mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-13 13:22:07 +08:00
问题修复:允许用户修改自身信息,但是不允许修改自身状态为禁用
This commit is contained in:
+9
-2
@@ -71,6 +71,7 @@ import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.e
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.USER_ME_ERROR;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.USER_OPERATE_SELF_STATUS_ERROR;
|
||||
|
||||
/**
|
||||
* 后台用户 Service 实现类
|
||||
@@ -156,8 +157,8 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateUser(UserSaveReqVO updateReqVO) {
|
||||
Long organId = updateReqVO.getOrganId() == null ? OrganContextHolder.getOrganId(): updateReqVO.getOrganId();
|
||||
// 不允许自身操作
|
||||
checkCurrentWhenOperate(updateReqVO.getId());
|
||||
// 不允许关闭自身状态
|
||||
checkCurrentWhenOperateStatus(updateReqVO.getId(), updateReqVO.getStatus());
|
||||
// 校验正确性
|
||||
validateUserForCreateOrUpdate(updateReqVO.getId(), updateReqVO.getUsername(),
|
||||
updateReqVO.getEmail(), updateReqVO.getDeptId(), updateReqVO.getPostIds(), null, organId);
|
||||
@@ -673,6 +674,12 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkCurrentWhenOperateStatus(Long userId, Integer status) {
|
||||
if (ObjectUtil.equal(userId, SecurityFrameworkUtils.getLoginUserId()) && Objects.equals(CommonStatusEnum.DISABLE.getStatus(), status)) {
|
||||
throw exception(USER_OPERATE_SELF_STATUS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> userTotal() {
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
|
||||
Reference in New Issue
Block a user