瀏覽代碼

Merge branch 'mazq-0927-org-model-fix' into 'develop'

feature(org-api依赖排除): org-api依赖排除

See merge request dcuc-tjdsj/auth-back!113
马志强 3 年之前
父節點
當前提交
a6c362bbbb
共有 21 個文件被更改,包括 541 次插入1380 次删除
  1. 7 2
      README.md
  2. 4 15
      pom.xml
  3. 10 102
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/app/AppController.java
  4. 4 4
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/approval/ApprovalController.java
  5. 4 4
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/audit/AuthAuditController.java
  6. 4 4
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/audit/MgeAuditRptController.java
  7. 2 10
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/ApplicationController.java
  8. 63 111
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/OrgQuotaAuthController.java
  9. 11 12
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/RoleRptController.java
  10. 0 239
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/org/GovernmentInfoController.java
  11. 0 577
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/org/OrgInfoController.java
  12. 37 37
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/org/vo/GovOrgVo.java
  13. 20 20
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/org/vo/MergersVo.java
  14. 103 103
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/org/vo/OrgVo.java
  15. 20 20
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/org/vo/SortVo.java
  16. 1 1
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/statisics/UserStatisicsController.java
  17. 0 52
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/statisics/vo/OrgTreeNodeVo.java
  18. 191 21
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/sub/AuthOrgInfoController.java
  19. 19 45
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/sub/vo/org/AuthOrgVo.java
  20. 40 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/sub/vo/org/OrgTreeNodeVo.java
  21. 1 1
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/sub/vo/org/TreeReqVo.java

+ 7 - 2
README.md

@@ -25,6 +25,11 @@
   - 权限自助模块开发
   - 权限自助模块开发
   - 红白名单模块开发 
   - 红白名单模块开发 
 ### 2.4.1
 ### 2.4.1
-  - 主客体分离
+  - 主客体分离人员数据独立
   - 管理员模块代码规范
   - 管理员模块代码规范
-  - 服务授权代码规范
+  - 服务授权代码规范
+### 2.4.2
+  - 主客体分离机构数据独立
+  - 机构树查询接口修改
+  - 内存机构树功能新增
+  - 修改调用app-service facade后applyInfo.orgId()改为applyInfo.orgCode()

+ 4 - 15
pom.xml

@@ -5,14 +5,14 @@
     <modelVersion>4.0.0</modelVersion>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.dragoninfo</groupId>
     <groupId>com.dragoninfo</groupId>
     <artifactId>dcuc-auth-back</artifactId>
     <artifactId>dcuc-auth-back</artifactId>
-    <version>2.4.1-tjdsj-SNAPSHOT</version>
+    <version>2.4.2-tjdsj-SNAPSHOT</version>
 
 
     <properties>
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
         <maven.compiler.target>1.8</maven.compiler.target>
         <!--revisions需写死,用于标识打包的版本号,不可删除-->
         <!--revisions需写死,用于标识打包的版本号,不可删除-->
-        <revision>2.4.1-tjdsj-SNAPSHOT</revision>
+        <revision>2.4.2-tjdsj-SNAPSHOT</revision>
         <duceap.version>2.1.0-SNAPSHOT</duceap.version>
         <duceap.version>2.1.0-SNAPSHOT</duceap.version>
         <lombok.version>1.18.2</lombok.version>
         <lombok.version>1.18.2</lombok.version>
         <jwt.version>3.10.3</jwt.version>
         <jwt.version>3.10.3</jwt.version>
@@ -40,11 +40,6 @@
             <optional>true</optional>
             <optional>true</optional>
         </dependency>
         </dependency>
 
 
-<!--        <dependency>-->
-<!--            <groupId>com.dragoninfo</groupId>-->
-<!--            <artifactId>dcuc-user-api</artifactId>-->
-<!--            <version>2.0.4-tjdsj-SNAPSHOT</version>-->
-<!--        </dependency>-->
         <!--监控配置-->
         <!--监控配置-->
         <dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <groupId>org.springframework.boot</groupId>
@@ -125,7 +120,7 @@
         <dependency>
         <dependency>
             <groupId>com.dragoninfo</groupId>
             <groupId>com.dragoninfo</groupId>
             <artifactId>dcuc-auth-api</artifactId>
             <artifactId>dcuc-auth-api</artifactId>
-            <version>2.4.1-tjdsj-SNAPSHOT</version>
+            <version>2.4.2-tjdsj-SNAPSHOT</version>
         </dependency>
         </dependency>
 
 
         <dependency>
         <dependency>
@@ -137,13 +132,7 @@
         <dependency>
         <dependency>
             <groupId>com.dragoninfo</groupId>
             <groupId>com.dragoninfo</groupId>
             <artifactId>dcuc-app-api</artifactId>
             <artifactId>dcuc-app-api</artifactId>
-            <version>2.2.3-tjdsj-SNAPSHOT</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.dragoninfo</groupId>
-            <artifactId>dcuc-org-api</artifactId>
-            <version>2.0.3-tjdsj-SNAPSHOT</version>
+            <version>2.2.4-tjdsj-SNAPSHOT</version>
         </dependency>
         </dependency>
 
 
         <dependency>
         <dependency>

+ 10 - 102
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/app/AppController.java

@@ -5,30 +5,21 @@ import cn.hutool.core.util.StrUtil;
 import com.alibaba.nacos.client.naming.utils.CollectionUtils;
 import com.alibaba.nacos.client.naming.utils.CollectionUtils;
 import com.dragoninfo.dcuc.app.dto.ApplyInfoDTO;
 import com.dragoninfo.dcuc.app.dto.ApplyInfoDTO;
 import com.dragoninfo.dcuc.app.entity.ApplyInfo;
 import com.dragoninfo.dcuc.app.entity.ApplyInfo;
-import com.dragoninfo.dcuc.app.entity.ManufacturerInfo;
 import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
 import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
 import com.dragoninfo.dcuc.app.facade.IManufacturerInfoFacade;
 import com.dragoninfo.dcuc.app.facade.IManufacturerInfoFacade;
 import com.dragoninfo.dcuc.auth.auth.vo.ApplicationInfoVO;
 import com.dragoninfo.dcuc.auth.auth.vo.ApplicationInfoVO;
 import com.dragoninfo.dcuc.auth.power.facade.IApplicationInfoFacade;
 import com.dragoninfo.dcuc.auth.power.facade.IApplicationInfoFacade;
-import com.dragoninfo.dcuc.auth.sub.facade.IAuthUserInfoFacade;
+import com.dragoninfo.dcuc.auth.sub.dto.AuthOrgDTO;
+import com.dragoninfo.dcuc.auth.sub.facade.IAuthOrgInfoFacade;
 import com.dragoninfo.dcuc.authweb.business.MtAuthBusiness;
 import com.dragoninfo.dcuc.authweb.business.MtAuthBusiness;
-import com.dragoninfo.dcuc.authweb.common.SysConstants;
 import com.dragoninfo.dcuc.authweb.restcontroller.app.vo.AppVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.app.vo.AppVo;
 import com.dragoninfo.dcuc.duceap.facade.IDuceapUploadFacade;
 import com.dragoninfo.dcuc.duceap.facade.IDuceapUploadFacade;
-import com.dragoninfo.dcuc.org.entity.OrgInfo;
-import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
-import com.dragoninfo.dcuc.org.vo.OrgTreeNode;
-import com.dragoninfo.duceap.commons.util.server.OrgInfoUtil;
 import com.dragoninfo.duceap.core.enums.ResultEnum;
 import com.dragoninfo.duceap.core.enums.ResultEnum;
 import com.dragoninfo.duceap.core.response.Result;
 import com.dragoninfo.duceap.core.response.Result;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
-import com.dragonsoft.duceap.base.entity.security.SecurityUser;
 import com.dragonsoft.duceap.base.exception.ApplicationException;
 import com.dragonsoft.duceap.base.exception.ApplicationException;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
-import com.dragonsoft.duceap.commons.util.tree.SimpleTreeNodeItemResolver;
-import com.dragonsoft.duceap.commons.util.tree.TreeNodeUtils;
-import com.dragonsoft.duceap.core.context.ContextUtils;
 import com.dragonsoft.duceap.core.search.Searchable;
 import com.dragonsoft.duceap.core.search.Searchable;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParam;
