TASK:mixi;
This commit is contained in:
@@ -11,6 +11,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|||||||
import org.apache.commons.fileupload.FileItem;
|
import org.apache.commons.fileupload.FileItem;
|
||||||
import org.apache.commons.fileupload.FileItemFactory;
|
import org.apache.commons.fileupload.FileItemFactory;
|
||||||
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.retry.annotation.Backoff;
|
import org.springframework.retry.annotation.Backoff;
|
||||||
import org.springframework.retry.annotation.Retryable;
|
import org.springframework.retry.annotation.Retryable;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
@@ -316,8 +317,11 @@ public class MiTuExportScheduledTask {
|
|||||||
* Customer purchase report
|
* Customer purchase report
|
||||||
*/
|
*/
|
||||||
@Retryable(value = Exception.class, maxAttempts = 3, backoff = @Backoff(delay = 1000))
|
@Retryable(value = Exception.class, maxAttempts = 3, backoff = @Backoff(delay = 1000))
|
||||||
@Scheduled(cron = "0 0 23 L * ? *")
|
@Scheduled(cron = "0 0 23 28-31 * ?")
|
||||||
public void customerPurchaseReport() {
|
public void customerPurchaseReport() {
|
||||||
|
final Calendar c = Calendar.getInstance();
|
||||||
|
//如果是最后一天 则执行定时任务
|
||||||
|
if (c.get(Calendar.DATE) == c.getActualMaximum(Calendar.DATE)) {
|
||||||
MiTuExport miTuExport = createMiTuExport("Customer purchase report", "month");
|
MiTuExport miTuExport = createMiTuExport("Customer purchase report", "month");
|
||||||
try {
|
try {
|
||||||
List<TransactionData> transactionData = retrieveTransactionData();
|
List<TransactionData> transactionData = retrieveTransactionData();
|
||||||
@@ -336,6 +340,7 @@ public class MiTuExportScheduledTask {
|
|||||||
System.out.println("接口执行完成!");
|
System.out.println("接口执行完成!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private MiTuExport createMiTuExport(String fileName, String period) {
|
private MiTuExport createMiTuExport(String fileName, String period) {
|
||||||
LocalDateTime currentDateTime = LocalDateTime.now();
|
LocalDateTime currentDateTime = LocalDateTime.now();
|
||||||
@@ -703,7 +708,7 @@ public class MiTuExportScheduledTask {
|
|||||||
System.out.println("接口执行完成!");
|
System.out.println("接口执行完成!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Bean
|
||||||
public String calculateLastDayOfQuarterCron() {
|
public String calculateLastDayOfQuarterCron() {
|
||||||
// 获取当前日期
|
// 获取当前日期
|
||||||
LocalDate currentDate = LocalDate.now();
|
LocalDate currentDate = LocalDate.now();
|
||||||
|
|||||||
Reference in New Issue
Block a user