package doumeemes.task;
|
|
|
import doumeemes.biz.system.SystemDictDataBiz;
|
import doumeemes.core.utils.DateUtil;
|
import doumeemes.service.business.BizLingyangService;
|
import doumeemes.service.business.PlansService;
|
import doumeemes.service.ext.*;
|
import doumeemes.service.system.SystemDictService;
|
import doumeemes.service.system.impl.SystemDictServiceImpl;
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.stereotype.Component;
|
|
/**
|
* 定时任务
|
* @author jiangping
|
* @date 2021-10-10 14:40:35
|
* https://www.bejson.com/othertools/cron/ cron 表达式生成地址
|
*/
|
@Component
|
public class ScheduleTool {
|
@Autowired
|
public RabbitTemplate rabbitTemplate;
|
@Autowired
|
DepartmentExtService departmentExtService;
|
@Autowired
|
BizLingyangService bizLingyangService;
|
@Autowired
|
BarcodeParamExtService barcodeParamExtService;
|
@Autowired
|
CategoryExtService categoryExtService;
|
@Autowired
|
ProceduresExtService proceduresExtService;
|
@Autowired
|
PlansExtService plansExtService;
|
@Autowired
|
SystemDictDataBiz systemDictDataBiz;
|
@Autowired
|
WorkorderExtService workorderExtService;
|
|
/**
|
* 初始化全部企业部门数据
|
* @throws Exception
|
*/
|
@Scheduled(fixedDelay = 1000 * 60 * 60 * 24)
|
public void syncDepartment() throws Exception {
|
System.out.println("定时加载企业部门缓存信息--------Begin------");
|
departmentExtService.loadAllDepart();
|
System.out.println("定时加载企业部门缓存信息--------end------");
|
}
|
|
/**
|
* 初始化全部企业二维码数据
|
* @throws Exception
|
*/
|
@Scheduled(fixedDelay = 1000 * 60 * 60 * 24)
|
public void syncBarcode() throws Exception {
|
System.out.println("定时加载企业二维码缓存信息--------Begin------");
|
barcodeParamExtService.loadAll();
|
System.out.println("定时加载企业二维码缓存信息--------end------");
|
}
|
/**
|
* 初始化全部企业全部分类
|
* @throws Exception
|
*/
|
@Scheduled(fixedDelay = 1000 * 60 * 60 * 24)
|
public void syncCategory() throws Exception {
|
System.out.println("定时加载企业分类信息缓存信息--------Begin------");
|
categoryExtService.loadAll();
|
System.out.println("定时加载企业分类信息缓存信息--------end------");
|
}
|
/**
|
* 初始化全部企业工序数据
|
* @throws Exception
|
*/
|
@Scheduled(fixedDelay = 1000 * 60 * 60 * 24)
|
public void syncProcedures() throws Exception {
|
System.out.println("定时加载企业工序缓存信息--------Begin------");
|
proceduresExtService.loadAll();
|
System.out.println("定时加载企业工序缓存信息--------end------");
|
}
|
@Scheduled(fixedDelay = 1000 * 60 * 60 * 1)
|
public void updatEdgpAccessToken() throws Exception {
|
System.out.println("定时更新edgp平台访问授权码--------Begin------");
|
systemDictDataBiz.updatEdgpAccessToken();
|
System.out.println("定时更新edgp平台访问授权码--------end------");
|
}
|
|
/**
|
* 每天凌晨重置所有企业的出入库、计划、工单code初始值
|
* @throws Exception
|
*/
|
@Scheduled(cron="0 0 0 * * ?")
|
public void initCompnayCodes() throws Exception {
|
System.out.println("定时加载数据code缓存信息--------Begin------");
|
departmentExtService.initCompnayCodes();
|
System.out.println("定时加载数据code缓存信息--------end------");
|
}
|
/**
|
* 每天定时统计羚羊数据信息
|
* @throws Exception
|
*/
|
// @Scheduled(cron="0 59 23 * * ?")
|
@Scheduled(fixedDelay = 1000 * 60 * 60 * 1)
|
public void syncLingData() throws Exception {
|
System.out.println("每天定时统计羚羊数据信息--------Begin------");
|
//TODO--------------每天定时统计羚羊数据信息------------
|
bizLingyangService.syncLingData();
|
System.out.println("每天定时统计羚羊数据信息--------end------");
|
}
|
|
/**
|
* 每天凌晨定点关闭不能关闭的计划
|
* @throws Exception
|
*/
|
@Scheduled(cron="0 0 1 * * ?")
|
public void closePlans() throws Exception {
|
System.out.println("定点关闭不能关闭的计划--------Begin------");
|
plansExtService.autoClose();
|
System.out.println("定点关闭不能关闭的计划--------end------");
|
}
|
|
}
|