Browse Source

小区导入

master
zxc 4 years ago
parent
commit
690aade8b8
  1. 44
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportNeighborHoodInfoListener.java
  2. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java

44
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportNeighborHoodInfoListener.java

@ -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);
}
}
}

1
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java

@ -519,6 +519,7 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
* @Author zhaoqifeng
* @Date 2022/2/14 9:50
*/
@Transactional(rollbackFor = Exception.class)
private String getNeighborHoodId(String customerId, ImportGeneralDTO info) {
//根据网格ID和小区名获取小区信息
LambdaQueryWrapper<IcNeighborHoodEntity> wrapper = new LambdaQueryWrapper<>();

Loading…
Cancel
Save