|
@@ -46,6 +46,7 @@ public class KgFacade extends KgServiceImpl {
|
|
|
if (CollUtil.isEmpty(res)) {
|
|
|
throw new CommonException(CommonErrorCode.NOT_EXISTS);
|
|
|
} else {
|
|
|
+ Map<String,Object> itemStyleMap = new HashMap<>();
|
|
|
long nodeId = 0;
|
|
|
categories.add(new CategorieDTO("中心词"));
|
|
|
categories.add(new CategorieDTO("关系"));
|
|
@@ -55,9 +56,10 @@ public class KgFacade extends KgServiceImpl {
|
|
|
|
|
|
GraphDTO graphDTO = res.get(0);
|
|
|
GNodeDTO gNodeDTO
|
|
|
- = new GNodeDTO(graphDTO.getLabel(), 0, graphDTO.getName(), nodeId, "circle", 50,graphDTO.getProperties(),graphDTO.getId());
|
|
|
+ = new GNodeDTO(graphDTO.getLabel(), 0, graphDTO.getName(), nodeId, "circle", 50,graphDTO.getProperties(),graphDTO.getId(),itemStyleMap);
|
|
|
nodeId++;
|
|
|
node.add(gNodeDTO);
|
|
|
+
|
|
|
if (CollUtil.isNotEmpty(graphDTO.getENodeRSDTOS())) {
|
|
|
Integer rsId = 2;
|
|
|
for (BaseNodeRSDTO baseNodeRSDTO : graphDTO.getENodeRSDTOS()) {
|
|
@@ -67,19 +69,20 @@ public class KgFacade extends KgServiceImpl {
|
|
|
rsId++;
|
|
|
}
|
|
|
GNodeDTO nNodeDTO
|
|
|
- = new GNodeDTO(graphDTO.getLabel(), 1, "", nodeId, "diamond", 10,graphDTO.getProperties(),graphDTO.getId());
|
|
|
+ = new GNodeDTO(graphDTO.getLabel(), 1, "", nodeId, "diamond", 10,graphDTO.getProperties(),graphDTO.getId(),itemStyleMap);
|
|
|
node.add(nNodeDTO);
|
|
|
links.add(new LinkDTO(gNodeDTO.getName(), nNodeDTO.getName(), baseNodeRSDTO.getRType(),baseNodeRSDTO.getRType()));
|
|
|
nodeId++;
|
|
|
if (CollUtil.isNotEmpty(baseNodeRSDTO.getENodeDTOS())) {
|
|
|
for (NextNodeDTO baseNodeDTO : baseNodeRSDTO.getENodeDTOS()) {
|
|
|
- String symbol = "diamond";
|
|
|
- if (baseNodeDTO.getPCount() > 0) {
|
|
|
- symbol = "circle";
|
|
|
+ Map<String,Object> childrenItemStyleMap = new HashMap<>();
|
|
|
+ String symbol = "circle";
|
|
|
+ if (baseNodeDTO.getPCount() == 0) {
|
|
|
+ childrenItemStyleMap.put("color", "#808080");
|
|
|
}
|
|
|
GNodeDTO eNodeDTO
|
|
|
= new GNodeDTO(baseNodeDTO.getLabel(), cMap.get(baseNodeRSDTO.getRType()),
|
|
|
- baseNodeDTO.getName(), nodeId, symbol, 28, baseNodeDTO.getProperties(),baseNodeDTO.getId());
|
|
|
+ baseNodeDTO.getName(), nodeId, symbol, 28, baseNodeDTO.getProperties(),baseNodeDTO.getId(),childrenItemStyleMap);
|
|
|
nodeId++;
|
|
|
node.add(eNodeDTO);
|
|
|
links.add(new LinkDTO(nNodeDTO.getName(), eNodeDTO.getName(), "",baseNodeRSDTO.getRType()));
|