Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
| | |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <version>1.18.28</version> |
| | | </dependency> |
| | | <!-- @Aspect @Pointcut @Aroundçåºç¨ --> |
| | | <dependency> |
| | |
| | | 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"); |
| | | } |
| | |
| | | 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"); |
| | | } |
| | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | 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{ |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | confirmCommand.isQuickSend = true ; |
| | | } |
| | | callback.callback(midRs.reportOrResponse_trueOrFalse); |
| | | return new MidResult[]{midRs, confirmCommand} ; |
| | | return new MidResult[]{confirmCommand, midRs} ; |
| | | } |
| | | /** |
| | | * æ§è¡åæ |
| | |
| | | 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 |
| | | |
| | |
| | | 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 ; |
| | |
| | | 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 |
| | | |
| | |
| | | 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 |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | return new MidResult[]{midRs, confirmCommand} ; |
| | | return new MidResult[]{confirmCommand, midRs} ; |
| | | } |
| | | /** |
| | | * æ§è¡åæ |
| | |
| | | } |
| | | |
| | | callback.callback(midRs.reportOrResponse_trueOrFalse); |
| | | return new MidResult[]{midRs, confirmCommand} ; |
| | | return new MidResult[]{confirmCommand, midRs} ; |
| | | } |
| | | /** |
| | | * æ§è¡åæ |
| | |
| | | */ |
| | | } |
| | | |
| | | return new MidResult[]{midRs, confirmCommand} ; |
| | | return new MidResult[]{confirmCommand, midRs} ; |
| | | } |
| | | /** |
| | | * æ§è¡åæ |
| | |
| | | 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){ |
| | |
| | | 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){ |
| | |
| | | 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){ |
| | |
| | | } |
| | | } |
| | | |
| | | return new MidResult[]{midRs, confirmCommand} ; |
| | | return new MidResult[]{confirmCommand, midRs} ; |
| | | } |
| | | /** |
| | | * æ§è¡åæ |
| | |
| | | bsNoTail[ProtocolConstantV206V1.dataLenIndex] = (byte)len ; |
| | | } |
| | | |
| | | public static void createLen4PUg(byte[] bytes) throws Exception { |
| | | int len = bytes.length - 4; |
| | | byte[] bs = ByteUtil.int2BCD_LE(len) ; |
| | | if(bs != null && bs.length == 1){ |
| | | bytes[1] = bs[0] ; |
| | | }else if(bs != null && bs.length > 1){ |
| | | bytes[1] = bs[0] ; |
| | | bytes[2] = bs[1] ; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * çæICå¡ç¼ç |
| | |
| | | } |
| | | |
| | | 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 ; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | return new MidResult[]{midRs, confirmCommand} ; |
| | | return new MidResult[]{confirmCommand, midRs} ; |
| | | } |
| | | /** |
| | | * æ§è¡åæ |
| | |
| | | callback.notify(new ValveStateInfo(cdData.stateVo.valveState.byteValue()== 1?false:true)); |
| | | } |
| | | } |
| | | return new MidResult[]{midRs, confirmCommand} ; |
| | | return new MidResult[]{confirmCommand, midRs} ; |
| | | } |
| | | /** |
| | | * æ§è¡åæ |
| | |
| | | callback.notify(new ValveStateInfo(false)); |
| | | } |
| | | } |
| | | return new MidResult[]{midRs, confirmCommand} ; |
| | | return new MidResult[]{confirmCommand, midRs} ; |
| | | } |
| | | /** |
| | | * æ§è¡åæ |
| | |
| | | */ |
| | | } |
| | | |
| | | return new MidResult[]{midRs, confirmCommand} ; |
| | | return new MidResult[]{confirmCommand, midRs} ; |
| | | } |
| | | /** |
| | | * æ§è¡åæ |
| | |
| | | } |
| | | } |
| | | |
| | | return new MidResult[]{midRs, confirmCommand} ; |
| | | return new MidResult[]{confirmCommand, midRs} ; |
| | | } |
| | | /** |
| | | * æ§è¡åæ |
| | |
| | | confirmCommand.isQuickSend = true ; |
| | | } |
| | | callback.callback(midRs.reportOrResponse_trueOrFalse); |
| | | return new MidResult[]{midRs, confirmCommand} ; |
| | | return new MidResult[]{confirmCommand, midRs} ; |
| | | } |
| | | /** |
| | | * æ§è¡åæ |
| | |
| | | callback.notify(new ValveStateInfo(true)) ; |
| | | } |
| | | |
| | | return new MidResult[]{midRs, confirmCommand} ; |
| | | return new MidResult[]{confirmCommand, midRs} ; |
| | | } |
| | | /** |
| | | * æ§è¡åæ |
| | |
| | | callback.notify(new ValveStateInfo(cdData.statePump.byteValue()== 1?true:false)); |
| | | } |
| | | } |
| | | return new MidResult[]{midRs, confirmCommand} ; |
| | | return new MidResult[]{confirmCommand, midRs} ; |
| | | } |
| | | /** |
| | | * æ§è¡åæ |
| | |
| | | } |
| | | callback.callback(midRs.reportOrResponse_trueOrFalse); |
| | | |
| | | return new MidResult[]{midRs, confirmCommand} ; |
| | | return new MidResult[]{confirmCommand, midRs} ; |
| | | } |
| | | /** |
| | | * æ§è¡åæ |
| | |
| | | callback.notify(new ValveStateInfo(true)); |
| | | } |
| | | |
| | | return new MidResult[]{midRs, confirmCommand} ; |
| | | return new MidResult[]{confirmCommand, midRs} ; |
| | | } |
| | | /** |
| | | * æ§è¡åæ |
| | |
| | | callback.notify(new ValveStateInfo(false)); |
| | | } |
| | | |
| | | return new MidResult[]{midRs, confirmCommand} ; |
| | | return new MidResult[]{confirmCommand, midRs} ; |
| | | } |
| | | /** |
| | | * æ§è¡åæ |
| | |
| | | confirmCommand.isQuickSend = true ; |
| | | } |
| | | callback.callback(midRs.reportOrResponse_trueOrFalse); |
| | | return new MidResult[]{midRs, confirmCommand} ; |
| | | return new MidResult[]{confirmCommand, midRs} ; |
| | | } |
| | | /** |
| | | * æ§è¡åæ |
| | |
| | | } |
| | | } |
| | | |
| | | return new MidResult[]{midRs, confirmCommand} ; |
| | | return new MidResult[]{confirmCommand, midRs} ; |
| | | } |
| | | /** |
| | | * æ§è¡åæ |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | //设å¤ç»ç«¯å·¥ä½ä¸æ¥ + æ¥è¯¢è®¾å¤ç»ç«¯å®æ¶å¼ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class DataCd80_5BVo extends AlarmVo { |
| | | |
| | | public String controllerType;//æ§å¶å¨ç±»å: 01:æµæ§ä¸ä½éï¼57:äºçµæ§å¶å¨ |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | //设å¤ç»ç«¯éæºèªæ¥ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class DataCd81Vo extends AlarmVo { |
| | | |
| | | public String controllerType;//æ§å¶å¨ç±»å: 01:æµæ§ä¸ä½éï¼57:äºçµæ§å¶å¨ |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | //å·å¡å¼æ³µ/é䏿¥ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class DataCd84Vo extends AlarmVo { |
| | | |
| | | public String controllerType;//æ§å¶å¨ç±»å 01ï¼0x01ï¼:æµæ§ä¸ä½éï¼57(0x57):äºçµæ§å¶å¨ |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | //å¹³å°/APPè¿ç¨å
³éæ°´æ³µ/éé¨ + å·å¡å
³æ³µ/é䏿¥ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class DataCd85Vo extends AlarmVo { |
| | | |
| | | public String controllerType;//æ§å¶å¨ç±»å 01ï¼0x01ï¼:æµæ§ä¸ä½éï¼57(0x57):äºçµæ§å¶å¨ |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | //å¹³å°/APPè¿ç¨å
³éæ°´æ³µ/éé¨ + å·å¡å
³æ³µ/é䏿¥ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class DataCd93_A3Vo extends AlarmVo { |
| | | |
| | | public String controllerType;//æ§å¶å¨ç±»å 01ï¼0x01ï¼:æµæ§ä¸ä½éï¼57(0x57):äºçµæ§å¶å¨ |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | //å¼å
³æ°´æ³µ/é鍿å/å¤±è´¥ä¸æ¥ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class DataCdC2Vo extends AlarmVo { |
| | | |
| | | public String controllerType ;//æ§å¶å¨ç±»å: 01:æµæ§ä¸ä½éï¼57:äºçµæ§å¶å¨ |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | |
| | | 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() ; |
| | | } |
| | | } |
| | |
| | | case STATE_SUCCESS: |
| | | return "å级æå"; |
| | | case STATE_FAILONE: |
| | | return "å级失败ï¼1å
æ»ï¼"; |
| | | return "ä¸å
æ»"; |
| | | case STATE_FAIL: |
| | | return "å级失败ï¼é1å
æ»ï¼"; |
| | | return "åçº§ä¸æ»"; |
| | | case STATE_FAILOFFLINE: |
| | | return "å级失败ï¼ç¦»çº¿ï¼"; |
| | | return "离线失败"; |
| | | default: |
| | | return "æªç¥"; |
| | | } |
| | |
| | | public int runningTotal ;//æææ£å¨å级 |
| | | public int overTotal ;//ææç»æï¼å
æ¬æå䏿æå¤±è´¥ï¼ |
| | | public int successTotal ;//æææå |
| | | public int failTotal ;//ææå¤±è´¥ |
| | | public int failTotal ;//ææå¤±è´¥ï¼ä¸å
æ»å¤±è´¥+å¤å
æ»å¤±è´¥+ç¦»çº¿å¤±è´¥ï¼ |
| | | public int failOneTotal ;//ææä¸å
æ»å¤±è´¥ |
| | | public int failOffTotal ;//ææç¦»çº¿å¤±è´¥ |
| | | |
| | | public Boolean allOver ;//ææé½ç»æï¼true:æ¯ï¼false:å¦ï¼ |
| | | |
| | | public UpgradeState() { |
| | | this.init(); |
| | |
| | | this.overTotal = 0; |
| | | this.successTotal = 0; |
| | | this.failTotal = 0; |
| | | this.failOneTotal = 0; |
| | | this.failOffTotal = 0; |
| | | this.allOver = false ; |
| | | } |
| | | |
| | | public String toString(){ |
| | |
| | | sb.append(" \nå·²ç»ææ»æ°ï¼" + overTotal) ; |
| | | sb.append(" \næåæ»æ°ï¼" + successTotal) ; |
| | | sb.append(" \nå¤±è´¥æ»æ°ï¼" + failTotal) ; |
| | | sb.append(" \n1å
æ»æ»æ°ï¼" + failOneTotal) ; |
| | | sb.append(" \n1å
æ»å¤±è´¥æ»æ°ï¼" + failOneTotal) ; |
| | | sb.append(" \nç¦»çº¿å¤±è´¥æ»æ°ï¼" + failOffTotal) ; |
| | | sb.append(" \nå
¨ç»æï¼" + allOver) ; |
| | | return sb.toString() ; |
| | | } |
| | | |
| | |
| | | public String softFileName ;//å级ç¨åºæä»¶å |
| | | public String softStoreAddr ;//å级ç¨åºåæ¾å°å |
| | | public String softStartAddr ;//ç¨åºè¦çèµ·å§å°å |
| | | public String softFileData64 ;//ææå级ç¨åºåèæ°ç» |
| | | public byte[] softFileData ;//ææå级ç¨åºåèæ°ç» |
| | | public Integer softBytesCalculate ;//æ ¹æ®å
¬å¼è®¡ç®å¾å°çææå级ç¨åºåèæ° |
| | | public Integer softByteSrc16 ;//ææå级ç¨åºåèæ°CRC16æ ¡éªå¼ |
| | |
| | | " å级ç¨åºæä»¶å=" + softFileName + "\n" + |
| | | " å级ç¨åºåæ¾å°å=" + softStoreAddr + "\n" + |
| | | " ç¨åºè¦çèµ·å§å°å=" + softStartAddr + "\n" + |
| | | " ææå级ç¨åºåèæ°=" + softFileData.length + "\n" + |
| | | " ææå级ç¨åºåèæ°(base64)=" + softFileData64 + "\n" + |
| | | " å
¬å¼è®¡ç®ç¨åºåèæ°=" + softBytesCalculate + |
| | | " ç¨åºCRC16æ ¡éªå¼=" + softByteSrc16 + "\n" + |
| | | " å级æ§å¶å¨æ°é=" + rtuAddrList.size() + "\n" + |
| | |
| | | // s1ä¸å |
| | | s0 <<= 8; |
| | | s = s0 | s1; |
| | | return (short) s; |
| | | |
| | | return (short)s ; |
| | | } else { |
| | | throw new Exception("byte2Shortæ¶æ°ç»è¶ç"); |
| | | } |
| | |
| | | * @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è¯è¨ææ±ç¼è¯è¨)é½ç¨çæ¯æ ç¬¦å·æ° |
| | |
| | | } |
| | | } |
| | | } |
| | | return crc; |
| | | return (short)crc; |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.dy.common.util; |
| | | |
| | | import java.util.Timer; |
| | | import java.util.TimerTask; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/11/20 17:49 |
| | | * @Description : |
| | | * æ¤æ½è±¡ç±»ä»£æ¿ThreadJobï¼åå ï¼ |
| | | * å¨while(true){}ä¸ä½¿ç¨Thread.sleep()ï¼å¯è½å¯¼è´ç䏥鿧è½é®é¢ï¼ä¸æ¨èå¨å¾ªç¯ä¸ä½¿ç¨çº¿ç¨ä¼ç ã |
| | | * Java线ç¨å®ç°éç¨å
æ ¸çº¿ç¨å®ç°ï¼çº¿ç¨çä¼ç åå¤éï¼ç¶æåæ¢ï¼éå婿ä½ç³»ç»è¿è¡ï¼è¿æ¯ä¸ä¸ªæå
¶èæ¶èåçæä½ã |
| | | * å¨çº¿ç¨ä¼ç æè¿è¡æ¶é´è¾é¿çæ
æ¯ä¸ï¼å
¶å¯¹æ§è½çå½±åè¿ä¸ç®ææ¾ï¼å 为对线ç¨ç¶æç忢并ä¸é¢ç¹ã |
| | | * ä½è¥çº¿ç¨ä¼ç åè¿è¡çæ¶é´é½å¾çï¼ä¾å¦æ¯«ç§/ç§ï¼æä¸æ¡ä¾å°±æ¯ä¸ä¸ªå
¸åæ¡ä¾ï¼ï¼ |
| | | * ç³»ç»å°é¢ç¹ç对线ç¨ç¶æè¿è¡åæ¢ï¼å¯¼è´ä¸¥éçæ§è½æèï¼å¹¶å¯¹çå¾ªç¯æ¬¡æ°çéå¢èæ¾å¤§ã |
| | | */ |
| | | public abstract class TimerTaskJob { |
| | | protected Timer timer; |
| | | |
| | | protected boolean stop = false ; |
| | | public void stop(){ |
| | | this.stop = true ; |
| | | if(this.timer != null){ |
| | | this.timer.cancel(); |
| | | } |
| | | } |
| | | public boolean isStop(){ |
| | | return this.stop ; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param delay |
| | | * @param interval |
| | | * @param callback |
| | | * @throws Exception |
| | | */ |
| | | public void start(Long delay, Long interval, Callback callback) throws Exception { |
| | | this.timer = new Timer(); |
| | | this.timer.schedule(new TimerTask() { |
| | | public void run() { |
| | | Exception exe = null ; |
| | | Object obj = null ; |
| | | try { |
| | | obj = execute() ; |
| | | }catch(Exception e){ |
| | | e.printStackTrace(); |
| | | exe = e ; |
| | | }finally { |
| | | if(callback != null){ |
| | | if(exe != null){ |
| | | callback.exception(exe); |
| | | }else{ |
| | | callback.call(obj); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, delay , interval); |
| | | } |
| | | public abstract Object execute() throws Exception ; |
| | | } |
New file |
| | |
| | | package com.dy.common.util; |
| | | |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/11/20 18:29 |
| | | * @Description |
| | | */ |
| | | public class TimerTaskJobTest extends TimerTaskJob implements Callback { |
| | | |
| | | private static int count = 0 ; |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | TimerTaskJobTest obj = new TimerTaskJobTest() ; |
| | | obj.start(1000L, 1000L, obj); |
| | | } |
| | | |
| | | public Object execute() { |
| | | count++ ; |
| | | System.out.println("æ§è¡ä¼ºæçº¿ç¨" + count + "次"); |
| | | if(count == 10) { |
| | | stop() ; |
| | | } |
| | | return true ; |
| | | } |
| | | |
| | | //////////////////////////////////////////////////// |
| | | // |
| | | // åçº§ç¶æéç¥å·¥ä½çº¿ç¨æ§è¡å®æååè°çæ¹æ³ï¼ |
| | | // ä¹å°±æ¯ä¸é¢executeæ¹æ³æ§è¡å®æè¿åææåºå¼å¸¸åï¼æ§è¡ä¸é¢ä¸ä¸ªæ¹æ³ |
| | | // |
| | | //////////////////////////////////////////////////// |
| | | @Override |
| | | public void call(Object obj) { |
| | | //线ç¨å·¥ä½æ§è¡ä¸æ¬¡ï¼obj = Boolean(true) |
| | | System.out.println("伺æçº¿ç¨æ§è¡ä¸æ¬¡åè°"); |
| | | } |
| | | @Override |
| | | public void call(Object... objs) { |
| | | } |
| | | @Override |
| | | public void exception(Exception e) { |
| | | e.printStackTrace(); |
| | | System.out.println("伺æçº¿ç¨åçå¼å¸¸" + e.getMessage()); |
| | | } |
| | | } |
| | |
| | | <version>1.5.5.Final</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | |
| | | 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; |
| | |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | 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(); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.Date; |
| | | |
| | |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class VoBatteryVolt extends VoIntake { |
| | | |
| | | /** |
| | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.Date; |
| | | |
| | |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class VoCumulativeFlow extends VoIntake { |
| | | |
| | | /** |
| | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | |
| | | * æ¶è´¹éé¢ å¤§äº æå®å¼ |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class VoIntakeAccumulateAmount extends VoIntake{ |
| | | private static final long serialVersionUID = 202408051046001L; |
| | | |
| | |
| | | |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | |
| | | * ç¨æ°´æ¶é¿ > æå®å¼ (åé) |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class VoIntakeOpenCount extends VoIntake{ |
| | | private static final long serialVersionUID = 202408051046001L; |
| | | |
| | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.Date; |
| | | |
| | |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class VoSignalIntensity extends VoIntake { |
| | | /** |
| | | * ä¿¡å·å¼ºåº¦ |
| | |
| | | public String storeRamAddr; |
| | | |
| | | /** |
| | | * ç¨åºè¦çè¶
å§å°åï¼4åèï¼8ä½åå
è¿å¶åç¬¦ï¼ |
| | | * ç¨åºè¦çèµ·å§å°åï¼4åèï¼8ä½åå
è¿å¶åç¬¦ï¼ |
| | | */ |
| | | @Schema(description = "ç¨åºè¦çè¶
å§å°å", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @Schema(description = "ç¨åºè¦çèµ·å§å°å", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | public String startRamAddr; |
| | | |
| | | /** |
| | |
| | | public String rtuAddr ; //æ§å¶å¨å°å |
| | | public Integer rate ; //è¿åº¦ |
| | | public String state; //åçº§ç¶æ |
| | | public Integer status; //è¿ç¨ç¶æï¼0ï¼ç¦»çº¿ï¼1ï¼å级ä¸ï¼2ï¼å级æåï¼3åçº§å¤±è´¥ï¼ |
| | | public Integer reTryTimes ; //éè¯æ¬¡æ° |
| | | public boolean over ; //æ¯å¦ç»æï¼trueï¼æ¯ï¼falseï¼å¦ï¼ |
| | | public boolean success ; //æ¯å¦æåï¼trueï¼æ¯ï¼falseï¼å¦ï¼ |
| | | public Boolean over ; //æ¯å¦ç»æï¼trueï¼æ¯ï¼falseï¼å¦ï¼ |
| | | public Boolean success ; //æ¯å¦æåï¼null:è¿è¡ä¸ï¼trueï¼æ¯ï¼falseï¼å¦ï¼ |
| | | |
| | | public void fromCache(UpgradeRtu ugRtu){ |
| | | this.rtuAddr = ugRtu.rtuAddr ; |
| | | this.rate = (ugRtu.currentPackage * 1000)/ugRtu.totalPackage ;//å端å®ç°æ¯1000份çè¿åº¦æ¡ |
| | | this.state = UpgradeRtu.getStateName(ugRtu.state) ; |
| | | this.status = 1 ;//é»è®¤åçº§ä¸ |
| | | if(ugRtu.state == UpgradeRtu.STATE_OFFLINE){ |
| | | this.status = 0 ; |
| | | }else if(ugRtu.state == UpgradeRtu.STATE_SUCCESS){ |
| | | this.status = 2 ; |
| | | }else { |
| | | if(ugRtu.isOver && ugRtu.state != UpgradeRtu.STATE_SUCCESS){ |
| | | this.status = 3; |
| | | } |
| | | } |
| | | this.reTryTimes = ugRtu.reTryTimes ; |
| | | this.over = ugRtu.isOver ; |
| | | this.success = ugRtu.state == UpgradeRtu.STATE_SUCCESS ? true : false ; |
| | | if(ugRtu.isOver){ |
| | | this.success = (ugRtu.state == UpgradeRtu.STATE_SUCCESS ? true : false) ; |
| | | }else{ |
| | | this.success = null ; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | #name: ym |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | # url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | # url: jdbc:mysql://8.130.130.233:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | url: jdbc:mysql://127.0.0.1:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | # url: jdbc:mysql://127.0.0.1:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | username: root |
| | | password: dysql,;.abc!@# |
| | | druid: |
| | |
| | | #å½ä»¤åéå°å(ä¸ç¼æ¯æºætagï¼å
¶ä¹æ¯æ°æ®æºåç¼åç§°) |
| | | ym: |
| | | comSendUrl: "http://127.0.0.1:8070/rtuMw/com/send" |
| | | ugTaskSendUrl: "http://127.0.0.1:8070/rtuMw/com/upgradeRtu" |
| | | ugTaskSendUrl: "http://192.168.40.132:8070/rtuMw/com/upgradeRtu" |
| | | rtuLogFileUrl: "http://127.0.0.1:8070/rtuMw/com/rtuLogFile" |
| | | rtuLogTextUrl: "http://127.0.0.1:8070/rtuMw/com/rtuLogText" |
| | | sp: |
| | |
| | | //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); |
| | |
| | | import com.dy.common.springUtil.SpringContextUtil; |
| | | import com.dy.common.util.Callback; |
| | | import com.dy.common.util.DateTime; |
| | | import com.dy.common.util.ThreadJob; |
| | | import com.dy.common.util.TimerTaskJob; |
| | | import com.dy.rtuMw.web.webRequest.WebRequestDeal; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/11/4 16:03 |
| | | * å级管çç±» |
| | | * @Author liurunyu |
| | | * @Date 2024/11/4 16:03 |
| | | * @Description |
| | | */ |
| | | public class UpgradeManager extends ThreadJob implements Callback { |
| | | public class UpgradeManager extends TimerTaskJob implements Callback { |
| | | |
| | | private static final Logger log = LogManager.getLogger(UpgradeManager.class.getName()); |
| | | |
| | |
| | | private Integer ugMaxRtuSameTime ;//åæ¶å级RTUæå¤§ä¸ªæ° |
| | | |
| | | private UpgradeTask task ;//åçº§ä»»å¡ |
| | | private boolean monitorFirst = true ;//æ¯å¦æ¯ç¬¬ä¸æ¬¡çè§ |
| | | |
| | | private UpgradeManager(){} |
| | | private UpgradeManager(){ |
| | | monitorFirst = true ; |
| | | } |
| | | |
| | | public static UpgradeManager getInstance() { |
| | | return UpgradeManager.INSTANCE; |
| | |
| | | /** |
| | | * 设置åçº§ä»»å¡ |
| | | * @param vo UpgradeTaskVo å级任å¡å¯¹è±¡ |
| | | * @throws Exception |
| | | * @throws Exception å¼å¸¸ |
| | | */ |
| | | public void setUpgradeTask(UpgradeTaskVo vo) throws Exception { |
| | | if(this.task != null && !this.task.taskIsOver){ |
| | | throw new Exception("å½ååå¨å级任å¡ï¼è¯·çå¾
å½å任塿§è¡å®æå¼ºå¶ç»æå½åä»»å¡"); |
| | | }else { |
| | | this.task.forceOver(); |
| | | this.task = new UpgradeTask(); |
| | | this.task.initOption(this.failTryTimes, this.ugMaxRtuSameTime); |
| | | this.task.setTask(vo); |
| | | this.start(this); |
| | | Exception ex = null ; |
| | | try{ |
| | | if(this.task != null){ |
| | | this.task.forceOver(); |
| | | } |
| | | this.task = new UpgradeTask(); |
| | | this.task.initOption(this.failTryTimes, this.ugMaxRtuSameTime); |
| | | this.task.setTask(vo); |
| | | }catch (Exception e){ |
| | | ex = e ; |
| | | }finally { |
| | | if(ex != null){ |
| | | this.task = null ; |
| | | throw ex ; |
| | | }else{ |
| | | this.start(1000L, (long) UpgradeUnit.confVo.notifyStateInterval, this); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ç»æå½ååçº§ä»»å¡ |
| | | * @throws Exception |
| | | * 强å¶ç»æå½åå级任å¡ï¼ |
| | | * æ¤åè½å¯è½ä¸ä¼å¼æ¾åºå»ï¼ |
| | | * å 为强å¶ç»æå级任å¡ï¼å¯¹ä¸ä¸ªæªåçº§å®æçRTUå°±ä¼å¡æ»ï¼ |
| | | * æä»¥å½å¼ºå¶ç»æå级任å¡ï¼ä»£ç é»è¾å¹¶æ²¡æå¼ºå¶ç»æRTUå级è¿ç¨ï¼å¦æå级è¿ç¨ä¹å¼ºå¶åæ¢ï¼é£ä¹RTUçä¼å¡æ» |
| | | */ |
| | | public void overUpgradeTask() throws Exception { |
| | | public void forceOverUpgradeTask() { |
| | | if(this.task != null){ |
| | | this.stop(); |
| | | this.task.forceOver(); |
| | |
| | | |
| | | /** |
| | | * RTUæä¸è¡æ°æ®äºï¼è§¦åä¸ååçº§æ°æ® |
| | | * @param rtuAddr |
| | | * @param code |
| | | * @param protocolName |
| | | * @param protocolVersion |
| | | * @param callbackCom |
| | | * @param rtuAddr æ§å¶å¨RTUå°å |
| | | * @param code ä¸è¡æ°æ®åè½ç |
| | | * @param protocolName ä¸è¡æ°æ®å¯¹åºçåè®®åç§° |
| | | * @param protocolVersion ä¸è¡æ°æ®å¯¹åºçåè®®çæ¬å· |
| | | * @param callbackCom åè°å½æ°ï¼å¤çä¸è¡å½ä»¤ |
| | | */ |
| | | public void trigger(String rtuAddr, String code, String protocolName, Short protocolVersion, Callback callbackCom){ |
| | | if(task != null && !task.taskIsOver){ |
| | |
| | | //////////////////////////////////////////////////// |
| | | /** |
| | | * å½ååçº§ç¶æ |
| | | * @return |
| | | * @return å½ååçº§ç¶æ |
| | | */ |
| | | public UpgradeState currentUpgradeState() { |
| | | if(task != null){ |
| | |
| | | |
| | | /** |
| | | * Rtuåçº§ä¿¡æ¯ |
| | | * @param rtuAddr |
| | | * @return |
| | | * @param rtuAddr æ§å¶å¨RTUå°å |
| | | * @return æ§å¶å¨RTUåçº§ç¶æ |
| | | */ |
| | | @SuppressWarnings("unused") |
| | | public UpgradeRtu upgradeRtuInfo(String rtuAddr){ |
| | | if(task != null){ |
| | | return task.upgradeInfos(rtuAddr) ; |
| | |
| | | |
| | | /** |
| | | * Rtuåçº§ä¿¡æ¯ |
| | | * @param rtuAddrList |
| | | * @return |
| | | * @param rtuAddrList æ§å¶å¨å°åå表 |
| | | * @return æå®å表ä¸çæ§å¶å¨RTUåçº§ç¶æ |
| | | */ |
| | | @SuppressWarnings("unused") |
| | | public List<UpgradeRtu> upgradeRtuInfos(List<String> rtuAddrList){ |
| | | if(task != null){ |
| | | return task.upgradeInfos(rtuAddrList) ; |
| | |
| | | |
| | | |
| | | /** |
| | | * Rtuåçº§ä¿¡æ¯ |
| | | * @return |
| | | * ææRtuåçº§ä¿¡æ¯ |
| | | * @return ææRtuåçº§ä¿¡æ¯ |
| | | */ |
| | | public List<UpgradeRtu> upgradeRtuInfoAll(){ |
| | | if(task != null){ |
| | |
| | | // ç»è®¡ç¶æ + ç¶æéç¥ |
| | | // |
| | | //////////////////////////////////////////////////// |
| | | @Override |
| | | public Object execute() throws Exception { |
| | | boolean first = true ; |
| | | while (true){ |
| | | if(this.isStop()){ |
| | | break ; |
| | | } |
| | | if(first){ |
| | | try{ |
| | | //馿¬¡å¯å¨ï¼å1ç§ |
| | | Thread.sleep(1000L); |
| | | }catch (Exception e){ |
| | | } |
| | | }else{ |
| | | try{ |
| | | //åXæ¯«ç§ |
| | | Thread.sleep(UpgradeUnit.confVo.notifyStateInterval); |
| | | }catch (Exception e){ |
| | | } |
| | | } |
| | | if(this.task == null |
| | | || this.task.taskVo == null |
| | | || this.task.taskVo.rtuAddrList == null |
| | | || this.task.taskVo.rtuAddrList.size() == 0){ |
| | | //ä»»å¡ä¸ºç©º |
| | | break ; |
| | | }else{ |
| | | if(!this.task.taskIsOver){ |
| | | //åçº§ä»»å¡æªå®æ |
| | | //å·¥ä½1ï¼ç»è®¡å½åæ£å¨å级çRTUæ°éï¼ä¸ºåéåæ¶å级æ°éååå¤ |
| | | this.task.statisticsRunningRtuCount() ; |
| | | |
| | | //å·¥ä½2ï¼ç»è®¡éè¦å级ä½å½å离线RTUçæ
åµ |
| | | this.task.statisticsOffRtuCountAndSet() ; |
| | | |
| | | //å·¥ä½3ï¼ç»è®¡æ¯å¦å
¨é¨åçº§å®æ |
| | | this.task.taskIsOver = this.task.statisticsIsAllOver() ; |
| | | |
| | | if(this.task.taskIsOver){ |
| | | if(!this.task.taskOverType.equals(UpgradeTask.TaskOverType_Force)){ |
| | | //ä»»å¡ä¸æ¯å¼ºå¶ç»æç |
| | | this.task.taskOverType = UpgradeTask.TaskOverType_Natural ;//ä»»å¡å®ææ¹å¼ï¼èªç¶ï¼å¼ºå¶ï¼ |
| | | this.task.taskOverDt = DateTime.yyyy_MM_dd_HH_mm_ss() ;//ä»»å¡å®ææ¶é´(yyyy-mm-dd HH:MM:SS) |
| | | } |
| | | //ä»»å¡å®æï¼æ§è¡æå䏿¬¡åçº§ç¶æéç¥ |
| | | //å·¥ä½4ï¼åçº§ç¶æéç¥ |
| | | if(!first){ |
| | | this.notifyUpgradeStatus() ; |
| | | } |
| | | }else{ |
| | | //任塿ªå®æï¼ç»§ç»æ§è¡åçº§ç¶æéç¥ |
| | | //å·¥ä½4ï¼ åçº§ç¶æéç¥ |
| | | if(!first){ |
| | | this.notifyUpgradeStatus() ; |
| | | } |
| | | } |
| | | }else{ |
| | | public Object execute() { |
| | | if(this.task == null |
| | | || this.task.taskVo == null |
| | | || this.task.taskVo.rtuAddrList == null |
| | | || this.task.taskVo.rtuAddrList.size() == 0){ |
| | | //ä»»å¡ä¸ºç©º |
| | | this.stop() ; |
| | | }else{ |
| | | if(!this.task.taskIsOver){ |
| | | //åçº§ä»»å¡æªå®æ |
| | | //å·¥ä½1ï¼å¤ææ¯å¦æ ä»»ä½ä¸ä¸ªRTUè¿è¡è¿å级ï¼å¹¶ä¸è¾¾å°æ¶éï¼å认为å½åå级任å¡å®æ |
| | | //-1:æ ä¸RTUå级ä¸è¶
æ¶ï¼0ï¼æ RTUåçº§ä½æªè¶
æ¶çå¾
ï¼1æRTUå级æ£å¸¸æ§è¡ |
| | | int temp = this.task.countNoOneRtuUpgradeInDuration() ; |
| | | if(temp == -1){ |
| | | this.task.taskIsOver = true ; |
| | | //ä»»å¡å·²ç»å®æ |
| | | this.stop(); |
| | | }else if(temp == 1){ |
| | | //å·¥ä½2ï¼ç»è®¡å½åæ£å¨å级çRTUæ°éï¼ä¸ºåæ¶å级æ°ééå¶ååå¤ |
| | | this.task.countRunningRtuCount() ; |
| | | |
| | | //å·¥ä½3ï¼ç»è®¡éè¦å级ä½å½å离线RTUçæ
åµï¼è¶
è¿æ¶éç设å¤ä¸ºåçº§å®æ |
| | | this.task.countOffRtuAndSetIfOver() ; |
| | | |
| | | //å·¥ä½4ï¼ç»è®¡æ¯å¦å
¨é¨åçº§å®æ |
| | | this.task.taskIsOver = this.task.countIsAllOver() ; |
| | | }else if(temp == 0){ |
| | | //ä¸ä½ä¸º |
| | | } |
| | | if(this.task.taskIsOver){ |
| | | if(!this.task.taskOverType.equals(UpgradeTask.TaskOverType_Force)){ |
| | | //ä»»å¡ä¸æ¯å¼ºå¶ç»æç |
| | | this.task.taskOverType = UpgradeTask.TaskOverType_Natural ;//ä»»å¡å®ææ¹å¼ï¼èªç¶ï¼å¼ºå¶ï¼ |
| | | this.task.taskOverDt = DateTime.yyyy_MM_dd_HH_mm_ss() ;//ä»»å¡å®ææ¶é´(yyyy-mm-dd HH:MM:SS) |
| | | } |
| | | //ä»»å¡å®æï¼æ§è¡æå䏿¬¡åçº§ç¶æéç¥ |
| | | //å·¥ä½5ï¼åçº§ç¶æéç¥ |
| | | //if(!first){ |
| | | // this.notifyUpgradeStatus() ; |
| | | //} |
| | | }else{ |
| | | //任塿ªå®æï¼ç»§ç»æ§è¡åçº§ç¶æéç¥ |
| | | //å·¥ä½5ï¼ åçº§ç¶æéç¥ |
| | | //if(!first){ |
| | | // this.notifyUpgradeStatus() ; |
| | | //} |
| | | } |
| | | //å·¥ä½5ï¼åçº§ç¶æéç¥ |
| | | if(!this.monitorFirst){ |
| | | this.notifyUpgradeStatus() ; |
| | | } |
| | | }else{ |
| | | //ä»»å¡å·²ç»å®æ |
| | | this.stop(); |
| | | } |
| | | if(first){ |
| | | first = false ; |
| | | } |
| | | } |
| | | if(this.monitorFirst){ |
| | | this.monitorFirst = false ; |
| | | } |
| | | return true ; |
| | | } |
| | |
| | | @Override |
| | | public void call(Object obj) { |
| | | //线ç¨å·¥ä½æ§è¡å®äºï¼obj = Boolean(true) |
| | | this.thread = null ;//èµå¼ä¸ºnullï¼ä½¿çº¿ç¨å¯¹è±¡è¢«åå¾åæ¶å¨åæ¶ |
| | | } |
| | | @Override |
| | | public void call(Object... objs) { |
| | |
| | | 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; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | 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.taskVo = taskVo ; |
| | | this.failTryTimes = failTryTimes ; |
| | | this.rtuAddr = rtuAddr ; |
| | | this.state = STATE_UNSTART ; |
| | | this.totalPackage = totalPackage ; |
| | |
| | | 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.taskVo = taskVo ; |
| | | this.failTryTimes = failTryTimes ; |
| | | this.rtuAddr = rtuAddr ; |
| | | this.state = state ; |
| | | this.totalPackage = totalPackage ; |
| | |
| | | */ |
| | | @Override |
| | | public void trigger(String code, String protocolName, Short protocolVersion, byte[][] softData, Callback callbackCom){ |
| | | if(this.state == STATE_OFFLINE || this.state == STATE_UNSTART){ |
| | | //å½åæªå¼å§å级è¿ç¨ï¼ä¸åå级é
ç½®æä»¤ |
| | | this.setStateAtCom1601Time(); |
| | | callbackCom.call(createCommand1601(protocolName, protocolVersion)); |
| | | }else if(this.state == STATE_RUNNING){ |
| | | //å½åå级è¿ç¨ä¸ |
| | | if(code.equals(UpgradeCode.cd_1601)){ |
| | | //ä¸åé
ç½®è¿å |
| | | this.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ; |
| | | callbackCom.call(createCommand1602(protocolName, protocolVersion, currentPackage, currentRamAddr, softData));//ä¸åæ°æ®å
æä»¤ |
| | | }else if(code.equals(UpgradeCode.cd_1602)){ |
| | | //ä¸åæ°æ®å
è¿å |
| | | currentPackage++ ; |
| | | currentRamAddr += RAMADDRADD ; |
| | | if(currentPackage < totalPackage){ |
| | | if(!this.isOver){ |
| | | //å级æªå®æ |
| | | if(this.state == STATE_OFFLINE || this.state == STATE_UNSTART){ |
| | | //å½åæªå¼å§å级è¿ç¨ï¼ä¸åå级é
ç½®æä»¤ |
| | | this.setStateAtSendCom1601Time(); |
| | | callbackCom.call(createCommand1601(protocolName, protocolVersion)); |
| | | }else if(this.state == STATE_RUNNING){ |
| | | //å½åå级è¿ç¨ä¸ |
| | | if(code.equals(UpgradeCode.cd_9601)){ |
| | | //ä¸åé
ç½®è¿å |
| | | this.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ; |
| | | callbackCom.call(createCommand1602(protocolName, protocolVersion, currentPackage, currentRamAddr, softData)); |
| | | }else{ |
| | | this.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ; |
| | | callbackCom.call(createCommand1603(protocolName, protocolVersion));//ä¸åæ ¡éªæä»¤ |
| | | } |
| | | }else if(code.equals(UpgradeCode.cd_1603)){ |
| | | //ä¸åæ ¡éªè¿å |
| | | this.isOver = true ;//åçº§å®æ |
| | | this.state = STATE_SUCCESS ; |
| | | this.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ; |
| | | callbackCom.call(createCommand1600(protocolName, protocolVersion));//ä¸åå¤ä½æä»¤ï¼æ¤æä»¤æ åºç |
| | | }else{ |
| | | if(!this.isOver){ |
| | | //å级æªå®æ |
| | | if(this.state == STATE_FAILONE || this.state == STATE_FAIL){ |
| | | //å·²ç»æ¯å级失败æ |
| | | if(this.reTryTimes < task.failTryTimes){ |
| | | //éè¯æ¬¡æ°æªè¾¾å°ä¸éï¼ç»§ç»éè¯ |
| | | this.reTryTimes += 1 ; |
| | | this.setStateAtCom1601Time(); |
| | | callbackCom.call(createCommand1601(protocolName, protocolVersion));//ä¸åé
ç½®æä»¤ |
| | | }else{ |
| | | this.isOver = true ;//åçº§å®æ |
| | | } |
| | | callbackCom.call(createCommand1602(protocolName, protocolVersion, currentPackage, currentRamAddr, softData));//ä¸åæ°æ®å
æä»¤ |
| | | }else if(code.equals(UpgradeCode.cd_9602)){ |
| | | //ä¸åæ°æ®å
è¿å |
| | | currentPackage++ ; |
| | | currentRamAddr += RAMADDRADD ; |
| | | if(currentPackage < totalPackage){ |
| | | this.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ; |
| | | callbackCom.call(createCommand1602(protocolName, protocolVersion, currentPackage, currentRamAddr, softData)); |
| | | }else{ |
| | | //éå级åè½ç ï¼å¦æå¨å级è¿ç¨ä¸æ¶å°è¿ä¸ªåè½ç çä¸è¡æ°æ®ï¼è¯´æåçº§å¤±è´¥äº |
| | | if(currentPackage == 0 || currentPackage == 1){ |
| | | //1å
æ»ï¼å级失败 |
| | | this.state = STATE_FAILONE ; |
| | | }else{ |
| | | //é1å
æ»ï¼å级失败 |
| | | this.state = STATE_FAIL ; |
| | | } |
| | | this.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ; |
| | | callbackCom.call(createCommand1603(protocolName, protocolVersion));//ä¸åæ ¡éªæä»¤ |
| | | } |
| | | }else if(code.equals(UpgradeCode.cd_9603)){ |
| | | //ä¸åæ ¡éªè¿å |
| | | this.setStateAtReceiveRes9603Time() ; |
| | | callbackCom.call(createCommand1600(protocolName, protocolVersion));//ä¸åå¤ä½æä»¤ï¼æ¤æä»¤æ åºç |
| | | }else{ |
| | | //åçº§å®æï¼æ ä¸å¡é»è¾ |
| | | //å½åæ¯å级ä¸ç¶æï¼å¹¶ä¸å级æªå®æï¼æ¶å°äºé960Xç³»ååè½ç ï¼åå级失败 |
| | | if(currentPackage == 0 || currentPackage == 1){ |
| | | //1å
æ»ï¼å级失败 |
| | | this.state = STATE_FAILONE ; |
| | | }else{ |
| | | //é1å
æ»ï¼å级失败 |
| | | this.state = STATE_FAIL ; |
| | | } |
| | | } |
| | | }else if(this.state == STATE_FAILONE || this.state == STATE_FAIL){ |
| | | //䏿¬¡è®¾ç½®äºå¤±è´¥ç¶æï¼å¹¶ä¸å级æªå®æï¼æ¶å°äºé960Xç³»ååè½ç ï¼åå级失败 |
| | | if(this.reTryTimes < this.failTryTimes){ |
| | | //éè¯æ¬¡æ°æªè¾¾å°ä¸éï¼ç»§ç»éè¯ |
| | | this.reTryTimes += 1 ; |
| | | this.setStateAtSendCom1601Time(); |
| | | callbackCom.call(createCommand1601(protocolName, protocolVersion));//ä¸åé
ç½®æä»¤ |
| | | }else{ |
| | | //å级失败ï¼å¹¶ä¸éè¯æ¬¡æ°è¾¾å°ä¸éï¼å¼ºå¶è®¾ç½®åçº§å®æ |
| | | this.isOver = true ; |
| | | } |
| | | }else if(this.state == STATE_SUCCESS){ |
| | | //å级æåæï¼ä¸ä¼åºç°æ¤æ
åµï¼å 为设置为æåææ¶ï¼åçº§ç»æå±æ§isOver设置为trueäº |
| | | //为å®å
¨è§ï¼è¿éåè®¾ç½®ä¸ºç»ææ |
| | | this.isOver = true ; |
| | | }else if(this.state == STATE_FAILOFFLINE){ |
| | | //å·²ç»è¢«å
¶ä»é»è¾æ¨¡å强å¶è®¾ç½®æç¦»çº¿å¤±è´¥æäºï¼ä¸ä¼åºç°æ¤æ
åµï¼å ä¸ºè®¾ç½®ä¸ºç¦»çº¿å¤±è´¥ææ¶ï¼åçº§ç»æå±æ§isOver设置为trueäº |
| | | //è¿éä¸åæä½ä¸º |
| | | //为å®å
¨è§ï¼è¿éåè®¾ç½®ä¸ºç»ææ |
| | | this.isOver = true ; |
| | | }else{ |
| | | //å
¶ä»ç¶æï¼æ²¡æå
¶ä»æäºï¼é¤éå设计å¼åæ¶å¢å äºç¶æï¼ |
| | | //为å®å
¨è§ï¼è¿éåè®¾ç½®ä¸ºç»ææ |
| | | this.isOver = true ; |
| | | } |
| | | }else{ |
| | | //å¨å
¶ä»ç¶æä¸ï¼ä¸è§¦åä»»å¡å·¥ä½ |
| | | //åçº§å®æï¼æ ä¸å¡é»è¾ |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置åéé
ç½®å½ä»¤æ¶å»çç¶æ |
| | | */ |
| | | private void setStateAtCom1601Time(){ |
| | | this.state = STATE_RUNNING; |
| | | private void setStateAtSendCom1601Time(){ |
| | | this.state = STATE_RUNNING;//å级è¿è¡ä¸ |
| | | this.currentPackage = 0 ; |
| | | this.currentRamAddr = 0 ; |
| | | this.isOver = false ; |
| | | this.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ; |
| | | } |
| | | |
| | | /** |
| | | * 设置1603æä»¤è¿åæ¶å»çç¶æ |
| | | */ |
| | | private void setStateAtReceiveRes9603Time(){ |
| | | this.isOver = true ;//åçº§å®æ |
| | | this.state = STATE_SUCCESS ; |
| | | this.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ; |
| | | } |
| | | |
| | |
| | | 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 ; |
| | | } |
| | |
| | | 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 |
| | |
| | | */ |
| | | @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 = "强å¶" ; |
| | |
| | | protected byte[][] softFileDataGrp ;//以512åè为å使å级ç¨åºæ°æ®åç» |
| | | |
| | | @JSONField(serialize = false) |
| | | protected Map<String, UpgradeRtu> upgradeRtus;//åçº§ç¶æ |
| | | protected ConcurrentHashMap<String, UpgradeRtu> upgradeRtus;//åçº§ç¶æ |
| | | |
| | | public boolean taskIsOver = false ;//任塿¯å¦å®æ |
| | | public String taskOverType = "" ;//ä»»å¡å®ææ¹å¼ï¼èªç¶ï¼å¼ºå¶ï¼ |
| | |
| | | if(taskVo.softStartAddr == null || taskVo.softStartAddr.trim().length() != 8){ |
| | | throw new Exception("ç¨åºè¦çèµ·å§å°åä¸åæ³ï¼å¿
é¡»æ¯8å符ï¼åå
è¿å¶ï¼çå符串") ; |
| | | } |
| | | if(taskVo.softFileData == null || taskVo.softFileData.length <= 0){ |
| | | if(taskVo.softFileData64 == null || taskVo.softFileData64.trim().length() == 0){ |
| | | throw new Exception("å级ç¨åºå
容å¿
é¡»æä¾") ; |
| | | } |
| | | if(taskVo.softBytesCalculate == null){ |
| | |
| | | this.setupDtLong = System.currentTimeMillis() ; |
| | | this.taskVo = taskVo ; |
| | | |
| | | this.upgradeRtus = new HashMap<>(); |
| | | if(taskVo.softFileData != null && taskVo.softFileData.length >0){ |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | |
| | | //æ ¹æ®æ¹æ³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ä¸å¨å级ä¹å |
| | |
| | | * 强å¶ç»æåçº§ä»»å¡ |
| | | */ |
| | | public void forceOver(){ |
| | | this.taskIsOver = true ;//强å¶è®¾ç½®ä»»å¡å®æ |
| | | this.taskOverType = TaskOverType_Force ;//ä»»å¡å®ææ¹å¼ï¼èªç¶ï¼å¼ºå¶ï¼ |
| | | this.taskOverDt = DateTime.yyyy_MM_dd_HH_mm_ss() ;//ä»»å¡å®ææ¶é´(yyyy-mm-dd HH:MM:SS) |
| | | //this.taskVo.rtuAddrList.clear(); |
| | | //this.upgradeState.clear(); |
| | | if(!this.taskIsOver){ |
| | | this.taskIsOver = true ;//强å¶è®¾ç½®ä»»å¡å®æ |
| | | this.taskOverType = TaskOverType_Force ;//ä»»å¡å®ææ¹å¼ï¼èªç¶ï¼å¼ºå¶ï¼ |
| | | this.taskOverDt = DateTime.yyyy_MM_dd_HH_mm_ss() ;//ä»»å¡å®ææ¶é´(yyyy-mm-dd HH:MM:SS) |
| | | //this.taskVo.rtuAddrList.clear(); |
| | | //this.upgradeState.clear(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | if(this.taskVo.rtuAddrList != null && this.taskVo.rtuAddrList.size() > 0){ |
| | | state.rtuTotal = this.taskVo.rtuAddrList.size() ; |
| | | if(this.upgradeRtus != null && this.upgradeRtus.size() > 0){ |
| | | Collection<UpgradeRtu> col = this.upgradeRtus.values() ; |
| | | for(UpgradeRtu info : col){ |
| | | this.upgradeRtus.values().stream().forEach(info ->{ |
| | | if(info.state == UpgradeRtu.STATE_OFFLINE){ |
| | | state.offLineTotal ++ ; |
| | | }else if(info.state == UpgradeRtu.STATE_UNSTART){ |
| | |
| | | state.runningTotal ++ ; |
| | | }else if(info.state == UpgradeRtu.STATE_SUCCESS) { |
| | | state.successTotal++; |
| | | }else if(info.state == UpgradeRtu.STATE_FAIL) { |
| | | state.failTotal++; |
| | | }else if(info.state == UpgradeRtu.STATE_FAILONE) { |
| | | state.failOneTotal++; |
| | | state.failTotal++; |
| | | }else if(info.state == UpgradeRtu.STATE_FAIL) { |
| | | }else if(info.state == UpgradeRtu.STATE_FAILOFFLINE) { |
| | | state.failTotal++; |
| | | state.failOffTotal++; |
| | | } |
| | | if(info.isOver){ |
| | | state.overTotal++; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | return state ; |
| | |
| | | /////////////////////////////////////////////////////////// |
| | | //以䏿¹æ³ä¸ºå
鍿å¡ï¼ä¸å¯¹å¤æä¾æå¡ |
| | | /////////////////////////////////////////////////////////// |
| | | |
| | | /** |
| | | * ç»è®¡å½åæ£å¨å级çRTUæ°éï¼ä¸ºåéåæ¶å级æ°éååå¤ |
| | | * 夿æ¯å¦æ²¡ç¨ä»»ä½ä¸ä¸ªRTUè¿è¡è¿å级ï¼èä¸è¶
è¿äºæ¶é |
| | | * @return -1:æ ä¸RTUå级ä¸è¶
æ¶ï¼0ï¼æ RTUåçº§ä½æªè¶
æ¶çå¾
ï¼1æRTUå级æ£å¸¸æ§è¡ |
| | | */ |
| | | protected void statisticsRunningRtuCount(){ |
| | | protected int countNoOneRtuUpgradeInDuration(){ |
| | | 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 countRunningRtuCount(){ |
| | | int runningTotal = 0 ; |
| | | Collection<UpgradeRtu> col = this.upgradeRtus.values() ; |
| | | for(UpgradeRtu info : col){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * ç»è®¡éè¦å级ä½å½å离线RTUçæ
åµ |
| | | * ç»è®¡éè¦å级ä½å½å离线RTUçæ
åµï¼è¶
è¿æ¶éç设å¤ä¸ºåçº§å®æ |
| | | */ |
| | | protected void statisticsOffRtuCountAndSet() { |
| | | protected void countOffRtuAndSetIfOver() { |
| | | Long now = System.currentTimeMillis() ; |
| | | if(now - this.setupDtLong > UpgradeUnit.confVo.rtuOffLineWaitDuration){ |
| | | //rtu离线ï¼çå¾
å
¶åçº§çæ¶é¿(毫ç§)ï¼è¶
è¿é
ç½®çæå¤§æ¶é¿ï¼è®¾ç½®å
¶å级失败ï¼ä¸è®¾ç½®å级任å¡å®æ |
| | |
| | | /** |
| | | * ç»è®¡æ¯å¦å级å
¨é¨ç»æ |
| | | */ |
| | | protected boolean statisticsIsAllOver() { |
| | | protected boolean countIsAllOver() { |
| | | if (this.taskVo.rtuAddrList != null && this.taskVo.rtuAddrList.size() > 0) { |
| | | Collection<UpgradeRtu> col = this.upgradeRtus.values() ; |
| | | for(UpgradeRtu info : col){ |
| | |
| | | */ |
| | | public void overUpgradeTask() throws Exception { |
| | | if(manager != null ){ |
| | | manager.overUpgradeTask() ; |
| | | manager.forceOverUpgradeTask() ; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | public Boolean showStartInfo ; |
| | | public Boolean enable ;//æ¨¡åæ¯å¦å¯å¨ |
| | | public Integer noOneRtuUpgradeMaxDuration ;//å级任å¡è®¾ç½®åï¼æ²¡æè®¾å¤å级æå¤§æ¶é¿ï¼æ¯«ç§ï¼ï¼è¶
è¿è¿ä¸ªæ¶é¿ï¼è®¤ä¸ºå级任å¡å®æï¼åå¼èå´æ¯5åé~60åé |
| | | public Integer failTryTimes ;//å级失败åï¼éå¯¹çæ¯å¨çº¿è¿è¡äºå级ä¸åå½ä»¤ï¼ï¼éæ°å¿è¯å级次æ°ï¼0表示ä¸éæ°å¿è¯å级 |
| | | public Integer ugMaxRtuAtOnce;//为äºç¼è§£éä¿¡ä¸é´ä»¶çååï¼åæ¶æ¯æå级çRTUå°æ° |
| | | public Integer rtuOffLineWaitDuration;//rtu离线ï¼çå¾
å
¶åçº§çæ¶é¿(毫ç§)ï¼è¶
è¿è¿ä¸ªæ¶é´ï¼è®¾ç½®å
¶å级失败ï¼ä¸è®¾ç½®å级任å¡å®æ |
| | |
| | | |
| | | public UpgradeUnitConfigVo(){ |
| | | this.enable = false ; |
| | | this.noOneRtuUpgradeMaxDuration = 10 * 60 * 1000 ; |
| | | this.failTryTimes = 0 ; |
| | | this.ugMaxRtuAtOnce = Integer.MAX_VALUE ; |
| | | this.rtuOffLineWaitDuration = 10 * 60 * 60 * 1000 ; |
| | |
| | | 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; |
| | |
| | | * @Author liurunyu |
| | | * @Date 2023/12/21 20:28 |
| | | * @LastEditTime 2023/12/21 20:28 |
| | | * @Description |
| | | * @Description éä¿¡ä¸é´ä»¶å¯¹å¤è¿è¡webè°ç¨ï¼æå½ä»¤ç»æåéåºå» |
| | | */ |
| | | @Component() |
| | | public class CommandResultDeal { |
| | |
| | | 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 { |
| | |
| | | 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; |
| | |
| | | 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 { |
| | |
| | | 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" |
| | | /> |
| | | |
| | | <!-- |
| | |
| | | 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" |
| | |
| | | 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" |
| | | /> |
| | | |
| | | <!-- |
| | |
| | | saveDbIntervalï¼Rtuç¶æåæ°æ®åºé´é(åé) |
| | | --> |
| | | <resource |
| | | rtuLogDir="rtuLogs/" |
| | | rtuLogFileMaxSize="100000" |
| | | rtuLogFileMaxCount="2" |
| | | monitorInterval="2" |
| | | saveDbInterval="10" |
| | | rtuLogDir="rtuLogs/" |
| | | rtuLogFileMaxSize="100000" |
| | | rtuLogFileMaxCount="2" |
| | | monitorInterval="2" |
| | | saveDbInterval="10" |
| | | /> |
| | | |
| | | |
| | |
| | | queueMaxSize: ç¼åéåèç¹æ°æå¤§æ°é |
| | | --> |
| | | <core |
| | | sleepBigBusy="100" |
| | | sleepSmallBusy="500" |
| | | queueWarnSize="100000" |
| | | queueMaxSize="300000" |
| | | sleepBigBusy="100" |
| | | sleepSmallBusy="500" |
| | | queueWarnSize="100000" |
| | | queueMaxSize="300000" |
| | | /> |
| | | |
| | | <!-- |
| | |
| | | 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" |
| | | /> |
| | | |
| | | <!-- |
| | |
| | | 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" |
| | |
| | | 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" |
| | | /> |
| | | |
| | | <!-- |
| | |
| | | saveDbIntervalï¼Rtuç¶æåæ°æ®åºé´é(åé) |
| | | --> |
| | | <resource |
| | | rtuLogDir="rtuLogs/" |
| | | rtuLogFileMaxSize="100000" |
| | | rtuLogFileMaxCount="2" |
| | | monitorInterval="2" |
| | | saveDbInterval="10" |
| | | rtuLogDir="rtuLogs/" |
| | | rtuLogFileMaxSize="100000" |
| | | rtuLogFileMaxCount="2" |
| | | monitorInterval="2" |
| | | saveDbInterval="10" |
| | | /> |
| | | |
| | | |
| | |
| | | queueMaxSize: ç¼åéåèç¹æ°æå¤§æ°é |
| | | --> |
| | | <core |
| | | sleepBigBusy="100" |
| | | sleepSmallBusy="500" |
| | | queueWarnSize="100000" |
| | | queueMaxSize="300000" |
| | | sleepBigBusy="100" |
| | | sleepSmallBusy="500" |
| | | queueWarnSize="100000" |
| | | queueMaxSize="300000" |
| | | /> |
| | | |
| | | <!-- |
| | |
| | | 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" |
| | | /> |
| | | |
| | | <!-- |
| | |
| | | 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" |
| | |
| | | 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" |
| | | /> |
| | | |
| | | <!-- |
| | |
| | | saveDbIntervalï¼Rtuç¶æåæ°æ®åºé´é(åé) |
| | | --> |
| | | <resource |
| | | rtuLogDir="rtuLogs/" |
| | | rtuLogFileMaxSize="100000" |
| | | rtuLogFileMaxCount="2" |
| | | monitorInterval="2" |
| | | saveDbInterval="10" |
| | | rtuLogDir="rtuLogs/" |
| | | rtuLogFileMaxSize="100000" |
| | | rtuLogFileMaxCount="2" |
| | | monitorInterval="2" |
| | | saveDbInterval="10" |
| | | /> |
| | | |
| | | |
| | |
| | | queueMaxSize: ç¼åéåèç¹æ°æå¤§æ°é |
| | | --> |
| | | <core |
| | | sleepBigBusy="100" |
| | | sleepSmallBusy="500" |
| | | queueWarnSize="100000" |
| | | queueMaxSize="300000" |
| | | sleepBigBusy="100" |
| | | sleepSmallBusy="500" |
| | | queueWarnSize="100000" |
| | | queueMaxSize="300000" |
| | | /> |
| | | |
| | | <!-- |
| | |
| | | onlyDealRtus="" |
| | | onlyOneProtocol="false" |
| | | downComandMaxResendTimes="1" |
| | | commandSendInterval="10" |
| | | commandSendInterval="3" |
| | | cachWaitResultTimeout="120" |
| | | offLineCachTimeout="86400" |
| | | lastUpDataTimeLive="500" |
| | |
| | | |
| | | <!-- RTU 软件å级 |
| | | enable: æ¨¡åæ¯å¦å¯å¨ |
| | | noOneRtuUpgradeMaxDurationï¼å级任å¡è®¾ç½®åï¼æ ä¸è®¾å¤å级æå¤§æ¶é¿ï¼ç§ï¼ï¼è¶
è¿è¿ä¸ªæ¶é¿ï¼è®¤ä¸ºå级任å¡å®æï¼åå¼èå´æ¯5åé~60åé |
| | | failTryTimesï¼å级失败åï¼éå¯¹çæ¯å¨çº¿è¿è¡äºå级ä¸åå½ä»¤ï¼ï¼éæ°å¿è¯å级次æ°ï¼å½è®¾ç½®ä¸º0æ¶è¡¨ç¤ºä¸éæ°å¿è¯å级 |
| | | ugMaxRtuAtOnceï¼ä¸ºäºç¼è§£éä¿¡ä¸é´ä»¶çååï¼åæ¶æ¯æå级çRTUå°æ°ï¼å½è®¾ç½®ä¸º0æ¶è¡¨ç¤ºä¸åéå¶ |
| | | rtuOffLineWaitDuration: rtu离线ï¼çå¾
å
¶åçº§çæ¶é¿ï¼ç§ï¼ï¼è¶
è¿è¿ä¸ªæ¶é´ï¼è®¾ç½®å
¶å级失败ï¼ä¸è®¾ç½®å级任å¡å®æ |
| | | notifyStateInterval: åçº§ç¶æéç¥é´éï¼ç§ï¼ |
| | | --> |
| | | <upgrade enable="true" |
| | | noOneRtuUpgradeMaxDuration="600" |
| | | failTryTimes="1" |
| | | ugMaxRtuAtOnce="1000" |
| | | rtuOffLineWaitDuration="1200" |
New file |
| | |
| | | /mvnw text eol=lf |
| | | *.cmd text eol=crlf |
New file |
| | |
| | | HELP.md |
| | | target/ |
| | | /pipIrr-mw-simulate-rtu.iml |
| | | !.mvn/wrapper/maven-wrapper.jar |
| | | !**/src/main/**/target/ |
| | | !**/src/test/**/target/ |
| | | |
| | | ### STS ### |
| | | .apt_generated |
| | | .classpath |
| | | .factorypath |
| | | .project |
| | | .settings |
| | | .springBeans |
| | | .sts4-cache |
| | | |
| | | ### IntelliJ IDEA ### |
| | | .idea |
| | | *.iws |
| | | *.iml |
| | | *.ipr |
| | | |
| | | ### NetBeans ### |
| | | /nbproject/private/ |
| | | /nbbuild/ |
| | | /dist/ |
| | | /nbdist/ |
| | | /.nb-gradle/ |
| | | build/ |
| | | !**/src/main/**/build/ |
| | | !**/src/test/**/build/ |
| | | |
| | | ### VS Code ### |
| | | .vscode/ |
New file |
| | |
| | | # Licensed to the Apache Software Foundation (ASF) under one |
| | | # or more contributor license agreements. See the NOTICE file |
| | | # distributed with this work for additional information |
| | | # regarding copyright ownership. The ASF licenses this file |
| | | # to you under the Apache License, Version 2.0 (the |
| | | # "License"); you may not use this file except in compliance |
| | | # with the License. You may obtain a copy of the License at |
| | | # |
| | | # http://www.apache.org/licenses/LICENSE-2.0 |
| | | # |
| | | # Unless required by applicable law or agreed to in writing, |
| | | # software distributed under the License is distributed on an |
| | | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| | | # KIND, either express or implied. See the License for the |
| | | # specific language governing permissions and limitations |
| | | # under the License. |
| | | wrapperVersion=3.3.2 |
| | | distributionType=only-script |
| | | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip |
New file |
| | |
| | | #!/bin/sh |
| | | # ---------------------------------------------------------------------------- |
| | | # Licensed to the Apache Software Foundation (ASF) under one |
| | | # or more contributor license agreements. See the NOTICE file |
| | | # distributed with this work for additional information |
| | | # regarding copyright ownership. The ASF licenses this file |
| | | # to you under the Apache License, Version 2.0 (the |
| | | # "License"); you may not use this file except in compliance |
| | | # with the License. You may obtain a copy of the License at |
| | | # |
| | | # http://www.apache.org/licenses/LICENSE-2.0 |
| | | # |
| | | # Unless required by applicable law or agreed to in writing, |
| | | # software distributed under the License is distributed on an |
| | | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| | | # KIND, either express or implied. See the License for the |
| | | # specific language governing permissions and limitations |
| | | # under the License. |
| | | # ---------------------------------------------------------------------------- |
| | | |
| | | # ---------------------------------------------------------------------------- |
| | | # Apache Maven Wrapper startup batch script, version 3.3.2 |
| | | # |
| | | # Optional ENV vars |
| | | # ----------------- |
| | | # JAVA_HOME - location of a JDK home dir, required when download maven via java source |
| | | # MVNW_REPOURL - repo url base for downloading maven distribution |
| | | # MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
| | | # MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output |
| | | # ---------------------------------------------------------------------------- |
| | | |
| | | set -euf |
| | | [ "${MVNW_VERBOSE-}" != debug ] || set -x |
| | | |
| | | # OS specific support. |
| | | native_path() { printf %s\\n "$1"; } |
| | | case "$(uname)" in |
| | | CYGWIN* | MINGW*) |
| | | [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" |
| | | native_path() { cygpath --path --windows "$1"; } |
| | | ;; |
| | | esac |
| | | |
| | | # set JAVACMD and JAVACCMD |
| | | set_java_home() { |
| | | # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched |
| | | if [ -n "${JAVA_HOME-}" ]; then |
| | | if [ -x "$JAVA_HOME/jre/sh/java" ]; then |
| | | # IBM's JDK on AIX uses strange locations for the executables |
| | | JAVACMD="$JAVA_HOME/jre/sh/java" |
| | | JAVACCMD="$JAVA_HOME/jre/sh/javac" |
| | | else |
| | | JAVACMD="$JAVA_HOME/bin/java" |
| | | JAVACCMD="$JAVA_HOME/bin/javac" |
| | | |
| | | if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then |
| | | echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 |
| | | echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 |
| | | return 1 |
| | | fi |
| | | fi |
| | | else |
| | | JAVACMD="$( |
| | | 'set' +e |
| | | 'unset' -f command 2>/dev/null |
| | | 'command' -v java |
| | | )" || : |
| | | JAVACCMD="$( |
| | | 'set' +e |
| | | 'unset' -f command 2>/dev/null |
| | | 'command' -v javac |
| | | )" || : |
| | | |
| | | if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then |
| | | echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 |
| | | return 1 |
| | | fi |
| | | fi |
| | | } |
| | | |
| | | # hash string like Java String::hashCode |
| | | hash_string() { |
| | | str="${1:-}" h=0 |
| | | while [ -n "$str" ]; do |
| | | char="${str%"${str#?}"}" |
| | | h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) |
| | | str="${str#?}" |
| | | done |
| | | printf %x\\n $h |
| | | } |
| | | |
| | | verbose() { :; } |
| | | [ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } |
| | | |
| | | die() { |
| | | printf %s\\n "$1" >&2 |
| | | exit 1 |
| | | } |
| | | |
| | | trim() { |
| | | # MWRAPPER-139: |
| | | # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. |
| | | # Needed for removing poorly interpreted newline sequences when running in more |
| | | # exotic environments such as mingw bash on Windows. |
| | | printf "%s" "${1}" | tr -d '[:space:]' |
| | | } |
| | | |
| | | # parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties |
| | | while IFS="=" read -r key value; do |
| | | case "${key-}" in |
| | | distributionUrl) distributionUrl=$(trim "${value-}") ;; |
| | | distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; |
| | | esac |
| | | done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" |
| | | [ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties" |
| | | |
| | | case "${distributionUrl##*/}" in |
| | | maven-mvnd-*bin.*) |
| | | MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ |
| | | case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in |
| | | *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; |
| | | :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; |
| | | :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; |
| | | :Linux*x86_64*) distributionPlatform=linux-amd64 ;; |
| | | *) |
| | | echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 |
| | | distributionPlatform=linux-amd64 |
| | | ;; |
| | | esac |
| | | distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" |
| | | ;; |
| | | maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; |
| | | *) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; |
| | | esac |
| | | |
| | | # apply MVNW_REPOURL and calculate MAVEN_HOME |
| | | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
| | | [ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" |
| | | distributionUrlName="${distributionUrl##*/}" |
| | | distributionUrlNameMain="${distributionUrlName%.*}" |
| | | distributionUrlNameMain="${distributionUrlNameMain%-bin}" |
| | | MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" |
| | | MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" |
| | | |
| | | exec_maven() { |
| | | unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : |
| | | exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" |
| | | } |
| | | |
| | | if [ -d "$MAVEN_HOME" ]; then |
| | | verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
| | | exec_maven "$@" |
| | | fi |
| | | |
| | | case "${distributionUrl-}" in |
| | | *?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; |
| | | *) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; |
| | | esac |
| | | |
| | | # prepare tmp dir |
| | | if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then |
| | | clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } |
| | | trap clean HUP INT TERM EXIT |
| | | else |
| | | die "cannot create temp dir" |
| | | fi |
| | | |
| | | mkdir -p -- "${MAVEN_HOME%/*}" |
| | | |
| | | # Download and Install Apache Maven |
| | | verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
| | | verbose "Downloading from: $distributionUrl" |
| | | verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
| | | |
| | | # select .zip or .tar.gz |
| | | if ! command -v unzip >/dev/null; then |
| | | distributionUrl="${distributionUrl%.zip}.tar.gz" |
| | | distributionUrlName="${distributionUrl##*/}" |
| | | fi |
| | | |
| | | # verbose opt |
| | | __MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' |
| | | [ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v |
| | | |
| | | # normalize http auth |
| | | case "${MVNW_PASSWORD:+has-password}" in |
| | | '') MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
| | | has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
| | | esac |
| | | |
| | | if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then |
| | | verbose "Found wget ... using wget" |
| | | wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" |
| | | elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then |
| | | verbose "Found curl ... using curl" |
| | | curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" |
| | | elif set_java_home; then |
| | | verbose "Falling back to use Java to download" |
| | | javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" |
| | | targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" |
| | | cat >"$javaSource" <<-END |
| | | public class Downloader extends java.net.Authenticator |
| | | { |
| | | protected java.net.PasswordAuthentication getPasswordAuthentication() |
| | | { |
| | | return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); |
| | | } |
| | | public static void main( String[] args ) throws Exception |
| | | { |
| | | setDefault( new Downloader() ); |
| | | java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); |
| | | } |
| | | } |
| | | END |
| | | # For Cygwin/MinGW, switch paths to Windows format before running javac and java |
| | | verbose " - Compiling Downloader.java ..." |
| | | "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" |
| | | verbose " - Running Downloader.java ..." |
| | | "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" |
| | | fi |
| | | |
| | | # If specified, validate the SHA-256 sum of the Maven distribution zip file |
| | | if [ -n "${distributionSha256Sum-}" ]; then |
| | | distributionSha256Result=false |
| | | if [ "$MVN_CMD" = mvnd.sh ]; then |
| | | echo "Checksum validation is not supported for maven-mvnd." >&2 |
| | | echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
| | | exit 1 |
| | | elif command -v sha256sum >/dev/null; then |
| | | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then |
| | | distributionSha256Result=true |
| | | fi |
| | | elif command -v shasum >/dev/null; then |
| | | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then |
| | | distributionSha256Result=true |
| | | fi |
| | | else |
| | | echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 |
| | | echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
| | | exit 1 |
| | | fi |
| | | if [ $distributionSha256Result = false ]; then |
| | | echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 |
| | | echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 |
| | | exit 1 |
| | | fi |
| | | fi |
| | | |
| | | # unzip and move |
| | | if command -v unzip >/dev/null; then |
| | | unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" |
| | | else |
| | | tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" |
| | | fi |
| | | printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" |
| | | mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" |
| | | |
| | | clean || : |
| | | exec_maven "$@" |
New file |
| | |
| | | <# : batch portion |
| | | @REM ---------------------------------------------------------------------------- |
| | | @REM Licensed to the Apache Software Foundation (ASF) under one |
| | | @REM or more contributor license agreements. See the NOTICE file |
| | | @REM distributed with this work for additional information |
| | | @REM regarding copyright ownership. The ASF licenses this file |
| | | @REM to you under the Apache License, Version 2.0 (the |
| | | @REM "License"); you may not use this file except in compliance |
| | | @REM with the License. You may obtain a copy of the License at |
| | | @REM |
| | | @REM http://www.apache.org/licenses/LICENSE-2.0 |
| | | @REM |
| | | @REM Unless required by applicable law or agreed to in writing, |
| | | @REM software distributed under the License is distributed on an |
| | | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| | | @REM KIND, either express or implied. See the License for the |
| | | @REM specific language governing permissions and limitations |
| | | @REM under the License. |
| | | @REM ---------------------------------------------------------------------------- |
| | | |
| | | @REM ---------------------------------------------------------------------------- |
| | | @REM Apache Maven Wrapper startup batch script, version 3.3.2 |
| | | @REM |
| | | @REM Optional ENV vars |
| | | @REM MVNW_REPOURL - repo url base for downloading maven distribution |
| | | @REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
| | | @REM MVNW_VERBOSE - true: enable verbose log; others: silence the output |
| | | @REM ---------------------------------------------------------------------------- |
| | | |
| | | @IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) |
| | | @SET __MVNW_CMD__= |
| | | @SET __MVNW_ERROR__= |
| | | @SET __MVNW_PSMODULEP_SAVE=%PSModulePath% |
| | | @SET PSModulePath= |
| | | @FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( |
| | | IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) |
| | | ) |
| | | @SET PSModulePath=%__MVNW_PSMODULEP_SAVE% |
| | | @SET __MVNW_PSMODULEP_SAVE= |
| | | @SET __MVNW_ARG0_NAME__= |
| | | @SET MVNW_USERNAME= |
| | | @SET MVNW_PASSWORD= |
| | | @IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*) |
| | | @echo Cannot start maven from wrapper >&2 && exit /b 1 |
| | | @GOTO :EOF |
| | | : end batch / begin powershell #> |
| | | |
| | | $ErrorActionPreference = "Stop" |
| | | if ($env:MVNW_VERBOSE -eq "true") { |
| | | $VerbosePreference = "Continue" |
| | | } |
| | | |
| | | # calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties |
| | | $distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl |
| | | if (!$distributionUrl) { |
| | | Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" |
| | | } |
| | | |
| | | switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { |
| | | "maven-mvnd-*" { |
| | | $USE_MVND = $true |
| | | $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" |
| | | $MVN_CMD = "mvnd.cmd" |
| | | break |
| | | } |
| | | default { |
| | | $USE_MVND = $false |
| | | $MVN_CMD = $script -replace '^mvnw','mvn' |
| | | break |
| | | } |
| | | } |
| | | |
| | | # apply MVNW_REPOURL and calculate MAVEN_HOME |
| | | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
| | | if ($env:MVNW_REPOURL) { |
| | | $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" } |
| | | $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')" |
| | | } |
| | | $distributionUrlName = $distributionUrl -replace '^.*/','' |
| | | $distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' |
| | | $MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" |
| | | if ($env:MAVEN_USER_HOME) { |
| | | $MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain" |
| | | } |
| | | $MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' |
| | | $MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" |
| | | |
| | | if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { |
| | | Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
| | | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
| | | exit $? |
| | | } |
| | | |
| | | if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { |
| | | Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" |
| | | } |
| | | |
| | | # prepare tmp dir |
| | | $TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile |
| | | $TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" |
| | | $TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null |
| | | trap { |
| | | if ($TMP_DOWNLOAD_DIR.Exists) { |
| | | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
| | | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
| | | } |
| | | } |
| | | |
| | | New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null |
| | | |
| | | # Download and Install Apache Maven |
| | | Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
| | | Write-Verbose "Downloading from: $distributionUrl" |
| | | Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
| | | |
| | | $webclient = New-Object System.Net.WebClient |
| | | if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { |
| | | $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) |
| | | } |
| | | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 |
| | | $webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null |
| | | |
| | | # If specified, validate the SHA-256 sum of the Maven distribution zip file |
| | | $distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum |
| | | if ($distributionSha256Sum) { |
| | | if ($USE_MVND) { |
| | | Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." |
| | | } |
| | | Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash |
| | | if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { |
| | | Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." |
| | | } |
| | | } |
| | | |
| | | # unzip and move |
| | | Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null |
| | | Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null |
| | | try { |
| | | Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null |
| | | } catch { |
| | | if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { |
| | | Write-Error "fail to move MAVEN_HOME" |
| | | } |
| | | } finally { |
| | | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
| | | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
| | | } |
| | | |
| | | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <parent> |
| | | <artifactId>pipIrr-mw</artifactId> |
| | | <groupId>com.dy</groupId> |
| | | <version>1.0.0</version> |
| | | <relativePath>../pom.xml</relativePath> |
| | | </parent> |
| | | |
| | | <packaging>jar</packaging> |
| | | <artifactId>pipIrr-mw-simulate-rtu</artifactId> |
| | | <version>1.0.0</version> |
| | | <name>pipIrr-mw-simulate-rtu</name> |
| | | <description>RTU模æå¨ï¼æ¨¡æRTU软件è¿ç¨å级ç</description> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-json</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-logging</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <!-- 卿å è½½æ°ç¼è¯çç±» --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-devtools</artifactId> |
| | | <scope>runtime</scope> |
| | | </dependency> |
| | | |
| | | |
| | | <!-- apache mina --> |
| | | <dependency> |
| | | <groupId>org.apache.mina</groupId> |
| | | <artifactId>mina-core</artifactId> |
| | | <version>2.2.2</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-api</artifactId> |
| | | <version>2.0.7</version> |
| | | </dependency> |
| | | |
| | | <!-- æµè¯ --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <!-- çæä¸å
å«ä¾èµjarç坿§è¡jarå
|
| | | <plugin> |
| | | !- spring bootæä¾çmavenæå
æä»¶ - |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | !- |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | - |
| | | <configuration> |
| | | !- ä¸å çè¯æç»å
å为: ${artifactId}-${version}.jar, å äºçè¯æç»å
å: ${artifactId}-${version}-${classifier}.jar - |
| | | <classifier>execute</classifier> |
| | | !- 䏿å®çæè·¯å¾çè¯, é»è®¤ä¿åå¨ ${build.directory} ä¸ - |
| | | <outputDirectory>${project.build.directory}/execute</outputDirectory> |
| | | <finalName>${artifactId}-${version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | |
| | | </plugin> |
| | | --> |
| | | <!-- æ·è´ä¾èµçjarå
å°libç®å½--> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | <configuration> |
| | | <!-- ä¸å çè¯æç»å
å为: ${artifactId}-${version}.jar, å äºçè¯æç»å
å: ${artifactId}-${version}-${classifier}.jar |
| | | <classifier>execute</classifier> |
| | | --> |
| | | <!-- ${project.build.directory}æ¯mavenåéï¼å
ç½®çï¼è¡¨ç¤ºtargetç®å½,妿ä¸åï¼å°å¨æ ¹ç®å½ä¸å建/lib --> |
| | | <outputDirectory>${project.build.directory}/lib</outputDirectory> |
| | | <!-- excludeTransitive:æ¯å¦ä¸å
å«é´æ¥ä¾èµå
ï¼æ¯å¦æä»¬ä¾èµAï¼ä½æ¯Aåä¾èµäºBï¼æä»¬æ¯å¦ä¹è¦æBæè¿å» é»è®¤ä¸æ--> |
| | | <excludeTransitive>false</excludeTransitive> |
| | | <!-- å¤å¶çjaræä»¶å»æçæ¬ä¿¡æ¯ --> |
| | | <stripVersion>false</stripVersion> |
| | | <finalName>${project.artifactId}-${project.version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.rtuMw.PipIrrMwAcceptApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | |
| | | <plugin> |
| | | <!-- 设置javaç¼è¯çæ¬ï¼è¿è¡ç¯å¢çæ¬ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <!-- sourceï¼ æºä»£ç ç¼è¯çæ¬ï¼targetï¼ ç®æ å¹³å°ç¼è¯çæ¬ï¼encodingï¼ å符éç¼ç ã --> |
| | | <configuration> |
| | | <source>${java.version}</source> |
| | | <target>${java.version}</target> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- è§£å³èµæºæä»¶çç¼ç é®é¢ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-resources-plugin</artifactId> |
| | | <configuration> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- mavenéæ§è¡æµè¯ç¨ä¾çæä»¶ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-surefire-plugin</artifactId> |
| | | <configuration> |
| | | <skipTests>true</skipTests> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- ä¸é¢è§£å³ï¼å½è¿è¡Maven Lifecycle packageæ¶æ¥éï¼Could not find artifact org.apache.mina:mina-core:bundle:2.2.1 in maven (https://repo1.maven.org/maven2/)--> |
| | | <groupId>org.apache.felix</groupId> |
| | | <artifactId>maven-bundle-plugin</artifactId> |
| | | <extensions>true</extensions> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | </project> |
New file |
| | |
| | | package com.dy.simRtu; |
| | | |
| | | |
| | | import com.dy.simRtu.tcpClient.TcpClUnitAdapter; |
| | | import com.dy.simRtu.tcpClient.TcpClUnitConfigVo; |
| | | |
| | | public class AdapterImp_TcpClUnit implements TcpClUnitAdapter { |
| | | |
| | | private TcpClUnitConfigVo configVo ; |
| | | |
| | | public TcpClUnitConfigVo getConfig() { |
| | | return configVo; |
| | | } |
| | | |
| | | public void setConfig(TcpClUnitConfigVo configVo){ |
| | | this.configVo = configVo ; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.simRtu; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.CommandLineRunner; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.WebApplicationType; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
| | | import org.springframework.boot.builder.SpringApplicationBuilder; |
| | | import org.springframework.context.annotation.ComponentScan; |
| | | import org.springframework.context.annotation.FilterType; |
| | | |
| | | |
| | | @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) //ç¦æ¢å¯å¨æ°æ®åºè¿æ¥æ± |
| | | @ComponentScan(basePackages = {"com.dy.common", "com.dy.pipIrrGlobal", "com.dy.simRtu"}, |
| | | excludeFilters = { |
| | | @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = { |
| | | com.dy.common.apiDoc.SpringApiConfig.class, //ä¸ç§æé¤ç±»çæ¹å¼ |
| | | com.dy.pipIrrGlobal.config.DingTalk.class |
| | | }), |
| | | @ComponentScan.Filter(type = FilterType.REGEX, pattern = { |
| | | //äºç§æé¤ç±»çæ¹å¼ï¼åæ£å表达å¼ï¼éè¦å¯¹ç®æ ç±»çå®å
¨éå®åå®å
¨å¹é
ï¼å¦åä¸çæ |
| | | "com.dy.common.aop..*", |
| | | "com.dy.common.apiDoc..*", |
| | | "com.dy.common.multiDataSource..*", |
| | | "com.dy.common.mybatis..*", |
| | | "com.dy.common.singleDataSource..*", |
| | | "com.dy.common.webFilter..*", |
| | | "com.dy.common.webListener..*", |
| | | "com.dy.pipIrrGlobal.webCtrls..*" |
| | | }) |
| | | } |
| | | ) |
| | | public class PipIrrMwSimulateRtuApplication implements CommandLineRunner { |
| | | |
| | | public static void main(String[] args) { |
| | | new SpringApplicationBuilder(PipIrrMwSimulateRtuApplication.class) |
| | | .web(WebApplicationType.NONE)//ä¸å¯å¨webæå¡ |
| | | .run(args); |
| | | } |
| | | |
| | | /** |
| | | * Spring容å¨å¯å¨å®æåï¼æ§è¡ä¸é¢æ¹æ³ |
| | | * @param args åæ° |
| | | * @throws Exception å¼å¸¸ |
| | | */ |
| | | @Override |
| | | public void run(String... args) throws Exception { |
| | | try{ |
| | | //çå¾
ä¸ä¸ |
| | | Thread.sleep(500L); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | finally { |
| | | this.startMwSv() ; |
| | | } |
| | | } |
| | | |
| | | private void startMwSv(){ |
| | | if(sv != null){ |
| | | sv.startServer(); |
| | | } |
| | | } |
| | | |
| | | |
| | | private Server sv ; |
| | | |
| | | @Autowired |
| | | public void setSv(Server sv){ |
| | | this.sv = sv ; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.simRtu; |
| | | |
| | | import com.dy.common.mw.UnitInterface; |
| | | import com.dy.common.util.ConfigXml4Springboot; |
| | | import com.dy.simRtu.tcpClient.TcpClUnit; |
| | | import com.dy.simRtu.tcpClient.TcpClUnitConfigVo; |
| | | import org.jdom2.Document; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.core.io.ResourceLoader; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/11/18 9:54 |
| | | * @Description |
| | | */ |
| | | @Component |
| | | public class Server { |
| | | @Autowired |
| | | protected ResourceLoader resourceLoader ; |
| | | |
| | | private ConfigXml4Springboot conf = null ; |
| | | private Document doc = null ; |
| | | private boolean showStartInfo = false ; |
| | | |
| | | private String mwServerUrl ; |
| | | |
| | | private List<UnitInterface> units = new ArrayList<UnitInterface>() ; |
| | | |
| | | /** |
| | | * å¯å¨æå¡ |
| | | */ |
| | | public void startServer() { |
| | | long start = System.currentTimeMillis(); |
| | | try { |
| | | this.conf = new ConfigXml4Springboot() ; |
| | | this.doc = this.conf.createDom(resourceLoader, "config.xml") ; |
| | | //////////////// |
| | | //æå¡ é
ç½® |
| | | this.showStartInfo = this.conf.getSetAttrBoolean(this.doc, "config.server", "showStartInfo", null, null) ; |
| | | |
| | | this.startUnits() ; |
| | | |
| | | String svName ; |
| | | try{ |
| | | svName = this.conf.getSetAttrTxt(this.doc, "config.server", "name", null, false, null) ; |
| | | }catch(Exception e){ |
| | | svName = "" ; |
| | | } |
| | | |
| | | String company ; |
| | | try{ |
| | | company = this.conf.getSetAttrTxt(this.doc, "config.server", "company", null, true, null) ; |
| | | }catch(Exception e){ |
| | | company = "" ; |
| | | } |
| | | System.out.println("OOOOOOOOOO OOOOOOOO OOOOOOOO") ; |
| | | System.out.println("@@@@@@@@@@@@@@@@#O $@@@@@@@@& @@@@@@@@#") ; |
| | | System.out.println("@@@@@@@@@@@@@@@@@@@# @@@@@@@@# $@@@@@@@@&") ; |
| | | System.out.println("@@@@@@@@@@@@@@@@@@@@@# #@@@@@@@@@@@@@@@@O") ; |
| | | System.out.println("@@@@@@@@@@@@@@@@@@@@@@@ &@@@@@@@@@@@@@@") ; |
| | | System.out.println("@@@@@@$ $@@@@@@@@@& O@@@@@@@@@@@#") ; |
| | | System.out.println("@@@@@@$ @@@@@@@@@ @@@@@@@@@& " + svName ) ; |
| | | System.out.println("@@@@@@$ O@@@@@@@@@ &@@@@@@@@") ; |
| | | |
| | | if(this.mwServerUrl != null){ |
| | | System.out.println("@@@@@@$ O@@@@@@@@@ &@@@@@@@@ è¿ç¨ä¸é´ä»¶æå¡ " + this.mwServerUrl ) ; |
| | | }else{ |
| | | System.out.println("@@@@@@$ O@@@@@@@@@ &@@@@@@@@") ; |
| | | } |
| | | System.out.println("@@@@@@$ #@@@@@@@@@$ &@@@@@@@@ æ¬RTU模æå°å " + ServerProperties.rtuAddr ) ; |
| | | System.out.println("@@@@@@@@@@@@@@@@@@@@@@# &@@@@@@@@ Runing in standalone mode" ) ; |
| | | System.out.println("@@@@@@@@@@@@@@@@@@@@@& &@@@@@@@@ Startup in " + (System.currentTimeMillis() - start) + " MS" ) ; |
| | | System.out.println("@@@@@@@@@@@@@@@@@@@# &@@@@@@@@ " + company) ; |
| | | System.out.println("@@@@@@@@@@@@@@@@#O &@@@@@@@@") ; |
| | | |
| | | }catch(Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | private void startUnits() { |
| | | try { |
| | | |
| | | // /////////////// |
| | | // åºç¡é
ç½® |
| | | ServerProperties.rtuAddr = conf.getSetAttrTxt(doc, "config.base", "rtuAddr", null, false, null); |
| | | |
| | | // /////////////// |
| | | // TCP 模å |
| | | TcpClUnitConfigVo tcpVo = new TcpClUnitConfigVo(); |
| | | tcpVo.mwServerIp = conf.getSetAttrTxt(doc, "config.tcpCl", "mwServerIp", null, false, null); |
| | | tcpVo.mwServerPort = conf.getSetAttrPlusInt(doc, "config.tcpCl", "mwServerPort", null, 100, 65535, null); |
| | | tcpVo.connectTimeout = conf.getSetAttrPlusInt(doc, "config.tcpCl", "connectTimeout", null, 1000, 10000, null); |
| | | this.mwServerUrl = tcpVo.mwServerIp + ":" + tcpVo.mwServerPort ; |
| | | AdapterImp_TcpClUnit tcpAdap = new AdapterImp_TcpClUnit(); |
| | | tcpAdap.setConfig(tcpVo); |
| | | TcpClUnit tcpUnit = TcpClUnit.getInstance(); |
| | | tcpUnit.setAdapter(tcpAdap); |
| | | tcpUnit.start(obj -> { |
| | | }); |
| | | units.add(tcpUnit) ; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.simRtu; |
| | | |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/11/18 9:53 |
| | | * @Description |
| | | */ |
| | | public class ServerProperties { |
| | | |
| | | public static String rtuAddr ; |
| | | } |
New file |
| | |
| | | package com.dy.simRtu.tcpClient; |
| | | |
| | | import org.apache.mina.core.session.IoSession; |
| | | import org.apache.mina.filter.codec.ProtocolCodecFactory; |
| | | import org.apache.mina.filter.codec.ProtocolDecoder; |
| | | import org.apache.mina.filter.codec.ProtocolEncoder; |
| | | |
| | | public class LocalCodecFactory implements ProtocolCodecFactory { |
| | | private ProtocolEncoder encoder; |
| | | private ProtocolDecoder decoder; |
| | | |
| | | public LocalCodecFactory() { |
| | | encoder = new LocalEncoder(); |
| | | decoder = new LocalDecoder(); |
| | | } |
| | | |
| | | /** |
| | | * å¾å°åè®®ç¼ç å¨ |
| | | * @param ioSession ç½ç»ä¼è¯ |
| | | * @return åè®®ç¼ç å¨ |
| | | */ |
| | | @Override |
| | | public ProtocolEncoder getEncoder(IoSession ioSession) { |
| | | return encoder; |
| | | } |
| | | /** |
| | | * å¾å°å议解ç å¨ |
| | | * @param ioSession ç½ç»ä¼è¯ |
| | | * @return å议解ç å¨ |
| | | */ |
| | | @Override |
| | | public ProtocolDecoder getDecoder(IoSession ioSession) { |
| | | return decoder; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.simRtu.tcpClient; |
| | | |
| | | import com.dy.common.util.ByteUtil; |
| | | import com.dy.simRtu.tcpClient.downData.DownData; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | import org.apache.mina.core.buffer.IoBuffer; |
| | | import org.apache.mina.core.session.IoSession; |
| | | import org.apache.mina.filter.codec.CumulativeProtocolDecoder; |
| | | import org.apache.mina.filter.codec.ProtocolDecoderOutput; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | public class LocalDecoder extends CumulativeProtocolDecoder { |
| | | |
| | | private static final Logger log = LogManager.getLogger(LocalDecoder.class) ; |
| | | |
| | | private static final String DECODER_STATE_KEY = LocalDecoder.class.getName() + ".STATE"; |
| | | |
| | | public static final int MAX_SIZE = 2147483647 ; |
| | | |
| | | |
| | | /** |
| | | * 对ç½ç»ä¼ è¾æ¥çæ°æ®è¿è¡è§£ç |
| | | */ |
| | | protected boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws IOException, Exception{ |
| | | int remain = in.remaining() ; |
| | | if(remain > 0){ |
| | | byte[] bs = new byte[remain]; |
| | | in.get(bs) ; |
| | | in.position(0) ; |
| | | log.info("æ¶å°ä¸é´ä»¶ä¸è¡æ°æ®ï¼" + ByteUtil.bytes2Hex(bs, true)); |
| | | new DownData().parseData(bs); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.simRtu.tcpClient; |
| | | |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | import org.apache.mina.core.buffer.IoBuffer; |
| | | import org.apache.mina.core.session.IoSession; |
| | | import org.apache.mina.filter.codec.ProtocolEncoderAdapter; |
| | | import org.apache.mina.filter.codec.ProtocolEncoderOutput; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | public class LocalEncoder extends ProtocolEncoderAdapter { |
| | | |
| | | private static final Logger log = LogManager.getLogger(LocalEncoder.class) ; |
| | | |
| | | /** |
| | | * å¯¹æ°æ®è¿è¡ç¼ç ï¼ä»¥å¤ç½ç»ä¼ è¾ |
| | | */ |
| | | public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws IOException, Exception{ |
| | | byte[] data = (byte[])message; |
| | | //log.info("ä¸è¡æ°æ®ï¼" + ByteUtil.bytes2Hex(data, true)); |
| | | |
| | | out.write(IoBuffer.allocate((data==null?0:data.length), false).put(data).flip()); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.simRtu.tcpClient; |
| | | |
| | | import com.dy.common.mw.UnitAdapterInterface; |
| | | import com.dy.common.mw.UnitCallbackInterface; |
| | | import com.dy.common.mw.UnitInterface; |
| | | import com.dy.common.util.Callback; |
| | | import com.dy.simRtu.ServerProperties; |
| | | import com.dy.simRtu.tcpClient.upData.UpData; |
| | | import com.dy.simRtu.tcpClient.upData.UpHeartBeat; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | import org.apache.mina.core.session.IoSession; |
| | | |
| | | |
| | | public class TcpClUnit implements UnitInterface { |
| | | |
| | | private static final Logger log = LogManager.getLogger(TcpClUnit.class) ; |
| | | |
| | | private static TcpClUnit instance = new TcpClUnit() ; |
| | | |
| | | public static TcpClUnitAdapter adapter ; |
| | | public static TcpClUnitConfigVo confVo ; |
| | | |
| | | public static IoSession session ; |
| | | |
| | | private TcpClUnit(){} ; |
| | | |
| | | public static TcpClUnit getInstance(){ |
| | | return instance ; |
| | | } |
| | | |
| | | @Override |
| | | public void setAdapter(UnitAdapterInterface adapter) throws Exception { |
| | | if(adapter == null){ |
| | | throw new Exception("Tcp Client模åéé
å¨å¯¹è±¡ä¸è½ä¸ºç©ºï¼") ; |
| | | } |
| | | TcpClUnit.adapter = (TcpClUnitAdapter)adapter ; |
| | | TcpClUnit.confVo = TcpClUnit.adapter.getConfig() ; |
| | | if(TcpClUnit.confVo == null){ |
| | | throw new Exception("Tcp Client模åé
置对象ä¸è½ä¸ºç©ºï¼") ; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void start(UnitCallbackInterface callback) throws Exception { |
| | | System.out.println("Tcp Client模åæåå¯å¨"); |
| | | this.doStart(); |
| | | callback.call(null) ; |
| | | } |
| | | |
| | | @Override |
| | | public void stop(UnitCallbackInterface callback) throws Exception { |
| | | callback.call(null); |
| | | } |
| | | |
| | | private void doStart(){ |
| | | new Thread(() -> { |
| | | Exception ex ; |
| | | while(true){ |
| | | ex = null ; |
| | | try { |
| | | new TcpConnect().createSession( |
| | | confVo.mwServerIp, |
| | | confVo.mwServerPort, |
| | | confVo.connectTimeout, |
| | | new TcpHandler(), |
| | | new Callback() { |
| | | @Override |
| | | public void call(Object obj) { |
| | | if (obj == null) { |
| | | log.error("å建ç½ç»ä¼è¯è¿å为null"); |
| | | } else { |
| | | TcpClUnit.session = (IoSession) obj; |
| | | log.info("æåå建ä¸éä¿¡ä¸é´ä»¶çç½ç»è¿æ¥"); |
| | | UpData.setSession(TcpClUnit.session); |
| | | heartBeat() ; |
| | | } |
| | | } |
| | | @Override |
| | | public void call(Object... objs) { |
| | | } |
| | | @Override |
| | | public void exception(Exception e) { |
| | | } |
| | | }); |
| | | }catch (Exception e){ |
| | | ex = e ; |
| | | } |
| | | if(ex == null){ |
| | | break ; |
| | | }else{ |
| | | try{ |
| | | Thread.sleep(100); |
| | | }catch (Exception e){ |
| | | } |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | |
| | | |
| | | private void heartBeat(){ |
| | | new Thread(new Runnable(){ |
| | | @Override |
| | | public void run() { |
| | | while(true){ |
| | | try { |
| | | UpHeartBeat.upCd02Data(ServerProperties.rtuAddr); |
| | | Thread.sleep(30000L); |
| | | //Thread.sleep(30000000L); |
| | | }catch (Exception e){ |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.simRtu.tcpClient; |
| | | |
| | | import com.dy.common.mw.UnitAdapterInterface; |
| | | |
| | | public interface TcpClUnitAdapter extends UnitAdapterInterface { |
| | | |
| | | TcpClUnitConfigVo getConfig() ; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.simRtu.tcpClient; |
| | | |
| | | public class TcpClUnitConfigVo { |
| | | public String mwServerIp ; |
| | | public Integer mwServerPort ; |
| | | public Integer connectTimeout ; |
| | | } |
New file |
| | |
| | | package com.dy.simRtu.tcpClient; |
| | | |
| | | import com.dy.common.util.Callback; |
| | | import org.apache.mina.core.future.ConnectFuture; |
| | | import org.apache.mina.core.session.IoSession; |
| | | import org.apache.mina.filter.codec.ProtocolCodecFilter; |
| | | import org.apache.mina.transport.socket.SocketConnector; |
| | | import org.apache.mina.transport.socket.nio.NioSocketConnector; |
| | | |
| | | import java.net.InetSocketAddress; |
| | | |
| | | public class TcpConnect { |
| | | |
| | | /** |
| | | * 夿ä¼è¯æ¯å¦ææ |
| | | * @param se ç½ç»ä¼è¯ |
| | | * @return æ¯å¦è¿æ¥ |
| | | */ |
| | | public boolean isConnected(IoSession se) { |
| | | return (se != null && se.isConnected()); |
| | | } |
| | | |
| | | /** |
| | | * å建æ°ä¼è¯ |
| | | * @param host æå¡å¨URI |
| | | * @param port æå¡å¨ç«¯å£ |
| | | * @param connectTimeout è¿æ¥è¶
æ¶æ¶é¿ |
| | | * @param handler æ°æ®å¤çè
|
| | | * @param callback åè° |
| | | * @return ç½ç»ä¼è¯ |
| | | */ |
| | | public void createSession(String host , |
| | | int port , |
| | | int connectTimeout , |
| | | TcpHandler handler, |
| | | Callback callback) throws Exception{ |
| | | SocketConnector connector = new NioSocketConnector(); |
| | | connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(new LocalCodecFactory())); |
| | | connector.setHandler(handler); |
| | | ConnectFuture connectFuture = connector.connect(new InetSocketAddress(host, port)); |
| | | connectFuture.awaitUninterruptibly(connectTimeout); |
| | | IoSession se = connectFuture.getSession(); |
| | | callback.call(se) ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å
³éä¼è¯èæ¥ |
| | | * @param se |
| | | * @param connectTimeout |
| | | */ |
| | | public void disconnect(IoSession se , int connectTimeout) { |
| | | if (se != null) { |
| | | try{ |
| | | se.closeNow().awaitUninterruptibly(connectTimeout); |
| | | }catch(Exception e){ |
| | | }finally{ |
| | | se = null; |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.simRtu.tcpClient; |
| | | |
| | | import com.dy.common.util.ByteUtil; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | import org.apache.mina.core.service.IoHandlerAdapter; |
| | | import org.apache.mina.core.session.IdleStatus; |
| | | import org.apache.mina.core.session.IoSession; |
| | | import org.apache.mina.filter.FilterEvent; |
| | | |
| | | public class TcpHandler extends IoHandlerAdapter { |
| | | |
| | | private static Logger log = LogManager.getLogger(TcpHandler.class.getName()) ; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void sessionCreated(IoSession session) throws Exception { |
| | | super.sessionCreated(session); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void sessionOpened(IoSession session) throws Exception { |
| | | super.sessionOpened(session); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void sessionClosed(IoSession session) throws Exception { |
| | | super.sessionClosed(session); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void sessionIdle(IoSession session, IdleStatus status) throws Exception { |
| | | super.sessionIdle(session, status); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void exceptionCaught(IoSession session, Throwable cause) throws Exception { |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void messageReceived(IoSession session, Object message) throws Exception { |
| | | if(message != null){ |
| | | byte[] bs = (byte[])message ; |
| | | log.info("æ¶å°ä¸é´ä»¶æ°æ®ï¼" + ByteUtil.bytes2Hex(bs, true)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void messageSent(IoSession session, Object message) throws Exception { |
| | | log.info("ç½ç»åéäºæ°æ®ï¼" |
| | | + (session==null?"":(session.getRemoteAddress() != null?("ä¸é´ä»¶ç½åæ¯ï¼" + session.getRemoteAddress().toString()):"")) ); |
| | | if(message != null){ |
| | | byte[] bs = (byte[])message ; |
| | | log.info("ç½ç»åéäºæ°æ®ï¼" + ByteUtil.bytes2Hex(bs, true)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void inputClosed(IoSession session) throws Exception { |
| | | session.closeNow(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void event(IoSession session, FilterEvent event) throws Exception { |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.simRtu.tcpClient.downData; |
| | | |
| | | import com.dy.common.mw.protocol.p206V1.ProtocolConstantV206V1; |
| | | import com.dy.common.util.ByteUtil; |
| | | import com.dy.simRtu.tcpClient.upData.*; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/11/18 10:57 |
| | | * @Description ä¸é´ä»¶çä¸è¡æ°æ® |
| | | */ |
| | | public class DownData { |
| | | |
| | | public void parseData(byte[] bs){ |
| | | if(bs != null && bs.length > 0){ |
| | | if(bs.length >= (ProtocolConstantV206V1.ctrlIndex) |
| | | && bs[0] == ProtocolConstantV206V1.P_Head_Byte |
| | | && bs[2] == ProtocolConstantV206V1.P_Head_Byte){ |
| | | this.dealP206V1(bs); |
| | | }else if(bs.length >= (ProtocolConstantV206V1.UG_codeIndex) |
| | | && bs[0] == ProtocolConstantV206V1.UG_P_Head_Byte |
| | | && bs[3] == ProtocolConstantV206V1.UG_P_Head_Byte){ |
| | | this.dealUpgrade(bs); |
| | | } |
| | | |
| | | } |
| | | } |
| | | private void dealP206V1(byte[] bs){ |
| | | //åºè¯¥æ¯é¾è·¯æ£æµæ°æ® |
| | | } |
| | | private void dealUpgrade(byte[] bs){ |
| | | String cdPre = ByteUtil.bytes2Hex(bs, false, ProtocolConstantV206V1.UG_codeIndex, 1); |
| | | if(cdPre.equals("16")){ |
| | | //å级åè½ç |
| | | UpHeartBeat.upHeartBeat = false ;//ä¸ä¸è¡å¿è·³ |
| | | 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")){ |
| | | //å级é
ç½® |
| | | UpCd9601.upData() ; |
| | | }else if(cd.equals("1602")){ |
| | | //åçº§æ°æ® |
| | | UpCd9602.upData() ; |
| | | }else if(cd.equals("1603")){ |
| | | //åçº§æ ¡éª |
| | | UpCd9603.upData() ; |
| | | }else if(cd.equals("1600")){ |
| | | //å级å¤ä½ |
| | | UpCd9600.upData() ; |
| | | UpHeartBeat.upHeartBeat = true ;//ä¸ä¸è¡å¿è·³ |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.simRtu.tcpClient.upData; |
| | | |
| | | import com.dy.common.mw.protocol.p206V1.parse.global.GlCreate; |
| | | import com.dy.common.util.ByteUtil; |
| | | import com.dy.simRtu.ServerProperties; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/11/18 11:26 |
| | | * @Description |
| | | */ |
| | | public class UpCd9600 extends UpData { |
| | | |
| | | private static final Logger log = LogManager.getLogger(UpCd9600.class); |
| | | |
| | | public static void upData() { |
| | | //æ ä¸è¡æ°æ® |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.simRtu.tcpClient.upData; |
| | | |
| | | import com.dy.common.mw.protocol.p206V1.parse.global.GlCreate; |
| | | import com.dy.common.util.ByteUtil; |
| | | import com.dy.simRtu.ServerProperties; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/11/18 11:26 |
| | | * @Description |
| | | */ |
| | | public class UpCd9601 extends UpData { |
| | | |
| | | private static final Logger log = LogManager.getLogger(UpCd9601.class); |
| | | |
| | | public static void upData() { |
| | | try { |
| | | if (UpData.session != null && UpData.session.isConnected()) { |
| | | byte[] bs = createData(ServerProperties.rtuAddr); |
| | | UpData.upSend(bs); |
| | | } else { |
| | | log.error("æªè¿æ¥éä¿¡ä¸é´ä»¶ï¼ä¸è½åéæ°æ®"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("åéä¿¡ä¸é´ä»¶åéæ°æ®äº§çå¼å¸¸", e); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æé æ°æ® |
| | | * |
| | | * @return åèæ°ç» |
| | | * @throws Exception å¼å¸¸ |
| | | */ |
| | | private static byte[] createData(String rtuAddr) throws Exception { |
| | | byte[] bytes = creatHead4Upgrade(rtuAddr, "96","01"); |
| | | |
| | | byte[] bs = new byte[1]; |
| | | bs[0] = (byte) 0x00;//00 æ£ç¡® ï¼0xXX é误 |
| | | bytes = ByteUtil.bytesMerge(bytes, bs); |
| | | |
| | | GlCreate.createLen4PUg(bytes);//é¿åº¦æ¾åèæ°ç»ä¸ |
| | | |
| | | byte[] bsTail = GlCreate.createCrcTail4Ug(bytes);//CRCåå°¾å å åèæ°ç»ä¸ |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bsTail); |
| | | |
| | | return bytes; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.simRtu.tcpClient.upData; |
| | | |
| | | import com.dy.common.mw.protocol.p206V1.parse.global.GlCreate; |
| | | import com.dy.common.util.ByteUtil; |
| | | import com.dy.simRtu.ServerProperties; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/11/18 11:26 |
| | | * @Description |
| | | */ |
| | | public class UpCd9602 extends UpData { |
| | | |
| | | private static final Logger log = LogManager.getLogger(UpCd9602.class); |
| | | |
| | | public static void upData() { |
| | | try { |
| | | if (UpData.session != null && UpData.session.isConnected()) { |
| | | byte[] bs = createData(ServerProperties.rtuAddr); |
| | | UpData.upSend(bs); |
| | | } else { |
| | | log.error("æªè¿æ¥éä¿¡ä¸é´ä»¶ï¼ä¸è½åéæ°æ®"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("åéä¿¡ä¸é´ä»¶åéæ°æ®äº§çå¼å¸¸", e); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æé æ°æ® |
| | | * |
| | | * @return åèæ°ç» |
| | | * @throws Exception å¼å¸¸ |
| | | */ |
| | | private static byte[] createData(String rtuAddr) throws Exception { |
| | | byte[] bytes = creatHead4Upgrade(rtuAddr, "96","02"); |
| | | |
| | | byte[] bs = new byte[1]; |
| | | bs[0] = (byte) 0x00;//00 æ£ç¡® ï¼0xXX é误 |
| | | bytes = ByteUtil.bytesMerge(bytes, bs); |
| | | |
| | | GlCreate.createLen4PUg(bytes);//é¿åº¦æ¾åèæ°ç»ä¸ |
| | | |
| | | byte[] bsTail = GlCreate.createCrcTail4Ug(bytes);//CRCåå°¾å å åèæ°ç»ä¸ |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bsTail); |
| | | |
| | | return bytes; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.simRtu.tcpClient.upData; |
| | | |
| | | import com.dy.common.mw.protocol.p206V1.parse.global.GlCreate; |
| | | import com.dy.common.util.ByteUtil; |
| | | import com.dy.simRtu.ServerProperties; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/11/18 11:26 |
| | | * @Description |
| | | */ |
| | | public class UpCd9603 extends UpData { |
| | | |
| | | private static final Logger log = LogManager.getLogger(UpCd9603.class); |
| | | |
| | | public static void upData() { |
| | | try { |
| | | if (UpData.session != null && UpData.session.isConnected()) { |
| | | byte[] bs = createData(ServerProperties.rtuAddr); |
| | | UpData.upSend(bs); |
| | | } else { |
| | | log.error("æªè¿æ¥éä¿¡ä¸é´ä»¶ï¼ä¸è½åéæ°æ®"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("åéä¿¡ä¸é´ä»¶åéæ°æ®äº§çå¼å¸¸", e); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æé æ°æ® |
| | | * |
| | | * @return åèæ°ç» |
| | | * @throws Exception å¼å¸¸ |
| | | */ |
| | | private static byte[] createData(String rtuAddr) throws Exception { |
| | | byte[] bytes = creatHead4Upgrade(rtuAddr, "96","03"); |
| | | |
| | | byte[] bs = new byte[1]; |
| | | bs[0] = (byte) 0x00;//00 æ£ç¡® ï¼0xXX é误 |
| | | bytes = ByteUtil.bytesMerge(bytes, bs); |
| | | |
| | | GlCreate.createLen4PUg(bytes);//é¿åº¦æ¾åèæ°ç»ä¸ |
| | | |
| | | byte[] bsTail = GlCreate.createCrcTail4Ug(bytes);//CRCåå°¾å å åèæ°ç»ä¸ |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bsTail); |
| | | |
| | | return bytes; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.simRtu.tcpClient.upData; |
| | | |
| | | import com.dy.common.mw.protocol.p206V1.ProtocolConstantV206V1; |
| | | import com.dy.common.mw.protocol.p206V1.parse.global.GlCreate; |
| | | import com.dy.common.util.ByteUtil; |
| | | import org.apache.mina.core.session.IoSession; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/7/15 14:20 |
| | | * @Description |
| | | */ |
| | | public class UpData { |
| | | |
| | | protected static IoSession session ; |
| | | |
| | | private static Object synObj = new Object() ; |
| | | |
| | | public static void setSession(IoSession session){ |
| | | UpData.session = session ; |
| | | } |
| | | |
| | | protected static void upSend(byte[] bs) throws Exception{ |
| | | synchronized (synObj){ |
| | | session.write(bs) ; |
| | | } |
| | | } |
| | | |
| | | protected static byte[] creatHead(String rtuAddr, String code, byte ctrl)throws Exception { |
| | | byte[] bsHead = new byte[ProtocolConstantV206V1.lenHead2Code] ; |
| | | byte index = 0 ; |
| | | bsHead[index] = ProtocolConstantV206V1.P_Head_Byte ; |
| | | |
| | | index++ ; |
| | | bsHead[index] = 0 ;//帧é¿åº¦ |
| | | |
| | | index++ ; |
| | | bsHead[index] = ProtocolConstantV206V1.P_Head_Byte ; |
| | | |
| | | index++ ; |
| | | bsHead[index] = ctrl; //æ§å¶ååè½ç |
| | | |
| | | index++ ; |
| | | GlCreate.createRtuAddr4P206(rtuAddr, bsHead, index); |
| | | index += 5 ; |
| | | |
| | | ByteUtil.hex2Bytes(code, bsHead, index) ; |
| | | |
| | | return bsHead ; |
| | | } |
| | | |
| | | protected static byte[] creatHead4Upgrade(String rtuAddr, String preCode, String sufCode)throws Exception { |
| | | byte[] bsHead = new byte[12] ; |
| | | byte index = 0 ; |
| | | bsHead[index] = ProtocolConstantV206V1.UG_P_Head_Byte ; |
| | | |
| | | index++ ; |
| | | bsHead[index] = 0 ;//帧é¿åº¦ |
| | | index++ ; |
| | | bsHead[index] = 0 ;//帧é¿åº¦ |
| | | |
| | | index++ ; |
| | | bsHead[index] = ProtocolConstantV206V1.UG_P_Head_Byte ; |
| | | |
| | | index++ ; |
| | | bsHead[index] = ByteUtil.hex2Bytes(preCode)[0]; //åè½ç å |
| | | |
| | | index++ ; |
| | | bsHead[index] = ByteUtil.hex2Bytes(sufCode)[0]; //åè½ç å |
| | | |
| | | index++ ; |
| | | GlCreate.createRtuAddr4P206(rtuAddr, bsHead, index); |
| | | |
| | | return bsHead ; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.simRtu.tcpClient.upData; |
| | | |
| | | import com.dy.common.mw.protocol.p206V1.parse.global.GlCreate; |
| | | import com.dy.common.util.ByteUtil; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/7/15 14:18 |
| | | * @Description |
| | | */ |
| | | public class UpHeartBeat extends UpData { |
| | | |
| | | private static final Logger log = LogManager.getLogger(UpHeartBeat.class) ; |
| | | |
| | | private static boolean isFirst = true ; |
| | | |
| | | public static boolean upHeartBeat = true ;//æ¯å¦å¯ä»¥åéå¿è·³ |
| | | |
| | | public static void upCd02Data(String rtuAddr){ |
| | | if(upHeartBeat){ |
| | | try{ |
| | | if(UpData.session != null && UpData.session.isConnected()){ |
| | | byte[] bs = createData(rtuAddr) ; |
| | | UpData.upSend(bs) ; |
| | | }else{ |
| | | log.error("æªè¿æ¥éä¿¡ä¸é´ä»¶ï¼ä¸è½åéæ°æ®"); |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("åéä¿¡ä¸é´ä»¶åéæ°æ®äº§çå¼å¸¸", e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æé å¿è·³æ°æ® |
| | | * @return åèæ°ç» |
| | | * @throws Exception å¼å¸¸ |
| | | */ |
| | | private static byte[] createData(String rtuAddr) throws Exception { |
| | | byte[] bytes = creatHead(rtuAddr, "02", (byte)0xB0); |
| | | |
| | | byte[] bs = new byte[1] ; |
| | | if(isFirst){ |
| | | isFirst = false ; |
| | | bs[0] = (byte)0xF0 ;//æ°æ®åï¼ 1 个åèï¼F0 ç»å½ï¼ F1 éåºç»å½ï¼F2 å¨çº¿ä¿æã |
| | | }else{ |
| | | bs[0] = (byte)0xF2 ;//æ°æ®åï¼ 1 个åèï¼F0 ç»å½ï¼ F1 éåºç»å½ï¼F2 å¨çº¿ä¿æã |
| | | } |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | GlCreate.createLen(bytes);//é¿åº¦æ¾åèæ°ç»ä¸ |
| | | |
| | | byte[] bsTail = GlCreate.createCrcTail4P206(bytes) ;//CRCåå°¾å å åèæ°ç»ä¸ |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bsTail) ; |
| | | |
| | | return bytes ; |
| | | } |
| | | } |
New file |
| | |
| | | logging: |
| | | charset: |
| | | console: UTF-8 |
| | | config: |
| | | classpath: log4j2.yml |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <config> |
| | | <server name="RTU模æå¨ï¼å级ï¼" showStartInfo="true" company="http://www.dyjs.com"/> |
| | | |
| | | <!-- |
| | | 532328000214 |
| | | 532328000215 |
| | | 532328000169 |
| | | 620201000030 |
| | | --> |
| | | <base rtuAddr="532328000214"></base> |
| | | <!-- --> |
| | | <tcpCl mwServerIp="192.168.40.132" mwServerPort="60000" connectTimeout="3000" /> |
| | | </config> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <Configuration status="OFF"> |
| | | <Appenders> |
| | | <Console name="Console" target="SYSTEM_OUT"> |
| | | <PatternLayout charset="GBK" pattern="%d %-5p [%t] (%F:%L) - %m%n%throwable"/> |
| | | </Console> |
| | | <RollingFile name="File" fileName="logs/simRtu.log" filePattern="logs/simRtu-%d{yyyyMMdd}-%i.log"> |
| | | <PatternLayout charset="UTF-8" pattern="%d %-5p [%t] (%class.%method:%L) - %m%n%throwable"/> |
| | | <Policies> |
| | | <TimeBasedTriggeringPolicy interval="7" /> |
| | | <SizeBasedTriggeringPolicy size="10MB"/> |
| | | </Policies> |
| | | <DefaultRolloverStrategy max="50" /> |
| | | </RollingFile> |
| | | </Appenders> |
| | | <Loggers> |
| | | <!-- |
| | | <Logger name="com.zhzc.jgTest" level="debug"> |
| | | <AppenderRef ref="Console"/> |
| | | </Logger> |
| | | <Logger name="org.jgroups" level="info"> |
| | | <AppenderRef ref="File"/> |
| | | </Logger> |
| | | --> |
| | | <!-- Rootä¸å个Loggeråæ¶èµ·ä½ç¨ --> |
| | | <Root level="info"> |
| | | <AppenderRef ref="Console"/> |
| | | <AppenderRef ref="File"/> |
| | | </Root> |
| | | </Loggers> |
| | | </Configuration> |
New file |
| | |
| | | package com.dy.simRtu; |
| | | |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | @SpringBootTest |
| | | class PipIrrMwSimulateRtuApplicationTests { |
| | | |
| | | @Test |
| | | void contextLoads() { |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | <modules> |
| | | <module>pipIrr-mw-rtu</module> |
| | | <module>pipIrr-mw-simulate-rtu</module> |
| | | <module>pipIrr-mwTest-server</module> |
| | | <module>pipIrr-mwTest-client</module> |
| | | </modules> |
| | |
| | | package com.dy.pipIrrMwTestRtu; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.CommandLineRunner; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | |
| | | "com.dy.common.mybatis..*", |
| | | "com.dy.common.singleDataSource..*", |
| | | "com.dy.common.webFilter..*", |
| | | "com.dy.common.webListener..*" |
| | | "com.dy.common.webListener..*", |
| | | "com.dy.pipIrrGlobal.webCtrls..*" |
| | | }) |
| | | } |
| | | ) |
| | |
| | | import com.dy.pipIrrMwTestRtu.tcpClient.TcpClUnitConfigVo; |
| | | import org.jdom2.Document; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.core.io.ResourceLoader; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | public class Server { |
| | | @Autowired |
| | | protected ResourceLoader resourceLoader ; |
| | | @Value("${server.port}") |
| | | private Integer webPort ; |
| | | @Value("${server.servlet.context-path}") |
| | | private String webContext ; |
| | | |
| | | private ConfigXml4Springboot conf = null ; |
| | | private Document doc = null ; |
| | |
| | | System.out.println("@@@@@@$ O@@@@@@@@@ &@@@@@@@@") ; |
| | | |
| | | if(this.mwServerUrl != null){ |
| | | System.out.println("@@@@@@$ O@@@@@@@@@ &@@@@@@@@ ä¸é´ä»¶æå¡ç«¯ " + this.mwServerUrl ) ; |
| | | System.out.println("@@@@@@$ O@@@@@@@@@ &@@@@@@@@ è¿ç¨ä¸é´ä»¶æå¡ç«¯ " + this.mwServerUrl ) ; |
| | | }else{ |
| | | System.out.println("@@@@@@$ O@@@@@@@@@ &@@@@@@@@") ; |
| | | } |
| | | System.out.println("@@@@@@$ #@@@@@@@@@$ &@@@@@@@@" ) ; |
| | | System.out.println("@@@@@@$ #@@@@@@@@@$ &@@@@@@@@ æ¬å°webæå¡ç«¯http://[ip]:" + this.webPort + this.webContext ) ; |
| | | System.out.println("@@@@@@@@@@@@@@@@@@@@@@# &@@@@@@@@ Runing in standalone mode" ) ; |
| | | System.out.println("@@@@@@@@@@@@@@@@@@@@@& &@@@@@@@@ Startup in " + (System.currentTimeMillis() - start) + " MS" ) ; |
| | | System.out.println("@@@@@@@@@@@@@@@@@@@# &@@@@@@@@ " + company) ; |
| | |
| | | } |
| | | |
| | | private void doStart(){ |
| | | new Thread(new Runnable(){ |
| | | @Override |
| | | public void run() { |
| | | Exception ex = null ; |
| | | while(true){ |
| | | ex = null ; |
| | | try { |
| | | new TcpConnect().createSession( |
| | | confVo.mwServerIp, |
| | | confVo.mwServerPort, |
| | | confVo.connectTimeout, |
| | | new TcpHandler(), |
| | | new Callback() { |
| | | @Override |
| | | public void call(Object obj) { |
| | | if (obj == null) { |
| | | log.error("å建ç½ç»ä¼è¯è¿å为null"); |
| | | } else { |
| | | TcpClUnit.session = (IoSession) obj; |
| | | log.info("æåå建ä¸éä¿¡ä¸é´ä»¶çç½ç»è¿æ¥"); |
| | | UpData.setSession(TcpClUnit.session); |
| | | heartBeat() ; |
| | | } |
| | | new Thread(() -> { |
| | | Exception ex ; |
| | | while(true){ |
| | | ex = null ; |
| | | try { |
| | | new TcpConnect().createSession( |
| | | confVo.mwServerIp, |
| | | confVo.mwServerPort, |
| | | confVo.connectTimeout, |
| | | new TcpHandler(), |
| | | new Callback() { |
| | | @Override |
| | | public void call(Object obj) { |
| | | if (obj == null) { |
| | | log.error("å建ç½ç»ä¼è¯è¿å为null"); |
| | | } else { |
| | | TcpClUnit.session = (IoSession) obj; |
| | | log.info("æåå建ä¸éä¿¡ä¸é´ä»¶çç½ç»è¿æ¥"); |
| | | UpData.setSession(TcpClUnit.session); |
| | | heartBeat() ; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void call(Object... objs) { |
| | | } |
| | | @Override |
| | | public void call(Object... objs) { |
| | | } |
| | | |
| | | @Override |
| | | public void exception(Exception e) { |
| | | } |
| | | }); |
| | | @Override |
| | | public void exception(Exception e) { |
| | | } |
| | | }); |
| | | }catch (Exception e){ |
| | | ex = e ; |
| | | } |
| | | if(ex == null){ |
| | | break ; |
| | | }else{ |
| | | try{ |
| | | Thread.sleep(100); |
| | | }catch (Exception e){ |
| | | ex = e ; |
| | | } |
| | | if(ex == null){ |
| | | break ; |
| | | }else{ |
| | | try{ |
| | | Thread.sleep(100); |
| | | }catch (Exception e){ |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <config> |
| | | <server name="RTU模æå¨" showStartInfo="true" company="http://www.dyjs.com"/> |
| | | <server name="RTUå级模æå¨" showStartInfo="true" company="http://www.dyjs.com"/> |
| | | |
| | | <base rtuAddr="532328059995" onlyOneHeartBeat="true" icCardAddr="3B7D1E1A" icCardNo="61181622830147821"></base> |
| | | <!-- --> |
| | |
| | | RTU模æå¨ |
| | | RTU模æå¨ï¼å
¶å®ç°Restfullæ¥å£ï¼ç±web端è°ç¨è§¦å使å
¶æ¨¡æRTU䏿¥æå®çåè½ç æ°æ® |
| | |
| | | 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; |
| | |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | 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(); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | <packaging>jar</packaging> |
| | | <artifactId>pipIrr-web-app</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <name>pipIrr-web-app</name> |
| | | <description>ææºApp</description> |
| | | |
| | | |
| | | <build> |
| | | <plugins> |
| | |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class QoIssueReport extends QueryConditionVo { |
| | | /** |
| | | * å·¡æ£åID |
| | |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class QoWorkOrder extends QueryConditionVo { |
| | | /** |
| | | * æ´¾å人å§å |
| | |
| | | import com.dy.pipIrrGlobal.util.TypeConversionEnum; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.Mapping; |
| | | import org.mapstruct.ReportingPolicy; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | @Mapper(uses = {TypeConversionEnum.class}) |
| | | @Mapper(uses = {TypeConversionEnum.class}, unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface DistrictVoMapper { |
| | | DistrictVoMapper INSTANCT = Mappers.getMapper(DistrictVoMapper.class); |
| | | /** |
| | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.softUpgrade.parse.HexFileParse; |
| | | import com.dy.common.softUpgrade.parse.HexFileVo; |
| | | import com.dy.common.util.ByteUtil; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | if(vo.storeRamAddr == null |
| | | || vo.storeRamAddr.trim().equals("") |
| | | || vo.storeRamAddr.length() != 8 |
| | | || !HexUtil.isHexNumber(vo.storeRamAddr)){ |
| | | return BaseResponseUtils.buildFail("å级ç¨åºåæ¾å°å(4åèï¼8ä½åå
è¿å¶æ°)䏿£ç¡®") ; |
| | | } |
| | | if(vo.startRamAddr == null |
| | | || vo.startRamAddr.trim().equals("") |
| | | || vo.startRamAddr.length() != 8 |
| | | || !HexUtil.isHexNumber(vo.startRamAddr)){ |
| | | return BaseResponseUtils.buildFail("ç¨åºè¦çèµ·å§å°å(4åèï¼8ä½åå
è¿å¶æ°)䏿£ç¡®") ; |
| | | } |
| | | if(vo.file == null){ |
| | | return BaseResponseUtils.buildFail("RTUç¨åºæä»¶å¿
é¡»ä¸ä¼ ") ; |
| | | } |
| | |
| | | } |
| | | count = this.sv.execute(id); |
| | | } catch (Exception e) { |
| | | log.error("ç»æRTUå级任å¡å¼å¸¸", e); |
| | | log.error("æ§è¡RTUå级任å¡å¼å¸¸", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | if(count <= 0){ |
| | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrDivide; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.Mapping; |
| | | import org.mapstruct.ReportingPolicy; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | /** |
| | |
| | | * @Description |
| | | */ |
| | | |
| | | @Mapper |
| | | @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface DtoToDividePojo { |
| | | DtoToDividePojo INSTANCT = Mappers.getMapper(DtoToDividePojo.class); |
| | | |
| | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowmeter; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.Mapping; |
| | | import org.mapstruct.ReportingPolicy; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | /** |
| | |
| | | * @Description |
| | | */ |
| | | |
| | | @Mapper |
| | | @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface DtoToFlowmeterPojo { |
| | | DtoToFlowmeterPojo INSTANCT = Mappers.getMapper(DtoToFlowmeterPojo.class); |
| | | // @Mapping(target = "code", source = "code") |
| | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.Mapping; |
| | | import org.mapstruct.ReportingPolicy; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | /** |
| | |
| | | * @Description æµéçæµç«ãæµé计Dto转Pojo |
| | | */ |
| | | |
| | | @Mapper |
| | | @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface DtoToMoniFlowPojo { |
| | | DtoToMoniFlowPojo INSTANCT = Mappers.getMapper(DtoToMoniFlowPojo.class); |
| | | @Mapping(target = "monitoringid", source = "monitoringId") |
| | |
| | | import jakarta.validation.constraints.Max; |
| | | import jakarta.validation.constraints.Min; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class OnLineIntakesQO extends QueryConditionVo { |
| | | /** |
| | | * ä¸é´ä»¶è¿åçRTUå¨çº¿æ
åµå¯¹è±¡æ°ç» |
| | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrIntakeController; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.Mapping; |
| | | import org.mapstruct.ReportingPolicy; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | /** |
| | |
| | | * @Description DtoToPojo 转 PrIntakeController |
| | | */ |
| | | |
| | | @Mapper |
| | | @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface DtoToPojo { |
| | | DtoToPojo INSTANCT = Mappers.getMapper(DtoToPojo.class); |
| | | @Mapping(target = "intakeid", source = "intakeId") |
| | |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Base64; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @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) ; |
| | |
| | | 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("æªé
ç½®å级任å¡åè°ç½å") ; |
| | | } |
| | |
| | | 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") ; |
| | |
| | | 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 ; |
| | | } |
| | |
| | | @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); |
| | |
| | | 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("å½å没æå级任å¡") ; |
| | |
| | | |
| | | QueryResultVo<VoWatch> rsVo = new QueryResultVo(); |
| | | VoWatch vo = new VoWatch() ; |
| | | vo.upgrade = this.sv.selectTaskDetail(RtuUpgradeStateReceiverCtrl.cache.ugTaskId); |
| | | vo.overall = RtuUpgradeStateReceiverCtrl.cache.ugOverallState ; |
| | | vo.rtus = new ArrayList<>() ; |
| | | List<UpgradeRtu> listFiltered = null ; |
| | | if(RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList != null && RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList.size() > 0) { |
| | | listFiltered = filterByQuery(qvo) ; |
| | | if (listFiltered.size() > 0) { |
| | | if(qvo.pageCurr < 1){ |
| | | qvo.pageCurr = 1 ; |
| | | } |
| | | int start = (qvo.pageCurr - 1) * qvo.pageSize ; |
| | | if(start >= listFiltered.size()){ |
| | | if(listFiltered.size()%qvo.pageSize > 0){ |
| | | start = listFiltered.size() - listFiltered.size()%qvo.pageSize ; |
| | | }else{ |
| | | start = listFiltered.size() - qvo.pageSize ; |
| | | if(RtuUpgradeStateReceiverCtrl.cache != null && RtuUpgradeStateReceiverCtrl.cache.ugTaskId != null){ |
| | | vo.upgrade = this.sv.selectTaskDetail(RtuUpgradeStateReceiverCtrl.cache.ugTaskId); |
| | | vo.overall = RtuUpgradeStateReceiverCtrl.cache.ugOverallState ; |
| | | vo.rtus = new ArrayList<>() ; |
| | | if(RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList != null && RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList.size() > 0) { |
| | | listFiltered = filterByQuery(qvo) ; |
| | | if (listFiltered.size() > 0) { |
| | | if(qvo.pageCurr < 1){ |
| | | qvo.pageCurr = 1 ; |
| | | } |
| | | } |
| | | for(int i = start; i < (start + qvo.pageSize) && i < listFiltered.size(); i++){ |
| | | UpgradeRtu ugRtu = listFiltered.get(i) ; |
| | | VoWatch.VoWatchRtu rtu = new VoWatch.VoWatchRtu() ; |
| | | rtu.fromCache(ugRtu) ; |
| | | vo.rtus.add(rtu) ; |
| | | int start = (qvo.pageCurr - 1) * qvo.pageSize ; |
| | | if(start >= listFiltered.size()){ |
| | | if(listFiltered.size()%qvo.pageSize > 0){ |
| | | start = listFiltered.size() - listFiltered.size()%qvo.pageSize ; |
| | | }else{ |
| | | start = listFiltered.size() - qvo.pageSize ; |
| | | } |
| | | } |
| | | for(int i = start; i < (start + qvo.pageSize) && i < listFiltered.size(); i++){ |
| | | UpgradeRtu ugRtu = listFiltered.get(i) ; |
| | | VoWatch.VoWatchRtu rtu = new VoWatch.VoWatchRtu() ; |
| | | rtu.fromCache(ugRtu) ; |
| | | vo.rtus.add(rtu) ; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | rsVo.obj = vo ; |
| | | rsVo.pageSize = qvo.pageSize ; |
| | | rsVo.pageCurr = qvo.pageCurr ; |
| | |
| | | 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; |
| | |
| | | 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.*; |
| | |
| | | */ |
| | | @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){ |
| | |
| | | //离线çï¼ä¸å¤ç |
| | | return ; |
| | | } |
| | | int n = Integer.parseInt(new CreateRandom().create(2)) ; |
| | | if(n == 44 || n == 45 || n == 54){ |
| | | if(rtu.currentPackage == 1){ |
| | | //1å
æ» |
| | | rtu.state = UpgradeRtu.STATE_FAILONE ; |
| | | return ; |
| | | } |
| | | } |
| | | |
| | | if(rtu.currentPackage == rtu.totalPackage){ |
| | | //åçº§ç»æ |
| | | rtu.state = UpgradeRtu.STATE_SUCCESS ; |
| | | rtu.isOver = true ; |
| | | return ; |
| | | } |
| | | if(rtu.reTryTimes >= 2){ |
| | | //éè¯æ¬¡æ°è¾¾å°æå¤§å¼ |
| | | if(rtu.state == UpgradeRtu.STATE_FAILONE || |
| | | rtu.state == UpgradeRtu.STATE_FAIL){ |
| | | //å失败äºï¼è®¤ä¸ºç»æäº |
| | | rtu.isOver = true ; |
| | | return ; |
| | | } |
| | | } |
| | | |
| | | rtu.state = UpgradeRtu.STATE_RUNNING ; |
| | | rtu.currentPackage += 1 ; |
| | | rtu.currentRamAddr = 0x00 + UpgradeRtu.RAMADDRADD ; |
| | | rtu.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ; |
| | | rtu.reTryTimes = 0 ; |
| | | rtu.isOver = false ; |
| | | int n = Integer.parseInt(new CreateRandom().create(3)) ; |
| | | if(n == 540 || n == 541 || n == 542 || n == 543 || n == 544 || n == 545){ |
| | | if(rtu.currentPackage == 1){ |
| | | //1å
æ» |
| | | rtu.state = UpgradeRtu.STATE_FAILONE ; |
| | | return ; |
| | | } |
| | | } |
| | | |
| | | if(n == 450 || n == 451 || n == 452 || n == 453 || n == 454 || n == 455){ |
| | | if(rtu.currentPackage != 1){ |
| | | //åæ» |
| | | rtu.state = UpgradeRtu.STATE_FAIL ; |
| | | return ; |
| | | } |
| | | } |
| | | |
| | | if(rtu.state == UpgradeRtu.STATE_FAILONE || |
| | | rtu.state == UpgradeRtu.STATE_FAIL){ |
| | | if(rtu.reTryTimes < 2){ |
| | | rtu.state = UpgradeRtu.STATE_RUNNING ; |
| | | rtu.currentPackage = 1 ; |
| | | rtu.currentRamAddr = 0x00 ; |
| | | rtu.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ; |
| | | rtu.reTryTimes++ ; |
| | | rtu.isOver = false ; |
| | | return ; |
| | | } |
| | | } |
| | | |
| | | if(rtu.state != UpgradeRtu.STATE_FAILONE && |
| | | rtu.state != UpgradeRtu.STATE_FAIL){ |
| | | rtu.state = UpgradeRtu.STATE_RUNNING ; |
| | | rtu.currentPackage += 1 ; |
| | | rtu.currentRamAddr = 0x00 + UpgradeRtu.RAMADDRADD ; |
| | | rtu.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ; |
| | | rtu.isOver = false ; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | boolean hasRunning = false ; |
| | | if(cache.ugRtuStateList != null && cache.ugRtuStateList.size() > 0){ |
| | | cache.ugOverallState.init(); |
| | | cache.ugOverallState.rtuTotal = cache.ugRtuStateList.size() ; |
| | | for(UpgradeRtu rtu : cache.ugRtuStateList){ |
| | | if(rtu.state == UpgradeRtu.STATE_OFFLINE){ |
| | | cache.ugOverallState.offLineTotal ++ ; |
| | |
| | | } |
| | | } |
| | | } |
| | | if(!hasRunning){ |
| | | cache.ugOverallState.allOver = true ; |
| | | } |
| | | return hasRunning ; |
| | | } |
| | | } |
| | |
| | | import com.dy.pipIrrSell.recharge.DtoRecharge; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.Mapping; |
| | | import org.mapstruct.ReportingPolicy; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | /** |
| | |
| | | * @Description å°DtoActiveCardæ å°ä¸ºDtoRecharge |
| | | */ |
| | | |
| | | @Mapper |
| | | @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface RechargeDtoMapper { |
| | | RechargeDtoMapper INSTANCT = Mappers.getMapper(RechargeDtoMapper.class); |
| | | |
| | |
| | | import com.dy.pipIrrSell.cardOperate.dto.DtoRecharge; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.Mapping; |
| | | import org.mapstruct.ReportingPolicy; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | /** |
| | |
| | | * @Description |
| | | */ |
| | | |
| | | @Mapper |
| | | @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface RechargeDtoMapper { |
| | | RechargeDtoMapper INSTANCT = Mappers.getMapper(RechargeDtoMapper.class); |
| | | |
| | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | @Schema(name = "æ¶æ®æ¥è¯¢æ¡ä»¶") |
| | | public class QoReceipt extends QueryConditionVo { |
| | | @Schema(description = "交æID") |
| | |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClient; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.Mapping; |
| | | import org.mapstruct.ReportingPolicy; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | /** |
| | |
| | | * @Description |
| | | */ |
| | | |
| | | @Mapper |
| | | @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface DtoClientToSeClient { |
| | | DtoClientToSeClient INSTANCT = Mappers.getMapper(DtoClientToSeClient.class); |
| | | |
| | |
| | | import com.dy.pipIrrGlobal.voSe.VoClient; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.Mapping; |
| | | import org.mapstruct.ReportingPolicy; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | /** |
| | |
| | | * @Description |
| | | */ |
| | | |
| | | @Mapper |
| | | @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SeClientToVoClient { |
| | | SeClientToVoClient INSTANCT = Mappers.getMapper(SeClientToVoClient.class); |
| | | |
| | |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | @Schema(name = "èæå¡å
å¼è®°å½æ¥è¯¢æ¡ä»¶") |
| | | public class DtoVcRecharge extends QueryConditionVo { |
| | | |
| | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | @Schema(name = "çµåé±å
å
弿¥è¯¢æ¡ä»¶") |
| | | public class QoWalletRecharge extends QueryConditionVo { |
| | | @Schema(description = "çµåé±å
è´¦æ·ID") |
| | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | @Schema(name = "çµåé±å
è´¦æ·æ¥è¯¢æ¡ä»¶") |
| | | public class QueryVo extends QueryConditionVo { |
| | | @Schema(description = "åæ·å§å") |
| | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.Date; |
| | | |
| | |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class AutomaticClose extends DtoBase { |
| | | public static final long serialVersionUID = 202407231056001L; |
| | | |
| | |
| | | |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class Recharge extends DtoBase { |
| | | public static final long serialVersionUID = 202406261045001L; |
| | | |
| | |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class QoIssueReport extends QueryConditionVo { |
| | | |
| | | /** |
| | |
| | | import com.dy.pipIrrGlobal.voSe.VoClient; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.Mapping; |
| | | import org.mapstruct.ReportingPolicy; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | /** |
| | |
| | | * @Description |
| | | */ |
| | | |
| | | @Mapper |
| | | @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SeClientToVoClient { |
| | | SeClientToVoClient INSTANCT = Mappers.getMapper(SeClientToVoClient.class); |
| | | |
| | |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class QoVcRecharge extends QueryConditionVo { |
| | | |
| | | /** |