Sfoglia il codice sorgente

需求:实现根据revit.project表查询集团编码的逻辑

lijie 3 anni fa
parent
commit
966b03f13f

+ 12 - 0
pom.xml

@@ -89,6 +89,18 @@
 					<artifactId>asm</artifactId>
 					<groupId>org.ow2.asm</groupId>
 				</exclusion>
+				<exclusion>
+					<artifactId>poi</artifactId>
+					<groupId>org.apache.poi</groupId>
+				</exclusion>
+				<exclusion>
+					<artifactId>poi-ooxml</artifactId>
+					<groupId>org.apache.poi</groupId>
+				</exclusion>
+				<exclusion>
+					<artifactId>poi-ooxml-schemas</artifactId>
+					<groupId>org.apache.poi</groupId>
+				</exclusion>
 			</exclusions>
 		</dependency>
         <dependency>

+ 17 - 18
src/main/java/com/persagy/proxy/common/service/impl/EmsAuthServiceImpl.java

@@ -40,7 +40,12 @@ public class EmsAuthServiceImpl extends AbstractAuthServiceImpl {
             // 两者都为空时不做校验
             return;
         }
-        ResultReturn<Group> queryResult = emsSaasWebClient.queryGroupProjectList(new JSONObject());
+        //
+        JSONObject param = new JSONObject();
+        if (StrUtil.isNotBlank(AppContext.getContext().getProjectId())){
+            param.put(CommonConstant.QUERY_PROJECTIDS,CollUtil.newArrayList(AppContext.getContext().getProjectId()));
+        }
+        ResultReturn<Group> queryResult = emsSaasWebClient.queryGroupProjectList(param);
         if (!CommonConstant.QUERY_SUCCESS.equals(queryResult.getResult())){
             throw new BusinessException(queryResult.getResultMsg());
         }
@@ -51,26 +56,20 @@ public class EmsAuthServiceImpl extends AbstractAuthServiceImpl {
         Map<String, List<Project>> groupMap = content.stream()
                 .collect(Collectors.toMap(Group::getGroupCode, Group::getProjects, (k1, k2) -> k1));
         // 1.没有集团编码时根据项目匹配集团
-        if (StrUtil.isBlank(AppContext.getContext().getGroupCode())){
-            // 如果集团编码为空则通过项目id查找
-            Set<Map.Entry<String, List<Project>>> entries = groupMap.entrySet();
-            flag:
-            for (Map.Entry<String, List<Project>> entry : entries) {
-                if (CollUtil.isEmpty(entry.getValue())){
-                    continue;
-                }
-                for (Project project : entry.getValue()) {
-                    if (AppContext.getContext().getProjectId().equals(project.getProjectId())){
-                        AppContext.getContext().setGroupCode(entry.getKey());
-                        break flag;
-                    }
+        // 如果集团编码为空则通过项目id查找
+        Set<Map.Entry<String, List<Project>>> entries = groupMap.entrySet();
+        flag:
+        for (Map.Entry<String, List<Project>> entry : entries) {
+            if (CollUtil.isEmpty(entry.getValue())){
+                continue;
+            }
+            for (Project project : entry.getValue()) {
+                if (AppContext.getContext().getProjectId().equals(project.getProjectId())){
+                    AppContext.getContext().setGroupCode(entry.getKey());
+                    break flag;
                 }
             }
         }
-//        if (StrUtil.isBlank(AppContext.getContext().getGroupCode())){
-//            // 无集团编码时,默认为配置的集团编码
-//            AppContext.getContext().setGroupCode(SpringHelper.getString(AdmCommonConstant.MIDDLEWARE_GROUP_CODE));
-//        }
         // 2.验证集团是否有效
         if (StrUtil.isBlank(AppContext.getContext().getGroupCode())
                 || !groupMap.containsKey(AppContext.getContext().getGroupCode())){