|
@@ -68,7 +68,7 @@ public class UserApi {
|
|
|
} else {
|
|
|
userCriteria.setRootOrgId(accessUser.getRootOrgId());
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return new ResponseEntity(HttpStatus.NOT_FOUND);
|
|
|
}
|
|
|
return new ResponseEntity(userService.findAll(userCriteria,
|
|
@@ -105,7 +105,7 @@ public class UserApi {
|
|
|
} else {
|
|
|
user.setRootOrgId(user.getOrgId());
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return new ResponseEntity(HttpStatus.NOT_FOUND);
|
|
|
}
|
|
|
try {
|
|
@@ -174,22 +174,23 @@ public class UserApi {
|
|
|
@ApiOperation(value = "修改用户密码", notes = "修改密码")
|
|
|
@PutMapping("/stu-password")
|
|
|
@Uac(roles = {RoleMeta.STUDENT}, policy = UacPolicy.IN)
|
|
|
- public ResponseEntity<String> stuPassword(@RequestParam("oldPassword") String oldPassword,
|
|
|
- @RequestParam("newPassword") String newPassword,
|
|
|
- HttpServletRequest request) {
|
|
|
+ public ResponseEntity stuPassword(@RequestParam("oldPassword") String oldPassword,
|
|
|
+ @RequestParam("newPassword") String newPassword,
|
|
|
+ HttpServletRequest request) {
|
|
|
AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
|
|
|
// String oldPassword = params.get("oldPassword");
|
|
|
// String newPassword = params.get("newPassword");
|
|
|
if (StringUtils.isEmpty(oldPassword) || StringUtils.isEmpty(newPassword)) {
|
|
|
- return new ResponseEntity<>("愿密码和新密码不能为空", HttpStatus.BAD_REQUEST);
|
|
|
+ return new ResponseEntity(new ErrorMsg("原密码不正确"), HttpStatus.BAD_REQUEST);
|
|
|
} else {
|
|
|
Long userId = accessUser.getUserId();
|
|
|
User user = userRepo.findOne(userId);
|
|
|
if (!oldPassword.equals(user.getPassword())) {
|
|
|
- return new ResponseEntity<>("愿密码不正确", HttpStatus.BAD_REQUEST);
|
|
|
+
|
|
|
+ return new ResponseEntity(new ErrorMsg("原密码不正确"), HttpStatus.BAD_REQUEST);
|
|
|
}
|
|
|
userRepo.updatePasswordById(userId, newPassword);
|
|
|
- return new ResponseEntity<>(HttpStatus.OK);
|
|
|
+ return new ResponseEntity(HttpStatus.OK);
|
|
|
}
|
|
|
}
|
|
|
|