Преглед изворни кода

图谱更新接口开发等

zhangenzhi пре 1 година
родитељ
комит
46033d01f3

+ 6 - 0
pom.xml

@@ -164,6 +164,12 @@
             <artifactId>junit</artifactId>
             <version>${junit.version}</version>
         </dependency>
+        <dependency>
+            <groupId>MavenRepository.MavenRepository.junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.13.2</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <dependencyManagement>

+ 6 - 0
src/main/java/com/pavis/backend/slim/project/system/controller/SysKgController.java

@@ -153,4 +153,10 @@ public class SysKgController {
     public AjaxResult selEntityRelation(@RequestBody FileKey keyEntityNce){
         return AjaxResult.success(kgService.selEntityRelation(keyEntityNce));
     }
+
+    @ApiOperation("图谱更新")
+    @PostMapping("/updateKg")
+    public AjaxResult updateKg(@RequestBody SysKg sysKg){
+        return AjaxResult.success(kgService.updateKg(sysKg));
+    }
 }

+ 0 - 10
src/main/java/com/pavis/backend/slim/project/system/domain/SysRelation.java

@@ -96,14 +96,4 @@ public class SysRelation extends BaseEntity {
      */
     @ApiModelProperty("方向")
     private String direction;
-    /**
-     * 实体关系集合
-     */
-    @ApiModelProperty("实体关系集合")
-    private String relationAll;
-    /**
-     * 实体关系展示集合
-     */
-    @ApiModelProperty("实体关系展示集合")
-    private String relationKgAll;
 }

+ 6 - 0
src/main/java/com/pavis/backend/slim/project/system/service/SysKgService.java

@@ -121,4 +121,10 @@ public interface SysKgService extends IService<SysKg> {
      */
     Boolean updateGrapgStatus(String kgId,Integer graphStatus,Integer annotationStatus,Integer finalStatus,String finalReason);
 
+    /**
+     * 图谱更新
+     * @param sysKg 图谱详情
+     * @return 图谱详情
+     */
+    SysKg updateKg(SysKg sysKg);
 }

+ 18 - 11
src/main/java/com/pavis/backend/slim/project/system/service/impl/SysKgServiceImpl.java

@@ -239,7 +239,7 @@ public class SysKgServiceImpl extends ServiceImpl<SysKgMapper, SysKg> implements
                         sysEntityRelation.setRelation((String) map.get("p"));
                         sysEntityRelation.setEnd((String) map.get("o"));
                         sysEntityRelation.setEndId(oCopy);
-                        sysEntityRelation.setEntityRelation(map.get("sType") + "-" + map.get("pType") + "-" + (String) map.get("oType"));
+                        sysEntityRelation.setEntityRelation(map.get("sType") + "-" + map.get("pType") + "-" + map.get("oType"));
                         sysEntityRelationMapper.insert(sysEntityRelation);
                     }
                 }
@@ -579,7 +579,7 @@ public class SysKgServiceImpl extends ServiceImpl<SysKgMapper, SysKg> implements
         QueryWrapper<SysEntityInstance> queryWrapper = new QueryWrapper();
         queryWrapper.eq("kg_id", keyEntityNce.getKgId());
         if (keyEntityNce.getKeyWord() != null && !"".equals(keyEntityNce.getKeyWord())) {
-            queryWrapper.like("name",keyEntityNce.getKeyWord());
+            queryWrapper.like("name", keyEntityNce.getKeyWord());
         }
 
         // zez 如果EntityName(实体名字)有值,则跟它一起连查,如果没有,则不管
@@ -601,11 +601,11 @@ public class SysKgServiceImpl extends ServiceImpl<SysKgMapper, SysKg> implements
 
         if (keyEntityRelation.getKeyWord() != null && !"".equals(keyEntityRelation.getKeyWord())) {
             queryWrap
-                    .like("start",keyEntityRelation.getKeyWord())
+                    .like("start", keyEntityRelation.getKeyWord())
                     .or()
-                    .like("relation",keyEntityRelation.getKeyWord())
+                    .like("relation", keyEntityRelation.getKeyWord())
                     .or()
-                    .like("end",keyEntityRelation.getKeyWord())
+                    .like("end", keyEntityRelation.getKeyWord())
             ;
         }
         // zez 根据实体名字查询实例关系
@@ -641,7 +641,7 @@ public class SysKgServiceImpl extends ServiceImpl<SysKgMapper, SysKg> implements
     @Override
     public List<String> getFileIdsByKgId(String kgId) {
         SysKg sysKg = baseMapper.selectById(kgId);
-        if(null != sysKg && null != sysKg.getFileIds() && StringUtils.isNotBlank(sysKg.getFileIds())){
+        if (null != sysKg && null != sysKg.getFileIds() && StringUtils.isNotBlank(sysKg.getFileIds())) {
             String[] fileIdsTmp = sysKg.getFileIds().split(",");
             List<String> fileIds = Arrays.asList(fileIdsTmp);
             return fileIds;
@@ -650,21 +650,28 @@ public class SysKgServiceImpl extends ServiceImpl<SysKgMapper, SysKg> implements
     }
 
     @Override
-    public Boolean updateGrapgStatus(String kgId,Integer graphStatus,Integer annotationStatus, Integer finalStatus,String finalReason) {
+    public Boolean updateGrapgStatus(String kgId, Integer graphStatus, Integer annotationStatus, Integer finalStatus, String finalReason) {
         SysKg sysKg = baseMapper.selectById(kgId);
-        if (null != sysKg){
-            if (null != graphStatus){
+        if (null != sysKg) {
+            if (null != graphStatus) {
                 sysKg.setGraphStatus(graphStatus);
             }
-            if (null != annotationStatus){
+            if (null != annotationStatus) {
                 sysKg.setAnnotationStatus(annotationStatus);
             }
             sysKg.setGenerateGraphStatus(finalStatus);
             sysKg.setGenerateGraphReason(finalReason);
             int upRes = baseMapper.updateById(sysKg);
-            log.info("更新生成图谱的状态:{}",upRes);
+            log.info("更新生成图谱的状态:{}", upRes);
             return upRes > 0 ? true : false;
         }
         return false;
     }
+
+    @Override
+    public SysKg updateKg(SysKg sysKg) {
+        log.info("******接口(updateKg)--->入参(sysKg):{}", JSON.toJSONString(sysKg));
+        baseMapper.updateById(sysKg);
+        return sysKg;
+    }
 }

+ 1 - 1
src/main/resources/application-local.yml

@@ -81,7 +81,7 @@ algorithm:
     url: http://192.168.1.150:8900/data_access
     # 文档转换为txt文本内容接口。
   convert:
-    url: http://192.168.1.127:8068
+    url: http://192.168.1.150:12000
     # 通用图谱调用算法接口。即未创建实体和关系。
   universalGraph:
     url: http://192.168.1.127:8068

+ 2 - 2
src/main/resources/application.yml

@@ -1,7 +1,7 @@
 spring:
   profiles:
-    active: ghj
-#    active: local
+#    active: ghj
+    active: local
   # 国际化资源文件路径
   messages:
     basename: i18n/messages

Разлика између датотеке није приказан због своје велике величине
+ 0 - 130
src/test/java/com/pavis/backend/slim/AnnotationDataTest.java


Неке датотеке нису приказане због велике количине промена