pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.java
@@ -178,8 +178,8 @@ * 10:开关阀卡关阀; * 11:开关阀卡刷卡卡开阀; * 12:黑名单命令关阀; * 13:用户远程定时关阀; * 14:用户远程定量关阀; * 13:远程定时关阀; * 14:远程定量关阀; * ) * @param type 字节 * @return 名称 @@ -198,8 +198,8 @@ case 10 -> "开关阀卡关阀"; case 11 -> "开关阀卡开阀"; case 12 -> "黑名单命令关阀"; case 13 -> "用户远程定时关阀"; case 14 -> "用户远程定量关阀"; case 13 -> "远程定时关阀"; case 14 -> "远程定量关阀"; default -> "未知"; }; } pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOpenCloseValveHistoryMapper.java
@@ -3,6 +3,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoRm.RmOpenCloseValveHistory; import com.dy.pipIrrGlobal.voRm.VoOpenCloseValve; import com.dy.pipIrrGlobal.voSt.VoIntake; import com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount; import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -76,4 +78,47 @@ * @return */ List<VoOpenCloseValve> getOpenCloseValveReports_history(Map<?, ?> params); /** * 获取指定时间段内从未开过阀的取水口数量 * @param params * @return */ Long getNeverOpenValveIntakesCount(Map<?, ?> params); /** * 获取指定时间段内从未开过阀的取水口 * @param params * @return */ List<VoIntake> getNeverOpenValveIntakes(Map<?, ?> params); /** * 获取指定时间段内开阀次数超过指定值的取水口数量 * @param params * @return */ Long getOpenValveGtIntakesCount(Map<String, Object> params); /** * 获取指定时间段内开阀次数超过指定值的取水口 * @param params * @return */ List<VoIntakeOpenCount> getOpenValveGtIntakes(Map<String, Object> params); /** * 获取指定时间段内开阀次数低于指定值的取水口数量 * @param params * @return */ Long getOpenValveLtIntakesCount(Map<String, Object> params); /** * 获取指定时间段内开阀次数低于指定值的取水口 * @param params * @return */ List<VoIntakeOpenCount> getOpenValveLtIntakes(Map<String, Object> params); } pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoIntakeOpenCount.java
New file @@ -0,0 +1,21 @@ package com.dy.pipIrrGlobal.voSt; import com.alibaba.fastjson2.annotation.JSONField; import com.alibaba.fastjson2.writer.ObjectWriterImplToString; import lombok.Data; /** * @author :WuZeYu * @Date :2024/8/5 10:45 * @LastEditTime :2024/8/5 10:45 * @Description 取水口开阀 指定值 次数 */ @Data public class VoIntakeOpenCount extends VoIntake{ private static final long serialVersionUID = 202408051046001L; /** * 指定值 */ private Long recordCount; } pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml
@@ -435,6 +435,30 @@ where id = #{id,jdbcType=BIGINT} </update> <!--根据指定条件获取开关阀报历史记录数量--> <select id="getOpenCloseValveReportsCount_history" resultType="java.lang.Long"> SELECT COUNT(*) AS recordCount FROM rm_open_close_valve_history oh INNER JOIN pr_intake inta ON inta.id = oh.intake_id <where> <if test="intakeId != null and intakeId >0"> AND oh.intake_id = #{intakeId} </if> <if test = "intakeNum != null and intakeNum !=''"> AND inta.name LIKE CONCAT('%',#{intakeNum},'%') </if> <if test = "rtuAddr != null and rtuAddr !=''"> AND oh.rtu_addr LIKE CONCAT('%',#{rtuAddr},'%') </if> <if test = "timeStart_open != null and timeStart_open != '' and timeStop_open != null and timeStop_open != '' "> AND oh.op_dt BETWEEN #{timeStart_open} AND #{timeStop_open} </if> <if test = "timeStart_close != null and timeStart_close != '' and timeStop_close != null and timeStop_close != '' "> AND oh.cl_dt BETWEEN #{timeStart_close} AND #{timeStop_close} </if> </where> </select> <!--根据指定条件获取开关阀报历史记录数量--> <select id="getOpenCloseValveReportsCount_history" resultType="java.lang.Long"> SELECT COUNT(*) AS recordCount @@ -528,4 +552,170 @@ </if> </trim> </select> <!--根据指定条件获取开关阀报历史记录--> <select id="getOpenCloseValveReports_history" resultType="com.dy.pipIrrGlobal.voRm.VoOpenCloseValve"> SELECT oh.intake_id AS intakeId, inta.name AS intakenum, oh.rtu_addr AS rtuAddr, oh.client_name AS clientName, oh.op_ic_card_no AS openIcNum, oh.op_ic_card_addr AS openIcAddr, oh.op_dt AS openTime, CASE WHEN oh.op_type = 1 THEN "刷卡开阀" WHEN oh.op_type = 3 THEN "中心站开阀" WHEN oh.op_type = 5 THEN "欠费关阀" WHEN oh.op_type = 8 THEN "用户远程开阀" WHEN oh.op_type = 11 THEN "开关阀卡开阀" ELSE "未知" END AS openType, oh.op_order_no AS openOrderNo, oh.op_total_amount AS openTotalAmount, oh.op_remain_money AS openRemainMoney, oh.op_water_remain_user AS openWaterRemain, oh.op_ele_total_amount AS openEleTotalAmount, oh.cl_ic_card_no AS closeIcNum, oh.cl_ic_card_addr AS closeIcAddr, oh.cl_dt AS closeTime, CASE WHEN oh.cl_type = 2 THEN "刷卡关阀" WHEN oh.cl_type = 4 THEN "中心站关阀" WHEN oh.cl_type = 5 THEN "欠费关阀" WHEN oh.cl_type = 6 THEN "流量计故障关阀" WHEN oh.cl_type = 7 THEN "紧急关闭" WHEN oh.cl_type = 9 THEN "用户远程关阀" WHEN oh.cl_type = 10 THEN "开关阀卡关阀" WHEN oh.cl_type = 12 THEN "黑名单命令关阀" WHEN oh.cl_type = 13 THEN "用户远程定时关阀" WHEN oh.cl_type = 14 THEN "用户远程定量关阀" ELSE "未知" END AS closeType, oh.cl_this_amount AS closeThisAmount, oh.cl_this_time AS thisTime, oh.cl_this_money AS thisMoney, oh.cl_remain_money AS closeRemainMoney, oh.cl_total_amount AS closeTotalAmount FROM rm_open_close_valve_history oh INNER JOIN pr_intake inta ON inta.id = oh.intake_id <where> <if test="intakeId != null and intakeId >0"> AND oh.intake_id = #{intakeId} </if> <if test = "intakeNum != null and intakeNum !=''"> AND inta.name LIKE CONCAT('%',#{intakeNum},'%') </if> <if test = "rtuAddr != null and rtuAddr !=''"> AND oh.rtu_addr LIKE CONCAT('%',#{rtuAddr},'%') </if> <if test = "timeStart_open != null and timeStart_open != '' and timeStop_open != null and timeStop_open != '' "> AND oh.op_dt BETWEEN #{timeStart_open} AND #{timeStop_open} </if> <if test = "timeStart_close != null and timeStart_close != '' and timeStop_close != null and timeStop_close != '' "> AND oh.cl_dt BETWEEN #{timeStart_close} AND #{timeStop_close} </if> </where> ORDER BY oh.op_dt DESC <trim prefix="limit " > <if test="start != null and count != null"> #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} </if> </trim> </select> <!--获取指定时间段内从未开过阀的取水口数量--> <select id="getNeverOpenValveIntakesCount" resultType="java.lang.Long"> SELECT COUNT(*) AS recordCount FROM pr_intake inta INNER JOIN ba_block blo ON blo.id = inta.blockId WHERE inta.deleted = 0 AND NOT EXISTS(SELECT * FROM rm_open_close_valve_history WHERE op_dt BETWEEN #{timeStart} AND #{timeStop} AND intake_id = inta.id) </select> <!--获取指定时间段内从未开过阀的取水口--> <select id="getNeverOpenValveIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntake"> SELECT inta.id AS intakeId, inta.name AS intakeNum, blo.name AS blockName FROM pr_intake inta INNER JOIN ba_block blo ON blo.id = inta.blockId WHERE inta.deleted = 0 AND NOT EXISTS(SELECT * FROM rm_open_close_valve_history WHERE op_dt BETWEEN #{timeStart} AND #{timeStop} AND intake_id = inta.id) ORDER BY inta.id <trim prefix="limit " > <if test="start != null and count != null"> #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} </if> </trim> </select> <!--获取指定时间段内开阀次数超过指定值的取水口数量--> <select id="getOpenValveGtIntakesCount" resultType="java.lang.Long"> select count(*) from (SELECT COUNT(*) AS recordCount, inta.id AS intakeId, inta.name AS intakeNum, blo.name AS blockName FROM pr_intake inta LEFT JOIN (SELECT * FROM rm_open_close_valve_history WHERE op_dt BETWEEN #{timeStart} AND #{timeStop}) his ON his.intake_id = inta.id INNER JOIN ba_block blo ON blo.id = inta.blockId WHERE inta.deleted = 0 GROUP BY intakeId,intakeNum,blockName HAVING recordCount > #{value}) a </select> <!--获取指定时间段内开阀次数超过指定值的取水口--> <select id="getOpenValveGtIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount"> SELECT COUNT(*) AS recordCount, inta.id AS intakeId, inta.name AS intakeNum, blo.name AS blockName FROM pr_intake inta LEFT JOIN (SELECT * FROM rm_open_close_valve_history WHERE op_dt BETWEEN #{timeStart} AND #{timeStop}) his ON his.intake_id = inta.id INNER JOIN ba_block blo ON blo.id = inta.blockId WHERE inta.deleted = 0 GROUP BY intakeId,intakeNum,blockName HAVING recordCount > #{value} ORDER BY inta.id <trim prefix="limit " > <if test="start != null and count != null"> #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} </if> </trim> </select> <!--获取指定时间段内开阀次数低于指定值的取水口数量--> <select id="getOpenValveLtIntakesCount" resultType="java.lang.Long"> select count(*) from (SELECT COUNT(*) AS recordCount, inta.id AS intakeId, inta.name AS intakeNum, blo.name AS blockName FROM pr_intake inta LEFT JOIN (SELECT * FROM rm_open_close_valve_history WHERE op_dt BETWEEN #{timeStart} AND #{timeStop}) his ON his.intake_id = inta.id INNER JOIN ba_block blo ON blo.id = inta.blockId WHERE inta.deleted = 0 GROUP BY intakeId,intakeNum,blockName HAVING recordCount < #{value}) a </select> <!--获取指定时间段内开阀次数低于指定值的取水口--> <select id="getOpenValveLtIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount"> SELECT COUNT(*) AS recordCount, inta.id AS intakeId, inta.name AS intakeNum, blo.name AS blockName FROM pr_intake inta LEFT JOIN (SELECT * FROM rm_open_close_valve_history WHERE op_dt BETWEEN #{timeStart} AND #{timeStop}) his ON his.intake_id = inta.id INNER JOIN ba_block blo ON blo.id = inta.blockId WHERE inta.deleted = 0 GROUP BY intakeId,intakeNum,blockName HAVING recordCount < #{value} ORDER BY inta.id <trim prefix="limit " > <if test="start != null and count != null"> #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} </if> </trim> </select> </mapper> pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveLastMapper.xml
@@ -454,30 +454,101 @@ where id = #{id,jdbcType=BIGINT} </update> <!--根据指定条件获取开关阀报最新记录数量--> <select id="getOpenCloseValveReportsCount_last" resultType="java.lang.Long"> SELECT COUNT(*) AS recordCount FROM rm_open_close_valve_last oh INNER JOIN pr_intake inta ON inta.id = oh.intake_id <where> <if test="intakeId != null and intakeId > 0"> AND oh.intake_id = #{intakeId} </if> <if test="intakeNum != null and intakeNum != ''"> AND inta.name LIKE CONCAT('%', #{intakeNum}, '%') </if> <if test="rtuAddr != null and rtuAddr != ''"> AND oh.rtu_addr LIKE CONCAT('%', #{rtuAddr}, '%') </if> <if test="timeStart_open != null and timeStop_open != null"> AND oh.op_dt BETWEEN #{timeStart_open} AND #{timeStop_open} </if> <if test="timeStart_close != null and timeStop_close != null"> AND oh.cl_dt BETWEEN #{timeStart_close} AND #{timeStop_close} </if> </where> </select> <!--根据指定条件获取开关阀报最新记录数量--> <select id="getOpenCloseValveReportsCount_last" resultType="java.lang.Long"> SELECT COUNT(*) AS recordCount FROM rm_open_close_valve_last oh INNER JOIN pr_intake inta ON inta.id = oh.intake_id <where> <if test="intakeId != null and intakeId >0"> AND oh.intake_id = #{intakeId} </if> <if test = "intakeNum != null and intakeNum !=''"> AND inta.name LIKE CONCAT('%',#{intakeNum},'%') </if> <if test = "rtuAddr != null and rtuAddr !=''"> AND oh.rtu_addr LIKE CONCAT('%',#{rtuAddr},'%') </if> <if test = "timeStart_open != null and timeStart_open != '' and timeStop_open != null and timeStop_open != '' "> AND oh.op_dt BETWEEN #{timeStart_open} AND #{timeStop_open} </if> <if test = "timeStart_close != null and timeStart_close != '' and timeStop_close != null and timeStop_close != '' "> AND oh.cl_dt BETWEEN #{timeStart_close} AND #{timeStop_close} </if> </where> </select> <!--根据指定条件获取开关阀报最新记录--> <select id="getOpenCloseValveReports_last" resultType="com.dy.pipIrrGlobal.voRm.VoOpenCloseValve"> SELECT oh.intake_id AS intakeId, inta.name AS intakeNum, oh.rtu_addr AS rtuAddr, oh.client_name AS clientName, oh.op_ic_card_no AS openIcNum, oh.op_ic_card_addr AS openIcAddr, oh.op_dt AS openTime, CASE WHEN oh.op_type = 1 THEN "刷卡开阀" WHEN oh.op_type = 3 THEN "中心站开阀" WHEN oh.op_type = 5 THEN "欠费关阀" WHEN oh.op_type = 8 THEN "用户远程开阀" WHEN oh.op_type = 11 THEN "开关阀卡开阀" ELSE "未知" END AS openType, oh.op_order_no AS openOrderNo, oh.op_total_amount AS openTotalAmount, oh.op_remain_money AS openRemainMoney, oh.op_water_remain_user AS openWaterRemain, oh.op_ele_total_amount AS openEleTotalAmount, oh.cl_ic_card_no AS closeIcNum, oh.cl_ic_card_addr AS closeIcAddr, oh.cl_dt AS closeTime, CASE WHEN oh.cl_type = 2 THEN "刷卡关阀" WHEN oh.cl_type = 4 THEN "中心站关阀" WHEN oh.cl_type = 5 THEN "欠费关阀" WHEN oh.cl_type = 6 THEN "流量计故障关阀" WHEN oh.cl_type = 7 THEN "紧急关闭" WHEN oh.cl_type = 9 THEN "用户远程关阀" WHEN oh.cl_type = 10 THEN "开关阀卡关阀" WHEN oh.cl_type = 12 THEN "黑名单命令关阀" WHEN oh.cl_type = 13 THEN "用户远程定时关阀" WHEN oh.cl_type = 14 THEN "用户远程定量关阀" ELSE "未知" END AS closeType, oh.cl_this_amount AS closeThisAmount, oh.cl_this_time AS thisTime, oh.cl_this_money AS thisMoney, oh.cl_remain_money AS closeRemainMoney, oh.cl_total_amount AS closeTotalAmount FROM rm_open_close_valve_last oh INNER JOIN pr_intake inta ON inta.id = oh.intake_id <where> <if test="intakeId != null and intakeId >0"> AND oh.intake_id = #{intakeId} </if> <if test = "intakeNum != null and intakeNum !=''"> AND inta.name LIKE CONCAT('%',#{intakeNum},'%') </if> <if test = "rtuAddr != null and rtuAddr !=''"> AND oh.rtu_addr LIKE CONCAT('%',#{rtuAddr},'%') </if> <if test = "timeStart_open != null and timeStart_open != '' and timeStop_open != null and timeStop_open != '' "> AND oh.op_dt BETWEEN #{timeStart_open} AND #{timeStop_open} </if> <if test = "timeStart_close != null and timeStart_close != '' and timeStop_close != null and timeStop_close != '' "> AND oh.cl_dt BETWEEN #{timeStart_close} AND #{timeStop_close} </if> </where> ORDER BY oh.op_dt DESC <trim prefix="limit " > <if test="start != null and count != null"> #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} </if> </trim> </select> <!--根据指定条件获取开关阀报最新记录--> <select id="getOpenCloseValveReports_last" resultType="com.dy.pipIrrGlobal.voRm.VoOpenCloseValve"> SELECT oh.intake_id AS intakeId, pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/report/ReportSv.java
@@ -13,6 +13,8 @@ import org.apache.dubbo.common.utils.PojoUtils; import org.springframework.stereotype.Service; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; import java.util.Map; @@ -109,25 +111,35 @@ public QueryResultVo<List<VoOpenCloseValve>> getOpenCloseValveReports_history(OpenCloseValveQO qo) { String timeStart_open = qo.getTimeStart_open(); String timeStop_open = qo.getTimeStop_open(); if(timeStart_open != null) { if(timeStart_open != null && timeStart_open != "") { timeStart_open = timeStart_open + " 00:00:00"; qo.setTimeStop_open(timeStart_open); } else { timeStart_open = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); } if(timeStop_open != null) { qo.setTimeStop_open(timeStart_open); if(timeStop_open != null && timeStop_open != "") { timeStop_open = timeStop_open + " 23:59:59"; qo.setTimeStop_open(timeStop_open); }else { timeStop_open = LocalDate.now() + " 23:59:59"; } qo.setTimeStop_open(timeStop_open); String timeStart_close = qo.getTimeStart_close(); String timeStop_close = qo.getTimeStop_close(); if(timeStart_close != null) { if(timeStart_close != null && timeStart_close != "") { timeStart_close = timeStart_close + " 00:00:00"; qo.setTimeStart_close(timeStart_close); } else { timeStart_close = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); } if(timeStop_close != null) { qo.setTimeStart_close(timeStart_close); if(timeStop_close != null && timeStop_close != "") { timeStop_close = timeStop_close + " 23:59:59"; qo.setTimeStop_close(timeStop_close); }else { timeStop_close = LocalDate.now() + " 23:59:59"; } qo.setTimeStop_close(timeStop_close); Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); Long itemTotal = rmOpenCloseValveHistoryMapper.getOpenCloseValveReportsCount_history(params); pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java
@@ -2,10 +2,21 @@ import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoRm.RmOnHourReportHistoryMapper; import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveHistoryMapper; import com.dy.pipIrrGlobal.daoRm.RmOnHourReportLastMapper; import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveLastMapper; import com.dy.pipIrrGlobal.voSt.*; import com.dy.pipIrrStatistics.intake.qo.*; import com.dy.pipIrrGlobal.voSt.VoBatteryVolt; import com.dy.pipIrrGlobal.voSt.VoCumulativeFlow; import com.dy.pipIrrGlobal.voSt.VoIntake; import com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount; import com.dy.pipIrrGlobal.voSt.VoSignalIntensity; import com.dy.pipIrrStatistics.intake.qo.BatteryVoltQO; import com.dy.pipIrrStatistics.intake.qo.CumulativeFlowQO; import com.dy.pipIrrStatistics.intake.qo.IntakeQO; import com.dy.pipIrrStatistics.intake.qo.IntakeValueQO; import com.dy.pipIrrStatistics.intake.qo.SignalIntensityQO; import lombok.extern.slf4j.Slf4j; import org.apache.dubbo.common.utils.PojoUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -30,6 +41,8 @@ public class IntakeSv { @Autowired private RmOnHourReportHistoryMapper rmOnHourReportHistoryMapper; @Autowired private RmOpenCloseValveHistoryMapper rmOpenCloseValveHistoryMapper; @Autowired private RmOnHourReportLastMapper rmOnHourReportLastMapper; @@ -177,6 +190,119 @@ } /** * 获取从未开过阀的取水口 * @return */ public QueryResultVo<List<VoIntake>> getNeverOpenValveIntakes(IntakeQO qo) { String timeStart = qo.getTimeStart(); String timeStop = qo.getTimeStop(); if(timeStart != null) { timeStart = timeStart + " 00:00:00"; }else { timeStart = LocalDate.now() + " 00:00:00"; } qo.setTimeStart(timeStart); if(timeStop != null) { timeStop = timeStop + " 23:59:59"; }else { timeStop = LocalDate.now() + " 23:59:59"; } qo.setTimeStop(timeStop); // 生成查询参数 Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; // 获取符合条件的记录数 Long itemTotal = Optional.ofNullable(rmOpenCloseValveHistoryMapper.getNeverOpenValveIntakesCount(params)).orElse(0L); QueryResultVo<List<VoIntake>> rsVo = new QueryResultVo<>() ; rsVo.pageSize = qo.pageSize ; rsVo.pageCurr = qo.pageCurr ; rsVo.calculateAndSet(itemTotal, params); rsVo.obj = rmOpenCloseValveHistoryMapper.getNeverOpenValveIntakes(params); return rsVo ; } /** * 获取指定时间段内开阀次数超过指定值的取水口 * @param qo * @return */ public QueryResultVo<List<VoIntakeOpenCount>> getOpenValveGtIntakes(IntakeValueQO qo) { String timeStart = qo.getTimeStart(); String timeStop = qo.getTimeStop(); if(timeStart != null) { timeStart = timeStart + " 00:00:00"; }else { timeStart = LocalDate.now() + " 00:00:00"; } qo.setTimeStart(timeStart); if(timeStop != null) { timeStop = timeStop + " 23:59:59"; }else { timeStop = LocalDate.now() + " 23:59:59"; } qo.setTimeStop(timeStop); // 生成查询参数 Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; // 获取符合条件的记录数 Long itemTotal = Optional.ofNullable(rmOpenCloseValveHistoryMapper.getOpenValveGtIntakesCount(params)).orElse(0L); QueryResultVo<List<VoIntakeOpenCount>> rsVo = new QueryResultVo<>() ; rsVo.pageSize = qo.pageSize ; rsVo.pageCurr = qo.pageCurr ; rsVo.calculateAndSet(itemTotal, params); rsVo.obj = rmOpenCloseValveHistoryMapper.getOpenValveGtIntakes(params); return rsVo ; } /** * 获取指定时间段内开阀次数低于指定值的取水口 * @param qo * @return */ public QueryResultVo<List<VoIntakeOpenCount>> getOpenValveLtIntakes(IntakeValueQO qo) { String timeStart = qo.getTimeStart(); String timeStop = qo.getTimeStop(); if(timeStart != null) { timeStart = timeStart + " 00:00:00"; }else { timeStart = LocalDate.now() + " 00:00:00"; } qo.setTimeStart(timeStart); if(timeStop != null) { timeStop = timeStop + " 23:59:59"; }else { timeStop = LocalDate.now() + " 23:59:59"; } qo.setTimeStop(timeStop); // 生成查询参数 Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; // 获取符合条件的记录数 Long itemTotal = Optional.ofNullable(rmOpenCloseValveHistoryMapper.getOpenValveLtIntakesCount(params)).orElse(0L); QueryResultVo<List<VoIntakeOpenCount>> rsVo = new QueryResultVo<>() ; rsVo.pageSize = qo.pageSize ; rsVo.pageCurr = qo.pageCurr ; rsVo.calculateAndSet(itemTotal, params); rsVo.obj = rmOpenCloseValveHistoryMapper.getOpenValveLtIntakes(params); return rsVo ; } /** * 根据开阀类型获取操作次数 * @param qo * @return pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java
@@ -6,6 +6,17 @@ import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.voSt.*; import com.dy.pipIrrStatistics.intake.qo.*; import com.dy.pipIrrGlobal.voSt.VoBatteryVolt; import com.dy.pipIrrGlobal.voSt.VoCumulativeFlow; import com.dy.pipIrrGlobal.voSt.VoIntake; import com.dy.pipIrrGlobal.voSt.VoSignalIntensity; import com.dy.pipIrrStatistics.intake.qo.BatteryVoltQO; import com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount; import com.dy.pipIrrStatistics.intake.qo.CumulativeFlowQO; import com.dy.pipIrrStatistics.intake.qo.IntakeQO; import com.dy.pipIrrStatistics.intake.qo.SignalIntensityQO; import com.dy.pipIrrStatistics.intake.qo.IntakeValueQO; import com.dy.pipIrrStatistics.result.StatisticlResultCode; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; @@ -139,4 +150,67 @@ return BaseResponseUtils.buildException(e.getMessage()) ; } } /** * 获取从未开过阀的取水口 * @param * @return */ @GetMapping(path = "/getNeverOpenValveIntakes") @SsoAop() public BaseResponse<QueryResultVo<List<VoIntake>>> getNeverOpenValveIntakes(IntakeQO qo) { try { QueryResultVo<List<VoIntake>> res = intakeSv.getNeverOpenValveIntakes(qo); if(res.itemTotal == 0) { return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.NO_RECORDS.getMessage()); } return BaseResponseUtils.buildSuccess(res); } catch (Exception e) { log.error("获取记录异常", e); return BaseResponseUtils.buildException(e.getMessage()) ; } } /** * 获取指定时间段内开阀次数超过指定值的取水口 * @param * @return */ @GetMapping(path = "/getOpenValveGtIntakes") @SsoAop() public BaseResponse<QueryResultVo<List<VoIntakeOpenCount>>> getOpenValveGtIntakes(IntakeValueQO qo) { try { QueryResultVo<List<VoIntakeOpenCount>> res = intakeSv.getOpenValveGtIntakes(qo); if(res.itemTotal == 0) { return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.NO_RECORDS.getMessage()); } return BaseResponseUtils.buildSuccess(res); } catch (Exception e) { log.error("获取记录异常", e); return BaseResponseUtils.buildException(e.getMessage()) ; } } /** * 获取指定时间段内开阀次数低于指定值的取水口 * @param * @return */ @GetMapping(path = "/getOpenValveLtIntakes") @SsoAop() public BaseResponse<QueryResultVo<List<VoIntakeOpenCount>>> getOpenValveLtIntakes(IntakeValueQO qo) { try { QueryResultVo<List<VoIntakeOpenCount>> res = intakeSv.getOpenValveLtIntakes(qo); if(res.itemTotal == 0) { return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.NO_RECORDS.getMessage()); } return BaseResponseUtils.buildSuccess(res); } catch (Exception e) { log.error("获取记录异常", e); return BaseResponseUtils.buildException(e.getMessage()) ; } } } pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/IntakeValueQO.java
New file @@ -0,0 +1,23 @@ package com.dy.pipIrrStatistics.intake.qo; import com.dy.common.webUtil.QueryConditionVo; import com.fasterxml.jackson.annotation.JsonFormat; import jakarta.validation.constraints.NotBlank; import lombok.Data; /** * @author :WuZeYu * @Date :2024/8/3 9:32 * @LastEditTime :2024/8/3 9:32 * @Description */ @Data public class IntakeValueQO extends IntakeQO { /** * 值 */ @NotBlank(message = "值不能为空") private int value; }