Commit b71568c2 authored by hongguangwu's avatar hongguangwu

人员档案相关-调用服务优化吧。。

parent 2fd7a1aa
......@@ -112,7 +112,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
, "/tcheckidcard/inner/checkIdCardSingle", checkIdCard, TCheckIdCard.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) {
TCheckIdCard check = checkListR.getData();
if (check == null || Common.isEmpty(check.getId())) {
if (check == null || Common.isEmpty(check.getIsTrue())) {
return R.failed("校验服务器未返回,请联系管理员!!");
} else if (check.getIsTrue() == CommonConstants.ZERO_INT) {
return R.failed(check.getReason());
......@@ -741,7 +741,9 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
, "/tcheckidcard/inner/checkIdCardSingle", checkIdCard, TCheckIdCard.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) {
TCheckIdCard check = checkListR.getData();
if (check.getIsTrue() == CommonConstants.ZERO_INT) {
if (check == null || Common.isEmpty(check.getIsTrue())) {
errorMsg.add("校验服务器未返回,请联系管理员!!");
} else if (check.getIsTrue() == CommonConstants.ZERO_INT) {
errorMsg.add(check.getReason());
}
}
......
......@@ -159,7 +159,7 @@ public class TCheckIdCardController {
@SysLog("校验姓名身份证 --- 单个")
@Inner
@PostMapping("/inner/checkIdCardSingle")
public R<TCheckIdCard> checkIdCardSingle(@RequestBody TCheckIdCard tCheckIdCard) {
public TCheckIdCard checkIdCardSingle(@RequestBody TCheckIdCard tCheckIdCard) {
return tCheckIdCardService.checkIdCardSingle(tCheckIdCard);
}
}
......@@ -45,5 +45,5 @@ public interface TCheckIdCardService extends IService<TCheckIdCard> {
**/
R<List<TCheckIdCard>> checkIdCard(List<TCheckIdCard> checkList);
R<TCheckIdCard> checkIdCardSingle(TCheckIdCard tCheckIdCard);
TCheckIdCard checkIdCardSingle(TCheckIdCard tCheckIdCard);
}
......@@ -226,11 +226,23 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
}
@Override
public R<TCheckIdCard> checkIdCardSingle(TCheckIdCard tCheckIdCard) {
public TCheckIdCard checkIdCardSingle(TCheckIdCard tCheckIdCard) {
String idCard = tCheckIdCard.getIdCard();
String name = tCheckIdCard.getName();
if (Common.isEmpty(idCard) || Common.isEmpty(name)){
return R.failed(CommonConstants.PARAM_IS_NOT_EMPTY);
tCheckIdCard.setIsTrue(CommonConstants.ZERO_INT);
tCheckIdCard.setReason(CommonConstants.PARAM_IS_NOT_EMPTY);
return tCheckIdCard;
}
// 校验姓名身份证规则
if (!regIdCard(idCard)) {
tCheckIdCard.setIsTrue(0);
tCheckIdCard.setReason("身份证格式有误");
return tCheckIdCard;
} else if (regEmpName(name)) {
tCheckIdCard.setIsTrue(0);
tCheckIdCard.setReason("姓名含数字或空格,无法校验");
return tCheckIdCard;
}
synchronized (this){
TCheckIdCard checkIdCard = baseMapper.selectOne(Wrappers.<TCheckIdCard>query().lambda()
......@@ -238,7 +250,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
.eq(TCheckIdCard::getIsTrue,CommonConstants.ONE_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(checkIdCard)){
return R.ok(checkIdCard);
return checkIdCard;
} else {
// 没找到正确的,再去找有没有错误的,如果还没有,再查
List<TCheckIdCard> checkList = baseMapper.selectList(Wrappers.<TCheckIdCard>query().lambda()
......@@ -246,7 +258,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
if (checkList != null && !checkList.isEmpty()) {
for (TCheckIdCard c : checkList) {
if (idCard.equals(c.getIdCard()) && name.equals(c.getName())) {
return R.ok(c);
return c;
}
}
}
......@@ -255,7 +267,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
c.setName(name);
ChecksUtil.checkIdCard(c,canCheckService.getCanCheck());
baseMapper.insert(c);
return R.ok(c);
return c;
}
}
}
......
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