@@ -53,16 +44,13 @@ public class AppController {
 
 
     @Autowired
     @Autowired
     private IApplyInfoFacade applyInfoFacade;
     private IApplyInfoFacade applyInfoFacade;
+
     @Autowired
     @Autowired
-    private MtAuthBusiness mtAuthBusiness;
-    @Autowired
-    private IAuthUserInfoFacade authUserInfoFacade;
-    @Autowired
-    private IOrgInfoFacade orgInfoFacade;
+    private IAuthOrgInfoFacade authOrgInfoFacade;
+
     @Autowired
     @Autowired
     private IDuceapUploadFacade uploadFacade;
     private IDuceapUploadFacade uploadFacade;
-    @Autowired
-    private IManufacturerInfoFacade manufacturerInfoFacade;
+
     @Autowired
     @Autowired
     private IApplicationInfoFacade applicationInfoFacade;
     private IApplicationInfoFacade applicationInfoFacade;
 
 
@@ -78,18 +66,6 @@ public class AppController {
     @ApiImplicitParam(name = "searchable", value = "查询条件(applyName:应用名称,like;managerOrgCode:应用系统事权单位代码,like;applyStatus:应用在用标识(0:启用 1:禁用);=;)")
     @ApiImplicitParam(name = "searchable", value = "查询条件(applyName:应用名称,like;managerOrgCode:应用系统事权单位代码,like;applyStatus:应用在用标识(0:启用 1:禁用);=;)")
     @PostMapping(value = "apps")
     @PostMapping(value = "apps")
     public Result<List<ApplyInfo>> applyPage(Searchable searchable) {
     public Result<List<ApplyInfo>> applyPage(Searchable searchable) {
-//        AuthUserDTO userInfo = authUserInfoFacade.get(ContextUtils.getUserInfo().getId());
-//        String userType = userInfo.getUserType();
-//        String company = userInfo.getCompany();
-
-        //TODO
-        //权限中心同步的应用厂商非必填
-        //
-        // 外部人员只能管理自己所属厂商下的应用
-//        if (UserTypeEnum.EXTERNAL.getValue().equals(userType)) {
-//            searchable.addSearchFilter("manufacturerId", SearchOperator.eq, company);
-//        }
-
         SearchDTO searchDTO = searchable.toSearchDTO();
         SearchDTO searchDTO = searchable.toSearchDTO();
         Page<ApplyInfo> page = applyInfoFacade.applyInfoPage(searchDTO);
         Page<ApplyInfo> page = applyInfoFacade.applyInfoPage(searchDTO);
         return Result.success(page.getTotalElements(), page.getContent());
         return Result.success(page.getTotalElements(), page.getContent());
@@ -126,18 +102,6 @@ public class AppController {
             if (!ResponseStatus.SUCCESS_CODE.equals(responseStatus.getStatusCode())) {
             if (!ResponseStatus.SUCCESS_CODE.equals(responseStatus.getStatusCode())) {
                 return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), responseStatus.getMessage());
                 return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), responseStatus.getMessage());
             }
             }
-            String orgId = applyInfoDTO.getOrgId();
-            if(StringUtils.isNotBlank(orgId)) {
-                applyInfoDTO.setOrgName(orgInfoFacade.detail(orgId).getFullName());
-            }
-            String orgCode = appVo.getOrgCode();
-            if(StringUtils.isNotBlank(orgCode)) {
-                OrgInfo orgInfo = orgInfoFacade.getOrgInfoByCode(orgCode);
-                if(null != orgInfo) {
-                    applyInfoDTO.setOrgName(orgInfo.getFullName());
-                    applyInfoDTO.setOrgId(orgInfo.getId());
-                }
-            }
             applyInfoFacade.saveAppIy(applyInfoDTO);
             applyInfoFacade.saveAppIy(applyInfoDTO);
         } catch (Exception e) {
         } catch (Exception e) {
             log.error("save app", e);
             log.error("save app", e);
@@ -153,16 +117,7 @@ public class AppController {
     public Result<Object> del(@PathVariable("id") String id) {
     public Result<Object> del(@PathVariable("id") String id) {
         //TODO
         //TODO
         //权限中心对施工人员和厂商未做管理
         //权限中心对施工人员和厂商未做管理
-//        try {
-//            boolean flag = authUserInfoFacade.extUsersByAppIdJudge(id);
-//            if (flag) {
-//                return Result.fail("300", "该应用下存在施工人员,不能删除");
-//            }
-            applyInfoFacade.del(id);
-//        } catch (Exception e) {
-//            log.error("delete app error", e);
-//            throw new ApplicationException(300, "删除失败", e);
-//        }
+        applyInfoFacade.del(id);
         return Result.success("删除成功");
         return Result.success("删除成功");
     }
     }
 
 
@@ -180,9 +135,9 @@ public class AppController {
         //查询应用信息
         //查询应用信息
         ApplyInfo applyInfo = applyInfoFacade.applyDetail(id);
         ApplyInfo applyInfo = applyInfoFacade.applyDetail(id);
         //存入机构信息信息
         //存入机构信息信息
-        String orgId = applyInfo.getOrgId();
-        if(StringUtils.isNotBlank(orgId)) {
-            applyInfo.setOrgName(orgInfoFacade.detail(orgId).getFullName());
+        String orgCode = applyInfo.getOrgCode();
+        if(StringUtils.isNotBlank(orgCode)) {
+            applyInfo.setOrgName(authOrgInfoFacade.getOrgByCode(orgCode).getFullName());
         }
         }
         AppVo appVo = new AppVo();
         AppVo appVo = new AppVo();
         BeanUtil.copyProperties(applyInfo, appVo);
         BeanUtil.copyProperties(applyInfo, appVo);
@@ -228,53 +183,6 @@ public class AppController {
         return Result.success(list);
         return Result.success(list);
     }
     }
 
 
-    @ApiOperation(value = "外部人员机构树")
-    @PostMapping(value = "app/externalTree")
-    public Result externalTree() {
-        List<Map<String, Object>> result = new ArrayList<>();
-        SecurityUser user = (SecurityUser) ContextUtils.getUserInfo();
-        //用户范围
-        String userMt = mtAuthBusiness.getMtAuth(user.getId(), SysConstants.MT_APP);
-        if (StringUtils.isEmpty(userMt)) {
-            return Result.success(result);
-        }
-        //所有应用
-        List<ApplyInfo> applyInfoList = applyInfoFacade.getAllList();
-        //范围内加过的厂商
-        Set<String> menuSet = new HashSet<>();
-        List<String> applyIds = new ArrayList<>();
-        for (ApplyInfo applyInfo : applyInfoList) {
-            applyIds.add(applyInfo.getOrgId());
-        }
-        Map<String, OrgTreeNode> orgTreeNodes = orgInfoFacade.getOrgTreeNodeByList(applyIds);
-        for (ApplyInfo applyInfo : applyInfoList) {
-            OrgTreeNode node = orgTreeNodes.get(applyInfo.getOrgId());
-            //应用所属机构在范围内
-            if (node != null && OrgInfoUtil.isHaveAuth(node.getValue(), node.getPath(), userMt)) {
-                Map<String, Object> appMap = new HashMap<>();
-                appMap.put("id", applyInfo.getId());
-                appMap.put("name", applyInfo.getApplyName());
-                appMap.put("pid", applyInfo.getManufacturerId());
-                appMap.put("isApply", true);
-                result.add(appMap);
-                //未添加的厂商
-                if (!menuSet.contains(applyInfo.getManufacturerId())) {
-                    ManufacturerInfo manu = manufacturerInfoFacade.manufacturerInfoDetail(applyInfo.getManufacturerId());
-                    if (manu == null) {
-                        continue;
-                    }
-                    menuSet.add(manu.getId());
-                    Map<String, Object> map = new HashMap<>();
-                    map.put("id", manu.getId());
-                    map.put("name", manu.getManufacturerName());
-                    map.put("isApply", false);
-                    result.add(map);
-                }
-            }
-        }
-        result = TreeNodeUtils.generateTree(result, new SimpleTreeNodeItemResolver("id", "pid"));
-        return Result.success(result);
-    }
 
 
     /**
     /**
      * 根据机构Id获取应用信息列表
      * 根据机构Id获取应用信息列表

+ 4 - 4
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/approval/ApprovalController.java

@@ -4,11 +4,11 @@ package com.dragoninfo.dcuc.authweb.restcontroller.approval;
 import com.dragoninfo.dcuc.auth.auth.dto.ApprovalDto;
 import com.dragoninfo.dcuc.auth.auth.dto.ApprovalDto;
 import com.dragoninfo.dcuc.auth.auth.entity.FuncApproval;
 import com.dragoninfo.dcuc.auth.auth.entity.FuncApproval;
 import com.dragoninfo.dcuc.auth.auth.facade.IApprovalFacade;
 import com.dragoninfo.dcuc.auth.auth.facade.IApprovalFacade;
+import com.dragoninfo.dcuc.auth.sub.dto.AuthOrgDTO;
 import com.dragoninfo.dcuc.auth.sub.dto.AuthUserDTO;
 import com.dragoninfo.dcuc.auth.sub.dto.AuthUserDTO;
+import com.dragoninfo.dcuc.auth.sub.facade.IAuthOrgInfoFacade;
 import com.dragoninfo.dcuc.auth.sub.facade.IAuthUserInfoFacade;
 import com.dragoninfo.dcuc.auth.sub.facade.IAuthUserInfoFacade;
 import com.dragoninfo.dcuc.authweb.restcontroller.approval.vo.FuncApprovalVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.approval.vo.FuncApprovalVo;
-import com.dragoninfo.dcuc.org.entity.OrgInfo;
-import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
 import com.dragoninfo.duceap.core.response.Result;
 import com.dragoninfo.duceap.core.response.Result;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
@@ -30,7 +30,7 @@ public class ApprovalController {
     @Autowired
     @Autowired
     private IApprovalFacade iApprovalFacade;
     private IApprovalFacade iApprovalFacade;
     @Autowired
     @Autowired
-    private IOrgInfoFacade iOrgInfoFacade;
+    private IAuthOrgInfoFacade authOrgInfoFacade;
     @Autowired
     @Autowired
     private IAuthUserInfoFacade authUserInfoFacade;
     private IAuthUserInfoFacade authUserInfoFacade;
 
 
@@ -97,7 +97,7 @@ public class ApprovalController {
     }
     }
 
 
     private FuncApproval setValues(FuncApproval approval) {
     private FuncApproval setValues(FuncApproval approval) {
-        OrgInfo orgInfo = iOrgInfoFacade.detail(approval.getProposerOrg());
+        AuthOrgDTO orgInfo = authOrgInfoFacade.get(approval.getProposerOrg());
         if (orgInfo != null) {
         if (orgInfo != null) {
             approval.setOrgName(orgInfo.getFullName());
             approval.setOrgName(orgInfo.getFullName());
         }
         }

+ 4 - 4
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/audit/AuthAuditController.java

@@ -12,11 +12,11 @@ import com.dragoninfo.dcuc.auth.auth.facade.IOrgQuotaAuthLogFacade;
 import com.dragoninfo.dcuc.auth.auth.facade.IRoleInfoFacade;
 import com.dragoninfo.dcuc.auth.auth.facade.IRoleInfoFacade;
 import com.dragoninfo.dcuc.auth.auth.facade.IStaffAssignAuthInfoLogFacade;
 import com.dragoninfo.dcuc.auth.auth.facade.IStaffAssignAuthInfoLogFacade;
 import com.dragoninfo.dcuc.auth.sub.dto.AuthUserDTO;
 import com.dragoninfo.dcuc.auth.sub.dto.AuthUserDTO;
+import com.dragoninfo.dcuc.auth.sub.facade.IAuthOrgInfoFacade;
 import com.dragoninfo.dcuc.auth.sub.facade.IAuthUserInfoFacade;
 import com.dragoninfo.dcuc.auth.sub.facade.IAuthUserInfoFacade;
 import com.dragoninfo.dcuc.authweb.restcontroller.audit.vo.AuthAuditDetailVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.audit.vo.AuthAuditDetailVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.audit.vo.AuthOperateVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.audit.vo.AuthOperateVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.audit.vo.RoleInfoVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.audit.vo.RoleInfoVo;
-import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
 import com.dragoninfo.duceap.core.response.Result;
 import com.dragoninfo.duceap.core.response.Result;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
 import com.dragonsoft.duceap.core.search.Searchable;
 import com.dragonsoft.duceap.core.search.Searchable;
@@ -47,7 +47,7 @@ public class AuthAuditController {
     IAuthUserInfoFacade userInfoFacade;
     IAuthUserInfoFacade userInfoFacade;
 
 
     @Autowired
     @Autowired
-    IOrgInfoFacade orgInfoFacade;
+    IAuthOrgInfoFacade authOrgInfoFacade;
 
 
     @Autowired
     @Autowired
     IOrgQuotaAuthLogFacade orgQuotaAuthLogFacade;
     IOrgQuotaAuthLogFacade orgQuotaAuthLogFacade;
@@ -155,8 +155,8 @@ public class AuthAuditController {
             AuthUserDTO managerInfo = userInfoFacade.get(orgQuotaAuthLog.getManagerId());
             AuthUserDTO managerInfo = userInfoFacade.get(orgQuotaAuthLog.getManagerId());
             String managerName = managerInfo.getName();
             String managerName = managerInfo.getName();
             String managerOrg = managerInfo.getOrgName();
             String managerOrg = managerInfo.getOrgName();
-            if (null != orgInfoFacade.detail(orgQuotaAuthLog.getTargetOrgId())) {
-                logMap.put("targetOrgName", orgInfoFacade.detail(orgQuotaAuthLog.getTargetOrgId()).getFullName());
+            if (null != authOrgInfoFacade.get(orgQuotaAuthLog.getTargetOrgId())) {
+                logMap.put("targetOrgName", authOrgInfoFacade.get(orgQuotaAuthLog.getTargetOrgId()).getFullName());
             } else {
             } else {
                 logMap.put("targetOrgName", "机构已删除");
                 logMap.put("targetOrgName", "机构已删除");
             }
             }

+ 4 - 4
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/audit/MgeAuditRptController.java

@@ -3,8 +3,8 @@ package com.dragoninfo.dcuc.authweb.restcontroller.audit;
 import com.dragoninfo.dcuc.auth.admin.dto.MgeLogDTO;
 import com.dragoninfo.dcuc.auth.admin.dto.MgeLogDTO;
 import com.dragoninfo.dcuc.auth.admin.enumresource.AdminObjectTypeEnum;
 import com.dragoninfo.dcuc.auth.admin.enumresource.AdminObjectTypeEnum;
 import com.dragoninfo.dcuc.auth.admin.facade.IMgeLogFacade;
 import com.dragoninfo.dcuc.auth.admin.facade.IMgeLogFacade;
+import com.dragoninfo.dcuc.auth.sub.facade.IAuthOrgInfoFacade;
 import com.dragoninfo.dcuc.authweb.restcontroller.audit.vo.MgeLogVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.audit.vo.MgeLogVo;
-import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
 import com.dragoninfo.duceap.core.response.Result;
 import com.dragoninfo.duceap.core.response.Result;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
@@ -28,7 +28,7 @@ public class MgeAuditRptController {
     @Autowired
     @Autowired
     private IMgeLogFacade iMgeLogFacade;
     private IMgeLogFacade iMgeLogFacade;
     @Autowired
     @Autowired
-    private IOrgInfoFacade iOrgInfoFacade;
+    private IAuthOrgInfoFacade authOrgInfoFacade;
 
 
     /**
     /**
      * 获取授权范围日志
      * 获取授权范围日志
@@ -74,7 +74,7 @@ public class MgeAuditRptController {
             ids = StringUtils.isEmpty(ids) ? "" : ids;
             ids = StringUtils.isEmpty(ids) ? "" : ids;
             if (!AdminObjectTypeEnum.GLY.getValue().equals(type) && !AdminObjectTypeEnum.PTCD.getValue().equals(type)) {
             if (!AdminObjectTypeEnum.GLY.getValue().equals(type) && !AdminObjectTypeEnum.PTCD.getValue().equals(type)) {
                 if (AdminObjectTypeEnum.JGGL.getValue().equals(type) || AdminObjectTypeEnum.RYGL.getValue().equals(type) || AdminObjectTypeEnum.SQGL.getValue().equals(type) || AdminObjectTypeEnum.GLYGL.getValue().equals(type)) {
                 if (AdminObjectTypeEnum.JGGL.getValue().equals(type) || AdminObjectTypeEnum.RYGL.getValue().equals(type) || AdminObjectTypeEnum.SQGL.getValue().equals(type) || AdminObjectTypeEnum.GLYGL.getValue().equals(type)) {
-                    ids = iOrgInfoFacade.changeIdsToNames(ids);
+                    ids = authOrgInfoFacade.changeIdsToNames(ids);
                     if(StringUtils.isNotBlank(ids)) {
                     if(StringUtils.isNotBlank(ids)) {
                         ids = ids.replace(":-1", "(及其下属机构)").replace(":0", "").replace(":1", "").replace(":2", "(及其下属机构)");
                         ids = ids.replace(":-1", "(及其下属机构)").replace(":0", "").replace(":1", "").replace(":2", "(及其下属机构)");
                     }
                     }
@@ -83,7 +83,7 @@ public class MgeAuditRptController {
 
 
             }
             }
             if (StringUtils.isNotEmpty(mgeLog.getOperateOrgId())) {
             if (StringUtils.isNotEmpty(mgeLog.getOperateOrgId())) {
-                String operateOrgName = iOrgInfoFacade.changeIdsToNames(mgeLog.getOperateOrgId().trim());
+                String operateOrgName = authOrgInfoFacade.changeIdsToNames(mgeLog.getOperateOrgId().trim());
                 mgeLog.setOperateOrgName(operateOrgName);
                 mgeLog.setOperateOrgName(operateOrgName);
             }
             }
         }
         }

+ 2 - 10
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/ApplicationController.java

@@ -51,20 +51,13 @@ public class ApplicationController {
      * @param
      * @param
      * @return
      * @return
      */
      */
-    @ApiOperation(value = "根据机构Id获取应用信息列表")
-    @ApiImplicitParam(name = "searchable", value = "查询条件,orgId不能为空")
+    @ApiOperation(value = "根据机构code获取应用信息列表")
+    @ApiImplicitParam(name = "searchable", value = "查询条件,orgCode不能为空")
     @PostMapping(value = "/appList/_search", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     @PostMapping(value = "/appList/_search", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     public Result<List<ApplicationInfoVo>> getAppList(SearchDTO searchDTO) {
     public Result<List<ApplicationInfoVo>> getAppList(SearchDTO searchDTO) {
         List<ApplicationInfoVo> resultList = new ArrayList<>();
         List<ApplicationInfoVo> resultList = new ArrayList<>();
         Searchable searchable = Searchable.toSearchable(searchDTO);
         Searchable searchable = Searchable.toSearchable(searchDTO);
         searchable.addSearchFilter("deleted", SearchOperator.eq, YesNotEnum.NO.getValue());
         searchable.addSearchFilter("deleted", SearchOperator.eq, YesNotEnum.NO.getValue());
-//        AuthUserDTO userInfo = authUserInfoFacade.get(ContextUtils.getUserInfo().getId());
-        //外部人员只能配置自己所属厂商下的应用
-        //TODO
-        //目前权限主体没同步厂商字段
-//        if (UserTypeEnum.EXTERNAL.getValue().equals(userInfo.getUserType())) {
-//            searchable.addSearchFilter("manufacturerId", SearchOperator.eq, userInfo.getCompany());
-//        }
         Page<ApplyInfo> applyInfos = applyInfoFacade.applyInfoPage(searchable.toSearchDTO());
         Page<ApplyInfo> applyInfos = applyInfoFacade.applyInfoPage(searchable.toSearchDTO());
         if (applyInfos.getContent().size() < 1) {
         if (applyInfos.getContent().size() < 1) {
             return Result.success(new ArrayList<>());
             return Result.success(new ArrayList<>());
@@ -93,7 +86,6 @@ public class ApplicationController {
             applicationInfoVO.setInitquotas(0L);
             applicationInfoVO.setInitquotas(0L);
             applicationInfoVO.setQuotaed(0L);
             applicationInfoVO.setQuotaed(0L);
             applicationInfoVO.setLeavequotas(0L);
             applicationInfoVO.setLeavequotas(0L);
-            applicationInfoVO.setAppOrgId(applyInfo.getOrgId());
             apps.add(applicationInfoVO);
             apps.add(applicationInfoVO);
         }
         }
         return apps;
         return apps;

+ 63 - 111
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/OrgQuotaAuthController.java

@@ -1,25 +1,25 @@
 package com.dragoninfo.dcuc.authweb.restcontroller.auth;
 package com.dragoninfo.dcuc.authweb.restcontroller.auth;
 
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
-import com.dragoninfo.dcuc.auth.admin.facade.IAppMtAuthFacade;
 import com.dragoninfo.dcuc.auth.auth.dto.OrgQuotaOpeDTO;
 import com.dragoninfo.dcuc.auth.auth.dto.OrgQuotaOpeDTO;
 import com.dragoninfo.dcuc.auth.auth.entity.OrgQuotaAuthInfo;
 import com.dragoninfo.dcuc.auth.auth.entity.OrgQuotaAuthInfo;
 import com.dragoninfo.dcuc.auth.auth.facade.IOrgQuotaAuthFacade;
 import com.dragoninfo.dcuc.auth.auth.facade.IOrgQuotaAuthFacade;
+import com.dragoninfo.dcuc.auth.sub.dto.AuthOrgDTO;
 import com.dragoninfo.dcuc.auth.sub.dto.AuthUserDTO;
 import com.dragoninfo.dcuc.auth.sub.dto.AuthUserDTO;
+import com.dragoninfo.dcuc.auth.sub.dto.OrgQuotaNumDTO;
+import com.dragoninfo.dcuc.auth.sub.dto.OrgTreeNodeDTO;
+import com.dragoninfo.dcuc.auth.sub.facade.IAuthOrgInfoFacade;
 import com.dragoninfo.dcuc.auth.sub.facade.IAuthUserInfoFacade;
 import com.dragoninfo.dcuc.auth.sub.facade.IAuthUserInfoFacade;
 import com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.OrgQuotaAuthInfoVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.OrgQuotaAuthInfoVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.OrgQuotaOperateVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.OrgQuotaOperateVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.sub.vo.org.OrgTreeNodeVo;
 import com.dragoninfo.dcuc.duceap.facade.ICodeListResourceFacade;
 import com.dragoninfo.dcuc.duceap.facade.ICodeListResourceFacade;
-import com.dragoninfo.dcuc.org.dto.OrgQuotaNumDTO;
-import com.dragoninfo.dcuc.org.entity.OrgInfo;
-import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
-import com.dragoninfo.dcuc.org.vo.OrgTreeNode;
-
 import com.dragoninfo.duceap.core.response.Result;
 import com.dragoninfo.duceap.core.response.Result;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.entity.metadata.CodeRecord;
 import com.dragonsoft.duceap.base.entity.metadata.CodeRecord;
 import com.dragonsoft.duceap.base.entity.security.SecurityUser;
 import com.dragonsoft.duceap.base.entity.security.SecurityUser;
 import com.dragonsoft.duceap.base.exception.ApplicationException;
 import com.dragonsoft.duceap.base.exception.ApplicationException;
+import com.dragonsoft.duceap.base.utils.UserContextUtils;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
 import com.dragonsoft.duceap.core.context.ContextUtils;
 import com.dragonsoft.duceap.core.context.ContextUtils;
 import com.dragonsoft.duceap.web.annotation.Permission;
 import com.dragonsoft.duceap.web.annotation.Permission;
@@ -38,6 +38,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Arrays;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 
 @Api(tags = {"授权模块-机构配额管理"})
 @Api(tags = {"授权模块-机构配额管理"})
 @RestController
 @RestController
@@ -45,33 +46,72 @@ import java.util.Map;
 public class OrgQuotaAuthController {
 public class OrgQuotaAuthController {
     private final Logger logger=LoggerFactory.getLogger(this.getClass());
     private final Logger logger=LoggerFactory.getLogger(this.getClass());
 
 
-    @Autowired
-    private IAppMtAuthFacade iAppMtAuthFacade;
-
     @Autowired
     @Autowired
     private IOrgQuotaAuthFacade iOrgQuotaAuthFacade;
     private IOrgQuotaAuthFacade iOrgQuotaAuthFacade;
 
 
     @Autowired
     @Autowired
-    private IOrgInfoFacade iOrgInfoFacade;
-
-    @Autowired
-    private IAuthUserInfoFacade authUserInfoFacade;
+    private IAuthOrgInfoFacade authOrgInfoFacade;
 
 
     @Autowired
     @Autowired
     private ICodeListResourceFacade iCodeListResourceFacade;
     private ICodeListResourceFacade iCodeListResourceFacade;
 
 
+        /**
+     * 机构配置-配额下发-计算
+     * @param roleLevel 角色层级
+     * @param unitClass 单位类别
+     * @param orgId   应用所属机构id
+     * @return
+     */
+    @GetMapping(value = "/searchOrg")
+    @ApiImplicitParams({@ApiImplicitParam(name = "roleLevel", value = "角色层级", required = true),
+            @ApiImplicitParam(name = "unitClass", value = "单位类别", required = true),
+            @ApiImplicitParam(name = "orgId", value = "机构id"),
+    })
+    public Result<OrgQuotaNumDTO> searchOrg(
+            @RequestParam(value = "orgId", required = false) String orgId,
+            @RequestParam(value = "unitClass") String unitClass,
+            @RequestParam(value = "roleLevel") String roleLevel) {
+        SecurityUser user = UserContextUtils.getCurrentUser();
+        try {
+            OrgQuotaNumDTO orgQuotaNumsVo = authOrgInfoFacade.searchOrgForQuota(user.getId(), orgId, unitClass, roleLevel);
+            return Result.success(orgQuotaNumsVo);
+        } catch (Exception e) {
+            logger.error("searchOrg异常", e);
+            return Result.fail("计算失败");
+        }
+    }
+
     /**
     /**
-     * 获取指定机构管辖的下级机构数量
+     * 授权管理-机构配额-配额下发-机构树
+     * @param unitClass
+     * @param roleLevel
+     * @param id        节点机构id
      * @return
      * @return
      */
      */
-    @ApiOperation(value = "获取指定机构管辖的下级机构数量")
-    @ApiImplicitParam(name = "orgId", value = "机构id")
-    @GetMapping(value = "/orgMgeNum")
-    public Result<Map<String, Integer>> getOrgMgeNum(@RequestParam(value = "orgId") String orgId) {
-        Map<String, Integer> orgMgeNum = iOrgInfoFacade.getOrgMgeNum(orgId);
-        return Result.success(orgMgeNum);
+    @GetMapping(value = "calQuotaTreeYB")
+    @ApiImplicitParams({@ApiImplicitParam(name = "roleLevel", value = "角色层级",required = false),
+            @ApiImplicitParam(name = "unitClass", value = "单位类别",required = false),
+            @ApiImplicitParam(name = "id", value = "机构id",required = false)
+    })
+    public Result<List<OrgTreeNodeVo>> calQuotaTreeYB(
+            @RequestParam(value = "unitClass", required = false) String unitClass,
+            @RequestParam(value = "roleLevel", required = false) String roleLevel,
+            @RequestParam(value = "id", required = false) String id) {
+        if (StringUtils.isEmpty(id)) {
+            return Result.success(new ArrayList<>());
+        } else {
+            SecurityUser user = UserContextUtils.getCurrentUser();
+            List<OrgTreeNodeDTO> calQuotaTree = authOrgInfoFacade.getCalQuotaTree(user.getId(), id, unitClass, roleLevel);
+            List<OrgTreeNodeVo> collect = calQuotaTree.stream().map(e -> {
+                OrgTreeNodeVo nodeVo = new OrgTreeNodeVo();
+                BeanUtils.copyProperties(e, nodeVo);
+                return nodeVo;
+            }).collect(Collectors.toList());
+            return Result.success(collect);
+        }
     }
     }
 
 
+
     /**
     /**
      * 获取指定机构配额分配信息
      * 获取指定机构配额分配信息
      *
      *
@@ -101,14 +141,7 @@ public class OrgQuotaAuthController {
     @ApiOperation(value = "保存机构配额分配信息")
     @ApiOperation(value = "保存机构配额分配信息")
     @PostMapping(value = "/orgQuota",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     @PostMapping(value = "/orgQuota",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     public Result orgQuotaSave(@RequestBody List<OrgQuotaOperateVo> list) {
     public Result orgQuotaSave(@RequestBody List<OrgQuotaOperateVo> list) {
-        SecurityUser curUser = (SecurityUser) ContextUtils.getUserInfo();
-        AuthUserDTO userInfo = authUserInfoFacade.get(curUser.getId());
-        if(null == userInfo) {
-            throw new ApplicationException("查询不到用户信息");
-        }
-        curUser.setUserName(userInfo.getName());
-        curUser.setSecurityOrg(userInfo.getOrgId());
-        curUser.setSecurityOrgName(userInfo.getOrgName());
+        SecurityUser curUser = UserContextUtils.getCurrentUser();
         //TODO
         //TODO
         //DTO待设计
         //DTO待设计
         OrgQuotaOpeDTO redto = new OrgQuotaOpeDTO();
         OrgQuotaOpeDTO redto = new OrgQuotaOpeDTO();
@@ -122,31 +155,6 @@ public class OrgQuotaAuthController {
         }
         }
     }
     }
 
 
-//    /**
-//     * 本级权限收回
-//     *
-//     * @return
-//     */
-//    @ApiOperation(value = "本级权限收回")
-//    @ApiImplicitParams({@ApiImplicitParam(name = "appId",required = true),
-//            @ApiImplicitParam(name = "roleId", value = "角色id",required = true),
-//            @ApiImplicitParam(name = "orgId", value = "机构id",required = true),
-//    })
-//    @Permission(value = "org_quota")
-//    @PutMapping(value = "/authCancelSelf",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-//    public Result authCancelSelf(@RequestBody OrgQuotaOperateVo orgQuotaOperateVo) {
-//        String appId = orgQuotaOperateVo.getAppId();
-//        String roleId = orgQuotaOperateVo.getRoleId();
-//        String orgId = orgQuotaOperateVo.getAppOrgId();
-//        String appMtAuthOrgIds = iAppMtAuthFacade.appMtList(ContextUtils.getUserInfo().getId()).get(0).getOrgId();
-//        ResponseStatus responseMessage = iOrgQuotaAuthFacade.authCancelSelf(appId, roleId, orgId, appMtAuthOrgIds);
-//        if(ResponseStatus.SUCCESS_CODE.equals(responseMessage.getStatusCode())){
-//            return Result.success(responseMessage.getMessage());
-//        }else {
-//            return Result.fail(responseMessage.getMessage());
-//        }
-//    }
-
     /**
     /**
      * 子级权限收回
      * 子级权限收回
      * @return
      * @return
@@ -169,11 +177,7 @@ public class OrgQuotaAuthController {
     @ApiOperation(value = "配额批量计算下发")
     @ApiOperation(value = "配额批量计算下发")
     @PostMapping(value = "/orgQuotaCalSave",produces = MediaType.APPLICATION_JSON_UTF8_VALUE )
     @PostMapping(value = "/orgQuotaCalSave",produces = MediaType.APPLICATION_JSON_UTF8_VALUE )
     public Result orgQuotaCalSave(@RequestBody OrgQuotaOperateVo orgQuotaOperateVo) {
     public Result orgQuotaCalSave(@RequestBody OrgQuotaOperateVo orgQuotaOperateVo) {
-        SecurityUser userInfo = (SecurityUser) ContextUtils.getUserInfo();
-        AuthUserDTO user = authUserInfoFacade.get(userInfo.getId());
-        userInfo.setSecurityOrg(user.getOrgId());
-        userInfo.setSecurityOrgName(user.getOrgName());
-        userInfo.setUserName(user.getName());
+        SecurityUser userInfo = UserContextUtils.getCurrentUser();
         OrgQuotaOpeDTO orgQuotaOpeDTO = new OrgQuotaOpeDTO();
         OrgQuotaOpeDTO orgQuotaOpeDTO = new OrgQuotaOpeDTO();
         BeanUtils.copyProperties(orgQuotaOperateVo,orgQuotaOpeDTO);
         BeanUtils.copyProperties(orgQuotaOperateVo,orgQuotaOpeDTO);
         orgQuotaOpeDTO.setSecurityUser(userInfo);
         orgQuotaOpeDTO.setSecurityUser(userInfo);
@@ -185,58 +189,6 @@ public class OrgQuotaAuthController {
         }
         }
     }
     }
 
 
-    /**
-     * 机构配置-配额下发-计算
-     * @param roleLevel 角色层级
-     * @param unitClass 单位类别
-     * @param orgId   应用所属机构id
-     * @return
-     */
-    @GetMapping(value = "/searchOrg")
-    @ApiImplicitParams({@ApiImplicitParam(name = "roleLevel", value = "角色层级", required = true),
-            @ApiImplicitParam(name = "unitClass", value = "单位类别", required = true),
-            @ApiImplicitParam(name = "orgId", value = "机构id"),
-    })
-    public Result<OrgQuotaNumDTO> searchOrg(
-            @RequestParam(value = "orgId", required = false) String orgId,
-            @RequestParam(value = "unitClass") String unitClass,
-            @RequestParam(value = "roleLevel") String roleLevel) {
-        SecurityUser user = (SecurityUser) ContextUtils.getUserInfo();
-        try {
-
-            OrgQuotaNumDTO orgQuotaNumsVo = iOrgInfoFacade.searchOrgForQuota(user.getId(), orgId, unitClass, roleLevel);
-            return Result.success(orgQuotaNumsVo);
-        } catch (Exception e) {
-            logger.error("searchOrg异常", e);
-            return Result.fail("计算失败");
-        }
-    }
-
-    /**
-     * 授权管理-机构配额-配额下发-机构树
-     * @param unitClass
-     * @param roleLevel
-     * @param id        节点机构id
-     * @return
-     */
-    @GetMapping(value = "calQuotaTreeYB")
-    @ApiImplicitParams({@ApiImplicitParam(name = "roleLevel", value = "角色层级",required = false),
-            @ApiImplicitParam(name = "unitClass", value = "单位类别",required = false),
-            @ApiImplicitParam(name = "id", value = "机构id",required = false)
-    })
-    public Result<List<OrgTreeNode>> calQuotaTreeYB(
-            @RequestParam(value = "unitClass", required = false) String unitClass,
-            @RequestParam(value = "roleLevel", required = false) String roleLevel,
-            @RequestParam(value = "id", required = false) String id) {
-        if (StringUtils.isEmpty(id)) {
-            return Result.success(new ArrayList<OrgTreeNode>());
-        } else {
-            SecurityUser user = (SecurityUser) ContextUtils.getUserInfo();
-            List<OrgTreeNode> calQuotaTree = iOrgInfoFacade.getCalQuotaTree(id, user.getId(), unitClass, roleLevel);
-            return Result.success(calQuotaTree);
-        }
-    }
-
     /**
     /**
      * 根据筛选的条件确定分配范围可选项
      * 根据筛选的条件确定分配范围可选项
      * @param orgId
      * @param orgId
@@ -253,7 +205,7 @@ public class OrgQuotaAuthController {
     public Result<List<CodeRecord>> distributionRange(@RequestParam("orgId") String orgId,
     public Result<List<CodeRecord>> distributionRange(@RequestParam("orgId") String orgId,
                                                          @RequestParam("roleLevel") String roleLevel,
                                                          @RequestParam("roleLevel") String roleLevel,
                                                          @RequestParam("unitClass") String unitClass) {
                                                          @RequestParam("unitClass") String unitClass) {
-        OrgInfo orgInfo = iOrgInfoFacade.detail(orgId);
+        AuthOrgDTO orgInfo = authOrgInfoFacade.get(orgId);
         int orgLevel = Integer.valueOf(orgInfo.getOrgLevel());
         int orgLevel = Integer.valueOf(orgInfo.getOrgLevel());
         int roleLevelInt = Integer.valueOf(roleLevel);
         int roleLevelInt = Integer.valueOf(roleLevel);
         int unit = 9;
         int unit = 9;

+ 11 - 12
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/RoleRptController.java

@@ -4,11 +4,11 @@ import com.dragoninfo.dcuc.app.entity.ApplyInfo;
 import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
 import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
 import com.dragoninfo.dcuc.auth.auth.facade.IRoleAuthInfoFacade;
 import com.dragoninfo.dcuc.auth.auth.facade.IRoleAuthInfoFacade;
 import com.dragoninfo.dcuc.auth.auth.vo.TreeInfoVO;
 import com.dragoninfo.dcuc.auth.auth.vo.TreeInfoVO;
+import com.dragoninfo.dcuc.auth.sub.dto.AuthOrgDTO;
+import com.dragoninfo.dcuc.auth.sub.facade.IAuthOrgInfoFacade;
 import com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.AppDropDownVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.AppDropDownVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.AppRoleCalculateVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.AppRoleCalculateVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.OrgRptOpeVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.OrgRptOpeVo;
-import com.dragoninfo.dcuc.org.entity.OrgInfo;
-import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
 import com.dragoninfo.duceap.core.response.Result;
 import com.dragoninfo.duceap.core.response.Result;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
 import com.dragonsoft.duceap.base.enums.BooleanEnum;
 import com.dragonsoft.duceap.base.enums.BooleanEnum;
@@ -27,7 +27,6 @@ import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
@@ -46,7 +45,7 @@ public class RoleRptController {
      * 机构信息服务
      * 机构信息服务
      */
      */
     @Autowired
     @Autowired
-    private IOrgInfoFacade iOrgInfoFacade;
+    private IAuthOrgInfoFacade authOrgInfoFacade;
 
 
     /**
     /**
      * 应用信息服务
      * 应用信息服务
@@ -70,16 +69,16 @@ public class RoleRptController {
         Page<TreeInfoVO> page = new PageImpl<TreeInfoVO>();
         Page<TreeInfoVO> page = new PageImpl<TreeInfoVO>();
         if (StringUtils.isNotEmpty(appId)) {
         if (StringUtils.isNotEmpty(appId)) {
             ApplyInfo applyInfo = applyInfoFacade.applyDetail(appId);
             ApplyInfo applyInfo = applyInfoFacade.applyDetail(appId);
-            String appOrgId = applyInfo.getOrgId();
+            String appOrgCode = applyInfo.getOrgCode();
             //机构下的分配情况,经过权限中心导入的应用机构id不是不填项
             //机构下的分配情况,经过权限中心导入的应用机构id不是不填项
-            if(StringUtils.isBlank(appOrgId)) {
+            if(StringUtils.isBlank(appOrgCode)) {
                 return Result.success(page.getTotalElements(),page.getContent());
                 return Result.success(page.getTotalElements(),page.getContent());
             }
             }
-            searchable.addSearchFilter("appOrgId", SearchOperator.eq, appOrgId);
+            searchable.addSearchFilter("appOrgCode", SearchOperator.eq, appOrgCode);
             page = roleAuthInfoFacade.getRptList(searchable.toSearchDTO());
             page = roleAuthInfoFacade.getRptList(searchable.toSearchDTO());
             for (TreeInfoVO treeInfoVO : page.getContent()) {
             for (TreeInfoVO treeInfoVO : page.getContent()) {
                 String orgId = treeInfoVO.getId();
                 String orgId = treeInfoVO.getId();
-                OrgInfo orgInfo = iOrgInfoFacade.detail(orgId);
+                AuthOrgDTO orgInfo = authOrgInfoFacade.get(orgId);
                 if (orgInfo != null) {
                 if (orgInfo != null) {
                     treeInfoVO.setCode(orgInfo.getCode());
                     treeInfoVO.setCode(orgInfo.getCode());
                     treeInfoVO.setName(orgInfo.getFullName());
                     treeInfoVO.setName(orgInfo.getFullName());
@@ -102,12 +101,12 @@ public class RoleRptController {
     public Result<AppRoleCalculateVo> getRoleTjInfo(@PathVariable("appId") String appId) {
     public Result<AppRoleCalculateVo> getRoleTjInfo(@PathVariable("appId") String appId) {
         AppRoleCalculateVo vo = new AppRoleCalculateVo();
         AppRoleCalculateVo vo = new AppRoleCalculateVo();
         ApplyInfo applyInfo = applyInfoFacade.applyDetail(appId);
         ApplyInfo applyInfo = applyInfoFacade.applyDetail(appId);
-        String orgId = applyInfo.getOrgId();
+        String orgCode = applyInfo.getOrgCode();
         //主客体授权版本,应用所属机构id可为空
         //主客体授权版本,应用所属机构id可为空
-        if(StringUtils.isBlank(orgId)) {
+        if(StringUtils.isBlank(orgCode)) {
             return Result.success(vo);
             return Result.success(vo);
         }
         }
-        Map<String, Object> resultMap = roleAuthInfoFacade.getRoleTjInfo(appId, orgId);
+        Map<String, Object> resultMap = roleAuthInfoFacade.getRoleTjInfo(appId, orgCode);
         Object roleNumsObj = resultMap.get("ROLENUMS");
         Object roleNumsObj = resultMap.get("ROLENUMS");
         Object initNumsObj = resultMap.get("INITNUMS");
         Object initNumsObj = resultMap.get("INITNUMS");
         Integer roleNums = roleNumsObj == null ? 0 : (Integer) roleNumsObj;
         Integer roleNums = roleNumsObj == null ? 0 : (Integer) roleNumsObj;
@@ -115,7 +114,7 @@ public class RoleRptController {
         vo.setRoleNums(roleNums);
         vo.setRoleNums(roleNums);
         vo.setInitNums(initNums);
         vo.setInitNums(initNums);
         vo.setAppId(appId);
         vo.setAppId(appId);
-        vo.setOrgId(orgId);
+        vo.setOrgId(orgCode);
         return Result.success(vo);
         return Result.success(vo);
     }
     }
 
 

+ 0 - 239
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/org/GovernmentInfoController.java

@@ -1,239 +0,0 @@
-//package com.dragoninfo.dcuc.authweb.restcontroller.org;
-//
-//import com.dragoninfo.dcuc.authweb.restcontroller.org.vo.GovOrgVo;
-//import com.dragoninfo.dcuc.authweb.restcontroller.org.vo.SortVo;
-//import com.dragoninfo.dcuc.org.entity.GovInfo;
-//import com.dragoninfo.dcuc.org.facade.IGovInfoFacade;
-//import com.dragoninfo.dcuc.user.entity.GovUserInfo;
-//import com.dragoninfo.dcuc.user.facade.IGovUserInfoFacade;
-//import com.dragoninfo.dcuc.user.user.enumresources.YesNotEnum;
-//import com.dragoninfo.dcuc.user.user.facade.IUserInfoFacade;
-//import com.dragoninfo.duceap.core.enums.ResultEnum;
-//import com.dragoninfo.duceap.core.response.Result;
-//import com.dragonsoft.duceap.base.entity.search.SearchDTO;
-//import com.dragonsoft.duceap.base.entity.security.SecurityUser;
-//import com.dragonsoft.duceap.commons.util.bean.BeanUtils;
-//import com.dragonsoft.duceap.commons.util.string.StringUtils;
-//import com.dragonsoft.duceap.core.context.ContextUtils;
-//import com.dragonsoft.duceap.core.search.Searchable;
-//import com.dragonsoft.duceap.core.search.enums.SearchOperator;
-//import io.swagger.annotations.Api;
-//import io.swagger.annotations.ApiImplicitParam;
-//import io.swagger.annotations.ApiImplicitParams;
-//import io.swagger.annotations.ApiOperation;
-//import org.apache.commons.lang3.StringEscapeUtils;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.data.domain.Page;
-//import org.springframework.web.bind.annotation.*;
-//
-//import java.util.ArrayList;
-//import java.util.HashMap;
-//import java.util.List;
-//import java.util.Map;
-//
-///**
-// * 勿删权限政务机构列表
-// * Created by Administrator on 2020/6/30.
-// */
-//@Api(tags = {"政务机构管理接口"})
-//@RestController
-//@RequestMapping(value = "/orgsvr/")
-//public class GovernmentInfoController {
-//    private Logger logger = LoggerFactory.getLogger(this.getClass());
-//
-//    @Autowired
-//    private IGovInfoFacade iGovInfoFacade;
-//    @Autowired
-//    private IUserInfoFacade iUserInfoFacade;
-//    @Autowired
-//    private IGovUserInfoFacade iGovUserInfoFacade;
-//
-//    @ApiOperation(value = "政务机构新增")
-//    @PostMapping("govOrg")
-//    public Result save(@RequestBody GovOrgVo vo) {
-//        try {
-//            GovInfo government = new GovInfo();
-//            BeanUtils.copyProperties(government, vo);
-//            if (StringUtils.isBlank(government.getUpGovId())) {
-//                government.setIsRoot("0");
-//            } else {
-//                government.setIsRoot("1");
-//            }
-//            SecurityUser user = (SecurityUser) ContextUtils.getUserInfo();
-//            if (iGovInfoFacade.checkCode("", government.getCode())) {
-//                return Result.fail(ResultEnum.FAIL.getKey(), "政务机构代码已存在");
-//            }
-//            if (iGovInfoFacade.checkName("", government.getFullName(), "")) {
-//                return Result.fail(ResultEnum.FAIL.getKey(), "政务机构名称已存在");
-//            }
-//            if (!iUserInfoFacade.getRootUser().equals(user.getUserName()) && StringUtils.isEmpty(government.getUpGovId())) {
-//                return Result.fail(ResultEnum.FAIL.getKey(), "请选择机构后再新增!");
-//            }
-//            iGovInfoFacade.addGov(government);
-//        } catch (Exception e) {
-//            logger.error(e.getMessage(), e);
-//            return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "新增异常");
-//        }
-//        return Result.success();
-//    }
-//
-//    @ApiOperation(value = "政务机构修改")
-//    @PutMapping("govOrg/{id}")
-//    public Result update(@RequestBody GovOrgVo vo) {
-//        try {
-//            GovInfo government = new GovInfo();
-//            BeanUtils.copyProperties(government, vo);
-//            government = setUpdateProperties(government);
-//            iGovInfoFacade.updateGov(government);
-//        } catch (Exception e) {
-//            logger.error(e.getMessage(), e);
-//            return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "修改异常");
-//        }
-//        return Result.success();
-//    }
-//
-//    @ApiOperation(value = "删除政务机构")
-//    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "机构ID", required = true
-//            , example = "40288a8b699fc2500169a33b20540000")})
-//    @DeleteMapping("govOrg/{id}")
-//    public Result delete(@PathVariable("id") String id) {
-//        Searchable searchable = Searchable.newSearchable();
-//        searchable.addSearchFilter("gov_id", SearchOperator.eq, id);
-//        searchable.addSearchFilter("deleted", SearchOperator.eq, YesNotEnum.NO.getValue());
-//        SearchDTO searchDTO = searchable.toSearchDTO();
-//        Page<GovUserInfo> page = iGovUserInfoFacade.govUserInfoPage(searchDTO);
-//        if (page.getContent().size() > 0) {
-//            return Result.fail("该机构有人员存在,不可删除");
-//        }
-//        iGovInfoFacade.deleteOrg(id);
-//        return Result.success();
-//    }
-//
-//    @ApiOperation(value = "获取政务机构")
-//    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "机构ID", required = true
-//            , example = "40288a8b699fc2500169a33b20540000")})
-//    @GetMapping(value = "govOrg/{id}")
-//    public Result get(@PathVariable("id") String id) {
-//        GovInfo government = new GovInfo();
-//        government = iGovInfoFacade.getGovInfoById(id);
-//        GovOrgVo vo = new GovOrgVo();
-//        try {
-//            BeanUtils.copyProperties(vo, government);
-//        } catch (Exception e) {
-//            logger.error(e.getMessage(), e);
-//            return Result.fail("属性复制异常");
-//        }
-//        return Result.success(vo);
-//    }
-//
-//
-//    @ApiOperation(value = "政务机构树")
-//    @ApiImplicitParam(name = "id", value = "id")
-//    @PostMapping(value = "govOrg/tree/full")
-//    public Result fullGovTree(@RequestBody Map params) {
-//        String id = (String) params.get("id");
-//        if (StringUtils.isEmpty(id)) {
-//            //根节点
-//            GovInfo root = iGovInfoFacade.getRootGov();
-//            List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
-//            resultList.add(treeMapFilter(root, null, ""));
-//            return Result.success(resultList);
-//        }
-//        return Result.success(getChildTreeNode(id, YesNotEnum.NO.getValue()));
-//    }
-//
-//    @ApiOperation(value = "政务机构拖动排序")
-//    @ApiImplicitParams({
-//            @ApiImplicitParam(name = "startId", value = "需要拖动的机构", required = true),
-//            @ApiImplicitParam(name = "endId", value = "拖动到目标机构", required = true),
-//            @ApiImplicitParam(name = "moveType", value = "prev:目标机构前,next: 目标机构后", required = true)
-//    })
-//    @PostMapping(value = "govOrg/sort")
-//    public Result reSort(@RequestBody SortVo sortVo) {
-//        try {
-//            iGovInfoFacade.reSort(sortVo.getStartId(), sortVo.getEndId(), sortVo.getMoveType());
-//        } catch (Exception e) {
-//            logger.error(e.getMessage(), e);
-//            return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "排序异常");
-//        }
-//
-//        return Result.success();
-//    }
-//
-//    @ApiOperation(value = "政务机构树匹配查询")
-//    @ApiImplicitParams({@ApiImplicitParam(name = "name", value = "机构名称", required = true),
-//            @ApiImplicitParam(name = "pageNum", value = "条数", required = true),
-//            @ApiImplicitParam(name = "pageSize", value = "页数", required = true)
-//    })
-//    @PostMapping(value = "govOrg/tree/match")
-//    public Result govMatch(@RequestBody Map map) {
-//        String name = map.get("name").toString();
-//        Integer pageNum = Integer.valueOf(map.get("pageNum").toString());
-//        Integer pageSize = Integer.valueOf(map.get("pageSize").toString());
-//        return Result.success(iGovInfoFacade.govMatch(name, pageNum, pageSize).getResult());
-//    }
-//
-//    private GovInfo setUpdateProperties(GovInfo government) {
-//        GovInfo oldGov = new GovInfo();
-//        if (StringUtils.isNotBlank(government.getId())) {
-//            oldGov = iGovInfoFacade.getGovInfoById(government.getId());
-//        }
-//        oldGov.setId(government.getId());
-//        oldGov.setCode(government.getCode());
-//        oldGov.setShortName(government.getShortName());
-//        oldGov.setFullName(government.getFullName());
-//        oldGov.setUpGovName(government.getUpGovName());
-//        oldGov.setUpGovId(government.getUpGovId());
-//        return oldGov;
-//    }
-//
-//    /**
-//     * 组装树节点
-//     *
-//     * @param government
-//     * @param orgNums
-//     * @param state      节点勾选状态
-//     * @return
-//     */
-//    private Map<String, Object> treeMapFilter(GovInfo government, Map<String, Long> orgNums, String state) {
-//        Map<String, Object> map = new HashMap<String, Object>();
-//        map.put("id", government.getId());
-//        map.put("code", government.getCode());
-//        map.put("name", StringEscapeUtils.unescapeHtml4(government.getFullName()));
-//        map.put("pid", government.getUpGovId());
-//        map.put("isParent", true);
-//        if (null == orgNums) {
-//            map.put("isParent", true);
-//            return map;
-//        }
-//        if ("0".equals(state) || null == orgNums.get(government.getId()) || 0 == orgNums.get(government.getId())) {
-//            map.put("isParent", false);
-//        } else {
-//            map.put("isParent", true);
-//        }
-//        return map;
-//    }
-//
-//
-//    /**
-//     * 异步获取子节点
-//     *
-//     * @param parentId
-//     * @param state    机构状态:0:未删除,1:已删除,null:全部
-//     * @return
-//     */
-//    public List<Map<String, Object>> getChildTreeNode(String parentId, String state) {
-//        List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
-//        //子级机构
-//        List<GovInfo> childList = iGovInfoFacade.findChildGovList(parentId);
-//        //子级和自身的子级个数
-//        Map<String, Long> orgNums = iGovInfoFacade.countGovByUpGovId(parentId);
-//        for (GovInfo government : childList) {
-//            Map<String, Object> map = treeMapFilter(government, orgNums, null);
-//            resultList.add(map);
-//        }
-//        return resultList;
-//    }
-//}

+ 0 - 577
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/org/OrgInfoController.java

@@ -1,577 +0,0 @@
-package com.dragoninfo.dcuc.authweb.restcontroller.org;
-
-import com.dragoninfo.dcuc.auth.sub.facade.IAuthUserInfoFacade;
-import com.dragoninfo.dcuc.authweb.business.MtAuthBusiness;
-import com.dragoninfo.dcuc.authweb.common.SysConstants;
-import com.dragoninfo.dcuc.authweb.restcontroller.org.vo.OrgRangeVo;
-import com.dragoninfo.dcuc.authweb.restcontroller.statisics.vo.OrgTreeNodeVo;
-import com.dragoninfo.dcuc.authweb.util.VersionUtils;
-import com.dragoninfo.dcuc.org.entity.OrgInfo;
-import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
-import com.dragoninfo.dcuc.org.vo.OrgTreeNode;
-import com.dragoninfo.duceap.commons.util.server.OrgInfoUtil;
-import com.dragoninfo.duceap.core.response.Result;
-import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
-import com.dragonsoft.duceap.base.entity.security.SecurityUser;
-import com.dragonsoft.duceap.base.enums.BooleanEnum;
-import com.dragonsoft.duceap.base.utils.UserContextUtils;
-import com.dragonsoft.duceap.commons.util.string.StringUtils;
-import com.dragonsoft.duceap.commons.util.tree.SimpleTreeNodeItemResolver;
-import com.dragonsoft.duceap.commons.util.tree.TreeNodeUtils;
-import com.dragonsoft.duceap.core.context.ContextUtils;
-import com.dragonsoft.duceap.web.utils.SessionUtils;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.*;
-
-/**
- * 勿删权限机构列表
- */
-
-
-@Api(tags = {"机构管理接口"})
-@RestController
-@RequestMapping(value = "/orgsvr/" + VersionUtils.VERSION_UID + "/")
-public class OrgInfoController {
-    @Autowired
-    private IOrgInfoFacade iOrgInfoFacade;
-
-    @Autowired
-    private IAuthUserInfoFacade authUserInfoFacade;
-
-    @Autowired
-    private MtAuthBusiness mtAuthBusiness;
-
-    /**
-     * 当前用户的管理范围机构树
-     *
-     * @param params type:机构树类型 (ORG:机构管理范围 USER:用户管理范围 APP:权限管理范围 MGE:管理员管理范围 ), id:异步加载的树节点
-     * @return
-     */
-    @ApiOperation(value = "机构树")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "id", value = "id"),
-            @ApiImplicitParam(name = "type", value = "type:机构树类型(ORG:机构管理范围 USER:用户管理范围 APP:权限管理范围 MGE:管理员管理范围)")})
-    @PostMapping(value = "org/tree/catalog")
-    public Result orgMtTreeYB(@RequestBody Map params) {
-        String id = (String) params.get("id");
-        String type = (String) params.get("type");
-        //获取管理范围ids
-        SecurityUser curUser = UserContextUtils.getCurrentUser();
-        String mtAuthIds = mtAuthBusiness.getMtAuth(curUser.getId(), type);
-        if (StringUtils.isEmpty(id)) {
-            //获取机构树根节点列表
-            List<Map<String, Object>> result = this.treeRootList(mtAuthIds);
-            return Result.success(result);
-        } else {
-            List<Map<String, Object>> result = this.getChildTreeNode(id, BooleanEnum.FALSE.getValue(), mtAuthIds);
-            return Result.success(result);
-        }
-    }
-
-    /**
-     * 获取单个树节点机构信息
-     */
-    @ApiOperation(value = "单个树节点信息")
-    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "机构ID", required = true
-            , example = "40288a8b699fc2500169a33b20540000")})
-    @GetMapping(value = "org/tree/node/{id}")
-    public Result<OrgTreeNodeVo> orgTreeNode(@PathVariable("id") String id) {
-        OrgTreeNode orgTreeNode = iOrgInfoFacade.getOrgTreeNode(id);
-        OrgTreeNodeVo vo = new OrgTreeNodeVo();
-        BeanUtils.copyProperties(orgTreeNode, vo);
-        vo.setName(orgTreeNode.getLabel());
-        return Result.success(vo);
-    }
-
-
-    /**
-     * 管理员管理—管理范围—分配树
-     *
-     * @return
-     */
-    @ApiOperation(value = "管理员管理—管理范围—分配树")
-    @PostMapping(value = "org/tree/admin")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "id", value = "id"),
-            @ApiImplicitParam(name = "userId", value = "用户ID", required = true),
-            @ApiImplicitParam(name = "mtType", value = "type:机构树类型(ORG:机构管理范围 USER:用户管理范围 APP:权限管理范围 MGE:管理员管理范围)", required = true)
-    })
-    public Result orgMtTreeWithChecked(@RequestBody OrgRangeVo orgRangeVo) {
-        String id = orgRangeVo.getId();
-        String mtType = orgRangeVo.getMtType();
-        String userId = orgRangeVo.getUserId();
-        //获取管理范围ids
-        SecurityUser curUser = UserContextUtils.getCurrentUser();
-        String mtAuthIds = mtAuthBusiness.getMtAuth(curUser.getId(), mtType);
-        //当临时表没有数据时候,获取登录人的权限范围
-        if (StringUtils.isEmpty(mtAuthIds) && SysConstants.MT_TEMP.equals(orgRangeVo.getMtType())) {
-            mtAuthIds = mtAuthBusiness.getMtAuth(curUser.getId(), SysConstants.MT_APP);
-        }
-        if (StringUtils.isEmpty(id)) {
-            //获取机构树根节点列表
-            List<Map<String, Object>> treeList = this.treeRootList(mtAuthIds);
-            return Result.success(checkTreeNode(treeList, mtType, userId));
-        } else {
-            List<Map<String, Object>> treeList = this.getChildTreeNode(id, BooleanEnum.FALSE.getValue(), mtAuthIds);
-            return Result.success(checkTreeNode(treeList, mtType, userId));
-        }
-    }
-
-//    /**
-//     * 、机构新增
-//     *
-//     * @return
-//     */
-//    @ApiOperation(value = "机构新增")
-//    @PostMapping(value = "org")
-//    public Result save(@RequestBody OrgVo vo) {
-//        try {
-//            OrgInfo orgInfo = new OrgInfo();
-//            BeanUtils.copyProperties(orgInfo, vo);
-//            SecurityUser user = (SecurityUser) ContextUtils.getUserInfo();
-//            orgInfo = this.upSetOrg(orgInfo);
-//            if (iOrgInfoFacade.checkCode("", orgInfo.getCode()) != null) {
-//                return Result.fail(ResultEnum.FAIL.getKey(), "机构代码已存在");
-//            }
-//            if (iOrgInfoFacade.checkName("", orgInfo.getFullName(), "") != null) {
-//                return Result.fail(ResultEnum.FAIL.getKey(), "机构名称已存在");
-//            }
-//
-//            if (!authUserInfoFacade.getRootUser().equals(user.getUserName()) && StringUtils.isEmpty(orgInfo.getUpGovId())) {
-//                return Result.fail(ResultEnum.FAIL.getKey(), "请选择机构后再新增!");
-//            }
-//            //保存机构在这
-//            orgInfo = iOrgInfoFacade.addOrg(orgInfo);
-//            // TODO: 2019/1/30
-//            //维护子表
-//            if (!authUserInfoFacade.getRootUser().equals(user.getName())) {
-//                OrgMtAuth orgMtAuth = iOrgMtAuthFacade.getOrgMtAuthById(user.getId()).get(0);
-//                String orgMtIds = orgMtAuth.getOrgId();
-//                if (orgMtIds != null && orgMtIds.indexOf(orgInfo.getUpGovId() + ":0") >= 0) {
-//                    //原机构范围只勾选了父节点,需添加新增的机构节点,修改父节点记录为勾选部分子节点
-//                    orgMtIds = orgMtIds.replace(orgInfo.getUpGovId() + ":0", orgInfo.getUpGovId() + ":1," + orgInfo.getId() + ":-1");
-//                } else if (orgMtIds != null && orgMtIds.indexOf(orgInfo.getUpGovId() + ":1") >= 0) {
-//                    //原父节点记录为勾选部分子节点,需添加新增的机构节点
-//                    orgMtIds = orgMtIds.replace(orgInfo.getUpGovId() + ":1", orgInfo.getUpGovId() + ":1," + orgInfo.getId() + ":-1");
-//                }
-//                if (!orgMtAuth.getOrgId().equals(orgMtIds)) {
-//                    orgMtAuth.setOrgId(orgMtIds);
-//                    iOrgMtAuthFacade.save(orgMtIds, user.getId());
-//                }
-//            }
-//        } catch (Exception e) {
-//            logger.error(e.getMessage(), e);
-//            return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "新增异常");
-//        }
-//        return Result.success();
-//    }
-//
-//
-//    @ApiOperation(value = "机构修改")
-//    @PutMapping(value = "org/{id}")
-//    public Result update(@RequestBody OrgVo vo) {
-//        try {
-//            if (iOrgInfoFacade.checkCode(vo.getId(), vo.getCode()) != null) {
-//                return Result.fail(ResultEnum.FAIL.getKey(), "机构代码已存在");
-//            }
-//            if (iOrgInfoFacade.checkName(vo.getId(), vo.getFullName(), "") != null) {
-//                return Result.fail(ResultEnum.FAIL.getKey(), "机构名称已存在");
-//            }
-//            OrgInfo orgInfo = iOrgInfoFacade.detail(vo.getId());
-//            Date date = orgInfo.getOrgEndDate();
-//            BeanUtils.copyProperties(orgInfo, vo);
-//            orgInfo.setOrgStartDate(date);
-//            iOrgInfoFacade.updateOrg(orgInfo);
-//        } catch (Exception e) {
-//            logger.error("修改失败", e);
-//            return Result.fail(ResultEnum.SERVICE_FAIL.getKey(), "保存失败");
-//        }
-//        return Result.success();
-//    }
-
-//    /**
-//     * 设置org更新值
-//     *
-//     * @param orgInfo
-//     */
-//
-//    private OrgInfo upSetOrg(OrgInfo orgInfo) {
-//        OrgInfo oldOrg = new OrgInfo();
-//        if (StringUtils.isNotEmpty(orgInfo.getId())) {
-//            oldOrg = iOrgInfoFacade.detail(orgInfo.getId());
-//        } else {
-//            oldOrg.setOrgStartDate(new Date());
-//        }
-//        oldOrg.setUpGovId(orgInfo.getUpGovId());
-//        oldOrg.setOrgKind(orgInfo.getOrgKind());
-//        oldOrg.setFullName(orgInfo.getFullName());
-//        oldOrg.setShortName(orgInfo.getShortName());
-//        oldOrg.setAreaCode(orgInfo.getAreaCode());
-//        oldOrg.setBizType(orgInfo.getBizType());
-//        oldOrg.setCode(orgInfo.getCode());
-//        oldOrg.setOrgType(orgInfo.getOrgType());
-//        oldOrg.setUnitClass(orgInfo.getUnitClass());
-//        oldOrg.setOrgLevel(orgInfo.getOrgLevel());
-//        oldOrg.setEmail(orgInfo.getEmail());
-//        oldOrg.setLinkMan(orgInfo.getLinkMan());
-//        oldOrg.setTel(orgInfo.getTel());
-//        oldOrg.setOrgRank(orgInfo.getOrgRank());
-//        return oldOrg;
-//    }
-
-//    /**
-//     * 机构删除
-//     *
-//     * @return
-//     */
-//    @ApiOperation(value = "机构删除")
-//    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "机构ID", required = true
-//            , example = "40288a8b699fc2500169a33b20540000")})
-//    @DeleteMapping(value = "org/{id}")
-//    public Result deleteOrg(@PathVariable("id") String id) {
-//        logger.info(id);
-//        Searchable searchable = Searchable.newSearchable();
-//        searchable.addSearchFilter("orgId", SearchOperator.eq, id);
-//        searchable.addSearchFilter("deleted", SearchOperator.eq, BooleanEnum.FALSE.getValue());
-//        SearchDTO searchDTO = searchable.toSearchDTO();
-//        Page<AuthUserDTO> page = authUserInfoFacade.page(searchDTO);
-//        if (page.getContent().size() > 0) {
-//            return Result.fail(ResultEnum.FAIL.getKey(), "该机构有人员存在,不可删除");
-//        }
-//        Page<ApplyInfo> appPage = applyInfoFacade.applyInfoPage(searchDTO);
-//        if (appPage.getContent().size() > 0) {
-//            return Result.fail(ResultEnum.FAIL.getKey(), "该机构有应用存在,不可删除");
-//        }
-//
-//        try {
-//            iOrgInfoFacade.deleteOrg(id);
-//        } catch (Exception e) {
-//            logger.error("删除失败", e);
-//            return Result.fail(ResultEnum.SERVICE_FAIL.getKey(), "删除失败");
-//        }
-//        return Result.success();
-//    }
-//
-//
-//    @ApiOperation(value = "机构调动")
-//    @ApiImplicitParams({@ApiImplicitParam(name = "orgId", value = "机构id", required = true),
-//            @ApiImplicitParam(name = "upGovId", value = "上级机构Id", required = true),})
-//    @PostMapping(value = "org/transfer")
-//    public Result orgInfoMove(@RequestBody MergersVo mergersVo) {
-//        String orgId = mergersVo.getOrgId();
-//        String upGovId = mergersVo.getUpGovId();
-//        if (orgId.equals(upGovId)) {
-//            return Result.fail(ResultEnum.FAIL.getKey(), "不能选择自身");
-//        }
-//        OrgInfo orgInfo = iOrgInfoFacade.detail(orgId);
-//        if (orgInfo.getUpGovId().equals(upGovId)) {
-//            return Result.fail(ResultEnum.FAIL.getKey(), "不能选择同一个上级机构");
-//        }
-//        try {
-//            iOrgInfoFacade.moveOrg(orgId, upGovId);
-//        } catch (Exception e) {
-//            logger.error("调动失败", e);
-//            return Result.fail(ResultEnum.SERVICE_FAIL.getKey(), "调动失败");
-//        }
-//        return Result.success();
-//    }
-//
-//    /**
-//     * 机构合并
-//     *
-//     * @param mergersVo
-//     * @return
-//     */
-//    @ApiOperation(value = "机构合并")
-//    @ApiImplicitParams({@ApiImplicitParam(name = "orgId", value = "合并机构id", required = true),
-//            @ApiImplicitParam(name = "targetId", value = "目标机构Id", required = true),})
-//    @PostMapping(value = "org/mergers")
-//    public Result orgInfoMerfe(@RequestBody MergersVo mergersVo) {
-//        String orgId = mergersVo.getOrgId();
-//        String targetId = mergersVo.getTargetId();
-//        if (orgId.equals(targetId))
-//            return Result.fail(ResultEnum.FAIL.getKey(), "不能选择自身");
-//        ResponseStatus result = iOrgInfoFacade.orgInfoMerge(orgId, targetId);
-//        if (result.getStatusCode().equals("200")) {
-//            OrgInfo orgInfo = iOrgInfoFacade.detail(targetId);
-//            authUserInfoFacade.updateByOrgId(orgId, targetId, orgInfo.getFullName(),orgInfo.getCode());
-//            List<NoticeUserVO> list = iManageInfoFacade.getManagerByOrgId(orgId);
-//            for (NoticeUserVO note : list) {
-//                if (!StringUtils.isEmpty(note.getUserId())) {
-//                    iAppMtAuthFacade.save("", note.getUserId());
-//                    iUserMtAuthFacade.save("", note.getUserId());
-//                    iOrgMtAuthFacade.save("", note.getUserId());
-//                    iManageInfoFacade.deleteAdmin(note.getUserId(), "");
-//                }
-//            }
-//        }
-//        return Result.success();
-//    }
-//
-//    @ApiOperation(value = "机构拖动排序")
-//    @ApiImplicitParams({@ApiImplicitParam(name = "startId", value = "需要拖动的机构", required = true),
-//            @ApiImplicitParam(name = "endId", value = "拖动到目标机构", required = true),
-//            @ApiImplicitParam(name = "moveType", value = "prev:目标机构前,next: 目标机构后", required = true)})
-//    @PostMapping(value = "org/sort")
-//    public Result reSort(@RequestBody SortVo sortVo) {
-//
-//        try {
-//            iOrgInfoFacade.reSort(sortVo.getStartId(), sortVo.getEndId(), sortVo.getMoveType());
-//        } catch (Exception e) {
-//            logger.error("排序失败", e);
-//        }
-//        return Result.success();
-//    }
-
-
-//    /**
-//     * 机构详情
-//     *
-//     * @param orgId
-//     * @return
-//     */
-//    @GetMapping(value = "org/{id}")
-//    @ApiOperation(value = "获取单个机构")
-//    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "机构ID", required = true
-//            , example = "40288a8b699fc2500169a33b20540000")})
-//    public Result<OrgVo> orgInfoDetail(@PathVariable(value = "id") String orgId) {
-//        OrgInfo detail = iOrgInfoFacade.detail(orgId);
-//        OrgVo org = new OrgVo();
-//        BeanUtils.copyProperties(org, detail);
-//        List<NoticeUserVO> managerList = this.getAdmins(orgId);
-//        org.setAdmins(managerList);
-//        return Result.success(org);
-//    }
-
-    /**
-     * orginfo转map
-     *
-     * @param orgInfosList
-     * @param orgNums
-     * @return
-     */
-    private List<Map<String, Object>> orgToTreeNode(List<OrgInfo> orgInfosList, Map<String, Long> orgNums) {
-        //子级和自身的子级个数
-        List<Map<String, Object>> mapList = new ArrayList<>();
-        for (OrgInfo orgInfo : orgInfosList) {
-            Map<String, Object> map = new HashMap<>();
-            map.put("id", orgInfo.getId());
-            map.put("code", orgInfo.getCode());
-            map.put("name", orgInfo.getFullName());
-            map.put("pid", orgInfo.getUpGovId());
-            map.put("path", orgInfo.getPath());
-            if (orgNums.containsKey(orgInfo.getId()) && orgNums.get(orgInfo.getId()) > 0) {
-                map.put("isParent", true);
-            } else {
-                map.put("isParent", false);
-            }
-            mapList.add(map);
-        }
-        return mapList;
-    }
-
-
-    /**
-     * 根据ids获取初始树根节点
-     *
-     * @param mtAuthIds:管理范围ids
-     * @return
-     */
-    public List<Map<String, Object>> treeRootList(String mtAuthIds) {
-        if (StringUtils.isBlank(mtAuthIds)) {
-            return new ArrayList<>();
-        }
-        StringBuffer orgIds = new StringBuffer();
-        for (String orgIdStr : mtAuthIds.split(",")) {
-            String[] orgIdStatus = orgIdStr.split(":");
-            orgIds.append(orgIdStatus[0] + ",");
-        }
-        List<OrgInfo> orgInfosList = iOrgInfoFacade.getOrgsByIds(orgIds.toString());
-        Map<String, Long> orgNums = iOrgInfoFacade.countOrgByIds(orgIds.toString());
-        List<Map<String, Object>> mapList = this.orgToTreeNode(orgInfosList, orgNums);
-        mapList = TreeNodeUtils.generateTree(mapList, new SimpleTreeNodeItemResolver("id", "pid"), 0);
-        for (Map<String, Object> map : mapList) {
-            map.remove("children");
-        }
-        return mapList;
-    }
-
-    /**
-     * 异步获取子节点
-     *
-     * @param parentId  父节点id
-     * @param state     机构状态:0:未删除,1:已删除,null:全部
-     * @param mtAuthIds 管理范围,为""或null时不过滤
-     * @return
-     */
-    public List<Map<String, Object>> getChildTreeNode(String parentId, String state, String mtAuthIds) {
-        //子级机构
-        List<OrgInfo> childList = iOrgInfoFacade.getOrgListByUpId(parentId);
-        Map<String, Long> orgNums = iOrgInfoFacade.countOrgByUpOrgId(parentId, state);
-        if (StringUtils.isNotEmpty(mtAuthIds)) {
-            Iterator<OrgInfo> iterator = childList.iterator();
-            while (iterator.hasNext()) {
-                OrgInfo orgInfo = iterator.next();
-                //不在管理范围内
-                if (!OrgInfoUtil.isHaveAuth(orgInfo.getId(), orgInfo.getPath(), mtAuthIds)){
-                    iterator.remove();
-                }
-            }
-        }
-        List<Map<String, Object>> mapList = this.orgToTreeNode(childList, orgNums);
-        return mapList;
-    }
-
-    /**
-     * 管理员管理-管理范围-节点状态勾选
-     *
-     * @param treeNodes
-     * @param type         机构树类型
-     * @param targetUserId
-     * @return
-     */
-    public List<Map<String, Object>> checkTreeNode(List<Map<String, Object>> treeNodes, String type, String targetUserId) {
-        String mtAuthIds = mtAuthBusiness.getMtAuth(targetUserId, type);
-        for (Map<String, Object> treeNode : treeNodes) {
-            String orgId = (String) treeNode.get("id");
-            String path = (String) treeNode.get("path");
-            if (StringUtils.isNotEmpty(mtAuthIds) && mtAuthIds.indexOf(orgId + ":1") > -1) {//半勾选
-                treeNode.put("checked", "1");
-            } else if (OrgInfoUtil.isHaveAuth(orgId, path, mtAuthIds)) {//全勾选
-                treeNode.put("checked", "2");
-            } else {
-                treeNode.put("checked", "0");//未勾选
-            }
-        }
-        return treeNodes;
-    }
-
-
-    @ApiOperation(value = "完整树")
-    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "节点机构id"),
-            @ApiImplicitParam(name = "type", value = "'1':顶点为自身所在机构,0:根节点", required = true)})
-    @PostMapping(value = "org/tree/full")
-    public Result fullOrgTree(@RequestBody Map<String, String> params) {
-        String id = params.get("id");
-        String type = params.get("type");
-        if (StringUtils.isEmpty(id)) {
-            SecurityUser securityUser = SessionUtils.getUserInfo();
-            if (BooleanEnum.TRUE.getValue().equals(type) && StringUtils.isNotEmpty(securityUser.getDeptId())) {
-                id = securityUser.getDeptId();
-            } else {
-                id = iOrgInfoFacade.getRootOrgId();
-            }
-            List<OrgInfo> orgInfos = iOrgInfoFacade.getOrgsByIds(id);
-            Map<String, Long> orgNums = iOrgInfoFacade.countOrgByIds(id);
-            List<Map<String, Object>> resultList = this.orgToTreeNode(orgInfos, orgNums);
-            return Result.success(resultList);
-        } else {
-            List<Map<String, Object>> result = this.getChildTreeNode(id, BooleanEnum.FALSE.getValue(), null);
-            return Result.success(result);
-        }
-    }
-
-
-//    /**
-//     * 审计管理—机构树
-//     *
-//     * @param type 机构树类型 ORG:机构管理范围 USER:用户管理范围 APP:权限管理范围 MGE:管理员管理范围
-//     * @param id   异步加载的树节点
-//     * @return
-//     */
-//    @ApiOperation(value = "审计管理—机构树")
-//    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "节点机构id", required = true),
-//            @ApiImplicitParam(name = "type", value = "机构树类型 ORG:机构管理范围 USER:用户管理范围 APP:权限管理范围 MGE:管理员管理范围", required = true)})
-//    @PostMapping(value = "org/tree/audit")
-//    public Result userAuditTree(
-//            @RequestParam(value = "type", required = false) String type,
-//            @RequestParam(value = "id", required = false) String id) {
-//        //获取管理范围ids
-//        SecurityUser curUser = (SecurityUser) ContextUtils.getUserInfo();
-//        String mtAuthIds = mtAuthBusiness.getMtAuth(curUser.getId(), type);
-//        if (StringUtils.isEmpty(id)) {
-//            List<Map<String, Object>> result = this.treeRootList(mtAuthIds);
-//            return Result.success(result);
-//        } else {
-//            List<Map<String, Object>> result = this.getChildTreeNode(id, null, mtAuthIds);
-//            return Result.success(result);
-//        }
-//    }
-//
-    @ApiOperation(value = "机构树匹配")
-    @ApiImplicitParams({@ApiImplicitParam(name = "name", value = "机构id", required = false),
-            @ApiImplicitParam(name = "mtType", value = "机构树类型 org:机构管理范围 user:用户管理范围 app:权限管理范围 mge:管理员管理范围", required = false),
-            @ApiImplicitParam(name = "pageNum", value = "条数", required = false),
-            @ApiImplicitParam(name = "pageSize", value = "页数", required = false)
-    })
-    @PostMapping(value = "org/tree/match")
-    public Result orgMatch(@RequestBody Map<String, Object> params) {
-        String mtType = (String) params.get("mtType");
-        String name = (String) params.get("name");
-        Integer pageNum = (Integer) params.get("pageNum");
-        Integer pageSize = (Integer) params.get("pageSize");
-        String mts = "";
-        String id = UserContextUtils.getCurrentUser().getId();
-        if (StringUtils.isBlank(mtType)) {
-            mts = "";
-        } else {
-            mts = mtAuthBusiness.getMtAuth(id, SysConstants.MT_APP);
-        }
-        if (!authUserInfoFacade.isRootUser(id) && StringUtils.isBlank(mts) && !StringUtils.isBlank(mtType) && !"all".equals(mtType)) {
-            return Result.success();
-        }
-        ResponseDTO responseDTO = iOrgInfoFacade.orgMatch(name, mts, pageNum, pageSize);
-        return Result.success(StringUtils.getLong(responseDTO.getMessage()), responseDTO.getResult());
-    }
-
-//    private String getRootUser() {
-//        String rootUserId = authWebConfig.getRootUserId();
-//        if(null == rootUserId) {
-//            rootUserId = "";
-//        }
-//        return rootUserId;
-//    }
-
-//    @ApiOperation(value = "获取过滤后的父节点")
-//    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "机构id", required = true),
-//            @ApiImplicitParam(name = "type", value = "机构树类型 org:机构管理范围 user:用户管理范围 app:权限管理范围 mge:管理员管理范围", required = true),
-//    })
-//    @PostMapping(value = "org/tree/filter")
-//    public Result getFilterOrgTree(@RequestParam(value = "codeId") String codeId,
-//                                   @RequestParam(value = "type", required = false) String type) {
-//        OrgTreeNode node = iOrgInfoFacade.getOrgTreeNode(codeId);
-//        String path = node.getPath();
-//        String[] paths = path.split("-");
-//        List<String> levelOrder = new ArrayList<String>();
-//        String mtIds = "";
-//        if (StringUtils.isBlank(type)) {
-//            mtIds = "";
-//        } else if ("org".equals(type)) {
-//            mtIds = iOrgMtAuthFacade.mgeOrgRightRangeStr(ContextUtils.getUserInfo().getId());
-//        } else if ("user".equals(type)) {
-//            mtIds = iUserMtAuthFacade.mgeUserRightRangeStr(ContextUtils.getUserInfo().getId());
-//        } else if ("app".equals(type)) {
-//            mtIds = iAppMtAuthFacade.mgeAppRightRangeStr(ContextUtils.getUserInfo().getId());
-//        } else if ("mge".equals(type)) {
-//            mtIds = iMgeMtAuthFacade.mgeMgeRightRangeStr(ContextUtils.getUserInfo().getId());
-//        } else {
-//            mtIds = "";
-//        }
-//        for (String curNodeId : paths) {
-//            OrgTreeNode curNode = iOrgInfoFacade.getOrgTreeNode(curNodeId);
-//            if (OrgInfoUtil.isHaveAuth(curNode.getValue(), curNode.getPath(), mtIds) || StringUtils.isEmpty(mtIds)) {
-//                levelOrder.add(curNodeId);
-//            }
-//        }
-//        levelOrder.add(codeId);
-//        return Result.success(levelOrder);
-//    }
-
-}

