LIVE_YE 2 年 前
コミット
95dbbd1bf1

+ 12 - 12
ruoyi-admin/pom.xml

@@ -35,6 +35,18 @@
             <artifactId>junit</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.8.7</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.sun.mail</groupId>
+            <artifactId>javax.mail</artifactId>
+            <version>1.6.2</version>
+        </dependency>
+
 
         <!-- swagger3-->
         <dependency>
@@ -73,18 +85,6 @@
             <artifactId>ruoyi-generator</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>cn.hutool</groupId>
-            <artifactId>hutool-all</artifactId>
-            <version>5.8.7</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.sun.mail</groupId>
-            <artifactId>javax.mail</artifactId>
-            <version>1.6.2</version>
-        </dependency>
-
     </dependencies>
 
     <build>

+ 8 - 3
ruoyi-system/src/main/java/com/ruoyi/system/service/Task.java

@@ -1,5 +1,6 @@
 package com.ruoyi.system.service;
 
+
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.extra.mail.MailUtil;
 import com.ruoyi.common.core.domain.entity.SysDept;
@@ -17,6 +18,7 @@ import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
+import java.io.File;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -35,7 +37,7 @@ public class Task {
     /***
      * 邮件发送(定时比对数据后发送邮件)
      */
-    //@Scheduled(cron = "0 0 * * * ? ")
+    @Scheduled(cron = "0 0 * * * ? ")
     public void thirdNucleicAcid() {
         try {
             SysDept dept = new SysDept();
@@ -214,10 +216,13 @@ public class Task {
                 mapList.add(map);
             }
             String path = ExcelUtils.getInstance().createExcel(mapList, "核酸对比数据", "对比数据");
-            MailUtil.send("1434745622@qq.com", "重点人群定时对比数据", "时间:"+startTime+"--"+endTime, true,
+            MailUtil.send("qsxzhb@126.com", "重点人群定时对比数据", "时间:"+startTime+"--"+endTime, true,
                     FileUtil.file(path));
-            MailUtil.send("1434899932@qq.com", "重点人群定时对比数据", "时间:"+startTime+"--"+endTime, true,
+            MailUtil.send("731020@qq.com", "重点人群定时对比数据", "时间:"+startTime+"--"+endTime, true,
                     FileUtil.file(path));
+            //删除系统文件
+            File file = new File(path);
+            file.delete();
 
         } catch (Exception e) {
             e.printStackTrace();

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/system/utils/ExcelUtils.java

@@ -97,7 +97,7 @@ public class ExcelUtils {
         Date date = new Date();
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
         // 使用项目根目录, 文件名加上时间戳
-        String path = System.getProperty("user.dir") + "\\" + filename + dateFormat.format(date) + ".xlsx";
+        String path = System.getProperty("user.dir") + "/" + filename + dateFormat.format(date) + ".xlsx";
         System.out.println("Excel文件输出路径: "+path);
         try {
             File file = new File(path);