Commit c8993d72 authored by lisong's avatar lisong

添加导入校验

parent c7523883
......@@ -36,6 +36,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.text.ParseException;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
......@@ -68,6 +69,14 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
RedisUtils redisUtils;
/**
* 身份证校验
*/
final String ID_CARD = "^[1-9]\\d{5}[1-9]\\d{3}((0[1-9])|(1[0-2]))(0[1-9]|([1|2][0-9])|3[0-1])((\\d{4})|\\d{3}X)$";
/**
* 电话校验
*/
final String PHONE = "^1((3|4|5|6|7|8|9){1}\\d{1}|70)\\d{8}$";
/**
* 分页查询
*/
public IPage<HouseholdPvDto> queryForHouseholdPvPage(Page<HouseholdPvDto> page, HouseholdPvDto dto) {
......@@ -188,6 +197,33 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
if (!map.containsKey(dto.getDistrictId())) {
return "第" + line + " 行乡镇不存在!";
}
if (dto.getNumber().length() > 50) {
return "第" + line + " 行户号最多输入50个字符!";
}
if (dto.getName().length() > 50) {
return "第" + line + " 行户主姓名最多输入50个字符!";
}
boolean idCard = dto.getIdNumber().matches(ID_CARD);
if (!idCard) {
return "第" + line + " 行身份证号格式有误!";
}
if (dto.getIssuingAuthority().length() > 200) {
return "第" + line + " 行签发机关最多输入200个字符!";
}
boolean phone = dto.getPhone().matches(PHONE);
if (!phone) {
return "第" + line + " 行手机号码格式有误!";
}
if (dto.getAddress().length() > 200) {
return "第" + line + " 行居住地最多输入200个字符!";
}
if (dto.getPostcode().length() > 10) {
return "第" + line + " 行居住地邮编最多输入10个字符!";
}
if (dto.getServiceAddress().length() > 200) {
return "第" + line + " 行送达地址最多输入200个字符!";
}
LambdaQueryWrapper<HouseholdPvDistrict> orgLambda = new QueryWrapper<HouseholdPvDistrict>().lambda();
orgLambda.likeRight(HouseholdPvDistrict::getBizOrgCode, orgCodeMap.get(dto.getPlatformCompanyId()));
List<HouseholdPvDistrict> householdPvDistricts = householdPvDistrictMapper.selectList(orgLambda);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment