From 8d725e7bd1ad30b5ba437cbf420da622cfefc7c6 Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期五, 22 十一月 2024 15:52:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreTimer.java                                           |   80 +++++++
 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreConstantThread.java                                  |    9 
 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreUnitConfigVo.java                                    |    3 
 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeCtrl.java              |  149 +++++--------
 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(test测试).xml                                              |    6 
 pipIrr-platform/pom.xml                                                                                                    |    4 
 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreUnit.java                                            |   28 +-
 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(ym元谋).xml                                                |    6 
 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/TimerTaskJob.java                                           |    3 
 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeStateReceiverCtrl.java |    2 
 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java                       |    2 
 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeTask.java                         |    9 
 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreConstantManage.java                                  |   20 +
 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java                                             |    3 
 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml                                                      |    6 
 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(sp沙盘).xml                                                |    6 
 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreConstantTimer.java                                   |   45 ++++
 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreThread.java                                          |    9 
 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ThreadJob.java                                              |    1 
 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeSv.java                |   57 ++--
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voUg/VoUgRtuResult.java                                    |   30 ++
 pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml                                                    |    2 
 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeResSv.java             |  160 ++++++++++++++
 23 files changed, 471 insertions(+), 169 deletions(-)

diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreConstantManage.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreConstantManage.java
index 262df98..492aab1 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreConstantManage.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreConstantManage.java
@@ -1,5 +1,6 @@
 package com.dy.common.mw.core;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.logging.log4j.*;
@@ -10,10 +11,12 @@
 	
 	private final static CoreConstantManage instance = new CoreConstantManage() ;
 
