From 1af705592aceadd76e3a16b963f8d43a7392652d Mon Sep 17 00:00:00 2001 From: xupei Date: Fri, 17 Oct 2025 17:59:43 +0800 Subject: [PATCH] =?UTF-8?q?BUGFIX:1.design=E4=B8=ADdislike=E5=90=8E?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E6=B7=B7=E4=B9=B1=202.=E7=BB=AD=E8=AE=A2?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E9=80=9A=E7=9F=A5=E4=BC=9A=E5=86=8D=E6=AC=A1?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E4=B8=8A=E4=B8=80=E6=AC=A1=E7=9A=84=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E8=AE=A2=E9=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/CollectionSortServiceImpl.java | 16 ++++++++----- .../service/impl/PaymentInfoServiceImpl.java | 2 ++ .../ai/da/service/impl/StripeServiceImpl.java | 24 ++++++++++++++++--- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/ai/da/service/impl/CollectionSortServiceImpl.java b/src/main/java/com/ai/da/service/impl/CollectionSortServiceImpl.java index 727cbb72..52964140 100644 --- a/src/main/java/com/ai/da/service/impl/CollectionSortServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/CollectionSortServiceImpl.java @@ -269,13 +269,17 @@ public class CollectionSortServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper() + .eq(CollectionSort::getProjectId, projectId) + .orderByAsc(CollectionSort::getSort); + + if (parentId != null) { + wrapper.eq(CollectionSort::getParentId, parentId); + } else { + wrapper.isNull(CollectionSort::getParentId); + } // 2. 查询同组数据,按原排序升序 - List list = baseMapper.selectList( - new LambdaQueryWrapper() - .eq(CollectionSort::getProjectId, projectId) - .eq(CollectionSort::getParentId, parentId) - .orderByAsc(CollectionSort::getSort) - ); + List list = baseMapper.selectList(wrapper); // 3. 重新编号 sort,从 1 开始 for (int i = 0; i < list.size(); i++) { diff --git a/src/main/java/com/ai/da/service/impl/PaymentInfoServiceImpl.java b/src/main/java/com/ai/da/service/impl/PaymentInfoServiceImpl.java index 9442d076..b39843ce 100644 --- a/src/main/java/com/ai/da/service/impl/PaymentInfoServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/PaymentInfoServiceImpl.java @@ -27,6 +27,7 @@ import io.netty.util.internal.StringUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; @@ -224,6 +225,7 @@ public class PaymentInfoServiceImpl extends ServiceImpl qwSI = new QueryWrapper<>(); if (!StringUtil.isNullOrEmpty(subscriptionId)) { - qwSI.eq("subscription_id", subscriptionId); + // 区分当前订阅的时段,从而确定是新订单还是续订订单的记录 + qwSI.lambda().eq(SubscriptionInfo::getSubscriptionId, subscriptionId) + .lt(SubscriptionInfo::getCurrentPeriodStart, secondsTimestamp) + .gt(SubscriptionInfo::getCurrentPeriodEnd, secondsTimestamp); List subscriptionInfoList = subscriptionInfoMapper.selectList(qwSI); if (subscriptionInfoList.isEmpty()){ @@ -1024,7 +1035,9 @@ public class StripeServiceImpl implements StripeService { } } }else if (!StringUtil.isNullOrEmpty(orderNo)) { - qwSI.eq("order_no", orderNo); + qwSI.lambda().eq(SubscriptionInfo::getOrderNo, orderNo) + .gt(SubscriptionInfo::getCurrentPeriodStart, secondsTimestamp) + .lt(SubscriptionInfo::getCurrentPeriodEnd, secondsTimestamp); subscriptionInfo = subscriptionInfoMapper.selectOne(qwSI); if (Objects.isNull(subscriptionInfo)){ log.info("不发送邮件,原因:【根据order_no:{},查询到的subscriptionInfo为空】", orderNo); @@ -1036,7 +1049,12 @@ public class StripeServiceImpl implements StripeService { } QueryWrapper qwPI = new QueryWrapper<>(); - qwPI.eq("order_no", subscriptionInfo.getOrderNo()).orderByDesc("id"); + String periodStart = DateUtil.changeTimeStampFormat(subscriptionInfo.getCurrentPeriodStart(), "seconds", CommonConstant.TIME_FORMAT_yyyy_MM_dd_HH_mm_ss); + String periodEnd = DateUtil.changeTimeStampFormat(subscriptionInfo.getCurrentPeriodEnd(), "seconds", CommonConstant.TIME_FORMAT_yyyy_MM_dd_HH_mm_ss); + + qwPI.lambda().eq(PaymentInfo::getOrderNo, subscriptionInfo.getOrderNo()) + .between(PaymentInfo::getCreateTime, periodStart, periodEnd) + .orderByDesc(PaymentInfo::getId); List paymentInfos = paymentInfoMapper.selectList(qwPI); if (paymentInfos.isEmpty()) { log.info("不发送邮件,原因:【根据order_no:{},查询到的paymentInfos为空】", orderNo);