|
@@ -400,7 +400,10 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
}
|
|
}
|
|
|
if (sku != null) {
|
|
if (sku != null) {
|
|
|
//扣除使用优惠券、余额的订单金额
|
|
//扣除使用优惠券、余额的订单金额
|
|
|
- deductOrderMoney(orderDon, couponUser, payRequest.getBalance(), user, sku.getPrice(), goodsDon.getType(), payRequest.getGcCash(), payRequest.getGcpIds(), payRequest.getGalaxycoin());
|
|
|
|
|
|
|
+ UnifiedOrderPayReq unifiedOrderPayReq = new UnifiedOrderPayReq();
|
|
|
|
|
+ unifiedOrderPayReq.setBalance(payRequest.getBalance());
|
|
|
|
|
+ unifiedOrderPayReq.setGalaxycoin(payRequest.getGalaxycoin());
|
|
|
|
|
+ deductOrderMoney(orderDon, couponUser, user, sku.getPrice(), goodsDon.getType(), payRequest.getGcCash(), payRequest.getGcpIds(), unifiedOrderPayReq);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (isSpecificPrice && (orderDon.getMoney().compareTo(BigDecimal.ZERO) == 0 || orderDon.getMoney().compareTo(specificPrice) != 0)) {
|
|
if (isSpecificPrice && (orderDon.getMoney().compareTo(BigDecimal.ZERO) == 0 || orderDon.getMoney().compareTo(specificPrice) != 0)) {
|
|
@@ -736,7 +739,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
}
|
|
}
|
|
|
if (sku != null) {
|
|
if (sku != null) {
|
|
|
//扣除使用优惠券、余额的订单金额
|
|
//扣除使用优惠券、余额的订单金额
|
|
|
- deductOrderMoney(orderDon, couponUser, payRequest.getBalance(), user, sku.getPrice(), goodsDon.getType(), payRequest.getGcCash(), payRequest.getGcpIds(), payRequest.getGalaxycoin());
|
|
|
|
|
|
|
+ deductOrderMoney(orderDon, couponUser, user, sku.getPrice(), goodsDon.getType(), payRequest.getGcCash(), payRequest.getGcpIds(), unifiedOrderPayReq);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (isSpecificPrice && (orderDon.getMoney().compareTo(BigDecimal.ZERO) == 0 || orderDon.getMoney().compareTo(specificPrice) != 0)) {
|
|
if (isSpecificPrice && (orderDon.getMoney().compareTo(BigDecimal.ZERO) == 0 || orderDon.getMoney().compareTo(specificPrice) != 0)) {
|
|
@@ -901,15 +904,21 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
orderMasterDon.setPayTitle(totalPayTitle.toString());
|
|
orderMasterDon.setPayTitle(totalPayTitle.toString());
|
|
|
BigDecimal pay_money = BigDecimal.ZERO;
|
|
BigDecimal pay_money = BigDecimal.ZERO;
|
|
|
BigDecimal real_money = BigDecimal.ZERO;
|
|
BigDecimal real_money = BigDecimal.ZERO;
|
|
|
|
|
+ BigDecimal pay_balance = BigDecimal.ZERO;
|
|
|
|
|
+ BigDecimal pay_galaxycoin = BigDecimal.ZERO;
|
|
|
List<Long> orderIds = new LinkedList<>();
|
|
List<Long> orderIds = new LinkedList<>();
|
|
|
for (OrderDon orderDon : orderDonList) {
|
|
for (OrderDon orderDon : orderDonList) {
|
|
|
pay_money = pay_money.add(orderDon.getMoney());
|
|
pay_money = pay_money.add(orderDon.getMoney());
|
|
|
real_money = real_money.add(orderDon.getRealMoney());
|
|
real_money = real_money.add(orderDon.getRealMoney());
|
|
|
|
|
+ pay_balance = pay_balance.add(orderDon.getBalance());
|
|
|
|
|
+ pay_galaxycoin = pay_galaxycoin.add(orderDon.getGalaxycoin());
|
|
|
orderIds.add(orderDon.getId());
|
|
orderIds.add(orderDon.getId());
|
|
|
}
|
|
}
|
|
|
orderMasterDon.setMoney(pay_money);
|
|
orderMasterDon.setMoney(pay_money);
|
|
|
orderMasterDon.setRealMoney(real_money);
|
|
orderMasterDon.setRealMoney(real_money);
|
|
|
orderMasterDon.setUserId(userId);
|
|
orderMasterDon.setUserId(userId);
|
|
|
|
|
+ orderMasterDon.setBalance(pay_balance);
|
|
|
|
|
+ orderMasterDon.setGalaxycoin(pay_galaxycoin);
|
|
|
orderMasterDonService.save(orderMasterDon);
|
|
orderMasterDonService.save(orderMasterDon);
|
|
|
|
|
|
|
|
orderDonMapper.update(null, Wrappers.lambdaUpdate(OrderDon.class)
|
|
orderDonMapper.update(null, Wrappers.lambdaUpdate(OrderDon.class)
|
|
@@ -1310,7 +1319,10 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
}
|
|
}
|
|
|
orderDon.setRealMoney(orderDon.getMoney());
|
|
orderDon.setRealMoney(orderDon.getMoney());
|
|
|
//扣除使用优惠券、余额的订单金额
|
|
//扣除使用优惠券、余额的订单金额
|
|
|
- deductOrderMoney(orderDon, couponUser, payRequest.getBalance(), user, sku.getPrice(), goodsDon.getType(), payRequest.getGcCash(), payRequest.getGcpIds(), payRequest.getGalaxycoin());
|
|
|
|
|
|
|
+ UnifiedOrderPayReq unifiedOrderPayReq = new UnifiedOrderPayReq();
|
|
|
|
|
+ unifiedOrderPayReq.setBalance(payRequest.getBalance());
|
|
|
|
|
+ unifiedOrderPayReq.setGalaxycoin(payRequest.getGalaxycoin());
|
|
|
|
|
+ deductOrderMoney(orderDon, couponUser, user, sku.getPrice(), goodsDon.getType(), payRequest.getGcCash(), payRequest.getGcpIds(), unifiedOrderPayReq);
|
|
|
this.saveOrUpdate(orderDon);
|
|
this.saveOrUpdate(orderDon);
|
|
|
|
|
|
|
|
//主订单
|
|
//主订单
|
|
@@ -1318,6 +1330,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
orderMasterDon.setRealMoney(orderDon.getRealMoney());
|
|
orderMasterDon.setRealMoney(orderDon.getRealMoney());
|
|
|
orderMasterDon.setOrderType(orderDon.getOrderType());
|
|
orderMasterDon.setOrderType(orderDon.getOrderType());
|
|
|
orderMasterDon.setStatus(OrderMasterDon.Status.noPayment);
|
|
orderMasterDon.setStatus(OrderMasterDon.Status.noPayment);
|
|
|
|
|
+ orderMasterDon.setBalance(orderDon.getBalance());
|
|
|
|
|
+ orderMasterDon.setGalaxycoin(orderDon.getGalaxycoin());
|
|
|
|
|
|
|
|
//订单金额为0 且订单为已完成 更新虚物车票
|
|
//订单金额为0 且订单为已完成 更新虚物车票
|
|
|
if (orderDon.getMoney().compareTo(BigDecimal.ZERO) == 0) {
|
|
if (orderDon.getMoney().compareTo(BigDecimal.ZERO) == 0) {
|
|
@@ -2362,7 +2376,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
/**
|
|
/**
|
|
|
* 使用优惠营销 订单金额抵扣
|
|
* 使用优惠营销 订单金额抵扣
|
|
|
*/
|
|
*/
|
|
|
- public void deductOrderMoney(OrderDon orderDon, CouponUser couponUser, BigDecimal balance, User user, BigDecimal skuMoney, Integer goodsType, BigDecimal gcCash, List<Long> gcpIds, BigDecimal galaxycoin) {
|
|
|
|
|
|
|
+ public void deductOrderMoney(OrderDon orderDon, CouponUser couponUser, User user, BigDecimal skuMoney, Integer goodsType, BigDecimal gcCash, List<Long> gcpIds, UnifiedOrderPayReq unifiedOrderPayReq) {
|
|
|
if (gcCash != null && gcCash.compareTo(BigDecimal.ZERO) > 0 && couponUser != null) {
|
|
if (gcCash != null && gcCash.compareTo(BigDecimal.ZERO) > 0 && couponUser != null) {
|
|
|
throw BusinessRuntimeException.getInstance("现金卡不能与其他优惠叠加使用");
|
|
throw BusinessRuntimeException.getInstance("现金卡不能与其他优惠叠加使用");
|
|
|
}
|
|
}
|
|
@@ -2454,7 +2468,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ BigDecimal galaxycoin = unifiedOrderPayReq.getGalaxycoin();
|
|
|
|
|
+ BigDecimal balance = unifiedOrderPayReq.getBalance();
|
|
|
//银河币 coin
|
|
//银河币 coin
|
|
|
if (galaxycoin != null && galaxycoin.compareTo(BigDecimal.ZERO) > 0 && orderDon.getMoney().compareTo(BigDecimal.ZERO) > 0) {
|
|
if (galaxycoin != null && galaxycoin.compareTo(BigDecimal.ZERO) > 0 && orderDon.getMoney().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
BigDecimal money = orderDon.getMoney();
|
|
BigDecimal money = orderDon.getMoney();
|
|
@@ -2474,6 +2489,9 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
Integer success = userMapper.deductGalaxycoin(user.getId(), subGalaxycoin, userGalaxycoin);
|
|
Integer success = userMapper.deductGalaxycoin(user.getId(), subGalaxycoin, userGalaxycoin);
|
|
|
if (success != 1) throw BusinessRuntimeException.getInstance("您的银河币不足!");
|
|
if (success != 1) throw BusinessRuntimeException.getInstance("您的银河币不足!");
|
|
|
orderDon.setGalaxycoin(subGalaxycoin);
|
|
orderDon.setGalaxycoin(subGalaxycoin);
|
|
|
|
|
+ userBenefitsService.recordGlaxycoinBySource(user.getId(), BigDecimal.valueOf(-galaxycoin.longValue()), UserGalaxycoinRecord.Source.payment);
|
|
|
|
|
+ //均分
|
|
|
|
|
+ unifiedOrderPayReq.setGalaxycoin(galaxycoin.subtract(subGalaxycoin));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//存在余额
|
|
//存在余额
|
|
@@ -2494,6 +2512,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
if (success != 1) throw BusinessRuntimeException.getInstance("您的余额不足!");
|
|
if (success != 1) throw BusinessRuntimeException.getInstance("您的余额不足!");
|
|
|
orderDon.setBalance(subBalance);
|
|
orderDon.setBalance(subBalance);
|
|
|
userBenefitsService.recordBalanceBySource(user.getId(), BigDecimal.valueOf(-subBalance.longValue()), UserBalanceSourceRecord.Source.payment);
|
|
userBenefitsService.recordBalanceBySource(user.getId(), BigDecimal.valueOf(-subBalance.longValue()), UserBalanceSourceRecord.Source.payment);
|
|
|
|
|
+ //均分
|
|
|
|
|
+ unifiedOrderPayReq.setBalance(balance.subtract(subBalance));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|