Browse Source

身份证校验

dev
zxc 3 years ago
parent
commit
8e6449b34e
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcEmployeeRegisterServiceImpl.java

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -267,6 +267,7 @@ public enum EpmetErrorCode {
NAT_RESULT_IS_NULL_ERROR(8932,"检测结果不能为空"),
SAMPLE_TIME_IS_NULL_ERROR(8933,"采样时间不能为空"),
SAMPLE_TIME_AND_RESULT_IS_NULL_ERROR(8934,"检测时间或结果不能为空"),
ID_CARD_ERROR(8935,"请输入正确的证件号"),
MISMATCH(10086,"人员与房屋信息不匹配,请与工作人员联系。"),

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcEmployeeRegisterServiceImpl.java

@ -7,10 +7,13 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.IdCardRegexUtils;
import com.epmet.dao.IcEmployeeRegisterDao;
import com.epmet.dto.IcEmployeeRegisterDTO;
import com.epmet.dto.form.EmployeeRegisterListFormDTO;
@ -22,6 +25,7 @@ import com.epmet.service.IcEmployeeRegisterService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.RegExUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -84,6 +88,9 @@ public class IcEmployeeRegisterServiceImpl extends BaseServiceImpl<IcEmployeeReg
@Override
@Transactional(rollbackFor = Exception.class)
public void save(IcEmployeeRegisterDTO dto) {
if (!IdCardRegexUtils.validateIdCard(dto.getIdCard())) {
throw new EpmetException(EpmetErrorCode.ID_CARD_ERROR.getCode());
}
IcEmployeeRegisterDetailEntity detailEntity = ConvertUtils.sourceToTarget(dto, IcEmployeeRegisterDetailEntity.class);
// 先看看存在不
IcEmployeeRegisterEntity origin = baseDao.getEmployeeRegisterByIdCard(dto.getIdCard());

Loading…
Cancel
Save