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; private BigDecimal newCustomerDiscountAmount;
/** /**

View File

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

View File

@ -106,15 +106,17 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
private ShopTableService shopTableService; private ShopTableService shopTableService;
@DubboReference @DubboReference
private PointsBasicSettingService pointsBasicService; private PointsBasicSettingService pointsBasicService;
@DubboReference @Resource
private MkShopConsumerCouponService consumerCouponService; private MkShopConsumerCouponService consumerCouponService;
@DubboReference @Resource
private ShopCouponService couponService; private ShopCouponService couponService;
@DubboReference @Resource
private MkShopCouponRecordService couponRecordService; private MkShopCouponRecordService couponRecordService;
@DubboReference @Resource
private TbMemberConfigService memberConfigService; private TbMemberConfigService memberConfigService;
@Resource @Resource
private MkShopConsumeDiscountRecordService newConsumerDiscountRecordService;
@Resource
private MemberOrderService memberOrderService; private MemberOrderService memberOrderService;
// 延迟 5 // 延迟 5
private static final long DELAY = 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()); fullReductionAmount.getPrice(), rateAmount.getPrice(), oneGiftAmount.getPrice(), twoHalfAmount.getPrice(), param.getOtherCouponDiscountAmount());
throw new ValidateException("生成支付订单失败,商品优惠券优惠金额不正确"); throw new ValidateException("生成支付订单失败,商品优惠券优惠金额不正确");
} }
//TODO 新客立减
//新客立减 //新客立减
if (shopUser != null) {
newTotalAmount = newTotalAmount.subtract(param.getNewCustomerDiscountAmount()); newTotalAmount = newTotalAmount.subtract(param.getNewCustomerDiscountAmount());
} else {
param.setNewCustomerDiscountAmount(BigDecimal.ZERO);
}
//折扣金额 //折扣金额
if (param.getDiscountAmount().compareTo(BigDecimal.ZERO) > 0) { if (param.getDiscountAmount().compareTo(BigDecimal.ZERO) > 0) {
newTotalAmount = totalAmount.getPrice().subtract(param.getDiscountAmount()); newTotalAmount = totalAmount.getPrice().subtract(param.getDiscountAmount());
@ -866,7 +871,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
.set(OrderInfo::getPayAmount, 0) .set(OrderInfo::getPayAmount, 0)
.update(); .update();
} else { } else {
// //会员活动 //TODO 以前的会员活动
// activateService.giveActivate(shopUser, new BigDecimal(czgCallBackDto.getAmount()).divide(new BigDecimal(100), 2, RoundingMode.DOWN), // activateService.giveActivate(shopUser, new BigDecimal(czgCallBackDto.getAmount()).divide(new BigDecimal(100), 2, RoundingMode.DOWN),
// payment.getRelatedId(), flowId); // payment.getRelatedId(), flowId);
} }
@ -1146,6 +1151,10 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
log.error("订单积分使用或优惠券扣除失败订单id{}", orderInfo.getId()); log.error("订单积分使用或优惠券扣除失败订单id{}", orderInfo.getId());
} }
} else { } else {
//TODO 新客立减
if (param.getNewCustomerDiscountId() != null) {
newConsumerDiscountRecordService.useDiscount(param.getNewCustomerDiscountId(), shopUser.getId(), param.getOrderId(), param.getNewCustomerDiscountAmount());
}
//积分使用 //积分使用
if (orderInfo.getPointsNum() != null && orderInfo.getPointsNum() > 0) { if (orderInfo.getPointsNum() != null && orderInfo.getPointsNum() > 0) {
pointsService.deductPoints(shopUser.getId(), orderInfo.getPointsNum(), "积分抵扣账单", orderInfo); 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.enums.ShopUserFlowBizEnum;
import com.czg.exception.CzgException; import com.czg.exception.CzgException;
import com.czg.exception.PaySuccessException; import com.czg.exception.PaySuccessException;
import com.czg.market.entity.MkShopCouponRecord;
import com.czg.market.service.MemberOrderService; import com.czg.market.service.MemberOrderService;
import com.czg.market.service.MkShopCouponRecordService;
import com.czg.order.dto.BigDecimalDTO; import com.czg.order.dto.BigDecimalDTO;
import com.czg.order.dto.CheckOrderPay; import com.czg.order.dto.CheckOrderPay;
import com.czg.order.dto.OrderInfoRefundDTO; import com.czg.order.dto.OrderInfoRefundDTO;
@ -75,12 +77,10 @@ public class PayServiceImpl implements PayService {
private UserInfoService userInfoService; private UserInfoService userInfoService;
@DubboReference @DubboReference
private ShopInfoService shopInfoService; private ShopInfoService shopInfoService;
// @DubboReference
// private ShopActivateService shopActivateService;
@DubboReference @DubboReference
private ShopUserFlowService userFlowService; private ShopUserFlowService userFlowService;
// @DubboReference @Resource
// private ShopCouponService couponService; private MkShopCouponRecordService recordService;
@DubboReference @DubboReference
private MemberPointsService pointsService; private MemberPointsService pointsService;
@DubboReference @DubboReference
@ -371,8 +371,8 @@ public class PayServiceImpl implements PayService {
.setBizEnum(ShopUserFlowBizEnum.CASH_IN); .setBizEnum(ShopUserFlowBizEnum.CASH_IN);
//更新会员余额 并生成流水 //更新会员余额 并生成流水
Long flowId = shopUserService.updateMoney(shopUser.getShopId(), shopUserMoneyEditDTO); Long flowId = shopUserService.updateMoney(shopUser.getShopId(), shopUserMoneyEditDTO);
//会员活动 //TODO 以前的会员活动
// shopActivateService.giveActivate(shopUser, payParam.getAmount(), payParam.getActivateId(), flowId); //shopActivateService.giveActivate(shopUser, payParam.getAmount(), payParam.getActivateId(), flowId);
return CzgResult.success(); return CzgResult.success();
} }
@ -550,12 +550,11 @@ public class PayServiceImpl implements PayService {
shopUserService.updateMoney(shopUser.getShopId(), giftFlowEdit); shopUserService.updateMoney(shopUser.getShopId(), giftFlowEdit);
userFlowService.updateRefund(giftFlow.getId(), giftFlow.getAmount()); userFlowService.updateRefund(giftFlow.getId(), giftFlow.getAmount());
} }
//TODO 移除优惠券
//移除优惠券 //移除优惠券
// inRecordService.remove(QueryWrapper.create() recordService.remove(QueryWrapper.create()
// .eq(ShopActivateCouponRecord::getSourceFlowId, inFlow.getId()) .eq(MkShopCouponRecord::getSourceFlowId, inFlow.getId())
// .eq(ShopActivateCouponRecord::getSource, "activate") .eq(MkShopCouponRecord::getSource, "activate")
// .eq(ShopActivateCouponRecord::getStatus, 0)); .eq(MkShopCouponRecord::getStatus, 0));
return CzgResult.success(); return CzgResult.success();
} }