From 709914b92b814f9f93ec38ed78054a8c831cc0fd Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Tue, 06 Jul 2021 14:00:02 +0800
Subject: [PATCH] redis常量update

---
 screen-job/src/main/java/com/moral/api/service/impl/HistoryMonthlyServiceImpl.java |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/screen-job/src/main/java/com/moral/api/service/impl/HistoryMonthlyServiceImpl.java b/screen-job/src/main/java/com/moral/api/service/impl/HistoryMonthlyServiceImpl.java
index 659841b..8acb57a 100644
--- a/screen-job/src/main/java/com/moral/api/service/impl/HistoryMonthlyServiceImpl.java
+++ b/screen-job/src/main/java/com/moral/api/service/impl/HistoryMonthlyServiceImpl.java
@@ -16,6 +16,7 @@
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.ObjectUtils;
 
 import java.util.ArrayList;
@@ -48,11 +49,12 @@
     private HistoryDailyService historyDailyService;
 
     @Override
+    @Transactional
     public void insertHistoryMonthly() {
-
-        Date now = new Date();
         //���������������������1���
         Date start = DateUtils.getFirstDayOfLastMonth();
+        //���������������������1���
+        Date end = DateUtils.addMonths(start, 1);
         //������
         QueryWrapper<Sensor> sensorQueryWrapper = new QueryWrapper<>();
         sensorQueryWrapper.select("code").eq("is_delete", Constants.NOT_DELETE);
@@ -60,7 +62,7 @@
 
         //���������������������������
         QueryWrapper<HistoryDaily> historyDailyQueryWrapper = new QueryWrapper<>();
-        historyDailyQueryWrapper.ge("time", DateUtils.dateToDateString(start)).lt("time", DateUtils.dateToDateString(now));
+        historyDailyQueryWrapper.ge("time", DateUtils.dateToDateString(start)).lt("time", DateUtils.dateToDateString(end));
         List<Map<String, Object>> weeklyData = historyDailyService.listMaps(historyDailyQueryWrapper);
         if (weeklyData.size() == 0) {
             return;
@@ -84,13 +86,13 @@
             }
 
             //CO 95������������������������
-            Object coAvg = AmendUtils.getCOAvgOfWeek(value);
+            Object coAvg = AmendUtils.getCOAvgOfWeekOrMonth(value);
             if (coAvg != null) {
                 jsonMap.put(Constants.SENSOR_CODE_CO, coAvg);
             }
 
             //O3 90������������������������
-            Object o3Avg = AmendUtils.getO3AvgOfWeek(value);
+            Object o3Avg = AmendUtils.getO3AvgOfWeekOrMonth(value);
             if (o3Avg != null) {
                 jsonMap.put(Constants.SENSOR_CODE_O3, o3Avg);
             }
@@ -129,7 +131,5 @@
 
         //���������������
         historyMonthlyMapper.insertHistoryMonthly(insertData);
-
-
     }
 }

--
Gitblit v1.8.0