|
@@ -26,6 +26,7 @@ import com.pavis.backend.slim.project.system.domain.SysKgEntity;
|
|
|
import com.pavis.backend.slim.project.system.domain.SysKgRelation;
|
|
|
import com.pavis.backend.slim.project.system.domain.SysRelation;
|
|
|
import com.pavis.backend.slim.project.system.domain.algorithm.AlgSpO;
|
|
|
+import com.pavis.backend.slim.project.system.domain.annotation.CreateEntityKg;
|
|
|
import com.pavis.backend.slim.project.system.domain.annotation.EntityColor;
|
|
|
import com.pavis.backend.slim.project.system.domain.annotation.ExportSchemaData;
|
|
|
import com.pavis.backend.slim.project.system.domain.annotation.ExportSysEntity;
|
|
@@ -206,7 +207,7 @@ public class SysKgServiceImpl extends ServiceImpl<SysKgMapper, SysKg> implements
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void algorithm(AlgSpO algSpO) {
|
|
|
+ public Boolean algorithm(AlgSpO algSpO) {
|
|
|
log.info("算法传参map:{}", JSON.toJSONString(algSpO));
|
|
|
// todo 先这么做,以后还需改动
|
|
|
sysEntityInstanceMapper.delete(new QueryWrapper<SysEntityInstance>().eq("kg_id", algSpO.getKgId()));
|
|
@@ -215,6 +216,7 @@ public class SysKgServiceImpl extends ServiceImpl<SysKgMapper, SysKg> implements
|
|
|
String oCopy = "";
|
|
|
String sCopy = "";
|
|
|
if (integer == 0) {
|
|
|
+ List<Integer> upLists = new ArrayList<>();
|
|
|
for (Map map : algSpO.getSpo()) {
|
|
|
if (map.get("s") != null) {
|
|
|
// check库里是否存在此值
|
|
@@ -231,7 +233,8 @@ public class SysKgServiceImpl extends ServiceImpl<SysKgMapper, SysKg> implements
|
|
|
sysEntityInstanceS.setInstanceId(MD5.create().digestHex16((String) map.get("s")));
|
|
|
sysEntityInstanceS.setName((String) map.get("s"));
|
|
|
sysEntityInstanceS.setEntityName((String) map.get("sType"));
|
|
|
- sysEntityInstanceMapper.insert(sysEntityInstanceS);
|
|
|
+ int insertRes = sysEntityInstanceMapper.insert(sysEntityInstanceS);
|
|
|
+ upLists.add(insertRes);
|
|
|
sCopy = MD5.create().digestHex16((String) map.get("s"));
|
|
|
} else {
|
|
|
sCopy = s;
|
|
@@ -250,7 +253,8 @@ public class SysKgServiceImpl extends ServiceImpl<SysKgMapper, SysKg> implements
|
|
|
sysEntityInstanceO.setInstanceId(MD5.create().digestHex16((String) map.get("o")));
|
|
|
sysEntityInstanceO.setName((String) map.get("o"));
|
|
|
sysEntityInstanceO.setEntityName((String) map.get("oType"));
|
|
|
- sysEntityInstanceMapper.insert(sysEntityInstanceO);
|
|
|
+ int insertRes = sysEntityInstanceMapper.insert(sysEntityInstanceO);
|
|
|
+ upLists.add(insertRes);
|
|
|
oCopy = MD5.create().digestHex16((String) map.get("o"));
|
|
|
} else {
|
|
|
oCopy = o;
|
|
@@ -276,11 +280,15 @@ public class SysKgServiceImpl extends ServiceImpl<SysKgMapper, SysKg> implements
|
|
|
sysEntityRelation.setEntityRelation(map.get("sType") + "-" + map.get("pType") + "-" + map.get("oType"));
|
|
|
// 设置基本信息,创建人、创建时间等。
|
|
|
sysEntityRelation.setCreateTime(DateUtil.date());
|
|
|
- sysEntityRelationMapper.insert(sysEntityRelation);
|
|
|
+ int insertRes = sysEntityRelationMapper.insert(sysEntityRelation);
|
|
|
+ upLists.add(insertRes);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ log.info("后端存储算法图数据 upLists:{}",JSON.toJSONString(upLists));
|
|
|
+ return upLists.contains(0) ? false : true;
|
|
|
}
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -415,7 +423,7 @@ public class SysKgServiceImpl extends ServiceImpl<SysKgMapper, SysKg> implements
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public SysEntityAll createEntityKg(SysEntity sysEntityAll) {
|
|
|
+ public SysEntityAll createEntityKg(CreateEntityKg sysEntityAll) {
|
|
|
log.info("*********接口(createEntityKg)------>入参(sysEntityAll):{}", JSON.toJSONString(sysEntityAll));
|
|
|
|
|
|
// zez 根据前端传参先进行删除需要删除的关系和实体
|
|
@@ -437,7 +445,22 @@ public class SysKgServiceImpl extends ServiceImpl<SysKgMapper, SysKg> implements
|
|
|
SysEntity sysEntity = sysEntityMapper.selectById(entityColor.getEntityId());
|
|
|
if (null != sysEntity) {
|
|
|
// 颜色发生变化,则更新标注的数据中的颜色,。
|
|
|
- entityColor.setUpName(sysEntity.getName());
|
|
|
+ // entityColor.setUpName(sysEntity.getName());
|
|
|
+ annotationListService.upTextFrontByColor(sysEntityAll.getKgId(), entityColor);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 处理前端标注数据的实体名称随实体名称的更新而更新值。
|
|
|
+ if (null != sysEntityAll && null != sysEntityAll.getUpName() && StringUtils.isNotEmpty(sysEntityAll.getUpName()) && CommonUtils.isJsonArray(sysEntityAll.getUpName())) {
|
|
|
+ List<EntityColor> entityColors = JSONArray.parseArray(sysEntityAll.getUpName(), EntityColor.class);
|
|
|
+ log.info("实体名称发生变化,需要处理 entityColors:{}", JSON.toJSONString(entityColors));
|
|
|
+ if (!CollectionUtils.isEmpty(entityColors)) {
|
|
|
+ for (EntityColor entityColor : entityColors) {
|
|
|
+ SysEntity sysEntity = sysEntityMapper.selectById(entityColor.getEntityId());
|
|
|
+ if (null != sysEntity) {
|
|
|
+ // 颜色发生变化,则更新标注的数据中的颜色,。
|
|
|
+ // entityColor.setUpName(sysEntity.getName());
|
|
|
annotationListService.upTextFrontByColor(sysEntityAll.getKgId(), entityColor);
|
|
|
}
|
|
|
}
|
|
@@ -792,7 +815,7 @@ public class SysKgServiceImpl extends ServiceImpl<SysKgMapper, SysKg> implements
|
|
|
}
|
|
|
|
|
|
if (null != sysEntityAll) {
|
|
|
- SysEntity sysEntity = new SysEntity();
|
|
|
+ CreateEntityKg sysEntity = new CreateEntityKg();
|
|
|
BeanUtils.copyProperties(sysEntityAll, sysEntity);
|
|
|
// // 处理前端存储的实体和关系数据。
|
|
|
ExportSysEntity exportSysEntity = new ExportSysEntity();
|