+ 37 - 37
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/org/vo/GovOrgVo.java

@@ -1,37 +1,37 @@
-package com.dragoninfo.dcuc.authweb.restcontroller.org.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-/**
- * Created by Administrator on 2020/6/30.
- */
-@Data
-@ApiModel(value = "政务机构Vo")
-public class GovOrgVo {
-    //编号
-    @ApiModelProperty(value = "id",required = true)
-    private String id;
-
-    //机构代码(共12位)=行政区划(6位)+业务类型(2位)+扩展代码(4位)
-    @ApiModelProperty(value = "机构代码",required = true)
-    private String code;
-
-    //机构全称
-    @ApiModelProperty(value = "机构全称",required = true)
-    private String fullName;
-
-    //机构简称
-    @ApiModelProperty(value = "机构简称")
-    private String shortName;
-
-    // 上级政府机构id
-    @ApiModelProperty(value = "上级政府机构id")
-    private String upGovId;
-
-    // 上级政府机构名称
-    @ApiModelProperty(value = "上级政府机构名称")
-    private String upGovName;
-
-}
+//package com.dragoninfo.dcuc.authweb.restcontroller.org.vo;
+//
+//import io.swagger.annotations.ApiModel;
+//import io.swagger.annotations.ApiModelProperty;
+//import lombok.Data;
+//
+///**
+// * Created by Administrator on 2020/6/30.
+// */
+//@Data
+//@ApiModel(value = "政务机构Vo")
+//public class GovOrgVo {
+//    //编号
+//    @ApiModelProperty(value = "id",required = true)
+//    private String id;
+//
+//    //机构代码(共12位)=行政区划(6位)+业务类型(2位)+扩展代码(4位)
+//    @ApiModelProperty(value = "机构代码",required = true)
+//    private String code;
+//
+//    //机构全称
+//    @ApiModelProperty(value = "机构全称",required = true)
+//    private String fullName;
+//
+//    //机构简称
+//    @ApiModelProperty(value = "机构简称")
+//    private String shortName;
+//
+//    // 上级政府机构id
+//    @ApiModelProperty(value = "上级政府机构id")
+//    private String upGovId;
+//
+//    // 上级政府机构名称
+//    @ApiModelProperty(value = "上级政府机构名称")
+//    private String upGovName;
+//
+//}

