|
@@ -1,5 +1,6 @@
|
|
package com.ruoyi.web.controller.idcard;
|
|
package com.ruoyi.web.controller.idcard;
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
import com.ruoyi.common.annotation.Log;
|
|
import com.ruoyi.common.annotation.Log;
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
@@ -81,19 +82,23 @@ public class SysUserIdcardController extends BaseController {
|
|
@Log(title = "用户身份证信息", businessType = BusinessType.INSERT)
|
|
@Log(title = "用户身份证信息", businessType = BusinessType.INSERT)
|
|
@PostMapping
|
|
@PostMapping
|
|
public AjaxResult add(@RequestBody SysUserIdcard sysUserIdcard) {
|
|
public AjaxResult add(@RequestBody SysUserIdcard sysUserIdcard) {
|
|
- LoginUser loginUser = getLoginUser();
|
|
|
|
- SysUser currentUser = loginUser.getUser();
|
|
|
|
- currentUser.setInitFace("Y");
|
|
|
|
- userService.checkUserAllowed(currentUser);
|
|
|
|
- userService.checkUserDataScope(currentUser.getUserId());
|
|
|
|
- currentUser.setUpdateBy(getUsername());
|
|
|
|
- if (userService.updateUserStatus(currentUser) > 0) {
|
|
|
|
|
|
+ String idCard = sysUserIdcard.getIdCard();
|
|
|
|
+ //先去查询是否已经被认证过
|
|
|
|
+ if (ObjectUtil.isNull(sysUserIdcardService.selectSysUserIdcardByIdCard(idCard))) {
|
|
|
|
+ LoginUser loginUser = getLoginUser();
|
|
|
|
+ SysUser currentUser = loginUser.getUser();
|
|
currentUser.setInitFace("Y");
|
|
currentUser.setInitFace("Y");
|
|
- // 更新缓存用户信息
|
|
|
|
- tokenService.setLoginUser(loginUser);
|
|
|
|
- return toAjax(sysUserIdcardService.insertSysUserIdcard(sysUserIdcard));
|
|
|
|
|
|
+ userService.checkUserAllowed(currentUser);
|
|
|
|
+ userService.checkUserDataScope(currentUser.getUserId());
|
|
|
|
+ currentUser.setUpdateBy(getUsername());
|
|
|
|
+ if (userService.updateUserStatus(currentUser) > 0) {
|
|
|
|
+ currentUser.setInitFace("Y");
|
|
|
|
+ // 更新缓存用户信息
|
|
|
|
+ tokenService.setLoginUser(loginUser);
|
|
|
|
+ return toAjax(sysUserIdcardService.insertSysUserIdcard(sysUserIdcard));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- return error("人脸认证更新失败");
|
|
|
|
|
|
+ return error("人脸认证失败,当前已被其他用户认证。");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -113,21 +118,24 @@ public class SysUserIdcardController extends BaseController {
|
|
sysUserIdcard.setAddress(sysUserIdcardVo.getAddress());
|
|
sysUserIdcard.setAddress(sysUserIdcardVo.getAddress());
|
|
sysUserIdcard.setFront(sysUserIdcardVo.getFront());
|
|
sysUserIdcard.setFront(sysUserIdcardVo.getFront());
|
|
sysUserIdcard.setBack(sysUserIdcardVo.getBack());
|
|
sysUserIdcard.setBack(sysUserIdcardVo.getBack());
|
|
- LoginUser loginUser = getLoginUser();
|
|
|
|
- SysUser currentUser = loginUser.getUser();
|
|
|
|
- currentUser.setInitFace("Y");
|
|
|
|
- userService.checkUserAllowed(currentUser);
|
|
|
|
- userService.checkUserDataScope(currentUser.getUserId());
|
|
|
|
- currentUser.setUpdateBy(getUsername());
|
|
|
|
- if (userService.updateUserStatus(currentUser) > 0) {
|
|
|
|
|
|
+ //先去查询是否已经被认证过
|
|
|
|
+ if (ObjectUtil.isNull(sysUserIdcardService.selectSysUserIdcardByIdCard(sysUserIdcardVo.getIdCard()))) {
|
|
|
|
+ LoginUser loginUser = getLoginUser();
|
|
|
|
+ SysUser currentUser = loginUser.getUser();
|
|
currentUser.setInitFace("Y");
|
|
currentUser.setInitFace("Y");
|
|
- // 更新缓存用户信息
|
|
|
|
- tokenService.setLoginUser(loginUser);
|
|
|
|
- //删除redis
|
|
|
|
- redisCache.deleteObject(certifyId);
|
|
|
|
- return toAjax(sysUserIdcardService.insertSysUserIdcard(sysUserIdcard));
|
|
|
|
|
|
+ userService.checkUserAllowed(currentUser);
|
|
|
|
+ userService.checkUserDataScope(currentUser.getUserId());
|
|
|
|
+ currentUser.setUpdateBy(getUsername());
|
|
|
|
+ if (userService.updateUserStatus(currentUser) > 0) {
|
|
|
|
+ currentUser.setInitFace("Y");
|
|
|
|
+ // 更新缓存用户信息
|
|
|
|
+ tokenService.setLoginUser(loginUser);
|
|
|
|
+ //删除redis
|
|
|
|
+ redisCache.deleteObject(certifyId);
|
|
|
|
+ return toAjax(sysUserIdcardService.insertSysUserIdcard(sysUserIdcard));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- return error("人脸认证更新失败");
|
|
|
|
|
|
+ return error("人脸认证失败,当前已被其他用户认证。");
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|