feat: 霸王餐充值接口修改

This commit is contained in:
2024-10-29 14:32:56 +08:00
parent 7184160296
commit ec74e71f90
2 changed files with 6 additions and 6 deletions

View File

@@ -20,7 +20,7 @@ public class MemberInDTO {
private BigDecimal amount; private BigDecimal amount;
private Integer orderId; private Integer orderId;
// 使用的优惠券 // 使用的优惠券
private List<Integer> couponIds = new ArrayList<>(); private List<Integer> userCouponIds = new ArrayList<>();
// 是否使用积分抵扣 // 是否使用积分抵扣
private boolean usePoints ; private boolean usePoints ;
} }

View File

@@ -397,7 +397,7 @@ public class PayService {
} }
// 校验优惠券积分同享 // 校验优惠券积分同享
if (!payDTO.getCouponIds().isEmpty() && freeDineConfig.getWithCoupon() == 0) { if (!payDTO.getUserCouponIds().isEmpty() && freeDineConfig.getWithCoupon() == 0) {
throw new MsgException("当前店铺未开启与优惠券同享"); throw new MsgException("当前店铺未开启与优惠券同享");
} }
@@ -411,15 +411,15 @@ public class PayService {
} }
BigDecimal shouldPayAmount = orderInfo.getOriginAmount().multiply(BigDecimal.valueOf(freeDineConfig.getRechargeTimes())); BigDecimal shouldPayAmount = orderInfo.getOriginAmount().multiply(BigDecimal.valueOf(freeDineConfig.getRechargeTimes()));
if (!payDTO.getCouponIds().isEmpty()) { if (!payDTO.getUserCouponIds().isEmpty()) {
List<TbUserCouponVo> userCouponList = shopCouponService.getActivateCouponByAmount(Integer.valueOf(orderInfo.getShopId()), String.valueOf(payDTO.getUserId()), shouldPayAmount); List<TbUserCouponVo> userCouponList = shopCouponService.getActivateCouponByAmount(Integer.valueOf(orderInfo.getShopId()), String.valueOf(payDTO.getUserId()), shouldPayAmount);
if (userCouponList.isEmpty()) { if (userCouponList.isEmpty()) {
throw new MsgException("存在不可用优惠券"); throw new MsgException("存在不可用优惠券");
} }
ArrayList<ActivateInInfoVO> activateInInfoVOS = new ArrayList<>(); ArrayList<ActivateInInfoVO> activateInInfoVOS = new ArrayList<>();
for (Integer couponId : payDTO.getCouponIds()) { for (Integer userCouponId : payDTO.getUserCouponIds()) {
TbUserCouponVo userCouponVo = userCouponList.stream().filter(item -> item.getCouponId().equals(couponId)).findFirst().orElse(null); TbUserCouponVo userCouponVo = userCouponList.stream().filter(item -> item.getId().equals(userCouponId)).findFirst().orElse(null);
if (userCouponVo == null) { if (userCouponVo == null) {
throw new MsgException("存在不可用优惠券"); throw new MsgException("存在不可用优惠券");
} }
@@ -431,7 +431,7 @@ public class PayService {
} }
List<TbShopCoupon> tbShopCoupons = mpShopCouponMapper.selectBatchIds(activateInInfoVOS.stream().map(ActivateInInfoVO::getCouponId).collect(Collectors.toList())); List<TbShopCoupon> tbShopCoupons = mpShopCouponMapper.selectBatchIds(activateInInfoVOS.stream().map(ActivateInInfoVO::getCouponId).collect(Collectors.toList()));
if (tbShopCoupons.size() != payDTO.getCouponIds().size()) { if (tbShopCoupons.size() != payDTO.getUserCouponIds().size()) {
throw new MsgException("存在不可用优惠券"); throw new MsgException("存在不可用优惠券");
} }