1.在系统监控---->定时任务中新增定时计划
2.后台java方法
@Service("smsSendTask") public class SmsSendTask implements Job{ @Autowired private TSSmsServiceI tSSmsService; /*@Scheduled(cron="0 0/1 * * * ?")*/ public void run() { long start = System.currentTimeMillis(); org.jeecgframework.core.util.LogUtil.info("===================推送消息定时任务开始==================="); try { tSSmsService.send(); } catch (Exception e) { e.printStackTrace(); } org.jeecgframework.core.util.LogUtil.info("===================推送消息定时任务结束==================="); long end = System.currentTimeMillis(); long times = end - start; org.jeecgframework.core.util.LogUtil.info("总耗时"+times+"毫秒"); } @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { run(); } }
3.多数据源