From 20f693a9af9e90931ecb004700ec96453d05cecb Mon Sep 17 00:00:00 2001
From: cjl <276999030@qq.com>
Date: Thu, 27 Jul 2023 10:31:37 +0800
Subject: [PATCH] fix: 远程数据提交修改

---
 screen-job/src/main/java/com/moral/api/task/HistoryTableInsertTask.java |  111 +++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 78 insertions(+), 33 deletions(-)

diff --git a/screen-job/src/main/java/com/moral/api/task/HistoryTableInsertTask.java b/screen-job/src/main/java/com/moral/api/task/HistoryTableInsertTask.java
index eb9b6af..635efde 100644
--- a/screen-job/src/main/java/com/moral/api/task/HistoryTableInsertTask.java
+++ b/screen-job/src/main/java/com/moral/api/task/HistoryTableInsertTask.java
@@ -3,48 +3,44 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.alibaba.fastjson.JSON;
-import com.moral.api.entity.HistoryDaily;
 import com.moral.api.service.HistoryDailyService;
 import com.moral.api.service.HistoryFiveMinutelyService;
+import com.moral.api.service.HistoryHourlyService;
+import com.moral.api.service.HistoryMonthlyService;
+import com.moral.api.service.HistoryWeeklyService;
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
+
+import javax.xml.crypto.Data;
+import java.util.Date;
 
 @Component
 public class HistoryTableInsertTask {
 
     @Autowired
+    private HistoryFiveMinutelyService historyFiveMinutelyService;
+
+    @Autowired
+    private HistoryHourlyService historyHourlyService;
+
+    @Autowired
     private HistoryDailyService historyDailyService;
 
     @Autowired
-    private HistoryFiveMinutelyService historyFiveMinutelyService;
+    private HistoryWeeklyService historyWeeklyService;
+
+    @Autowired
+    private HistoryMonthlyService historyMonthlyService;
 
     //5������������������
     @XxlJob("insertHistoryFiveMinutely")
     public ReturnT insertHistoryFiveMinutely() {
         try {
-           /* List<Map<String, Object>> list = new ArrayList<>();
-            Map<String, Object> map = new HashMap<>();
-            map.put("mac", "123456");
-            Date date = new Date();
-            map.put("time", date);
-            Map<String, Object> value = new HashMap<>();
-            value.put("e1", 10);            value.put("e2", 20);
-            map.put("value", JSON.toJSONString(value));
-            list.add(map);
-            String timeUnits = DateUtils.dateToDateString(date, DateUtils.yyyyMM_EN);*/
-
             historyFiveMinutelyService.insertHistoryFiveMinutely();
         } catch (Exception e) {
             XxlJobHelper.log(e.getMessage());
-            return ReturnT.FAIL;
+            return new ReturnT(ReturnT.FAIL_CODE, e.getMessage());
         }
         return ReturnT.SUCCESS;
     }
@@ -53,22 +49,71 @@
     @XxlJob("insertHistoryDaily")
     public ReturnT insertHistoryDaily() {
         try {
-            List<HistoryDaily> list = new ArrayList<>();
-            HistoryDaily historyDaily = new HistoryDaily();
-            historyDaily.setMac("123456");
-            historyDaily.setTime(new Date());
-            Map<String, Object> value = new HashMap<>();
-            value.put("e1", 1);
-            value.put("e2", 2);
-            historyDaily.setValue(JSON.toJSONString(value));
-            for (int i = 0; i < 20000; i++) {
-                list.add(historyDaily);
-            }
-            historyDailyService.insertHistoryDaily(list);
+            Date now = new Date();
+            historyDailyService.insertHistoryDaily(null);
         } catch (Exception e) {
             XxlJobHelper.log(e.getMessage());
             return ReturnT.FAIL;
         }
         return ReturnT.SUCCESS;
     }
+
+    //���������������
+    @XxlJob("insertHistoryWeekly")
+    public ReturnT insertHistoryWeekly() {
+        try {
+            historyWeeklyService.insertHistoryWeekly();
+        } catch (Exception e) {
+            XxlJobHelper.log(e.getMessage());
+            return new ReturnT(ReturnT.FAIL_CODE, e.getMessage());
+        }
+        return ReturnT.SUCCESS;
+    }
+
+    //���������������
+    @XxlJob("insertHistoryMonthly")
+    public ReturnT insertHistoryMonthly() {
+        try {
+            historyMonthlyService.insertHistoryMonthly();
+        } catch (Exception e) {
+            XxlJobHelper.log(e.getMessage());
+            return new ReturnT(ReturnT.FAIL_CODE, e.getMessage());
+        }
+        return ReturnT.SUCCESS;
+    }
+
+    //������������������������
+    @XxlJob("historyHourlySupplement")
+    public ReturnT historyHourlySupplement() {
+        try {
+            historyHourlyService.insertHistoryHourly();
+        } catch (Exception e) {
+            XxlJobHelper.log(e.getMessage());
+            return new ReturnT(ReturnT.FAIL_CODE, e.getMessage());
+        }
+        return ReturnT.SUCCESS;
+    }
+
+    //���������������������������������������������������������������
+    @XxlJob("insertHistoryHourlyComplete")
+    public ReturnT insertHistoryHourlyComplete(){
+        try {
+            historyHourlyService.insertHistoryHourlyComplete();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ReturnT(ReturnT.FAIL_CODE, e.getMessage());
+        }
+        return ReturnT.SUCCESS;
+    }
+
+    @XxlJob("dateToChangShu")
+    public ReturnT dateToChangShu(){
+        try {
+            historyHourlyService.dateToChangShu(null);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ReturnT(ReturnT.FAIL_CODE, e.getMessage());
+        }
+        return ReturnT.SUCCESS;
+    }
 }

--
Gitblit v1.8.0