Browse Source

feat(all): 车次成本计算

1 修改车次成本公里数成本计算错误问题
dev
zhaoqiaobo 2 months ago
parent
commit
25bb6d4776
  1. 15
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java

15
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java

@ -142,7 +142,9 @@ public class DeliverFinishReportListener implements ReportService {
for (QualityDeliverEntity qualityDeliverEntity : value) {
QualityDeliverEntity entity = new QualityDeliverEntity();
entity.setId(qualityDeliverEntity.getId());
entity.setCarComplateTime(new Date());
if(ObjectUtil.isEmpty(entity.getCarComplateTime())){
entity.setCarComplateTime(new Date());
}
entity.setOrderCode(qualityDeliverEntity.getOrderCode());
entity.setWaybillNumber(qualityDeliverEntity.getWaybillNumber());
entity.setConditions(qualityDeliverEntity.getConditions());
@ -205,6 +207,7 @@ public class DeliverFinishReportListener implements ReportService {
idex++;
}
}
initRule(value, allRouteMap, firstRouteMap);
if (StrUtil.isNotEmpty(deliveryKind) && StrUtil.equals(deliveryKind, "自主配送")) {
if (StrUtil.isNotEmpty(qualityDeliverEntity.getDeliveryType())
&& (StrUtil.equals(qualityDeliverEntity.getDeliveryType(), "商配") || StrUtil.equals(qualityDeliverEntity.getDeliveryType(), "市配"))) {
@ -1085,6 +1088,7 @@ public class DeliverFinishReportListener implements ReportService {
return;
}
}
BigDecimal reduce = BigDecimal.ZERO;
for (Map.Entry<String, QualityDeliverEntity> entry : map.entrySet()) {
QualityDeliverEntity value1 = entry.getValue();
String warehousePosition = value1.getWarehousePosition();
@ -1100,13 +1104,10 @@ public class DeliverFinishReportListener implements ReportService {
}
// A-B B-C C-D 每一个点为起点到下一个点的距离
Long distance = GaoDeApiUtil.measureDistance(beforePositioning, arrivePositioning);
// 获取上一个点位的总距离
BigDecimal reduce = BigDecimal.ZERO;
if(CollUtil.isNotEmpty(allRouteMap)){
reduce = allRouteMap.values().stream().map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add);
}
String str = Convert.toStr(ObjectUtil.isNotEmpty(distance) ? NumberUtil.div(new BigDecimal(distance), 1000) : 0L / 1000);
allRouteMap.put(value1.getSignReservationCode(), Convert.toStr(NumberUtil.add(reduce, new BigDecimal(str))));
// 获取上一个点位的总距离
reduce = NumberUtil.add(reduce, new BigDecimal(str));
allRouteMap.put(value1.getSignReservationCode(), Convert.toStr(reduce));
beforePositioning = arrivePositioning;
}
}

Loading…
Cancel
Save