LIVE_YE před 2 měsíci
rodič
revize
f32ca5504a

+ 4 - 0
ruoyi-modules/ruoyi-wuye/pom.xml

@@ -102,6 +102,10 @@
             <groupId>org.dromara</groupId>
             <artifactId>ruoyi-system</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+        </dependency>
 
     </dependencies>
 

+ 46 - 0
ruoyi-modules/ruoyi-wuye/src/main/java/org/dromara/service/impl/Task.java

@@ -0,0 +1,46 @@
+package org.dromara.service.impl;
+
+
+import com.google.gson.Gson;
+import org.dromara.common.core.utils.DateUtils;
+import org.dromara.domain.checkPoint.bo.CheckPointManageBo;
+import org.dromara.domain.checkPoint.bo.CheckPointRecordBo;
+import org.dromara.domain.checkPoint.vo.CheckPointManageVo;
+import org.dromara.service.ICheckPointManageService;
+import org.dromara.service.ICheckPointRecordService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 定时任务
+* @author tang
+ */
+@Component
+public class Task {
+    @Autowired
+    private ICheckPointManageService checkPointManageService;
+    @Autowired
+    private ICheckPointRecordService checkPointRecordService;
+    private static final Gson GSON = new Gson();
+    /***
+     *每日巡更记录的定时任务
+     * 每天23点执行
+     */
+    @Async
+    @Scheduled(cron = "0 0 23 * * ? ")
+    public void popover() throws Exception {
+        CheckPointManageBo checkPointManage = new CheckPointManageBo();
+        List<CheckPointManageVo> checkPointManages = checkPointManageService.queryList(checkPointManage);
+        if (checkPointManages != null && !checkPointManages.isEmpty()){
+            for (CheckPointManageVo pointManage : checkPointManages) {
+                CheckPointRecordBo checkPointRecord = GSON.fromJson(GSON.toJson(pointManage), CheckPointRecordBo.class);
+                checkPointRecord.setCreateTime(DateUtils.getNowDate());
+                checkPointRecordService.insertByBo(checkPointRecord);
+            }
+        }
+    }
+}