|
|
@ -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,29 +195,46 @@ 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){ |
|
|
|
if (Integer.valueOf(v.toString()).compareTo(1) != 0){ |
|
|
|
for (ImportGeneralDTO r : needInsertList) { |
|
|
|
if (k.equals(r.getBuildingUnitId()+"_"+r.getDoorName())){ |
|
|
|
// 集合里重复的
|
|
|
|
nums.add(r.getNum()); |
|
|
|
/*nums.add(r.getNum()); |
|
|
|
disposeErrorMsg(info,ImportErrorMsgConstants.EXIST_ERROR); |
|
|
|
r.setExistStatus(true); |
|
|
|
r.setExistStatus(true);*/ |
|
|
|
if (!r.getAddStatus()){ |
|
|
|
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); |
|
|
|
// nums.add(n.getNum());
|
|
|
|
// disposeErrorMsg(info,ImportErrorMsgConstants.EXIST_ERROR);
|
|
|
|
// n.setExistStatus(true);
|
|
|
|
if (!n.getAddStatus()){ |
|
|
|
n.setHouseId(e.getHouseId()); |
|
|
|
needUpdateList.add(n); |
|
|
|
n.setAddStatus(true); |
|
|
|
n.setExistStatus(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
@ -238,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<>(); |
|
|
@ -576,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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|