Browse Source

feat(all): 修改结算配送费逻辑

1 修改结算费的计算逻辑,取消配送计价方式的匹配
visual
zhaoqiaobo 5 months ago
parent
commit
7317779e46
  1. 7
      blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsOrderInfoServiceImpl.java
  2. 2
      blade-service/logpm-statisticsdata/src/main/resources/application-prod.yml

7
blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsOrderInfoServiceImpl.java

@ -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));
}
}

2
blade-service/logpm-statisticsdata/src/main/resources/application-prod.yml

@ -1,6 +1,6 @@
#服务器端口
server:
port: 8200
port: 19999
#数据源配置
#spring:

Loading…
Cancel
Save