Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
| | |
| | | @Data |
| | | public class Com99Vo { |
| | | public String icCardNo ;//17位虚拟IC卡编号(协议是10位数字) |
| | | public Integer moneyRemain;//剩余金额(取值范围0.00~999999.99,单位为元) |
| | | public Double moneyRemain;//剩余金额(取值范围0.00~999999.99,单位为元) |
| | | public Double waterPrice;//水价(取值范围0.00~99.99元/m3) |
| | | public Integer minutes ;//用水时长(0~9999分钟) |
| | | public String orderNo ;//订单号(16位数字) |
| | |
| | | @Data |
| | | public class ComA0Vo { |
| | | public String icCardNo ;//17位虚拟IC卡编号(协议是10位数字) |
| | | public Integer moneyRemain;//剩余金额(取值范围0.00~999999.99,单位为元) |
| | | public Double moneyRemain;//剩余金额(取值范围0.00~999999.99,单位为元) |
| | | public Double waterPrice;//水价(取值范围0.00~99.99元/m3) |
| | | public Integer waterAmount ;//预用水量(0~9999 m3) |
| | | public String orderNo ;//订单号(16位数字) |
| | |
| | | import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard; |
| | | import jakarta.annotation.PostConstruct; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpMethod; |
| | |
| | | //@Value("${mw.comSendUrl}") |
| | | protected String comSendUrl; |
| | | |
| | | protected static String controllerType = null; |
| | | protected static Integer projectNo = null; |
| | | //protected static String controllerType = null; |
| | | //protected static Integer projectNo = null; |
| | | |
| | | @Value("${project.projectNo}") |
| | | protected Integer projectNo; |
| | | |
| | | @Value("${project.controllerType}") |
| | | protected String controllerType; |
| | | |
| | | protected String commandTypeOuter = CommandType.outerCommand; |
| | | |
| | | // 存储实例化的 CompletableFuture<Data> 对象 |
| | | protected static Map<Long, Object> features = new HashMap<>(); |
| | | protected static Boolean setuped = false; |
| | | //protected static Boolean setuped = false; |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | |
| | | /** |
| | | * 获取系统配置参数 |
| | | */ |
| | | public void setUp() { |
| | | controllerType = comSupport.baSettingsMapper.getItemValue("controllerType"); |
| | | projectNo = Integer.parseInt(comSupport.baSettingsMapper.getItemValue("projectNo")); |
| | | setuped = true; |
| | | } |
| | | //public void setUp() { |
| | | // controllerType = comSupport.baSettingsMapper.getItemValue("controllerType"); |
| | | // projectNo = Integer.parseInt(comSupport.baSettingsMapper.getItemValue("projectNo")); |
| | | // setuped = true; |
| | | //} |
| | | |
| | | /** |
| | | * 生成订单号 |
| | |
| | | seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard); |
| | | } |
| | | |
| | | // 如果是开发命令(92-平台开阀,91-小程序开阀),返回结果中添加阀控器地址、虚拟卡编号、订单号 |
| | | if(commandCode.equals("92") || commandCode.equals("97")) { |
| | | JSONObject job_response = (JSONObject) JSON.toJSON(response_CallBack); |
| | | JSONObject job_param = (JSONObject) JSON.toJSON(param); |
| | | |
| | | JSONObject job_data = job_response.getJSONObject("content").getJSONObject("data"); |
| | | job_data.remove("success"); |
| | | job_data.put("intakeId", intakeId); |
| | | job_data.put("rtuAddr", rtuAddr); |
| | | job_data.put("vcNum", job_param.getString("icCardNo")); |
| | | job_data.put("orderNo", job_param.getString("orderNo")); |
| | | |
| | | response_CallBack = JSON.parseObject(job_response.toJSONString(), BaseResponse.class); |
| | | } |
| | | |
| | | // 回调返回的内容,回调结果写入命令日志表的任务由中间件完成 |
| | | return response_CallBack; |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmAlarmStateHistory; |
| | | import com.dy.pipIrrGlobal.voRm.VoControllerAlarmState; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | |
| | | * @return update count |
| | | */ |
| | | int updateByPrimaryKey(RmAlarmStateHistory record); |
| | | |
| | | /** |
| | | * 根据指定条件获取记录总数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoControllerAlarmState> getControllerAlarmStateHistory(Map<?, ?> params); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmAlarmStateLast; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay; |
| | | import com.dy.pipIrrGlobal.voRm.VoControllerAlarmState; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | |
| | | * @return object by intakeId |
| | | */ |
| | | List<RmAlarmStateLast> selectByIntakeId(Long intakeId); |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件获取记录总数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoControllerAlarmState> getControllerAlarmStateLast(Map<?, ?> params); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmClientAmountDayLast; |
| | | import com.dy.pipIrrGlobal.voRm.VoClientAmountDay; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | |
| | | * @return update count |
| | | */ |
| | | int updateByPrimaryKey(RmClientAmountDayLast record); |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件获取记录总数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoClientAmountDay> getClientAmountDayLast(Map<?, ?> params); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmClientAmountDay; |
| | | import com.dy.pipIrrGlobal.voRm.VoClientAmountDay; |
| | | import com.dy.pipIrrGlobal.voRm.VoControllerAlarmState; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | |
| | | * @return update count |
| | | */ |
| | | int updateByPrimaryKey(RmClientAmountDay record); |
| | | |
| | | /** |
| | | * 根据指定条件获取记录总数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoClientAmountDay> getClientAmountDayHistory(Map<?, ?> params); |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voRm; |
| | | |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.sql.Date; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/7/23 16:21 |
| | | * @LastEditTime :2024/7/23 16:21 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @Schema(title = "农户日用水量统计视图对象") |
| | | public class VoClientAmountDay implements BaseEntity { |
| | | |
| | | private static final long serialVersionUID = 202407231622001L; |
| | | |
| | | @Schema(description = "农户ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private String clientId; |
| | | |
| | | @Schema(description = "日取水量", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Double amount; |
| | | |
| | | @Schema(description = "日花费金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Double money; |
| | | |
| | | @Schema(description = "统计日期(yyyy-mm-dd)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private java.sql.Date dt; |
| | | |
| | | @Schema(description = "统计日最后一次开阀日期时间(yyyy-mm-dd HH:MM:SS)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private java.util.Date openDtLast; |
| | | |
| | | @Schema(description = "统计日最后一次关阀日期时间(yyyy-mm-dd HH:MM:SS)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private java.util.Date closeDtLast; |
| | | |
| | | @Schema(description = "统计日最后一次开阀取水量", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Double thisAmountLast; |
| | | |
| | | @Schema(description = "统计日最后一次开阀花费金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Double thisMoneyLast; |
| | | |
| | | @Schema(description = "统计日最后一次开阀取水时长(分钟)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long thisTimeLast; |
| | | |
| | | @Schema(description = "统计日最后一次关阀上报控制器时钟", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private java.util.Date rtuDtLast; |
| | | |
| | | @Schema(description = "农户姓名", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private String clientName; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voRm; |
| | | |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/7/23 8:39 |
| | | * @LastEditTime :2024/7/23 8:39 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @Schema(title = "控制器报警与状态视图对象") |
| | | public class VoControllerAlarmState implements BaseEntity { |
| | | |
| | | private static final long serialVersionUID = 202407230842001L; |
| | | |
| | | @Schema(description = "控制器ID") |
| | | private String controllerId; |
| | | |
| | | @Schema(description = "取水口ID") |
| | | private String intakeId; |
| | | |
| | | @Schema(description = "取水口名称") |
| | | private String intakeName; |
| | | |
| | | @Schema(description = "控制器地址") |
| | | private String rtuAddr; |
| | | |
| | | @Schema(description = "上报日期时间") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date dt; |
| | | |
| | | @Schema(description = "状态-阀门/泵(0打开、1关闭)") |
| | | private Byte valveState; |
| | | |
| | | @Schema(description = "剩余水量小于报警上限报警报警(1:报警, 0:正常)") |
| | | private Byte alarmRemainWater; |
| | | |
| | | @Schema(description = "剩余水量为0关泵/阀(1:关泵,0:正常)") |
| | | private Byte alarm0WaterRemain; |
| | | |
| | | @Schema(description = "年用水量大于限制水量报警(1:报警 0:正常)") |
| | | private Byte alarmExceedYear; |
| | | |
| | | @Schema(description = "流量计故障(1:报警,0:正常)") |
| | | private Byte alarmWaterMeterFault; |
| | | |
| | | @Schema(description = "漏损(偷水)报警(1:报警, 0:正常)") |
| | | private Byte alarmLoss; |
| | | |
| | | @Schema(description = "流量计损坏(正常通讯但瞬时为0)报警(1:报警,0:正常)") |
| | | private Byte alarmWaterMeterBreak; |
| | | |
| | | @Schema(description = "电表故障报警(1:报警,0:正常)") |
| | | private Byte alarmEleMeterFault; |
| | | |
| | | @Schema(description = "剩余金额为0(1:报警,0:正常)") |
| | | private Byte alarm0MoneyRemain; |
| | | |
| | | @Schema(description = "控制器内门报警(1:报警,0:正常)") |
| | | private Byte alarmInnerDoor; |
| | | |
| | | @Schema(description = "控制器外门打开报警(1:报警,0:正常)") |
| | | private Byte alarmOuterDoor; |
| | | |
| | | @Schema(description = "交流缺项报警(1:报警,0:正常)") |
| | | private Byte alarmEleMiss; |
| | | |
| | | @Schema(description = "交流过流报警(1:报警,0:正常)") |
| | | private Byte alarmEleExceed; |
| | | |
| | | @Schema(description = "三相电欠压报警(1:报警,0:正常)") |
| | | private Byte alarmEleLowVolt; |
| | | |
| | | @Schema(description = "IC卡状态(1、有效,0:无效)") |
| | | private Byte stateIcEnable; |
| | | |
| | | @Schema(description = "电池电压报警(1:报警,0:正常)") |
| | | private Byte alarmBatteryVolt; |
| | | |
| | | @Schema(description = "阀门报警(1:报警,0:正常)") |
| | | private Byte alarmValve; |
| | | |
| | | @Schema(description = "供电方式(0: 220V,1:蓄电池)") |
| | | private Byte powerType; |
| | | } |
| | |
| | | |
| | | pipIrr: |
| | | global: |
| | | dev: true #是否开发阶段,true或false |
| | | dev: false #是否开发阶段,true或false |
| | | dsName: ym #开发阶段,设置临时的数据库名称 |
| | | mw: |
| | | webPort: 8070 |
| | |
| | | # ym: 100 |
| | | # pj: 101 |
| | | |
| | | #项目配置 |
| | | project: |
| | | #项目编码 |
| | | projectNo: 10 |
| | | #控制器类型 |
| | | controllerType: 57 |
| | | |
| | | |
| | | #通讯协议 |
| | | #protocol: DYJS_2023,DYJS_2024 |
| | | mw: |
| | |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, controller_id, intake_id, rtu_addr, dt, rtu_dt, valve_state, alarm_remain_water, |
| | | alarm0_water_remain, alarm_exceed_year, alarm_water_meter_fault, alarm_loss, alarm_water_meter_break, |
| | | alarm_ele_meter_fault, alarm0_money_remain, alarm_inner_door, alarm_outer_door, alarm_ele_miss, |
| | | alarm_ele_exceed, alarm_ele_low_volt, state_ic_enable,alarm_battery_volt,alarm_valve,power_type |
| | | id, |
| | | controller_id, |
| | | intake_id, |
| | | rtu_addr, |
| | | dt, |
| | | rtu_dt, |
| | | valve_state, |
| | | alarm_remain_water, |
| | | alarm0_water_remain, |
| | | alarm_exceed_year, |
| | | alarm_water_meter_fault, |
| | | alarm_loss, |
| | | alarm_water_meter_break, |
| | | alarm_ele_meter_fault, |
| | | alarm0_money_remain, |
| | | alarm_inner_door, |
| | | alarm_outer_door, |
| | | alarm_ele_miss, |
| | | alarm_ele_exceed, |
| | | alarm_ele_low_volt, |
| | | state_ic_enable, |
| | | alarm_battery_volt, |
| | | alarm_valve, |
| | | power_type |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from rm_alarm_state_history |
| | | delete |
| | | from rm_alarm_state_history |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmAlarmStateHistory"> |
| | |
| | | state_ic_enable,alarm_battery_volt,alarm_valve,power_type) |
| | | values (#{id,jdbcType=BIGINT}, #{controllerId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, |
| | | #{rtuAddr,jdbcType=VARCHAR}, #{dt,jdbcType=TIMESTAMP}, #{rtuDt,jdbcType=TIMESTAMP}, |
| | | #{valveState,jdbcType=TINYINT}, #{alarmRemainWater,jdbcType=TINYINT}, #{alarm0WaterRemain,jdbcType=TINYINT}, |
| | | #{valveState,jdbcType=TINYINT}, #{alarmRemainWater,jdbcType=TINYINT}, |
| | | #{alarm0WaterRemain,jdbcType=TINYINT}, |
| | | #{alarmExceedYear,jdbcType=TINYINT}, #{alarmWaterMeterFault,jdbcType=TINYINT}, |
| | | #{alarmLoss,jdbcType=TINYINT}, #{alarmWaterMeterBreak,jdbcType=TINYINT}, #{alarmEleMeterFault,jdbcType=TINYINT}, |
| | | #{alarm0MoneyRemain,jdbcType=TINYINT}, #{alarmInnerDoor,jdbcType=TINYINT}, #{alarmOuterDoor,jdbcType=TINYINT}, |
| | | #{alarmEleMiss,jdbcType=TINYINT}, #{alarmEleExceed,jdbcType=TINYINT}, #{alarmEleLowVolt,jdbcType=TINYINT}, |
| | | #{alarmLoss,jdbcType=TINYINT}, #{alarmWaterMeterBreak,jdbcType=TINYINT}, |
| | | #{alarmEleMeterFault,jdbcType=TINYINT}, |
| | | #{alarm0MoneyRemain,jdbcType=TINYINT}, #{alarmInnerDoor,jdbcType=TINYINT}, |
| | | #{alarmOuterDoor,jdbcType=TINYINT}, |
| | | #{alarmEleMiss,jdbcType=TINYINT}, #{alarmEleExceed,jdbcType=TINYINT}, |
| | | #{alarmEleLowVolt,jdbcType=TINYINT}, |
| | | #{stateIcEnable,jdbcType=TINYINT}, #{alarmBatteryVolt,jdbcType=TINYINT}, #{alarmValve,jdbcType=TINYINT}, |
| | | #{powerType,jdbcType=TINYINT}) |
| | | </insert> |
| | |
| | | power_type = #{powerType,jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <!--根据指定条件获取记录总数--> |
| | | <select id="getRecordCount" resultType="java.lang.Long"> |
| | | select count(*) |
| | | from rm_alarm_state_history rash |
| | | Left join pr_intake pint on rash.intake_id = pint.id |
| | | <where> |
| | | <if test="alarmState == 1"> |
| | | and ( |
| | | alarm_remain_water = 1 |
| | | or alarm0_water_remain = 1 |
| | | or alarm_exceed_year = 1 |
| | | or alarm_water_meter_fault = 1 |
| | | or alarm_loss = 1 |
| | | or alarm_water_meter_break = 1 |
| | | or alarm_ele_meter_fault = 1 |
| | | or alarm0_money_remain = 1 |
| | | or alarm_inner_door = 1 |
| | | or alarm_outer_door = 1 |
| | | or alarm_ele_miss = 1 |
| | | or alarm_ele_exceed = 1 |
| | | or alarm_ele_low_volt = 1 |
| | | or alarm_battery_volt = 1 |
| | | or alarm_valve = 1 |
| | | ) |
| | | </if> |
| | | <if test="alarmState == 0"> |
| | | and ( |
| | | alarm_remain_water = 0 |
| | | and alarm0_water_remain = 0 |
| | | and alarm_exceed_year = 0 |
| | | and alarm_water_meter_fault = 0 |
| | | and alarm_loss = 0 |
| | | and alarm_water_meter_break = 0 |
| | | and alarm_ele_meter_fault = 0 |
| | | and alarm0_money_remain = 0 |
| | | and alarm_inner_door = 0 |
| | | and alarm_outer_door = 0 |
| | | and alarm_ele_miss = 0 |
| | | and alarm_ele_exceed = 0 |
| | | and alarm_ele_low_volt = 0 |
| | | and alarm_battery_volt = 0 |
| | | and alarm_valve = 0 |
| | | ) |
| | | </if> |
| | | <if test="valveState != null"> |
| | | and rash.valve_state = #{valveState,jdbcType=TINYINT} |
| | | </if> |
| | | <if test="intakeName != null"> |
| | | and pint.name = #{intakeName,jdbcType=VARCHAR} |
| | | </if> |
| | | <if test="startDt != null"> |
| | | and rash.dt >= #{startDt,jdbcType=TIMESTAMP} |
| | | </if> |
| | | <if test="endDt != null"> |
| | | and rash.dt <= #{endDt,jdbcType=TIMESTAMP} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <!--根据指定条件获取记录--> |
| | | <select id="getControllerAlarmStateHistory" resultType="com.dy.pipIrrGlobal.voRm.VoControllerAlarmState"> |
| | | select |
| | | CAST(rash.controller_id AS char)AS controllerId, |
| | | CAST(rash.intake_id AS char)AS intakeId, |
| | | pint.name as intakeName, |
| | | rash.rtu_addr as rtuAddr, |
| | | rash.dt as dt, |
| | | rash.valve_state as valveState, |
| | | rash.alarm_remain_water as alarmRemainWater, |
| | | rash.alarm0_water_remain as alarm0WaterRemain, |
| | | rash.alarm_exceed_year as alarmExceedYear, |
| | | rash.alarm_water_meter_fault as alarmWaterMeterFault, |
| | | rash.alarm_loss as alarmLoss, |
| | | rash.alarm_water_meter_break as alarmWaterMeterBreak, |
| | | rash.alarm_ele_meter_fault as alarmEleMeterFault, |
| | | rash.alarm0_money_remain as alarm0MoneyRemain, |
| | | rash.alarm_inner_door as alarmInnerDoor, |
| | | rash.alarm_outer_door as alarmOuterDoor, |
| | | rash.alarm_ele_miss as alarmEleMiss, |
| | | rash.alarm_ele_exceed as alarmEleExceed, |
| | | rash.alarm_ele_low_volt as alarmEleLowVolt, |
| | | rash.state_ic_enable as stateIcEnable, |
| | | rash.alarm_battery_volt as alarmBatteryVolt, |
| | | rash.alarm_valve as alarmValve, |
| | | rash.power_type as powerType |
| | | from rm_alarm_state_history rash |
| | | Left join pr_intake pint on rash.intake_id = pint.id |
| | | <where> |
| | | <if test="alarmState == 1"> |
| | | and ( |
| | | alarm_remain_water = 1 |
| | | or alarm0_water_remain = 1 |
| | | or alarm_exceed_year = 1 |
| | | or alarm_water_meter_fault = 1 |
| | | or alarm_loss = 1 |
| | | or alarm_water_meter_break = 1 |
| | | or alarm_ele_meter_fault = 1 |
| | | or alarm0_money_remain = 1 |
| | | or alarm_inner_door = 1 |
| | | or alarm_outer_door = 1 |
| | | or alarm_ele_miss = 1 |
| | | or alarm_ele_exceed = 1 |
| | | or alarm_ele_low_volt = 1 |
| | | or alarm_battery_volt = 1 |
| | | or alarm_valve = 1 |
| | | ) |
| | | </if> |
| | | <if test="alarmState == 0"> |
| | | and ( |
| | | alarm_remain_water = 0 |
| | | and alarm0_water_remain = 0 |
| | | and alarm_exceed_year = 0 |
| | | and alarm_water_meter_fault = 0 |
| | | and alarm_loss = 0 |
| | | and alarm_water_meter_break = 0 |
| | | and alarm_ele_meter_fault = 0 |
| | | and alarm0_money_remain = 0 |
| | | and alarm_inner_door = 0 |
| | | and alarm_outer_door = 0 |
| | | and alarm_ele_miss = 0 |
| | | and alarm_ele_exceed = 0 |
| | | and alarm_ele_low_volt = 0 |
| | | and alarm_battery_volt = 0 |
| | | and alarm_valve = 0 |
| | | ) |
| | | </if> |
| | | <if test="valveState != null"> |
| | | and rash.valve_state = #{valveState,jdbcType=TINYINT} |
| | | </if> |
| | | <if test="intakeName != null"> |
| | | and pint.name like CONCAT('%',#{intakeName,jdbcType=VARCHAR},'%') |
| | | </if> |
| | | <if test="startDt != null"> |
| | | and rash.dt >= #{startDt,jdbcType=TIMESTAMP} |
| | | </if> |
| | | <if test="endDt != null"> |
| | | and rash.dt <= #{endDt,jdbcType=TIMESTAMP} |
| | | </if> |
| | | </where> |
| | | ORDER BY rash.dt DESC |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${(pageCurr-1)*pageSize}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | power_type = #{powerType,jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <!--根据指定条件获取记录总数--> |
| | | <select id="getRecordCount" resultType="java.lang.Long"> |
| | | select count(*) |
| | | from rm_alarm_state_last rasl |
| | | Left join pr_intake pint on intake_id = pint.id |
| | | <where> |
| | | <if test="alarmState == 1"> |
| | | and ( |
| | | alarm_remain_water = 1 |
| | | or alarm0_water_remain = 1 |
| | | or alarm_exceed_year = 1 |
| | | or alarm_water_meter_fault = 1 |
| | | or alarm_loss = 1 |
| | | or alarm_water_meter_break = 1 |
| | | or alarm_ele_meter_fault = 1 |
| | | or alarm0_money_remain = 1 |
| | | or alarm_inner_door = 1 |
| | | or alarm_outer_door = 1 |
| | | or alarm_ele_miss = 1 |
| | | or alarm_ele_exceed = 1 |
| | | or alarm_ele_low_volt = 1 |
| | | or alarm_battery_volt = 1 |
| | | or alarm_valve = 1 |
| | | ) |
| | | </if> |
| | | <if test="alarmState == 0"> |
| | | and ( |
| | | alarm_remain_water = 0 |
| | | and alarm0_water_remain = 0 |
| | | and alarm_exceed_year = 0 |
| | | and alarm_water_meter_fault = 0 |
| | | and alarm_loss = 0 |
| | | and alarm_water_meter_break = 0 |
| | | and alarm_ele_meter_fault = 0 |
| | | and alarm0_money_remain = 0 |
| | | and alarm_inner_door = 0 |
| | | and alarm_outer_door = 0 |
| | | and alarm_ele_miss = 0 |
| | | and alarm_ele_exceed = 0 |
| | | and alarm_ele_low_volt = 0 |
| | | and alarm_battery_volt = 0 |
| | | and alarm_valve = 0 |
| | | ) |
| | | </if> |
| | | <if test="valveState != null"> |
| | | and rasl.valve_state = #{valveState,jdbcType=TINYINT} |
| | | </if> |
| | | <if test="intakeName != null"> |
| | | and pint.name = #{intakeName,jdbcType=VARCHAR} |
| | | </if> |
| | | <if test="startDt != null"> |
| | | and rasl.dt >= #{startDt,jdbcType=TIMESTAMP} |
| | | </if> |
| | | <if test="endDt != null"> |
| | | and rasl.dt <= #{endDt,jdbcType=TIMESTAMP} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <!--根据指定条件获取记录--> |
| | | <select id="getControllerAlarmStateLast" resultType="com.dy.pipIrrGlobal.voRm.VoControllerAlarmState"> |
| | | select |
| | | CAST(rasl.controller_id AS char)AS controllerId, |
| | | CAST(rasl.intake_id AS char)AS intakeId, |
| | | pint.name as intakeName, |
| | | rasl.rtu_addr as rtuAddr, |
| | | rasl.dt as dt, |
| | | rasl.valve_state as valveState, |
| | | rasl.alarm_remain_water as alarmRemainWater, |
| | | rasl.alarm0_water_remain as alarm0WaterRemain, |
| | | rasl.alarm_exceed_year as alarmExceedYear, |
| | | rasl.alarm_water_meter_fault as alarmWaterMeterFault, |
| | | rasl.alarm_loss as alarmLoss, |
| | | rasl.alarm_water_meter_break as alarmWaterMeterBreak, |
| | | rasl.alarm_ele_meter_fault as alarmEleMeterFault, |
| | | rasl.alarm0_money_remain as alarm0MoneyRemain, |
| | | rasl.alarm_inner_door as alarmInnerDoor, |
| | | rasl.alarm_outer_door as alarmOuterDoor, |
| | | rasl.alarm_ele_miss as alarmEleMiss, |
| | | rasl.alarm_ele_exceed as alarmEleExceed, |
| | | rasl.alarm_ele_low_volt as alarmEleLowVolt, |
| | | rasl.state_ic_enable as stateIcEnable, |
| | | rasl.alarm_battery_volt as alarmBatteryVolt, |
| | | rasl.alarm_valve as alarmValve, |
| | | rasl.power_type as powerType |
| | | from rm_alarm_state_last rasl |
| | | Left join pr_intake pint on intake_id = pint.id |
| | | <where> |
| | | <if test="alarmState == 1"> |
| | | and ( |
| | | alarm_remain_water = 1 |
| | | or alarm0_water_remain = 1 |
| | | or alarm_exceed_year = 1 |
| | | or alarm_water_meter_fault = 1 |
| | | or alarm_loss = 1 |
| | | or alarm_water_meter_break = 1 |
| | | or alarm_ele_meter_fault = 1 |
| | | or alarm0_money_remain = 1 |
| | | or alarm_inner_door = 1 |
| | | or alarm_outer_door = 1 |
| | | or alarm_ele_miss = 1 |
| | | or alarm_ele_exceed = 1 |
| | | or alarm_ele_low_volt = 1 |
| | | or alarm_battery_volt = 1 |
| | | or alarm_valve = 1 |
| | | ) |
| | | </if> |
| | | <if test="alarmState == 0"> |
| | | and ( |
| | | alarm_remain_water = 0 |
| | | and alarm0_water_remain = 0 |
| | | and alarm_exceed_year = 0 |
| | | and alarm_water_meter_fault = 0 |
| | | and alarm_loss = 0 |
| | | and alarm_water_meter_break = 0 |
| | | and alarm_ele_meter_fault = 0 |
| | | and alarm0_money_remain = 0 |
| | | and alarm_inner_door = 0 |
| | | and alarm_outer_door = 0 |
| | | and alarm_ele_miss = 0 |
| | | and alarm_ele_exceed = 0 |
| | | and alarm_ele_low_volt = 0 |
| | | and alarm_battery_volt = 0 |
| | | and alarm_valve = 0 |
| | | ) |
| | | </if> |
| | | <if test="valveState != null"> |
| | | and rasl.valve_state = #{valveState,jdbcType=TINYINT} |
| | | </if> |
| | | <if test="intakeName != null"> |
| | | and pint.name like CONCAT('%',#{intakeName,jdbcType=VARCHAR},'%') |
| | | </if> |
| | | <if test="startDt != null"> |
| | | and rasl.dt >= #{startDt,jdbcType=TIMESTAMP} |
| | | </if> |
| | | <if test="endDt != null"> |
| | | and rasl.dt <= #{endDt,jdbcType=TIMESTAMP} |
| | | </if> |
| | | </where> |
| | | ORDER BY rasl.dt DESC |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${(pageCurr-1)*pageSize}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | rtu_dt_last = #{rtuDtLast,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <!--根据指定条件获取记录总数--> |
| | | <select id="getRecordCount" resultType="java.lang.Long"> |
| | | select count(*) |
| | | from rm_client_amount_day_last rcadl |
| | | Left join se_client sc on sc.id = rcadl.client_id |
| | | <where> |
| | | <if test="clientName != null"> |
| | | and sc.name = #{clientName,jdbcType=VARCHAR} |
| | | </if> |
| | | <if test="startDt != null"> |
| | | and rash.dt >= #{startDt,jdbcType=TIMESTAMP} |
| | | </if> |
| | | <if test="endDt != null"> |
| | | and rash.dt <= #{endDt,jdbcType=TIMESTAMP} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <!--根据指定条件获取记录--> |
| | | <select id="getClientAmountDayLast" resultType="com.dy.pipIrrGlobal.voRm.VoClientAmountDay"> |
| | | select |
| | | CAST(rcadl.client_id AS char)AS clientId, |
| | | rcadl.amount as amount, |
| | | rcadl.money as money, |
| | | rcadl.dt as dt, |
| | | rcadl.open_dt_last as openDtLast, |
| | | rcadl.close_dt_last as closeDtLast, |
| | | rcadl.this_amount_last as thisAmountLast, |
| | | rcadl.this_money_last as thisMoneyLast, |
| | | rcadl.this_time_last as thisTimeLast, |
| | | rcadl.rtu_dt_last as rtuDtLast, |
| | | sc.name as clientName |
| | | from rm_client_amount_day_last rcadl |
| | | Left join se_client sc on sc.id = rcadl.client_id |
| | | <where> |
| | | <if test="clientName != null"> |
| | | and sc.name = #{clientName,jdbcType=VARCHAR} |
| | | </if> |
| | | <if test="startDt != null"> |
| | | and rash.dt >= #{startDt,jdbcType=TIMESTAMP} |
| | | </if> |
| | | <if test="endDt != null"> |
| | | and rash.dt <= #{endDt,jdbcType=TIMESTAMP} |
| | | </if> |
| | | </where> |
| | | ORDER BY rcadl.dt DESC |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${(pageCurr-1)*pageSize}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | rtu_dt_last = #{rtuDtLast,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <!--根据指定条件获取记录总数--> |
| | | <select id="getRecordCount" resultType="java.lang.Long"> |
| | | select count(*) |
| | | from rm_client_amount_day rcad |
| | | Left join se_client sc on sc.id = rcad.client_id |
| | | <where> |
| | | <if test="clientName != null"> |
| | | and sc.name = #{clientName,jdbcType=VARCHAR} |
| | | </if> |
| | | <if test="startDt != null"> |
| | | and rash.dt >= #{startDt,jdbcType=TIMESTAMP} |
| | | </if> |
| | | <if test="endDt != null"> |
| | | and rash.dt <= #{endDt,jdbcType=TIMESTAMP} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <!--根据指定条件获取记录--> |
| | | <select id="getClientAmountDayHistory" resultType="com.dy.pipIrrGlobal.voRm.VoClientAmountDay"> |
| | | select |
| | | CAST(rcad.client_id AS char)AS clientId, |
| | | rcad.amount as amount, |
| | | rcad.money as money, |
| | | rcad.dt as dt, |
| | | rcad.open_dt_last as openDtLast, |
| | | rcad.close_dt_last as closeDtLast, |
| | | rcad.this_amount_last as thisAmountLast, |
| | | rcad.this_money_last as thisMoneyLast, |
| | | rcad.this_time_last as thisTimeLast, |
| | | rcad.rtu_dt_last as rtuDtLast, |
| | | sc.name as clientName |
| | | from rm_client_amount_day rcad |
| | | Left join se_client sc on sc.id = rcad.client_id |
| | | <where> |
| | | <if test="clientName != null"> |
| | | and sc.name = #{clientName,jdbcType=VARCHAR} |
| | | </if> |
| | | <if test="startDt != null"> |
| | | and rash.dt >= #{startDt,jdbcType=TIMESTAMP} |
| | | </if> |
| | | <if test="endDt != null"> |
| | | and rash.dt <= #{endDt,jdbcType=TIMESTAMP} |
| | | </if> |
| | | </where> |
| | | ORDER BY rcad.dt DESC |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${(pageCurr-1)*pageSize}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | import com.dy.common.mw.protocol.MidResult; |
| | | import com.dy.common.mw.protocol.MidResultAction; |
| | | import com.dy.common.mw.protocol.MidResultError; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | |
| | | |
| | | @Override |
| | | public void doAction(MidResult result) { |
| | | //if(result != null && result instanceof MidResultError){ |
| | | // MidResultError rs = (MidResultError)result ; |
| | | // log.error("解析或构造" + (rs.protocolName==null?"":("通信协议" + rs.protocolName + "的")) + "RTU" + (rs.rtuAddr==null?"":("(地址" + rs.rtuAddr + ")" )) + "数据出错" + (rs.message == null?"":(":" + rs.message))); |
| | | // if(rs.e != null){ |
| | | // log.error(rs.e); |
| | | // rs.e.printStackTrace(); |
| | | // } |
| | | //} |
| | | if(result != null && result instanceof MidResultError){ |
| | | MidResultError rs = (MidResultError)result ; |
| | | log.error("解析或构造" + (rs.protocolName==null?"":("通信协议" + rs.protocolName + "的")) + "RTU" + (rs.rtuAddr==null?"":("(地址" + rs.rtuAddr + ")" )) + "数据出错" + (rs.message == null?"":(":" + rs.message))); |
| | | if(rs.e != null){ |
| | | log.error(rs.e); |
| | | rs.e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | datasource: #配置数据源 |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | # url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | # url: jdbc:mysql://127.0.0.1:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | url: jdbc:mysql://8.140.179.55:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | # url: jdbc:mysql://8.140.179.55:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | username: root |
| | | password: dysql,;.abc!@# |
| | | druid: |
| | |
| | | @PostMapping(path = "receive", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | public void receive(@RequestBody Data data) { |
| | | JSONObject job_data = (JSONObject) JSON.toJSON(data); |
| | | //System.out.println(job_data.toJSONString()); |
| | | String job_dataS = job_data.toJSONString(); |
| | | JSONObject job_subData = job_data.getJSONObject("subData").getJSONObject("subData"); |
| | | |
| | | JSONObject job_response = new JSONObject(); |
New file |
| | |
| | | package com.dy.pipIrrRemote.common.dto; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-07-23 10:36 |
| | | * @LastEditTime 2024-07-23 10:36 |
| | | * @Description 自动关阀(定时关阀、定量关阀)传输对象 |
| | | */ |
| | | |
| | | @Data |
| | | public class AutomaticClose extends DtoBase { |
| | | public static final long serialVersionUID = 202407231039001L; |
| | | |
| | | /** |
| | | * 阀控器地址 |
| | | */ |
| | | @NotBlank(message = "阀控器地址不能为空") |
| | | private String rtuAddr; |
| | | |
| | | /** |
| | | * 虚拟卡编号 |
| | | */ |
| | | @NotBlank(message = "虚拟卡编号不能为空") |
| | | private String vcNum; |
| | | |
| | | /** |
| | | * 订单号 |
| | | */ |
| | | @NotBlank(message = "订单号不能为空") |
| | | private String orderNo; |
| | | |
| | | /** |
| | | * 用水时长,拥有定时关阀 |
| | | */ |
| | | private Integer minutes; |
| | | |
| | | /** |
| | | * 预用水量,拥有定量关阀 |
| | | */ |
| | | private Integer waterAmount; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.records; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/7/23 15:55 |
| | | * @LastEditTime :2024/7/23 15:55 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ToString(callSuper = true) |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Builder |
| | | @Schema(name = "农户日用水量统计查询条件") |
| | | public class ClientAmountDayQueryVo extends QueryConditionVo { |
| | | |
| | | @Schema(description = "农户姓名", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private String clientName; |
| | | |
| | | @Schema(description = "统计开始日期", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date startDt; |
| | | |
| | | @Schema(description = "统计结束日期", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endDt; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.records; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/7/22 20:01 |
| | | * @LastEditTime :2024/7/22 20:01 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ToString(callSuper = true) |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Builder |
| | | @Schema(name = "控制器报警与状态查询条件") |
| | | public class ControllerAlarmStateQueryVo extends QueryConditionVo { |
| | | |
| | | @Schema(description = "取水口名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private String intakeName; |
| | | |
| | | @Schema(description = "阀门状态", requiredMode = Schema.RequiredMode.NOT_REQUIRED)//(0打开、1关闭) |
| | | private Byte valveState; |
| | | |
| | | @Schema(description = "开始时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date startDt; |
| | | |
| | | @Schema(description = "结束时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endDt; |
| | | |
| | | @Schema(description = "报警状态", requiredMode = Schema.RequiredMode.NOT_REQUIRED)//(0正常、1报警) |
| | | private Byte alarmState; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.records; |
| | | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.voRm.VoClientAmountDay; |
| | | import com.dy.pipIrrGlobal.voRm.VoControllerAlarmState; |
| | | import com.dy.pipIrrGlobal.voSe.VoActiveCard; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/7/22 20:00 |
| | | * @LastEditTime :2024/7/22 20:00 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "检测控制查询", description = "检测控制查询") |
| | | @RestController |
| | | @RequestMapping(path = "remoteRecords") |
| | | public class RecordsCtrl { |
| | | @Autowired |
| | | private RecordsSv recordsSv; |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件获取控制器报警与状态列表(历史) |
| | | * |
| | | * @param vo 查询条件 |
| | | * @return 符合条件的控制器报警与状态列表(历史) |
| | | */ |
| | | @Operation(summary = "获得一页控制器报警与状态记录", description = "返回一页控制器报警与状态数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回一页控制器报警与状态数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/getControllerAlarmStateHistory") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoControllerAlarmState>>> getControllerAlarmStateHistory(@RequestBody ControllerAlarmStateQueryVo vo) { |
| | | try { |
| | | QueryResultVo<List<VoControllerAlarmState>> res = recordsSv.getControllerAlarmStateHistory(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取控制器报警与状态记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件获取控制器报警与状态列表(最新) |
| | | * |
| | | * @param vo 查询条件 |
| | | * @return 符合条件的控制器报警与状态列表(最新) |
| | | */ |
| | | @Operation(summary = "获得一页控制器报警与状态记录", description = "返回一页控制器报警与状态数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回一页控制器报警与状态数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/getControllerAlarmStateLast") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoControllerAlarmState>>> getControllerAlarmStateLast(@RequestBody ControllerAlarmStateQueryVo vo) { |
| | | try { |
| | | QueryResultVo<List<VoControllerAlarmState>> res = recordsSv.getControllerAlarmStateLast(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取控制器记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件获取农户日用水量统计列表(历史) |
| | | * |
| | | * @param vo 查询条件 |
| | | * @return 符合条件的农户日用水量统计列表(历史) |
| | | */ |
| | | @Operation(summary = "获得一页农户日用水量统计记录", description = "返回一页农户日用水量统计数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回一页控制器报警与状态数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/getClientAmountDayHistory") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoClientAmountDay>>> getClientAmountDayHistory(@RequestBody ClientAmountDayQueryVo vo) { |
| | | try { |
| | | QueryResultVo<List<VoClientAmountDay>> res = recordsSv.getClientAmountDayHistory(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取农户日用水量统计记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件获取农户日用水量统计列表(最新) |
| | | * |
| | | * @param vo 查询条件 |
| | | * @return 符合条件的农户日用水量统计列表(最新) |
| | | */ |
| | | @Operation(summary = "获得一页农户日用水量统计记录", description = "返回一页农户日用水量统计数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回一页控制器报警与状态数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/getClientAmountDayLast") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoClientAmountDay>>> getClientAmountDayLast(@RequestBody ClientAmountDayQueryVo vo) { |
| | | try { |
| | | QueryResultVo<List<VoClientAmountDay>> res = recordsSv.getClientAmountDayLast(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取农户日用水量统计记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.records; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoRm.RmAlarmStateHistoryMapper; |
| | | import com.dy.pipIrrGlobal.daoRm.RmAlarmStateLastMapper; |
| | | import com.dy.pipIrrGlobal.daoRm.RmClientAmountDayLastMapper; |
| | | import com.dy.pipIrrGlobal.daoRm.RmClientAmountDayMapper; |
| | | import com.dy.pipIrrGlobal.voRm.VoClientAmountDay; |
| | | import com.dy.pipIrrGlobal.voRm.VoControllerAlarmState; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/7/22 20:01 |
| | | * @LastEditTime :2024/7/22 20:01 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class RecordsSv { |
| | | @Autowired |
| | | private RmAlarmStateHistoryMapper rmAlarmStateHistoryMapper; |
| | | @Autowired |
| | | private RmAlarmStateLastMapper rmAlarmStateLastMapper; |
| | | |
| | | @Autowired |
| | | private RmClientAmountDayLastMapper rmClientAmountDayLastMapper; |
| | | @Autowired |
| | | private RmClientAmountDayMapper rmClientAmountDayMapper; |
| | | |
| | | |
| | | /** |
| | | * 获得一页控制器报警与状态记录(历史) |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoControllerAlarmState>> getControllerAlarmStateHistory(ControllerAlarmStateQueryVo vo) { |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo); |
| | | |
| | | Long itemTotal = rmAlarmStateHistoryMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoControllerAlarmState>> rsVo = new QueryResultVo<>(); |
| | | rsVo.pageSize = vo.pageSize; |
| | | rsVo.pageCurr = vo.pageCurr; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = rmAlarmStateHistoryMapper.getControllerAlarmStateHistory(params); |
| | | return rsVo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获得一页控制器报警与状态记录(最新) |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoControllerAlarmState>> getControllerAlarmStateLast(ControllerAlarmStateQueryVo vo) { |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo); |
| | | |
| | | Long itemTotal = rmAlarmStateLastMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoControllerAlarmState>> rsVo = new QueryResultVo<>(); |
| | | rsVo.pageSize = vo.pageSize; |
| | | rsVo.pageCurr = vo.pageCurr; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = rmAlarmStateLastMapper.getControllerAlarmStateLast(params); |
| | | return rsVo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获得一页农户日用水量统计记录(历史) |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoClientAmountDay>> getClientAmountDayHistory(ClientAmountDayQueryVo vo) { |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo); |
| | | |
| | | Long itemTotal = rmClientAmountDayMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoClientAmountDay>> rsVo = new QueryResultVo<>(); |
| | | rsVo.pageSize = vo.pageSize; |
| | | rsVo.pageCurr = vo.pageCurr; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = rmClientAmountDayMapper.getClientAmountDayHistory(params); |
| | | return rsVo; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获得一页农户日用水量统计记录(最新) |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoClientAmountDay>> getClientAmountDayLast(ClientAmountDayQueryVo vo) { |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo); |
| | | |
| | | Long itemTotal = rmClientAmountDayLastMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoClientAmountDay>> rsVo = new QueryResultVo<>(); |
| | | rsVo.pageSize = vo.pageSize; |
| | | rsVo.pageCurr = vo.pageCurr; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = rmClientAmountDayLastMapper.getClientAmountDayLast(params); |
| | | return rsVo; |
| | | } |
| | | } |
| | |
| | | |
| | | import java.util.Objects; |
| | | |
| | | //import com.dy.common.mw.protocol.p206V1_0_0.downVos.Com97Vo; |
| | | //import com.dy.common.mw.protocol.p206V1_0_0.downVos.ComXyVo; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-05-21 14:31 |
| | |
| | | Long intakeId = po.getIntakeId(); |
| | | Long operator = po.getOperator(); |
| | | Long comId = idLongGenerator.generate(); |
| | | |
| | | // 获取系统参数 |
| | | if(!setuped) { |
| | | setUp(); |
| | | } |
| | | |
| | | // 取水口ID换阀控器地址及通讯协议 |
| | | JSONObject job_rtu = getRtu(intakeId, null); |
| | |
| | | Long operator = po.getOperator(); |
| | | Long comId = idLongGenerator.generate(); |
| | | |
| | | // 获取系统参数 |
| | | if(!setuped) { |
| | | setUp(); |
| | | } |
| | | |
| | | // 取水口ID换阀控器地址及通讯协议 |
| | | JSONObject job_rtu = getRtu(intakeId, null); |
| | | if(job_rtu == null) { |
| | |
| | | Long intakeId = po.getIntakeId(); |
| | | Long operator = po.getOperator(); |
| | | Long comId = idLongGenerator.generate(); |
| | | |
| | | // 获取系统参数 |
| | | if(!setuped) { |
| | | setUp(); |
| | | } |
| | | |
| | | // 取水口ID换阀控器地址及通讯协议 |
| | | JSONObject job_rtu = getRtu(intakeId, null); |
| | |
| | | Long operator = po.getOperator(); |
| | | Long comId = idLongGenerator.generate(); |
| | | |
| | | // 获取系统参数 |
| | | if(!setuped) { |
| | | setUp(); |
| | | } |
| | | |
| | | // 取水口ID换阀控器地址及通讯协议 |
| | | JSONObject job_rtu = getRtu(intakeId, null); |
| | | if(job_rtu == null) { |
| | |
| | | Long intakeId = po.getIntakeId(); |
| | | Long operator = po.getOperator(); |
| | | Long comId = idLongGenerator.generate(); |
| | | |
| | | // 获取系统参数 |
| | | if(!setuped) { |
| | | setUp(); |
| | | } |
| | | |
| | | // 取水口ID换阀控器地址及通讯协议 |
| | | JSONObject job_rtu = getRtu(intakeId, null); |
| | |
| | | import com.dy.common.mw.protocol.p206V1_0_0.CodeV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.downVos.Com97Vo; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.downVos.Com98Vo; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.downVos.Com99Vo; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.downVos.ComA0Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.downVos.*; |
| | | import com.dy.common.mw.protocol.p206V202404.downVos.ComCd15Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.downVos.ComCd92_A2Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.downVos.ComCd93_A3Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.downVos.ComCd9CVo; |
| | | import com.dy.common.util.IDLongGenerator; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | |
| | | if(vcId == null) { |
| | | return BaseResponseUtils.buildErrorMsg(RemoteResultCode.PLEASE_SELECT_A_VC.getMessage()); |
| | | } |
| | | } |
| | | |
| | | // 获取系统参数 |
| | | if(!setuped) { |
| | | setUp(); |
| | | } |
| | | |
| | | // 虚拟卡ID换虚拟卡对象 |
| | |
| | | String orderNo = voUnclosedParam.getOrderNo(); |
| | | Long comId = idLongGenerator.generate(); |
| | | |
| | | // 获取系统参数 |
| | | if(!setuped) { |
| | | setUp(); |
| | | } |
| | | |
| | | // 阀控器地址换取水口ID和通讯协议 |
| | | JSONObject job_rtu = getRtu(null, rtuAddr); |
| | | if(job_rtu == null) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 定时关阀 |
| | | * @param automaticClose |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path = "timed_close", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> timedClose(@RequestBody @Valid AutomaticClose automaticClose, BindingResult bindingResult) { |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | Long intakeId = automaticClose.getIntakeId(); |
| | | String rtuAddr = automaticClose.getRtuAddr(); |
| | | String vcNum = automaticClose.getVcNum(); |
| | | String orderNo = automaticClose.getOrderNo(); |
| | | Integer minutes = automaticClose.getMinutes(); |
| | | Long operator = automaticClose.getOperator(); |
| | | |
| | | Long vcId = Optional.ofNullable(seVirtualCardMapper.getVcIdByNum(vcNum)).orElse(0L); |
| | | Long comId = idLongGenerator.generate(); |
| | | |
| | | // 虚拟卡ID换虚拟卡对象 |
| | | VoVirtualCard vc = commandSv.getVcById(vcId); |
| | | if (vc == null) { |
| | | return BaseResponseUtils.buildErrorMsg(RemoteResultCode.PLEASE_SELECT_A_VC.getMessage()); |
| | | } |
| | | Double moneyRemain = vc.getMoney(); |
| | | |
| | | // 获取水价 |
| | | Double waterPrice = commandSv.getPrice(); |
| | | |
| | | // 阀控器地址换取水口ID和通讯协议 |
| | | JSONObject job_rtu = getRtu(null, rtuAddr); |
| | | if(job_rtu == null) { |
| | | return BaseResponseUtils.buildErrorMsg(RemoteResultCode.RTU_NOT_EXIST.getMessage()); |
| | | } |
| | | String protocol = job_rtu.getString("protocol"); |
| | | String orgTag = job_rtu.getString("orgTag"); |
| | | comSendUrl = env.getProperty(pro_mw + "." + orgTag + "." + key_mw); |
| | | |
| | | String commandCode = null; |
| | | if(protocol.equals("p206V202404")) { |
| | | return BaseResponseUtils.buildSuccess(); |
| | | } else if(protocol.equals("p206V1_0_1")) { |
| | | // 获取功能码 |
| | | commandCode = CodeV1_0_1.cd_99; |
| | | |
| | | // 创建视图 |
| | | Com99Vo param = new Com99Vo(); |
| | | param.setIcCardNo(vcNum); |
| | | param.setMoneyRemain(moneyRemain); |
| | | param.setWaterPrice(waterPrice); |
| | | param.setMinutes(minutes); |
| | | param.setOrderNo(orderNo); |
| | | |
| | | /** |
| | | * 构造命令、发送命令并处理请求结果及执行结果 |
| | | * 1 准备参数 |
| | | * 2 调用公共方法 |
| | | */ |
| | | Param myParam = new Param(); |
| | | myParam.setComId(comId); |
| | | myParam.setComType((byte)2); |
| | | myParam.setCommandCode(commandCode); |
| | | myParam.setCommandName(CodeV202404.getCodeName(commandCode)); |
| | | myParam.setIntakeId(intakeId); |
| | | myParam.setRtuAddr(rtuAddr); |
| | | myParam.setProtocol(protocol); |
| | | myParam.setVcId(vcId); |
| | | myParam.setParam(param); |
| | | myParam.setRtuResultSendWebUrl(rtuCallbackUrl_rm); |
| | | myParam.setOperator(operator); |
| | | return dealWithCommandResult(myParam); |
| | | } else { |
| | | return BaseResponseUtils.buildErrorMsg("系统暂不支持该协议"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 定量关阀 |
| | | * @param automaticClose |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path = "quantify_close", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> quantifyClose(@RequestBody @Valid AutomaticClose automaticClose, BindingResult bindingResult) { |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | Long intakeId = automaticClose.getIntakeId(); |
| | | String rtuAddr = automaticClose.getRtuAddr(); |
| | | String vcNum = automaticClose.getVcNum(); |
| | | String orderNo = automaticClose.getOrderNo(); |
| | | Integer waterAmount = automaticClose.getWaterAmount(); |
| | | Long operator = automaticClose.getOperator(); |
| | | |
| | | Long vcId = Optional.ofNullable(seVirtualCardMapper.getVcIdByNum(vcNum)).orElse(0L); |
| | | Long comId = idLongGenerator.generate(); |
| | | |
| | | // 虚拟卡ID换虚拟卡对象 |
| | | VoVirtualCard vc = commandSv.getVcById(vcId); |
| | | if (vc == null) { |
| | | return BaseResponseUtils.buildErrorMsg(RemoteResultCode.PLEASE_SELECT_A_VC.getMessage()); |
| | | } |
| | | Double moneyRemain = vc.getMoney(); |
| | | |
| | | // 获取水价 |
| | | Double waterPrice = commandSv.getPrice(); |
| | | |
| | | // 阀控器地址换取水口ID和通讯协议 |
| | | JSONObject job_rtu = getRtu(null, rtuAddr); |
| | | if(job_rtu == null) { |
| | | return BaseResponseUtils.buildErrorMsg(RemoteResultCode.RTU_NOT_EXIST.getMessage()); |
| | | } |
| | | String protocol = job_rtu.getString("protocol"); |
| | | String orgTag = job_rtu.getString("orgTag"); |
| | | comSendUrl = env.getProperty(pro_mw + "." + orgTag + "." + key_mw); |
| | | |
| | | String commandCode = null; |
| | | if(protocol.equals("p206V202404")) { |
| | | return BaseResponseUtils.buildSuccess(); |
| | | } else if(protocol.equals("p206V1_0_1")) { |
| | | // 获取功能码 |
| | | commandCode = CodeV1_0_1.cd_A0; |
| | | |
| | | // 创建视图 |
| | | ComA0Vo param = new ComA0Vo(); |
| | | param.setIcCardNo(vcNum); |
| | | param.setMoneyRemain(moneyRemain); |
| | | param.setWaterPrice(waterPrice); |
| | | param.setWaterAmount(waterAmount); |
| | | param.setOrderNo(orderNo); |
| | | |
| | | /** |
| | | * 构造命令、发送命令并处理请求结果及执行结果 |
| | | * 1 准备参数 |
| | | * 2 调用公共方法 |
| | | */ |
| | | Param myParam = new Param(); |
| | | myParam.setComId(comId); |
| | | myParam.setComType((byte)2); |
| | | myParam.setCommandCode(commandCode); |
| | | myParam.setCommandName(CodeV202404.getCodeName(commandCode)); |
| | | myParam.setIntakeId(intakeId); |
| | | myParam.setRtuAddr(rtuAddr); |
| | | myParam.setProtocol(protocol); |
| | | myParam.setVcId(vcId); |
| | | myParam.setParam(param); |
| | | myParam.setRtuResultSendWebUrl(rtuCallbackUrl_rm); |
| | | myParam.setOperator(operator); |
| | | return dealWithCommandResult(myParam); |
| | | } else { |
| | | return BaseResponseUtils.buildErrorMsg("系统暂不支持该协议"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据操作员ID获取未关阀记录 |
| | | * @param operator |
| | | * @return |
| | |
| | | Long operator = po.getOperator(); |
| | | String flowNo = RandomStringUtils.randomNumeric(12); // 生成12位随机数 |
| | | Long comId = idLongGenerator.generate(); |
| | | |
| | | // 获取系统参数 |
| | | if(!setuped) { |
| | | setUp(); |
| | | } |
| | | |
| | | // 取水口ID换阀控器地址及通讯协议 |
| | | JSONObject job_rtu = getRtu(intakeId, null); |
| | |
| | | Long operator = card.getOperator(); |
| | | Long comId = idLongGenerator.generate(); |
| | | |
| | | // 获取系统参数 |
| | | if(!setuped) { |
| | | setUp(); |
| | | } |
| | | |
| | | // 取水口ID换阀控器地址及通讯协议 |
| | | JSONObject job_rtu = getRtu(intakeId, null); |
| | | if(job_rtu == null) { |
| | |
| | | // Boolean valid = usability.getValid(); |
| | | // Long operator = usability.getOperator(); |
| | | // Long comId = idLongGenerator.generate(); |
| | | // |
| | | // // 获取系统参数 |
| | | // if(!setuped) { |
| | | // setUp(); |
| | | // } |
| | | // |
| | | // // 取水口ID换阀控器地址及通讯协议 |
| | | // JSONObject job_rtu = getRtu(intakeId, null); |
| | |
| | | package com.dy.pipIrrWechat.command; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.Data; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrGlobal.command.ComSupport; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.MediaType; |
| | |
| | | @RequestMapping(path="comRes") |
| | | public class CommandResultCtrl extends ComSupport { |
| | | @PostMapping(path = "receive", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | public BaseResponse<String> receive(@RequestBody Data data) { |
| | | Long comId = 0L; |
| | | if(data.getCommandId() != null) { |
| | | comId = Long.parseLong(data.getCommandId()); |
| | | } |
| | | public void receive(@RequestBody Data data) { |
| | | JSONObject job_data = (JSONObject) JSON.toJSON(data); |
| | | String job_dataS = job_data.toJSONString(); |
| | | JSONObject job_subData = job_data.getJSONObject("subData").getJSONObject("subData"); |
| | | |
| | | CompletableFuture<Data> feature = (CompletableFuture<Data>) features.get(comId); |
| | | JSONObject job_response = new JSONObject(); |
| | | job_response.put("data", job_subData); |
| | | job_response.put("commandCode", job_data.getString("code")); |
| | | job_response.put("commandId", job_data.getString("commandId")); |
| | | |
| | | CompletableFuture<JSONObject> feature = (CompletableFuture<JSONObject>) features.get(job_data.getLong("commandId")); |
| | | if(feature != null) { |
| | | feature.complete(data); |
| | | feature.complete(job_response); |
| | | }else{ |
| | | feature.complete(new JSONObject()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess("ok"); |
| | | } |
| | | } |
| | |
| | | package com.dy.pipIrrWechat.command; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.CodeV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.downVos.Com97Vo; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.downVos.Com98Vo; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.downVos.Com99Vo; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.downVos.ComA0Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.downVos.ComCd15Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.downVos.ComCd92_A2Vo; |
| | |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrGlobal.voRm.VoUnclosedValve; |
| | | import com.dy.pipIrrGlobal.voSe.VoVirtualCard; |
| | | import com.dy.pipIrrWechat.command.dto.AutomaticClose; |
| | | import com.dy.pipIrrWechat.command.dto.Recharge; |
| | | import com.dy.pipIrrWechat.command.dto.ValveClose; |
| | | import com.dy.pipIrrWechat.command.dto.ValveOpen; |
| | |
| | | if (vcId == null) { |
| | | return BaseResponseUtils.buildErrorMsg(WechatResultCode.PLEASE_SELECT_A_VC.getMessage()); |
| | | } |
| | | } |
| | | |
| | | // 获取系统参数 |
| | | if (!setuped) { |
| | | setUp(); |
| | | } |
| | | |
| | | // 虚拟卡ID换虚拟卡对象 |
| | |
| | | Long operator = valve.getOperator(); |
| | | Long comId = idLongGenerator.generate(); |
| | | |
| | | // 获取系统参数 |
| | | if (!setuped) { |
| | | setUp(); |
| | | } |
| | | |
| | | // 阀控器地址换取水口ID和通讯协议 |
| | | JSONObject job_rtu = getRtu(null, rtuAddr); |
| | | if (job_rtu == null) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 定时关阀 |
| | | * @param automaticClose |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path = "timed_close", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> timedClose(@RequestBody @Valid AutomaticClose automaticClose, BindingResult bindingResult) { |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | Long intakeId = automaticClose.getIntakeId(); |
| | | String rtuAddr = automaticClose.getRtuAddr(); |
| | | String vcNum = automaticClose.getVcNum(); |
| | | String orderNo = automaticClose.getOrderNo(); |
| | | Integer minutes = automaticClose.getMinutes(); |
| | | Long operator = automaticClose.getOperator(); |
| | | |
| | | Long vcId = Optional.ofNullable(seVirtualCardMapper.getVcIdByNum(vcNum)).orElse(0L); |
| | | Long comId = idLongGenerator.generate(); |
| | | |
| | | // 虚拟卡ID换虚拟卡对象 |
| | | VoVirtualCard vc = commandSv.getVcById(vcId); |
| | | if (vc == null) { |
| | | return BaseResponseUtils.buildErrorMsg(WechatResultCode.PLEASE_SELECT_A_VC.getMessage()); |
| | | } |
| | | Double moneyRemain = vc.getMoney(); |
| | | |
| | | // 获取水价 |
| | | Double waterPrice = commandSv.getPrice(); |
| | | |
| | | // 阀控器地址换取水口ID和通讯协议 |
| | | JSONObject job_rtu = getRtu(null, rtuAddr); |
| | | if(job_rtu == null) { |
| | | return BaseResponseUtils.buildErrorMsg(WechatResultCode.RTU_NOT_EXIST.getMessage()); |
| | | } |
| | | String protocol = job_rtu.getString("protocol"); |
| | | String orgTag = job_rtu.getString("orgTag"); |
| | | comSendUrl = env.getProperty(pro_mw + "." + orgTag + "." + key_mw); |
| | | |
| | | String commandCode = null; |
| | | if(protocol.equals("p206V202404")) { |
| | | return BaseResponseUtils.buildSuccess(); |
| | | } else if(protocol.equals("p206V1_0_1")) { |
| | | // 获取功能码 |
| | | commandCode = CodeV1_0_1.cd_99; |
| | | |
| | | // 创建视图 |
| | | Com99Vo param = new Com99Vo(); |
| | | param.setIcCardNo(vcNum); |
| | | param.setMoneyRemain(moneyRemain); |
| | | param.setWaterPrice(waterPrice); |
| | | param.setMinutes(minutes); |
| | | param.setOrderNo(orderNo); |
| | | |
| | | /** |
| | | * 构造命令、发送命令并处理请求结果及执行结果 |
| | | * 1 准备参数 |
| | | * 2 调用公共方法 |
| | | */ |
| | | Param myParam = new Param(); |
| | | myParam.setComId(comId); |
| | | myParam.setComType((byte)2); |
| | | myParam.setCommandCode(commandCode); |
| | | myParam.setCommandName(CodeV202404.getCodeName(commandCode)); |
| | | myParam.setIntakeId(intakeId); |
| | | myParam.setRtuAddr(rtuAddr); |
| | | myParam.setProtocol(protocol); |
| | | myParam.setVcId(vcId); |
| | | myParam.setParam(param); |
| | | myParam.setRtuResultSendWebUrl(rtuCallbackUrl_wx); |
| | | myParam.setOperator(operator); |
| | | return dealWithCommandResult(myParam); |
| | | } else { |
| | | return BaseResponseUtils.buildErrorMsg("系统暂不支持该协议"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 定量关阀 |
| | | * @param automaticClose |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path = "quantify_close", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> quantifyClose(@RequestBody @Valid AutomaticClose automaticClose, BindingResult bindingResult) { |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | Long intakeId = automaticClose.getIntakeId(); |
| | | String rtuAddr = automaticClose.getRtuAddr(); |
| | | String vcNum = automaticClose.getVcNum(); |
| | | String orderNo = automaticClose.getOrderNo(); |
| | | Integer waterAmount = automaticClose.getWaterAmount(); |
| | | Long operator = automaticClose.getOperator(); |
| | | |
| | | Long vcId = Optional.ofNullable(seVirtualCardMapper.getVcIdByNum(vcNum)).orElse(0L); |
| | | Long comId = idLongGenerator.generate(); |
| | | |
| | | // 虚拟卡ID换虚拟卡对象 |
| | | VoVirtualCard vc = commandSv.getVcById(vcId); |
| | | if (vc == null) { |
| | | return BaseResponseUtils.buildErrorMsg(WechatResultCode.PLEASE_SELECT_A_VC.getMessage()); |
| | | } |
| | | Double moneyRemain = vc.getMoney(); |
| | | |
| | | // 获取水价 |
| | | Double waterPrice = commandSv.getPrice(); |
| | | |
| | | // 阀控器地址换取水口ID和通讯协议 |
| | | JSONObject job_rtu = getRtu(null, rtuAddr); |
| | | if(job_rtu == null) { |
| | | return BaseResponseUtils.buildErrorMsg(WechatResultCode.RTU_NOT_EXIST.getMessage()); |
| | | } |
| | | String protocol = job_rtu.getString("protocol"); |
| | | String orgTag = job_rtu.getString("orgTag"); |
| | | comSendUrl = env.getProperty(pro_mw + "." + orgTag + "." + key_mw); |
| | | |
| | | String commandCode = null; |
| | | if(protocol.equals("p206V202404")) { |
| | | return BaseResponseUtils.buildSuccess(); |
| | | } else if(protocol.equals("p206V1_0_1")) { |
| | | // 获取功能码 |
| | | commandCode = CodeV1_0_1.cd_A0; |
| | | |
| | | // 创建视图 |
| | | ComA0Vo param = new ComA0Vo(); |
| | | param.setIcCardNo(vcNum); |
| | | param.setMoneyRemain(moneyRemain); |
| | | param.setWaterPrice(waterPrice); |
| | | param.setWaterAmount(waterAmount); |
| | | param.setOrderNo(orderNo); |
| | | |
| | | /** |
| | | * 构造命令、发送命令并处理请求结果及执行结果 |
| | | * 1 准备参数 |
| | | * 2 调用公共方法 |
| | | */ |
| | | Param myParam = new Param(); |
| | | myParam.setComId(comId); |
| | | myParam.setComType((byte)2); |
| | | myParam.setCommandCode(commandCode); |
| | | myParam.setCommandName(CodeV202404.getCodeName(commandCode)); |
| | | myParam.setIntakeId(intakeId); |
| | | myParam.setRtuAddr(rtuAddr); |
| | | myParam.setProtocol(protocol); |
| | | myParam.setVcId(vcId); |
| | | myParam.setParam(param); |
| | | myParam.setRtuResultSendWebUrl(rtuCallbackUrl_wx); |
| | | myParam.setOperator(operator); |
| | | return dealWithCommandResult(myParam); |
| | | } else { |
| | | return BaseResponseUtils.buildErrorMsg("系统暂不支持该协议"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据操作员ID获取未关阀记录 |
| | | * |
| | | * @param operator |
| | |
| | | Long operator = po.getOperator(); |
| | | String flowNo = RandomStringUtils.randomNumeric(12); // 生成12位随机数 |
| | | Long comId = idLongGenerator.generate(); |
| | | |
| | | // 获取系统参数 |
| | | if(!setuped) { |
| | | setUp(); |
| | | } |
| | | |
| | | // 取水口ID换阀控器地址及通讯协议 |
| | | JSONObject job_rtu = getRtu(intakeId, null); |
New file |
| | |
| | | package com.dy.pipIrrWechat.command.dto; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-07-23 10:55 |
| | | * @LastEditTime 2024-07-23 10:55 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | public class AutomaticClose extends DtoBase { |
| | | public static final long serialVersionUID = 202407231056001L; |
| | | |
| | | /** |
| | | * 阀控器地址 |
| | | */ |
| | | @NotBlank(message = "阀控器地址不能为空") |
| | | private String rtuAddr; |
| | | |
| | | /** |
| | | * 虚拟卡编号 |
| | | */ |
| | | @NotBlank(message = "虚拟卡编号不能为空") |
| | | private String vcNum; |
| | | |
| | | /** |
| | | * 订单号 |
| | | */ |
| | | @NotBlank(message = "订单号不能为空") |
| | | private String orderNo; |
| | | |
| | | /** |
| | | * 用水时长,拥有定时关阀 |
| | | */ |
| | | private Integer minutes; |
| | | |
| | | /** |
| | | * 预用水量,拥有定量关阀 |
| | | */ |
| | | private Integer waterAmount; |
| | | } |