Browse Source

房屋合同签订更新房屋状态,房屋购买,更新房屋状态

develop
zhangyuan 3 years ago
parent
commit
9cc8cb2452
  1. 5
      epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentHouseDTO.java
  2. 16
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractInfoServiceImpl.java
  3. 41
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentHouseServiceImpl.java

5
epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentHouseDTO.java

@ -187,4 +187,9 @@ public class RentHouseDTO implements Serializable {
*/ */
private String purchaseDate; private String purchaseDate;
/**
* 是否更新
*/
private String flag;
} }

16
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractInfoServiceImpl.java

@ -13,8 +13,10 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.IdCardNoValidatorUtils; import com.epmet.commons.tools.validator.IdCardNoValidatorUtils;
import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.IcHouseDTO;
import com.epmet.dto.IcResiUserAttachmentDTO; import com.epmet.dto.IcResiUserAttachmentDTO;
import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.form.IcHouseAddFormDTO;
import com.epmet.dto.form.RentTenantFormDTO; import com.epmet.dto.form.RentTenantFormDTO;
import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient;
@ -162,7 +164,7 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl<RentContractInf
public void review(RentContractInfoDTO dto) { public void review(RentContractInfoDTO dto) {
RentContractInfoEntity entity = ConvertUtils.sourceToTarget(dto, RentContractInfoEntity.class); RentContractInfoEntity entity = ConvertUtils.sourceToTarget(dto, RentContractInfoEntity.class);
updateById(entity); updateById(entity);
// 如果审核通过,就去更新基础库头像信息以及居民信息 // 如果审核通过,就去更新基础库头像信息以及居民信息,最后更新房屋的状态
if (NumConstant.ONE_STR.equals(entity.getState())) { if (NumConstant.ONE_STR.equals(entity.getState())) {
// 获取基本信息 // 获取基本信息
RentContractInfoDTO contractDto = get(dto.getId()); RentContractInfoDTO contractDto = get(dto.getId());
@ -215,6 +217,12 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl<RentContractInf
epmetUserOpenFeignClient.updateImage(formDTO); epmetUserOpenFeignClient.updateImage(formDTO);
}); });
// 更新房屋的状态为租赁
Result<IcHouseDTO> houseInfo = govOrgOpenFeignClient.get(dto.getHomeId());
IcHouseAddFormDTO formDTO = ConvertUtils.sourceToTarget(houseInfo.getData(), IcHouseAddFormDTO.class);
formDTO.setRentFlag(NumConstant.ONE);
govOrgOpenFeignClient.houseUpdate(formDTO);
} }
} }
@ -242,12 +250,12 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl<RentContractInf
rentContractFileService.deletePhysical(params); rentContractFileService.deletePhysical(params);
if (null == dto.getTenantList() || dto.getTenantList().isEmpty()) { if (null == dto.getTenantList() || dto.getTenantList().isEmpty()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"租客不能为空"); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "租客不能为空");
} else { } else {
List<RentTenantInfoEntity> tenantList = ConvertUtils.sourceToTarget(dto.getTenantList(), RentTenantInfoEntity.class); List<RentTenantInfoEntity> tenantList = ConvertUtils.sourceToTarget(dto.getTenantList(), RentTenantInfoEntity.class);
long idCardNum = tenantList.stream().map(RentTenantInfoEntity::getIdCard).collect(Collectors.toList()).stream().distinct().count(); long idCardNum = tenantList.stream().map(RentTenantInfoEntity::getIdCard).collect(Collectors.toList()).stream().distinct().count();
if (tenantList.size() != idCardNum) { if (tenantList.size() != idCardNum) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"租客身份证重复"); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "租客身份证重复");
} }
tenantList.forEach(tenant -> { tenantList.forEach(tenant -> {
@ -279,7 +287,7 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl<RentContractInf
} }
if (null == dto.getFileList() || dto.getFileList().isEmpty()) { if (null == dto.getFileList() || dto.getFileList().isEmpty()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"合同附件不能为空"); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "合同附件不能为空");
} else { } else {
List<RentContractFileEntity> fileList = ConvertUtils.sourceToTarget(dto.getFileList(), RentContractFileEntity.class); List<RentContractFileEntity> fileList = ConvertUtils.sourceToTarget(dto.getFileList(), RentContractFileEntity.class);
fileList.forEach(item -> { fileList.forEach(item -> {

41
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentHouseServiceImpl.java

@ -3,11 +3,13 @@ package com.epmet.plugin.power.modules.rent.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dto.form.IcHouseAddFormDTO;
import com.epmet.plugin.power.modules.rent.dao.RentHouseDao; import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.plugin.power.dto.rent.RentHouseDTO; import com.epmet.plugin.power.dto.rent.RentHouseDTO;
import com.epmet.plugin.power.modules.rent.dao.RentHouseDao;
import com.epmet.plugin.power.modules.rent.entity.RentHouseEntity; import com.epmet.plugin.power.modules.rent.entity.RentHouseEntity;
import com.epmet.plugin.power.modules.rent.redis.RentHouseRedis; import com.epmet.plugin.power.modules.rent.redis.RentHouseRedis;
import com.epmet.plugin.power.modules.rent.service.RentHouseService; import com.epmet.plugin.power.modules.rent.service.RentHouseService;
@ -32,6 +34,9 @@ public class RentHouseServiceImpl extends BaseServiceImpl<RentHouseDao, RentHous
@Autowired @Autowired
private RentHouseRedis rentHouseRedis; private RentHouseRedis rentHouseRedis;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Override @Override
public PageData<RentHouseDTO> page(Map<String, Object> params) { public PageData<RentHouseDTO> page(Map<String, Object> params) {
IPage<RentHouseEntity> page = baseDao.selectPage( IPage<RentHouseEntity> page = baseDao.selectPage(
@ -48,11 +53,33 @@ public class RentHouseServiceImpl extends BaseServiceImpl<RentHouseDao, RentHous
return ConvertUtils.sourceToTarget(entityList, RentHouseDTO.class); return ConvertUtils.sourceToTarget(entityList, RentHouseDTO.class);
} }
private QueryWrapper<RentHouseEntity> getWrapper(Map<String, Object> params){ private QueryWrapper<RentHouseEntity> getWrapper(Map<String, Object> params) {
String id = (String)params.get(FieldConstant.ID_HUMP); String id = (String) params.get(FieldConstant.ID_HUMP);
String gridId = (String) params.get("gridId");
String villageId = (String) params.get("villageId");
String buildId = (String) params.get("buildId");
String unitId = (String) params.get("unitId");
String homeId = (String) params.get("homeId");
String ownerName = (String) params.get("ownerName");
String ownerPhone = (String) params.get("ownerPhone");
String ownerIdCard = (String) params.get("ownerIdCard");
String rentFlag = (String) params.get("rentFlag");
String startTime = (String) params.get("startTime");
String endTime = (String) params.get("endTime");
QueryWrapper<RentHouseEntity> wrapper = new QueryWrapper<>(); QueryWrapper<RentHouseEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
wrapper.eq(StringUtils.isNotBlank(gridId), "GRID_ID", gridId);
wrapper.eq(StringUtils.isNotBlank(villageId), "VILLAGE_ID", villageId);
wrapper.eq(StringUtils.isNotBlank(buildId), "BUILD_ID", buildId);
wrapper.eq(StringUtils.isNotBlank(unitId), "UNIT_ID", unitId);
wrapper.eq(StringUtils.isNotBlank(homeId), "HOME_ID", homeId);
wrapper.eq(StringUtils.isNotBlank(ownerName), "OWNER_NAME", ownerName);
wrapper.eq(StringUtils.isNotBlank(ownerPhone), "OWNER_PHONE", ownerPhone);
wrapper.eq(StringUtils.isNotBlank(ownerIdCard), "OWNER_ID_CARD", ownerIdCard);
wrapper.eq(StringUtils.isNotBlank(rentFlag), "RENT_FLAG", rentFlag);
wrapper.ge(StringUtils.isNotBlank(startTime), "PURCHASE_DATE", startTime);
wrapper.le(StringUtils.isNotBlank(endTime), "PURCHASE_DATE", endTime);
return wrapper; return wrapper;
} }
@ -68,6 +95,12 @@ public class RentHouseServiceImpl extends BaseServiceImpl<RentHouseDao, RentHous
public void save(RentHouseDTO dto) { public void save(RentHouseDTO dto) {
RentHouseEntity entity = ConvertUtils.sourceToTarget(dto, RentHouseEntity.class); RentHouseEntity entity = ConvertUtils.sourceToTarget(dto, RentHouseEntity.class);
insert(entity); insert(entity);
// 更新房屋的租赁状态
if (dto.getFlag() == "123") {
IcHouseAddFormDTO formDTO = ConvertUtils.sourceToTarget(dto, IcHouseAddFormDTO.class);
govOrgOpenFeignClient.houseUpdate(formDTO);
}
} }
@Override @Override

Loading…
Cancel
Save