ソースを参照

1、新增静态信息更新状态到图谱

zhaops 4 年 前
コミット
6801b30240

+ 10 - 0
cdssman-service/src/main/java/com/diagbot/client/CdssCoreClient.java

@@ -3,6 +3,7 @@ package com.diagbot.client;
 import com.diagbot.client.hystrix.CdssCoreHystrix;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.StaticKnowledgeIndexDTO;
+import com.diagbot.vo.HasStaticKnowledgeVO;
 import com.diagbot.vo.StaticKnowledgeIndexVO;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -26,4 +27,13 @@ public interface CdssCoreClient {
      */
     @PostMapping("/retrieval/staticKnowledgeIndex")
     RespDTO<List<StaticKnowledgeIndexDTO>> staticKnowledgeIndex(@RequestBody @Valid StaticKnowledgeIndexVO staticKnowledgeIndexVO);
+
+    /**
+     * 更新是否有静态知识状态
+     *
+     * @param hasStaticKnowledgeVO
+     * @return
+     */
+    @PostMapping("/staticKnowledge/updateHasInfoStatus")
+    RespDTO<Boolean> updateHasInfoStatus(@Valid @RequestBody HasStaticKnowledgeVO hasStaticKnowledgeVO);
 }

+ 13 - 0
cdssman-service/src/main/java/com/diagbot/client/hystrix/CdssCoreHystrix.java

@@ -3,6 +3,7 @@ package com.diagbot.client.hystrix;
 import com.diagbot.client.CdssCoreClient;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.StaticKnowledgeIndexDTO;
+import com.diagbot.vo.HasStaticKnowledgeVO;
 import com.diagbot.vo.StaticKnowledgeIndexVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
@@ -30,4 +31,16 @@ public class CdssCoreHystrix implements CdssCoreClient {
         log.error("【hystrix】调用{}异常", "staticKnowledgeIndex");
         return null;
     }
+
+    /**
+     * 更新是否有静态知识状态
+     *
+     * @param hasStaticKnowledgeVO
+     * @return
+     */
+    @Override
+    public RespDTO<Boolean> updateHasInfoStatus(@Valid @RequestBody HasStaticKnowledgeVO hasStaticKnowledgeVO) {
+        log.error("【hystrix】调用{}异常", "updateHasInfoStatus");
+        return null;
+    }
 }

+ 18 - 1
cdssman-service/src/main/java/com/diagbot/facade/ConceptInfoFacade.java

@@ -25,6 +25,7 @@ import com.diagbot.util.UserUtils;
 import com.diagbot.vo.ChangeStatusVO;
 import com.diagbot.vo.ConceptInfoPageVO;
 import com.diagbot.vo.ConceptInfoVO;
+import com.diagbot.vo.HasStaticKnowledgeVO;
 import com.diagbot.vo.IdVO;
 import com.diagbot.vo.StaticKnowledgeIndexVO;
 import com.google.common.collect.Lists;
@@ -250,9 +251,25 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
             conceptInfoVO.setId(conceptInfo.getId());
         }
 
-        //删除已有静态信息
+        //是否包含静态信息,包含启用和禁用
         QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
         conceptDetailQueryWrapper.eq("concept_id", conceptInfoVO.getId());
+        List<ConceptDetail> oldDetails = conceptDetailFacade.list(conceptDetailQueryWrapper);
+        if (ListUtil.isEmpty(oldDetails)
+                && ListUtil.isNotEmpty(conceptInfoVO.getDetails())) {
+            //TODO 更新图谱是否有静态信息
+            HasStaticKnowledgeVO hasStaticKnowledgeVO = new HasStaticKnowledgeVO();
+            hasStaticKnowledgeVO.setName(conceptInfoVO.getName());
+            hasStaticKnowledgeVO.setType(typeName);
+            hasStaticKnowledgeVO.setHasInfo(1);
+            RespDTO<Boolean> respDTO = cdssCoreClient.updateHasInfoStatus(hasStaticKnowledgeVO);
+            //更新失败
+            if (RespDTOUtil.respIsNG(respDTO)) {
+
+            }
+        }
+
+        //删除已有静态信息
         conceptDetailFacade.remove(conceptDetailQueryWrapper);
         //插入新的静态信息
         List<ConceptDetail> conceptDetailList = Lists.newLinkedList();

+ 32 - 0
cdssman-service/src/main/java/com/diagbot/vo/HasStaticKnowledgeVO.java

@@ -0,0 +1,32 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/8/25 14:02
+ */
+@Getter
+@Setter
+public class HasStaticKnowledgeVO {
+    /**
+     * 标准术语名称
+     */
+    @NotBlank(message = "请输入标准术语名称")
+    private String name;
+    /**
+     * 术语类型
+     */
+    @NotBlank(message = "请输入术语类型")
+    private String type;
+    /**
+     * 是否有静态知识:0-无,1-有
+     */
+    @NotNull(message = "请输入是否有静态信息(0-无,1-有)")
+    private Integer hasInfo;
+}