liurunyu
2025-01-09 e059d06932a35d26be1c030dce61964bd04a1488
优化”最近未上报数据“功能实现
4个文件已修改
97 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoIntakeUnReported.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportLastMapper.xml 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoIntakeUnReported.java
@@ -1,6 +1,8 @@
package com.dy.pipIrrGlobal.voSt;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
@@ -10,19 +12,14 @@
 * @Description
 */
@Data
public class VoIntakeUnReported {
    /**
     * 取水口编号
     */
    private String intakeNum;
@JsonPropertyOrder({ "intakeId", "intakeNum", "blockName", "lng", "lat"
        ,"rtuAddr"
})
@EqualsAndHashCode(callSuper=false)
public class VoIntakeUnReported extends VoIntake{
    /**
     * 阀控器地址
     */
    private String rtuAddr;
    /**
     * 阀控器时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String rtuDt;
    public String rtuAddr;
}
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportLastMapper.xml
@@ -423,36 +423,40 @@
    <!--获取最近未报数的取水口数量-->
    <select id="getUnReportedIntakesCount" resultType="java.lang.Long">
        SELECT
            count(*)
        FROM  pr_intake pit
        LEFT JOIN `rm_on_hour_report_last` rohrl ON pit.id = rohrl.intake_id
        LEFT JOIN pr_controller pct ON pit.id = pct.intakeId
        WHERE  rohrl.id is NULL
        count(*)
        FROM pr_intake pit
        LEFT JOIN `rm_on_hour_report_last` rohrl
        ON (
            pit.id = rohrl.intake_id
        <if test="timeStart != null and timeStart != '' ">
            OR rohrl.rtu_dt  &lt; #{timeStart}
            AND rohrl.dt  > #{timeStart}
        </if>
<!--        <if test="timeStop != null and timeStop != '' ">-->
<!--            OR rohrl.rtu_dt &gt; #{timeStop}-->
<!--        </if>-->
        ORDER BY rtu_dt ASC
        )
        LEFT JOIN ba_block bbl ON bbl.id = pit.blockId
        LEFT JOIN pr_controller pct ON pit.id = pct.intakeId
        WHERE rohrl.id is NULL
    </select>
    <!--获取最近未报数的取水口-->
    <select id="getUnReportedIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeUnReported">
        SELECT
            pit.`name` intakeNum,
            pct.rtuAddr,
            rohrl.rtu_dt rtuDt
            pit.id      AS intakeId,
            pit.`name`  AS intakeNum,
            pit.lng     AS lng,
            pit.lat     AS lat,
            bbl.name    AS blockName,
            pct.rtuAddr AS rtuAddr
        FROM  pr_intake pit
        LEFT JOIN `rm_on_hour_report_last` rohrl ON pit.id = rohrl.intake_id
        LEFT JOIN `rm_on_hour_report_last` rohrl
        ON (
            pit.id = rohrl.intake_id
        <if test="timeStart != null and timeStart != '' ">
            AND rohrl.dt  > #{timeStart}
        </if>
        )
        LEFT JOIN ba_block bbl ON bbl.id = pit.blockId
        LEFT JOIN pr_controller pct ON pit.id = pct.intakeId
        WHERE  rohrl.id is NULL
        <if test="timeStart != null">
            OR rohrl.rtu_dt  &lt; #{timeStart}
        </if>
<!--        <if test="timeStop != null">-->
<!--            OR rohrl.rtu_dt &gt; #{timeStop}-->
<!--        </if>-->
        ORDER BY rtu_dt ASC
        ORDER BY pit.id DESC
        <trim prefix="limit ">
            <if test="start != null and count != null">
                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java
@@ -79,25 +79,6 @@
     * @return
     */
    public QueryResultVo<List<VoIntakeUnReported>> getUnReportedIntakes(CommonQO qo) {
        String timeStart = qo.getTimeStart();
        String timeStop = qo.getTimeStop();
        if(timeStart == "") {
            timeStart = null;
        }
        if(timeStop == "") {
            timeStop = null;
        }
        if(timeStart != null && timeStart != "") {
            timeStart = timeStart + " 00:00:00";
        }
        qo.setTimeStart(timeStart);
        if(timeStop != null && timeStop != "") {
            timeStop = timeStop + " 23:59:59";
        }
        qo.setTimeStop(timeStop);
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo);
        Long itemTotal = rmOnHourReportLastMapper.getUnReportedIntakesCount(params);
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java
@@ -45,7 +45,7 @@
     */
    @GetMapping(path = "/getNotOnlineIntakes")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoIntake>>> getNotOnlineIntakes(@Valid CommonQO qo, BindingResult bindingResult) throws Exception {
    public BaseResponse<QueryResultVo<List<VoIntake>>> getNotOnlineIntakes(@Valid CommonQO qo, BindingResult bindingResult) {
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
@@ -81,7 +81,14 @@
     */
    @GetMapping(path = "/getUnReportedIntakes")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoIntakeUnReported>>> getUnReportedIntakes(CommonQO qo) {
    public BaseResponse<QueryResultVo<List<VoIntakeUnReported>>> getUnReportedIntakes(@Valid CommonQO qo, BindingResult bindingResult) {
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        String timeStart = qo.getTimeStart();
        if(timeStart != null && !timeStart.trim().equals("")) {
            qo.setTimeStart(timeStart + " 00:00:00") ;
        }
        try {
            QueryResultVo<List<VoIntakeUnReported>> res = intakeSv.getUnReportedIntakes(qo);
            return BaseResponseUtils.buildSuccess(res);