diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java index 250737e3..d2926b44 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java @@ -330,7 +330,7 @@ public class OrderServiceImpl implements OrderService { 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()); if (user == null) { @@ -345,17 +345,11 @@ public class OrderServiceImpl implements OrderService { if (goldPrice.compareTo(order.getPayablePrice()) == 1) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "支付的积分金额大于支付金额"); } - // 应付金额 减去 积分抵扣金额 = 支付金额 + // 支付金额 减去 积分抵扣金额 = 应付金额 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())) { throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_ENTER_USER_PAY_PWD, ""); } @@ -370,7 +364,7 @@ public class OrderServiceImpl implements OrderService { } // 扣除用户积分 userService.goldHandle(order.getMemId(), createOrderModel.getPayGold(), 2, 2, order.getId(), - "抵扣积分订单:" + order.getOrderNo() + ",使用积分:" + order.getPayGold()); + "积分抵扣金额,交易订单:" + order.getOrderNo() + ",使用积分:" + order.getPayGold()); order.setOrderStatus(OrderStatus.STATUS2.getNumber()); order.setPayRealPrice(order.getPayPrice()); @@ -379,6 +373,10 @@ public class OrderServiceImpl implements OrderService { for (HighChildOrder childOrder : order.getHighChildOrderList()) { childOrder.setChildOrderStatus(OrderChildStatus.STATUS2.getNumber()); } + } else { + // 扣除用户积分 + userService.goldHandle(order.getMemId(), createOrderModel.getPayGold(), 2, 2, order.getId(), + "积分抵扣金额,交易订单:" + order.getOrderNo() + ",使用积分:" + order.getPayGold()); } }