Browse Source

房屋新增途径添加orgIdPath

master
zxc 3 years ago
parent
commit
420dde575a
  1. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/ImportGeneralDTO.java
  2. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java
  3. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java
  4. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/ImportGeneralDTO.java

@ -28,6 +28,8 @@ public class ImportGeneralDTO implements Serializable {
private String pid;
private String pids;
private String orgIdPath;
/**
* 网格名ID
*/

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java

@ -170,8 +170,6 @@ public class HouseController implements ResultDataResolver {
//效验数据
ValidatorUtils.validateEntity(formDTO, IcHouseAddFormDTO.AddShowGroup.class);
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
houseService.addHouse(customerId, formDTO);
return new Result();
}

5
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java

@ -3,6 +3,7 @@ package com.epmet.model;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
@ -237,6 +238,10 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
if (CollectionUtils.isEmpty(needInsertList)){
return;
}
needInsertList.forEach(n -> {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(n.getGridId());
n.setOrgIdPath(gridInfo.getPids().concat(":").concat(gridInfo.getId()));
});
// 根据单元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);

11
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java

@ -20,6 +20,7 @@ import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
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.HouseInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -147,6 +148,16 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
areaCode = numberAfterFillZero(areaCode, NumConstant.TWELVE);
icHouseDTO.setHouseCode(createHouseCode(customerId, formDTO.getBuildingId(), areaCode));
}
// 补充orgIdPath
IcNeighborHoodEntity icNeighborHoodEntity = icNeighborHoodDao.selectById(icHouseDTO.getNeighborHoodId());
if (null == icNeighborHoodEntity){
throw new EpmetException("小区不存在:"+icHouseDTO.getNeighborHoodId());
}
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(icNeighborHoodEntity.getGridId());
if (null == gridInfo){
throw new EpmetException("网格信息不存在:"+icNeighborHoodEntity.getId());
}
icHouseDTO.setOrgIdPath(gridInfo.getPids().concat(":").concat(gridInfo.getId()));
icHouseDao.insert(icHouseDTO);
IcHouseEntity entity = new IcHouseEntity();
entity.setId(icHouseDTO.getId());

Loading…
Cancel
Save