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 84da64314..13685965e 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 @@ -112,6 +112,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; @@ -2210,7 +2211,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl provinceCityMap, Map provinceCityAearMap, Map clientBrandMap, Map templateMap) { if (CollUtil.isNotEmpty(basicExcels)) { + Map categoryIdMap = new HashMap<>(); + if (CollUtil.isNotEmpty(categoryEntityMap)) { + categoryEntityMap.forEach((k, v) -> { + categoryIdMap.put(v.getId().toString(), v); + }); + } // 校验sheet2的数据 for (int i = 0; i < basicExcels.size(); i++) { BasicdataPriceCategoryV2Excel basicExcel = basicExcels.get(i); @@ -2480,7 +2487,105 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl categoryIdMap, String category, StringBuilder rowMessage, + String categoryIdStr, String unit, String type) { + if (StrUtil.isNotEmpty(categoryIdStr)) { + List categoryIds = StrUtil.splitTrim(categoryIdStr, ","); + List categoryNamesFromMap = categoryIds.stream() + .map(categoryIdMap::get) + .filter(Objects::nonNull) + .map(BasicdataCategoryEntity::getName) + .collect(Collectors.toList()); + if (CollUtil.isNotEmpty(categoryNamesFromMap)) { + if (!categoryNamesFromMap.contains(category)) { + rowMessage.append("品类【").append(category).append("】不在模板") + .append(type); + if (StrUtil.isNotEmpty(unit)) { + rowMessage.append(unit); + } + rowMessage.append("品类中,请检查;"); + } + }else{ + rowMessage.append("品类【").append(category).append("】不在模板") + .append(type); + if (StrUtil.isNotEmpty(unit)) { + rowMessage.append(unit); + } + rowMessage.append("品类中,请检查;"); + } + } + } + private void buildErrorMessageExcel(StringBuilder message, StringBuilder rowMessage, String firstMessage) { if (StrUtil.isNotEmpty(rowMessage.toString())) { message.append("

"); @@ -2531,7 +2665,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl categoryEntityMap, StringBuilder rowMessage, String category) { if (StrUtil.isNotEmpty(category)) { if (!categoryEntityMap.containsKey(category)) { - rowMessage.append("品类不存在;"); + rowMessage.append("品类不存在;"); } } } @@ -2539,7 +2673,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl clientEntityMap, StringBuilder rowMessage, String sendOrg) { if (StrUtil.isNotEmpty(sendOrg)) { if (!clientEntityMap.containsKey(sendOrg)) { - rowMessage.append("发货单位不存在;"); + rowMessage.append("发货单位不存在;"); } } } @@ -2547,15 +2681,15 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl provinceMap, Map provinceCityMap, Map provinceCityAearMap, StringBuilder rowMessage, String startProvince, String startCity, String startArea, String type) { if (StrUtil.isNotEmpty(startProvince)) { if (!provinceMap.containsKey(startProvince)) { - rowMessage.append(type).append("(省)不存在;"); + rowMessage.append(type).append("(省)不存在;"); } else { if (StrUtil.isNotEmpty(startCity)) { if (!provinceCityMap.containsKey(startProvince + startCity)) { - rowMessage.append(type).append("(市)不存在;"); + rowMessage.append(type).append("(市)不存在;"); } else { if (StrUtil.isNotEmpty(startArea)) { if (!provinceCityAearMap.containsKey(startProvince + startCity + startArea)) { - rowMessage.append(type).append("(区)不存在;"); + rowMessage.append(type).append("(区)不存在;"); } } } @@ -2581,15 +2715,15 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl priceEntityMap, StringBuilder rowMessage, String client, String brand) { if (StrUtil.isEmpty(client)) { - rowMessage.append("客户名称不能为空;"); + rowMessage.append("客户名称不能为空;"); } if (StrUtil.isEmpty(brand)) { - rowMessage.append("品牌不能为空;"); + rowMessage.append("品牌不能为空;"); } // 客户+品牌必须在sheet1中存在 if (!ObjectUtil.isAllEmpty(client, brand)) { if (!priceEntityMap.containsKey(client + brand)) { - rowMessage.append("客户名称+品牌名称不存在;"); + rowMessage.append("客户名称+品牌名称不存在;"); } } } @@ -2977,42 +3111,42 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl 1) { - rowMessage.append("生效时间与截至时间范围在系统中存在多个价格体系,请确认;"); + rowMessage.append("生效时间与截至时间范围在系统中存在多个价格体系,请确认;"); } } } @@ -3084,7 +3218,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl