parent
0104323702
commit
7e6b791ac9
|
|
@ -15,7 +15,7 @@ import com.czg.market.entity.MkDiscountActivity;
|
|||
public interface MkDiscountActivityService extends IService<MkDiscountActivity> {
|
||||
Page<MkDiscountActivityDTO> getActivityPage(TimeQueryParam param, Long shopId);
|
||||
|
||||
MkDiscountActivityDTO checkDiscountAct(Long shopId, boolean couponShare, boolean vipShare, boolean limitRateShare, boolean pointsShare);
|
||||
MkDiscountActivityDTO checkDiscountAct(Long discountActId, boolean couponShare, boolean vipShare, boolean limitRateShare, boolean pointsShare);
|
||||
|
||||
MkDiscountActivityDTO getActivityByShopId(Long shopId);
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,10 @@ public class CheckOrderPay implements Serializable {
|
|||
* 满减活动抵扣金额
|
||||
*/
|
||||
private BigDecimal discountActAmount;
|
||||
/**
|
||||
* 满减活动Id
|
||||
*/
|
||||
private Long discountActId;
|
||||
/**
|
||||
* 其它优惠券抵扣金额
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ public class MkDiscountActivityServiceImpl extends ServiceImpl<MkDiscountActivit
|
|||
}
|
||||
|
||||
@Override
|
||||
public MkDiscountActivityDTO checkDiscountAct(Long shopId, boolean couponShare, boolean vipShare, boolean limitRateShare, boolean pointsShare) {
|
||||
MkDiscountActivityDTO activityDTO = getActivityByShopId(shopId);
|
||||
public MkDiscountActivityDTO checkDiscountAct(Long discountActId, boolean couponShare, boolean vipShare, boolean limitRateShare, boolean pointsShare) {
|
||||
MkDiscountActivityDTO activityDTO = getActivityById(discountActId);
|
||||
AssertUtil.isNull(activityDTO, "店铺未配置满减活动");
|
||||
//检查是否开启了优惠券抵扣
|
||||
if (couponShare && activityDTO.getCouponShare() == 0) {
|
||||
|
|
@ -105,6 +105,22 @@ public class MkDiscountActivityServiceImpl extends ServiceImpl<MkDiscountActivit
|
|||
return activityDTO;
|
||||
}
|
||||
|
||||
|
||||
private MkDiscountActivityDTO getActivityById(Long discountActId) {
|
||||
MkDiscountActivity activity = this.getById(discountActId);
|
||||
if (activity == null) {
|
||||
return null;
|
||||
}
|
||||
MkDiscountActivityDTO activityDTO = BeanUtil.toBean(activity, MkDiscountActivityDTO.class);
|
||||
activityDTO.setThresholds(thresholdMapper.selectListByQuery(
|
||||
new QueryWrapper()
|
||||
.eq(MkDiscountThreshold::getActivityId, activity.getId())
|
||||
.orderBy(MkDiscountThreshold::getFullAmount, false)
|
||||
));
|
||||
return activityDTO;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addActivity(MkDiscountActivityDTO param) {
|
||||
if (CollUtil.isEmpty(param.getThresholds())) {
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@
|
|||
AND is_del = 0
|
||||
AND status = 2
|
||||
AND NOW() BETWEEN valid_start_time AND valid_end_time
|
||||
<!-- AND (use_time_type = 'all' OR
|
||||
# (use_time_type = 'custom' AND TIME(NOW()) BETWEEN use_start_time AND use_end_time))
|
||||
# AND use_days LIKE CONCAT('%', #{useDay}, '%') -->
|
||||
AND (use_time_type = 'all' OR
|
||||
(use_time_type = 'custom' AND TIME(NOW()) BETWEEN use_start_time AND use_end_time))
|
||||
AND use_days LIKE CONCAT('%', #{useDay}, '%')
|
||||
ORDER BY sort DESC,
|
||||
update_time DESC,
|
||||
create_time DESC
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
// 满减活动校验 不为霸王餐 霸王餐不参与满减
|
||||
if (!param.isFreeDine() && param.getDiscountActAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
//检查满减活动是否开启
|
||||
discountAct = discountActService.checkDiscountAct(orderInfo.getShopId(),
|
||||
discountAct = discountActService.checkDiscountAct(param.getDiscountActId(),
|
||||
CollUtil.isNotEmpty(param.getCouponList()), param.isVipPrice(), param.getLimitRate() != null,
|
||||
param.getPointsDiscountAmount().compareTo(BigDecimal.ZERO) > 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,13 +89,14 @@ public class ShopProdCategoryServiceImpl extends ServiceImpl<ShopProdCategoryMap
|
|||
|
||||
@Override
|
||||
public void updateShopProdCategory(ShopProdCategoryDTO dto) {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
dto.setShopId(shopId);
|
||||
boolean exists = super.exists(query().eq(ShopProdCategory::getName, dto.getName()).eq(ShopProdCategory::getShopId, shopId).ne(ShopProdCategory::getId, dto.getId()));
|
||||
if (exists) {
|
||||
throw new CzgException("商品分类已存在");
|
||||
}
|
||||
ShopProdCategory entity = BeanUtil.copyProperties(dto, ShopProdCategory.class);
|
||||
entity.setPid(0L);
|
||||
super.updateById(entity);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue