修改证件号校验 , 人口录入页面布局 , 年龄解析

This commit is contained in:
java_cuibaocheng@163.com 2023-11-04 15:07:48 +08:00
parent db5be7b815
commit 77e5fff71d
4 changed files with 1477 additions and 1386 deletions

View File

@ -5,6 +5,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.time.LocalDate;
import java.time.Period;
@ApiModel @ApiModel
public class PopulationInfoBaseDTO { public class PopulationInfoBaseDTO {
@ -90,7 +93,9 @@ public class PopulationInfoBaseDTO {
} }
public Integer getAge() { public Integer getAge() {
return IdCardVerifyUtil.getIdCardAge(idcard); LocalDate birthDate = LocalDate.parse(this.birthday);
Period period = Period.between(birthDate, LocalDate.now());
return period.getYears();
} }
public void setAge(Integer age) { public void setAge(Integer age) {

View File

@ -8,7 +8,6 @@ import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResultList; import com.cm.common.result.SuccessResultList;
import com.cm.common.token.app.AppTokenManager; import com.cm.common.token.app.AppTokenManager;
import com.cm.common.token.app.entity.AppTokenUser; import com.cm.common.token.app.entity.AppTokenUser;
import com.cm.common.utils.DateUtil;
import com.cm.common.utils.HashMapUtil; import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.UUIDUtil; import com.cm.common.utils.UUIDUtil;
import com.cm.population.dao.areatree.IAreatreeDao; import com.cm.population.dao.areatree.IAreatreeDao;
@ -40,7 +39,6 @@ import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
/** /**
@ -80,13 +78,12 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
List<AreaZtreeDTO> list = iAreatreeDao.getAreaList(params); List<AreaZtreeDTO> list = iAreatreeDao.getAreaList(params);
for (AreaZtreeDTO dto : list) { for (AreaZtreeDTO dto : list) {
Integer count = iAreatreeDao.countByParentId(dto.getId()); Integer count = iAreatreeDao.countByParentId(dto.getId());
if (count > 0) { if(count > 0) {
dto.setIsParent(true); dto.setIsParent(true);
} }
} }
return list; return list;
} }
@Autowired @Autowired
private ICorrectService iCorrectService; private ICorrectService iCorrectService;
@Autowired @Autowired
@ -101,7 +98,6 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
private IReleaseService iReleaseService; private IReleaseService iReleaseService;
@Autowired @Autowired
private ISecurityService iSecurityService; private ISecurityService iSecurityService;
@Override @Override
public PopulationInfoBaseDTO getBase(String populationInfoId) { public PopulationInfoBaseDTO getBase(String populationInfoId) {
Map<String, Object> query = new HashMap<>(); Map<String, Object> query = new HashMap<>();
@ -149,15 +145,17 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
if (dto != null) { if (dto != null) {
throw new SaveException("该证件号码已存在"); throw new SaveException("该证件号码已存在");
} }
if (!IdCardVerifyUtil.isIDCard(populationInfoVO.getIdcard().trim())) { if (populationInfoVO.getIdcardType().equals("身份证")) {
throw new SaveException("该证件号码错误"); if(!IdCardVerifyUtil.isIDCard(populationInfoVO.getIdcard().trim())) {
throw new SaveException("该证件号码错误");
}
} }
String areaCode = populationInfoVO.getDomicileAreaCode(); String areaCode = populationInfoVO.getDomicileAreaCode();
if (areaCode.startsWith("150271")) { //包头稀土高新技术产业开发区 if(areaCode.startsWith("150271")) { //包头稀土高新技术产业开发区
populationInfoVO.setDomicileAddressType("3"); populationInfoVO.setDomicileAddressType("3");
} else if (areaCode.startsWith("1502")) { //包头市 }else if(areaCode.startsWith("1502")) { //包头市
populationInfoVO.setDomicileAddressType("2"); populationInfoVO.setDomicileAddressType("2");
} else { //非包头市 }else { //非包头市
populationInfoVO.setDomicileAddressType("1"); populationInfoVO.setDomicileAddressType("1");
} }
Map<String, Object> params = HashMapUtil.objectToMap(populationInfoVO); Map<String, Object> params = HashMapUtil.objectToMap(populationInfoVO);
@ -176,9 +174,9 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
public void remove(String token, List<String> ids) { public void remove(String token, List<String> ids) {
Map<String, Object> params = getHashMap(2); Map<String, Object> params = getHashMap(2);
params.put("populationInfoIds", ids); params.put("populationInfoIds", ids);
if (StringUtils.isEmpty(token)) { if(StringUtils.isEmpty(token)) {
setUpdateInfo(params); setUpdateInfo(params);
} else { }else{
setUpdateInfo(token, params); setUpdateInfo(token, params);
} }
populationInfoDao.remove(params); populationInfoDao.remove(params);
@ -188,9 +186,9 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
public void delete(String token, List<String> ids) { public void delete(String token, List<String> ids) {
Map<String, Object> params = getHashMap(2); Map<String, Object> params = getHashMap(2);
params.put("populationInfoIds", ids); params.put("populationInfoIds", ids);
if (StringUtils.isEmpty(token)) { if(StringUtils.isEmpty(token)) {
setUpdateInfo(params); setUpdateInfo(params);
} else { }else{
setUpdateInfo(token, params); setUpdateInfo(token, params);
} }
populationInfoDao.delete(params); populationInfoDao.delete(params);
@ -208,21 +206,23 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
if (dto != null && !dto.getPopulationInfoId().equals(populationInfoId)) { if (dto != null && !dto.getPopulationInfoId().equals(populationInfoId)) {
throw new SaveException("该证件号码已存在"); throw new SaveException("该证件号码已存在");
} }
if (!IdCardVerifyUtil.isIDCard(populationInfoVO.getIdcard().trim())) { if (populationInfoVO.getIdcardType().equals("身份证")) {
throw new SaveException("该证件号码错误"); if(!IdCardVerifyUtil.isIDCard(populationInfoVO.getIdcard().trim())) {
throw new SaveException("该证件号码错误");
}
} }
String areaCode = populationInfoVO.getDomicileAreaCode(); String areaCode = populationInfoVO.getDomicileAreaCode();
if (areaCode.startsWith("150271")) { //包头稀土高新技术产业开发区 if(areaCode.startsWith("150271")) { //包头稀土高新技术产业开发区
populationInfoVO.setDomicileAddressType("3"); populationInfoVO.setDomicileAddressType("3");
} else if (areaCode.startsWith("1502")) { //包头市 }else if(areaCode.startsWith("1502")) { //包头市
populationInfoVO.setDomicileAddressType("2"); populationInfoVO.setDomicileAddressType("2");
} else { //非包头市 }else { //非包头市
populationInfoVO.setDomicileAddressType("1"); populationInfoVO.setDomicileAddressType("1");
} }
params.put("populationInfoId", populationInfoId); params.put("populationInfoId", populationInfoId);
if (StringUtils.isEmpty(token)) { if(StringUtils.isEmpty(token)) {
setUpdateInfo(params); setUpdateInfo(params);
} else { }else{
setUpdateInfo(token, params); setUpdateInfo(token, params);
} }
populationInfoDao.update(params); populationInfoDao.update(params);
@ -273,14 +273,7 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
@Override @Override
public List<PopulationInfoDTO> list(Map<String, Object> params) { public List<PopulationInfoDTO> list(Map<String, Object> params) {
List<PopulationInfoDTO> populationInfoDTOS = populationInfoDao.list(params); return populationInfoDao.list(params);
populationInfoDTOS.forEach(populationInfoDTO -> {
if (StringUtils.isBlank(populationInfoDTO.getBirthday())) {
return;
}
populationInfoDTO.setAge(DateUtil.getAgeByBirthday(populationInfoDTO.getBirthday()));
});
return populationInfoDTOS;
} }
@Override @Override

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff