浏览代码

优化2222

wangfeng 4 年之前
父节点
当前提交
c9cf53ac8f

+ 6 - 8
cdssman-service/src/main/java/com/diagbot/client/CdssCoreClient.java

@@ -156,29 +156,27 @@ public interface CdssCoreClient {
 
    //"分页获取规则维护列表
     @PostMapping("/klRule/getKlRuleInfoPage")
-
-    public RespDTO<IPage<KlRuleInfoDTO>> getKlRuleInfoPages(@RequestBody KlRuleInfoVO klRuleInfoVO);
+    RespDTO<IPage<KlRuleInfoDTO>> getKlRuleInfoPages(@RequestBody KlRuleInfoVO klRuleInfoVO);
 
 
     //根据规则Id获取规则详情
     @PostMapping("/klRule/getByIdRuleInfo")
-    public RespDTO<KlRuleByIdParDTO> getByIdRuleInfoAll(@RequestBody @Valid KlRuleByIdVO klRuleByIdVO);
+    RespDTO<KlRuleByIdParDTO> getByIdRuleInfoAll(@RequestBody @Valid KlRuleByIdVO klRuleByIdVO);
 
     //保存规则详情[
     @PostMapping("/klRule/saveRuleInfo")
-    public RespDTO<Boolean> saveRuleInfoAll(@RequestBody @Valid KlRuleInfoSaveVO klRuleInfoSaveVO);
+    RespDTO<Boolean> saveRuleInfoAll(@RequestBody @Valid KlRuleInfoSaveVO klRuleInfoSaveVO);
 
     //刪除规则详情
     @PostMapping("/klRule/clearRuleInfo")
-    public RespDTO<Boolean> clearRuleInfoAll(@RequestBody @Valid KlRuleInfoClearVO klRuleInfoClearVO);
+    RespDTO<Boolean> clearRuleInfoAll(@RequestBody @Valid KlRuleInfoClearVO klRuleInfoClearVO);
 
     //停用规则
     @PostMapping("/klRule/disableRuleInfo")
-
-    public RespDTO<Boolean> disableRuleInfos(@RequestBody @Valid KlRuleSatartOrdisaVO klRuleSatartOrdisaVO);
+    RespDTO<Boolean> disableRuleInfos(@RequestBody @Valid KlRuleSatartOrdisaVO klRuleSatartOrdisaVO);
 
    //启用规则
     @PostMapping("/klRule/startRuleInfo")
-    public RespDTO<Boolean> startRuleInfos(@RequestBody @Valid KlRuleSatartOrdisaVO klRuleSatartOrdisaVO);
+    RespDTO<Boolean> startRuleInfos(@RequestBody @Valid KlRuleSatartOrdisaVO klRuleSatartOrdisaVO);
 
 }

+ 9 - 1
cdssman-service/src/main/java/com/diagbot/entity/KlRulePlan.java

@@ -66,7 +66,7 @@ public class KlRulePlan implements Serializable {
     private String name;
 
     private Integer type;
-
+    private Integer number;
     /**
      * 类型编码
      */
@@ -79,6 +79,14 @@ public class KlRulePlan implements Serializable {
 
     private String remark;
 
+    public Integer getNumber() {
+        return number;
+    }
+
+    public void setNumber(Integer number) {
+        this.number = number;
+    }
+
     public Long getId() {
         return id;
     }

+ 21 - 1
cdssman-service/src/main/java/com/diagbot/facade/KlRuleFacade.java

@@ -30,33 +30,53 @@ public class KlRuleFacade extends KlRuleServiceImpl {
         RespDTO<IPage<KlRuleInfoDTO>> klRuleInfoPages = cdssCoreClient.getKlRuleInfoPages(klRuleInfoVO);
         if (klRuleInfoPages == null || !CommonErrorCode.OK.getCode().equals(klRuleInfoPages.code)) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
-                    "获取cdss_core数据失败");
+                    "分页获取规则维护列表数据失败");
         }
         return klRuleInfoPages.data;
     }
 
     public KlRuleByIdParDTO getByIdRuleInfos(KlRuleByIdVO klRuleByIdVO) {
         RespDTO<KlRuleByIdParDTO> byIdRuleInfoAll = cdssCoreClient.getByIdRuleInfoAll(klRuleByIdVO);
+        if (byIdRuleInfoAll == null || !CommonErrorCode.OK.getCode().equals(byIdRuleInfoAll.code)) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "获取规则详情数据失败");
+        }
         return byIdRuleInfoAll.data;
     }
 
     public Boolean saveRuleInfos(KlRuleInfoSaveVO klRuleInfoSaveVO) {
         RespDTO<Boolean> booleanRespDTO = cdssCoreClient.saveRuleInfoAll(klRuleInfoSaveVO);
+        if (booleanRespDTO == null || !CommonErrorCode.OK.getCode().equals(booleanRespDTO.code)) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "保存规则详情数据失败");
+        }
         return booleanRespDTO.data;
     }
 
     public Boolean clearRuleInfos(KlRuleInfoClearVO klRuleInfoClearVO) {
         RespDTO<Boolean> booleanRespDTO = cdssCoreClient.clearRuleInfoAll(klRuleInfoClearVO);
+        if (booleanRespDTO == null || !CommonErrorCode.OK.getCode().equals(booleanRespDTO.code)) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "刪除规则详情数据失败");
+        }
         return booleanRespDTO.data;
     }
 
     public Boolean startOrDisableRule(KlRuleSatartOrdisaVO klRuleSatartOrdisaVO) {
         RespDTO<Boolean> booleanRespDTO = cdssCoreClient.disableRuleInfos(klRuleSatartOrdisaVO);
+        if (booleanRespDTO == null || !CommonErrorCode.OK.getCode().equals(booleanRespDTO.code)) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "停用规则失败");
+        }
         return booleanRespDTO.data;
     }
 
     public Boolean startRuleInfos(KlRuleSatartOrdisaVO klRuleSatartOrdisaVO) {
         RespDTO<Boolean> booleanRespDTO = cdssCoreClient.startRuleInfos(klRuleSatartOrdisaVO);
+        if (booleanRespDTO == null || !CommonErrorCode.OK.getCode().equals(booleanRespDTO.code)) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "启用规则失败");
+        }
         return booleanRespDTO.data;
     }
 }

+ 6 - 0
cdssman-service/src/main/java/com/diagbot/facade/KlRulePlanFacade.java

@@ -3,6 +3,8 @@ package com.diagbot.facade;
 import com.diagbot.client.CdssCoreClient;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.KlRuleMenuWrapper;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.vo.KlRuleMenuVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -21,6 +23,10 @@ public class KlRulePlanFacade {
 
     public List<KlRuleMenuWrapper> getMenu(KlRuleMenuVO klRuleMenuVO) {
         RespDTO<List<KlRuleMenuWrapper>> menus = cdssCoreClient.getMenus(klRuleMenuVO);
+        if (menus == null || !CommonErrorCode.OK.getCode().equals(menus.code)) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "获取规则下拉菜单信息数据失败");
+        }
         return  menus.data;
     }
 }