From eec956d198f261cc37bba0c2de1d5acb3a68431b Mon Sep 17 00:00:00 2001 From: zhaoqiaobo Date: Wed, 22 May 2024 21:32:49 +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=E5=AF=BC=E5=85=A5=E6=9C=AA=E6=8C=89?= =?UTF-8?q?=E8=AE=A1=E8=B4=B9=E6=96=B9=E5=BC=8F=E5=8C=BA=E5=88=86=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/BasicdataPriceServiceImpl.java | 738 ++++++++++-------- 1 file changed, 406 insertions(+), 332 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 a61b61e53..6d624f5c8 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 @@ -1800,160 +1800,10 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl 0) { - Long routeId = null; - Integer pickupIsByCategory = templateEntity.getPickupIsByCategory(); - // 按品类计费 - boolean categoryFlag = ObjectUtil.isNotEmpty(pickupIsByCategory) && ObjectUtil.equal(pickupIsByCategory, BooleanZeroOneEnums.YES.getCode()); - // 按区域计费 有路径的 - boolean b = ObjectUtil.isNotEmpty(pickupIsUnifyAreaBill) && ObjectUtil.equal(pickupIsUnifyAreaBill, BooleanZeroOneEnums.NO.getCode()); - BasicdataPriceCategoryBasicEntity basicEntity = null; - 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"); - BasicdataPriceRouteEntity routeEntity = routeEntityMap.get(key); - if (ObjectUtil.isNotEmpty(routeEntity)) { - routeId = routeEntity.getId(); - } - } else { - log.error("价格体系导入CategoryBasic数据无法处理,模板配置的按区域计费,数据不满足路径条件:{}", JSONUtil.toJsonStr(basicExcel)); - continue; - } - } - if (b && categoryFlag) { - // 有路径按品类计费 一个客户一条路径一个品类一个价格 - if (pickupEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand() + routeId + basicExcel.getCategory())) { - basicEntity = pickupEntityMap.get(basicExcel.getClient() + basicExcel.getBrand() + routeId + basicExcel.getCategory()); - } else { - basicEntity = new BasicdataPriceCategoryBasicEntity(); - pickupEntityMap.put(basicExcel.getClient() + basicExcel.getBrand() + routeId + basicExcel.getCategory(), basicEntity); - } - } else if (b && !categoryFlag) { - // 有路径不按品类计费,一个客户一条路径一个价格 - if (pickupEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand() + routeId)) { - basicEntity = pickupEntityMap.get(basicExcel.getClient() + basicExcel.getBrand() + routeId); - } else { - basicEntity = new BasicdataPriceCategoryBasicEntity(); - pickupEntityMap.put(basicExcel.getClient() + basicExcel.getBrand() + routeId, basicEntity); - } - } else if (!b && categoryFlag) { - // 没路径 按品类计费 一个客户一个品类一个价格 - 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); - } - } else { - // 没路径 不按品类计费 一个客户一个价格 - if (pickupEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand())) { - basicEntity = pickupEntityMap.get(basicExcel.getClient() + basicExcel.getBrand()); - } else { - basicEntity = new BasicdataPriceCategoryBasicEntity(); - pickupEntityMap.put(basicExcel.getClient() + basicExcel.getBrand(), basicEntity); - } - } - // 按区域计费 - if (b) { - basicEntity.setBoId(routeId); - } else { - basicEntity.setBoId(priceEntity.getId()); - } - basicEntity.setServiceType(ServiceTypeEnums.PICK_UP.getCode()); - // 计费类型 - if (StrUtil.isNotEmpty(basicExcel.getPickupUnit())) { - basicEntity.setType(IDict.getCodeByText(PickupPricingTypeEnums.class, basicExcel.getPickupUnit())); - } - basicEntity.setPriceId(priceEntity.getId()); - // 品类 - if (StrUtil.isNotEmpty(basicExcel.getCategory())) { - if (ObjectUtil.isNotEmpty(categoryEntityMap.get(basicExcel.getCategory()))) { - if (categoryFlag) { - basicEntity.setCategoryId(categoryEntityMap.get(basicExcel.getCategory()).getId()); - } - } - } - // 价格 - basicEntity.setPrice(Convert.toDouble(pickupPrice)); + buildSaveBasicExcel(categoryEntityMap, routeEntityMap, pickupEntityMap, basicExcel, priceEntity, templateEntity, pickupIsUnifyAreaBill, pickupPrice); } if (StrUtil.isNotEmpty(trunkLinePrice) && Convert.toDouble(trunkLinePrice) > 0) { - Long routeId = null; - Integer pickupIsByCategory = templateEntity.getTrunklineIsByCategory(); - // 按品类计费 - boolean categoryFlag = ObjectUtil.isNotEmpty(pickupIsByCategory) && ObjectUtil.equal(pickupIsByCategory, BooleanZeroOneEnums.YES.getCode()); - // 按区域计费 有路径的 - boolean b = ObjectUtil.isNotEmpty(trunklineIsUnifyAreaBill) && ObjectUtil.equal(trunklineIsUnifyAreaBill, BooleanZeroOneEnums.NO.getCode()); - BasicdataPriceCategoryBasicEntity basicEntity = null; - 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"); - BasicdataPriceRouteEntity routeEntity = routeEntityMap.get(key); - if (ObjectUtil.isNotEmpty(routeEntity)) { - routeId = routeEntity.getId(); - } - } else { - log.error("价格体系导入CategoryBasic数据无法处理,模板配置的按区域计费,数据不满足路径条件:{}", JSONUtil.toJsonStr(basicExcel)); - continue; - } - } - if (b && categoryFlag) { - // 有路径按品类计费 - if (trunkLineEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand() + routeId + basicExcel.getCategory())) { - basicEntity = trunkLineEntityMap.get(basicExcel.getClient() + basicExcel.getBrand() + routeId + basicExcel.getCategory()); - } else { - basicEntity = new BasicdataPriceCategoryBasicEntity(); - trunkLineEntityMap.put(basicExcel.getClient() + basicExcel.getBrand() + routeId + basicExcel.getCategory(), basicEntity); - } - } else if (b && !categoryFlag) { - // 有路径不按品类计费,一个客户一条路径一个价格 - if (trunkLineEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand() + routeId)) { - basicEntity = trunkLineEntityMap.get(basicExcel.getClient() + basicExcel.getBrand() + routeId); - } else { - basicEntity = new BasicdataPriceCategoryBasicEntity(); - trunkLineEntityMap.put(basicExcel.getClient() + basicExcel.getBrand() + routeId, basicEntity); - } - } else if (!b && categoryFlag) { - // 没路径 按品类计费 一个客户一个品类一个价格 - 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); - } - } else { - // 没路径 不按品类计费 一个客户一个价格 - if (trunkLineEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand())) { - basicEntity = trunkLineEntityMap.get(basicExcel.getClient() + basicExcel.getBrand()); - } else { - basicEntity = new BasicdataPriceCategoryBasicEntity(); - trunkLineEntityMap.put(basicExcel.getClient() + basicExcel.getBrand(), basicEntity); - } - } - // 按区域计费 - if (b) { - basicEntity.setBoId(routeId); - } else { - basicEntity.setBoId(priceEntity.getId()); - } - basicEntity.setServiceType(ServiceTypeEnums.TRUNK_LINE.getCode()); - // 计费类型 - if (StrUtil.isNotEmpty(basicExcel.getTrunkLineUnit())) { - basicEntity.setType(IDict.getCodeByText(TrunkLinePricingTypeEnums.class, basicExcel.getTrunkLineUnit())); - } - basicEntity.setPriceId(priceEntity.getId()); - // 品类 - if (StrUtil.isNotEmpty(basicExcel.getCategory())) { - if (ObjectUtil.isNotEmpty(categoryEntityMap.get(basicExcel.getCategory()))) { - if (categoryFlag) { - basicEntity.setCategoryId(categoryEntityMap.get(basicExcel.getCategory()).getId()); - } - } - } - // 价格 - basicEntity.setPrice(Convert.toDouble(trunkLinePrice)); + buildSaveTrunkLineExcel(categoryEntityMap, routeEntityMap, trunkLineEntityMap, basicExcel, priceEntity, templateEntity, trunklineIsUnifyAreaBill, trunkLinePrice); } String withinThirtyPrice = basicExcel.getWithinThirtyPrice(); String betweenThirtySixtyPrice = basicExcel.getBetweenThirtySixtyPrice(); @@ -1964,53 +1814,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl 0) || (ObjectUtil.isNotEmpty(beyondSixtyPrice) && Convert.toDouble(beyondSixtyPrice) > 0) || (ObjectUtil.isNotEmpty(beyondNinetyPrice) && Convert.toDouble(beyondNinetyPrice) > 0)) { - Integer pickupIsByCategory = templateEntity.getWarehouseIsByCategory(); - // 按品类计费 - boolean categoryFlag = ObjectUtil.isNotEmpty(pickupIsByCategory) && ObjectUtil.equal(pickupIsByCategory, BooleanZeroOneEnums.YES.getCode()); - BasicdataPriceCategoryWarehouseEntity warehouseEntity = null; - if(categoryFlag){ - 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); - } - }else{ - if (warehouseEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand())) { - warehouseEntity = warehouseEntityMap.get(basicExcel.getClient() + basicExcel.getBrand()); - } else { - warehouseEntity = new BasicdataPriceCategoryWarehouseEntity(); - warehouseEntityMap.put(basicExcel.getClient() + basicExcel.getBrand(), warehouseEntity); - } - } - - if (ObjectUtil.isNotEmpty(priceEntity)) { - warehouseEntity.setPriceId(priceEntity.getId()); - warehouseEntity.setBoId(priceEntity.getId()); - } - if (StrUtil.isNotEmpty(basicExcel.getCategory())) { - BasicdataCategoryEntity basicdataCategoryEntity = categoryEntityMap.get(basicExcel.getCategory()); - if (ObjectUtil.isNotEmpty(basicdataCategoryEntity)) { - if (categoryFlag) { - warehouseEntity.setCategoryId(basicdataCategoryEntity.getId()); - } - } - } - warehouseEntity.setCostType(CostTypeEnums.NOMAL.getCode()); - warehouseEntity.setType(Convert.toInt(templateEntity.getWarehousePricingType())); - warehouseEntity.setServiceType(1); - if (StrUtil.isNotEmpty(basicExcel.getWithinThirtyPrice())) { - warehouseEntity.setWithinThirtyPrice(Convert.toDouble(basicExcel.getWithinThirtyPrice())); - } - if (StrUtil.isNotEmpty(basicExcel.getBetweenThirtySixtyPrice())) { - warehouseEntity.setBetweenThirtySixtyPrice(Convert.toDouble(basicExcel.getBetweenThirtySixtyPrice())); - } - if (StrUtil.isNotEmpty(basicExcel.getBeyondSixtyPrice())) { - warehouseEntity.setBeyondSixtyPrice(Convert.toDouble(basicExcel.getBeyondSixtyPrice())); - } - if (StrUtil.isNotEmpty(basicExcel.getBeyondNinetyPrice())) { - warehouseEntity.setBeyondNinetyPrice(Convert.toDouble(basicExcel.getBeyondNinetyPrice())); - } + buildSaveWarehouseExcel(categoryEntityMap, warehouseEntityMap, basicExcel, priceEntity, templateEntity); } String warehouseOperatePrice = basicExcel.getWarehouseOperatePrice(); String warehouseManagementPrice = basicExcel.getWarehouseManagementPrice(); @@ -2018,94 +1822,11 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl 0) || (ObjectUtil.isNotEmpty(warehouseManagementPrice) && Convert.toDouble(warehouseManagementPrice) > 0) || (ObjectUtil.isNotEmpty(warehouseSortPrice) && Convert.toDouble(warehouseSortPrice) > 0)) { - Integer pickupIsByCategory = templateEntity.getWarehouseIsCategorySubjoin(); - // 按品类计费 - boolean categoryFlag = ObjectUtil.isNotEmpty(pickupIsByCategory) && ObjectUtil.equal(pickupIsByCategory, BooleanZeroOneEnums.YES.getCode()); - BasicdataPriceCategoryWarehouseEntity warehouseEntity = null; - if(categoryFlag){ - 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); - } - }else{ - if (warehouseAddEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand())) { - warehouseEntity = warehouseAddEntityMap.get(basicExcel.getClient() + basicExcel.getBrand()); - } else { - warehouseEntity = new BasicdataPriceCategoryWarehouseEntity(); - warehouseAddEntityMap.put(basicExcel.getClient() + basicExcel.getBrand(), warehouseEntity); - } - } - if (ObjectUtil.isNotEmpty(priceEntity)) { - warehouseEntity.setPriceId(priceEntity.getId()); - warehouseEntity.setBoId(priceEntity.getId()); - } - if (StrUtil.isNotEmpty(basicExcel.getCategory())) { - BasicdataCategoryEntity basicdataCategoryEntity = categoryEntityMap.get(basicExcel.getCategory()); - if (ObjectUtil.isNotEmpty(basicdataCategoryEntity)) { - if (categoryFlag) { - warehouseEntity.setCategoryId(basicdataCategoryEntity.getId()); - } - } - } - warehouseEntity.setCostType(CostTypeEnums.ADD.getCode()); - warehouseEntity.setType(Convert.toInt(templateEntity.getWarehousePricingType())); - warehouseEntity.setServiceType(1); - if (StrUtil.isNotEmpty(basicExcel.getWarehouseOperatePrice())) { - warehouseEntity.setOperatePrice(Convert.toDouble(basicExcel.getWarehouseOperatePrice())); - } - if (StrUtil.isNotEmpty(basicExcel.getWarehouseManagementPrice())) { - warehouseEntity.setWarehouseManagementPrice(Convert.toDouble(basicExcel.getWarehouseManagementPrice())); - } - if (StrUtil.isNotEmpty(basicExcel.getWarehouseSortPrice())) { - warehouseEntity.setWarehouseSortPrice(Convert.toDouble(basicExcel.getWarehouseSortPrice())); - } + buildSaveWarehouseAddExcel(categoryEntityMap, warehouseAddEntityMap, basicExcel, priceEntity, templateEntity); } String dispatchPrice = basicExcel.getDispatchPrice(); if (StrUtil.isNotEmpty(dispatchPrice) && Convert.toDouble(dispatchPrice) > 0) { - Integer pickupIsByCategory = templateEntity.getDispatchIsByCategory(); - // 按品类计费 - boolean categoryFlag = ObjectUtil.isNotEmpty(pickupIsByCategory) && ObjectUtil.equal(pickupIsByCategory, BooleanZeroOneEnums.YES.getCode()); - BasicdataPriceCategoryDispatchEntity entity = null; - if(categoryFlag){ - 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); - } - }else{ - if (dispatchEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand())) { - entity = dispatchEntityMap.get(basicExcel.getClient() + basicExcel.getBrand()); - } else { - entity = new BasicdataPriceCategoryDispatchEntity(); - dispatchEntityMap.put(basicExcel.getClient() + basicExcel.getBrand(), entity); - } - } - if (ObjectUtil.isNotEmpty(priceEntity)) { - entity.setPriceId(priceEntity.getId()); - entity.setBoId(priceEntity.getId()); - } - if (StrUtil.isNotEmpty(basicExcel.getCategory())) { - BasicdataCategoryEntity basicdataCategoryEntity = categoryEntityMap.get(basicExcel.getCategory()); - if (ObjectUtil.isNotEmpty(basicdataCategoryEntity)) { - if (categoryFlag) { - entity.setCategoryId(basicdataCategoryEntity.getId()); - } - } - } - entity.setCostType(CostTypeEnums.NOMAL.getCode()); - if (StrUtil.isNotEmpty(basicExcel.getDispatchUnit())) { - entity.setType(IDict.getCodeByText(DispatchPricingTypeEnums.class, basicExcel.getDispatchUnit())); - } - entity.setServiceType(1); - if (StrUtil.isNotEmpty(basicExcel.getDispatchPrice())) { - entity.setPrice(Convert.toDouble(basicExcel.getDispatchPrice())); - } - if (StrUtil.isNotEmpty(basicExcel.getDispatchLeaveBehindPrice())) { - entity.setLeaveBehindPrice(Convert.toDouble(basicExcel.getDispatchLeaveBehindPrice())); - } + buildSaveDispatchExcel(categoryEntityMap, dispatchEntityMap, basicExcel, priceEntity, templateEntity); } String dispatchSortPrice = basicExcel.getDispatchSortPrice(); String dispatchHandlingPrice = basicExcel.getDispatchHandlingPrice(); @@ -2115,54 +1836,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl 0) || (ObjectUtil.isNotEmpty(dispatchRelocationPrice) && Convert.toDouble(dispatchRelocationPrice) > 0) || (ObjectUtil.isNotEmpty(dispatchDeliveryPrice) && Convert.toDouble(dispatchDeliveryPrice) > 0)) { - Integer pickupIsByCategory = templateEntity.getDispatchIsByCategory(); - // 按品类计费 - boolean categoryFlag = ObjectUtil.isNotEmpty(pickupIsByCategory) && ObjectUtil.equal(pickupIsByCategory, BooleanZeroOneEnums.YES.getCode()); - BasicdataPriceCategoryDispatchEntity entity = null; - if(categoryFlag){ - 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); - } - }else{ - if (dispatchAddEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand())) { - entity = dispatchAddEntityMap.get(basicExcel.getClient() + basicExcel.getBrand()); - } else { - entity = new BasicdataPriceCategoryDispatchEntity(); - dispatchAddEntityMap.put(basicExcel.getClient() + basicExcel.getBrand(), entity); - } - } - if (ObjectUtil.isNotEmpty(priceEntity)) { - entity.setPriceId(priceEntity.getId()); - entity.setBoId(priceEntity.getId()); - } - if (StrUtil.isNotEmpty(basicExcel.getCategory())) { - BasicdataCategoryEntity basicdataCategoryEntity = categoryEntityMap.get(basicExcel.getCategory()); - if (ObjectUtil.isNotEmpty(basicdataCategoryEntity)) { - if (categoryFlag) { - entity.setCategoryId(basicdataCategoryEntity.getId()); - } - } - } - entity.setCostType(CostTypeEnums.ADD.getCode()); - if (StrUtil.isNotEmpty(basicExcel.getDispatchUnit())) { - entity.setType(IDict.getCodeByText(DispatchPricingTypeEnums.class, basicExcel.getDispatchUnit())); - } - entity.setServiceType(1); - if (StrUtil.isNotEmpty(basicExcel.getDispatchSortPrice())) { - entity.setSortPrice(Convert.toDouble(basicExcel.getDispatchSortPrice())); - } - if (StrUtil.isNotEmpty(basicExcel.getDispatchHandlingPrice())) { - entity.setHandlingPrice(Convert.toDouble(basicExcel.getDispatchHandlingPrice())); - } - if (StrUtil.isNotEmpty(basicExcel.getDispatchRelocationPrice())) { - entity.setRelocationPrice(Convert.toDouble(basicExcel.getDispatchRelocationPrice())); - } - if (StrUtil.isNotEmpty(basicExcel.getDispatchDeliveryPrice())) { - entity.setUpstairsDeliveryPrice(Convert.toDouble(basicExcel.getDispatchDeliveryPrice())); - } + buildSaveDispatchAddExcel(categoryEntityMap, dispatchAddEntityMap, basicExcel, priceEntity, templateEntity); } String dispatchStairsCarryingCharge = basicExcel.getDispatchStairsCarryingCharge(); if (StrUtil.isNotEmpty(dispatchStairsCarryingCharge)) { @@ -2190,6 +1864,406 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl categoryEntityMap, Map dispatchAddEntityMap, BasicdataPriceCategoryV2Excel basicExcel, BasicdataPriceEntity priceEntity, BasicdataPriceTemplateEntity templateEntity) { + Integer pickupIsByCategory = templateEntity.getDispatchIsByCategory(); + // 按品类计费 + boolean categoryFlag = ObjectUtil.isNotEmpty(pickupIsByCategory) && ObjectUtil.equal(pickupIsByCategory, BooleanZeroOneEnums.YES.getCode()); + BasicdataPriceCategoryDispatchEntity entity = null; + if(categoryFlag){ + String key = basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory(); + if(StrUtil.isNotEmpty(basicExcel.getDispatchUnit())){ + key = key + basicExcel.getDispatchUnit(); + } + if (dispatchAddEntityMap.containsKey(key)) { + entity = dispatchAddEntityMap.get(key); + } else { + entity = new BasicdataPriceCategoryDispatchEntity(); + dispatchAddEntityMap.put(key, entity); + } + }else{ + String key = basicExcel.getClient() + basicExcel.getBrand(); + if(StrUtil.isNotEmpty(basicExcel.getDispatchUnit())){ + key = key + basicExcel.getDispatchUnit(); + } + if (dispatchAddEntityMap.containsKey(key)) { + entity = dispatchAddEntityMap.get(key); + } else { + entity = new BasicdataPriceCategoryDispatchEntity(); + dispatchAddEntityMap.put(key, entity); + } + } + if (ObjectUtil.isNotEmpty(priceEntity)) { + entity.setPriceId(priceEntity.getId()); + entity.setBoId(priceEntity.getId()); + } + if (StrUtil.isNotEmpty(basicExcel.getCategory())) { + BasicdataCategoryEntity basicdataCategoryEntity = categoryEntityMap.get(basicExcel.getCategory()); + if (ObjectUtil.isNotEmpty(basicdataCategoryEntity)) { + if (categoryFlag) { + entity.setCategoryId(basicdataCategoryEntity.getId()); + } + } + } + entity.setCostType(CostTypeEnums.ADD.getCode()); + if (StrUtil.isNotEmpty(basicExcel.getDispatchUnit())) { + entity.setType(IDict.getCodeByText(DispatchPricingTypeEnums.class, basicExcel.getDispatchUnit())); + } + entity.setServiceType(1); + if (StrUtil.isNotEmpty(basicExcel.getDispatchSortPrice())) { + entity.setSortPrice(Convert.toDouble(basicExcel.getDispatchSortPrice())); + } + if (StrUtil.isNotEmpty(basicExcel.getDispatchHandlingPrice())) { + entity.setHandlingPrice(Convert.toDouble(basicExcel.getDispatchHandlingPrice())); + } + if (StrUtil.isNotEmpty(basicExcel.getDispatchRelocationPrice())) { + entity.setRelocationPrice(Convert.toDouble(basicExcel.getDispatchRelocationPrice())); + } + if (StrUtil.isNotEmpty(basicExcel.getDispatchDeliveryPrice())) { + entity.setUpstairsDeliveryPrice(Convert.toDouble(basicExcel.getDispatchDeliveryPrice())); + } + } + + private void buildSaveDispatchExcel(Map categoryEntityMap, Map dispatchEntityMap, BasicdataPriceCategoryV2Excel basicExcel, BasicdataPriceEntity priceEntity, BasicdataPriceTemplateEntity templateEntity) { + Integer pickupIsByCategory = templateEntity.getDispatchIsByCategory(); + // 按品类计费 + boolean categoryFlag = ObjectUtil.isNotEmpty(pickupIsByCategory) && ObjectUtil.equal(pickupIsByCategory, BooleanZeroOneEnums.YES.getCode()); + BasicdataPriceCategoryDispatchEntity entity = null; + if(categoryFlag){ + String key = basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory(); + if(StrUtil.isNotEmpty(basicExcel.getDispatchUnit())){ + key = key + basicExcel.getDispatchUnit(); + } + if (dispatchEntityMap.containsKey(key)) { + entity = dispatchEntityMap.get(key); + } else { + entity = new BasicdataPriceCategoryDispatchEntity(); + dispatchEntityMap.put(key, entity); + } + }else{ + String key = basicExcel.getClient() + basicExcel.getBrand(); + if(StrUtil.isNotEmpty(basicExcel.getDispatchUnit())){ + key = key + basicExcel.getDispatchUnit(); + } + if (dispatchEntityMap.containsKey(key)) { + entity = dispatchEntityMap.get(key); + } else { + entity = new BasicdataPriceCategoryDispatchEntity(); + dispatchEntityMap.put(key, entity); + } + } + if (ObjectUtil.isNotEmpty(priceEntity)) { + entity.setPriceId(priceEntity.getId()); + entity.setBoId(priceEntity.getId()); + } + if (StrUtil.isNotEmpty(basicExcel.getCategory())) { + BasicdataCategoryEntity basicdataCategoryEntity = categoryEntityMap.get(basicExcel.getCategory()); + if (ObjectUtil.isNotEmpty(basicdataCategoryEntity)) { + if (categoryFlag) { + entity.setCategoryId(basicdataCategoryEntity.getId()); + } + } + } + entity.setCostType(CostTypeEnums.NOMAL.getCode()); + if (StrUtil.isNotEmpty(basicExcel.getDispatchUnit())) { + entity.setType(IDict.getCodeByText(DispatchPricingTypeEnums.class, basicExcel.getDispatchUnit())); + } + entity.setServiceType(1); + if (StrUtil.isNotEmpty(basicExcel.getDispatchPrice())) { + entity.setPrice(Convert.toDouble(basicExcel.getDispatchPrice())); + } + if (StrUtil.isNotEmpty(basicExcel.getDispatchLeaveBehindPrice())) { + entity.setLeaveBehindPrice(Convert.toDouble(basicExcel.getDispatchLeaveBehindPrice())); + } + } + + private void buildSaveWarehouseAddExcel(Map categoryEntityMap, Map warehouseAddEntityMap, BasicdataPriceCategoryV2Excel basicExcel, BasicdataPriceEntity priceEntity, BasicdataPriceTemplateEntity templateEntity) { + Integer pickupIsByCategory = templateEntity.getWarehouseIsCategorySubjoin(); + // 按品类计费 + boolean categoryFlag = ObjectUtil.isNotEmpty(pickupIsByCategory) && ObjectUtil.equal(pickupIsByCategory, BooleanZeroOneEnums.YES.getCode()); + BasicdataPriceCategoryWarehouseEntity warehouseEntity = null; + if(categoryFlag){ + String key = basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory(); + if(StrUtil.isNotEmpty(basicExcel.getDispatchUnit())){ + key = key + basicExcel.getDispatchUnit(); + } + if (warehouseAddEntityMap.containsKey(key)) { + warehouseEntity = warehouseAddEntityMap.get(key); + } else { + warehouseEntity = new BasicdataPriceCategoryWarehouseEntity(); + warehouseAddEntityMap.put(key, warehouseEntity); + } + }else{ + String key = basicExcel.getClient() + basicExcel.getBrand(); + if(StrUtil.isNotEmpty(basicExcel.getDispatchUnit())){ + key = key + basicExcel.getDispatchUnit(); + } + if (warehouseAddEntityMap.containsKey(key)) { + warehouseEntity = warehouseAddEntityMap.get(key); + } else { + warehouseEntity = new BasicdataPriceCategoryWarehouseEntity(); + warehouseAddEntityMap.put(key, warehouseEntity); + } + } + if (ObjectUtil.isNotEmpty(priceEntity)) { + warehouseEntity.setPriceId(priceEntity.getId()); + warehouseEntity.setBoId(priceEntity.getId()); + } + if (StrUtil.isNotEmpty(basicExcel.getCategory())) { + BasicdataCategoryEntity basicdataCategoryEntity = categoryEntityMap.get(basicExcel.getCategory()); + if (ObjectUtil.isNotEmpty(basicdataCategoryEntity)) { + if (categoryFlag) { + warehouseEntity.setCategoryId(basicdataCategoryEntity.getId()); + } + } + } + warehouseEntity.setCostType(CostTypeEnums.ADD.getCode()); + warehouseEntity.setType(Convert.toInt(templateEntity.getWarehousePricingType())); + warehouseEntity.setServiceType(1); + if (StrUtil.isNotEmpty(basicExcel.getWarehouseOperatePrice())) { + warehouseEntity.setOperatePrice(Convert.toDouble(basicExcel.getWarehouseOperatePrice())); + } + if (StrUtil.isNotEmpty(basicExcel.getWarehouseManagementPrice())) { + warehouseEntity.setWarehouseManagementPrice(Convert.toDouble(basicExcel.getWarehouseManagementPrice())); + } + if (StrUtil.isNotEmpty(basicExcel.getWarehouseSortPrice())) { + warehouseEntity.setWarehouseSortPrice(Convert.toDouble(basicExcel.getWarehouseSortPrice())); + } + } + + private void buildSaveWarehouseExcel(Map categoryEntityMap, Map warehouseEntityMap, BasicdataPriceCategoryV2Excel basicExcel, BasicdataPriceEntity priceEntity, BasicdataPriceTemplateEntity templateEntity) { + Integer pickupIsByCategory = templateEntity.getWarehouseIsByCategory(); + // 按品类计费 + boolean categoryFlag = ObjectUtil.isNotEmpty(pickupIsByCategory) && ObjectUtil.equal(pickupIsByCategory, BooleanZeroOneEnums.YES.getCode()); + BasicdataPriceCategoryWarehouseEntity warehouseEntity = null; + if(categoryFlag){ + 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); + } + }else{ + if (warehouseEntityMap.containsKey(basicExcel.getClient() + basicExcel.getBrand())) { + warehouseEntity = warehouseEntityMap.get(basicExcel.getClient() + basicExcel.getBrand()); + } else { + warehouseEntity = new BasicdataPriceCategoryWarehouseEntity(); + warehouseEntityMap.put(basicExcel.getClient() + basicExcel.getBrand(), warehouseEntity); + } + } + + if (ObjectUtil.isNotEmpty(priceEntity)) { + warehouseEntity.setPriceId(priceEntity.getId()); + warehouseEntity.setBoId(priceEntity.getId()); + } + if (StrUtil.isNotEmpty(basicExcel.getCategory())) { + BasicdataCategoryEntity basicdataCategoryEntity = categoryEntityMap.get(basicExcel.getCategory()); + if (ObjectUtil.isNotEmpty(basicdataCategoryEntity)) { + if (categoryFlag) { + warehouseEntity.setCategoryId(basicdataCategoryEntity.getId()); + } + } + } + warehouseEntity.setCostType(CostTypeEnums.NOMAL.getCode()); + warehouseEntity.setType(Convert.toInt(templateEntity.getWarehousePricingType())); + warehouseEntity.setServiceType(1); + if (StrUtil.isNotEmpty(basicExcel.getWithinThirtyPrice())) { + warehouseEntity.setWithinThirtyPrice(Convert.toDouble(basicExcel.getWithinThirtyPrice())); + } + if (StrUtil.isNotEmpty(basicExcel.getBetweenThirtySixtyPrice())) { + warehouseEntity.setBetweenThirtySixtyPrice(Convert.toDouble(basicExcel.getBetweenThirtySixtyPrice())); + } + if (StrUtil.isNotEmpty(basicExcel.getBeyondSixtyPrice())) { + warehouseEntity.setBeyondSixtyPrice(Convert.toDouble(basicExcel.getBeyondSixtyPrice())); + } + if (StrUtil.isNotEmpty(basicExcel.getBeyondNinetyPrice())) { + warehouseEntity.setBeyondNinetyPrice(Convert.toDouble(basicExcel.getBeyondNinetyPrice())); + } + } + + private void buildSaveTrunkLineExcel(Map categoryEntityMap, Map routeEntityMap, Map trunkLineEntityMap, BasicdataPriceCategoryV2Excel basicExcel, BasicdataPriceEntity priceEntity, BasicdataPriceTemplateEntity templateEntity, Integer trunklineIsUnifyAreaBill, String trunkLinePrice) { + Long routeId = null; + Integer pickupIsByCategory = templateEntity.getTrunklineIsByCategory(); + // 按品类计费 + boolean categoryFlag = ObjectUtil.isNotEmpty(pickupIsByCategory) && ObjectUtil.equal(pickupIsByCategory, BooleanZeroOneEnums.YES.getCode()); + // 按区域计费 有路径的 + boolean b = ObjectUtil.isNotEmpty(trunklineIsUnifyAreaBill) && ObjectUtil.equal(trunklineIsUnifyAreaBill, BooleanZeroOneEnums.NO.getCode()); + BasicdataPriceCategoryBasicEntity basicEntity = null; + 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"); + BasicdataPriceRouteEntity routeEntity = routeEntityMap.get(key); + if (ObjectUtil.isNotEmpty(routeEntity)) { + routeId = routeEntity.getId(); + } + } + } + if (b && categoryFlag) { + // 有路径按品类计费 + String key = basicExcel.getClient() + basicExcel.getBrand() + routeId + basicExcel.getCategory(); + if(StrUtil.isNotEmpty(basicExcel.getTrunkLineUnit())){ + key = key + basicExcel.getTrunkLineUnit(); + } + if (trunkLineEntityMap.containsKey(key)) { + basicEntity = trunkLineEntityMap.get(key); + } else { + basicEntity = new BasicdataPriceCategoryBasicEntity(); + trunkLineEntityMap.put(key, basicEntity); + } + } else if (b && !categoryFlag) { + // 有路径不按品类计费,一个客户一条路径一个价格 + String key = basicExcel.getClient() + basicExcel.getBrand() + routeId; + if(StrUtil.isNotEmpty(basicExcel.getTrunkLineUnit())){ + key = key + basicExcel.getTrunkLineUnit(); + } + if (trunkLineEntityMap.containsKey(key)) { + basicEntity = trunkLineEntityMap.get(key); + } else { + basicEntity = new BasicdataPriceCategoryBasicEntity(); + trunkLineEntityMap.put(key, basicEntity); + } + } else if (!b && categoryFlag) { + // 没路径 按品类计费 一个客户一个品类一个价格 + String key = basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory(); + if(StrUtil.isNotEmpty(basicExcel.getTrunkLineUnit())){ + key = key + basicExcel.getTrunkLineUnit(); + } + if (trunkLineEntityMap.containsKey(key)) { + basicEntity = trunkLineEntityMap.get(key); + } else { + basicEntity = new BasicdataPriceCategoryBasicEntity(); + trunkLineEntityMap.put(key, basicEntity); + } + } else { + // 没路径 不按品类计费 一个客户一个价格 + String key = basicExcel.getClient() + basicExcel.getBrand(); + if(StrUtil.isNotEmpty(basicExcel.getTrunkLineUnit())){ + key = key + basicExcel.getTrunkLineUnit(); + } + if (trunkLineEntityMap.containsKey(key)) { + basicEntity = trunkLineEntityMap.get(key); + } else { + basicEntity = new BasicdataPriceCategoryBasicEntity(); + trunkLineEntityMap.put(key, basicEntity); + } + } + // 按区域计费 + if (b) { + basicEntity.setBoId(routeId); + } else { + basicEntity.setBoId(priceEntity.getId()); + } + basicEntity.setServiceType(ServiceTypeEnums.TRUNK_LINE.getCode()); + // 计费类型 + if (StrUtil.isNotEmpty(basicExcel.getTrunkLineUnit())) { + basicEntity.setType(IDict.getCodeByText(TrunkLinePricingTypeEnums.class, basicExcel.getTrunkLineUnit())); + } + basicEntity.setPriceId(priceEntity.getId()); + // 品类 + if (StrUtil.isNotEmpty(basicExcel.getCategory())) { + if (ObjectUtil.isNotEmpty(categoryEntityMap.get(basicExcel.getCategory()))) { + if (categoryFlag) { + basicEntity.setCategoryId(categoryEntityMap.get(basicExcel.getCategory()).getId()); + } + } + } + // 价格 + basicEntity.setPrice(Convert.toDouble(trunkLinePrice)); + } + + private void buildSaveBasicExcel(Map categoryEntityMap, Map routeEntityMap, Map pickupEntityMap, BasicdataPriceCategoryV2Excel basicExcel, BasicdataPriceEntity priceEntity, BasicdataPriceTemplateEntity templateEntity, Integer pickupIsUnifyAreaBill, String pickupPrice) { + Long routeId = null; + Integer pickupIsByCategory = templateEntity.getPickupIsByCategory(); + // 按品类计费 + boolean categoryFlag = ObjectUtil.isNotEmpty(pickupIsByCategory) && ObjectUtil.equal(pickupIsByCategory, BooleanZeroOneEnums.YES.getCode()); + // 按区域计费 有路径的 + boolean b = ObjectUtil.isNotEmpty(pickupIsUnifyAreaBill) && ObjectUtil.equal(pickupIsUnifyAreaBill, BooleanZeroOneEnums.NO.getCode()); + BasicdataPriceCategoryBasicEntity basicEntity = null; + 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"); + BasicdataPriceRouteEntity routeEntity = routeEntityMap.get(key); + if (ObjectUtil.isNotEmpty(routeEntity)) { + routeId = routeEntity.getId(); + } + } + } + if (b && categoryFlag) { + // 有路径按品类计费 一个客户一条路径一个品类一种计价方式一个价格 + String key = basicExcel.getClient() + basicExcel.getBrand() + routeId + basicExcel.getCategory(); + if(StrUtil.isNotEmpty(basicExcel.getPickupUnit())){ + key = key + basicExcel.getPickupUnit(); + } + if (pickupEntityMap.containsKey(key)) { + basicEntity = pickupEntityMap.get(key); + } else { + basicEntity = new BasicdataPriceCategoryBasicEntity(); + pickupEntityMap.put(key, basicEntity); + } + } else if (b && !categoryFlag) { + // 有路径不按品类计费,一个客户一条路径一种计价方式一个价格 + String key = basicExcel.getClient() + basicExcel.getBrand() + routeId; + if(StrUtil.isNotEmpty(basicExcel.getPickupUnit())){ + key = key + basicExcel.getPickupUnit(); + } + if (pickupEntityMap.containsKey(key)) { + basicEntity = pickupEntityMap.get(key); + } else { + basicEntity = new BasicdataPriceCategoryBasicEntity(); + pickupEntityMap.put(key, basicEntity); + } + } else if (!b && categoryFlag) { + // 没路径 按品类计费 一个客户一个品类一种计价方式一个价格 + String key = basicExcel.getClient() + basicExcel.getBrand() + basicExcel.getCategory(); + if(StrUtil.isNotEmpty(basicExcel.getPickupUnit())){ + key = key + basicExcel.getPickupUnit(); + } + if (pickupEntityMap.containsKey(key)) { + basicEntity = pickupEntityMap.get(key); + } else { + basicEntity = new BasicdataPriceCategoryBasicEntity(); + pickupEntityMap.put(key, basicEntity); + } + } else { + // 没路径 不按品类计费 一个客户一个计价方式一个价格 + String key = basicExcel.getClient() + basicExcel.getBrand(); + if(StrUtil.isNotEmpty(basicExcel.getPickupUnit())){ + key = key + basicExcel.getPickupUnit(); + } + if (pickupEntityMap.containsKey(key)) { + basicEntity = pickupEntityMap.get(key); + } else { + basicEntity = new BasicdataPriceCategoryBasicEntity(); + pickupEntityMap.put(key, basicEntity); + } + } + // 按区域计费 + if (b) { + basicEntity.setBoId(routeId); + } else { + basicEntity.setBoId(priceEntity.getId()); + } + basicEntity.setServiceType(ServiceTypeEnums.PICK_UP.getCode()); + // 计费类型 + if (StrUtil.isNotEmpty(basicExcel.getPickupUnit())) { + basicEntity.setType(IDict.getCodeByText(PickupPricingTypeEnums.class, basicExcel.getPickupUnit())); + } + basicEntity.setPriceId(priceEntity.getId()); + // 品类 + if (StrUtil.isNotEmpty(basicExcel.getCategory())) { + if (ObjectUtil.isNotEmpty(categoryEntityMap.get(basicExcel.getCategory()))) { + if (categoryFlag) { + basicEntity.setCategoryId(categoryEntityMap.get(basicExcel.getCategory()).getId()); + } + } + } + // 价格 + basicEntity.setPrice(Convert.toDouble(pickupPrice)); + } + private void setStarProvinceExcel(Map provinceMap, BasicdataPriceRouteEntity routeEntity, String province) { if (StrUtil.isNotEmpty(provinceMap.get(province))) { routeEntity.setStartProvinceId(Convert.toLong(provinceMap.get(province)));