Преглед на файлове

类型查询增加返回字段type

linhuili преди 3 години
родител
ревизия
cdb3e4afc1

+ 6 - 0
src/main/java/com/persagy/proxy/adm/model/AdmObjectType.java

@@ -56,4 +56,10 @@ public class AdmObjectType {
 
     /** 子列表 */
     private List<AdmObjectType> children;
+
+    /** 创建时间 */
+    private String createTime;
+
+    /** 更新时间 */
+    private String lastUpdate;
 }

+ 34 - 2
src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmDictBaseServiceImpl.java

@@ -99,10 +99,11 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
         // 调用中台查询
         DmpResult<JSONArray> dmpResult = rwdClient.queryObjectType(context, para);
         JSONArray data = dmpResult.getData();
-        List<T> admVOs = new ArrayList<>();
+        List<AdmObjectType> admVOs = new ArrayList<>();
         if(CollUtil.isNotEmpty(data)){
-            admVOs = data.toJavaList(clazz);
+            admVOs = data.toJavaList(AdmObjectType.class);
         }
+        List<AdmObjectType> content = dictDefTypeTransfer(admVOs);
         // 设置返回值
         AdmResponse response = AdmResponse.success(admVOs);
         Long total = dmpResult.getCount() == null ? null : dmpResult.getCount().longValue();
@@ -224,6 +225,7 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
             objectType.setAliasCode(dicData.get("code").textValue());
             objectType.setAliasName(dicData.get("label").textValue());
             objectType.setObjType(dicData.get("type").textValue());
+
             result.add(objectType);
         }
         return result;
@@ -258,4 +260,34 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
         return dmpCriteria;
     }
 
+
+    /**
+     * 字典类型返回结构与ADM兼容
+     * @param data
+     */
+    private List<AdmObjectType> dictDefTypeTransfer(List<AdmObjectType> data){
+        if(CollUtil.isEmpty(data)){
+            return new ArrayList<>();
+        }
+        for (AdmObjectType datum : data) {
+            String projectId = datum.getProjectId();
+            String groupCode = datum.getGroupCode();
+            if(StringUtils.isNotEmpty(groupCode) && !"0".equals(groupCode)){
+                //集团级
+                datum.setType("group");
+            }else if(StringUtils.isNotEmpty(projectId) && !"0".equals(projectId)){
+                //项目级
+                datum.setType("project");
+            }else{
+                //平台级
+                datum.setType("common");
+            }
+
+            //todo 页面不展示问题字段测试
+            datum.setCreateTime("2021-04-16 10:29:46");
+            datum.setLastUpdate("2021-04-16 10:29:46");
+        }
+
+        return data;
+    }
 }