From 324651b2d73611c86111787921ad41b481471641 Mon Sep 17 00:00:00 2001 From: zhaoqiaobo Date: Tue, 21 May 2024 14:08:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(all):=20=E4=BF=AE=E6=94=B9=E4=BB=B7?= =?UTF-8?q?=E6=A0=BC=E4=BD=93=E7=B3=BB=E4=BF=9D=E5=AD=98=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1 兼容同时存在按区域计费和统一计费的情况 --- .../impl/BasicdataPriceServiceImpl.java | 279 ++++++++++++++---- 1 file changed, 227 insertions(+), 52 deletions(-) diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataPriceServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataPriceServiceImpl.java index 0ae01857c..5dd410828 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataPriceServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataPriceServiceImpl.java @@ -1287,6 +1287,9 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl routeEntityMap, Map vehicleTypeMap) { if (CollUtil.isNotEmpty(excels)) { + Map pickupEntityMap = new HashMap<>(); + Map trunkLineEntityMap = new HashMap<>(); + Map 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 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 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 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 templateMap, Map routeEntityMap) { if (CollUtil.isNotEmpty(excels)) { + // 不按区域计费时 客户+品牌 唯一 + Map pickupEntityMap = new HashMap<>(); + Map trunkLineEntityMap = new HashMap<>(); + Map dispatchEntityMap = new HashMap<>(); + Map 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 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 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 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 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 categoryEntityMap, List basicEntities, Map templateMap, Map routeEntityMap, List warehouseEntities, List dispatchEntities) { if (CollUtil.isNotEmpty(basicExcels)) { + Map pickupEntityMap = new HashMap<>(); + Map trunkLineEntityMap = new HashMap<>(); + Map warehouseEntityMap = new HashMap<>(); + Map warehouseAddEntityMap = new HashMap<>(); + Map dispatchEntityMap = new HashMap<>(); + Map 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 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 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 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 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 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 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