|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.util.NumberUtil; |
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
@ -447,6 +448,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
|
|
|
|
|
log.warn("#############calculateRealCost: 未维护价格,无法计算。"); |
|
|
|
|
throw new CustomerException(405, "未维护价格,无法计算。"); |
|
|
|
|
} |
|
|
|
|
log.info("获取的价格:{}", JSONUtil.toJsonStr(price)); |
|
|
|
|
// 查询包件数据
|
|
|
|
|
List<StatisticsDistributionPackageEntity> distributionPackageEntities = distributionPackageService.list(new QueryWrapper<StatisticsDistributionPackageEntity>().lambda().eq(StatisticsDistributionPackageEntity::getOrderInfoId, id)); |
|
|
|
|
// 校验是否全部配送完成
|
|
|
|
@ -933,9 +935,11 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
|
|
|
|
|
|
|
|
|
|
private void buildBasicDispatchCost(StatisticsDistributionPackageEntity statisticsDistributionPackageEntity, PriceDispatchVO dispatch, Integer dispatchIsByCategory) { |
|
|
|
|
List<PriceDispatchBasicVO> pieceCategory = dispatch.getPieceCategory(); |
|
|
|
|
log.info("计算配送费开始:品类信息》》》{}", JSONUtil.toJsonStr(pieceCategory)); |
|
|
|
|
if (CollUtil.isNotEmpty(pieceCategory)) { |
|
|
|
|
List<PriceDispatchBasicVO> pieceList = pieceCategory; |
|
|
|
|
if (1 == dispatchIsByCategory) { |
|
|
|
|
log.info("按品类计算"); |
|
|
|
|
pieceList = pieceCategory.stream().filter(priceDispatchBasicVO -> { |
|
|
|
|
return StrUtil.equals(String.valueOf(priceDispatchBasicVO.getCategoryId()), statisticsDistributionPackageEntity.getProductId()); |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
@ -944,6 +948,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
|
|
|
|
|
PriceDispatchBasicVO priceDispatchBasicVO = pieceList.get(0); |
|
|
|
|
// TODO 如果是遗留件 按遗留件单价来计算 目前只有欧派有遗留件
|
|
|
|
|
Double price1 = priceDispatchBasicVO.getPrice(); |
|
|
|
|
log.info("基础按件价格:{}",price1); |
|
|
|
|
// 配送费 = 按件单价
|
|
|
|
|
statisticsDistributionPackageEntity.setDeliveryFee(NumberUtil.toBigDecimal(price1)); |
|
|
|
|
} |
|
|
|
@ -964,6 +969,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
|
|
|
|
|
BigDecimal totalVolume = statisticsDistributionPackageEntity.getVolume(); |
|
|
|
|
// 配送费 = 按方单价 * 体积
|
|
|
|
|
if (ObjectUtil.isNotEmpty(totalVolume)) { |
|
|
|
|
log.info("基础按方价格:{}",NumberUtil.toBigDecimal(price1).multiply(totalVolume)); |
|
|
|
|
statisticsDistributionPackageEntity.setDeliveryFee(NumberUtil.toBigDecimal(price1).multiply(totalVolume)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -984,6 +990,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
|
|
|
|
|
BigDecimal totalWeight = statisticsDistributionPackageEntity.getWeight(); |
|
|
|
|
// 配送费 = 按重量单价 * 重量
|
|
|
|
|
if (ObjectUtil.isNotEmpty(totalWeight)) { |
|
|
|
|
log.info("基础按重量价格:{}",totalWeight); |
|
|
|
|
statisticsDistributionPackageEntity.setDeliveryFee(NumberUtil.toBigDecimal(price1).multiply(totalWeight)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|