package com.management.task; import com.management.controller.*; 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; /** * 计划任务 * * @return null * @Author weiloong_zhang */ @Configuration @EnableScheduling public class CrmTask { @Autowired CRMTokenController crmTokenController; @Autowired PreContractController preContractController; @Autowired FrameContractController frameContractController; @Autowired XSHTController xshtController; @Autowired DesignController designController; @Autowired GoodsPlanController goodsPlanController; @Autowired InvoiceController invoiceController; @Autowired QualityBackController qualityBackController; @Autowired TenderingController tenderingController; @Autowired BankInfoController bankInfoController; @Autowired ReimbursementController reimbursementController; /** * 定时任务获取纷享销客token * * @return void * @Author weiloong_zhang */ @Scheduled(cron = "0 0/60 * * * ?") private void crmTokenTask() { crmTokenController.getCRMToken(); } /** * 定时任务同步ERP数据 * * @return void * @Author weiloong_zhang */ @Scheduled(cron = "0 0/1 * * * ?") private void configureTasks() throws Exception { System.out.println("开始同步ERP数据"); crmTokenController.tokenReSync(); preContractController.syncContract(); preContractController.bgPreContract(); frameContractController.syncFrameContract(); frameContractController.syncFrameContractBG(); xshtController.syncXSHT(); xshtController.XSHTBGSync(); xshtController.isComplete(); designController.syncDesign(); designController.upDesignDoc(); goodsPlanController.syncGoodsPlan(); invoiceController.syncInvoice(); invoiceController.syncRedInvoice(); invoiceController.deleteInvoice(); qualityBackController.qualityFeedBack(); tenderingController.syncTendering(); bankInfoController.syncBankInfo(); reimbursementController.syncReimbursement(); reimbursementController.syncPublicExpenses(); reimbursementController.syncTravelExpenses(); System.out.println("ERP数据执行完毕"); } }