Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
徐少华
midjourney-proxy
Commits
e91e2c56
Commit
e91e2c56
authored
Sep 19, 2019
by
刘正
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
判断用户对指定ServerId是否授权
parent
14343e0c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
2 deletions
+48
-2
BookAuthUserBiz.java
...n/java/com/pcloud/book/copyright/biz/BookAuthUserBiz.java
+5
-0
BookAuthUserBizImpl.java
...m/pcloud/book/copyright/biz/impl/BookAuthUserBizImpl.java
+29
-2
BookAuthUserFacade.java
.../com/pcloud/book/copyright/facade/BookAuthUserFacade.java
+6
-0
BookAuthUserFacadeImpl.java
...ud/book/copyright/facade/impl/BookAuthUserFacadeImpl.java
+8
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/copyright/biz/BookAuthUserBiz.java
View file @
e91e2c56
...
...
@@ -46,6 +46,11 @@ public interface BookAuthUserBiz {
Boolean
checkIsHaveAuth
(
Long
bookId
,
Long
channelId
,
Long
adviserId
,
Long
wechatUserId
,
Integer
authBookType
);
/**
* 校验用户针对指定的服务是否被授权
*/
Boolean
checkIsHaveAuthWithServer
(
String
userInfo
,
Long
serverId
);
/**
* 获取授权信息总的统计数据
*/
BookAuthCodeUserVO
getAuthUserTotalCount
(
List
<
Long
>
adviserIds
,
List
<
Long
>
removeAdviserIds
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/copyright/biz/impl/BookAuthUserBizImpl.java
View file @
e91e2c56
package
com
.
pcloud
.
book
.
copyright
.
biz
.
impl
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.copyright.biz.BookAuthUserBiz
;
import
com.pcloud.book.copyright.dao.BookAuthServeDao
;
import
com.pcloud.book.copyright.dao.BookAuthUserDao
;
import
com.pcloud.book.copyright.dao.BookClickBuyRecordDao
;
import
com.pcloud.book.copyright.dto.CheckUserAuthDTO
;
import
com.pcloud.book.copyright.dto.DateDTO
;
import
com.pcloud.book.copyright.dto.ServeDTO
;
import
com.pcloud.book.copyright.entity.BookAuthUser
;
import
com.pcloud.book.copyright.entity.BookClickBuyRecord
;
import
com.pcloud.book.copyright.enums.AuthBookTypeEnum
;
...
...
@@ -19,6 +22,8 @@ import com.pcloud.book.util.common.ThreadPoolUtils;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
...
...
@@ -27,12 +32,11 @@ import org.springframework.stereotype.Component;
import
org.springframework.transaction.annotation.Transactional
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
/**
* @author lily
...
...
@@ -45,6 +49,10 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
private
BookAuthUserDao
bookAuthUserDao
;
@Autowired
private
BookClickBuyRecordDao
bookClickBuyRecordDao
;
@Autowired
private
QrcodeSceneConsr
qrcodeSceneConsr
;
@Autowired
private
BookAuthServeDao
bookAuthServeDao
;
@ParamLog
(
value
=
"获取授权用户数量"
)
...
...
@@ -156,6 +164,25 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
}
@Override
public
Boolean
checkIsHaveAuthWithServer
(
String
userInfo
,
Long
serverId
)
{
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
);
// 书类型指定为is_paper_book
Boolean
isUserAuth
=
checkIsHaveAuth
(
bookId
,
channelId
,
adviserId
,
wecharUserId
,
0
);
if
(
isUserAuth
){
List
<
Long
>
serverIds
=
new
ArrayList
<>();
serverIds
.
add
(
serverId
);
List
<
ServeDTO
>
serveDTOS
=
bookAuthServeDao
.
isSetServeAuth
(
bookId
,
channelId
,
adviserId
,
serverIds
);
// 用户被授权, 且指定的应用也被版权保护时, 返回true
return
!
ListUtils
.
isEmpty
(
serveDTOS
);
}
// 其余情况都是false
return
false
;
}
@Override
public
BookAuthCodeUserVO
getAuthUserTotalCount
(
List
<
Long
>
adviserIds
,
List
<
Long
>
removeAdviserIds
)
{
BookAuthCodeUserVO
bookAuthCodeUserVO
=
bookAuthUserDao
.
getAuthUserTotalCount
(
adviserIds
,
removeAdviserIds
);
if
(
bookAuthCodeUserVO
!=
null
){
...
...
pcloud-service-book/src/main/java/com/pcloud/book/copyright/facade/BookAuthUserFacade.java
View file @
e91e2c56
...
...
@@ -11,6 +11,7 @@ import com.pcloud.common.exceptions.BizException;
import
com.pcloud.common.permission.PermissionException
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
...
...
@@ -66,4 +67,9 @@ public interface BookAuthUserFacade {
@ApiOperation
(
"校验用户是否授权过"
)
ResponseDto
<?>
checkIsHaveAuth
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
CheckUserParam
checkUserParam
)
throws
BizException
;
@GetMapping
(
"checkIsHaveAuthWithServer"
)
@ApiOperation
(
"校验用户针对指定的服务是否被授权"
)
ResponseDto
<?>
checkIsHaveAuthWithServer
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"serveId"
)
Long
serveId
)
throws
BizException
;
}
pcloud-service-book/src/main/java/com/pcloud/book/copyright/facade/impl/BookAuthUserFacadeImpl.java
View file @
e91e2c56
package
com
.
pcloud
.
book
.
copyright
.
facade
.
impl
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.copyright.biz.BookAuthUserBiz
;
import
com.pcloud.book.copyright.facade.BookAuthUserFacade
;
import
com.pcloud.book.copyright.vo.BookAuthCodeUserVO
;
...
...
@@ -16,6 +17,7 @@ import com.pcloud.common.utils.cookie.Cookie;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
...
...
@@ -96,4 +98,10 @@ public class BookAuthUserFacadeImpl implements BookAuthUserFacade {
Boolean
result
=
bookAuthUserBiz
.
checkIsHaveAuth
(
bookId
,
channelId
,
adviserId
,
wechatUserId
,
1
);
return
new
ResponseDto
<>(
result
);
}
@Override
@GetMapping
(
"checkIsHaveAuthWithServer"
)
public
ResponseDto
<?>
checkIsHaveAuthWithServer
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"serveId"
)
Long
serveId
)
throws
BizException
{
return
new
ResponseDto
<>(
bookAuthUserBiz
.
checkIsHaveAuthWithServer
(
userInfo
,
serveId
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment