pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoLargeScreen/Ls4StatisticsMapper.java
New file @@ -0,0 +1,78 @@ package com.dy.pipIrrGlobal.daoLargeScreen; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.Date; /** * @Author: liurunyu * @Date: 2025/2/6 10:46 * @Description */ @Mapper public interface Ls4StatisticsMapper extends BaseMapper<Object> { /** * æ¶åè¡æ¿åºåæ»æ° * @return */ Integer totalCountOfDistrict(@Param("level")Integer level) ; /** * çåºæ»æ° * @return */ Integer totalCountOfBlock() ; /** * åæ°´æ¿æ»æ° * @return */ Integer totalCountOfDivide() ; /** * åæ°´å£æ»æ° * @return */ Integer totalCountOfIntake() ; /** * å·²ç»å®æ§å¶å¨çåæ°´å£æ»æ° * @return */ Integer totalCountOfIntakeWithController() ; /** * æªç»å®æ§å¶å¨çåæ°´å£æ»æ° * @return */ Integer totalCountOfIntakeWithoutController() ; /** * 鿧卿»æ° * @return */ Integer totalCountOfController() ; /** * æµæµªéæ§å¨æ»æ° * @return */ Integer totalCountOfControllerTramp() ; /** * å¼éæ»æ° */ Integer totalCountOfOpenValve(@Param("dt") Date dt) ; /** * å ³éæ»æ° */ Integer totalCountOfCloseValve(@Param("dt") Date dt) ; /** * æ¥è¦æ»æ° */ Integer totalCountOfAlarm(@Param("dt") Date dt) ; /** * æ æ¥è¦æ»æ° */ Integer totalCountOfNoAlarm(@Param("dt") Date dt) ; } pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/rtuMw/Web2RtuMw.java
@@ -3,7 +3,6 @@ import com.dy.common.multiDataSource.DataSourceContext; import com.dy.common.mw.protocol.Command; import com.dy.common.mw.protocol.CommandType; import com.dy.common.softUpgrade.state.UpgradeTaskVo; import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; import org.springframework.core.env.Environment; pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voLargeScreen/VoBaseInfo.java
New file @@ -0,0 +1,65 @@ package com.dy.pipIrrGlobal.voLargeScreen; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import lombok.Data; /** * @Author: liurunyu * @Date: 2025/2/6 10:40 * @Description */ @Data @JsonPropertyOrder({"totalCountOfTown", "totalCountOfVillage", "totalCountOfBlock", "totalCountOfDivide", "totalCountOfIntake", "totalCountOfIntakeWithController", "totalCountOfIntakeWithoutController", "totalCountOfController", "totalCountOfControllerTramp" }) public class VoBaseInfo { private static final long serialVersionUID = 202502060948001L; /** * ä¹¡éæ»æ° */ public Integer totalCountOfTown ; /** * è¡æ¿ææ»æ° */ public Integer totalCountOfVillage ; /** * çåºæ»æ° */ public Integer totalCountOfBlock ; /** * åæ°´æ¿æ»æ° */ public Integer totalCountOfDivide ; /** * åæ°´å£æ»æ° */ public Integer totalCountOfIntake ; /** * å·²ç»å®æ§å¶å¨çåæ°´å£æ»æ° */ public Integer totalCountOfIntakeWithController ; /** * æªç»å®æ§å¶å¨çåæ°´å£æ»æ° */ public Integer totalCountOfIntakeWithoutController ; /** * 鿧卿»æ° */ public Integer totalCountOfController ; /** * æµæµªéæ§å¨æ»æ° */ public Integer totalCountOfControllerTramp ; } pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voLargeScreen/VoCurrentInfo.java
New file @@ -0,0 +1,58 @@ package com.dy.pipIrrGlobal.voLargeScreen; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import lombok.Data; /** * @Author: liurunyu * @Date: 2025/2/6 10:40 * @Description å½åä¿¡æ¯ */ @Data @JsonPropertyOrder({"totalCountOfOnLine", "totalCountOfOffLine", "totalCountOfOpenValve", "totalCountOfCloseValve", "totalCountOfUnknownValve" }) public class VoCurrentInfo { private static final long serialVersionUID = 202502061348001L; /** * å¨çº¿æ»æ° */ public Integer totalCountOfOnLine ; /** * ç¦»çº¿æ»æ° */ public Integer totalCountOfOffLine ; /** * é弿»æ° */ public Integer totalCountOfOpenValve ; /** * éå ³æ»æ° */ public Integer totalCountOfCloseValve ; /** * æªç¥éé¨ç¶ææ»æ° */ public Integer totalCountOfUnknownValve ; /** * æ¥è¦æ»æ° */ public Integer totalCountOfAlarm ; /** * æ æ¥è¦æ»æ° */ public Integer totalCountOfNoAlarm ; /** * æªç¥æ¥è¦ç¶ææ»æ° */ public Integer totalCountOfUnknownAlarm ; } pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voLargeScreen/VoMonitorInfo.java
New file @@ -0,0 +1,33 @@ package com.dy.pipIrrGlobal.voLargeScreen; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import lombok.Data; /** * @Author: liurunyu * @Date: 2025/2/6 10:40 * @Description çæµä¿¡æ¯ */ @Data @JsonPropertyOrder({"totalCountOfOnLine", "totalCountOfOffLine" }) public class VoMonitorInfo { private static final long serialVersionUID = 202502061348001L; /** * 仿æ¶ä»¥æ¥ï¼æ¾ä¸æ¥è¿æ°æ®çæ»æ° */ public Integer totalCountOfReport ; /** * 仿æ¶ä»¥æ¥ï¼æªæ¾ä¸æ¥è¿æ°æ®çæ»æ° */ public Integer totalCountOfNoReport ; /** * 仿ªä¸æ¥è¿æ°æ®çæ»æ° */ public Integer totalCountOfNeverReport ; } pipIrr-platform/pipIrr-global/src/main/resources/mapper/Ls4StatisticsMapper.xml
New file @@ -0,0 +1,134 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.dy.pipIrrGlobal.daoLargeScreen.Ls4StatisticsMapper"> <select id="totalCountOfDistrict" resultType="java.lang.Integer"> select count(*) as count from ba_district tb where tb.level = #{level, jdbcType=INTEGER} and tb.deleted != 1 </select> <select id="totalCountOfBlock" resultType="java.lang.Integer"> select count(*) as count from ba_block tb where tb.deleted != 1 </select> <select id="totalCountOfDivide" resultType="java.lang.Integer"> select count(*) as count from pr_divide tb where tb.deleted != 1 </select> <select id="totalCountOfIntake" resultType="java.lang.Integer"> select count(*) as count from pr_intake tb where tb.deleted != 1 </select> <select id="totalCountOfIntakeWithController" resultType="java.lang.Integer"> select count(*) as count from ( select distinct tb.id from pr_intake tb inner join pr_intake_controller ctb on tb.id = ctb.intakeId where tb.deleted != 1 and ctb.id is not null ) otb </select> <select id="totalCountOfIntakeWithoutController" resultType="java.lang.Integer"> select count(*) as count from pr_intake tb left join pr_intake_controller ctb on tb.id = ctb.intakeId where tb.deleted != 1 and ctb.id is null </select> <select id="totalCountOfController" resultType="java.lang.Integer"> select count(*) as count from pr_controller tb where tb.deleted != 1 </select> <select id="totalCountOfControllerTramp" resultType="java.lang.Integer"> select count(*) as count from pr_controller_tramp tb </select> <select id="totalCountOfOpenValve" resultType="java.lang.Integer"> select count(*) as count from rm_alarm_state_last tb where valve_state = 0 <if test="dt != null "> AND tb.dt <![CDATA[>=]]> #{dt, javaType=DATE, jdbcType=TIMESTAMP} </if> </select> <select id="totalCountOfCloseValve" resultType="java.lang.Integer"> select count(*) as count from rm_alarm_state_last tb where valve_state = 1 <if test="dt != null "> AND tb.dt <![CDATA[>=]]> #{dt, javaType=DATE, jdbcType=TIMESTAMP} </if> </select> <select id="totalCountOfAlarm" 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="dt != null "> AND tb.dt <![CDATA[>=]]> #{dt, javaType=DATE, jdbcType=TIMESTAMP} </if> </select> <select id="totalCountOfNoAlarm" 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="dt != null "> AND tb.dt <![CDATA[>=]]> #{dt, javaType=DATE, jdbcType=TIMESTAMP} </if> </select> </mapper> pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml
@@ -1336,8 +1336,8 @@ count(ocvh.id) as times from rm_open_close_valve_history ocvh inner join se_client_card cc on CAST(cc.cardNum AS CHAR) = ocvh.cl_ic_card_no where ocvh.cl_dt <![CDATA[>=]]> #{startDt, jdbcType=BIGINT} and ocvh.cl_dt <![CDATA[<=]]> #{endDt, jdbcType=BIGINT} where ocvh.cl_dt <![CDATA[>=]]> #{startDt, jdbcType=TIMESTAMP } and ocvh.cl_dt <![CDATA[<=]]> #{endDt, jdbcType=TIMESTAMP} group by ocvh.client_id, cc.id </select> <select id="statisticsByClient" resultType="com.dy.pipIrrGlobal.voSt.VoClientConsumeStatistics"> @@ -1347,8 +1347,8 @@ sum(cl_this_time) as duration, count(id) as times from rm_open_close_valve_history where cl_dt <![CDATA[>=]]> #{startDt, jdbcType=BIGINT} and cl_dt <![CDATA[<=]]> #{endDt, jdbcType=BIGINT} where cl_dt <![CDATA[>=]]> #{startDt, jdbcType=TIMESTAMP} and cl_dt <![CDATA[<=]]> #{endDt, jdbcType=TIMESTAMP} group by client_id </select> </mapper> pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/forTcp/TcpSessionCache.java
@@ -128,7 +128,7 @@ /** * å¾å°ææå¨çº¿ä¸ç¦»çº¿æ°éç»è®¡ * @return [0]=å¨çº¿æ°éï¼[2]ä¸çº¿è¿ï¼ä½å½åç¦»çº¿çæ°é * @return [0]=å¨çº¿æ°éï¼[1]ä¸çº¿è¿ï¼ä½å½åç¦»çº¿çæ°é */ public static Integer[] allOnLineStateStatistics(){ synchronized (map){ pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/largeScreen/Ls4StatisticsCtrl.java
New file @@ -0,0 +1,107 @@ package com.dy.pipIrrStatistics.largeScreen; import com.dy.common.aop.SsoAop; import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.ResultCodeMsg; import com.dy.pipIrrGlobal.voLargeScreen.VoBaseInfo; import com.dy.pipIrrGlobal.voLargeScreen.VoCurrentInfo; import com.dy.pipIrrGlobal.voLargeScreen.VoMonitorInfo; 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.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.Date; /** * @Author: liurunyu * @Date: 2025/2/6 10:32 * @Description */ @Slf4j @Tag(name = "大å±å±ç¤º", description = "大å±å±ç¤º---ç»è®¡ä¿¡æ¯") @RestController @RequestMapping(path = "ls4Statistics") @SuppressWarnings("unchecked")//javaçæ¬è¶é«ï¼å¯¹æ³å约æè¶ä¸¥ï¼æä»¥é ç½®SuppressWarnings("unchecked") public class Ls4StatisticsCtrl { private Ls4StatisticsSv sv; @Autowired private void setSv(Ls4StatisticsSv sv) { this.sv = sv; } /** * 大å±å±ç¤º---åºæ¬ä¿¡æ¯ * @return åºæ¬ä¿¡æ¯ */ @Operation(summary = "大å±å±ç¤º", description = "åºæ¬ä¿¡æ¯") @ApiResponses(value = { @ApiResponse( responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, description = "åºæ¬ä¿¡æ¯ï¼BaseResponse.content:VoBaseInfo{}ï¼", content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = VoBaseInfo.class))} ) }) @GetMapping(path = "baseInfo") @SsoAop() public BaseResponse<VoBaseInfo> baseInfo() { VoBaseInfo res = this.sv.baseInfo(); return BaseResponseUtils.buildSuccess(res); } /** * 大å±å±ç¤º---å½åä¿¡æ¯ * @return å½åä¿¡æ¯ */ @Operation(summary = "大å±å±ç¤º", description = "å½åä¿¡æ¯") @ApiResponses(value = { @ApiResponse( responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, description = "åºæ¬ä¿¡æ¯ï¼BaseResponse.content:VoCurrentInfo{}ï¼", content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = VoCurrentInfo.class))} ) }) @GetMapping(path = "currentInfo") @SsoAop() public BaseResponse<VoCurrentInfo> currentInfo() throws Exception { VoCurrentInfo res = this.sv.currentInfo(); return BaseResponseUtils.buildSuccess(res); } /** * 大å±å±ç¤º---çæµä¿¡æ¯ * @return çæµä¿¡æ¯ * @param startDt å¼å§æ¥æï¼æ ¼å¼ yyyy-mm-ddï¼ */ @Operation(summary = "大å±å±ç¤º", description = "çæµä¿¡æ¯") @ApiResponses(value = { @ApiResponse( responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, description = "åºæ¬ä¿¡æ¯ï¼BaseResponse.content:VoMonitorInfo{}ï¼", content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = VoMonitorInfo.class))} ) }) @GetMapping(path = "monitorInfo") @SsoAop() public BaseResponse<VoMonitorInfo> monitorInfo(Date startDt) { 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
New file @@ -0,0 +1,127 @@ package com.dy.pipIrrStatistics.largeScreen; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.dy.common.mw.protocol.Command; import com.dy.common.mw.protocol.CommandBackParam; import com.dy.common.util.DateTime; import com.dy.common.webUtil.BaseResponse; import com.dy.pipIrrGlobal.daoLargeScreen.Ls4StatisticsMapper; import com.dy.pipIrrGlobal.rtuMw.CodeLocal; import com.dy.pipIrrGlobal.rtuMw.Web2RtuMw; import com.dy.pipIrrGlobal.voLargeScreen.VoBaseInfo; import com.dy.pipIrrGlobal.voLargeScreen.VoCurrentInfo; import com.dy.pipIrrGlobal.voLargeScreen.VoMonitorInfo; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; import java.util.Date; /** * @Author: liurunyu * @Date: 2025/2/6 10:33 * @Description */ @Slf4j @Service public class Ls4StatisticsSv extends Web2RtuMw { private Environment env; private RestTemplate restTemplate; private Ls4StatisticsMapper dao ; @Autowired private void setEnvironment(Environment env){ this.env = env; } @Autowired private void setRestTemplate(RestTemplate restTemplate){ this.restTemplate = restTemplate; } @Autowired private void setDao(Ls4StatisticsMapper dao){ this.dao = dao; } /** * åºæ¬ä¿¡æ¯ç»è®¡ * @return */ public VoBaseInfo baseInfo(){ VoBaseInfo vo = new VoBaseInfo() ; vo.totalCountOfTown = this.dao.totalCountOfDistrict(3) ; vo.totalCountOfVillage = this.dao.totalCountOfDistrict(4) ; vo.totalCountOfBlock = this.dao.totalCountOfBlock() ; vo.totalCountOfDivide = this.dao.totalCountOfDivide() ; vo.totalCountOfIntake = this.dao.totalCountOfIntake() ; vo.totalCountOfIntakeWithController = this.dao.totalCountOfIntakeWithController() ; vo.totalCountOfIntakeWithoutController = this.dao.totalCountOfIntakeWithoutController() ; vo.totalCountOfController = this.dao.totalCountOfController() ; vo.totalCountOfControllerTramp = this.dao.totalCountOfControllerTramp() ; return vo ; } /** * å½åä¿¡æ¯ç»è®¡ * @return */ public VoCurrentInfo currentInfo() throws Exception{ Integer totalCountOfIntake = this.dao.totalCountOfIntake() ; 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 ; return vo ; } /** * çæµä¿¡æ¯ç»è®¡ * @return */ public VoMonitorInfo monitorInfo(Date startDt){ VoMonitorInfo vo = new VoMonitorInfo() ; return vo ; } /** * æ¥è¯¢åæ°´å£å¨çº¿å离线ç»è®¡ * @return */ private Integer[] queryMwOnAndOffLine() { Integer[] result = new Integer[]{0,0} ; //åéä¿¡ä¸é´ä»¶åå ³å½ä»¤ï¼æ¥è¯¢RTUå¨çº¿ç»è®¡æ åµ Command com = this.createInnerCommand(CodeLocal.onLineStatistics); String rqUrl = this.get2MwRequestUrl(this.env, ContextComSend) ; BaseResponse res = this.sendPostRequest2Mw(restTemplate, rqUrl, com) ; if(res != null){ if(res.isSuccess()){ Command reCom = JSON.parseObject(res.getContent() == null ? null : JSON.toJSONString(res.getContent()), Command.class) ; CommandBackParam bakParam = JSON.parseObject((reCom== null || reCom.param == null) ? null : JSON.toJSONString(reCom.param), CommandBackParam.class) ; if(bakParam != null){ if(bakParam.getSuccess().booleanValue() && reCom.getAttachment() != null){ //éä¿¡ä¸é´ä»¶æåè¿åå½ä»¤ç»æ JSONObject comRes = (JSONObject) JSON.toJSON(reCom.getAttachment()); result[0] = comRes.getInteger("onLineNum") ; result[1] = comRes.getInteger("offLineNum") ; } }else{ log.error("éä¿¡ä¸é´ä»¶è¿åå é¨å½ä»¤ç»æä¸ä¸å å«CommandBackParamç±»ååæ°"); } }else{ log.error("éä¿¡ä¸é´ä»¶è¿åå é¨å½ä»¤æ§è¡å¤±è´¥" + (res.getMsg() == null? "" : ("ï¼" + res.getMsg()))) ; } }else{ log.error("éä¿¡ä¸é´ä»¶è¿åå é¨å½ä»¤ç»æä¸ºnull"); } return result ; } } pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/largeScreen/˵Ã÷.txt
New file @@ -0,0 +1 @@ 大å±ç³»ç»ï¼largeScreenï¼ç¼©åLsï¼