+ 20 - 20
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/org/vo/MergersVo.java

@@ -1,20 +1,20 @@
-package com.dragoninfo.dcuc.authweb.restcontroller.org.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "机构合并入参Vo")
-public class MergersVo {
-
-    @ApiModelProperty(value = "合并机构id",required = true)
-    String orgId;
-
-    @ApiModelProperty(value = "目标机构Id",required = true)
-    String targetId;
-
-    @ApiModelProperty(value = "上级机构Id",required = true)
-    String upGovId;
-
-}
+//package com.dragoninfo.dcuc.authweb.restcontroller.org.vo;
+//
+//import io.swagger.annotations.ApiModel;
+//import io.swagger.annotations.ApiModelProperty;
+//import lombok.Data;
+//
+//@Data
+//@ApiModel(value = "机构合并入参Vo")
+//public class MergersVo {
+//
+//    @ApiModelProperty(value = "合并机构id",required = true)
+//    String orgId;
+//
+//    @ApiModelProperty(value = "目标机构Id",required = true)
+//    String targetId;
+//
+//    @ApiModelProperty(value = "上级机构Id",required = true)
+//    String upGovId;
+//
+//}

+ 103 - 103
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/org/vo/OrgVo.java

@@ -1,103 +1,103 @@
-package com.dragoninfo.dcuc.authweb.restcontroller.org.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.util.List;
-
-/**
- * Created by yica on 2020/5/12.
- */
-@Data
-@ApiModel(value = "机构Vo")
-public class OrgVo {
-
-
-    //编号
-    //编号
-    @ApiModelProperty(value = "id",required = true)
-    private String id;
-
-    //机构代码(共12位)=行政区划(6位)+业务类型(2位)+扩展代码(4位)
-    //编号
-    @ApiModelProperty(value = "机构代码",required = true)
-    private String code;
-
-    //机构全称
-    @ApiModelProperty(value = "机构全称",required = true)
-    private String fullName;
-
-    //机构简称
-    @ApiModelProperty(value = "机构简称")
-    private String shortName;
-
-    //行政区划
-    @ApiModelProperty(value = "行政区划",required = true)
-    private String areaCode;
-
-    //机构类别 1,行政单位,2 业务单位
-    @ApiModelProperty(value = "机构类别",required = true)
-    private String orgType;
-
-
-    //机构类型 1:正式 2:临时
-    @ApiModelProperty(name = "机构类型",required = true)
-    private String orgKind;
-
-    //标准代码
-    @ApiModelProperty(value = "标准代码",required = true)
-    private String bizType;
-
-    //单位层级;1:部级单位 2:厅级单位 3:局级单位 4:处级单位 5:科级单位 6:股级单位
-    @ApiModelProperty(value = "单位层级",required = true)
-    private String orgLevel;
-
-    //单位级别;01:正部级单位 02:副部级单位 11:正厅级单位 12:副厅级单位 21:正处级单位 22:副处级单位
-    //          31:正科级单位 32:副科级单位 41:正股级单位 42:副股级单位
-    @ApiModelProperty(value = "单位级别",required = true)
-    private String orgRank;
-
-    // 上级行政机构 行政隶属于那一个公安局的单位
-    @ApiModelProperty(value = "上级行政机构")
-    private String upGovId;
-
-    // 上级行政机构名称
-    @ApiModelProperty(value = "上级行政机构名称")
-    private String upGovName;
-
-    //上级单位code
-    @ApiModelProperty(value = "上级单位code")
-    private String upGovCode;
-
-    //联系人
-    @ApiModelProperty(value = "联系人")
-    private String linkMan;
-
-    //电话
-    @ApiModelProperty(value = "电话")
-    private String tel;
-
-    //E-mail
-    @ApiModelProperty(value = "E-mail")
-    private String email;
-
-    //单位类别
-    @ApiModelProperty(value = "单位类别")
-    private String unitClass;
-
-
-    //排序号
-    @ApiModelProperty(value = "SORT_NO")
-    private Integer sortNo;
-
-//    @ApiModelProperty(value = "机构管理员信息")
-//    private  List<NoticeUserVO> admins;
-
-
-
-
-
-
-
-}
+//package com.dragoninfo.dcuc.authweb.restcontroller.org.vo;
+//
+//import io.swagger.annotations.ApiModel;
+//import io.swagger.annotations.ApiModelProperty;
+//import lombok.Data;
+//
+//import java.util.List;
+//
+///**
+// * Created by yica on 2020/5/12.
+// */
+//@Data
+//@ApiModel(value = "机构Vo")
+//public class OrgVo {
+//
+//
+//    //编号
+//    //编号
+//    @ApiModelProperty(value = "id",required = true)
+//    private String id;
+//
+//    //机构代码(共12位)=行政区划(6位)+业务类型(2位)+扩展代码(4位)
+//    //编号
+//    @ApiModelProperty(value = "机构代码",required = true)
+//    private String code;
+//
+//    //机构全称
+//    @ApiModelProperty(value = "机构全称",required = true)
+//    private String fullName;
+//
+//    //机构简称
+//    @ApiModelProperty(value = "机构简称")
+//    private String shortName;
+//
+//    //行政区划
+//    @ApiModelProperty(value = "行政区划",required = true)
+//    private String areaCode;
+//
+//    //机构类别 1,行政单位,2 业务单位
+//    @ApiModelProperty(value = "机构类别",required = true)
+//    private String orgType;
+//
+//
+//    //机构类型 1:正式 2:临时
+//    @ApiModelProperty(name = "机构类型",required = true)
+//    private String orgKind;
+//
+//    //标准代码
+//    @ApiModelProperty(value = "标准代码",required = true)
+//    private String bizType;
+//
+//    //单位层级;1:部级单位 2:厅级单位 3:局级单位 4:处级单位 5:科级单位 6:股级单位
+//    @ApiModelProperty(value = "单位层级",required = true)
+//    private String orgLevel;
+//
+//    //单位级别;01:正部级单位 02:副部级单位 11:正厅级单位 12:副厅级单位 21:正处级单位 22:副处级单位
+//    //          31:正科级单位 32:副科级单位 41:正股级单位 42:副股级单位
+//    @ApiModelProperty(value = "单位级别",required = true)
+//    private String orgRank;
+//
+//    // 上级行政机构 行政隶属于那一个公安局的单位
+//    @ApiModelProperty(value = "上级行政机构")
+//    private String upGovId;
+//
+//    // 上级行政机构名称
+//    @ApiModelProperty(value = "上级行政机构名称")
+//    private String upGovName;
+//
+//    //上级单位code
+//    @ApiModelProperty(value = "上级单位code")
+//    private String upGovCode;
+//
+//    //联系人
+//    @ApiModelProperty(value = "联系人")
+//    private String linkMan;
+//
+//    //电话
+//    @ApiModelProperty(value = "电话")
+//    private String tel;
+//
+//    //E-mail
+//    @ApiModelProperty(value = "E-mail")
+//    private String email;
+//
+//    //单位类别
+//    @ApiModelProperty(value = "单位类别")
+//    private String unitClass;
+//
+//
+//    //排序号
+//    @ApiModelProperty(value = "SORT_NO")
+//    private Integer sortNo;
+//
+////    @ApiModelProperty(value = "机构管理员信息")
+////    private  List<NoticeUserVO> admins;
+//
+//
+//
+//
+//
+//
+//
+//}

