提交代码

yy_dev
胡锐 2 years ago
parent 904cfee8e1
commit cc1eb61317
  1. 1
      service/src/main/java/com/hfkj/config/hsg/UserDiscountService.java
  2. 1
      service/src/main/java/com/hfkj/model/UserDiscount.java
  3. 6
      service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java

@ -40,6 +40,7 @@ public class UserDiscountService {
if (!response.getString("return_code").equals("000000")) { if (!response.getString("return_code").equals("000000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response.getString("return_msg")); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response.getString("return_msg"));
} }
System.out.println(response);
return response.getObject("return_data", UserDiscount.class); return response.getObject("return_data", UserDiscount.class);
} }

@ -19,6 +19,5 @@ public class UserDiscount {
private Integer discountType; private Integer discountType;
private BigDecimal discountCondition; private BigDecimal discountCondition;
private BigDecimal discountPrice; private BigDecimal discountPrice;
private Date receiveTime;
private Integer status; private Integer status;
} }

@ -121,7 +121,7 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService {
// 优惠比例 / 100 = 最终优惠比例 // 优惠比例 / 100 = 最终优惠比例
tradeOrder.setStoreDiscountSatisfy(true); tradeOrder.setStoreDiscountSatisfy(true);
BigDecimal priceRate = tradeOrder.getStoreDiscountPrice().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); 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())); tradeOrder.setTradeActualAmount(tradeOrder.getTradeActualAmount().subtract(tradeOrder.getStoreDiscountActualPrice()));
} else { } else {
tradeOrder.setStoreDiscountSatisfy(true); tradeOrder.setStoreDiscountSatisfy(true);
@ -146,8 +146,8 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService {
} else if (userDiscount.getDiscountType().equals(UserDiscountTypeEnum.type3.getNumber())) { } else if (userDiscount.getDiscountType().equals(UserDiscountTypeEnum.type3.getNumber())) {
// 优惠比例 / 100 = 最终优惠比例 // 优惠比例 / 100 = 最终优惠比例
BigDecimal priceRate = tradeOrder.getUserDiscountPrice().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); BigDecimal priceRate = tradeOrder.getUserDiscountPrice().setScale(2, BigDecimal.ROUND_DOWN);
tradeOrder.setUserDiscountActualPrice(tradeOrder.getTradeActualAmount().multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); tradeOrder.setUserDiscountActualPrice(tradeOrder.getTradeActualAmount().subtract(tradeOrder.getTradeActualAmount().multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)));
tradeOrder.setTradeActualAmount(tradeOrder.getTradeActualAmount().subtract(tradeOrder.getUserDiscountActualPrice())); tradeOrder.setTradeActualAmount(tradeOrder.getTradeActualAmount().subtract(tradeOrder.getUserDiscountActualPrice()));
} else { } else {
tradeOrder.setUserDiscountActualPrice(userDiscount.getDiscountPrice()); tradeOrder.setUserDiscountActualPrice(userDiscount.getDiscountPrice());

Loading…
Cancel
Save