| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -15,6 +15,7 @@ import com.epmet.dao.IcBuildingDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.ImportGeneralDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.form.ImportInfoFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.form.ImportTaskCommonFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.ExistHouseInfoResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.ImportResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.UpdateBuildingHouseNumResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.IcHouseEntity; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -48,6 +49,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    List<ImportGeneralDTO> needDisposeList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    List<ImportGeneralDTO> needInsertList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    List<ImportGeneralDTO> needUpdateList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    String gridName = null; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    String agencyName = null; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -125,21 +127,6 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            disposeErrorMsg(info, "是否出租的值未填写"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(StringUtils.isBlank(data.getOwnerIdCard())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            nums.add(num); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            disposeErrorMsg(info, "房主身份证的值未填写"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(StringUtils.isBlank(data.getOwnerName())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            nums.add(num); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            disposeErrorMsg(info, "房主姓名的值未填写"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(StringUtils.isBlank(data.getOwnerPhone())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            nums.add(num); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            disposeErrorMsg(info, "房主电话的值未填写"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(StringUtils.isBlank(data.getDoorName())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            nums.add(num); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            disposeErrorMsg(info, "门牌号的值未填写"); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -208,35 +195,45 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (CollectionUtils.isEmpty(needInsertList)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 根据单元ID_doorName查询已存在的
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> ids = needInsertList.stream().filter(n -> StringUtils.isNotBlank(n.getBuildingUnitId())).map(m -> m.getBuildingUnitId() + "_" + m.getDoorName()).distinct().collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ExistHouseInfoResultDTO> existHouses = icBuildingDao.selectExistHouse(ids); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, Long> collect = needInsertList.stream().collect(Collectors.groupingBy(n -> n.getBuildingUnitId() + "_" + n.getDoorName(), Collectors.counting())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        collect.forEach((k,v) -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (Integer.valueOf(v.toString()).compareTo(1) != 0){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                for (ImportGeneralDTO r : needInsertList) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (k.equals(r.getBuildingUnitId()+"_"+r.getDoorName())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        // 只添加没添加过的
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        // 集合里重复的
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        /*nums.add(r.getNum()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        disposeErrorMsg(info,ImportErrorMsgConstants.EXIST_ERROR); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        r.setExistStatus(true);*/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        if (!r.getAddStatus()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            // 集合里重复的
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            nums.add(r.getNum()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            disposeErrorMsg(info,ImportErrorMsgConstants.EXIST_ERROR); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            r.setExistStatus(true); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            for (ExistHouseInfoResultDTO existHouse : existHouses) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                if (existHouse.getName().equals(r.getBuildingUnitId()+"_"+r.getDoorName())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    r.setHouseId(existHouse.getHouseId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    break; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            needUpdateList.add(r); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            r.setAddStatus(true); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            r.setExistStatus(true); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 根据单元ID_doorName查询已存在的
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> ids = needInsertList.stream().filter(n -> StringUtils.isNotBlank(n.getBuildingUnitId())).map(m -> m.getBuildingUnitId() + "_" + m.getDoorName()).distinct().collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> existHouses = icBuildingDao.selectExistHouse(ids); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        existHouses.forEach(e -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            for (ImportGeneralDTO n : needInsertList) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if ((n.getBuildingUnitId()+"_"+n.getDoorName()).equals(e)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if ((n.getBuildingUnitId()+"_"+n.getDoorName()).equals(e.getName())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    // 库里存在的
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					//                    nums.add(n.getNum());
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					//                    disposeErrorMsg(info,ImportErrorMsgConstants.EXIST_ERROR);
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					//                    n.setExistStatus(true);
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (!n.getAddStatus()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        // 库里存在的
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        nums.add(n.getNum()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        disposeErrorMsg(info,ImportErrorMsgConstants.EXIST_ERROR); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        n.setExistStatus(true); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        n.setHouseId(e.getHouseId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        needUpdateList.add(n); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        n.setAddStatus(true); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        n.setExistStatus(true); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -245,6 +242,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<Boolean, List<ImportGeneralDTO>> groupByExistStatus = needInsertList.stream().collect(Collectors.groupingBy(ImportGeneralDTO::getExistStatus)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ImportGeneralDTO> importGeneralDTOS = groupByExistStatus.get(false); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        houseInsert(importGeneralDTOS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        houseUpdate(needUpdateList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 清除
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        needDisposeList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        needInsertList = new ArrayList<>(); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -583,4 +581,11 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public void houseUpdate(List<ImportGeneralDTO> houses){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (!CollectionUtils.isEmpty(houses)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            icHouseService.houseUpdate(houses); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
					 | 
				
				 | 
				
					
  |