Commit a9c05740 by guiq

bug: [none] 接口优化 checkIsHaveAuthWithServer

parent 68860f17
......@@ -2,7 +2,6 @@ package com.pcloud.book.copyright.biz.impl;
import cn.hutool.core.collection.CollUtil;
import com.google.common.collect.Lists;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.live.LiveCons;
......@@ -32,10 +31,8 @@ import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.cookie.Cookie;
import com.pcloud.readercenter.wechat.entity.WechatUser;
import com.pcloud.resourcecenter.base.constants.ResourceRedisCons;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.slf4j.Logger;
......@@ -191,41 +188,24 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
@Override
public Boolean checkIsHaveAuthWithServer(String userInfo, Long serverId, String serverType) {
// 如果包含超级作者资源, 则直接返回
long t1 = System.currentTimeMillis();
if(checkIsSuperProduct(serverId)){
long t2 = System.currentTimeMillis();
System.out.println("第0阶段耗时=" + (t2 - t1));
if (checkIsSuperProduct(serverId)) {
return false;
}
long t2 = System.currentTimeMillis();
System.out.println("第1阶段耗时=" + (t2 - t1));
// 否则查询授权关系
Long bookId = qrcodeSceneConsr.getBookId4SceneId(Cookie.getId(userInfo,Cookie._SCENE_ID));
long t3 = System.currentTimeMillis();
System.out.println("第2阶段耗时=" + (t3 - t2));
Long bookId = qrcodeSceneConsr.getBookId4SceneId(Cookie.getId(userInfo, Cookie._SCENE_ID));
Long channelId = Cookie.getId(userInfo, Cookie._CHANNEL_ID);
Long adviserId = Cookie.getId(userInfo,Cookie._ADVISER_ID);
Long wecharUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
Long adviserId = Cookie.getId(userInfo, Cookie._ADVISER_ID);
Long wecharUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
if("live".equalsIgnoreCase(serverType)){
if ("live".equalsIgnoreCase(serverType)) {
List<Long> id = new ArrayList<>(1);
id.add(serverId);
Map<Long, Boolean> map = liveCons.checkIsSuperMerchant(id);
if(map != null && Boolean.TRUE.equals(map.get(serverId))){
if (map != null && Boolean.TRUE.equals(map.get(serverId))) {
return false;
}
else{
return checkIsHaveAuthWithServer(bookId,channelId,adviserId,wecharUserId,serverId);
}
}
else{
Boolean aBoolean = checkIsHaveAuthWithServer(bookId, channelId, adviserId, wecharUserId, serverId);
long t4 = System.currentTimeMillis();
System.out.println("第3阶段耗时=" + (t4 - t3));
return aBoolean;
}
return checkIsHaveAuthWithServer(bookId, channelId, adviserId, wecharUserId, serverId);
}
private Boolean checkIsHaveAuthWithServer(Long bookId, Long channelId, Long adviserId, Long wecharUserId, Long serverId) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment