lvzhangrun 3 năm trước cách đây
mục cha
commit
951903aae0

+ 2 - 2
dcuc-auth-service/pom.xml

@@ -62,11 +62,11 @@
             <version>2.2.3-tjdsj-SNAPSHOT</version>
         </dependency>
 
-        <dependency>
+        <!--<dependency>
             <groupId>com.dragoninfo</groupId>
             <artifactId>dcuc-org-api</artifactId>
             <version>2.0.3-tjdsj-SNAPSHOT</version>
-        </dependency>
+        </dependency>-->
 
 <!--        <dependency>-->
 <!--            <groupId>com.dragoninfo</groupId>-->

+ 3 - 3
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/admin/service/impl/AppMtAuthService.java

@@ -8,8 +8,8 @@ import com.dragoninfo.dcuc.auth.admin.repo.AppMtAuthRepository;
 import com.dragoninfo.dcuc.auth.admin.service.IAppMtAuthService;
 import com.dragoninfo.dcuc.auth.admin.service.IManageInfoService;
 import com.dragoninfo.dcuc.auth.admin.service.IMgeLogService;
+import com.dragoninfo.dcuc.auth.sub.service.IAuthOrgInfoService;
 import com.dragoninfo.dcuc.auth.sub.service.IAuthUserInfoService;
-import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.enums.BooleanEnum;
 import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
@@ -36,7 +36,7 @@ public class AppMtAuthService implements IAppMtAuthService {
     @Autowired
     private IAuthUserInfoService authUserInfoService;
     @Autowired
-    private IOrgInfoFacade orgInfoFacade;
+    private IAuthOrgInfoService authOrgInfoService;
     @Autowired
     private AppMtAuthRepository appMtAuthRepository;
 
@@ -84,7 +84,7 @@ public class AppMtAuthService implements IAppMtAuthService {
     @Override
     public String mgeAppRightRangeStr(String userId) {
         if (authUserInfoService.isRootUser(userId)) {
-            String rootOrgId = orgInfoFacade.getRootOrgId();
+            String rootOrgId = authOrgInfoService.getRootOrgId();
             if (StringUtils.isNotEmpty(rootOrgId)) {
                 return rootOrgId + ":2";
             }

+ 14 - 9
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/admin/service/impl/ManageInfoService.java

@@ -13,11 +13,11 @@ import com.dragoninfo.dcuc.auth.admin.service.IMgeLogService;
 import com.dragoninfo.dcuc.auth.admin.service.ITempMtAuthService;
 import com.dragoninfo.dcuc.auth.admin.vo.AdminAuditVO;
 import com.dragoninfo.dcuc.auth.sub.dto.AuthUserDTO;
+import com.dragoninfo.dcuc.auth.sub.dto.OrgTreeNodeDTO;
 import com.dragoninfo.dcuc.auth.sub.entity.AuthUserInfo;
+import com.dragoninfo.dcuc.auth.sub.service.IAuthOrgInfoService;
 import com.dragoninfo.dcuc.auth.sub.service.IAuthUserInfoService;
 import com.dragoninfo.dcuc.duceap.facade.ICodeListResourceFacade;
-import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
-import com.dragoninfo.dcuc.org.vo.OrgTreeNode;
 import com.dragoninfo.duceap.commons.util.server.OrgInfoUtil;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.entity.metadata.CodeRecord;
@@ -67,7 +67,7 @@ public class ManageInfoService implements IManageInfoService {
     @Autowired
     private IMgeLogService iMgeLogService;
     @Autowired
-    private IOrgInfoFacade orgInfoFacade;
+    private IAuthOrgInfoService authOrgInfoService;
 
     @Autowired
     private ICodeListResourceFacade codeListResourceFacade;
@@ -112,7 +112,8 @@ public class ManageInfoService implements IManageInfoService {
                 if(CollectionUtils.isEmpty(mtAuths)) {
                     return new PageImpl<>(new ArrayList(), searchable.getPage(), 0L);
                 }
-                Set<String> allMtOrgIds = orgInfoFacade.getAllMtOrgIds(mtAuths.get(0).getOrgId());
+                //  TODO
+                Set<String> allMtOrgIds = authOrgInfoService.getAllMtOrgIds(mtAuths.get(0).getOrgId());
                 searchable.addSearchFilter("orgId", SearchOperator.in, allMtOrgIds);
             }
         }
@@ -281,9 +282,12 @@ public class ManageInfoService implements IManageInfoService {
         String mgeMt = appMtAuthService.mgeAppRightRangeStr(curUser.getId());
         AuthUserInfo userInfo = authUserInfoService.findById(userId);
         String orgId = userInfo.getOrgId();
-        OrgTreeNode orgTreeNode = orgInfoFacade.getOrgTreeNode(orgId);
-
-        return OrgInfoUtil.isHaveAuth(userInfo.getOrgId(), orgTreeNode.getPath(), mgeMt);
+        //  TODO
+        List<OrgTreeNodeDTO> list = authOrgInfoService.getChildById(orgId);
+        if (CollectionUtils.isEmpty(list)) {
+            return false;
+        }
+        return OrgInfoUtil.isHaveAuth(userInfo.getOrgId(), list.get(0).getPath(), mgeMt);
     }
 
     @Override
@@ -303,14 +307,15 @@ public class ManageInfoService implements IManageInfoService {
                 if(CollectionUtils.isEmpty(mtAuths)) {
                     return new PageImpl<>(new ArrayList(), searchable.getPage(), 0L);
                 }
-                Set<String> allMtOrgIds = orgInfoFacade.getAllMtOrgIds(mtAuths.get(0).getOrgId());
+                //  TODO
+                Set<String> allMtOrgIds = authOrgInfoService.getAllMtOrgIds(mtAuths.get(0).getOrgId());
                 searchable.addSearchFilter("orgId", SearchOperator.in, allMtOrgIds);
             }
         }
         Page<AuthUserInfo> userInfoPage = manageInfoRepository.getManageUserInfo(searchable);
         List<AuthUserInfo> userInfos = userInfoPage.getContent();
         List<AuthUserDTO> collect = userInfos.stream().map(e -> {
-            //  TODO-Lvzr:过滤ADMIN数据,暂时写死,是否需要支持动态过滤
+            //  TODO:过滤ADMIN数据,暂时写死,是否需要支持动态过滤
             String name = e.getName();
             if (org.springframework.util.StringUtils.hasText(name) && "ADMIN".equalsIgnoreCase(name)) {
                 return null;

+ 7 - 6
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/audit/service/log/DataAuthLogHandler.java

@@ -15,15 +15,14 @@ import com.dragoninfo.dcuc.auth.auth.dto.data.SubDataDTO;
 import com.dragoninfo.dcuc.auth.auth.entity.DataAuth;
 import com.dragoninfo.dcuc.auth.auth.enumresources.SubDataAuthTypeEnum;
 import com.dragoninfo.dcuc.auth.sub.business.ILabelBusiness;
+import com.dragoninfo.dcuc.auth.sub.entity.AuthOrgInfo;
 import com.dragoninfo.dcuc.auth.sub.entity.AuthUserInfo;
+import com.dragoninfo.dcuc.auth.sub.service.IAuthOrgInfoService;
 import com.dragoninfo.dcuc.auth.sub.service.IAuthUserInfoService;
 import com.dragoninfo.dcuc.auth.sub.vo.LabelVO;
-import com.dragoninfo.dcuc.org.entity.OrgInfo;
-import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
 import com.dragonsoft.duceap.base.entity.security.SecurityUser;
 import com.dragonsoft.duceap.base.utils.UserContextUtils;
 import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
-import com.dragonsoft.duceap.core.context.ContextUtils;
 import com.google.common.collect.Lists;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -55,7 +54,7 @@ public class DataAuthLogHandler {
     private ILabelBusiness labelBusiness;
 
     @Autowired
-    private IOrgInfoFacade orgInfoFacade;
+    private IAuthOrgInfoService authOrgInfoService;
 
     @Autowired
     private IDataResourceFacade dataResourceFacade;
@@ -91,7 +90,8 @@ public class DataAuthLogHandler {
 
         //机构数据授权
         if (subType.equals(SubDataAuthTypeEnum.SUB_DATA_AUTH_ORG.getValue())) {
-            OrgInfo orgInfoByCode = orgInfoFacade.getOrgInfoByCode(subId);
+            //  TODO    orgInfoFacade.getOrgInfoByCode(subId);
+            AuthOrgInfo orgInfoByCode = authOrgInfoService.getByOrgCode(subId);
             authorizeSubjectDto.setSubjectId(orgInfoByCode.getCode());
             authorizeSubjectDto.setSubjectName(orgInfoByCode.getFullName());
         }
@@ -142,7 +142,8 @@ public class DataAuthLogHandler {
 
             //机构数据授权
             if (dataAuth.getSubType().equals(SubDataAuthTypeEnum.SUB_DATA_AUTH_ORG.getValue())) {
-                OrgInfo orgInfoByCode = orgInfoFacade.getOrgInfoByCode(dataAuth.getSubId());
+                //  TODO    orgInfoFacade.getOrgInfoByCode(subId);
+                AuthOrgInfo orgInfoByCode = authOrgInfoService.getByOrgCode(dataAuth.getSubId());
                 authorizeSubjectDto.setSubjectId(orgInfoByCode.getCode());
                 authorizeSubjectDto.setSubjectName(orgInfoByCode.getFullName());
             }

+ 9 - 8
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/impl/ServiceAuthBusinessImpl.java

@@ -18,11 +18,11 @@ import com.dragoninfo.dcuc.auth.auth.service.IServiceAuthResultService;
 import com.dragoninfo.dcuc.auth.auth.service.IWorkFlowService;
 import com.dragoninfo.dcuc.auth.config.DcucAuthApprovalConfig;
 import com.dragoninfo.dcuc.auth.config.DcucAuthConfig;
+import com.dragoninfo.dcuc.auth.sub.entity.AuthOrgInfo;
+import com.dragoninfo.dcuc.auth.sub.service.IAuthOrgInfoService;
 import com.dragoninfo.dcuc.common.Constants;
 import com.dragoninfo.dcuc.common.http.HttpUtil;
 import com.dragoninfo.dcuc.duceap.enums.AuthApplyTypeEnum;
-import com.dragoninfo.dcuc.org.entity.OrgInfo;
-import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
 import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.enums.BooleanEnum;
@@ -66,7 +66,7 @@ public class ServiceAuthBusinessImpl implements IServiceAuthBusiness {
     private IServiceResourceFacade serviceResourceFacade;
 
     @Autowired
-    private IOrgInfoFacade orgInfoFacade;
+    private IAuthOrgInfoService authOrgInfoService;
 
     @Autowired
     private IWorkFlowService workFlowService;
@@ -143,11 +143,12 @@ public class ServiceAuthBusinessImpl implements IServiceAuthBusiness {
         //设置应用的管理单位和事权单位信息
         String orgId = applyInfo.getOrgId();
         String managerOrgId = applyInfo.getManagerOrgId();
-        List<OrgInfo> orgsByIds = orgInfoFacade.getOrgsByIds(String.join(StrUtil.COMMA, orgId, managerOrgId));
-        Map<String, OrgInfo> orgInfoMap = orgsByIds.stream()
-                .collect(Collectors.toMap(OrgInfo::getId, item -> item, (old, laset) -> laset));
-        OrgInfo orgInfo = orgInfoMap.get(orgId);
-        OrgInfo managerOrgInfo = orgInfoMap.get(managerOrgId);
+        //  TODO
+        List<AuthOrgInfo> orgsByIds = authOrgInfoService.getByIds(Arrays.asList(orgId, managerOrgId));
+        Map<String, AuthOrgInfo> orgInfoMap = orgsByIds.stream()
+                .collect(Collectors.toMap(AuthOrgInfo::getId, item -> item, (old, laset) -> laset));
+        AuthOrgInfo orgInfo = orgInfoMap.get(orgId);
+        AuthOrgInfo managerOrgInfo = orgInfoMap.get(managerOrgId);
         if (null != orgInfo) {
             dto.setAppOrgName(orgInfo.getFullName());
             dto.setAppOrgCode(orgInfo.getCode());

+ 5 - 5
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/OrgQuotaAuthLogService.java

@@ -11,8 +11,8 @@ import com.dragoninfo.dcuc.auth.auth.entity.OrgQuotaAuthLog;
 import com.dragoninfo.dcuc.auth.auth.entity.RoleInfo;
 import com.dragoninfo.dcuc.auth.auth.enumresources.LogTypeEnum;
 import com.dragoninfo.dcuc.auth.auth.service.IOrgQuotaAuthLogService;
-import com.dragoninfo.dcuc.org.entity.OrgInfo;
-import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
+import com.dragoninfo.dcuc.auth.sub.entity.AuthOrgInfo;
+import com.dragoninfo.dcuc.auth.sub.service.IAuthOrgInfoService;
 import com.dragoninfo.duceap.core.service.impl.BaseService;
 import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
@@ -43,7 +43,7 @@ public class OrgQuotaAuthLogService extends BaseService<OrgQuotaAuthLog, String>
     private IApplyInfoFacade applyInfoFacade;
 
     @Autowired
-    private IOrgInfoFacade orgInfoFacade;
+    private IAuthOrgInfoService authOrgInfoService;
 
     public void setOrgQuotaAuthLogBPO(OrgQuotaAuthLogBPO orgQuotaAuthLogBPO) {
         this.orgQuotaAuthLogBPO = orgQuotaAuthLogBPO;
@@ -82,7 +82,7 @@ public class OrgQuotaAuthLogService extends BaseService<OrgQuotaAuthLog, String>
             String orgId = logMap.get("orgId");
             RoleInfo roleInfo = roleMap.containsKey(roleId) ? roleMap.get(roleId) : roleInfoBPO.get(roleId);
             ApplyInfo applyInfo = null;
-            OrgInfo orgInfo = null;
+            AuthOrgInfo orgInfo = null;
             if (!appMap.containsKey(appId)) {
                 applyInfo = applyInfoFacade.applyDetail(appId);
             } else {
@@ -91,7 +91,7 @@ public class OrgQuotaAuthLogService extends BaseService<OrgQuotaAuthLog, String>
             if (!orgMap.containsKey(orgId)) {
                 params.clear();
                 params.add("id", orgId);
-                orgInfo = orgInfoFacade.detail(orgId);
+                orgInfo = authOrgInfoService.findById(orgId);
             } else {
                 orgMap.get(orgId);
             }

+ 40 - 33
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/OrgQuotaAuthService.java

@@ -14,10 +14,10 @@ import com.dragoninfo.dcuc.auth.auth.enumresources.YesNotEnum;
 import com.dragoninfo.dcuc.auth.auth.service.IOrgQuotaAuthLogService;
 import com.dragoninfo.dcuc.auth.auth.service.IOrgQuotaAuthService;
 import com.dragoninfo.dcuc.auth.auth.service.IStaffAssignAuthInfoService;
+import com.dragoninfo.dcuc.auth.sub.dto.OrgTreeNodeDTO;
+import com.dragoninfo.dcuc.auth.sub.entity.AuthOrgInfo;
+import com.dragoninfo.dcuc.auth.sub.service.IAuthOrgInfoService;
 import com.dragoninfo.dcuc.auth.sub.service.IAuthUserInfoService;
-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.service.impl.BaseService;
 import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
@@ -37,6 +37,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * Created by liws on 2018/6/28.
@@ -57,7 +58,7 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
     @Autowired
     private IApplyInfoFacade applyInfoFacade;
     @Autowired
-    private IOrgInfoFacade orgInfoFacade;
+    private IAuthOrgInfoService authOrgInfoService;
 
     @Autowired
     private IAppMtAuthFacade appMtAuthFacade;
@@ -109,17 +110,17 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
         }
         if (roleInfo.getIsNotLimitCount().equalsIgnoreCase(BooleanEnum.FALSE.getValue())) {
             //机构path
-            List<OrgInfo> orgsByIds = orgInfoFacade.getOrgsByIds(userOrgId);
+            //  TODO
+            AuthOrgInfo authOrgInfo = authOrgInfoService.findById(userOrgId);
             String path = "";
             String[] paths = new String[]{};
-            if (CollectionUtils.isNotEmpty(orgsByIds)) {
-                path = orgsByIds.get(0).getPath();
-                if (StringUtils.isNotEmpty(path)) {
-                    paths = path.split("-");
-                }
-            } else {
+            if (null == authOrgInfo) {
                 return;
             }
+            path = authOrgInfo.getPath();
+            if (StringUtils.isNotEmpty(path)) {
+                paths = path.split("-");
+            }
             //不限制配额
             //获取机构信息,更新上级机构的YXF_NUM
             for (String currentOrg : paths) {
@@ -156,14 +157,15 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
         long time1 = System.currentTimeMillis();
         logger.info("authCancelChild:applyInfoFacade.applyDetail耗时:{} ms", (time1 - time));
 
-        OrgInfo orgInfo = orgInfoFacade.detail(orgId);
+        AuthOrgInfo orgInfo = authOrgInfoService.findById(orgId);
         if (orgInfo == null) {
             return ResponseStatus.fail("回收异常!");
         }
         long time2 = System.currentTimeMillis();
         logger.info("authCancelChild:orgInfoFacade.detail耗时:{} ms", (time2 - time1));
-
-        List<String> childIds = orgInfoFacade.getChildrenIds(orgId);
+        //  TODO
+        List<String> childIds = authOrgInfoService.getChildById(orgId)
+                .stream().map(OrgTreeNodeDTO::getId).collect(Collectors.toList());
         long time3 = System.currentTimeMillis();
         logger.info("authCancelChild:orgInfoFacade.getChildrenIds耗时:{} ms", (time3 - time2));
 
@@ -215,8 +217,9 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
 
     private int cancelQuota(String orgId, String appMtAuths, List<OrgQuotaAuthInfo> updateList, Map<String, OrgQuotaAuthInfo> orgQuotaAuthInfoMap) {
         int count = 0;
-
-        List<String> childrenIds = orgInfoFacade.getChildrenIds(orgId);
+        //  TODO
+        List<String> childrenIds = authOrgInfoService.getChildById(orgId)
+                .stream().map(OrgTreeNodeDTO::getId).collect(Collectors.toList());
 
         if (CollectionUtils.isNotEmpty(childrenIds)) {
             for (String cId : childrenIds) {
@@ -232,8 +235,12 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
         if (orgQuotaAuthInfo == null || (count == 0 && orgQuotaAuthInfo.getDfpNum() == 0)) {
             return count;
         }
-
-        OrgTreeNode orgTreeNode = orgInfoFacade.getOrgTreeNode(orgId);
+        //  TODO
+        List<OrgTreeNodeDTO> list = authOrgInfoService.getChildById(orgId);
+        if (CollectionUtils.isEmpty(list)) {
+            return count;
+        }
+        OrgTreeNodeDTO orgTreeNode = list.get(0);
 
         orgQuotaAuthInfo.setYxfNum(orgQuotaAuthInfo.getYxfNum() - count);
         if (orgTreeNode != null && OrgInfoUtil.isHaveAuth(orgId, orgTreeNode.getPath(), appMtAuths)) {
@@ -306,10 +313,10 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
 
         //查询用户拥有的应用机构管理权限范围机构
 
-        OrgInfo orgInfo = orgInfoFacade.detail(orgId);
+        AuthOrgInfo orgInfo = authOrgInfoService.findById(orgId);
         String pOrgId = orgInfo.getUpGovId();
 
-        OrgInfo upOrgInfo = orgInfoFacade.detail(pOrgId);
+        AuthOrgInfo upOrgInfo = authOrgInfoService.findById(pOrgId);
 
         boolean haveParentAuth = OrgInfoUtil.isHaveAuth(pOrgId, upOrgInfo.getPath(), appMtAuthOrgIds);
         String userId = ContextUtils.getUserInfo().getId();
@@ -376,11 +383,12 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
 
         String userId = userInfo.getId();
 
-        Map<String, Object> resultMap = orgInfoFacade.searchOrg(userId, rootId, unitClass, roleLevel);
+        //  TODO
+        Map<String, Object> resultMap = null/*orgInfoFacade.searchOrg(userId, rootId, unitClass, roleLevel)*/;
 
         ApplyInfo applyInfo = applyInfoFacade.applyDetail(appId);
 
-        OrgInfo rootOrg = orgInfoFacade.detail(rootId);
+        AuthOrgInfo rootOrg = authOrgInfoService.findById(rootId);
         int count = (Integer) resultMap.get("count");
         OrgQuotaAuthInfo rootOrgQuota = orgQuotaAuthInfoBpo.getOrgQuotoAuthInfo(appId, roleId, rootId);//获取当前本级机构配额信息
         //判断空闲名额是否足够
@@ -569,10 +577,9 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
 
     @Override
     public ResponseStatus changeQuotaWhenOrgMove(String orgId, String oldUpId, String newUpId) {
-
-        OrgTreeNode oldUpNode = orgInfoFacade.getOrgTreeNode(oldUpId);
-
-        OrgTreeNode newUpNode = orgInfoFacade.getOrgTreeNode(newUpId);
+        //  TODO
+        OrgTreeNodeDTO oldUpNode = authOrgInfoService.getOrgTreeNode(oldUpId);
+        OrgTreeNodeDTO newUpNode = authOrgInfoService.getOrgTreeNode(newUpId);
         return changeUpOrgYxfQuota(orgId, newUpId, oldUpNode, newUpNode);
     }
 
@@ -626,12 +633,12 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
 
     @Override
     public ResponseStatus changeQuotaWhenOrgMerfe(String orgId, String oldUpId, String newId) {
+        //  TODO
+        OrgTreeNodeDTO oldUpNode = authOrgInfoService.getOrgTreeNode(oldUpId);
 
-        OrgTreeNode oldUpNode = orgInfoFacade.getOrgTreeNode(oldUpId);
-
-        OrgTreeNode newNode = orgInfoFacade.getOrgTreeNode(newId);
+        OrgTreeNodeDTO newNode = authOrgInfoService.getOrgTreeNode(newId);
 
-        OrgTreeNode newUpNode = orgInfoFacade.getOrgTreeNode(newNode.getPid());
+        OrgTreeNodeDTO newUpNode = authOrgInfoService.getOrgTreeNode(newNode.getPid());
         //修改上级机构配额
         if (newUpNode != null) {
             changeUpOrgYxfQuota(orgId, newId, oldUpNode, newUpNode);
@@ -654,7 +661,7 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
         return ResponseStatus.success();
     }
 
-    private ResponseStatus changeUpOrgYxfQuota(String orgId, String newId, OrgTreeNode oldUpNode, OrgTreeNode newUpNode) {
+    private ResponseStatus changeUpOrgYxfQuota(String orgId, String newId, OrgTreeNodeDTO oldUpNode, OrgTreeNodeDTO newUpNode) {
         String oldUpPath = oldUpNode.getPath() + "-" + oldUpNode.getId();
         String newUpPath = newUpNode.getPath() + "-" + newUpNode.getId();
         //该增加已下发的机构ID
@@ -699,8 +706,8 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
     public List<String> getAppIds(String orgId) {
         List<String> appIds = applyInfoFacade.getAppIdsByOrgId(orgId);
         List<String> resultList = new ArrayList<>(appIds);
-
-        OrgTreeNode orgTreeNode = orgInfoFacade.getOrgTreeNode(orgId);
+        //  TODO
+        OrgTreeNodeDTO orgTreeNode = authOrgInfoService.getOrgTreeNode(orgId);
         String path = orgTreeNode.getPath();
         if (StringUtils.isBlank(path)) {
             return resultList;

+ 13 - 11
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/OrgRuleService.java

@@ -12,8 +12,8 @@ import com.dragoninfo.dcuc.auth.auth.entity.RoleInfo;
 import com.dragoninfo.dcuc.auth.auth.enumresources.YesNotEnum;
 import com.dragoninfo.dcuc.auth.auth.service.IOrgRuleService;
 import com.dragoninfo.dcuc.auth.auth.service.IRoleInfoService;
-import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
-import com.dragoninfo.dcuc.org.vo.OrgTreeNode;
+import com.dragoninfo.dcuc.auth.sub.dto.OrgTreeNodeDTO;
+import com.dragoninfo.dcuc.auth.sub.service.IAuthOrgInfoService;
 import com.dragoninfo.duceap.core.service.impl.BaseService;
 import com.dragonsoft.duceap.base.entity.security.SecurityUser;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
@@ -47,7 +47,7 @@ public class OrgRuleService extends BaseService<OrgRule, String> implements IOrg
     private IApplyInfoFacade applyInfoFacade;
 
     @Autowired
-    private IOrgInfoFacade orgInfoFacade;
+    private IAuthOrgInfoService authOrgInfoService;
     /**
      * 机构配额新建
      **/
@@ -59,16 +59,17 @@ public class OrgRuleService extends BaseService<OrgRule, String> implements IOrg
 
     @Override
     public void matching(String orgId) {
-
-        OrgTreeNode orgTreeNode = orgInfoFacade.getOrgTreeNode(orgId);
+        //  TODO
+        OrgTreeNodeDTO orgTreeNode = authOrgInfoService.getOrgTreeNode(orgId);
         String path = orgTreeNode.getPath();
         Searchable searchable = Searchable.newSearchable();
         if (StringUtils.isNotEmpty(path)) {
             path.replace("-", ",");
             searchable.addSearchFilter("topOrgId", SearchOperator.in, path);
         }
-        searchable.addSearchFilter("orgClass", SearchOperator.like, orgTreeNode.getUnitClass());
-        searchable.addSearchFilter("orgLevel", SearchOperator.ge, orgTreeNode.getOrgLevel());
+        //  TODO
+//        searchable.addSearchFilter("orgClass", SearchOperator.like, orgTreeNode.getUnitClass());
+//        searchable.addSearchFilter("orgLevel", SearchOperator.ge, orgTreeNode.getOrgLevel());
         searchable.addSort(Sort.Direction.DESC, "createTime");
         List<OrgRule> list = orgRuleBPO.find(OrgRule.class, searchable);
         Map<String, Integer> addNumMap = new HashMap<String, Integer>();
@@ -102,7 +103,8 @@ public class OrgRuleService extends BaseService<OrgRule, String> implements IOrg
             }
 
             String pid = orgTreeNode.getPid();
-            OrgTreeNode upGovNode = orgInfoFacade.getOrgTreeNode(pid);
+            //  TODO
+            OrgTreeNodeDTO upGovNode = authOrgInfoService.getOrgTreeNode(pid);
             if (upGovNode == null) {
                 return;
             }
@@ -125,7 +127,7 @@ public class OrgRuleService extends BaseService<OrgRule, String> implements IOrg
      * @param updataList 配额修改列表,统一保存
      * @param logList    配额分配日志,统一保存
      */
-    private void upGovQuota(OrgTreeNode node, RoleInfo roleInfo, SecurityUser user, Integer addNum, ApplyInfo applyInfo, List<OrgQuotaAuthInfo> createList, List<OrgQuotaAuthInfo> updataList, List<OrgQuotaAuthLog> logList) {
+    private void upGovQuota(OrgTreeNodeDTO node, RoleInfo roleInfo, SecurityUser user, Integer addNum, ApplyInfo applyInfo, List<OrgQuotaAuthInfo> createList, List<OrgQuotaAuthInfo> updataList, List<OrgQuotaAuthLog> logList) {
         String id = node.getId();
         String pid = node.getPid();
         OrgQuotaAuthInfo quotaAuthInfo = orgQuotaAuthInfoBpo.getOrgQuotoAuthInfo(roleInfo.getAppId(), roleInfo.getId(), id);
@@ -140,8 +142,8 @@ public class OrgRuleService extends BaseService<OrgRule, String> implements IOrg
         if (StringUtils.isEmpty(pid)) {
             return;
         }
-
-        OrgTreeNode upGovNode = orgInfoFacade.getOrgTreeNode(pid);
+        //  TODO
+        OrgTreeNodeDTO upGovNode = authOrgInfoService.getOrgTreeNode(pid);
         if (upGovNode == null) {
             return;
         }

+ 11 - 10
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/RoleAuthInfoService.java

@@ -9,11 +9,12 @@ import com.dragoninfo.dcuc.auth.auth.entity.StaffAssignAuthInfo;
 import com.dragoninfo.dcuc.auth.auth.service.IRoleAuthInfoService;
 import com.dragoninfo.dcuc.auth.auth.vo.RoleInfoVO;
 import com.dragoninfo.dcuc.auth.auth.vo.TreeInfoVO;
+import com.dragoninfo.dcuc.auth.sub.entity.AuthOrgInfo;
+import com.dragoninfo.dcuc.auth.sub.service.IAuthOrgInfoService;
 import com.dragoninfo.dcuc.auth.util.TreeUtil;
-import com.dragoninfo.dcuc.org.entity.OrgInfo;
-import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
 import com.dragoninfo.duceap.core.service.impl.BaseService;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
+import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
 import com.dragonsoft.duceap.core.search.Searchable;
 import com.dragonsoft.duceap.core.search.enums.SearchOperator;
@@ -43,7 +44,7 @@ public class RoleAuthInfoService extends BaseService<RoleAuthInfo, String> imple
 //    private IOrgQuotaAuthService iOrgQuotaAuthService;
 
     @Autowired
-    private IOrgInfoFacade orgInfoFacade;
+    private IAuthOrgInfoService authOrgInfoService;
 
 
 //    public boolean isStaffPass(String appId, String staffId, String orgId, Searchable searchable, String[] roleList, Long roleListSize) {
@@ -179,19 +180,19 @@ public class RoleAuthInfoService extends BaseService<RoleAuthInfo, String> imple
     public List<TreeInfoVO> getRptOrgListByPid(String orgId, String appId, boolean isInit, SearchDTO searchDTO) {
         List<TreeInfoVO> treeInfoList = new ArrayList<>();
         List<TreeInfoVO> childrenList = null;
-        Map<String, OrgInfo> orgInfoMap = new HashMap<>();
+        Map<String, AuthOrgInfo> orgInfoMap = new HashMap<>();
         List<String> childIds = new ArrayList<>();
         Page<TreeInfoVO> firstOrg = roleAuthInfoBPO.getRptList(appId, Searchable.toSearchable(searchDTO).addSearchFilter("id", SearchOperator.eq, orgId));//获取报表列表选择的机构作为顶级节点
         TreeInfoVO rootTreeInfo = firstOrg.getContent().get(0);//顶级节点对象
         if (isInit) {
-            OrgInfo orgInfo = orgInfoFacade.detail(orgId);
+            AuthOrgInfo orgInfo = authOrgInfoService.findById(orgId);
             setTreeInfo(rootTreeInfo, orgInfo);
             treeInfoList.add(rootTreeInfo);
             return treeInfoList;
         }
-
-        List<OrgInfo> orgList = orgInfoFacade.getOrgListByUpId(orgId);
-        for (OrgInfo orgInfo : orgList) {
+        //  TODO
+        List<AuthOrgInfo> orgList = authOrgInfoService.getByIds(CollectionUtils.createSingleList(orgId));
+        for (AuthOrgInfo orgInfo : orgList) {
             String id = orgInfo.getId();
             orgInfoMap.put(id, orgInfo);
             childIds.add(id);
@@ -201,7 +202,7 @@ public class RoleAuthInfoService extends BaseService<RoleAuthInfo, String> imple
             return null;
         }
         for (TreeInfoVO treeInfoVO : childrenList) {
-            OrgInfo orgInfo = orgInfoMap.get(treeInfoVO.getId());
+            AuthOrgInfo orgInfo = orgInfoMap.get(treeInfoVO.getId());
             setTreeInfo(treeInfoVO, orgInfo);
         }
         //根据指定节点获取子节点树结构列表
@@ -209,7 +210,7 @@ public class RoleAuthInfoService extends BaseService<RoleAuthInfo, String> imple
         return childrenList;
     }
 
-    private void setTreeInfo(TreeInfoVO rootTreeInfo, OrgInfo orgInfo) {
+    private void setTreeInfo(TreeInfoVO rootTreeInfo, AuthOrgInfo orgInfo) {
         String upGovId = orgInfo.getUpGovId();
         String fullName = orgInfo.getFullName();
         String code = orgInfo.getCode();

+ 4 - 4
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/RoleInfoService.java

@@ -22,10 +22,10 @@ import com.dragoninfo.dcuc.auth.auth.vo.DcucRoleVO;
 import com.dragoninfo.dcuc.auth.auth.vo.RoleInfoVO;
 import com.dragoninfo.dcuc.auth.auth.vo.RsGridCheckedVO;
 import com.dragoninfo.dcuc.auth.config.DcucAuthConfig;
+import com.dragoninfo.dcuc.auth.sub.entity.AuthOrgInfo;
 import com.dragoninfo.dcuc.auth.sub.entity.AuthUserInfo;
+import com.dragoninfo.dcuc.auth.sub.service.IAuthOrgInfoService;
 import com.dragoninfo.dcuc.auth.sub.service.IAuthUserInfoService;
-import com.dragoninfo.dcuc.org.entity.OrgInfo;
-import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
 import com.dragoninfo.duceap.core.enums.RoleLevelEnum;
 import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
@@ -81,7 +81,7 @@ public class RoleInfoService implements IRoleInfoService {
     private IManageInfoService manageInfoService;
 
     @Autowired
-    private IOrgInfoFacade orgInfoFacade;
+    private IAuthOrgInfoService authOrgInfoService;
 
     @Override
     public Page<RoleInfoVO> page(Searchable searchable) {
@@ -415,7 +415,7 @@ public class RoleInfoService implements IRoleInfoService {
         }
 
         String orgId = userInfo.getOrgId();
-        OrgInfo orgInfo = orgInfoFacade.detail(orgId);
+        AuthOrgInfo orgInfo = authOrgInfoService.findById(orgId);
         if (orgInfo == null || YesNotEnum.YES.getValue().equals(orgInfo.getDeleted())) {
             return result;
         }

+ 6 - 6
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/StaffAssignAuthInfoService.java

@@ -23,10 +23,10 @@ import com.dragoninfo.dcuc.auth.auth.service.IOrgQuotaAuthService;
 import com.dragoninfo.dcuc.auth.auth.service.IRoleInfoService;
 import com.dragoninfo.dcuc.auth.auth.service.IStaffAssignAuthInfoService;
 import com.dragoninfo.dcuc.auth.auth.service.IStaffAssignAuthLogService;
+import com.dragoninfo.dcuc.auth.sub.entity.AuthOrgInfo;
 import com.dragoninfo.dcuc.auth.sub.entity.AuthUserInfo;
+import com.dragoninfo.dcuc.auth.sub.service.IAuthOrgInfoService;
 import com.dragoninfo.dcuc.auth.sub.service.IAuthUserInfoService;
-import com.dragoninfo.dcuc.org.entity.OrgInfo;
-import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
 import com.dragonsoft.duceap.base.entity.security.SecurityUser;
@@ -79,7 +79,7 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
     @Autowired
     private IAuthUserInfoService authUserInfoService;
     @Autowired
-    private IOrgInfoFacade orgInfoFacade;
+    private IAuthOrgInfoService authOrgInfoService;
 
     @Autowired
     private LogInfoFillService logInfoFillService;
@@ -540,7 +540,7 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
 
     private boolean isEnoughQuota(String appId, String appOrgId, String roleId, String orgId, int needNum, boolean isAdd) {
         RoleInfo roleInfo = roleInfoService.get(roleId);
-        String rootOrgId = orgInfoFacade.getRootOrgId();
+//        String rootOrgId = authOrgInfoService.getRootOrgId();
         if (BooleanEnum.FALSE.getValue().equals(roleInfo.getIsNotLimitCount())) {
             return true;
         }
@@ -872,8 +872,8 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
         SecurityUser securityUser = (SecurityUser) ContextUtils.getUserInfo();
         AuthUserInfo userInfo = authUserInfoService.findById(dto.getUserId());
         String orgId = userInfo.getOrgId();
-
-        List<OrgInfo> orgsByIds = orgInfoFacade.getOrgsByIds(orgId);
+        //  TODO
+        List<AuthOrgInfo> orgsByIds = authOrgInfoService.getByIds(CollectionUtils.createSingleList(orgId));
 
         String userOrgPath = "";
         if (CollectionUtils.isNotEmpty(orgsByIds)) {

+ 14 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/sub/service/IAuthOrgInfoService.java

@@ -9,6 +9,7 @@ import com.dragonsoft.duceap.core.search.Searchable;
 import org.springframework.data.domain.Page;
 
 import java.util.List;
+import java.util.Set;
 
 /**
  * @author wangrs
@@ -99,6 +100,9 @@ public interface IAuthOrgInfoService{
      */
     List<OrgTreeNodeDTO> getChildById(String id);
 
+    //  TODO
+    OrgTreeNodeDTO getOrgTreeNode(String id);
+
     /**
      * 名称或是code查询机构
      * @param name
@@ -114,4 +118,14 @@ public interface IAuthOrgInfoService{
      * @return
      */
     List<AuthOrgInfo> getByIds(List<String> orgIds);
+
+    /**
+     * TODO:把管理范围转换成所以的机构集合
+     *
+     * @param mtIds 管理范围
+     * @return 机构ID集合
+     */
+    Set<String> getAllMtOrgIds(String mtIds);
+
+    String getRootOrgId();
 }

+ 33 - 3
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/sub/service/impl/AuthOrgInfoService.java

@@ -1,12 +1,12 @@
 package com.dragoninfo.dcuc.auth.sub.service.impl;
 
 import com.dragoninfo.dcuc.auth.auth.constance.CommonCons;
-import com.dragoninfo.dcuc.auth.sub.repo.AuthOrgInfoRepository;
-import com.dragoninfo.dcuc.auth.sub.repo.ChildCountDO;
 import com.dragoninfo.dcuc.auth.sub.dto.AuthOrgDTO;
 import com.dragoninfo.dcuc.auth.sub.dto.ExcelImpOrgInfo;
 import com.dragoninfo.dcuc.auth.sub.dto.OrgTreeNodeDTO;
 import com.dragoninfo.dcuc.auth.sub.entity.AuthOrgInfo;
+import com.dragoninfo.dcuc.auth.sub.repo.AuthOrgInfoRepository;
+import com.dragoninfo.dcuc.auth.sub.repo.ChildCountDO;
 import com.dragoninfo.dcuc.auth.sub.service.IAuthOrgInfoService;
 import com.dragoninfo.dcuc.auth.util.ImportUtil;
 import com.dragoninfo.dcuc.duceap.enums.OrgKindEnum;
@@ -21,6 +21,7 @@ import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
 import com.dragonsoft.duceap.core.search.Searchable;
 import com.dragonsoft.duceap.core.search.enums.SearchOperator;
+import lombok.Getter;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.Cell;
@@ -29,13 +30,13 @@ import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageImpl;
 import org.springframework.data.jpa.domain.Specification;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import javax.persistence.criteria.Predicate;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -51,6 +52,10 @@ import java.util.stream.Collectors;
 @Transactional(rollbackFor = RuntimeException.class)
 public class AuthOrgInfoService implements IAuthOrgInfoService {
 
+    @Value("${dcuc.org.root-org-id}")
+    @Getter
+    private String rootOrgId;
+
     private List<String> excelTitle = Arrays.asList("上级行政机构","机构类型","机构名称","行政区划","机构代码","机构类别","单位层级","单位级别","单位类别");
 
     public static volatile Boolean cacheSuccess = false;
@@ -455,6 +460,20 @@ public class AuthOrgInfoService implements IAuthOrgInfoService {
         return collect;
     }
 
+    /**
+     * TODO
+     * @param id
+     * @return
+     */
+    @Override
+    public OrgTreeNodeDTO getOrgTreeNode(String id) {
+        List<OrgTreeNodeDTO> list = getChildById(id);
+        if (CollectionUtils.isEmpty(list)) {
+            throw new RuntimeException("Empty OrgTreeNodes.");
+        }
+        return list.get(0);
+    }
+
     public List<AuthOrgInfo> getChildOrgById(String id) {
         List<AuthOrgInfo> child;
         if(StringUtils.isBlank(id)) {
@@ -484,6 +503,17 @@ public class AuthOrgInfoService implements IAuthOrgInfoService {
         return orgInfoRepository.findAllById(orgIds);
     }
 
+    /**
+     * TODO
+     *
+     * @param mtIds 管理范围
+     * @return
+     */
+    @Override
+    public Set<String> getAllMtOrgIds(String mtIds) {
+        return null;
+    }
+
     public void codeListCache() {
         try {
             log.info("-------------codeListCache START--------------");

+ 2 - 0
dcuc-auth-service/src/main/resources/application-auth.yml

@@ -1,4 +1,6 @@
 dcuc:
+  org:
+    root-org-id: 7F08CCC3C4984A2586C9D3F0A6B804E5
   auth:
     app-code: QXXT0000000000000001
     menu-noclear: true