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
5b4a7cb3
Commit
5b4a7cb3
authored
Mar 11, 2021
by
郑勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: [1004401] ERP关联RAYS书刊信息展示、配置资源跳转交互优化
parent
4b4fb3f4
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
345 additions
and
18 deletions
+345
-18
BookDto.java
...-book/src/main/java/com/pcloud/book/book/dto/BookDto.java
+13
-0
QrcodeStatisticsDTO.java
...in/java/com/pcloud/book/book/dto/QrcodeStatisticsDTO.java
+20
-0
BookAdviserBiz.java
...rc/main/java/com/pcloud/book/book/biz/BookAdviserBiz.java
+1
-1
BookAdviserBizImpl.java
...ava/com/pcloud/book/book/biz/impl/BookAdviserBizImpl.java
+163
-16
BookBizImpl.java
.../main/java/com/pcloud/book/book/biz/impl/BookBizImpl.java
+5
-0
BookAdviserFacadeImpl.java
...m/pcloud/book/book/facade/impl/BookAdviserFacadeImpl.java
+2
-1
QrCodeVO.java
...-book/src/main/java/com/pcloud/book/book/vo/QrCodeVO.java
+9
-0
ChannelConsr.java
...main/java/com/pcloud/book/consumer/user/ChannelConsr.java
+15
-0
BookGroupDao.java
...src/main/java/com/pcloud/book/group/dao/BookGroupDao.java
+2
-0
BookGroupServeDao.java
...ain/java/com/pcloud/book/group/dao/BookGroupServeDao.java
+15
-0
BookGroupDaoImpl.java
...java/com/pcloud/book/group/dao/impl/BookGroupDaoImpl.java
+9
-0
BookGroupServeDaoImpl.java
...com/pcloud/book/group/dao/impl/BookGroupServeDaoImpl.java
+43
-0
Book.Mapper.xml
...rvice-book/src/main/resources/mapper/book/Book.Mapper.xml
+1
-0
BookGroupMapper.xml
...-book/src/main/resources/mapper/group/BookGroupMapper.xml
+10
-0
BookGroupServe.xml
...e-book/src/main/resources/mapper/group/BookGroupServe.xml
+37
-0
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/book/dto/BookDto.java
View file @
5b4a7cb3
...
...
@@ -786,6 +786,19 @@ public class BookDto extends BaseDto {
*/
private
Integer
isSendMiniUrl
;
/**
*是否小睿教育书
*/
private
Boolean
xiaoRuiEducation
;
public
Boolean
getXiaoRuiEducation
()
{
return
xiaoRuiEducation
;
}
public
void
setXiaoRuiEducation
(
Boolean
xiaoRuiEducation
)
{
this
.
xiaoRuiEducation
=
xiaoRuiEducation
;
}
public
Integer
getIsSendMiniUrl
()
{
return
isSendMiniUrl
;
}
...
...
pcloud-facade-book/src/main/java/com/pcloud/book/book/dto/QrcodeStatisticsDTO.java
View file @
5b4a7cb3
...
...
@@ -15,4 +15,24 @@ public class QrcodeStatisticsDTO {
private
Long
browserCounts
;
/**
* 二维码类型
*/
private
String
codeType
;
/**
* 二维码下面资源数量
*/
private
Integer
serveCount
;
/**
* 二维码下面企业微信数量和资源数量总和
*/
private
Integer
totalCount
;
/**
* 是否小睿教育书
*/
private
Boolean
xiaoRuiEducation
;
}
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/BookAdviserBiz.java
View file @
5b4a7cb3
...
...
@@ -245,7 +245,7 @@ public interface BookAdviserBiz {
*/
BookAdviserDto
getOneMainBook
(
Long
bookId
);
PageBeanNew
<
QrCodeVO
>
getQrList
(
Long
bookId
,
Long
adviserId
,
Long
channelId
,
Integer
currentPage
,
Integer
numPerPage
);
PageBeanNew
<
QrCodeVO
>
getQrList
(
Long
bookId
,
Long
adviserId
,
Long
channelId
,
Integer
type
,
Integer
currentPage
,
Integer
numPerPage
);
/**
* 获取书下资源总数(包括现代纸书、1V1、小睿、社群码)
...
...
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/impl/BookAdviserBizImpl.java
View file @
5b4a7cb3
...
...
@@ -69,6 +69,7 @@ import com.pcloud.book.es.biz.ESBookAndAdviserBiz;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.dao.BookAppletSceneDao
;
import
com.pcloud.book.group.dao.BookGroupDao
;
import
com.pcloud.book.group.dao.BookGroupServeDao
;
import
com.pcloud.book.group.dto.BookAppletSceneDTO
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.BookGroupServeCountDTO
;
...
...
@@ -230,6 +231,8 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
private
LabelConsr
labelConsr
;
@Autowired
private
BookLabelBiz
bookLabelBiz
;
@Autowired
private
BookGroupServeDao
bookGroupServeDao
;
@Override
public
List
<
BookDto
>
listByAdviserId
(
Long
adviserId
)
{
...
...
@@ -1083,13 +1086,66 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
@Override
@ParamLog
(
"获取某本书关联的二维码"
)
public
PageBeanNew
<
QrCodeVO
>
getQrList
(
Long
bookId
,
Long
adviserId
,
Long
channelId
,
Integer
currentPage
,
Integer
numPerPage
)
{
public
PageBeanNew
<
QrCodeVO
>
getQrList
(
Long
bookId
,
Long
adviserId
,
Long
channelId
,
Integer
type
,
Integer
currentPage
,
Integer
numPerPage
)
{
if
(
null
==
bookId
||
null
==
adviserId
||
null
==
channelId
||
null
==
currentPage
||
null
==
numPerPage
){
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"参数为空"
);
}
//type 代表的是过滤二维码。如果是0,展示所有的二维码。如果是1(展示没有资源的码。但是要过滤小睿教育的书的非公众号二维码)
List
<
Long
>
xiaoRuiEducation
=
channelConsr
.
isXiaoRuiEducation
(
Lists
.
newArrayList
(
bookId
));
//BookAdviserDto bookAdviserDto = bookAdviserDao.getBase(bookId, channelId, adviserId);
//现在一本书下面可以配多个跳小睿的码
List
<
BookGroupDTO
>
bookGroupDTOList
=
bookGroupDao
.
getDTOByBookIdList
(
bookId
,
channelId
,
adviserId
);
//群二维码
List
<
Long
>
groupQrcodeList
=
CollUtil
.
isEmpty
(
bookGroupDTOList
)
?
new
ArrayList
<>()
:
bookGroupDTOList
.
stream
().
filter
(
a
->
null
!=
a
.
getJoinGroupType
()
&&
JoinGroupTypeEnum
.
GROUP_QRCODE
.
getCode
().
equals
(
a
.
getJoinGroupType
())).
map
(
a
->
a
.
getId
()).
distinct
().
collect
(
Collectors
.
toList
());
//客服机器人
List
<
Long
>
robotList
=
CollUtil
.
isEmpty
(
bookGroupDTOList
)
?
new
ArrayList
<>()
:
bookGroupDTOList
.
stream
().
filter
(
a
->
null
!=
a
.
getJoinGroupType
()
&&
JoinGroupTypeEnum
.
ROBOT
.
getCode
().
equals
(
a
.
getJoinGroupType
())).
map
(
a
->
a
.
getId
()).
distinct
().
collect
(
Collectors
.
toList
());
//(**不包括群二维码)小睿二维码下资源数量
List
<
Long
>
xiaoruiList
=
CollUtil
.
isEmpty
(
bookGroupDTOList
)
?
new
ArrayList
<>()
:
bookGroupDTOList
.
stream
().
filter
(
a
->
null
!=
a
.
getJoinGroupType
()
&&
!
JoinGroupTypeEnum
.
GROUP_QRCODE
.
getCode
().
equals
(
a
.
getJoinGroupType
())).
map
(
a
->
a
.
getId
()).
distinct
().
collect
(
Collectors
.
toList
());
//分开查3种类型的资源数量
//群二维码下资源数量
Map
<
Long
,
BookGroupServeCountDTO
>
groupQrCodeMap
=
CollUtil
.
isEmpty
(
groupQrcodeList
)
?
new
HashMap
<>()
:
bookGroupServeDao
.
mapGroupQrcodeServeCount
(
groupQrcodeList
);
//客服机器人码下资源数量
Map
<
Long
,
BookGroupServeCountDTO
>
robotMap
=
CollUtil
.
isEmpty
(
robotList
)
?
new
HashMap
<>()
:
bookGroupServeDao
.
mapGroupQrcodeServeCount
(
robotList
);
//(**不包括群二维码)小睿二维码下资源数量
Map
<
Long
,
BookGroupServeCountDTO
>
xiaoruiMap
=
CollUtil
.
isEmpty
(
xiaoruiList
)
?
new
HashMap
<>()
:
bookGroupServeDao
.
mapXiaoRuiGroupQrcodeServeCount
(
xiaoruiList
);
List
<
QrCodeVO
>
qrCodeVOS
=
new
ArrayList
<>();
BookGroupDTO
bookGroupDTO
=
bookGroupDao
.
getDTOByBookId
(
bookId
,
channelId
,
adviserId
);
QrCodeVO
qrCodeVO
;
for
(
BookGroupDTO
bookGroupDTO
:
bookGroupDTOList
)
{
qrCodeVO
=
new
QrCodeVO
();
qrCodeVO
.
setQrCodeName
(
bookGroupDTO
.
getGroupQrcodeName
());
qrCodeVO
.
setQrCodeUrl
(
bookGroupDTO
.
getGroupQrcodeUrl
());
qrCodeVO
.
setServeCount
(
0
);
qrCodeVO
.
setRightsCount
(
0
);
qrCodeVO
.
setSceneId
(
bookGroupDTO
.
getId
());
qrCodeVO
.
setJoinGroupType
(
bookGroupDTO
.
getJoinGroupType
());
if
(
JoinGroupTypeEnum
.
GROUP_QRCODE
.
getCode
().
equals
(
bookGroupDTO
.
getJoinGroupType
())){
if
(
CollUtil
.
isNotEmpty
(
groupQrCodeMap
)
&&
groupQrCodeMap
.
containsKey
(
bookGroupDTO
.
getId
())){
BookGroupServeCountDTO
bookGroupServeCountDTO
=
groupQrCodeMap
.
get
(
bookGroupDTO
.
getId
());
qrCodeVO
.
setServeCount
(
bookGroupServeCountDTO
.
getServeCount
());
}
}
else
{
if
(
CollUtil
.
isNotEmpty
(
xiaoruiMap
)
&&
xiaoruiMap
.
containsKey
(
bookGroupDTO
.
getId
())){
BookGroupServeCountDTO
bookGroupServeCountDTO
=
xiaoruiMap
.
get
(
bookGroupDTO
.
getId
());
qrCodeVO
.
setServeCount
(
bookGroupServeCountDTO
.
getServeCount
());
}
if
(
JoinGroupTypeEnum
.
ROBOT
.
getCode
().
equals
(
bookGroupDTO
.
getJoinGroupType
())){
if
(
CollUtil
.
isNotEmpty
(
robotMap
)
&&
robotMap
.
containsKey
(
bookGroupDTO
.
getId
())){
BookGroupServeCountDTO
bookGroupServeCountDTO
=
robotMap
.
get
(
bookGroupDTO
.
getId
());
if
(
null
!=
bookGroupServeCountDTO
&&
null
!=
bookGroupServeCountDTO
.
getServeCount
())
{
qrCodeVO
.
setServeCount
((
null
==
qrCodeVO
.
getServeCount
()
?
0
:
qrCodeVO
.
getServeCount
())
+
bookGroupServeCountDTO
.
getServeCount
());
}
}
}
}
qrCodeVO
.
setCodeType
(
"group"
);
qrCodeVO
.
setXiaoRuiEducation
(
false
);
if
(
CollUtil
.
isNotEmpty
(
xiaoRuiEducation
)
&&
xiaoRuiEducation
.
contains
(
bookId
)){
qrCodeVO
.
setXiaoRuiEducation
(
true
);
}
qrCodeVOS
.
add
(
qrCodeVO
);
}
/*BookGroupDTO bookGroupDTO = bookGroupDao.getDTOByBookId(bookId, channelId, adviserId);
if (null != bookGroupDTO) {
Map<String, BookGroupServeCountDTO> mapBookGroupServeCount;
Map<String, BookGroupServeCountDTO> mapBookGroupRobotServeCount = null;
...
...
@@ -1130,20 +1186,32 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
BookGroupServeCountDTO bookGroupServeCountDTO = mapBookGroupRobotServeCount.get("" + bookId + "_" + channelId + "_" + adviserId);
qrCodeVO.setServeCount(qrCodeVO.getServeCount() + bookGroupServeCountDTO.getServeCount());
}
qrCodeVO.setCodeType("group");
qrCodeVO.setXiaoRuiEducation(false);
if(CollUtil.isNotEmpty(xiaoRuiEducation) && xiaoRuiEducation.contains(bookId)){
qrCodeVO.setXiaoRuiEducation(true);
}
qrCodeVOS.add(qrCodeVO);
}
}
*/
List
<
QrcodeSceneDto
>
qrcodeSceneDtos
=
qrcodeSceneConsr
.
getQrCodeList
(
bookId
,
adviserId
,
channelId
);
if
(!
ListUtils
.
isEmpty
(
qrcodeSceneDtos
))
{
List
<
Long
>
sceneIds
=
qrcodeSceneDtos
.
stream
().
map
(
x
->
x
.
getSceneId
()).
collect
(
Collectors
.
toList
());
// 企业微信群资源数
Map
<
Long
,
BookGroupServeCountDTO
>
bookQrcodeWxworkMap
=
bookQrcodeWxworkBiz
.
mapWxWorkServeCount4SceneIds
(
sceneIds
,
BookQrcodeType
.
OFFICIAL_ACCOUNTS
.
getCode
());
for
(
QrcodeSceneDto
e
:
qrcodeSceneDtos
)
{
QrCodeVO
qrCodeVO
=
new
QrCodeVO
();
qrCodeVO
.
setQrCodeName
(
e
.
getSceneName
());
qrCodeVO
.
setQrCodeUrl
(
e
.
getQrcodeUrl
());
QrCodeVO
qrCodeVO
1
=
new
QrCodeVO
();
qrCodeVO
1
.
setQrCodeName
(
e
.
getSceneName
());
qrCodeVO
1
.
setQrCodeUrl
(
e
.
getQrcodeUrl
());
BookGroupServeCountDTO
serveCountDTO
=
bookQrcodeWxworkMap
.
get
(
e
.
getSceneId
());
qrCodeVO
.
setServeCount
((
ListUtils
.
isEmpty
(
e
.
getMessages
())
?
0
:
e
.
getMessages
().
size
())
+
(
serveCountDTO
==
null
?
0
:
serveCountDTO
.
getServeCount
()));
qrCodeVOS
.
add
(
qrCodeVO
);
qrCodeVO1
.
setServeCount
((
ListUtils
.
isEmpty
(
e
.
getMessages
())
?
0
:
e
.
getMessages
().
size
())
+
((
serveCountDTO
==
null
||
null
==
serveCountDTO
.
getServeCount
())
?
0
:
serveCountDTO
.
getServeCount
()));
//设置二维码类型和书刊是否是小睿教育的书
qrCodeVO1
.
setCodeType
(
e
.
getQrcodeType
());
qrCodeVO1
.
setXiaoRuiEducation
(
false
);
if
(
CollUtil
.
isNotEmpty
(
xiaoRuiEducation
)
&&
xiaoRuiEducation
.
contains
(
bookId
)){
qrCodeVO1
.
setXiaoRuiEducation
(
true
);
}
qrCodeVO1
.
setSceneId
(
e
.
getSceneId
());
qrCodeVOS
.
add
(
qrCodeVO1
);
}
}
if
(
ListUtils
.
isEmpty
(
qrCodeVOS
)){
...
...
@@ -1151,9 +1219,20 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
}
List
<
QrCodeVO
>
record
=
new
ArrayList
<>();
if
(
qrCodeVOS
.
size
()
>
(
currentPage
+
1
)
*
numPerPage
){
record
=
qrCodeVOS
.
subList
(
currentPage
*
numPerPage
,(
currentPage
+
1
)
*
numPerPage
);
//type 代表的是过滤二维码。如果是0,展示所有的二维码。如果是1(展示没有资源的码。但是要过滤小睿教育的书的非公众号二维码)
if
(
null
!=
type
&&
1
==
type
){
qrCodeVOS
=
qrCodeVOS
.
stream
().
filter
(
a
->
(
null
==
a
.
getServeCount
()
||
0
==
a
.
getServeCount
())
&&
!(
null
!=
a
.
getXiaoRuiEducation
()
&&
a
.
getXiaoRuiEducation
()
&&
!
"wechat"
.
equalsIgnoreCase
(
a
.
getCodeType
()))).
collect
(
Collectors
.
toList
());
record
=
qrCodeVOS
.
subList
(
currentPage
*
numPerPage
,(
currentPage
+
1
)
*
numPerPage
);
}
else
{
record
=
qrCodeVOS
.
subList
(
currentPage
*
numPerPage
,(
currentPage
+
1
)
*
numPerPage
);
}
}
else
{
record
=
qrCodeVOS
.
subList
(
currentPage
*
numPerPage
,
qrCodeVOS
.
size
());
if
(
null
!=
type
&&
1
==
type
){
qrCodeVOS
=
qrCodeVOS
.
stream
().
filter
(
a
->
(
null
==
a
.
getServeCount
()
||
0
==
a
.
getServeCount
())
&&
!(
null
!=
a
.
getXiaoRuiEducation
()
&&
a
.
getXiaoRuiEducation
()
&&
!
"wechat"
.
equalsIgnoreCase
(
a
.
getCodeType
()))).
collect
(
Collectors
.
toList
());
record
=
qrCodeVOS
.
subList
(
currentPage
*
numPerPage
,
qrCodeVOS
.
size
());
}
else
{
record
=
qrCodeVOS
.
subList
(
currentPage
*
numPerPage
,
qrCodeVOS
.
size
());
}
}
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
qrCodeVOS
.
size
(),
record
);
}
...
...
@@ -1436,15 +1515,31 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
public
Map
<
String
,
BookQrcodeStatisticsDTO
>
mapBookQrcodeStatistics
(
List
<
Long
>
adviserIds
,
List
<
Long
>
bookIds
,
List
<
Long
>
channelIds
)
{
Map
<
String
,
BookQrcodeStatisticsDTO
>
resultMap
=
new
HashMap
<>();
BookQrcodeStatisticsDTO
bookQrcodeStatisticsDTO
;
//是否小睿教育的书
List
<
Long
>
xiaoRuiEducation
=
CollUtil
.
isEmpty
(
bookIds
)
?
new
ArrayList
<>()
:
channelConsr
.
isXiaoRuiEducation
(
bookIds
);
// 社群书统计
List
<
BookGroupDTO
>
bookGroupList
=
bookGroupDao
.
getDTOByBookIdsAdviserIdsChannelIds
(
bookIds
,
adviserIds
,
channelIds
);
//计算每个二维码下面的资源数量
//群二维码
List
<
Long
>
groupQrcodeList
=
CollUtil
.
isEmpty
(
bookGroupList
)
?
new
ArrayList
<>()
:
bookGroupList
.
stream
().
filter
(
a
->
null
!=
a
.
getJoinGroupType
()
&&
JoinGroupTypeEnum
.
GROUP_QRCODE
.
getCode
().
equals
(
a
.
getJoinGroupType
())).
map
(
a
->
a
.
getId
()).
distinct
().
collect
(
Collectors
.
toList
());
//客服机器人
List
<
Long
>
robotList
=
CollUtil
.
isEmpty
(
bookGroupList
)
?
new
ArrayList
<>()
:
bookGroupList
.
stream
().
filter
(
a
->
null
!=
a
.
getJoinGroupType
()
&&
JoinGroupTypeEnum
.
ROBOT
.
getCode
().
equals
(
a
.
getJoinGroupType
())).
map
(
a
->
a
.
getId
()).
distinct
().
collect
(
Collectors
.
toList
());
//(**不包括群二维码)小睿二维码下资源数量
List
<
Long
>
xiaoruiList
=
CollUtil
.
isEmpty
(
bookGroupList
)
?
new
ArrayList
<>()
:
bookGroupList
.
stream
().
filter
(
a
->
null
!=
a
.
getJoinGroupType
()
&&
!
JoinGroupTypeEnum
.
GROUP_QRCODE
.
getCode
().
equals
(
a
.
getJoinGroupType
())).
map
(
a
->
a
.
getId
()).
distinct
().
collect
(
Collectors
.
toList
());
//分开查3种类型的资源数量
//群二维码下资源数量
Map
<
Long
,
BookGroupServeCountDTO
>
groupQrCodeMap
=
CollUtil
.
isEmpty
(
groupQrcodeList
)
?
new
HashMap
<>()
:
bookGroupServeDao
.
mapGroupQrcodeServeCount
(
groupQrcodeList
);
//客服机器人码下资源数量
Map
<
Long
,
BookGroupServeCountDTO
>
robotMap
=
CollUtil
.
isEmpty
(
robotList
)
?
new
HashMap
<>()
:
bookGroupServeDao
.
mapGroupQrcodeServeCount
(
robotList
);
//(**不包括群二维码)小睿二维码下资源数量
Map
<
Long
,
BookGroupServeCountDTO
>
xiaoruiMap
=
CollUtil
.
isEmpty
(
xiaoruiList
)
?
new
HashMap
<>()
:
bookGroupServeDao
.
mapXiaoRuiGroupQrcodeServeCount
(
xiaoruiList
);
if
(!
CollectionUtils
.
isEmpty
(
bookGroupList
)){
List
<
Long
>
bookGroupIds
=
bookGroupList
.
stream
().
map
(
x
->
x
.
getId
()).
collect
(
Collectors
.
toList
());
Map
<
Long
,
GroupUserCountDTO
>
scanCountByGroup
=
wechatGroupConsr
.
getScanCountByGroup
(
bookGroupIds
,
null
);
for
(
BookGroupDTO
bookGroupDTO
:
bookGroupList
)
{
GroupUserCountDTO
groupUserCountDTO
=
scanCountByGroup
.
get
(
bookGroupDTO
.
getId
());
String
bookAdviserId
=
bookGroupDTO
.
getBookId
()
+
"_"
+
bookGroupDTO
.
getChannelId
()
+
"_"
+
bookGroupDTO
.
getCreateUser
();
bookQrcodeStatisticsDTO
=
new
BookQrcodeStatisticsDTO
();
bookQrcodeStatisticsDTO
.
setBookChannelAdviserId
(
bookGroupDTO
.
getBookId
()+
"_"
+
bookGroupDTO
.
getChannelId
()+
"_"
+
bookGroupDTO
.
getCreateUser
());
bookQrcodeStatisticsDTO
.
setAdviserId
(
bookGroupDTO
.
getCreateUser
());
...
...
@@ -1457,12 +1552,47 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
qrcodeStatisticsDTO
.
setQrcodeUrl
(
bookGroupDTO
.
getGroupQrcodeUrl
());
qrcodeStatisticsDTO
.
setCounts
(
0L
);
qrcodeStatisticsDTO
.
setBrowserCounts
(
0L
);
qrcodeStatisticsDTO
.
setServeCount
(
0
);
qrcodeStatisticsDTO
.
setCodeType
(
"group"
);
qrcodeStatisticsDTO
.
setXiaoRuiEducation
(
false
);
if
(
CollUtil
.
isNotEmpty
(
xiaoRuiEducation
)
&&
xiaoRuiEducation
.
contains
(
bookGroupDTO
.
getBookId
())){
qrcodeStatisticsDTO
.
setXiaoRuiEducation
(
true
);
}
if
(
groupUserCountDTO
!=
null
){
qrcodeStatisticsDTO
.
setCounts
(
groupUserCountDTO
.
getCount
().
longValue
());
qrcodeStatisticsDTO
.
setBrowserCounts
(
groupUserCountDTO
.
getUserCount
().
longValue
());
}
bookQrcodeStatisticsDTO
.
getQrcodeSceneDtoList
().
add
(
qrcodeStatisticsDTO
);
resultMap
.
put
(
bookQrcodeStatisticsDTO
.
getBookChannelAdviserId
(),
bookQrcodeStatisticsDTO
);
if
(
JoinGroupTypeEnum
.
GROUP_QRCODE
.
getCode
().
equals
(
bookGroupDTO
.
getJoinGroupType
())){
if
(
CollUtil
.
isNotEmpty
(
groupQrCodeMap
)
&&
groupQrCodeMap
.
containsKey
(
bookGroupDTO
.
getId
())){
BookGroupServeCountDTO
bookGroupServeCountDTO
=
groupQrCodeMap
.
get
(
bookGroupDTO
.
getId
());
qrcodeStatisticsDTO
.
setServeCount
(
bookGroupServeCountDTO
.
getServeCount
());
}
}
else
{
if
(
CollUtil
.
isNotEmpty
(
xiaoruiMap
)
&&
xiaoruiMap
.
containsKey
(
bookGroupDTO
.
getId
())){
BookGroupServeCountDTO
bookGroupServeCountDTO
=
xiaoruiMap
.
get
(
bookGroupDTO
.
getId
());
qrcodeStatisticsDTO
.
setServeCount
(
bookGroupServeCountDTO
.
getServeCount
());
}
if
(
JoinGroupTypeEnum
.
ROBOT
.
getCode
().
equals
(
bookGroupDTO
.
getJoinGroupType
())){
if
(
CollUtil
.
isNotEmpty
(
robotMap
)
&&
robotMap
.
containsKey
(
bookGroupDTO
.
getId
())){
BookGroupServeCountDTO
bookGroupServeCountDTO
=
robotMap
.
get
(
bookGroupDTO
.
getId
());
if
(
null
!=
bookGroupServeCountDTO
&&
null
!=
bookGroupServeCountDTO
.
getServeCount
())
{
qrcodeStatisticsDTO
.
setServeCount
((
null
==
qrcodeStatisticsDTO
.
getServeCount
()
?
0
:
qrcodeStatisticsDTO
.
getServeCount
())
+
bookGroupServeCountDTO
.
getServeCount
());
}
}
}
}
qrcodeStatisticsDTO
.
setTotalCount
(
qrcodeStatisticsDTO
.
getServeCount
());
bookQrcodeStatisticsDTO
.
getQrcodeSceneDtoList
().
add
(
qrcodeStatisticsDTO
);
bookQrcodeStatisticsDTO
.
setQrcodeSceneDtoList
(
Lists
.
newArrayList
(
qrcodeStatisticsDTO
));
if
(
resultMap
.
containsKey
(
bookQrcodeStatisticsDTO
.
getBookChannelAdviserId
())){
BookQrcodeStatisticsDTO
bookQrcodeStatisticsDTO1
=
resultMap
.
get
(
bookQrcodeStatisticsDTO
.
getBookChannelAdviserId
());
if
(
null
!=
bookQrcodeStatisticsDTO1
&&
CollUtil
.
isNotEmpty
(
bookQrcodeStatisticsDTO1
.
getQrcodeSceneDtoList
())){
List
<
QrcodeStatisticsDTO
>
qrcodeSceneDtoList
=
bookQrcodeStatisticsDTO1
.
getQrcodeSceneDtoList
();
qrcodeSceneDtoList
.
add
(
qrcodeStatisticsDTO
);
bookQrcodeStatisticsDTO
.
setQrcodeSceneDtoList
(
qrcodeSceneDtoList
);
}
}
resultMap
.
put
(
bookQrcodeStatisticsDTO
.
getBookChannelAdviserId
(),
bookQrcodeStatisticsDTO
);
}
}
...
...
@@ -1471,6 +1601,9 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
if
(
CollectionUtils
.
isEmpty
(
qrcodeSceneDtos
)){
qrcodeSceneDtos
=
Lists
.
newArrayList
();
}
List
<
Long
>
sceneIds
=
CollUtil
.
isEmpty
(
qrcodeSceneDtos
)
?
new
ArrayList
<>()
:
qrcodeSceneDtos
.
stream
().
map
(
x
->
x
.
getSceneId
()).
collect
(
Collectors
.
toList
());
// 企业微信群资源数
Map
<
Long
,
BookGroupServeCountDTO
>
bookQrcodeWxworkMap
=
CollUtil
.
isEmpty
(
sceneIds
)
?
new
HashMap
<>()
:
bookQrcodeWxworkBiz
.
mapWxWorkServeCount4SceneIds
(
sceneIds
,
BookQrcodeType
.
OFFICIAL_ACCOUNTS
.
getCode
());
String
bookChannelAdviserId
;
for
(
QrcodeSceneDto
qrcodeSceneDto
:
qrcodeSceneDtos
)
{
bookChannelAdviserId
=
qrcodeSceneDto
.
getAdviserBookId
()
+
"_"
+
qrcodeSceneDto
.
getChannelPartyId
()
+
"_"
+
qrcodeSceneDto
.
getAdviserId
();
...
...
@@ -1489,11 +1622,25 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
qrcodeStatisticsDTO
.
setQrcodeUrl
(
qrcodeSceneDto
.
getQrcodeUrl
());
qrcodeStatisticsDTO
.
setCounts
(
qrcodeSceneDto
.
getCounts
());
qrcodeStatisticsDTO
.
setBrowserCounts
(
qrcodeSceneDto
.
getBrowserCounts
());
//设置二维码类型和二维码下面配置的资源数量。一般资源和企业微信数量
qrcodeStatisticsDTO
.
setCodeType
(
qrcodeSceneDto
.
getQrcodeType
());
qrcodeStatisticsDTO
.
setServeCount
(
qrcodeSceneDto
.
getServeCount
());
qrcodeStatisticsDTO
.
setTotalCount
(
qrcodeSceneDto
.
getServeCount
());
//计算二维码下面的资源数(包括普通资源和配置的企业微信数量)
if
(
CollUtil
.
isNotEmpty
(
bookQrcodeWxworkMap
)
&&
bookQrcodeWxworkMap
.
containsKey
(
qrcodeSceneDto
.
getSceneId
())){
BookGroupServeCountDTO
bookGroupServeCountDTO
=
bookQrcodeWxworkMap
.
get
(
qrcodeSceneDto
.
getSceneId
());
if
(
null
!=
bookGroupServeCountDTO
&&
null
!=
bookGroupServeCountDTO
.
getServeCount
()){
qrcodeStatisticsDTO
.
setServeCount
((
null
==
qrcodeSceneDto
.
getServeCount
()
?
0
:
qrcodeSceneDto
.
getServeCount
())
+
bookGroupServeCountDTO
.
getServeCount
());
}
}
qrcodeStatisticsDTO
.
setXiaoRuiEducation
(
false
);
if
(
CollUtil
.
isNotEmpty
(
xiaoRuiEducation
)
&&
xiaoRuiEducation
.
contains
(
qrcodeSceneDto
.
getAdviserBookId
())){
qrcodeStatisticsDTO
.
setXiaoRuiEducation
(
true
);
}
bookQrcodeStatisticsDTO
.
getQrcodeSceneDtoList
().
add
(
qrcodeStatisticsDTO
);
}
// 筛选出疑似未印刷的二维码(扫码人数<=20 || 扫码次数<=40)
Iterator
<
BookQrcodeStatisticsDTO
>
iterator
=
resultMap
.
values
().
iterator
();
/*
Iterator<BookQrcodeStatisticsDTO> iterator = resultMap.values().iterator();
while(iterator.hasNext()) {
BookQrcodeStatisticsDTO item = iterator.next();
for (int i = item.getQrcodeSceneDtoList().size() - 1; i >= 0; i--) {
...
...
@@ -1507,7 +1654,7 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
resultMap.remove(item);
}
}
}
}
*/
return
resultMap
;
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/impl/BookBizImpl.java
View file @
5b4a7cb3
...
...
@@ -773,9 +773,14 @@ public class BookBizImpl implements BookBiz {
paramMap
.
put
(
"channelIds"
,
bookDetailDTO
.
getChannelIds
());
paramMap
.
put
(
"adviserIds"
,
bookDetailDTO
.
getAdviserIds
());
List
<
BookDto
>
bookDtos
=
bookDao
.
listBookGroupByBookIds
(
bookDetailDTO
.
getBookIds
(),
bookDetailDTO
.
getChannelIds
(),
bookDetailDTO
.
getAdviserIds
());
List
<
Long
>
xiaoRuiEducation
=
channelConsr
.
isXiaoRuiEducation
(
bookDetailDTO
.
getBookIds
());
if
(!
ListUtils
.
isEmpty
(
bookDtos
))
{
for
(
BookDto
bookDto
:
bookDtos
)
{
bookDto
.
setXiaoRuiEducation
(
false
);
bookMap
.
put
(
bookDto
.
getBookId
()
+
"_"
+
bookDto
.
getChannelId
()
+
"_"
+
bookDto
.
getAdviserId
(),
bookDto
);
if
(
CollUtil
.
isNotEmpty
(
xiaoRuiEducation
)
&&
xiaoRuiEducation
.
contains
(
bookDto
.
getBookId
())){
bookDto
.
setXiaoRuiEducation
(
true
);
}
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/book/facade/impl/BookAdviserFacadeImpl.java
View file @
5b4a7cb3
...
...
@@ -249,9 +249,10 @@ public class BookAdviserFacadeImpl implements BookAdviserFacade {
public
ResponseDto
<
PageBeanNew
<
QrCodeVO
>>
getQrList
(
@RequestParam
(
value
=
"bookId"
)
Long
bookId
,
@RequestParam
(
value
=
"adviserId"
)
Long
adviserId
,
@RequestParam
(
value
=
"channelId"
)
Long
channelId
,
@RequestParam
(
value
=
"type"
)
Integer
type
,
@RequestParam
(
value
=
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
)
Integer
numPerPage
)
throws
BizException
{
PageBeanNew
<
QrCodeVO
>
qrCodeVOPageBeanNew
=
bookAdviserBiz
.
getQrList
(
bookId
,
adviserId
,
channelId
,
currentPage
,
numPerPage
);
PageBeanNew
<
QrCodeVO
>
qrCodeVOPageBeanNew
=
bookAdviserBiz
.
getQrList
(
bookId
,
adviserId
,
channelId
,
type
,
currentPage
,
numPerPage
);
return
new
ResponseDto
<>(
qrCodeVOPageBeanNew
);
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/book/vo/QrCodeVO.java
View file @
5b4a7cb3
...
...
@@ -18,4 +18,13 @@ public class QrCodeVO {
@ApiModelProperty
(
"权益数"
)
private
Integer
rightsCount
;
@ApiModelProperty
(
"二维码类型"
)
private
String
codeType
;
@ApiModelProperty
(
"是否小睿教育书"
)
private
Boolean
xiaoRuiEducation
;
@ApiModelProperty
(
"公众号码id"
)
private
Long
sceneId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/user/ChannelConsr.java
View file @
5b4a7cb3
...
...
@@ -271,4 +271,19 @@ public class ChannelConsr {
}
return
new
HashMap
<>();
}
/**
* 是否小睿教育书
*/
public
List
<
Long
>
isXiaoRuiEducation
(
List
<
Long
>
bookIds
)
{
if
(
CollectionUtils
.
isEmpty
(
bookIds
)){
return
new
ArrayList
<>();
}
try
{
return
ResponseHandleUtil
.
parseList
(
qrcodeSceneService
.
isXiaoRuiEducation
(
bookIds
),
Long
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"是否小睿教育书 "
+
e
.
getMessage
(),
e
);
throw
new
ChannelBizException
(
ChannelBizException
.
PARAM_IS_NULL
,
"获取是否小睿教育书失败"
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/BookGroupDao.java
View file @
5b4a7cb3
...
...
@@ -382,4 +382,6 @@ public interface BookGroupDao extends BaseDao<BookGroup> {
List
<
HotAppDTO
>
listHotApp
();
List
<
HotAppDTO
>
listHotAppIncrement
();
List
<
BookGroupDTO
>
getDTOByBookIdList
(
Long
bookId
,
Long
channelId
,
Long
adviserId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/BookGroupServeDao.java
View file @
5b4a7cb3
...
...
@@ -82,6 +82,21 @@ public interface BookGroupServeDao extends BaseDao<BookGroupServe> {
Map
<
String
,
BookGroupServeCountDTO
>
mapBookGroupQrcodeServeCount
(
List
<
Long
>
adviserIds
,
List
<
Long
>
bookIds
,
List
<
Long
>
channelIds
,
Integer
joinGroupType
);
/**
* 批量获取群二维码下资源数量
* @param bookGroupIds
* @return
*/
Map
<
Long
,
BookGroupServeCountDTO
>
mapGroupQrcodeServeCount
(
List
<
Long
>
bookGroupIds
);
/**
* 批量获取 除了 群二维码下 其它社区码下资源数量
* @param bookGroupIds
* @return
*/
Map
<
Long
,
BookGroupServeCountDTO
>
mapXiaoRuiGroupQrcodeServeCount
(
List
<
Long
>
bookGroupIds
);
/**
* 根据书刊查社群书配置资源
* @author:zhuyajie
* @date:2020/12/14 16:31
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/BookGroupDaoImpl.java
View file @
5b4a7cb3
...
...
@@ -505,4 +505,13 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou
public
List
<
HotAppDTO
>
listHotAppIncrement
()
{
return
getSqlSession
().
selectList
(
getStatement
(
"listHotAppIncrement"
));
}
@Override
public
List
<
BookGroupDTO
>
getDTOByBookIdList
(
Long
bookId
,
Long
channelId
,
Long
adviserId
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"bookId"
,
bookId
);
paramMap
.
put
(
"channelId"
,
channelId
);
paramMap
.
put
(
"adviserId"
,
adviserId
);
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getDTOByBookIdList"
),
paramMap
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/BookGroupServeDaoImpl.java
View file @
5b4a7cb3
package
com
.
pcloud
.
book
.
group
.
dao
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.map.MapUtil
;
import
com.pcloud.book.book.vo.BookResourceNumDTO
;
import
com.pcloud.book.group.dao.BookGroupServeDao
;
...
...
@@ -155,6 +156,48 @@ public class BookGroupServeDaoImpl extends BaseDaoImpl<BookGroupServe> implement
}
@Override
public
Map
<
Long
,
BookGroupServeCountDTO
>
mapGroupQrcodeServeCount
(
List
<
Long
>
bookGroupIds
)
{
if
(
CollUtil
.
isNotEmpty
(
bookGroupIds
)
&&
bookGroupIds
.
size
()
>
500
)
{
Map
<
Long
,
BookGroupServeCountDTO
>
resultMap
=
new
HashMap
<>();
List
<
List
<
Long
>>
lists
=
ListUtils
.
groupList
(
bookGroupIds
);
for
(
List
<
Long
>
list
:
lists
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"bookGroupIds"
,
bookGroupIds
);
Map
<
Long
,
BookGroupServeCountDTO
>
objectObjectMap
=
getSessionTemplate
().
selectMap
(
getStatement
(
"mapGroupQrcodeServeCount"
),
map
,
"bookQrcodeId"
);
if
(
objectObjectMap
!=
null
){
resultMap
.
putAll
(
objectObjectMap
);
}
}
return
resultMap
;
}
else
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"bookGroupIds"
,
bookGroupIds
);
return
getSessionTemplate
().
selectMap
(
getStatement
(
"mapGroupQrcodeServeCount"
),
map
,
"bookQrcodeId"
);
}
}
@Override
public
Map
<
Long
,
BookGroupServeCountDTO
>
mapXiaoRuiGroupQrcodeServeCount
(
List
<
Long
>
bookGroupIds
)
{
if
(
CollUtil
.
isNotEmpty
(
bookGroupIds
)
&&
bookGroupIds
.
size
()
>
500
)
{
Map
<
Long
,
BookGroupServeCountDTO
>
resultMap
=
new
HashMap
<>();
List
<
List
<
Long
>>
lists
=
ListUtils
.
groupList
(
bookGroupIds
);
for
(
List
<
Long
>
list
:
lists
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"bookGroupIds"
,
bookGroupIds
);
Map
<
Long
,
BookGroupServeCountDTO
>
objectObjectMap
=
getSessionTemplate
().
selectMap
(
getStatement
(
"mapXiaoRuiGroupQrcodeServeCount"
),
map
,
"bookQrcodeId"
);
if
(
objectObjectMap
!=
null
){
resultMap
.
putAll
(
objectObjectMap
);
}
}
return
resultMap
;
}
else
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"bookGroupIds"
,
bookGroupIds
);
return
getSessionTemplate
().
selectMap
(
getStatement
(
"mapXiaoRuiGroupQrcodeServeCount"
),
map
,
"bookQrcodeId"
);
}
}
@Override
public
List
<
BookGroupServe
>
getServeListByBook
(
Long
bookId
,
Long
channelId
,
Long
adviserId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"adviserId"
,
adviserId
);
...
...
pcloud-service-book/src/main/resources/mapper/book/Book.Mapper.xml
View file @
5b4a7cb3
...
...
@@ -358,6 +358,7 @@
<select
id=
"listBookGroupByBookIds"
resultMap=
"bookMap"
parameterType=
"list"
>
SELECT
b.BOOK_ID,
b.CREATED_DATE,
b.ISBN,
b.BOOK_NAME,
b.COVER_IMG,
...
...
pcloud-service-book/src/main/resources/mapper/group/BookGroupMapper.xml
View file @
5b4a7cb3
...
...
@@ -144,6 +144,16 @@
ORDER BY create_time ASC limit 1
</select>
<select
id=
"getDTOByBookIdList"
resultMap=
"BookGroupDTO"
parameterType=
"map"
>
select
<include
refid=
"Base_Column_List"
/>
from book_group
where is_delete = 0
and book_id = #{bookId,jdbcType=BIGINT}
and channel_id = #{channelId,jdbcType=BIGINT}
and create_user = #{adviserId,jdbcType=BIGINT}
</select>
<select
id=
"getDTOByBookIdsAnsAdviserIds"
resultMap=
"BookGroupDTO"
parameterType=
"map"
>
select
<include
refid=
"Base_Column_List"
/>
...
...
pcloud-service-book/src/main/resources/mapper/group/BookGroupServe.xml
View file @
5b4a7cb3
...
...
@@ -238,6 +238,26 @@
GROUP BY bg.book_id,bg.create_user,bg.channel_id
</select>
<!--客服机器人、1v1、小睿的资源数-->
<!--2021-02-19 企业微信群也算一个资源数-->
<select
id=
"mapXiaoRuiGroupQrcodeServeCount"
parameterType=
"map"
resultType=
"com.pcloud.book.group.dto.BookGroupServeCountDTO"
>
SELECT
bg.id bookQrcodeId,
ifnull(COUNT(DISTINCT bgs.id),0) + (SELECT ifnull(COUNT(1),0) FROM book_qrcode_wxwork bqw WHERE bqw.book_qrcode_type = 2 AND bqw.book_qrcode_id = bg.id) serveCount,
bg.book_id bookId, bg.create_user adviserId, bg.channel_id channelId,COUNT(DISTINCT bg.group_qrcode_url) qrcodeCount,
bg.join_group_type joinGroupType
FROM `book_group` bg
LEFT JOIN book_group_serve bgs ON bg.id = bgs.book_group_id
WHERE
bg.is_delete=0
AND bg.id IN
<foreach
collection=
"bookGroupIds"
item=
"bookGroupId"
separator=
","
open=
"("
close=
")"
>
${bookGroupId}
</foreach>
AND bg.join_group_type IN (2,3,4)
GROUP BY bg.id
</select>
<!--社群资源数-->
<select
id=
"mapBookGroupQrcodeServeCount"
parameterType=
"map"
resultType=
"com.pcloud.book.group.dto.BookGroupServeCountDTO"
>
SELECT
...
...
@@ -265,6 +285,23 @@
GROUP BY bg.book_id,bg.create_user,bg.channel_id
</select>
<!--群二维码资源数-->
<select
id=
"mapGroupQrcodeServeCount"
parameterType=
"map"
resultType=
"com.pcloud.book.group.dto.BookGroupServeCountDTO"
>
SELECT
bg.id bookQrcodeId,ifnull(COUNT(DISTINCT k.id),0) serveCount
FROM
book_group bg
LEFT JOIN book_keyword bk ON bg.id=bk.book_group_id AND bk.is_delete = 0
LEFT JOIN keyword k ON bk.keyword_id = k.id AND k.is_delete = 0
WHERE
bg.is_delete = 0
AND bg.id IN
<foreach
collection=
"bookGroupIds"
item=
"bookGroupId"
separator=
","
open=
"("
close=
")"
>
${bookGroupId}
</foreach>
GROUP BY bg.id
</select>
<select
id=
"getServeListByBook"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
SELECT
s.id,
...
...
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