Browse Source

解决缺陷16991; 移除应用注册时的授权与菜单创建等功能。后端

LT32820A 1 week ago
parent
commit
e10dfe1fd2

+ 11 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/AppmanageController.java

@@ -201,6 +201,17 @@ public class AppmanageController {
         return Result.ok("检查通过");
     }
 
+    // 在编辑表单情况下检查应用名称是否重复
+    @GetMapping("/appNameIsEdit")
+    public Result<String> AppNameIsExistByEdit(String appid){
+        return Result.ok(appInfoService.AppNameIsExistByEdit(appid));
+    }
+
+//    @GetMapping("/appMenuIsEdit")
+//    public Result<String> AppMenuIsExistByEdit(String appid){
+//        return Result.ok(appInfoService.AppMenuIsExistByEdit(appid));
+//    }
+
     // 应用注册流程被撤销 后续处理(微服务调用)
 //    @GetMapping("/afterAppCheckPass")
 //    public <T> void afterUnsendAppRegisterFlow(@RequestParam("workID") long workID){

+ 4 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/AppCustomMapper.java

@@ -113,5 +113,9 @@ public interface AppCustomMapper {
             "SELECT 1 FROM wf_empworks where workid = (SELECT OID FROM app_detail_info_workflow WHERE name = #{appName})"})
     Integer checkAppNameIsExist(@Param("appName") String appName);
 
+    @Select("SELECT name FROM app_base_info WHERE id = #{appid}")
+    String queryAppNameByAppid(@Param("appid") String appid);
 
+//    @Select("SELECT menu_info FROM app_base_info WHERE id = #{appid}")
+//    String queryMenuInfoByAppid(@Param("appid") String appid);
 }

+ 4 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/AppmanageService.java

@@ -69,5 +69,9 @@ public interface AppmanageService  {
 
     // 查询应用名称是否已经存在流程里或者应用信息表里
     Boolean AppNameIsExist(String appName);
+
+    String AppNameIsExistByEdit(String appid);
+
+//    String AppMenuIsExistByEdit(String addid);
 }
 

+ 47 - 39
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/AppmanageServiceImpl.java

@@ -52,12 +52,12 @@ public class AppmanageServiceImpl implements AppmanageService {
     private ISysUserRoleService sysUserRoleService;
 
     // 给角色授权用
-    @Autowired
-    private ISysRolePermissionService sysRolePermissionService;
-
-    // 给用户授权用
-    @Autowired
-    private ISysUserPermissionService sysUserPermissionService;
+//    @Autowired
+//    private ISysRolePermissionService sysRolePermissionService;
+//
+//    // 给用户授权用
+//    @Autowired
+//    private ISysUserPermissionService sysUserPermissionService;
 
     // 添加菜单用
     @Autowired
@@ -682,24 +682,24 @@ public class AppmanageServiceImpl implements AppmanageService {
                 }
 
                 // 创建该应用的一级菜单
-                SysPermission hassysPermission = customMapper.queryUrlByUrl(baseInfoInFlow.getMenuInfo());
-                if (hassysPermission == null){
-                    SysPermission sysPermission = new SysPermission();
-                    sysPermission.setName(baseInfoInFlow.getName());
-                    sysPermission.setAppId(appid);
-                    sysPermission.setUrl(baseInfoInFlow.getMenuInfo());
-                    // 设置组件(即 菜单路径去掉第一个 "/")
-                    String component = sysPermission.getUrl().replaceFirst("^/", "");
-                    sysPermission.setComponent(component);
-                    sysPermission.setMenuType(0);
-                    sysPermission.setRoute(true);
-                    sysPermissionService.addPermission(sysPermission);
-                    AfterCheckSaveUserPermission(baseInfoInFlow, sysPermission.getId());
-//                    sysRolePermissionService.saveRolePermission(roleid, sysPermission.getId());
-                }else {
-                    AfterCheckSaveUserPermission(baseInfoInFlow, hassysPermission.getId());
-//                    sysRolePermissionService.saveRolePermission(roleid, hassysPermission.getId());
-                }
+//                SysPermission hassysPermission = customMapper.queryUrlByUrl(baseInfoInFlow.getMenuInfo());
+//                if (hassysPermission == null){
+//                    SysPermission sysPermission = new SysPermission();
+//                    sysPermission.setName(baseInfoInFlow.getName());
+//                    sysPermission.setAppId(appid);
+//                    sysPermission.setUrl(baseInfoInFlow.getMenuInfo());
+//                    // 设置组件(即 菜单路径去掉第一个 "/")
+//                    String component = sysPermission.getUrl().replaceFirst("^/", "");
+//                    sysPermission.setComponent(component);
+//                    sysPermission.setMenuType(0);
+//                    sysPermission.setRoute(true);
+//                    sysPermissionService.addPermission(sysPermission);
+//                    AfterCheckSaveUserPermission(baseInfoInFlow, sysPermission.getId());
+////                    sysRolePermissionService.saveRolePermission(roleid, sysPermission.getId());
+//                }else {
+//                    AfterCheckSaveUserPermission(baseInfoInFlow, hassysPermission.getId());
+////                    sysRolePermissionService.saveRolePermission(roleid, hassysPermission.getId());
+//                }
             }else {  // 简易注册需执行的操作
                 appid = baseInfoInFlow.getId();
             }