+ 20 - 20
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/org/vo/SortVo.java

@@ -1,20 +1,20 @@
-package com.dragoninfo.dcuc.authweb.restcontroller.org.vo;
-
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "排序Vo")
-public class SortVo {
-
-    @ApiModelProperty(value = "需要拖动的机构",required = true)
-    String startId;
-
-    @ApiModelProperty(value = "拖动到目标机构",required = true)
-    String endId;
-
-    @ApiModelProperty(value = "prev:目标机构前,next: 目标机构后",required = true)
-    String moveType;
-}
+//package com.dragoninfo.dcuc.authweb.restcontroller.org.vo;
+//
+//
+//import io.swagger.annotations.ApiModel;
+//import io.swagger.annotations.ApiModelProperty;
+//import lombok.Data;
+//
+//@Data
+//@ApiModel(value = "排序Vo")
+//public class SortVo {
+//
+//    @ApiModelProperty(value = "需要拖动的机构",required = true)
+//    String startId;
+//
+//    @ApiModelProperty(value = "拖动到目标机构",required = true)
+//    String endId;
+//
+//    @ApiModelProperty(value = "prev:目标机构前,next: 目标机构后",required = true)
+//    String moveType;
+//}

+ 1 - 1
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/statisics/UserStatisicsController.java

