|  |  |  | 
|---|
|  |  |  | //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, 3600, 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, 36000, 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;//变成毫秒 | 
|---|
|  |  |  | 
|---|
|  |  |  | //升级任务未完成 | 
|---|
|  |  |  | //工作1:判断是否无任何一个RTU进行过升级,并且达到时限,则认为当前升级任务完成 | 
|---|
|  |  |  | //-1:无一RTU升级且超时,0:无RTU升级但未超时等待,1有RTU升级正常执行 | 
|---|
|  |  |  | int temp = this.task.countNoOneRtuUpgradeInDuration() ; | 
|---|
|  |  |  | int temp = 1 ; | 
|---|
|  |  |  | //int temp = this.task.countNoOneRtuUpgradeInDuration() ; | 
|---|
|  |  |  | if(temp == -1){ | 
|---|
|  |  |  | this.task.taskIsOver = true ; | 
|---|
|  |  |  | //任务已经完成 | 
|---|
|  |  |  | 
|---|
|  |  |  | this.task.countRunningRtuCount() ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //工作3:统计需要升级但当前离线RTU的情况,超过时限的设备为升级完成 | 
|---|
|  |  |  | this.task.countOffRtuAndSetIfOver() ; | 
|---|
|  |  |  | //this.task.countOffRtuAndSetIfOver() ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //工作4:统计是否全部升级完成 | 
|---|
|  |  |  | this.task.taskIsOver = this.task.countIsAllOver() ; | 
|---|
|  |  |  | //this.task.taskIsOver = this.task.countIsAllOver() ; | 
|---|
|  |  |  | }else if(temp == 0){ | 
|---|
|  |  |  | //不作为 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | AtomicBoolean hasRunning = new AtomicBoolean(false); | 
|---|
|  |  |  | this.upgradeRtus.values().forEach(info ->{ | 
|---|
|  |  |  | if(info.state == UpgradeRtu.STATE_OFFLINE){ | 
|---|
|  |  |  | state.offLineTotal++ ; | 
|---|
|  |  |  | state.failTotal++; | 
|---|
|  |  |  | }else if(info.state == UpgradeRtu.STATE_UNSTART){ | 
|---|
|  |  |  | state.unStartTotal ++ ; | 
|---|