@@ -730,21 +730,21 @@ public class AppmanageServiceImpl implements AppmanageService {
         sysBaseApi.sendTemplateAnnouncement(message);
     }
 
-    // 授予应用相关用户(管理员 开发负责人 运维负责人等)访问应用一级菜单权限
-    private void AfterCheckSaveUserPermission(AppBaseInfo appBaseInfo, String permissionid){
-        sysUserPermissionService.save(getSysUserPermission(appBaseInfo.getAdmin(), permissionid));
-        if (!Objects.equals(appBaseInfo.getBusinessUser(), "")){} sysUserPermissionService.save(getSysUserPermission(appBaseInfo.getBusinessUser(), permissionid));
-        if (!Objects.equals(appBaseInfo.getDevelopUser(), "")) sysUserPermissionService.save(getSysUserPermission(appBaseInfo.getDevelopUser(), permissionid));
-        if (!Objects.equals(appBaseInfo.getRequirementUser(), "")) sysUserPermissionService.save(getSysUserPermission(appBaseInfo.getBusinessUser(), permissionid));
-    }
-
-    private SysUserPermission getSysUserPermission(String username, String permissionId) {
-        String userId = customMapper.queryUserIdByUsername(username);
-        SysUserPermission sysUserPermission = new SysUserPermission();
-        sysUserPermission.setUserId(userId);
-        sysUserPermission.setPermissionId(permissionId);
-        return sysUserPermission;
-    }
+//    // 授予应用相关用户(管理员 开发负责人 运维负责人等)访问应用一级菜单权限
+//    private void AfterCheckSaveUserPermission(AppBaseInfo appBaseInfo, String permissionid){
+//        sysUserPermissionService.save(getSysUserPermission(appBaseInfo.getAdmin(), permissionid));
+//        if (!Objects.equals(appBaseInfo.getBusinessUser(), "")){} sysUserPermissionService.save(getSysUserPermission(appBaseInfo.getBusinessUser(), permissionid));
+//        if (!Objects.equals(appBaseInfo.getDevelopUser(), "")) sysUserPermissionService.save(getSysUserPermission(appBaseInfo.getDevelopUser(), permissionid));
+//        if (!Objects.equals(appBaseInfo.getRequirementUser(), "")) sysUserPermissionService.save(getSysUserPermission(appBaseInfo.getBusinessUser(), permissionid));
+//    }
+
+//    private SysUserPermission getSysUserPermission(String username, String permissionId) {
+//        String userId = customMapper.queryUserIdByUsername(username);
+//        SysUserPermission sysUserPermission = new SysUserPermission();
+//        sysUserPermission.setUserId(userId);
+//        sysUserPermission.setPermissionId(permissionId);
+//        return sysUserPermission;
+//    }
 
     // 应用注册 撤销后续处理(删除插入的数据)
     @Override
@@ -765,4 +765,12 @@ public class AppmanageServiceImpl implements AppmanageService {
         Integer i = customMapper.checkAppNameIsExist(appName);
         return i!= null;
     }
+
+    public  String AppNameIsExistByEdit(String appid){
+        return customMapper.queryAppNameByAppid(appid);
+    }
+
+//    public String AppMenuIsExistByEdit(String appid){
+//        return customMapper.queryMenuInfoByAppid(appid);
+//    }
 }