Browse Source

feat(service): 优化价格体系

dist.1.3.0
zhaoqiaobo 9 months ago
parent
commit
5be3192c5a
  1. 38
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataPriceServiceImpl.java

38
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataPriceServiceImpl.java

@ -21,6 +21,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@ -1541,12 +1542,14 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
// 按类型分组放到fullMap中
list.forEach(item -> {
Integer type = item.getType();
if (ObjectUtil.isNotNull(fullMap)) {
List<BasicdataPriceFullVehicleEntity> collect = fullMap.get(type);
if (ObjectUtil.isEmpty(collect)) {
collect = new ArrayList<>();
}
collect.add(item);
fullMap.put(type, collect);
}
});
}
// 获取品类数据
@ -1630,9 +1633,9 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
categoryBasicMap.put(type, collect);
});
}
if (ObjectUtil.isNotEmpty(dispatchPricingType)) {
//整车
if (dispatchPricingType.contains(DispatchPricingTypeEnums.COMPLETE_VEHICLE.getCode().toString())) {
if (ObjectUtil.contains(dispatchPricingType, DispatchPricingTypeEnums.COMPLETE_VEHICLE.getCode().toString())) {
if (CollUtil.isNotEmpty(fullVehicleEntities)) {
List<BasicdataPriceFullVehicleVO> basicVOList = new ArrayList<>();
fullVehicleEntities.forEach(item -> {
@ -1644,7 +1647,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
}
}
// 按件
if (dispatchPricingType.contains(DispatchPricingTypeEnums.PIECE.getCode().toString())) {
if (ObjectUtil.contains(dispatchPricingType, DispatchPricingTypeEnums.PIECE.getCode().toString())) {
List<PriceDispatchBasicVO> basicVOList = new ArrayList<>();
List<BasicdataPriceCategoryDispatchEntity> basicEntities = categoryBasicMap.get(DispatchPricingTypeEnums.PIECE.getCode());
if (CollUtil.isNotEmpty(basicEntities)) {
@ -1657,7 +1660,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
priceDispatchVO.setPieceCategory(basicVOList);
}
// 按重量
if (dispatchPricingType.contains(DispatchPricingTypeEnums.WEIGHT.getCode().toString())) {
if (ObjectUtil.contains(dispatchPricingType, DispatchPricingTypeEnums.WEIGHT.getCode().toString())) {
List<PriceDispatchBasicVO> basicVOList = new ArrayList<>();
List<BasicdataPriceCategoryDispatchEntity> basicEntities = categoryBasicMap.get(DispatchPricingTypeEnums.WEIGHT.getCode());
if (CollUtil.isNotEmpty(basicEntities)) {
@ -1670,7 +1673,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
priceDispatchVO.setWeightCategory(basicVOList);
}
// 按方
if (dispatchPricingType.contains(DispatchPricingTypeEnums.CUBE.getCode().toString())) {
if (ObjectUtil.contains(dispatchPricingType, DispatchPricingTypeEnums.CUBE.getCode().toString())) {
List<PriceDispatchBasicVO> basicVOList = new ArrayList<>();
List<BasicdataPriceCategoryDispatchEntity> basicEntities = categoryBasicMap.get(DispatchPricingTypeEnums.CUBE.getCode());
if (CollUtil.isNotEmpty(basicEntities)) {
@ -1683,7 +1686,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
priceDispatchVO.setCubeCategory(basicVOList);
}
// 按公里
if (dispatchPricingType.contains(DispatchPricingTypeEnums.KILOMETER.getCode().toString())) {
if (ObjectUtil.contains(dispatchPricingType, DispatchPricingTypeEnums.KILOMETER.getCode().toString())) {
List<PriceDispatchBasicVO> basicVOList = new ArrayList<>();
List<BasicdataPriceCategoryDispatchEntity> basicEntities = categoryBasicMap.get(DispatchPricingTypeEnums.KILOMETER.getCode());
if (CollUtil.isNotEmpty(basicEntities)) {
@ -1696,7 +1699,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
priceDispatchVO.setKilometerCost(basicVOList);
}
// 按吨
if (dispatchPricingType.contains(DispatchPricingTypeEnums.TON.getCode().toString())) {
if (ObjectUtil.contains(dispatchPricingType, DispatchPricingTypeEnums.TON.getCode().toString())) {
List<PriceDispatchBasicVO> basicVOList = new ArrayList<>();
List<BasicdataPriceCategoryDispatchEntity> basicEntities = categoryBasicMap.get(DispatchPricingTypeEnums.TON.getCode());
if (CollUtil.isNotEmpty(basicEntities)) {
@ -1709,7 +1712,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
priceDispatchVO.setTonCost(basicVOList);
}
//按吨公里
if (dispatchPricingType.contains(DispatchPricingTypeEnums.TON_PER_KILOMETER.getCode().toString())) {
if (ObjectUtil.contains(dispatchPricingType, DispatchPricingTypeEnums.TON_PER_KILOMETER.getCode().toString())) {
List<PriceDispatchBasicVO> basicVOList = new ArrayList<>();
List<BasicdataPriceCategoryDispatchEntity> basicEntities = categoryBasicMap.get(DispatchPricingTypeEnums.TON_PER_KILOMETER.getCode());
if (CollUtil.isNotEmpty(basicEntities)) {
@ -1721,6 +1724,8 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
}
priceDispatchVO.setTonKilometerCost(basicVOList);
}
}
//附加费
List<BasicdataPriceCategoryDispatchEntity> dispatchEntities1 = dispatchMap.get(CostTypeEnums.ADD.getCode());
if (CollUtil.isNotEmpty(dispatchEntities1)) {
@ -1748,9 +1753,11 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
}
}
// 设置基础费用
if (ObjectUtil.isNotEmpty(priceEntity)) {
priceDispatchVO.setDispatchUpwardJudgment(priceEntity.getDispatchUpwardJudgment());
priceDispatchVO.setDispatchUpwardJudgmentCost(priceEntity.getDispatchUpwardJudgmentCost());
priceDispatchVO.setDispatchStairsCarryingCharge(priceEntity.getDispatchStairsCarryingCharge());
}
return priceDispatchVO;
}
@ -1770,8 +1777,9 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
categoryBasicMap.put(type, collect);
});
}
if (ObjectUtil.isNotEmpty(warehousePricingType)) {
// 按件
if (warehousePricingType.equals(WarehousePricingTypeEnums.PIECE.getCode())) {
if (ObjectUtil.equal(warehousePricingType, WarehousePricingTypeEnums.PIECE.getCode())) {
List<BasicdataPriceCategoryWarehouseEntity> warehouseEntities1 = categoryBasicMap.get(WarehousePricingTypeEnums.PIECE.getCode());
if (CollUtil.isNotEmpty(warehouseEntities1)) {
List<PriceWarehouseBasicVO> basicVOS = warehouseEntities1.stream().map(item -> {
@ -1781,7 +1789,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
}).collect(Collectors.toList());
priceWarehouseVO.setCatergory(basicVOS);
}
} else if (warehousePricingType.equals(WarehousePricingTypeEnums.CUBE.getCode())) {
} else if (ObjectUtil.equal(warehousePricingType, WarehousePricingTypeEnums.CUBE.getCode())) {
List<BasicdataPriceCategoryWarehouseEntity> warehouseEntities2 = categoryBasicMap.get(WarehousePricingTypeEnums.CUBE.getCode());
if (CollUtil.isNotEmpty(warehouseEntities2)) {
List<PriceWarehouseBasicVO> basicVOS = warehouseEntities2.stream().map(item -> {
@ -1791,7 +1799,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
}).collect(Collectors.toList());
priceWarehouseVO.setCatergory(basicVOS);
}
} else if (warehousePricingType.equals(WarehousePricingTypeEnums.WEIGHT.getCode())) {
} else if (ObjectUtil.equal(warehousePricingType, WarehousePricingTypeEnums.WEIGHT.getCode())) {
List<BasicdataPriceCategoryWarehouseEntity> warehouseEntities3 = categoryBasicMap.get(WarehousePricingTypeEnums.WEIGHT.getCode());
if (CollUtil.isNotEmpty(warehouseEntities3)) {
List<PriceWarehouseBasicVO> basicVOS = warehouseEntities3.stream().map(item -> {
@ -1801,7 +1809,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
}).collect(Collectors.toList());
priceWarehouseVO.setCatergory(basicVOS);
}
} else if (warehousePricingType.equals(WarehousePricingTypeEnums.TONNE.getCode())) {
} else if (ObjectUtil.equal(warehousePricingType, WarehousePricingTypeEnums.TONNE.getCode())) {
List<BasicdataPriceCategoryWarehouseEntity> warehouseEntities4 = categoryBasicMap.get(WarehousePricingTypeEnums.TONNE.getCode());
if (CollUtil.isNotEmpty(warehouseEntities4)) {
List<PriceWarehouseBasicVO> basicVOS = warehouseEntities4.stream().map(item -> {
@ -1812,6 +1820,8 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
priceWarehouseVO.setCatergory(basicVOS);
}
}
}
// 附加费
List<BasicdataPriceCategoryWarehouseEntity> warehouseEntities1 = warehouseMap.get(CostTypeEnums.ADD.getCode());
if (CollUtil.isNotEmpty(warehouseEntities1)) {
@ -1832,6 +1842,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
initCategoryBasicMap(categoryBasicEntities, categoryBasicMap);
// 设置整车
String trunklinePricingType = templateEntity.getTrunklinePricingType();
if (StrUtil.isNotEmpty(trunklinePricingType)) {
if (trunklinePricingType.contains(TrunkLinePricingTypeEnums.COMPLETE_VEHICLE.getCode().toString())) {
if (CollUtil.isNotEmpty(fullVehicleEntities)) {
List<BasicdataPriceFullVehicleVO> fullVehicleVOS = fullVehicleEntities.stream().map(item -> {
@ -1878,6 +1889,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
priceTrunkLineVO.setWeightCategory(weightCategoryVOS);
}
}
}
Integer pickupIsMinCost = templateEntity.getPickupIsMinCost();
if (ObjectUtil.equal(pickupIsMinCost, BooleanZeroOneEnums.YES.getCode())) {
// 设置最低计费
@ -1900,6 +1912,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
// 设置整车
// fullVehicleEntities转为BasicdataPriceFullVehicleVO
String pickupPricingType = templateEntity.getPickupPricingType();
if (StrUtil.isNotEmpty(pickupPricingType)) {
if (pickupPricingType.contains(PickupPricingTypeEnums.COMPLETE_VEHICLE.getCode().toString())) {
if (CollUtil.isNotEmpty(fullVehicleEntities)) {
List<BasicdataPriceFullVehicleVO> fullVehicleVOS = fullVehicleEntities.stream().map(item -> {
@ -1946,6 +1959,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
pricePickupVO.setWeightCategory(basicVOS);
}
}
}
Integer pickupIsMinCost = templateEntity.getPickupIsMinCost();
if (ObjectUtil.equal(pickupIsMinCost, BooleanZeroOneEnums.YES.getCode())) {
// 设置最低计费

Loading…
Cancel
Save