表阀一体机:web后端系统,实现功能码5B、5C、15、16、22、30、31、50、55、56、65、68、97、98、99远程命令。
13 文件已复制
3 文件已重命名
31个文件已修改
2个文件已删除
45个文件已添加
| | |
| | | s += (protocol == null ? "" : ("协议=" + protocol + "\n")); |
| | | s += (protocolVersion == null ? "" : ("协议版本号=" + protocolVersion + "\n")); |
| | | s += (rtuAddr == null ? "" : ("Rtu地址=" + rtuAddr + "\n")); |
| | | s += "命令类型=" + (type.equals(CommandType.innerCommand)?"内部命令":"RTU命令") + "\n" ; |
| | | s += "命令类型=" + (type.equals(CommandType.innerCommand)?"内部命令":(type.equals(CommandType.outerCommand)?"RTU命令":"透传命令")) + "\n" ; |
| | | s += (code == null ? "" : ("功能码=" + code + "\n")) ; |
| | | s += (rtuResultSendWebUrl == null ? "" : ("回调网址=" + rtuResultSendWebUrl + "\n")); |
| | | if(param != null){ |
| | |
| | | cdData.waterAlarm = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | |
| | | index += 2 ; |
| | | cdData.moneyAlarm = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | cdData.moneyAlarm = ByteUtil.BCD2Int_LE(bs, index, index + 1)/100 ; |
| | | |
| | | } |
| | | } |
| | |
| | | return sb.toString() ; |
| | | } |
| | | |
| | | |
| | | public String toStr(){ |
| | | StringBuffer sb = new StringBuffer() ; |
| | | sb.append("泵/阀状态 : ") ; |
| | | sb.append(statePump == null?"未知":(statePump.byteValue()==1?"泵/阀开":(statePump.byteValue()==0?"泵/阀关":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append("剩余水量报警 : ") ; |
| | | sb.append(alarmWaterRemain == null?"未知":(alarmWaterRemain.byteValue() == 0 ? "正常":(alarmWaterRemain.byteValue() == 1 ? "报警":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append("剩余0水量关泵/阀 : ") ; |
| | | sb.append(alarm0WaterRemain == null?"未知":(alarm0WaterRemain.byteValue() == 0 ? "正常":(alarm0WaterRemain.byteValue() == 1 ? "关泵/阀":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append("年度超采 : ") ; |
| | | sb.append(alarmExceedYear == null?"未知":(alarmExceedYear.byteValue() == 0 ? "正常":(alarmExceedYear.byteValue() == 1 ? "报警":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append("流量计故障 : ") ; |
| | | sb.append(alarmWaterMeterFault == null?"未知":(alarmWaterMeterFault.byteValue() == 0 ? "正常":(alarmWaterMeterFault.byteValue() == 1 ? "报警":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append("偷水 : ") ; |
| | | sb.append(alarmSteal == null?"未知":(alarmSteal.byteValue() == 0 ? "正常":(alarmSteal.byteValue() == 1 ? "报警":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append("流量计损坏 : ") ; |
| | | sb.append(alarmWaterMeterBreak == null?"未知":(alarmWaterMeterBreak.byteValue() == 0 ? "正常":(alarmWaterMeterBreak.byteValue() == 1 ? "报警":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append("电表故障 : ") ; |
| | | sb.append(alarmEleMeterFault == null?"未知":(alarmEleMeterFault.byteValue() == 0 ? "正常":(alarmEleMeterFault.byteValue() == 1 ? "报警":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append("剩余0金额关泵/阀 : ") ; |
| | | sb.append(alarm0MoneyRemain == null?"未知":(alarm0MoneyRemain.byteValue() == 0 ? "正常":(alarm0MoneyRemain.byteValue() == 1 ? "关泵/阀":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append("控制器内门 : ") ; |
| | | sb.append(alarmDoor == null?"未知":(alarmDoor.byteValue() == 0 ? "正常":(alarmDoor.byteValue() == 1 ? "报警":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append("电池电压低 : ") ; |
| | | sb.append(alarmBatteryVolt == null?"未知":(alarmBatteryVolt.byteValue() == 0 ? "正常":(alarmBatteryVolt.byteValue() == 1 ? "报警":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append("交流缺项 : ") ; |
| | | sb.append(alarmEleMiss == null?"未知":(alarmEleMiss.byteValue() == 0 ? "正常":(alarmEleMiss.byteValue() == 1 ? "报警":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append("交流过流 : ") ; |
| | | sb.append(alarmEleExceed == null?"未知":(alarmEleExceed.byteValue() == 0 ? "正常":(alarmEleExceed.byteValue() == 1 ? "报警":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append("三相电欠压 : ") ; |
| | | sb.append(alarmEleLowVolt == null?"未知":(alarmEleLowVolt.byteValue() == 0 ? "正常":(alarmEleLowVolt.byteValue() == 1 ? "报警":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append("IC卡功能 : ") ; |
| | | sb.append(stateIcEnable == null?"未知":(stateIcEnable.byteValue() == 0 ? "无效":(stateIcEnable.byteValue() == 1 ? "有效":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append("阀门开关状态 : ") ; |
| | | sb.append(stateOpClValve == null?"未知":(stateOpClValve.byteValue() == 0 ? "正常":(stateOpClValve.byteValue() == 1 ? "未到位":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append("阀门堵转报警 : ") ; |
| | | sb.append(alarmBlockValve == null?"未知":(alarmBlockValve.byteValue() == 0 ? "正常":(alarmBlockValve.byteValue() == 1 ? "报警":"未知"))) ; |
| | | sb.append("\n") ; |
| | | |
| | | return sb.toString() ; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.CommonV202404; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd10Vo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_10) ; |
| | | } |
| | | public DataCd10Vo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.CommonV202404; |
| | | import lombok.Data; |
| | | |
| | |
| | | public String rtuAddr;//控制器新地址 |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd50Vo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_50) ; |
| | | } |
| | | |
| | | public DataCd50Vo(String comName){ |
| | | this.comName = comName ; |
| | |
| | | return sb.toString() ; |
| | | } |
| | | |
| | | public String toStr(boolean showBase){ |
| | | StringBuffer sb = new StringBuffer() ; |
| | | if(showBase){ |
| | | sb.append(comName + " : \n") ; |
| | | sb.append("控制器类型 : ") ; |
| | | sb.append(CommonV202404.ctrlDevType(controllerType)) ; |
| | | sb.append("\n") ; |
| | | sb.append("项目编号 : ") ; |
| | | sb.append(projectNo == null?"未知":projectNo) ; |
| | | sb.append("\n") ; |
| | | } |
| | | sb.append("控制器地址 : ") ; |
| | | sb.append(rtuAddr == null?"未知": rtuAddr) ; |
| | | sb.append("\n") ; |
| | | return sb.toString() ; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.CommonV202404; |
| | | import lombok.Data; |
| | | |
| | |
| | | public String dt ;//充值时间(yyyy-mm-dd HH:mm:ss) |
| | | |
| | | public String comName ;//命令名称 |
| | | public DataCd55Vo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_55) ; |
| | | } |
| | | |
| | | public DataCd55Vo(String comName){ |
| | | this.comName = comName ; |
| | |
| | | return sb.toString() ; |
| | | } |
| | | |
| | | public String toStr(boolean showBase){ |
| | | StringBuffer sb = new StringBuffer() ; |
| | | if(showBase){ |
| | | sb.append(comName + " : \n") ; |
| | | sb.append("控制器类型 : ") ; |
| | | sb.append(CommonV202404.ctrlDevType(controllerType)) ; |
| | | sb.append("\n") ; |
| | | sb.append("项目编号 : ") ; |
| | | sb.append(projectNo == null?"未知":projectNo) ; |
| | | sb.append("\n") ; |
| | | } |
| | | sb.append("IC卡地址 : ") ; |
| | | sb.append(icCardAddr == null?"未知":icCardAddr) ; |
| | | sb.append("\n") ; |
| | | sb.append("用户卡序列号 : ") ; |
| | | sb.append(icCardNo == null?"未知":icCardNo) ; |
| | | sb.append("\n") ; |
| | | sb.append("充值金额 : ") ; |
| | | sb.append(chargeMoney == null?"未知":chargeMoney) ; |
| | | sb.append("\n") ; |
| | | sb.append("充值水量 : ") ; |
| | | sb.append(chargeWater == null?"未知":chargeWater) ; |
| | | sb.append("\n") ; |
| | | sb.append("流水号 : ") ; |
| | | sb.append(flowNo == null?"未知":flowNo) ; |
| | | sb.append("\n") ; |
| | | sb.append("充值结果 : ") ; |
| | | sb.append(success == null?"未知":(success.booleanValue()?"成功":"失败")) ; |
| | | sb.append("\n") ; |
| | | sb.append("充值时间 : ") ; |
| | | sb.append(dt == null?"未知":dt) ; |
| | | sb.append("\n") ; |
| | | return sb.toString() ; |
| | | } |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import lombok.Data; |
| | | |
| | | //查询设备终端剩余水量和剩余金额报警值 |
| | |
| | | public Integer moneyAlarm ;//剩余金额报警值,单位:元。整数,取值范围0~65535 |
| | | |
| | | public String comName ;//命令名称 |
| | | public DataCd56Vo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_56) ; |
| | | } |
| | | |
| | | public DataCd56Vo(String comName){ |
| | | this.comName = comName ; |
| | |
| | | return sb.toString() ; |
| | | } |
| | | |
| | | public String toStr(boolean showBase){ |
| | | StringBuffer sb = new StringBuffer() ; |
| | | if(showBase){ |
| | | sb.append(comName + " : \n") ; |
| | | sb.append("控制器类型 : ") ; |
| | | sb.append(controllerType == null?"未知":(controllerType.equals("01")?"测控一体阀":(controllerType.equals("57")?"井电控制器":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append("项目编号 : ") ; |
| | | sb.append(projectNo == null?"未知":projectNo) ; |
| | | sb.append("\n") ; |
| | | } |
| | | sb.append("剩余金额报警值 : ") ; |
| | | sb.append(moneyAlarm == null?"未知":moneyAlarm) ; |
| | | sb.append("\n") ; |
| | | sb.append("剩余水量报警值 : ") ; |
| | | sb.append(waterAlarm == null?"未知":waterAlarm) ; |
| | | sb.append("\n") ; |
| | | return sb.toString() ; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.CommonV202404; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd5CVo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_5C) ; |
| | | } |
| | | public DataCd5CVo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | |
| | | return sb.toString() ; |
| | | } |
| | | |
| | | public String toStr(boolean showBase){ |
| | | StringBuffer sb = new StringBuffer() ; |
| | | if(showBase){ |
| | | sb.append(comName + " : \n") ; |
| | | sb.append("控制器类型 : ") ; |
| | | sb.append(CommonV202404.ctrlDevType(controllerType)) ; |
| | | sb.append("\n") ; |
| | | sb.append("项目编号 : ") ; |
| | | sb.append(projectNo == null?"未知":projectNo) ; |
| | | sb.append("\n") ; |
| | | } |
| | | sb.append("观察时间 : ") ; |
| | | sb.append(dt == null?"未知":dt) ; |
| | | sb.append("\n") ; |
| | | sb.append("当日水表净流量 : ") ; |
| | | sb.append(meterAmountDay == null?"未知":meterAmountDay) ; |
| | | sb.append("\n") ; |
| | | sb.append("当日用户用水量 : ") ; |
| | | sb.append(farmerAmountDay == null?"未知":farmerAmountDay) ; |
| | | sb.append("\n") ; |
| | | sb.append("当日漏损水量 : ") ; |
| | | sb.append(lossAmountDay == null?"未知":lossAmountDay) ; |
| | | sb.append("\n") ; |
| | | return sb.toString() ; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.CommonV202404; |
| | | import lombok.Data; |
| | | |
| | |
| | | public Byte useWaterType ;//用水方式(0x00:正常刷卡开泵/阀用水 0x01:平台远程开泵/阀用水 0x02:用户远程开泵/阀用水 0x03:测试卡,0x04:其它) |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd65Vo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_65) ; |
| | | } |
| | | public DataCd65Vo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | |
| | | return sb.toString() ; |
| | | } |
| | | |
| | | public String toStr(boolean showBase){ |
| | | StringBuffer sb = new StringBuffer() ; |
| | | if(showBase){ |
| | | sb.append(comName + " : \n") ; |
| | | sb.append("控制器类型 : ") ; |
| | | sb.append(CommonV202404.ctrlDevType(controllerType)) ; |
| | | sb.append("\n") ; |
| | | sb.append("项目编号 : ") ; |
| | | sb.append(projectNo == null?"未知":projectNo) ; |
| | | sb.append("\n") ; |
| | | } |
| | | sb.append("用水方式 : ") ; |
| | | sb.append(useWaterType == null?"未知":(useWaterType.byteValue()==0?"刷卡开泵/阀":(useWaterType.byteValue()==1?"平台远程开泵/阀":(useWaterType.byteValue()==2?"APP远程开泵/阀":(useWaterType.byteValue()==3?"测试卡开泵/阀":(useWaterType.byteValue()==4?"其他":"未知")))))) ; |
| | | sb.append("\n") ; |
| | | sb.append("IC卡地址 : ") ; |
| | | sb.append(icCardAddr == null?"未知":icCardAddr) ; |
| | | sb.append("\n") ; |
| | | sb.append("用户卡序列号 : ") ; |
| | | sb.append(icCardNo == null?"未知":icCardNo) ; |
| | | sb.append("\n") ; |
| | | sb.append("用户剩余金额 : ") ; |
| | | sb.append(moneyRemain == null?"未知":moneyRemain) ; |
| | | sb.append("\n") ; |
| | | sb.append("用户剩余水量 : ") ; |
| | | sb.append(waterRemain == null?"未知":waterRemain) ; |
| | | sb.append("\n") ; |
| | | sb.append("本次使用电量 : ") ; |
| | | sb.append(thisEle == null?"未知":thisEle) ; |
| | | sb.append("\n") ; |
| | | sb.append("本次使用水量 : ") ; |
| | | sb.append(thisWater == null?"未知":thisWater) ; |
| | | sb.append("\n") ; |
| | | sb.append("本次开始时间 : ") ; |
| | | sb.append(rtuStartDt == null?"未知":rtuStartDt) ; |
| | | sb.append("\n") ; |
| | | sb.append("本次结束时间 : ") ; |
| | | sb.append(rtuEndDt == null?"未知":rtuEndDt) ; |
| | | sb.append("\n") ; |
| | | return sb.toString() ; |
| | | } |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.CommonV202404; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd68Vo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_68) ; |
| | | } |
| | | public DataCd68Vo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | |
| | | return sb.toString() ; |
| | | } |
| | | |
| | | public String toStr(boolean showBase){ |
| | | StringBuffer sb = new StringBuffer() ; |
| | | if(showBase){ |
| | | sb.append(comName + " : \n") ; |
| | | sb.append("控制器类型 : ") ; |
| | | sb.append(CommonV202404.ctrlDevType(controllerType)) ; |
| | | sb.append("\n") ; |
| | | sb.append("项目编号 : ") ; |
| | | sb.append(projectNo == null?"未知":projectNo) ; |
| | | sb.append("\n") ; |
| | | } |
| | | sb.append("机井年最大用水量 : ") ; |
| | | sb.append(maxAmountYear == null?"未知":maxAmountYear) ; |
| | | sb.append("\n") ; |
| | | sb.append("水位下限 : ") ; |
| | | sb.append(limitLevel == null?"未知":limitLevel) ; |
| | | sb.append("\n") ; |
| | | return sb.toString() ; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.CommonV202404; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd80_5BVo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_5B) ; |
| | | } |
| | | public DataCd80_5BVo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | |
| | | sb.append(" 信号强度 : ") ; |
| | | sb.append(csq == null?"未知":csq) ; |
| | | sb.append("\n") ; |
| | | return sb.toString() + super.toString() ; |
| | | return sb + super.toString() ; |
| | | } |
| | | |
| | | public String toStr(boolean showBase){ |
| | | StringBuffer sb = new StringBuffer() ; |
| | | if(showBase){ |
| | | sb.append(comName + " : \n") ; |
| | | sb.append("控制器类型 : ") ; |
| | | sb.append(CommonV202404.ctrlDevType(controllerType)) ; |
| | | sb.append("\n") ; |
| | | sb.append("项目编号 : ") ; |
| | | sb.append(projectNo == null?"未知":projectNo) ; |
| | | sb.append("\n") ; |
| | | sb.append("用水方式 : ") ; |
| | | sb.append(useWaterType == null?"未知":(useWaterType.byteValue()==0?"刷卡开泵/阀":(useWaterType.byteValue()==1?"平台远程开泵/阀":(useWaterType.byteValue()==2?"APP远程开泵/阀":(useWaterType.byteValue()==3?"测试卡开泵/阀":(useWaterType.byteValue()==4?"其他":"未知")))))) ; |
| | | sb.append("\n") ; |
| | | } |
| | | sb.append("订单号 : ") ; |
| | | sb.append(orderNo == null?"未知":orderNo) ; |
| | | sb.append("\n") ; |
| | | sb.append("IC卡地址 : ") ; |
| | | sb.append(icCardAddr == null?"未知":icCardAddr) ; |
| | | sb.append("\n") ; |
| | | sb.append("用户卡序列号 : ") ; |
| | | sb.append(icCardNo == null?"未知":icCardNo) ; |
| | | sb.append("\n") ; |
| | | sb.append("观察时间 : ") ; |
| | | sb.append(rtuDt == null?"未知":rtuDt) ; |
| | | sb.append("\n") ; |
| | | sb.append("水位 : ") ; |
| | | sb.append(waterLevel == null?"未知":waterLevel) ; |
| | | sb.append("\n") ; |
| | | sb.append("水压 : ") ; |
| | | sb.append(waterPress == null?"未知":waterPress) ; |
| | | sb.append("\n") ; |
| | | sb.append("瞬时流量 : ") ; |
| | | sb.append(waterInstant == null?"未知":waterInstant) ; |
| | | sb.append("\n") ; |
| | | sb.append("水表累计流量 : ") ; |
| | | sb.append(waterTotal == null?"未知":waterTotal) ; |
| | | sb.append("\n") ; |
| | | sb.append("电表累计电量 : ") ; |
| | | sb.append(eleTotal == null?"未知":eleTotal) ; |
| | | sb.append("\n") ; |
| | | sb.append("用户剩余金额 : ") ; |
| | | sb.append(moneyRemain == null?"未知":moneyRemain) ; |
| | | sb.append("\n") ; |
| | | sb.append("用户剩余水量 : ") ; |
| | | sb.append(waterRemain == null?"未知":waterRemain) ; |
| | | sb.append("\n") ; |
| | | sb.append("本次使用电量 : ") ; |
| | | sb.append(thisEle == null?"未知":thisEle) ; |
| | | sb.append("\n") ; |
| | | sb.append("本次使用水量 : ") ; |
| | | sb.append(thisWater == null?"未知":thisWater) ; |
| | | sb.append("\n") ; |
| | | sb.append("本次使用金额 : ") ; |
| | | sb.append(thisMoney == null?"未知":thisMoney) ; |
| | | sb.append("\n") ; |
| | | sb.append("本次使用时长 : ") ; |
| | | sb.append(thisDuration == null?"未知":thisDuration) ; |
| | | sb.append("\n") ; |
| | | sb.append("当前水量单价 : ") ; |
| | | sb.append(waterPrice == null?"未知":waterPrice) ; |
| | | sb.append("\n") ; |
| | | sb.append("当前电量单价 : ") ; |
| | | sb.append(elePrice == null?"未知":elePrice) ; |
| | | sb.append("\n") ; |
| | | sb.append("交流A相电压 : ") ; |
| | | sb.append(aVolt == null?"未知":aVolt) ; |
| | | sb.append("\n") ; |
| | | sb.append("交流B相电压 : ") ; |
| | | sb.append(bVolt == null?"未知":bVolt) ; |
| | | sb.append("\n") ; |
| | | sb.append("交流C相电压 : ") ; |
| | | sb.append(cVolt == null?"未知":cVolt) ; |
| | | sb.append("\n") ; |
| | | sb.append("交流A相电流 : ") ; |
| | | sb.append(aCurrent == null?"未知":aCurrent) ; |
| | | sb.append("\n") ; |
| | | sb.append("交流B相电流 : ") ; |
| | | sb.append(bCurrent == null?"未知":bCurrent) ; |
| | | sb.append("\n") ; |
| | | sb.append("交流C相电流 : ") ; |
| | | sb.append(cCurrent == null?"未知":cCurrent) ; |
| | | sb.append("\n") ; |
| | | sb.append("后备电池电压 : ") ; |
| | | sb.append(batteryVolt == null?"未知":batteryVolt) ; |
| | | sb.append("\n") ; |
| | | sb.append("水表远传电压 : ") ; |
| | | sb.append(waterMeterTransVolt == null?"未知":waterMeterTransVolt) ; |
| | | sb.append("\n") ; |
| | | sb.append("水表工作电压 : ") ; |
| | | sb.append(waterMeterWorkVolt == null?"未知":waterMeterWorkVolt) ; |
| | | sb.append("\n") ; |
| | | sb.append("信号强度 : ") ; |
| | | sb.append(csq == null?"未知":csq) ; |
| | | sb.append("\n") ; |
| | | return sb + super.toStr() ; |
| | | } |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.CommonV202404; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd81Vo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_81) ; |
| | | } |
| | | public DataCd81Vo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.CommonV202404; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd83Vo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_83) ; |
| | | } |
| | | public DataCd83Vo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.CommonV202404; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd84Vo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_84) ; |
| | | } |
| | | public DataCd84Vo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.CommonV202404; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd85Vo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_85) ; |
| | | } |
| | | public DataCd85Vo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.CommonV202404; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd86Vo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_86) ; |
| | | } |
| | | public DataCd86Vo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.CommonV202404; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd87Vo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_87) ; |
| | | } |
| | | public DataCd87Vo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.CommonV202404; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd88Vo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_88) ; |
| | | } |
| | | public DataCd88Vo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.CommonV202404; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd8AVo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_8A) ; |
| | | } |
| | | public DataCd8AVo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.CommonV202404; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd92_A2Vo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_92) ; |
| | | } |
| | | public DataCd92_A2Vo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.CommonV202404; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | |
| | | public Integer thisDuration;//本次使用时间长, 单位:分钟 |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd93_A3Vo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_93) ; |
| | | } |
| | | public DataCd93_A3Vo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.CommonV202404; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd9AVo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_9A) ; |
| | | } |
| | | public DataCd9AVo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.CommonV202404; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | |
| | | public String rtuDt;//设备时钟 |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCdC2Vo(){ |
| | | this.comName = CodeV202404.getCodeName(CodeV202404.cd_C2) ; |
| | | } |
| | | public DataCdC2Vo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCdXyVo(){ |
| | | } |
| | | |
| | | public DataCdXyVo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | |
| | | return sb.toString() ; |
| | | } |
| | | |
| | | public String toStr(boolean showBase){ |
| | | StringBuffer sb = new StringBuffer() ; |
| | | if(showBase){ |
| | | sb.append(comName + " : \n") ; |
| | | sb.append("控制器类型 : ") ; |
| | | sb.append(CommonV202404.ctrlDevType(controllerType)) ; |
| | | sb.append("\n") ; |
| | | sb.append("项目编号 : ") ; |
| | | sb.append(projectNo == null?"未知":projectNo) ; |
| | | sb.append("\n") ; |
| | | } |
| | | sb.append("命令结果 : ") ; |
| | | sb.append(success == null?"未知":(success?"成功":"失败")) ; |
| | | sb.append("\n") ; |
| | | return sb.toString() ; |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 创建外部命令(发给控制器) |
| | | * @param comId 命令ID |
| | | * @param code 命令code |
| | | * @return |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 创建外部命令(发给控制器) |
| | | * @param rtuAddr 控制器地址 |
| | | * @param comId 命令ID |
| | | * @param code 命令code |
| | | * @return |
| | | */ |
| | | public Command createOuterCommand(String rtuAddr, String comId, String code) { |
| | | Command com = new Command(); |
| | | com.id = comId; |
| | | com.rtuAddr = rtuAddr; |
| | | com.code = code ; |
| | | com.type = CommandType.outerCommand; |
| | | return com ; |
| | | } |
| | | |
| | | /** |
| | | * 创建外部透传命令(发给控制器) |
| | | * @param comId 命令ID |
| | | * @param code 命令code |
| | | * @return |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 创建外部透传命令(发给控制器) |
| | | * @param rtuAddr 控制器地址 |
| | | * @param comId 命令ID |
| | | * @param code 命令code |
| | | * @return |
| | | */ |
| | | public Command createOuterTransparentCommand(String rtuAddr, String comId, String code) { |
| | | Command com = new Command(); |
| | | com.id = comId; |
| | | com.rtuAddr = rtuAddr; |
| | | com.code = code ; |
| | | com.type = CommandType.outerTransCommand; |
| | | return com ; |
| | | } |
| | | |
| | | /** |
| | | * 创建内部命令 |
| | | * @param code 命令code |
| | | * @return |
| | |
| | | project: |
| | | #项目编码 |
| | | projectNo: 10 |
| | | #控制器类型 |
| | | #控制器类型 (01(0x01):测控一体阀;02(0x02):表阀一体机;57(0x57):井电控制器) |
| | | controllerType: 57 |
| | | #默认行政区划编码(天津-天津市-武清区-京滨工业园-大禹节水) |
| | | divisionCode: 120114403100 |
| | |
| | | devtools: |
| | | livereload: |
| | | enabled: false |
| | | restart: |
| | | enabled: false #禁用热部署 |
| | | profiles: |
| | | include: common-mw, global, database |
| | | |
| | |
| | | package com.dy.pipIrrRemote.common; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.Data; |
| | | import com.dy.pipIrrGlobal.command.ComResultWait; |
| | |
| | | @PostMapping(path = "receive", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | public void receive(@RequestBody Data data) { |
| | | JSONObject protocolData = data == null ? null : (JSONObject)data.subData ; //协议数据 |
| | | JSONObject codeData = protocolData == null ? null : (protocolData.getJSONObject("subData")) ; //协议功能码数据 |
| | | |
| | | Object codeDataObj = protocolData == null ? null : protocolData.get("subData") ; |
| | | JSONObject codeData = null ; |
| | | JSONArray codeArrayData = null ; |
| | | if(codeDataObj != null){ |
| | | if(codeDataObj instanceof JSONObject){ |
| | | codeData = protocolData == null ? null : (protocolData.getJSONObject("subData")) ; //协议功能码数据 |
| | | }else if(codeDataObj instanceof JSONArray){{ |
| | | codeArrayData = protocolData == null ? null : (protocolData.getJSONArray("subData")) ; //协议功能码数据 |
| | | }} |
| | | } |
| | | JSONObject job_response = new JSONObject(); |
| | | job_response.put("data", codeData==null?protocolData:codeData); |
| | | job_response.put("data", codeData!=null?codeData:(codeArrayData!=null?codeArrayData:null)); |
| | | job_response.put("commandCode", data.code); |
| | | job_response.put("commandId", data.commandId); |
| | | |
| | |
| | | package com.dy.pipIrrRemote.monitor; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.CdParam; |
| | | import lombok.AllArgsConstructor; |
| | | import com.dy.pipIrrRemote.monitor.common.CdParameter; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | |
| | | @ToString(callSuper = true) |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @SuperBuilder |
| | | public class ComTransParam extends CdParam { |
| | | public class ComTransParam extends CdParameter { |
| | | public String data ; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.common; |
| | | |
| | | import lombok.*; |
| | | import lombok.experimental.SuperBuilder; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 16:11 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @SuperBuilder |
| | | public class CdParameter { |
| | | //项目编码 |
| | | public Integer projectNo; |
| | | //控制器类型(01(0x01):测控一体阀;02(0x02):表阀一体机;57(0x57):井电控制器) |
| | | public String controllerType; |
| | | //命令功能码 |
| | | public String commandCode; |
| | | } |
| | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrController; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory; |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | | import com.dy.pipIrrRemote.monitor.p202404V201.Cd50Param; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Qualifier; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.core.env.Environment; |
| | | import org.springframework.validation.BindingResult; |
| | |
| | | |
| | | @Value("${mw.rtuCallbackUrl_rm}") |
| | | protected String rtuResultSendWebUrl; |
| | | |
| | | @Value("${project.projectNo}") |
| | | protected Integer projectNo; |
| | | |
| | | @Value("${project.controllerType}") |
| | | protected String controllerType; |
| | | |
| | | //控制器对象 |
| | | protected PrController ctrlPo ; |
| | |
| | | * @param param 命令参数 |
| | | * @return |
| | | */ |
| | | public BaseResponse<Object> pre3(ComSv comSv, Long intakeId, Long operator, String comCode, CdParam param) { |
| | | public BaseResponse<Object> pre3(ComSv comSv, Long intakeId, Long operator, String comCode, CdParameter param) { |
| | | comId = new IDLongGenerator().generate(); |
| | | //生成并保存命令日志 |
| | | RmCommandHistory po = comSv.saveComHistoryPo(comId, |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd15; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCdXyVo; |
| | | import com.dy.common.util.NumUtil; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | | import com.dy.pipIrrRemote.monitor.common.ComCtrl; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.RandomStringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Scope; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 11:10 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "远程命令", description = "远程用户充值") |
| | | @RestController("cd15Ctrl") |
| | | @RequestMapping(path = "p202404V201/cd15") |
| | | @RequiredArgsConstructor |
| | | @Scope("prototype") //因为有对象类属性,所以采用原型模式,每次请求新建一个实例对象 |
| | | public class CdCtrl extends ComCtrl { |
| | | |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功,无返回数据"; |
| | | |
| | | private static final String ComCode = "15" ; |
| | | |
| | | @Autowired |
| | | private CdSv sv ; |
| | | /** |
| | | * 向设备(控制器)发送命令 |
| | | * @param dto 前端发来的值对象 |
| | | * @param bindingResult 对dto验证的结果 |
| | | * @return 返回前端 |
| | | */ |
| | | @PostMapping(path = "send", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Object> send(@RequestBody @Valid CdDto dto, BindingResult bindingResult) { |
| | | BaseResponse<Object> res ; |
| | | //发送命令前-1:验证 |
| | | res = super.pre1(sv, ComCode, dto, bindingResult); |
| | | if(res == null) { |
| | | //发送命令前-2:获得数据 |
| | | res = super.pre2(sv, ComCode, dto, bindingResult); |
| | | if (res == null) { |
| | | //发送命令前-3:保存命令日志 |
| | | SeClientCard icPo = sv.selectClientIcCardById(Long.parseLong(dto.icCardId.trim())) ; |
| | | if(icPo == null){ |
| | | return BaseResponseUtils.buildError("服务端出错,未得到农户IC卡") ; |
| | | } |
| | | CdParam comParam = CdParam.builder().commandCode(ComCode).projectNo(projectNo).controllerType(controllerType) |
| | | .icCardAddr(icPo.getCardaddr())//IC卡地址(8位数字或字母) |
| | | .icCardNo(icPo.getCardnum())//用户卡序列号(17位数字)(6字节BCD,2字节HEX) |
| | | .chargeMoney(dto.chargeMoney)//单位:元 2位小数点(最大值 99999999.99) |
| | | .chargeWater(null)//当前应用只能远程充钱,所以chargeWater赋空值 |
| | | .flowNo(RandomStringUtils.randomNumeric(12))//流水号(12位数字) |
| | | .build(); |
| | | res = super.pre3(sv, dto.getIntakeId(), dto.getOperator(), ComCode, comParam); |
| | | if (res == null) { |
| | | //发送命令前-4:准备Feature |
| | | super.pre4(); |
| | | try { |
| | | //创建外部命令(发给控制器) |
| | | Command com = sv.createOuterCommand(ctrlPo.getRtuAddr(), "" + comId, ComCode); |
| | | com.rtuResultSendWebUrl = rtuResultSendWebUrl; |
| | | com.param = comParam ; |
| | | //发送命令 |
| | | res = super.doSend(sv, com); |
| | | if (res == null) { |
| | | //发送命令后 |
| | | res = super.after(ComCode); |
| | | } |
| | | } catch (Exception e) { |
| | | res = BaseResponseUtils.buildFail("服务端构造并向通信中间件发送请求时异常" + (e.getMessage() == null ? "" : e.getMessage())); |
| | | } finally { |
| | | //最终 |
| | | super.end(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return res ; |
| | | } |
| | | |
| | | @Override |
| | | protected String checkDto(DtoBase dto) { |
| | | if(dto != null){ |
| | | CdDto myo = (CdDto) dto ; |
| | | if(myo.icCardId == null || myo.icCardId.trim().equals("")){ |
| | | return "请选择农户IC卡"; |
| | | } |
| | | if(!NumUtil.isPlusIntNumber(myo.icCardId.trim())){ |
| | | return "请选择农户IC卡"; |
| | | } |
| | | if(myo.chargeMoney == null){ |
| | | return "充值金额(元)不能为空"; |
| | | } |
| | | if(myo.chargeMoney > 99999999.99 || myo.chargeMoney <= 0.0){ |
| | | return "请正确填写充值金额(元)"; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | protected String createRtnMsg(String code, JSONObject resultData){ |
| | | String msg; |
| | | if(resultData != null){ |
| | | JSONObject codeData = resultData.getJSONObject("data") ; |
| | | if(codeData == null){ |
| | | msg = RtuSuccessMsg ; |
| | | }else { |
| | | String json = codeData.toJSONString(); |
| | | DataCdXyVo cvo = JSON.parseObject(json, DataCdXyVo.class) ; |
| | | if(cvo != null){ |
| | | msg = cvo.toStr(false) ; |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
| | | } |
| | | } |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
| | | } |
| | | return msg; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd15; |
| | | |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 14:42 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=true) |
| | | public class CdDto extends DtoBase { |
| | | public static final long serialVersionUID = 202505121115001L; |
| | | @NotNull(message = "农户IC卡ID不能为空") |
| | | public String icCardId ;//农户IC卡记录ID |
| | | @NotNull(message = "充值金额不能为空") |
| | | public Double chargeMoney ;//单位:元 2位小数点(最大值 99999999.99) |
| | | //@NotNull(message = "充值水量不能为空") |
| | | //public Double chargeWater ;//单位:m3 2位小数点(最大值 99999999.99) |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd15; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.CdParameter; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import lombok.experimental.SuperBuilder; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 14:43 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @ToString(callSuper = true) |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @SuperBuilder |
| | | public class CdParam extends CdParameter { |
| | | public String icCardAddr ;//IC卡地址(8位数字或字母) |
| | | public String icCardNo ;//用户卡序列号(17位数字)(6字节BCD,2字节HEX) |
| | | public Double chargeMoney ;//单位:元 2位小数点(最大值 99999999.99) |
| | | public Double chargeWater ;//单位:m3 2位小数点(最大值 99999999.99) |
| | | public String flowNo ;//流水号(12位数字) |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd15; |
| | | |
| | | import com.dy.pipIrrGlobal.daoPr.PrControllerMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrRemote.monitor.common.ComSv; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 14:42 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service("cd15Sv") |
| | | public class CdSv extends ComSv { |
| | | |
| | | @Autowired |
| | | protected SeClientCardMapper seClientCardDao ; |
| | | |
| | | public SeClientCard selectClientIcCardById(Long id){ |
| | | return seClientCardDao.selectByPrimaryKey(id) ; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd16; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCdXyVo; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | | import com.dy.pipIrrRemote.monitor.common.ComCtrl; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.RandomStringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Scope; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 11:33 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "远程命令", description = "设置设备终端剩余水量和剩余金额报警值") |
| | | @RestController("cd16Ctrl") |
| | | @RequestMapping(path = "p202404V201/cd16") |
| | | @RequiredArgsConstructor |
| | | @Scope("prototype") //因为有对象类属性,所以采用原型模式,每次请求新建一个实例对象 |
| | | public class CdCtrl extends ComCtrl { |
| | | |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功,无返回数据"; |
| | | |
| | | private static final String ComCode = "16" ; |
| | | |
| | | @Autowired |
| | | private CdSv sv ; |
| | | /** |
| | | * 向设备(控制器)发送命令 |
| | | * @param dto 前端发来的值对象 |
| | | * @param bindingResult 对dto验证的结果 |
| | | * @return 返回前端 |
| | | */ |
| | | @PostMapping(path = "send", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Object> send(@RequestBody @Valid CdDto dto, BindingResult bindingResult) { |
| | | BaseResponse<Object> res ; |
| | | //发送命令前-1:验证 |
| | | res = super.pre1(sv, ComCode, dto, bindingResult); |
| | | if(res == null) { |
| | | //发送命令前-2:获得数据 |
| | | res = super.pre2(sv, ComCode, dto, bindingResult); |
| | | if (res == null) { |
| | | //发送命令前-3:保存命令日志 |
| | | CdParam comParam = CdParam.builder().commandCode(ComCode).projectNo(projectNo).controllerType(controllerType) |
| | | .waterAlarm(dto.waterAlarm)//剩余水量报警值,单位:m3。整数,取值范围0~9999 |
| | | .moneyAlarm(dto.moneyAlarm)//剩余金额报警值,单位:元。整数,取值范围0~9999 |
| | | .build(); |
| | | res = super.pre3(sv, dto.getIntakeId(), dto.getOperator(), ComCode, comParam); |
| | | if (res == null) { |
| | | //发送命令前-4:准备Feature |
| | | super.pre4(); |
| | | try { |
| | | //创建外部命令(发给控制器) |
| | | Command com = sv.createOuterCommand(ctrlPo.getRtuAddr(), "" + comId, ComCode); |
| | | com.rtuResultSendWebUrl = rtuResultSendWebUrl; |
| | | com.param = comParam ; |
| | | //发送命令 |
| | | res = super.doSend(sv, com); |
| | | if (res == null) { |
| | | //发送命令后 |
| | | res = super.after(ComCode); |
| | | } |
| | | } catch (Exception e) { |
| | | res = BaseResponseUtils.buildFail("服务端构造并向通信中间件发送请求时异常" + (e.getMessage() == null ? "" : e.getMessage())); |
| | | } finally { |
| | | //最终 |
| | | super.end(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return res ; |
| | | } |
| | | |
| | | @Override |
| | | protected String checkDto(DtoBase dto) { |
| | | if(dto != null){ |
| | | CdDto myo = (CdDto) dto ; |
| | | if(myo.waterAlarm == null){ |
| | | return "剩余水量报警值不能为空"; |
| | | } |
| | | if(myo.moneyAlarm == null){ |
| | | return "剩余金额报警值不能为空"; |
| | | } |
| | | if(myo.waterAlarm > 9999 || myo.waterAlarm <= 0.0){ |
| | | return "请正确填写剩余水量报警值(m3)"; |
| | | } |
| | | if(myo.moneyAlarm > 9999 || myo.moneyAlarm <= 0.0){ |
| | | return "请正确填写剩余金额报警值(元)"; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | protected String createRtnMsg(String code, JSONObject resultData){ |
| | | String msg; |
| | | if(resultData != null){ |
| | | JSONObject codeData = resultData.getJSONObject("data") ; |
| | | if(codeData == null){ |
| | | msg = RtuSuccessMsg ; |
| | | }else { |
| | | String json = codeData.toJSONString(); |
| | | DataCdXyVo cvo = JSON.parseObject(json, DataCdXyVo.class) ; |
| | | if(cvo != null){ |
| | | msg = cvo.toStr(false) ; |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
| | | } |
| | | } |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
| | | } |
| | | return msg; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd16; |
| | | |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 11:33 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=true) |
| | | public class CdDto extends DtoBase { |
| | | public static final long serialVersionUID = 202505121133001L; |
| | | @NotNull(message = "剩余水量报警值不能为空") |
| | | public Integer waterAlarm ;//剩余水量报警值,单位:m3。整数,取值范围0~9999 |
| | | @NotNull(message = "剩余金额报警值不能为空") |
| | | public Integer moneyAlarm ;//剩余金额报警值,单位:元。整数,取值范围0~9999 |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd16; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.CdParameter; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import lombok.experimental.SuperBuilder; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 11:33 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @ToString(callSuper = true) |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @SuperBuilder |
| | | public class CdParam extends CdParameter { |
| | | public Integer waterAlarm ;//剩余水量报警值,单位:m3。整数,取值范围0~9999 |
| | | public Integer moneyAlarm ;//剩余金额报警值,单位:元。整数,取值范围0~9999 |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd16; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.ComSv; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 11:33 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service("cd16Sv") |
| | | public class CdSv extends ComSv { |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd22; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCdXyVo; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | | import com.dy.pipIrrRemote.monitor.common.ComCtrl; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Scope; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 13:48 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "远程命令", description = "设置设备终端剩余水量和剩余金额报警值") |
| | | @RestController("cd22Ctrl") |
| | | @RequestMapping(path = "p202404V201/cd22") |
| | | @RequiredArgsConstructor |
| | | @Scope("prototype") //因为有对象类属性,所以采用原型模式,每次请求新建一个实例对象 |
| | | public class CdCtrl extends ComCtrl { |
| | | |
| | | private static final String RtuSuccessMsg = "设置机井年最大开采量和水位下限"; |
| | | |
| | | private static final String ComCode = "22" ; |
| | | |
| | | @Autowired |
| | | private CdSv sv ; |
| | | /** |
| | | * 向设备(控制器)发送命令 |
| | | * @param dto 前端发来的值对象 |
| | | * @param bindingResult 对dto验证的结果 |
| | | * @return 返回前端 |
| | | */ |
| | | @PostMapping(path = "send", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Object> send(@RequestBody @Valid CdDto dto, BindingResult bindingResult) { |
| | | BaseResponse<Object> res ; |
| | | //发送命令前-1:验证 |
| | | res = super.pre1(sv, ComCode, dto, bindingResult); |
| | | if(res == null) { |
| | | //发送命令前-2:获得数据 |
| | | res = super.pre2(sv, ComCode, dto, bindingResult); |
| | | if (res == null) { |
| | | //发送命令前-3:保存命令日志 |
| | | CdParam comParam = CdParam.builder().commandCode(ComCode).projectNo(projectNo).controllerType(controllerType) |
| | | .maxAmountYear(dto.maxAmountYear)//机井年最大用水量单位:m3 整数,取值范围0~99999999 |
| | | .limitLevel(dto.limitLevel)//水位下限 单位:m 取值范围:0~9999.99 |
| | | .build(); |
| | | res = super.pre3(sv, dto.getIntakeId(), dto.getOperator(), ComCode, comParam); |
| | | if (res == null) { |
| | | //发送命令前-4:准备Feature |
| | | super.pre4(); |
| | | try { |
| | | //创建外部命令(发给控制器) |
| | | Command com = sv.createOuterCommand(ctrlPo.getRtuAddr(), "" + comId, ComCode); |
| | | com.rtuResultSendWebUrl = rtuResultSendWebUrl; |
| | | com.param = comParam ; |
| | | //发送命令 |
| | | res = super.doSend(sv, com); |
| | | if (res == null) { |
| | | //发送命令后 |
| | | res = super.after(ComCode); |
| | | } |
| | | } catch (Exception e) { |
| | | res = BaseResponseUtils.buildFail("服务端构造并向通信中间件发送请求时异常" + (e.getMessage() == null ? "" : e.getMessage())); |
| | | } finally { |
| | | //最终 |
| | | super.end(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return res ; |
| | | } |
| | | |
| | | @Override |
| | | protected String checkDto(DtoBase dto) { |
| | | if(dto != null){ |
| | | CdDto myo = (CdDto) dto ; |
| | | if(myo.maxAmountYear == null){ |
| | | return "机井年最大用水量不能为空"; |
| | | } |
| | | if(myo.limitLevel == null){ |
| | | return "水位下限不能为空"; |
| | | } |
| | | if(myo.maxAmountYear > 99999999 || myo.maxAmountYear <= 0.0){ |
| | | return "请正确填写机井年最大用水量(m3)(0~99999999)"; |
| | | } |
| | | if(myo.limitLevel > 9999.99 || myo.limitLevel < 0.0){ |
| | | return "请正确填写水位下限(m)(0~9999.99)"; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | protected String createRtnMsg(String code, JSONObject resultData){ |
| | | String msg; |
| | | if(resultData != null){ |
| | | JSONObject codeData = resultData.getJSONObject("data") ; |
| | | if(codeData == null){ |
| | | msg = RtuSuccessMsg ; |
| | | }else { |
| | | String json = codeData.toJSONString(); |
| | | DataCdXyVo cvo = JSON.parseObject(json, DataCdXyVo.class) ; |
| | | if(cvo != null){ |
| | | msg = cvo.toStr(false) ; |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
| | | } |
| | | } |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
| | | } |
| | | return msg; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd22; |
| | | |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 13:48 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=true) |
| | | public class CdDto extends DtoBase { |
| | | public static final long serialVersionUID = 202505121133001L; |
| | | @NotNull(message = "机井年最大用水量不能为空") |
| | | public Integer maxAmountYear ;//机井年最大用水量单位:m3 整数,取值范围0~99999999 |
| | | @NotNull(message = "水位下限不能为空") |
| | | public Double limitLevel ;//水位下限 单位:m 取值范围:0~9999.99 |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd22; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.CdParameter; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import lombok.experimental.SuperBuilder; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 13:48 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @ToString(callSuper = true) |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @SuperBuilder |
| | | public class CdParam extends CdParameter { |
| | | public Integer maxAmountYear ;//机井年最大用水量单位:m3 整数,取值范围0~99999999 |
| | | public Double limitLevel ;//水位下限 单位:m 取值范围:0~9999.99 |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd22; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.ComSv; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 13:48 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service("cd22Sv") |
| | | public class CdSv extends ComSv { |
| | | } |
copy from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java
copy to pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd30/CdCtrl.java
File was copied from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201; |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd30; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCdXyVo; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 14:41 |
| | | * @Date: 2025/5/12 13:56 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "远程透传命令", description = "远程透传命令") |
| | | @RestController |
| | | @RequestMapping(path = "p202404V201") |
| | | @Tag(name = "远程命令", description = "设置设备终端用水有效") |
| | | @RestController("cd30Ctrl") |
| | | @RequestMapping(path = "p202404V201/cd30") |
| | | @RequiredArgsConstructor |
| | | @Scope("prototype") //因为有对象类属性,所以采用原型模式,每次请求新建一个实例对象 |
| | | public class Cd50Ctrl extends ComCtrl { |
| | | public class CdCtrl extends ComCtrl { |
| | | |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功"; |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功,无返回数据"; |
| | | |
| | | private static final String ComCode = "50" ; |
| | | private static final String ComCode = "30" ; |
| | | |
| | | @Autowired |
| | | private Cd50Sv sv ; |
| | | private CdSv sv ; |
| | | /** |
| | | * 向设备(控制器)发送透传命令 |
| | | * 向设备(控制器)发送命令 |
| | | * @param dto 前端发来的值对象 |
| | | * @param bindingResult 对dto验证的结果 |
| | | * @return 返回前端 |
| | | */ |
| | | @PostMapping(path = "cd50", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @PostMapping(path = "send", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Object> send(@RequestBody @Valid Cd50Dto dto, BindingResult bindingResult) { |
| | | public BaseResponse<Object> send(@RequestBody @Valid CdDto dto, BindingResult bindingResult) { |
| | | BaseResponse<Object> res ; |
| | | //发送命令前-1:验证 |
| | | res = super.pre1(sv, ComCode, dto, bindingResult); |
| | |
| | | res = super.pre2(sv, ComCode, dto, bindingResult); |
| | | if (res == null) { |
| | | //发送命令前-3:保存命令日志 |
| | | Cd50Param comParam = Cd50Param.builder().commandCode(ComCode).build(); |
| | | CdParam comParam = CdParam.builder().commandCode(ComCode).projectNo(projectNo).controllerType(controllerType).build(); |
| | | res = super.pre3(sv, dto.getIntakeId(), dto.getOperator(), ComCode, comParam); |
| | | if (res == null) { |
| | | //发送命令前-4:准备Feature |
| | | super.pre4(); |
| | | try { |
| | | //创建外部命令(发给控制器) |
| | | Command com = sv.createOuterCommand("" + comId, ComCode); |
| | | com.rtuAddr = ctrlPo.getRtuAddr(); |
| | | Command com = sv.createOuterCommand(ctrlPo.getRtuAddr(), "" + comId, ComCode); |
| | | com.rtuResultSendWebUrl = rtuResultSendWebUrl; |
| | | com.param = comParam ; |
| | | //发送命令 |
| | | res = super.doSend(sv, com); |
| | | if (res == null) { |
| | |
| | | if(resultData != null){ |
| | | JSONObject codeData = resultData.getJSONObject("data") ; |
| | | if(codeData == null){ |
| | | return RtuSuccessMsg ; |
| | | msg = RtuSuccessMsg ; |
| | | }else { |
| | | Integer minute = codeData.getInteger("minute"); |
| | | return "查询成功,自报周期:" + minute + "分钟"; |
| | | String json = codeData.toJSONString(); |
| | | DataCdXyVo cvo = JSON.parseObject(json, DataCdXyVo.class) ; |
| | | if(cvo != null){ |
| | | msg = cvo.toStr(false) ; |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
| | | } |
| | | } |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd30; |
| | | |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 13:56 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=true) |
| | | public class CdDto extends DtoBase { |
| | | public static final long serialVersionUID = 202505121108001L; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd30; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.CdParameter; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import lombok.experimental.SuperBuilder; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 13:56 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @ToString(callSuper = true) |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @SuperBuilder |
| | | public class CdParam extends CdParameter { |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd30; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.ComSv; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 13:56 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service("cd30Sv") |
| | | public class CdSv extends ComSv { |
| | | } |
copy from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java
copy to pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd31/CdCtrl.java
File was copied from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201; |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd31; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCdXyVo; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 14:41 |
| | | * @Date: 2025/5/12 17:18 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "远程透传命令", description = "远程透传命令") |
| | | @RestController |
| | | @RequestMapping(path = "p202404V201") |
| | | @Tag(name = "远程命令", description = "设置设备终端用水有效") |
| | | @RestController("cd31Ctrl") |
| | | @RequestMapping(path = "p202404V201/cd31") |
| | | @RequiredArgsConstructor |
| | | @Scope("prototype") //因为有对象类属性,所以采用原型模式,每次请求新建一个实例对象 |
| | | public class Cd50Ctrl extends ComCtrl { |
| | | public class CdCtrl extends ComCtrl { |
| | | |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功"; |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功,无返回数据"; |
| | | |
| | | private static final String ComCode = "50" ; |
| | | private static final String ComCode = "31" ; |
| | | |
| | | @Autowired |
| | | private Cd50Sv sv ; |
| | | private CdSv sv ; |
| | | /** |
| | | * 向设备(控制器)发送透传命令 |
| | | * 向设备(控制器)发送命令 |
| | | * @param dto 前端发来的值对象 |
| | | * @param bindingResult 对dto验证的结果 |
| | | * @return 返回前端 |
| | | */ |
| | | @PostMapping(path = "cd50", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @PostMapping(path = "send", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Object> send(@RequestBody @Valid Cd50Dto dto, BindingResult bindingResult) { |
| | | public BaseResponse<Object> send(@RequestBody @Valid CdDto dto, BindingResult bindingResult) { |
| | | BaseResponse<Object> res ; |
| | | //发送命令前-1:验证 |
| | | res = super.pre1(sv, ComCode, dto, bindingResult); |
| | |
| | | res = super.pre2(sv, ComCode, dto, bindingResult); |
| | | if (res == null) { |
| | | //发送命令前-3:保存命令日志 |
| | | Cd50Param comParam = Cd50Param.builder().commandCode(ComCode).build(); |
| | | CdParam comParam = CdParam.builder().commandCode(ComCode).projectNo(projectNo).controllerType(controllerType).build(); |
| | | comParam.valid = false ; |
| | | res = super.pre3(sv, dto.getIntakeId(), dto.getOperator(), ComCode, comParam); |
| | | if (res == null) { |
| | | //发送命令前-4:准备Feature |
| | | super.pre4(); |
| | | try { |
| | | //创建外部命令(发给控制器) |
| | | Command com = sv.createOuterCommand("" + comId, ComCode); |
| | | com.rtuAddr = ctrlPo.getRtuAddr(); |
| | | Command com = sv.createOuterCommand(ctrlPo.getRtuAddr(), "" + comId, ComCode); |
| | | com.rtuResultSendWebUrl = rtuResultSendWebUrl; |
| | | com.param = comParam ; |
| | | //发送命令 |
| | | res = super.doSend(sv, com); |
| | | if (res == null) { |
| | |
| | | if(resultData != null){ |
| | | JSONObject codeData = resultData.getJSONObject("data") ; |
| | | if(codeData == null){ |
| | | return RtuSuccessMsg ; |
| | | msg = RtuSuccessMsg ; |
| | | }else { |
| | | Integer minute = codeData.getInteger("minute"); |
| | | return "查询成功,自报周期:" + minute + "分钟"; |
| | | String json = codeData.toJSONString(); |
| | | DataCdXyVo cvo = JSON.parseObject(json, DataCdXyVo.class) ; |
| | | if(cvo != null){ |
| | | msg = cvo.toStr(false) ; |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
| | | } |
| | | } |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd31; |
| | | |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 17:18 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=true) |
| | | public class CdDto extends DtoBase { |
| | | public static final long serialVersionUID = 202505121718001L; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd31; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.CdParameter; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import lombok.experimental.SuperBuilder; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 17:18 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @ToString(callSuper = true) |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @SuperBuilder |
| | | public class CdParam extends CdParameter { |
| | | public Boolean valid ;//有效性 |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd31; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.ComSv; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 17:18 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service("cd31Sv") |
| | | public class CdSv extends ComSv { |
| | | } |
copy from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java
copy to pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd50/CdCtrl.java
File was copied from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201; |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd50; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd50Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCdXyVo; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Scope; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.validation.BindingResult; |
| | |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "远程透传命令", description = "远程透传命令") |
| | | @RestController |
| | | @RequestMapping(path = "p202404V201") |
| | | @Tag(name = "远程命令", description = "查询设备终端地址") |
| | | @RestController("cd50Ctrl") |
| | | @RequestMapping(path = "p202404V201/cd50") |
| | | @RequiredArgsConstructor |
| | | @Scope("prototype") //因为有对象类属性,所以采用原型模式,每次请求新建一个实例对象 |
| | | public class Cd50Ctrl extends ComCtrl { |
| | | public class CdCtrl extends ComCtrl { |
| | | |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功"; |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功,无返回数据"; |
| | | |
| | | private static final String ComCode = "50" ; |
| | | |
| | | @Autowired |
| | | private Cd50Sv sv ; |
| | | private CdSv sv ; |
| | | /** |
| | | * 向设备(控制器)发送透传命令 |
| | | * 向设备(控制器)发送命令 |
| | | * @param dto 前端发来的值对象 |
| | | * @param bindingResult 对dto验证的结果 |
| | | * @return 返回前端 |
| | | */ |
| | | @PostMapping(path = "cd50", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @PostMapping(path = "send", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Object> send(@RequestBody @Valid Cd50Dto dto, BindingResult bindingResult) { |
| | | public BaseResponse<Object> send(@RequestBody @Valid CdDto dto, BindingResult bindingResult) { |
| | | BaseResponse<Object> res ; |
| | | //发送命令前-1:验证 |
| | | res = super.pre1(sv, ComCode, dto, bindingResult); |
| | |
| | | res = super.pre2(sv, ComCode, dto, bindingResult); |
| | | if (res == null) { |
| | | //发送命令前-3:保存命令日志 |
| | | Cd50Param comParam = Cd50Param.builder().commandCode(ComCode).build(); |
| | | CdParam comParam = CdParam.builder().commandCode(ComCode).projectNo(projectNo).controllerType(controllerType).build(); |
| | | res = super.pre3(sv, dto.getIntakeId(), dto.getOperator(), ComCode, comParam); |
| | | if (res == null) { |
| | | //发送命令前-4:准备Feature |
| | | super.pre4(); |
| | | try { |
| | | //创建外部命令(发给控制器) |
| | | Command com = sv.createOuterCommand("" + comId, ComCode); |
| | | com.rtuAddr = ctrlPo.getRtuAddr(); |
| | | Command com = sv.createOuterCommand(ctrlPo.getRtuAddr(), "" + comId, ComCode); |
| | | com.rtuResultSendWebUrl = rtuResultSendWebUrl; |
| | | com.param = comParam ; |
| | | //发送命令 |
| | | res = super.doSend(sv, com); |
| | | if (res == null) { |
| | |
| | | if(resultData != null){ |
| | | JSONObject codeData = resultData.getJSONObject("data") ; |
| | | if(codeData == null){ |
| | | return RtuSuccessMsg ; |
| | | msg = RtuSuccessMsg ; |
| | | }else { |
| | | Integer minute = codeData.getInteger("minute"); |
| | | return "查询成功,自报周期:" + minute + "分钟"; |
| | | String json = codeData.toJSONString(); |
| | | DataCd50Vo cvo = JSON.parseObject(json, DataCd50Vo.class) ; |
| | | if(cvo != null){ |
| | | msg = cvo.toStr(false) ; |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
| | | } |
| | | } |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
File was renamed from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Dto.java |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201; |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd50; |
| | | |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | | import lombok.Data; |
| | |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=true) |
| | | public class Cd50Dto extends DtoBase { |
| | | public class CdDto extends DtoBase { |
| | | public static final long serialVersionUID = 202505091450001L; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd50; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.CdParameter; |
| | | import lombok.*; |
| | | import lombok.experimental.SuperBuilder; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 14:43 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @ToString(callSuper = true) |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @SuperBuilder |
| | | public class CdParam extends CdParameter { |
| | | } |
File was renamed from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Sv.java |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201; |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd50; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.ComSv; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class Cd50Sv extends ComSv { |
| | | @Service("cd50Sv") |
| | | public class CdSv extends ComSv { |
| | | } |
copy from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java
copy to pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd55/CdCtrl.java
File was copied from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201; |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd55; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd55Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd65Vo; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 14:41 |
| | | * @Date: 2025/5/12 11:28 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "远程透传命令", description = "远程透传命令") |
| | | @RestController |
| | | @RequestMapping(path = "p202404V201") |
| | | @Tag(name = "远程命令", description = "查询设备终端充值记录") |
| | | @RestController("cd55Ctrl") |
| | | @RequestMapping(path = "p202404V201/cd55") |
| | | @RequiredArgsConstructor |
| | | @Scope("prototype") //因为有对象类属性,所以采用原型模式,每次请求新建一个实例对象 |
| | | public class Cd50Ctrl extends ComCtrl { |
| | | public class CdCtrl extends ComCtrl { |
| | | |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功"; |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功,无返回数据"; |
| | | |
| | | private static final String ComCode = "50" ; |
| | | private static final String ComCode = "55" ; |
| | | |
| | | @Autowired |
| | | private Cd50Sv sv ; |
| | | private CdSv sv ; |
| | | /** |
| | | * 向设备(控制器)发送透传命令 |
| | | * 向设备(控制器)发送命令 |
| | | * @param dto 前端发来的值对象 |
| | | * @param bindingResult 对dto验证的结果 |
| | | * @return 返回前端 |
| | | */ |
| | | @PostMapping(path = "cd50", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @PostMapping(path = "send", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Object> send(@RequestBody @Valid Cd50Dto dto, BindingResult bindingResult) { |
| | | public BaseResponse<Object> send(@RequestBody @Valid CdDto dto, BindingResult bindingResult) { |
| | | BaseResponse<Object> res ; |
| | | //发送命令前-1:验证 |
| | | res = super.pre1(sv, ComCode, dto, bindingResult); |
| | |
| | | res = super.pre2(sv, ComCode, dto, bindingResult); |
| | | if (res == null) { |
| | | //发送命令前-3:保存命令日志 |
| | | Cd50Param comParam = Cd50Param.builder().commandCode(ComCode).build(); |
| | | CdParam comParam = CdParam.builder().commandCode(ComCode).projectNo(projectNo).controllerType(controllerType).build(); |
| | | comParam.page = 1 ; |
| | | res = super.pre3(sv, dto.getIntakeId(), dto.getOperator(), ComCode, comParam); |
| | | if (res == null) { |
| | | //发送命令前-4:准备Feature |
| | | super.pre4(); |
| | | try { |
| | | //创建外部命令(发给控制器) |
| | | Command com = sv.createOuterCommand("" + comId, ComCode); |
| | | com.rtuAddr = ctrlPo.getRtuAddr(); |
| | | Command com = sv.createOuterCommand(ctrlPo.getRtuAddr(), "" + comId, ComCode); |
| | | com.rtuResultSendWebUrl = rtuResultSendWebUrl; |
| | | com.param = comParam ; |
| | | //发送命令 |
| | | res = super.doSend(sv, com); |
| | | if (res == null) { |
| | |
| | | protected String createRtnMsg(String code, JSONObject resultData){ |
| | | String msg; |
| | | if(resultData != null){ |
| | | JSONObject codeData = resultData.getJSONObject("data") ; |
| | | JSONArray codeData = resultData.getJSONArray("data") ; |
| | | if(codeData == null){ |
| | | return RtuSuccessMsg ; |
| | | msg = RtuSuccessMsg ; |
| | | }else { |
| | | Integer minute = codeData.getInteger("minute"); |
| | | return "查询成功,自报周期:" + minute + "分钟"; |
| | | String json = codeData.toJSONString(); |
| | | List<DataCd55Vo> list = JSON.parseArray(json, DataCd55Vo.class) ; |
| | | if(list != null && list.size() > 0){ |
| | | msg = "" ; |
| | | for(DataCd55Vo cvo : list){ |
| | | msg += cvo.toStr(false) + "\n"; |
| | | } |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
| | | } |
| | | } |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd55; |
| | | |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 11:28 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=true) |
| | | public class CdDto extends DtoBase { |
| | | public static final long serialVersionUID = 202505121128001L; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd55; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.CdParameter; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import lombok.experimental.SuperBuilder; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 11:28 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @ToString(callSuper = true) |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @SuperBuilder |
| | | public class CdParam extends CdParameter { |
| | | public Integer page ;//分页(取值范围1、2、3、4、5、6、7、8、9) |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd55; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.ComSv; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 11:28 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service("cd55Sv") |
| | | public class CdSv extends ComSv { |
| | | } |
copy from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java
copy to pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd56/CdCtrl.java
File was copied from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201; |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd56; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd56Vo; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 14:41 |
| | | * @Date: 2025/5/12 11:40 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "远程透传命令", description = "远程透传命令") |
| | | @RestController |
| | | @RequestMapping(path = "p202404V201") |
| | | @Tag(name = "远程命令", description = "查询设备终端剩余水量和剩余金额报警值") |
| | | @RestController("cd56Ctrl") |
| | | @RequestMapping(path = "p202404V201/cd56") |
| | | @RequiredArgsConstructor |
| | | @Scope("prototype") //因为有对象类属性,所以采用原型模式,每次请求新建一个实例对象 |
| | | public class Cd50Ctrl extends ComCtrl { |
| | | public class CdCtrl extends ComCtrl { |
| | | |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功"; |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功,无返回数据"; |
| | | |
| | | private static final String ComCode = "50" ; |
| | | private static final String ComCode = "56" ; |
| | | |
| | | @Autowired |
| | | private Cd50Sv sv ; |
| | | private CdSv sv ; |
| | | /** |
| | | * 向设备(控制器)发送透传命令 |
| | | * 向设备(控制器)发送命令 |
| | | * @param dto 前端发来的值对象 |
| | | * @param bindingResult 对dto验证的结果 |
| | | * @return 返回前端 |
| | | */ |
| | | @PostMapping(path = "cd50", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @PostMapping(path = "send", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Object> send(@RequestBody @Valid Cd50Dto dto, BindingResult bindingResult) { |
| | | public BaseResponse<Object> send(@RequestBody @Valid CdDto dto, BindingResult bindingResult) { |
| | | BaseResponse<Object> res ; |
| | | //发送命令前-1:验证 |
| | | res = super.pre1(sv, ComCode, dto, bindingResult); |
| | |
| | | res = super.pre2(sv, ComCode, dto, bindingResult); |
| | | if (res == null) { |
| | | //发送命令前-3:保存命令日志 |
| | | Cd50Param comParam = Cd50Param.builder().commandCode(ComCode).build(); |
| | | CdParam comParam = CdParam.builder().commandCode(ComCode).projectNo(projectNo).controllerType(controllerType).build(); |
| | | res = super.pre3(sv, dto.getIntakeId(), dto.getOperator(), ComCode, comParam); |
| | | if (res == null) { |
| | | //发送命令前-4:准备Feature |
| | | super.pre4(); |
| | | try { |
| | | //创建外部命令(发给控制器) |
| | | Command com = sv.createOuterCommand("" + comId, ComCode); |
| | | com.rtuAddr = ctrlPo.getRtuAddr(); |
| | | Command com = sv.createOuterCommand(ctrlPo.getRtuAddr(), "" + comId, ComCode); |
| | | com.rtuResultSendWebUrl = rtuResultSendWebUrl; |
| | | com.param = comParam ; |
| | | //发送命令 |
| | | res = super.doSend(sv, com); |
| | | if (res == null) { |
| | |
| | | if(resultData != null){ |
| | | JSONObject codeData = resultData.getJSONObject("data") ; |
| | | if(codeData == null){ |
| | | return RtuSuccessMsg ; |
| | | msg = RtuSuccessMsg ; |
| | | }else { |
| | | Integer minute = codeData.getInteger("minute"); |
| | | return "查询成功,自报周期:" + minute + "分钟"; |
| | | String json = codeData.toJSONString(); |
| | | DataCd56Vo cvo = JSON.parseObject(json, DataCd56Vo.class) ; |
| | | if(cvo != null){ |
| | | msg = cvo.toStr(false) ; |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
| | | } |
| | | } |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd56; |
| | | |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 11:40 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=true) |
| | | public class CdDto extends DtoBase { |
| | | public static final long serialVersionUID = 202505121140001L; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd56; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.CdParameter; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import lombok.experimental.SuperBuilder; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 11:40 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @ToString(callSuper = true) |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @SuperBuilder |
| | | public class CdParam extends CdParameter { |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd56; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.ComSv; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 11:40 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service("cd56Sv") |
| | | public class CdSv extends ComSv { |
| | | } |
File was renamed from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201; |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd5B; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd80_5BVo; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 14:41 |
| | | * @Date: 2025/5/12 10:41 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "远程透传命令", description = "远程透传命令") |
| | | @RestController |
| | | @RequestMapping(path = "p202404V201") |
| | | @Tag(name = "远程命令", description = "查询设备终端实时值") |
| | | @RestController("cd5BCtrl") |
| | | @RequestMapping(path = "p202404V201/cd5B") |
| | | @RequiredArgsConstructor |
| | | @Scope("prototype") //因为有对象类属性,所以采用原型模式,每次请求新建一个实例对象 |
| | | public class Cd50Ctrl extends ComCtrl { |
| | | public class CdCtrl extends ComCtrl { |
| | | |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功"; |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功,无返回数据"; |
| | | |
| | | private static final String ComCode = "50" ; |
| | | private static final String ComCode = "5B" ; |
| | | |
| | | @Autowired |
| | | private Cd50Sv sv ; |
| | | private CdSv sv ; |
| | | /** |
| | | * 向设备(控制器)发送透传命令 |
| | | * 向设备(控制器)发送命令 |
| | | * @param dto 前端发来的值对象 |
| | | * @param bindingResult 对dto验证的结果 |
| | | * @return 返回前端 |
| | | */ |
| | | @PostMapping(path = "cd50", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @PostMapping(path = "send", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Object> send(@RequestBody @Valid Cd50Dto dto, BindingResult bindingResult) { |
| | | public BaseResponse<Object> send(@RequestBody @Valid CdDto dto, BindingResult bindingResult) { |
| | | BaseResponse<Object> res ; |
| | | //发送命令前-1:验证 |
| | | res = super.pre1(sv, ComCode, dto, bindingResult); |
| | |
| | | res = super.pre2(sv, ComCode, dto, bindingResult); |
| | | if (res == null) { |
| | | //发送命令前-3:保存命令日志 |
| | | Cd50Param comParam = Cd50Param.builder().commandCode(ComCode).build(); |
| | | CdParam comParam = CdParam.builder().commandCode(ComCode).projectNo(projectNo).controllerType(controllerType).build(); |
| | | res = super.pre3(sv, dto.getIntakeId(), dto.getOperator(), ComCode, comParam); |
| | | if (res == null) { |
| | | //发送命令前-4:准备Feature |
| | | super.pre4(); |
| | | try { |
| | | //创建外部命令(发给控制器) |
| | | Command com = sv.createOuterCommand("" + comId, ComCode); |
| | | com.rtuAddr = ctrlPo.getRtuAddr(); |
| | | Command com = sv.createOuterCommand(ctrlPo.getRtuAddr(), "" + comId, ComCode); |
| | | com.rtuResultSendWebUrl = rtuResultSendWebUrl; |
| | | com.param = comParam ; |
| | | //发送命令 |
| | | res = super.doSend(sv, com); |
| | | if (res == null) { |
| | |
| | | if(resultData != null){ |
| | | JSONObject codeData = resultData.getJSONObject("data") ; |
| | | if(codeData == null){ |
| | | return RtuSuccessMsg ; |
| | | msg = RtuSuccessMsg ; |
| | | }else { |
| | | Integer minute = codeData.getInteger("minute"); |
| | | return "查询成功,自报周期:" + minute + "分钟"; |
| | | String json = codeData.toJSONString(); |
| | | DataCd80_5BVo cvo = JSON.parseObject(json, DataCd80_5BVo.class) ; |
| | | if(cvo != null){ |
| | | msg = cvo.toStr(false) ; |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
| | | } |
| | | } |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd5B; |
| | | |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 14:42 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=true) |
| | | public class CdDto extends DtoBase { |
| | | public static final long serialVersionUID = 202505120909001L; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd5B; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.CdParameter; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import lombok.experimental.SuperBuilder; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 14:43 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @ToString(callSuper = true) |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @SuperBuilder |
| | | public class CdParam extends CdParameter { |
| | | } |
copy from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Sv.java
copy to pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd5B/CdSv.java
File was copied from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Sv.java |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201; |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd5B; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.ComSv; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class Cd50Sv extends ComSv { |
| | | @Service("cd5BSv") |
| | | public class CdSv extends ComSv { |
| | | } |
copy from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java
copy to pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd5C/CdCtrl.java
File was copied from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201; |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd5C; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd5CVo; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 14:41 |
| | | * @Date: 2025/5/12 11:40 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "远程透传命令", description = "远程透传命令") |
| | | @RestController |
| | | @RequestMapping(path = "p202404V201") |
| | | @Tag(name = "远程命令", description = "查询设备终端的日记录") |
| | | @RestController("cd5CCtrl") |
| | | @RequestMapping(path = "p202404V201/cd5C") |
| | | @RequiredArgsConstructor |
| | | @Scope("prototype") //因为有对象类属性,所以采用原型模式,每次请求新建一个实例对象 |
| | | public class Cd50Ctrl extends ComCtrl { |
| | | public class CdCtrl extends ComCtrl { |
| | | |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功"; |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功,无返回数据"; |
| | | |
| | | private static final String ComCode = "50" ; |
| | | private static final String ComCode = "5C" ; |
| | | |
| | | @Autowired |
| | | private Cd50Sv sv ; |
| | | private CdSv sv ; |
| | | /** |
| | | * 向设备(控制器)发送透传命令 |
| | | * 向设备(控制器)发送命令 |
| | | * @param dto 前端发来的值对象 |
| | | * @param bindingResult 对dto验证的结果 |
| | | * @return 返回前端 |
| | | */ |
| | | @PostMapping(path = "cd50", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @PostMapping(path = "send", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Object> send(@RequestBody @Valid Cd50Dto dto, BindingResult bindingResult) { |
| | | public BaseResponse<Object> send(@RequestBody @Valid CdDto dto, BindingResult bindingResult) { |
| | | BaseResponse<Object> res ; |
| | | //发送命令前-1:验证 |
| | | res = super.pre1(sv, ComCode, dto, bindingResult); |
| | |
| | | res = super.pre2(sv, ComCode, dto, bindingResult); |
| | | if (res == null) { |
| | | //发送命令前-3:保存命令日志 |
| | | Cd50Param comParam = Cd50Param.builder().commandCode(ComCode).build(); |
| | | CdParam comParam = CdParam.builder().commandCode(ComCode).projectNo(projectNo).controllerType(controllerType).build(); |
| | | comParam.page = 1 ; |
| | | res = super.pre3(sv, dto.getIntakeId(), dto.getOperator(), ComCode, comParam); |
| | | if (res == null) { |
| | | //发送命令前-4:准备Feature |
| | | super.pre4(); |
| | | try { |
| | | //创建外部命令(发给控制器) |
| | | Command com = sv.createOuterCommand("" + comId, ComCode); |
| | | com.rtuAddr = ctrlPo.getRtuAddr(); |
| | | Command com = sv.createOuterCommand(ctrlPo.getRtuAddr(), "" + comId, ComCode); |
| | | com.rtuResultSendWebUrl = rtuResultSendWebUrl; |
| | | com.param = comParam ; |
| | | //发送命令 |
| | | res = super.doSend(sv, com); |
| | | if (res == null) { |
| | |
| | | if(resultData != null){ |
| | | JSONObject codeData = resultData.getJSONObject("data") ; |
| | | if(codeData == null){ |
| | | return RtuSuccessMsg ; |
| | | msg = RtuSuccessMsg ; |
| | | }else { |
| | | Integer minute = codeData.getInteger("minute"); |
| | | return "查询成功,自报周期:" + minute + "分钟"; |
| | | String json = codeData.toJSONString(); |
| | | List<DataCd5CVo> list = JSON.parseArray(json, DataCd5CVo.class) ; |
| | | if(list != null && list.size() > 0){ |
| | | msg = "" ; |
| | | for(DataCd5CVo cvo : list){ |
| | | msg += cvo.toStr(false) + "\n"; |
| | | } |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
| | | } |
| | | } |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd5C; |
| | | |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 13:43 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=true) |
| | | public class CdDto extends DtoBase { |
| | | public static final long serialVersionUID = 202505121140001L; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd5C; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.CdParameter; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import lombok.experimental.SuperBuilder; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 13:43 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @ToString(callSuper = true) |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @SuperBuilder |
| | | public class CdParam extends CdParameter { |
| | | public Integer page ;//分页(取值范围1、2、3、4、5、6、7、8、9) |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd5C; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.ComSv; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 13:43 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service("cd5CSv") |
| | | public class CdSv extends ComSv { |
| | | } |
copy from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java
copy to pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd65/CdCtrl.java
File was copied from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201; |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd65; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd65Vo; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 14:41 |
| | | * @Date: 2025/5/12 10:50 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "远程透传命令", description = "远程透传命令") |
| | | @RestController |
| | | @RequestMapping(path = "p202404V201") |
| | | @Tag(name = "远程命令", description = "查询设备终端用户用水记录") |
| | | @RestController("cd65Ctrl") |
| | | @RequestMapping(path = "p202404V201/cd65") |
| | | @RequiredArgsConstructor |
| | | @Scope("prototype") //因为有对象类属性,所以采用原型模式,每次请求新建一个实例对象 |
| | | public class Cd50Ctrl extends ComCtrl { |
| | | public class CdCtrl extends ComCtrl { |
| | | |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功"; |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功,无返回数据"; |
| | | |
| | | private static final String ComCode = "50" ; |
| | | private static final String ComCode = "65" ; |
| | | |
| | | @Autowired |
| | | private Cd50Sv sv ; |
| | | private CdSv sv ; |
| | | /** |
| | | * 向设备(控制器)发送透传命令 |
| | | * 向设备(控制器)发送命令 |
| | | * @param dto 前端发来的值对象 |
| | | * @param bindingResult 对dto验证的结果 |
| | | * @return 返回前端 |
| | | */ |
| | | @PostMapping(path = "cd50", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @PostMapping(path = "send", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Object> send(@RequestBody @Valid Cd50Dto dto, BindingResult bindingResult) { |
| | | public BaseResponse<Object> send(@RequestBody @Valid CdDto dto, BindingResult bindingResult) { |
| | | BaseResponse<Object> res ; |
| | | //发送命令前-1:验证 |
| | | res = super.pre1(sv, ComCode, dto, bindingResult); |
| | |
| | | res = super.pre2(sv, ComCode, dto, bindingResult); |
| | | if (res == null) { |
| | | //发送命令前-3:保存命令日志 |
| | | Cd50Param comParam = Cd50Param.builder().commandCode(ComCode).build(); |
| | | CdParam comParam = CdParam.builder().commandCode(ComCode).projectNo(projectNo).controllerType(controllerType).build(); |
| | | comParam.page = 1 ; |
| | | res = super.pre3(sv, dto.getIntakeId(), dto.getOperator(), ComCode, comParam); |
| | | if (res == null) { |
| | | //发送命令前-4:准备Feature |
| | | super.pre4(); |
| | | try { |
| | | //创建外部命令(发给控制器) |
| | | Command com = sv.createOuterCommand("" + comId, ComCode); |
| | | com.rtuAddr = ctrlPo.getRtuAddr(); |
| | | Command com = sv.createOuterCommand(ctrlPo.getRtuAddr(), "" + comId, ComCode); |
| | | com.rtuResultSendWebUrl = rtuResultSendWebUrl; |
| | | com.param = comParam ; |
| | | //发送命令 |
| | | res = super.doSend(sv, com); |
| | | if (res == null) { |
| | |
| | | if(resultData != null){ |
| | | JSONObject codeData = resultData.getJSONObject("data") ; |
| | | if(codeData == null){ |
| | | return RtuSuccessMsg ; |
| | | msg = RtuSuccessMsg ; |
| | | }else { |
| | | Integer minute = codeData.getInteger("minute"); |
| | | return "查询成功,自报周期:" + minute + "分钟"; |
| | | String json = codeData.toJSONString(); |
| | | List<DataCd65Vo> list = JSON.parseArray(json, DataCd65Vo.class) ; |
| | | if(list != null && list.size() > 0){ |
| | | msg = "" ; |
| | | for(DataCd65Vo cvo : list){ |
| | | msg += cvo.toStr(false) ; |
| | | } |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
| | | } |
| | | } |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd65; |
| | | |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 14:42 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=true) |
| | | public class CdDto extends DtoBase { |
| | | public static final long serialVersionUID = 202505120909001L; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd65; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.CdParameter; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import lombok.experimental.SuperBuilder; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 14:43 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @ToString(callSuper = true) |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @SuperBuilder |
| | | public class CdParam extends CdParameter { |
| | | public Integer page ;//分页,取值范围(1、2、3、4、5、6、7、8、9) |
| | | } |
copy from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Sv.java
copy to pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd65/CdSv.java
File was copied from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Sv.java |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201; |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd65; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.ComSv; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class Cd50Sv extends ComSv { |
| | | @Service("cd65Sv") |
| | | public class CdSv extends ComSv { |
| | | } |
copy from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java
copy to pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd68/CdCtrl.java
File was copied from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201; |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd68; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd68Vo; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 14:41 |
| | | * @Date: 2025/5/12 13:53 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "远程透传命令", description = "远程透传命令") |
| | | @RestController |
| | | @RequestMapping(path = "p202404V201") |
| | | @Tag(name = "远程命令", description = "查询机井年最大开采量和水位下限") |
| | | @RestController("cd68Ctrl") |
| | | @RequestMapping(path = "p202404V201/cd68") |
| | | @RequiredArgsConstructor |
| | | @Scope("prototype") //因为有对象类属性,所以采用原型模式,每次请求新建一个实例对象 |
| | | public class Cd50Ctrl extends ComCtrl { |
| | | public class CdCtrl extends ComCtrl { |
| | | |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功"; |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功,无返回数据"; |
| | | |
| | | private static final String ComCode = "50" ; |
| | | private static final String ComCode = "68" ; |
| | | |
| | | @Autowired |
| | | private Cd50Sv sv ; |
| | | private CdSv sv ; |
| | | /** |
| | | * 向设备(控制器)发送透传命令 |
| | | * 向设备(控制器)发送命令 |
| | | * @param dto 前端发来的值对象 |
| | | * @param bindingResult 对dto验证的结果 |
| | | * @return 返回前端 |
| | | */ |
| | | @PostMapping(path = "cd50", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @PostMapping(path = "send", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Object> send(@RequestBody @Valid Cd50Dto dto, BindingResult bindingResult) { |
| | | public BaseResponse<Object> send(@RequestBody @Valid CdDto dto, BindingResult bindingResult) { |
| | | BaseResponse<Object> res ; |
| | | //发送命令前-1:验证 |
| | | res = super.pre1(sv, ComCode, dto, bindingResult); |
| | |
| | | res = super.pre2(sv, ComCode, dto, bindingResult); |
| | | if (res == null) { |
| | | //发送命令前-3:保存命令日志 |
| | | Cd50Param comParam = Cd50Param.builder().commandCode(ComCode).build(); |
| | | CdParam comParam = CdParam.builder().commandCode(ComCode).projectNo(projectNo).controllerType(controllerType).build(); |
| | | res = super.pre3(sv, dto.getIntakeId(), dto.getOperator(), ComCode, comParam); |
| | | if (res == null) { |
| | | //发送命令前-4:准备Feature |
| | | super.pre4(); |
| | | try { |
| | | //创建外部命令(发给控制器) |
| | | Command com = sv.createOuterCommand("" + comId, ComCode); |
| | | com.rtuAddr = ctrlPo.getRtuAddr(); |
| | | Command com = sv.createOuterCommand(ctrlPo.getRtuAddr(), "" + comId, ComCode); |
| | | com.rtuResultSendWebUrl = rtuResultSendWebUrl; |
| | | com.param = comParam ; |
| | | //发送命令 |
| | | res = super.doSend(sv, com); |
| | | if (res == null) { |
| | |
| | | if(resultData != null){ |
| | | JSONObject codeData = resultData.getJSONObject("data") ; |
| | | if(codeData == null){ |
| | | return RtuSuccessMsg ; |
| | | msg = RtuSuccessMsg ; |
| | | }else { |
| | | Integer minute = codeData.getInteger("minute"); |
| | | return "查询成功,自报周期:" + minute + "分钟"; |
| | | String json = codeData.toJSONString(); |
| | | DataCd68Vo cvo = JSON.parseObject(json, DataCd68Vo.class) ; |
| | | if(cvo != null){ |
| | | msg = cvo.toStr(false) ; |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
| | | } |
| | | } |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd68; |
| | | |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 13:53 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=true) |
| | | public class CdDto extends DtoBase { |
| | | public static final long serialVersionUID = 202505121140001L; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd68; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.CdParameter; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import lombok.experimental.SuperBuilder; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 13:53 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @ToString(callSuper = true) |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @SuperBuilder |
| | | public class CdParam extends CdParameter { |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd68; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.ComSv; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 13:53 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service("cd68Sv") |
| | | public class CdSv extends ComSv { |
| | | } |
copy from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java
copy to pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd97/CdCtrl.java
File was copied from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201; |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd97; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCdXyVo; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 14:41 |
| | | * @Date: 2025/5/12 10:40 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "远程透传命令", description = "远程透传命令") |
| | | @RestController |
| | | @RequestMapping(path = "p202404V201") |
| | | @Tag(name = "远程命令", description = "清除设备终端用户用水记录") |
| | | @RestController("cd97Ctrl") |
| | | @RequestMapping(path = "p202404V201/cd97") |
| | | @RequiredArgsConstructor |
| | | @Scope("prototype") //因为有对象类属性,所以采用原型模式,每次请求新建一个实例对象 |
| | | public class Cd50Ctrl extends ComCtrl { |
| | | public class CdCtrl extends ComCtrl { |
| | | |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功"; |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功,无返回数据"; |
| | | |
| | | private static final String ComCode = "50" ; |
| | | private static final String ComCode = "97" ; |
| | | |
| | | @Autowired |
| | | private Cd50Sv sv ; |
| | | private CdSv sv ; |
| | | /** |
| | | * 向设备(控制器)发送透传命令 |
| | | * 向设备(控制器)发送命令 |
| | | * @param dto 前端发来的值对象 |
| | | * @param bindingResult 对dto验证的结果 |
| | | * @return 返回前端 |
| | | */ |
| | | @PostMapping(path = "cd50", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @PostMapping(path = "send", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Object> send(@RequestBody @Valid Cd50Dto dto, BindingResult bindingResult) { |
| | | public BaseResponse<Object> send(@RequestBody @Valid CdDto dto, BindingResult bindingResult) { |
| | | BaseResponse<Object> res ; |
| | | //发送命令前-1:验证 |
| | | res = super.pre1(sv, ComCode, dto, bindingResult); |
| | |
| | | res = super.pre2(sv, ComCode, dto, bindingResult); |
| | | if (res == null) { |
| | | //发送命令前-3:保存命令日志 |
| | | Cd50Param comParam = Cd50Param.builder().commandCode(ComCode).build(); |
| | | CdParam comParam = CdParam.builder().commandCode(ComCode).projectNo(projectNo).controllerType(controllerType).build(); |
| | | res = super.pre3(sv, dto.getIntakeId(), dto.getOperator(), ComCode, comParam); |
| | | if (res == null) { |
| | | //发送命令前-4:准备Feature |
| | | super.pre4(); |
| | | try { |
| | | //创建外部命令(发给控制器) |
| | | Command com = sv.createOuterCommand("" + comId, ComCode); |
| | | com.rtuAddr = ctrlPo.getRtuAddr(); |
| | | Command com = sv.createOuterCommand(ctrlPo.getRtuAddr(), "" + comId, ComCode); |
| | | com.rtuResultSendWebUrl = rtuResultSendWebUrl; |
| | | com.param = comParam ; |
| | | //发送命令 |
| | | res = super.doSend(sv, com); |
| | | if (res == null) { |
| | |
| | | if(resultData != null){ |
| | | JSONObject codeData = resultData.getJSONObject("data") ; |
| | | if(codeData == null){ |
| | | return RtuSuccessMsg ; |
| | | msg = RtuSuccessMsg ; |
| | | }else { |
| | | Integer minute = codeData.getInteger("minute"); |
| | | return "查询成功,自报周期:" + minute + "分钟"; |
| | | String json = codeData.toJSONString(); |
| | | DataCdXyVo cvo = JSON.parseObject(json, DataCdXyVo.class) ; |
| | | if(cvo != null){ |
| | | msg = cvo.toStr(false) ; |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
| | | } |
| | | } |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd97; |
| | | |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 10:40 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=true) |
| | | public class CdDto extends DtoBase { |
| | | public static final long serialVersionUID = 202505121108001L; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd97; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.CdParameter; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import lombok.experimental.SuperBuilder; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 10:40 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @ToString(callSuper = true) |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @SuperBuilder |
| | | public class CdParam extends CdParameter { |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd97; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.ComSv; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 10:40 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service("cd97Sv") |
| | | public class CdSv extends ComSv { |
| | | } |
copy from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java
copy to pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd98/CdCtrl.java
File was copied from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201; |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd98; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCdXyVo; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 14:41 |
| | | * @Date: 2025/5/12 11:30 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "远程透传命令", description = "远程透传命令") |
| | | @RestController |
| | | @RequestMapping(path = "p202404V201") |
| | | @Tag(name = "远程命令", description = "清空设备终端充值记录") |
| | | @RestController("cd98Ctrl") |
| | | @RequestMapping(path = "p202404V201/cd98") |
| | | @RequiredArgsConstructor |
| | | @Scope("prototype") //因为有对象类属性,所以采用原型模式,每次请求新建一个实例对象 |
| | | public class Cd50Ctrl extends ComCtrl { |
| | | public class CdCtrl extends ComCtrl { |
| | | |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功"; |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功,无返回数据"; |
| | | |
| | | private static final String ComCode = "50" ; |
| | | private static final String ComCode = "98" ; |
| | | |
| | | @Autowired |
| | | private Cd50Sv sv ; |
| | | private CdSv sv ; |
| | | /** |
| | | * 向设备(控制器)发送透传命令 |
| | | * 向设备(控制器)发送命令 |
| | | * @param dto 前端发来的值对象 |
| | | * @param bindingResult 对dto验证的结果 |
| | | * @return 返回前端 |
| | | */ |
| | | @PostMapping(path = "cd50", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @PostMapping(path = "send", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Object> send(@RequestBody @Valid Cd50Dto dto, BindingResult bindingResult) { |
| | | public BaseResponse<Object> send(@RequestBody @Valid CdDto dto, BindingResult bindingResult) { |
| | | BaseResponse<Object> res ; |
| | | //发送命令前-1:验证 |
| | | res = super.pre1(sv, ComCode, dto, bindingResult); |
| | |
| | | res = super.pre2(sv, ComCode, dto, bindingResult); |
| | | if (res == null) { |
| | | //发送命令前-3:保存命令日志 |
| | | Cd50Param comParam = Cd50Param.builder().commandCode(ComCode).build(); |
| | | CdParam comParam = CdParam.builder().commandCode(ComCode).projectNo(projectNo).controllerType(controllerType).build(); |
| | | res = super.pre3(sv, dto.getIntakeId(), dto.getOperator(), ComCode, comParam); |
| | | if (res == null) { |
| | | //发送命令前-4:准备Feature |
| | | super.pre4(); |
| | | try { |
| | | //创建外部命令(发给控制器) |
| | | Command com = sv.createOuterCommand("" + comId, ComCode); |
| | | com.rtuAddr = ctrlPo.getRtuAddr(); |
| | | Command com = sv.createOuterCommand(ctrlPo.getRtuAddr(), "" + comId, ComCode); |
| | | com.rtuResultSendWebUrl = rtuResultSendWebUrl; |
| | | com.param = comParam ; |
| | | //发送命令 |
| | | res = super.doSend(sv, com); |
| | | if (res == null) { |
| | |
| | | if(resultData != null){ |
| | | JSONObject codeData = resultData.getJSONObject("data") ; |
| | | if(codeData == null){ |
| | | return RtuSuccessMsg ; |
| | | msg = RtuSuccessMsg ; |
| | | }else { |
| | | Integer minute = codeData.getInteger("minute"); |
| | | return "查询成功,自报周期:" + minute + "分钟"; |
| | | String json = codeData.toJSONString(); |
| | | DataCdXyVo cvo = JSON.parseObject(json, DataCdXyVo.class) ; |
| | | if(cvo != null){ |
| | | msg = cvo.toStr(false) ; |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
| | | } |
| | | } |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd98; |
| | | |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 11:30 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=true) |
| | | public class CdDto extends DtoBase { |
| | | public static final long serialVersionUID = 202505121108001L; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd98; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.CdParameter; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import lombok.experimental.SuperBuilder; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 11:30 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @ToString(callSuper = true) |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @SuperBuilder |
| | | public class CdParam extends CdParameter { |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd98; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.ComSv; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 11:30 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service("cd98Sv") |
| | | public class CdSv extends ComSv { |
| | | } |
copy from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java
copy to pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd99/CdCtrl.java
File was copied from pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/Cd50Ctrl.java |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201; |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd99; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCdXyVo; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/9 14:41 |
| | | * @Date: 2025/5/12 13:45 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "远程透传命令", description = "远程透传命令") |
| | | @RestController |
| | | @RequestMapping(path = "p202404V201") |
| | | @Tag(name = "远程命令", description = "清空设备终端日记录") |
| | | @RestController("cd99Ctrl") |
| | | @RequestMapping(path = "p202404V201/cd99") |
| | | @RequiredArgsConstructor |
| | | @Scope("prototype") //因为有对象类属性,所以采用原型模式,每次请求新建一个实例对象 |
| | | public class Cd50Ctrl extends ComCtrl { |
| | | public class CdCtrl extends ComCtrl { |
| | | |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功"; |
| | | private static final String RtuSuccessMsg = "控制器接收并执行命令成功,无返回数据"; |
| | | |
| | | private static final String ComCode = "50" ; |
| | | private static final String ComCode = "99" ; |
| | | |
| | | @Autowired |
| | | private Cd50Sv sv ; |
| | | private CdSv sv ; |
| | | /** |
| | | * 向设备(控制器)发送透传命令 |
| | | * 向设备(控制器)发送命令 |
| | | * @param dto 前端发来的值对象 |
| | | * @param bindingResult 对dto验证的结果 |
| | | * @return 返回前端 |
| | | */ |
| | | @PostMapping(path = "cd50", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @PostMapping(path = "send", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Object> send(@RequestBody @Valid Cd50Dto dto, BindingResult bindingResult) { |
| | | public BaseResponse<Object> send(@RequestBody @Valid CdDto dto, BindingResult bindingResult) { |
| | | BaseResponse<Object> res ; |
| | | //发送命令前-1:验证 |
| | | res = super.pre1(sv, ComCode, dto, bindingResult); |
| | |
| | | res = super.pre2(sv, ComCode, dto, bindingResult); |
| | | if (res == null) { |
| | | //发送命令前-3:保存命令日志 |
| | | Cd50Param comParam = Cd50Param.builder().commandCode(ComCode).build(); |
| | | CdParam comParam = CdParam.builder().commandCode(ComCode).projectNo(projectNo).controllerType(controllerType).build(); |
| | | res = super.pre3(sv, dto.getIntakeId(), dto.getOperator(), ComCode, comParam); |
| | | if (res == null) { |
| | | //发送命令前-4:准备Feature |
| | | super.pre4(); |
| | | try { |
| | | //创建外部命令(发给控制器) |
| | | Command com = sv.createOuterCommand("" + comId, ComCode); |
| | | com.rtuAddr = ctrlPo.getRtuAddr(); |
| | | Command com = sv.createOuterCommand(ctrlPo.getRtuAddr(), "" + comId, ComCode); |
| | | com.rtuResultSendWebUrl = rtuResultSendWebUrl; |
| | | com.param = comParam ; |
| | | //发送命令 |
| | | res = super.doSend(sv, com); |
| | | if (res == null) { |
| | |
| | | if(resultData != null){ |
| | | JSONObject codeData = resultData.getJSONObject("data") ; |
| | | if(codeData == null){ |
| | | return RtuSuccessMsg ; |
| | | msg = RtuSuccessMsg ; |
| | | }else { |
| | | Integer minute = codeData.getInteger("minute"); |
| | | return "查询成功,自报周期:" + minute + "分钟"; |
| | | String json = codeData.toJSONString(); |
| | | DataCdXyVo cvo = JSON.parseObject(json, DataCdXyVo.class) ; |
| | | if(cvo != null){ |
| | | msg = cvo.toStr(false) ; |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
| | | } |
| | | } |
| | | }else{ |
| | | msg = RtuSuccessMsg ; |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd99; |
| | | |
| | | import com.dy.pipIrrRemote.common.dto.DtoBase; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 13:45 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=true) |
| | | public class CdDto extends DtoBase { |
| | | public static final long serialVersionUID = 202505121108001L; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd99; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.CdParameter; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import lombok.experimental.SuperBuilder; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 13:45 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @ToString(callSuper = true) |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @SuperBuilder |
| | | public class CdParam extends CdParameter { |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.monitor.p202404V201.cd99; |
| | | |
| | | import com.dy.pipIrrRemote.monitor.common.ComSv; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/12 13:45 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service("cd99Sv") |
| | | public class CdSv extends ComSv { |
| | | } |
| | |
| | | value: ./logs |
| | | #日志文件存储名称 |
| | | - name: project.name |
| | | value: pipIrrOperation |
| | | value: pipIrrTerminal |
| | | |
| | | #定义输出器,可以输出到控制台和文件. |
| | | Appenders: |