From daad26e9ea4296f8ae6df07b458e30aad5586847 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期二, 16 一月 2024 15:17:34 +0800
Subject: [PATCH] 1、通信中间件实现控制器报警与状态处理逻辑,及实现数据库映射Mapper; 2、通信中间件实现控制器自报数据处理逻辑,及实现数据库映射Mapper。

---
 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeCtrl.java |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeCtrl.java
index cdb44cb..fa5f55e 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeCtrl.java
@@ -10,6 +10,7 @@
 import com.dy.pipIrrGlobal.pojoPr.PrIntake;
 import com.dy.pipIrrGlobal.voPr.VoIntake;
 import com.dy.pipIrrGlobal.voSe.VoActiveCard;
+import com.dy.pipIrrProject.result.ProjectResultCode;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.media.Content;
@@ -53,8 +54,8 @@
     private final IntakeSv intakeSv;
 
     /**
-     * 瀹㈡埛绔姹傚緱鍒版墍鏈夊垎姘村彛鍚嶅瓧
-     * @return 鎵�鏈夊垎姘村彛鍚嶅瓧
+     * 瀹㈡埛绔姹傚緱鍒版墍鏈夊彇姘村彛鍚嶅瓧
+     * @return 鎵�鏈夊彇姘村彛鍚嶅瓧
      */
     @Operation(summary = "鑾峰緱鍏ㄩ儴鍙栨按鍙�", description = "杩斿洖鍏ㄩ儴鍙栨按鍙f暟鎹�")
     @ApiResponses(value = {
@@ -70,7 +71,11 @@
     public BaseResponse<QueryResultVo<List<PrIntake>>> all(){
         try {
             QueryResultVo<List<PrIntake>> res = this.intakeSv.selectAll();
-            return BaseResponseUtils.buildSuccess(res);
+            if(res == null) {
+                return BaseResponseUtils.buildFail(ProjectResultCode.NO_INTAKES.getMessage());
+            }else {
+                return BaseResponseUtils.buildSuccess(res);
+            }
         } catch (Exception e) {
             log.error("鏌ヨ鍙栨按鍙e紓甯�", e);
             return BaseResponseUtils.buildException(e.getMessage()) ;
@@ -93,7 +98,11 @@
     @GetMapping(path = "one/{id}")
     @SsoAop()
     public BaseResponse<PrIntake> one(@PathVariable("id") Long id){
-        return BaseResponseUtils.buildSuccess(this.intakeSv.selectById(id));
+        if(this.intakeSv.selectById(id) == null) {
+            return BaseResponseUtils.buildFail(ProjectResultCode.NO_INTAKES.getMessage());
+        }else {
+            return BaseResponseUtils.buildSuccess(this.intakeSv.selectById(id));
+        }
     }
 
     @Operation(summary = "鑾峰緱涓�椤靛彇姘村彛璁板綍", description = "杩斿洖涓�椤靛彇姘村彛鏁版嵁")
@@ -111,7 +120,7 @@
         try {
             QueryResultVo<List<VoIntake>> res = intakeSv.getIntakes(vo);
             if(res == null) {
-                return BaseResponseUtils.buildFail("鏌ヨ澶辫触");
+                return BaseResponseUtils.buildFail(ProjectResultCode.NO_INTAKES.getMessage());
             }
             return BaseResponseUtils.buildSuccess(res);
         } catch (Exception e) {
@@ -142,7 +151,7 @@
         po.setOperateDt(operateTime);
         Integer rec = Optional.ofNullable(intakeSv.addIntake(po)).orElse(0);
         if(rec == 0) {
-            return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�");
+            return BaseResponseUtils.buildFail(ProjectResultCode.ADD_INTAKE_FAIL.getMessage());
         }
         return BaseResponseUtils.buildSuccess(true) ;
     }
@@ -177,7 +186,7 @@
             return BaseResponseUtils.buildException(e.getMessage()) ;
         }
         if(count <= 0){
-            return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ;
+            return BaseResponseUtils.buildFail(ProjectResultCode.UPDATE_INTAKE.getMessage()) ;
         }else{
             return BaseResponseUtils.buildSuccess(true) ;
         }
@@ -200,8 +209,8 @@
     @GetMapping(path = "delete/{id}")
     @SsoAop()
     public BaseResponse<Boolean> delete(@PathVariable("id") Long id){
-        if(id == null){
-            return BaseResponseUtils.buildFail("id涓嶈兘涓虹┖") ;
+        if(id == null ){
+            return BaseResponseUtils.buildFail(ProjectResultCode.PLEASE_INPUT_INTAKE_ID.getMessage()) ;
         }
         int count;
         try {
@@ -211,7 +220,7 @@
             return BaseResponseUtils.buildException(e.getMessage()) ;
         }
         if(count <= 0){
-            return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ;
+            return BaseResponseUtils.buildFail(ProjectResultCode.DELETE_INTAKE_FAIL.getMessage()) ;
         }else{
             return BaseResponseUtils.buildSuccess(true) ;
         }

--
Gitblit v1.8.0