Authored by Lixiaodi

支付宝绑定

package com.yohoufo.user.controller.passport;
import com.alibaba.fastjson.JSON;
import com.yoho.core.config.ConfigReader;
import com.yoho.tools.common.beans.ApiResponse;
import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
import com.yohoufo.common.exception.GatewayException;
import com.yohoufo.common.exception.VersionNotSupportException;
import com.yohoufo.common.utils.UserInfoHiddenHelper;
import com.yohoufo.dal.user.model.UserAuthorizeInfo;
import com.yohoufo.dal.user.model.ZhiMaCert;
import com.yohoufo.user.common.IDCardUtils;
import com.yohoufo.user.helper.HideDataUtil;
... ... @@ -125,6 +127,46 @@ public class RealNameAuthorizeController {
}
}
@RequestMapping(params = "method=ufo.user.getUserAliPayAccountInfo")
public ApiResponse getUserAliPayAccountInfo(RealNameAuthorizeReqVO reqVO) throws GatewayException {
logger.info("enter getUserAliPayAccountInfo reqVO is {}", reqVO);
//(1) 优先校验请求的参数
if (reqVO == null || reqVO.getUid() <= 0) {
throw new GatewayException(402, "uid为空");
}
UserAuthorizeInfo info;
//检查是否已经实名认证,如果已经认证直接返回
if ((info = realNameAuthorizeService.getValidAuthorizeInfo(reqVO.getUid())) == null) {
throw new GatewayException(601, "无绑定信息");
} else {
return new ApiResponse(200, "查询成功", info);
}
}
@RequestMapping(params = "method=ufo.user.directBindAliPayAccountInfo")
public ApiResponse directBindAliPayAccountInfo(RealNameAuthorizeReqVO reqVO) throws GatewayException {
logger.info("enter directBindAliPayAccountInfo reqVO is {}", reqVO);
//(1) 优先校验请求的参数
if (reqVO == null || reqVO.getUid() <= 0) {
throw new GatewayException(402, "uid为空");
}
if (StringUtils.isBlank(reqVO.getAlipayAccount())) {
throw new GatewayException(402, "alipayAccount为空");
}
if (StringUtils.isBlank(reqVO.getCertName())) {
throw new GatewayException(402, "certName");
}
try {
realNameAuthorizeService.directBindUserAlipayAccountInfo(reqVO);
return new ApiResponse(200, "绑定成功");
} catch (Exception e) {
logger.error("directBindAliPayAccountInfo err reqVO is " + JSON.toJSONString(reqVO), e);
return new ApiResponse(500, "绑定失败:" + e.getMessage());
}
}
/***************************************************************************************
* 芝麻认证 (实名认证用)
**************************************************************************************/
... ...
... ... @@ -36,4 +36,6 @@ public interface IRealNameAuthorizeService {
void autoBindAliPayAccount(RealNameAuthorizeReqVO reqVO) throws GatewayException;
void directBindUserAlipayAccountInfo(RealNameAuthorizeReqVO reqVO);
}
... ...
... ... @@ -133,6 +133,13 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
return num;
}
public void directBindUserAlipayAccountInfo(RealNameAuthorizeReqVO reqVO) {
int uid = reqVO.getUid();
if (getValidAuthorizeInfo(uid) != null) {
userAuthorizeInfoDao.updateToUnValidStatusByUid(uid, DateUtil.getCurrentTimeSecond());
}
saveAuthorizeInfo(reqVO);
}
public void saveAuthorizeInfo(RealNameAuthorizeReqVO reqVO){
... ...