Bläddra i källkod

feature 增加定时任务

xiahan 1 år sedan
förälder
incheckning
5967b779d0

+ 2 - 0
cx-safe-check/cx-save-check-server/src/main/java/com/rongwei/RwSaveCheckApplication.java

@@ -10,6 +10,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.FilterType;
 import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
 
 @SpringBootApplication
 @EnableDiscoveryClient
@@ -17,6 +18,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
 @MapperScan("com.rongwei.*.*.dao")
 //@EnableDistributedTransaction
 @EnableAsync
+@EnableScheduling
 @ComponentScan(basePackages = {"com.rongwei"},excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE,
         classes = {BaseMetaObjectHandler.class}))
 public class RwSaveCheckApplication {

+ 2 - 0
cx-safe-check/cx-save-check-server/src/main/java/com/rongwei/savecheck/controller/CheckTemplateController.java

@@ -12,6 +12,7 @@ import com.rongwei.sfcommon.sys.service.CheckTemplateItemsService;
 import com.rongwei.sfcommon.sys.service.CheckTemplateService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
@@ -136,6 +137,7 @@ public class CheckTemplateController {
      * @param map
      * @return
      */
+    @Scheduled(cron = "0 5 0 * * ?")
     @PostMapping("/pointCheckCreate")
     public R pointCheckCreate(@RequestBody(required = false) Map<String,Object> map) {
         log.info("生成点检任务参数为:{}", map);