Commit 292fdad3 authored by hongguangwu's avatar hongguangwu

人员档案相关-身份证、手机号校验优化

parent 50391d15
......@@ -279,10 +279,9 @@ public class TEmployeeInfoController {
* @Date: 2022/6/23 17:40
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(summary = "档案复档temployeeinfo_restore", description = "档案复档 projectIds:项目档案ids")
@Operation(summary = "档案复档", description = "档案复档 projectIds:项目档案ids")
@SysLog("档案复档")
@GetMapping("/restoreEmployee")
@PreAuthorize("@pms.hasPermission('temployeeinfo_restore')")
public R<String> restoreEmployee(@RequestParam String id, String projectIds) {
return tEmployeeInfoService.restoreEmployee(id, projectIds);
}
......
......@@ -507,12 +507,20 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (list != null && !list.isEmpty()) {
return R.failed("该手机号已被使用!");
}
// 调用校验服务-校验手机号
R<Boolean> checkMobileR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckmobile/inner/checkOneMobile", employeeInfo.getEmpPhone(), Boolean.class, SecurityConstants.FROM_IN);
if (checkMobileR != null && checkMobileR.getData() != null) {
if (Boolean.FALSE.equals(checkMobileR.getData())) {
return R.failed("手机号校验错误!");
TCheckMobile checkMobile = new TCheckMobile();
checkMobile.setMobile(employeeInfo.getEmpPhone());
R<TCheckMobile> a = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckmobile/inner/checkOneMobile", checkMobile, TCheckMobile.class, SecurityConstants.FROM_IN);
if (a != null && a.getData() != null) {
checkMobile = a.getData();
if (checkMobile != null && Common.isNotNull(checkMobile.getStatus())) {
if (!CommonConstants.ONE_STRING.equals(checkMobile.getStatus())) {
return R.failed(checkMobile.getMessage());
}
} else {
return R.failed("校验服务错误,请联系管理员!");
}
}
}
......@@ -757,11 +765,19 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_PHONE_EXIST_ERROR, existEmp.getEmpIdcard()));
}
} else {
R<Boolean> checkMobileR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckmobile/inner/checkOneMobile", excel.getEmpPhone(), Boolean.class, SecurityConstants.FROM_IN);
if (checkMobileR != null && checkMobileR.getData() != null) {
if (Boolean.FALSE.equals(checkMobileR.getData())) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_PHONE_CHECK_ERROR, excel.getEmpIdcard()));
// 调用校验服务-校验手机号
TCheckMobile checkMobile = new TCheckMobile();
checkMobile.setMobile(excel.getEmpPhone());
R<TCheckMobile> a = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckmobile/inner/checkOneMobile", checkMobile, TCheckMobile.class, SecurityConstants.FROM_IN);
if (a != null && a.getData() != null) {
checkMobile = a.getData();
if (checkMobile != null && Common.isNotNull(checkMobile.getStatus())) {
if (!CommonConstants.ONE_STRING.equals(checkMobile.getStatus())) {
errorMsg.add(checkMobile.getMessage());
}
} else {
errorMsg.add("校验服务错误,请联系管理员!");
}
}
}
......@@ -1126,11 +1142,19 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_PHONE_EXIST_ERROR, existEmp.getEmpIdcard()));
}
} else {
R<Boolean> checkMobileR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckmobile/inner/checkOneMobile", excel.getEmpPhone(), Boolean.class, SecurityConstants.FROM_IN);
if (checkMobileR != null && checkMobileR.getData() != null) {
if (Boolean.FALSE.equals(checkMobileR.getData())) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_PHONE_CHECK_ERROR, excel.getEmpIdcard()));
// 调用校验服务-校验手机号
TCheckMobile checkMobile = new TCheckMobile();
checkMobile.setMobile(excel.getEmpPhone());
R<TCheckMobile> a = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckmobile/inner/checkOneMobile", checkMobile, TCheckMobile.class, SecurityConstants.FROM_IN);
if (a != null && a.getData() != null) {
checkMobile = a.getData();
if (checkMobile != null && Common.isNotNull(checkMobile.getStatus())) {
if (!CommonConstants.ONE_STRING.equals(checkMobile.getStatus())) {
errorMsg.add(checkMobile.getMessage());
}
} else {
errorMsg.add("校验服务错误,请联系管理员!");
}
}
}
......
......@@ -21,6 +21,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.check.entity.TCheckMobile;
import com.yifu.cloud.plus.v1.check.service.TCheckMobileService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
......@@ -133,8 +135,8 @@ public class TCheckMobileController {
@Operation(description = "检测手机号,多个手机号码用英文半角逗号隔开,仅支持国内号码")
@SysLog("检测手机号状态" )
@Inner
@GetMapping("/inner/checkMobiles" )
public R<Map<String,TCheckMobile>> checkMobilesInner(String mobiles) {
@PostMapping("/inner/checkMobiles" )
public R<Map<String,TCheckMobile>> checkMobilesInner(@RequestParam String mobiles) {
return tCheckMobileService.checkMobiles(mobiles);
}
......@@ -147,9 +149,15 @@ public class TCheckMobileController {
@Operation(description = "单个检测手机号,仅支持国内号码")
@SysLog("单个检测手机号状态" )
@Inner
@GetMapping("/inner/checkOneMobile" )
public boolean checkOneMobile(String mobile) {
return tCheckMobileService.checkOneMobile(mobile);
@PostMapping("/inner/checkOneMobile" )
public TCheckMobile checkOneMobile(@RequestBody TCheckMobile checkMobile) {
if (Common.isNotNull(checkMobile.getMobile())) {
return tCheckMobileService.checkOneMobile(checkMobile.getMobile());
} else {
checkMobile.setStatus(CommonConstants.ZERO_STRING);
checkMobile.setMessage("手机号必填");
return checkMobile;
}
}
}
......@@ -33,5 +33,5 @@ public interface TCheckMobileService extends IService<TCheckMobile> {
R<Map<String,TCheckMobile>> checkMobiles(String mobiles);
boolean checkOneMobile(String mobile);
TCheckMobile checkOneMobile(String mobile);
}
......@@ -250,7 +250,12 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
.eq(TCheckIdCard::getIsTrue,CommonConstants.ONE_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(checkIdCard)){
tCheckIdCard.setIsTrue(CommonConstants.ONE_INT);
if (name.equals(checkIdCard.getName())) {
tCheckIdCard.setIsTrue(CommonConstants.ONE_INT);
} else {
tCheckIdCard.setIsTrue(CommonConstants.ZERO_INT);
tCheckIdCard.setReason("【" + name + "】错误,正确的姓名:" + checkIdCard.getName());
}
return tCheckIdCard;
} else {
// 没找到正确的,再去找有没有错误的,如果还没有,再查
......@@ -270,7 +275,9 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
c.setName(name);
ChecksUtil.checkIdCard(c,canCheckService.getCanCheck());
baseMapper.insert(c);
return c;
tCheckIdCard.setIsTrue(c.getIsTrue());
tCheckIdCard.setReason(c.getReason());
return tCheckIdCard;
}
}
}
......
......@@ -113,7 +113,11 @@ public class TCheckMobileServiceImpl extends ServiceImpl<TCheckMobileMapper, TCh
}
@Override
public synchronized boolean checkOneMobile(String mobile) {
public synchronized TCheckMobile checkOneMobile(String mobile) {
TCheckMobile returnMobile = new TCheckMobile();
returnMobile.setMobile(mobile);
returnMobile.setMessage("未找到!");
returnMobile.setStatus(CommonConstants.ZERO_STRING);
if (Common.isNotNull(mobile)) {
//1.先从本地库获取正常数据
List<TCheckMobile> checkMobiles = baseMapper.selectList(Wrappers.<TCheckMobile>query().lambda()
......@@ -121,29 +125,34 @@ public class TCheckMobileServiceImpl extends ServiceImpl<TCheckMobileMapper, TCh
if (Common.isNotNull(checkMobiles)) {
for (TCheckMobile c : checkMobiles) {
if (CommonConstants.ONE_STRING.equals(c.getStatus())) {
return true;
returnMobile.setStatus(CommonConstants.ONE_STRING);
return returnMobile;
}
}
return false;
return returnMobile;
} else {
//2.从远处端获取数据
R<Map<String, TCheckMobile>> mobileMapR = ChecksUtil.checkMobile(mobile, canCheckService.getCanCheck());
if (Common.isEmpty(mobileMapR) || Common.isEmpty(mobileMapR.getData())) {
return false;
if (mobileMapR != null) {
returnMobile.setMessage(mobileMapR.getMsg());
}
return returnMobile;
}
Map<String, TCheckMobile> checkMobileMap = mobileMapR.getData();
if (Common.isNotNull(checkMobileMap) && checkMobileMap.get(mobile) != null) {
TCheckMobile checkMobile = checkMobileMap.get(mobile);
this.save(checkMobile);
if (checkMobile != null && CommonConstants.ONE_STRING.equals(checkMobile.getStatus())) {
return true;
returnMobile.setStatus(CommonConstants.ONE_STRING);
return returnMobile;
} else {
return false;
return returnMobile;
}
}
}
}
return false;
return returnMobile;
}
}
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