liurunyu
2024-11-14 bc38e91b5905b4887561b9c6cab343610e60af5f
升级监视中,增加重置功能(只在演示中有效)
2个文件已修改
58 ■■■■ 已修改文件
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeCtrl.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeStateReceiverCtrl.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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){
            for(UpgradeRtu rtu : cache.ugRtuStateList){
                this.rtuUpgrade(rtu) ;
            }
            hasRunning = this.statisticsNowUpgradeState() ;
            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){