Authored by qinchao

解绑支付宝接口 for platform

... ... @@ -7,6 +7,9 @@ public interface IUserAuthorizeInfoDao {
//获取生效的认证信息
UserAuthorizeInfo selectValidAuthorizeInfoByUid(int uid);
//失效信息
int updateToUnValidStatusByUid(int uid);
int insert(UserAuthorizeInfo userAuthorizeInfo);
int insertSelective(UserAuthorizeInfo userAuthorizeInfo);
... ...
... ... @@ -25,6 +25,12 @@
order by id desc limit 1
</select>
<update id="updateToUnValidStatusByUid" parameterType="java.lang.Integer">
update authorize_info
set valid_status = 0
where uid = #{uid,jdbcType=INTEGER}
</update>
<insert id="insert" parameterType="com.yohoufo.dal.user.model.UserAuthorizeInfo" >
insert into authorize_info (uid, valid_status, alipay_account, cert_name, create_time, update_time)
values (#{uid},#{validStatus},
... ...
... ... @@ -186,6 +186,10 @@ public class CacheService {
set(getAuthorizeInfoRedisKeyBuilder(authorizeInfo.getUid()),authorizeInfo,CacheKeyEnum.AUTHORIZE_INFO_KEY.getDefaultExpireTime(),CacheKeyEnum.AUTHORIZE_INFO_KEY.getTimeUnit());
}
public void delUserAuthorizeInfo(Integer uid){
yhRedisTemplate.delete(getAuthorizeInfoRedisKeyBuilder(uid));
}
/**************************************************************************
* 芝麻认证相关
... ...
... ... @@ -50,4 +50,23 @@ public class RealNameAuthorize4PlatformController {
return new ApiResponse.ApiResponseBuilder().code(200)
.data(info).message("").build();
}
/**
* 解绑支付宝信息
* 提供给运营平台使用
* @return
*/
@RequestMapping(value="/clearAliPayAccount")
@IgnoreSession
@IgnoreSignature
public ApiResponse clearAliPayAccount(@RequestBody AuthorizeInfoReq req) {
logger.info("enter RealNameAuthorize4PlatformController clearAliPayAccount authorize info param req is {}", req);
//获取
int num = 0;
if(req.getUid()!=null){
num = realNameAuthorizeService.clearAuthorizeInfo(req.getUid());
}
return new ApiResponse.ApiResponseBuilder().code(200)
.data(num).message("").build();
}
}
... ...
... ... @@ -15,6 +15,8 @@ public interface IRealNameAuthorizeService {
UserAuthorizeInfo getValidAuthorizeInfo(int uid);
int clearAuthorizeInfo(int uid);
void saveAuthorizeInfo(RealNameAuthorizeReqVO reqVO);
boolean isValidZhiMaCert(int uid);
... ...
... ... @@ -118,6 +118,16 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
return authorizeInfo;
}
// 清除绑定的支付宝信息
public int clearAuthorizeInfo(int uid){
logger.info("RealNameAuthorizeServiceImpl clearAuthorizeInfo uid is {} ",uid);
int num = userAuthorizeInfoDao.updateToUnValidStatusByUid(uid);
logger.info("RealNameAuthorizeServiceImpl clearAuthorizeInfo uid is {} ,num {}",uid,num);
//清缓存
cacheService.delUserAuthorizeInfo(uid);
return num;
}
public void saveAuthorizeInfo(RealNameAuthorizeReqVO reqVO){
... ... @@ -290,13 +300,6 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
logger.info("RealNameAuthorizeServiceImpl clearCacheZhiMaCertInfo uid is {} ", uid);
int result = 0;
if (uid!=null && uid > 0 ){
/*List<ZhiMaCert> zhiMaCerts = zhiMaCertDao.selectByUid(uid);
try {
zhiMaCerts.stream().forEach(item -> zhiMaCertDao.insertbak(item));
} catch (Exception e) {
logger.info("zhiMaCertDao.insertbak find error zhiMaCerts is : " + zhiMaCerts, e);
}*/
result = zhiMaCertDao.deleteByUid(uid);
logger.info("RealNameAuthorizeServiceImpl clearCacheZhiMaCertInfo delete uid{} ,delete result is {}", uid, result);
... ...