Jelajahi Sumber

更新数据

zhoutg 5 tahun lalu
induk
melakukan
fbfc877e1d

+ 1 - 1
config-server/src/main/resources/shared/knowledgeman-service-dev.yml

@@ -111,4 +111,4 @@ fastdfs:
 
 neo:
   server:
-    address: http://192.168.2.234:5008
+    address: http://192.168.3.180:5004

+ 1 - 1
config-server/src/main/resources/shared/knowledgeman-service-local.yml

@@ -111,4 +111,4 @@ fastdfs:
 
 neo:
   server:
-    address: http://192.168.2.234:5008
+    address: http://192.168.3.180:5004

+ 2 - 2
config-server/src/main/resources/shared/knowledgeman-service-pro.yml

@@ -109,6 +109,6 @@ fastdfs:
   http_anti_steal_token: no
   tracker_servers: 192.168.2.236:22122
 
-ai:
+neo:
   server:
-    address: http://192.168.2.234:5008
+    address: http://192.168.3.180:5004

+ 1 - 1
config-server/src/main/resources/shared/knowledgeman-service-test.yml

@@ -111,4 +111,4 @@ fastdfs:
 
 neo:
   server:
-    address: http://192.168.2.234:5008
+    address: http://192.168.3.180:5004

+ 2 - 2
knowledgeman-service/src/main/java/com/diagbot/client/NeoServiceClient.java

@@ -16,10 +16,10 @@ import org.springframework.web.bind.annotation.RequestBody;
 @FeignClient(name = "neo", url = "${neo.server.address}", fallback = NeoServiceHystrix.class)
 public interface NeoServiceClient {
 
-    @PostMapping("/user/verifyToken")
+    @PostMapping("/knowledge/updateDisease")
     RespDTO<Boolean> updateNeo(@RequestBody NeoParamVO neoParamVO);
 
-    @PostMapping("/user/verifyToken")
+    @PostMapping("/knowledge/deleteDisease")
     RespDTO<Boolean> deleteNeo(@RequestBody NeoParamVO neoParamVO);
 }
 

+ 0 - 3
knowledgeman-service/src/main/java/com/diagbot/dto/DiagnosePageDTO.java

@@ -1,6 +1,5 @@
 package com.diagbot.dto;
 