-	private static Long sleepBigBusy = 100L ;//澶у繖鏃讹紙闄や簡鎭掍箙浠诲姟锛岃繕鏄叾浠栦换鍔★級锛屾牳蹇冪嚎绋嬫殏鍋滈棿闅�
-	private static Long sleepSmallBusy = 500L ;//灏忓繖鏃讹紙鍙湁鎭掍箙浠诲姟锛屾棤鍏朵粬浠诲姟锛夛紝鏍稿績绾跨▼鏆傚仠闂撮殧
-	
+	private List<CoreConstantTimer> coreConstantTimers ;
+
+	private Long coreInterval = 100L ;//鏍稿績绾跨▼鏆傚仠闂撮殧
+
 	private CoreConstantManage(){
+		coreConstantTimers = new ArrayList<>() ;
 	}
 	
 	public static CoreConstantManage getInstance(){
@@ -22,12 +25,10 @@
 	
 	/**
 	 * 璁剧疆鏆傚仠鏃堕暱
-	 * @param sleepBigBusy 澶у繖鏃讹紙闄や簡鎭掍箙浠诲姟锛岃繕鏄叾浠栦换鍔★級锛屾牳蹇冪嚎绋嬫殏鍋滈棿闅�
-	 * @param sleepSmallBusy 灏忓繖鏃讹紙鍙湁鎭掍箙浠诲姟锛屾棤鍏朵粬浠诲姟锛夛紝鏍稿績绾跨▼鏆傚仠闂撮殧
+	 * @param coreInterval 鏍稿績绾跨▼鏆傚仠闂撮殧
 	 */
-	public void setSleep(Long sleepBigBusy, Long sleepSmallBusy){
-		CoreConstantManage.sleepBigBusy = sleepBigBusy ;
-		CoreConstantManage.sleepSmallBusy = sleepSmallBusy ;
+	public void setSleep(Long coreInterval){
+		this.coreInterval = coreInterval ;
 	}
 
 	public void start(){
@@ -35,7 +36,8 @@
 		List<CoreTask> constantTasks = CoreUnit.getAllConstantTasks();
 		if (constantTasks != null && constantTasks.size() > 0) {
 			for (CoreTask task : constantTasks) {
-				new CoreConstantThread(sleepBigBusy, sleepSmallBusy, task).start();
+				//new CoreConstantThread(sleepBigBusy, sleepSmallBusy, task).start();
+				coreConstantTimers.add(new CoreConstantTimer(coreInterval, task).start());
 			}
 		}
 	}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreConstantThread.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreConstantThread.java
index 8e497f2..34a6f56 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreConstantThread.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreConstantThread.java
@@ -9,6 +9,15 @@
  * @LastEditTime 2023/12/19 16:41
  * @Description
  */
+/**
+ * 2024-11-21 璇ョ被宸茬粡寮冪敤锛屾敼鐢盋oreConstantTimer瀹炵幇銆�
+ * 褰撻噰鐢═hread瀹炵幇鏃讹紝鍦╳hile(true){}涓娇鐢═hread.sleep()锛屽彲鑳藉鑷寸殑涓ラ噸鎬ц兘闂锛屼笉鎺ㄨ崘鍦ㄥ惊鐜腑浣跨敤绾跨▼浼戠湢銆�
+ * Java绾跨▼瀹炵幇閲囩敤鍐呮牳绾跨▼瀹炵幇锛岀嚎绋嬬殑浼戠湢鍙婂敜閱掞紙鐘舵�佸垏鎹級闇�鍊熷姪鎿嶄綔绯荤粺杩涜锛岃繖鏄竴涓瀬鍏惰�楁椂鑰楀姏鐨勬搷浣溿��
+ * 鍦ㄧ嚎绋嬩紤鐪犳垨杩愯鏃堕棿杈冮暱鐨勬儏鏅笅锛屽叾瀵规�ц兘鐨勫奖鍝嶈繕涓嶇畻鏄庢樉锛屽洜涓哄绾跨▼鐘舵�佺殑鍒囨崲骞朵笉棰戠箒銆�
+ * 浣嗚嫢绾跨▼浼戠湢鍙婅繍琛岀殑鏃堕棿閮藉緢鐭紙渚嬪姣/绉掞級锛�
+ * 绯荤粺灏嗛绻佺殑瀵圭嚎绋嬬姸鎬佽繘琛屽垏鎹紝瀵艰嚧涓ラ噸鐨勬�ц兘鎹熻�楋紝骞跺鐫�寰幆娆℃暟鐨勯�掑鑰屾斁澶с��
+ */
+@Deprecated
 public class CoreConstantThread extends Thread {
 
     private final static Logger log = LogManager.getLogger(CoreConstantThread.class.getName()) ;
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreConstantTimer.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreConstantTimer.java
new file mode 100644
index 0000000..a6aceb2
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreConstantTimer.java
@@ -0,0 +1,45 @@
+package com.dy.common.mw.core;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2024/11/21 17:13
+ * @Description
+ */
+public class CoreConstantTimer extends TimerTask {
+
+    private final static Logger log = LogManager.getLogger(CoreConstantTimer.class.getName()) ;
+
+    private Timer timer;
+
+    private long coreInterval ;
+
+    private CoreTask task ;
+
+    public CoreConstantTimer(long coreInterval, CoreTask task){
+        this.timer = new Timer();
+        this.coreInterval = coreInterval ;
+        this.task = task ;
+    }
+
+    public CoreConstantTimer start(){
+        this.timer.schedule(this, 0 , this.coreInterval);
+        return this ;
+    }
+
+    @Override
+    public void run() {
+        if(task != null){
+            try {
+                task.execute();
+            } catch (Exception e) {
+                log.error("鎭掍箙浠诲姟" + task.getClass().getName() + "鎵ц鏃跺彂鐢熷紓甯�" + (e.getMessage() == null ? "" : (":" + e.getMessage())), e);
+            }
+        }
+    }
+}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreThread.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreThread.java
index 4f706a3..e77a8d1 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreThread.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreThread.java
@@ -4,6 +4,15 @@
 
 import com.dy.common.queue.Queue;
 
+/**
+ * 2024-11-21 璇ョ被宸茬粡寮冪敤锛屾敼鐢盋oreTimer瀹炵幇銆�
+ * 褰撻噰鐢═hread瀹炵幇鏃讹紝鍦╳hile(true){}涓娇鐢═hread.sleep()锛屽彲鑳藉鑷寸殑涓ラ噸鎬ц兘闂锛屼笉鎺ㄨ崘鍦ㄥ惊鐜腑浣跨敤绾跨▼浼戠湢銆�
+ * Java绾跨▼瀹炵幇閲囩敤鍐呮牳绾跨▼瀹炵幇锛岀嚎绋嬬殑浼戠湢鍙婂敜閱掞紙鐘舵�佸垏鎹級闇�鍊熷姪鎿嶄綔绯荤粺杩涜锛岃繖鏄竴涓瀬鍏惰�楁椂鑰楀姏鐨勬搷浣溿��
+ * 鍦ㄧ嚎绋嬩紤鐪犳垨杩愯鏃堕棿杈冮暱鐨勬儏鏅笅锛屽叾瀵规�ц兘鐨勫奖鍝嶈繕涓嶇畻鏄庢樉锛屽洜涓哄绾跨▼鐘舵�佺殑鍒囨崲骞朵笉棰戠箒銆�
+ * 浣嗚嫢绾跨▼浼戠湢鍙婅繍琛岀殑鏃堕棿閮藉緢鐭紙渚嬪姣/绉掞級锛�
+ * 绯荤粺灏嗛绻佺殑瀵圭嚎绋嬬姸鎬佽繘琛屽垏鎹紝瀵艰嚧涓ラ噸鐨勬�ц兘鎹熻�楋紝骞跺鐫�寰幆娆℃暟鐨勯�掑鑰屾斁澶с��
+ */
+@Deprecated
 public class CoreThread extends Thread{
 	
 	private static Logger log = LogManager.getLogger(CoreThread.class.getName()) ;
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreTimer.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreTimer.java
new file mode 100644
index 0000000..9e30fd6
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreTimer.java
@@ -0,0 +1,80 @@
+package com.dy.common.mw.core;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2024/11/21 13:41
+ * @Description
+ */
+public class CoreTimer extends TimerTask {
+
+    private static final Logger log = LogManager.getLogger(CoreTimer.class.getName()) ;
+
+    private static final CoreTimer instance = new CoreTimer() ;
+
+    private Long workInterval = 100L ;//鏍稿績绾跨▼鏆傚仠闂撮殧
+
+    private Timer timer;
+
+    private boolean stop;
+
+    private CoreTimer(){
+        this.timer = new Timer();
+        this.stop = false ;
+    }
+
+    public static CoreTimer getInstance(){
+        return instance ;
+    }
+
+    public void stop(){
+        this.stop = true ;
+        if(this.timer != null){
+            this.timer.cancel();
+        }
+    }
+    public boolean isStop(){
+        return this.stop ;
+    }
+
+    /**
+     * 璁剧疆/鏍稿績绾跨▼鏆傚仠闂撮殧
+     * @param workInterval /鏍稿績绾跨▼鏆傚仠闂撮殧
+     */
+    public void setSleep(Long workInterval){
+        this.workInterval = workInterval ;
+    }
+
+    public void start(){
+        this.timer.schedule(this, 0 , this.workInterval);
+    }
+
+    /**
+     * TimerTask鐨剅un鏂规硶
+     */
+    @Override
+    public void run() {
+        try{
+            /**
+             * 姝ゅ鍙栧嚭褰撳墠闃熷垪鐨勮妭鐐规暟閲忥紝浣滀负涓�涓畾閲廲ount澶勭悊锛�
+             * 鍘熷洜:
+             * 鍦ㄥ鐞嗗畾閲廲ount杩囩▼涓紝鍙兘鏈夌殑鑺傜偣鍙堝洖鍒伴槦鍒椾腑锛屼篃鍙兘鏂扮敓鑺傜偣杩涘叆闃熷垪涓紝鍗冲湪澶勭悊杩囩▼涓紝闃熷垪鍙兘鍙堝闀夸簡
+             */
+            int count = CoreUnit.taskQueue.size() ;
+            while(count > 0){
+                CoreTask task = (CoreTask)CoreUnit.taskQueue.pop() ;
+                if(task != null){
+                    task.execute();
+                }
+                count-- ;
+            }
+        }catch(Exception e){
+            log.error("鏍稿績绾跨▼鍙戠敓寮傚父" + (e.getMessage() == null ? "" : (":" + e.getMessage())), e);;
+        }
+    }
+}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreUnit.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreUnit.java
index d7c3261..6b3ce51 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreUnit.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreUnit.java
@@ -8,6 +8,7 @@
 import com.dy.common.mw.UnitInterface;
 import com.dy.common.mw.UnitCallbackInterface;
 
+
 public class CoreUnit implements UnitInterface {
 	
 	private static final CoreUnit instance = new CoreUnit() ;
@@ -36,17 +37,14 @@
 		if(vo == null){
 			throw new Exception("鏍稿績妯″潡閰嶇疆瀵硅薄涓嶈兘涓虹┖锛�") ;
 		}
-		if(vo.sleepBigBusy == null || vo.sleepSmallBusy == null){
+		if(vo.coreInterval == null){
 			throw new Exception("鏍稿績妯″潡閰嶇疆瀵硅薄闂撮殧灞炴�у�间笉鑳戒负绌猴紒") ;
 		}
-		if(vo.sleepBigBusy <= 0){
-			throw new Exception("鏍稿績妯″潡閰嶇疆瀵硅薄灞炴�leepBigBusy鍊间笉鑳藉皬浜�0锛�") ;
+		if(vo.coreInterval <= 0){
+			throw new Exception("鏍稿績妯″潡閰嶇疆瀵硅薄灞炴�oreInterval鍊间笉鑳藉皬浜�0锛�") ;
 		}
-		if(vo.sleepBigBusy > 1000){
-			throw new Exception("鏍稿績妯″潡閰嶇疆瀵硅薄灞炴�leepBigBusy鍊间笉鑳藉ぇ浜�1000锛�") ;
-		}
-		if(vo.sleepSmallBusy > 1000){
-			throw new Exception("鏍稿績妯″潡閰嶇疆瀵硅薄灞炴�leepSmallBusy鍊间笉鑳藉ぇ浜�1000锛�") ;
+		if(vo.coreInterval > 1000){
+			throw new Exception("鏍稿績妯″潡閰嶇疆瀵硅薄灞炴�oreInterval鍊间笉鑳藉ぇ浜�1000锛�") ;
 		}
 		if(vo.queueWarnSize == null || vo.queueMaxSize == null){
 			throw new Exception("鏍稿績妯″潡閰嶇疆瀵硅薄闃熷垪鑺傜偣闄愬埗鏁伴噺灞炴�у�间笉鑳戒负绌猴紒") ;
@@ -67,18 +65,22 @@
 	public void start(UnitCallbackInterface callback) throws Exception {
 		if(!started){
 			started = true ;
+			/*
 			CoreThread ct = CoreThread.getInstance() ;
 			ct.setSleep(this.adapter.getConfig().sleepBigBusy, this.adapter.getConfig().sleepSmallBusy);
-			ct.start(); 
-			
+			ct.start();
+			*/
+			CoreTimer ct = CoreTimer.getInstance() ;
+			ct.setSleep(this.adapter.getConfig().coreInterval);
+			ct.start();
+
 			CoreConstantManage ccm = CoreConstantManage.getInstance() ;
-			ccm.setSleep(this.adapter.getConfig().sleepBigBusy, this.adapter.getConfig().sleepSmallBusy);
+			ccm.setSleep(this.adapter.getConfig().coreInterval);
 			ccm.start();
 			
 			if(adapter.getConfig().showStartInfo){
 				System.out.println("鏍稿績妯″潡鎴愬姛鍚姩锛�"
-						+ "涓荤嚎绋嬬箒蹇欓棿闅旓細" + adapter.getConfig().sleepBigBusy + "姣锛�"
-						+ "杞婚棽闂撮殧锛�" + adapter.getConfig().sleepSmallBusy + "姣"  );
+						+ "涓荤嚎绋嬫墽琛岄棿闅旓細" + adapter.getConfig().coreInterval + "姣");
 			}
 			callback.call(null);
 		}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreUnitConfigVo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreUnitConfigVo.java
index 521c1cf..591c566 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreUnitConfigVo.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreUnitConfigVo.java
@@ -1,8 +1,7 @@
 package com.dy.common.mw.core;
 
 public class CoreUnitConfigVo {
-	public Long sleepBigBusy = 100L ;//澶у繖鏃讹紙闄や簡鎭掍箙浠诲姟锛岃繕鏈夊叾浠栦换鍔¢渶澶勭悊锛夛紝鏍稿績绾跨▼鏆傚仠闂撮殧
-	public Long sleepSmallBusy = 500L ;//灏忓繖鏃讹紙鍙湁鎭掍箙浠诲姟锛屾棤鍏朵粬浠诲姟闇�澶勭悊锛夛紝鏍稿績绾跨▼鏆傚仠闂撮殧
+	public Long coreInterval = 100L ;//澶у繖鏃讹紙闄や簡鎭掍箙浠诲姟锛岃繕鏈夊叾浠栦换鍔¢渶澶勭悊锛夛紝鏍稿績绾跨▼鏆傚仠闂撮殧
 	public Integer queueWarnSize = 1000 ;//闃熷垪鎶ヨ闀垮害
 	public Integer queueMaxSize = 5000 ;//闃熷垪鏈�澶ч暱搴�
 	public Boolean showStartInfo; //鏄惁鍦ㄦ帶鍒跺彴涓婃樉绀轰俊鎭�
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ThreadJob.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ThreadJob.java
index 35c75e0..cfd912a 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ThreadJob.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ThreadJob.java
@@ -2,6 +2,7 @@
 
 
 @SuppressWarnings("unused")
+@Deprecated
 public abstract class ThreadJob {
     protected Thread thread ;
     protected boolean stop = false ;
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/TimerTaskJob.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/TimerTaskJob.java
index b72f479..8aefc22 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/TimerTaskJob.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/TimerTaskJob.java
@@ -7,11 +7,12 @@
  * @Author: liurunyu
  * @Date: 2024/11/20 17:49
  * @Description :
+ * 2024-11-20锛�
  * 姝ゆ娊璞$被浠f浛ThreadJob锛屽師鍥狅細
  * 鍦╳hile(true){}涓娇鐢═hread.sleep()锛屽彲鑳藉鑷寸殑涓ラ噸鎬ц兘闂锛屼笉鎺ㄨ崘鍦ㄥ惊鐜腑浣跨敤绾跨▼浼戠湢銆�
  * Java绾跨▼瀹炵幇閲囩敤鍐呮牳绾跨▼瀹炵幇锛岀嚎绋嬬殑浼戠湢鍙婂敜閱掞紙鐘舵�佸垏鎹級闇�鍊熷姪鎿嶄綔绯荤粺杩涜锛岃繖鏄竴涓瀬鍏惰�楁椂鑰楀姏鐨勬搷浣溿��
  * 鍦ㄧ嚎绋嬩紤鐪犳垨杩愯鏃堕棿杈冮暱鐨勬儏鏅笅锛屽叾瀵规�ц兘鐨勫奖鍝嶈繕涓嶇畻鏄庢樉锛屽洜涓哄绾跨▼鐘舵�佺殑鍒囨崲骞朵笉棰戠箒銆�
- * 浣嗚嫢绾跨▼浼戠湢鍙婅繍琛岀殑鏃堕棿閮藉緢鐭紙渚嬪姣/绉掞紝鏂囦腑妗堜緥灏辨槸涓�涓吀鍨嬫渚嬶級锛�
+ * 浣嗚嫢绾跨▼浼戠湢鍙婅繍琛岀殑鏃堕棿閮藉緢鐭紙渚嬪姣/绉掞級锛�
  * 绯荤粺灏嗛绻佺殑瀵圭嚎绋嬬姸鎬佽繘琛屽垏鎹紝瀵艰嚧涓ラ噸鐨勬�ц兘鎹熻�楋紝骞跺鐫�寰幆娆℃暟鐨勯�掑鑰屾斁澶с��
  */
 public abstract class TimerTaskJob {
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voUg/VoUgRtuResult.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voUg/VoUgRtuResult.java
new file mode 100644
index 0000000..2653252
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voUg/VoUgRtuResult.java
@@ -0,0 +1,30 @@
+package com.dy.pipIrrGlobal.voUg;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
+import com.alibaba.excel.enums.poi.VerticalAlignmentEnum;
+import lombok.Data;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2024/11/22 14:26
+ * @Description
+ */
+@Data
+@HeadRowHeight(26)
+@ContentRowHeight(22)
+public class VoUgRtuResult {
+    @ExcelProperty("鎺у埗鍣ㄥ湴鍧�")
+    @ColumnWidth(20)
+    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER)
+    public String rtuAddr;
+
+    @ExcelProperty("鍗囩骇缁撴灉")
+    @ColumnWidth(30)
+    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.LEFT, verticalAlignment = VerticalAlignmentEnum.CENTER)
+    public String result;
+}
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml
index 3445b17..fc2033d 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml
@@ -313,7 +313,7 @@
     #鍛戒护鍙戦�佸湴鍧�(涓紑鏄満鏋則ag锛屽叾涔熸槸鏁版嵁婧愬悗缂�鍚嶇О)
     ym:
         comSendUrl: "http://127.0.0.1:8070/rtuMw/com/send"
-        ugTaskSendUrl: "http://192.168.40.132:8070/rtuMw/com/upgradeRtu"
+        ugTaskSendUrl: "http://127.0.0.1:8070/rtuMw/com/upgradeRtu"
         rtuLogFileUrl: "http://127.0.0.1:8070/rtuMw/com/rtuLogFile"
         rtuLogTextUrl: "http://127.0.0.1:8070/rtuMw/com/rtuLogText"
     sp:
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java
index 72902e7..1d82e16 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java
@@ -370,8 +370,7 @@
 			// ///////////////
 			// 鏍稿績
 			CoreUnitConfigVo coreConfVo = new CoreUnitConfigVo();
-			coreConfVo.sleepBigBusy = conf.getSetAttrPlusInt(doc, "config.core", "sleepBigBusy", null, 1, 200, null).longValue() ;
-			coreConfVo.sleepSmallBusy = conf.getSetAttrPlusInt(doc, "config.core", "sleepSmallBusy", null, 2, 1000, null).longValue();
+			coreConfVo.coreInterval = conf.getSetAttrPlusInt(doc, "config.core", "coreInterval", null, 1, 200, null).longValue() ;
 			coreConfVo.queueWarnSize = ServerProperties.cacheUpDownDataWarnCount ;
 			coreConfVo.queueMaxSize = ServerProperties.cacheUpDownDataMaxCount ;
 			coreConfVo.showStartInfo = showStartInfo ;
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeTask.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeTask.java
index 9c606ec..fbc5c6e 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeTask.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeTask.java
@@ -13,6 +13,7 @@
 
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 /**
  * @Author: liurunyu
@@ -202,6 +203,7 @@
         if(this.taskVo.rtuAddrList != null && this.taskVo.rtuAddrList.size() > 0){
             state.rtuTotal = this.taskVo.rtuAddrList.size() ;
             if(this.upgradeRtus != null && this.upgradeRtus.size() > 0){
+                AtomicBoolean hasRunning = new AtomicBoolean(false);
                 this.upgradeRtus.values().stream().forEach(info ->{
                     if(info.state == UpgradeRtu.STATE_OFFLINE){
                         state.offLineTotal ++ ;
@@ -222,8 +224,15 @@
                     }
                     if(info.isOver){
                         state.overTotal++;
+                    }else{
+                        hasRunning.set(true);
                     }
                 });
+                if(!hasRunning.get()){
+                    state.allOver = true ;
+                }else{
+                    state.allOver = false ;
+                }
             }
         }
         return state ;
diff --git "a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050sp\346\262\231\347\233\230\051.xml" "b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050sp\346\262\231\347\233\230\051.xml"
index a84ad5e..27724cf 100644
--- "a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050sp\346\262\231\347\233\230\051.xml"
+++ "b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050sp\346\262\231\347\233\230\051.xml"
@@ -124,14 +124,12 @@
 	/>
 
 	<!--
-    sleepBigBusy锛氫富绾跨▼澶у繖鏃舵瘡娆℃墽琛岄棿闅旀椂闀匡紙姣锛�
-    sleepSmallBusy锛氫富绾跨▼灏忓繖鏃舵瘡娆℃墽琛岄棿闅旀椂闀匡紙姣锛�
+    coreInterval锛氫富绾跨▼姣忔鎵ц闂撮殧鏃堕暱锛堟绉掞級
     queueWarnSize: 缂撳瓨闃熷垪鑺傜偣鏁拌鍛婃暟閲�
     queueMaxSize: 缂撳瓨闃熷垪鑺傜偣鏁版渶澶ф暟閲�
      -->
 	<core
-			sleepBigBusy="100"
-			sleepSmallBusy="500"
+			coreInterval="100"
 			queueWarnSize="100000"
 			queueMaxSize="300000"
 	/>
diff --git "a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050test\346\265\213\350\257\225\051.xml" "b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050test\346\265\213\350\257\225\051.xml"
index a9648f9..2ba0296 100644
--- "a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050test\346\265\213\350\257\225\051.xml"
+++ "b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050test\346\265\213\350\257\225\051.xml"
@@ -124,14 +124,12 @@
 	/>
 
 	<!--
-    sleepBigBusy锛氫富绾跨▼澶у繖鏃舵瘡娆℃墽琛岄棿闅旀椂闀匡紙姣锛�
-    sleepSmallBusy锛氫富绾跨▼灏忓繖鏃舵瘡娆℃墽琛岄棿闅旀椂闀匡紙姣锛�
+    coreInterval锛氫富绾跨▼姣忔鎵ц闂撮殧鏃堕暱锛堟绉掞級
     queueWarnSize: 缂撳瓨闃熷垪鑺傜偣鏁拌鍛婃暟閲�
     queueMaxSize: 缂撳瓨闃熷垪鑺傜偣鏁版渶澶ф暟閲�
      -->
 	<core
-			sleepBigBusy="100"
-			sleepSmallBusy="500"
+			coreInterval="100"
 			queueWarnSize="100000"
 			queueMaxSize="300000"
 	/>
diff --git "a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050ym\345\205\203\350\260\213\051.xml" "b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050ym\345\205\203\350\260\213\051.xml"
index 3a54042..eabdf5c 100644
--- "a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050ym\345\205\203\350\260\213\051.xml"
+++ "b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050ym\345\205\203\350\260\213\051.xml"
@@ -124,14 +124,12 @@
 	/>
 
 	<!--
-    sleepBigBusy锛氫富绾跨▼澶у繖鏃舵瘡娆℃墽琛岄棿闅旀椂闀匡紙姣锛�
-    sleepSmallBusy锛氫富绾跨▼灏忓繖鏃舵瘡娆℃墽琛岄棿闅旀椂闀匡紙姣锛�
+    coreInterval锛氫富绾跨▼姣忔鎵ц闂撮殧鏃堕暱锛堟绉掞級
     queueWarnSize: 缂撳瓨闃熷垪鑺傜偣鏁拌鍛婃暟閲�
     queueMaxSize: 缂撳瓨闃熷垪鑺傜偣鏁版渶澶ф暟閲�
      -->
 	<core
-			sleepBigBusy="100"
-			sleepSmallBusy="500"
+			coreInterval="100"
 			queueWarnSize="100000"
 			queueMaxSize="300000"
 	/>
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml
index 3a54042..eabdf5c 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml
@@ -124,14 +124,12 @@
 	/>
 
 	<!--
-    sleepBigBusy锛氫富绾跨▼澶у繖鏃舵瘡娆℃墽琛岄棿闅旀椂闀匡紙姣锛�
-    sleepSmallBusy锛氫富绾跨▼灏忓繖鏃舵瘡娆℃墽琛岄棿闅旀椂闀匡紙姣锛�
+    coreInterval锛氫富绾跨▼姣忔鎵ц闂撮殧鏃堕暱锛堟绉掞級
     queueWarnSize: 缂撳瓨闃熷垪鑺傜偣鏁拌鍛婃暟閲�
     queueMaxSize: 缂撳瓨闃熷垪鑺傜偣鏁版渶澶ф暟閲�
      -->
 	<core
-			sleepBigBusy="100"
-			sleepSmallBusy="500"
+			coreInterval="100"
 			queueWarnSize="100000"
 			queueMaxSize="300000"
 	/>
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java
index 8c7fb80..be352d7 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java
@@ -132,7 +132,7 @@
                     jsonArray.add(jsonObject);
                 });
             }
-            System.out.println(jsonArray);
+            //System.out.println(jsonArray);
         }
 
         /**
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 0e99c5e..ec86f88 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
@@ -1,7 +1,8 @@
 package com.dy.pipIrrRemote.rtuUpgrage;
 
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.support.ExcelTypeEnum;
 import com.dy.common.aop.SsoAop;
-import com.dy.common.multiDataSource.DataSourceContext;
 import com.dy.common.softUpgrade.state.UpgradeRtu;
 import com.dy.common.softUpgrade.state.UpgradeTaskVo;
 import com.dy.common.springUtil.SpringContextUtil;
@@ -12,6 +13,8 @@
 import com.dy.pipIrrGlobal.pojoUg.UgRtuProgram;
 import com.dy.pipIrrGlobal.pojoUg.UgRtuTask;
 import com.dy.pipIrrGlobal.rtuMw.ToRtuMwCom;
+import com.dy.pipIrrGlobal.voPr.VoDivide;
+import com.dy.pipIrrGlobal.voUg.VoUgRtuResult;
 import com.dy.pipIrrGlobal.voUg.VoWatch;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.media.Content;
@@ -19,15 +22,19 @@
 import io.swagger.v3.oas.annotations.responses.ApiResponse;
 import io.swagger.v3.oas.annotations.responses.ApiResponses;
 import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
 import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.client.RestTemplate;
 
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.Base64;
 import java.util.List;
@@ -44,6 +51,9 @@
 public class RtuUpgradeCtrl extends ToRtuMwCom {
     @Autowired
     private RtuUpgradeSv sv ;
+
+    @Autowired
+    RtuUpgradeResSv resSv ;
 
     @Autowired
     private Environment env;
@@ -128,9 +138,10 @@
         vo.softBytesCalculate = ppo.programCalculateBytes ;
         vo.softByteSrc16 = ppo.programCrc16 ;
     }
+
+
     /**
-     *  鐩戣锛�
-     * 閲嶇疆锛屾紨绀虹殑閲嶇疆
+     * 閲嶇疆杩滅▼鍗囩骇婕旂ず绋嬪簭
      * @return 鎿嶄綔缁撴灉
      */
     @GetMapping(path = "/demoReset")
@@ -166,7 +177,7 @@
         if(qvo == null){
             qvo = new QueryVo();
             qvo.pageCurr = 1 ;
-            qvo.pageSize = 50 ;
+            qvo.pageSize = 49 ;
         }
         if(RtuUpgradeStateReceiverCtrl.cache == null){
             //return BaseResponseUtils.buildError("褰撳墠娌℃湁鍗囩骇浠诲姟") ;
@@ -174,96 +185,50 @@
             RtuUpgradeStateReceiverCtrl ctrl = SpringContextUtil.getBean(RtuUpgradeStateReceiverCtrl.class);
             ctrl.demo();
         }
-
-        QueryResultVo<VoWatch> rsVo = new QueryResultVo();
-        VoWatch vo = new VoWatch() ;
-        List<UpgradeRtu> listFiltered = null ;
-        if(RtuUpgradeStateReceiverCtrl.cache != null && RtuUpgradeStateReceiverCtrl.cache.ugTaskId != null){
-            vo.upgrade = this.sv.selectTaskDetail(RtuUpgradeStateReceiverCtrl.cache.ugTaskId);
-            vo.overall = RtuUpgradeStateReceiverCtrl.cache.ugOverallState ;
-            vo.rtus = new ArrayList<>() ;
-            if(RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList != null && RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList.size() > 0) {
-                listFiltered = filterByQuery(qvo) ;
-                if (listFiltered.size() > 0) {
-                    if(qvo.pageCurr < 1){
-                        qvo.pageCurr = 1 ;
-                    }
-                    int start = (qvo.pageCurr - 1) * qvo.pageSize ;
-                    if(start >= listFiltered.size()){
-                        if(listFiltered.size()%qvo.pageSize > 0){
-                            start = listFiltered.size() - listFiltered.size()%qvo.pageSize ;
-                        }else{
-                            start = listFiltered.size() - qvo.pageSize ;
-                        }
-                    }
-                    for(int i = start; i < (start + qvo.pageSize) && i < listFiltered.size(); i++){
-                        UpgradeRtu ugRtu = listFiltered.get(i) ;
-                        VoWatch.VoWatchRtu rtu = new VoWatch.VoWatchRtu() ;
-                        rtu.fromCache(ugRtu) ;
-                        vo.rtus.add(rtu) ;
-                    }
-                }
-            }
-        }
-
-        rsVo.obj = vo ;
-        rsVo.pageSize = qvo.pageSize ;
-        rsVo.pageCurr = qvo.pageCurr ;
-        rsVo.calculateAndSet(0L + (listFiltered==null?0:listFiltered.size()), null);
+        QueryResultVo<VoWatch> rsVo = this.resSv.curUpgradeState(qvo) ;
         return BaseResponseUtils.buildSuccess(rsVo) ;
     }
 
-    private List<UpgradeRtu> filterByQuery(QueryVo qvo){
-        if (qvo.status != null || qvo.result != null) {
-            final Integer qvoStatus = qvo.status ;
-            final Integer qvoResult = qvo.result ;
-            final String qvoRtuAddr = qvo.rtuAddr ;
-            return RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList.stream().filter(rtu -> {
-                boolean ok = false;
-                if (qvoStatus != null) {
-                    if (qvoStatus.intValue() == 1) {
-                        if (rtu.state == UpgradeRtu.STATE_RUNNING) {
-                            ok = true;
-                        }else{
-                            ok = false ;
-                        }
-                    } else if (qvoStatus.intValue() == 0) {
-                        if (rtu.isOver) {
-                            ok = true;
-                        }else{
-                            ok = false ;
-                        }
-                    }
-                }
-                if (qvoResult != null) {
-                    if (qvoResult.intValue() == 1) {
-                        if (rtu.state == UpgradeRtu.STATE_SUCCESS) {
-                            ok = true;
-                        }else{
-                            ok = false ;
-                        }
-                    } else if (qvoResult.intValue() == 0) {
-                        if (rtu.state == UpgradeRtu.STATE_OFFLINE
-                                || rtu.state == UpgradeRtu.STATE_FAILONE
-                                || rtu.state == UpgradeRtu.STATE_FAIL
-                                || rtu.state == UpgradeRtu.STATE_FAILOFFLINE) {
-                            ok = true;
-                        }else{
-                            ok = false ;
-                        }
-                    }
-                }
-                if(qvoRtuAddr != null && !qvoRtuAddr.trim().equals("")){
-                    if(rtu.rtuAddr.equals(qvoRtuAddr)){
-                        ok = true;
-                    }else{
-                        ok = false ;
-                    }
-                }
-                return ok;
-            }).toList() ;
-        }else{
-            return RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList ;
-        }
+    /**
+     * 瀵煎嚭鍗囩骇澶辫触RTU鍒楄〃
+     * @param response
+     */
+    @RequestMapping(value = "/exportUgFail", method = RequestMethod.GET)
+    public void exportUgFail(HttpServletResponse response) throws Exception {
+        setExcelRespProp(response, "鍗囩骇澶辫触RTU鍒楄〃");
+        List<VoUgRtuResult> rsList = resSv.exportUgFail();
+        EasyExcel.write(response.getOutputStream())
+                .head(VoUgRtuResult.class)
+                .excelType(ExcelTypeEnum.XLSX)
+                .sheet("鍗囩骇澶辫触RTU鍒楄〃")
+                .doWrite(rsList);
     }
+
+
+    /**
+     * 瀵煎嚭闀跨骇鎴愬姛RTU鍒楄〃
+     * @param response
+     */
+    @RequestMapping(value = "/exportUgSuccess", method = RequestMethod.GET)
+    public void exportUgSuccess(HttpServletResponse response) throws Exception {
+        setExcelRespProp(response, "鍗囩骇鎴愬姛RTU鍒楄〃");
+        List<VoUgRtuResult> rsList = resSv.exportUgSuccess();
+        EasyExcel.write(response.getOutputStream())
+                .head(VoUgRtuResult.class)
+                .excelType(ExcelTypeEnum.XLSX)
+                .sheet("鍗囩骇鎴愬姛RTU鍒楄〃")
+                .doWrite(rsList);
+    }
+
+
+    /**
+     * 璁剧疆excel涓嬭浇鍝嶅簲澶村睘鎬�
+     */
+    private void setExcelRespProp(HttpServletResponse response, String rawFileName) throws UnsupportedEncodingException {
+        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+        response.setCharacterEncoding("utf-8");
+        String fileName = URLEncoder.encode(rawFileName, "UTF-8").replaceAll("\\+", "%20");
+        response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
+    }
+
 }
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeResSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeResSv.java
new file mode 100644
index 0000000..03c204d
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeResSv.java
@@ -0,0 +1,160 @@
+package com.dy.pipIrrRemote.rtuUpgrage;
+
+import com.dy.common.softUpgrade.state.UpgradeRtu;
+import com.dy.common.webUtil.QueryResultVo;
+import com.dy.pipIrrGlobal.voUg.VoUgRtuResult;
+import com.dy.pipIrrGlobal.voUg.VoWatch;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Author liurunyu
+ * @Date 2024/11/22 14:40
+ * @Description
+ */
+@Slf4j
+@Service
+public class RtuUpgradeResSv {
+    @Autowired
+    private RtuUpgradeSv sv ;
+
+    public QueryResultVo<VoWatch> curUpgradeState(QueryVo qvo){
+        QueryResultVo<VoWatch> rsVo = new QueryResultVo<>();
+        VoWatch vo = new VoWatch() ;
+        List<UpgradeRtu> listFiltered = null ;
+        if(RtuUpgradeStateReceiverCtrl.cache != null && RtuUpgradeStateReceiverCtrl.cache.ugTaskId != null){
+            vo.upgrade = this.sv.selectTaskDetail(RtuUpgradeStateReceiverCtrl.cache.ugTaskId);
+            vo.overall = RtuUpgradeStateReceiverCtrl.cache.ugOverallState ;
+            vo.rtus = new ArrayList<>() ;
+            if(RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList != null && RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList.size() > 0) {
+                listFiltered = filterByQuery(qvo) ;
+                if (listFiltered.size() > 0) {
+                    if(qvo.pageCurr < 1){
+                        qvo.pageCurr = 1 ;
+                    }
+                    int start = (qvo.pageCurr - 1) * qvo.pageSize ;
+                    if(start >= listFiltered.size()){
+                        if(listFiltered.size()%qvo.pageSize > 0){
+                            start = listFiltered.size() - listFiltered.size()%qvo.pageSize ;
+                        }else{
+                            start = listFiltered.size() - qvo.pageSize ;
+                        }
+                    }
+                    for(int i = start; i < (start + qvo.pageSize) && i < listFiltered.size(); i++){
+                        UpgradeRtu ugRtu = listFiltered.get(i) ;
+                        VoWatch.VoWatchRtu rtu = new VoWatch.VoWatchRtu() ;
+                        rtu.fromCache(ugRtu) ;
+                        vo.rtus.add(rtu) ;
+                    }
+                }
+            }
+        }
+
+        rsVo.obj = vo ;
+        rsVo.pageSize = qvo.pageSize ;
+        rsVo.pageCurr = qvo.pageCurr ;
+        rsVo.calculateAndSet((long)(listFiltered==null?0:listFiltered.size()), null);
+        return rsVo ;
+    }
+
+    /**
+     * 杩囨护缁撴灉
+     * @param qvo 鏌ヨ鍙傛暟
+     * @return 闆嗗悎
+     */
+    private List<UpgradeRtu> filterByQuery(QueryVo qvo){
+        if (qvo.status != null || qvo.result != null) {
+            Integer qvoStatus = qvo.status ;
+            Integer qvoResult = qvo.result ;
+            String qvoRtuAddr = qvo.rtuAddr ;
+            return RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList.stream().filter(rtu -> {
+                boolean ok = false;
+                if (qvoStatus != null) {
+                    if (qvoStatus == 1) {
+                        ok = rtu.state == UpgradeRtu.STATE_RUNNING;
+                    } else if (qvoStatus == 0) {
+                        ok = rtu.isOver;
+                    }
+                }
+                if (qvoResult != null) {
+                    if (qvoResult == 1) {
+                        ok = rtu.state == UpgradeRtu.STATE_SUCCESS;
+                    } else if (qvoResult == 0) {
+                        ok = rtu.state == UpgradeRtu.STATE_OFFLINE
+                                || rtu.state == UpgradeRtu.STATE_FAILONE
+                                || rtu.state == UpgradeRtu.STATE_FAIL
+                                || rtu.state == UpgradeRtu.STATE_FAILOFFLINE;
+                    }
+                }
+                if(qvoRtuAddr != null && !qvoRtuAddr.trim().equals("")){
+                    ok = rtu.rtuAddr.equals(qvoRtuAddr);
+                }
+                return ok;
+            }).toList() ;
+        }else{
+            return RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList ;
+        }
+    }
+
+    /**
+     * 杩囨护鍑哄綋鍓嶉暱绾т换鍔′腑鍗囩骇澶辫触鐨凴TU
+     * @return 闆嗗悎
+     */
+    public List<VoUgRtuResult> exportUgFail(){
+        List<VoUgRtuResult> list = new ArrayList<>() ;
+        if(RtuUpgradeStateReceiverCtrl.cache != null && RtuUpgradeStateReceiverCtrl.cache.ugTaskId != null){
+            if(RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList != null && RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList.size() > 0) {
+                RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList.forEach(rtu -> {
+                    if(rtu.isOver){
+                        if(rtu.state == UpgradeRtu.STATE_OFFLINE
+                                || rtu.state == UpgradeRtu.STATE_UNSTART
+                                || rtu.state == UpgradeRtu.STATE_FAILOFFLINE){
+                            VoUgRtuResult vo = new VoUgRtuResult() ;
+                            vo.rtuAddr = rtu.rtuAddr ;
+                            vo.result = "绂荤嚎" ;
+                            list.add(vo);
+                        }else if(rtu.state == UpgradeRtu.STATE_FAILONE){
+                            VoUgRtuResult vo = new VoUgRtuResult() ;
+                            vo.rtuAddr = rtu.rtuAddr ;
+                            vo.result = "涓�鍖呮" ;
+                            list.add(vo);
+                        }else if(rtu.state == UpgradeRtu.STATE_FAIL){
+                            VoUgRtuResult vo = new VoUgRtuResult() ;
+                            vo.rtuAddr = rtu.rtuAddr ;
+                            vo.result = "澶氬寘姝�" ;
+                            list.add(vo);
+                        }
+                    }
+                });
+            }
+        }
+        return list ;
+    }
+
+    /**
+     * 杩囨护鍑哄綋鍓嶉暱绾т换鍔′腑鍗囩骇鎴愬姛鐨凴TU
+     * @return 闆嗗悎
+     */
+    public List<VoUgRtuResult> exportUgSuccess(){
+        List<VoUgRtuResult> list = new ArrayList<>() ;
+        if(RtuUpgradeStateReceiverCtrl.cache != null && RtuUpgradeStateReceiverCtrl.cache.ugTaskId != null){
+            if(RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList != null && RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList.size() > 0) {
+                RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList.forEach(rtu -> {
+                    if(rtu.isOver){
+                        if(rtu.state == UpgradeRtu.STATE_SUCCESS){
+                            VoUgRtuResult vo = new VoUgRtuResult() ;
+                            vo.rtuAddr = rtu.rtuAddr ;
+                            vo.result = "鍗囩骇鎴愬姛" ;
+                            list.add(vo);
+                        }
+                    }
+                });
+            }
+        }
+        return list ;
+    }
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeStateReceiverCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeStateReceiverCtrl.java
index 7654ce3..f379023 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeStateReceiverCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeStateReceiverCtrl.java
@@ -244,7 +244,7 @@
         }
 
         int n = Integer.parseInt(new CreateRandom().create(3)) ;
-        if(n == 540 || n == 541 || n == 542 || n == 543 || n == 544 || n == 545){
+        if(n == 540 || n == 541 || n == 542 || n == 543 || n == 544 || n == 545 || n == 546 || n == 547 || n == 548 || n == 549 ){
             if(rtu.currentPackage == 1){
                 //1鍖呮
                 rtu.state = UpgradeRtu.STATE_FAILONE ;
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeSv.java
index 3293427..11787ec 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeSv.java
@@ -58,28 +58,6 @@
     }
 
     /**
-     * 鏌ヨ涓�涓崌绾т换鍔℃湁鍏充俊鎭�
-     * @return 鍗囩骇浠诲姟鏈夊叧淇℃伅
-     */
-    public VoUpgradeDetail selectTaskDetail(String taskId){
-        List<VoUpgradeDetail> list = this.tdao.selectTaskDetail(Long.valueOf(taskId)) ;
-        if(list != null && list.size() > 0){
-            return list.get(0) ;
-        }
-        return null ;
-    }
-
-
-    /**
-     * 淇濆瓨鍗囩骇浠诲姟涓烘墽琛岀姸鎬�
-     * @param taskId 浠诲姟ID
-     */
-    public void setUpgradeTaskExecuted(String taskId){
-        this.tdao.executeById(Long.valueOf(taskId)) ;
-    }
-
-
-    /**
      * 淇濆瓨RTU鍗囩骇缁撴潫鐘舵��
      * @param taskId
      * @param rtu
@@ -91,17 +69,38 @@
         cdao.updateRtuUpgradeState(params) ;
     }
 
-    /////////////////////////////////////////////////////
-    //
-    // 浠ヤ笅妯℃嫙鏁版嵁
-    //
-    /////////////////////////////////////////////////////
     /**
-     * 閫氫俊涓婚敭鏌ヨ涓�涓崌绾т换鍔�
+     * 鏌ヨ涓�涓崌绾т换鍔℃湁鍏充俊鎭�
+     * @return 鍗囩骇浠诲姟鏈夊叧淇℃伅
+     */
+    public VoUpgradeDetail selectTaskDetail(String taskId){
+        List<VoUpgradeDetail> list = this.tdao.selectTaskDetail(Long.valueOf(taskId)) ;
+        if(list != null && list.size() > 0){
+            return list.get(0) ;
+        }
+        return null ;
+    }
+
+    /**
+     * 淇濆瓨鍗囩骇浠诲姟涓烘墽琛岀姸鎬�
+     * @param taskId 浠诲姟ID
+     */
+    public void setUpgradeTaskExecuted(String taskId){
+        this.tdao.executeById(Long.valueOf(taskId)) ;
+    }
+
+
+    /////////////////////////////////////////////////////
+    //
+    // 浠ヤ笅婕旂ず鍗囩骇鍔熻兘鐢ㄥ埌
+    //
+    /////////////////////////////////////////////////////
+
+    /**
+     * 鏌ヨ鏈�鏂颁竴涓崌绾т换鍔�
      * @return
      */
     public UgRtuTask selectLastTask(){
         return tdao.selectLastTask();
     }
-
 }
diff --git a/pipIrr-platform/pom.xml b/pipIrr-platform/pom.xml
index 62c1229..61492eb 100644
--- a/pipIrr-platform/pom.xml
+++ b/pipIrr-platform/pom.xml
@@ -271,11 +271,11 @@
                 <scope>import</scope>
             </dependency>
 
-            <!-- quartz -->
+            <!-- rocketmq-client -->
             <dependency>
                 <groupId>org.apache.rocketmq</groupId>
                 <artifactId>rocketmq-client</artifactId>
-                <version>4.9.7</version>
+                <version>5.3.1</version>
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>

--
Gitblit v1.8.0