Commit a9c05740 by guiq

bug: [none] 接口优化 checkIsHaveAuthWithServer

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