-import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -29,7 +28,6 @@ public class DiagnosePageDTO implements Serializable {
     /**
      * 记录修改时间,如果时间是1970年则表示纪录未修改
      */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
     private Date gmtModified;
 
 
@@ -51,7 +49,6 @@ public class DiagnosePageDTO implements Serializable {
     /**
      * 记录更新图谱的时间,如果时间是1970年则表示纪录未修改
      */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
     private Date neoUpdate;
 
     /**

+ 1 - 0
knowledgeman-service/src/main/java/com/diagbot/dto/VerifyDataDTO.java

@@ -23,5 +23,6 @@ public class VerifyDataDTO {
     @ApiModelProperty(value = "疾病公式")
     private List<DiagnoseDetail> disformula = new ArrayList<>();
 
+    @ApiModelProperty(value = "1:有问题词,0:无问题词")
     private Integer hasQuestion;
 }

+ 24 - 19
knowledgeman-service/src/main/java/com/diagbot/facade/DiagnoseFacade.java

@@ -43,6 +43,7 @@ import com.diagbot.vo.DiagnoseVerifyVO;
 import com.diagbot.vo.DiseaseIndexVO;
 import com.diagbot.vo.GetDiagnoseDetailVO;
 import com.diagbot.vo.NeoParamVO;
+import com.diagbot.vo.UpdateDiagnoseVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
@@ -101,6 +102,14 @@ public class DiagnoseFacade extends DiagnoseServiceImpl {
                 || IsDeleteEnum.Y.getKey().equals(deleteDiagnoseVO.getIsDeleted()))) {
             throw new CommonException(CommonErrorCode.STATUS_IS_ERROR, "状态值错误【Y】或【N】");
         }
+
+        // 删除图谱数据
+        NeoParamVO neoParamVO = new NeoParamVO();
+        neoParamVO.setId(deleteDiagnoseVO.getId());
+        neoServiceClient.deleteNeo(neoParamVO);
+        RespDTO<Boolean> respDTO = neoServiceClient.deleteNeo(neoParamVO);
+        RespDTOUtil.respNGDeal(respDTO, "删除图谱数据失败【远程调用】");
+
         Date now = DateUtil.now();
         this.update(new Diagnose(), new UpdateWrapper<Diagnose>()
                 .eq("id", deleteDiagnoseVO.getId())
@@ -120,13 +129,6 @@ public class DiagnoseFacade extends DiagnoseServiceImpl {
         // 删除问题词列表(物理删除)
         diagnoseQuestionService.remove(new QueryWrapper<DiagnoseQuestion>()
                 .eq("diagnose_id", deleteDiagnoseVO.getId()));
-
-        // 删除图谱数据
-        NeoParamVO neoParamVO = new NeoParamVO();
-        neoParamVO.setId(deleteDiagnoseVO.getId());
-        neoServiceClient.deleteNeo(neoParamVO);
-        RespDTO<Boolean> respDTO = neoServiceClient.updateNeo(neoParamVO);
-        RespDTOUtil.respNGDeal(respDTO, "删除图谱数据失败【远程调用】");
     }
 
 
@@ -531,24 +533,27 @@ public class DiagnoseFacade extends DiagnoseServiceImpl {
     /**
      * 更新图谱(先校验,再更新)
      *
-     * @param diagnoseWrapper
+     * @param updateDiagnoseVO
      * @return
      */
-    public void  updateNeo(DiagnoseWrapper diagnoseWrapper) {
-        VerifyDataDTO verifyDataDTO = verifyData(diagnoseWrapper);
-        if (HasQuestionEnum.HAS_QUESTION.getKey() == verifyDataDTO.getHasQuestion()) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "有问题词存在或公式错误,不能更新图谱");
-        }
-        // 更新时间
-        this.update(new UpdateWrapper<Diagnose>()
-                .eq("id", diagnoseWrapper.getId())
-                .set("neo_update", new Date())
-        );
+    public void  updateNeo(UpdateDiagnoseVO updateDiagnoseVO) {
+//        VerifyDataDTO verifyDataDTO = verifyData(diagnoseWrapper);
+//        if (HasQuestionEnum.HAS_QUESTION.getKey() == verifyDataDTO.getHasQuestion()) {
+//            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "有问题词存在或公式错误,不能更新图谱");
+//        }
+
         // 更新图谱对接接口
         NeoParamVO neoParamVO = new NeoParamVO();
-        neoParamVO.setId(diagnoseWrapper.getId());
+        neoParamVO.setId(updateDiagnoseVO.getId());
         RespDTO<Boolean> respDTO = neoServiceClient.updateNeo(neoParamVO);
         RespDTOUtil.respNGDeal(respDTO, "更新图谱数据失败【远程调用】");
+
+        // 更新时间
+        this.update(new UpdateWrapper<Diagnose>()
+                .eq("id", updateDiagnoseVO.getId())
+                .set("modifier", updateDiagnoseVO.getModifier())
+                .set("neo_update", new Date())
+        );
     }
 
 

+ 28 - 0
knowledgeman-service/src/main/java/com/diagbot/vo/UpdateDiagnoseVO.java

@@ -0,0 +1,28 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description:
+ * @author: ztg
+ * @time: 2019/1/28 15:45
+ */
+@Getter
+@Setter
+@ApiModel
+public class UpdateDiagnoseVO {
+
+    @NotNull(message="id不能为空")
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    @ApiModelProperty("修改人")
+    @NotBlank(message="修改人不能为空")
+    private String modifier;
+}

+ 3 - 2
knowledgeman-service/src/main/java/com/diagbot/web/DiagnoseController.java

@@ -15,6 +15,7 @@ import com.diagbot.vo.DiagnosePageVO;
 import com.diagbot.vo.DiagnoseVerifyVO;
 import com.diagbot.vo.DiseaseIndexVO;
 import com.diagbot.vo.GetDiagnoseDetailVO;
+import com.diagbot.vo.UpdateDiagnoseVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -92,8 +93,8 @@ public class DiagnoseController {
     @PostMapping("/updateNeo")
     @SysLogger("updateNeo")
     @Transactional
-    public RespDTO<Boolean> updateNeo4j(@RequestBody DiagnoseWrapper diagnoseWrapper) {
-        diagnoseFacade.updateNeo(diagnoseWrapper);
+    public RespDTO<Boolean> updateNeo4j(@RequestBody UpdateDiagnoseVO updateDiagnoseVO) {
+        diagnoseFacade.updateNeo(updateDiagnoseVO);
         return RespDTO.onSuc(true);
     }
 

+ 1 - 1
knowledgeman-service/src/main/resources/mapper/DiagnoseMapper.xml

@@ -29,7 +29,7 @@
         <if test="hasQuestion != null and hasQuestion != ''">
             and a.has_question = #{hasQuestion}
         </if>
-        ORDER BY a.has_question desc, a.gmt_modified desc
+        ORDER BY a.has_question, a.gmt_modified desc
     </select>
 
     <select id="index" resultType="com.diagbot.dto.ConceptBaseDTO">