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
5eb18bfc
Commit
5eb18bfc
authored
Sep 25, 2020
by
吴博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
第三方资源加bookid埋点 ,并统计第三方链接的访问数据
parent
40dda3c0
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
955 additions
and
11 deletions
+955
-11
AppletThirdResourcesBiz.java
...a/com/pcloud/book/applet/biz/AppletThirdResourcesBiz.java
+2
-0
SpecialBookBiz.java
.../main/java/com/pcloud/book/applet/biz/SpecialBookBiz.java
+68
-0
AppletThirdResourcesBizImpl.java
...oud/book/applet/biz/impl/AppletThirdResourcesBizImpl.java
+57
-0
SpecialBookBizImpl.java
...a/com/pcloud/book/applet/biz/impl/SpecialBookBizImpl.java
+268
-0
SpecialBookDao.java
.../main/java/com/pcloud/book/applet/dao/SpecialBookDao.java
+18
-0
SpecialBookDaoImpl.java
...a/com/pcloud/book/applet/dao/impl/SpecialBookDaoImpl.java
+24
-0
SpecialBookDTO.java
.../main/java/com/pcloud/book/applet/dto/SpecialBookDTO.java
+51
-0
SpecialBookQueryDTO.java
.../java/com/pcloud/book/applet/dto/SpecialBookQueryDTO.java
+14
-0
ThirdResourceRecordDTO.java
...va/com/pcloud/book/applet/dto/ThirdResourceRecordDTO.java
+28
-0
SpecialBook.java
.../main/java/com/pcloud/book/applet/entity/SpecialBook.java
+39
-0
AppletThirdResourcesFacade.java
...pcloud/book/applet/facade/AppletThirdResourcesFacade.java
+15
-0
SpecialBookFacade.java
...java/com/pcloud/book/applet/facade/SpecialBookFacade.java
+121
-0
BookBiz.java
...-book/src/main/java/com/pcloud/book/book/biz/BookBiz.java
+1
-1
BookBizImpl.java
.../main/java/com/pcloud/book/book/biz/impl/BookBizImpl.java
+7
-5
BookFacadeImpl.java
...java/com/pcloud/book/book/facade/impl/BookFacadeImpl.java
+2
-1
ReaderConsr.java
...ain/java/com/pcloud/book/consumer/reader/ReaderConsr.java
+27
-2
WechatGroupConsr.java
...om/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
+15
-0
application.yml
pcloud-service-book/src/main/resources/application.yml
+2
-2
AppletThirdResourcesClickMapper.xml
...sources/mapper/applet/AppletThirdResourcesClickMapper.xml
+44
-0
SpecialBook.Mapper.xml
...k/src/main/resources/mapper/applet/SpecialBook.Mapper.xml
+152
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AppletThirdResourcesBiz.java
View file @
5eb18bfc
package
com
.
pcloud
.
book
.
applet
.
biz
;
import
com.pcloud.book.applet.dto.AppletThirdResourcesDTO
;
import
com.pcloud.book.applet.dto.ThirdResourceRecordDTO
;
import
com.pcloud.book.applet.entity.AppletThirdResources
;
import
com.pcloud.book.applet.entity.AppletThirdResourcesClick
;
import
com.pcloud.common.page.PageBeanNew
;
...
...
@@ -27,4 +28,5 @@ public interface AppletThirdResourcesBiz {
void
createThirdResources
(
AppletThirdResourcesDTO
thirdResourcesDTO
);
PageBeanNew
<
ThirdResourceRecordDTO
>
listThirdResourceRecord
(
String
queryName
,
Integer
currentPage
,
Integer
numPerPage
,
String
wechatUser
,
Long
thirdResourceId
,
Integer
recordType
);
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/SpecialBookBiz.java
0 → 100644
View file @
5eb18bfc
package
com
.
pcloud
.
book
.
applet
.
biz
;
import
com.pcloud.book.applet.dto.SpecialBookDTO
;
import
com.pcloud.book.applet.entity.SpecialBook
;
import
com.pcloud.common.page.PageBeanNew
;
import
java.util.List
;
/**
* (SpecialBook)表服务接口
*
* @author makejava
* @since 2020-09-16 13:43:43
*/
public
interface
SpecialBookBiz
{
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SpecialBook
getById
(
Long
id
);
/**
* 分页查询
*/
PageBeanNew
getList
(
Integer
currentPage
,
Integer
numPerPage
);
/**
* 新增数据
*
* @param specialBook 实例对象
* @return 主键
*/
void
insert
(
List
<
SpecialBook
>
specialBook
);
/**
* 修改数据
*
* @param specialBook 实例对象
*/
void
update
(
SpecialBook
specialBook
);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
void
deleteById
(
Long
id
);
/**
* 获取小睿统计书刊列表
* @param queryName
* @param startTime
* @param endTime
* @param currentPage
* @param numPerPage
* @param wechatUser
* @return
*/
PageBeanNew
<
SpecialBookDTO
>
listSpecialBook
(
String
queryName
,
String
startTime
,
String
endTime
,
Integer
currentPage
,
Integer
numPerPage
,
String
wechatUser
);
void
exportSpecialBook
(
String
queryName
,
String
startTime
,
String
endTime
,
Integer
currentPage
,
Integer
numPerPage
,
String
wechatUser
,
Long
partyId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletThirdResourcesBizImpl.java
View file @
5eb18bfc
...
...
@@ -9,17 +9,22 @@ import com.pcloud.book.applet.dao.AppletThirdResourcesDao;
import
com.pcloud.book.applet.dto.AppletChartDateDTO
;
import
com.pcloud.book.applet.dto.AppletThirdResourcesDTO
;
import
com.pcloud.book.applet.dto.PvuvDTO
;
import
com.pcloud.book.applet.dto.ThirdResourceRecordDTO
;
import
com.pcloud.book.applet.entity.AppletThirdResources
;
import
com.pcloud.book.applet.entity.AppletThirdResourcesClick
;
import
com.pcloud.book.applet.enums.DataRecordTypeEnum
;
import
com.pcloud.book.applet.enums.DataTypeEnum
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.consumer.user.AdviserConsr
;
import
com.pcloud.book.group.biz.BizMaterialBiz
;
import
com.pcloud.book.group.enums.UseTypeEnum
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.readercenter.wechat.entity.WechatUser
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.MapUtils
;
import
org.springframework.beans.BeanUtils
;
...
...
@@ -48,6 +53,10 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
private
AppletNewsDao
appletNewsDao
;
@Autowired
private
BizMaterialBiz
bizMaterialBiz
;
@Autowired
private
ReaderConsr
readerConsr
;
@Autowired
private
AdviserConsr
adviserConsr
;
@Override
public
PageBeanNew
<
AppletThirdResourcesDTO
>
getListThirdResourcesAnalysis
(
String
keyValue
,
String
source
,
...
...
@@ -236,4 +245,52 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
}
@Override
@ParamLog
(
"第三方资源列表"
)
public
PageBeanNew
<
ThirdResourceRecordDTO
>
listThirdResourceRecord
(
String
queryName
,
Integer
currentPage
,
Integer
numPerPage
,
String
wechatUser
,
Long
thirdResourceId
,
Integer
recordType
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
if
(!
StringUtil
.
isEmpty
(
queryName
))
{
paramMap
.
put
(
"queryName"
,
queryName
);
}
List
<
Long
>
wechatUserIds
=
null
;
if
(!
StringUtil
.
isEmpty
(
wechatUser
))
{
wechatUserIds
=
readerConsr
.
getWechatUserByNameOrId
(
wechatUser
);
if
(
ListUtils
.
isEmpty
(
wechatUserIds
))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
new
ArrayList
<>());
}
}
if
(!
ListUtils
.
isEmpty
(
wechatUserIds
))
{
paramMap
.
put
(
"wechatUserIds"
,
wechatUserIds
);
}
if
(
null
!=
recordType
)
{
paramMap
.
put
(
"recordType"
,
recordType
);
}
paramMap
.
put
(
"thirdResourceId"
,
thirdResourceId
);
PageBeanNew
<
ThirdResourceRecordDTO
>
pageBeanNew
=
thirdResourcesClickDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listThirdResourceRecord"
);
if
(
null
==
pageBeanNew
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
new
ArrayList
<>());
}
List
<
ThirdResourceRecordDTO
>
recordList
=
pageBeanNew
.
getRecordList
();
List
<
Long
>
adviserIds
=
recordList
.
stream
().
map
(
e
->
e
.
getAdviserId
()).
collect
(
Collectors
.
toList
());
List
<
Long
>
wechatUserIdList
=
recordList
.
stream
().
map
(
e
->
e
.
getWechatUserId
()).
collect
(
Collectors
.
toList
());
Map
<
Long
,
String
>
adviserNameMap
=
new
HashMap
<>();
Map
<
Long
,
WechatUser
>
userMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
adviserIds
))
{
adviserNameMap
=
adviserConsr
.
getNames
(
adviserIds
);
}
if
(!
ListUtils
.
isEmpty
(
wechatUserIdList
))
{
userMap
=
readerConsr
.
getUserList
(
wechatUserIdList
);
}
for
(
ThirdResourceRecordDTO
thirdResourceRecordDTO
:
recordList
)
{
if
(
MapUtils
.
isNotEmpty
(
adviserNameMap
)
&&
null
!=
adviserNameMap
.
get
(
thirdResourceRecordDTO
.
getAdviserId
()))
{
thirdResourceRecordDTO
.
setAdviserName
(
adviserNameMap
.
get
(
thirdResourceRecordDTO
.
getAdviserId
()));
}
if
(
MapUtils
.
isNotEmpty
(
userMap
)
&&
null
!=
userMap
.
get
(
thirdResourceRecordDTO
.
getWechatUserId
()))
{
thirdResourceRecordDTO
.
setWechatUserName
(
userMap
.
get
(
thirdResourceRecordDTO
.
getWechatUserId
()).
getWechatUserNickname
());
thirdResourceRecordDTO
.
setPhone
(
userMap
.
get
(
thirdResourceRecordDTO
.
getWechatUserId
()).
getPhoneNumber
());
}
}
return
pageBeanNew
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/SpecialBookBizImpl.java
0 → 100644
View file @
5eb18bfc
package
com
.
pcloud
.
book
.
applet
.
biz
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pcloud.book.applet.dto.SpecialBookDTO
;
import
com.pcloud.book.applet.biz.SpecialBookBiz
;
import
com.pcloud.book.applet.dao.SpecialBookDao
;
import
com.pcloud.book.applet.entity.SpecialBook
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.common.ExportConsr
;
import
com.pcloud.book.consumer.message.MessageConsr
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.consumer.user.AdviserConsr
;
import
com.pcloud.book.consumer.user.AgentConsr
;
import
com.pcloud.book.consumer.user.ChannelConsr
;
import
com.pcloud.book.consumer.user.PartyConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.dto.BookServeDTO
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.constant.SystemCode
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.NumberUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.readercenter.wechat.dto.SpecialBookDTO4Reader
;
import
com.pcloud.readercenter.wechat.dto.SpecialBookQueryDTO4Reader
;
import
com.pcloud.usercenter.party.agent.entity.Agent
;
import
com.pcloud.wechatgroup.group.dto.SpecialBookDTO4WG
;
import
com.pcloud.wechatgroup.group.dto.SpecialBookQueryDTO4WG
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.text.DecimalFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* (SpecialBook)表服务实现类
*
* @author makejava
* @since 2020-09-16 13:43:43
*/
@Service
(
"specialBookBiz"
)
public
class
SpecialBookBizImpl
implements
SpecialBookBiz
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
SpecialBookBizImpl
.
class
);
@Autowired
private
SpecialBookDao
specialBookDao
;
@Autowired
private
BookGroupBiz
bookGroupBiz
;
@Autowired
private
WechatGroupConsr
wechatGroupConsr
;
@Autowired
private
ReaderConsr
readerConsr
;
@Autowired
private
AdviserConsr
adviserConsr
;
@Autowired
private
ChannelConsr
channelConsr
;
@Autowired
private
AgentConsr
agentConsr
;
@Autowired
private
PartyConsr
partyConsr
;
@Autowired
private
ExportConsr
exportConsr
;
@Autowired
private
MessageConsr
messageConsr
;
@Override
@ParamLog
(
"通过ID查询单条数据"
)
public
SpecialBook
getById
(
Long
id
)
{
return
specialBookDao
.
getById
(
id
);
}
@Override
@ParamLog
(
"查询多条数据"
)
public
PageBeanNew
getList
(
Integer
currentPage
,
Integer
numPerPage
)
{
PageBeanNew
pageBeanNew
=
specialBookDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
null
,
"getList"
);
List
recordList
=
pageBeanNew
.
getRecordList
();
if
(
ListUtils
.
isEmpty
(
recordList
))
{
return
pageBeanNew
;
}
// 加载其它数据
return
pageBeanNew
;
}
@Override
@ParamLog
(
"新增"
)
public
void
insert
(
List
<
SpecialBook
>
specialBooks
)
{
if
(
ListUtils
.
isEmpty
(
specialBooks
))
{
return
;
}
List
<
Long
>
bookIds
=
specialBooks
.
stream
().
map
(
e
->
e
.
getBookId
()).
collect
(
Collectors
.
toList
());
List
<
SpecialBook
>
specialBookList
=
specialBookDao
.
listByBookIds
(
bookIds
);
if
(!
ListUtils
.
isEmpty
(
specialBookList
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
specialBookList
.
get
(
0
).
getBookName
()
+
"已存在列表"
);
}
specialBookDao
.
insert
(
specialBooks
);
}
@Override
@ParamLog
(
"修改"
)
public
void
update
(
SpecialBook
specialBook
)
{
if
(
specialBook
==
null
||
!
NumberUtil
.
isNumber
(
specialBook
.
getId
()))
{
throw
BizException
.
PARAM_IS_NULL
;
}
specialBookDao
.
update
(
specialBook
);
}
@Override
@ParamLog
(
"删除"
)
public
void
deleteById
(
Long
id
)
{
specialBookDao
.
deleteById
(
id
);
}
@Override
@ParamLog
(
isAfterReturn
=
false
)
public
PageBeanNew
<
SpecialBookDTO
>
listSpecialBook
(
String
queryName
,
String
startTime
,
String
endTime
,
Integer
currentPage
,
Integer
numPerPage
,
String
wechatUser
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
if
(!
StringUtil
.
isEmpty
(
queryName
))
{
paramMap
.
put
(
"queryName"
,
queryName
);
}
List
<
Long
>
wechatUserIds
=
null
;
if
(!
StringUtil
.
isEmpty
(
wechatUser
))
{
wechatUserIds
=
readerConsr
.
getWechatUserByNameOrId
(
wechatUser
);
if
(
ListUtils
.
isEmpty
(
wechatUserIds
))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
new
ArrayList
<>());
}
}
if
(!
ListUtils
.
isEmpty
(
wechatUserIds
))
{
paramMap
.
put
(
"wechatUserIds"
,
wechatUserIds
);
}
PageBeanNew
<
SpecialBookDTO
>
pageBeanNew
=
specialBookDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listSpecialBook"
);
if
(
null
==
pageBeanNew
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
pageBeanNew
;
}
List
<
SpecialBookDTO
>
specialBookDTOS
=
pageBeanNew
.
getRecordList
();
List
<
Long
>
adviserIds
=
specialBookDTOS
.
stream
().
map
(
e
->
e
.
getAdviserId
()).
collect
(
Collectors
.
toList
());
List
<
Long
>
channleIds
=
specialBookDTOS
.
stream
().
map
(
e
->
e
.
getChannelId
()).
collect
(
Collectors
.
toList
());
List
<
Long
>
bookIds
=
specialBookDTOS
.
stream
().
map
(
e
->
e
.
getBookId
()).
collect
(
Collectors
.
toList
());
List
<
Long
>
bookGroupIds
=
specialBookDTOS
.
stream
().
map
(
e
->
e
.
getBookGroupId
()).
collect
(
Collectors
.
toList
());
Map
<
Long
,
String
>
adviserNameMap
=
new
HashMap
<>();
Map
<
Long
,
String
>
channelNameMap
=
new
HashMap
<>();
Map
<
Long
,
Agent
>
agentMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
adviserIds
))
{
adviserNameMap
=
adviserConsr
.
getNames
(
adviserIds
);
agentMap
=
partyConsr
.
getAgentByPartyId
(
adviserIds
,
SystemCode
.
adviser
.
code
);
}
if
(!
ListUtils
.
isEmpty
(
channleIds
))
{
channelNameMap
=
channelConsr
.
getNamesByIdList
(
channleIds
);
}
SpecialBookQueryDTO4WG
specialBookQueryDTO4WG
=
new
SpecialBookQueryDTO4WG
();
specialBookQueryDTO4WG
.
setBookGroupIds
(
bookGroupIds
);
specialBookQueryDTO4WG
.
setStartTime
(
startTime
);
specialBookQueryDTO4WG
.
setEndTime
(
endTime
);
SpecialBookQueryDTO4Reader
specialBookQueryDTO4Reader
=
new
SpecialBookQueryDTO4Reader
();
specialBookQueryDTO4Reader
.
setBookIds
(
bookIds
);
specialBookQueryDTO4Reader
.
setStartTime
(
startTime
);
specialBookQueryDTO4Reader
.
setEndTime
(
endTime
);
Map
<
Long
,
SpecialBookDTO4WG
>
introductionPagePVMap
=
wechatGroupConsr
.
getIntroductionPagePVAndUvMap
(
specialBookQueryDTO4WG
);
Map
<
Long
,
SpecialBookDTO4Reader
>
appletStatisticsMap
=
readerConsr
.
getAppletStatisticsMap
(
specialBookQueryDTO4Reader
);
for
(
SpecialBookDTO
specialBookDTO
:
specialBookDTOS
)
{
if
(
null
!=
specialBookDTO
.
getAdviserId
()
&&
null
!=
adviserNameMap
.
get
(
specialBookDTO
.
getAdviserId
()))
{
specialBookDTO
.
setAdviserName
(
adviserNameMap
.
get
(
specialBookDTO
.
getAdviserId
()));
specialBookDTO
.
setAgentName
(
agentMap
.
get
(
specialBookDTO
.
getAdviserId
()).
getName
());
}
if
(
null
!=
specialBookDTO
.
getChannelId
()
&&
null
!=
channelNameMap
.
get
(
specialBookDTO
.
getChannelId
()))
{
specialBookDTO
.
setChannelName
(
channelNameMap
.
get
(
specialBookDTO
.
getChannelId
()));
}
if
(
null
!=
specialBookDTO
.
getBookGroupId
()
&&
null
!=
introductionPagePVMap
.
get
(
specialBookDTO
.
getBookGroupId
()))
{
specialBookDTO
.
setIntroductionPagePV
(
introductionPagePVMap
.
get
(
specialBookDTO
.
getBookGroupId
()).
getIntroductionPagePV
());
specialBookDTO
.
setIntroductionPageUV
(
introductionPagePVMap
.
get
(
specialBookDTO
.
getBookGroupId
()).
getIntroductionPageUV
());
}
if
(
null
!=
specialBookDTO
.
getBookId
()
&&
null
!=
appletStatisticsMap
.
get
(
specialBookDTO
.
getBookId
()))
{
specialBookDTO
.
setAppletNewUserCount
(
appletStatisticsMap
.
get
(
specialBookDTO
.
getBookId
()).
getAppletNewUserCount
());
specialBookDTO
.
setAppletPV
(
appletStatisticsMap
.
get
(
specialBookDTO
.
getBookId
()).
getAppletPV
());
specialBookDTO
.
setAppletUV
(
appletStatisticsMap
.
get
(
specialBookDTO
.
getBookId
()).
getAppletUV
());
}
//资源数量
List
<
BookServeDTO
>
serveDTOList
=
bookGroupBiz
.
getBookAndBookGroupServeIds
(
specialBookDTO
.
getAdviserId
(),
specialBookDTO
.
getBookId
(),
specialBookDTO
.
getChannelId
());
specialBookDTO
.
setResourceCount
(
ListUtils
.
isEmpty
(
serveDTOList
)
?
0
:
serveDTOList
.
size
());
DecimalFormat
df
=
new
DecimalFormat
(
"0.00%"
);
if
(
null
==
introductionPagePVMap
.
get
(
specialBookDTO
.
getBookGroupId
())
||
null
==
introductionPagePVMap
.
get
(
specialBookDTO
.
getBookGroupId
()).
getIntroductionPageUV
()
||
0
==
introductionPagePVMap
.
get
(
specialBookDTO
.
getBookGroupId
()).
getIntroductionPageUV
()
||
null
==
appletStatisticsMap
.
get
(
specialBookDTO
.
getBookId
())
||
null
==
appletStatisticsMap
.
get
(
specialBookDTO
.
getBookId
()).
getAppletUV
()
||
0
==
appletStatisticsMap
.
get
(
specialBookDTO
.
getBookId
()).
getAppletUV
())
{
specialBookDTO
.
setAppletTransformationEfficiency
(
df
.
format
(
0
));
}
else
{
specialBookDTO
.
setAppletTransformationEfficiency
(
df
.
format
(
appletStatisticsMap
.
get
(
specialBookDTO
.
getBookId
()).
getAppletUV
().
doubleValue
()/
introductionPagePVMap
.
get
(
specialBookDTO
.
getBookGroupId
()).
getIntroductionPageUV
()
)
);
}
}
return
pageBeanNew
;
}
@Override
public
void
exportSpecialBook
(
String
queryName
,
String
startTime
,
String
endTime
,
Integer
currentPage
,
Integer
numPerPage
,
String
wechatUser
,
Long
partyId
)
{
ThreadPoolUtils
.
EXPORT_THREAD_POOL
.
execute
(()
->
{
PageBeanNew
<
SpecialBookDTO
>
specialBookDTOPageBeanNew
=
this
.
listSpecialBook
(
queryName
,
startTime
,
endTime
,
currentPage
,
numPerPage
,
wechatUser
);
if
(
null
==
specialBookDTOPageBeanNew
||
ListUtils
.
isEmpty
(
specialBookDTOPageBeanNew
.
getRecordList
()))
{
return
;
}
String
exportSpecialBookUrl
=
getExportSpecialBookUrl
(
specialBookDTOPageBeanNew
.
getRecordList
());
String
fileName
=
"书刊数据增长统计"
;
if
(!
StringUtil
.
isEmpty
(
exportSpecialBookUrl
))
{
JSONObject
content
=
new
JSONObject
();
content
.
put
(
"commitTime"
,
DateUtils
.
formatDate
(
new
Date
()));
content
.
put
(
"type"
,
"书刊数据增长统计导出"
);
messageConsr
.
sendLetter
(
partyId
,
partyId
,
content
.
toJSONString
(),
SystemCode
.
pcloud
.
code
,
"book_download"
,
exportSpecialBookUrl
,
fileName
);
}
});
}
private
String
getExportSpecialBookUrl
(
List
<
SpecialBookDTO
>
list
)
{
// 字段名
String
[]
rowsName
=
{
"书籍id"
,
"书籍名称"
,
"出版社名称"
,
"isbn"
,
"编辑名称"
,
"渠道名称"
,
"二维码"
,
"资源数量"
,
"落地页PV"
,
"落地页UV"
,
"小睿新增用户"
,
"小睿浏览量PV"
,
"小睿读者量UV"
,
"进入小程序转化率"
};
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
Object
[]
objs
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
SpecialBookDTO
spaceDTO
=
list
.
get
(
i
);
objs
=
new
Object
[
rowsName
.
length
];
objs
[
0
]
=
spaceDTO
.
getBookId
();
objs
[
1
]
=
spaceDTO
.
getBookName
();
objs
[
2
]
=
spaceDTO
.
getAgentName
();
objs
[
3
]
=
spaceDTO
.
getIsbn
();
objs
[
4
]
=
spaceDTO
.
getAdviserName
();
objs
[
5
]
=
spaceDTO
.
getChannelName
();
objs
[
6
]
=
spaceDTO
.
getBookGroupUrl
();
objs
[
7
]
=
spaceDTO
.
getResourceCount
();
objs
[
8
]
=
null
==
spaceDTO
.
getIntroductionPagePV
()
?
0
:
spaceDTO
.
getIntroductionPagePV
();
objs
[
9
]
=
null
==
spaceDTO
.
getIntroductionPageUV
()
?
0
:
spaceDTO
.
getIntroductionPageUV
();
objs
[
10
]
=
null
==
spaceDTO
.
getAppletNewUserCount
()
?
0
:
spaceDTO
.
getAppletNewUserCount
();
objs
[
11
]
=
null
==
spaceDTO
.
getAppletPV
()
?
0
:
spaceDTO
.
getAppletPV
();
objs
[
12
]
=
null
==
spaceDTO
.
getAppletUV
()
?
0
:
spaceDTO
.
getAppletUV
();
objs
[
13
]
=
null
==
spaceDTO
.
getAppletTransformationEfficiency
()
?
"0.00%"
:
spaceDTO
.
getAppletTransformationEfficiency
();
dataList
.
add
(
objs
);
}
String
fileName
=
new
Date
()
+
"落地页书刊数据统计"
;
String
fileUrl
=
exportConsr
.
exportExcel
(
fileName
,
rowsName
,
dataList
);
return
fileUrl
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/SpecialBookDao.java
0 → 100644
View file @
5eb18bfc
package
com
.
pcloud
.
book
.
applet
.
dao
;
import
com.pcloud.book.applet.entity.SpecialBook
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* (SpecialBook)表数据库访问层
*
* @author makejava
* @since 2020-09-16 13:43:42
*/
public
interface
SpecialBookDao
extends
BaseDao
<
SpecialBook
>
{
List
<
SpecialBook
>
listByBookIds
(
List
<
Long
>
bookIds
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/SpecialBookDaoImpl.java
0 → 100644
View file @
5eb18bfc
package
com
.
pcloud
.
book
.
applet
.
dao
.
impl
;
import
com.pcloud.book.applet.dao.SpecialBookDao
;
import
com.pcloud.book.applet.entity.SpecialBook
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* (SpecialBook)表数据库访问层
*
* @author makejava
* @since 2020-09-16 13:43:43
*/
@Repository
(
"specialBookDaoImpl"
)
public
class
SpecialBookDaoImpl
extends
BaseDaoImpl
<
SpecialBook
>
implements
SpecialBookDao
{
@Override
public
List
<
SpecialBook
>
listByBookIds
(
List
<
Long
>
bookIds
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"listByBookIds"
),
bookIds
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/SpecialBookDTO.java
0 → 100644
View file @
5eb18bfc
package
com
.
pcloud
.
book
.
applet
.
dto
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
SpecialBookDTO
{
private
Long
id
;
private
Long
bookId
;
private
Long
adviserId
;
private
Long
channelId
;
private
Long
agentId
;
private
String
bookName
;
private
String
agentName
;
private
String
isbn
;
private
String
adviserName
;
private
String
channelName
;
private
List
<
String
>
qrcodes
;
private
Long
bookGroupId
;
private
String
bookGroupUrl
;
private
Integer
resourceCount
;
private
Integer
introductionPageNewUserCount
;
private
Integer
introductionPagePV
;
private
Integer
introductionPageUV
;
private
Integer
appletNewUserCount
;
private
Integer
appletPV
;
private
Integer
appletUV
;
private
String
appletTransformationEfficiency
;
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/SpecialBookQueryDTO.java
0 → 100644
View file @
5eb18bfc
package
com
.
pcloud
.
book
.
applet
.
dto
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
SpecialBookQueryDTO
{
private
List
<
Long
>
bookGroupIds
;
private
List
<
Long
>
bookIds
;
private
String
startTime
;
private
String
endTime
;
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/ThirdResourceRecordDTO.java
0 → 100644
View file @
5eb18bfc
package
com
.
pcloud
.
book
.
applet
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
ThirdResourceRecordDTO
{
private
Long
id
;
private
Long
bookId
;
private
String
bookName
;
private
String
isbn
;
private
Long
adviserId
;
private
String
adviserName
;
private
Long
wechatUserId
;
private
String
wechatUserName
;
private
String
phone
;
private
Long
newsId
;
private
String
urlNumber
;
private
Integer
recordType
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
private
Long
thirdResourceId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/SpecialBook.java
0 → 100644
View file @
5eb18bfc
package
com
.
pcloud
.
book
.
applet
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.entity.BaseEntity
;
import
lombok.Data
;
import
java.util.Date
;
/**
* (SpecialBook)实体类
*
* @author makejava
* @since 2020-09-16 13:43:42
*/
@Data
public
class
SpecialBook
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
894207975530749745L
;
private
Long
id
;
private
Long
bookId
;
private
Long
adviserId
;
private
Long
channelId
;
private
Integer
isDelete
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
updateTime
;
private
String
bookName
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/AppletThirdResourcesFacade.java
View file @
5eb18bfc
package
com
.
pcloud
.
book
.
applet
.
facade
;
import
com.pcloud.book.applet.dto.ThirdResourceRecordDTO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.CookieValue
;
...
...
@@ -149,4 +150,17 @@ public class AppletThirdResourcesFacade {
return
new
ResponseDto
<>();
}
@GetMapping
(
"listThirdResourceRecord"
)
public
ResponseDto
<
PageBeanNew
<
ThirdResourceRecordDTO
>>
listThirdResourceRecord
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"thirdResourceId"
)
Long
thirdResourceId
,
@RequestParam
(
value
=
"queryName"
,
required
=
false
)
String
queryName
,
@RequestParam
(
value
=
"wechatUser"
,
required
=
false
)
String
wechatUser
,
@RequestParam
(
value
=
"currentPage"
,
defaultValue
=
"0"
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
defaultValue
=
"1000"
)
Integer
numPerPage
,
@RequestParam
(
value
=
"recordType"
,
required
=
false
)
Integer
recordType
)
{
SessionUtil
.
getToken4Redis
(
token
);
PageBeanNew
<
ThirdResourceRecordDTO
>
thirdResourceRecordDTOPageBeanNew
=
thirdResourcesBiz
.
listThirdResourceRecord
(
queryName
,
currentPage
,
numPerPage
,
wechatUser
,
thirdResourceId
,
recordType
);
return
new
ResponseDto
<>(
thirdResourceRecordDTOPageBeanNew
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/SpecialBookFacade.java
0 → 100644
View file @
5eb18bfc
package
com
.
pcloud
.
book
.
applet
.
facade
;
import
com.pcloud.book.applet.biz.SpecialBookBiz
;
import
com.pcloud.book.applet.dto.SpecialBookDTO
;
import
com.pcloud.book.applet.dto.ThirdResourceRecordDTO
;
import
com.pcloud.book.applet.entity.SpecialBook
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.wechatgroup.message.enums.IsSystem
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
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
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.Map
;
/**
* (SpecialBook)表控制层
*
* @author makejava
* @since 2020-09-16 13:43:43
*/
@RestController
(
"specialBookFacade"
)
@RequestMapping
(
"specialBook"
)
public
class
SpecialBookFacade
{
@Autowired
private
SpecialBookBiz
specialBookBiz
;
@ApiOperation
(
"通过主键查询单条数据"
)
@GetMapping
(
"getById"
)
public
ResponseDto
<?>
getById
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
Long
id
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
specialBookBiz
.
getById
(
id
));
}
@ApiOperation
(
"分页查询"
)
@GetMapping
(
"getList"
)
public
ResponseDto
<?>
getList
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"currentPage"
,
defaultValue
=
"0"
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
defaultValue
=
"10"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
specialBookBiz
.
getList
(
currentPage
,
numPerPage
));
}
@ApiOperation
(
"新增"
)
@PostMapping
(
"insert"
)
public
ResponseDto
<?>
insert
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
List
<
SpecialBook
>
specialBooks
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
specialBookBiz
.
insert
(
specialBooks
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"更新"
)
@PostMapping
(
"update"
)
public
ResponseDto
<?>
update
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
SpecialBook
specialBook
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
specialBookBiz
.
update
(
specialBook
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"删除"
)
@GetMapping
(
"deleteById"
)
public
ResponseDto
<?>
deleteById
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
Long
id
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
if
(
null
==
id
)
{
throw
BookBizException
.
PARAM_DELETION
;
}
specialBookBiz
.
deleteById
(
id
);
return
new
ResponseDto
<>();
}
@GetMapping
(
"listSpecialBook"
)
public
ResponseDto
<
PageBeanNew
<
SpecialBookDTO
>>
listSpecialBook
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"queryName"
,
required
=
false
)
String
queryName
,
@RequestParam
(
value
=
"wechatUser"
,
required
=
false
)
String
wechatUser
,
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
String
startTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
String
endTime
,
@RequestParam
(
value
=
"currentPage"
,
defaultValue
=
"0"
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
defaultValue
=
"10"
)
Integer
numPerPage
)
{
SessionUtil
.
getToken4Redis
(
token
);
PageBeanNew
<
SpecialBookDTO
>
specialBookDTOPageBeanNew
=
specialBookBiz
.
listSpecialBook
(
queryName
,
startTime
,
endTime
,
currentPage
,
numPerPage
,
wechatUser
);
return
new
ResponseDto
<>(
specialBookDTOPageBeanNew
);
}
@GetMapping
(
"exportSpecialBook"
)
public
ResponseDto
<
Void
>
exportSpecialBook
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"queryName"
,
required
=
false
)
String
queryName
,
@RequestParam
(
value
=
"wechatUser"
,
required
=
false
)
String
wechatUser
,
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
String
startTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
String
endTime
,
@RequestParam
(
value
=
"currentPage"
,
defaultValue
=
"0"
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
defaultValue
=
"1000"
)
Integer
numPerPage
)
{
Map
<
String
,
Object
>
map
=
SessionUtil
.
getToken4Redis
(
token
);
String
isSystem
=
(
String
)
map
.
get
(
SessionUtil
.
IS_SYSTEM
);
Long
partyId
=
(
Long
)
map
.
get
(
SessionUtil
.
PARTY_ID
);
if
(
IsSystem
.
NOT_SYSTEM
.
code
.
equals
(
isSystem
))
{
partyId
=
(
Long
)
map
.
get
(
SessionUtil
.
MEMBER_ID
);
}
specialBookBiz
.
exportSpecialBook
(
queryName
,
startTime
,
endTime
,
currentPage
,
numPerPage
,
wechatUser
,
partyId
);
return
new
ResponseDto
<>();
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/BookBiz.java
View file @
5eb18bfc
...
...
@@ -660,7 +660,7 @@ public interface BookBiz {
void
updateIsOpenRobotProcess4Now
(
Long
adviserId
,
UpdateBookRobotProcessDto
robotProcessDto
);
PageBeanNew
<
BookDto
>
getAdviserBooks4Rights
(
String
keyword
,
Long
agentId
,
Long
templetId
,
Long
secondTempletId
,
String
typeCode
,
Integer
currentPage
,
Integer
numPerPage
);
PageBeanNew
<
BookDto
>
getAdviserBooks4Rights
(
String
keyword
,
Long
agentId
,
Long
templetId
,
Long
secondTempletId
,
String
typeCode
,
Integer
currentPage
,
Integer
numPerPage
,
Integer
isIgnore
);
/**
* 小程序首页书刊搜索
...
...
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/impl/BookBizImpl.java
View file @
5eb18bfc
...
...
@@ -7,7 +7,6 @@ import com.google.common.collect.Lists;
import
com.google.common.collect.Maps
;
import
com.alibaba.fastjson.JSONObject
;
import
com.netflix.discovery.converters.Auto
;
import
com.pcloud.analysisengine.qrcode.dto.BookTimeSourceDto
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
...
...
@@ -107,6 +106,7 @@ import com.pcloud.book.group.tools.SendWeixinRequestTools;
import
com.pcloud.book.mq.producer.BookMQProducer
;
import
com.pcloud.book.rightsSetting.mapper.RightsSettingBookRelationMapper
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.book.util.common.YesOrNoEnums
;
import
com.pcloud.channelcenter.qrcode.dto.QrcodeLocationDto
;
import
com.pcloud.channelcenter.qrcode.dto.QrcodeSceneDto
;
import
com.pcloud.channelcenter.qrcode.entity.QrcodeLabel
;
...
...
@@ -2371,7 +2371,7 @@ public class BookBizImpl implements BookBiz {
@Override
public
PageBeanNew
<
BookDto
>
getAdviserBooks4Rights
(
String
keyword
,
Long
agentId
,
Long
templetId
,
Long
secondTempletId
,
String
typeCode
,
Integer
currentPage
,
Integer
numPerPag
e
)
{
Integer
currentPage
,
Integer
numPerPage
,
Integer
isIgnor
e
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"keyword"
,
keyword
);
map
.
put
(
"templetId"
,
templetId
);
...
...
@@ -2391,9 +2391,11 @@ public class BookBizImpl implements BookBiz {
map
.
put
(
"adviserIds4Name"
,
adviserIds
);
}
//获取已被权益选择的书刊
List
<
Long
>
bookIds
=
rightsSettingBookRelationMapper
.
getAllBookIds
();
if
(!
ListUtils
.
isEmpty
(
bookIds
)){
map
.
put
(
"ignoreBookIds"
,
bookIds
);
if
((
null
==
isIgnore
)
||
YesOrNoEnums
.
NO
.
getValue
().
equals
(
isIgnore
))
{
List
<
Long
>
bookIds
=
rightsSettingBookRelationMapper
.
getAllBookIds
();
if
(!
ListUtils
.
isEmpty
(
bookIds
)){
map
.
put
(
"ignoreBookIds"
,
bookIds
);
}
}
PageBeanNew
<
BookDto
>
page
=
bookDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"getAdviserBooks4Rights"
);
fillBookInfo
(
page
.
getRecordList
());
...
...
pcloud-service-book/src/main/java/com/pcloud/book/book/facade/impl/BookFacadeImpl.java
View file @
5eb18bfc
...
...
@@ -1072,6 +1072,7 @@ public class BookFacadeImpl implements BookFacade {
@RequestParam
(
value
=
"templetId"
,
required
=
false
)
Long
templetId
,
@RequestParam
(
value
=
"secondTempletId"
,
required
=
false
)
Long
secondTempletId
,
@RequestParam
(
value
=
"typeCode"
,
required
=
false
)
String
typeCode
,
@RequestParam
(
value
=
"isIgnore"
,
required
=
false
)
Integer
isIgnore
,
@RequestParam
(
value
=
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
...
...
@@ -1079,7 +1080,7 @@ public class BookFacadeImpl implements BookFacade {
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
return
new
ResponseDto
<>(
bookBiz
.
getAdviserBooks4Rights
(
keyword
,
agentId
,
templetId
,
secondTempletId
,
typeCode
,
currentPage
,
numPerPage
));
return
new
ResponseDto
<>(
bookBiz
.
getAdviserBooks4Rights
(
keyword
,
agentId
,
templetId
,
secondTempletId
,
typeCode
,
currentPage
,
numPerPage
,
isIgnore
));
}
@Override
...
...
pcloud-service-book/src/main/java/com/pcloud/book/consumer/reader/ReaderConsr.java
View file @
5eb18bfc
package
com
.
pcloud
.
book
.
consumer
.
reader
;
import
cn.hutool.core.collection.CollUtil
;
import
com.pcloud.book.
base.exception.BookBizException
;
import
com.pcloud.book.
applet.dto.SpecialBookDTO
;
import
com.pcloud.channelcenter.base.exceptions.ChannelBizException
;
import
com.pcloud.readercenter.wechat.dto.NickNameAndOpenIdDto
;
import
java.util.ArrayList
;
...
...
@@ -12,6 +12,8 @@ import java.util.stream.Collectors;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.readercenter.wechat.dto.SpecialBookDTO4Reader
;
import
com.pcloud.readercenter.wechat.dto.SpecialBookQueryDTO4Reader
;
import
com.pcloud.usercenter.party.agent.dto.AgentCity
;
import
com.pcloud.usercenter.party.agent.service.AgentService
;
import
org.slf4j.Logger
;
...
...
@@ -30,7 +32,6 @@ import com.pcloud.readercenter.wechat.dto.ReaderMessageDto;
import
com.pcloud.readercenter.wechat.dto.WechatUserRobotDto
;
import
com.pcloud.readercenter.wechat.entity.WechatUser
;
import
com.pcloud.readercenter.wechat.service.WechatUserService
;
import
org.springframework.web.bind.annotation.RequestParam
;
/**
* @author lily
...
...
@@ -246,6 +247,30 @@ public class ReaderConsr {
}
return
count
;
}
public
Map
<
Long
,
SpecialBookDTO4Reader
>
getAppletStatisticsMap
(
SpecialBookQueryDTO4Reader
specialBookQueryDTO
)
{
LOGGER
.
info
(
"小程序用户统计数据"
);
Map
<
Long
,
SpecialBookDTO4Reader
>
map
=
new
HashMap
<>();
try
{
map
=
ResponseHandleUtil
.
parseMapResponse
(
wechatUserService
.
getAppletStatisticsMap
(
specialBookQueryDTO
),
Long
.
class
,
SpecialBookDTO4Reader
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"小程序用户统计数据.[getAppletStatisticsMap]失败"
+
e
.
getMessage
(),
e
);
}
return
map
;
}
public
List
<
Long
>
getWechatUserByNameOrId
(
String
wechatUser
)
{
LOGGER
.
info
(
"根据名称或id获取用户id"
);
List
<
Long
>
wechatUserIds
=
new
ArrayList
<>();
try
{
wechatUserIds
=
ResponseHandleUtil
.
parseList
(
wechatUserService
.
getWechatUserByNameOrId
(
wechatUser
),
Long
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"根据名称或id获取用户id.[getWechatUserByNameOrId]失败"
+
e
.
getMessage
(),
e
);
}
return
wechatUserIds
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
View file @
5eb18bfc
...
...
@@ -3,6 +3,7 @@ package com.pcloud.book.consumer.wechatgroup;
import
com.dcg.coolq.sdk.CoolQSDK
;
import
com.dcg.coolq.sdk.message.vos.send.PrivateMsgSendVO
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.pcloud.book.applet.dto.SpecialBookDTO
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.exceptions.BizException
;
...
...
@@ -16,6 +17,8 @@ import com.pcloud.wechatgroup.group.dto.GroupRobotDTO;
import
com.pcloud.wechatgroup.group.dto.GroupUserCountDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupUserDTO
;
import
com.pcloud.wechatgroup.group.dto.RobotReplyDTO
;
import
com.pcloud.wechatgroup.group.dto.SpecialBookDTO4WG
;
import
com.pcloud.wechatgroup.group.dto.SpecialBookQueryDTO4WG
;
import
com.pcloud.wechatgroup.group.service.GroupMemberService
;
import
com.pcloud.wechatgroup.message.dto.BrandParamDTO
;
import
com.pcloud.wechatgroup.message.dto.GroupChatCountDTO
;
...
...
@@ -777,4 +780,16 @@ public class WechatGroupConsr {
}
return
bookGroupId
;
}
public
Map
<
Long
,
SpecialBookDTO4WG
>
getIntroductionPagePVAndUvMap
(
SpecialBookQueryDTO4WG
specialBookQueryDTO
)
{
log
.
info
(
"批量获取落地页统计数据"
);
Map
<
Long
,
SpecialBookDTO4WG
>
map
=
new
HashMap
<>();
try
{
map
=
ResponseHandleUtil
.
parseMapResponse
(
groupMemberService
.
getIntroductionPagePVAndUvMap
(
specialBookQueryDTO
),
Long
.
class
,
SpecialBookDTO4WG
.
class
);
}
catch
(
Exception
e
)
{
log
.
error
(
"批量获取落地页统计数据.[getIntroductionPagePVAndUvMap]失败"
+
e
.
getMessage
(),
e
);
}
return
map
;
}
}
pcloud-service-book/src/main/resources/application.yml
View file @
5eb18bfc
...
...
@@ -5,8 +5,8 @@ server:
eureka
:
instance
:
status-page-url-path
:
/book/v1.0/swagger-ui.html
#
client:
# register-with-eureka: fals
e #禁止自己当做服务注册
client
:
register-with-eureka
:
tru
e
#禁止自己当做服务注册
spring
:
application
:
...
...
pcloud-service-book/src/main/resources/mapper/applet/AppletThirdResourcesClickMapper.xml
View file @
5eb18bfc
...
...
@@ -91,5 +91,49 @@
where a.Date between DATE_SUB(CURDATE(), INTERVAL 30 DAY) and DATE_SUB(CURDATE(),INTERVAL 1 DAY))b ON b.createDate = aa.createDate
ORDER BY b.createDate asc
</select>
<select
id=
"listThirdResourceRecord"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.dto.ThirdResourceRecordDTO"
>
select
a.id,
a.wechat_user_id wechatUserId,
a.third_resources_id thirdResourceId,
a.record_type recordType,
a.create_time createTime,
b.url_number urlNumber,
a.news_id newsId,
a.booK_id bookId,
a.adviser_id adviserId,
c.book_name bookName,
c.isbn
from
applet_thirdresources_click_record a
left join
applet_news b on a.news_id = b.id
left join
book c on a.book_id = c.BOOK_ID
<where>
a.book_id is not null and a.third_resources_id = #{thirdResourceId}
<if
test=
"queryName != null"
>
and (
c.book_name like concat("%",#{queryName},"%")
or
c.isbn like concat("%",#{queryName},"%")
)
</if>
<if
test=
"wechatUserIds != null"
>
and
a.wechat_user_id in
<foreach
collection=
"wechatUserIds"
item=
"item"
index=
"index"
open=
"("
close=
")"
separator=
","
>
${item}
</foreach>
</if>
<if
test=
"recordType != null"
>
and a.record_type = #{recordType}
</if>
</where>
order by a.create_time desc
</select>
</mapper>
pcloud-service-book/src/main/resources/mapper/applet/SpecialBook.Mapper.xml
0 → 100644
View file @
5eb18bfc
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.pcloud.book.applet.dao.impl.SpecialBookDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.applet.entity.SpecialBook"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"book_id"
property=
"bookId"
jdbcType=
"BIGINT"
/>
<result
column=
"adviser_id"
property=
"adviserId"
jdbcType=
"BIGINT"
/>
<result
column=
"channel_id"
property=
"channelId"
jdbcType=
"BIGINT"
/>
<result
column=
"is_delete"
property=
"isDelete"
jdbcType=
"INTEGER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<resultMap
id=
"BaseDTOResultMap"
type=
"com.pcloud.book.applet.dto.SpecialBookDTO"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"book_id"
property=
"bookId"
jdbcType=
"BIGINT"
/>
<result
column=
"adviser_id"
property=
"adviserId"
jdbcType=
"BIGINT"
/>
<result
column=
"channel_id"
property=
"channelId"
jdbcType=
"BIGINT"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, book_id, adviser_id, channel_id, is_delete, create_time, update_time
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM special_book
WHERE id = #{id}
</select>
<select
id=
"getList"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM special_book
</select>
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
INSERT INTO special_book(
book_id,
adviser_id,
channel_id,
is_delete,
create_time,
update_time
) VALUES (
#{bookId, jdbcType=BIGINT},
#{adviserId, jdbcType=BIGINT},
#{channelId, jdbcType=BIGINT},
0,
now(),
now()
)
</insert>
<insert
id=
"batchInsert"
>
INSERT INTO special_book (
book_id,
adviser_id,
channel_id,
is_delete,
create_time,
update_time
) VALUES
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(
#{item.bookId, jdbcType=BIGINT},
#{item.adviserId, jdbcType=BIGINT},
#{item.channelId, jdbcType=BIGINT},
0 ,
now(),
now()
)
</foreach>
</insert>
<!--通过主键修改数据-->
<update
id=
"update"
>
UPDATE special_book
<set>
<if
test=
"bookId != null"
>
book_id = #{bookId},
</if>
<if
test=
"adviserId != null"
>
adviser_id = #{adviserId},
</if>
<if
test=
"channelId != null"
>
channel_id = #{channelId},
</if>
<if
test=
"isDelete != null"
>
is_delete = #{isDelete},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
</set>
WHERE id = #{id}
</update>
<!--通过主键删除-->
<delete
id=
"deleteById"
>
DELETE FROM special_book where id = #{id}
</delete>
<select
id=
"listSpecialBook"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.dto.SpecialBookDTO"
>
SELECT
a.id,
a.book_id bookId,
b.book_name bookName,
a.adviser_id adviserId,
a.channel_id channelId,
b.isbn,
c.id bookGroupId,
c.group_qrcode_url bookGroupUrl
FROM special_book a
left join book b on a.book_id = b.book_id
left join book_group c on a.book_id = c.book_id and a.channel_id = c.channel_id and c.is_delete = 0
where
a.is_delete = 0
<if
test=
"queryName != null"
>
and (
b.book_name like concat("%",#{queryName},"%")
or
b.isbn like concat("%",#{queryName},"%")
)
</if>
</select>
<select
id=
"listByBookIds"
parameterType=
"list"
resultType=
"com.pcloud.book.applet.entity.SpecialBook"
>
select
a.id,
a.book_id bookId,
b.book_name bookName
from
special_book a
left join book b on a.book_id = b.book_id
where
a.book_id
in
<foreach
collection=
"list"
index=
"index"
item=
"item"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
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