Compare commits

...

2 Commits

Author SHA1 Message Date
wangw ce2af8c5be Merge remote-tracking branch 'origin/test' into test 2025-09-18 16:55:34 +08:00
wangw 95d2c0d809 新客立减 2025-09-18 16:55:24 +08:00
5 changed files with 33 additions and 20 deletions

View File

@ -59,7 +59,7 @@ public class CheckOrderPay implements Serializable {
/**
* 新客立减
*/
private BigDecimal newCustomerDiscountId;
private Long newCustomerDiscountId;
private BigDecimal newCustomerDiscountAmount;
/**

View File

@ -23,6 +23,11 @@
<artifactId>pay-service</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.czg</groupId>
<artifactId>market-service</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.czg</groupId>
<artifactId>cash-common-mq</artifactId>

View File

@ -106,15 +106,17 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
private ShopTableService shopTableService;
@DubboReference
private PointsBasicSettingService pointsBasicService;
@DubboReference
@Resource
private MkShopConsumerCouponService consumerCouponService;
@DubboReference
@Resource
private ShopCouponService couponService;
@DubboReference
@Resource
private MkShopCouponRecordService couponRecordService;
@DubboReference
@Resource
private TbMemberConfigService memberConfigService;
@Resource
private MkShopConsumeDiscountRecordService newConsumerDiscountRecordService;
@Resource
private MemberOrderService memberOrderService;
// 延迟 5
private static final long DELAY = 5;
@ -460,9 +462,12 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
fullReductionAmount.getPrice(), rateAmount.getPrice(), oneGiftAmount.getPrice(), twoHalfAmount.getPrice(), param.getOtherCouponDiscountAmount());
throw new ValidateException("生成支付订单失败,商品优惠券优惠金额不正确");
}
//TODO 新客立减
//新客立减
if (shopUser != null) {
newTotalAmount = newTotalAmount.subtract(param.getNewCustomerDiscountAmount());
} else {
param.setNewCustomerDiscountAmount(BigDecimal.ZERO);
}
//折扣金额
if (param.getDiscountAmount().compareTo(BigDecimal.ZERO) > 0) {
newTotalAmount = totalAmount.getPrice().subtract(param.getDiscountAmount());
@ -866,7 +871,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
.set(OrderInfo::getPayAmount, 0)
.update();
} else {
// //会员活动
//TODO 以前的会员活动
// activateService.giveActivate(shopUser, new BigDecimal(czgCallBackDto.getAmount()).divide(new BigDecimal(100), 2, RoundingMode.DOWN),
// payment.getRelatedId(), flowId);
}
@ -1146,6 +1151,10 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
log.error("订单积分使用或优惠券扣除失败订单id{}", orderInfo.getId());
}
} else {
//TODO 新客立减
if (param.getNewCustomerDiscountId() != null) {
newConsumerDiscountRecordService.useDiscount(param.getNewCustomerDiscountId(), shopUser.getId(), param.getOrderId(), param.getNewCustomerDiscountAmount());
}
//积分使用
if (orderInfo.getPointsNum() != null && orderInfo.getPointsNum() > 0) {
pointsService.deductPoints(shopUser.getId(), orderInfo.getPointsNum(), "积分抵扣账单", orderInfo);

View File

@ -17,7 +17,9 @@ import com.czg.entity.resp.*;
import com.czg.enums.ShopUserFlowBizEnum;
import com.czg.exception.CzgException;
import com.czg.exception.PaySuccessException;
import com.czg.market.entity.MkShopCouponRecord;
import com.czg.market.service.MemberOrderService;
import com.czg.market.service.MkShopCouponRecordService;
import com.czg.order.dto.BigDecimalDTO;
import com.czg.order.dto.CheckOrderPay;
import com.czg.order.dto.OrderInfoRefundDTO;
@ -75,12 +77,10 @@ public class PayServiceImpl implements PayService {
private UserInfoService userInfoService;
@DubboReference
private ShopInfoService shopInfoService;
// @DubboReference
// private ShopActivateService shopActivateService;
@DubboReference
private ShopUserFlowService userFlowService;
// @DubboReference
// private ShopCouponService couponService;
@Resource
private MkShopCouponRecordService recordService;
@DubboReference
private MemberPointsService pointsService;
@DubboReference
@ -371,7 +371,7 @@ public class PayServiceImpl implements PayService {
.setBizEnum(ShopUserFlowBizEnum.CASH_IN);
//更新会员余额 并生成流水
Long flowId = shopUserService.updateMoney(shopUser.getShopId(), shopUserMoneyEditDTO);
//会员活动
//TODO 以前的会员活动
//shopActivateService.giveActivate(shopUser, payParam.getAmount(), payParam.getActivateId(), flowId);
return CzgResult.success();
}
@ -550,12 +550,11 @@ 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));
recordService.remove(QueryWrapper.create()
.eq(MkShopCouponRecord::getSourceFlowId, inFlow.getId())
.eq(MkShopCouponRecord::getSource, "activate")
.eq(MkShopCouponRecord::getStatus, 0));
return CzgResult.success();
}