From f628dd00d8f99b37a128243b941bb8cfefd02ac9 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期四, 14 十一月 2024 10:36:08 +0800
Subject: [PATCH] 1、优远程升级相关代码; 2、修改升级监视功能模块代码。

---
 pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskCtrl.java |   90 +++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 83 insertions(+), 7 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskCtrl.java
index 38822a4..459728b 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskCtrl.java
@@ -5,8 +5,8 @@
 import com.dy.common.webUtil.BaseResponseUtils;
 import com.dy.common.webUtil.QueryResultVo;
 import com.dy.common.webUtil.ResultCodeMsg;
-import com.dy.pipIrrGlobal.pojoRm.UgRtuTask;
-import com.dy.pipIrrGlobal.voRm.VoRtuTask;
+import com.dy.pipIrrGlobal.pojoUg.UgRtuTask;
+import com.dy.pipIrrGlobal.voUg.VoRtuTask;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.media.Content;
@@ -25,7 +25,6 @@
 import org.springframework.web.bind.annotation.RestController;
 
 import java.io.UnsupportedEncodingException;
-import java.util.Date;
 import java.util.List;
 import java.util.Objects;
 
@@ -137,9 +136,7 @@
         }
         UgRtuTask po = new UgRtuTask();
         vo.toPo(po);
-        po.dt = new Date();
-        po.isOver = 0 ;
-        po.deleted = 0 ;
+        po.init();
         int count;
         try {
             count = this.sv.save(po);
@@ -192,6 +189,85 @@
 
 
     /**
+     * 鎵цRTU鍗囩骇浠诲姟
+     * @param id RTU鍗囩骇浠诲姟ID
+     * @return 鏄惁鎴愬姛
+     */
+    @Operation(summary = "鎵цRTU鍗囩骇浠诲姟", description = "鎻愪氦RTU鍗囩骇浠诲姟ID锛岃繘琛屾墽琛�")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = Boolean.class))}
+            )
+    })
+    @GetMapping(path = "execute")
+    @SsoAop()
+    public BaseResponse<Boolean> execute(Long id){
+        if(id == null){
+            return BaseResponseUtils.buildFail("id涓嶈兘涓虹┖") ;
+        }
+        int count;
+        try {
+            count = this.sv.isOver(id) ;
+            if(count > 0){
+                return BaseResponseUtils.buildError("浠诲姟宸茬粡缁撴潫锛屼笉鑳藉啀鎵ц") ;
+            }
+            count = this.sv.isExecute(id) ;
+            if(count > 0){
+                return BaseResponseUtils.buildError("浠诲姟宸茬粡鎵ц锛屼笉鑳藉啀鎵ц") ;
+            }
+            count = this.sv.execute(id);
+        } catch (Exception e) {
+            log.error("缁撴潫RTU鍗囩骇浠诲姟寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage()) ;
+        }
+        if(count <= 0){
+            return BaseResponseUtils.buildFail("鏁版嵁搴撴搷浣滃け璐�") ;
+        }else{
+            return BaseResponseUtils.buildSuccess(true) ;
+        }
+    }
+
+    /**
+     * 缁撴潫RTU鍗囩骇浠诲姟
+     * @param id RTU鍗囩骇浠诲姟ID
+     * @return 鏄惁鎴愬姛
+     */
+    @Operation(summary = "缁撴潫RTU鍗囩骇浠诲姟", description = "鎻愪氦RTU鍗囩骇浠诲姟ID锛岃繘琛岀粨鏉�")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = Boolean.class))}
+            )
+    })
+    @GetMapping(path = "over")
+    @SsoAop()
+    public BaseResponse<Boolean> over(Long id){
+        if(id == null){
+            return BaseResponseUtils.buildFail("id涓嶈兘涓虹┖") ;
+        }
+        int count;
+        try {count = this.sv.isOver(id) ;
+            if(count > 0){
+                return BaseResponseUtils.buildError("浠诲姟宸茬粡缁撴潫锛屼笉鐢ㄥ啀缁撴潫") ;
+            }
+            count = this.sv.over(id);
+        } catch (Exception e) {
+            log.error("缁撴潫RTU鍗囩骇浠诲姟寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage()) ;
+        }
+        if(count <= 0){
+            return BaseResponseUtils.buildFail("鏁版嵁搴撴搷浣滃け璐�") ;
+        }else{
+            return BaseResponseUtils.buildSuccess(true) ;
+        }
+    }
+
+    /**
      * 鍒犻櫎RTU鍗囩骇浠诲姟
      * @param id RTU鍗囩骇浠诲姟ID
      * @return 鏄惁鎴愬姛
@@ -219,7 +295,7 @@
             return BaseResponseUtils.buildException(e.getMessage()) ;
         }
         if(count <= 0){
-            return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ;
+            return BaseResponseUtils.buildFail("鏁版嵁搴撴搷浣滃け璐�") ;
         }else{
             return BaseResponseUtils.buildSuccess(true) ;
         }

--
Gitblit v1.8.0