From 9d3fbe1b85f2feff39bf009604d9c1f6254af7a2 Mon Sep 17 00:00:00 2001 From: mrzhssss <pro6@qq.com> Date: 星期二, 07 六月 2022 13:25:26 +0800 Subject: [PATCH] 日入出库汇总新增筛选和统计功能 --- src/main/java/com/zy/asrs/task/OrderSyncScheduler.java | 51 ++++++++++++++++++++++++--------------------------- 1 files changed, 24 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/zy/asrs/task/OrderSyncScheduler.java b/src/main/java/com/zy/asrs/task/OrderSyncScheduler.java index 05d7cba..7dd3566 100644 --- a/src/main/java/com/zy/asrs/task/OrderSyncScheduler.java +++ b/src/main/java/com/zy/asrs/task/OrderSyncScheduler.java @@ -2,11 +2,14 @@ import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.zy.asrs.entity.Order; +import com.zy.asrs.service.ApiLogService; import com.zy.asrs.service.OrderService; +import com.zy.asrs.task.core.ReturnT; +import com.zy.asrs.task.handler.OrderSyncHandler; 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; @@ -14,40 +17,34 @@ * Created by vincent on 2020/7/7 */ @Slf4j -@Component +//@Component public class OrderSyncScheduler { @Autowired + private OrderSyncHandler orderSyncHandler; + @Autowired private OrderService orderService; + @Autowired + private ApiLogService apiLogService; - @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(){ - // 鎵�鏈夎鍗� - List<Order> orders = orderService.selectList(new EntityWrapper<Order>().eq("settle", 4L)); + @Scheduled(cron = "0/5 * * * * ? ") + @Async("orderThreadPool") + public void completeAndReport(){ + List<Order> orders = orderService.selectList(new EntityWrapper<Order>().eq("settle", 4L).eq("status", 1)); for (Order order : orders) { -// OpenOrderCompeteResult result = new OpenOrderCompeteResult(); -// results.add(result); -// result.setOrderNo(order.getOrderNo()); -// result.setOrderTime(order.getOrderTime()); -// result.setOrderType(order.getDocType$()); -// List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId()); -// for (OrderDetl orderDetl : orderDetls) { -// result.getOrderDetails().add(new DetlDto(orderDetl.getOrderNo(), orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getQty())); -// } -// // 淇敼璁㈠崟鐘舵�� 4.瀹屾垚 ===>> 6.宸蹭笂鎶� -// if (!orderService.updateSettle(order.getId(), 6L, null)) { -// throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳"); -// } + ReturnT<String> result = orderSyncHandler.start(order); + if (!result.isSuccess()) { + log.error("鍗曟嵁[orderNo={}]涓婃姤erp澶辫触", order.getOrderNo()); + } } } -- Gitblit v1.9.1