Commit 292fdad3 authored by hongguangwu's avatar hongguangwu

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

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