This commit is contained in:
雷欧(林平凡)
2024-11-29 10:15:07 +08:00
parent 7ac0e5f94d
commit 213cf32012

View File

@@ -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<OrderRow> 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<String, Long> 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<Map.Entry<String, Long>> 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<OrderRow> 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 {