From 1c0dbad152362ac704a27ecfc5b5d08247385d87 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期二, 21 十月 2025 17:12:48 +0800
Subject: [PATCH] 13
---
src/main/java/com/zy/asrs/task/OrderSyncScheduler.java | 77 ++++++++++++++++++++++++++++++--------
1 files changed, 61 insertions(+), 16 deletions(-)
diff --git a/src/main/java/com/zy/asrs/task/OrderSyncScheduler.java b/src/main/java/com/zy/asrs/task/OrderSyncScheduler.java
index cf74bfc..7791532 100644
--- a/src/main/java/com/zy/asrs/task/OrderSyncScheduler.java
+++ b/src/main/java/com/zy/asrs/task/OrderSyncScheduler.java
@@ -1,10 +1,24 @@
package com.zy.asrs.task;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.core.common.Cools;
+import com.zy.asrs.entity.OrderPakin;
+import com.zy.asrs.entity.OrderDetlReport;
+import com.zy.asrs.entity.OrderDetlReportLog;
+import com.zy.asrs.service.ApiLogService;
+import com.zy.asrs.service.OrderDetlReportLogService;
+import com.zy.asrs.service.OrderDetlReportService;
import com.zy.asrs.service.OrderService;
+import com.zy.asrs.task.core.ReturnT;
+import com.zy.asrs.task.handler.OrderSyncHandler;
+import com.zy.common.entity.Parameter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
+
+import java.util.List;
/**
* Created by vincent on 2020/7/7
@@ -14,26 +28,57 @@
public class OrderSyncScheduler {
@Autowired
+ private OrderSyncHandler orderSyncHandler;
+ @Autowired
private OrderService orderService;
+ @Autowired
+ private ApiLogService apiLogService;
+ @Autowired
+ private OrderDetlReportService orderDetlReportService;
+ @Autowired
+ private OrderDetlReportLogService orderDetlReportLogService;
- @Scheduled(cron = "0/3 * * * * ? ")
- private void queryAndSave(){
-// for (WrkMast wrkMast : wrkMasts) {
-// ReturnT<String> result = workLogHandler.start(wrkMast);
-// if (!result.isSuccess()) {
-// log.error("宸ヤ綔妗workNo={}]鍘嗗彶妗e鐞嗗け璐�", wrkMast.getWrkNo());
-// }
-// }
+ @Scheduled(cron = "0 0 1 * * ? ")
+ public void clearApiLog() {
+ try {
+ apiLogService.clearWeekBefore();
+ } catch (Exception e) {
+ log.error("绗笁鏂规帴鍙f棩蹇楄嚜鍔ㄦ竻闄ゅけ璐ワ紙鑼冨洿锛氫竴鍛ㄤ箣鍓�", e);
+ }
}
- @Scheduled(cron = "0/3 * * * * ? ")
- private void completeAndReport(){
-// for (WrkMast wrkMast : wrkMasts) {
-// ReturnT<String> result = workLogHandler.start(wrkMast);
-// if (!result.isSuccess()) {
-// log.error("宸ヤ綔妗workNo={}]鍘嗗彶妗e鐞嗗け璐�", wrkMast.getWrkNo());
-// }
-// }
+ @Scheduled(cron = "0/30 * * * * ? ")
+ public void clearReportLog() {
+ try {
+ List<OrderDetlReport> orderDetls = orderDetlReportService.selectList(new EntityWrapper<OrderDetlReport>());
+ for (OrderDetlReport orderDetl : orderDetls) {
+ OrderPakin order = orderService.selectByNo(orderDetl.getOrderNo());
+ if (order == null) {
+ OrderDetlReportLog orderDetlReportLog = new OrderDetlReportLog();
+ orderDetlReportLog.sync(orderDetl);
+ orderDetlReportLog.setId(null);
+ orderDetlReportLogService.insert(orderDetlReportLog);
+ orderDetlReportService.deleteById(orderDetl.getId());
+ }
+ }
+ } catch (Exception e) {
+ log.error("涓婃姤鏃ュ織鍒犻櫎", e);
+ }
+ }
+
+ @Scheduled(cron = "0/5 * * * * ? ")
+ @Async("orderThreadPool")
+ public void completeAndReport() {
+ String erpReport = Parameter.get().getErpReport();
+ if (!Cools.isEmpty(erpReport) && erpReport.equals("true")) {
+ List<OrderPakin> orders = orderService.selectComplete();
+ for (OrderPakin order : orders) {
+ ReturnT<String> result = orderSyncHandler.start(order);
+ if (!result.isSuccess()) {
+ log.error("鍗曟嵁[orderNo={}]涓婃姤erp澶辫触", order.getOrderNo());
+ }
+ }
+ }
}
}
--
Gitblit v1.9.1