|
|
@ -107,32 +107,31 @@ public class BasicdataFactoryCategoryImporter implements ExcelImporter<Basicdata |
|
|
|
String mainName = datum.getMainName(); |
|
|
|
String mainName = datum.getMainName(); |
|
|
|
String mainCategory1 = datum.getMainCategory(); |
|
|
|
String mainCategory1 = datum.getMainCategory(); |
|
|
|
List<BasicdataMainCategoryEntity> mainCategoryEntityList = groupedByFactoryCategoryId.get(factoryCategoryId); |
|
|
|
List<BasicdataMainCategoryEntity> mainCategoryEntityList = groupedByFactoryCategoryId.get(factoryCategoryId); |
|
|
|
//把mainCategoryEntityList转成以mainName为Key的Map
|
|
|
|
if(CollUtil.isNotEmpty(mainCategoryEntityList)){ |
|
|
|
Map<String, BasicdataMainCategoryEntity> mainCategoryEntityMap = mainCategoryEntityList.stream() |
|
|
|
//把mainCategoryEntityList转成以mainName为Key的Map
|
|
|
|
.collect(Collectors.toMap(BasicdataMainCategoryEntity::getMainName, entity -> entity)); |
|
|
|
Map<String, BasicdataMainCategoryEntity> mainCategoryEntityMap = mainCategoryEntityList.stream() |
|
|
|
|
|
|
|
.collect(Collectors.toMap(BasicdataMainCategoryEntity::getMainName, entity -> entity)); |
|
|
|
BasicdataMainCategoryEntity mainCategory = mainCategoryEntityMap.get(mainName); |
|
|
|
|
|
|
|
if (Objects.isNull(mainCategory)){ |
|
|
|
BasicdataMainCategoryEntity mainCategory = mainCategoryEntityMap.get(mainName); |
|
|
|
mainCategory = new BasicdataMainCategoryEntity(); |
|
|
|
if (Objects.isNull(mainCategory)){ |
|
|
|
mainCategory.setFactoryCategoryId(factoryCategoryId); |
|
|
|
mainCategory = new BasicdataMainCategoryEntity(); |
|
|
|
} |
|
|
|
mainCategory.setFactoryCategoryId(factoryCategoryId); |
|
|
|
|
|
|
|
} |
|
|
|
mainCategory.setMainName(mainName); |
|
|
|
|
|
|
|
BasicdataMainEntity basicdataMainEntity = mainMap.get(mainName); |
|
|
|
|
|
|
|
if(!Objects.isNull(basicdataMainEntity)){ |
|
|
|
|
|
|
|
mainCategory.setMainId(basicdataMainEntity.getId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
BasicdataCategoryEntity basicdataCategoryEntity = categoryMap.get(mainCategory1); |
|
|
|
|
|
|
|
if(!Objects.isNull(basicdataCategoryEntity)){ |
|
|
|
|
|
|
|
mainCategory.setCategoryId(basicdataCategoryEntity.getId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
mainCategory.setCategory(mainCategory1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
newMainCategoryEntities.add(mainCategory); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mainCategory.setMainName(mainName); |
|
|
|
|
|
|
|
BasicdataMainEntity basicdataMainEntity = mainMap.get(mainName); |
|
|
|
|
|
|
|
if(!Objects.isNull(basicdataMainEntity)){ |
|
|
|
|
|
|
|
mainCategory.setMainId(basicdataMainEntity.getId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
BasicdataCategoryEntity basicdataCategoryEntity = categoryMap.get(mainCategory1); |
|
|
|
|
|
|
|
if(!Objects.isNull(basicdataCategoryEntity)){ |
|
|
|
|
|
|
|
mainCategory.setCategoryId(basicdataCategoryEntity.getId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
mainCategory.setCategory(mainCategory1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
newMainCategoryEntities.add(mainCategory); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|