|  |  | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson2.JSONObject; | 
 |  |  | import com.dy.common.aop.SsoAop; | 
 |  |  | import com.dy.common.mw.protocol.p206V1_0_0.CodeV1_0_1; | 
 |  |  | import com.dy.common.mw.protocol.p206V1_0_0.downVos.*; | 
 |  |  | import com.dy.common.multiDataSource.DataSourceContext; | 
 |  |  | import com.dy.common.mw.protocol.p206V1.CodeV1; | 
 |  |  | import com.dy.common.mw.protocol.p206V1.ProtocolConstantV206V1; | 
 |  |  | import com.dy.common.mw.protocol.p206V1.downVos.*; | 
 |  |  | import com.dy.common.mw.protocol.p206V2.ProtocolConstantV206V2; | 
 |  |  | import com.dy.common.mw.protocol.p206V202404.CodeV202404; | 
 |  |  | import com.dy.common.mw.protocol.p206V202404.ProtocolConstantV206V202404; | 
 |  |  | import com.dy.common.mw.protocol.p206V202404.downVos.ComCdXyVo; | 
 |  |  | import com.dy.common.util.IDLongGenerator; | 
 |  |  | import com.dy.common.webUtil.BaseResponse; | 
 |  |  | 
 |  |  | import org.springframework.web.bind.annotation.RestController; | 
 |  |  |  | 
 |  |  | import java.util.Objects; | 
 |  |  |  | 
 |  |  | //import com.dy.common.mw.protocol.p206V1_0_0.downVos.Com97Vo; | 
 |  |  | //import com.dy.common.mw.protocol.p206V1_0_0.downVos.ComXyVo; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * @author ZhuBaoMin | 
 |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 通用查询接口 | 
 |  |  |      * p206V1_0_1 | 
 |  |  |      * p206V1 | 
 |  |  |      *   66     查询IP和端口 | 
 |  |  |      *   67     查询流量采集周期 | 
 |  |  |      *   68     查询用户余额报警值 | 
 |  |  | 
 |  |  |         Long operator = po.getOperator(); | 
 |  |  |         Long comId = idLongGenerator.generate(); | 
 |  |  |  | 
 |  |  |         // 获取系统参数 | 
 |  |  |         if(!setuped) { | 
 |  |  |             setUp(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 取水口ID换阀控器地址及通讯协议 | 
 |  |  |         JSONObject job_rtu = getRtu(intakeId, null); | 
 |  |  |         if(job_rtu == null) { | 
 |  |  | 
 |  |  |         } | 
 |  |  |         String rtuAddr = job_rtu.getString("rtuAddr"); | 
 |  |  |         String protocol = job_rtu.getString("protocol"); | 
 |  |  |         String orgTag = job_rtu.getString("orgTag"); | 
 |  |  |         //String orgTag = job_rtu.getString("orgTag"); | 
 |  |  |         String orgTag = DataSourceContext.get(); | 
 |  |  |         comSendUrl = env.getProperty(pro_mw + "." + orgTag + "." + key_mw); | 
 |  |  |  | 
 |  |  |         // 获取功能码 | 
 |  |  |         String commandCode = po.getCommandCode(); | 
 |  |  |         if(protocol.equals("p206V202404")) { | 
 |  |  |         if(protocol.equals(ProtocolConstantV206V202404.protocolName)) { | 
 |  |  |             // 创建视图 | 
 |  |  |             ComCdXyVo param = new ComCdXyVo(); | 
 |  |  |             param.controllerType = controllerType; | 
 |  |  | 
 |  |  |             myParam.setRtuResultSendWebUrl(rtuCallbackUrl_rm); | 
 |  |  |             myParam.setOperator(operator); | 
 |  |  |             return dealWithCommandResult(myParam); | 
 |  |  |         } else if(protocol.equals("p206V1_0_1")) { | 
 |  |  |         } else if(protocol.equals(ProtocolConstantV206V1.protocolName) || protocol.equals(ProtocolConstantV206V2.protocolName)) { | 
 |  |  |             // 创建视图 | 
 |  |  |             ComXyVo param = new ComXyVo(); | 
 |  |  |             param.setCommandCode(commandCode); | 
 |  |  | 
 |  |  |             myParam.setComId(comId); | 
 |  |  |             myParam.setComType((byte)2); | 
 |  |  |             myParam.setCommandCode(commandCode); | 
 |  |  |             myParam.setCommandName(CodeV1_0_1.getCodeName(commandCode)); | 
 |  |  |             myParam.setCommandName(CodeV1.getCodeName(commandCode)); | 
 |  |  |             myParam.setIntakeId(intakeId); | 
 |  |  |             myParam.setRtuAddr(rtuAddr); | 
 |  |  |             myParam.setProtocol(protocol); | 
 |  |  | 
 |  |  |         Long operator = po.getOperator(); | 
 |  |  |         Long comId = idLongGenerator.generate(); | 
 |  |  |  | 
 |  |  |         // 获取系统参数 | 
 |  |  |         if(!setuped) { | 
 |  |  |             setUp(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 取水口ID换阀控器地址及通讯协议 | 
 |  |  |         JSONObject job_rtu = getRtu(intakeId, null); | 
 |  |  |         if(job_rtu == null) { | 
 |  |  | 
 |  |  |         } | 
 |  |  |         String rtuAddr = job_rtu.getString("rtuAddr"); | 
 |  |  |         String protocol = job_rtu.getString("protocol"); | 
 |  |  |         String orgTag = job_rtu.getString("orgTag"); | 
 |  |  |         //String orgTag = job_rtu.getString("orgTag"); | 
 |  |  |         String orgTag = DataSourceContext.get(); | 
 |  |  |         comSendUrl = env.getProperty(pro_mw + "." + orgTag + "." + key_mw); | 
 |  |  |  | 
 |  |  |         // 获取功能码 | 
 |  |  |         String commandCode = po.getCommandCode(); | 
 |  |  |         if(protocol.equals("p206V202404")) { | 
 |  |  |         if(protocol.equals(ProtocolConstantV206V202404.protocolName)) { | 
 |  |  |             return BaseResponseUtils.buildSuccess(""); | 
 |  |  |         } else if(protocol.equals("p206V1_0_1")) { | 
 |  |  |         } else if(protocol.equals(ProtocolConstantV206V1.protocolName) || protocol.equals(ProtocolConstantV206V2.protocolName)) { | 
 |  |  |             // 创建视图 | 
 |  |  |             Com37Vo param = new Com37Vo(); | 
 |  |  |             param.setSeconds(po.getSeconds()); | 
 |  |  | 
 |  |  |             myParam.setComId(comId); | 
 |  |  |             myParam.setComType((byte)2); | 
 |  |  |             myParam.setCommandCode(commandCode); | 
 |  |  |             myParam.setCommandName(CodeV1_0_1.getCodeName(commandCode)); | 
 |  |  |             myParam.setCommandName(CodeV1.getCodeName(commandCode)); | 
 |  |  |             myParam.setIntakeId(intakeId); | 
 |  |  |             myParam.setRtuAddr(rtuAddr); | 
 |  |  |             myParam.setProtocol(protocol); | 
 |  |  | 
 |  |  |         Long operator = po.getOperator(); | 
 |  |  |         Long comId = idLongGenerator.generate(); | 
 |  |  |  | 
 |  |  |         // 获取系统参数 | 
 |  |  |         if(!setuped) { | 
 |  |  |             setUp(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 取水口ID换阀控器地址及通讯协议 | 
 |  |  |         JSONObject job_rtu = getRtu(intakeId, null); | 
 |  |  |         if(job_rtu == null) { | 
 |  |  | 
 |  |  |         } | 
 |  |  |         String rtuAddr = job_rtu.getString("rtuAddr"); | 
 |  |  |         String protocol = job_rtu.getString("protocol"); | 
 |  |  |         String orgTag = job_rtu.getString("orgTag"); | 
 |  |  |         //String orgTag = job_rtu.getString("orgTag"); | 
 |  |  |         String orgTag = DataSourceContext.get(); | 
 |  |  |         comSendUrl = env.getProperty(pro_mw + "." + orgTag + "." + key_mw); | 
 |  |  |  | 
 |  |  |         // 获取功能码 | 
 |  |  |         String commandCode = po.getCommandCode(); | 
 |  |  |         if(protocol.equals("p206V202404")) { | 
 |  |  |         if(protocol.equals(ProtocolConstantV206V202404.protocolName)) { | 
 |  |  |             return BaseResponseUtils.buildSuccess(""); | 
 |  |  |         } else if(protocol.equals("p206V1_0_1")) { | 
 |  |  |         } else if(protocol.equals(ProtocolConstantV206V1.protocolName) || protocol.equals(ProtocolConstantV206V2.protocolName)) { | 
 |  |  |             // 创建视图 | 
 |  |  |             Com21Vo param = new Com21Vo(); | 
 |  |  |             param.setIp(po.getIp()); | 
 |  |  | 
 |  |  |             myParam.setComId(comId); | 
 |  |  |             myParam.setComType((byte)2); | 
 |  |  |             myParam.setCommandCode(commandCode); | 
 |  |  |             myParam.setCommandName(CodeV1_0_1.getCodeName(commandCode)); | 
 |  |  |             myParam.setCommandName(CodeV1.getCodeName(commandCode)); | 
 |  |  |             myParam.setIntakeId(intakeId); | 
 |  |  |             myParam.setRtuAddr(rtuAddr); | 
 |  |  |             myParam.setProtocol(protocol); | 
 |  |  | 
 |  |  |         Long operator = po.getOperator(); | 
 |  |  |         Long comId = idLongGenerator.generate(); | 
 |  |  |  | 
 |  |  |         // 获取系统参数 | 
 |  |  |         if(!setuped) { | 
 |  |  |             setUp(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 取水口ID换阀控器地址及通讯协议 | 
 |  |  |         JSONObject job_rtu = getRtu(intakeId, null); | 
 |  |  |         if(job_rtu == null) { | 
 |  |  | 
 |  |  |         } | 
 |  |  |         String rtuAddr = job_rtu.getString("rtuAddr"); | 
 |  |  |         String protocol = job_rtu.getString("protocol"); | 
 |  |  |         String orgTag = job_rtu.getString("orgTag"); | 
 |  |  |         //String orgTag = job_rtu.getString("orgTag"); | 
 |  |  |         String orgTag = DataSourceContext.get(); | 
 |  |  |         comSendUrl = env.getProperty(pro_mw + "." + orgTag + "." + key_mw); | 
 |  |  |  | 
 |  |  |         // 获取功能码 | 
 |  |  |         String commandCode = po.getCommandCode(); | 
 |  |  |         if(protocol.equals("p206V202404")) { | 
 |  |  |         if(protocol.equals(ProtocolConstantV206V202404.protocolName)) { | 
 |  |  |             return BaseResponseUtils.buildSuccess(""); | 
 |  |  |         } else if(protocol.equals("p206V1_0_1")) { | 
 |  |  |         } else if(protocol.equals(ProtocolConstantV206V1.protocolName) || protocol.equals(ProtocolConstantV206V2.protocolName)) { | 
 |  |  |             // 创建视图 | 
 |  |  |             Com38Vo param = new Com38Vo(); | 
 |  |  |             param.setRemainMoneyAlarm(po.getRemainMoneyAlarm()); | 
 |  |  | 
 |  |  |             myParam.setComId(comId); | 
 |  |  |             myParam.setComType((byte)2); | 
 |  |  |             myParam.setCommandCode(commandCode); | 
 |  |  |             myParam.setCommandName(CodeV1_0_1.getCodeName(commandCode)); | 
 |  |  |             myParam.setCommandName(CodeV1.getCodeName(commandCode)); | 
 |  |  |             myParam.setIntakeId(intakeId); | 
 |  |  |             myParam.setRtuAddr(rtuAddr); | 
 |  |  |             myParam.setProtocol(protocol); | 
 |  |  | 
 |  |  |         Long operator = po.getOperator(); | 
 |  |  |         Long comId = idLongGenerator.generate(); | 
 |  |  |  | 
 |  |  |         // 获取系统参数 | 
 |  |  |         if(!setuped) { | 
 |  |  |             setUp(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 取水口ID换阀控器地址及通讯协议 | 
 |  |  |         JSONObject job_rtu = getRtu(intakeId, null); | 
 |  |  |         if(job_rtu == null) { | 
 |  |  | 
 |  |  |         } | 
 |  |  |         String rtuAddr = job_rtu.getString("rtuAddr"); | 
 |  |  |         String protocol = job_rtu.getString("protocol"); | 
 |  |  |         String orgTag = job_rtu.getString("orgTag"); | 
 |  |  |         //String orgTag = job_rtu.getString("orgTag"); | 
 |  |  |         String orgTag = DataSourceContext.get(); | 
 |  |  |         comSendUrl = env.getProperty(pro_mw + "." + orgTag + "." + key_mw); | 
 |  |  |  | 
 |  |  |         // 获取功能码 | 
 |  |  |         String commandCode = po.getCommandCode(); | 
 |  |  |         if(protocol.equals("p206V202404")) { | 
 |  |  |         if(protocol.equals(ProtocolConstantV206V202404.protocolName)) { | 
 |  |  |             return BaseResponseUtils.buildSuccess(""); | 
 |  |  |         } else if(protocol.equals("p206V1_0_1")) { | 
 |  |  |         } else if(protocol.equals(ProtocolConstantV206V1.protocolName) || protocol.equals(ProtocolConstantV206V2.protocolName)) { | 
 |  |  |             // 创建视图 | 
 |  |  |             Com39Vo param = new Com39Vo(); | 
 |  |  |             param.setBatteryVoltAlarm(po.getBatteryVoltAlarm()); | 
 |  |  | 
 |  |  |             myParam.setComId(comId); | 
 |  |  |             myParam.setComType((byte)2); | 
 |  |  |             myParam.setCommandCode(commandCode); | 
 |  |  |             myParam.setCommandName(CodeV1_0_1.getCodeName(commandCode)); | 
 |  |  |             myParam.setCommandName(CodeV1.getCodeName(commandCode)); | 
 |  |  |             myParam.setIntakeId(intakeId); | 
 |  |  |             myParam.setRtuAddr(rtuAddr); | 
 |  |  |             myParam.setProtocol(protocol); |