pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeCtrl.java
@@ -122,6 +122,23 @@ vo.softBytesCalculate = ppo.programCalculateBytes ; vo.softByteSrc16 = ppo.programCrc16 ; } /** * 监视: * 重置,演示的重置 * @return 操作结果 */ @GetMapping(path = "/demoReset") @SsoAop() public BaseResponse<Boolean> demoReset(){ if(RtuUpgradeStateReceiverCtrl.cache == null){ //return BaseResponseUtils.buildError("当前没有升级任务") ; //正式运行时,下面两行去掉,上面一行打开 RtuUpgradeStateReceiverCtrl ctrl = SpringContextUtil.getBean(RtuUpgradeStateReceiverCtrl.class); ctrl.resetDemo(); ctrl.demo(); } return BaseResponseUtils.buildSuccess(true) ; } /** * 监视: @@ -134,7 +151,7 @@ responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, description = "返回操作成功与否数据(BaseResponse.content:Boolean)", content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = Boolean.class))} schema = @Schema(implementation = VoWatch.class))} ) }) @GetMapping(path = "/curUpgradeState") pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeStateReceiverCtrl.java
@@ -112,6 +112,14 @@ 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() ; @@ -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,22 +180,11 @@ } } } private void runDemo(){ boolean hasRunning = true ; while (true){ private boolean runDemo(){ for(UpgradeRtu rtu : cache.ugRtuStateList){ this.rtuUpgrade(rtu) ; } hasRunning = this.statisticsNowUpgradeState() ; if(!hasRunning){ break ; } try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } } return this.statisticsNowUpgradeState() ; } private void rtuUpgrade(UpgradeRtu rtu){ if(rtu.lastDownDt == null){