@@ -1,6 +1,6 @@
 //package com.dragoninfo.dcuc.authweb.restcontroller.statisics;
 //package com.dragoninfo.dcuc.authweb.restcontroller.statisics;
 //
 //
-//import com.dragoninfo.dcuc.authweb.restcontroller.statisics.vo.OrgTreeNodeVo;
+//import com.dragoninfo.dcuc.authweb.restcontroller.sub.vo.org.OrgTreeNodeVo;
 //import com.dragoninfo.dcuc.duceap.enums.UserTypeEnum;
 //import com.dragoninfo.dcuc.duceap.enums.UserTypeEnum;
 //import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
 //import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
 //import com.dragoninfo.dcuc.org.vo.OrgTreeNode;
 //import com.dragoninfo.dcuc.org.vo.OrgTreeNode;

+ 0 - 52
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/statisics/vo/OrgTreeNodeVo.java

@@ -1,52 +0,0 @@
-package com.dragoninfo.dcuc.authweb.restcontroller.statisics.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-/**
- * @author mazq
- * 树节点Vo
- */
-@ApiModel
-@Data
-public class OrgTreeNodeVo {
-    @ApiModelProperty(value = "主键id")
-    String id;
-
-    @ApiModelProperty(value = "机构代码")
-    String code;
-
-    @ApiModelProperty(value = "机构名称")
-    String name;
-
-    @ApiModelProperty(value = "上级id")
-    String pid;
-
-    @ApiModelProperty(value = "路径")
-    String path;
-
-    @ApiModelProperty(value = "机构数量")
-    Integer orgNum;
-
-    @ApiModelProperty(value = "用户数量")
-    Integer userNum;
-
-    @ApiModelProperty(value = "警员数量")
-    Integer policeUserCount;
-
-    @ApiModelProperty(value = "警辅数量")
-    Integer auxiliUserCount;
-
-    @ApiModelProperty(value = "施工人员数量")
-    Integer extcerUserCount;
-
-    @ApiModelProperty(value = "是否是父节点")
-    Boolean isParent;
-
-    @ApiModelProperty(value = "机构名称")
-    String text;
-
-
-
-}

