|
|
@ -10,6 +10,14 @@ import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.security.user.LoginUserUtil; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dto.CustomerAgencyDTO; |
|
|
|
import com.epmet.dto.IcResiUserAttachmentDTO; |
|
|
|
import com.epmet.dto.IcResiUserDTO; |
|
|
|
import com.epmet.dto.form.RentTenantFormDTO; |
|
|
|
import com.epmet.dto.result.GridInfoResultDTO; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.plugin.power.dto.rent.RentContractFileDTO; |
|
|
|
import com.epmet.plugin.power.dto.rent.RentContractInfoDTO; |
|
|
|
import com.epmet.plugin.power.dto.rent.RentTenantInfoDTO; |
|
|
@ -26,10 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
/** |
|
|
|
* 合同表 |
|
|
@ -46,6 +51,12 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl<RentContractInf |
|
|
|
@Autowired |
|
|
|
LoginUserUtil loginUserUtil; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private RentTenantInfoService rentTenantInfoService; |
|
|
|
|
|
|
@ -156,10 +167,45 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl<RentContractInf |
|
|
|
public void review(RentContractInfoDTO dto) { |
|
|
|
RentContractInfoEntity entity = ConvertUtils.sourceToTarget(dto, RentContractInfoEntity.class); |
|
|
|
updateById(entity); |
|
|
|
// 如果审核通过,就去更新基础库
|
|
|
|
// 如果审核通过,就去更新基础库头像信息以及居民信息
|
|
|
|
if (NumConstant.ONE_STR.equals(entity.getState())) { |
|
|
|
dto.getTenantList().forEach(tenant->{ |
|
|
|
dto.getTenantList().forEach(tenant -> { |
|
|
|
RentTenantFormDTO formDTO = new RentTenantFormDTO(); |
|
|
|
List<IcResiUserAttachmentDTO> images = new ArrayList<>(); |
|
|
|
formDTO.setCustomerId(loginUserUtil.getLoginUserCustomerId()); |
|
|
|
formDTO.setIdCard(tenant.getIdCard()); |
|
|
|
formDTO.setImages(images); |
|
|
|
formDTO.setType(NumConstant.ONE_STR); |
|
|
|
|
|
|
|
tenant.getImgList().forEach(img -> { |
|
|
|
// 更新基础库的人员头像
|
|
|
|
IcResiUserAttachmentDTO image = new IcResiUserAttachmentDTO(); |
|
|
|
image.setAttachmentUrl(img.getFileUrl()); |
|
|
|
image.setCustomerId(loginUserUtil.getLoginUserCustomerId()); |
|
|
|
images.add(image); |
|
|
|
}); |
|
|
|
formDTO.setImages(images); |
|
|
|
|
|
|
|
// 初始化居民信息
|
|
|
|
IcResiUserDTO user = new IcResiUserDTO(); |
|
|
|
user.setCustomerId(loginUserUtil.getLoginUserCustomerId()); |
|
|
|
user.setGridId(dto.getGridId()); |
|
|
|
user.setVillageId(dto.getVillageId()); |
|
|
|
user.setBuildId(dto.getBuildId()); |
|
|
|
user.setUnitId(dto.getUnitId()); |
|
|
|
user.setHomeId(dto.getHomeId()); |
|
|
|
user.setName(tenant.getName()); |
|
|
|
user.setIdCard(tenant.getIdCard()); |
|
|
|
user.setMobile(tenant.getMobile()); |
|
|
|
|
|
|
|
Result<GridInfoResultDTO> gridInfo = govOrgOpenFeignClient.queryGridInfo(dto.getGridId()); |
|
|
|
user.setAgencyId(gridInfo.getData().getParentAgencyId()); |
|
|
|
Result<CustomerAgencyDTO> agencyInfo = govOrgOpenFeignClient.getAgencyById(gridInfo.getData().getParentAgencyId()); |
|
|
|
user.setPids(agencyInfo.getData().getPids()); |
|
|
|
|
|
|
|
formDTO.setUser(user); |
|
|
|
|
|
|
|
epmetUserOpenFeignClient.updateImage(formDTO); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|