From 515b39791a7fbd18cd4026aa358c7354272c92af Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期五, 29 十一月 2024 15:27:59 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV

---
 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/web/com/CommandCtrl.java |   43 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/web/com/CommandCtrl.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/web/com/CommandCtrl.java
index 520cfe3..2a4f64c 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/web/com/CommandCtrl.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/web/com/CommandCtrl.java
@@ -1,16 +1,19 @@
 package com.dy.rtuMw.web.com;
 
+import com.dy.common.softUpgrade.state.UpgradeTaskVo;
+import com.dy.common.webUtil.ResultCodeMsg;
 import com.dy.rtuMw.resource.ResourceUnit;
 import com.dy.rtuMw.server.ServerProperties;
 import com.dy.rtuMw.server.forTcp.TcpSessionCache;
 import com.dy.rtuMw.server.local.CommandInnerDeaLer;
 import com.dy.rtuMw.server.local.ReturnCommand;
-import com.dy.rtuMw.server.tasks.RtuDownTask;
+import com.dy.rtuMw.server.tasks.WebDownComTask;
 import com.dy.common.mw.core.CoreUnit;
 import com.dy.common.mw.protocol.Command;
 import com.dy.common.mw.protocol.CommandType;
 import com.dy.common.webUtil.BaseResponse;
 import com.dy.common.webUtil.BaseResponseUtils;
+import com.dy.rtuMw.server.upgrade.UpgradeUnit;
 import jakarta.servlet.ServletOutputStream;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
@@ -142,6 +145,42 @@
         }
     }
     /**
+     * 鎺ユ敹web绯荤粺鍙戞潵鍗囩骇浠诲姟
+     * @param vo
+     * @return
+     */
+    @PostMapping(path = "upgradeRtu", consumes = MediaType.APPLICATION_JSON_VALUE)
+    public BaseResponse<Boolean> upgradeRtu(@RequestBody UpgradeTaskVo vo) {
+        log.info("鏀跺埌RTU鍗囩骇浠诲姟锛歕n" + vo.toString()) ;
+        try{
+            UpgradeUnit.getInstance().setUpgradeTask(vo);
+        }catch (Exception e){
+            log.error("璁剧疆RTU鍗囩骇浠诲姟鏃跺彂鐢熷紓甯�", e);
+            return BaseResponseUtils.buildError("璁剧疆RTU鍗囩骇浠诲姟鏃跺彂鐢熷紓甯�" + (e.getMessage() == null?"":("锛�" + e.getMessage())));
+        }
+        return BaseResponseUtils.buildSuccess(true);
+    }
+
+    /**
+     * 鎺ユ敹web绯荤粺鍙戞潵寮哄埗缁撴潫鍗囩骇浠诲姟
+     * @return
+     */
+    @GetMapping(path = "ugForceOver", consumes = MediaType.APPLICATION_JSON_VALUE)
+    public BaseResponse<String> ugForceOver() {
+        log.info("鏀跺埌鍋滄RTU鍗囩骇浠诲姟鍛戒护") ;
+        try{
+            String mes = UpgradeUnit.getInstance().forceOverUpgradeTask();
+            if(mes == null){
+                mes = "鍋滄鍗囩骇浠诲姟鎴愬姛" ;
+            }
+            return BaseResponseUtils.buildResult(ResultCodeMsg.RsCode.SUCCESS_CODE, mes, mes);
+        }catch (Exception e){
+            log.error("鍋滄RTU鍗囩骇浠诲姟鏃跺彂鐢熷紓甯�", e);
+            return BaseResponseUtils.buildError("鍋滄RTU鍗囩骇浠诲姟鏃跺彂鐢熷紓甯�" + (e.getMessage() == null?"":("锛�" + e.getMessage())));
+        }
+    }
+
+    /**
      * 鎺ユ敹web绯荤粺鍙戞潵鐨勫懡浠�
      * @param com
      * @return
@@ -234,7 +273,7 @@
         }
 
         //鐢熸垚寮傛浠诲姟
-        RtuDownTask task = new RtuDownTask() ;
+        WebDownComTask task = new WebDownComTask() ;
         task.data = command ;
         try{
             log.info("鏋勯�犱笅鍙戣繙绋嬪懡浠�" + command.getCode() + "鐨勬牳蹇冧换鍔★紝骞舵斁鍏ヤ换鍔¢槦鍒椾腑");

--
Gitblit v1.8.0