From c9fe1b65bf3b2cf2a935edeb3370f73a55f0ce67 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期六, 10 五月 2025 08:58:19 +0800
Subject: [PATCH] 修改《打包发布配置修改》文档
---
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeStateReceiverCtrl.java | 60 +++++++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 47 insertions(+), 13 deletions(-)
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 22d6a5c..a31da14 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
@@ -21,6 +21,7 @@
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
+import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
@@ -41,6 +42,13 @@
private RtuUpgradeSv sv ;
/**
+ * 寮哄埗缁撴潫鍗囩骇浠诲姟閫氫俊涓棿浠舵垚鍔熸墽琛屽悗
+ */
+ public static void afterMwForceOverCurUgTask(){
+ cache = null ;
+ }
+
+ /**
* rtu杩滅▼鍗囩骇浠诲姟閫氫俊涓棿浠舵墽琛屾儏鍐电粺璁″洖鏀�
* @param info 鏁版嵁
* @return 鎿嶄綔缁撴灉
@@ -48,15 +56,8 @@
@Hidden //涓嶅叕寮�鎺ュ彛锛屽叾鍙湁閫氫俊涓棿浠惰皟鐢�
@PostMapping(path = "/receive")
public BaseResponse<Boolean> receive(@RequestBody UpgradeInfo info, HttpServletRequest req, HttpServletResponse rep){
+ /*
log.info("鎺ユ敹鍒扮殑RTU杩滅▼鍗囩骇鐘舵�佹暟鎹负锛歿}", info.toString("532328000214"));
- //杩涜鎺掑簭
- //Comparator<UpgradeRtu> comparator = Comparator.comparing(UpgradeRtu::getRtuAddr, Comparator.naturalOrder());
- //info.ugRtuStateList = info.ugRtuStateList.stream().sorted(comparator).collect(Collectors.toList());
-
- //閫氫俊涓棿浠朵紶杩囨潵鐨勬満鏋則ag锛屼互鐢ㄤ簬鏌ユ壘鏁版嵁婧�
- String token = req.getHeader(Constant.UserTokenKeyInHeader);
- DataSourceContext.set(token);
-
if(info.ugRtuStateList != null && info.ugRtuStateList.size() > 0){
if(info.ugRtuStateList.size() < 10){
for (UpgradeRtu rtuVo : info.ugRtuStateList) {
@@ -64,6 +65,16 @@
}
}
}
+ */
+
+ //杩涜鎺掑簭
+ Comparator<UpgradeRtu> comparator = Comparator.comparing(UpgradeRtu::getRtuAddr, Comparator.naturalOrder());
+ info.ugRtuStateList = info.ugRtuStateList.stream().sorted(comparator).collect(Collectors.toList());
+
+ //閫氫俊涓棿浠朵紶杩囨潵鐨勬満鏋則ag锛屼互鐢ㄤ簬鏌ユ壘鏁版嵁婧�
+ String token = req.getHeader(Constant.UserTokenKeyInHeader);
+ DataSourceContext.set(token);
+
if(cache == null){
cache = info;
//姝ゆ椂涓嶅仛浠诲姟鎿嶄綔锛屽彧淇濋殰cache涓嶄负绌猴紝 绛夊緟涓嬫鍙戞潵鏁版嵁
@@ -81,6 +92,9 @@
}
//cache璧嬪�煎繀椤绘斁鍦ㄤ笂闈㈠鐞嗙殑鍚庨潰锛屽惁鍒欎笂闈㈢殑姣旇緝涓嶆垚鍔�
cache = info;
+ if(info.ugOverallState != null && info.ugOverallState.allOver){
+ this.saveTaskOver(info.ugTaskId) ;
+ }
}
return null;
}
@@ -104,15 +118,31 @@
*/
private void save2Db(String taskId, List<UpgradeRtu> newList, List<UpgradeRtu> oldList){
List<UpgradeRtu> newOverList = newList.stream().filter(vo -> vo.isOver).collect(Collectors.toList()) ;
+ List<UpgradeRtu> oldNoOverList = newList.stream().filter(vo -> !vo.isOver).collect(Collectors.toList()) ;
+ boolean oldExist = false ;
for(UpgradeRtu nvo : newOverList){
- if(nvo != null) {
- if(oldList.stream().anyMatch(vo -> vo.rtuAddr.equals(nvo.rtuAddr) && vo.isOver == false)){
- //涓婃娌℃湁鍗囩骇缁撴潫锛岃�屽綋鍓嶅崌绾х粨鏉熶簡
- this.sv.saveRtuUpgradeState(Long.parseLong(taskId), nvo);
- }
+ oldExist = false ;
+ if(oldNoOverList.stream().anyMatch(vo -> vo.rtuAddr.equals(nvo.rtuAddr))){
+ oldExist = true ;
+ }
+ if(!oldExist){
+ //涓婃娌℃湁鍗囩骇缁撴潫锛岃�屽綋鍓嶅崌绾х粨鏉熶簡
+ this.sv.saveRtuUpgradeState(Long.parseLong(taskId), nvo);
}
}
}
+
+ /**
+ * 淇濆瓨鍗囩骇浠诲姟宸茬粡鎵ц瀹屾垚
+ * @param taskId
+ */
+ private void saveTaskOver(String taskId){
+ this.sv.updateTaskOver(taskId) ;
+ }
+
+
+
+
/////////////////////////////////////////////////////
//
// 浠ヤ笅妯℃嫙鏁版嵁
@@ -211,6 +241,7 @@
rtu.currentPackage = 0 ;
rtu.currentRamAddr = 0x00 ;
rtu.lastDownDt = "" ;
+ rtu.lastDownDtAt = 0L ;
rtu.reTryTimes = 0 ;
rtu.isOver = false ;
}else{
@@ -218,6 +249,7 @@
rtu.currentPackage = 1 ;
rtu.currentRamAddr = 0x00 ;
rtu.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ;
+ rtu.lastDownDtAt = System.currentTimeMillis() ;
rtu.reTryTimes = 0 ;
rtu.isOver = false ;
}
@@ -268,6 +300,7 @@
rtu.currentPackage = 1 ;
rtu.currentRamAddr = 0x00 ;
rtu.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ;
+ rtu.lastDownDtAt = System.currentTimeMillis() ;
rtu.reTryTimes++ ;
rtu.isOver = false ;
return ;
@@ -280,6 +313,7 @@
rtu.currentPackage += 1 ;
rtu.currentRamAddr = 0x00 + UpgradeRtu.RAMADDRADD ;
rtu.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ;
+ rtu.lastDownDtAt = System.currentTimeMillis() ;
rtu.isOver = false ;
}
--
Gitblit v1.8.0