1、优化代码;2、修改长级测试中发现的bug;3、通信中间件配置文件配置项修改
50个文件已修改
567 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/aop/SsoAspect.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/aop/SsoPowerAspect.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/CommonV1.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/DriverV1.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_02_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_1601_Down.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_1602_Down.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_1603_Down.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_81_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_83_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_84_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_9601_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_9602_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_9603_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_C0_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/global/GlCreate.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/parse/Cd_02_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/parse/Cd_81_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/parse/Cd_83_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/parse/Cd_84_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/parse/Cd_C0_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/Cd_02_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/Cd_80_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/Cd_81_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/Cd_83_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/Cd_84_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/Cd_85_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/Cd_8A_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/Cd_C2_Up.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/softUpgrade/state/UpgradeInfo.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/CRC16.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/rtuMw/ToRtuMwCom.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeManager.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeRtuDev.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeTask.java 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeUnitConfigVo.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/web/comResult/CommandResultDeal.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/web/webRequest/WebRequestDeal.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(sp沙盘).xml 76 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(test测试).xml 76 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(ym元谋).xml 76 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-simulate-rtu/src/main/java/com/dy/simRtu/tcpClient/downData/DownData.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-simulate-rtu/src/main/java/com/dy/simRtu/tcpClient/upData/UpData.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/p206V1/ComSupportP206V1.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/p206V202404test/ComSupportP206V202404.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/rtuLog/RtuLogSupport.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeStateReceiverCtrl.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/aop/SsoAspect.java
@@ -111,9 +111,13 @@
                response = restTemplate.exchange(url, HttpMethod.GET, httpEntity, SsoVo.class);
            } catch (Exception e) {
                e.printStackTrace();
                return BaseResponseUtils.buildError("后端系统出错,访问单点登录系统异常");
            }
            assert response != null;
            return response.getBody();
            if(response == null){
                return BaseResponseUtils.buildError("后端系统出错,访问单点登录系统异常");
            }else{
                return response.getBody();
            }
        }else {
            return BaseResponseUtils.buildError("后端系统出错,未得到SsoCheckUrl");
        }
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/aop/SsoPowerAspect.java
@@ -129,9 +129,13 @@
                response = restTemplate.exchange(url, HttpMethod.GET, httpEntity, SsoVo.class);
            } catch (Exception e) {
                e.printStackTrace();
                return BaseResponseUtils.buildError("后端系统出错,访问单点登录系统异常");
            }
            assert response != null;
            return response.getBody();
            if(response == null){
                return BaseResponseUtils.buildError("后端系统出错,访问单点登录系统异常");
            }else{
                return response.getBody();
            }
        }else {
            return BaseResponseUtils.buildError("后端系统出错,未得到SsoCheckUrl");
        }
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/CommonV1.java
@@ -75,7 +75,7 @@
            int len = ByteUtilUnsigned.byte2Byte(bs, ProtocolConstantV206V1.dataLenIndex);
            return len + ProtocolConstantV206V1.lenHead2ctrl + ProtocolConstantV206V1.lenTail;
        }else{
            int len = ByteUtilUnsigned.bytes2Short_BE(bs, ProtocolConstantV206V1.UG_dataLenIndex_start);
            int len = ByteUtilUnsigned.bytes2Short_LE(bs, ProtocolConstantV206V1.UG_dataLenIndex_start);
            return len + ProtocolConstantV206V1.UG_lenHead2Cmd + ProtocolConstantV206V1.UG_lenTail;
        }
    }
