From cc1eb613170dc82ac9f12adc467ccc7997b78d73 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 27 Mar 2023 16:42:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/hfkj/config/hsg/UserDiscountService.java | 1 + service/src/main/java/com/hfkj/model/UserDiscount.java | 1 - .../java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java | 6 +++--- 3 files changed, 4 insertions(+), 4 deletions(-) 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());