diff --git a/src/main/java/cn/van/business/util/JDUtils.java b/src/main/java/cn/van/business/util/JDUtils.java index 5a90b8a..f99ecba 100644 --- a/src/main/java/cn/van/business/util/JDUtils.java +++ b/src/main/java/cn/van/business/util/JDUtils.java @@ -179,7 +179,7 @@ public class JDUtils { @Scheduled(cron = "0 * * * * ?") // 每分钟执行一次 public void fetchLatestOrder() throws Exception { LocalDateTime now = LocalDateTime.now(); - LocalDateTime lastMinute = now.minusMinutes(10).withSecond(0).withNano(0); + LocalDateTime lastMinute = now.minusMinutes(30).withSecond(0).withNano(0); UnionOpenOrderRowQueryResponse response = fetchOrdersForDateTime(lastMinute, true, 1); // 真实代表实时订单 if (response != null) { @@ -207,8 +207,9 @@ public class JDUtils { * 扫描订单发送到微信 * 每分钟的30秒执行一次 */ - @Scheduled(cron = "30 * * * * ?") + @Scheduled(cron = "*/10 * * * * ?") public void sendOrderToWx() { + long start = System.currentTimeMillis(); int[] parm = {-1}; List orderRows = orderRowRepository.findByValidCodeNotInOrderByOrderTimeDesc(parm); if (!orderRows.isEmpty()) { @@ -216,6 +217,7 @@ public class JDUtils { orderToWx(orderRow, true); } } + logger.info("扫描订单发送到微信耗时:{} ms, 订单数:{} ", System.currentTimeMillis() - start, orderRows.size()); } @@ -642,7 +644,7 @@ public class JDUtils { Map skuIdViolationCountMap = filterOrdersByDays.stream().filter(orderRow -> orderRow.getValidCode() == 27 || orderRow.getValidCode() == 28 - || orderRow.getValidCode() == 2).filter(orderRow -> orderRow.getSkuName() != null).collect(Collectors.groupingBy(OrderRow::getSkuName, Collectors.counting())); + ).filter(orderRow -> orderRow.getSkuName() != null).collect(Collectors.groupingBy(OrderRow::getSkuName, Collectors.counting())); List> sortedViolationCounts = skuIdViolationCountMap.entrySet().stream() .sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).collect(Collectors.toList()); Integer num = 0; @@ -657,7 +659,7 @@ public class JDUtils { // 订单状态查询 if (order.startsWith("3") || order.startsWith("2")) { List orderRowList = orderRowRepository.findByOrderId(Long.parseLong(order)); - if (orderRowList.size() > 0) { + if (!orderRowList.isEmpty()) { OrderRow orderRow = orderRowList.get(0); content.append(getFormattedOrderInfo(orderRow, orderRow.getValidCode())); } else {