From 300cda64bc2f5ad7fb0a3c057c330ed905d12032 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期四, 28 十一月 2024 15:15:08 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV

---
 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeStateReceiverCtrl.java |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 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 abfdc1b..eb37c52 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;
 
@@ -74,12 +75,17 @@
                 }
             }
         }else{
-            cache = info;
             //褰揷ache涓湁鍊兼椂锛岃繘琛屾瘮瀵瑰瓨鍌紝瀵规瘮鐩殑鏄槻姝㈤噸澶嶆搷浣滄暟鎹簱
             if(info.ugRtuStateList != null && info.ugRtuStateList.size() > 0){
                 //姝ゆ椂淇濊瘉涓や釜闆嗗悎閮戒笉涓簄ull
                 this.save2Db(info.ugTaskId, info.ugRtuStateList, cache.ugRtuStateList);
             }
+            if(info.ugRtuStateList != null && info.ugRtuStateList.size() > 0){
+                //姝ゆ椂淇濊瘉涓や釜闆嗗悎閮戒笉涓簄ull
+                info.ugRtuStateList.stream().sorted(Comparator.comparing(UpgradeRtu::getRtuAddr, Comparator.naturalOrder())).collect(Collectors.toList());
+            }
+            //cache璧嬪�煎繀椤绘斁鍦ㄤ笂闈㈠鐞嗙殑鍚庨潰锛屽惁鍒欎笂闈㈢殑姣旇緝涓嶆垚鍔�
+            cache = info;
         }
         return null;
     }
@@ -103,9 +109,10 @@
      */
     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()) ;
         for(UpgradeRtu nvo : newOverList){
             if(nvo != null) {
-                if(oldList.stream().anyMatch(vo -> vo.rtuAddr.equals(nvo.rtuAddr) && vo.isOver == false)){
+                if(oldNoOverList.stream().anyMatch(vo -> vo.rtuAddr.equals(nvo.rtuAddr))){
                     //涓婃娌℃湁鍗囩骇缁撴潫锛岃�屽綋鍓嶅崌绾х粨鏉熶簡
                     this.sv.saveRtuUpgradeState(Long.parseLong(taskId), nvo);
                 }
@@ -305,10 +312,10 @@
                 }else if(rtu.state == UpgradeRtu.STATE_SUCCESS) {
                     cache.ugOverallState.successTotal++;
                 }else if(rtu.state == UpgradeRtu.STATE_FAILONE) {
-                    cache.ugOverallState.failOneTotal++;
+                    cache.ugOverallState.dieOneTotal++;
                     cache.ugOverallState.failTotal++;
                 }else if(rtu.state == UpgradeRtu.STATE_FAIL) {
-                    cache.ugOverallState.failMultiTotal++;
+                    cache.ugOverallState.dieMultiTotal++;
                     cache.ugOverallState.failTotal++;
                 }
                 if(rtu.isOver){

--
Gitblit v1.8.0