|
@@ -22,6 +22,7 @@ import com.persagy.dmp.common.constant.ResponseCode;
|
|
|
import com.persagy.dmp.common.exception.BusinessException;
|
|
|
import com.persagy.dmp.common.helper.SpringHelper;
|
|
|
import com.persagy.dmp.define.entity.GraphDefine;
|
|
|
+import com.persagy.dmp.define.entity.ObjectInfoDefine;
|
|
|
import com.persagy.dmp.define.entity.RelationDefine;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -47,7 +48,7 @@ public class ToolController {
|
|
|
private IConfigService configService;
|
|
|
|
|
|
@RequestMapping("/dict")
|
|
|
- public AdmResult<Object> dict(@RequestBody AdmRequest req){
|
|
|
+ public AdmResult<Object> dict(@RequestBody AdmRequest req, @RequestParam(required = false) String module){
|
|
|
Map<String,Object> map = syncApp.queryDict(req.getGroupCode(), req.getProjectId(), req.getUserId());
|
|
|
|
|
|
List<Map<String, Object>> majorList = (List)map.get("major");
|
|
@@ -75,31 +76,36 @@ public class ToolController {
|
|
|
}
|
|
|
map.remove("system");
|
|
|
|
|
|
- List<RelationDefine> relDefs = (List<RelationDefine>)map.get("relation");
|
|
|
- List<GraphDefine> graph = ServiceUtil.call (() -> rwdClient.queryGraphDef(req.getGroupCode(), req.getProjectId(), AdmConst.APP_ID, req.getUserId(), new QueryCriteria()));
|
|
|
- List<Map<String, Object>> rels = new ArrayList<>();
|
|
|
- for(GraphDefine gd : graph){
|
|
|
- HashMap<String, Object> m = new HashMap<>();
|
|
|
- m.put("code", gd.getCode());
|
|
|
- m.put("name", gd.getName());
|
|
|
- m.put("type", "graph");
|
|
|
- rels.add(m);
|
|
|
-
|
|
|
- ArrayList<RelationDefine> chidren = new ArrayList<>();
|
|
|
- m.put("children", chidren);
|
|
|
- for(RelationDefine relDef : relDefs) {
|
|
|
- if(relDef.getGraphCode().equals(gd.getCode()))
|
|
|
- chidren.add(relDef);
|
|
|
+ if("infos".equals(module)) { //信息点配置
|
|
|
+ map.remove("relation");
|
|
|
+
|
|
|
+ } else { //关系、管道、无模型设备
|
|
|
+ List<RelationDefine> relDefs = (List<RelationDefine>)map.get("relation");
|
|
|
+ List<GraphDefine> graph = ServiceUtil.call (() -> rwdClient.queryGraphDef(req.getGroupCode(), req.getProjectId(), AdmConst.APP_ID, req.getUserId(), new QueryCriteria()));
|
|
|
+ List<Map<String, Object>> rels = new ArrayList<>();
|
|
|
+ for(GraphDefine gd : graph){
|
|
|
+ HashMap<String, Object> m = new HashMap<>();
|
|
|
+ m.put("code", gd.getCode());
|
|
|
+ m.put("name", gd.getName());
|
|
|
+ m.put("type", "graph");
|
|
|
+ rels.add(m);
|
|
|
+
|
|
|
+ ArrayList<RelationDefine> chidren = new ArrayList<>();
|
|
|
+ m.put("children", chidren);
|
|
|
+ for(RelationDefine relDef : relDefs) {
|
|
|
+ if(relDef.getGraphCode().equals(gd.getCode()))
|
|
|
+ chidren.add(relDef);
|
|
|
+ }
|
|
|
}
|
|
|
+ map.put("relation", rels);
|
|
|
}
|
|
|
- map.put("relation", rels);
|
|
|
|
|
|
return AdmResult.success(map);
|
|
|
}
|
|
|
|
|
|
private void distinct(List<TypeDef> list){
|
|
|
List<TypeDef> result = new ArrayList<>();
|
|
|
- ArrayList<String> codes = new ArrayList<>();
|
|
|
+ HashSet<String> codes = new HashSet<>();
|
|
|
for(TypeDef def : list) {
|
|
|
if(!codes.contains(def.getCode())) {
|
|
|
codes.add(def.getCode());
|
|
@@ -124,22 +130,37 @@ public class ToolController {
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/cfgs")
|
|
|
- public AdmResult<Object> cfgs(@RequestBody AdmRequest req){
|
|
|
+ public AdmResult<Object> cfgs(@RequestBody AdmRequest req, @RequestParam(required = false) String module){
|
|
|
String projectId = req.getProjectId();
|
|
|
+ HashMap<String, Object> data = new HashMap<>();
|
|
|
|
|
|
//配置数据查询
|
|
|
- List<AdmRelsConfig> relConfig = configService.queryRelsConfig(projectId);
|
|
|
- List<AdmPipeConfig> pipeConfig = configService.queryPipeConfig(projectId);
|
|
|
- List<AdmContainerConfig> containerConfig = configService.queryContainerConfig(projectId);
|
|
|
+ if("infos".equals(module)) { //信息点配置
|
|
|
|
|
|
- HashMap<String, Object> data = new HashMap<>();
|
|
|
- data.put("relConfig", relConfig);
|
|
|
- data.put("pipeConfig", pipeConfig);
|
|
|
- data.put("containerConfig", containerConfig);
|
|
|
+ } else {
|
|
|
+ List<AdmRelsConfig> relConfig = configService.queryRelsConfig(projectId);
|
|
|
+ List<AdmPipeConfig> pipeConfig = configService.queryPipeConfig(projectId);
|
|
|
+ List<AdmContainerConfig> containerConfig = configService.queryContainerConfig(projectId);
|
|
|
+
|
|
|
+ data.put("relConfig", relConfig);
|
|
|
+ data.put("pipeConfig", pipeConfig);
|
|
|
+ data.put("containerConfig", containerConfig);
|
|
|
+ }
|
|
|
|
|
|
return AdmResult.success(data);
|
|
|
}
|
|
|
|
|
|
+ @RequestMapping("/typeInfos")
|
|
|
+ public AdmResult<Object> typeInfos(@RequestBody AdmRequest req, @RequestParam String typeCode){
|
|
|
+ QueryCriteria criteria = new QueryCriteria();
|
|
|
+ ObjectNode node = objectMapper.createObjectNode();
|
|
|
+ node.put("classCode", typeCode);
|
|
|
+ criteria.setCriteria(node);
|
|
|
+
|
|
|
+ List<ObjectInfoDefine> funcList = ServiceUtil.call(() -> rwdClient.queryFunc(req.getGroupCode(), req.getProjectId(), AdmConst.APP_ID, req.getUserId(), criteria));
|
|
|
+ return AdmResult.success(funcList);
|
|
|
+ }
|
|
|
+
|
|
|
@Autowired
|
|
|
private AdmRelsConfigMapper relsConfigMapper;
|
|
|
@Autowired
|