Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
| | |
| | | public String parseRtuAddr(byte[] bs, int index)throws Exception{ |
| | | String rtuAddrBCD = "" + ByteUtil.BCD2Long_BE(bs, index, index + 2) ;//地址是大端模式 |
| | | String rtuAddrStr = "" + ByteUtilUnsigned.bytes2Short_LE(bs, index + 3) ; |
| | | while(rtuAddrStr.length() < 5){ |
| | | while(rtuAddrStr.length() <= 5){ |
| | | rtuAddrStr = "0" + rtuAddrStr ; |
| | | } |
| | | return rtuAddrBCD + rtuAddrStr ; |
New file |
| | |
| | | package com.dy.common.mw.protocol.p206V1_0_0.downVos; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/7/25 15:27 |
| | | * @Description |
| | | */ |
| | | public class Com10Vo { |
| | | public String rtuAddr ; |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V1_0_0.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.CodeV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.CommonV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.ParseParamsForDownV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.ProtocolConstantV206V1_0_0; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.downVos.Com10Vo; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.downVos.Com3AVo; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.parse.global.GlCreate; |
| | | import com.dy.common.util.ByteUtil; |
| | | |
| | |
| | | * @throws Exception 异常 |
| | | */ |
| | | public byte[] doParse(ParseParamsForDownV1_0_1 para) throws Exception { |
| | | if(para.param == null) { |
| | | throw new Exception("命令参数为null") ; |
| | | }else { |
| | | JSONObject obj = (JSONObject) para.param; |
| | | String json = obj.toJSONString(); |
| | | Com10Vo cvo = JSON.parseObject(json, Com10Vo.class); |
| | | if (cvo == null) { |
| | | throw new Exception("json转Com10Vo为null"); |
| | | } |
| | | if (cvo.rtuAddr == null) { |
| | | throw new Exception("测试新地址不能为空"); |
| | | } |
| | | |
| | | CommonV1_0_1 commonV1_0_1 = new CommonV1_0_1() ; |
| | | byte[] bytes ; |
| | | byte[] bsHead = new byte[ProtocolConstantV206V1_0_0.lenHead2Code] ; |
| | |
| | | |
| | | ByteUtil.hex2Bytes(para.commandCode, bsHead, index) ; |
| | | |
| | | if(para.param == null){ |
| | | throw new Exception("未提供命令参数数据,不能构造功能码为" + para.commandCode + "的下行命令") ; |
| | | }else{ |
| | | index = 0 ; |
| | | byte[] bs = new byte[13] ; |
| | | String newRtuAddr = (String)para.param ; |
| | | GlCreate.createRtuAddr(newRtuAddr, bs, index); |
| | | |
| | | GlCreate.createRtuAddr(cvo.rtuAddr, bs, index); |
| | | index += 5 ; |
| | | GlCreate.createPw(bs, index); |
| | | index += 2 ; |
| | | GlCreate.createTp(bs, index); |
| | | bytes = ByteUtil.bytesMerge(bsHead, bs) ; |
| | | } |
| | | |
| | | GlCreate.createLen(bytes);//长度放字节数组中 |
| | | |
| | |
| | | |
| | | return bytes ; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | * @throws Exception 异常 |
| | | */ |
| | | public static String parseIcCardNo(byte[] bs, int index)throws Exception{ |
| | | String rtuAddrStr = "" + ByteUtilUnsigned.bytes2Short_LE(bs, index) ; |
| | | String rtuAddrBCD = "" + ByteUtil.BCD2Long_LE(bs, index + 2, index + 7) ; |
| | | while(rtuAddrStr.length() < 5){ |
| | | rtuAddrStr = "0" + rtuAddrStr ; |
| | | String icNoStr = "" + ByteUtilUnsigned.bytes2Short_LE(bs, index) ; |
| | | String icNoBCD = "" + ByteUtil.BCD2Long_LE(bs, index + 2, index + 7) ; |
| | | while(icNoStr.length() < 5){ |
| | | icNoStr = "0" + icNoStr ; |
| | | } |
| | | return rtuAddrBCD + rtuAddrStr ; |
| | | return icNoBCD + icNoStr ; |
| | | } |
| | | |
| | | |
| | |
| | | sb.append(" IC卡编号:"); |
| | | sb.append(icCardNo); |
| | | sb.append("\n"); |
| | | sb.append(" ic卡地址:"); |
| | | sb.append(" IC卡地址:"); |
| | | sb.append(icCardAddr); |
| | | sb.append("\n"); |
| | | sb.append(" 剩余金额(元):"); |
| | |
| | | sb.append(" IC卡编号:"); |
| | | sb.append(icCardNo); |
| | | sb.append("\n"); |
| | | sb.append(" ic卡地址:"); |
| | | sb.append(" IC卡地址:"); |
| | | sb.append(icCardAddr); |
| | | sb.append("\n"); |
| | | sb.append(" 剩余金额(元):"); |
| | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | @TableName(value="rm_client_amount_month", autoResultMap = true) |
| | | @TableName(value="st_client_amount_month", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | @TableName(value="rm_client_amount_year", autoResultMap = true) |
| | | @TableName(value="st_client_amount_year", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | @TableName(value="rm_intake_amount_month", autoResultMap = true) |
| | | @TableName(value="st_intake_amount_month", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | @TableName(value="rm_intake_amount_year", autoResultMap = true) |
| | | @TableName(value="st_intake_amount_year", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | |
| | | * @Description 取水口漏损月统计 |
| | | */ |
| | | |
| | | @TableName(value="rm_loss_month", autoResultMap = true) |
| | | @TableName(value="st_loss_month", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | |
| | | * @Description 取水口漏损年统计 |
| | | */ |
| | | |
| | | @TableName(value="rm_loss_year", autoResultMap = true) |
| | | @TableName(value="st_loss_year", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | |
| | | if(com == null){ |
| | | rt = this.connect() ;//连接通信中间件测试 |
| | | }else{ |
| | | if(com.equals("21")){ |
| | | if(com.equals("10")){ |
| | | rt = this.cd10() ; |
| | | }else if(com.equals("21")){ |
| | | rt = this.cd21() ; |
| | | }else if(com.equals("37")){ |
| | | rt = this.cd37() ; |
| | |
| | | rt = this.cd97() ; |
| | | }else if(com.equals("98")){ |
| | | rt = this.cd98() ; |
| | | }else if(com.equals("99")){ |
| | | rt = this.cd99() ; |
| | | }else if(com.equals("A0")){ |
| | | rt = this.cdA0() ; |
| | | }else if(com.equals("B0")){ |
| | | rt = this.cdB0() ; |
| | | } |
| | |
| | | */ |
| | | private BaseResponse connect(){ |
| | | return this.sendTest() ; |
| | | } |
| | | |
| | | private BaseResponse cd10(){ |
| | | Com10Vo comVo = new Com10Vo() ; |
| | | comVo.rtuAddr = "532328059995" ;//前6位是行政区划码,后6位是序列号最大是065535 |
| | | return this.sendCom2Mw(this.command(CodeV1_0_1.cd_10, comVo, null)) ; |
| | | } |
| | | |
| | | private BaseResponse cd21(){ |
| | |
| | | |
| | | private BaseResponse cd3C(){ |
| | | Com3CVo comVo = new Com3CVo() ; |
| | | comVo.minute = 60 ; |
| | | comVo.minute = 5 ; |
| | | return this.sendCom2Mw(this.command(CodeV1_0_1.cd_3C, comVo, null)) ; |
| | | } |
| | | |
| | |
| | | return this.sendCom2Mw(this.command(CodeV1_0_1.cd_98, comVo, null)) ; |
| | | } |
| | | |
| | | //定时关阀开阀 |
| | | private BaseResponse cd99(){ |
| | | Com99Vo comVo = new Com99Vo() ; |
| | | comVo.icCardNo = CommandP206V1_0_0Ctrl.vsIcCardNo; |
| | | comVo.moneyRemain = 234.56 ; |
| | | comVo.waterPrice = 1.2 ; |
| | | comVo.minutes = 5 ; |
| | | return this.sendCom2Mw(this.command(CodeV1_0_1.cd_99, comVo, null)) ; |
| | | } |
| | | |
| | | //定量关阀开阀 |
| | | private BaseResponse cdA0(){ |
| | | ComA0Vo comVo = new ComA0Vo() ; |
| | | comVo.icCardNo = CommandP206V1_0_0Ctrl.vsIcCardNo; |
| | | comVo.moneyRemain = 234.56 ; |
| | | comVo.waterPrice = 1.2 ; |
| | | comVo.waterAmount = 10 ; |
| | | return this.sendCom2Mw(this.command(CodeV1_0_1.cd_98, comVo, null)) ; |
| | | } |
| | | |
| | | private BaseResponse cdB0(){ |
| | | return this.sendCom2Mw(this.command(CodeV1_0_1.cd_B0, null, null)) ; |
| | | } |