|
@@ -0,0 +1,40 @@
|
|
|
+package org.springblade.control.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.control.entity.*;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.time.LocalDate;
|
|
|
+
|
|
|
+@Service
|
|
|
+@AllArgsConstructor
|
|
|
+public class PublicScheduledTaskServiceImpl {
|
|
|
+
|
|
|
+ private final EMFinancialReimbursementServiceImpl emFinancialReimbursementService;
|
|
|
+ private final EMInvoiceServiceImpl emInvoiceService;
|
|
|
+ private final EMLoanServiceImpl emLoanService;
|
|
|
+ private final EMOutsourcingPayServiceImpl emOutsourcingPayService;
|
|
|
+ private final EMPayServiceImpl emPayService;
|
|
|
+ private final EMPurchaseServiceImpl emPurchaseService;
|
|
|
+ private final EMUseCarServiceImpl emUseCarService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 定时删除费用管理的草稿数据信息
|
|
|
+ * cron = 三个月执行一次
|
|
|
+ */
|
|
|
+ @Scheduled(cron = "0 0 0 1 */3 ?")
|
|
|
+ void delDraftDataInfo() {
|
|
|
+ LocalDate currentDate = LocalDate.now(); //当前时间
|
|
|
+ LocalDate threeMonthsAgo = currentDate.minusMonths(3); //三个月前的时间
|
|
|
+ emFinancialReimbursementService.remove(Wrappers.<EMFinancialReimbursementInfo>lambdaQuery().eq(EMFinancialReimbursementInfo::getIsTemp, 0).le(EMFinancialReimbursementInfo::getCreateTime, threeMonthsAgo));
|
|
|
+ emInvoiceService.remove(Wrappers.<EMInvoiceInfo>lambdaQuery().eq(EMInvoiceInfo::getIsTemp, 0).le(EMInvoiceInfo::getCreateTime, threeMonthsAgo));
|
|
|
+ emLoanService.remove(Wrappers.<EMLoanInfo>lambdaQuery().eq(EMLoanInfo::getIsTemp, 0).le(EMLoanInfo::getCreateTime, threeMonthsAgo));
|
|
|
+ emOutsourcingPayService.remove(Wrappers.<EMOutsourcingPayInfo>lambdaQuery().eq(EMOutsourcingPayInfo::getIsTemp, 0).le(EMOutsourcingPayInfo::getCreateTime, threeMonthsAgo));
|
|
|
+ emPayService.remove(Wrappers.<EMPayInfo>lambdaQuery().eq(EMPayInfo::getIsTemp, 0).le(EMPayInfo::getCreateTime, threeMonthsAgo));
|
|
|
+ emPurchaseService.remove(Wrappers.<EMPurchaseInfo>lambdaQuery().eq(EMPurchaseInfo::getIsTemp, 0).le(EMPurchaseInfo::getCreateTime, threeMonthsAgo));
|
|
|
+ emUseCarService.remove(Wrappers.<EMUseCarInfo>lambdaQuery().eq(EMUseCarInfo::getIsTemp, 0).le(EMUseCarInfo::getCreateTime, threeMonthsAgo));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|