Commit e1420540 by 刘正

添加对超级作者的查询

parent 9a3c005a
...@@ -4,7 +4,9 @@ import com.google.common.collect.Lists; ...@@ -4,7 +4,9 @@ import com.google.common.collect.Lists;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException; import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil; import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.liveapp.live.dto.CourseListDto; import com.pcloud.liveapp.live.dto.CourseListDto;
import com.pcloud.liveapp.live.service.LiveCourseService; import com.pcloud.liveapp.live.service.LiveCourseService;
...@@ -13,6 +15,7 @@ import org.springframework.http.ResponseEntity; ...@@ -13,6 +15,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -38,4 +41,21 @@ public class LiveCons { ...@@ -38,4 +41,21 @@ public class LiveCons {
return Lists.newArrayList(); return Lists.newArrayList();
} }
@ParamLog("调用liveApp获取超级作者应用情况")
public Map<Long, Boolean> checkIsSuperMerchant(List<Long> serverIds) {
if (ListUtils.isEmpty(serverIds)) {
return null;
}
try {
return ResponseHandleUtil.parseMap(liveCourseService.checkIsSuperMerchant(serverIds), Long.class, Boolean.class);
} catch (BizException e) {
throw new BizException(e.getCode(), e.getMessage());
} catch (Exception e) {
log.error("调用liveApp获取超级作者应用情况失败[labelService.getLabelName]:" + e.getMessage(), e);
return null;
}
}
} }
...@@ -48,7 +48,7 @@ public interface BookAuthUserBiz { ...@@ -48,7 +48,7 @@ public interface BookAuthUserBiz {
/** /**
* 校验用户针对指定的服务是否被授权 * 校验用户针对指定的服务是否被授权
*/ */
Boolean checkIsHaveAuthWithServer(String userInfo, Long serverId); Boolean checkIsHaveAuthWithServer(String userInfo, Long serverId, String serverType);
/** /**
* 获取授权信息总的统计数据 * 获取授权信息总的统计数据
......
...@@ -2,6 +2,7 @@ package com.pcloud.book.copyright.biz.impl; ...@@ -2,6 +2,7 @@ package com.pcloud.book.copyright.biz.impl;
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.copyright.biz.BookAuthUserBiz; import com.pcloud.book.copyright.biz.BookAuthUserBiz;
import com.pcloud.book.copyright.dao.BookAuthServeDao; import com.pcloud.book.copyright.dao.BookAuthServeDao;
import com.pcloud.book.copyright.dao.BookAuthUserDao; import com.pcloud.book.copyright.dao.BookAuthUserDao;
...@@ -53,7 +54,8 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz { ...@@ -53,7 +54,8 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
private QrcodeSceneConsr qrcodeSceneConsr; private QrcodeSceneConsr qrcodeSceneConsr;
@Autowired @Autowired
private BookAuthServeDao bookAuthServeDao; private BookAuthServeDao bookAuthServeDao;
@Autowired
private LiveCons liveCons;
@ParamLog(value = "获取授权用户数量") @ParamLog(value = "获取授权用户数量")
@Override @Override
...@@ -164,11 +166,29 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz { ...@@ -164,11 +166,29 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
} }
@Override @Override
public Boolean checkIsHaveAuthWithServer(String userInfo, Long serverId) { public Boolean checkIsHaveAuthWithServer(String userInfo, Long serverId, String serverType) {
Long bookId = qrcodeSceneConsr.getBookId4SceneId(Cookie.getId(userInfo,Cookie._SCENE_ID)); Long bookId = qrcodeSceneConsr.getBookId4SceneId(Cookie.getId(userInfo,Cookie._SCENE_ID));
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)){
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))){
return false;
}
else{
return checkIsHaveAuthWithServer(bookId,channelId,adviserId,wecharUserId,serverId);
}
}
else{
return checkIsHaveAuthWithServer(bookId,channelId,adviserId,wecharUserId,serverId);
}
}
private Boolean checkIsHaveAuthWithServer(Long bookId, Long channelId, Long adviserId, Long wecharUserId, Long serverId) {
// 书类型指定为is_paper_book // 书类型指定为is_paper_book
Boolean isUserAuth = checkIsHaveAuth(bookId,channelId,adviserId,wecharUserId,0); Boolean isUserAuth = checkIsHaveAuth(bookId,channelId,adviserId,wecharUserId,0);
if(isUserAuth){ if(isUserAuth){
......
...@@ -70,6 +70,6 @@ public interface BookAuthUserFacade { ...@@ -70,6 +70,6 @@ public interface BookAuthUserFacade {
@GetMapping("checkIsHaveAuthWithServer") @GetMapping("checkIsHaveAuthWithServer")
@ApiOperation("校验用户针对指定的服务是否被授权") @ApiOperation("校验用户针对指定的服务是否被授权")
ResponseDto<?> checkIsHaveAuthWithServer(@CookieValue("userInfo") String userInfo, @RequestParam("serveId") Long serveId) ResponseDto<?> checkIsHaveAuthWithServer(@CookieValue("userInfo") String userInfo, @RequestParam("serveId") Long serveId, @RequestParam(value = "serverType",required = false) String serverType)
throws BizException; throws BizException;
} }
...@@ -101,7 +101,7 @@ public class BookAuthUserFacadeImpl implements BookAuthUserFacade { ...@@ -101,7 +101,7 @@ public class BookAuthUserFacadeImpl implements BookAuthUserFacade {
@Override @Override
@GetMapping("checkIsHaveAuthWithServer") @GetMapping("checkIsHaveAuthWithServer")
public ResponseDto<?> checkIsHaveAuthWithServer(@CookieValue("userInfo") String userInfo, @RequestParam("serveId") Long serveId) throws BizException { public ResponseDto<?> checkIsHaveAuthWithServer(@CookieValue("userInfo") String userInfo, @RequestParam("serveId") Long serveId, @RequestParam(value = "serverType",required = false) String serverType) throws BizException {
return new ResponseDto<>(bookAuthUserBiz.checkIsHaveAuthWithServer(userInfo,serveId)); return new ResponseDto<>(bookAuthUserBiz.checkIsHaveAuthWithServer(userInfo,serveId,serverType));
} }
} }
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