|
@@ -1,5 +1,6 @@
|
|
|
package com.persagy.adm.diagram.controller;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
|
import com.persagy.adm.diagram.core.ContentParser;
|
|
@@ -8,6 +9,7 @@ import com.persagy.adm.diagram.core.model.Diagram;
|
|
|
import com.persagy.adm.diagram.core.model.template.DiagramTemplate;
|
|
|
import com.persagy.adm.diagram.frame.BdtpRequest;
|
|
|
import com.persagy.adm.diagram.manage.DiagramManager;
|
|
|
+import com.persagy.adm.diagram.service.IconService;
|
|
|
import com.persagy.dmp.common.constant.ResponseCode;
|
|
|
import com.persagy.dmp.common.exception.BusinessException;
|
|
|
import com.persagy.dmp.common.model.response.CommonResult;
|
|
@@ -22,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -42,6 +45,8 @@ public class DiagramController {
|
|
|
private DiagramManager diagramManager;
|
|
|
@Autowired
|
|
|
private ContentParser parser;
|
|
|
+ @Autowired
|
|
|
+ private IconService iconService;
|
|
|
|
|
|
/**
|
|
|
* 系统图列表接口
|
|
@@ -77,10 +82,19 @@ public class DiagramController {
|
|
|
|
|
|
List<Diagram> diagramList = dataStrategy.getDiagrams(null, projectId,
|
|
|
(String) diagram.get("systemId"), groupCode, null, false);
|
|
|
- if (diagramList != null) { //TODO 批量处理会导致接口响应慢,优化为列表和内容拆分的方式
|
|
|
+ //TODO 批量处理会导致接口响应慢,优化为列表和内容拆分的方式
|
|
|
+ if (diagramList != null) {
|
|
|
diagramList.forEach(d -> {
|
|
|
diagramManager.buildDiagram(d);
|
|
|
d.toAbsoluteLocation();
|
|
|
+
|
|
|
+ //TODO 批量处理会导致接口响应慢,优化为列表和内容拆分的方式
|
|
|
+ //没有nodes的话就不去查询了
|
|
|
+ if (CollectionUtil.isNotEmpty(d.getNodes())) {
|
|
|
+ String[] legendIds = d.getLegendIds();
|
|
|
+ Map<String, String> map = iconService.getIconsByLegendIds(Arrays.asList(legendIds));
|
|
|
+ d.setExtraProp("legendIcons", map);
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
|