不可使用愿意 优惠券 列表
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 < now()
|
||||
and inRecord.use_end_time > now()
|
||||
|
||||
Reference in New Issue
Block a user