|
|
@ -1,6 +1,5 @@ |
|
|
|
package com.epmet.model; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.ConcurrentHashSet; |
|
|
|
import com.alibaba.excel.context.AnalysisContext; |
|
|
|
import com.alibaba.excel.event.AnalysisEventListener; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
@ -17,7 +16,6 @@ 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; |
|
|
|
import com.epmet.enums.HousePurposeEnums; |
|
|
|
import com.epmet.enums.HouseRentFlagEnums; |
|
|
@ -26,12 +24,16 @@ import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|
|
|
import com.epmet.redis.IcHouseRedis; |
|
|
|
import com.epmet.service.IcHouseService; |
|
|
|
import com.epmet.service.IcNeighborHoodService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.util.*; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -39,6 +41,7 @@ import java.util.stream.Collectors; |
|
|
|
* @DateTime 2022/2/13 1:25 下午 |
|
|
|
* @DESC |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoModel> { |
|
|
|
|
|
|
|
List<Integer> nums = new ArrayList<>(); |
|
|
@ -137,6 +140,16 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode |
|
|
|
disposeErrorMsg(info, "门牌号的值未填写"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(data.getOwnerPhone()) && data.getOwnerPhone().length() > 15){ |
|
|
|
nums.add(num); |
|
|
|
disposeErrorMsg(info, "房主电话的长度超出限制"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(data.getOwnerIdCard()) && data.getOwnerIdCard().length() > 18){ |
|
|
|
nums.add(num); |
|
|
|
disposeErrorMsg(info, "房主身份证的长度超出限制"); |
|
|
|
return; |
|
|
|
} |
|
|
|
/** |
|
|
|
* 2022-03-29 需求改动,单元号修改 eg 1 改为 1单元 |
|
|
|
* 做限制,此字段中必须带有 "单元"2字,不存在就不给导入 |
|
|
@ -490,7 +503,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode |
|
|
|
*/ |
|
|
|
public Map<String,Object> getGridInfos(String orgId){ |
|
|
|
gridInfoDTOs = icBuildingDao.selectAllGridByOrgId(orgId); |
|
|
|
gridInfos = gridInfoDTOs.stream().collect(Collectors.toMap(n -> n.getGridName(), n -> n.getGridId())); |
|
|
|
gridInfos = gridInfoDTOs.stream().collect(Collectors.toMap(n -> n.getGridName(), n -> n.getGridId(),(o1,o2) -> o1)); |
|
|
|
icHouseRedis.setTemporaryCacheGrid(formDTO.getCustomerId(), gridInfos, formDTO.getUserId()); |
|
|
|
return gridInfos; |
|
|
|
} |
|
|
@ -503,7 +516,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode |
|
|
|
*/ |
|
|
|
public Map<String,Object> getNeighborHoodInfos(List<String> gridIds){ |
|
|
|
neighborHoodInfoDTOs = icBuildingDao.selectAllNeighborHoodByGridIds(gridIds); |
|
|
|
neighborHoodInfos = neighborHoodInfoDTOs.stream().collect(Collectors.toMap(n -> n.getGridId() + "_" + n.getNeighborHoodName(), n -> n.getNeighborHoodId())); |
|
|
|
neighborHoodInfos = neighborHoodInfoDTOs.stream().collect(Collectors.toMap(n -> n.getGridId() + "_" + n.getNeighborHoodName(), n -> n.getNeighborHoodId(),(o1,o2) -> o1)); |
|
|
|
icHouseRedis.setTemporaryCacheNeighBorHood(formDTO.getCustomerId(), neighborHoodInfos, formDTO.getUserId()); |
|
|
|
return neighborHoodInfos; |
|
|
|
} |
|
|
@ -516,7 +529,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode |
|
|
|
*/ |
|
|
|
public Map<String,Object> getBuildingInfos(String orgId){ |
|
|
|
buildingInfoDTOs = icBuildingDao.selectAllBuildingByNeighborHoodId(orgId); |
|
|
|
buildingInfos = buildingInfoDTOs.stream().collect(Collectors.toMap(n -> n.getNeighborHoodId() + "_" + n.getBuildingName(), n -> n.getBuildingId())); |
|
|
|
buildingInfos = buildingInfoDTOs.stream().collect(Collectors.toMap(n -> n.getNeighborHoodId() + "_" + n.getBuildingName(), n -> n.getBuildingId(),(o1,o2) -> o1)); |
|
|
|
icHouseRedis.setTemporaryCacheBuilding(formDTO.getCustomerId(), buildingInfos, formDTO.getUserId()); |
|
|
|
return buildingInfos; |
|
|
|
} |
|
|
@ -530,7 +543,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode |
|
|
|
public Map<String,Object> getBuildingUnitInfos(String orgId){ |
|
|
|
buildingUnitInfoDTOs = icBuildingDao.selectAllBuildingUnitByBuildingId(orgId); |
|
|
|
if (!CollectionUtils.isEmpty(buildingUnitInfoDTOs)){ |
|
|
|
buildingUnitInfos = buildingUnitInfoDTOs.stream().collect(Collectors.toMap(n -> n.getBuildingId() + "_" + n.getBuildingUnit(), n -> n.getBuildingUnitId())); |
|
|
|
buildingUnitInfos = buildingUnitInfoDTOs.stream().collect(Collectors.toMap(n -> n.getBuildingId() + "_" + n.getBuildingUnit(), n -> n.getBuildingUnitId(),(o1,o2) -> o1)); |
|
|
|
icHouseRedis.setTemporaryCacheBuildingUnit(formDTO.getCustomerId(), buildingUnitInfos, formDTO.getUserId()); |
|
|
|
} |
|
|
|
return buildingInfos; |
|
|
@ -570,7 +583,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode |
|
|
|
input.setResultDescFilePath(s); |
|
|
|
} catch (IOException e) { |
|
|
|
epmetCommonServiceOpenFeignClient.finishImportTask(input); |
|
|
|
e.printStackTrace(); |
|
|
|
log.error("method exception", e); |
|
|
|
} |
|
|
|
} |
|
|
|
epmetCommonServiceOpenFeignClient.finishImportTask(input); |
|
|
|