修复一直问题

master
胡锐 4 weeks ago
parent 06df546980
commit d54297aa8f
  1. 2
      cweb/src/main/java/com/hfkj/controller/UserController.java
  2. 2
      service/src/main/java/com/hfkj/service/user/BsUserService.java
  3. 9
      service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java

@ -112,7 +112,7 @@ public class UserController {
fileNames.add(childPath + "/" + fileName);
// 修改用户头像
user.setHeadImg(CommonSysConst.getSysConfig().getDomain()+"/"+fileNames.get(0));
user.setHeadImg(CommonSysConst.getSysConfig().getDomain()+"/filesystem/"+fileNames.get(0));
userService.updateInfo(user);
} catch (Exception e) {

@ -50,7 +50,7 @@ public interface BsUserService {
* 注销账户
* @param userId
*/
void delete(Long userId);
void delete(Long userId) throws Exception;
/**
* 查询详情

@ -163,12 +163,17 @@ public class BsUserServiceImpl implements BsUserService {
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW,rollbackFor= {RuntimeException.class})
public void delete(Long userId) {
public void delete(Long userId) throws Exception {
// 查询用户
BsUser user = getUser(userId);
if (user == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到用户");
}
if (UserStatusEnum.status0.getCode() == user.getStatus()) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到用户");
}
user.setHeadImg(null);
user.setName("账户已注销");
user.setStatus(UserStatusEnum.status0.getCode());
editData(user);
@ -185,6 +190,8 @@ public class BsUserServiceImpl implements BsUserService {
sonRel.setStatus(0);
userParentRelService.editData(sonRel);
}
// 更新session
userCenter.remove(userToken(user.getId()));
}
@Override

Loading…
Cancel
Save