123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package com.szwl.controller;
- import com.szwl.service.TDepartmentService;
- import com.szwl.service.TShandeMchService;
- import com.szwl.service.es.EsTCoinOrderService;
- import com.szwl.service.es.EsTOrderService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.context.annotation.Configuration;
- import org.springframework.scheduling.annotation.EnableScheduling;
- import org.springframework.scheduling.annotation.Scheduled;
- import org.springframework.stereotype.Component;
- import java.text.ParseException;
- import java.util.Calendar;
- @Configuration //1.主要用于标记配置类,兼备Component的效果。
- @Component
- @EnableScheduling // 2.开启定时任务
- public class ScheduledService {
- @Autowired
- private TShandeMchService tShandeMchService;
- @Autowired
- EsTCoinOrderService esTCoinOrderService;
- @Autowired
- EsTOrderService esTOrderService;
- //每天凌晨统计/核对杉德支付的金额表
- @Scheduled(cron = "30 05 0 * * ?")
- public void shandejiesuan(){
- tShandeMchService.jiesuan();
- }
- //在每小时的20分执行一次 es同步数据
- @Scheduled(cron = "0 20 * * * ?")
- public void tongbuEs() throws ParseException {
- esTOrderService.tongbuByHour();
- esTCoinOrderService.tongbuByHour();
- }
- }
|