zhubaomin
2024-11-22 44180ee779c038ad628fcd847a0b8e2ca9b6f4ee
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeCtrl.java
@@ -29,6 +29,7 @@
import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
/**
@@ -67,7 +68,7 @@
    @GetMapping(path = "/issuedTask")
    @SsoAop()
    public BaseResponse<Boolean> issuedTask(String id){
        if(id == null || !id.trim().equals("")){
        if(id == null || id.trim().equals("")){
            return BaseResponseUtils.buildError("任务id不能为空") ;
        }
        UgRtuTask tpo = this.sv.selectTaskById(id) ;
@@ -87,7 +88,7 @@
            return BaseResponseUtils.buildError("任务所涉及的控制器还未设置") ;
        }
        String ugCallbackUrl_rm = env.getProperty("mw." + DataSourceContext.get() + ".ugCallbackUrl_rm" );
        String ugCallbackUrl_rm = env.getProperty("mw.ugCallbackUrl_rm" );
        if(ugCallbackUrl_rm == null || ugCallbackUrl_rm.trim().equals("")){
            return BaseResponseUtils.buildError("未配置升级任务回调网址") ;
        }
@@ -104,8 +105,12 @@
                this.sv.setUpgradeTaskExecuted(id);
                return BaseResponseUtils.buildSuccess(true) ;
            }else{
                log.error("通信中间件执行下发升级任务失败" + (res.getMsg() == null? "" : ("," + res.getMsg()))) ;
                return BaseResponseUtils.buildFail("通信中间件执行失败" + (res.getMsg() == null? "" : ("," + res.getMsg()))) ;
                String msg = res.getContent()==null?null:(String)res.getContent() ;
                if(msg == null){
                    msg = res.getMsg() ;
                }
                log.error("通信中间件执行下发升级任务失败" + msg) ;
                return BaseResponseUtils.buildFail("通信中间件执行失败" + msg) ;
            }
        }else{
            log.error("通信中间件返回结果为null") ;
@@ -118,7 +123,8 @@
        vo.softFileName = ppo.hexFileName ;
        vo.softStoreAddr = ppo.storeRamAddr ;
        vo.softStartAddr = ppo.startRamAddr ;
        vo.softFileData = ppo.programBytes ;
        vo.softFileData64 = Base64.getEncoder().encodeToString(ppo.programBytes) ;
        //vo.softFileData = ppo.programBytes ;
        vo.softBytesCalculate = ppo.programCalculateBytes ;
        vo.softByteSrc16 = ppo.programCrc16 ;
    }
@@ -130,7 +136,7 @@
    @GetMapping(path = "/demoReset")
    @SsoAop()
    public BaseResponse<Boolean> demoReset(){
        if(RtuUpgradeStateReceiverCtrl.cache == null){
        if(RtuUpgradeStateReceiverCtrl.cache != null){
            //return BaseResponseUtils.buildError("当前没有升级任务") ;
            //正式运行时,下面两行去掉,上面一行打开
            RtuUpgradeStateReceiverCtrl ctrl = SpringContextUtil.getBean(RtuUpgradeStateReceiverCtrl.class);
@@ -159,6 +165,8 @@
    public BaseResponse<QueryResultVo<VoWatch> > curUpgradeState(QueryVo qvo){
        if(qvo == null){
            qvo = new QueryVo();
            qvo.pageCurr = 1 ;
            qvo.pageSize = 50 ;
        }
        if(RtuUpgradeStateReceiverCtrl.cache == null){
            //return BaseResponseUtils.buildError("当前没有升级任务") ;