feat: 霸王餐充值接口修改
This commit is contained in:
@@ -20,7 +20,7 @@ public class MemberInDTO {
|
||||
private BigDecimal amount;
|
||||
private Integer orderId;
|
||||
// 使用的优惠券
|
||||
private List<Integer> couponIds = new ArrayList<>();
|
||||
private List<Integer> userCouponIds = new ArrayList<>();
|
||||
// 是否使用积分抵扣
|
||||
private boolean usePoints ;
|
||||
}
|
||||
|
||||
@@ -397,7 +397,7 @@ public class PayService {
|
||||
}
|
||||
|
||||
// 校验优惠券积分同享
|
||||
if (!payDTO.getCouponIds().isEmpty() && freeDineConfig.getWithCoupon() == 0) {
|
||||
if (!payDTO.getUserCouponIds().isEmpty() && freeDineConfig.getWithCoupon() == 0) {
|
||||
throw new MsgException("当前店铺未开启与优惠券同享");
|
||||
}
|
||||
|
||||
@@ -411,15 +411,15 @@ public class PayService {
|
||||
}
|
||||
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);
|
||||
if (userCouponList.isEmpty()) {
|
||||
throw new MsgException("存在不可用优惠券");
|
||||
}
|
||||
|
||||
ArrayList<ActivateInInfoVO> activateInInfoVOS = new ArrayList<>();
|
||||
for (Integer couponId : payDTO.getCouponIds()) {
|
||||
TbUserCouponVo userCouponVo = userCouponList.stream().filter(item -> item.getCouponId().equals(couponId)).findFirst().orElse(null);
|
||||
for (Integer userCouponId : payDTO.getUserCouponIds()) {
|
||||
TbUserCouponVo userCouponVo = userCouponList.stream().filter(item -> item.getId().equals(userCouponId)).findFirst().orElse(null);
|
||||
if (userCouponVo == null) {
|
||||
throw new MsgException("存在不可用优惠券");
|
||||
}
|
||||
@@ -431,7 +431,7 @@ public class PayService {
|
||||
}
|
||||
|
||||
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("存在不可用优惠券");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user