From a458c6231fb8ff8d231ba3829cefebe49c099c48 Mon Sep 17 00:00:00 2001 From: sunjiabei Date: Wed, 10 Dec 2025 11:40:25 +0800 Subject: [PATCH] =?UTF-8?q?12=E6=9C=8810=E6=97=A5=E9=93=B6=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/serviceImpl/cash/BankServiceImpl.java | 44 +++++++++++++--------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/example/demo/serviceImpl/cash/BankServiceImpl.java b/src/main/java/com/example/demo/serviceImpl/cash/BankServiceImpl.java index ed59160..fc558bc 100644 --- a/src/main/java/com/example/demo/serviceImpl/cash/BankServiceImpl.java +++ b/src/main/java/com/example/demo/serviceImpl/cash/BankServiceImpl.java @@ -233,15 +233,15 @@ public class BankServiceImpl implements BankService { // 获取订单号 String orderNo = paymentDTO.getMerchant_reference(); - // 查询金币系统中的订单 - CashCollection cashCollection = cashCollectionMapper.selectByGoldCoinOrderCode(orderNo); - if (cashCollection != null) { - // 更新金币系统中的订单信息 + List orderNoList = cashCollectionMapper.selectStripeList(); + // 检查当前订单号是否在列表中 + if (orderNoList.contains(orderNo)) { cashCollectionMapper.updateByGoldCoinOrderCodeByPayment(paymentDTO); processedPayments.add(paymentDTO); log.info("成功处理订单: {}", orderNo); messages.add("成功处理订单: " + orderNo); - } else { + } + else { log.warn("金币系统中未找到订单: {}", orderNo); messages.add("金币系统中未找到订单: " + orderNo); } @@ -366,10 +366,12 @@ public class BankServiceImpl implements BankService { // 添加到列表中 stripeDTOList.add(stripeDTO); - // 如果订单号存在,则更新数据库中的记录 + // 如果订单号存在,且在selectStripeList返回的列表中,则更新数据库中的记录 if (stripeDTO.getOrderNo() != null && !stripeDTO.getOrderNo().isEmpty()) { - CashCollection cashCollection = cashCollectionMapper.selectByGoldCoinOrderCode(stripeDTO.getOrderNo()); - if (cashCollection != null) { + // 获取需要处理的订单号列表 + List orderNoList = cashCollectionMapper.selectStripeList(); + // 检查当前订单号是否在列表中 + if (orderNoList.contains(stripeDTO.getOrderNo())) { cashCollectionMapper.updateByGoldCoinOrderCodeByStripe(stripeDTO); } } @@ -722,20 +724,28 @@ public class BankServiceImpl implements BankService { try { // 生成昨天的日期,格式为yyyyMMdd DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); - LocalDate yesterday = LocalDate.now().minusDays(7); - String yesterdayStr = yesterday.format(formatter); + LocalDate sevenDayAgo = LocalDate.now().minusDays(7); + String sevenDayAgoStr = sevenDayAgo.format(formatter); + LocalDate sixDayAgo = LocalDate.now().minusDays(6); + String sixDayAgoStr = sixDayAgo.format(formatter); + LocalDate fiveDayAgo = LocalDate.now().minusDays(5); + String fiveDayAgoStr = fiveDayAgo.format(formatter); + LocalDate fourDayAgo = LocalDate.now().minusDays(4); + String fourDayAgoStr = fourDayAgo.format(formatter); + LocalDate threeDayAgo = LocalDate.now().minusDays(3); + String threeDayAgoStr = threeDayAgo.format(formatter); + LocalDate twoDayAgo = LocalDate.now().minusDays(2); + String twoDayAgoStr = twoDayAgo.format(formatter); + LocalDate oneDayAgo = LocalDate.now().minusDays(1); + String oneDayAgoStr = oneDayAgo.format(formatter); LocalDate today = LocalDate.now(); String todayStr = today.format(formatter); -// LocalDate yesterday = LocalDate.now().minusDays(2); -// String yesterdayStr = yesterday.format(formatter); -// LocalDate today = LocalDate.now().minusDays(1); -// String todayStr = today.format(formatter); // 创建BankDTO实例并设置时间 BankDTO dto = new BankDTO(); - dto.setTime(yesterdayStr); - dto.setStartTime(yesterdayStr); + + dto.setStartTime(fiveDayAgoStr); dto.setEndTime(todayStr); - dto.setTime(yesterdayStr); + dto.setTime(sixDayAgoStr); dto.setSum(1000); // 依次调用各个自动处理方法