|
|
@ -118,28 +118,30 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb |
|
|
|
// 物业表插入
|
|
|
|
List<String> propertyNames = notExistList.stream().map(m -> m.getPropertyName()).distinct().collect(Collectors.toList()); |
|
|
|
List<String> disposePropertyNames = notExistList.stream().map(m -> m.getPropertyName()).distinct().collect(Collectors.toList()); |
|
|
|
List<String> existPropertyNames = propertyManagementDao.selectExistNames(propertyNames); |
|
|
|
disposePropertyNames.removeAll(existPropertyNames); |
|
|
|
List<IcPropertyManagementEntity> propertyManagementEntities = new ArrayList<>(); |
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(disposePropertyNames)){ |
|
|
|
disposePropertyNames.forEach(name -> { |
|
|
|
IcPropertyManagementEntity e = new IcPropertyManagementEntity(); |
|
|
|
e.setName(name); |
|
|
|
propertyManagementEntities.add(e); |
|
|
|
}); |
|
|
|
} |
|
|
|
neighborHoodService.insertPropertyManagement(propertyManagementEntities); |
|
|
|
if (!CollectionUtils.isEmpty(propertyNames)){ |
|
|
|
List<String> existPropertyNames = propertyManagementDao.selectExistNames(propertyNames); |
|
|
|
disposePropertyNames.removeAll(existPropertyNames); |
|
|
|
List<IcPropertyManagementEntity> propertyManagementEntities = new ArrayList<>(); |
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(disposePropertyNames)){ |
|
|
|
disposePropertyNames.forEach(name -> { |
|
|
|
IcPropertyManagementEntity e = new IcPropertyManagementEntity(); |
|
|
|
e.setName(name); |
|
|
|
propertyManagementEntities.add(e); |
|
|
|
}); |
|
|
|
} |
|
|
|
neighborHoodService.insertPropertyManagement(propertyManagementEntities); |
|
|
|
|
|
|
|
// 小区物业关系表插入
|
|
|
|
List<NeighborHoodAndManagementDTO> neighborHoodAndManagementDTOS = ConvertUtils.sourceToTarget(notExistList, 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()); |
|
|
|
})); |
|
|
|
List<IcNeighborHoodPropertyEntity> icNeighborHoodPropertyEntities = ConvertUtils.sourceToTarget(neighborHoodAndManagementDTOS, IcNeighborHoodPropertyEntity.class); |
|
|
|
neighborHoodService.neighborHoodPropertyInsert(icNeighborHoodPropertyEntities); |
|
|
|
// 小区物业关系表插入
|
|
|
|
List<NeighborHoodAndManagementDTO> neighborHoodAndManagementDTOS = ConvertUtils.sourceToTarget(notExistList, 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()); |
|
|
|
})); |
|
|
|
List<IcNeighborHoodPropertyEntity> icNeighborHoodPropertyEntities = ConvertUtils.sourceToTarget(neighborHoodAndManagementDTOS, IcNeighborHoodPropertyEntity.class); |
|
|
|
neighborHoodService.neighborHoodPropertyInsert(icNeighborHoodPropertyEntities); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|