|  | @@ -4692,22 +4692,24 @@ public class OrderServiceImpl implements OrderService {
 | 
	
		
			
				|  |  |                      // 满赠商品不参与积分分摊计算
 | 
	
		
			
				|  |  |                      return !Constants.ActivityTopicEnum.MZ.getTopicName().equals(goodsDetailsDto.getActivity());
 | 
	
		
			
				|  |  |                  }).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +                // 系统设置的最大抵扣比例(最多能抵扣订单金额的比例),在系统管理的系统参数中设置,KEY为 HAIKONG_MEMBER_MAX_SCORE_RATIO
 | 
	
		
			
				|  |  | +                String scoreRatioStr = sysConfigDao.queryByKey(Constants.HAIKONG_MEMBER_MAX_SCORE_RATIO);
 | 
	
		
			
				|  |  | +                if (org.springframework.util.StringUtils.isEmpty(scoreRatioStr)) {
 | 
	
		
			
				|  |  | +                    LOGGER.error("计算优惠价格时,未设置订单的最大积分抵扣比例!");
 | 
	
		
			
				|  |  | +                    throw new ServiceException(String.format("请先设置订单的最大积分抵扣比例,设置方式:【系统管理】-->【系统参数】,参数名为:【%s】", Constants.HAIKONG_MEMBER_MAX_SCORE_RATIO));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                BigDecimal scoreRatio = new BigDecimal(scoreRatioStr);
 | 
	
		
			
				|  |  |                  // 总分摊积分
 | 
	
		
			
				|  |  |                  BigDecimal shareScore = BigDecimal.ZERO;
 | 
	
		
			
				|  |  |                  // 取整后的积分数量
 | 
	
		
			
				|  |  |                  BigDecimal scoreIntegerDecimal = BigDecimal.valueOf(scoreInteger);
 | 
	
		
			
				|  |  |                  // 计算积分能抵扣的金额
 | 
	
		
			
				|  |  | -                BigDecimal scoreCanDeductionPrice = scoreIntegerDecimal.divide(BigDecimal.valueOf(scoreLimit), 2, BigDecimal.ROUND_HALF_UP);
 | 
	
		
			
				|  |  | +                BigDecimal scoreCanDeductionPrice = orderTotalPrice.multiply(new BigDecimal(scoreRatioStr)).setScale(0, BigDecimal.ROUND_FLOOR);
 | 
	
		
			
				|  |  | +                // 计算最大可抵扣积分
 | 
	
		
			
				|  |  | +                BigDecimal maxDeductionScore = scoreCanDeductionPrice.multiply(BigDecimal.valueOf(scoreLimit));
 | 
	
		
			
				|  |  |                  // 订单详情积分抵扣总金额
 | 
	
		
			
				|  |  |                  BigDecimal goodsDetailScoreDeductionPrice = BigDecimal.ZERO;
 | 
	
		
			
				|  |  |                  int size = goodsDetailsDtos.size();
 | 
	
		
			
				|  |  | -                // 系统设置的最大抵扣比例(最多能抵扣订单金额的比例),在系统管理的系统参数中设置,KEY为 HAIKONG_MEMBER_MAX_SCORE_RATIO
 | 
	
		
			
				|  |  | -                String scoreRatioStr = sysConfigDao.queryByKey(Constants.HAIKONG_MEMBER_MAX_SCORE_RATIO);
 | 
	
		
			
				|  |  | -                if (org.springframework.util.StringUtils.isEmpty(scoreRatioStr)) {
 | 
	
		
			
				|  |  | -                    LOGGER.error("计算优惠价格时,未设置订单的最大积分抵扣比例!");
 | 
	
		
			
				|  |  | -                    throw new ServiceException(String.format("请先设置订单的最大积分抵扣比例,设置方式:【系统管理】-->【系统参数】,参数名为:【%s】", Constants.HAIKONG_MEMBER_MAX_SCORE_RATIO));
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -                BigDecimal scoreRatio = new BigDecimal(scoreRatioStr);
 | 
	
		
			
				|  |  |                  for (int i = 0; i < size; i++) {
 | 
	
		
			
				|  |  |                      GoodsDetailsDto goodsDetailsDto = goodsDetailsDtos.get(i);
 | 
	
		
			
				|  |  |                      // 抵扣积分分摊
 | 
	
	
		
			
				|  | @@ -4720,7 +4722,7 @@ public class OrderServiceImpl implements OrderService {
 | 
	
		
			
				|  |  |                      BigDecimal actualPaymentAmount = goodsDetailsDto.getActualPaymentAmount();
 | 
	
		
			
				|  |  |                      // 当前商品最大支持抵扣的金额
 | 
	
		
			
				|  |  |                      BigDecimal currentSkuMaxDeductionPrice = actualPaymentAmount.multiply(BigDecimal.valueOf(goodsDetailsDto.getSellVolume()))
 | 
	
		
			
				|  |  | -                                                                                .multiply(scoreRatio);
 | 
	
		
			
				|  |  | +                                                                                .multiply(scoreRatio).setScale(0, BigDecimal.ROUND_FLOOR);
 | 
	
		
			
				|  |  |                      // 其他活动优惠金额
 | 
	
		
			
				|  |  |                      BigDecimal otherDiscountedPrice = Objects.isNull(goodsDetailsDto.getDiscountedPrice()) ? BigDecimal.ZERO : goodsDetailsDto.getDiscountedPrice();
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -4734,7 +4736,7 @@ public class OrderServiceImpl implements OrderService {
 | 
	
		
			
				|  |  |                          discountedPrice = shareScoreItem.divide(BigDecimal.valueOf(scoreLimit), 2, BigDecimal.ROUND_HALF_UP);
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                      // 订单商品详情最后一个商品并且详情不止一个商品
 | 
	
		
			
				|  |  | -                    if (i == index && size > 1) {// 商品总价
 | 
	
		
			
				|  |  | +                    if (i == index && size > 1) {
 | 
	
		
			
				|  |  |                          // 最后一个商品分摊积分 = 积分总数 - 已分摊积分
 | 
	
		
			
				|  |  |                          shareScoreItem = scoreIntegerDecimal.subtract(shareScore);
 | 
	
		
			
				|  |  |  //                        discountedPrice = shareScoreItem.divide(BigDecimal.valueOf(scoreLimit), 2, BigDecimal.ROUND_HALF_UP);
 | 
	
	
		
			
				|  | @@ -4744,9 +4746,9 @@ public class OrderServiceImpl implements OrderService {
 | 
	
		
			
				|  |  |                      // 订单商品详情只有一个商品的情况下
 | 
	
		
			
				|  |  |                      if (size == 1) {
 | 
	
		
			
				|  |  |                          // 总计分为所有积分取整
 | 
	
		
			
				|  |  | -                        shareScore = scoreIntegerDecimal;
 | 
	
		
			
				|  |  | +                        shareScoreItem = scoreIntegerDecimal;
 | 
	
		
			
				|  |  |                          // 3-3. 计算积分抵扣后的价格
 | 
	
		
			
				|  |  | -                        discountedPrice = shareScore.divide(BigDecimal.valueOf(scoreLimit), 2, BigDecimal.ROUND_HALF_UP);
 | 
	
		
			
				|  |  | +                        discountedPrice = shareScoreItem.divide(BigDecimal.valueOf(scoreLimit), 2, BigDecimal.ROUND_HALF_UP);
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                      // 当前计算出来的积分抵扣金额如果比最大的还要大,则积分抵扣金额为最大抵扣金额,并且积分需要重新计算
 | 
	
		
			
				|  |  |                      if (discountedPrice.compareTo(currentSkuMaxDeductionPrice) > 0) {
 | 
	
	
		
			
				|  | @@ -5094,7 +5096,7 @@ public class OrderServiceImpl implements OrderService {
 | 
	
		
			
				|  |  |          orderGoodsVo.setInventoryType(goodsDto.getInventoryType());
 | 
	
		
			
				|  |  |          orderGoodsVo.setDefectiveProductsGrade(goodsDto.getDefectiveProductsGrade());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        BigDecimal number = new BigDecimal(Long.valueOf(goodsDto.getSellVolume()));
 | 
	
		
			
				|  |  | +        /*BigDecimal number = new BigDecimal(Long.valueOf(goodsDto.getSellVolume()));
 | 
	
		
			
				|  |  |          BigDecimal goodsTotal = goodsDto.getRetailPrice().multiply(number);//单商品总价
 | 
	
		
			
				|  |  |          BigDecimal rate = goodsTotal.divide(orderInfo.getGoods_price(), 2, BigDecimal.ROUND_HALF_UP);//当前商品总价/订单总价(不含运费、不含优惠券)
 | 
	
		
			
				|  |  |          BigDecimal freightPrice = BigDecimal.valueOf(orderInfo.getFreight_price());
 | 
	
	
		
			
				|  | @@ -5122,13 +5124,13 @@ public class OrderServiceImpl implements OrderService {
 | 
	
		
			
				|  |  |              orderGoodsVo.setSettlePrice(goodsTotal);//商品结算平摊价格
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  |              orderGoodsVo.setSettlePrice(settlePrice);//商品结算平摊价格
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +        }*/
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          // 计算税费
 | 
	
		
			
				|  |  | -        GoodsEntity goodsEntity = goodsService.queryObject(goodsDto.getId().intValue());
 | 
	
		
			
				|  |  | +        /*GoodsEntity goodsEntity = goodsService.queryObject(goodsDto.getId().intValue());
 | 
	
		
			
				|  |  |          BigDecimal goodsTax = CalculateTax.calculateFinalTax(goodsEntity, goodsDto.getStoreRetailPrice(), goodsService).setScale(3, RoundingMode.HALF_UP);
 | 
	
		
			
				|  |  | -        goodsTax = goodsTax.multiply(number).setScale(2, RoundingMode.HALF_UP);
 | 
	
		
			
				|  |  | -        orderGoodsVo.setTaxPrice(goodsTax);
 | 
	
		
			
				|  |  | +        goodsTax = goodsTax.multiply(number).setScale(2, RoundingMode.HALF_UP);*/
 | 
	
		
			
				|  |  | +        orderGoodsVo.setTaxPrice(goodsDto.getGoodsTaxes());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          return orderGoodsVo;
 | 
	
		
			
				|  |  |      }
 |