修改证件号校验 , 人口录入页面布局 , 年龄解析
This commit is contained in:
parent
db5be7b815
commit
77e5fff71d
@ -5,6 +5,9 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Period;
|
||||
|
||||
@ApiModel
|
||||
public class PopulationInfoBaseDTO {
|
||||
|
||||
@ -90,7 +93,9 @@ public class PopulationInfoBaseDTO {
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -8,7 +8,6 @@ import com.cm.common.pojo.ListPage;
|
||||
import com.cm.common.result.SuccessResultList;
|
||||
import com.cm.common.token.app.AppTokenManager;
|
||||
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.UUIDUtil;
|
||||
import com.cm.population.dao.areatree.IAreatreeDao;
|
||||
@ -40,7 +39,6 @@ import com.github.pagehelper.PageInfo;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -80,13 +78,12 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
|
||||
List<AreaZtreeDTO> list = iAreatreeDao.getAreaList(params);
|
||||
for (AreaZtreeDTO dto : list) {
|
||||
Integer count = iAreatreeDao.countByParentId(dto.getId());
|
||||
if (count > 0) {
|
||||
if(count > 0) {
|
||||
dto.setIsParent(true);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ICorrectService iCorrectService;
|
||||
@Autowired
|
||||
@ -101,7 +98,6 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
|
||||
private IReleaseService iReleaseService;
|
||||
@Autowired
|
||||
private ISecurityService iSecurityService;
|
||||
|
||||
@Override
|
||||
public PopulationInfoBaseDTO getBase(String populationInfoId) {
|
||||
Map<String, Object> query = new HashMap<>();
|
||||
@ -149,15 +145,17 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
|
||||
if (dto != null) {
|
||||
throw new SaveException("该证件号码已存在");
|
||||
}
|
||||
if (!IdCardVerifyUtil.isIDCard(populationInfoVO.getIdcard().trim())) {
|
||||
throw new SaveException("该证件号码错误");
|
||||
if (populationInfoVO.getIdcardType().equals("身份证")) {
|
||||
if(!IdCardVerifyUtil.isIDCard(populationInfoVO.getIdcard().trim())) {
|
||||
throw new SaveException("该证件号码错误");
|
||||
}
|
||||
}
|
||||
String areaCode = populationInfoVO.getDomicileAreaCode();
|
||||
if (areaCode.startsWith("150271")) { //包头稀土高新技术产业开发区
|
||||
if(areaCode.startsWith("150271")) { //包头稀土高新技术产业开发区
|
||||
populationInfoVO.setDomicileAddressType("3");
|
||||
} else if (areaCode.startsWith("1502")) { //包头市
|
||||
}else if(areaCode.startsWith("1502")) { //包头市
|
||||
populationInfoVO.setDomicileAddressType("2");
|
||||
} else { //非包头市
|
||||
}else { //非包头市
|
||||
populationInfoVO.setDomicileAddressType("1");
|
||||
}
|
||||
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) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("populationInfoIds", ids);
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
if(StringUtils.isEmpty(token)) {
|
||||
setUpdateInfo(params);
|
||||
} else {
|
||||
}else{
|
||||
setUpdateInfo(token, params);
|
||||
}
|
||||
populationInfoDao.remove(params);
|
||||
@ -188,9 +186,9 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
|
||||
public void delete(String token, List<String> ids) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("populationInfoIds", ids);
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
if(StringUtils.isEmpty(token)) {
|
||||
setUpdateInfo(params);
|
||||
} else {
|
||||
}else{
|
||||
setUpdateInfo(token, params);
|
||||
}
|
||||
populationInfoDao.delete(params);
|
||||
@ -208,21 +206,23 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
|
||||
if (dto != null && !dto.getPopulationInfoId().equals(populationInfoId)) {
|
||||
throw new SaveException("该证件号码已存在");
|
||||
}
|
||||
if (!IdCardVerifyUtil.isIDCard(populationInfoVO.getIdcard().trim())) {
|
||||
throw new SaveException("该证件号码错误");
|
||||
if (populationInfoVO.getIdcardType().equals("身份证")) {
|
||||
if(!IdCardVerifyUtil.isIDCard(populationInfoVO.getIdcard().trim())) {
|
||||
throw new SaveException("该证件号码错误");
|
||||
}
|
||||
}
|
||||
String areaCode = populationInfoVO.getDomicileAreaCode();
|
||||
if (areaCode.startsWith("150271")) { //包头稀土高新技术产业开发区
|
||||
if(areaCode.startsWith("150271")) { //包头稀土高新技术产业开发区
|
||||
populationInfoVO.setDomicileAddressType("3");
|
||||
} else if (areaCode.startsWith("1502")) { //包头市
|
||||
}else if(areaCode.startsWith("1502")) { //包头市
|
||||
populationInfoVO.setDomicileAddressType("2");
|
||||
} else { //非包头市
|
||||
}else { //非包头市
|
||||
populationInfoVO.setDomicileAddressType("1");
|
||||
}
|
||||
params.put("populationInfoId", populationInfoId);
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
if(StringUtils.isEmpty(token)) {
|
||||
setUpdateInfo(params);
|
||||
} else {
|
||||
}else{
|
||||
setUpdateInfo(token, params);
|
||||
}
|
||||
populationInfoDao.update(params);
|
||||
@ -273,14 +273,7 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
|
||||
|
||||
@Override
|
||||
public List<PopulationInfoDTO> list(Map<String, Object> params) {
|
||||
List<PopulationInfoDTO> populationInfoDTOS = populationInfoDao.list(params);
|
||||
populationInfoDTOS.forEach(populationInfoDTO -> {
|
||||
if (StringUtils.isBlank(populationInfoDTO.getBirthday())) {
|
||||
return;
|
||||
}
|
||||
populationInfoDTO.setAge(DateUtil.getAgeByBirthday(populationInfoDTO.getBirthday()));
|
||||
});
|
||||
return populationInfoDTOS;
|
||||
return populationInfoDao.list(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user