From 3efb76f21f8f2eff3705a6bf681ed6ff52b16d70 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期一, 18 十一月 2024 15:32:16 +0800
Subject: [PATCH] Maven编译打包时会产生一些警告信息,进行一个类的注解,消除这些警告信息
---
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeStateReceiverCtrl.java | 91 +++++++++++++++++++++++++++++++--------------
1 files changed, 62 insertions(+), 29 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 3c7ffa2..1d35d06 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
@@ -8,8 +8,8 @@
import com.dy.common.util.DateTime;
import com.dy.common.util.ThreadJob;
import com.dy.common.webUtil.BaseResponse;
-import com.dy.pipIrrGlobal.pojoRm.UgRtuProgram;
-import com.dy.pipIrrGlobal.pojoRm.UgRtuTask;
+import com.dy.pipIrrGlobal.pojoUg.UgRtuProgram;
+import com.dy.pipIrrGlobal.pojoUg.UgRtuTask;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
@@ -112,12 +112,20 @@
private static ThreadJob threadJob ;
+ protected void resetDemo(){
+ if(threadJob != null){
+ threadJob.stop() ;
+ threadJob = null ;
+ }
+ cache = null ;
+ }
+
protected void demo(){
if(cache == null){
UgRtuTask tpo = this.sv.selectLastTask() ;
if(tpo != null) {
UgRtuProgram ppo = this.sv.selectProgramById(tpo.programId);
- if (ppo == null) {
+ if (ppo != null) {
List<String> taskRtuAddrs = this.sv.selectAllRtuAddrByTask("" + tpo.id);
if (taskRtuAddrs != null && taskRtuAddrs.size() > 0) {
cache = new UpgradeInfo();
@@ -137,7 +145,17 @@
threadJob = new ThreadJob() {
@Override
public Object execute() throws Exception {
- runDemo() ;
+ while(!this.stop){
+ if(!runDemo()){
+ this.stop = true ;
+ }else{
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
return null;
}
};
@@ -162,25 +180,11 @@
}
}
}
- private void runDemo(){
- boolean hasRunning = true ;
- while (true){
- for(UpgradeRtu rtu : cache.ugRtuStateList){
- this.rtuUpgrade(rtu) ;
- hasRunning = this.statisticsNowUpgradeState() ;
- if(!hasRunning){
- break ;
- }
- }
- if(!hasRunning){
- break ;
- }
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
+ private boolean runDemo(){
+ for(UpgradeRtu rtu : cache.ugRtuStateList){
+ this.rtuUpgrade(rtu) ;
}
+ return this.statisticsNowUpgradeState() ;
}
private void rtuUpgrade(UpgradeRtu rtu){
if(rtu.lastDownDt == null){
@@ -215,13 +219,36 @@
return ;
}
int n = Integer.parseInt(new CreateRandom().create(2)) ;
- if(n == 44 || n == 45 || n == 54){
+ if(n == 4
+ || n == 14
+ || n == 24
+ || n == 34
+ || n == 44
+ || n == 54
+ || n == 64
+ || n == 74
+ || n == 84
+ || n == 95
+ || n == 45
+ || n == 46
+ || n == 47
+ || n == 48
+ || n == 49){
if(rtu.currentPackage == 1){
//1鍖呮
rtu.state = UpgradeRtu.STATE_FAILONE ;
return ;
}
}
+
+ if(n == 45){
+ if(rtu.currentPackage != 1){
+ //鍗囨
+ rtu.state = UpgradeRtu.STATE_FAIL ;
+ return ;
+ }
+ }
+
if(rtu.currentPackage == rtu.totalPackage){
//鍗囩骇缁撴潫
rtu.state = UpgradeRtu.STATE_SUCCESS ;
@@ -229,12 +256,16 @@
return ;
}
- rtu.state = UpgradeRtu.STATE_RUNNING ;
- rtu.currentPackage += 1 ;
- rtu.currentRamAddr = 0x00 + UpgradeRtu.RAMADDRADD ;
- rtu.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ;
- rtu.reTryTimes = 0 ;
- rtu.isOver = false ;
+ if(rtu.state != UpgradeRtu.STATE_FAILONE &&
+ rtu.state != UpgradeRtu.STATE_FAIL){
+ rtu.state = UpgradeRtu.STATE_RUNNING ;
+ rtu.currentPackage += 1 ;
+ rtu.currentRamAddr = 0x00 + UpgradeRtu.RAMADDRADD ;
+ rtu.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ;
+ rtu.reTryTimes = 0 ;
+ rtu.isOver = false ;
+ }
+
}
/**
@@ -244,6 +275,8 @@
public boolean statisticsNowUpgradeState() {
boolean hasRunning = false ;
if(cache.ugRtuStateList != null && cache.ugRtuStateList.size() > 0){
+ cache.ugOverallState.init();
+ cache.ugOverallState.rtuTotal = cache.ugRtuStateList.size() ;
for(UpgradeRtu rtu : cache.ugRtuStateList){
if(rtu.state == UpgradeRtu.STATE_OFFLINE){
cache.ugOverallState.offLineTotal ++ ;
--
Gitblit v1.8.0