|
|
@ -1,17 +1,22 @@ |
|
|
|
package com.huoran.users.controller; |
|
|
|
package com.huoran.users.controller; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
import com.google.gson.Gson; |
|
|
|
import com.google.gson.Gson; |
|
|
|
import com.huoran.common.response.R; |
|
|
|
import com.huoran.common.response.R; |
|
|
|
import com.huoran.common.utils.TokenUtils; |
|
|
|
import com.huoran.common.utils.TokenUtils; |
|
|
|
import com.huoran.users.config.AliRealNameAuthenticationConfig; |
|
|
|
import com.huoran.users.config.AliRealNameAuthenticationConfig; |
|
|
|
import com.huoran.users.entity.EnterpriseCertification; |
|
|
|
import com.huoran.users.entity.EnterpriseCertification; |
|
|
|
|
|
|
|
import com.huoran.users.entity.HrUserAccount; |
|
|
|
|
|
|
|
import com.huoran.users.entity.HrUserInfo; |
|
|
|
import com.huoran.users.entity.UserAuthenticationInformation; |
|
|
|
import com.huoran.users.entity.UserAuthenticationInformation; |
|
|
|
import com.huoran.users.entity.res.BusinessLicenseOCRResp; |
|
|
|
import com.huoran.users.entity.res.BusinessLicenseOCRResp; |
|
|
|
import com.huoran.users.entity.res.CreditCodeResp; |
|
|
|
import com.huoran.users.entity.res.CreditCodeResp; |
|
|
|
import com.huoran.users.entity.res.IdCardOCRResp; |
|
|
|
import com.huoran.users.entity.res.IdCardOCRResp; |
|
|
|
import com.huoran.users.entity.res.RealNameAuthenticationResp; |
|
|
|
import com.huoran.users.entity.res.RealNameAuthenticationResp; |
|
|
|
import com.huoran.users.service.EnterpriseCertificationService; |
|
|
|
import com.huoran.users.service.EnterpriseCertificationService; |
|
|
|
|
|
|
|
import com.huoran.users.service.IHrUserAccountService; |
|
|
|
|
|
|
|
import com.huoran.users.service.IHrUserInfoService; |
|
|
|
import com.huoran.users.service.UserAuthenticationInformationService; |
|
|
|
import com.huoran.users.service.UserAuthenticationInformationService; |
|
|
|
import com.huoran.users.utils.ali.FaceRecognitionAidUtil; |
|
|
|
import com.huoran.users.utils.ali.FaceRecognitionAidUtil; |
|
|
|
import com.huoran.users.utils.ali.HttpUtils; |
|
|
|
import com.huoran.users.utils.ali.HttpUtils; |
|
|
@ -40,7 +45,11 @@ public class AliRealNameAuthenticationController { |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
public UserAuthenticationInformationService service; |
|
|
|
public UserAuthenticationInformationService service; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
public IHrUserAccountService userAccountService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
public IHrUserInfoService userInfoService; |
|
|
|
//企业认证信息存储
|
|
|
|
//企业认证信息存储
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
public EnterpriseCertificationService enterpriseCertificationService; |
|
|
|
public EnterpriseCertificationService enterpriseCertificationService; |
|
|
@ -95,12 +104,39 @@ public class AliRealNameAuthenticationController { |
|
|
|
throw new RuntimeException(info.getRespMessage()); |
|
|
|
throw new RuntimeException(info.getRespMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<UserAuthenticationInformation> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapper.eq("open_id", userAuthenticationInformation.getOpenId()); |
|
|
|
|
|
|
|
UserAuthenticationInformation information = service.getOne(queryWrapper); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!ObjectUtils.isEmpty(information)) { |
|
|
|
|
|
|
|
//为二次认证,删除上一次的认证信息
|
|
|
|
|
|
|
|
service.removeById(information.getId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//设置用户当前认证时间
|
|
|
|
//设置用户当前认证时间
|
|
|
|
userAuthenticationInformation.setRealNameAuthenticationTime(new Date()); |
|
|
|
userAuthenticationInformation.setRealNameAuthenticationTime(new Date()); |
|
|
|
userAuthenticationInformation.setProvince(info.getProvince()); |
|
|
|
userAuthenticationInformation.setProvince(info.getProvince()); |
|
|
|
userAuthenticationInformation.setCity(info.getCity()); |
|
|
|
userAuthenticationInformation.setCity(info.getCity()); |
|
|
|
userAuthenticationInformation.setCounty(info.getCounty()); |
|
|
|
userAuthenticationInformation.setCounty(info.getCounty()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<HrUserAccount> accountQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
|
|
accountQueryWrapper.eq("app_open_id", userAuthenticationInformation.getOpenId()); |
|
|
|
|
|
|
|
accountQueryWrapper.eq("platform_id", 7); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HrUserAccount userAccount = userAccountService.getOne(accountQueryWrapper); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
userAccount.setAccount(userAuthenticationInformation.getRealName()); |
|
|
|
|
|
|
|
userAccountService.updateById(userAccount); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UpdateWrapper<HrUserInfo> userInfoUpdateWrapper = new UpdateWrapper<>(); |
|
|
|
|
|
|
|
userInfoUpdateWrapper.set("user_name", userAuthenticationInformation.getRealName()); |
|
|
|
|
|
|
|
userInfoUpdateWrapper.eq("user_id", userAccount.getUserId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
userInfoService.update(new HrUserInfo(), userInfoUpdateWrapper); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean addState = service.save(userAuthenticationInformation); |
|
|
|
boolean addState = service.save(userAuthenticationInformation); |
|
|
|
return addState ? R.ok() : R.error("认证失败"); |
|
|
|
return addState ? R.ok() : R.error("认证失败"); |
|
|
|
} |
|
|
|
} |
|
|
|