1、增加了单数据源的Configuration;
2、RestTemplateConfiguration.java更换包路径;
3、完善王江海制定协议的实现代码。
1 文件已复制
2 文件已重命名
49个文件已修改
2个文件已添加
| | |
| | | public byte createCtrl(byte dir, byte funcCode){ |
| | | byte b = dir;//DIR = 1(0x80),表示此帧报文是由终端发出的上行报文; |
| | | b = (byte)(b | funcCode) ; |
| | | //DIV = 1(0x40),表示此报文已被拆分为若干帧 |
| | | //FCB = 1(0x08),表示只发一次 |
| | | b = (byte)(b |0x08) ; |
| | | //DIV = 1(0x20),表示此报文已被拆分为若干帧 |
| | | //FCB = 1(0x10),表示只发一次 |
| | | b = (byte)(b |0x10) ; |
| | | //DIR = 0 下行,则功能码采用0 |
| | | return b ; |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.downVos; |
| | | |
| | | public class ComCdXyVo { |
| | | public String controllerType;//控制器类型 01(0x01):测控一体阀;57(0x57):井电控制器 |
| | | public Integer projectNo ;//控制器类型 0x01:测控一体阀;0x57:井电控制器 |
| | | public String controllerType;//控制器类型: 01(0x01):测控一体阀;57(0x57):井电控制器 |
| | | public Integer projectNo ;//项目编号 |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String json = obj.toJSONString(); |
| | | ComCd10Vo cvo = JSON.parseObject(json, ComCd10Vo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCd10Vo为null") ; |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String json = obj.toJSONString(); |
| | | ComCd15Vo cvo = JSON.parseObject(json, ComCd15Vo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCd15Vo为null") ; |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String json = obj.toJSONString(); |
| | | ComCd16Vo cvo = JSON.parseObject(json, ComCd16Vo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCd16Vo为null") ; |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String json = obj.toJSONString(); |
| | | ComCd21Vo cvo = JSON.parseObject(json, ComCd21Vo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCd21Vo为null") ; |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String json = obj.toJSONString(); |
| | | ComCd22Vo cvo = JSON.parseObject(json, ComCd22Vo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCd22Vo为null") ; |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String json = obj.toJSONString(); |
| | | ComCd23Vo cvo = JSON.parseObject(json, ComCd23Vo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCd23Vo为null") ; |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String json = obj.toJSONString(); |
| | | ComCd24Vo cvo = JSON.parseObject(json, ComCd24Vo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCd24Vo为null") ; |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | ComCdXyVo cvo = JSON.parseObject(json, ComCdXyVo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCdXyVo为null") ; |
| | | } |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String controllerType = (String)obj.get("controllerType"); |
| | | Integer projectNo = (Integer)obj.get("projectNo") ; |
| | | |
| | | byte[] bs = new byte[9] ; |
| | | int index = 0 ; |
| | | bs[index] = (byte)(Integer.parseInt(cvo.controllerType, 16)); |
| | | bs[index] = (byte)(Integer.parseInt(controllerType, 16)); |
| | | |
| | | index ++ ; |
| | | bs[index] = cvo.projectNo.byteValue() ; |
| | | bs[index] = projectNo.byteValue() ; |
| | | |
| | | index ++ ; |
| | | GlCreate.createPw(bs, index); |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String json = obj.toJSONString(); |
| | | ComCd26Vo cvo = JSON.parseObject(json, ComCd26Vo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCd22Vo为null") ; |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | ComCdXyVo cvo = JSON.parseObject(json, ComCdXyVo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCdXyVo为null") ; |
| | | } |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String controllerType = (String)obj.get("controllerType"); |
| | | Integer projectNo = (Integer)obj.get("projectNo") ; |
| | | |
| | | byte[] bs = new byte[9] ; |
| | | int index = 0 ; |
| | | bs[index] = (byte)(Integer.parseInt(cvo.controllerType, 16)); |
| | | bs[index] = (byte)(Integer.parseInt(controllerType, 16)); |
| | | |
| | | index ++ ; |
| | | bs[index] = cvo.projectNo.byteValue() ; |
| | | bs[index] = projectNo.byteValue() ; |
| | | |
| | | index ++ ; |
| | | GlCreate.createPw(bs, index); |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String json = obj.toJSONString(); |
| | | ComCd31Vo cvo = JSON.parseObject(json, ComCd31Vo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCd30Vo为null") ; |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | ComCdXyVo cvo = JSON.parseObject(json, ComCdXyVo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCdXyVo为null") ; |
| | | } |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String controllerType = (String)obj.get("controllerType"); |
| | | Integer projectNo = (Integer)obj.get("projectNo") ; |
| | | |
| | | byte[] bs = new byte[2] ; |
| | | int index = 0 ; |
| | | bs[index] = (byte)(Integer.parseInt(cvo.controllerType, 16)); |
| | | bs[index] = (byte)(Integer.parseInt(controllerType, 16)); |
| | | |
| | | index ++ ; |
| | | bs[index] = cvo.projectNo.byteValue() ; |
| | | bs[index] = projectNo.byteValue() ; |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | }else{ |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String json = obj.toJSONString(); |
| | | ComCd55Vo cvo = JSON.parseObject(json, ComCd55Vo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCd55Vo为null") ; |
| | |
| | | cdData.icCardNo = GlParse.parseIcCardNo(bs, index, 6, 2) ; |
| | | |
| | | index += 8 ; |
| | | int chargeMoney = ByteUtil.BCD2Int_BE(bs, index, index + 4) ; |
| | | Long chargeMoney = ByteUtil.BCD2Long_LE(bs, index, index + 4) ; |
| | | cdData.chargeMoney = chargeMoney/100.0D; |
| | | |
| | | index += 5 ; |
| | | int chargeWater = ByteUtil.BCD2Int_BE(bs, index, index + 4) ; |
| | | Long chargeWater = ByteUtil.BCD2Long_LE(bs, index, index + 4) ; |
| | | cdData.chargeWater = chargeWater/100.0D; |
| | | |
| | | index += 5 ; |
| | | cdData.flowNo = ByteUtil.BCD2String_BE(bs, index, index + 5) ; |
| | | cdData.flowNo = ByteUtil.BCD2String_LE(bs, index, index + 5) ; |
| | | |
| | | index += 6 ; |
| | | byte flag = bs[index] ; |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | ComCdXyVo cvo = JSON.parseObject(json, ComCdXyVo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCdXyVo为null") ; |
| | | } |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String controllerType = (String)obj.get("controllerType"); |
| | | Integer projectNo = (Integer)obj.get("projectNo") ; |
| | | |
| | | byte[] bs = new byte[2] ; |
| | | int index = 0 ; |
| | | bs[index] = (byte)(Integer.parseInt(cvo.controllerType, 16)); |
| | | bs[index] = (byte)(Integer.parseInt(controllerType, 16)); |
| | | |
| | | index ++ ; |
| | | bs[index] = cvo.projectNo.byteValue() ; |
| | | bs[index] = projectNo.byteValue() ; |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | }else{ |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | ComCdXyVo cvo = JSON.parseObject(json, ComCdXyVo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCdXyVo为null") ; |
| | | } |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String controllerType = (String)obj.get("controllerType"); |
| | | Integer projectNo = (Integer)obj.get("projectNo") ; |
| | | |
| | | byte[] bs = new byte[2] ; |
| | | int index = 0 ; |
| | | bs[index] = (byte)(Integer.parseInt(cvo.controllerType, 16)); |
| | | bs[index] = (byte)(Integer.parseInt(controllerType, 16)); |
| | | |
| | | index ++ ; |
| | | bs[index] = cvo.projectNo.byteValue() ; |
| | | bs[index] = projectNo.byteValue() ; |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | }else{ |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String json = obj.toJSONString(); |
| | | ComCd55Vo cvo = JSON.parseObject(json, ComCd55Vo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCd55Vo为null") ; |
| | |
| | | String yy = ByteUtil.BCD2String_BE(bs, index, index) ; |
| | | cdData.dt = "20" + yy + "-" + MM + "-" + dd + " " + HH ; |
| | | |
| | | int meterAmountDay = ByteUtil.BCD2Int_BE(bs, index, index + 3) ; |
| | | Long meterAmountDay = ByteUtil.BCD2Long_LE(bs, index, index + 3) ; |
| | | cdData.meterAmountDay = meterAmountDay/100.0D; |
| | | |
| | | index += 4 ; |
| | | int farmerAmountDay = ByteUtil.BCD2Int_BE(bs, index, index + 3) ; |
| | | Long farmerAmountDay = ByteUtil.BCD2Long_LE(bs, index, index + 3) ; |
| | | cdData.farmerAmountDay = farmerAmountDay/100.0D; |
| | | |
| | | index += 4 ; |
| | | int lossAmountDay = ByteUtil.BCD2Int_BE(bs, index, index + 3) ; |
| | | Long lossAmountDay = ByteUtil.BCD2Long_LE(bs, index, index + 3) ; |
| | | cdData.lossAmountDay = lossAmountDay/100.0D; |
| | | |
| | | return cdData ; |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String json = obj.toJSONString(); |
| | | ComCd65Vo cvo = JSON.parseObject(json, ComCd65Vo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCd65Vo为null") ; |
| | |
| | | cdData.icCardNo = GlParse.parseIcCardNo(bs, index, 6, 2) ; |
| | | |
| | | index += 8 ; |
| | | int moneyRemain = ByteUtil.BCD2Int_BE(bs, index, index + 4) ; |
| | | Long moneyRemain = ByteUtil.BCD2Long_LE(bs, index, index + 4) ; |
| | | cdData.moneyRemain = moneyRemain/100.0D; |
| | | |
| | | index += 5 ; |
| | | int waterRemain = ByteUtil.BCD2Int_BE(bs, index, index + 4) ; |
| | | Long waterRemain = ByteUtil.BCD2Long_LE(bs, index, index + 4) ; |
| | | cdData.waterRemain = waterRemain/100.0D; |
| | | |
| | | index += 5 ; |
| | | int thisEle = ByteUtil.BCD2Int_BE(bs, index, index + 3) ; |
| | | int thisEle = ByteUtil.BCD2Int_LE(bs, index, index + 3) ; |
| | | cdData.thisEle = thisEle/100.0D; |
| | | |
| | | index += 4 ; |
| | | int thisWater = ByteUtil.BCD2Int_BE(bs, index, index + 3) ; |
| | | int thisWater = ByteUtil.BCD2Int_LE(bs, index, index + 3) ; |
| | | cdData.thisWater = thisWater/100.0D; |
| | | |
| | | index += 4 ; |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | ComCdXyVo cvo = JSON.parseObject(json, ComCdXyVo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCdXyVo为null") ; |
| | | } |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String controllerType = (String)obj.get("controllerType"); |
| | | Integer projectNo = (Integer)obj.get("projectNo") ; |
| | | |
| | | byte[] bs = new byte[2] ; |
| | | int index = 0 ; |
| | | bs[index] = (byte)(Integer.parseInt(cvo.controllerType, 16)); |
| | | bs[index] = (byte)(Integer.parseInt(controllerType, 16)); |
| | | |
| | | index ++ ; |
| | | bs[index] = cvo.projectNo.byteValue() ; |
| | | bs[index] = projectNo.byteValue() ; |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | }else{ |
| | |
| | | byte[] bs = new byte[2] ; |
| | | bs[0] = (byte)(Integer.parseInt(cdData.getControllerType(), 16)); |
| | | bs[1] = cdData.projectNo.byteValue() ; |
| | | GlCreate.createTp(bs, 3) ; |
| | | GlCreate.createTp(bs, 2) ; |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | }else{ |
| | | throw new Exception("下行命令参数据为null") ; |
| | |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | DataCd81Vo cdData = (DataCd81Vo)para.param ; |
| | | byte[] bs = new byte[2] ; |
| | | byte[] bs = new byte[8] ; |
| | | bs[0] = (byte)(Integer.parseInt(cdData.getControllerType(), 16)); |
| | | bs[1] = cdData.projectNo.byteValue() ; |
| | | GlCreate.createTp(bs, 3) ; |
| | | GlCreate.createTp(bs, 2) ; |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | }else{ |
| | | throw new Exception("下行命令参数据为null") ; |
| | |
| | | cdData.projectNo = (int)bs[index]; |
| | | |
| | | index ++ ; |
| | | cdData.waterTotalAmountYear = ByteUtil.BCD2Int_BE(bs, index, index + 4)/100.0D ; |
| | | cdData.waterTotalAmountYear = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | cdData.waterTotalAmountMeter = ByteUtil.BCD2Int_BE(bs, index, index + 4)/100.0D ; |
| | | cdData.waterTotalAmountMeter = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | cdData.eleTotalAmountYear = ByteUtil.BCD2Int_BE(bs, index, index + 4)/100.0D ; |
| | | cdData.eleTotalAmountYear = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | cdData.eleTotalAmountMeter = ByteUtil.BCD2Int_BE(bs, index, index + 4)/100.0D ; |
| | | cdData.eleTotalAmountMeter = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | cdData.waterTotalAmountDay = ByteUtil.BCD2Int_BE(bs, index, index + 3)/100.0D ; |
| | | cdData.waterTotalAmountDay = ByteUtil.BCD2Long_LE(bs, index, index + 3)/100.0D ; |
| | | |
| | | index += 4 ; |
| | | cdData.waterUserTotalAmountDay = ByteUtil.BCD2Int_BE(bs, index, index + 3)/100.0D ; |
| | | cdData.waterUserTotalAmountDay = ByteUtil.BCD2Long_LE(bs, index, index + 3)/100.0D ; |
| | | |
| | | index += 4 ; |
| | | cdData.lossTotalAmountDay = ByteUtil.BCD2Int_BE(bs, index, index + 3)/100.0D ; |
| | | cdData.lossTotalAmountDay = ByteUtil.BCD2Long_LE(bs, index, index + 3)/100.0D ; |
| | | |
| | | index += 4 ; |
| | | cdData.batteryVolt = ByteUtil.BCD2Int_BE(bs, index, index + 1)/100.0D ; |
| | | cdData.batteryVolt = ByteUtil.BCD2Int_LE(bs, index, index + 1)/100.0D ; |
| | | |
| | | } |
| | | |
| | |
| | | index += 8 ; |
| | | cdData.orderNo = ByteUtil.BCD2String_BE(bs, index, index + 7) ; |
| | | |
| | | index ++ ; |
| | | String mm = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | index ++ ; |
| | | String HH = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | index ++ ; |
| | | String dd = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | index ++ ; |
| | | String MM = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | cdData.opDt = MM + "月" + dd + "日" + HH + "时" + mm + "分" ; |
| | | index += 8 ; |
| | | cdData.opDt = GlParse.parseRtuDt(bs, index) ; |
| | | |
| | | index ++ ; |
| | | cdData.waterTotalAmount = ByteUtil.BCD2Int_BE(bs, index, index + 4)/100.0D ; |
| | | index += 6 ; |
| | | cdData.waterTotalAmount = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | cdData.eleTotalAmount = ByteUtil.BCD2Int_BE(bs, index, index + 4)/100.0D ; |
| | | cdData.eleTotalAmount = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | cdData.moneyRemainUser = ByteUtil.BCD2Int_BE(bs, index, index + 4)/100.0D ; |
| | | cdData.moneyRemainUser = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | cdData.waterRemainUser = ByteUtil.BCD2Int_BE(bs, index, index + 4)/100.0D ; |
| | | cdData.waterRemainUser = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | GlParse.parseAlarmAndState(bs, index, cdData) ; |
| | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.parse.global.GlCreate; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd93_A3_85Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd85Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd93_A3Vo; |
| | | import com.dy.common.util.ByteUtil; |
| | | |
| | | @AnnotationCodeDown(ifAny={ |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | DataCd93_A3_85Vo cdData = (DataCd93_A3_85Vo)para.param ; |
| | | DataCd85Vo cdData = (DataCd85Vo)para.param ; |
| | | byte[] bs = new byte[2] ; |
| | | bs[0] = (byte)(Integer.parseInt(cdData.controllerType, 16)); |
| | | bs[1] = cdData.projectNo.byteValue() ; |
| | |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.*; |
| | | import com.dy.common.mw.protocol.p206V202404.parse.global.GlParse; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd93_A3_85Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd85Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd93_A3Vo; |
| | | import com.dy.common.util.ByteUtil; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | |
| | | */ |
| | | protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { |
| | | DataV202404 dV1 = (DataV202404)data.getSubData() ; |
| | | DataCd93_A3_85Vo cdData = new DataCd93_A3_85Vo(CodeV202404.getCodeName(dataCode)) ; |
| | | DataCd85Vo cdData = new DataCd85Vo(CodeV202404.getCodeName(dataCode)) ; |
| | | dV1.subData = cdData ; |
| | | |
| | | GlParse.parseCd93A3And85(bs, cdData) ; |
| | | GlParse.parseCd85(bs, cdData) ; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String json = obj.toJSONString(); |
| | | ComCd86Vo cvo = JSON.parseObject(json, ComCd86Vo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCd21Vo为null") ; |
| | |
| | | cdData.ip = ByteUtil.bytes2String_BE(bs, index, index + ipLen - 1) ; |
| | | |
| | | index += ipLen ; |
| | | cdData.port = Integer.parseInt(ByteUtil.bytes2String_BE(bs, index, index + portLen - 1)) ; |
| | | cdData.port = Integer.parseInt(ByteUtil.bytes2String_LE(bs, index, index + portLen - 1)) ; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String json = obj.toJSONString(); |
| | | ComCd87Vo cvo = JSON.parseObject(json, ComCd87Vo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCd21Vo为null") ; |
| | |
| | | short portLen = ByteUtilUnsigned.byte2Byte(bs, index) ; |
| | | |
| | | index++ ; |
| | | cdData.domain = ByteUtil.bytes2String_BE(bs, index, index + domainLen - 1) ; |
| | | cdData.domain = ByteUtil.bytes2String_LE(bs, index, index + domainLen - 1) ; |
| | | |
| | | index += domainLen ; |
| | | cdData.port = Integer.parseInt(ByteUtil.bytes2String_BE(bs, index, index + portLen - 1)) ; |
| | | cdData.port = Integer.parseInt(ByteUtil.bytes2String_LE(bs, index, index + portLen - 1)) ; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | ComCdXyVo cvo = JSON.parseObject(json, ComCdXyVo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCdXyVo为null") ; |
| | | } |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String controllerType = (String)obj.get("controllerType"); |
| | | Integer projectNo = (Integer)obj.get("projectNo") ; |
| | | |
| | | byte[] bs = new byte[2] ; |
| | | int index = 0 ; |
| | | bs[index] = (byte)(Integer.parseInt(cvo.controllerType, 16)); |
| | | bs[index] = (byte)(Integer.parseInt(controllerType, 16)); |
| | | |
| | | index ++ ; |
| | | bs[index] = cvo.projectNo.byteValue() ; |
| | | bs[index] = projectNo.byteValue() ; |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | }else{ |
| | |
| | | byte[] bs = new byte[8] ; |
| | | bs[0] = (byte)(Integer.parseInt(cdData.getControllerType(), 16)); |
| | | bs[1] = cdData.projectNo.byteValue() ; |
| | | GlCreate.createTp(bs, 3) ; |
| | | GlCreate.createTp(bs, 2) ; |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | }else{ |
| | | throw new Exception("下行命令参数据为null") ; |
| | |
| | | cdData.projectNo = (int)bs[index]; |
| | | |
| | | index++ ; |
| | | int lng = ByteUtil.BCD2Int_BE(bs, index, index + 4) ; |
| | | Long lng = ByteUtil.BCD2Long_LE(bs, index, index + 4) ; |
| | | cdData.lng = lng/1000000.0D; |
| | | |
| | | index += 5 ; |
| | | int lat = ByteUtil.BCD2Int_BE(bs, index, index + 4) ; |
| | | Long lat = ByteUtil.BCD2Long_LE(bs, index, index + 4) ; |
| | | cdData.lat = lat/1000000.0D; |
| | | |
| | | index += 5 ; |
| | | int softVersion = ByteUtil.BCD2Int_BE(bs, index, index + 1) ; |
| | | int softVersion = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | cdData.softVersion = softVersion/10.0F; |
| | | |
| | | index += 2 ; |
| | | int hardVersion = ByteUtil.BCD2Int_BE(bs, index, index + 1) ; |
| | | int hardVersion = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | cdData.hardVersion = hardVersion/10.0F; |
| | | |
| | | index += 2 ; |
| | | int protocolVersion = ByteUtil.BCD2Int_BE(bs, index, index + 1) ; |
| | | int protocolVersion = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | cdData.protocolVersion = protocolVersion/10.0F; |
| | | |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String json = obj.toJSONString(); |
| | | ComCd92_A2Vo cvo = JSON.parseObject(json, ComCd92_A2Vo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCd92_A2Vo为null") ; |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String json = obj.toJSONString(); |
| | | ComCd93_A3Vo cvo = JSON.parseObject(json, ComCd93_A3Vo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCd93_A3Vo为null") ; |
| | |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.*; |
| | | import com.dy.common.mw.protocol.p206V202404.parse.global.GlParse; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd93_A3_85Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd93_A3Vo; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | |
| | | */ |
| | | protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { |
| | | DataV202404 dV1 = (DataV202404)data.getSubData() ; |
| | | DataCd93_A3_85Vo cdData = new DataCd93_A3_85Vo(CodeV202404.getCodeName(dataCode)) ; |
| | | DataCd93_A3Vo cdData = new DataCd93_A3Vo(CodeV202404.getCodeName(dataCode)) ; |
| | | dV1.subData = cdData ; |
| | | |
| | | GlParse.parseCd93A3And85(bs, cdData) ; |
| | | GlParse.parseCd93A3(bs, cdData) ; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | ComCdXyVo cvo = JSON.parseObject(json, ComCdXyVo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCdXyVo为null") ; |
| | | } |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String controllerType = (String)obj.get("controllerType"); |
| | | Integer projectNo = (Integer)obj.get("projectNo") ; |
| | | |
| | | byte[] bs = new byte[2] ; |
| | | int index = 0 ; |
| | | bs[index] = (byte)(Integer.parseInt(cvo.controllerType, 16)); |
| | | bs[index] = (byte)(Integer.parseInt(controllerType, 16)); |
| | | |
| | | index ++ ; |
| | | bs[index] = cvo.projectNo.byteValue() ; |
| | | bs[index] = projectNo.byteValue() ; |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | }else{ |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | ComCdXyVo cvo = JSON.parseObject(json, ComCdXyVo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCdXyVo为null") ; |
| | | } |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String controllerType = (String)obj.get("controllerType"); |
| | | Integer projectNo = (Integer)obj.get("projectNo") ; |
| | | |
| | | byte[] bs = new byte[2] ; |
| | | int index = 0 ; |
| | | bs[index] = (byte)(Integer.parseInt(cvo.controllerType, 16)); |
| | | bs[index] = (byte)(Integer.parseInt(controllerType, 16)); |
| | | |
| | | index ++ ; |
| | | bs[index] = cvo.projectNo.byteValue() ; |
| | | bs[index] = projectNo.byteValue() ; |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | }else{ |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | ComCdXyVo cvo = JSON.parseObject(json, ComCdXyVo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCdXyVo为null") ; |
| | | } |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String controllerType = (String)obj.get("controllerType"); |
| | | Integer projectNo = (Integer)obj.get("projectNo") ; |
| | | |
| | | byte[] bs = new byte[2] ; |
| | | int index = 0 ; |
| | | bs[index] = (byte)(Integer.parseInt(cvo.controllerType, 16)); |
| | | bs[index] = (byte)(Integer.parseInt(controllerType, 16)); |
| | | |
| | | index ++ ; |
| | | bs[index] = cvo.projectNo.byteValue() ; |
| | | bs[index] = projectNo.byteValue() ; |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | }else{ |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | ComCdXyVo cvo = JSON.parseObject(json, ComCdXyVo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCdXyVo为null") ; |
| | | } |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String controllerType = (String)obj.get("controllerType"); |
| | | Integer projectNo = (Integer)obj.get("projectNo") ; |
| | | |
| | | byte[] bs = new byte[2] ; |
| | | int index = 0 ; |
| | | bs[index] = (byte)(Integer.parseInt(cvo.controllerType, 16)); |
| | | bs[index] = (byte)(Integer.parseInt(controllerType, 16)); |
| | | |
| | | index ++ ; |
| | | bs[index] = cvo.projectNo.byteValue() ; |
| | | bs[index] = projectNo.byteValue() ; |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | }else{ |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String json = obj.toJSONString(); |
| | | ComCd9CVo cvo = JSON.parseObject(json, ComCd9CVo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCd9CVo为null") ; |
| | |
| | | para.data.subData==null?null:(((DataV202404)para.data.subData).subData), |
| | | null); |
| | | //构造应答 |
| | | byte[] data = new Cd_02_Down().doParse(downCpParams) ; |
| | | byte[] data = new Cd_C2_Down().doParse(downCpParams) ; |
| | | |
| | | MidResultToRtu confirmCommand = new MidResultToRtu() ; |
| | | confirmCommand.protocolName = para.protocolName ;//协议名称 |
New file |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.dy.common.util.ByteUtil; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/5/15 13:43 |
| | | * @Description |
| | | */ |
| | | public class Test { |
| | | public static void main(String[] args) throws Exception{ |
| | | byte[] bs = new byte[]{(byte)0x80, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00} ; |
| | | Long l1 = ByteUtil.BCD2Long_BE(bs, 0, 0 + 4); |
| | | Long l2 = ByteUtil.BCD2Long_LE(bs, 0, 0 + 4); |
| | | System.out.println(l1); |
| | | System.out.println(l2); |
| | | } |
| | | } |
| | |
| | | |
| | | index++ ; |
| | | GlCreate.createRtuAddr(rtuAddr, bsHead, index); |
| | | index += 7 ; |
| | | index += 8 ; |
| | | |
| | | ByteUtil.hex2Bytes(commandCode, bsHead, index) ; |
| | | return bsHead ; |
| | |
| | | } |
| | | |
| | | public static void createDt(byte[] bs, int index) throws Exception { |
| | | bs[index] = Byte.parseByte(DateTime.ss()) ; |
| | | bs[index + 1] = Byte.parseByte(DateTime.mm()) ; |
| | | bs[index + 2] = Byte.parseByte(DateTime.HH()) ; |
| | | bs[index + 3] = Byte.parseByte(DateTime.dd()) ; |
| | | bs[index + 4] = Byte.parseByte(DateTime.MM()) ; |
| | | bs[index + 5] = Byte.parseByte(DateTime.yy()) ; |
| | | ByteUtil.string2BCD_BE(bs, DateTime.ss(), index) ; ; |
| | | ByteUtil.string2BCD_BE(bs, DateTime.mm(), index + 1) ; |
| | | ByteUtil.string2BCD_BE(bs, DateTime.HH(), index + 2) ; |
| | | ByteUtil.string2BCD_BE(bs, DateTime.dd(), index + 3) ; |
| | | ByteUtil.string2BCD_BE(bs, DateTime.MM(), index + 4) ; |
| | | ByteUtil.string2BCD_BE(bs, DateTime.yy(), index + 5) ; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | public static void createTp(byte[] bs, int index) throws Exception { |
| | | ByteUtil.string2BCD_BE(bs, DateTime.ss(), index) ; ; |
| | | ByteUtil.string2BCD_BE(bs, DateTime.mm(), index + 1) ; |
| | | ByteUtil.string2BCD_BE(bs, DateTime.HH(), index + 2) ; |
| | | ByteUtil.string2BCD_BE(bs, DateTime.dd(), index + 3) ; |
| | | byte month = Byte.parseByte(DateTime.MM()) ; |
| | | byte week = (byte)(DateTime.week_Int().byteValue() << 1) ; |
| | | String month1 = "0" ; |
| | | String month2 = "0" ; |
| | | if(month < 10){ |
| | | month1 = "" + month ; |
| | | }else{ |
| | | if(month == 10){ |
| | | month1 = "0" ; |
| | | }else if(month == 11){ |
| | | month1 = "1" ; |
| | | }else if(month == 12){ |
| | | month1 = "2" ; |
| | | } |
| | | week = (byte)(week | 0x01) ; |
| | | } |
| | | month2 = "" + week ; |
| | | |
| | | ByteUtil.string2BCD_BE(bs, month2 + month1, index + 4) ; |
| | | ByteUtil.string2BCD_BE(bs, DateTime.yy(), index + 5) ; |
| | | |
| | | /* |
| | | bs[index] = Byte.parseByte(DateTime.ss()) ; |
| | | bs[index + 1] = Byte.parseByte(DateTime.mm()) ; |
| | | bs[index + 2] = Byte.parseByte(DateTime.HH()) ; |
| | | bs[index + 3] = Byte.parseByte(DateTime.dd()) ; |
| | | bs[index + 4] = (byte)(DateTime.week_Int().byteValue() << 5 | Byte.parseByte(DateTime.MM())) ; |
| | | bs[index + 5] = Byte.parseByte(DateTime.yy()) ; |
| | | */ |
| | | } |
| | | |
| | | public static void createS2D(byte[] bs, int index) throws Exception { |
| | | ByteUtil.string2BCD_BE(bs, DateTime.ss(), index) ; ; |
| | | ByteUtil.string2BCD_BE(bs, DateTime.mm(), index + 1) ; |
| | | ByteUtil.string2BCD_BE(bs, DateTime.HH(), index + 2) ; |
| | | ByteUtil.string2BCD_BE(bs, DateTime.dd(), index + 3) ; |
| | | /* |
| | | bs[index] = Byte.parseByte(DateTime.ss()) ; |
| | | bs[index + 1] = Byte.parseByte(DateTime.mm()) ; |
| | | bs[index + 2] = Byte.parseByte(DateTime.HH()) ; |
| | | bs[index + 3] = Byte.parseByte(DateTime.dd()) ; |
| | | */ |
| | | } |
| | | |
| | | public static void createLen(byte[] bsNoTail) throws Exception { |
| | |
| | | bytes[1] = ProtocolConstantV206V1_0_0.P_Tail_Byte ; |
| | | return bytes ; |
| | | } |
| | | |
| | | public static void main(String[] args)throws Exception{ |
| | | byte[] bs = new byte[6] ; |
| | | createTp(bs, 0) ; |
| | | String hex = ByteUtil.bytes2Hex(bs,true, 0, 6) ; |
| | | System.out.println(hex); |
| | | } |
| | | } |
| | |
| | | */ |
| | | public static String parseIcCardNo(byte[] bs, int index, int len1, int len2)throws Exception{ |
| | | String rtuAddrBCD = "" + ByteUtil.BCD2Long_BE(bs, index, index + len1 - 1) ; |
| | | String rtuAddrStr = "" + ByteUtilUnsigned.bytes2Short_LE(bs, index + len1 + len2 -1 ) ; |
| | | String rtuAddrStr = "" + ByteUtilUnsigned.bytes2Short_LE(bs, index + len1) ; |
| | | while(rtuAddrStr.length() < 5){ |
| | | rtuAddrStr = "0" + rtuAddrStr ; |
| | | } |
| | | return rtuAddrBCD + rtuAddrStr ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分析状态与报警 |
| | | * @param bs |
| | | * @param index |
| | | * @return |
| | | */ |
| | | public static void parseAlarmAndState(byte[] bs, int index, DataCd80_5BVo vo){ |
| | | byte b = bs[index] ; |
| | | vo.statePump = (byte)(b & 0x1) ; |
| | | vo.alarmWaterRemain = (byte)(b >> 1 & 1) ; |
| | | vo.alarm0WaterRemain = (byte)(b >> 2 & 1) ; |
| | | vo.alarmExceedYear = (byte)(b >> 3 & 1) ; |
| | | vo.alarmWaterMeterFault = (byte)(b >> 4 & 1) ; |
| | | vo.alarmSteal = (byte)(b >> 5 & 1) ; |
| | | vo.alarmWaterMeterBreak = (byte)(b >> 6 & 1) ; |
| | | vo.alarmEleMeterFault = (byte)(b >> 7 & 1) ; |
| | | |
| | | index++ ; |
| | | b = bs[index] ; |
| | | vo.alarm0MoneyRemain = (byte)(b & 0x1) ; |
| | | vo.alarmInnerDoor = (byte)(b >> 1 & 1) ; |
| | | vo.alarmOuterDoor = (byte)(b >> 2 & 1) ; |
| | | vo.alarmEleMiss = (byte)(b >> 3 & 1) ; |
| | | vo.alarmEleExceed = (byte)(b >> 4 & 1) ; |
| | | vo.alarmEleLowVolt = (byte)(b >> 5 & 1) ; |
| | | vo.stateIcEnable = (byte)(b >> 6 & 1) ; |
| | | } |
| | | /** |
| | | * 分析状态与报警 |
| | | * @param bs |
| | | * @param index |
| | | * @return |
| | | */ |
| | | public static void parseAlarmAndState(byte[] bs, int index, DataCd81Vo vo){ |
| | | byte b = bs[index] ; |
| | | vo.statePump = (byte)(b & 0x1) ; |
| | | vo.alarmWaterRemain = (byte)(b >> 1 & 1) ; |
| | | vo.alarm0WaterRemain = (byte)(b >> 2 & 1) ; |
| | | vo.alarmExceedYear = (byte)(b >> 3 & 1) ; |
| | | vo.alarmWaterMeterFault = (byte)(b >> 4 & 1) ; |
| | | vo.alarmSteal = (byte)(b >> 5 & 1) ; |
| | | vo.alarmWaterMeterBreak = (byte)(b >> 6 & 1) ; |
| | | vo.alarmEleMeterFault = (byte)(b >> 7 & 1) ; |
| | | |
| | | index++ ; |
| | | b = bs[index] ; |
| | | vo.alarm0MoneyRemain = (byte)(b & 0x1) ; |
| | | vo.alarmInnerDoor = (byte)(b >> 1 & 1) ; |
| | | vo.alarmOuterDoor = (byte)(b >> 2 & 1) ; |
| | | vo.alarmEleMiss = (byte)(b >> 3 & 1) ; |
| | | vo.alarmEleExceed = (byte)(b >> 4 & 1) ; |
| | | vo.alarmEleLowVolt = (byte)(b >> 5 & 1) ; |
| | | vo.stateIcEnable = (byte)(b >> 6 & 1) ; |
| | | } |
| | | /** |
| | | * 分析状态与报警 |
| | | * @param bs |
| | | * @param index |
| | | * @return |
| | | */ |
| | | public static void parseAlarmAndState(byte[] bs, int index, DataCd84Vo vo){ |
| | | byte b = bs[index] ; |
| | | vo.statePump = (byte)(b & 0x1) ; |
| | | vo.alarmWaterRemain = (byte)(b >> 1 & 1) ; |
| | | vo.alarm0WaterRemain = (byte)(b >> 2 & 1) ; |
| | | vo.alarmExceedYear = (byte)(b >> 3 & 1) ; |
| | | vo.alarmWaterMeterFault = (byte)(b >> 4 & 1) ; |
| | | vo.alarmSteal = (byte)(b >> 5 & 1) ; |
| | | vo.alarmWaterMeterBreak = (byte)(b >> 6 & 1) ; |
| | | vo.alarmEleMeterFault = (byte)(b >> 7 & 1) ; |
| | | |
| | | index++ ; |
| | | b = bs[index] ; |
| | | vo.alarm0MoneyRemain = (byte)(b & 0x1) ; |
| | | vo.alarmInnerDoor = (byte)(b >> 1 & 1) ; |
| | | vo.alarmOuterDoor = (byte)(b >> 2 & 1) ; |
| | | vo.alarmEleMiss = (byte)(b >> 3 & 1) ; |
| | | vo.alarmEleExceed = (byte)(b >> 4 & 1) ; |
| | | vo.alarmEleLowVolt = (byte)(b >> 5 & 1) ; |
| | | vo.stateIcEnable = (byte)(b >> 6 & 1) ; |
| | | } |
| | | /** |
| | | * 分析状态与报警 |
| | | * @param bs |
| | | * @param index |
| | | * @return |
| | | */ |
| | | public static void parseAlarmAndState(byte[] bs, int index, DataCd93_A3_85Vo vo){ |
| | | byte b = bs[index] ; |
| | | vo.statePump = (byte)(b & 0x1) ; |
| | | vo.alarmWaterRemain = (byte)(b >> 1 & 1) ; |
| | | vo.alarm0WaterRemain = (byte)(b >> 2 & 1) ; |
| | | vo.alarmExceedYear = (byte)(b >> 3 & 1) ; |
| | | vo.alarmWaterMeterFault = (byte)(b >> 4 & 1) ; |
| | | vo.alarmSteal = (byte)(b >> 5 & 1) ; |
| | | vo.alarmWaterMeterBreak = (byte)(b >> 6 & 1) ; |
| | | vo.alarmEleMeterFault = (byte)(b >> 7 & 1) ; |
| | | |
| | | index++ ; |
| | | b = bs[index] ; |
| | | vo.alarm0MoneyRemain = (byte)(b & 0x1) ; |
| | | vo.alarmInnerDoor = (byte)(b >> 1 & 1) ; |
| | | vo.alarmOuterDoor = (byte)(b >> 2 & 1) ; |
| | | vo.alarmEleMiss = (byte)(b >> 3 & 1) ; |
| | | vo.alarmEleExceed = (byte)(b >> 4 & 1) ; |
| | | vo.alarmEleLowVolt = (byte)(b >> 5 & 1) ; |
| | | vo.stateIcEnable = (byte)(b >> 6 & 1) ; |
| | | } |
| | | /** |
| | | * 分析状态与报警 |
| | | * @param bs |
| | | * @param index |
| | | * @return |
| | | */ |
| | | public static void parseAlarmAndState(byte[] bs, int index, DataCdC2Vo vo){ |
| | | public static void parseAlarmAndState(byte[] bs, int index, AlarmVo vo){ |
| | | byte b = bs[index] ; |
| | | vo.statePump = (byte)(b & 0x1) ; |
| | | vo.alarmWaterRemain = (byte)(b >> 1 & 1) ; |
| | |
| | | index++ ; |
| | | dt = ByteUtil.BCD2String_BE(bs, index, index) + " " + dt ;//日 |
| | | index++ ; |
| | | //bs[index] = (byte)(bs[index] & 0x10); |
| | | bs[index] = (byte)(bs[index] & 0x1F); |
| | | dt = ByteUtil.BCD2String_BE(bs, index, index) + "-" + dt ;//月 |
| | | index++ ; |
| | | dt = "20" + ByteUtil.BCD2String_BE(bs, index, index) + "-" + dt ;//年 |
| | |
| | | cdData.useWaterType = bs[index]; |
| | | |
| | | index++ ; |
| | | cdData.orderNo = ByteUtil.BCD2String_BE(bs, index, index + 4) ; |
| | | cdData.orderNo = ByteUtil.BCD2String_BE(bs, index, index + 7) ; |
| | | |
| | | index += 8 ; |
| | | cdData.icCardAddr = ByteUtil.bytes2Hex(bs, false, index, 4) ; |
| | |
| | | cdData.rtuDt = GlParse.parseRtuDt(bs, index) ; |
| | | |
| | | index += 6 ; |
| | | int waterLevel = ByteUtil.BCD2Int_BE(bs, index, index + 3) ; |
| | | Long waterLevel = ByteUtil.BCD2Long_LE(bs, index, index + 3) ; |
| | | cdData.waterLevel = waterLevel/1000.0D; |
| | | |
| | | index += 4 ; |
| | | int waterPress = ByteUtil.BCD2Int_BE(bs, index, index + 2) ; |
| | | int waterPress = ByteUtil.BCD2Int_LE(bs, index, index + 2) ; |
| | | cdData.waterPress = waterPress/100.0D; |
| | | |
| | | index += 3 ; |
| | | int waterInstant = ByteUtil.BCD2Int_BE(bs, index, index + 3) ; |
| | | Long waterInstant = ByteUtil.BCD2Long_LE(bs, index, index + 3) ; |
| | | cdData.waterInstant = waterInstant/100.0D; |
| | | |
| | | index += 4 ; |
| | | int waterTotal = ByteUtil.BCD2Int_BE(bs, index, index + 4) ; |
| | | Long waterTotal = ByteUtil.BCD2Long_LE(bs, index, index + 4) ; |
| | | cdData.waterTotal = waterTotal/100.0D; |
| | | |
| | | index += 5 ; |
| | | int eleTotal = ByteUtil.BCD2Int_BE(bs, index, index + 4) ; |
| | | Long eleTotal = ByteUtil.BCD2Long_LE(bs, index, index + 4) ; |
| | | cdData.eleTotal = eleTotal/100.0D; |
| | | |
| | | index += 5 ; |
| | | int moneyRemain = ByteUtil.BCD2Int_BE(bs, index, index + 4) ; |
| | | Long moneyRemain = ByteUtil.BCD2Long_LE(bs, index, index + 4) ; |
| | | cdData.moneyRemain = moneyRemain/100.0D; |
| | | |
| | | index += 5 ; |
| | | int waterRemain = ByteUtil.BCD2Int_BE(bs, index, index + 4) ; |
| | | Long waterRemain = ByteUtil.BCD2Long_LE(bs, index, index + 4) ; |
| | | cdData.waterRemain = waterRemain/100.0D; |
| | | |
| | | index += 5 ; |
| | | int thisEle = ByteUtil.BCD2Int_BE(bs, index, index + 3) ; |
| | | int thisEle = ByteUtil.BCD2Int_LE(bs, index, index + 3) ; |
| | | cdData.thisEle = thisEle/100.0D; |
| | | |
| | | index += 4 ; |
| | | int thisWater = ByteUtil.BCD2Int_BE(bs, index, index + 3) ; |
| | | int thisWater = ByteUtil.BCD2Int_LE(bs, index, index + 3) ; |
| | | cdData.thisWater = thisWater/100.0D; |
| | | |
| | | index += 4 ; |
| | | int thisMoney = ByteUtil.BCD2Int_BE(bs, index, index + 3) ; |
| | | int thisMoney = ByteUtil.BCD2Int_LE(bs, index, index + 3) ; |
| | | cdData.thisMoney = thisMoney/100.0D; |
| | | |
| | | index += 4 ; |
| | | cdData.thisDuration = ByteUtil.BCD2Int_BE(bs, index, index + 1) ; |
| | | cdData.thisDuration = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | |
| | | index += 2 ; |
| | | int waterPrice = ByteUtil.BCD2Int_BE(bs, index, index + 1) ; |
| | | int waterPrice = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | cdData.waterPrice = waterPrice/100.0D; |
| | | |
| | | index += 2 ; |
| | | int elePrice = ByteUtil.BCD2Int_BE(bs, index, index + 1) ; |
| | | int elePrice = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | cdData.elePrice = elePrice/100.0D; |
| | | |
| | | index += 2 ; |
| | | GlParse.parseAlarmAndState(bs, index, cdData) ; |
| | | |
| | | index += 2 ; |
| | | int aVolt = ByteUtil.BCD2Int_BE(bs, index, index + 1) ; |
| | | int aVolt = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | cdData.aVolt = aVolt/10.0D; |
| | | |
| | | index += 2 ; |
| | | int bVolt = ByteUtil.BCD2Int_BE(bs, index, index + 1) ; |
| | | int bVolt = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | cdData.bVolt = bVolt/10.0D; |
| | | |
| | | index += 2 ; |
| | | int cVolt = ByteUtil.BCD2Int_BE(bs, index, index + 1) ; |
| | | int cVolt = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | cdData.cVolt = cVolt/10.0D; |
| | | |
| | | index += 2 ; |
| | | int aCurrent = ByteUtil.BCD2Int_BE(bs, index, index + 1) ; |
| | | int aCurrent = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | cdData.aCurrent = aCurrent/10.0D; |
| | | |
| | | index += 2 ; |
| | | int bCurrent = ByteUtil.BCD2Int_BE(bs, index, index + 1) ; |
| | | int bCurrent = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | cdData.bCurrent = bCurrent/10.0D; |
| | | |
| | | index += 2 ; |
| | | int cCurrent = ByteUtil.BCD2Int_BE(bs, index, index + 1) ; |
| | | int cCurrent = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | cdData.cCurrent = cCurrent/10.0D; |
| | | |
| | | index += 2 ; |
| | | int batteryVolt = ByteUtil.BCD2Int_BE(bs, index, index + 1) ; |
| | | int batteryVolt = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | cdData.batteryVolt = batteryVolt/100.0D; |
| | | |
| | | index += 2 ; |
| | | int waterMeterTransVolt = ByteUtil.BCD2Int_BE(bs, index, index + 1) ; |
| | | int waterMeterTransVolt = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | cdData.waterMeterTransVolt = waterMeterTransVolt/100.0D; |
| | | |
| | | index += 2 ; |
| | | int waterMeterWorkVolt = ByteUtil.BCD2Int_BE(bs, index, index + 1) ; |
| | | int waterMeterWorkVolt = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | cdData.waterMeterWorkVolt = waterMeterWorkVolt/100.0D; |
| | | |
| | | index += 2 ; |
| | | cdData.csq = ByteUtil.BCD2Int_BE(bs, index, index) ; |
| | | cdData.csq = ByteUtil.BCD2Int_LE(bs, index, index) ; |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分析功能93、A3和85数据 |
| | | * 分析功能85数据 |
| | | * @param bs |
| | | * @param cdData |
| | | * @throws Exception |
| | | */ |
| | | public static void parseCd93A3And85(byte[] bs, DataCd93_A3_85Vo cdData) throws Exception { |
| | | public static void parseCd85(byte[] bs, DataCd85Vo cdData) throws Exception { |
| | | int index = ProtocolConstantV206V202404.dataIndex ; |
| | | cdData.controllerType = ByteUtil.bytes2Hex(bs, false, index, 1) ; |
| | | |
| | | index++ ; |
| | | cdData.projectNo = (int)bs[index]; |
| | | |
| | | index ++ ; |
| | | cdData.opType = bs[index]; |
| | | |
| | | index++ ; |
| | | cdData.icCardAddr = ByteUtil.bytes2Hex(bs, false, index, 4) ; |
| | | |
| | | index += 4 ; |
| | | cdData.icCardNo = GlParse.parseIcCardNo(bs, index, 6, 2) ; |
| | | |
| | | index += 8 ; |
| | | cdData.orderNo = ByteUtil.BCD2String_BE(bs, index, index + 7) ; |
| | | |
| | | index += 8 ; |
| | | cdData.startDt = GlParse.parseRtuDt(bs, index) ; |
| | | |
| | | index += 6 ; |
| | | cdData.endDt = GlParse.parseRtuDt(bs, index) ; |
| | | |
| | | index += 6 ; |
| | | cdData.waterTotalAmount = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | cdData.eleTotalAmount = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | cdData.moneyRemain = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | cdData.waterRemain = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | cdData.thisEle = ByteUtil.BCD2Long_LE(bs, index, index + 3)/100.0D ; |
| | | |
| | | index += 4 ; |
| | | cdData.thisWater = ByteUtil.BCD2Long_LE(bs, index, index + 3)/100.0D ; |
| | | |
| | | index += 4 ; |
| | | cdData.thisMoney = ByteUtil.BCD2Long_LE(bs, index, index + 3)/100.0D ; |
| | | |
| | | index += 4 ; |
| | | cdData.thisDuration = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | |
| | | index += 2 ; |
| | | GlParse.parseAlarmAndState(bs, index, cdData) ; |
| | | } |
| | | /** |
| | | * 分析功能93、A3数据 |
| | | * @param bs |
| | | * @param cdData |
| | | * @throws Exception |
| | | */ |
| | | public static void parseCd93A3(byte[] bs, DataCd93_A3Vo cdData) throws Exception { |
| | | int index = ProtocolConstantV206V202404.dataIndex ; |
| | | cdData.controllerType = ByteUtil.bytes2Hex(bs, false, index, 1) ; |
| | | |
| | |
| | | index++ ; |
| | | cdData.icCardAddr = ByteUtil.bytes2Hex(bs, false, index, 4) ; |
| | | |
| | | index += 8 ; |
| | | index += 4 ; |
| | | cdData.icCardNo = GlParse.parseIcCardNo(bs, index, 6, 2) ; |
| | | |
| | | index += 8 ; |
| | | cdData.orderNo = ByteUtil.BCD2String_BE(bs, index, index + 7) ; |
| | | |
| | | index ++ ; |
| | | String mm = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | index ++ ; |
| | | String HH = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | index ++ ; |
| | | String dd = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | index ++ ; |
| | | String MM = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | cdData.startDt = MM + "月" + dd + "日" + HH + "时" + mm + "分" ; |
| | | index += 8 ; |
| | | cdData.startDt = GlParse.parseRtuDt(bs, index) ; |
| | | |
| | | index ++ ; |
| | | mm = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | index ++ ; |
| | | HH = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | index ++ ; |
| | | dd = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | index ++ ; |
| | | MM = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | cdData.endDt = MM + "月" + dd + "日" + HH + "时" + mm + "分" ; |
| | | index += 6 ; |
| | | cdData.endDt = GlParse.parseRtuDt(bs, index) ; |
| | | |
| | | index ++ ; |
| | | cdData.waterTotalAmount = ByteUtil.BCD2Int_BE(bs, index, index + 4)/100.0D ; |
| | | index += 6 ; |
| | | cdData.waterTotalAmount = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | cdData.eleTotalAmount = ByteUtil.BCD2Int_BE(bs, index, index + 4)/100.0D ; |
| | | cdData.eleTotalAmount = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | cdData.moneyRemain = ByteUtil.BCD2Int_BE(bs, index, index + 4)/100.0D ; |
| | | cdData.moneyRemain = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | cdData.waterRemain = ByteUtil.BCD2Int_BE(bs, index, index + 4)/100.0D ; |
| | | cdData.waterRemain = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | cdData.thisEle = ByteUtil.BCD2Int_BE(bs, index, index + 3)/100.0D ; |
| | | cdData.thisEle = ByteUtil.BCD2Long_LE(bs, index, index + 3)/100.0D ; |
| | | |
| | | index += 4 ; |
| | | cdData.thisWater = ByteUtil.BCD2Int_BE(bs, index, index + 3)/100.0D ; |
| | | cdData.thisWater = ByteUtil.BCD2Long_LE(bs, index, index + 3)/100.0D ; |
| | | |
| | | index += 4 ; |
| | | cdData.thisMoney = ByteUtil.BCD2Int_BE(bs, index, index + 3)/100.0D ; |
| | | cdData.thisMoney = ByteUtil.BCD2Long_LE(bs, index, index + 3)/100.0D ; |
| | | |
| | | index += 4 ; |
| | | cdData.thisDuration = ByteUtil.BCD2Int_BE(bs, index, index + 1) ; |
| | | cdData.thisDuration = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | |
| | | index += 2 ; |
| | | GlParse.parseAlarmAndState(bs, index, cdData) ; |
| | |
| | | sb.append("\n") ; |
| | | sb.append(" 泵状态 : ") ; |
| | | sb.append(statePump == null?"未知":(statePump.byteValue()==1?"泵/阀开":(statePump.byteValue()==0?"泵/阀关":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append(" 剩余水量报警 : ") ; |
| | | sb.append(alarmWaterRemain == null?"未知":(alarmWaterRemain.byteValue()==1?"小于报警上限":(alarmWaterRemain.byteValue()==0?"正常":"未知"))) ; |
| | | sb.append("\n") ; |
| | |
| | | sb.append("\n") ; |
| | | sb.append(" 泵状态 : ") ; |
| | | sb.append(statePump == null?"未知":(statePump.byteValue()==1?"泵/阀开":(statePump.byteValue()==0?"泵/阀关":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append(" 剩余水量报警 : ") ; |
| | | sb.append(alarmWaterRemain == null?"未知":(alarmWaterRemain.byteValue()==1?"小于报警上限":(alarmWaterRemain.byteValue()==0?"正常":"未知"))) ; |
| | | sb.append("\n") ; |
copy from pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/upVos/DataCd93_A3_85Vo.java
copy to pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/upVos/DataCd85Vo.java
File was copied from pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/upVos/DataCd93_A3_85Vo.java |
| | |
| | | |
| | | //平台/APP远程关闭水泵/阀门 + 刷卡关泵/阀上报 |
| | | @Data |
| | | public class DataCd93_A3_85Vo extends AlarmVo { |
| | | public class DataCd85Vo extends AlarmVo { |
| | | |
| | | public String controllerType;//控制器类型 01(0x01):测控一体阀;57(0x57):井电控制器 |
| | | public Integer projectNo ;//控制器类型 0x01:测控一体阀;0x57:井电控制器 |
| | | public Byte opResult ;//关泵/阀结果: 0x00:成功 0x81:失败 |
| | | public Byte opType ;//关泵/阀方式: 0x00:刷卡闭 0x01:平台关 0x02:APP关 0x03:非法卡关 0x04:水表异常关 0x05:电表异常关 0x06:剩余水量不足关 0x07:剩余金额不足关 0x08:开泵/阀后管道没有流量关 0x09:掉电再上电。 |
| | | public String icCardAddr ;//IC卡地址(远程关闭时为0) |
| | | public String icCardNo ;//IC卡编号(17位数字) |
| | |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd93_A3_85Vo(String comName){ |
| | | public DataCd85Vo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | | |
| | |
| | | sb.append("\n") ; |
| | | sb.append(" 关泵/阀类型 : ") ; |
| | | sb.append(opType == null?"未知":(opType.byteValue() == 0x00 ? "刷卡":(opType.byteValue() == 0x01 ? "平台":(opType.byteValue() == 0x02 ? "APP":(opType.byteValue() == 0x03 ? "非法卡":(opType.byteValue() == 0x04 ? "水表异常":(opType.byteValue() == 0x05 ? "电表异常":(opType.byteValue() == 0x06 ? "剩余水量不足":(opType.byteValue() == 0x07 ? "剩余金额不足":(opType.byteValue() == 0x08 ? "无流量":(opType.byteValue() == 0x09 ? "掉电再上电":"未知"))))))))))) ; |
| | | sb.append("\n") ; |
| | | sb.append(" 关启泵/阀结果 : ") ; |
| | | sb.append(opResult == null?"未知":(opResult.byteValue() == 0x00 ? "成功":"失败")) ; |
| | | sb.append("\n") ; |
| | | sb.append(" IC卡地址 : ") ; |
| | | sb.append(icCardAddr == null?"未知":icCardAddr) ; |
File was renamed from pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/upVos/DataCd93_A3_85Vo.java |
| | |
| | | |
| | | //平台/APP远程关闭水泵/阀门 + 刷卡关泵/阀上报 |
| | | @Data |
| | | public class DataCd93_A3_85Vo extends AlarmVo { |
| | | public class DataCd93_A3Vo extends AlarmVo { |
| | | |
| | | public String controllerType;//控制器类型 01(0x01):测控一体阀;57(0x57):井电控制器 |
| | | public Integer projectNo ;//控制器类型 0x01:测控一体阀;0x57:井电控制器 |
| | |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd93_A3_85Vo(String comName){ |
| | | public DataCd93_A3Vo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | | |
New file |
| | |
| | | package com.dy.common.singleDataSource; |
| | | |
| | | import com.alibaba.druid.pool.DruidDataSource; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import javax.sql.DataSource; |
| | | import java.sql.SQLException; |
| | | |
| | | @Configuration |
| | | public class DruidDataSourceConfig { |
| | | |
| | | //编写方法,注入DruidDataSource |
| | | //还有说明一下为什么我们注入自己的DataSource , 默认的HiKariDatasource失效? |
| | | //1. 默认的数据源 如配置? @ConditionalOnMissingBean({ DataSource.class, XADataSource.class }) |
| | | // 解读通过@ConditionalOnMissingBean({ DataSource.class}) 判断如果容器有DataSource Bean 就不注入默认的HiKariDatasource |
| | | @ConfigurationProperties("spring.datasource") |
| | | @Bean |
| | | public DataSource dataSource() throws SQLException { |
| | | //1. 配置了 @ConfigurationProperties("spring.datasource") |
| | | // 就可以读取到application.yml的配置 |
| | | //2. 我们就不需要调用DruidDataSource 对象的setXxx, 会自动关联 |
| | | |
| | | DruidDataSource druidDataSource = new DruidDataSource(); |
| | | return druidDataSource; |
| | | } |
| | | } |
File was renamed from pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/aop/SsoRestTemplateConfiguration.java |
| | |
| | | package com.dy.common.aop; |
| | | package com.dy.common.springUtil; |
| | | |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | /** |
| | | * 为SsoAspect访问单点登录系统提供 RestTemplate |
| | | * 提供 RestTemplate |
| | | */ |
| | | @Configuration |
| | | public class SsoRestTemplateConfiguration { |
| | | public class RestTemplateConfiguration { |
| | | |
| | | @Bean |
| | | public RestTemplate restTemplate(){ |