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
dab59d36
Commit
dab59d36
authored
Feb 19, 2020
by
阮思源
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat-1002383' into 'master'
1002383 书单服务页2处(个人号回复、H5技能页)设计 See merge request rays/pcloud-book!433
parents
1ea6fa34
c7168f2a
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
1409 additions
and
4 deletions
+1409
-4
BookDto.java
...-book/src/main/java/com/pcloud/book/book/dto/BookDto.java
+14
-0
BookBiz.java
...-book/src/main/java/com/pcloud/book/book/biz/BookBiz.java
+10
-0
SearchBiz.java
...ook/src/main/java/com/pcloud/book/book/biz/SearchBiz.java
+34
-0
BookBizImpl.java
.../main/java/com/pcloud/book/book/biz/impl/BookBizImpl.java
+77
-0
SearchBizImpl.java
...ain/java/com/pcloud/book/book/biz/impl/SearchBizImpl.java
+400
-0
BookDao.java
...-book/src/main/java/com/pcloud/book/book/dao/BookDao.java
+2
-0
HotBookDao.java
...ok/src/main/java/com/pcloud/book/book/dao/HotBookDao.java
+14
-0
SearchRecordDao.java
...c/main/java/com/pcloud/book/book/dao/SearchRecordDao.java
+12
-0
BookDaoImpl.java
.../main/java/com/pcloud/book/book/dao/impl/BookDaoImpl.java
+7
-0
HotBookDaoImpl.java
...in/java/com/pcloud/book/book/dao/impl/HotBookDaoImpl.java
+31
-0
SearchRecordDaoImpl.java
...va/com/pcloud/book/book/dao/impl/SearchRecordDaoImpl.java
+22
-0
HotBook.java
...ok/src/main/java/com/pcloud/book/book/entity/HotBook.java
+34
-0
SearchRecord.java
...c/main/java/com/pcloud/book/book/entity/SearchRecord.java
+42
-0
BookFacade.java
...src/main/java/com/pcloud/book/book/facade/BookFacade.java
+23
-0
SearchFacade.java
...c/main/java/com/pcloud/book/book/facade/SearchFacade.java
+120
-0
BookFacadeImpl.java
...java/com/pcloud/book/book/facade/impl/BookFacadeImpl.java
+34
-0
SearchFacadeImpl.java
...va/com/pcloud/book/book/facade/impl/SearchFacadeImpl.java
+205
-0
SearchBookVO.java
...k/src/main/java/com/pcloud/book/book/vo/SearchBookVO.java
+32
-0
BookKeywordBizImpl.java
...com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
+58
-4
Book.Mapper.xml
...rvice-book/src/main/resources/mapper/book/Book.Mapper.xml
+84
-0
HotBook.xml
...d-service-book/src/main/resources/mapper/book/HotBook.xml
+66
-0
SearchRecord.xml
...vice-book/src/main/resources/mapper/book/SearchRecord.xml
+88
-0
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/book/dto/BookDto.java
View file @
dab59d36
...
...
@@ -513,6 +513,11 @@ public class BookDto extends BaseDto {
private
Long
secondTempletId
;
/**
* 第二类型名称
*/
private
String
secondTempletName
;
/**
* 第二级类型typeCode
*/
private
String
secondTypeCode
;
...
...
@@ -1442,6 +1447,14 @@ public class BookDto extends BaseDto {
this
.
secondTempletId
=
secondTempletId
;
}
public
String
getSecondTempletName
()
{
return
secondTempletName
;
}
public
void
setSecondTempletName
(
String
secondTempletName
)
{
this
.
secondTempletName
=
secondTempletName
;
}
public
String
getSecondTypeCode
()
{
return
secondTypeCode
;
}
...
...
@@ -1760,6 +1773,7 @@ public class BookDto extends BaseDto {
", totalIncome="
+
totalIncome
+
", groupQrcodeLink='"
+
groupQrcodeLink
+
'\''
+
", secondTempletId="
+
secondTempletId
+
", secondTempletName='"
+
secondTempletName
+
'\''
+
", secondTypeCode='"
+
secondTypeCode
+
'\''
+
", registerNum="
+
registerNum
+
", registerRate="
+
registerRate
+
...
...
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/BookBiz.java
View file @
dab59d36
...
...
@@ -611,4 +611,14 @@ public interface BookBiz {
* @return
*/
List
<
Long
>
getBookIdsByBookName
(
String
bookName
);
/**
* 平台端获取编辑书刊
*/
PageBeanNew
<
BookDto
>
getAdviserBooks4Pcloud
(
String
keyword
,
Long
agentId
,
Long
templetId
,
Long
secondTempletId
,
String
typeCode
,
Integer
currentPage
,
Integer
numPerPage
);
/**
* 获取编辑书刊H5
*/
PageBeanNew
<
BookDto
>
getAdviserBooks4H5
(
String
keyword
,
Long
templetId
,
Long
secondTempletId
,
Integer
currentPage
,
Integer
numPerPage
);
}
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/SearchBiz.java
0 → 100644
View file @
dab59d36
package
com
.
pcloud
.
book
.
book
.
biz
;
import
com.pcloud.book.book.entity.HotBook
;
import
com.pcloud.book.book.entity.SearchRecord
;
import
com.pcloud.book.book.vo.SearchBookVO
;
import
com.pcloud.common.page.PageBeanNew
;
import
java.util.List
;
public
interface
SearchBiz
{
void
createHotBook
(
HotBook
hotBook
);
void
deleteHotBook
(
Long
id
);
PageBeanNew
<
HotBook
>
getHotBookList
(
Integer
currentPage
,
Integer
numPerPage
);
void
updateHotBookSeqNum
(
HotBook
hotBook
);
void
createSearchRecord4H5
(
SearchRecord
searchRecord
);
PageBeanNew
<
SearchBookVO
>
getSearchList
(
String
content
,
Integer
currentPage
,
Integer
numPerPage
);
PageBeanNew
<
SearchRecord
>
getSearchRecordList
(
String
content
,
Long
bookId
,
Long
agentId
,
Integer
currentPage
,
Integer
numPerPage
);
PageBeanNew
<
SearchRecord
>
getUserSearchList4H5
(
String
wxId
,
Integer
currentPage
,
Integer
numPerPage
);
void
deleteUserSearchList4H5
(
String
wxId
);
void
exportSearchList
(
String
systemCode
,
Long
partyId
,
String
content
);
void
exportSearchRecordList
(
String
systemCode
,
Long
partyId
,
String
content
,
Long
bookId
,
Long
agentId
);
List
<
String
>
getBookSearchUserList4H5
(
Long
bookId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/impl/BookBizImpl.java
View file @
dab59d36
...
...
@@ -7,6 +7,7 @@ import com.google.common.collect.Lists;
import
com.google.common.collect.Maps
;
import
com.pcloud.analysisengine.qrcode.dto.BookTimeSourceDto
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.appcenter.base.exception.AppBizException
;
import
com.pcloud.book.base.enums.BookFreezeEnum
;
import
com.pcloud.book.base.enums.BookStatusEnum
;
...
...
@@ -80,6 +81,7 @@ import com.pcloud.common.utils.string.StringUtil;
import
com.pcloud.commoncenter.export.dto.ExportDto
;
import
com.pcloud.commoncenter.export.service.ExportService
;
import
com.pcloud.settlementcenter.record.exceptions.RecordException
;
import
com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
...
...
@@ -1918,4 +1920,79 @@ public class BookBizImpl implements BookBiz {
}
return
bookIds
;
}
@ParamLog
(
"平台端获取编辑书刊"
)
@Override
public
PageBeanNew
<
BookDto
>
getAdviserBooks4Pcloud
(
String
keyword
,
Long
agentId
,
Long
templetId
,
Long
secondTempletId
,
String
typeCode
,
Integer
currentPage
,
Integer
numPerPage
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"keyword"
,
keyword
);
map
.
put
(
"templetId"
,
templetId
);
map
.
put
(
"secondTempletId"
,
secondTempletId
);
map
.
put
(
"typeCode"
,
typeCode
);
if
(
agentId
!=
null
){
List
<
Long
>
adviserIds
=
adviserConsr
.
getIdsByNameAndAgentId
(
agentId
,
null
);
if
(
ListUtils
.
isEmpty
(
adviserIds
)){
map
.
put
(
"adviserIds"
,
Arrays
.
asList
(-
1L
));
}
else
{
map
.
put
(
"adviserIds"
,
adviserIds
);
}
}
PageBeanNew
<
BookDto
>
page
=
bookDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"getAdviserBooks4Pcloud"
);
fillBookInfo
(
page
.
getRecordList
());
return
page
;
}
@ParamLog
(
"获取编辑书刊H5"
)
@Override
public
PageBeanNew
<
BookDto
>
getAdviserBooks4H5
(
String
keyword
,
Long
templetId
,
Long
secondTempletId
,
Integer
currentPage
,
Integer
numPerPage
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"keyword"
,
keyword
);
map
.
put
(
"templetId"
,
templetId
);
map
.
put
(
"secondTempletId"
,
secondTempletId
);
PageBeanNew
<
BookDto
>
page
=
bookDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"getAdviserBooks4H5"
);
fillBookInfo
(
page
.
getRecordList
());
return
page
;
}
@ParamLog
(
"填充书刊信息"
)
private
void
fillBookInfo
(
List
<
BookDto
>
list
)
{
if
(
ListUtils
.
isEmpty
(
list
)){
return
;
}
//填充出版社信息
List
<
Long
>
adviserIds
=
list
.
stream
().
filter
(
s
->
s
.
getAdviserId
()!=
null
).
map
(
BookDto:
:
getAdviserId
).
distinct
().
collect
(
Collectors
.
toList
());
Map
<
Long
,
AdviserBaseInfoDto
>
infoDtoMap
=
adviserConsr
.
getAdviserId2AdviserInfoDtoMap
(
adviserIds
);
List
<
Long
>
templetIds
=
new
ArrayList
<>();
list
.
forEach
(
BookDto
->
{
if
(
Objects
.
nonNull
(
BookDto
.
getTempletId
()))
{
templetIds
.
add
(
BookDto
.
getTempletId
());
}
if
(
Objects
.
nonNull
(
BookDto
.
getSecondTempletId
()))
{
templetIds
.
add
(
BookDto
.
getSecondTempletId
());
}
});
Map
<
Long
,
AssistTempletDTO
>
assistTempletDTOMap
=
assistTempletConsr
.
mapByIds
(
templetIds
);
list
.
forEach
(
bookDto
->
{
Long
secondTempletId
=
bookDto
.
getSecondTempletId
();
Long
templetId
=
bookDto
.
getTempletId
();
if
(
secondTempletId
!=
null
&&
assistTempletDTOMap
!=
null
)
{
AssistTempletDTO
templetDTO
=
assistTempletDTOMap
.
get
(
secondTempletId
);
bookDto
.
setSecondTempletName
(
Optional
.
ofNullable
(
templetDTO
).
map
(
AssistTempletDTO:
:
getTempletName
).
orElse
(
null
));
}
if
(
templetId
!=
null
&&
assistTempletDTOMap
!=
null
)
{
AssistTempletDTO
templetDTO
=
assistTempletDTOMap
.
get
(
templetId
);
bookDto
.
setTempletName
(
Optional
.
ofNullable
(
templetDTO
).
map
(
AssistTempletDTO:
:
getTempletName
).
orElse
(
null
));
}
Long
adviserId
=
bookDto
.
getAdviserId
();
if
(
infoDtoMap
!=
null
){
AdviserBaseInfoDto
infoDto
=
infoDtoMap
.
get
(
adviserId
);
if
(
infoDto
!=
null
){
bookDto
.
setAgentId
(
infoDto
.
getAgentId
());
bookDto
.
setAgentName
(
infoDto
.
getAgentName
());
}
}
});
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/impl/SearchBizImpl.java
0 → 100644
View file @
dab59d36
package
com
.
pcloud
.
book
.
book
.
biz
.
impl
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.biz.SearchBiz
;
import
com.pcloud.book.book.dao.HotBookDao
;
import
com.pcloud.book.book.dao.SearchRecordDao
;
import
com.pcloud.book.book.entity.HotBook
;
import
com.pcloud.book.book.entity.SearchRecord
;
import
com.pcloud.book.book.vo.SearchBookVO
;
import
com.pcloud.book.consumer.common.ExportConsr
;
import
com.pcloud.book.consumer.message.MessageConsr
;
import
com.pcloud.book.consumer.user.AdviserConsr
;
import
com.pcloud.book.consumer.user.AgentConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.common.core.aspect.ParamLog
;
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.string.StringUtil
;
import
com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto
;
import
com.pcloud.wechatgroup.group.dto.GroupUserDTO
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Component
(
"searchBiz"
)
public
class
SearchBizImpl
implements
SearchBiz
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
SearchBizImpl
.
class
);
@Autowired
private
HotBookDao
hotBookDao
;
@Autowired
private
SearchRecordDao
searchRecordDao
;
@Autowired
private
AdviserConsr
adviserConsr
;
@Autowired
private
AgentConsr
agentConsr
;
@Autowired
private
WechatGroupConsr
wechatGroupConsr
;
@Autowired
private
ExportConsr
exportConsr
;
@Autowired
private
MessageConsr
messageConsr
;
private
String
[]
headUrls
=
{
"https://oss.5rs.me/oss/upload/image/jpg/3a11ab4cf6c947e38cda73d0aecccbb3.jpg"
,
"https://oss.5rs.me/oss/upload/image/jpg/704c18a6b3bf4e35a168e4f36033038f.jpg"
,
"https://oss.5rs.me/oss/upload/image/jpg/ae7e5553eccd4a16abeb1949dd1095b2.jpg"
,
"https://oss.5rs.me/oss/upload/image/jpg/308779222431415c9f48208a62e43537.jpg"
,
"https://oss.5rs.me/oss/upload/image/jpg/b43e6165354944be9f3d84d8a57a1a24.jpg"
,
"https://oss.5rs.me/oss/upload/image/jpg/9780da1a10e44c7eb0584742b7997e67.jpg"
,
"https://oss.5rs.me/oss/upload/image/jpg/db3cf67c60ef48088da829cf17f95114.jpg"
,
"https://oss.5rs.me/oss/upload/image/jpg/d9c36922f1de482ea540e46cff4ca3bd.jpg"
,
"https://oss.5rs.me/oss/upload/image/jpg/fffdd6d3d68e4b6da9c565026b37d05a.jpg"
,
"https://oss.5rs.me/oss/upload/image/jpg/d7784fdb585248c899fc5a1ca5f4ce48.jpg"
,
"https://oss.5rs.me/oss/upload/image/jpg/a3a1780e91114e3b824d2945c8d25c42.jpg"
,
"https://oss.5rs.me/oss/upload/image/jpg/2ab8eff973fc4e069127e1ea5d052afb.jpg"
,
"https://oss.5rs.me/oss/upload/image/jpg/056b36999a824e36b603792e7d36ae1b.jpg"
,
"https://oss.5rs.me/oss/upload/image/jpg/cbaad09bf69f4bf496c7f0a277e9a200.jpg"
,
"https://oss.5rs.me/oss/upload/image/jpg/c8a30b39734a4c29864f31f53c76002b.jpg"
,
"https://oss.5rs.me/oss/upload/image/jpg/ebbf5e67c4d0461ea0ef8ffd87a11ee1.jpg"
,
"https://oss.5rs.me/oss/upload/image/jpg/747eebb4c0654f45a2f0be72175f11b2.jpg"
,
"https://oss.5rs.me/oss/upload/image/jpg/03f36b5880d94d289ac62e35b0279db1.jpg"
,
"https://oss.5rs.me/oss/upload/image/jpg/272aaaff1894463da8f86911701a1464.jpg"
,
"https://oss.5rs.me/oss/upload/image/jpg/32f1950fe55849e4818aaff9eab79c41.jpg"
};
@ParamLog
(
"创建热门书"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
createHotBook
(
HotBook
hotBook
)
{
if
(
hotBook
==
null
||
hotBook
.
getBookId
()==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"热门书不能为空!"
);
}
Integer
maxSeqNum
=
hotBookDao
.
getMaxSeqNum
();
hotBook
.
setSeqNum
(
maxSeqNum
+
1
);
hotBookDao
.
insert
(
hotBook
);
}
@ParamLog
(
"刪除热门书"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
deleteHotBook
(
Long
id
)
{
if
(
id
==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"热门书id不能为空!"
);
}
hotBookDao
.
deleteById
(
id
);
}
@ParamLog
(
"获取热门书列表"
)
@Override
public
PageBeanNew
<
HotBook
>
getHotBookList
(
Integer
currentPage
,
Integer
numPerPage
)
{
if
(
currentPage
==
null
||
currentPage
<
0
||
numPerPage
==
null
||
numPerPage
<=
0
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"分页参数有误!"
);
}
PageBeanNew
<
HotBook
>
pageNew
=
hotBookDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
new
HashMap
<>(),
"getHotBookList"
);
List
<
HotBook
>
list
=
pageNew
.
getRecordList
();
//填充出版社信息
fillHotBookAgent
(
list
);
return
pageNew
;
}
@ParamLog
(
"填充书的出版社"
)
private
void
fillHotBookAgent
(
List
<
HotBook
>
list
)
{
if
(
ListUtils
.
isEmpty
(
list
)){
return
;
}
List
<
Long
>
adviserIds
=
list
.
stream
().
filter
(
s
->
s
.
getAdviserId
()!=
null
).
map
(
HotBook:
:
getAdviserId
).
distinct
().
collect
(
Collectors
.
toList
());
if
(
ListUtils
.
isEmpty
(
adviserIds
)){
return
;
}
Map
<
Long
,
AdviserBaseInfoDto
>
infoDtoMap
=
adviserConsr
.
getAdviserId2AdviserInfoDtoMap
(
adviserIds
);
for
(
HotBook
hotBook:
list
){
AdviserBaseInfoDto
infoDto
=
infoDtoMap
.
get
(
hotBook
.
getAdviserId
());
if
(
infoDto
!=
null
){
hotBook
.
setAgentId
(
infoDto
.
getAgentId
());
hotBook
.
setAgentName
(
infoDto
.
getAgentName
());
}
}
}
@ParamLog
(
"修改热门书排序值"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
updateHotBookSeqNum
(
HotBook
hotBook
)
{
if
(
hotBook
==
null
||
hotBook
.
getId
()==
null
||
hotBook
.
getSeqNum
()==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
hotBookDao
.
updateSeqNum
(
hotBook
.
getId
(),
hotBook
.
getSeqNum
());
}
@ParamLog
(
"创建搜索记录H5"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
createSearchRecord4H5
(
SearchRecord
searchRecord
)
{
if
(
searchRecord
==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数为空!"
);
}
if
(
StringUtil
.
isEmpty
(
searchRecord
.
getWxId
())){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"wxId不能为空!"
);
}
searchRecordDao
.
insert
(
searchRecord
);
}
@ParamLog
(
"获取热门搜索列表"
)
@Override
public
PageBeanNew
<
SearchBookVO
>
getSearchList
(
String
content
,
Integer
currentPage
,
Integer
numPerPage
)
{
if
(
currentPage
==
null
||
currentPage
<
0
||
numPerPage
==
null
||
numPerPage
<=
0
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"分页参数有误!"
);
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"content"
,
content
);
PageBeanNew
<
SearchBookVO
>
pageNew
=
searchRecordDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"getSearchList"
);
fillSearchAgent
(
pageNew
.
getRecordList
());
return
pageNew
;
}
@ParamLog
(
"导出热门搜索列表"
)
@Override
public
void
exportSearchList
(
String
systemCode
,
Long
partyId
,
String
content
)
{
ThreadPoolUtils
.
EXPORT_THREAD_POOL
.
execute
(()
->
{
try
{
Integer
count
=
getSearchList
(
content
,
0
,
1
).
getTotalCount
();
if
(
count
>
10000
)
{
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"数量超出限制,请添加筛选条件!"
);
}
List
<
SearchBookVO
>
list
=
new
ArrayList
<>();
Integer
cu
=
500
;
Integer
p
=
(
count
/
cu
)
+
1
;
for
(
int
i
=
0
;
i
<
p
;
i
++)
{
PageBeanNew
<
SearchBookVO
>
page
=
getSearchList
(
content
,
i
,
cu
);
list
.
addAll
(
page
.
getRecordList
());
}
//导出
exportSL
(
list
,
systemCode
,
partyId
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"exportSearchList+++content="
+
content
+
"systemCode="
+
systemCode
+
"partyId="
+
partyId
);
}
});
}
@ParamLog
(
"导出"
)
private
void
exportSL
(
List
<
SearchBookVO
>
list
,
String
systemCode
,
Long
partyId
)
{
if
(
ListUtils
.
isEmpty
(
list
))
{
return
;
}
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
for
(
int
i
=
0
,
size
=
list
.
size
();
i
<
size
;
i
++)
{
SearchBookVO
dto
=
list
.
get
(
i
);
Object
[]
obj
=
new
Object
[
4
];
obj
[
0
]
=
i
+
1
;
obj
[
1
]
=
dto
.
getContent
();
obj
[
2
]
=
dto
.
getSearchCount
();
obj
[
3
]
=
dto
.
getAgentName
();
dataList
.
add
(
obj
);
}
Date
date
=
new
Date
();
String
[]
rowsName
=
{
"序号"
,
"关键词搜书内容"
,
"搜索次数"
,
"出版社"
};
String
fileName
=
"用户实搜记录--"
+
DateUtils
.
getStrFormTime
(
"yyyyMMdd"
,
date
);
String
fileUrl
=
exportConsr
.
exportExcel
(
fileName
,
rowsName
,
dataList
);
String
letterType
=
"pcloud_book_download"
;
String
content
=
String
.
format
(
"{\"commitTime\":\"%s\",\"type\":\"%s\"}"
,
DateUtils
.
formatDate
(
date
),
fileName
);
messageConsr
.
sendLetter
(
partyId
,
partyId
,
content
,
systemCode
,
letterType
,
fileUrl
,
fileName
,
null
,
null
);
}
@ParamLog
(
"填充搜索记录出版社"
)
private
void
fillSearchAgent
(
List
<
SearchBookVO
>
list
)
{
if
(
ListUtils
.
isEmpty
(
list
)){
return
;
}
List
<
Long
>
agentIds
=
list
.
stream
().
filter
(
s
->
s
.
getAgentId
()!=
null
).
map
(
SearchBookVO:
:
getAgentId
).
distinct
().
collect
(
Collectors
.
toList
());
if
(
ListUtils
.
isEmpty
(
agentIds
)){
return
;
}
Map
<
Long
,
String
>
names
=
agentConsr
.
getNames
(
agentIds
);
for
(
SearchBookVO
searchBookVO:
list
){
if
(
searchBookVO
.
getAgentId
()!=
null
){
searchBookVO
.
setAgentName
(
names
.
get
(
searchBookVO
.
getAgentId
()));
}
}
}
@ParamLog
(
"获取某个热门搜索列表"
)
@Override
public
PageBeanNew
<
SearchRecord
>
getSearchRecordList
(
String
content
,
Long
bookId
,
Long
agentId
,
Integer
currentPage
,
Integer
numPerPage
)
{
if
(
currentPage
==
null
||
currentPage
<
0
||
numPerPage
==
null
||
numPerPage
<=
0
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"分页参数有误!"
);
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"content"
,
content
);
map
.
put
(
"bookId"
,
bookId
);
map
.
put
(
"agentId"
,
agentId
);
PageBeanNew
<
SearchRecord
>
pageNew
=
searchRecordDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"getSearchRecordList"
);
fillAgentAndWxInfo
(
pageNew
.
getRecordList
());
return
pageNew
;
}
@ParamLog
(
"导出某个热门搜索列表"
)
@Override
public
void
exportSearchRecordList
(
String
systemCode
,
Long
partyId
,
String
content
,
Long
bookId
,
Long
agentId
)
{
ThreadPoolUtils
.
EXPORT_THREAD_POOL
.
execute
(()
->
{
try
{
Integer
count
=
getSearchRecordList
(
content
,
bookId
,
agentId
,
0
,
1
).
getTotalCount
();
if
(
count
>
10000
)
{
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"数量超出限制,请添加筛选条件!"
);
}
List
<
SearchRecord
>
list
=
new
ArrayList
<>();
Integer
cu
=
500
;
Integer
p
=
(
count
/
cu
)
+
1
;
for
(
int
i
=
0
;
i
<
p
;
i
++)
{
PageBeanNew
<
SearchRecord
>
page
=
getSearchRecordList
(
content
,
bookId
,
agentId
,
i
,
cu
);
list
.
addAll
(
page
.
getRecordList
());
}
//导出
exportSRL
(
list
,
systemCode
,
partyId
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"exportSearchRecordList+++content="
+
content
+
"bookId="
+
bookId
+
"agentId="
+
agentId
+
"systemCode="
+
systemCode
+
"partyId="
+
partyId
);
}
});
}
@ParamLog
(
"获取搜索书籍的用户头像H5"
)
@Override
public
List
<
String
>
getBookSearchUserList4H5
(
Long
bookId
)
{
List
<
String
>
wxIds
=
searchRecordDao
.
getRecent5WxIds
(
bookId
);
List
<
String
>
headPics
=
new
ArrayList
<>();
if
(!
ListUtils
.
isEmpty
(
wxIds
)){
Map
<
String
,
GroupUserDTO
>
userDTOMap
=
wechatGroupConsr
.
mapWxUserInfoByWxIdList
(
wxIds
);
for
(
String
wxId:
wxIds
){
GroupUserDTO
userDTO
=
userDTOMap
.
get
(
wxId
);
if
(
userDTO
!=
null
&&!
StringUtil
.
isEmpty
(
userDTO
.
getHeadPic
())){
headPics
.
add
(
userDTO
.
getHeadPic
());
}
}
}
int
size
=
headPics
.
size
();
int
limit
=
5
-
size
;
if
(
limit
>
0
){
//取几个补充
List
<
String
>
allHeads
=
Arrays
.
asList
(
headUrls
);
for
(
int
i
=
0
;
i
<
limit
;
)
{
Integer
index
=
(
int
)
(
Math
.
random
()
*
(
allHeads
.
size
()
-
1
));
String
url
=
allHeads
.
get
(
index
);
if
(!
headPics
.
contains
(
url
))
{
headPics
.
add
(
url
);
i
=
i
+
1
;
}
}
}
return
headPics
;
}
@ParamLog
(
"导出"
)
private
void
exportSRL
(
List
<
SearchRecord
>
list
,
String
systemCode
,
Long
partyId
)
{
if
(
ListUtils
.
isEmpty
(
list
))
{
return
;
}
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
for
(
int
i
=
0
,
size
=
list
.
size
();
i
<
size
;
i
++)
{
SearchRecord
dto
=
list
.
get
(
i
);
Object
[]
obj
=
new
Object
[
7
];
obj
[
0
]
=
i
+
1
;
obj
[
1
]
=
dto
.
getContent
();
obj
[
2
]
=
dto
.
getWxId
();
obj
[
3
]
=
dto
.
getNickName
();
Integer
sex
=
dto
.
getSex
();
if
(
sex
.
equals
(
new
Integer
(
0
))){
obj
[
4
]
=
"男"
;
}
else
if
(
sex
.
equals
(
new
Integer
(
1
))){
obj
[
4
]
=
"女"
;
}
else
{
obj
[
4
]
=
"未知"
;
}
obj
[
5
]
=
dto
.
getAgentName
();
Date
creatTime
=
dto
.
getCreateTime
();
obj
[
6
]
=
DateUtils
.
formatDate
(
creatTime
);
dataList
.
add
(
obj
);
}
Date
date
=
new
Date
();
String
[]
rowsName
=
{
"序号"
,
"搜索词"
,
"用户id"
,
"昵称"
,
"性别"
,
"出版社"
,
"读者输入时间"
};
String
fileName
=
"读者记录--"
+
DateUtils
.
getStrFormTime
(
"yyyyMMdd"
,
date
);
String
fileUrl
=
exportConsr
.
exportExcel
(
fileName
,
rowsName
,
dataList
);
String
letterType
=
"pcloud_book_download"
;
String
content
=
String
.
format
(
"{\"commitTime\":\"%s\",\"type\":\"%s\"}"
,
DateUtils
.
formatDate
(
date
),
fileName
);
messageConsr
.
sendLetter
(
partyId
,
partyId
,
content
,
systemCode
,
letterType
,
fileUrl
,
fileName
,
null
,
null
);
}
@ParamLog
(
"获取用户最近搜索列表H5"
)
@Override
public
PageBeanNew
<
SearchRecord
>
getUserSearchList4H5
(
String
wxId
,
Integer
currentPage
,
Integer
numPerPage
)
{
if
(
currentPage
==
null
||
currentPage
<
0
||
numPerPage
==
null
||
numPerPage
<=
0
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"分页参数有误!"
);
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wxId"
,
wxId
);
PageBeanNew
<
SearchRecord
>
page
=
searchRecordDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"getUserSearchList4H5"
);
return
page
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
"删除用户搜索记录H5"
)
@Override
public
void
deleteUserSearchList4H5
(
String
wxId
)
{
if
(
StringUtil
.
isEmpty
(
wxId
)){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
searchRecordDao
.
deleteByWxId
(
wxId
);
}
@ParamLog
(
"填充出版社和用户信息"
)
private
void
fillAgentAndWxInfo
(
List
<
SearchRecord
>
list
)
{
if
(
ListUtils
.
isEmpty
(
list
)){
return
;
}
List
<
Long
>
agentIds
=
new
ArrayList
<>();
List
<
String
>
wxIds
=
new
ArrayList
<>();
for
(
SearchRecord
record:
list
){
if
(
record
.
getAgentId
()!=
null
){
agentIds
.
add
(
record
.
getAgentId
());
}
if
(!
StringUtil
.
isEmpty
(
record
.
getWxId
())){
wxIds
.
add
(
record
.
getWxId
());
}
}
Map
<
Long
,
String
>
names
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
agentIds
)){
names
=
agentConsr
.
getNames
(
agentIds
);
}
Map
<
String
,
GroupUserDTO
>
userDTOMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
wxIds
)){
userDTOMap
=
wechatGroupConsr
.
mapWxUserInfoByWxIdList
(
wxIds
);
}
for
(
SearchRecord
searchRecord:
list
){
if
(
searchRecord
.
getAgentId
()!=
null
){
searchRecord
.
setAgentName
(
names
.
get
(
searchRecord
.
getAgentId
()));
}
if
(!
StringUtil
.
isEmpty
(
searchRecord
.
getWxId
())){
GroupUserDTO
userDTO
=
userDTOMap
.
get
(
searchRecord
.
getWxId
());
if
(
userDTO
!=
null
){
searchRecord
.
setHeadUrl
(
userDTO
.
getHeadPic
());
searchRecord
.
setNickName
(
userDTO
.
getNickName
());
searchRecord
.
setSex
(
userDTO
.
getSex
());
}
}
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/dao/BookDao.java
View file @
dab59d36
...
...
@@ -327,4 +327,6 @@ public interface BookDao extends BaseDao<Book> {
* @return
*/
List
<
Long
>
getBookIdsByBookName
(
String
bookName
);
BookDto
getAdviserBookByName
(
String
bookName
);
}
pcloud-service-book/src/main/java/com/pcloud/book/book/dao/HotBookDao.java
0 → 100644
View file @
dab59d36
package
com
.
pcloud
.
book
.
book
.
dao
;
import
com.pcloud.book.book.entity.HotBook
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
public
interface
HotBookDao
extends
BaseDao
<
HotBook
>
{
Integer
getMaxSeqNum
();
void
updateSeqNum
(
Long
id
,
Integer
seqNum
);
List
<
HotBook
>
getHotBookList
();
}
pcloud-service-book/src/main/java/com/pcloud/book/book/dao/SearchRecordDao.java
0 → 100644
View file @
dab59d36
package
com
.
pcloud
.
book
.
book
.
dao
;
import
com.pcloud.book.book.entity.SearchRecord
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
public
interface
SearchRecordDao
extends
BaseDao
<
SearchRecord
>
{
void
deleteByWxId
(
String
wxId
);
List
<
String
>
getRecent5WxIds
(
Long
bookId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/book/dao/impl/BookDaoImpl.java
View file @
dab59d36
...
...
@@ -321,4 +321,11 @@ public class BookDaoImpl extends BaseDaoImpl<Book> implements BookDao {
paramMap
.
put
(
"bookName"
,
bookName
);
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getBookIdsByBookName"
),
paramMap
);
}
@Override
public
BookDto
getAdviserBookByName
(
String
bookName
)
{
Map
<
String
,
Object
>
paramMap
=
Maps
.
newHashMap
();
paramMap
.
put
(
"bookName"
,
bookName
);
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getAdviserBookByName"
),
paramMap
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/dao/impl/HotBookDaoImpl.java
0 → 100644
View file @
dab59d36
package
com
.
pcloud
.
book
.
book
.
dao
.
impl
;
import
com.pcloud.book.book.dao.HotBookDao
;
import
com.pcloud.book.book.entity.HotBook
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Component
(
"hotBookDao"
)
public
class
HotBookDaoImpl
extends
BaseDaoImpl
<
HotBook
>
implements
HotBookDao
{
@Override
public
Integer
getMaxSeqNum
()
{
return
super
.
getSqlSession
().
selectOne
(
super
.
getStatement
(
"getMaxSeqNum"
));
}
@Override
public
void
updateSeqNum
(
Long
id
,
Integer
seqNum
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"id"
,
id
);
map
.
put
(
"seqNum"
,
seqNum
);
super
.
getSqlSession
().
update
(
super
.
getStatement
(
"updateSeqNum"
),
map
);
}
@Override
public
List
<
HotBook
>
getHotBookList
()
{
return
super
.
getSqlSession
().
selectList
(
super
.
getStatement
(
"getHotBookList"
));
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/dao/impl/SearchRecordDaoImpl.java
0 → 100644
View file @
dab59d36
package
com
.
pcloud
.
book
.
book
.
dao
.
impl
;
import
com.pcloud.book.book.dao.SearchRecordDao
;
import
com.pcloud.book.book.entity.SearchRecord
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
@Component
(
"searchRecordDao"
)
public
class
SearchRecordDaoImpl
extends
BaseDaoImpl
<
SearchRecord
>
implements
SearchRecordDao
{
@Override
public
void
deleteByWxId
(
String
wxId
)
{
super
.
getSqlSession
().
delete
(
super
.
getStatement
(
"deleteByWxId"
),
wxId
);
}
@Override
public
List
<
String
>
getRecent5WxIds
(
Long
bookId
)
{
return
super
.
getSqlSession
().
selectList
(
super
.
getStatement
(
"getRecent5WxIds"
),
bookId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/entity/HotBook.java
0 → 100644
View file @
dab59d36
package
com
.
pcloud
.
book
.
book
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
(
"热门书"
)
public
class
HotBook
extends
BaseEntity
{
@ApiModelProperty
(
"名称"
)
private
Long
bookId
;
@ApiModelProperty
(
"书名"
)
private
String
bookName
;
@ApiModelProperty
(
"排序值"
)
private
Integer
seqNum
;
@ApiModelProperty
(
"编辑id"
)
private
Long
adviserId
;
@ApiModelProperty
(
"出版社id"
)
private
Long
agentId
;
@ApiModelProperty
(
"出版社名称"
)
private
String
agentName
;
@ApiModelProperty
(
"搜索次数"
)
private
Integer
searchCount
;
}
pcloud-service-book/src/main/java/com/pcloud/book/book/entity/SearchRecord.java
0 → 100644
View file @
dab59d36
package
com
.
pcloud
.
book
.
book
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
(
"搜索记录"
)
public
class
SearchRecord
extends
BaseEntity
{
@ApiModelProperty
(
"搜索内容"
)
private
String
content
;
@ApiModelProperty
(
"书籍id"
)
private
Long
bookId
;
@ApiModelProperty
(
"书名"
)
private
String
bookName
;
@ApiModelProperty
(
"出版社id"
)
private
Long
agentId
;
@ApiModelProperty
(
"出版社名称"
)
private
String
agentName
;
@ApiModelProperty
(
"用户wxId"
)
private
String
wxId
;
@ApiModelProperty
(
"头像"
)
private
String
headUrl
;
@ApiModelProperty
(
"昵称"
)
private
String
nickName
;
@ApiModelProperty
(
"性别"
)
private
Integer
sex
;
@ApiModelProperty
(
"热门关键词id"
)
private
Long
hotBookId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/book/facade/BookFacade.java
View file @
dab59d36
...
...
@@ -681,4 +681,27 @@ public interface BookFacade {
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"平台端获取书刊列表"
)
@GetMapping
(
"getAdviserBooks4Pcloud"
)
ResponseDto
<?>
getAdviserBooks4Pcloud
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
,
@RequestParam
(
value
=
"agentId"
,
required
=
false
)
Long
agentId
,
@RequestParam
(
value
=
"templetId"
,
required
=
false
)
Long
templetId
,
@RequestParam
(
value
=
"secondTempletId"
,
required
=
false
)
Long
secondTempletId
,
@RequestParam
(
value
=
"typeCode"
,
required
=
false
)
String
typeCode
,
@RequestParam
(
value
=
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"获取书刊列表H5"
)
@GetMapping
(
"getAdviserBooks4H5"
)
ResponseDto
<?>
getAdviserBooks4H5
(
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
,
@RequestParam
(
value
=
"templetId"
,
required
=
false
)
Long
templetId
,
@RequestParam
(
value
=
"secondTempletId"
,
required
=
false
)
Long
secondTempletId
,
@RequestParam
(
value
=
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
;
}
pcloud-service-book/src/main/java/com/pcloud/book/book/facade/SearchFacade.java
0 → 100644
View file @
dab59d36
package
com
.
pcloud
.
book
.
book
.
facade
;
import
com.pcloud.book.book.entity.HotBook
;
import
com.pcloud.book.book.entity.SearchRecord
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.permission.PermissionException
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
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.RequestParam
;
@FeignClient
(
value
=
"pcloud-service-book"
,
qualifier
=
"searchFacadeCloud"
,
path
=
"search"
)
@Api
(
"书籍搜索"
)
public
interface
SearchFacade
{
@ApiOperation
(
"创建热门书"
)
@PostMapping
(
"createHotBook"
)
ResponseDto
<?>
createHotBook
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
HotBook
hotBook
)
throws
PermissionException
;
@ApiOperation
(
"删除热门书"
)
@GetMapping
(
"deleteHotBook"
)
ResponseDto
<?>
deleteHotBook
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"id"
)
Long
id
)
throws
PermissionException
;
@ApiOperation
(
"获取热门书PC"
)
@GetMapping
(
"getHotBookList4PC"
)
ResponseDto
<?>
getHotBookList4PC
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"获取热门书H5"
)
@GetMapping
(
"getHotBookList4H5"
)
ResponseDto
<?>
getHotBookList4H5
(
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"修改热门书排序值"
)
@PostMapping
(
"updateHotBookSeqNum"
)
ResponseDto
<?>
updateHotBookSeqNum
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
HotBook
hotBook
)
throws
PermissionException
;
@ApiOperation
(
"创建搜索记录H5"
)
@PostMapping
(
"createSearchRecord4H5"
)
ResponseDto
<?>
createSearchRecord4H5
(
@RequestBody
SearchRecord
searchRecord
)
throws
PermissionException
;
@ApiOperation
(
"获取热门搜索列表"
)
@GetMapping
(
"getSearchList"
)
ResponseDto
<?>
getSearchList
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
value
=
"content"
,
required
=
false
)
@ApiParam
(
"内容"
)
String
content
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"导出热门搜索列表"
)
@GetMapping
(
"exportSearchList"
)
ResponseDto
<?>
exportSearchList
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
value
=
"content"
,
required
=
false
)
@ApiParam
(
"内容"
)
String
content
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"获取某个热门搜索列表"
)
@GetMapping
(
"getSearchRecordList"
)
ResponseDto
<?>
getSearchRecordList
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
"content"
)
@ApiParam
(
"内容"
)
String
content
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
@ApiParam
(
"书id"
)
Long
bookId
,
@RequestParam
(
value
=
"agentId"
,
required
=
false
)
@ApiParam
(
"出版社id"
)
Long
agentId
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"导出某个热门搜索列表"
)
@GetMapping
(
"exportSearchRecordList"
)
ResponseDto
<?>
exportSearchRecordList
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
"content"
)
@ApiParam
(
"内容"
)
String
content
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
@ApiParam
(
"书id"
)
Long
bookId
,
@RequestParam
(
value
=
"agentId"
,
required
=
false
)
@ApiParam
(
"出版社id"
)
Long
agentId
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"获取用户最近搜索列表H5"
)
@GetMapping
(
"getUserSearchList4H5"
)
ResponseDto
<?>
getUserSearchList4H5
(
@RequestParam
(
"wxId"
)
@ApiParam
(
"用户id"
)
String
wxId
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"删除用户搜索记录H5"
)
@GetMapping
(
"deleteUserSearchList4H5"
)
ResponseDto
<?>
deleteUserSearchList4H5
(
@RequestParam
(
"wxId"
)
@ApiParam
(
"用户id"
)
String
wxId
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"获取搜索书籍的用户H5"
)
@GetMapping
(
"getBookSearchUserList4H5"
)
ResponseDto
<?>
getBookSearchUserList4H5
(
@RequestParam
(
"bookId"
)
@ApiParam
(
"书id"
)
Long
bookId
)
throws
BizException
,
PermissionException
;
}
pcloud-service-book/src/main/java/com/pcloud/book/book/facade/impl/BookFacadeImpl.java
View file @
dab59d36
...
...
@@ -855,6 +855,40 @@ public class BookFacadeImpl implements BookFacade {
return
new
ResponseDto
<>(
null
==
pageBean
?
new
PageBeanNew
<>()
:
pageBean
);
}
@GetMapping
(
"getAdviserBooks4Pcloud"
)
@Override
public
ResponseDto
<?>
getAdviserBooks4Pcloud
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
,
@RequestParam
(
value
=
"agentId"
,
required
=
false
)
Long
agentId
,
@RequestParam
(
value
=
"templetId"
,
required
=
false
)
Long
templetId
,
@RequestParam
(
value
=
"secondTempletId"
,
required
=
false
)
Long
secondTempletId
,
@RequestParam
(
value
=
"typeCode"
,
required
=
false
)
String
typeCode
,
@RequestParam
(
value
=
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
return
new
ResponseDto
<>(
bookBiz
.
getAdviserBooks4Pcloud
(
keyword
,
agentId
,
templetId
,
secondTempletId
,
typeCode
,
currentPage
,
numPerPage
));
}
@GetMapping
(
"getAdviserBooks4H5"
)
@Override
public
ResponseDto
<?>
getAdviserBooks4H5
(
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
,
@RequestParam
(
value
=
"templetId"
,
required
=
false
)
Long
templetId
,
@RequestParam
(
value
=
"secondTempletId"
,
required
=
false
)
Long
secondTempletId
,
@RequestParam
(
value
=
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
return
new
ResponseDto
<>(
bookBiz
.
getAdviserBooks4H5
(
keyword
,
templetId
,
secondTempletId
,
currentPage
,
numPerPage
));
}
@GetMapping
(
"getBookLabels"
)
@Override
public
ResponseDto
<?>
getBookLabels
(
...
...
pcloud-service-book/src/main/java/com/pcloud/book/book/facade/impl/SearchFacadeImpl.java
0 → 100644
View file @
dab59d36
package
com
.
pcloud
.
book
.
book
.
facade
.
impl
;
import
com.pcloud.book.book.biz.SearchBiz
;
import
com.pcloud.book.book.entity.HotBook
;
import
com.pcloud.book.book.entity.SearchRecord
;
import
com.pcloud.book.book.facade.SearchFacade
;
import
com.pcloud.common.core.constant.SystemCode
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
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
io.swagger.annotations.ApiParam
;
import
lombok.extern.slf4j.Slf4j
;
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.Map
;
@Slf4j
@RestController
(
"searchFacade"
)
@RequestMapping
(
"search"
)
public
class
SearchFacadeImpl
implements
SearchFacade
{
@Autowired
private
SearchBiz
searchBiz
;
@ApiOperation
(
"创建热门书"
)
@PostMapping
(
"createHotBook"
)
@Override
public
ResponseDto
<?>
createHotBook
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
HotBook
hotBook
)
throws
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
searchBiz
.
createHotBook
(
hotBook
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"删除热门书"
)
@GetMapping
(
"deleteHotBook"
)
@Override
public
ResponseDto
<?>
deleteHotBook
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"id"
)
Long
id
)
throws
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
searchBiz
.
deleteHotBook
(
id
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"获取热门书PC"
)
@GetMapping
(
"getHotBookList4PC"
)
@Override
public
ResponseDto
<?>
getHotBookList4PC
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
return
new
ResponseDto
<>(
searchBiz
.
getHotBookList
(
currentPage
,
numPerPage
));
}
@ApiOperation
(
"获取热门书H5"
)
@GetMapping
(
"getHotBookList4H5"
)
@Override
public
ResponseDto
<?>
getHotBookList4H5
(
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
return
new
ResponseDto
<>(
searchBiz
.
getHotBookList
(
currentPage
,
numPerPage
));
}
@ApiOperation
(
"修改热门书排序值"
)
@PostMapping
(
"updateHotBookSeqNum"
)
@Override
public
ResponseDto
<?>
updateHotBookSeqNum
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
HotBook
hotBook
)
throws
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
searchBiz
.
updateHotBookSeqNum
(
hotBook
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"创建搜索记录H5"
)
@PostMapping
(
"createSearchRecord4H5"
)
@Override
public
ResponseDto
<?>
createSearchRecord4H5
(
@RequestBody
SearchRecord
searchRecord
)
throws
PermissionException
{
searchBiz
.
createSearchRecord4H5
(
searchRecord
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"获取热门搜索列表"
)
@GetMapping
(
"getSearchList"
)
@Override
public
ResponseDto
<?>
getSearchList
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
value
=
"content"
,
required
=
false
)
@ApiParam
(
"内容"
)
String
content
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
return
new
ResponseDto
<>(
searchBiz
.
getSearchList
(
content
,
currentPage
,
numPerPage
));
}
@ApiOperation
(
"导出热门搜索列表"
)
@GetMapping
(
"exportSearchList"
)
@Override
public
ResponseDto
<?>
exportSearchList
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
value
=
"content"
,
required
=
false
)
@ApiParam
(
"内容"
)
String
content
)
throws
BizException
,
PermissionException
{
String
systemCode
=
(
String
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
SYSTEM_CODE
);
if
(!
SystemCode
.
pcloud
.
code
.
equalsIgnoreCase
(
systemCode
))
{
throw
new
PermissionException
(
PermissionException
.
PERMISSION_NOT_FOUND
);
}
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
);
}
searchBiz
.
exportSearchList
(
systemCode
,
partyId
,
content
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"获取某个热门搜索列表"
)
@GetMapping
(
"getSearchRecordList"
)
@Override
public
ResponseDto
<?>
getSearchRecordList
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
"content"
)
@ApiParam
(
"内容"
)
String
content
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
@ApiParam
(
"书id"
)
Long
bookId
,
@RequestParam
(
value
=
"agentId"
,
required
=
false
)
@ApiParam
(
"出版社id"
)
Long
agentId
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
return
new
ResponseDto
<>(
searchBiz
.
getSearchRecordList
(
content
,
bookId
,
agentId
,
currentPage
,
numPerPage
));
}
@ApiOperation
(
"导出某个热门搜索列表"
)
@GetMapping
(
"exportSearchRecordList"
)
@Override
public
ResponseDto
<?>
exportSearchRecordList
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
"content"
)
@ApiParam
(
"内容"
)
String
content
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
@ApiParam
(
"书id"
)
Long
bookId
,
@RequestParam
(
value
=
"agentId"
,
required
=
false
)
@ApiParam
(
"出版社id"
)
Long
agentId
)
throws
BizException
,
PermissionException
{
String
systemCode
=
(
String
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
SYSTEM_CODE
);
if
(!
SystemCode
.
pcloud
.
code
.
equalsIgnoreCase
(
systemCode
))
{
throw
new
PermissionException
(
PermissionException
.
PERMISSION_NOT_FOUND
);
}
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
);
}
searchBiz
.
exportSearchRecordList
(
systemCode
,
partyId
,
content
,
bookId
,
agentId
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"获取用户最近搜索列表H5"
)
@GetMapping
(
"getUserSearchList4H5"
)
@Override
public
ResponseDto
<?>
getUserSearchList4H5
(
@RequestParam
(
"wxId"
)
@ApiParam
(
"用户id"
)
String
wxId
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
return
new
ResponseDto
<>(
searchBiz
.
getUserSearchList4H5
(
wxId
,
currentPage
,
numPerPage
));
}
@ApiOperation
(
"删除用户搜索记录H5"
)
@GetMapping
(
"deleteUserSearchList4H5"
)
@Override
public
ResponseDto
<?>
deleteUserSearchList4H5
(
@RequestParam
(
"wxId"
)
@ApiParam
(
"用户id"
)
String
wxId
)
throws
BizException
,
PermissionException
{
searchBiz
.
deleteUserSearchList4H5
(
wxId
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"获取搜索书籍的用户头像H5"
)
@GetMapping
(
"getBookSearchUserList4H5"
)
@Override
public
ResponseDto
<?>
getBookSearchUserList4H5
(
@RequestParam
(
"bookId"
)
@ApiParam
(
"书id"
)
Long
bookId
)
throws
BizException
,
PermissionException
{
return
new
ResponseDto
<>(
searchBiz
.
getBookSearchUserList4H5
(
bookId
));
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/vo/SearchBookVO.java
0 → 100644
View file @
dab59d36
package
com
.
pcloud
.
book
.
book
.
vo
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
@Data
@ApiModel
(
"搜索书名VO"
)
public
class
SearchBookVO
{
@ApiModelProperty
(
"内容"
)
private
String
content
;
@ApiModelProperty
(
"书id"
)
private
Long
bookId
;
@ApiModelProperty
(
"书名"
)
private
String
bookName
;
@ApiModelProperty
(
"出版社id"
)
private
Long
agentId
;
@ApiModelProperty
(
"出版社名称"
)
private
String
agentName
;
@ApiModelProperty
(
"搜索次数"
)
private
Integer
searchCount
;
}
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
View file @
dab59d36
...
...
@@ -7,11 +7,15 @@ import com.pcloud.appcenter.app.dto.AppDto;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.biz.BookKeywordWarehouseBiz
;
import
com.pcloud.book.book.dao.BookDao
;
import
com.pcloud.book.book.dao.SearchRecordDao
;
import
com.pcloud.book.book.dto.BookDto
;
import
com.pcloud.book.book.entity.SearchRecord
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.content.ResourceConsr
;
import
com.pcloud.book.consumer.live.LiveCons
;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.consumer.user.AdviserConsr
;
import
com.pcloud.book.consumer.user.ChannelConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.biz.BookGroupAppBiz
;
...
...
@@ -233,6 +237,10 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
private
PcloudRobotBiz
pcloudRobotBiz
;
@Autowired
private
PcloudRobotClassifyDao
pcloudRobotClassifyDao
;
@Autowired
private
SearchRecordDao
searchRecordDao
;
@Autowired
private
AdviserConsr
adviserConsr
;
/**
* 字符串切割长度
*/
...
...
@@ -573,10 +581,13 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
pcloudRobotBiz
.
handlePcloudTdReply
(
sendTextDTO
);
return
;
}
// 小睿对话索要出版社信息
boolean
_continue
=
replySelfKeywordTemplate
(
sendTextDTO
);
// 判断是否需要继续走下去
if
(!
_continue
)
{
return
;
}
// 读者发送书名
if
(!
StringUtil
.
isEmpty
(
sendTextDTO
.
getTextContent
())
&&
sendTextDTO
.
getTextContent
().
length
()>
1
&&
sendTextDTO
.
getTextContent
().
startsWith
(
"#"
)){
sendSearchBook
(
sendTextDTO
);
return
;
}
sendPcloudKeyword
(
sendTextDTO
,
pcloudRobot
);
return
;
}
...
...
@@ -591,6 +602,49 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
}
}
@ParamLog
(
"发送搜索书籍"
)
private
void
sendSearchBook
(
SendTextDTO
sendTextDTO
)
{
String
bookName
=
sendTextDTO
.
getTextContent
().
substring
(
1
);
BookDto
bookDto
=
bookDao
.
getAdviserBookByName
(
bookName
);
String
userWxId
=
sendTextDTO
.
getWechatUserId
();
String
ip
=
sendTextDTO
.
getIp
();
Integer
code
=
sendTextDTO
.
getCode
();
String
robotId
=
sendTextDTO
.
getWxId
();
if
(
bookDto
==
null
){
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
"如果这里没有你需要的,小睿深表歉意,小睿还在不断丰富阅读内容,提升阅读体验,一旦发现好东西就会快马加鞭分享给你的!"
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
code
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
String
h5link
=
wechatGroupLinkPrefix
+
"/dialog/search?wxId="
+
userWxId
+
"&robotWxId="
+
robotId
;
String
linkUrl
=
UrlUtils
.
getShortUrl4Own
(
h5link
);
linkUrl
=
"★"
+
linkUrl
+
"★"
;
sendTextMessageVO
.
setContent
(
"详情点击进入:"
+
linkUrl
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
else
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
code
);
String
h5link
=
wechatGroupLinkPrefix
+
"/dialog/resource?bookId="
+
bookDto
.
getBookId
()+
"&adviserId="
+
bookDto
.
getAdviserId
()+
"&channelId="
+
bookDto
.
getChannelId
()+
"&wxId="
+
userWxId
+
"&robotWxId="
+
robotId
;
String
linkUrl
=
UrlUtils
.
getShortUrl4Own
(
h5link
);
linkUrl
=
"★"
+
linkUrl
+
"★"
;
sendTextMessageVO
.
setContent
(
"详情点击进入:"
+
linkUrl
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
//插入触发记录
SearchRecord
searchRecord
=
new
SearchRecord
();
searchRecord
.
setContent
(
bookName
);
searchRecord
.
setBookId
(
bookDto
.
getBookId
());
searchRecord
.
setWxId
(
userWxId
);
Long
agentId
=
adviserConsr
.
getAgentIdByAdviser
(
bookDto
.
getAdviserId
());
searchRecord
.
setAgentId
(
agentId
);
searchRecordDao
.
insert
(
searchRecord
);
}
}
@ParamLog
(
"小睿根据书名推送匹配的资源"
)
private
boolean
replySelfKeywordTemplate
(
SendTextDTO
sendTextDTO
)
{
try
{
...
...
pcloud-service-book/src/main/resources/mapper/book/Book.Mapper.xml
View file @
dab59d36
...
...
@@ -2023,4 +2023,87 @@
b.BOOK_NAME LIKE CONCAT('%',#{bookName},'%')
LIMIT 0,50
</select>
<select
id=
"getAdviserBooks4Pcloud"
resultMap=
"bookMap"
parameterType=
"map"
>
SELECT
A.BOOK_ID, A.CHANNEL_ID, A.ADVISER_ID, A.IS_MAIN_EDITOR, T.TYPE_CODE, T.TYPE_NAME, B.ISBN, B.BOOK_NAME, B.REMARK,
B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.ORIGIN_NAME, B.BOOK_PRICE, B.ISSN, B.BOOK_NUM, B.SERIAL_NUMBER,
A.TEMPLET_ID,A.SECOND_TEMPLET_ID,A.LAST_MODIFIED_DATE LAST_MODIFIED_DATE,A.BOOK_ADVISER_ID,CONCAT('BK',A.BOOK_ID) uniqueNumber
FROM
BOOK_ADVISER A
INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID AND A.IS_DELETE = 0 AND B.IS_DELETE = 0
LEFT JOIN BOOK_TYPE T ON B.TYPE_CODE = T.TYPE_CODE
WHERE
1=1
AND A.IS_MAIN_EDITOR = 1
<if
test=
"typeCode!=null"
>
AND
B.TYPE_CODE = #{typeCode}
</if>
<if
test=
"keyword != null"
>
AND (B.BOOK_NAME LIKE CONCAT('%', #{keyword}, '%')
OR B.ISBN LIKE CONCAT(#{keyword},'%')
OR CONCAT('BK',A.BOOK_ID) = #{keyword})
</if>
<if
test=
"templetId != null"
>
AND
A.TEMPLET_ID = #{templetId}
</if>
<if
test=
"secondTempletId!=null "
>
AND
A.SECOND_TEMPLET_ID=#{secondTempletId}
</if>
<if
test=
"adviserIds!=null and adviserIds.size()>0"
>
AND
A.ADVISER_ID in
<foreach
collection=
"adviserIds"
item=
"item"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
</if>
GROUP BY A.BOOK_ID, A.CHANNEL_ID
ORDER BY
A.LAST_MODIFIED_DATE DESC
</select>
<select
id=
"getAdviserBooks4H5"
resultMap=
"bookMap"
parameterType=
"map"
>
SELECT
A.BOOK_ID, A.CHANNEL_ID, A.ADVISER_ID, A.IS_MAIN_EDITOR, T.TYPE_CODE, T.TYPE_NAME, B.ISBN, B.BOOK_NAME, B.REMARK,
B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.ORIGIN_NAME, B.BOOK_PRICE, B.ISSN, B.BOOK_NUM, B.SERIAL_NUMBER,
A.TEMPLET_ID,A.SECOND_TEMPLET_ID,A.LAST_MODIFIED_DATE LAST_MODIFIED_DATE,A.BOOK_ADVISER_ID,CONCAT('BK',A.BOOK_ID) uniqueNumber
FROM
BOOK_ADVISER A
INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID AND A.IS_DELETE = 0 AND B.IS_DELETE = 0
LEFT JOIN BOOK_TYPE T ON B.TYPE_CODE = T.TYPE_CODE
WHERE
1=1
AND A.IS_MAIN_EDITOR = 1
<if
test=
"keyword != null"
>
AND (B.BOOK_NAME LIKE CONCAT('%', #{keyword}, '%'))
</if>
<if
test=
"templetId != null"
>
AND
A.TEMPLET_ID = #{templetId}
</if>
<if
test=
"secondTempletId!=null "
>
AND
A.SECOND_TEMPLET_ID=#{secondTempletId}
</if>
GROUP BY A.BOOK_ID, A.CHANNEL_ID
ORDER BY
A.LAST_MODIFIED_DATE DESC
</select>
<select
id=
"getAdviserBookByName"
parameterType=
"map"
resultMap=
"bookMap"
>
SELECT
A.BOOK_ID, A.CHANNEL_ID, A.ADVISER_ID, A.IS_MAIN_EDITOR, T.TYPE_CODE, T.TYPE_NAME, B.ISBN, B.BOOK_NAME, B.REMARK,
B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.ORIGIN_NAME, B.BOOK_PRICE, B.ISSN, B.BOOK_NUM, B.SERIAL_NUMBER,
A.TEMPLET_ID,A.SECOND_TEMPLET_ID,A.LAST_MODIFIED_DATE LAST_MODIFIED_DATE,A.BOOK_ADVISER_ID,CONCAT('BK',A.BOOK_ID) uniqueNumber
FROM
BOOK_ADVISER A
INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID AND A.IS_DELETE = 0 AND B.IS_DELETE = 0
LEFT JOIN BOOK_TYPE T ON B.TYPE_CODE = T.TYPE_CODE
WHERE B.BOOK_NAME=#{bookName}
AND A.IS_MAIN_EDITOR = 1
limit 1
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/book/HotBook.xml
0 → 100644
View file @
dab59d36
<?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.book.dao.impl.HotBookDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.book.entity.HotBook"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"book_id"
property=
"bookId"
jdbcType=
"BIGINT"
/>
<result
column=
"seq_num"
property=
"seqNum"
jdbcType=
"INTEGER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"INTEGER"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id,book_id,seq_num,create_time
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.book.entity.HotBook"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into hot_book
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
book_id,
seq_num,
create_time
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{bookId,jdbcType=BIGINT},
#{seqNum,jdbcType=INTEGER},
NOW()
</trim>
</insert>
<select
id=
"getMaxSeqNum"
resultType=
"integer"
>
select ifnull(max(seq_num),0) from hot_book
</select>
<delete
id=
"deleteById"
parameterType=
"long"
>
delete from hot_book
where id=#{id}
</delete>
<select
id=
"getHotBookList"
parameterType=
"map"
resultType=
"com.pcloud.book.book.entity.HotBook"
>
select
t1.id,
t1.book_id bookId,
t1.seq_num seqNum,
t1.create_time createTime,
t2.book_name bookName,
t3.adviser_id adviserId,
count(t4.id) searchCount
from hot_book t1
left join search_record t4
on t1.id=t4.hot_book_id
left join book t2
on t1.book_id=t2.book_id
left join book_adviser t3
on t1.book_id=t3.book_id
group by t1.id
order by seq_num
</select>
<update
id=
"updateSeqNum"
parameterType=
"map"
>
update hot_book
set seq_num=#{seqNum}
where id=#{id}
</update>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/book/SearchRecord.xml
0 → 100644
View file @
dab59d36
<?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.book.dao.impl.SearchRecordDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.book.entity.SearchRecord"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"content"
property=
"content"
jdbcType=
"VARCHAR"
/>
<result
column=
"book_id"
property=
"bookId"
jdbcType=
"BIGINT"
/>
<result
column=
"agent_id"
property=
"agentId"
jdbcType=
"BIGINT"
/>
<result
column=
"wx_id"
property=
"wxId"
jdbcType=
"VARCHAR"
/>
<result
column=
"hot_book_id"
property=
"hotBookId"
jdbcType=
"BIGINT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"INTEGER"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id,content,book_id,agent_id,wx_id,hot_book_id,create_time
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.book.entity.SearchRecord"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into search_record
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
content,
book_id,
agent_id,
wx_id,
hot_book_id,
create_time
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{content,jdbcType=VARCHAR},
#{bookId,jdbcType=BIGINT},
#{agentId,jdbcType=BIGINT},
#{wxId,jdbcType=VARCHAR},
#{hotBookId,jdbcType=BIGINT},
NOW()
</trim>
</insert>
<select
id=
"getSearchList"
parameterType=
"map"
resultType=
"com.pcloud.book.book.vo.SearchBookVO"
>
select
content,
book_id bookId,
agent_id agentId,
count(1) searchCount
from search_record
where 1=1
<if
test=
"content!=null"
>
and content like CONCAT('%', #{content}, '%')
</if>
group by
content,book_id,agent_id
</select>
<select
id=
"getSearchRecordList"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from search_record
where content=#{content}
<if
test=
"bookId!=null"
>
and book_id=#{bookId}
</if>
<if
test=
"agentId!=null"
>
and agent_id=#{agentId}
</if>
</select>
<select
id=
"getUserSearchList4H5"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from search_record
where wx_id=#{wxId}
group by content
order by create_time desc
</select>
<delete
id=
"deleteByWxId"
parameterType=
"string"
>
delete from search_record
where wx_id=#{wxId}
</delete>
<select
id=
"getRecent5WxIds"
parameterType=
"long"
resultType=
"string"
>
select distinct wx_id
from search_record
where book_id=#{bookId}
limit 5
</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