限时折扣 互斥

This commit is contained in:
2025-10-22 18:26:53 +08:00
parent a6a202ce46
commit fbd98b52a5
3 changed files with 30 additions and 13 deletions

View File

@@ -62,13 +62,18 @@ public class MkDiscountActivityServiceImpl extends ServiceImpl<MkDiscountActivit
}
@Override
public MkDiscountActivityDTO checkDiscountAct(Long shopId, boolean couponShare, boolean vipShare, boolean pointsShare) {
public MkDiscountActivityDTO checkDiscountAct(Long shopId, boolean couponShare, boolean vipShare, boolean limitRateShare, boolean pointsShare) {
MkDiscountActivityDTO activityDTO = getActivityByShopId(shopId);
AssertUtil.isNull(activityDTO, "店铺未配置满减活动");
//检查是否开启了优惠券抵扣
if (couponShare && activityDTO.getCouponShare() == 0) {
throw new CzgException("满减活动与优惠券不可共用");
}
//检查是否开启了限时折扣
if (limitRateShare && activityDTO.getDiscountShare() == 0) {
throw new CzgException("满减活动与限时折扣不可共用");
}
//检查是否开启了会员抵扣
if (vipShare && activityDTO.getVipPriceShare() == 0) {
throw new CzgException("满减活动与会员价不可共用");
@@ -87,7 +92,7 @@ public class MkDiscountActivityServiceImpl extends ServiceImpl<MkDiscountActivit
if (shopInfo.getIsEnableDiscount() == null || shopInfo.getIsEnableDiscount() == 0) {
return null;
}
MkDiscountActivity activity = mapper.selectOneByShopId(shopId,CzgStrUtils.getStrWeek());
MkDiscountActivity activity = mapper.selectOneByShopId(shopId, CzgStrUtils.getStrWeek());
if (activity == null) {
return null;
}