From b397edee2be2dfcc3f28eeac50298b4de26b1afa Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期五, 13 十二月 2024 16:53:45 +0800
Subject: [PATCH] 取水口日取水量表中,出现一些大数,明显不正确,发析系统日志,发现一些阀控器会上报一些累计流量为0的数据,且无规律,推测是其不能从水表读取到累计流量时会上报0值。如果间歇上报0值,间歇上报一些非0值,非0值减去0值,就会出现大数,一天中出现几次那么会大数进行累加,数值将更大。为此变更算法,规避这种情况,但也会丢失一些流量值。

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmTimingReportLastMapper.xml |   63 +++++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 1 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmTimingReportLastMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmTimingReportLastMapper.xml
index b16ee8a..3cca12b 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmTimingReportLastMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmTimingReportLastMapper.xml
@@ -225,6 +225,67 @@
     select
     <include refid="Base_Column_List" />
     from rm_timing_report_last
-    where rtu_addr = #{rtuAddr}
+    where intake_id = #{intakeId}
+  </select>
+
+  <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇瀹氭椂鎶ユ渶鏂拌褰曟暟閲�-->
+  <select id="getTimingReportsCount_last" resultType="java.lang.Long">
+    SELECT
+        COUNT(*) AS recordCount
+    FROM rm_timing_report_last tim
+        INNER JOIN pr_intake inta ON inta.id = tim.intake_id
+    <where>
+      <if test="intakeId != null and intakeId >0">
+        AND tim.intake_id = #{intakeId}
+      </if>
+      <if test = "intakeNum != null and intakeNum !=''">
+        AND inta.name LIKE CONCAT('%',#{intakeNum},'%')
+      </if>
+      <if test = "rtuAddr != null and rtuAddr !=''">
+        AND tim.rtu_addr LIKE CONCAT('%',#{rtuAddr},'%')
+      </if>
+      <if test = "timeStart != null and timeStop != null">
+        AND tim.dt BETWEEN #{timeStart} AND #{timeStop}
+      </if>
+    </where>
+  </select>
+
+  <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇瀹氭椂鎶ユ渶鏂拌褰�-->
+  <select id="getTimingReports_last" resultType="com.dy.pipIrrGlobal.voRm.VoTiming">
+    SELECT
+      tim.intake_id AS intakeId,
+      inta.name AS intakenum,
+      tim.rtu_addr AS rtuAddr,
+      tim.dt AS receiveTime,
+      tim.water_total_amount_year AS waterTotalAmountYear,
+      tim.water_total_amount_meter AS waterTotalAmountMeter,
+      tim.ele_total_amount_year AS eleTotalAmountYear,
+      tim.ele_total_amount_meter AS eleTotalAmountMeter,
+      tim.water_total_amount_day AS waterTotalAmountDay,
+      tim.water_user_total_amount_day AS waterUserTotalAmountDay,
+      tim.loss_total_amount_day AS lossTotalAmountDay,
+      tim.battery_volt AS batteryVolt
+    FROM rm_timing_report_last tim
+    INNER JOIN pr_intake inta ON inta.id = tim.intake_id
+    <where>
+      <if test="intakeId != null and intakeId >0">
+        AND tim.intake_id = #{intakeId}
+      </if>
+      <if test = "intakeNum != null and intakeNum !=''">
+        AND inta.name LIKE CONCAT('%',#{intakeNum},'%')
+      </if>
+      <if test = "rtuAddr != null and rtuAddr !=''">
+        AND tim.rtu_addr LIKE CONCAT('%',#{rtuAddr},'%')
+      </if>
+      <if test = "timeStart != null and timeStop != null">
+        AND tim.dt BETWEEN #{timeStart} AND #{timeStop}
+      </if>
+    </where>
+    ORDER BY tim.dt DESC, tim.loss_total_amount_day DESC
+    <trim prefix="limit " >
+      <if test="start != null and count != null">
+        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
+      </if>
+    </trim>
   </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0