From b62a18196dc7ede82d17a51fe1f0973c7b0983ab Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期三, 09 八月 2023 16:43:39 +0800
Subject: [PATCH] 1

---
 src/main/java/com/yssh/config/ScheduleConfig.java         |   42 ++++++++++++++++----
 src/main/java/com/yssh/service/WarningAnalyseService.java |    8 +++-
 src/main/java/com/yssh/service/XlsExportService.java      |   11 ++---
 3 files changed, 43 insertions(+), 18 deletions(-)

diff --git a/src/main/java/com/yssh/config/ScheduleConfig.java b/src/main/java/com/yssh/config/ScheduleConfig.java
index 4a1aa1e..8058abd 100644
--- a/src/main/java/com/yssh/config/ScheduleConfig.java
+++ b/src/main/java/com/yssh/config/ScheduleConfig.java
@@ -10,10 +10,7 @@
 import com.yssh.entity.DictRecord;
 import com.yssh.entity.SuYuan;
 import com.yssh.entity.VocVals;
-import com.yssh.service.DictRecordService;
-import com.yssh.service.SuYuanService;
-import com.yssh.service.VocValsService;
-import com.yssh.service.WarningAnalyseService;
+import com.yssh.service.*;
 import com.yssh.utils.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -32,19 +29,22 @@
 	protected final Logger logger = LoggerFactory.getLogger(this.getClass());
 
 	@Resource
-	private VocValsService vocValsService;
+	VocValsService vocValsService;
 
 	@Resource
-	private SuYuanService suYuanService;
+	SuYuanService suYuanService;
 
 	@Resource
-	private CsvFilePathConfig csvFilePathConfig;
+	CsvFilePathConfig csvFilePathConfig;
 
 	@Resource
-	private DictRecordService dictRecordService;
+	DictRecordService dictRecordService;
 
 	@Resource
-	private WarningAnalyseService warningAnalyseService;
+	WarningAnalyseService warningAnalyseService;
+
+	@Resource
+	XlsExportService xlsExportService;
 
 	@Value("${csv.voc_max}")
 	private int vocMax = 96;
@@ -188,4 +188,28 @@
 		}
 		warningAnalyseService.warningOperationStorage(date);
 	}
+
+	/**
+	 * 鍒涘缓鏃ユ姤锛氭瘡鏃�0鏃�1鍒�
+	 */
+	@Scheduled(cron = "0 1 0 * * ?")
+	public void createDayReport() {
+		xlsExportService.createDayReport(new Date());
+	}
+
+	/**
+	 * 鍒涘缓鍛ㄦ姤锛氭瘡鍛ㄤ竴0鏃�5鍒�
+	 */
+	@Scheduled(cron = "0 5 0 ? * MON")
+	public void createWeekReport() {
+		xlsExportService.createWeekReport(new Date());
+	}
+
+	/**
+	 * 鍒涘缓鏈堟姤锛氭瘡鏈�1鏃�0鏃�9鍒�
+	 */
+	@Scheduled(cron = "0 9 0 1 * ?")
+	public void createMonthReport() {
+		xlsExportService.createMonthReport(new Date());
+	}
 }
diff --git a/src/main/java/com/yssh/service/WarningAnalyseService.java b/src/main/java/com/yssh/service/WarningAnalyseService.java
index 5fc3490..3e3a2d4 100644
--- a/src/main/java/com/yssh/service/WarningAnalyseService.java
+++ b/src/main/java/com/yssh/service/WarningAnalyseService.java
@@ -237,7 +237,9 @@
         return null;
     }
 
-    // 宸插簾寮� *
+    /**
+     * 瀛樺偍鍛婅/棰勮淇℃伅
+     */
     public void warningOperationStorage(Date date) {
         List<WarningDetail> allData = new ArrayList<>();
         List<WarningDetail> alarms = this.getAlarmWarnAnalyse(date, false);
@@ -260,7 +262,9 @@
         }
     }
 
-    // 宸插簾寮� *
+    /**
+     * 鑾峰彇鍛婅/棰勮鍒嗘瀽
+     */
     private List<WarningDetail> getAlarmWarnAnalyse(Date date, boolean isWarn) {
         List<String> ids = CalculateUtils.assembleId(commonService.getCheckPoints3d());
 
diff --git a/src/main/java/com/yssh/service/XlsExportService.java b/src/main/java/com/yssh/service/XlsExportService.java
index e8964c7..19f710f 100644
--- a/src/main/java/com/yssh/service/XlsExportService.java
+++ b/src/main/java/com/yssh/service/XlsExportService.java
@@ -12,10 +12,7 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * Excel瀵煎嚭鏈嶅姟绫�
@@ -65,7 +62,7 @@
     /**
      * 鍒涘缓鏃ユ姤
      */
-    public void createDayReport() {
+    public void createDayReport(Date date) {
         try {
             String type = "day";
             List<DayExcel> list = new ArrayList<>();
@@ -86,7 +83,7 @@
     /**
      * 鍒涘缓鍛ㄦ姤
      */
-    public void createWeekReport() {
+    public void createWeekReport(Date date) {
         try {
             String type = "week";
             List<WeekExcel> list = new ArrayList<>();
@@ -107,7 +104,7 @@
     /**
      * 鍒涘缓鏈堟姤
      */
-    public void createMonthReport() {
+    public void createMonthReport(Date date) {
         try {
             String type = "month";
             List<MonthExcel> list = new ArrayList<>();

--
Gitblit v1.9.3