diff --git a/service/src/main/java/com/hfkj/config/hsg/UserDiscountService.java b/service/src/main/java/com/hfkj/config/hsg/UserDiscountService.java index 66f9d44..cbdabd0 100644 --- a/service/src/main/java/com/hfkj/config/hsg/UserDiscountService.java +++ b/service/src/main/java/com/hfkj/config/hsg/UserDiscountService.java @@ -40,6 +40,7 @@ public class UserDiscountService { if (!response.getString("return_code").equals("000000")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response.getString("return_msg")); } + System.out.println(response); return response.getObject("return_data", UserDiscount.class); } diff --git a/service/src/main/java/com/hfkj/model/UserDiscount.java b/service/src/main/java/com/hfkj/model/UserDiscount.java index eb8c197..47a5a61 100644 --- a/service/src/main/java/com/hfkj/model/UserDiscount.java +++ b/service/src/main/java/com/hfkj/model/UserDiscount.java @@ -19,6 +19,5 @@ public class UserDiscount { private Integer discountType; private BigDecimal discountCondition; private BigDecimal discountPrice; - private Date receiveTime; private Integer status; } diff --git a/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java index 75c3735..e2bab7e 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java @@ -121,7 +121,7 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService { // 优惠比例 / 100 = 最终优惠比例 tradeOrder.setStoreDiscountSatisfy(true); BigDecimal priceRate = tradeOrder.getStoreDiscountPrice().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); - tradeOrder.setStoreDiscountActualPrice(tradeOrder.getTradeActualAmount().multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); + tradeOrder.setStoreDiscountActualPrice(tradeOrder.getTradeActualAmount().subtract(tradeOrder.getTradeActualAmount().multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP))); tradeOrder.setTradeActualAmount(tradeOrder.getTradeActualAmount().subtract(tradeOrder.getStoreDiscountActualPrice())); } else { tradeOrder.setStoreDiscountSatisfy(true); @@ -146,8 +146,8 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService { } else if (userDiscount.getDiscountType().equals(UserDiscountTypeEnum.type3.getNumber())) { // 优惠比例 / 100 = 最终优惠比例 - BigDecimal priceRate = tradeOrder.getUserDiscountPrice().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); - tradeOrder.setUserDiscountActualPrice(tradeOrder.getTradeActualAmount().multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); + BigDecimal priceRate = tradeOrder.getUserDiscountPrice().setScale(2, BigDecimal.ROUND_DOWN); + tradeOrder.setUserDiscountActualPrice(tradeOrder.getTradeActualAmount().subtract(tradeOrder.getTradeActualAmount().multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP))); tradeOrder.setTradeActualAmount(tradeOrder.getTradeActualAmount().subtract(tradeOrder.getUserDiscountActualPrice())); } else { tradeOrder.setUserDiscountActualPrice(userDiscount.getDiscountPrice());