Commit 230fcb07 by guojuxing

新增/编辑管理员添加标志位,用来操作密码

parent d3e69864
......@@ -30,7 +30,7 @@ public class UserController {
@RequestMapping("/save-or-update-user")
public RestResponse editUser(@Validated({ UserDTO.UserQoValid.class }) UserDTO userDTO) {
userDTO.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
String password = UserPasswordUtils.validPassword(userDTO.getPasswordType(), userDTO.getPassword());
String password = UserPasswordUtils.validPassword(userDTO.getPasswordType(), userDTO.getPassword(), userDTO.getOperPasswordType());
userDTO.setPassword(UserPasswordUtils.getEncryptPassword(password));
ServiceResponse userResult;
//普通用户
......
......@@ -45,16 +45,22 @@ public class UserPasswordUtils {
* @param password
* @return
*/
public static String validPassword(int passwordType, String password) {
public static String validPassword(int passwordType, String password, Integer operPasswordType) {
//加密
if (UserConstants.CREATE_AUTO == passwordType) {
//自动随机生成
return createPasswordAuto(8);
} else {
if (StringUtils.isNotBlank(password)) {
return password;
} else {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "密码不能为空");
if (operPasswordType == null) {
operPasswordType = 2;
}
if (operPasswordType.intValue() != 1) {
//如果不等于1,则需要验证密码
if (StringUtils.isNotBlank(password)) {
return password;
} else {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "密码不能为空");
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment