| | |
| | | import com.zy.common.entity.Parameter; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | |
| | | @Value("${erp.switch.ErpReportOld}") |
| | | private boolean ErpReportOld; |
| | | |
| | | @Scheduled(cron = "0 0 1 * * ? ") |
| | | public void clearApiLog() { |
| | | try { |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | @Scheduled(cron = "0 1 * * * ? ") |
| | | @Async("orderThreadPool") |
| | | public void completeAndReportOrderIssuedOnceMore() { |
| | | List<Order> orderList = orderService.selectComplete99(); |
| | | for (Order order : orderList) { |
| | | try { |
| | | ReturnT<String> result = orderSyncHandler.startOrderIssuedOnceMore(order); |
| | | if (!result.isSuccess()) { |
| | | log.error("单据[orderNo={}]再次转执行表失败:{}", order.getOrderNo(),result.getMsg()); |
| | | } |
| | | } catch (Exception e){ |
| | | log.error(e.getMessage()); |
| | | log.error("单据[orderNo={}]再次转执行表失败", order.getOrderNo()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = "0/30 * * * * ? ") |
| | | @Async("orderThreadPool") |
| | | public void completeAndReportOrderIssued() { |
| | | String erpReport = Parameter.get().getErpReport(); |
| | | if (!Cools.isEmpty(erpReport) && erpReport.equals("true")) { |
| | | // String erpReport = Parameter.get().getErpReport(); |
| | | // if (!Cools.isEmpty(erpReport) && erpReport.equals("true")) { |
| | | List<Order> orderList = orderService.selectComplete1(); |
| | | // List<Order> orderList = orderService.selectList(new EntityWrapper<Order>().eq("settle", 1L).eq("status", 1).orderBy("create_time", true)); |
| | | for (Order order : orderList) { |
| | | try { |
| | | ReturnT<String> result = orderSyncHandler.startOrderIssued(order); |
| | | if (!result.isSuccess()) { |
| | | log.error("单据[orderNo={}]上报erp失败", order.getOrderNo()); |
| | | log.error("单据[orderNo={}]转执行表失败", order.getOrderNo()); |
| | | } |
| | | } catch (Exception e){ |
| | | log.error(e.getMessage()); |
| | | log.error("单据[orderNo={}]上报erp失败", order.getOrderNo()); |
| | | log.error("单据[orderNo={}]转执行表失败", order.getOrderNo()); |
| | | } |
| | | } |
| | | } |
| | | // } |
| | | } |
| | | |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | @Async("orderThreadPool") |
| | | public void completeAndReportOrderInAndOutUtil() { |
| | | String erpReport = Parameter.get().getErpReport(); |
| | | if (!Cools.isEmpty(erpReport) && erpReport.equals("true")) { |
| | | // String erpReport = Parameter.get().getErpReport(); |
| | | // if (!Cools.isEmpty(erpReport) && erpReport.equals("true")) { |
| | | List<Order> orders = OrderInAndOutUtil.selectComplete(null); |
| | | for (Order order : orders) { |
| | | try { |
| | |
| | | log.error("单据[orderNo={}]转上报表失败", order.getOrderNo()); |
| | | } |
| | | } |
| | | } |
| | | // } |
| | | } |
| | | |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | @Scheduled(cron = "0/30 * * * * ? ") |
| | | @Async("orderThreadPool") |
| | | public void completeAndReportOrderReport() { |
| | | if (!ErpReportOld){ |
| | | return; |
| | | } |
| | | String erpReport = Parameter.get().getErpReport(); |
| | | if (!Cools.isEmpty(erpReport) && erpReport.equals("true")) { |
| | | List<Order> orders = orderService.selectComplete(); |