Authored by qinchao

解绑支付宝接口 for platform

@@ -7,6 +7,9 @@ public interface IUserAuthorizeInfoDao { @@ -7,6 +7,9 @@ public interface IUserAuthorizeInfoDao {
7 //获取生效的认证信息 7 //获取生效的认证信息
8 UserAuthorizeInfo selectValidAuthorizeInfoByUid(int uid); 8 UserAuthorizeInfo selectValidAuthorizeInfoByUid(int uid);
9 9
  10 + //失效信息
  11 + int updateToUnValidStatusByUid(int uid);
  12 +
10 int insert(UserAuthorizeInfo userAuthorizeInfo); 13 int insert(UserAuthorizeInfo userAuthorizeInfo);
11 14
12 int insertSelective(UserAuthorizeInfo userAuthorizeInfo); 15 int insertSelective(UserAuthorizeInfo userAuthorizeInfo);
@@ -25,6 +25,12 @@ @@ -25,6 +25,12 @@
25 order by id desc limit 1 25 order by id desc limit 1
26 </select> 26 </select>
27 27
  28 + <update id="updateToUnValidStatusByUid" parameterType="java.lang.Integer">
  29 + update authorize_info
  30 + set valid_status = 0
  31 + where uid = #{uid,jdbcType=INTEGER}
  32 + </update>
  33 +
28 <insert id="insert" parameterType="com.yohoufo.dal.user.model.UserAuthorizeInfo" > 34 <insert id="insert" parameterType="com.yohoufo.dal.user.model.UserAuthorizeInfo" >
29 insert into authorize_info (uid, valid_status, alipay_account, cert_name, create_time, update_time) 35 insert into authorize_info (uid, valid_status, alipay_account, cert_name, create_time, update_time)
30 values (#{uid},#{validStatus}, 36 values (#{uid},#{validStatus},
@@ -186,6 +186,10 @@ public class CacheService { @@ -186,6 +186,10 @@ public class CacheService {
186 set(getAuthorizeInfoRedisKeyBuilder(authorizeInfo.getUid()),authorizeInfo,CacheKeyEnum.AUTHORIZE_INFO_KEY.getDefaultExpireTime(),CacheKeyEnum.AUTHORIZE_INFO_KEY.getTimeUnit()); 186 set(getAuthorizeInfoRedisKeyBuilder(authorizeInfo.getUid()),authorizeInfo,CacheKeyEnum.AUTHORIZE_INFO_KEY.getDefaultExpireTime(),CacheKeyEnum.AUTHORIZE_INFO_KEY.getTimeUnit());
187 } 187 }
188 188
  189 + public void delUserAuthorizeInfo(Integer uid){
  190 + yhRedisTemplate.delete(getAuthorizeInfoRedisKeyBuilder(uid));
  191 + }
  192 +
189 193
190 /************************************************************************** 194 /**************************************************************************
191 * 芝麻认证相关 195 * 芝麻认证相关
@@ -50,4 +50,23 @@ public class RealNameAuthorize4PlatformController { @@ -50,4 +50,23 @@ public class RealNameAuthorize4PlatformController {
50 return new ApiResponse.ApiResponseBuilder().code(200) 50 return new ApiResponse.ApiResponseBuilder().code(200)
51 .data(info).message("").build(); 51 .data(info).message("").build();
52 } 52 }
  53 +
  54 + /**
  55 + * 解绑支付宝信息
  56 + * 提供给运营平台使用
  57 + * @return
  58 + */
  59 + @RequestMapping(value="/clearAliPayAccount")
  60 + @IgnoreSession
  61 + @IgnoreSignature
  62 + public ApiResponse clearAliPayAccount(@RequestBody AuthorizeInfoReq req) {
  63 + logger.info("enter RealNameAuthorize4PlatformController clearAliPayAccount authorize info param req is {}", req);
  64 + //获取
  65 + int num = 0;
  66 + if(req.getUid()!=null){
  67 + num = realNameAuthorizeService.clearAuthorizeInfo(req.getUid());
  68 + }
  69 + return new ApiResponse.ApiResponseBuilder().code(200)
  70 + .data(num).message("").build();
  71 + }
53 } 72 }
@@ -15,6 +15,8 @@ public interface IRealNameAuthorizeService { @@ -15,6 +15,8 @@ public interface IRealNameAuthorizeService {
15 15
16 UserAuthorizeInfo getValidAuthorizeInfo(int uid); 16 UserAuthorizeInfo getValidAuthorizeInfo(int uid);
17 17
  18 + int clearAuthorizeInfo(int uid);
  19 +
18 void saveAuthorizeInfo(RealNameAuthorizeReqVO reqVO); 20 void saveAuthorizeInfo(RealNameAuthorizeReqVO reqVO);
19 21
20 boolean isValidZhiMaCert(int uid); 22 boolean isValidZhiMaCert(int uid);
@@ -118,6 +118,16 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { @@ -118,6 +118,16 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
118 return authorizeInfo; 118 return authorizeInfo;
119 } 119 }
120 120
  121 + // 清除绑定的支付宝信息
  122 + public int clearAuthorizeInfo(int uid){
  123 + logger.info("RealNameAuthorizeServiceImpl clearAuthorizeInfo uid is {} ",uid);
  124 + int num = userAuthorizeInfoDao.updateToUnValidStatusByUid(uid);
  125 + logger.info("RealNameAuthorizeServiceImpl clearAuthorizeInfo uid is {} ,num {}",uid,num);
  126 + //清缓存
  127 + cacheService.delUserAuthorizeInfo(uid);
  128 + return num;
  129 + }
  130 +
121 131
122 132
123 public void saveAuthorizeInfo(RealNameAuthorizeReqVO reqVO){ 133 public void saveAuthorizeInfo(RealNameAuthorizeReqVO reqVO){
@@ -290,13 +300,6 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { @@ -290,13 +300,6 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
290 logger.info("RealNameAuthorizeServiceImpl clearCacheZhiMaCertInfo uid is {} ", uid); 300 logger.info("RealNameAuthorizeServiceImpl clearCacheZhiMaCertInfo uid is {} ", uid);
291 int result = 0; 301 int result = 0;
292 if (uid!=null && uid > 0 ){ 302 if (uid!=null && uid > 0 ){
293 - /*List<ZhiMaCert> zhiMaCerts = zhiMaCertDao.selectByUid(uid);  
294 - try {  
295 - zhiMaCerts.stream().forEach(item -> zhiMaCertDao.insertbak(item));  
296 - } catch (Exception e) {  
297 - logger.info("zhiMaCertDao.insertbak find error zhiMaCerts is : " + zhiMaCerts, e);  
298 - }*/  
299 -  
300 result = zhiMaCertDao.deleteByUid(uid); 303 result = zhiMaCertDao.deleteByUid(uid);
301 logger.info("RealNameAuthorizeServiceImpl clearCacheZhiMaCertInfo delete uid{} ,delete result is {}", uid, result); 304 logger.info("RealNameAuthorizeServiceImpl clearCacheZhiMaCertInfo delete uid{} ,delete result is {}", uid, result);
302 305