mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
新增用户修改个人密码接口,解决首次登录修改密码可能的权限问题
This commit is contained in:
+19
@@ -1,7 +1,9 @@
|
||||
package com.cf.imes.module.system.controller.admin.user;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
@@ -10,6 +12,8 @@ import com.cf.imes.framework.excel.core.util.ExcelUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.framework.security.core.LoginUser;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.user.*;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.user.UserImportExcelVO;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.user.UserImportRespVO;
|
||||
@@ -45,11 +49,13 @@ import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PERSONAL_PASSWORD_PERMISSION_ERROR;
|
||||
|
||||
@Tag(name = "管理后台 - 用户")
|
||||
@RestController
|
||||
@@ -101,6 +107,19 @@ public class UserController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/update-personal-password")
|
||||
@Operation(summary = "重置用户个人密码")
|
||||
public CommonResult<Boolean> updateUserPersonalPassword(@Valid @RequestBody UserUpdatePasswordReqVO reqVO) {
|
||||
// 校验个人
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
if (ObjectUtil.isNotNull(loginUser) && Objects.equals(loginUser.getId(), reqVO.getId())) {
|
||||
userService.updateUserPassword(reqVO.getId(), reqVO.getPassword());
|
||||
} else {
|
||||
throw new ServiceException(PERSONAL_PASSWORD_PERMISSION_ERROR);
|
||||
}
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/reset-password")
|
||||
@Operation(summary = "忘记密码重置")
|
||||
@PermitAll
|
||||
|
||||
Reference in New Issue
Block a user