From 362df20650080f13b2ad19a27f766ce824446a94 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期三, 20 十一月 2024 15:58:39 +0800
Subject: [PATCH] 完善代码,修复潜在的bug

---
 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeCtrl.java |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeCtrl.java
index 1308504..0e99c5e 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeCtrl.java
@@ -29,6 +29,7 @@
 import org.springframework.web.client.RestTemplate;
 
 import java.util.ArrayList;
+import java.util.Base64;
 import java.util.List;
 
 /**
@@ -67,7 +68,7 @@
     @GetMapping(path = "/issuedTask")
     @SsoAop()
     public BaseResponse<Boolean> issuedTask(String id){
-        if(id == null || !id.trim().equals("")){
+        if(id == null || id.trim().equals("")){
             return BaseResponseUtils.buildError("浠诲姟id涓嶈兘涓虹┖") ;
         }
         UgRtuTask tpo = this.sv.selectTaskById(id) ;
@@ -87,7 +88,7 @@
             return BaseResponseUtils.buildError("浠诲姟鎵�娑夊強鐨勬帶鍒跺櫒杩樻湭璁剧疆") ;
         }
 
-        String ugCallbackUrl_rm = env.getProperty("mw." + DataSourceContext.get() + ".ugCallbackUrl_rm" );
+        String ugCallbackUrl_rm = env.getProperty("mw.ugCallbackUrl_rm" );
         if(ugCallbackUrl_rm == null || ugCallbackUrl_rm.trim().equals("")){
             return BaseResponseUtils.buildError("鏈厤缃崌绾т换鍔″洖璋冪綉鍧�") ;
         }
@@ -104,8 +105,12 @@
                 this.sv.setUpgradeTaskExecuted(id);
                 return BaseResponseUtils.buildSuccess(true) ;
             }else{
-                log.error("閫氫俊涓棿浠舵墽琛屼笅鍙戝崌绾т换鍔″け璐�" + (res.getMsg() == null? "" : ("锛�" + res.getMsg()))) ;
-                return BaseResponseUtils.buildFail("閫氫俊涓棿浠舵墽琛屽け璐�" + (res.getMsg() == null? "" : ("锛�" + res.getMsg()))) ;
+                String msg = res.getContent()==null?null:(String)res.getContent() ;
+                if(msg == null){
+                    msg = res.getMsg() ;
+                }
+                log.error("閫氫俊涓棿浠舵墽琛屼笅鍙戝崌绾т换鍔″け璐�" + msg) ;
+                return BaseResponseUtils.buildFail("閫氫俊涓棿浠舵墽琛屽け璐�" + msg) ;
             }
         }else{
             log.error("閫氫俊涓棿浠惰繑鍥炵粨鏋滀负null") ;
@@ -118,7 +123,8 @@
         vo.softFileName = ppo.hexFileName ;
         vo.softStoreAddr = ppo.storeRamAddr ;
         vo.softStartAddr = ppo.startRamAddr ;
-        vo.softFileData = ppo.programBytes ;
+        vo.softFileData64 = Base64.getEncoder().encodeToString(ppo.programBytes) ;
+        //vo.softFileData = ppo.programBytes ;
         vo.softBytesCalculate = ppo.programCalculateBytes ;
         vo.softByteSrc16 = ppo.programCrc16 ;
     }
@@ -130,7 +136,7 @@
     @GetMapping(path = "/demoReset")
     @SsoAop()
     public BaseResponse<Boolean> demoReset(){
-        if(RtuUpgradeStateReceiverCtrl.cache == null){
+        if(RtuUpgradeStateReceiverCtrl.cache != null){
             //return BaseResponseUtils.buildError("褰撳墠娌℃湁鍗囩骇浠诲姟") ;
             //姝e紡杩愯鏃讹紝涓嬮潰涓よ鍘绘帀锛屼笂闈竴琛屾墦寮�
             RtuUpgradeStateReceiverCtrl ctrl = SpringContextUtil.getBean(RtuUpgradeStateReceiverCtrl.class);
@@ -159,6 +165,8 @@
     public BaseResponse<QueryResultVo<VoWatch> > curUpgradeState(QueryVo qvo){
         if(qvo == null){
             qvo = new QueryVo();
+            qvo.pageCurr = 1 ;
+            qvo.pageSize = 50 ;
         }
         if(RtuUpgradeStateReceiverCtrl.cache == null){
             //return BaseResponseUtils.buildError("褰撳墠娌℃湁鍗囩骇浠诲姟") ;

--
Gitblit v1.8.0