From 2b4fc2b16efdc887b71855b0b4d5b5680453d088 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期五, 29 十一月 2024 11:15:52 +0800
Subject: [PATCH] 1、实现强制停止RTU远程升级任务功能; 2、业务系统与通信中间件web通信模块优化,使变得更通用与简单。

---
 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

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 6cfbdba..129aa1f 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
@@ -25,6 +25,8 @@
 import com.dy.common.util.ConfigXml4Springboot;
 import com.dy.common.util.IDLongGenerator;
 
+import com.dy.rtuMw.server.upgrade.UpgradeUnit;
+import com.dy.rtuMw.server.upgrade.UpgradeUnitConfigVo;
 import org.jdom2.Document;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -331,6 +333,27 @@
 			*/
 
 			/////////////////
+			//RTU杩滅▼鍗囩骇妯″潡
+			UpgradeUnitConfigVo ugVo = new UpgradeUnitConfigVo();
+			ugVo.enable = conf.getSetAttrBoolean(doc, "config.upgrade", "enable", null, null) ;
+			ugVo.noOneRtuUpgradeMaxDuration = conf.getSetAttrPlusInt(doc, "config.upgrade", "noOneRtuUpgradeMaxDuration", null, 5, 360000, null);
+			ugVo.noOneRtuUpgradeMaxDuration = ugVo.noOneRtuUpgradeMaxDuration * 1000 ;//鍙樻垚姣
+			ugVo.failTryTimes = conf.getSetAttrPlusInt(doc, "config.upgrade", "failTryTimes", null, 0, 100, null);
+			ugVo.ugMaxRtuAtOnce = conf.getSetAttrPlusInt(doc, "config.upgrade", "ugMaxRtuAtOnce", null, 0, 1000000, null);
+			ugVo.rtuOffLineWaitDuration = conf.getSetAttrPlusInt(doc, "config.upgrade", "rtuOffLineWaitDuration", null, 1, 3600000, null);
+			ugVo.rtuOffLineWaitDuration = ugVo.rtuOffLineWaitDuration * 1000;//鍙樻垚姣
+			ugVo.notifyStateInterval = conf.getSetAttrPlusInt(doc, "config.upgrade", "notifyStateInterval", null, 1, 300, null);
+			ugVo.notifyStateInterval = ugVo.notifyStateInterval * 1000;//鍙樻垚姣
+			ugVo.showStartInfo = showStartInfo ;
+			AdapterImp_UpgradeUnit ugAdap = new AdapterImp_UpgradeUnit();
+			ugAdap.setConfig(ugVo);
+			UpgradeUnit ugUnit = UpgradeUnit.getInstance();
+			ugUnit.setAdapter(ugAdap);
+			ugUnit.start(obj -> {
+			});
+			units.add(ugUnit) ;
+
+			/////////////////
 			//RTU涓婅鏁版嵁澶勭悊妯″潡锛堜换鍔℃爲锛�
 			RtuDataUnitConfigVo rducVo = new RtuDataUnitConfigVo();
 			rducVo.resourceLoader = this.resourceLoader ;
@@ -347,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 ;

--
Gitblit v1.8.0