@@ -176,8 +176,9 @@
                return "计算CRC是:" + crcCompute + ",上传CRC是" + crcInBs ;
            }
        }else{
            int crcCompute = (byte)new CRC16().CRC(bs, ProtocolConstantV206V1.ctrlIndex, bs.length - 3) ;
            int crcInBs = ByteUtilUnsigned.bytes2Short_BE(bs, bs.length - 3) ;
            short crcCompute = new CRC16().CRC(bs, 0, bs.length - 4) ;
            short crcInBs = ByteUtil.bytes2Short_BE(bs,bs.length - 3) ;
            //int crcInBs = ByteUtilUnsigned.bytes2Short_BE(bs, bs.length - 3) ;
            if(crcCompute == crcInBs){
                return null ;
            }else{
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/DriverV1.java
@@ -112,7 +112,10 @@
            isFail = true ;
            return new MidResult[]{(new MidResultError(ProtocolConstantV206V1.protocolName, rtuAddr, "严重错误,分析Rtu数据出错!数据为:" + upHex + (e.getMessage() == null?"":(",出错信息:" + e.getMessage())), e))} ;
        } finally{
            callback.callback(rtuAddr, upCode, CodeV1.getCodeName(upCode), upHex, reportOrResponse_trueOrFalse, isFail, rtuAddr);
            if(upCode != null){
                //CRC验证失败时,upCode为null,此时不进行回调
                callback.callback(rtuAddr, upCode, CodeV1.getCodeName(upCode), upHex, reportOrResponse_trueOrFalse, isFail, rtuAddr);
            }
        }
    }
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_02_Up.java
@@ -76,7 +76,7 @@
            confirmCommand.isQuickSend = true ;
        }
        callback.callback(midRs.reportOrResponse_trueOrFalse);
        return new MidResult[]{midRs, confirmCommand} ;
        return new MidResult[]{confirmCommand, midRs} ;
    }
    /**
     * æ‰§è¡Œåˆ†æž
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_1601_Down.java
@@ -33,7 +33,7 @@
        midRs.downCodeName = CodeV1.getCodeName(para.commandCode) ;//下行命令功能码名称;
        midRs.downBuffer = bs ;//下行命令数据
        midRs.downBufHex = ByteUtil.bytes2Hex(bs, true) ;//下行命令数据十六进制形式
        midRs.hasResponse = true ;//是否有应答
        midRs.hasResponse = false ;//是否有应答
        midRs.maxSendTimes = null ;//命令最大发送次数(当收不到应答时,将重发),如果不设置,命令缓存器进行补充设置
        midRs.isCachForOffLine = false ;//RTU不在线,命令是否缓存,低功耗时为true
@@ -75,7 +75,7 @@
        if(para.param == null){
            throw new Exception("参数为空") ;
        }
        if(para.param instanceof Com1601Vo){
        if(!(para.param instanceof Com1601Vo)){
            throw new Exception("参数类型非Com1601Vo") ;
        }
        Com1601Vo vo = (Com1601Vo) para.param ;
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_1602_Down.java
@@ -33,7 +33,7 @@
        midRs.downCodeName = CodeV1.getCodeName(para.commandCode) ;//下行命令功能码名称;
        midRs.downBuffer = bs ;//下行命令数据
        midRs.downBufHex = ByteUtil.bytes2Hex(bs, true) ;//下行命令数据十六进制形式
        midRs.hasResponse = true ;//是否有应答
        midRs.hasResponse = false ;//是否有应答
        midRs.maxSendTimes = null ;//命令最大发送次数(当收不到应答时,将重发),如果不设置,命令缓存器进行补充设置
        midRs.isCachForOffLine = false ;//RTU不在线,命令是否缓存,低功耗时为true
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_1603_Down.java
@@ -32,7 +32,7 @@
        midRs.downCodeName = CodeV1.getCodeName(para.commandCode) ;//下行命令功能码名称;
        midRs.downBuffer = bs ;//下行命令数据
        midRs.downBufHex = ByteUtil.bytes2Hex(bs, true) ;//下行命令数据十六进制形式
        midRs.hasResponse = true ;//是否有应答
        midRs.hasResponse = false ;//是否有应答
        midRs.maxSendTimes = null ;//命令最大发送次数(当收不到应答时,将重发),如果不设置,命令缓存器进行补充设置
        midRs.isCachForOffLine = false ;//RTU不在线,命令是否缓存,低功耗时为true
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_81_Up.java
@@ -84,7 +84,7 @@
            }
        }
        return new MidResult[]{midRs, confirmCommand} ;
        return new MidResult[]{confirmCommand, midRs} ;
    }
    /**
     * æ‰§è¡Œåˆ†æž
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_83_Up.java
@@ -86,7 +86,7 @@
        }
        callback.callback(midRs.reportOrResponse_trueOrFalse);
        return new MidResult[]{midRs, confirmCommand} ;
        return new MidResult[]{confirmCommand, midRs} ;
    }
    /**
     * æ‰§è¡Œåˆ†æž
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_84_Up.java
@@ -91,7 +91,7 @@
            */
        }
        return new MidResult[]{midRs, confirmCommand} ;
        return new MidResult[]{confirmCommand, midRs} ;
    }
    /**
     * æ‰§è¡Œåˆ†æž
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_9601_Up.java
@@ -43,7 +43,7 @@
        midRs.upBuffer = para.upBuffer ;//上行数据字节数组
        midRs.data = para.data ;//解析后的数据
        midRs.reportOrResponse_trueOrFalse = false ;//主动上报
        midRs.reportOrResponse_trueOrFalse = true ;//升级的,不认为是命令应答
        callback.callback(midRs.reportOrResponse_trueOrFalse);
        if(para.data != null && para.data.getSubData() != null){
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_9602_Up.java
@@ -43,7 +43,7 @@
        midRs.upBuffer = para.upBuffer ;//上行数据字节数组
        midRs.data = para.data ;//解析后的数据
        midRs.reportOrResponse_trueOrFalse = false ;//主动上报
        midRs.reportOrResponse_trueOrFalse = true ;//升级的,不认为是命令应答
        callback.callback(midRs.reportOrResponse_trueOrFalse);
        if(para.data != null && para.data.getSubData() != null){
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_9603_Up.java
@@ -43,7 +43,7 @@
        midRs.upBuffer = para.upBuffer ;//上行数据字节数组
        midRs.data = para.data ;//解析后的数据
        midRs.reportOrResponse_trueOrFalse = false ;//主动上报
        midRs.reportOrResponse_trueOrFalse = true ;//升级的,不认为是命令应答
        callback.callback(midRs.reportOrResponse_trueOrFalse);
        if(para.data != null && para.data.getSubData() != null){
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_C0_Up.java
@@ -84,7 +84,7 @@
            }
        }
        return new MidResult[]{midRs, confirmCommand} ;
        return new MidResult[]{confirmCommand, midRs} ;
    }
    /**
     * æ‰§è¡Œåˆ†æž
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/global/GlCreate.java
@@ -92,9 +92,9 @@
    }
    public static byte[] createCrcTail4Ug(byte[] bsNoTail) throws Exception {
        int crc = new CRC16().CRC(bsNoTail, 0, bsNoTail.length -1) ;
        short crc = new CRC16().CRC(bsNoTail, 0, bsNoTail.length -1) ;
        byte[] bytes = new byte[ProtocolConstantV206V1.UG_lenTail] ;
        ByteUtilUnsigned.short2Bytes_BE(bytes, crc, 0);
        ByteUtil.short2Bytes_BE(bytes, crc, 0);
        bytes[2] = ProtocolConstantV206V1.P_Tail_Byte ;
        return bytes ;
    }
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/parse/Cd_02_Up.java
@@ -85,7 +85,7 @@
            }
        }
        return new MidResult[]{midRs, confirmCommand} ;
        return new MidResult[]{confirmCommand, midRs} ;
    }
    /**
     * æ‰§è¡Œåˆ†æž
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/parse/Cd_81_Up.java
@@ -83,7 +83,7 @@
                callback.notify(new ValveStateInfo(cdData.stateVo.valveState.byteValue()== 1?false:true));
            }
        }
        return new MidResult[]{midRs, confirmCommand} ;
        return new MidResult[]{confirmCommand, midRs} ;
    }
    /**
     * æ‰§è¡Œåˆ†æž
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/parse/Cd_83_Up.java
@@ -86,7 +86,7 @@
                callback.notify(new ValveStateInfo(false));
            }
        }
        return new MidResult[]{midRs, confirmCommand} ;
        return new MidResult[]{confirmCommand, midRs} ;
    }
    /**
     * æ‰§è¡Œåˆ†æž
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/parse/Cd_84_Up.java
@@ -92,7 +92,7 @@
            */
        }
        return new MidResult[]{midRs, confirmCommand} ;
        return new MidResult[]{confirmCommand, midRs} ;
    }
    /**
     * æ‰§è¡Œåˆ†æž
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/parse/Cd_C0_Up.java
@@ -84,7 +84,7 @@
            }
        }
        return new MidResult[]{midRs, confirmCommand} ;
        return new MidResult[]{confirmCommand, midRs} ;
    }
    /**
     * æ‰§è¡Œåˆ†æž
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/Cd_02_Up.java
@@ -75,7 +75,7 @@
            confirmCommand.isQuickSend = true ;
        }
        callback.callback(midRs.reportOrResponse_trueOrFalse);
        return new MidResult[]{midRs, confirmCommand} ;
        return new MidResult[]{confirmCommand, midRs} ;
    }
    /**
     * æ‰§è¡Œåˆ†æž
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/Cd_80_Up.java
@@ -82,7 +82,7 @@
            callback.notify(new ValveStateInfo(true)) ;
        }
        return new MidResult[]{midRs, confirmCommand} ;
        return new MidResult[]{confirmCommand, midRs} ;
    }
    /**
     * æ‰§è¡Œåˆ†æž
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/Cd_81_Up.java
@@ -84,7 +84,7 @@
                callback.notify(new ValveStateInfo(cdData.statePump.byteValue()== 1?true:false));
            }
        }
        return new MidResult[]{midRs, confirmCommand} ;
        return new MidResult[]{confirmCommand, midRs} ;
    }
    /**
     * æ‰§è¡Œåˆ†æž
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/Cd_83_Up.java
@@ -79,7 +79,7 @@
        }
        callback.callback(midRs.reportOrResponse_trueOrFalse);
        return new MidResult[]{midRs, confirmCommand} ;
        return new MidResult[]{confirmCommand, midRs} ;
    }
    /**
     * æ‰§è¡Œåˆ†æž
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/Cd_84_Up.java
@@ -80,7 +80,7 @@
            callback.notify(new ValveStateInfo(true));
        }
        return new MidResult[]{midRs, confirmCommand} ;
        return new MidResult[]{confirmCommand, midRs} ;
    }
    /**
     * æ‰§è¡Œåˆ†æž
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/Cd_85_Up.java
@@ -81,7 +81,7 @@
            callback.notify(new ValveStateInfo(false));
        }
        return new MidResult[]{midRs, confirmCommand} ;
        return new MidResult[]{confirmCommand, midRs} ;
    }
    /**
     * æ‰§è¡Œåˆ†æž
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/Cd_8A_Up.java
@@ -75,7 +75,7 @@
            confirmCommand.isQuickSend = true ;
        }
        callback.callback(midRs.reportOrResponse_trueOrFalse);
        return new MidResult[]{midRs, confirmCommand} ;
        return new MidResult[]{confirmCommand, midRs} ;
    }
    /**
     * æ‰§è¡Œåˆ†æž
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/Cd_C2_Up.java
@@ -90,7 +90,7 @@
            }
        }
        return new MidResult[]{midRs, confirmCommand} ;
        return new MidResult[]{confirmCommand, midRs} ;
    }
    /**
     * æ‰§è¡Œåˆ†æž
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/softUpgrade/state/UpgradeInfo.java
@@ -3,6 +3,7 @@
import lombok.Data;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
/**
 * @Author: liurunyu
@@ -17,13 +18,29 @@
    public UpgradeState ugOverallState;
    //升级任务RTU状态列表
    public List<UpgradeRtu> ugRtuStateList;
    public String toString(){
        return this.toString(null) ;
    }
    public String toString(String logRtuAddr){
        StringBuilder sb = new StringBuilder() ;
        sb.append("RTU远程升级状态:") ;
        sb.append("  \n任务id:" + ugTaskId) ;
        sb.append("  \n" + ugOverallState.toString()) ;
        //sb.append("  \n升级的控制器总数:" + ugRtuStateList.size()) ;
        if(ugRtuStateList != null && ugRtuStateList.size() > 0){
            sb.append("  \n升级的控制器总数:" + ugRtuStateList.size()) ;
            sb.append("  \n其中一个控制器升级情况:") ;
            AtomicBoolean exist = new AtomicBoolean(false);
            if(logRtuAddr != null){
                ugRtuStateList.stream().filter(ur -> ur.getRtuAddr().equals(logRtuAddr)).forEach(ur -> {
                    sb.append("  \n" + ur.toString()) ;
                    exist.set(true);
                }) ;
            }
            if(!exist.get()){
                sb.append("  \n" + ugRtuStateList.get(0).toString()) ;
            }
        }
        return sb.toString() ;
    }
}
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java
@@ -703,8 +703,7 @@
            // s1不变
            s0 <<= 8;
            s = s0 | s1;
            return (short) s;
            return (short)s ;
        } else {
            throw new Exception("byte2Short时数组越界");
        }
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/CRC16.java
@@ -34,7 +34,7 @@
     * @return CRC
     */
    @SuppressWarnings("unused")
    public int CRC(byte[] b, int startIndex, int endIndex) {
    public short CRC(byte[] b, int startIndex, int endIndex) {
        int crc = 0xFFFF;
        for (int j = startIndex ; j <= endIndex; j++) {
            crc = crc ^ ((b[j] + 256) % 256) ;//转换成无符号数,因为终端实现(C语言或汇编语言)都用的是无符号数
@@ -46,7 +46,7 @@
                }
            }
        }
        return crc;
        return (short)crc;
    }
    
    
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/rtuMw/ToRtuMwCom.java
@@ -5,6 +5,7 @@
import com.dy.common.mw.protocol.CommandType;
import com.dy.common.softUpgrade.state.UpgradeTaskVo;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@@ -90,8 +91,13 @@
            response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, BaseResponse.class);
        } catch (Exception e) {
            e.printStackTrace();
            return BaseResponseUtils.buildError("后端系统出错,中间件调用异常");
        }
        return response.getBody();
        if(response == null){
            return BaseResponseUtils.buildError("后端系统出错,中间件调用异常");
        }else{
            return response.getBody();
        }
    }