+ 191 - 21
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/sub/AuthOrgInfoController.java

@@ -1,25 +1,37 @@
 package com.dragoninfo.dcuc.authweb.restcontroller.sub;
 package com.dragoninfo.dcuc.authweb.restcontroller.sub;
 
 
+import cn.hutool.core.util.StrUtil;
 import com.dragoninfo.dcuc.auth.sub.dto.AuthOrgDTO;
 import com.dragoninfo.dcuc.auth.sub.dto.AuthOrgDTO;
 import com.dragoninfo.dcuc.auth.sub.dto.OrgTreeNodeDTO;
 import com.dragoninfo.dcuc.auth.sub.dto.OrgTreeNodeDTO;
 import com.dragoninfo.dcuc.auth.sub.facade.IAuthOrgInfoFacade;
 import com.dragoninfo.dcuc.auth.sub.facade.IAuthOrgInfoFacade;
-import com.dragoninfo.dcuc.authweb.restcontroller.statisics.vo.OrgTreeNodeVo;
+import com.dragoninfo.dcuc.authweb.business.MtAuthBusiness;
+import com.dragoninfo.dcuc.authweb.common.SysConstants;
+import com.dragoninfo.dcuc.authweb.restcontroller.org.vo.OrgRangeVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.sub.vo.org.AuthOrgVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.sub.vo.org.OrgTreeNodeVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.sub.vo.org.TreeReqVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.sub.vo.org.TreeReqVo;
 import com.dragoninfo.dcuc.authweb.util.VersionUtils;
 import com.dragoninfo.dcuc.authweb.util.VersionUtils;
+import com.dragoninfo.duceap.commons.util.server.OrgInfoUtil;
 import com.dragoninfo.duceap.core.response.Result;
 import com.dragoninfo.duceap.core.response.Result;
 import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
 import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
