|
@@ -85,6 +85,14 @@ public class AdminController {
|
|
|
|
|
|
|
|
@PostMapping("/post")
|
|
@PostMapping("/post")
|
|
|
public Result<String> saveAdmin(@RequestBody @Validated Admin admin) throws Exception {
|
|
public Result<String> saveAdmin(@RequestBody @Validated Admin admin) throws Exception {
|
|
|
|
|
+ Long adminId = StpUserUtil.getLoginIdAsLong();
|
|
|
|
|
+ Admin exist = adminService.getById(adminId);
|
|
|
|
|
+ if (exist == null) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("账号不存在,请重新登录");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (exist.getCategory() != Admin.Category.superoot) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("无超级管理员权限");
|
|
|
|
|
+ }
|
|
|
if (StringUtils.isNotBlank(admin.getPassWord())) {
|
|
if (StringUtils.isNotBlank(admin.getPassWord())) {
|
|
|
admin.setPassWord(Codec.DoDigest.custom().setAlgorithm(Codec.DoDigest.Algorithm.SHA256).setStringData(admin.getPassWord()).toBase64String());
|
|
admin.setPassWord(Codec.DoDigest.custom().setAlgorithm(Codec.DoDigest.Algorithm.SHA256).setStringData(admin.getPassWord()).toBase64String());
|
|
|
}
|
|
}
|