From 9c5c40fe909036ebb54979705f92644d9c0d3adf Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 10 Sep 2024 12:46:49 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E8=AF=84=E5=AE=A1?= =?UTF-8?q?=E3=80=91=E5=95=86=E5=9F=8E=EF=BC=9A=E6=BB=A1=E5=87=8F=E9=80=81?= =?UTF-8?q?=E7=9A=84=E6=A0=A1=E9=AA=8C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/promotion/api/reward/RewardActivityApi.java | 2 +- .../promotion/dal/mysql/reward/RewardActivityMapper.java | 4 ++-- .../promotion/service/reward/RewardActivityServiceImpl.java | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/reward/RewardActivityApi.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/reward/RewardActivityApi.java index 2a941e051..68f76a1fa 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/reward/RewardActivityApi.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/reward/RewardActivityApi.java @@ -16,7 +16,7 @@ public interface RewardActivityApi { * 获得当前时间内开启的满减送活动 * * @param status 状态 - * @param dateTime 时间 + * @param dateTime 当前时间,即筛选 <= dateTime 的满减送活动 * @return 满减送活动列表 */ List getRewardActivityListByStatusAndNow(Integer status, LocalDateTime dateTime); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/reward/RewardActivityMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/reward/RewardActivityMapper.java index f8b8d5ccb..6f377fb60 100755 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/reward/RewardActivityMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/reward/RewardActivityMapper.java @@ -28,8 +28,8 @@ public interface RewardActivityMapper extends BaseMapperX { default List selectListByStatusAndDateTimeLt(Integer status, LocalDateTime dateTime) { return selectList(new LambdaQueryWrapperX() .eq(RewardActivityDO::getStatus, status) - .lt(RewardActivityDO::getStartTime, dateTime) - .gt(RewardActivityDO::getEndTime, dateTime)// 开始时间 < 指定时间 < 结束时间,也就是说获取指定时间段的活动 + // 开始时间 < 指定时间(dateTime) < 结束时间,也就是说获取指定时间段的活动 + .lt(RewardActivityDO::getStartTime, dateTime).gt(RewardActivityDO::getEndTime, dateTime) .orderByAsc(RewardActivityDO::getStartTime) ); } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/reward/RewardActivityServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/reward/RewardActivityServiceImpl.java index f8299edea..fcd650c28 100755 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/reward/RewardActivityServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/reward/RewardActivityServiceImpl.java @@ -121,6 +121,8 @@ public class RewardActivityServiceImpl implements RewardActivityService { list.removeIf(activity -> id.equals(activity.getId())); } + // TODO @puhui999:这个可能要完整对标有赞的校验。完全不允许重叠。 + // 例如说,rewardActivity 是全部活动,结果有个 db 里的 activity 是某个分类,它也是冲突的。也就是说,当前时间段内,有且仅有只能有一个活动! for (RewardActivityDO item : list) { // 1.1 校验满减送活动时间是否冲突,如果时段不冲突那么不同的时间段内则可以存在相同的商品范围 if (!LocalDateTimeUtil.isOverlap(item.getStartTime(), item.getEndTime(),