Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
| | |
| | | |
| | | 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); |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voRm; |
| | | |
| | | 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 { |
| | | |
| | | 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; |
| | | } |
| | |
| | | </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 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 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> |
New file |
| | |
| | | package com.dy.pipIrrRemote.controllerAlarmState; |
| | | |
| | | 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.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 = "controllerAlarmState") |
| | | public class ControllerAlarmStateCtrl { |
| | | @Autowired |
| | | private ControllerAlarmStateSv controllerAlarmStateSv; |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件获取控制器报警与状态列表(历史) |
| | | * |
| | | * @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 QueryVo vo) { |
| | | try { |
| | | QueryResultVo<List<VoControllerAlarmState>> res = controllerAlarmStateSv.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 QueryVo vo) { |
| | | try { |
| | | QueryResultVo<List<VoControllerAlarmState>> res = controllerAlarmStateSv.getControllerAlarmStateLast(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取控制器记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.controllerAlarmState; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoRm.RmAlarmStateHistoryMapper; |
| | | import com.dy.pipIrrGlobal.daoRm.RmAlarmStateLastMapper; |
| | | 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 ControllerAlarmStateSv { |
| | | @Autowired |
| | | private RmAlarmStateHistoryMapper rmAlarmStateHistoryMapper; |
| | | @Autowired |
| | | private RmAlarmStateLastMapper rmAlarmStateLastMapper; |
| | | |
| | | /** |
| | | * 获得一页控制器报警与状态记录(历史) |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoControllerAlarmState>> getControllerAlarmStateHistory(QueryVo 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(QueryVo 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; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.controllerAlarmState; |
| | | |
| | | 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 QueryVo 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; |
| | | } |