pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoLargeScreen/Ls4StatisticsMapper.java
@@ -75,4 +75,47 @@ */ Integer totalCountOfNoAlarm(@Param("dt") Date dt) ; /** * 从某时以来,曾上报过数据的总数 */ Integer mTotalCountOfReport(@Param("fromDt") Date fromDt) ; /** * 从某时以来,未曾上报过数据的总数 */ Integer mTotalCountOfNoReport(@Param("fromDt") Date fromDt) ; /** * 从未上报过数据的总数 */ Integer mTotalCountOfNeverReport() ; /** * 从某时以来,曾阀开总数 */ Integer mTotalCountOfOpenValve(@Param("fromDt") Date fromDt) ; /** * 从某时以来,曾阀关总数 */ Integer mTotalCountOfCloseValve(@Param("fromDt") Date fromDt) ; /** * 从未开过阀的总数 */ Integer mTotalCountOfNeverOpenValve() ; /** * 从某时以来,曾报警总数 */ Integer mTotalCountOfAlarm(@Param("fromDt") Date fromDt) ; /** * 从某时以来,曾无报警总数 */ Integer mTotalCountOfNoAlarm(@Param("fromDt") Date fromDt) ; /** * 从未报过警总数 */ Integer mTotalCountOfNeverAlarm() ; } pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voLargeScreen/VoCurrentInfo.java
@@ -10,11 +10,14 @@ */ @Data @JsonPropertyOrder({"totalCountOfOnLine", "totalCountOfOffLine", "totalCountOfOpenValve", "totalCountOfCloseValve", "totalCountOfUnknownValve" @JsonPropertyOrder({"cTotalCountOfOnLine", "cTotalCountOfOffLine", "cTotalCountOfOpenValve", "cTotalCountOfCloseValve", "cTotalCountOfUnknownValve", "cTotalCountOfAlarm", "cTotalCountOfNoAlarm", "cTotalCountOfUnknownAlarm" }) public class VoCurrentInfo { @@ -23,36 +26,36 @@ /** * 在线总数 */ public Integer totalCountOfOnLine ; public Integer cTotalCountOfOnLine; /** * 离线总数 */ public Integer totalCountOfOffLine ; public Integer cTotalCountOfOffLine; /** * 阀开总数 */ public Integer totalCountOfOpenValve ; public Integer cTotalCountOfOpenValve; /** * 阀关总数 */ public Integer totalCountOfCloseValve ; public Integer cTotalCountOfCloseValve; /** * 未知阀门状态总数 */ public Integer totalCountOfUnknownValve ; public Integer cTotalCountOfUnknownValve; /** * 报警总数 */ public Integer totalCountOfAlarm ; public Integer cTotalCountOfAlarm; /** * 无报警总数 */ public Integer totalCountOfNoAlarm ; public Integer cTotalCountOfNoAlarm; /** * 未知报警状态总数 */ public Integer totalCountOfUnknownAlarm ; public Integer cTotalCountOfUnknownAlarm; } pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voLargeScreen/VoMonitorInfo.java
@@ -10,24 +10,59 @@ */ @Data @JsonPropertyOrder({"totalCountOfOnLine", "totalCountOfOffLine" @JsonPropertyOrder({"mTotalCountOfReport", "mTotalCountOfNoReport", "mTotalCountOfNeverReport", "mTotalCountOfOpenValve", "mTotalCountOfCloseValve", "mTotalCountOfUnknownValve", "mTotalCountOfAlarm", "mTotalCountOfNoAlarm", "mTotalCountOfUnknownAlarm" }) public class VoMonitorInfo { private static final long serialVersionUID = 202502061348001L; private static final long serialVersionUID = 202502061348321L; /** * 从某时以来,曾上报过数据的总数 */ public Integer totalCountOfReport ; public Integer mTotalCountOfReport; /** * 从某时以来,未曾上报过数据的总数 */ public Integer totalCountOfNoReport ; public Integer mTotalCountOfNoReport; /** * 从未上报过数据的总数 */ public Integer totalCountOfNeverReport ; public Integer mTotalCountOfNeverReport; /** * 从某时以来,曾阀开总数 */ public Integer mTotalCountOfOpenValve ; /** * 从某时以来,曾阀关总数 */ public Integer mTotalCountOfCloseValve ; /** * 从未开过阀的总数 */ public Integer mTotalCountOfNeverOpenValve ; /** * 从某时以来,曾报警总数 */ public Integer mTotalCountOfAlarm ; /** * 从某时以来,曾无报警总数 */ public Integer mTotalCountOfNoAlarm ; /** * 从未报过警总数 */ public Integer mTotalCountOfNeverAlarm ; } pipIrr-platform/pipIrr-global/src/main/resources/mapper/Ls4StatisticsMapper.xml
@@ -130,5 +130,142 @@ </if> </select> <select id="mTotalCountOfReport" resultType="java.lang.Integer"> select count(*) as count from rm_on_hour_report_last tb where tb.dt <![CDATA[>=]]> #{fromDt, javaType=DATE, jdbcType=TIMESTAMP} </select> <select id="mTotalCountOfNoReport" resultType="java.lang.Integer"> select count(*) as count from pr_intake tb left join ( select ltb.intake_id from rm_on_hour_report_last ltb where ltb.dt <![CDATA[>=]]> #{fromDt, javaType=DATE, jdbcType=TIMESTAMP} ) temTb on tb.id = temTb.intake_id where temTb.intake_id is null </select> <select id="mTotalCountOfNeverReport" resultType="java.lang.Integer"> select count(*) as count from pr_intake tb left join ( select ltb.intake_id from rm_on_hour_report_last ltb ) temTb on tb.id = temTb.intake_id where temTb.intake_id is null </select> <select id="mTotalCountOfOpenValve" resultType="java.lang.Integer"> select count(*) as count from rm_alarm_state_last tb where valve_state = 0 <if test="fromDt != null "> AND tb.dt <![CDATA[>=]]> #{fromDt, javaType=DATE, jdbcType=TIMESTAMP} </if> </select> <select id="mTotalCountOfCloseValve" resultType="java.lang.Integer"> select count(*) as count from rm_alarm_state_last tb where valve_state = 1 <if test="fromDt != null "> AND tb.dt <![CDATA[>=]]> #{fromDt, javaType=DATE, jdbcType=TIMESTAMP} </if> </select> <select id="mTotalCountOfNeverOpenValve" resultType="java.lang.Integer"> select count(*) as count from pr_intake tb left join ( /* 此处理解为有过记录,那么就开过阀 */ select ltb.intake_id from rm_alarm_state_last ltb ) temTb on tb.id = temTb.intake_id where temTb.intake_id is null </select> <select id="mTotalCountOfAlarm" resultType="java.lang.Integer"> select count(*) as count from rm_alarm_state_last tb where (alarm_remain_water = 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 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 state_ic_enable = 1 or alarm_battery_volt = 1 or alarm_valve = 1) <if test="fromDt != null "> AND tb.dt <![CDATA[>=]]> #{fromDt, javaType=DATE, jdbcType=TIMESTAMP} </if> </select> <select id="mTotalCountOfNoAlarm" resultType="java.lang.Integer"> select count(*) as count from rm_alarm_state_last tb where ((alarm_remain_water is null or alarm_remain_water = 0) and (alarm_remain_water is null or alarm_exceed_year = 0) and (alarm_remain_water is null or alarm_water_meter_fault = 0) and (alarm_remain_water is null or alarm_loss = 0) and (alarm_remain_water is null or alarm_water_meter_break = 0) and (alarm_remain_water is null or alarm_ele_meter_fault = 0) and (alarm_remain_water is null or alarm_inner_door = 0) and (alarm_remain_water is null or alarm_outer_door = 0) and (alarm_remain_water is null or alarm_ele_miss = 0) and (alarm_remain_water is null or alarm_ele_exceed = 0) and (alarm_remain_water is null or alarm_ele_low_volt = 0) and (alarm_remain_water is null or state_ic_enable = 0) and (alarm_remain_water is null or alarm_battery_volt = 0) and (alarm_remain_water is null or alarm_valve = 0) ) <if test="fromDt != null "> AND tb.dt <![CDATA[>=]]> #{fromDt, javaType=DATE, jdbcType=TIMESTAMP} </if> </select> <select id="mTotalCountOfNeverAlarm" resultType="java.lang.Integer"> select count(*) as count from pr_intake tb left join ( select ltb.intake_id from rm_alarm_state_last ltb where ((ltb.alarm_remain_water is null or ltb.alarm_remain_water = 0) and (ltb.alarm_remain_water is null or ltb.alarm_exceed_year = 0) and (ltb.alarm_remain_water is null or ltb.alarm_water_meter_fault = 0) and (ltb.alarm_remain_water is null or ltb.alarm_loss = 0) and (ltb.alarm_remain_water is null or ltb.alarm_water_meter_break = 0) and (ltb.alarm_remain_water is null or ltb.alarm_ele_meter_fault = 0) and (ltb.alarm_remain_water is null or ltb.alarm_inner_door = 0) and (ltb.alarm_remain_water is null or ltb.alarm_outer_door = 0) and (ltb.alarm_remain_water is null or ltb.alarm_ele_miss = 0) and (ltb.alarm_remain_water is null or ltb.alarm_ele_exceed = 0) and (ltb.alarm_remain_water is null or ltb.alarm_ele_low_volt = 0) and (ltb.alarm_remain_water is null or ltb.state_ic_enable = 0) and (ltb.alarm_remain_water is null or ltb.alarm_battery_volt = 0) and (ltb.alarm_remain_water is null or ltb.alarm_valve = 0) ) ) temTb on tb.id = temTb.intake_id where temTb.intake_id is null </select> </mapper> pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/largeScreen/Ls4StatisticsCtrl.java
@@ -1,6 +1,7 @@ package com.dy.pipIrrStatistics.largeScreen; import com.dy.common.aop.SsoAop; import com.dy.common.util.DateTime; import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.ResultCodeMsg; @@ -86,7 +87,7 @@ /** * 大屏展示---监测信息 * @return 监测信息 * @param startDt 开始日期(格式 yyyy-mm-dd) * @param fromDt 开始日期(格式 yyyy-mm-dd) */ @Operation(summary = "大屏展示", description = "监测信息") @ApiResponses(value = { @@ -99,7 +100,11 @@ }) @GetMapping(path = "monitorInfo") @SsoAop() public BaseResponse<VoMonitorInfo> monitorInfo(Date startDt) { public BaseResponse<VoMonitorInfo> monitorInfo(String fromDt) throws Exception { if(fromDt == null || fromDt.trim().equals("")){ return BaseResponseUtils.buildException("开始日期不能为空"); } Date startDt = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(fromDt + " 00:00:00"); VoMonitorInfo res = this.sv.monitorInfo(startDt); return BaseResponseUtils.buildSuccess(res); } pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/largeScreen/Ls4StatisticsSv.java
@@ -72,14 +72,16 @@ Date dtAtXHourBefore = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(DateTime.lastXHour_yyyy_MM_dd_HH_mm_ss(24)) ;//X个小时前 VoCurrentInfo vo = new VoCurrentInfo() ; Integer[] result = this.queryMwOnAndOffLine() ; vo.totalCountOfOnLine = result[0] ; vo.totalCountOfOffLine = totalCountOfIntake - vo.totalCountOfOnLine; ; vo.totalCountOfOpenValve = this.dao.totalCountOfOpenValve(dtAtXHourBefore) ; vo.totalCountOfCloseValve = this.dao.totalCountOfCloseValve(dtAtXHourBefore) ; vo.totalCountOfUnknownValve = totalCountOfIntake - vo.totalCountOfOpenValve - vo.totalCountOfCloseValve ; vo.totalCountOfAlarm = this.dao.totalCountOfAlarm(dtAtXHourBefore) ; vo.totalCountOfNoAlarm = this.dao.totalCountOfNoAlarm(dtAtXHourBefore) ; vo.totalCountOfUnknownAlarm = totalCountOfIntake - vo.totalCountOfAlarm - vo.totalCountOfNoAlarm ; vo.cTotalCountOfOnLine = result[0] ; vo.cTotalCountOfOffLine = totalCountOfIntake - vo.cTotalCountOfOnLine; vo.cTotalCountOfOpenValve = this.dao.totalCountOfOpenValve(dtAtXHourBefore) ; vo.cTotalCountOfCloseValve = this.dao.totalCountOfCloseValve(dtAtXHourBefore) ; vo.cTotalCountOfUnknownValve = totalCountOfIntake - vo.cTotalCountOfOpenValve - vo.cTotalCountOfCloseValve; vo.cTotalCountOfAlarm = this.dao.totalCountOfAlarm(dtAtXHourBefore) ; vo.cTotalCountOfNoAlarm = this.dao.totalCountOfNoAlarm(dtAtXHourBefore) ; vo.cTotalCountOfUnknownAlarm = totalCountOfIntake - vo.cTotalCountOfAlarm - vo.cTotalCountOfNoAlarm; return vo ; } @@ -87,8 +89,20 @@ * 监测信息统计 * @return */ public VoMonitorInfo monitorInfo(Date startDt){ public VoMonitorInfo monitorInfo(Date fromDt){ VoMonitorInfo vo = new VoMonitorInfo() ; vo.mTotalCountOfReport = this.dao.mTotalCountOfReport(fromDt) ; vo.mTotalCountOfNoReport = this.dao.mTotalCountOfNoReport(fromDt) ; vo.mTotalCountOfNeverReport = this.dao.mTotalCountOfNeverReport() ; vo.mTotalCountOfOpenValve = this.dao.mTotalCountOfOpenValve(fromDt) ; vo.mTotalCountOfCloseValve = this.dao.mTotalCountOfCloseValve(fromDt) ; vo.mTotalCountOfNeverOpenValve = this.dao.mTotalCountOfNeverOpenValve() ; vo.mTotalCountOfAlarm = this.dao.mTotalCountOfAlarm(fromDt) ; vo.mTotalCountOfNoAlarm = this.dao.mTotalCountOfNoAlarm(fromDt) ; vo.mTotalCountOfNeverAlarm = this.dao.mTotalCountOfNeverAlarm() ; return vo ; }