不可使用愿意 优惠券 列表

This commit is contained in:
2025-09-27 09:57:09 +08:00
parent a069d14657
commit 9dbd002211
9 changed files with 27 additions and 14 deletions

View File

@@ -23,7 +23,7 @@ public interface MkShopCouponRecordMapper extends BaseMapper<MkShopCouponRecord>
List<UserCouponVO> findCouponVOByUser(String name, List<Long> shopUserIds, Integer status);
List<UserCouponVo> queryByVipIdAndShopId(Long shopId, Long shopUserId, Integer type);
List<UserCouponVo> queryByVipIdAndShopId(Long shopId, Long shopUserId, Integer type, Integer isFood);
List<ShopInfoCouponVO> getShopByCouponRecord(Long userId);
}

View File

@@ -72,8 +72,8 @@ public class MkShopCouponRecordServiceImpl extends ServiceImpl<MkShopCouponRecor
}
@Override
public List<UserCouponVo> queryByVipIdAndShopId(Long shopId, Long shopUserId, Integer type) {
return getMapper().queryByVipIdAndShopId(shopId, shopUserId, type);
public List<UserCouponVo> queryByVipIdAndShopId(Long shopId, Long shopUserId, Integer type, Integer isFood) {
return getMapper().queryByVipIdAndShopId(shopId, shopUserId, type, isFood);
}

View File

@@ -284,8 +284,8 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
}
@Override
public List<UserCouponVo> findCoupon(Long shopId, Long shopUserId, Integer type) {
List<UserCouponVo> tbUserCouponVos = recordService.queryByVipIdAndShopId(shopId, shopUserId, type);
public List<UserCouponVo> findCoupon(Long shopId, Long shopUserId, Integer type, Integer isFood) {
List<UserCouponVo> tbUserCouponVos = recordService.queryByVipIdAndShopId(shopId, shopUserId, type, isFood);
if (CollectionUtil.isNotEmpty(tbUserCouponVos)) {
String week = DateUtil.dayOfWeekEnum(new Date()).toChinese("");
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
@@ -418,6 +418,7 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
useRestrictions = new StringBuilder(tbShopCoupon.getUseDays() + " ");
}
if (!tbShopCoupon.getUseDays().contains(week)) {
tbUserCouponVo.setNoUseRestrictions("不在可用时间范围内");
isUse = false;
}
}
@@ -427,12 +428,15 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
LocalTime endTime = tbShopCoupon.getUseEndTime().toLocalTime();
if (currentTime.isBefore(startTime)) {
if (startTime.isBefore(endTime)) {
tbUserCouponVo.setNoUseRestrictions("不在可用时间范围内");
isUse = false;
} else if (currentTime.isAfter(endTime)) {
tbUserCouponVo.setNoUseRestrictions("不在可用时间范围内");
isUse = false;
}
} else if (startTime.isBefore(endTime)) {
if (currentTime.isAfter(endTime)) {
tbUserCouponVo.setNoUseRestrictions("不在可用时间范围内");
isUse = false;
}
}

View File

@@ -108,9 +108,16 @@
<if test="shopId != null and shopId != ''">
and inRecord.shop_id = #{shopId}
</if>
<if test="type != null ">
and inRecord.type = #{type}
</if>
<choose>
<when test="type != null ">
and inRecord.type = #{type}
</when>
<otherwise>
<if test="isFood != null">
and inRecord.type != 2
</if>
</otherwise>
</choose>
and inRecord.status = 0
and inRecord.use_start_time &lt; now()
and inRecord.use_end_time &gt; now()