feat: 资质申请监控
parent
8ca75b8634
commit
23f22b6052
|
|
@ -22,6 +22,7 @@ public enum ErrorCode {
|
||||||
// ---- 人员信息 ----
|
// ---- 人员信息 ----
|
||||||
ORG_PERSONNEL_NOT_FOUND("01-05-001", "人员信息不存在"),
|
ORG_PERSONNEL_NOT_FOUND("01-05-001", "人员信息不存在"),
|
||||||
ORG_PERSONNEL_ACCOUNT_EXISTS("01-05-002", "账号已存在"),
|
ORG_PERSONNEL_ACCOUNT_EXISTS("01-05-002", "账号已存在"),
|
||||||
|
ORG_PERSONNEL_IDCARDNO_EXISTS("01-05-003", "身份证已存在"),
|
||||||
|
|
||||||
// ---- 人员证书 ----
|
// ---- 人员证书 ----
|
||||||
ORG_PERSONNEL_CERT_NOT_FOUND("01-06-001", "人员证书不存在"),
|
ORG_PERSONNEL_CERT_NOT_FOUND("01-06-001", "人员证书不存在"),
|
||||||
|
|
|
||||||
|
|
@ -28,4 +28,6 @@ public interface OrgPersonnelGateway {
|
||||||
void delete(Long id);
|
void delete(Long id);
|
||||||
|
|
||||||
PageResult<OrgPersonnelEntity> page(OrgPersonnelQuery query);
|
PageResult<OrgPersonnelEntity> page(OrgPersonnelQuery query);
|
||||||
|
|
||||||
|
OrgPersonnelEntity findAnyByIdCardNo(String idCardNo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,14 @@ public class OrgPersonnelDomainService {
|
||||||
entity.setId(existing.getId());
|
entity.setId(existing.getId());
|
||||||
return orgPersonnelGateway.restore(entity);
|
return orgPersonnelGateway.restore(entity);
|
||||||
}
|
}
|
||||||
|
OrgPersonnelEntity existingIdCardNo = orgPersonnelGateway.findAnyByIdCardNo(entity.getIdCardNo());
|
||||||
|
if (existingIdCardNo != null) {
|
||||||
|
if (!isSoftDeleted(existingIdCardNo)) {
|
||||||
|
throw new BizException(ErrorCode.ORG_PERSONNEL_IDCARDNO_EXISTS);
|
||||||
|
}
|
||||||
|
entity.setId(existingIdCardNo.getId());
|
||||||
|
return orgPersonnelGateway.restore(entity);
|
||||||
|
}
|
||||||
return orgPersonnelGateway.save(entity);
|
return orgPersonnelGateway.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,11 +51,23 @@ public class OrgPersonnelDomainService {
|
||||||
throw new BizException(ErrorCode.ORG_PERSONNEL_NOT_FOUND);
|
throw new BizException(ErrorCode.ORG_PERSONNEL_NOT_FOUND);
|
||||||
}
|
}
|
||||||
assertAccountUnique(entity.getAccount(), entity.getId());
|
assertAccountUnique(entity.getAccount(), entity.getId());
|
||||||
|
assertIdcarNoUnique(entity.getIdCardNo(), entity.getId());
|
||||||
mergeForModify(existing, entity);
|
mergeForModify(existing, entity);
|
||||||
existing.setJoinWorkDate(entity.getJoinWorkDate());
|
existing.setJoinWorkDate(entity.getJoinWorkDate());
|
||||||
return orgPersonnelGateway.modify(existing);
|
return orgPersonnelGateway.modify(existing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void assertIdcarNoUnique(String idCardNo, Long excludeId) {
|
||||||
|
if (!StringUtils.hasText(idCardNo)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OrgPersonnelEntity found = orgPersonnelGateway.findAnyByIdCardNo(idCardNo);
|
||||||
|
if (found != null && !isSoftDeleted(found)
|
||||||
|
&& (excludeId == null || !found.getId().equals(excludeId))) {
|
||||||
|
throw new BizException(ErrorCode.ORG_PERSONNEL_IDCARDNO_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void mergeForModify(OrgPersonnelEntity target, OrgPersonnelEntity patch) {
|
private void mergeForModify(OrgPersonnelEntity target, OrgPersonnelEntity patch) {
|
||||||
if (StringUtils.hasText(patch.getUserName())) {
|
if (StringUtils.hasText(patch.getUserName())) {
|
||||||
target.setUserName(patch.getUserName());
|
target.setUserName(patch.getUserName());
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ public class OrgPersonnelGatewayImpl implements OrgPersonnelGateway {
|
||||||
wrapper.in(OrgPersonnelDO::getId, query.getPersonnelIds());
|
wrapper.in(OrgPersonnelDO::getId, query.getPersonnelIds());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
wrapper.orderByDesc(OrgPersonnelDO::getId);
|
||||||
Page<OrgPersonnelDO> page = new Page<>(query.getPageNum(), query.getPageSize());
|
Page<OrgPersonnelDO> page = new Page<>(query.getPageNum(), query.getPageSize());
|
||||||
IPage<OrgPersonnelDO> result = orgPersonnelMapper.selectPage(page, wrapper);
|
IPage<OrgPersonnelDO> result = orgPersonnelMapper.selectPage(page, wrapper);
|
||||||
|
|
||||||
|
|
@ -164,6 +164,15 @@ public class OrgPersonnelGatewayImpl implements OrgPersonnelGateway {
|
||||||
return PageResult.of(entities, result.getTotal(), result.getCurrent(), result.getSize());
|
return PageResult.of(entities, result.getTotal(), result.getCurrent(), result.getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrgPersonnelEntity findAnyByIdCardNo(String idCardNo) {
|
||||||
|
OrgPersonnelDO orgPersonnelDO = orgPersonnelMapper.selectOne(new LambdaQueryWrapper<OrgPersonnelDO>().eq(OrgPersonnelDO::getIdCardNo, idCardNo));
|
||||||
|
if (orgPersonnelDO != null) {
|
||||||
|
return toEntity(orgPersonnelDO);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private OrgPersonnelDO toDO(OrgPersonnelEntity entity) {
|
private OrgPersonnelDO toDO(OrgPersonnelEntity entity) {
|
||||||
OrgPersonnelDO dataObject = new OrgPersonnelDO();
|
OrgPersonnelDO dataObject = new OrgPersonnelDO();
|
||||||
dataObject.setOrgId(orgContextResolver.resolveOrgId(entity.getOrgId()));
|
dataObject.setOrgId(orgContextResolver.resolveOrgId(entity.getOrgId()));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue