|
@@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.Collections;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -53,6 +54,13 @@ public class UserController extends BaseController {
|
|
|
// @WebControllerLog(description = "用户管理---获取用户列表")
|
|
|
@CheckCurrentUser()
|
|
|
public Result list(@RequestBody UserRequest param){
|
|
|
+ String jsonStr = redisTemplate.opsForValue().get(request.getHeader("token"));
|
|
|
+ JSONObject user = null;
|
|
|
+ if (StringUtil.isNotEmpty(jsonStr)) {
|
|
|
+ user = JSONObject.parseObject(jsonStr);
|
|
|
+ param.setRoleKey(user.getString("roleKey"));
|
|
|
+ }
|
|
|
+
|
|
|
PageInfo<UserResponse> page = new PageInfo<UserResponse>(userService.findAllBySearchKey(param));
|
|
|
return Result.success(page);
|
|
|
}
|
|
@@ -95,6 +103,10 @@ public class UserController extends BaseController {
|
|
|
throw new BaseRuntimeException(MsgCode.FAILURE_CODE_4005, MsgCode.FAILURE_MSG_4005);
|
|
|
}
|
|
|
|
|
|
+ if(param.getNickName().length() > 50){
|
|
|
+ throw new BaseRuntimeException(MsgCode.FAILURE_CODE_4012, MsgCode.FAILURE_MSG_4012);
|
|
|
+ }
|
|
|
+
|
|
|
int n = 0;
|
|
|
userEntity = userService.findByUserName(param.getUserName());
|
|
|
if(userEntity != null){
|
|
@@ -141,6 +153,10 @@ public class UserController extends BaseController {
|
|
|
throw new BaseRuntimeException(MsgCode.FAILURE_CODE_3001, MsgCode.FAILURE_MSG_3001);
|
|
|
}
|
|
|
|
|
|
+ if(param.getNickName().length() > 50){
|
|
|
+ throw new BaseRuntimeException(MsgCode.FAILURE_CODE_4012, MsgCode.FAILURE_MSG_4012);
|
|
|
+ }
|
|
|
+
|
|
|
if(StringUtil.isNotEmpty(param.getUserName())){
|
|
|
if(!RegexUtils.validateMobilePhone(param.getUserName())){
|
|
|
throw new BaseRuntimeException(MsgCode.FAILURE_CODE_4005, MsgCode.FAILURE_MSG_4005);
|
|
@@ -236,18 +252,22 @@ public class UserController extends BaseController {
|
|
|
if(StringUtil.isEmpty(getTokenUserName())){
|
|
|
throw new BaseRuntimeException(MsgCode.FAILURE_CODE_3004, MsgCode.FAILURE_MSG_3004);
|
|
|
}
|
|
|
+
|
|
|
+ if(StringUtil.isEmpty(param.getOldPassword())){
|
|
|
+ throw new BaseRuntimeException(MsgCode.FAILURE_CODE_4013, MsgCode.FAILURE_MSG_4013);
|
|
|
+ }
|
|
|
UserEntity userEntity = userService.findByUserName(getTokenUserName());
|
|
|
|
|
|
//对前端传的密码解密
|
|
|
if(param.getPassword().length() < 25){
|
|
|
- throw new BaseRuntimeException(MsgCode.FAILURE_CODE_4001, MsgCode.FAILURE_MSG_4001);
|
|
|
+ throw new BaseRuntimeException(MsgCode.FAILURE_CODE_4002, MsgCode.FAILURE_MSG_4002);
|
|
|
}
|
|
|
String password = Base64Converter.decode(Base64Converter.subText(param.getPassword()));
|
|
|
param.setPassword(password);
|
|
|
|
|
|
//对前端传的密码解密
|
|
|
if(param.getOldPassword().length() < 25){
|
|
|
- throw new BaseRuntimeException(MsgCode.FAILURE_CODE_4001, MsgCode.FAILURE_MSG_4001);
|
|
|
+ throw new BaseRuntimeException(MsgCode.FAILURE_CODE_4002, MsgCode.FAILURE_MSG_4002);
|
|
|
}
|
|
|
String oldPassword = Base64Converter.decode(Base64Converter.subText(param.getOldPassword()));
|
|
|
param.setOldPassword(oldPassword);
|
|
@@ -282,4 +302,5 @@ public class UserController extends BaseController {
|
|
|
return Result.success();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|