|
|
@ -2,8 +2,10 @@ package com.epmet.service.impl; |
|
|
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.enums.OrgTypeEnum; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
@ -17,11 +19,13 @@ import com.epmet.dto.IcNeighborHoodPropertyDTO; |
|
|
|
import com.epmet.dto.form.IcHouseListFormDTO; |
|
|
|
import com.epmet.dto.form.IcNeighborHoodAddFormDTO; |
|
|
|
import com.epmet.dto.form.IcNeighborHoodListFormDTO; |
|
|
|
import com.epmet.dto.form.IcUserBelongToChangedFormDTO; |
|
|
|
import com.epmet.dto.result.IcNeighborHoodResultDTO; |
|
|
|
import com.epmet.entity.IcHouseEntity; |
|
|
|
import com.epmet.entity.IcNeighborHoodEntity; |
|
|
|
import com.epmet.entity.IcNeighborHoodPropertyEntity; |
|
|
|
import com.epmet.excel.IcNeighborHoodExcel; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.service.IcNeighborHoodPropertyService; |
|
|
|
import com.epmet.service.IcNeighborHoodService; |
|
|
@ -44,7 +48,7 @@ import java.util.Optional; |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
public class NeighborHoodServiceImpl implements NeighborHoodService { |
|
|
|
public class NeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao,IcNeighborHoodEntity> implements NeighborHoodService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|
|
@ -56,6 +60,8 @@ public class NeighborHoodServiceImpl implements NeighborHoodService { |
|
|
|
private IcNeighborHoodPropertyDao icNeighborHoodPropertyDao; |
|
|
|
@Resource |
|
|
|
private IcNeighborHoodDao icNeighborHoodDao; |
|
|
|
@Autowired |
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@ -132,11 +138,28 @@ public class NeighborHoodServiceImpl implements NeighborHoodService { |
|
|
|
if (!customerAgencyResult.success()) { |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|
|
|
} |
|
|
|
IcNeighborHoodEntity icNeighborHoodEntity = baseDao.selectById(formDTO.getNeighborHoodId()); |
|
|
|
if (icNeighborHoodEntity == null){ |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"小区信息不存在","小区信息不存在"); |
|
|
|
} |
|
|
|
|
|
|
|
CustomerAgencyDTO customerAgencyDTO = Optional.ofNullable(customerAgencyResult.getData()).orElse(new CustomerAgencyDTO()); |
|
|
|
icNeighborHoodDTO.setParentAgencyId(customerAgencyDTO.getPid()); |
|
|
|
icNeighborHoodDTO.setAgencyPids(customerAgencyDTO.getPids()); |
|
|
|
icNeighborHoodService.update(icNeighborHoodDTO); |
|
|
|
|
|
|
|
//如果更新了网格 则需要更新网格下的居民所属关系
|
|
|
|
if (icNeighborHoodEntity.getGridId().equals(icNeighborHoodDTO.getGridId())){ |
|
|
|
IcUserBelongToChangedFormDTO userForm = new IcUserBelongToChangedFormDTO(); |
|
|
|
userForm.setSourceGridId(icNeighborHoodEntity.getGridId()); |
|
|
|
userForm.setTargetGridId(icNeighborHoodDTO.getGridId()); |
|
|
|
Result<Boolean> updateResult = epmetUserOpenFeignClient.changeIcResiUserBelongTo(userForm); |
|
|
|
if (updateResult == null || !updateResult.success()){ |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"更新居民信息失败,请稍后重试!","更新居民信息失败,请稍后重试!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//设置物业关联
|
|
|
|
String propertyId = formDTO.getPropertyId(); |
|
|
|
String neighborHoodId = icNeighborHoodDTO.getId(); |
|
|
|