2021与蓝度共同重构项目,服务端
fix
zhanzhiqin
2022-06-02 b64d778d7ea64b2c6517b4ec34646be50a930151
ximon-admin/src/main/java/com/sandu/ximon/admin/service/AdminService.java
@@ -173,7 +173,7 @@
        if (admin == null) {
            throw new BusinessException("找不到管理员");
        }
        if(!AdministratorEnums.ADMIN.getCode().equals(SecurityUtils.getUserDetails().getAdministratorType())){
        if (!AdministratorEnums.ADMIN.getCode().equals(SecurityUtils.getUserDetails().getAdministratorType())) {
            throw new BusinessException("只有超级管理员才能删除用户");
        }
@@ -182,6 +182,9 @@
        //有用户必定有用户与角色的关系数据
        AdminRoleRelation one = adminRoleRelationService.getOne(Wrappers.lambdaQuery(AdminRoleRelation.class).eq(AdminRoleRelation::getAdminId, admin.getId()));
        Role role = SpringContextHolder.getBean(RoleService.class).getOne(Wrappers.lambdaQuery(Role.class).eq(Role::getId, one.getRoleId()));
        if (role == null) {
            throw new BusinessException("数据异常!");
        }
        if (role.getLevel().equals(RoleLevelStatus.SUPER.getCode())) {
            throw new BusinessException("超级管理员无法删除");
@@ -197,6 +200,15 @@
            }
        }
        /**
         * 删除管理员 日志记录开始
         */
        String content = "删除管理员:" + admin.getUsername() + "用户id:" + admin;
        StoreOperationRecordsUtils.storeOperationData(null, null, "删除管理员", content);
        /**
         * 删除管理员 日志记录结束
         */
        return flag;
    }