|
|
@ -51,6 +51,7 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb |
|
|
|
|
|
|
|
List<ImportGeneralDTO> needDisposeList = new ArrayList<>(); |
|
|
|
List<ImportGeneralDTO> needInsertList = new ArrayList<>(); |
|
|
|
List<ImportGeneralDTO> needUpdateList = new ArrayList<>(); |
|
|
|
|
|
|
|
String gridName = null; |
|
|
|
String agencyName = null; |
|
|
@ -128,7 +129,7 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb |
|
|
|
} |
|
|
|
|
|
|
|
public void finalDispose(){ |
|
|
|
if (CollectionUtils.isEmpty(needDisposeList)){ |
|
|
|
if (CollectionUtils.isEmpty(needDisposeList) && CollectionUtils.isEmpty(needUpdateList)){ |
|
|
|
return; |
|
|
|
} |
|
|
|
Map<String, Long> groupByAllName = needDisposeList.stream().collect(Collectors.groupingBy( |
|
|
@ -151,8 +152,11 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb |
|
|
|
}); |
|
|
|
Map<Boolean, List<ImportGeneralDTO>> groupByStatus = needDisposeList.stream().collect(Collectors.groupingBy(ImportGeneralDTO::getExistStatus)); |
|
|
|
List<ImportGeneralDTO> importGeneralDTOS = groupByStatus.get(false); |
|
|
|
if (!CollectionUtils.isEmpty(importGeneralDTOS)){ |
|
|
|
List<ImportGeneralDTO> importInfo = neighborHoodService.getImportInfo(formDTO, importGeneralDTOS); |
|
|
|
if (!CollectionUtils.isEmpty(importGeneralDTOS) || !CollectionUtils.isEmpty(needUpdateList)){ |
|
|
|
List<ImportGeneralDTO> importInfo = new ArrayList<>(); |
|
|
|
if (!CollectionUtils.isEmpty(importGeneralDTOS)){ |
|
|
|
importInfo = neighborHoodService.getImportInfo(formDTO, importGeneralDTOS); |
|
|
|
} |
|
|
|
Map<Boolean, List<ImportGeneralDTO>> groupByBuildingExistStatus = importInfo.stream().collect(Collectors.groupingBy(ImportGeneralDTO::getNeighborHoodExistStatus)); |
|
|
|
List<ImportGeneralDTO> existList = groupByBuildingExistStatus.get(true); |
|
|
|
if (!CollectionUtils.isEmpty(existList)){ |
|
|
@ -165,7 +169,16 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
List<ImportGeneralDTO> notExistList = groupByBuildingExistStatus.get(false); |
|
|
|
List<ImportGeneralDTO> notExistList = new ArrayList<>(); |
|
|
|
List<ImportGeneralDTO> notExistListFalse = groupByBuildingExistStatus.get(false); |
|
|
|
if (!CollectionUtils.isEmpty(notExistListFalse)){ |
|
|
|
notExistList.addAll(notExistListFalse); |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(needUpdateList)){ |
|
|
|
notExistList.addAll(needUpdateList); |
|
|
|
// 更新详细地址和备注
|
|
|
|
neighborHoodService.updateNeighborHood(needUpdateList); |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(notExistList)){ |
|
|
|
// 物业表插入
|
|
|
|
List<String> propertyNames = notExistList.stream().filter(n -> StringUtils.isNotBlank(n.getPropertyName())).map(m -> m.getPropertyName()).distinct().collect(Collectors.toList()); |
|
|
@ -184,15 +197,26 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb |
|
|
|
neighborHoodService.insertPropertyManagement(propertyManagementEntities); |
|
|
|
|
|
|
|
// 小区物业关系表插入
|
|
|
|
List<NeighborHoodAndManagementDTO> neighborHoodAndManagementDTOS = ConvertUtils.sourceToTarget(notExistList, NeighborHoodAndManagementDTO.class); |
|
|
|
List<NeighborHoodAndManagementDTO> neighborHoodAndManagementDTOS = ConvertUtils.sourceToTarget(notExistListFalse, NeighborHoodAndManagementDTO.class); |
|
|
|
List<NeighborHoodAndManagementDTO> updateNeighborHoodAndManagement = ConvertUtils.sourceToTarget(needUpdateList, NeighborHoodAndManagementDTO.class); |
|
|
|
List<IcPropertyManagementEntity> propertyManagementInfos = propertyManagementDao.selectIdByName(propertyNames); |
|
|
|
neighborHoodAndManagementDTOS.forEach(n -> propertyManagementInfos.stream().filter(p -> p.getName().equals(n.getPropertyName())) |
|
|
|
.forEach(p -> { |
|
|
|
n.setPropertyId(p.getId()); |
|
|
|
n.setNeighborHoodId(n.getNeighborHoodId()); |
|
|
|
})); |
|
|
|
if (!CollectionUtils.isEmpty(neighborHoodAndManagementDTOS)){ |
|
|
|
neighborHoodAndManagementDTOS.forEach(n -> propertyManagementInfos.stream().filter(p -> p.getName().equals(n.getPropertyName())) |
|
|
|
.forEach(p -> { |
|
|
|
n.setPropertyId(p.getId()); |
|
|
|
n.setNeighborHoodId(n.getNeighborHoodId()); |
|
|
|
})); |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(updateNeighborHoodAndManagement)){ |
|
|
|
updateNeighborHoodAndManagement.forEach(n -> propertyManagementInfos.stream().filter(p -> p.getName().equals(n.getPropertyName())) |
|
|
|
.forEach(p -> { |
|
|
|
n.setPropertyId(p.getId()); |
|
|
|
n.setNeighborHoodId(n.getNeighborHoodId()); |
|
|
|
})); |
|
|
|
} |
|
|
|
List<IcNeighborHoodPropertyEntity> icNeighborHoodPropertyEntities = ConvertUtils.sourceToTarget(neighborHoodAndManagementDTOS, IcNeighborHoodPropertyEntity.class); |
|
|
|
neighborHoodService.neighborHoodPropertyInsert(icNeighborHoodPropertyEntities); |
|
|
|
neighborHoodService.neighborHoodPropertyUpdate(updateNeighborHoodAndManagement); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -200,6 +224,7 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb |
|
|
|
// 清除
|
|
|
|
needDisposeList = new ArrayList<>(); |
|
|
|
needInsertList = new ArrayList<>(); |
|
|
|
needUpdateList = new ArrayList<>(); |
|
|
|
gridName = null; |
|
|
|
agencyName = null; |
|
|
|
gridInfos = null; |
|
|
@ -297,9 +322,13 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb |
|
|
|
// 赋值小区ID
|
|
|
|
dto.setNeighborHoodId(null == cacheNeighBorHood ? "" : cacheNeighBorHood.toString()); |
|
|
|
if (StringUtils.isNotBlank(dto.getNeighborHoodId())){ |
|
|
|
/** |
|
|
|
* 2022-04-27 新增需求,存在小区进行更改 更新物业、详细地址、备注信息 |
|
|
|
*/ |
|
|
|
// 小区已存在
|
|
|
|
nums.add(dto.getNum()); |
|
|
|
disposeErrorMsg(info,ImportErrorMsgConstants.EXIST_ERROR); |
|
|
|
/*nums.add(dto.getNum()); |
|
|
|
disposeErrorMsg(info,ImportErrorMsgConstants.EXIST_ERROR);*/ |
|
|
|
needUpdateList.add(dto); |
|
|
|
}else { |
|
|
|
needDisposeList.add(dto); |
|
|
|
} |
|
|
|