Authored by qinchao

认证信息重新再查一下: 当天存在未通过的认证记录(且ocr通过)

... ... @@ -24,6 +24,9 @@ public interface IZhiMaCertDao {
ZhiMaCert selectValidByUid(int uid);
//最近的一条未授权的数据
ZhiMaCert selectLatestUnAuthorizeByUid(int uid);
ZhiMaCert selectValidByCertNo(String certNo);
//根据业务编号查询
... ...
... ... @@ -11,7 +11,7 @@ public class ZhiMaCert {
//uid ,索引
private Integer uid;
//生效状态:1 生效 ; 0 不生效
//生效状态:'9:未授权(初始值), 1:有效, 0:已失效(删除或者解绑)
private Integer validStatus;
//身份证图片已传:1 生效 ;2 生效,但是未实际ocr校验, 0 不生效
... ...
... ... @@ -33,6 +33,14 @@
order by id desc limit 1
</select>
<select id="selectLatestUnAuthorizeByUid" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from zhima_cert
where uid = #{uid} and valid_status = 9
order by id desc limit 1
</select>
<select id="selectValidByCertNo" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
... ...
... ... @@ -48,6 +48,7 @@ import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
... ... @@ -328,6 +329,42 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
if (zhiMaCert != null) {
//保存到redis
cacheService.setZhiMaCert(zhiMaCert);
}else{
//根据uid查询最近一条芝麻认证没通过的数据数据:
// 如果没有主动请求过&&ocr通过了 ,再根据biz_no获取支付宝结果 ,
// 最后打个标记,代表已经请求过一次,后续不再请求
// 暂时不打标志了 ,请求一次时间也不长 ,后续再观察下,看看时间情况
ZhiMaCert zhiMaCert_check_again = zhiMaCertDao.selectLatestUnAuthorizeByUid(uid);
String dayStr = getStringDate("yyyyMMdd");
Calendar c = Calendar.getInstance();
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
c.set(Calendar.MILLISECOND, 0);
Long today_zero=c.getTimeInMillis()/1000;
//当天至少请求过一次实名认证,并且是当天的数据
//Long count = cacheService.getPhotoCheckCount(dayStr,uid);
if(zhiMaCert_check_again!=null&&StringUtils.isNotBlank(zhiMaCert_check_again.getBizNo())
&&CertPhotoEnum.isValidStatus(zhiMaCert_check_again.getValidPhoto())
&&zhiMaCert_check_again.getCreateTime()>=today_zero
){
ZhimaCustomerCertificationQueryResponse zhiMaResp=ZhiMaCallUtil.zhiMaResult(zhiMaCert_check_again.getBizNo());
logger.error("getValidZhiMaCert recall zhiMaCertResultQuery result is null,biz no {}",zhiMaCert_check_again.getBizNo());
if(zhiMaResp!=null&&zhiMaResp.isSuccess()&&"true".equals(zhiMaResp.getPassed())){
//芝麻认证通过
int updateCount = zhiMaCertDao.updateValidStatusByPrimaryKey(zhiMaCert_check_again.getId());
logger.error("getValidZhiMaCert recall zhiMaCertResultQuery updateCount {} ,result is {},zhiMaCert_check_again {}",updateCount ,zhiMaResp,zhiMaCert_check_again);
if(updateCount>=1){
zhiMaCert = zhiMaCertDao.selectValidByUid(uid);
if (zhiMaCert != null) {
//保存到redis
cacheService.setZhiMaCert(zhiMaCert);
}
}
}
}
}
return zhiMaCert;
}
... ... @@ -545,7 +582,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
//存储认证信息
ZhiMaCert zhiMaCert = new ZhiMaCert();
zhiMaCert.setUid(reqVO.getUid());
zhiMaCert.setValidStatus(0);//用户还未授权,暂时未生效
zhiMaCert.setValidStatus(9);//用户还未授权,暂时未生效 ,初始值为9
zhiMaCert.setCertName(reqVO.getCertName());
zhiMaCert.setCertNo(reqVO.getCertNo());
zhiMaCert.setCreateTime(nowSecond);
... ...