@@ -114,7 +120,12 @@
            response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, BaseResponse.class);
        } catch (Exception e) {
            e.printStackTrace();
            return BaseResponseUtils.buildError("后端系统出错,中间件调用异常");
        }
        return response.getBody();
        if(response == null){
            return BaseResponseUtils.buildError("后端系统出错,中间件调用异常");
        }else{
            return response.getBody();
        }
    }
}
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java
@@ -336,12 +336,14 @@
            //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 = 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 = ugVo.rtuOffLineWaitDuration + 1000;//变成毫秒
            ugVo.rtuOffLineWaitDuration = ugVo.rtuOffLineWaitDuration * 1000;//变成毫秒
            ugVo.notifyStateInterval = conf.getSetAttrPlusInt(doc, "config.upgrade", "notifyStateInterval", null, 1, 300, null);
            ugVo.notifyStateInterval = ugVo.notifyStateInterval + 1000;//变成毫秒
            ugVo.notifyStateInterval = ugVo.notifyStateInterval * 1000;//变成毫秒
            ugVo.showStartInfo = showStartInfo ;
            AdapterImp_UpgradeUnit ugAdap = new AdapterImp_UpgradeUnit();
            ugAdap.setConfig(ugVo);
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeManager.java
@@ -192,15 +192,24 @@
            }else{
                if(!this.task.taskIsOver){
                    //升级任务未完成
                    //工作1:统计当前正在升级的RTU数量,为受限同时升级数量做准备
                    this.task.statisticsRunningRtuCount() ;
                    //工作1:判断是否无任何一个RTU进行过升级,并且达到时限,则认为当前升级任务完成
                    int temp = this.task.countNoOneRtuUpgrade() ;
                    if(temp == -1){
                        this.task.taskIsOver = true ;
                        //任务已经完成
                        this.stop();
                    }else if(temp == 1){
                        //工作2:统计当前正在升级的RTU数量,为同时升级数量限制做准备
                        this.task.statisticsRunningRtuCount() ;
                    //工作2:统计需要升级但当前离线RTU的情况
                    this.task.statisticsOffRtuCountAndSet() ;
                        //工作3:统计需要升级但当前离线RTU的情况
                        this.task.statisticsOffRtuCountAndSet() ;
                    //工作3:统计是否全部升级完成
                    this.task.taskIsOver = this.task.statisticsIsAllOver() ;
                        //工作4:统计是否全部升级完成
                        this.task.taskIsOver = this.task.statisticsIsAllOver() ;
                    }else if(temp == 0){
                        //不作为
                    }
                    if(this.task.taskIsOver){
                        if(!this.task.taskOverType.equals(UpgradeTask.TaskOverType_Force)){
                            //任务不是强制结束的
@@ -208,16 +217,20 @@
                            this.task.taskOverDt = DateTime.yyyy_MM_dd_HH_mm_ss() ;//任务完成时间(yyyy-mm-dd HH:MM:SS)
                        }
                        //任务完成,执行最后一次升级状态通知
                        //工作4:升级状态通知
                        if(!first){
                            this.notifyUpgradeStatus() ;
                        }
                        //工作5:升级状态通知
                        //if(!first){
                        //    this.notifyUpgradeStatus() ;
                        //}
                    }else{
                        //任务未完成,继续执行升级状态通知
                        //工作4: å‡çº§çŠ¶æ€é€šçŸ¥
                        if(!first){
                            this.notifyUpgradeStatus() ;
                        }
                        //工作5: å‡çº§çŠ¶æ€é€šçŸ¥
                        //if(!first){
                        //    this.notifyUpgradeStatus() ;
                        //}
                    }
                    //工作5:升级状态通知
                    if(!first){
                        this.notifyUpgradeStatus() ;
                    }
                }else{
                    //任务已经完成
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeRtuDev.java
@@ -5,6 +5,7 @@
import com.dy.common.mw.protocol.CommandType;
import com.dy.common.softUpgrade.Com1601Vo;
import com.dy.common.softUpgrade.state.UpgradeRtu;
import com.dy.common.softUpgrade.state.UpgradeTaskVo;
import com.dy.common.util.Callback;
import com.dy.common.util.DateTime;
import lombok.Data;
@@ -20,14 +21,19 @@
public class UpgradeRtuDev extends UpgradeRtu {
    @JSONField(serialize = false)
    private UpgradeTask task ;
    private Integer failTryTimes ;//升级失败后,重新偿试升级次数,0表示不重新偿试升级
    @JSONField(serialize = false)
    public UpgradeTaskVo taskVo ;//升级任务值对象
    private UpgradeRtuDev(){
    }
    public UpgradeRtuDev(UpgradeTask task, String rtuAddr, int totalPackage) {
    public UpgradeRtuDev(UpgradeTaskVo taskVo, Integer failTryTimes , String rtuAddr, int totalPackage) {
        super();
        this.task = task ;
        //this.task = task ;
        this.taskVo = taskVo ;
        this.failTryTimes = failTryTimes ;
        this.rtuAddr = rtuAddr ;
        this.state = STATE_UNSTART ;
        this.totalPackage = totalPackage ;
@@ -38,9 +44,11 @@
        this.isOver = false ;
    }
    public UpgradeRtuDev(UpgradeTask task, String rtuAddr, int totalPackage, int state) {
    public UpgradeRtuDev(UpgradeTaskVo taskVo, Integer failTryTimes, String rtuAddr, int totalPackage, int state) {
        super();
        this.task = task ;
        //this.task = task ;
        this.taskVo = taskVo ;
        this.failTryTimes = failTryTimes ;
        this.rtuAddr = rtuAddr ;
        this.state = state ;
        this.totalPackage = totalPackage ;
@@ -65,11 +73,11 @@
            callbackCom.call(createCommand1601(protocolName, protocolVersion));
        }else if(this.state == STATE_RUNNING){
            //当前升级过程中
            if(code.equals(UpgradeCode.cd_1601)){
            if(code.equals(UpgradeCode.cd_9601)){
                //下发配置返回
                this.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ;
                callbackCom.call(createCommand1602(protocolName, protocolVersion, currentPackage, currentRamAddr, softData));//下发数据包指令
            }else if(code.equals(UpgradeCode.cd_1602)){
            }else if(code.equals(UpgradeCode.cd_9602)){
                //下发数据包返回
                currentPackage++ ;
                currentRamAddr += RAMADDRADD ;
@@ -80,7 +88,7 @@
                    this.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ;
                    callbackCom.call(createCommand1603(protocolName, protocolVersion));//下发校验指令
                }
            }else if(code.equals(UpgradeCode.cd_1603)){
            }else if(code.equals(UpgradeCode.cd_9603)){
                //下发校验返回
                this.isOver = true ;//升级完成
                this.state = STATE_SUCCESS ;
@@ -91,7 +99,7 @@
                    //升级未完成
                    if(this.state == STATE_FAILONE || this.state == STATE_FAIL){
                        //已经是升级失败态
                        if(this.reTryTimes < task.failTryTimes){
                        if(this.reTryTimes < this.failTryTimes){
                            //重试次数未达到上限,继续重试
                            this.reTryTimes += 1 ;
                            this.setStateAtCom1601Time();
@@ -141,10 +149,10 @@
        com.rtuResultSendWebUrl = Command.ignoreRtuResultSendWebUrl ;
        Com1601Vo vo = new Com1601Vo() ;
        vo.softStoreAddr = this.task.taskVo.softStoreAddr ;
        vo.softStartAddr = this.task.taskVo.softStartAddr ;
        vo.totalByte =  this.task.taskVo.softBytesCalculate ;
        vo.softCrc = this.task.taskVo.softByteSrc16;
        vo.softStoreAddr = this.taskVo.softStoreAddr ;
        vo.softStartAddr = this.taskVo.softStartAddr ;
        vo.totalByte =  this.taskVo.softBytesCalculate ;
        vo.softCrc = this.taskVo.softByteSrc16;
        com.param = vo ;
        return com ;
    }
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeTask.java
@@ -8,8 +8,11 @@
import com.dy.common.util.Callback;
import com.dy.common.util.DateTime;
import lombok.Data;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/**
 * @Author: liurunyu
@@ -18,6 +21,8 @@
 */
@Data
public class UpgradeTask {
    private static final Logger log = LogManager.getLogger(UpgradeTask.class.getName());
    protected static final String TaskOverType_Natural = "自然" ;
    protected static final String TaskOverType_Force = "强制" ;
@@ -37,7 +42,7 @@
    protected byte[][] softFileDataGrp ;//以512字节为单位把升级程序数据分组
    @JSONField(serialize = false)
    protected Map<String, UpgradeRtu> upgradeRtus;//升级状态
    protected ConcurrentHashMap<String, UpgradeRtu> upgradeRtus;//升级状态
    public boolean taskIsOver = false ;//任务是否完成
    public String taskOverType = "" ;//任务完成方式(自然,强制)
@@ -95,15 +100,19 @@
        this.setupDtLong = System.currentTimeMillis() ;
        this.taskVo = taskVo ;
        this.upgradeRtus = new HashMap<>();
        if(taskVo.softFileData64 != null && taskVo.softFileData64.trim().equals("")){
        this.upgradeRtus = new ConcurrentHashMap<>();
        if(taskVo.softFileData64 != null && !taskVo.softFileData64.trim().equals("")){
            taskVo.softFileData = Base64.getDecoder().decode(taskVo.softFileData64);
            List<byte[]> listBytes = new HexFileParse().splitBytesByUnit512(taskVo.softFileData);
            this.softFileDataGrp = listBytes.toArray(new byte[0][]);
            for(String rtuAddr : this.taskVo.rtuAddrList){
                //此时状态设置成离线状态
                UpgradeRtuDev ugRtu = new UpgradeRtuDev(this, rtuAddr, this.softFileDataGrp.length, UpgradeRtuDev.STATE_OFFLINE) ;
                this.upgradeRtus.put(rtuAddr, ugRtu) ;
            try{
                for(String rtuAddr : this.taskVo.rtuAddrList){
                    //此时状态设置成离线状态
                    UpgradeRtuDev ugRtu = new UpgradeRtuDev(this.taskVo, this.failTryTimes, rtuAddr, this.softFileDataGrp.length, UpgradeRtuDev.STATE_OFFLINE) ;
                    this.upgradeRtus.put(rtuAddr, ugRtu) ;
                }
            }catch (Exception e){
                log.error(e);
            }
        }
    }
@@ -121,7 +130,7 @@
                //根据方法setTask的逻辑,只要RTU在升级之列,此处ugRtuState一定不为null
                //为保险,实现下面逻辑
                if(taskVo.rtuAddrList.contains(rtuAddr)){
                    ugRtu = new UpgradeRtuDev(this, rtuAddr, this.taskVo.softFileData.length) ;
                    ugRtu = new UpgradeRtuDev(this.taskVo, this.failTryTimes, rtuAddr, this.taskVo.softFileData.length) ;
                    upgradeRtus.put(rtuAddr, ugRtu) ;
                }else{
                    //rtu不在升级之列
@@ -257,8 +266,36 @@
    ///////////////////////////////////////////////////////////
    //以下方法为内部服务,不对外提供服务
    ///////////////////////////////////////////////////////////
    /**
     * ç»Ÿè®¡å½“前正在升级的RTU数量,为受限同时升级数量做准备
     * åˆ¤æ–­æ˜¯å¦æ²¡ç”¨ä»»ä½•一个RTU进行过升级,而且超过了时限
     * @return -1:无一RTU升级且超时,0:无RTU升级但未超时等待,1有RTU升级正常执行
     */
    protected int countNoOneRtuUpgrade(){
        if(this.upgradeRtus == null || upgradeRtus.size() == 0){
            //当前没有任何一个设备进行过升级
            Long now = System.currentTimeMillis() ;
            if(now - this.setupDtLong > UpgradeUnit.confVo.noOneRtuUpgradeMaxDuration){
                return -1 ;
            }
        }else{
            Collection<UpgradeRtu> col = this.upgradeRtus.values() ;
            for(UpgradeRtu info : col){
                if(info.currentPackage > 0){
                    //当前有设备进行过升级
                    return 1 ;
                }
            }
            Long now = System.currentTimeMillis() ;
            if(now - this.setupDtLong > UpgradeUnit.confVo.noOneRtuUpgradeMaxDuration){
                return -1 ;
            }
        }
        return 0 ;
    }
    /**
     * ç»Ÿè®¡å½“前正在升级的RTU数量,为同时升级数量限制做准备
     */
    protected void statisticsRunningRtuCount(){
        int runningTotal = 0 ;
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeUnitConfigVo.java
@@ -9,6 +9,7 @@
    public Boolean showStartInfo ;
    public Boolean enable ;//模块是否启动
    public Integer noOneRtuUpgradeMaxDuration ;//升级任务设置后,没有设备升级最大时长(毫秒),超过这个时长,认为升级任务完成,取值范围是5分钟~60分钟
    public Integer failTryTimes ;//升级失败后(针对的是在线进行了升级下发命令),重新偿试升级次数,0表示不重新偿试升级
    public Integer ugMaxRtuAtOnce;//为了缓解通信中间件的压力,同时支持升级的RTU台数
    public Integer rtuOffLineWaitDuration;//rtu离线,等待其升级的时长(毫秒),超过这个时间,设置其升级失败,且设置升级任务完成
@@ -16,6 +17,7 @@
    public UpgradeUnitConfigVo(){
        this.enable = false ;
        this.noOneRtuUpgradeMaxDuration = 10 * 60 * 1000 ;
        this.failTryTimes = 0 ;
        this.ugMaxRtuAtOnce = Integer.MAX_VALUE ;
        this.rtuOffLineWaitDuration = 10 * 60 * 60 * 1000 ;
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/web/comResult/CommandResultDeal.java
@@ -1,7 +1,9 @@
package com.dy.rtuMw.web.comResult;
import com.dy.common.contant.Constant;
import com.dy.common.mw.protocol.Command;
import com.dy.common.mw.protocol.Data;
import com.dy.rtuMw.server.ServerProperties;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@@ -17,7 +19,7 @@
 * @Author liurunyu
 * @Date 2023/12/21 20:28
 * @LastEditTime 2023/12/21 20:28
 * @Description
 * @Description é€šä¿¡ä¸­é—´ä»¶å¯¹å¤–进行web调用,把命令结果发送出去
 */
@Component()
public class CommandResultDeal {
@@ -41,6 +43,7 @@
            restTemplate.getMessageConverters().set(1,new StringHttpMessageConverter(StandardCharsets.UTF_8));
            HttpHeaders headers = new HttpHeaders();
            headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
            headers.set(Constant.UserTokenKeyInHeader, ServerProperties.orgTag);
            HttpEntity<?> httpEntity = new HttpEntity<>(data, headers);
            ResponseEntity<WebResponseVo> response = null;
            try {
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/web/webRequest/WebRequestDeal.java
@@ -1,7 +1,9 @@
package com.dy.rtuMw.web.webRequest;
import com.dy.common.contant.Constant;
import com.dy.common.mw.protocol.Command;
import com.dy.common.webUtil.BaseResponse;
import com.dy.rtuMw.server.ServerProperties;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@@ -45,6 +47,7 @@
            restTemplate.getMessageConverters().set(1,new StringHttpMessageConverter(StandardCharsets.UTF_8));
            HttpHeaders headers = new HttpHeaders();
            headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
            headers.set(Constant.UserTokenKeyInHeader, ServerProperties.orgTag);
            HttpEntity<?> httpEntity = new HttpEntity<>(obj, headers);
            ResponseEntity<BaseResponse> response = null;
            try {
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(spɳÅÌ).xml
@@ -24,22 +24,22 @@
    sendDingDingAlarmMsInterval: æœ‰æŠ¥è­¦å‘生时,向钉钉发送消息的间隔时长(分钟)
     -->
    <base
        orgTag="sp"
        isLowPower="false"
        onlyDealRtus=""
        onlyOneProtocol="false"
        downComandMaxResendTimes="1"
        commandSendInterval="10"
        cachWaitResultTimeout="120"
        offLineCachTimeout="86400"
        lastUpDataTimeLive="500"
        dbDataIdSuffix="0"
        cacheUpDownDataWarnCount="100000"
        cacheUpDownDataMaxCount="110000"
        disconnectedByNoUpDataMinutes="3"
        workReportDealOneByTimes="5"
        intakeAlarmLossMinValue="1.0"
        sendDingDingAlarmMsInterval="60"
            orgTag="sp"
            isLowPower="false"
            onlyDealRtus=""
            onlyOneProtocol="false"
            downComandMaxResendTimes="1"
            commandSendInterval="3"
            cachWaitResultTimeout="120"
            offLineCachTimeout="86400"
            lastUpDataTimeLive="500"
            dbDataIdSuffix="0"
            cacheUpDownDataWarnCount="100000"
            cacheUpDownDataMaxCount="110000"
            disconnectedByNoUpDataMinutes="3"
            workReportDealOneByTimes="5"
            intakeAlarmLossMinValue="1.0"
            sendDingDingAlarmMsInterval="60"
    />
    <!--
@@ -49,19 +49,21 @@
    synchroRtuClockTimepieces:当RTU与服务器时钟相差一定毫秒(配置文件是秒钟)后,进行校时
     -->
    <protocol
        centerAddr="1"
        synchroRtuClock="true"
        synchroRtuClockTimepieces="300000"
            centerAddr="1"
            synchroRtuClock="true"
            synchroRtuClockTimepieces="300000"
    />
    <!-- RTU è½¯ä»¶å‡çº§
    enable: æ¨¡å—是否启动
    noOneRtuUpgradeMaxDuration:升级任务设置后,无一设备升级最大时长(秒),超过这个时长,认为升级任务完成,取值范围是5分钟~60分钟
    failTryTimes:升级失败后(针对的是在线进行了升级下发命令),重新偿试升级次数,当设置为0时表示不重新偿试升级
    ugMaxRtuAtOnce:为了缓解通信中间件的压力,同时支持升级的RTU台数,当设置为0时表示不受限制
    rtuOffLineWaitDuration: rtu离线,等待其升级的时长(秒),超过这个时间,设置其升级失败,且设置升级任务完成
    notifyStateInterval: å‡çº§çŠ¶æ€é€šçŸ¥é—´éš”ï¼ˆç§’ï¼‰
    -->
    <upgrade enable="true"
             noOneRtuUpgradeMaxDuration="600"
             failTryTimes="1"
             ugMaxRtuAtOnce="1000"
             rtuOffLineWaitDuration="1200"
@@ -83,15 +85,15 @@
    enableThreadPool:是否启用线程池
     -->
    <support
        short_maxThread="6"
        short_minThread="6"
        short_freeTimeout="60"
        short_busyTimeout="5"
        long_maxThread="6"
        long_minThread="6"
        long_freeTimeout="60"
        long_busyTimeout="-1"
        enableThreadPool="true"
            short_maxThread="6"
            short_minThread="6"
            short_freeTimeout="60"
            short_busyTimeout="5"
            long_maxThread="6"
            long_minThread="6"
            long_freeTimeout="60"
            long_busyTimeout="-1"
            enableThreadPool="true"
    />
    <!--
@@ -103,11 +105,11 @@
    saveDbInterval:Rtu状态存数据库间隔(分钟)
     -->
    <resource
        rtuLogDir="rtuLogs/"
        rtuLogFileMaxSize="100000"
        rtuLogFileMaxCount="2"
        monitorInterval="2"
        saveDbInterval="10"
            rtuLogDir="rtuLogs/"
            rtuLogFileMaxSize="100000"
            rtuLogFileMaxCount="2"
            monitorInterval="2"
            saveDbInterval="10"
    />
@@ -128,10 +130,10 @@
    queueMaxSize: ç¼“存队列节点数最大数量
     -->
    <core
        sleepBigBusy="100"
        sleepSmallBusy="500"
        queueWarnSize="100000"
        queueMaxSize="300000"
            sleepBigBusy="100"
            sleepSmallBusy="500"
            queueWarnSize="100000"
            queueMaxSize="300000"
    />
    <!--
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(test²âÊÔ).xml
@@ -24,22 +24,22 @@
    sendDingDingAlarmMsInterval: æœ‰æŠ¥è­¦å‘生时,向钉钉发送消息的间隔时长(分钟)
     -->
    <base
        orgTag="test"
        isLowPower="false"
        onlyDealRtus=""
        onlyOneProtocol="false"
        downComandMaxResendTimes="1"
        commandSendInterval="10"
        cachWaitResultTimeout="120"
        offLineCachTimeout="86400"
        lastUpDataTimeLive="500"
        dbDataIdSuffix="0"
        cacheUpDownDataWarnCount="100000"
        cacheUpDownDataMaxCount="110000"
        disconnectedByNoUpDataMinutes="3"
        workReportDealOneByTimes="5"
        intakeAlarmLossMinValue="1.0"
        sendDingDingAlarmMsInterval="60"
            orgTag="test"
            isLowPower="false"
            onlyDealRtus=""
            onlyOneProtocol="false"
            downComandMaxResendTimes="1"
            commandSendInterval="3"
            cachWaitResultTimeout="120"
            offLineCachTimeout="86400"
            lastUpDataTimeLive="500"
            dbDataIdSuffix="0"
            cacheUpDownDataWarnCount="100000"
            cacheUpDownDataMaxCount="110000"
            disconnectedByNoUpDataMinutes="3"
            workReportDealOneByTimes="5"
            intakeAlarmLossMinValue="1.0"
            sendDingDingAlarmMsInterval="60"
    />
    <!--
@@ -49,19 +49,21 @@
    synchroRtuClockTimepieces:当RTU与服务器时钟相差一定毫秒(配置文件是秒钟)后,进行校时
     -->
    <protocol
        centerAddr="1"
        synchroRtuClock="true"
        synchroRtuClockTimepieces="300000"
            centerAddr="1"
            synchroRtuClock="true"
            synchroRtuClockTimepieces="300000"
    />
    <!-- RTU è½¯ä»¶å‡çº§
    enable: æ¨¡å—是否启动
    noOneRtuUpgradeMaxDuration:升级任务设置后,无一设备升级最大时长(秒),超过这个时长,认为升级任务完成,取值范围是5分钟~60分钟
    failTryTimes:升级失败后(针对的是在线进行了升级下发命令),重新偿试升级次数,当设置为0时表示不重新偿试升级
    ugMaxRtuAtOnce:为了缓解通信中间件的压力,同时支持升级的RTU台数,当设置为0时表示不受限制
    rtuOffLineWaitDuration: rtu离线,等待其升级的时长(秒),超过这个时间,设置其升级失败,且设置升级任务完成
    notifyStateInterval: å‡çº§çŠ¶æ€é€šçŸ¥é—´éš”ï¼ˆç§’ï¼‰
    -->
    <upgrade enable="true"
             noOneRtuUpgradeMaxDuration="600"
             failTryTimes="1"
             ugMaxRtuAtOnce="1000"
             rtuOffLineWaitDuration="1200"
@@ -83,15 +85,15 @@
    enableThreadPool:是否启用线程池
     -->
    <support
        short_maxThread="6"
        short_minThread="6"
        short_freeTimeout="60"
        short_busyTimeout="5"
        long_maxThread="6"
        long_minThread="6"
        long_freeTimeout="60"
        long_busyTimeout="-1"
        enableThreadPool="true"
            short_maxThread="6"
            short_minThread="6"
            short_freeTimeout="60"
            short_busyTimeout="5"
            long_maxThread="6"
            long_minThread="6"
            long_freeTimeout="60"
            long_busyTimeout="-1"
            enableThreadPool="true"
    />
    <!--
@@ -103,11 +105,11 @@
    saveDbInterval:Rtu状态存数据库间隔(分钟)
     -->
    <resource
        rtuLogDir="rtuLogs/"
        rtuLogFileMaxSize="100000"
        rtuLogFileMaxCount="2"
        monitorInterval="2"
        saveDbInterval="10"
            rtuLogDir="rtuLogs/"
            rtuLogFileMaxSize="100000"
            rtuLogFileMaxCount="2"
            monitorInterval="2"
            saveDbInterval="10"
    />
@@ -128,10 +130,10 @@
    queueMaxSize: ç¼“存队列节点数最大数量
     -->
    <core
        sleepBigBusy="100"
        sleepSmallBusy="500"
        queueWarnSize="100000"
        queueMaxSize="300000"
            sleepBigBusy="100"
            sleepSmallBusy="500"
            queueWarnSize="100000"
            queueMaxSize="300000"
    />
    <!--
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(ymԪı).xml
@@ -24,22 +24,22 @@
    sendDingDingAlarmMsInterval: æœ‰æŠ¥è­¦å‘生时,向钉钉发送消息的间隔时长(分钟)
     -->
    <base
        orgTag="ym"
        isLowPower="false"
        onlyDealRtus=""
        onlyOneProtocol="false"
        downComandMaxResendTimes="1"
        commandSendInterval="10"
        cachWaitResultTimeout="120"
        offLineCachTimeout="86400"
        lastUpDataTimeLive="500"
        dbDataIdSuffix="0"
        cacheUpDownDataWarnCount="100000"
        cacheUpDownDataMaxCount="110000"
        disconnectedByNoUpDataMinutes="3"
        workReportDealOneByTimes="5"
        intakeAlarmLossMinValue="1.0"
        sendDingDingAlarmMsInterval="60"
            orgTag="ym"
            isLowPower="false"
            onlyDealRtus=""
            onlyOneProtocol="false"
            downComandMaxResendTimes="1"
            commandSendInterval="3"
            cachWaitResultTimeout="120"
            offLineCachTimeout="86400"
            lastUpDataTimeLive="500"
            dbDataIdSuffix="0"
            cacheUpDownDataWarnCount="100000"
            cacheUpDownDataMaxCount="110000"
            disconnectedByNoUpDataMinutes="3"
            workReportDealOneByTimes="5"
            intakeAlarmLossMinValue="1.0"
            sendDingDingAlarmMsInterval="60"
    />
    <!--
@@ -49,19 +49,21 @@
    synchroRtuClockTimepieces:当RTU与服务器时钟相差一定毫秒(配置文件是秒钟)后,进行校时
     -->
    <protocol
        centerAddr="1"
        synchroRtuClock="true"
        synchroRtuClockTimepieces="300000"
            centerAddr="1"
            synchroRtuClock="true"
            synchroRtuClockTimepieces="300000"
    />
    <!-- RTU è½¯ä»¶å‡çº§
    enable: æ¨¡å—是否启动
    noOneRtuUpgradeMaxDuration:升级任务设置后,无一设备升级最大时长(秒),超过这个时长,认为升级任务完成,取值范围是5分钟~60分钟
    failTryTimes:升级失败后(针对的是在线进行了升级下发命令),重新偿试升级次数,当设置为0时表示不重新偿试升级
    ugMaxRtuAtOnce:为了缓解通信中间件的压力,同时支持升级的RTU台数,当设置为0时表示不受限制
    rtuOffLineWaitDuration: rtu离线,等待其升级的时长(秒),超过这个时间,设置其升级失败,且设置升级任务完成
    notifyStateInterval: å‡çº§çŠ¶æ€é€šçŸ¥é—´éš”ï¼ˆç§’ï¼‰
    -->
    <upgrade enable="true"
             noOneRtuUpgradeMaxDuration="600"
             failTryTimes="1"
             ugMaxRtuAtOnce="1000"
             rtuOffLineWaitDuration="1200"
@@ -83,15 +85,15 @@
    enableThreadPool:是否启用线程池
     -->
    <support
        short_maxThread="6"
        short_minThread="6"
        short_freeTimeout="60"
        short_busyTimeout="5"
        long_maxThread="6"
        long_minThread="6"
        long_freeTimeout="60"
        long_busyTimeout="-1"
        enableThreadPool="true"
            short_maxThread="6"
            short_minThread="6"
            short_freeTimeout="60"
            short_busyTimeout="5"
            long_maxThread="6"
            long_minThread="6"
            long_freeTimeout="60"
            long_busyTimeout="-1"
            enableThreadPool="true"
    />
    <!--
@@ -103,11 +105,11 @@
    saveDbInterval:Rtu状态存数据库间隔(分钟)
     -->
    <resource
        rtuLogDir="rtuLogs/"
        rtuLogFileMaxSize="100000"
        rtuLogFileMaxCount="2"
        monitorInterval="2"
        saveDbInterval="10"
            rtuLogDir="rtuLogs/"
            rtuLogFileMaxSize="100000"
            rtuLogFileMaxCount="2"
            monitorInterval="2"
            saveDbInterval="10"
    />
@@ -128,10 +130,10 @@
    queueMaxSize: ç¼“存队列节点数最大数量
     -->
    <core
        sleepBigBusy="100"
        sleepSmallBusy="500"
        queueWarnSize="100000"
        queueMaxSize="300000"
            sleepBigBusy="100"
            sleepSmallBusy="500"
            queueWarnSize="100000"
            queueMaxSize="300000"
    />
    <!--
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml
@@ -29,7 +29,7 @@
            onlyDealRtus=""
            onlyOneProtocol="false"
            downComandMaxResendTimes="1"
            commandSendInterval="10"
            commandSendInterval="3"
            cachWaitResultTimeout="120"
            offLineCachTimeout="86400"
            lastUpDataTimeLive="500"
@@ -56,12 +56,14 @@
    <!-- RTU è½¯ä»¶å‡çº§
    enable: æ¨¡å—是否启动
    noOneRtuUpgradeMaxDuration:升级任务设置后,无一设备升级最大时长(秒),超过这个时长,认为升级任务完成,取值范围是5分钟~60分钟
    failTryTimes:升级失败后(针对的是在线进行了升级下发命令),重新偿试升级次数,当设置为0时表示不重新偿试升级
    ugMaxRtuAtOnce:为了缓解通信中间件的压力,同时支持升级的RTU台数,当设置为0时表示不受限制
    rtuOffLineWaitDuration: rtu离线,等待其升级的时长(秒),超过这个时间,设置其升级失败,且设置升级任务完成
    notifyStateInterval: å‡çº§çŠ¶æ€é€šçŸ¥é—´éš”ï¼ˆç§’ï¼‰
    -->
    <upgrade enable="true"
             noOneRtuUpgradeMaxDuration="600"
             failTryTimes="1"
             ugMaxRtuAtOnce="1000"
             rtuOffLineWaitDuration="1200"
pipIrr-platform/pipIrr-mw/pipIrr-mw-simulate-rtu/src/main/java/com/dy/simRtu/tcpClient/downData/DownData.java
@@ -12,7 +12,7 @@
public class DownData {
    public void parseData(byte[] bs){
        if(bs != null && bs.length >= ProtocolConstantV206V1.lenHead2Code){
        if(bs != null && bs.length > 0){
            if(bs.length >= (ProtocolConstantV206V1.ctrlIndex)
                    && bs[0] == ProtocolConstantV206V1.P_Head_Byte
                    && bs[2] == ProtocolConstantV206V1.P_Head_Byte){
@@ -29,12 +29,12 @@
        //应该是链路检测数据
    }
    private void dealUpgrade(byte[] bs){
        String cdPre = ByteUtil.bytes2Hex(bs, false, ProtocolConstantV206V1.codeIndex, 1);
        String cdPre = ByteUtil.bytes2Hex(bs, false, ProtocolConstantV206V1.UG_codeIndex, 1);
        if(cdPre.equals("16")){
            //升级功能码
            UpHeartBeat.upHeartBeat = false ;//不上行心跳
            if(bs.length >= ProtocolConstantV206V1.lenHead2Code + 1){
                String cdSuf = ByteUtil.bytes2Hex(bs, false, ProtocolConstantV206V1.codeIndex + 1, 1);
            if(bs.length >= ProtocolConstantV206V1.UG_lenHead2Cmd + 1){
                String cdSuf = ByteUtil.bytes2Hex(bs, false, ProtocolConstantV206V1.UG_codeIndex + 1, 1);
                String cd = cdPre + cdSuf;
                if(cd.equals("1601")){
                    //升级配置
pipIrr-platform/pipIrr-mw/pipIrr-mw-simulate-rtu/src/main/java/com/dy/simRtu/tcpClient/upData/UpData.java
@@ -52,7 +52,7 @@
    protected static byte[] creatHead4Upgrade(String rtuAddr, String preCode, String sufCode)throws Exception {
        byte[] bsHead = new byte[12] ;
        byte index = 0 ;
        bsHead[index] = ProtocolConstantV206V1.P_Head_Byte ;
        bsHead[index] = ProtocolConstantV206V1.UG_P_Head_Byte ;
        index++ ;
        bsHead[index] = 0 ;//帧长度
@@ -60,7 +60,7 @@
        bsHead[index] = 0 ;//帧长度
        index++ ;
        bsHead[index] = ProtocolConstantV206V1.P_Head_Byte ;
        bsHead[index] = ProtocolConstantV206V1.UG_P_Head_Byte ;
        index++ ;
        bsHead[index] = ByteUtil.hex2Bytes(preCode)[0]; //功能码域
pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/p206V1/ComSupportP206V1.java
@@ -4,6 +4,7 @@
import com.dy.common.mw.protocol.CommandType;
import com.dy.common.mw.protocol.p206V1.ProtocolConstantV206V1;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@@ -82,8 +83,13 @@
            response = restTemplate.exchange(url, HttpMethod.GET, httpEntity, BaseResponse.class);
        } catch (Exception e) {
            e.printStackTrace();
            return BaseResponseUtils.buildError("后端系统出错,中间件调用异常");
        }
        return response.getBody();
        if(response == null){
            return BaseResponseUtils.buildError("后端系统出错,中间件调用异常");
        }else{
            return response.getBody();
        }
    }
    /**
@@ -102,8 +108,13 @@
            response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, BaseResponse.class);
        } catch (Exception e) {
            e.printStackTrace();
            return BaseResponseUtils.buildError("后端系统出错,中间件调用异常");
        }
        return response.getBody();
        if(response == null){
            return BaseResponseUtils.buildError("后端系统出错,中间件调用异常");
        }else{
            return response.getBody();
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/p206V202404test/ComSupportP206V202404.java
@@ -5,6 +5,7 @@
import com.dy.common.mw.protocol.p206V202404.ProtocolConstantV206V202404;
import com.dy.common.mw.protocol.p206V202404.downVos.ComCdXyVo;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@@ -78,8 +79,13 @@
            response = restTemplate.exchange(url, HttpMethod.GET, httpEntity, BaseResponse.class);
        } catch (Exception e) {
            e.printStackTrace();
            return BaseResponseUtils.buildError("后端系统出错,中间件调用异常");
        }
        return response.getBody();
        if(response == null){
            return BaseResponseUtils.buildError("后端系统出错,中间件调用异常");
        }else{
            return response.getBody();
        }
    }
    /**
@@ -98,8 +104,13 @@
            response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, BaseResponse.class);
        } catch (Exception e) {
            e.printStackTrace();
            return BaseResponseUtils.buildError("后端系统出错,中间件调用异常");
        }
        return response.getBody();
        if(response == null){
            return BaseResponseUtils.buildError("后端系统出错,中间件调用异常");
        }else{
            return response.getBody();
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/rtuLog/RtuLogSupport.java
@@ -1,6 +1,7 @@
package com.dy.pipIrrMwTestWeb.rtuLog;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.web.client.RestTemplate;
@@ -61,7 +62,12 @@
            response = restTemplate.exchange(fullUrl, HttpMethod.GET, httpEntity, BaseResponse.class);
        } catch (Exception e) {
            e.printStackTrace();
            return BaseResponseUtils.buildError("后端系统出错,中间件调用异常");
        }
        return response.getBody();
        if(response == null){
            return BaseResponseUtils.buildError("后端系统出错,中间件调用异常");
        }else{
            return response.getBody();
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeStateReceiverCtrl.java
@@ -1,5 +1,7 @@
package com.dy.pipIrrRemote.rtuUpgrage;
import com.dy.common.contant.Constant;
import com.dy.common.multiDataSource.DataSourceContext;
import com.dy.common.softUpgrade.state.UpgradeInfo;
import com.dy.common.softUpgrade.state.UpgradeRtu;
import com.dy.common.softUpgrade.state.UpgradeState;
@@ -12,6 +14,8 @@
import com.dy.pipIrrGlobal.pojoUg.UgRtuTask;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -43,12 +47,16 @@
     */
    @Hidden //不公开接口,其只有通信中间件调用
    @PostMapping(path = "/receive")
    public BaseResponse<Boolean> receive(@RequestBody UpgradeInfo info){
        log.info("接收到的RTU远程升级状态数据为:{}", info.toString());
    public BaseResponse<Boolean> receive(@RequestBody UpgradeInfo info, HttpServletRequest req, HttpServletResponse rep){
        log.info("接收到的RTU远程升级状态数据为:{}", info.toString("532328000214"));
        //进行排序
        //Comparator<UpgradeRtu> comparator = Comparator.comparing(UpgradeRtu::getRtuAddr, Comparator.naturalOrder());
        //info.ugRtuStateList = info.ugRtuStateList.stream().sorted(comparator).collect(Collectors.toList());
        //通信中间件传过来的机构tag,以用于查找数据源
        String token = req.getHeader(Constant.UserTokenKeyInHeader);
        DataSourceContext.set(token);
        if(info.ugRtuStateList != null && info.ugRtuStateList.size() > 0){
            if(info.ugRtuStateList.size() < 10){
                for (UpgradeRtu rtuVo : info.ugRtuStateList) {