Browse Source

审批校验身份证号逻辑提前

lingshan_master
wanggongfeng 3 years ago
parent
commit
fefd327935
  1. 23
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractInfoServiceImpl.java

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

@ -282,6 +282,19 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl<RentContractInf
if (NumConstant.ONE_STR.equals(entity.getState())) {
// 获取基本信息
RentContractInfoDTO contractDto = get(dto.getId());
// 获取租客信息
Map<String, Object> tenantParams = new HashMap<>(4);
tenantParams.put("contractId", contractDto.getId());
List<RentTenantInfoDTO> tenantList = rentTenantInfoService.list(tenantParams);
// 提前校验身份证格式
for(RentTenantInfoDTO rentTenantInfoDTO : tenantList){
// 校验身份证
IdCardRegexUtils regex = IdCardRegexUtils.parse(rentTenantInfoDTO.getIdCard());
if (regex == null) {
return new Result().error(rentTenantInfoDTO.getName()+"证件号错误");
// throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), rentTenantInfoDTO.getName()+"证件号错误", rentTenantInfoDTO.getName()+"证件号错误");
}
}
// 1、审核通过,插入合同记录表
PliRentContractInfoLogEntity logEntity = ConvertUtils.sourceToTarget(contractDto, PliRentContractInfoLogEntity.class);
@ -297,17 +310,9 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl<RentContractInf
}
rentContractFileService.insertBatch(contractFileEntities);
// 获取租客信息
Map<String, Object> tenantParams = new HashMap<>(4);
tenantParams.put("contractId", contractDto.getId());
List<RentTenantInfoDTO> tenantList = rentTenantInfoService.list(tenantParams);
tenantList.forEach(tenant -> {
// 校验身份证
IdCardRegexUtils regex = IdCardRegexUtils.parse(tenant.getIdCard());
if (regex == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), tenant.getName()+"证件号错误", tenant.getName()+"证件号错误");
}
// 根据身份证解析性别和出生日期
tenant.setGender("0".equals(IdCardNoValidatorUtils.getGender(tenant.getIdCard())) ? "" : IdCardNoValidatorUtils.getGender(tenant.getIdCard()));

Loading…
Cancel
Save