原记录表作废

This commit is contained in:
2025-09-13 15:57:51 +08:00
parent 77ac277856
commit dca94cc848
15 changed files with 183 additions and 336 deletions

View File

@@ -107,8 +107,6 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
private PointsBasicSettingService pointsBasicService;
// @DubboReference
// private ShopCouponService couponService;
@DubboReference
private ShopActivateCouponRecordService couponRecordService;
@DubboReference
private TbMemberConfigService memberConfigService;
@Resource
@@ -590,29 +588,30 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
*/
private void checkCoupon(Map<Long, Integer> prodCouponMap, BigDecimalDTO fullAmount, BigDecimalDTO discountAmount, CheckOrderPay param) {
if (CollUtil.isNotEmpty(param.getCouponList())) {
//校验优惠券
List<ShopActivateCouponRecord> records = couponRecordService.listAs(
QueryWrapper.create()
.where(ShopActivateCouponRecord::getId).in(param.getCouponList())
.and(ShopActivateCouponRecord::getStatus).eq(0), ShopActivateCouponRecord.class);
if (CollUtil.isEmpty(records)) {
throw new ValidateException("生成支付订单失败,优惠券信息不存在");
} else if (records.size() != param.getCouponList().size()) {
throw new ValidateException("生成支付订单失败,优惠券信息不正确");
}
boolean isFullMinus = false;
for (ShopActivateCouponRecord record : records) {
if (record.getType().equals(1)) {
if (isFullMinus) {
throw new ValidateException("生成支付订单失败,满减券仅可使用一张");
}
fullAmount.setPrice(record.getFullAmount());
discountAmount.setPrice(record.getDiscountAmount());
isFullMinus = true;
} else if (record.getType().equals(2)) {
prodCouponMap.compute(record.getProId(), (key, oldValue) -> oldValue == null ? 1 : oldValue + 1);
}
}
//TODO 校验优惠券
// //校验优惠券
// List<ShopActivateCouponRecord> records = couponRecordService.listAs(
// QueryWrapper.create()
// .where(ShopActivateCouponRecord::getId).in(param.getCouponList())
// .and(ShopActivateCouponRecord::getStatus).eq(0), ShopActivateCouponRecord.class);
// if (CollUtil.isEmpty(records)) {
// throw new ValidateException("生成支付订单失败,优惠券信息不存在");
// } else if (records.size() != param.getCouponList().size()) {
// throw new ValidateException("生成支付订单失败,优惠券信息不正确");
// }
// boolean isFullMinus = false;
// for (ShopActivateCouponRecord record : records) {
// if (record.getType().equals(1)) {
// if (isFullMinus) {
// throw new ValidateException("生成支付订单失败,满减券仅可使用一张");
// }
// fullAmount.setPrice(record.getFullAmount());
// discountAmount.setPrice(record.getDiscountAmount());
// isFullMinus = true;
// } else if (record.getType().equals(2)) {
// prodCouponMap.compute(record.getProId(), (key, oldValue) -> oldValue == null ? 1 : oldValue + 1);
// }
// }
if (discountAmount.getPrice().compareTo(param.getFullCouponDiscountAmount()) != 0) {
throw new ValidateException("生成支付订单失败,满减券减免金额不正确");
}

View File

@@ -79,8 +79,6 @@ public class PayServiceImpl implements PayService {
// private ShopActivateService shopActivateService;
@DubboReference
private ShopUserFlowService userFlowService;
@DubboReference
private ShopActivateCouponRecordService inRecordService;
// @DubboReference
// private ShopCouponService couponService;
@DubboReference
@@ -551,11 +549,12 @@ public class PayServiceImpl implements PayService {
shopUserService.updateMoney(shopUser.getShopId(), giftFlowEdit);
userFlowService.updateRefund(giftFlow.getId(), giftFlow.getAmount());
}
//TODO 移除优惠券
//移除优惠券
inRecordService.remove(QueryWrapper.create()
.eq(ShopActivateCouponRecord::getSourceFlowId, inFlow.getId())
.eq(ShopActivateCouponRecord::getSource, "activate")
.eq(ShopActivateCouponRecord::getStatus, 0));
// inRecordService.remove(QueryWrapper.create()
// .eq(ShopActivateCouponRecord::getSourceFlowId, inFlow.getId())
// .eq(ShopActivateCouponRecord::getSource, "activate")
// .eq(ShopActivateCouponRecord::getStatus, 0));
return CzgResult.success();
}