+import com.dragonsoft.duceap.base.entity.security.SecurityUser;
+import com.dragonsoft.duceap.base.utils.UserContextUtils;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageImpl;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 /**
 /**
@@ -33,59 +45,217 @@ public class AuthOrgInfoController {
 
 
 
 
     @Autowired
     @Autowired
-    private IAuthOrgInfoFacade orgInfoFacade;
+    private IAuthOrgInfoFacade authOrgInfoFacade;
+
+    @Autowired
+    private MtAuthBusiness mtAuthBusiness;
 
 
     @PostMapping("/page")
     @PostMapping("/page")
     @ApiOperation(value = "服务主体-机构信息列表")
     @ApiOperation(value = "服务主体-机构信息列表")
     @ApiImplicitParam(name = "searchDTO", value = "查询条件")
     @ApiImplicitParam(name = "searchDTO", value = "查询条件")
-    public Page<AuthOrgDTO> page(SearchDTO searchDTO) {
-        Page<AuthOrgDTO> page = orgInfoFacade.page(searchDTO);
-        return page;
+    public Page<AuthOrgVo> page(SearchDTO searchDTO) {
+        Page<AuthOrgDTO> page = authOrgInfoFacade.page(searchDTO);
+        List<AuthOrgDTO> content = page.getContent();
+        List<AuthOrgVo> collect = content.stream().map(e -> {
+            AuthOrgVo authOrgVo = new AuthOrgVo();
+            BeanUtils.copyProperties(e, authOrgVo);
+            return authOrgVo;
+        }).collect(Collectors.toList());
+        return new PageImpl<>(collect, page.getPageable(),page.getTotalElements());
     }
     }
 
 
     @GetMapping(value = "/detail/{id}")
     @GetMapping(value = "/detail/{id}")
     @ApiImplicitParam(name = "id", value = "机构信息ID")
     @ApiImplicitParam(name = "id", value = "机构信息ID")
     @ApiOperation(value = "服务主体-机构信息详情")
     @ApiOperation(value = "服务主体-机构信息详情")
-    public AuthOrgDTO detail(@PathVariable(value = "id") String id) {
-        return orgInfoFacade.get(id);
+    public AuthOrgVo detail(@PathVariable(value = "id") String id) {
+        AuthOrgDTO authOrgDTO = authOrgInfoFacade.get(id);
+        AuthOrgVo authOrgVo = new AuthOrgVo();
+        BeanUtils.copyProperties(authOrgDTO, authOrgVo);
+        return authOrgVo;
     }
     }
 
 
     @DeleteMapping(value = "/delete/{id}")
     @DeleteMapping(value = "/delete/{id}")
     @ApiImplicitParam(name = "id", value = "机构信息ID")
     @ApiImplicitParam(name = "id", value = "机构信息ID")
     @ApiOperation(value = "服务主体-机构信息删除")
     @ApiOperation(value = "服务主体-机构信息删除")
     public ResponseStatus delete(@PathVariable(value = "id") String id) {
     public ResponseStatus delete(@PathVariable(value = "id") String id) {
-        orgInfoFacade.deleteById(id);
+        authOrgInfoFacade.deleteById(id);
         return ResponseStatus.success();
         return ResponseStatus.success();
     }
     }
 
 
+    /**
+     * 获取单个树节点机构信息
+     */
+    @ApiOperation(value = "单个树节点信息")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "机构ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
+    @GetMapping(value = "org/tree/node/{id}")
+    public Result<OrgTreeNodeVo> orgTreeNode(@PathVariable("id") String id) {
+        OrgTreeNodeDTO orgTreeNode = authOrgInfoFacade.getOrgTreeNode(id);
+        OrgTreeNodeVo vo = new OrgTreeNodeVo();
+        BeanUtils.copyProperties(orgTreeNode, vo);
+        return Result.success(vo);
+    }
+
     /**
     /**
      * 当前用户的管理范围机构树
      * 当前用户的管理范围机构树
      *
      *
-     * @param reqVo
+     * @param params type:机构树类型 (APP:权限管理范围 MGE:管理员管理范围 ), id:异步加载的树节点
      * @return
      * @return
      */
      */
     @ApiOperation(value = "机构树")
     @ApiOperation(value = "机构树")
-    @ApiImplicitParam(name = "reqVo", value = "reqVo:机构树查询对象")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id"),
+            @ApiImplicitParam(name = "type", value = "type:机构树类型(APP:权限管理范围)")})
     @PostMapping(value = "org/tree/catalog")
     @PostMapping(value = "org/tree/catalog")
-    public Result<List<OrgTreeNodeVo>> orgTreeFromDB(@RequestBody TreeReqVo reqVo) {
-        String id = reqVo.getId();
-        List<OrgTreeNodeDTO> treeNodes = orgInfoFacade.getChildById(id);
-        List<OrgTreeNodeVo> collect = treeNodes.stream().map(item -> {
-            OrgTreeNodeVo nodeVo = new OrgTreeNodeVo();
-            BeanUtils.copyProperties(item, nodeVo);
-            return nodeVo;
-        }).collect(Collectors.toList());
-        return Result.success(collect);
+    public Result orgMtTreeYB(@RequestBody Map params) {
+        String id = (String) params.get("id");
+        String type = (String) params.get("type");
+        //获取管理范围ids
+        SecurityUser curUser = UserContextUtils.getCurrentUser();
+        String mtAuthIds = mtAuthBusiness.getMtAuth(curUser.getId(), type);
+        if (StringUtils.isEmpty(id)) {
+            //获取机构树根节点列表
+            List<OrgTreeNodeVo> result = this.treeRootList(mtAuthIds);
+            return Result.success(result);
+        } else {
+            List<OrgTreeNodeVo> result = this.getChildTreeNode(id, mtAuthIds);
+            return Result.success(result);
+        }
     }
     }
 
 
+    /**
+     * 管理员管理—管理范围—分配树
+     *
+     * @return
+     */
+    @ApiOperation(value = "管理员管理—管理范围—分配树")
+    @PostMapping(value = "org/tree/admin")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id"),
+            @ApiImplicitParam(name = "userId", value = "用户ID", required = true),
+            @ApiImplicitParam(name = "mtType", value = "type:机构树类型(APP:权限管理范围)", required = true)
+    })
+    public Result orgMtTreeWithChecked(@RequestBody OrgRangeVo orgRangeVo) {
+        String id = orgRangeVo.getId();
+        String mtType = orgRangeVo.getMtType();
+        String userId = orgRangeVo.getUserId();
+        //获取管理范围ids
+        SecurityUser curUser = UserContextUtils.getCurrentUser();
+        String mtAuthIds = mtAuthBusiness.getMtAuth(curUser.getId(), mtType);
+        //当临时表没有数据时候,获取登录人的权限范围
+        if (StringUtils.isEmpty(mtAuthIds) && SysConstants.MT_TEMP.equals(orgRangeVo.getMtType())) {
+            mtAuthIds = mtAuthBusiness.getMtAuth(curUser.getId(), SysConstants.MT_APP);
+        }
+        if (StringUtils.isEmpty(id)) {
+            //获取机构树根节点列表
+            List<OrgTreeNodeVo> result = this.treeRootList(mtAuthIds);
+            return Result.success(checkTreeNode(result, mtType, userId));
+        } else {
+            List<OrgTreeNodeVo> result  = this.getChildTreeNode(id, mtAuthIds);
+            return Result.success(checkTreeNode(result, mtType, userId));
+        }
+    }
 
 
     @ApiOperation(value = "机构树匹配")
     @ApiOperation(value = "机构树匹配")
-    @ApiImplicitParam(name = "reqVo", value = "reqVo:机构树查询对象")
+    @ApiImplicitParams({@ApiImplicitParam(name = "name", value = "机构id"),
+            @ApiImplicitParam(name = "mtType", value = "机构树类型 app:权限管理范围"),
+            @ApiImplicitParam(name = "pageNum", value = "条数"),
+            @ApiImplicitParam(name = "pageSize", value = "页数")
+    })
     @PostMapping(value = "org/tree/match")
     @PostMapping(value = "org/tree/match")
     public Result orgMatch(@RequestBody TreeReqVo reqVo) {
     public Result orgMatch(@RequestBody TreeReqVo reqVo) {
-        ResponseDTO<List<AuthOrgDTO>> responseDTO = orgInfoFacade.orgMatch(reqVo.getName(), reqVo.getPageNum(), reqVo.getPageSize());
+        String mtType = reqVo.getMtType();
+        String name = reqVo.getName();
+        Integer pageNum = reqVo.getPageNum();
+        Integer pageSize = reqVo.getPageSize();
+        String mts = "";
+        String id = UserContextUtils.getCurrentUser().getId();
+        if (StringUtils.isBlank(mtType)) {
+            mts = "";
+        } else {
+            mts = mtAuthBusiness.getMtAuth(id, SysConstants.MT_APP);
+        }
+        if (StringUtils.isBlank(mts) && !StringUtils.isBlank(mtType)) {
+            return Result.success();
+        }
+        ResponseDTO responseDTO = authOrgInfoFacade.orgMatch(name, mts, pageNum, pageSize);
         return Result.success(StringUtils.getLong(responseDTO.getMessage()), responseDTO.getResult());
         return Result.success(StringUtils.getLong(responseDTO.getMessage()), responseDTO.getResult());
     }
     }
 
 
+    /**
+     * 管理员管理-管理范围-节点状态勾选
+     *
+     * @param treeNodes
+     * @param type         机构树类型
+     * @param targetUserId
+     * @return
+     */
+    public List<OrgTreeNodeVo> checkTreeNode(List<OrgTreeNodeVo> treeNodes, String type, String targetUserId) {
+        String mtAuthIds = mtAuthBusiness.getMtAuth(targetUserId, type);
+        for (OrgTreeNodeVo treeNode : treeNodes) {
+            String orgId = treeNode.getId();
+            String path =  treeNode.getPath();
+            //半勾选
+            if (StringUtils.isNotEmpty(mtAuthIds) && mtAuthIds.contains(orgId + ":1")) {
+                treeNode.setChecked("1");
+            } else if (OrgInfoUtil.isHaveAuth(orgId, path, mtAuthIds)) {
+                //全勾选
+                treeNode.setChecked("2");
+            } else {
+                //未勾选
+                treeNode.setChecked("0");
+            }
+        }
+        return treeNodes;
+    }
+
+
+    /**
+     * 根据ids获取初始树根节点
+     *
+     * @param mtAuthIds :管理范围ids
+     * @return
+     */
+    public List<OrgTreeNodeVo> treeRootList(String mtAuthIds) {
+        if (StringUtils.isBlank(mtAuthIds)) {
+            return new ArrayList<>();
+        }
+        List<String> orgIds = new ArrayList<>();
+        for (String orgIdStr : mtAuthIds.split(StrUtil.COMMA)) {
+            String[] orgIdStatus = orgIdStr.split(StrUtil.COLON);
+            orgIds.add(orgIdStatus[0]);
+        }
+        List<OrgTreeNodeDTO> orgInfosList = authOrgInfoFacade.getOrgTreeNodeByIds(orgIds);
+        List<OrgTreeNodeVo> collect = orgInfosList.stream().map(e -> {
+            e.setChildIds(null);
+            OrgTreeNodeVo vo = new OrgTreeNodeVo();
+            BeanUtils.copyProperties(e, vo);
+            return vo;
+        }).collect(Collectors.toList());
+        return collect;
+    }
+
+    /**
+     * 异步获取子节点
+     *
+     * @param id  父节点id
+     * @param mtAuthIds 管理范围,为""或null时不过滤
+     * @return
+     */
+    public List<OrgTreeNodeVo> getChildTreeNode(String id, String mtAuthIds) {
+        //子级机构
+        List<OrgTreeNodeDTO> childList = authOrgInfoFacade.getChildById(id);
+        if (StringUtils.isNotEmpty(mtAuthIds)) {
+           childList = childList
+                   .stream()
+                   .filter(e-> OrgInfoUtil.isHaveAuth(e.getId(), e.getPath(), mtAuthIds))
+                   .collect(Collectors.toList());
+        }
+        return childList.stream().map(e->{
+            OrgTreeNodeVo nodeVo = new OrgTreeNodeVo();
+            BeanUtils.copyProperties(e, nodeVo);
+            return nodeVo;
+        }).collect(Collectors.toList());
+    }
 
 
 }
 }

+ 19 - 45
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/sub/vo/org/AuthOrgVo.java

@@ -1,80 +1,54 @@
 package com.dragoninfo.dcuc.authweb.restcontroller.sub.vo.org;
 package com.dragoninfo.dcuc.authweb.restcontroller.sub.vo.org;
 
 
-import com.dragonsoft.duceap.base.annotations.audit.DeletedBy;
-import com.dragonsoft.duceap.base.annotations.audit.DeletedDate;
-import org.hibernate.annotations.GenericGenerator;
-import org.springframework.data.annotation.CreatedBy;
-import org.springframework.data.annotation.CreatedDate;
-import org.springframework.data.annotation.LastModifiedBy;
-import org.springframework.data.annotation.LastModifiedDate;
-
-import javax.persistence.Column;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import java.util.Date;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 
 /**
 /**
  * @author mazq
  * @author mazq
  * @date 2021/6/11
  * @date 2021/6/11
  */
  */
+@ApiModel(value = "机构信息Vo")
+@Data
 public class AuthOrgVo {
 public class AuthOrgVo {
 
 
+    @ApiModelProperty(value = "主键id")
     private String id;
     private String id;
-    /**
-     * 上级行政机构代码
-     */
+
+    @ApiModelProperty(value = "上级行政机构代码")
     private String upGovCode;
     private String upGovCode;
 
 
+    @ApiModelProperty(value = "上级机构id")
     private String upGovId;
     private String upGovId;
 
 
-    /**
-     * 上级行政机构名称
-     */
+    @ApiModelProperty(value = "上级行政机构名称")
     private String upGovName;
     private String upGovName;
 
 
-    /**
-     * 机构代码
-     */
+    @ApiModelProperty(value = "机构代码")
     private String code;
     private String code;
 
 
-    /**
-     * 机构名称
-     */
+    @ApiModelProperty(value = "机构名称")
     private String fullName;
     private String fullName;
 
 
-    /**
-     * 机构类型
-     */
+    @ApiModelProperty(value = "机构类型")
     private String orgKind;
     private String orgKind;
 
 
-    /**
-     * 行政区划
-     */
+    @ApiModelProperty(value = "行政区划")
     private String areaCode;
     private String areaCode;
 
 
-    /**
-     * 机构类别
-     */
+    @ApiModelProperty(value = "机构类别")
     private String orgType;
     private String orgType;
 
 
-    /**
-     * 机构层级
-     */
+    @ApiModelProperty(value = "机构层级")
     private String orgLevel;
     private String orgLevel;
 
 
-    /**
-     * 单位级别
-     */
+    @ApiModelProperty(value = "单位级别")
     private String orgRank;
     private String orgRank;
 
 
-    /**
-     * 单位类别
-     */
+    @ApiModelProperty(value = "单位类别")
     private String unitClass;
     private String unitClass;
 
 
-    /**
-     * 层级路径
-     */
+    @ApiModelProperty(value = "层级路径")
     private String path;
     private String path;
 
 
 
 

+ 40 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/sub/vo/org/OrgTreeNodeVo.java

@@ -0,0 +1,40 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.sub.vo.org;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * 树节点Vo
+ */
+@ApiModel(value = "机构树节点Vo")
+@Data
+public class OrgTreeNodeVo {
+    @ApiModelProperty(value = "主键id")
+    private String id;
+
+    @ApiModelProperty(value = "机构代码")
+    private String code;
+
+    @ApiModelProperty(value = "机构名称")
+    private String name;
+
+    @ApiModelProperty(value = "上级id")
+    private String pid;
+
+    @ApiModelProperty(value = "路径")
+    private String path;
+
+    @ApiModelProperty(value = "是否是父节点")
+    private Boolean isParent;
+
+    @ApiModelProperty(value = "勾选状态")
+    private String checked;
+
+    @ApiModelProperty(value = "子节点id")
+    private List<String> childIds;
+
+}

+ 1 - 1
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/sub/vo/org/TreeReqVo.java

@@ -17,7 +17,7 @@ public class TreeReqVo {
     private String id;
     private String id;
 
 
     @ApiModelProperty(value = "机构树类型 (ORG:机构管理范围 USER:用户管理范围 APP:权限管理范围 MGE:管理员管理范围 )")
     @ApiModelProperty(value = "机构树类型 (ORG:机构管理范围 USER:用户管理范围 APP:权限管理范围 MGE:管理员管理范围 )")
-    private String type;
+    private String mtType;
 
 
     @ApiModelProperty(value = "搜索关键词")
     @ApiModelProperty(value = "搜索关键词")
     private String name;
     private String name;