|
@@ -4389,19 +4389,19 @@ public class OrderServiceImpl implements OrderService {
|
|
String sku = goodsDetailsDto.getGoodsSn();
|
|
String sku = goodsDetailsDto.getGoodsSn();
|
|
BigDecimal scoreLimitDecimal = skuScoreLimitMap.get(sku);
|
|
BigDecimal scoreLimitDecimal = skuScoreLimitMap.get(sku);
|
|
String prodBarcode = goodsDetailsDto.getProdBarcode();
|
|
String prodBarcode = goodsDetailsDto.getProdBarcode();
|
|
- BigDecimal actualPaymentAmount = goodsDetailsDto.getActualPaymentAmount();
|
|
|
|
|
|
+ BigDecimal retailPrice = goodsDetailsDto.getRetailPrice();
|
|
// 计算抵扣,当商品不是最后一个商品
|
|
// 计算抵扣,当商品不是最后一个商品
|
|
if (i < index) {
|
|
if (i < index) {
|
|
// 商品总价
|
|
// 商品总价
|
|
// 分摊积分
|
|
// 分摊积分
|
|
- BigDecimal shareScoreItem = actualPaymentAmount.divide(skuTotalPrice, 2, BigDecimal.ROUND_HALF_UP).multiply(scoreIntegerDecimal);
|
|
|
|
|
|
+ BigDecimal shareScoreItem = retailPrice.divide(skuTotalPrice, 2, BigDecimal.ROUND_HALF_UP).multiply(scoreIntegerDecimal);
|
|
shareScore = shareScore.add(shareScoreItem);
|
|
shareScore = shareScore.add(shareScoreItem);
|
|
// 保留两位小数,四舍五入
|
|
// 保留两位小数,四舍五入
|
|
BigDecimal discountedPrice = shareScore.divide(BigDecimal.valueOf(scoreLimit), 2, BigDecimal.ROUND_HALF_UP);
|
|
BigDecimal discountedPrice = shareScore.divide(BigDecimal.valueOf(scoreLimit), 2, BigDecimal.ROUND_HALF_UP);
|
|
goodsDetailScoreDeductionPrice = goodsDetailScoreDeductionPrice.add(discountedPrice);
|
|
goodsDetailScoreDeductionPrice = goodsDetailScoreDeductionPrice.add(discountedPrice);
|
|
goodsDetailsDto.setDiscountedPrice(discountedPrice);
|
|
goodsDetailsDto.setDiscountedPrice(discountedPrice);
|
|
goodsDetailsDto.setDeductionScore(shareScoreItem.intValue());
|
|
goodsDetailsDto.setDeductionScore(shareScoreItem.intValue());
|
|
- goodsDetailsDto.setActualPaymentAmount(actualPaymentAmount.subtract(discountedPrice));
|
|
|
|
|
|
+ goodsDetailsDto.setActualPaymentAmount(retailPrice.subtract(discountedPrice));
|
|
}
|
|
}
|
|
// 订单商品详情最后一个商品并且详情不止一个商品
|
|
// 订单商品详情最后一个商品并且详情不止一个商品
|
|
if (i == index && size > 1) {// 商品总价
|
|
if (i == index && size > 1) {// 商品总价
|
|
@@ -4411,11 +4411,11 @@ public class OrderServiceImpl implements OrderService {
|
|
goodsDetailScoreDeductionPrice = goodsDetailScoreDeductionPrice.add(discountedPrice);
|
|
goodsDetailScoreDeductionPrice = goodsDetailScoreDeductionPrice.add(discountedPrice);
|
|
goodsDetailsDto.setDiscountedPrice(discountedPrice);
|
|
goodsDetailsDto.setDiscountedPrice(discountedPrice);
|
|
goodsDetailsDto.setDeductionScore(shareScoreItem.intValue());
|
|
goodsDetailsDto.setDeductionScore(shareScoreItem.intValue());
|
|
- goodsDetailsDto.setActualPaymentAmount(actualPaymentAmount.subtract(discountedPrice));
|
|
|
|
|
|
+ goodsDetailsDto.setActualPaymentAmount(retailPrice.subtract(discountedPrice));
|
|
}
|
|
}
|
|
// 订单商品详情只有一个商品的情况下
|
|
// 订单商品详情只有一个商品的情况下
|
|
if (size == 1) {
|
|
if (size == 1) {
|
|
- BigDecimal shareScoreItem = scoreIntegerDecimal.subtract(shareScore);
|
|
|
|
|
|
+ shareScore = scoreIntegerDecimal;
|
|
// 3-1. 计算总价的50%,百分比可以进行设置,算出整数(向下取整)
|
|
// 3-1. 计算总价的50%,百分比可以进行设置,算出整数(向下取整)
|
|
BigDecimal halfPrice = orderTotalPrice.multiply(scoreLimitDecimal).setScale(0, BigDecimal.ROUND_FLOOR);
|
|
BigDecimal halfPrice = orderTotalPrice.multiply(scoreLimitDecimal).setScale(0, BigDecimal.ROUND_FLOOR);
|
|
// 3-3. 计算积分抵扣后的价格
|
|
// 3-3. 计算积分抵扣后的价格
|
|
@@ -4426,8 +4426,8 @@ public class OrderServiceImpl implements OrderService {
|
|
}
|
|
}
|
|
goodsDetailScoreDeductionPrice = goodsDetailScoreDeductionPrice.add(discountedPrice);
|
|
goodsDetailScoreDeductionPrice = goodsDetailScoreDeductionPrice.add(discountedPrice);
|
|
goodsDetailsDto.setDiscountedPrice(discountedPrice);
|
|
goodsDetailsDto.setDiscountedPrice(discountedPrice);
|
|
- goodsDetailsDto.setDeductionScore(shareScoreItem.intValue());
|
|
|
|
- goodsDetailsDto.setActualPaymentAmount(actualPaymentAmount.subtract(discountedPrice));
|
|
|
|
|
|
+ goodsDetailsDto.setDeductionScore(shareScore.intValue());
|
|
|
|
+ goodsDetailsDto.setActualPaymentAmount(retailPrice.subtract(discountedPrice));
|
|
}
|
|
}
|
|
LOGGER.info("--------------------------------------------------------");
|
|
LOGGER.info("--------------------------------------------------------");
|
|
LOGGER.info("【计算优惠价】sku:【{}】,条码:【{}】积分抵扣{}元,抵扣积分{}分", sku, prodBarcode, goodsDetailsDto.getDiscountedPrice(), shareScore.intValue());
|
|
LOGGER.info("【计算优惠价】sku:【{}】,条码:【{}】积分抵扣{}元,抵扣积分{}分", sku, prodBarcode, goodsDetailsDto.getDiscountedPrice(), shareScore.intValue());
|