Browse Source

feat(all): 修改价格体系保存逻辑

1 兼容同时存在按区域计费和统一计费的情况
dist.1.3.0
zhaoqiaobo 8 months ago
parent
commit
324651b2d7
  1. 279
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataPriceServiceImpl.java

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

@ -1287,6 +1287,9 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
Map<String, BasicdataPriceRouteEntity> routeEntityMap,
Map<String, String> vehicleTypeMap) {
if (CollUtil.isNotEmpty(excels)) {
Map<String, BasicdataPriceFullVehicleEntity> pickupEntityMap = new HashMap<>();
Map<String, BasicdataPriceFullVehicleEntity> trunkLineEntityMap = new HashMap<>();
Map<String, BasicdataPriceFullVehicleEntity> dispatchEntityMap = new HashMap<>();
for (BasicdataPriceFullVehicleV2Excel excel : excels) {
BasicdataPriceEntity priceEntity = priceEntityMap.get(excel.getClient() + excel.getBrand());
if (ObjectUtil.isEmpty(priceEntity)) {
@ -1300,9 +1303,20 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
String pickupPrice = excel.getPickupPrice();
String trunkLinePrice = excel.getTrunkLinePrice();
String dispatchPrice = excel.getDispatchPrice();
if (StrUtil.isNotEmpty(pickupPrice)) {
BasicdataPriceFullVehicleEntity entity = new BasicdataPriceFullVehicleEntity();
if (ObjectUtil.isNotEmpty(pickupIsUnifyAreaBill) && ObjectUtil.equal(pickupIsUnifyAreaBill, BooleanZeroOneEnums.NO.getCode())) {
if (StrUtil.isNotEmpty(pickupPrice) && Convert.toDouble(pickupPrice) > 0) {
boolean b = ObjectUtil.isNotEmpty(pickupIsUnifyAreaBill) && ObjectUtil.equal(pickupIsUnifyAreaBill, BooleanZeroOneEnums.NO.getCode());
BasicdataPriceFullVehicleEntity entity = null;
if (b) {
entity = new BasicdataPriceFullVehicleEntity();
} else {
if (pickupEntityMap.containsKey(excel.getClient() + excel.getBrand() + excel.getVehicleType())) {
entity = pickupEntityMap.get(excel.getClient() + excel.getBrand() + excel.getVehicleType());
} else {
entity = new BasicdataPriceFullVehicleEntity();
pickupEntityMap.put(excel.getClient() + excel.getBrand() + excel.getVehicleType(), entity);
}
}
if (b) {
if (!ObjectUtil.isAllEmpty(excel.getClient(), excel.getBrand(), excel.getSendOrg())) {
String key = buildRoutKeyV2(excel.getClient(), excel.getBrand(), excel.getStartProvince(), excel.getStartCity(),
excel.getStartArea(), excel.getEndProvince(), excel.getEndCity(), excel.getEndArea(), excel.getSendOrg(), "1");
@ -1311,7 +1325,6 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
entity.setBoId(routeEntity.getId());
}
} else {
// TODO 这个放到校验的时候处理
entity.setBoId(priceEntity.getId());
log.error("价格体系导入FullVehicle数据无法处理,模板配置的按区域计费,数据不满足路径条件:{}", JSONUtil.toJsonStr(excel));
continue;
@ -1332,10 +1345,24 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
}
// 价格
entity.setPrice(Convert.toDouble(pickupPrice));
entities.add(entity);
if (b) {
entities.add(entity);
}
}
if (StrUtil.isNotEmpty(trunkLinePrice)) {
BasicdataPriceFullVehicleEntity entity = new BasicdataPriceFullVehicleEntity();
if (StrUtil.isNotEmpty(trunkLinePrice) && Convert.toDouble(trunkLinePrice) > 0) {
boolean b = ObjectUtil.isNotEmpty(trunklineIsUnifyAreaBill) && ObjectUtil.equal(trunklineIsUnifyAreaBill, BooleanZeroOneEnums.NO.getCode());
BasicdataPriceFullVehicleEntity entity = null;
if (b) {
entity = new BasicdataPriceFullVehicleEntity();
} else {
if (trunkLineEntityMap.containsKey(excel.getClient() + excel.getBrand() + excel.getVehicleType())) {
entity = trunkLineEntityMap.get(excel.getClient() + excel.getBrand() + excel.getVehicleType());
} else {
entity = new BasicdataPriceFullVehicleEntity();
trunkLineEntityMap.put(excel.getClient() + excel.getBrand() + excel.getVehicleType(), entity);
}
}
if (ObjectUtil.isNotEmpty(trunklineIsUnifyAreaBill) && ObjectUtil.equal(trunklineIsUnifyAreaBill, BooleanZeroOneEnums.NO.getCode())) {
if (!ObjectUtil.isAllEmpty(excel.getClient(), excel.getBrand(), excel.getSendOrg())) {
String key = buildRoutKeyV2(excel.getClient(), excel.getBrand(), excel.getStartProvince(), excel.getStartCity(),
@ -1345,7 +1372,6 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
entity.setBoId(routeEntity.getId());
}
} else {
// TODO 这个放到校验的时候处理
entity.setBoId(priceEntity.getId());
log.error("价格体系导入FullVehicle数据无法处理,模板配置的按区域计费,数据不满足路径条件:{}", JSONUtil.toJsonStr(excel));
continue;
@ -1366,10 +1392,19 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
}
// 价格
entity.setPrice(Convert.toDouble(trunkLinePrice));
entities.add(entity);
if (b) {
entities.add(entity);
}
}
if (StrUtil.isNotEmpty(dispatchPrice)) {
BasicdataPriceFullVehicleEntity entity = new BasicdataPriceFullVehicleEntity();
if (StrUtil.isNotEmpty(dispatchPrice) && Convert.toDouble(dispatchPrice) > 0) {
BasicdataPriceFullVehicleEntity entity = null;
if (dispatchEntityMap.containsKey(excel.getClient() + excel.getBrand() + excel.getVehicleType())) {
entity = dispatchEntityMap.get(excel.getClient() + excel.getBrand() + excel.getVehicleType());
} else {
entity = new BasicdataPriceFullVehicleEntity();
dispatchEntityMap.put(excel.getClient() + excel.getBrand() + excel.getVehicleType(), entity);
}
// 统一计费
entity.setBoId(priceEntity.getId());
entity.setPriceId(priceEntity.getId());
@ -1384,8 +1419,17 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
}
// 价格
entity.setPrice(Convert.toDouble(dispatchPrice));
entities.add(entity);
}
}
if (CollUtil.isNotEmpty(pickupEntityMap)) {
entities.addAll(pickupEntityMap.values());
}
if (CollUtil.isNotEmpty(dispatchEntityMap)) {
entities.addAll(dispatchEntityMap.values());
}
if (CollUtil.isNotEmpty(trunkLineEntityMap)) {
entities.addAll(trunkLineEntityMap.values());
}
}
}
@ -1423,7 +1467,6 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
}
} else {
basicEntity.setBoId(priceEntity.getId());
// TODO 这个放到校验的时候处理
log.error("价格体系导入General数据无法处理,模板配置的按区域计费,数据不满足路径条件:{}", JSONUtil.toJsonStr(basicExcel));
continue;
}
@ -1450,6 +1493,11 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
Map<String, BasicdataPriceTemplateEntity> templateMap, Map<String,
BasicdataPriceRouteEntity> routeEntityMap) {
if (CollUtil.isNotEmpty(excels)) {
// 不按区域计费时 客户+品牌 唯一
Map<String, BasicdataPriceGeneralEntity> pickupEntityMap = new HashMap<>();
Map<String, BasicdataPriceGeneralEntity> trunkLineEntityMap = new HashMap<>();
Map<String, BasicdataPriceGeneralEntity> dispatchEntityMap = new HashMap<>();
Map<String, BasicdataPriceGeneralEntity> dispatchLeaveBehindEntityMap = new HashMap<>();
for (BasicdataPriceGeneralV2Excel basicExcel : excels) {
BasicdataPriceEntity priceEntity = priceEntityMap.get(basicExcel.getClient() + basicExcel.getBrand());
if (ObjectUtil.isEmpty(priceEntity)) {
@ -1465,12 +1513,23 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
String trunkLineMinCost = basicExcel.getTrunkLineMinCost();
String dispatchMinCost = basicExcel.getDispatchMinCost();
String dispatchLeaveBehindMinCost = basicExcel.getDispatchLeaveBehindMinCost();
if (StrUtil.isNotEmpty(pickupMinCost)) {
if (StrUtil.isNotEmpty(pickupMinCost) && Convert.toDouble(pickupMinCost) > 0) {
boolean b = ObjectUtil.isNotEmpty(pickupIsUnifyAreaBill) && ObjectUtil.equal(pickupIsUnifyAreaBill, BooleanZeroOneEnums.NO.getCode());
// 服务类型
BasicdataPriceGeneralEntity basicEntity = new BasicdataPriceGeneralEntity();
BasicdataPriceGeneralEntity basicEntity = null;
if (b) {
basicEntity = new BasicdataPriceGeneralEntity();
} else {
if (pickupEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand())) {
basicEntity = pickupEntityMap.get(basicExcel.getClient() + basicExcel.getBrand());
} else {
basicEntity = new BasicdataPriceGeneralEntity();
pickupEntityMap.put(basicExcel.getClient() + basicExcel.getBrand(), basicEntity);
}
}
basicEntity.setServiceType(GeneralServiceTypeEnums.PICK_UP.getCode());
// 按区域计费
if (ObjectUtil.isNotEmpty(pickupIsUnifyAreaBill) && ObjectUtil.equal(pickupIsUnifyAreaBill, BooleanZeroOneEnums.NO.getCode())) {
if (b) {
if (!ObjectUtil.isAllEmpty(basicExcel.getClient(), basicExcel.getBrand(), basicExcel.getSendOrg())) {
String key = buildRoutKeyV2(basicExcel.getClient(), basicExcel.getBrand(), basicExcel.getStartProvince(), basicExcel.getStartCity(),
basicExcel.getStartArea(), basicExcel.getEndProvince(), basicExcel.getEndCity(), basicExcel.getEndArea(), basicExcel.getSendOrg(), "1");
@ -1480,7 +1539,6 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
}
} else {
basicEntity.setBoId(priceEntity.getId());
// TODO 这个放到校验的时候处理
log.error("价格体系导入General数据无法处理,模板配置的按区域计费,数据不满足路径条件:{}", JSONUtil.toJsonStr(basicExcel));
continue;
}
@ -1495,14 +1553,29 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
if (StrUtil.isNotEmpty(basicExcel.getPickupAddCost())) {
basicEntity.setAdditionalCost(Convert.toDouble(basicExcel.getPickupAddCost()));
}
entities.add(basicEntity);
// 按区域计费直接加入保存队列
if (b) {
entities.add(basicEntity);
}
}
if (StrUtil.isNotEmpty(trunkLineMinCost)) {
if (StrUtil.isNotEmpty(trunkLineMinCost) && Convert.toDouble(trunkLineMinCost) > 0) {
boolean b = ObjectUtil.isNotEmpty(trunklineIsUnifyAreaBill) && ObjectUtil.equal(trunklineIsUnifyAreaBill, BooleanZeroOneEnums.NO.getCode());
// 服务类型
BasicdataPriceGeneralEntity basicEntity = new BasicdataPriceGeneralEntity();
BasicdataPriceGeneralEntity basicEntity = null;
if (b) {
basicEntity = new BasicdataPriceGeneralEntity();
} else {
if (trunkLineEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand())) {
basicEntity = trunkLineEntityMap.get(basicExcel.getClient() + basicExcel.getBrand());
} else {
basicEntity = new BasicdataPriceGeneralEntity();
trunkLineEntityMap.put(basicExcel.getClient() + basicExcel.getBrand(), basicEntity);
}
}
basicEntity.setServiceType(GeneralServiceTypeEnums.TRUNK_LINE.getCode());
// 按区域计费
if (ObjectUtil.isNotEmpty(trunklineIsUnifyAreaBill) && ObjectUtil.equal(trunklineIsUnifyAreaBill, BooleanZeroOneEnums.NO.getCode())) {
if (b) {
if (!ObjectUtil.isAllEmpty(basicExcel.getClient(), basicExcel.getBrand(), basicExcel.getSendOrg())) {
String key = buildRoutKeyV2(basicExcel.getClient(), basicExcel.getBrand(), basicExcel.getStartProvince(), basicExcel.getStartCity(),
basicExcel.getStartArea(), basicExcel.getEndProvince(), basicExcel.getEndCity(), basicExcel.getEndArea(), basicExcel.getSendOrg(), "2");
@ -1512,7 +1585,6 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
}
} else {
basicEntity.setBoId(priceEntity.getId());
// TODO 这个放到校验的时候处理
log.error("价格体系导入General数据无法处理,模板配置的按区域计费,数据不满足路径条件:{}", JSONUtil.toJsonStr(basicExcel));
continue;
}
@ -1527,11 +1599,20 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
if (StrUtil.isNotEmpty(basicExcel.getTrunkLineAddCost())) {
basicEntity.setAdditionalCost(Convert.toDouble(basicExcel.getTrunkLineAddCost()));
}
entities.add(basicEntity);
if (b) {
entities.add(basicEntity);
}
}
if (StrUtil.isNotEmpty(dispatchMinCost)) {
if (StrUtil.isNotEmpty(dispatchMinCost) && Convert.toDouble(dispatchMinCost) > 0) {
// 服务类型
BasicdataPriceGeneralEntity basicEntity = new BasicdataPriceGeneralEntity();
BasicdataPriceGeneralEntity basicEntity = null;
if (dispatchEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand())) {
basicEntity = dispatchEntityMap.get(basicExcel.getClient() + basicExcel.getBrand());
} else {
basicEntity = new BasicdataPriceGeneralEntity();
dispatchEntityMap.put(basicExcel.getClient() + basicExcel.getBrand(), basicEntity);
}
basicEntity.setServiceType(GeneralServiceTypeEnums.DISPATCH.getCode());
// 统一计费
basicEntity.setBoId(priceEntity.getId());
@ -1542,11 +1623,17 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
if (StrUtil.isNotEmpty(basicExcel.getDispatchAddCost())) {
basicEntity.setAdditionalCost(Convert.toDouble(basicExcel.getDispatchAddCost()));
}
entities.add(basicEntity);
}
if (StrUtil.isNotEmpty(dispatchLeaveBehindMinCost)) {
if (StrUtil.isNotEmpty(dispatchLeaveBehindMinCost) && Convert.toDouble(dispatchLeaveBehindMinCost) > 0) {
// 服务类型
BasicdataPriceGeneralEntity basicEntity = new BasicdataPriceGeneralEntity();
BasicdataPriceGeneralEntity basicEntity = null;
if (dispatchLeaveBehindEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand())) {
basicEntity = dispatchLeaveBehindEntityMap.get(basicExcel.getClient() + basicExcel.getBrand());
} else {
basicEntity = new BasicdataPriceGeneralEntity();
dispatchLeaveBehindEntityMap.put(basicExcel.getClient() + basicExcel.getBrand(), basicEntity);
}
basicEntity.setServiceType(GeneralServiceTypeEnums.DISPATCH_LEAVE_BEHIND.getCode());
// 统一计费
basicEntity.setBoId(priceEntity.getId());
@ -1557,8 +1644,8 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
if (StrUtil.isNotEmpty(basicExcel.getDispatchLeaveBehindAddCost())) {
basicEntity.setAdditionalCost(Convert.toDouble(basicExcel.getDispatchLeaveBehindAddCost()));
}
entities.add(basicEntity);
}
String dispatchUpwardJudgment = basicExcel.getDispatchUpwardJudgment();
if (StrUtil.isNotEmpty(dispatchUpwardJudgment)) {
priceEntity.setDispatchUpwardJudgment(Convert.toDouble(dispatchUpwardJudgment));
@ -1568,6 +1655,18 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
priceEntity.setDispatchUpwardJudgmentCost(Convert.toDouble(dispatchUpwardJudgmentCost));
}
}
if (CollUtil.isNotEmpty(pickupEntityMap)) {
entities.addAll(pickupEntityMap.values());
}
if (CollUtil.isNotEmpty(dispatchLeaveBehindEntityMap)) {
entities.addAll(dispatchLeaveBehindEntityMap.values());
}
if (CollUtil.isNotEmpty(dispatchEntityMap)) {
entities.addAll(dispatchEntityMap.values());
}
if (CollUtil.isNotEmpty(trunkLineEntityMap)) {
entities.addAll(trunkLineEntityMap.values());
}
}
}
@ -1640,6 +1739,12 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
Map<String, BasicdataCategoryEntity> categoryEntityMap, List<BasicdataPriceCategoryBasicEntity> basicEntities,
Map<String, BasicdataPriceTemplateEntity> templateMap, Map<String, BasicdataPriceRouteEntity> routeEntityMap, List<BasicdataPriceCategoryWarehouseEntity> warehouseEntities, List<BasicdataPriceCategoryDispatchEntity> dispatchEntities) {
if (CollUtil.isNotEmpty(basicExcels)) {
Map<String, BasicdataPriceCategoryBasicEntity> pickupEntityMap = new HashMap<>();
Map<String, BasicdataPriceCategoryBasicEntity> trunkLineEntityMap = new HashMap<>();
Map<String, BasicdataPriceCategoryWarehouseEntity> warehouseEntityMap = new HashMap<>();
Map<String, BasicdataPriceCategoryWarehouseEntity> warehouseAddEntityMap = new HashMap<>();
Map<String, BasicdataPriceCategoryDispatchEntity> dispatchEntityMap = new HashMap<>();
Map<String, BasicdataPriceCategoryDispatchEntity> dispatchAddEntityMap = new HashMap<>();
for (BasicdataPriceCategoryV2Excel basicExcel : basicExcels) {
BasicdataPriceEntity priceEntity = priceEntityMap.get(basicExcel.getClient() + basicExcel.getBrand());
if (ObjectUtil.isEmpty(priceEntity)) {
@ -1652,10 +1757,21 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
Integer trunklineIsUnifyAreaBill = templateEntity.getTrunklineIsUnifyAreaBill();
String pickupPrice = basicExcel.getPickupPrice();
String trunkLinePrice = basicExcel.getTrunkLinePrice();
if (StrUtil.isNotEmpty(pickupPrice)) {
BasicdataPriceCategoryBasicEntity basicEntity = new BasicdataPriceCategoryBasicEntity();
if (StrUtil.isNotEmpty(pickupPrice) && Convert.toDouble(pickupPrice) > 0) {
boolean b = ObjectUtil.isNotEmpty(pickupIsUnifyAreaBill) && ObjectUtil.equal(pickupIsUnifyAreaBill, BooleanZeroOneEnums.NO.getCode());
BasicdataPriceCategoryBasicEntity basicEntity = null;
if (b) {
basicEntity = new BasicdataPriceCategoryBasicEntity();
} else {
if (pickupEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory())) {
basicEntity = pickupEntityMap.get(basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory());
} else {
basicEntity = new BasicdataPriceCategoryBasicEntity();
pickupEntityMap.put(basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory(), basicEntity);
}
}
// 按区域计费
if (ObjectUtil.isNotEmpty(pickupIsUnifyAreaBill) && ObjectUtil.equal(pickupIsUnifyAreaBill, BooleanZeroOneEnums.NO.getCode())) {
if (b) {
if (!ObjectUtil.isAllEmpty(basicExcel.getClient(), basicExcel.getBrand(), basicExcel.getSendOrg())) {
String key = buildRoutKeyV2(basicExcel.getClient(), basicExcel.getBrand(), basicExcel.getStartProvince(),
basicExcel.getStartCity(), basicExcel.getStartArea(), basicExcel.getEndProvince(),
@ -1665,7 +1781,6 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
basicEntity.setBoId(routeEntity.getId());
}
} else {
// TODO 这个放到校验的时候处理
basicEntity.setBoId(priceEntity.getId());
log.error("价格体系导入CategoryBasic数据无法处理,模板配置的按区域计费,数据不满足路径条件:{}", JSONUtil.toJsonStr(basicExcel));
continue;
@ -1688,12 +1803,25 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
}
// 价格
basicEntity.setPrice(Convert.toDouble(pickupPrice));
basicEntities.add(basicEntity);
if (b) {
basicEntities.add(basicEntity);
}
}
if (StrUtil.isNotEmpty(trunkLinePrice)) {
BasicdataPriceCategoryBasicEntity basicEntity = new BasicdataPriceCategoryBasicEntity();
if (StrUtil.isNotEmpty(trunkLinePrice) && Convert.toDouble(trunkLinePrice) > 0) {
boolean b = ObjectUtil.isNotEmpty(trunklineIsUnifyAreaBill) && ObjectUtil.equal(trunklineIsUnifyAreaBill, BooleanZeroOneEnums.NO.getCode());
BasicdataPriceCategoryBasicEntity basicEntity = null;
if (b) {
basicEntity = new BasicdataPriceCategoryBasicEntity();
} else {
if (trunkLineEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory())) {
basicEntity = trunkLineEntityMap.get(basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory());
} else {
basicEntity = new BasicdataPriceCategoryBasicEntity();
trunkLineEntityMap.put(basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory(), basicEntity);
}
}
// 按区域计费
if (ObjectUtil.isNotEmpty(trunklineIsUnifyAreaBill) && ObjectUtil.equal(trunklineIsUnifyAreaBill, BooleanZeroOneEnums.NO.getCode())) {
if (b) {
if (!ObjectUtil.isAllEmpty(basicExcel.getClient(), basicExcel.getBrand(), basicExcel.getSendOrg())) {
String key = buildRoutKeyV2(basicExcel.getClient(), basicExcel.getBrand(), basicExcel.getStartProvince(),
basicExcel.getStartCity(), basicExcel.getStartArea(), basicExcel.getEndProvince(),
@ -1703,7 +1831,6 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
basicEntity.setBoId(routeEntity.getId());
}
} else {
// TODO 这个放到校验的时候处理
basicEntity.setBoId(priceEntity.getId());
log.error("价格体系导入CategoryBasic数据无法处理,模板配置的按区域计费,数据不满足路径条件:{}", JSONUtil.toJsonStr(basicExcel));
continue;
@ -1726,14 +1853,26 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
}
// 价格
basicEntity.setPrice(Convert.toDouble(trunkLinePrice));
basicEntities.add(basicEntity);
if (b) {
basicEntities.add(basicEntity);
}
}
String withinThirtyPrice = basicExcel.getWithinThirtyPrice();
String betweenThirtySixtyPrice = basicExcel.getBetweenThirtySixtyPrice();
String beyondSixtyPrice = basicExcel.getBeyondSixtyPrice();
String beyondNinetyPrice = basicExcel.getBeyondNinetyPrice();
if (!ObjectUtil.isAllEmpty(withinThirtyPrice, betweenThirtySixtyPrice, beyondSixtyPrice, beyondNinetyPrice)) {
BasicdataPriceCategoryWarehouseEntity warehouseEntity = new BasicdataPriceCategoryWarehouseEntity();
// 4个仓储费只要有一个不为空则创建
if ((ObjectUtil.isNotEmpty(withinThirtyPrice) && Convert.toDouble(withinThirtyPrice) > 0)
|| (ObjectUtil.isNotEmpty(betweenThirtySixtyPrice) && Convert.toDouble(betweenThirtySixtyPrice) > 0)
|| (ObjectUtil.isNotEmpty(beyondSixtyPrice) && Convert.toDouble(beyondSixtyPrice) > 0)
|| (ObjectUtil.isNotEmpty(beyondNinetyPrice) && Convert.toDouble(beyondNinetyPrice) > 0)) {
BasicdataPriceCategoryWarehouseEntity warehouseEntity = null;
if (warehouseEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory())) {
warehouseEntity = warehouseEntityMap.get(basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory());
} else {
warehouseEntity = new BasicdataPriceCategoryWarehouseEntity();
warehouseEntityMap.put(basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory(), warehouseEntity);
}
if (ObjectUtil.isNotEmpty(priceEntity)) {
warehouseEntity.setPriceId(priceEntity.getId());
warehouseEntity.setBoId(priceEntity.getId());
@ -1759,13 +1898,20 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
if (StrUtil.isNotEmpty(basicExcel.getBeyondNinetyPrice())) {
warehouseEntity.setBeyondNinetyPrice(Convert.toDouble(basicExcel.getBeyondNinetyPrice()));
}
warehouseEntities.add(warehouseEntity);
}
String warehouseOperatePrice = basicExcel.getWarehouseOperatePrice();
String warehouseManagementPrice = basicExcel.getWarehouseManagementPrice();
String warehouseSortPrice = basicExcel.getWarehouseSortPrice();
if (!ObjectUtil.isAllEmpty(warehouseOperatePrice, warehouseManagementPrice, warehouseSortPrice)) {
BasicdataPriceCategoryWarehouseEntity warehouseEntity = new BasicdataPriceCategoryWarehouseEntity();
if ((ObjectUtil.isNotEmpty(warehouseOperatePrice) && Convert.toDouble(warehouseOperatePrice) > 0)
|| (ObjectUtil.isNotEmpty(warehouseManagementPrice) && Convert.toDouble(warehouseManagementPrice) > 0)
|| (ObjectUtil.isNotEmpty(warehouseSortPrice) && Convert.toDouble(warehouseSortPrice) > 0)) {
BasicdataPriceCategoryWarehouseEntity warehouseEntity = null;
if (warehouseAddEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory())) {
warehouseEntity = warehouseAddEntityMap.get(basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory());
} else {
warehouseEntity = new BasicdataPriceCategoryWarehouseEntity();
warehouseAddEntityMap.put(basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory(), warehouseEntity);
}
if (ObjectUtil.isNotEmpty(priceEntity)) {
warehouseEntity.setPriceId(priceEntity.getId());
warehouseEntity.setBoId(priceEntity.getId());
@ -1788,11 +1934,16 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
if (StrUtil.isNotEmpty(basicExcel.getWarehouseSortPrice())) {
warehouseEntity.setWarehouseSortPrice(Convert.toDouble(basicExcel.getWarehouseSortPrice()));
}
warehouseEntities.add(warehouseEntity);
}
String dispatchPrice = basicExcel.getDispatchPrice();
if (StrUtil.isNotEmpty(dispatchPrice)) {
BasicdataPriceCategoryDispatchEntity entity = new BasicdataPriceCategoryDispatchEntity();
if (StrUtil.isNotEmpty(dispatchPrice) && Convert.toDouble(dispatchPrice) > 0) {
BasicdataPriceCategoryDispatchEntity entity = null;
if (dispatchEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory())) {
entity = dispatchEntityMap.get(basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory());
} else {
entity = new BasicdataPriceCategoryDispatchEntity();
dispatchEntityMap.put(basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory(), entity);
}
if (ObjectUtil.isNotEmpty(priceEntity)) {
entity.setPriceId(priceEntity.getId());
entity.setBoId(priceEntity.getId());
@ -1814,14 +1965,22 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
if (StrUtil.isNotEmpty(basicExcel.getDispatchLeaveBehindPrice())) {
entity.setLeaveBehindPrice(Convert.toDouble(basicExcel.getDispatchLeaveBehindPrice()));
}
dispatchEntities.add(entity);
}
String dispatchSortPrice = basicExcel.getDispatchSortPrice();
String dispatchHandlingPrice = basicExcel.getDispatchHandlingPrice();
String dispatchRelocationPrice = basicExcel.getDispatchRelocationPrice();
String dispatchDeliveryPrice = basicExcel.getDispatchDeliveryPrice();
if (!ObjectUtil.isAllEmpty(dispatchSortPrice, dispatchHandlingPrice, dispatchRelocationPrice, dispatchDeliveryPrice)) {
BasicdataPriceCategoryDispatchEntity entity = new BasicdataPriceCategoryDispatchEntity();
if ((ObjectUtil.isNotEmpty(dispatchSortPrice) && Convert.toDouble(dispatchSortPrice) > 0)
|| (ObjectUtil.isNotEmpty(dispatchHandlingPrice) && Convert.toDouble(dispatchHandlingPrice) > 0)
|| (ObjectUtil.isNotEmpty(dispatchRelocationPrice) && Convert.toDouble(dispatchRelocationPrice) > 0)
|| (ObjectUtil.isNotEmpty(dispatchDeliveryPrice) && Convert.toDouble(dispatchDeliveryPrice) > 0)) {
BasicdataPriceCategoryDispatchEntity entity = null;
if (dispatchAddEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory())) {
entity = dispatchAddEntityMap.get(basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory());
} else {
entity = new BasicdataPriceCategoryDispatchEntity();
dispatchAddEntityMap.put(basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory(), entity);
}
if (ObjectUtil.isNotEmpty(priceEntity)) {
entity.setPriceId(priceEntity.getId());
entity.setBoId(priceEntity.getId());
@ -1849,13 +2008,29 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
if (StrUtil.isNotEmpty(basicExcel.getDispatchDeliveryPrice())) {
entity.setUpstairsDeliveryPrice(Convert.toDouble(basicExcel.getDispatchDeliveryPrice()));
}
dispatchEntities.add(entity);
}
String dispatchStairsCarryingCharge = basicExcel.getDispatchStairsCarryingCharge();
if (StrUtil.isNotEmpty(dispatchStairsCarryingCharge)) {
priceEntity.setDispatchStairsCarryingCharge(Convert.toInt(dispatchStairsCarryingCharge));
}
}
if (CollUtil.isNotEmpty(pickupEntityMap)) {
basicEntities.addAll(pickupEntityMap.values());
}
if (CollUtil.isNotEmpty(trunkLineEntityMap)) {
basicEntities.addAll(trunkLineEntityMap.values());
}
if (CollUtil.isNotEmpty(warehouseEntityMap)) {
warehouseEntities.addAll(warehouseEntityMap.values());
}
if (CollUtil.isNotEmpty(warehouseAddEntityMap)) {
warehouseEntities.addAll(warehouseAddEntityMap.values());
}
if (CollUtil.isNotEmpty(dispatchEntityMap)) {
dispatchEntities.addAll(dispatchEntityMap.values());
}
if (CollUtil.isNotEmpty(dispatchAddEntityMap)) {
dispatchEntities.addAll(dispatchAddEntityMap.values());
}
}
}

Loading…
Cancel
Save