Browse Source

feat(all): 修改价格体系导入未按计费方式区分的问题

dist.1.3.0
zhaoqiaobo 11 months ago
parent
commit
eec956d198
  1. 738
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataPriceServiceImpl.java

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

@ -1800,160 +1800,10 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
String pickupPrice = basicExcel.getPickupPrice();
String trunkLinePrice = basicExcel.getTrunkLinePrice();
if (StrUtil.isNotEmpty(pickupPrice) && Convert.toDouble(pickupPrice) > 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<BasicdataPriceMap
|| (ObjectUtil.isNotEmpty(betweenThirtySixtyPrice) && Convert.toDouble(betweenThirtySixtyPrice) > 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<BasicdataPriceMap
if ((ObjectUtil.isNotEmpty(warehouseOperatePrice) && Convert.toDouble(warehouseOperatePrice) > 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<BasicdataPriceMap
|| (ObjectUtil.isNotEmpty(dispatchHandlingPrice) && Convert.toDouble(dispatchHandlingPrice) > 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<BasicdataPriceMap
}
}
private void buildSaveDispatchAddExcel(Map<String, BasicdataCategoryEntity> categoryEntityMap, Map<String, BasicdataPriceCategoryDispatchEntity> 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<String, BasicdataCategoryEntity> categoryEntityMap, Map<String, BasicdataPriceCategoryDispatchEntity> 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<String, BasicdataCategoryEntity> categoryEntityMap, Map<String, BasicdataPriceCategoryWarehouseEntity> 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<String, BasicdataCategoryEntity> categoryEntityMap, Map<String, BasicdataPriceCategoryWarehouseEntity> 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<String, BasicdataCategoryEntity> categoryEntityMap, Map<String, BasicdataPriceRouteEntity> routeEntityMap, Map<String, BasicdataPriceCategoryBasicEntity> 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<String, BasicdataCategoryEntity> categoryEntityMap, Map<String, BasicdataPriceRouteEntity> routeEntityMap, Map<String, BasicdataPriceCategoryBasicEntity> 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<String, String> provinceMap, BasicdataPriceRouteEntity routeEntity, String province) {
if (StrUtil.isNotEmpty(provinceMap.get(province))) {
routeEntity.setStartProvinceId(Convert.toLong(provinceMap.get(province)));

Loading…
Cancel
Save