|
@ -9,14 +9,18 @@ import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|
|
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.constant.CustomerGridConstant; |
|
|
import com.epmet.constant.CustomerGridConstant; |
|
|
|
|
|
import com.epmet.constant.ImportErrorMsgConstants; |
|
|
|
|
|
import com.epmet.constants.ImportTaskConstants; |
|
|
import com.epmet.dao.IcBuildingDao; |
|
|
import com.epmet.dao.IcBuildingDao; |
|
|
import com.epmet.dto.ImportGeneralDTO; |
|
|
import com.epmet.dto.ImportGeneralDTO; |
|
|
import com.epmet.dto.form.ImportInfoFormDTO; |
|
|
import com.epmet.dto.form.ImportInfoFormDTO; |
|
|
|
|
|
import com.epmet.dto.form.ImportTaskCommonFormDTO; |
|
|
import com.epmet.dto.result.ImportResultDTO; |
|
|
import com.epmet.dto.result.ImportResultDTO; |
|
|
import com.epmet.entity.IcHouseEntity; |
|
|
import com.epmet.entity.IcHouseEntity; |
|
|
import com.epmet.enums.HousePurposeEnums; |
|
|
import com.epmet.enums.HousePurposeEnums; |
|
|
import com.epmet.enums.HouseRentFlagEnums; |
|
|
import com.epmet.enums.HouseRentFlagEnums; |
|
|
import com.epmet.enums.HouseTypeEnums; |
|
|
import com.epmet.enums.HouseTypeEnums; |
|
|
|
|
|
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|
|
import com.epmet.redis.IcHouseRedis; |
|
|
import com.epmet.redis.IcHouseRedis; |
|
|
import com.epmet.service.IcHouseService; |
|
|
import com.epmet.service.IcHouseService; |
|
|
import com.epmet.service.IcNeighborHoodService; |
|
|
import com.epmet.service.IcNeighborHoodService; |
|
@ -24,6 +28,7 @@ import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.util.CollectionUtils; |
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@ -38,6 +43,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode |
|
|
Integer num = NumConstant.ZERO; |
|
|
Integer num = NumConstant.ZERO; |
|
|
List<HouseErrorInfoModel> errorInfos = new ArrayList<>(); |
|
|
List<HouseErrorInfoModel> errorInfos = new ArrayList<>(); |
|
|
HouseInfoModel info = null; |
|
|
HouseInfoModel info = null; |
|
|
|
|
|
String taskId = ""; |
|
|
|
|
|
|
|
|
List<ImportGeneralDTO> needDisposeList = new ArrayList<>(); |
|
|
List<ImportGeneralDTO> needDisposeList = new ArrayList<>(); |
|
|
List<ImportGeneralDTO> needInsertList = new ArrayList<>(); |
|
|
List<ImportGeneralDTO> needInsertList = new ArrayList<>(); |
|
@ -61,13 +67,16 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode |
|
|
private IcHouseRedis icHouseRedis; |
|
|
private IcHouseRedis icHouseRedis; |
|
|
private IcNeighborHoodService neighborHoodService; |
|
|
private IcNeighborHoodService neighborHoodService; |
|
|
private IcHouseService icHouseService; |
|
|
private IcHouseService icHouseService; |
|
|
|
|
|
private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient; |
|
|
|
|
|
|
|
|
public ImportHouseInfoListener(ImportInfoFormDTO formDTO,IcBuildingDao icBuildingDao, IcHouseRedis icHouseRedis,IcNeighborHoodService neighborHoodService, IcHouseService icHouseService){ |
|
|
public ImportHouseInfoListener(ImportInfoFormDTO formDTO,IcBuildingDao icBuildingDao, IcHouseRedis icHouseRedis,IcNeighborHoodService neighborHoodService, IcHouseService icHouseService, EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient,String tId){ |
|
|
this.formDTO = formDTO; |
|
|
this.formDTO = formDTO; |
|
|
this.icBuildingDao = icBuildingDao; |
|
|
this.icBuildingDao = icBuildingDao; |
|
|
this.icHouseRedis = icHouseRedis; |
|
|
this.icHouseRedis = icHouseRedis; |
|
|
this.neighborHoodService = neighborHoodService; |
|
|
this.neighborHoodService = neighborHoodService; |
|
|
this.icHouseService = icHouseService; |
|
|
this.icHouseService = icHouseService; |
|
|
|
|
|
this.epmetCommonServiceOpenFeignClient = epmetCommonServiceOpenFeignClient; |
|
|
|
|
|
this.taskId = tId; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -84,7 +93,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode |
|
|
if (StringUtils.isNotBlank(dto.getHouseType()) ){ |
|
|
if (StringUtils.isNotBlank(dto.getHouseType()) ){ |
|
|
if( !"楼房".equals(dto.getHouseType()) && !dto.getHouseType().equals("平房") && !dto.getHouseType().equals("别墅") ){ |
|
|
if( !"楼房".equals(dto.getHouseType()) && !dto.getHouseType().equals("平房") && !dto.getHouseType().equals("别墅") ){ |
|
|
nums.add(num); |
|
|
nums.add(num); |
|
|
disposeErrorMsg(info,""); |
|
|
disposeErrorMsg(info,ImportErrorMsgConstants.HOUSE_ERROR); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -98,13 +107,13 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode |
|
|
!dto.getPurpose().equals("商住混用") && |
|
|
!dto.getPurpose().equals("商住混用") && |
|
|
!dto.getPurpose().equals("其他")) ){ |
|
|
!dto.getPurpose().equals("其他")) ){ |
|
|
nums.add(num); |
|
|
nums.add(num); |
|
|
disposeErrorMsg(info,""); |
|
|
disposeErrorMsg(info, ImportErrorMsgConstants.HOUSE_ERROR); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
dto.setPurpose(HousePurposeEnums.getKeyByValue(dto.getPurpose())); |
|
|
dto.setPurpose(HousePurposeEnums.getKeyByValue(dto.getPurpose())); |
|
|
if (StringUtils.isNotBlank(dto.getRentFlagString()) && (!dto.getRentFlagString().equals("是") && !dto.getRentFlagString().equals("否"))){ |
|
|
if (StringUtils.isNotBlank(dto.getRentFlagString()) && (!dto.getRentFlagString().equals("是") && !dto.getRentFlagString().equals("否"))){ |
|
|
nums.add(num); |
|
|
nums.add(num); |
|
|
disposeErrorMsg(info,""); |
|
|
disposeErrorMsg(info,ImportErrorMsgConstants.HOUSE_ERROR); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
dto.setRentFlag(HouseRentFlagEnums.getCodeByName(dto.getRentFlagString())); |
|
|
dto.setRentFlag(HouseRentFlagEnums.getCodeByName(dto.getRentFlagString())); |
|
@ -145,7 +154,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode |
|
|
if (k.equals(r.getBuildingUnitId()+"_"+r.getDoorName())){ |
|
|
if (k.equals(r.getBuildingUnitId()+"_"+r.getDoorName())){ |
|
|
// 集合里重复的
|
|
|
// 集合里重复的
|
|
|
nums.add(r.getNum()); |
|
|
nums.add(r.getNum()); |
|
|
disposeErrorMsg(info,""); |
|
|
disposeErrorMsg(info,ImportErrorMsgConstants.EXIST_ERROR); |
|
|
r.setExistStatus(true); |
|
|
r.setExistStatus(true); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -159,7 +168,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode |
|
|
if ((n.getBuildingUnitId()+"_"+n.getDoorName()).equals(e)){ |
|
|
if ((n.getBuildingUnitId()+"_"+n.getDoorName()).equals(e)){ |
|
|
// 库里存在的
|
|
|
// 库里存在的
|
|
|
nums.add(n.getNum()); |
|
|
nums.add(n.getNum()); |
|
|
disposeErrorMsg(info,""); |
|
|
disposeErrorMsg(info,ImportErrorMsgConstants.EXIST_ERROR); |
|
|
n.setExistStatus(true); |
|
|
n.setExistStatus(true); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -196,7 +205,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode |
|
|
// 排除不是本楼的
|
|
|
// 排除不是本楼的
|
|
|
if (!dto.getBuildingName().equals(buildingGeneralDTO.getBuildingName())){ |
|
|
if (!dto.getBuildingName().equals(buildingGeneralDTO.getBuildingName())){ |
|
|
nums.add(num); |
|
|
nums.add(num); |
|
|
disposeErrorMsg(info,""); |
|
|
disposeErrorMsg(info,ImportErrorMsgConstants.HOUSE_ERROR); |
|
|
}else { |
|
|
}else { |
|
|
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(buildingGeneralDTO.getGridId()); |
|
|
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(buildingGeneralDTO.getGridId()); |
|
|
if (null == gridInfo){ |
|
|
if (null == gridInfo){ |
|
@ -207,7 +216,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode |
|
|
|| (!gridInfo.getGridName().equals(dto.getGridName())&&buildingGeneralDTO.getNeighborHoodName().equals(dto.getNeighborHoodName()) && buildingGeneralDTO.getBuildingName().equals(dto.getBuildingName())) |
|
|
|| (!gridInfo.getGridName().equals(dto.getGridName())&&buildingGeneralDTO.getNeighborHoodName().equals(dto.getNeighborHoodName()) && buildingGeneralDTO.getBuildingName().equals(dto.getBuildingName())) |
|
|
|| (!gridInfo.getAgencyName().equals(dto.getAgencyName())&&gridInfo.getGridName().equals(dto.getGridName())&&buildingGeneralDTO.getNeighborHoodName().equals(dto.getNeighborHoodName()) && buildingGeneralDTO.getBuildingName().equals(dto.getBuildingName()))){ |
|
|
|| (!gridInfo.getAgencyName().equals(dto.getAgencyName())&&gridInfo.getGridName().equals(dto.getGridName())&&buildingGeneralDTO.getNeighborHoodName().equals(dto.getNeighborHoodName()) && buildingGeneralDTO.getBuildingName().equals(dto.getBuildingName()))){ |
|
|
nums.add(num); |
|
|
nums.add(num); |
|
|
disposeErrorMsg(info,""); |
|
|
disposeErrorMsg(info,ImportErrorMsgConstants.HOUSE_ERROR); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
dto.setBuildingId(formDTO.getOrgId()); |
|
|
dto.setBuildingId(formDTO.getOrgId()); |
|
@ -248,7 +257,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode |
|
|
//排除不是本小区的
|
|
|
//排除不是本小区的
|
|
|
if (!dto.getNeighborHoodName().equals(neighborHoodGeneralDTO.getNeighborHoodName())){ |
|
|
if (!dto.getNeighborHoodName().equals(neighborHoodGeneralDTO.getNeighborHoodName())){ |
|
|
nums.add(num); |
|
|
nums.add(num); |
|
|
disposeErrorMsg(info,""); |
|
|
disposeErrorMsg(info,ImportErrorMsgConstants.HOUSE_ERROR); |
|
|
}else { |
|
|
}else { |
|
|
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(neighborHoodGeneralDTO.getGridId()); |
|
|
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(neighborHoodGeneralDTO.getGridId()); |
|
|
if (null == gridInfo){ |
|
|
if (null == gridInfo){ |
|
@ -258,7 +267,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode |
|
|
if ((!gridInfo.getGridName().equals(dto.getGridName()) && neighborHoodGeneralDTO.getNeighborHoodName().equals(dto.getNeighborHoodName())) || |
|
|
if ((!gridInfo.getGridName().equals(dto.getGridName()) && neighborHoodGeneralDTO.getNeighborHoodName().equals(dto.getNeighborHoodName())) || |
|
|
(!gridInfo.getAgencyName().equals(dto.getAgencyName()) && gridInfo.getGridName().equals(dto.getGridName()) && neighborHoodGeneralDTO.getNeighborHoodName().equals(dto.getNeighborHoodName()))){ |
|
|
(!gridInfo.getAgencyName().equals(dto.getAgencyName()) && gridInfo.getGridName().equals(dto.getGridName()) && neighborHoodGeneralDTO.getNeighborHoodName().equals(dto.getNeighborHoodName()))){ |
|
|
nums.add(num); |
|
|
nums.add(num); |
|
|
disposeErrorMsg(info,""); |
|
|
disposeErrorMsg(info,ImportErrorMsgConstants.HOUSE_ERROR); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
dto.setNeighborHoodId(formDTO.getOrgId()); |
|
|
dto.setNeighborHoodId(formDTO.getOrgId()); |
|
@ -290,7 +299,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode |
|
|
//排除不是本网格的 gridName不一样排除,gridName一样但是agencyName不一样也得排除
|
|
|
//排除不是本网格的 gridName不一样排除,gridName一样但是agencyName不一样也得排除
|
|
|
if (dto.getGridName().compareTo(gridName) != 0 || (!dto.getAgencyName().equals(gridInfo.getAgencyName()) && dto.getGridName().equals(gridName))){ |
|
|
if (dto.getGridName().compareTo(gridName) != 0 || (!dto.getAgencyName().equals(gridInfo.getAgencyName()) && dto.getGridName().equals(gridName))){ |
|
|
nums.add(num); |
|
|
nums.add(num); |
|
|
disposeErrorMsg(info,""); |
|
|
disposeErrorMsg(info,ImportErrorMsgConstants.HOUSE_ERROR); |
|
|
}else { |
|
|
}else { |
|
|
//
|
|
|
//
|
|
|
dto.setGridId(formDTO.getOrgId()); |
|
|
dto.setGridId(formDTO.getOrgId()); |
|
@ -317,21 +326,21 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode |
|
|
//排除不是本组织的
|
|
|
//排除不是本组织的
|
|
|
if (!dto.getAgencyName().equals(agencyName)){ |
|
|
if (!dto.getAgencyName().equals(agencyName)){ |
|
|
nums.add(num); |
|
|
nums.add(num); |
|
|
disposeErrorMsg(info,""); |
|
|
disposeErrorMsg(info,ImportErrorMsgConstants.HOUSE_ERROR); |
|
|
}else { |
|
|
}else { |
|
|
// 根据组织查询出所有网格,甩出不是本组织下的网格
|
|
|
// 根据组织查询出所有网格,甩出不是本组织下的网格
|
|
|
gridInfos = null == gridInfos ? getGridInfos(formDTO.getOrgId()) : gridInfos; |
|
|
gridInfos = null == gridInfos ? getGridInfos(formDTO.getOrgId()) : gridInfos; |
|
|
if (null == gridInfos){ |
|
|
if (null == gridInfos){ |
|
|
// 组织下确实不存在网格
|
|
|
// 组织下确实不存在网格
|
|
|
nums.add(num); |
|
|
nums.add(num); |
|
|
disposeErrorMsg(info,""); |
|
|
disposeErrorMsg(info,ImportErrorMsgConstants.HOUSE_ERROR); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
// 根据网格名对比,没有找到的就把行号加入到未执行成功队列中
|
|
|
// 根据网格名对比,没有找到的就把行号加入到未执行成功队列中
|
|
|
Object cacheGridName = icHouseRedis.getTemporaryCacheGrid(formDTO.getCustomerId(), formDTO.getUserId(), dto.getGridName()); |
|
|
Object cacheGridName = icHouseRedis.getTemporaryCacheGrid(formDTO.getCustomerId(), formDTO.getUserId(), dto.getGridName()); |
|
|
if (null == cacheGridName){ |
|
|
if (null == cacheGridName){ |
|
|
nums.add(num); |
|
|
nums.add(num); |
|
|
disposeErrorMsg(info,""); |
|
|
disposeErrorMsg(info,ImportErrorMsgConstants.HOUSE_ERROR); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
dto.setGridId(cacheGridName.toString()); |
|
|
dto.setGridId(cacheGridName.toString()); |
|
@ -450,6 +459,24 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode |
|
|
// 放结果
|
|
|
// 放结果
|
|
|
icHouseRedis.setImportResultDTO(formDTO.getCustomerId(), formDTO.getUserId(), new ImportResultDTO(nums,num)); |
|
|
icHouseRedis.setImportResultDTO(formDTO.getCustomerId(), formDTO.getUserId(), new ImportResultDTO(nums,num)); |
|
|
|
|
|
|
|
|
|
|
|
ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO(); |
|
|
|
|
|
input.setOperatorId(formDTO.getUserId()); |
|
|
|
|
|
input.setTaskId(taskId); |
|
|
|
|
|
if (CollectionUtils.isEmpty(nums)){ |
|
|
|
|
|
input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS); |
|
|
|
|
|
epmetCommonServiceOpenFeignClient.finishImportTask(input); |
|
|
|
|
|
}else { |
|
|
|
|
|
input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(errorInfos)){ |
|
|
|
|
|
try { |
|
|
|
|
|
String s = neighborHoodService.orgGeneralImport(errorInfos, HouseErrorInfoModel.class); |
|
|
|
|
|
input.setResultDescFilePath(s); |
|
|
|
|
|
} catch (IOException e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
epmetCommonServiceOpenFeignClient.finishImportTask(input); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|