Merge remote-tracking branch 'origin/2.0-dev' into 2.0-dev

dev-discount
袁野 2 years ago
commit 2da84f9784
  1. 18
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java

@ -343,7 +343,7 @@ public class OrderServiceImpl implements OrderService {
order.setPayPrice(order.getPayablePrice()); order.setPayPrice(order.getPayablePrice());
// 积分抵扣 // 积分抵扣
if (createOrderModel.getPayGold() != null && createOrderModel.getPayGold().compareTo(0) == 1) { if (createOrderModel.getPayGold() != null && createOrderModel.getPayGold() > 0) {
// 查询用户 // 查询用户
HighUser user = userService.findByUserId(order.getMemId()); HighUser user = userService.findByUserId(order.getMemId());
if (user == null) { if (user == null) {
@ -358,17 +358,11 @@ public class OrderServiceImpl implements OrderService {
if (goldPrice.compareTo(order.getPayablePrice()) == 1) { if (goldPrice.compareTo(order.getPayablePrice()) == 1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "支付的积分金额大于支付金额"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "支付的积分金额大于支付金额");
} }
// 应付金额 减去 积分抵扣金额 = 支付金额 // 支付金额 减去 积分抵扣金额 = 应付金额
order.setPayPrice(order.getPayablePrice().subtract(goldPrice)); order.setPayPrice(order.getPayablePrice().subtract(goldPrice));
// 积分金额小于应付金额
if (goldPrice.compareTo(order.getPayablePrice()) == -1) {
// 扣除用户积分
userService.goldHandle(order.getMemId(), createOrderModel.getPayGold(), 2, 2, order.getId(),
"抵扣积分订单:" + order.getOrderNo() + ",使用积分:" + order.getPayGold());
}
// 积分金额等于应付金额 // 积分金额等于应付金额
if (goldPrice.compareTo(order.getPayablePrice()) == 0) { if (order.getPayPrice().compareTo(new BigDecimal("0")) == 0) {
if (StringUtils.isBlank(createOrderModel.getPayPwd())) { if (StringUtils.isBlank(createOrderModel.getPayPwd())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_ENTER_USER_PAY_PWD, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_ENTER_USER_PAY_PWD, "");
} }
@ -383,7 +377,7 @@ public class OrderServiceImpl implements OrderService {
} }
// 扣除用户积分 // 扣除用户积分
userService.goldHandle(order.getMemId(), createOrderModel.getPayGold(), 2, 2, order.getId(), userService.goldHandle(order.getMemId(), createOrderModel.getPayGold(), 2, 2, order.getId(),
"抵扣积分订单:" + order.getOrderNo() + ",使用积分:" + order.getPayGold()); "积分抵扣金额,交易订单:" + order.getOrderNo() + ",使用积分:" + order.getPayGold());
order.setOrderStatus(OrderStatus.STATUS2.getNumber()); order.setOrderStatus(OrderStatus.STATUS2.getNumber());
order.setPayRealPrice(order.getPayPrice()); order.setPayRealPrice(order.getPayPrice());
@ -392,6 +386,10 @@ public class OrderServiceImpl implements OrderService {
for (HighChildOrder childOrder : order.getHighChildOrderList()) { for (HighChildOrder childOrder : order.getHighChildOrderList()) {
childOrder.setChildOrderStatus(OrderChildStatus.STATUS2.getNumber()); childOrder.setChildOrderStatus(OrderChildStatus.STATUS2.getNumber());
} }
} else {
// 扣除用户积分
userService.goldHandle(order.getMemId(), createOrderModel.getPayGold(), 2, 2, order.getId(),
"积分抵扣金额,交易订单:" + order.getOrderNo() + ",使用积分:" + order.getPayGold());
} }
} }

Loading…
Cancel
Save