Explorar el Código

投药报表,小时||天维度,时区问题

Davidliu hace 2 días
padre
commit
02016f0a3d

+ 4 - 4
src/main/java/com/xlht/xlhtproject/controller/TXlhtAddRecordController.java

@@ -73,8 +73,8 @@ public class TXlhtAddRecordController extends BaseController{
                 Collections.singletonList("南池瞬时加药量(L/h)-5分钟"),
                 Collections.singletonList("南池系统加药量(L/h)(系统显示)"),
                 Collections.singletonList("北池系统加药量(L/h)(系统显示)"),
-                Collections.singletonList("南池系统加药量(L/h)"),
-                Collections.singletonList("北池系统加药量(L/h)")
+                Collections.singletonList("南池系统加药量(L/h)-实际"),
+                Collections.singletonList("北池系统加药量(L/h)-实际")
         );
         List<List<Object>> data = new ArrayList<>();
         for (TXlhtAddRecord member : list) {
@@ -145,8 +145,8 @@ public class TXlhtAddRecordController extends BaseController{
                 Collections.singletonList("南池瞬时加药量(L/h)-5分钟"),
                 Collections.singletonList("南池系统加药量(L/h)(系统显示)"),
                 Collections.singletonList("北池系统加药量(L/h)(系统显示)"),
-                Collections.singletonList("南池系统加药量(L/h)"),
-                Collections.singletonList("北池系统加药量(L/h)")
+                Collections.singletonList("南池系统加药量(L/h)-实际"),
+                Collections.singletonList("北池系统加药量(L/h)-实际")
         );
         List<List<Object>> data = new ArrayList<>();
         for (TXlhtAddRecord member : list) {

+ 4 - 4
src/main/resources/mapper/TXlhtAddRecordMapper.xml

@@ -154,7 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             rec_hour.real_two_amount
         FROM (
                  SELECT
-                     DATEADD(HOUR, DATEDIFF(HOUR, 0, create_time), 0) AS hour_time,
+                     DATEADD(HOUR, DATEDIFF(HOUR, 0, DATEADD(HOUR, 8, create_time)), 0) AS hour_time,
                      avg(one_amount) AS one_amount,
                      avg(two_amount) AS two_amount,
                      avg(tmp_one_amount) AS tmp_one_amount,
@@ -167,11 +167,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 <if test="timeBegin != null  and timeBegin != ''"> and create_time &gt;= #{timeBegin}</if>
                 <if test="timeEnd != null  and timeEnd != ''"> and create_time &lt;= #{timeEnd}</if>
                 </where>
-                 GROUP BY DATEADD(HOUR, DATEDIFF(HOUR, 0, create_time), 0)
+                 GROUP BY DATEADD(HOUR, DATEDIFF(HOUR, 0, DATEADD(HOUR, 8, create_time)), 0)
              ) AS rec_hour
                  LEFT JOIN (
             SELECT
-                DATEADD(HOUR, DATEDIFF(HOUR, 0, create_time), 0) AS hour_time,
+                DATEADD(HOUR, DATEDIFF(HOUR, 0, DATEADD(HOUR, 8, create_time)), 0) AS hour_time,
                 AVG(one_amount) AS instant_one_amount,
                 AVG(two_amount) AS instant_two_amount
             FROM t_xlht_add_record_sec
@@ -180,7 +180,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 <if test="timeBegin != null  and timeBegin != ''"> and create_time &gt;= #{timeBegin}</if>
                 <if test="timeEnd != null  and timeEnd != ''"> and create_time &lt;= #{timeEnd}</if>
             </where>
-            GROUP BY DATEADD(HOUR, DATEDIFF(HOUR, 0, create_time), 0)
+            GROUP BY DATEADD(HOUR, DATEDIFF(HOUR, 0, DATEADD(HOUR, 8, create_time)), 0)
         ) AS sec_hour
         ON sec_hour.hour_time = rec_hour.hour_time
         order by rec_hour.hour_time desc