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
6b68fa95
Commit
6b68fa95
authored
Oct 22, 2020
by
吴博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: [1003634] 用户丢书购买纸书引导流程
parent
f9a9a15b
Show whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
2159 additions
and
7 deletions
+2159
-7
BookDto.java
...-book/src/main/java/com/pcloud/book/book/dto/BookDto.java
+99
-0
BookAdviserService.java
...java/com/pcloud/book/book/service/BookAdviserService.java
+5
-0
BuyBookRequestBiz.java
...in/java/com/pcloud/book/applet/biz/BuyBookRequestBiz.java
+58
-0
HotBookSaleBiz.java
.../main/java/com/pcloud/book/applet/biz/HotBookSaleBiz.java
+53
-0
AppletBooklistBizImpl.java
...om/pcloud/book/applet/biz/impl/AppletBooklistBizImpl.java
+1
-1
BuyBookRequestBizImpl.java
...om/pcloud/book/applet/biz/impl/BuyBookRequestBizImpl.java
+111
-0
HotBookSaleBizImpl.java
...a/com/pcloud/book/applet/biz/impl/HotBookSaleBizImpl.java
+120
-0
BuyBookRequestDao.java
...in/java/com/pcloud/book/applet/dao/BuyBookRequestDao.java
+18
-0
HotBookSaleDao.java
.../main/java/com/pcloud/book/applet/dao/HotBookSaleDao.java
+23
-0
BuyBookRequestDaoImpl.java
...om/pcloud/book/applet/dao/impl/BuyBookRequestDaoImpl.java
+24
-0
HotBookSaleDaoImpl.java
...a/com/pcloud/book/applet/dao/impl/HotBookSaleDaoImpl.java
+40
-0
BuyBookRequetUserDTO.java
...java/com/pcloud/book/applet/dto/BuyBookRequetUserDTO.java
+19
-0
BuyBookRequest.java
...in/java/com/pcloud/book/applet/entity/BuyBookRequest.java
+45
-0
HotBookSale.java
.../main/java/com/pcloud/book/applet/entity/HotBookSale.java
+53
-0
BuyBookRequestFacade.java
...a/com/pcloud/book/applet/facade/BuyBookRequestFacade.java
+90
-0
HotBookSaleFacade.java
...java/com/pcloud/book/applet/facade/HotBookSaleFacade.java
+89
-0
SearchBiz.java
...ook/src/main/java/com/pcloud/book/book/biz/SearchBiz.java
+16
-0
SearchRecordDisSaleBiz.java
...java/com/pcloud/book/book/biz/SearchRecordDisSaleBiz.java
+51
-0
SearchRecordSaleBiz.java
...in/java/com/pcloud/book/book/biz/SearchRecordSaleBiz.java
+51
-0
BookBizImpl.java
.../main/java/com/pcloud/book/book/biz/impl/BookBizImpl.java
+35
-1
SearchBizImpl.java
...ain/java/com/pcloud/book/book/biz/impl/SearchBizImpl.java
+65
-0
SearchRecordDisSaleBizImpl.java
...pcloud/book/book/biz/impl/SearchRecordDisSaleBizImpl.java
+74
-0
SearchRecordSaleBizImpl.java
...om/pcloud/book/book/biz/impl/SearchRecordSaleBizImpl.java
+74
-0
SearchRecordDisSaleDao.java
...java/com/pcloud/book/book/dao/SearchRecordDisSaleDao.java
+21
-0
SearchRecordSaleDao.java
...in/java/com/pcloud/book/book/dao/SearchRecordSaleDao.java
+35
-0
SearchRecordDisSaleDaoImpl.java
...pcloud/book/book/dao/impl/SearchRecordDisSaleDaoImpl.java
+46
-0
SearchRecordSaleDaoImpl.java
...om/pcloud/book/book/dao/impl/SearchRecordSaleDaoImpl.java
+78
-0
SearchRecord.java
...c/main/java/com/pcloud/book/book/entity/SearchRecord.java
+2
-0
SearchFacadeImpl.java
...va/com/pcloud/book/book/facade/impl/SearchFacadeImpl.java
+39
-0
BookAdviserServiceImpl.java
...pcloud/book/book/service/impl/BookAdviserServiceImpl.java
+6
-0
BookSearchParamVO.java
...va/com/pcloud/book/book/vo/request/BookSearchParamVO.java
+4
-0
AgentConsr.java
...c/main/java/com/pcloud/book/consumer/user/AgentConsr.java
+12
-0
ESBookAndAdviserBiz.java
...main/java/com/pcloud/book/es/biz/ESBookAndAdviserBiz.java
+1
-1
ESBookAndAdviserBizImpl.java
.../com/pcloud/book/es/biz/impl/ESBookAndAdviserBizImpl.java
+6
-4
BuyBookRequest.Mapper.xml
...rc/main/resources/mapper/applet/BuyBookRequest.Mapper.xml
+145
-0
HotBookSale.Mapper.xml
...k/src/main/resources/mapper/applet/HotBookSale.Mapper.xml
+114
-0
SearchRecordDisSale.Mapper.xml
...main/resources/mapper/book/SearchRecordDisSale.Mapper.xml
+196
-0
SearchRecordSale.Mapper.xml
...rc/main/resources/mapper/book/SearchRecordSale.Mapper.xml
+240
-0
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/book/dto/BookDto.java
View file @
6b68fa95
...
@@ -720,6 +720,105 @@ public class BookDto extends BaseDto {
...
@@ -720,6 +720,105 @@ public class BookDto extends BaseDto {
*/
*/
private
String
volLabelName
;
private
String
volLabelName
;
@ApiModelProperty
(
"是否出版融合"
)
private
Integer
isFuse
;
@ApiModelProperty
(
"负责人"
)
private
String
person
;
@ApiModelProperty
(
"天猫"
)
private
String
tmall
;
@ApiModelProperty
(
"天猫口令"
)
private
String
tmallWord
;
@ApiModelProperty
(
"京东"
)
private
String
jd
;
@ApiModelProperty
(
"当当"
)
private
String
dangdang
;
private
String
pinduoduo
;
private
String
weixin
;
@ApiModelProperty
(
"出版社标识"
)
private
String
logo
;
@ApiModelProperty
(
"出版社介绍"
)
private
String
desc
;
public
Integer
getIsFuse
()
{
return
isFuse
;
}
public
void
setIsFuse
(
Integer
isFuse
)
{
this
.
isFuse
=
isFuse
;
}
public
String
getPerson
()
{
return
person
;
}
public
void
setPerson
(
String
person
)
{
this
.
person
=
person
;
}
public
String
getTmall
()
{
return
tmall
;
}
public
void
setTmall
(
String
tmall
)
{
this
.
tmall
=
tmall
;
}
public
String
getTmallWord
()
{
return
tmallWord
;
}
public
void
setTmallWord
(
String
tmallWord
)
{
this
.
tmallWord
=
tmallWord
;
}
public
String
getJd
()
{
return
jd
;
}
public
void
setJd
(
String
jd
)
{
this
.
jd
=
jd
;
}
public
String
getDangdang
()
{
return
dangdang
;
}
public
void
setDangdang
(
String
dangdang
)
{
this
.
dangdang
=
dangdang
;
}
public
String
getPinduoduo
()
{
return
pinduoduo
;
}
public
void
setPinduoduo
(
String
pinduoduo
)
{
this
.
pinduoduo
=
pinduoduo
;
}
public
String
getWeixin
()
{
return
weixin
;
}
public
void
setWeixin
(
String
weixin
)
{
this
.
weixin
=
weixin
;
}
public
String
getLogo
()
{
return
logo
;
}
public
void
setLogo
(
String
logo
)
{
this
.
logo
=
logo
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
public
String
getGraLabelName
()
{
public
String
getGraLabelName
()
{
return
graLabelName
;
return
graLabelName
;
}
}
...
...
pcloud-facade-book/src/main/java/com/pcloud/book/book/service/BookAdviserService.java
View file @
6b68fa95
...
@@ -159,4 +159,9 @@ public interface BookAdviserService {
...
@@ -159,4 +159,9 @@ public interface BookAdviserService {
@ApiOperation
(
value
=
"获取编辑做书品种数统计信息"
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"获取编辑做书品种数统计信息"
,
httpMethod
=
"POST"
)
@PostMapping
(
"/getAdviserBookVarietyStats"
)
@PostMapping
(
"/getAdviserBookVarietyStats"
)
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
BookVarietyStatsDto
>>>
getAdviserBookVarietyStats
(
@RequestBody
List
<
BookVarietyStatsRequestDto
>
requestDtos
)
throws
BizException
;
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
BookVarietyStatsDto
>>>
getAdviserBookVarietyStats
(
@RequestBody
List
<
BookVarietyStatsRequestDto
>
requestDtos
)
throws
BizException
;
@GetMapping
(
"getBookCountByAgentId"
)
@ApiOperation
(
"根据出版ID获取图书数量"
)
ResponseEntity
<
ResponseDto
<
Integer
>>
getBookCountByAgentId
(
@RequestParam
(
"agentId"
)
Long
agentId
)
throws
BizException
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/BuyBookRequestBiz.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
applet
.
biz
;
import
com.pcloud.book.applet.dto.BuyBookRequetUserDTO
;
import
com.pcloud.book.applet.entity.BuyBookRequest
;
import
com.pcloud.common.page.PageBeanNew
;
/**
* (BuyBookRequest)表服务接口
*
* @author makejava
* @since 2020-10-14 19:51:41
*/
public
interface
BuyBookRequestBiz
{
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
BuyBookRequest
getById
(
Long
id
);
/**
* 分页查询
*/
PageBeanNew
getList
(
Integer
currentPage
,
Integer
numPerPage
);
/**
* 新增数据
*
* @param buyBookRequest 实例对象
* @return 主键
*/
Long
insert
(
BuyBookRequest
buyBookRequest
);
/**
* 修改数据
*
* @param buyBookRequest 实例对象
*/
void
update
(
BuyBookRequest
buyBookRequest
);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
void
deleteById
(
Long
id
);
/**
* 获取用户数量
* @return
* @param topCount
*/
BuyBookRequetUserDTO
getUserCount
(
Integer
topCount
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/HotBookSaleBiz.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
applet
.
biz
;
import
com.pcloud.book.applet.entity.HotBookSale
;
import
com.pcloud.book.book.entity.HotBook
;
import
com.pcloud.common.page.PageBeanNew
;
/**
* 热门书名(HotBookSale)表服务接口
*
* @author makejava
* @since 2020-10-14 12:06:59
*/
public
interface
HotBookSaleBiz
{
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
HotBookSale
getById
(
Integer
id
);
/**
* 分页查询
*/
PageBeanNew
getList
(
Integer
currentPage
,
Integer
numPerPage
);
/**
* 新增数据
*
* @param hotBookSale 实例对象
* @return 主键
*/
Integer
insert
(
HotBookSale
hotBookSale
);
/**
* 修改数据
*
* @param hotBookSale 实例对象
*/
void
update
(
HotBookSale
hotBookSale
);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
void
deleteById
(
Integer
id
);
PageBeanNew
<
HotBookSale
>
getHotBookList
(
Integer
currentPage
,
Integer
numPerPage
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletBooklistBizImpl.java
View file @
6b68fa95
...
@@ -743,7 +743,7 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
...
@@ -743,7 +743,7 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
private
void
autoCreateBooklist
(
List
<
Long
>
templetIds
,
List
<
Long
>
secondTempletIds
,
List
<
Long
>
graLabelIds
,
List
<
Long
>
subLabelIds
){
private
void
autoCreateBooklist
(
List
<
Long
>
templetIds
,
List
<
Long
>
secondTempletIds
,
List
<
Long
>
graLabelIds
,
List
<
Long
>
subLabelIds
){
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
Page
<
ESBookAndAdviser
>
esPage
=
esBookAndAdviserBiz
.
getESAdviserBooks4Applet
(
"1"
,
null
,
templetIds
,
graLabelIds
,
subLabelIds
,
i
,
20
,
secondTempletIds
);
Page
<
ESBookAndAdviser
>
esPage
=
esBookAndAdviserBiz
.
getESAdviserBooks4Applet
(
"1"
,
null
,
templetIds
,
graLabelIds
,
subLabelIds
,
i
,
20
,
secondTempletIds
,
null
,
null
,
null
);
if
(
ListUtils
.
isEmpty
(
esPage
.
getContent
())){
if
(
ListUtils
.
isEmpty
(
esPage
.
getContent
())){
return
;
return
;
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/BuyBookRequestBizImpl.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
applet
.
biz
.
impl
;
import
com.pcloud.book.applet.biz.BuyBookRequestBiz
;
import
com.pcloud.book.applet.dao.BuyBookRequestDao
;
import
com.pcloud.book.applet.dto.BuyBookRequetUserDTO
;
import
com.pcloud.book.applet.entity.BuyBookRequest
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.NumberUtil
;
import
com.pcloud.readercenter.wechat.entity.WechatUser
;
import
org.apache.commons.collections.MapUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* (BuyBookRequest)表服务实现类
*
* @author makejava
* @since 2020-10-14 19:51:41
*/
@Service
(
"buyBookRequestBiz"
)
public
class
BuyBookRequestBizImpl
implements
BuyBookRequestBiz
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
BuyBookRequestBizImpl
.
class
);
@Autowired
private
BuyBookRequestDao
buyBookRequestDao
;
@Autowired
private
ReaderConsr
readerConsr
;
@Override
@ParamLog
(
"通过ID查询单条数据"
)
public
BuyBookRequest
getById
(
Long
id
)
{
return
buyBookRequestDao
.
getById
(
id
);
}
@Override
@ParamLog
(
"查询多条数据"
)
public
PageBeanNew
getList
(
Integer
currentPage
,
Integer
numPerPage
)
{
PageBeanNew
pageBeanNew
=
buyBookRequestDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
null
,
"getList"
);
List
recordList
=
pageBeanNew
.
getRecordList
();
if
(
ListUtils
.
isEmpty
(
recordList
))
{
return
pageBeanNew
;
}
// 加载其它数据
return
pageBeanNew
;
}
@Override
@ParamLog
(
"新增"
)
public
Long
insert
(
BuyBookRequest
buyBookRequest
)
{
buyBookRequestDao
.
insert
(
buyBookRequest
);
return
buyBookRequest
.
getId
();
}
@Override
@ParamLog
(
"修改"
)
public
void
update
(
BuyBookRequest
buyBookRequest
)
{
if
(
buyBookRequest
==
null
||
!
NumberUtil
.
isNumber
(
buyBookRequest
.
getId
()))
{
throw
BizException
.
PARAM_IS_NULL
;
}
buyBookRequestDao
.
update
(
buyBookRequest
);
}
@Override
@ParamLog
(
"删除"
)
public
void
deleteById
(
Long
id
)
{
buyBookRequestDao
.
deleteById
(
id
);
}
@Override
public
BuyBookRequetUserDTO
getUserCount
(
Integer
topCount
)
{
List
<
BuyBookRequest
>
buyBookRequests
=
buyBookRequestDao
.
getUserCount
();
BuyBookRequetUserDTO
buyBookRequetUserDTO
=
new
BuyBookRequetUserDTO
();
List
<
String
>
headUrls
=
new
ArrayList
<>();
if
(
ListUtils
.
isEmpty
(
buyBookRequests
))
{
buyBookRequetUserDTO
.
setUserCount
(
0
);
}
else
{
buyBookRequetUserDTO
.
setUserCount
(
buyBookRequests
.
size
());
List
<
Long
>
wechatUserIds
=
new
ArrayList
<>();
wechatUserIds
=
buyBookRequests
.
stream
().
map
(
e
->
e
.
getWechatUserId
()).
distinct
().
collect
(
Collectors
.
toList
());
if
(!
ListUtils
.
isEmpty
(
wechatUserIds
))
{
if
(
wechatUserIds
.
size
()
>
topCount
)
{
wechatUserIds
=
wechatUserIds
.
subList
(
0
,
topCount
);
}
Map
<
Long
,
WechatUser
>
userList
=
readerConsr
.
getUserList
(
wechatUserIds
);
if
(
MapUtils
.
isNotEmpty
(
userList
))
{
headUrls
=
userList
.
values
().
stream
().
map
(
e
->
e
.
getWechatUserHeadurl
()).
collect
(
Collectors
.
toList
());
}
}
}
buyBookRequetUserDTO
.
setWechatUserHeadUrl
(
headUrls
);
return
buyBookRequetUserDTO
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/HotBookSaleBizImpl.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
applet
.
biz
.
impl
;
import
com.pcloud.book.applet.biz.HotBookSaleBiz
;
import
com.pcloud.book.applet.dao.HotBookSaleDao
;
import
com.pcloud.book.applet.entity.HotBookSale
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.entity.HotBook
;
import
com.pcloud.book.consumer.user.AdviserConsr
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.NumberUtil
;
import
com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* 热门书名(HotBookSale)表服务实现类
*
* @author makejava
* @since 2020-10-14 12:06:59
*/
@Service
(
"hotBookSaleBiz"
)
public
class
HotBookSaleBizImpl
implements
HotBookSaleBiz
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
HotBookSaleBizImpl
.
class
);
@Autowired
private
HotBookSaleDao
hotBookSaleDao
;
@Autowired
private
AdviserConsr
adviserConsr
;
@Override
@ParamLog
(
"通过ID查询单条数据"
)
public
HotBookSale
getById
(
Integer
id
)
{
return
hotBookSaleDao
.
getById
(
id
);
}
@Override
@ParamLog
(
"查询多条数据"
)
public
PageBeanNew
getList
(
Integer
currentPage
,
Integer
numPerPage
)
{
PageBeanNew
pageBeanNew
=
hotBookSaleDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
null
,
"getList"
);
List
recordList
=
pageBeanNew
.
getRecordList
();
if
(
ListUtils
.
isEmpty
(
recordList
))
{
return
pageBeanNew
;
}
// 加载其它数据
return
pageBeanNew
;
}
@Override
@ParamLog
(
"新增"
)
public
Integer
insert
(
HotBookSale
hotBook
)
{
if
(
hotBook
==
null
||
hotBook
.
getBookId
()==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"热门书不能为空!"
);
}
Integer
maxSeqNum
=
hotBookSaleDao
.
getMaxSeqNum
();
hotBook
.
setSeqNum
(
maxSeqNum
+
1
);
hotBookSaleDao
.
insert
(
hotBook
);
hotBookSaleDao
.
insert
(
hotBook
);
return
hotBook
.
getId
().
intValue
();
}
@Override
@ParamLog
(
"修改"
)
public
void
update
(
HotBookSale
hotBookSale
)
{
if
(
hotBookSale
==
null
||
!
NumberUtil
.
isNumber
(
hotBookSale
.
getId
()))
{
throw
BizException
.
PARAM_IS_NULL
;
}
hotBookSaleDao
.
update
(
hotBookSale
);
}
@Override
@ParamLog
(
"删除"
)
public
void
deleteById
(
Integer
id
)
{
hotBookSaleDao
.
deleteById
(
id
);
}
@Override
public
PageBeanNew
<
HotBookSale
>
getHotBookList
(
Integer
currentPage
,
Integer
numPerPage
)
{
if
(
currentPage
==
null
||
currentPage
<
0
||
numPerPage
==
null
||
numPerPage
<=
0
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"分页参数有误!"
);
}
PageBeanNew
<
HotBookSale
>
pageNew
=
hotBookSaleDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
new
HashMap
<>(),
"getHotBookList"
);
List
<
HotBookSale
>
list
=
pageNew
.
getRecordList
();
//填充出版社信息
fillHotBookAgent
(
list
);
return
pageNew
;
}
private
void
fillHotBookAgent
(
List
<
HotBookSale
>
list
)
{
if
(
ListUtils
.
isEmpty
(
list
)){
return
;
}
List
<
Long
>
adviserIds
=
list
.
stream
().
filter
(
s
->
s
.
getAdviserId
()!=
null
).
map
(
HotBookSale:
:
getAdviserId
).
distinct
().
collect
(
Collectors
.
toList
());
if
(
ListUtils
.
isEmpty
(
adviserIds
)){
return
;
}
Map
<
Long
,
AdviserBaseInfoDto
>
infoDtoMap
=
adviserConsr
.
getAdviserId2AdviserInfoDtoMap
(
adviserIds
);
for
(
HotBookSale
hotBook:
list
){
AdviserBaseInfoDto
infoDto
=
infoDtoMap
.
get
(
hotBook
.
getAdviserId
());
if
(
infoDto
!=
null
){
hotBook
.
setAgentId
(
infoDto
.
getAgentId
());
hotBook
.
setAgentName
(
infoDto
.
getAgentName
());
}
}
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/BuyBookRequestDao.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
applet
.
dao
;
import
com.pcloud.book.applet.entity.BuyBookRequest
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* (BuyBookRequest)表数据库访问层
*
* @author makejava
* @since 2020-10-14 19:51:40
*/
public
interface
BuyBookRequestDao
extends
BaseDao
<
BuyBookRequest
>
{
List
<
BuyBookRequest
>
getUserCount
();
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/HotBookSaleDao.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
applet
.
dao
;
import
com.pcloud.book.applet.entity.HotBookSale
;
import
com.pcloud.book.book.entity.HotBook
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* 热门书名(HotBookSale)表数据库访问层
*
* @author makejava
* @since 2020-10-14 12:06:58
*/
public
interface
HotBookSaleDao
extends
BaseDao
<
HotBookSale
>
{
Integer
getMaxSeqNum
();
void
updateSeqNum
(
Long
id
,
Integer
seqNum
);
List
<
HotBookSale
>
getHotBookList
();
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/BuyBookRequestDaoImpl.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
applet
.
dao
.
impl
;
import
com.pcloud.book.applet.dao.BuyBookRequestDao
;
import
com.pcloud.book.applet.entity.BuyBookRequest
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* (BuyBookRequest)表数据库访问层
*
* @author makejava
* @since 2020-10-14 19:51:40
*/
@Repository
(
"buyBookRequestDaoImpl"
)
public
class
BuyBookRequestDaoImpl
extends
BaseDaoImpl
<
BuyBookRequest
>
implements
BuyBookRequestDao
{
@Override
public
List
<
BuyBookRequest
>
getUserCount
()
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getUserCount"
));
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/HotBookSaleDaoImpl.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
applet
.
dao
.
impl
;
import
com.pcloud.book.applet.dao.HotBookSaleDao
;
import
com.pcloud.book.applet.entity.HotBookSale
;
import
com.pcloud.book.book.entity.HotBook
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 热门书名(HotBookSale)表数据库访问层
*
* @author makejava
* @since 2020-10-14 12:06:58
*/
@Repository
(
"hotBookSaleDaoImpl"
)
public
class
HotBookSaleDaoImpl
extends
BaseDaoImpl
<
HotBookSale
>
implements
HotBookSaleDao
{
@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
<
HotBookSale
>
getHotBookList
()
{
return
super
.
getSqlSession
().
selectList
(
super
.
getStatement
(
"getHotBookList"
));
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/BuyBookRequetUserDTO.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
applet
.
dto
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
BuyBookRequetUserDTO
{
/**
* 用户数量
*/
private
Integer
userCount
;
/**
* 头像列表
*/
private
List
<
String
>
wechatUserHeadUrl
;
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/BuyBookRequest.java
0 → 100644
View file @
6b68fa95
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
;
/**
* (BuyBookRequest)实体类
*
* @author makejava
* @since 2020-10-14 19:51:40
*/
@Data
public
class
BuyBookRequest
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
-
15486229714305004L
;
private
Long
id
;
private
Long
bookId
;
private
Long
adviserId
;
private
Long
channelId
;
private
Long
agentId
;
private
Long
wechatUserId
;
private
String
userName
;
private
String
phone
;
private
String
address
;
@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
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/HotBookSale.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
applet
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 热门书名(HotBookSale)实体类
*
* @author makejava
* @since 2020-10-14 12:06:58
*/
@Data
public
class
HotBookSale
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
;
@ApiModelProperty
(
"书封面"
)
private
String
coverImg
;
@ApiModelProperty
(
"运营id"
)
private
Long
channelId
;
@ApiModelProperty
(
"作者"
)
private
String
author
;
@ApiModelProperty
(
"出版社"
)
private
String
publish
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/BuyBookRequestFacade.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
applet
.
facade
;
import
com.pcloud.book.applet.biz.BuyBookRequestBiz
;
import
com.pcloud.book.applet.dto.BuyBookRequetUserDTO
;
import
com.pcloud.book.applet.entity.BuyBookRequest
;
import
com.pcloud.book.base.exception.BookBizException
;
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.common.utils.cookie.Cookie
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* (BuyBookRequest)表控制层
*
* @author makejava
* @since 2020-10-14 19:51:41
*/
@RestController
(
"buyBookRequestFacade"
)
@RequestMapping
(
"buyBookRequest"
)
public
class
BuyBookRequestFacade
{
@Autowired
private
BuyBookRequestBiz
buyBookRequestBiz
;
@ApiOperation
(
"通过主键查询单条数据"
)
@GetMapping
(
"getById"
)
public
ResponseDto
<?>
getById
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
Long
id
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
buyBookRequestBiz
.
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
<>(
buyBookRequestBiz
.
getList
(
currentPage
,
numPerPage
));
}
@ApiOperation
(
"新增"
)
@PostMapping
(
"insert"
)
public
ResponseDto
<?>
insert
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
BuyBookRequest
buyBookRequest
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
buyBookRequest
.
setWechatUserId
(
wechatUserId
);
return
new
ResponseDto
<>(
buyBookRequestBiz
.
insert
(
buyBookRequest
));
}
@ApiOperation
(
"更新"
)
@PostMapping
(
"update"
)
public
ResponseDto
<?>
update
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
BuyBookRequest
buyBookRequest
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
buyBookRequestBiz
.
update
(
buyBookRequest
);
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
;
}
buyBookRequestBiz
.
deleteById
(
id
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"获取购书流程填写用户数量"
)
@GetMapping
(
"getUserCount"
)
public
ResponseDto
<
BuyBookRequetUserDTO
>
getUserCount
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"topCount"
,
defaultValue
=
"5"
)
Integer
topCount
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<
BuyBookRequetUserDTO
>(
buyBookRequestBiz
.
getUserCount
(
topCount
));
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/HotBookSaleFacade.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
applet
.
facade
;
import
com.pcloud.book.applet.biz.HotBookSaleBiz
;
import
com.pcloud.book.applet.entity.HotBookSale
;
import
com.pcloud.book.base.exception.BookBizException
;
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
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
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
;
/**
* 热门书名(HotBookSale)表控制层
*
* @author makejava
* @since 2020-10-14 12:06:59
*/
@RestController
(
"hotBookSaleFacade"
)
@RequestMapping
(
"hotBookSale"
)
public
class
HotBookSaleFacade
{
@Autowired
private
HotBookSaleBiz
hotBookSaleBiz
;
@ApiOperation
(
"通过主键查询单条数据"
)
@GetMapping
(
"getById"
)
public
ResponseDto
<?>
getById
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
Integer
id
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
hotBookSaleBiz
.
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
<>(
hotBookSaleBiz
.
getList
(
currentPage
,
numPerPage
));
}
@ApiOperation
(
"新增"
)
@PostMapping
(
"insert"
)
public
ResponseDto
<?>
insert
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
HotBookSale
hotBookSale
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
hotBookSaleBiz
.
insert
(
hotBookSale
));
}
@ApiOperation
(
"更新"
)
@PostMapping
(
"update"
)
public
ResponseDto
<?>
update
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
HotBookSale
hotBookSale
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
hotBookSaleBiz
.
update
(
hotBookSale
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"删除"
)
@GetMapping
(
"deleteById"
)
public
ResponseDto
<?>
deleteById
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
Integer
id
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
if
(
null
==
id
)
{
throw
BookBizException
.
PARAM_DELETION
;
}
hotBookSaleBiz
.
deleteById
(
id
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"获取热门书4sale"
)
@GetMapping
(
"getHotBookList4Sale"
)
public
ResponseDto
<?>
getHotBookList4Sale
(
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
return
new
ResponseDto
<>(
hotBookSaleBiz
.
getHotBookList
(
currentPage
,
numPerPage
));
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/SearchBiz.java
View file @
6b68fa95
...
@@ -36,4 +36,20 @@ public interface SearchBiz {
...
@@ -36,4 +36,20 @@ public interface SearchBiz {
List
<
BookSearchTopVO
>
getBookSearchTop
(
Integer
top
);
List
<
BookSearchTopVO
>
getBookSearchTop
(
Integer
top
);
void
createSearchRecordDis
(
SearchRecord
searchRecord
);
void
createSearchRecordDis
(
SearchRecord
searchRecord
);
/**
* 丢书新增搜索记录
* @param searchRecord
* @param officialAccountId
*/
void
createSearchRecord4Sale
(
SearchRecord
searchRecord
,
Long
officialAccountId
);
PageBeanNew
<
SearchRecord
>
getUserSearchList4Sale
(
String
wxId
,
Long
id
,
Integer
currentPage
,
Integer
numPerPage
);
/**
* 清空搜索记录
* @param wxId
* @param wechatUserId
*/
void
deleteUserSearchList4Sale
(
String
wxId
,
Long
wechatUserId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/SearchRecordDisSaleBiz.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
book
.
biz
;
import
com.pcloud.book.book.entity.SearchRecordDis
;
import
com.pcloud.common.page.PageBeanNew
;
/**
* 用户搜索记录(内容去重)(SearchRecordDis)表服务接口
*
* @author makejava
* @since 2020-10-12 16:24:41
*/
public
interface
SearchRecordDisSaleBiz
{
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SearchRecordDis
getById
(
Integer
id
);
/**
* 分页查询
*/
PageBeanNew
getList
(
Integer
currentPage
,
Integer
numPerPage
);
/**
* 新增数据
*
* @param SearchRecordDis 实例对象
* @return 主键
*/
Long
insert
(
SearchRecordDis
SearchRecordDis
);
/**
* 修改数据
*
* @param SearchRecordDis 实例对象
*/
void
update
(
SearchRecordDis
SearchRecordDis
);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
void
deleteById
(
Integer
id
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/SearchRecordSaleBiz.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
book
.
biz
;
import
com.pcloud.book.book.entity.SearchRecord
;
import
com.pcloud.common.page.PageBeanNew
;
/**
* 用户搜索记录(SearchRecordSale)表服务接口
*
* @author makejava
* @since 2020-10-12 16:24:03
*/
public
interface
SearchRecordSaleBiz
{
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SearchRecord
getById
(
Integer
id
);
/**
* 分页查询
*/
PageBeanNew
getList
(
Integer
currentPage
,
Integer
numPerPage
);
/**
* 新增数据
*
* @param searchRecordSale 实例对象
* @return 主键
*/
void
insert
(
SearchRecord
searchRecordSale
);
/**
* 修改数据
*
* @param searchRecordSale 实例对象
*/
void
update
(
SearchRecord
searchRecordSale
);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
void
deleteById
(
Integer
id
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/impl/BookBizImpl.java
View file @
6b68fa95
...
@@ -138,6 +138,7 @@ import com.pcloud.resourcecenter.product.dto.SpecificationDto;
...
@@ -138,6 +138,7 @@ import com.pcloud.resourcecenter.product.dto.SpecificationDto;
import
com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto
;
import
com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto
;
import
com.sun.org.apache.xpath.internal.operations.Bool
;
import
com.sun.org.apache.xpath.internal.operations.Bool
;
import
com.pcloud.usercenter.party.agent.dto.SaleAgentDTO
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -2481,7 +2482,14 @@ public class BookBizImpl implements BookBiz {
...
@@ -2481,7 +2482,14 @@ public class BookBizImpl implements BookBiz {
String
keyword
=
bookSearchParamVO
.
getKeyword
();
String
keyword
=
bookSearchParamVO
.
getKeyword
();
Integer
currentPage
=
bookSearchParamVO
.
getCurrentPage
();
Integer
currentPage
=
bookSearchParamVO
.
getCurrentPage
();
Integer
numPerPage
=
bookSearchParamVO
.
getNumPerPage
();
Integer
numPerPage
=
bookSearchParamVO
.
getNumPerPage
();
Page
<
ESBookAndAdviser
>
esPage
=
esBookAndAdviserBiz
.
getESAdviserBooks4Applet
(
grayStatus
,
keyword
,
templetIds
,
graLabelIds
,
subLabelIds
,
currentPage
,
numPerPage
,
scecondTempletIds
);
Integer
isAdviserBook
=
bookSearchParamVO
.
getIsAdviserBook
();
Long
agentId
=
bookSearchParamVO
.
getAgentId
();
List
<
Long
>
adviserIds
=
new
ArrayList
<>();
if
(
null
!=
agentId
)
{
adviserIds
=
adviserConsr
.
getByAgentId
(
agentId
);
}
Page
<
ESBookAndAdviser
>
esPage
=
esBookAndAdviserBiz
.
getESAdviserBooks4Applet
(
grayStatus
,
keyword
,
templetIds
,
graLabelIds
,
subLabelIds
,
currentPage
,
numPerPage
,
scecondTempletIds
,
isAdviserBook
,
adviserIds
,
agentId
);
List
<
ESBookAndAdviser
>
esBookAndAdvisers
=
esPage
.
getContent
();
List
<
ESBookAndAdviser
>
esBookAndAdvisers
=
esPage
.
getContent
();
if
(
ListUtils
.
isEmpty
(
esBookAndAdvisers
))
{
if
(
ListUtils
.
isEmpty
(
esBookAndAdvisers
))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
...
@@ -2489,10 +2497,36 @@ public class BookBizImpl implements BookBiz {
...
@@ -2489,10 +2497,36 @@ public class BookBizImpl implements BookBiz {
List
<
BookDto
>
bookDtos
=
changeToBookDto
(
esBookAndAdvisers
);
List
<
BookDto
>
bookDtos
=
changeToBookDto
(
esBookAndAdvisers
);
fillOtherBookInfo
(
bookDtos
);
fillOtherBookInfo
(
bookDtos
);
fillBookInfo
(
bookDtos
);
fillBookInfo
(
bookDtos
);
//丢书流程填充出版社店铺信息
if
(
null
!=
isAdviserBook
)
{
fillAgentSale
(
bookDtos
);
}
PageBeanNew
<
BookDto
>
page
=
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
(
int
)
esPage
.
getTotalElements
(),
bookDtos
);
PageBeanNew
<
BookDto
>
page
=
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
(
int
)
esPage
.
getTotalElements
(),
bookDtos
);
return
page
;
return
page
;
}
}
private
void
fillAgentSale
(
List
<
BookDto
>
bookDtos
)
{
if
(
ListUtils
.
isEmpty
(
bookDtos
))
{
return
;
}
List
<
Long
>
agentIds
=
bookDtos
.
stream
().
map
(
e
->
e
.
getAgentId
()).
collect
(
Collectors
.
toList
());
if
(
ListUtils
.
isEmpty
(
agentIds
))
{
return
;
}
Map
<
Long
,
SaleAgentDTO
>
saleAgentDTOMap
=
agentConsr
.
getSaleAgentMap
(
agentIds
);
if
(
MapUtils
.
isEmpty
(
saleAgentDTOMap
))
{
return
;
}
//填充出版社商铺信息
bookDtos
.
forEach
(
bookDto
->
{
Long
agentId
=
bookDto
.
getAgentId
();
SaleAgentDTO
saleAgentDTO
=
saleAgentDTOMap
.
get
(
agentId
);
if
(
null
!=
agentId
&&
null
!=
saleAgentDTO
)
{
BeanUtils
.
copyProperties
(
saleAgentDTO
,
bookDto
,
"id"
,
"agentName"
);
}
});
}
@ParamLog
(
"获取书籍标签"
)
@ParamLog
(
"获取书籍标签"
)
@Override
@Override
public
Map
<
Integer
,
List
<
BookLabel
>>
getBookLabels4Erp
()
{
public
Map
<
Integer
,
List
<
BookLabel
>>
getBookLabels4Erp
()
{
...
...
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/impl/SearchBizImpl.java
View file @
6b68fa95
...
@@ -7,6 +7,8 @@ import com.pcloud.book.book.dao.BookDao;
...
@@ -7,6 +7,8 @@ import com.pcloud.book.book.dao.BookDao;
import
com.pcloud.book.book.dao.HotBookDao
;
import
com.pcloud.book.book.dao.HotBookDao
;
import
com.pcloud.book.book.dao.SearchRecordDao
;
import
com.pcloud.book.book.dao.SearchRecordDao
;
import
com.pcloud.book.book.dao.SearchRecordDisDao
;
import
com.pcloud.book.book.dao.SearchRecordDisDao
;
import
com.pcloud.book.book.dao.SearchRecordDisSaleDao
;
import
com.pcloud.book.book.dao.SearchRecordSaleDao
;
import
com.pcloud.book.book.dto.BookDto
;
import
com.pcloud.book.book.dto.BookDto
;
import
com.pcloud.book.book.entity.HotBook
;
import
com.pcloud.book.book.entity.HotBook
;
import
com.pcloud.book.book.entity.SearchRecord
;
import
com.pcloud.book.book.entity.SearchRecord
;
...
@@ -74,6 +76,10 @@ public class SearchBizImpl implements SearchBiz {
...
@@ -74,6 +76,10 @@ public class SearchBizImpl implements SearchBiz {
private
ReaderConsr
readerConsr
;
private
ReaderConsr
readerConsr
;
@Autowired
@Autowired
private
AccountSettingService
accountSettingService
;
private
AccountSettingService
accountSettingService
;
@Autowired
private
SearchRecordSaleDao
searchRecordSaleDao
;
@Autowired
private
SearchRecordDisSaleDao
searchRecordDisSaleDao
;
@ParamLog
(
"创建热门书"
)
@ParamLog
(
"创建热门书"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
@@ -331,6 +337,65 @@ public class SearchBizImpl implements SearchBiz {
...
@@ -331,6 +337,65 @@ public class SearchBizImpl implements SearchBiz {
}
}
}
}
@Override
@ParamLog
(
"丢书新增搜索记录"
)
public
void
createSearchRecord4Sale
(
SearchRecord
searchRecord
,
Long
officialAccountId
)
{
if
(
searchRecord
==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数为空!"
);
}
if
(
StringUtil
.
isEmpty
(
searchRecord
.
getContent
())){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"内容不能为空!"
);
}
try
{
Long
agentId
=
ResponseHandleUtil
.
parseResponse
(
accountSettingService
.
getAgentIdByAccountSettingId
(
officialAccountId
),
Long
.
class
);
searchRecord
.
setAgentId
(
agentId
);
}
catch
(
Exception
e
)
{
LOGGER
.
info
(
"[accountSettingService.getAgentIdByAccountSettingId] 获取 agentId 失败"
,
e
);
}
searchRecordSaleDao
.
insert
(
searchRecord
);
createSearchRecordDis4Sale
(
searchRecord
);
}
@Override
public
PageBeanNew
<
SearchRecord
>
getUserSearchList4Sale
(
String
wxId
,
Long
wechatUserId
,
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
);
map
.
put
(
"wechatUserId"
,
wechatUserId
);
PageBeanNew
<
SearchRecord
>
page
=
searchRecordDisSaleDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"getUserSearchList4H5"
,
"countUserSearchList4H5"
);
return
page
;
}
@Override
public
void
deleteUserSearchList4Sale
(
String
wxId
,
Long
wechatUserId
)
{
if
(
StringUtil
.
isEmpty
(
wxId
)&&
wechatUserId
==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
if
(!
StringUtil
.
isEmpty
(
wxId
)){
searchRecordSaleDao
.
updateUserDeleteByWxId
(
wxId
,
true
);
//同时删除去重表
searchRecordDisSaleDao
.
updateUserDeleteByWxId
(
wxId
,
true
);
}
if
(
wechatUserId
!=
null
){
searchRecordSaleDao
.
updateUserDeleteByWechatUserId
(
wechatUserId
,
true
);
//同时删除去重表
searchRecordDisSaleDao
.
updateUserDeleteByWechatUserId
(
wechatUserId
,
true
);
}
}
private
void
createSearchRecordDis4Sale
(
SearchRecord
searchRecord
)
{
SearchRecordDis
searchRecordDisOld
=
searchRecordDisSaleDao
.
getByCondition
(
searchRecord
.
getWechatUserId
(),
searchRecord
.
getWxId
(),
searchRecord
.
getContent
());
if
(
searchRecordDisOld
==
null
){
SearchRecordDis
searchRecordDis
=
new
SearchRecordDis
();
BeanUtils
.
copyProperties
(
searchRecord
,
searchRecordDis
);
searchRecordDisSaleDao
.
insert
(
searchRecordDis
);
}
else
{
searchRecordDisSaleDao
.
update
(
searchRecordDisOld
);
}
}
@ParamLog
(
"导出"
)
@ParamLog
(
"导出"
)
private
void
exportSRL
(
List
<
SearchRecord
>
list
,
String
systemCode
,
Long
partyId
)
{
private
void
exportSRL
(
List
<
SearchRecord
>
list
,
String
systemCode
,
Long
partyId
)
{
...
...
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/impl/SearchRecordDisSaleBizImpl.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
book
.
biz
.
impl
;
import
com.pcloud.book.book.biz.SearchRecordDisSaleBiz
;
import
com.pcloud.book.book.dao.SearchRecordDisSaleDao
;
import
com.pcloud.book.book.entity.SearchRecordDis
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.NumberUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* 用户搜索记录(内容去重)(SearchRecordDisSale)表服务实现类
*
* @author makejava
* @since 2020-10-12 16:24:41
*/
@Service
(
"searchRecordDisSaleBiz"
)
public
class
SearchRecordDisSaleBizImpl
implements
SearchRecordDisSaleBiz
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
SearchRecordDisSaleBizImpl
.
class
);
@Autowired
private
SearchRecordDisSaleDao
searchRecordDisSaleDao
;
@Override
@ParamLog
(
"通过ID查询单条数据"
)
public
SearchRecordDis
getById
(
Integer
id
)
{
return
searchRecordDisSaleDao
.
getById
(
id
);
}
@Override
@ParamLog
(
"查询多条数据"
)
public
PageBeanNew
getList
(
Integer
currentPage
,
Integer
numPerPage
)
{
PageBeanNew
pageBeanNew
=
searchRecordDisSaleDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
null
,
"getList"
);
List
recordList
=
pageBeanNew
.
getRecordList
();
if
(
ListUtils
.
isEmpty
(
recordList
))
{
return
pageBeanNew
;
}
// 加载其它数据
return
pageBeanNew
;
}
@Override
@ParamLog
(
"新增"
)
public
Long
insert
(
SearchRecordDis
searchRecordDisSale
)
{
searchRecordDisSaleDao
.
insert
(
searchRecordDisSale
);
return
searchRecordDisSale
.
getId
();
}
@Override
@ParamLog
(
"修改"
)
public
void
update
(
SearchRecordDis
searchRecordDisSale
)
{
if
(
searchRecordDisSale
==
null
||
!
NumberUtil
.
isNumber
(
searchRecordDisSale
.
getId
()))
{
throw
BizException
.
PARAM_IS_NULL
;
}
searchRecordDisSaleDao
.
update
(
searchRecordDisSale
);
}
@Override
@ParamLog
(
"删除"
)
public
void
deleteById
(
Integer
id
)
{
searchRecordDisSaleDao
.
deleteById
(
id
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/impl/SearchRecordSaleBizImpl.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
book
.
biz
.
impl
;
import
com.pcloud.book.book.biz.SearchRecordSaleBiz
;
import
com.pcloud.book.book.dao.SearchRecordSaleDao
;
import
com.pcloud.book.book.entity.SearchRecord
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.NumberUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* 用户搜索记录(SearchRecordSale)表服务实现类
*
* @author makejava
* @since 2020-10-12 16:24:03
*/
@Service
(
"searchRecordSaleBiz"
)
public
class
SearchRecordSaleBizImpl
implements
SearchRecordSaleBiz
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
SearchRecordSaleBizImpl
.
class
);
@Autowired
private
SearchRecordSaleDao
searchRecordSaleDao
;
@Override
@ParamLog
(
"通过ID查询单条数据"
)
public
SearchRecord
getById
(
Integer
id
)
{
return
searchRecordSaleDao
.
getById
(
id
);
}
@Override
@ParamLog
(
"查询多条数据"
)
public
PageBeanNew
getList
(
Integer
currentPage
,
Integer
numPerPage
)
{
PageBeanNew
pageBeanNew
=
searchRecordSaleDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
null
,
"getList"
);
List
recordList
=
pageBeanNew
.
getRecordList
();
if
(
ListUtils
.
isEmpty
(
recordList
))
{
return
pageBeanNew
;
}
// 加载其它数据
return
pageBeanNew
;
}
@Override
@ParamLog
(
"新增"
)
public
void
insert
(
SearchRecord
searchRecordSale
)
{
searchRecordSaleDao
.
insert
(
searchRecordSale
);
}
@Override
@ParamLog
(
"修改"
)
public
void
update
(
SearchRecord
searchRecordSale
)
{
if
(
searchRecordSale
==
null
||
!
NumberUtil
.
isNumber
(
searchRecordSale
.
getId
()))
{
throw
BizException
.
PARAM_IS_NULL
;
}
searchRecordSaleDao
.
update
(
searchRecordSale
);
}
@Override
@ParamLog
(
"删除"
)
public
void
deleteById
(
Integer
id
)
{
searchRecordSaleDao
.
deleteById
(
id
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/book/dao/SearchRecordDisSaleDao.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
book
.
dao
;
import
com.pcloud.book.book.entity.SearchRecordDis
;
import
com.pcloud.common.core.dao.BaseDao
;
/**
* 用户搜索记录(内容去重)(SearchRecordDisSale)表数据库访问层
*
* @author makejava
* @since 2020-10-12 16:24:41
*/
public
interface
SearchRecordDisSaleDao
extends
BaseDao
<
SearchRecordDis
>
{
SearchRecordDis
getByCondition
(
Long
wechatUserId
,
String
wxId
,
String
content
);
void
updateUserDeleteByWxId
(
String
wxId
,
Boolean
userDelete
);
void
updateUserDeleteByWechatUserId
(
Long
wechatUserId
,
Boolean
userDelete
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/book/dao/SearchRecordSaleDao.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
book
.
dao
;
import
com.pcloud.book.book.dto.AdviserBookInfoDTO
;
import
com.pcloud.book.book.entity.SearchRecord
;
import
com.pcloud.book.book.vo.BookSearchTopVO
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* 用户搜索记录(SearchRecordSale)表数据库访问层
*
* @author makejava
* @since 2020-10-12 16:24:03
*/
public
interface
SearchRecordSaleDao
extends
BaseDao
<
SearchRecord
>
{
void
deleteByWxId
(
String
wxId
);
List
<
String
>
getRecent5WxIds
(
Long
bookId
);
void
updateUserDeleteByWxId
(
String
wxId
,
Boolean
userDelete
);
List
<
BookSearchTopVO
>
getBookSearchTop
(
Integer
top
);
void
updateUserDeleteByWechatUserId
(
Long
wechatUserId
,
Boolean
userDelete
);
Integer
getBookSearchCount
(
String
keyword
);
List
<
AdviserBookInfoDTO
>
getBookSearchIds
(
String
keyword
,
Integer
currentPage
,
Integer
numPerPage
);
List
<
Long
>
getWechatUserIds
(
Long
bookId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/book/dao/impl/SearchRecordDisSaleDaoImpl.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
book
.
dao
.
impl
;
import
com.pcloud.book.book.dao.SearchRecordDisSaleDao
;
import
com.pcloud.book.book.entity.SearchRecordDis
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 用户搜索记录(内容去重)(SearchRecordDisSale)表数据库访问层
*
* @author makejava
* @since 2020-10-12 16:24:41
*/
@Repository
(
"searchRecordDisSaleDaoImpl"
)
public
class
SearchRecordDisSaleDaoImpl
extends
BaseDaoImpl
<
SearchRecordDis
>
implements
SearchRecordDisSaleDao
{
@Override
public
SearchRecordDis
getByCondition
(
Long
wechatUserId
,
String
wxId
,
String
content
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wechatUserId"
,
wechatUserId
);
map
.
put
(
"wxId"
,
wxId
);
map
.
put
(
"content"
,
content
);
return
super
.
getSqlSession
().
selectOne
(
super
.
getStatement
(
"getByCondition"
),
map
);
}
@Override
public
void
updateUserDeleteByWxId
(
String
wxId
,
Boolean
userDelete
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wxId"
,
wxId
);
map
.
put
(
"userDelete"
,
userDelete
);
super
.
getSqlSession
().
update
(
super
.
getStatement
(
"updateUserDeleteByWxId"
),
map
);
}
@Override
public
void
updateUserDeleteByWechatUserId
(
Long
wechatUserId
,
Boolean
userDelete
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wechatUserId"
,
wechatUserId
);
map
.
put
(
"userDelete"
,
userDelete
);
super
.
getSqlSession
().
update
(
super
.
getStatement
(
"updateUserDeleteByWechatUserId"
),
map
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/book/dao/impl/SearchRecordSaleDaoImpl.java
0 → 100644
View file @
6b68fa95
package
com
.
pcloud
.
book
.
book
.
dao
.
impl
;
import
com.pcloud.book.book.dao.SearchRecordSaleDao
;
import
com.pcloud.book.book.dto.AdviserBookInfoDTO
;
import
com.pcloud.book.book.entity.SearchRecord
;
import
com.pcloud.book.book.vo.BookSearchTopVO
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 用户搜索记录(SearchRecordSale)表数据库访问层
*
* @author makejava
* @since 2020-10-12 16:24:03
*/
@Repository
(
"searchRecordSaleDaoImpl"
)
public
class
SearchRecordSaleDaoImpl
extends
BaseDaoImpl
<
SearchRecord
>
implements
SearchRecordSaleDao
{
@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
);
}
@Override
public
void
updateUserDeleteByWxId
(
String
wxId
,
Boolean
userDelete
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wxId"
,
wxId
);
map
.
put
(
"userDelete"
,
userDelete
);
super
.
getSqlSession
().
update
(
super
.
getStatement
(
"updateUserDeleteByWxId"
),
map
);
}
@Override
public
List
<
BookSearchTopVO
>
getBookSearchTop
(
Integer
top
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"top"
,
top
);
return
super
.
getSqlSession
().
selectList
(
super
.
getStatement
(
"getBookSearchTop"
),
map
);
}
@Override
public
void
updateUserDeleteByWechatUserId
(
Long
wechatUserId
,
Boolean
userDelete
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wechatUserId"
,
wechatUserId
);
map
.
put
(
"userDelete"
,
userDelete
);
super
.
getSqlSession
().
update
(
super
.
getStatement
(
"updateUserDeleteByWechatUserId"
),
map
);
}
@Override
public
Integer
getBookSearchCount
(
String
keyword
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"keyword"
,
keyword
);
return
super
.
getSqlSession
().
selectOne
(
super
.
getStatement
(
"getBookSearchCount"
),
map
);
}
@Override
public
List
<
AdviserBookInfoDTO
>
getBookSearchIds
(
String
keyword
,
Integer
currentPage
,
Integer
numPerPage
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"keyword"
,
keyword
);
map
.
put
(
"pageNum"
,
currentPage
*
numPerPage
);
map
.
put
(
"numPerPage"
,
numPerPage
);
return
super
.
getSqlSession
().
selectList
(
super
.
getStatement
(
"getBookSearchIds"
),
map
);
}
@Override
public
List
<
Long
>
getWechatUserIds
(
Long
bookId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"bookId"
,
bookId
);
return
super
.
getSqlSession
().
selectList
(
super
.
getStatement
(
"getWechatUserIds"
),
map
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/book/entity/SearchRecord.java
View file @
6b68fa95
...
@@ -45,4 +45,6 @@ public class SearchRecord extends BaseEntity {
...
@@ -45,4 +45,6 @@ public class SearchRecord extends BaseEntity {
@ApiModelProperty
(
"用户是否删除"
)
@ApiModelProperty
(
"用户是否删除"
)
private
Boolean
userDelete
;
private
Boolean
userDelete
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/facade/impl/SearchFacadeImpl.java
View file @
6b68fa95
...
@@ -219,4 +219,43 @@ public class SearchFacadeImpl implements SearchFacade {
...
@@ -219,4 +219,43 @@ public class SearchFacadeImpl implements SearchFacade {
)
throws
BizException
,
PermissionException
{
)
throws
BizException
,
PermissionException
{
return
new
ResponseDto
<>(
searchBiz
.
getBookSearchTop
(
top
));
return
new
ResponseDto
<>(
searchBiz
.
getBookSearchTop
(
top
));
}
}
@ApiOperation
(
"丢书新增搜索记录"
)
@PostMapping
(
"createSearchRecord4Sale"
)
public
ResponseDto
<?>
createSearchRecord4Sale
(
@CookieValue
(
value
=
"userInfo"
)
String
userInfo
,
@RequestBody
SearchRecord
searchRecord
)
throws
PermissionException
{
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
officialAccountId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
searchBiz
.
createSearchRecord4Sale
(
searchRecord
,
officialAccountId
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"获取用户最近丢书搜索列表"
)
@GetMapping
(
"getUserSearchList4Sale"
)
public
ResponseDto
<?>
getUserSearchList4Sale
(
@CookieValue
(
value
=
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"wxId"
,
required
=
false
)
@ApiParam
(
"用户id"
)
String
wxId
,
@RequestParam
(
value
=
"wechatUserId"
,
required
=
false
)
@ApiParam
(
"微信id"
)
Long
wechatUserId
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
return
new
ResponseDto
<>(
searchBiz
.
getUserSearchList4Sale
(
wxId
,
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
),
currentPage
,
numPerPage
));
}
@ApiOperation
(
"删除用户搜索记录4sale"
)
@GetMapping
(
"deleteUserSearchList4Sale"
)
public
ResponseDto
<?>
deleteUserSearchList4Sale
(
@RequestParam
(
value
=
"wxId"
,
required
=
false
)
@ApiParam
(
"用户id"
)
String
wxId
,
@RequestParam
(
value
=
"wechatUserId"
,
required
=
false
)
@ApiParam
(
"微信id"
)
Long
wechatUserId
)
throws
BizException
,
PermissionException
{
searchBiz
.
deleteUserSearchList4Sale
(
wxId
,
wechatUserId
);
return
new
ResponseDto
<>();
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/service/impl/BookAdviserServiceImpl.java
View file @
6b68fa95
...
@@ -171,4 +171,10 @@ public class BookAdviserServiceImpl implements BookAdviserService {
...
@@ -171,4 +171,10 @@ public class BookAdviserServiceImpl implements BookAdviserService {
public
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
BookVarietyStatsDto
>>>
getAdviserBookVarietyStats
(
@RequestBody
List
<
BookVarietyStatsRequestDto
>
requestDtos
)
throws
BizException
{
public
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
BookVarietyStatsDto
>>>
getAdviserBookVarietyStats
(
@RequestBody
List
<
BookVarietyStatsRequestDto
>
requestDtos
)
throws
BizException
{
return
ResponseHandleUtil
.
toResponse
(
bookAdviserBiz
.
getAdviserBookVarietyStats
(
requestDtos
));
return
ResponseHandleUtil
.
toResponse
(
bookAdviserBiz
.
getAdviserBookVarietyStats
(
requestDtos
));
}
}
@Override
@GetMapping
(
"getBookCountByAgentId"
)
public
ResponseEntity
<
ResponseDto
<
Integer
>>
getBookCountByAgentId
(
@RequestParam
(
"agentId"
)
Long
agentId
)
throws
BizException
{
return
ResponseHandleUtil
.
toResponse
(
bookAdviserBiz
.
getBookCount
(
agentId
));
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/vo/request/BookSearchParamVO.java
View file @
6b68fa95
...
@@ -29,4 +29,8 @@ public class BookSearchParamVO {
...
@@ -29,4 +29,8 @@ public class BookSearchParamVO {
@NotNull
@NotNull
private
Integer
numPerPage
;
private
Integer
numPerPage
;
private
Integer
isAdviserBook
;
private
Long
agentId
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/user/AgentConsr.java
View file @
6b68fa95
...
@@ -9,6 +9,7 @@ import com.pcloud.common.dto.ResponseDto;
...
@@ -9,6 +9,7 @@ import com.pcloud.common.dto.ResponseDto;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.usercenter.party.agent.dto.SaleAgentDTO
;
import
com.pcloud.usercenter.party.agent.entity.Agent
;
import
com.pcloud.usercenter.party.agent.entity.Agent
;
import
com.pcloud.usercenter.party.agent.service.AgentService
;
import
com.pcloud.usercenter.party.agent.service.AgentService
;
...
@@ -18,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -18,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -106,4 +108,14 @@ public class AgentConsr {
...
@@ -106,4 +108,14 @@ public class AgentConsr {
}
}
return
name
;
return
name
;
}
}
public
Map
<
Long
,
SaleAgentDTO
>
getSaleAgentMap
(
List
<
Long
>
agentIds
)
{
Map
<
Long
,
SaleAgentDTO
>
saleAgentDTOMap
=
new
HashMap
<>();
try
{
saleAgentDTOMap
=
ResponseHandleUtil
.
parseMap
(
agentService
.
getSaleAgentMap
(
agentIds
),
Long
.
class
,
SaleAgentDTO
.
class
);
}
catch
(
Exception
e
){
LOGGER
.
error
(
"调用getSaleAgentMap获取出版社商铺失败"
+
e
.
getMessage
(),
e
);
}
return
saleAgentDTOMap
;
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/es/biz/ESBookAndAdviserBiz.java
View file @
6b68fa95
...
@@ -17,7 +17,7 @@ public interface ESBookAndAdviserBiz {
...
@@ -17,7 +17,7 @@ public interface ESBookAndAdviserBiz {
Page
<
ESBookAndAdviser
>
getAdviserBooks4ES
(
String
grayStatus
,
String
keyword
,
Long
templetId
,
Long
secondTempletId
,
Integer
currentPage
,
Integer
numPerPage
);
Page
<
ESBookAndAdviser
>
getAdviserBooks4ES
(
String
grayStatus
,
String
keyword
,
Long
templetId
,
Long
secondTempletId
,
Integer
currentPage
,
Integer
numPerPage
);
Page
<
ESBookAndAdviser
>
getESAdviserBooks4Applet
(
String
grayStatus
,
String
keyword
,
List
<
Long
>
templetIds
,
List
<
Long
>
graLabelIds
,
List
<
Long
>
subLabelIds
,
Integer
currentPage
,
Integer
numPerPage
,
List
<
Long
>
scecondTempletIds
);
Page
<
ESBookAndAdviser
>
getESAdviserBooks4Applet
(
String
grayStatus
,
String
keyword
,
List
<
Long
>
templetIds
,
List
<
Long
>
graLabelIds
,
List
<
Long
>
subLabelIds
,
Integer
currentPage
,
Integer
numPerPage
,
List
<
Long
>
scecondTempletIds
,
Integer
isAdviserBook
,
List
<
Long
>
adviserIds
,
Long
agentId
);
void
deleteAdviserBooks4ES
();
void
deleteAdviserBooks4ES
();
...
...
pcloud-service-book/src/main/java/com/pcloud/book/es/biz/impl/ESBookAndAdviserBizImpl.java
View file @
6b68fa95
...
@@ -235,16 +235,18 @@ public class ESBookAndAdviserBizImpl implements ESBookAndAdviserBiz {
...
@@ -235,16 +235,18 @@ public class ESBookAndAdviserBizImpl implements ESBookAndAdviserBiz {
}
}
@Override
@Override
public
Page
<
ESBookAndAdviser
>
getESAdviserBooks4Applet
(
String
grayStatus
,
String
keyword
,
List
<
Long
>
templetIds
,
List
<
Long
>
graLabelIds
,
List
<
Long
>
subLabelIds
,
Integer
currentPage
,
Integer
numPerPage
,
List
<
Long
>
scecondTempletIds
)
{
public
Page
<
ESBookAndAdviser
>
getESAdviserBooks4Applet
(
String
grayStatus
,
String
keyword
,
List
<
Long
>
templetIds
,
List
<
Long
>
graLabelIds
,
List
<
Long
>
subLabelIds
,
Integer
currentPage
,
Integer
numPerPage
,
List
<
Long
>
scecondTempletIds
,
Integer
isAdviserBook
,
List
<
Long
>
adviserIds
,
Long
agentId
)
{
BoolQueryBuilder
boolQueryBuilder
=
QueryBuilders
.
boolQuery
()
BoolQueryBuilder
boolQueryBuilder
=
QueryBuilders
.
boolQuery
()
.
filter
(
QueryBuilders
.
termQuery
(
"isBookDelete"
,
0
))
.
filter
(
QueryBuilders
.
termQuery
(
"isBookDelete"
,
0
))
.
filter
(
ListUtils
.
isEmpty
(
templetIds
)
?
QueryBuilders
.
boolQuery
()
:
QueryBuilders
.
termsQuery
(
"templetId"
,
templetIds
));
.
filter
(
QueryBuilders
.
termQuery
(
"isBookAdviserDelete"
,
0
))
.
filter
(
ListUtils
.
isEmpty
(
templetIds
)
?
QueryBuilders
.
boolQuery
()
:
QueryBuilders
.
termsQuery
(
"templetId"
,
templetIds
))
.
filter
(
null
==
agentId
?
QueryBuilders
.
boolQuery
()
:
QueryBuilders
.
termsQuery
(
"adviserId"
,
adviserIds
));
BoolQueryBuilder
should
=
QueryBuilders
.
boolQuery
()
BoolQueryBuilder
should
=
QueryBuilders
.
boolQuery
()
.
should
(
StringUtil
.
isEmpty
(
keyword
)
?
QueryBuilders
.
boolQuery
()
:
QueryBuilders
.
wildcardQuery
(
"bookName"
,
"*"
+
keyword
+
"*"
))
.
should
(
StringUtil
.
isEmpty
(
keyword
)
?
QueryBuilders
.
boolQuery
()
:
QueryBuilders
.
wildcardQuery
(
"bookName"
,
"*"
+
keyword
+
"*"
))
.
should
(
StringUtil
.
isEmpty
(
keyword
)
?
QueryBuilders
.
boolQuery
()
:
QueryBuilders
.
wildcardQuery
(
"isbn"
,
"*"
+
keyword
+
"*"
));
.
should
(
StringUtil
.
isEmpty
(
keyword
)
?
QueryBuilders
.
boolQuery
()
:
QueryBuilders
.
wildcardQuery
(
"isbn"
,
"*"
+
keyword
+
"*"
));
BoolQueryBuilder
should1
=
QueryBuilders
.
boolQuery
()
BoolQueryBuilder
should1
=
QueryBuilders
.
boolQuery
()
.
should
(
QueryBuilders
.
termQuery
(
"isBookAdviserDelete"
,
0
))
.
should
(
null
==
isAdviserBook
?
QueryBuilders
.
boolQuery
()
:
QueryBuilders
.
termQuery
(
"isAdviserBook"
,
isAdviserBook
));
.
should
(
QueryBuilders
.
termQuery
(
"isAdviserBook"
,
0
));
//(年级&&科目)||二级分类
//(年级&&科目)||二级分类
BoolQueryBuilder
must1
=
QueryBuilders
.
boolQuery
()
BoolQueryBuilder
must1
=
QueryBuilders
.
boolQuery
()
.
filter
(
ListUtils
.
isEmpty
(
graLabelIds
)
?
QueryBuilders
.
boolQuery
()
:
QueryBuilders
.
termsQuery
(
"graLabelId"
,
graLabelIds
))
.
filter
(
ListUtils
.
isEmpty
(
graLabelIds
)
?
QueryBuilders
.
boolQuery
()
:
QueryBuilders
.
termsQuery
(
"graLabelId"
,
graLabelIds
))
...
...
pcloud-service-book/src/main/resources/mapper/applet/BuyBookRequest.Mapper.xml
0 → 100644
View file @
6b68fa95
<?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.BuyBookRequestDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.applet.entity.BuyBookRequest"
>
<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=
"agent_id"
property=
"agentId"
jdbcType=
"BIGINT"
/>
<result
column=
"wechat_user_id"
property=
"wechatUserId"
jdbcType=
"BIGINT"
/>
<result
column=
"user_name"
property=
"userName"
jdbcType=
"VARCHAR"
/>
<result
column=
"phone"
property=
"phone"
jdbcType=
"VARCHAR"
/>
<result
column=
"address"
property=
"address"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, book_id, adviser_id, channel_id, agent_id, wechat_user_id, user_name, phone, address, create_time, update_time
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM buy_book_request
WHERE id = #{id}
</select>
<select
id=
"getList"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM buy_book_request
</select>
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
INSERT INTO buy_book_request(
book_id,
adviser_id,
channel_id,
agent_id,
wechat_user_id,
user_name,
phone,
address,
create_time,
update_time
) VALUES (
#{bookId, jdbcType=BIGINT},
#{adviserId, jdbcType=BIGINT},
#{channelId, jdbcType=BIGINT},
#{agentId, jdbcType=BIGINT},
#{wechatUserId, jdbcType=BIGINT},
#{userName, jdbcType=VARCHAR},
#{phone, jdbcType=VARCHAR},
#{address, jdbcType=VARCHAR},
now(),
now()
)
</insert>
<insert
id=
"batchInsert"
>
INSERT INTO buy_book_request (
book_id,
adviser_id,
channel_id,
agent_id,
wechat_user_id,
user_name,
phone,
address,
create_time,
update_time
) VALUES
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(
#{item.bookId, jdbcType=BIGINT},
#{item.adviserId, jdbcType=BIGINT},
#{item.channelId, jdbcType=BIGINT},
#{item.agentId, jdbcType=BIGINT},
#{item.wechatUserId, jdbcType=BIGINT},
#{item.userName, jdbcType=VARCHAR},
#{item.phone, jdbcType=VARCHAR},
#{item.address, jdbcType=VARCHAR},
#{item.createTime, jdbcType=TIMESTAMP},
#{item.updateTime, jdbcType=TIMESTAMP}
)
</foreach>
</insert>
<!--通过主键修改数据-->
<update
id=
"update"
>
UPDATE buy_book_request
<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=
"agentId != null"
>
agent_id = #{agentId},
</if>
<if
test=
"wechatUserId != null"
>
wechat_user_id = #{wechatUserId},
</if>
<if
test=
"userName != null and userName != ''"
>
user_name = #{userName},
</if>
<if
test=
"phone != null and phone != ''"
>
phone = #{phone},
</if>
<if
test=
"address != null and address != ''"
>
address = #{address},
</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 buy_book_request where id = #{id}
</delete>
<select
id=
"getUserCount"
resultType=
"com.pcloud.book.applet.entity.BuyBookRequest"
>
select
wechat_user_id wechatUserId,
book_id bookId
from
buy_book_request
order by
create_time desc
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/applet/HotBookSale.Mapper.xml
0 → 100644
View file @
6b68fa95
<?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.HotBookSaleDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.applet.entity.HotBookSale"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"book_id"
property=
"bookId"
jdbcType=
"INTEGER"
/>
<result
column=
"seq_num"
property=
"seqNum"
jdbcType=
"INTEGER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, book_id, seq_num, create_time
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM hot_book_sale
WHERE id = #{id}
</select>
<select
id=
"getList"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM hot_book_sale
</select>
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
INSERT INTO hot_book_sale(
book_id,
seq_num,
create_time
) VALUES (
#{bookId, jdbcType=INTEGER},
#{seqNum, jdbcType=INTEGER},
now()
)
</insert>
<insert
id=
"batchInsert"
>
INSERT INTO hot_book_sale (
book_id,
seq_num,
create_time
) VALUES
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(
#{item.bookId, jdbcType=INTEGER},
#{item.seqNum, jdbcType=INTEGER},
#{item.createTime, jdbcType=TIMESTAMP}
)
</foreach>
</insert>
<!--通过主键修改数据-->
<update
id=
"update"
>
UPDATE hot_book_sale
<set>
<if
test=
"bookId != null"
>
book_id = #{bookId},
</if>
<if
test=
"seqNum != null"
>
seq_num = #{seqNum},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
</set>
WHERE id = #{id}
</update>
<!--通过主键删除-->
<delete
id=
"deleteById"
>
DELETE FROM hot_book_sale where id = #{id}
</delete>
<select
id=
"getMaxSeqNum"
resultType=
"integer"
>
select ifnull(max(seq_num),0) from hot_book_sale
</select>
<select
id=
"getHotBookList"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.entity.HotBookSale"
>
select
h.id,
h.book_id bookId,
h.seq_num seqNum,
h.create_time createTime,
b.BOOK_NAME bookName,
b.COVER_IMG coverImg,
b.author,
b.publish,
a.ADVISER_ID adviserId,
a.channel_id channelId,
count(r.id) searchCount
from hot_book_sale h
LEFT JOIN search_record_sale r
on h.id=r.hot_book_id
INNER JOIN book b
on h.book_id=b.BOOK_ID
INNER JOIN book_adviser a
ON h.book_id=a.BOOK_ID
group by h.id
order by h.seq_num
</select>
<update
id=
"updateSeqNum"
parameterType=
"map"
>
update hot_book_sale
set seq_num=#{seqNum}
where id=#{id}
</update>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/book/SearchRecordDisSale.Mapper.xml
0 → 100644
View file @
6b68fa95
<?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.SearchRecordDisSaleDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.book.entity.SearchRecordDis"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"content"
property=
"content"
jdbcType=
"VARCHAR"
/>
<result
column=
"book_id"
property=
"bookId"
jdbcType=
"INTEGER"
/>
<result
column=
"agent_id"
property=
"agentId"
jdbcType=
"INTEGER"
/>
<result
column=
"wx_id"
property=
"wxId"
jdbcType=
"VARCHAR"
/>
<result
column=
"wechat_user_id"
property=
"wechatUserId"
jdbcType=
"INTEGER"
/>
<result
column=
"hot_book_id"
property=
"hotBookId"
jdbcType=
"INTEGER"
/>
<result
column=
"user_delete"
property=
"userDelete"
jdbcType=
"BOOLEAN"
/>
<result
column=
"search_count"
property=
"searchCount"
jdbcType=
"INTEGER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<resultMap
id=
"SearchRecordResultMap"
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=
"wechat_user_id"
property=
"wechatUserId"
jdbcType=
"BIGINT"
/>
<result
column=
"hot_book_id"
property=
"hotBookId"
jdbcType=
"BIGINT"
/>
<result
column=
"user_delete"
property=
"userDelete"
jdbcType=
"BOOLEAN"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"INTEGER"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, content, book_id, agent_id, wx_id, wechat_user_id, hot_book_id, user_delete, search_count, create_time, update_time
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM search_record_dis_sale
WHERE id = #{id}
</select>
<select
id=
"getList"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM search_record_dis_sale
</select>
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
INSERT INTO search_record_dis_sale(
content,
book_id,
agent_id,
wx_id,
wechat_user_id,
hot_book_id,
create_time,
update_time
) VALUES (
#{content, jdbcType=VARCHAR},
#{bookId, jdbcType=INTEGER},
#{agentId, jdbcType=INTEGER},
#{wxId, jdbcType=VARCHAR},
#{wechatUserId, jdbcType=INTEGER},
#{hotBookId, jdbcType=INTEGER},
now(),
now()
)
</insert>
<insert
id=
"batchInsert"
>
INSERT INTO search_record_dis_sale (
content,
book_id,
agent_id,
wx_id,
wechat_user_id,
hot_book_id,
create_time,
update_time
) VALUES
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(
#{item.content, jdbcType=VARCHAR},
#{item.bookId, jdbcType=INTEGER},
#{item.agentId, jdbcType=INTEGER},
#{item.wxId, jdbcType=VARCHAR},
#{item.wechatUserId, jdbcType=INTEGER},
#{item.hotBookId, jdbcType=INTEGER},
now(),
now()
)
</foreach>
</insert>
<!--通过主键修改数据-->
<update
id=
"update"
>
UPDATE search_record_dis_sale
<set>
<if
test=
"content != null and content != ''"
>
content = #{content},
</if>
<if
test=
"bookId != null"
>
book_id = #{bookId},
</if>
<if
test=
"agentId != null"
>
agent_id = #{agentId},
</if>
<if
test=
"wxId != null and wxId != ''"
>
wx_id = #{wxId},
</if>
<if
test=
"wechatUserId != null"
>
wechat_user_id = #{wechatUserId},
</if>
<if
test=
"hotBookId != null"
>
hot_book_id = #{hotBookId},
</if>
<if
test=
"userDelete != null"
>
user_delete = #{userDelete},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
search_count=search_count+1,
update_time = now(),
</set>
WHERE id = #{id}
</update>
<!--通过主键删除-->
<delete
id=
"deleteById"
>
DELETE FROM search_record_dis_sale where id = #{id}
</delete>
<select
id=
"getByCondition"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from search_record_dis_sale
where user_delete=0
and content=#{content}
<if
test=
"wechatUserId!=null"
>
and wechat_user_id=#{wechatUserId}
</if>
<if
test=
"wxId!=null"
>
and wx_id=#{wxId}
</if>
limit 1
</select>
<update
id=
"updateUserDeleteByWxId"
parameterType=
"map"
>
update search_record_dis_sale
set user_delete=#{userDelete},update_time = now()
where wx_id=#{wxId}
</update>
<update
id=
"updateUserDeleteByWechatUserId"
parameterType=
"map"
>
update search_record_dis_sale
set user_delete=#{userDelete}, update_time = now()
where wechat_user_id=#{wechatUserId}
</update>
<select
id=
"getUserSearchList4H5"
parameterType=
"map"
resultMap=
"SearchRecordResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
FROM
search_record_dis_sale
WHERE
user_delete = 0
<if
test=
"wxId!=null"
>
and wx_id = #{wxId}
</if>
<if
test=
"wechatUserId!=null"
>
and wechat_user_id = #{wechatUserId}
</if>
ORDER by update_time DESC
</select>
<select
id=
"countUserSearchList4H5"
parameterType=
"map"
resultType=
"integer"
>
select
count(1)
FROM
search_record_dis_sale
WHERE
user_delete = 0
<if
test=
"wxId!=null"
>
and wx_id = #{wxId}
</if>
<if
test=
"wechatUserId!=null"
>
and wechat_user_id = #{wechatUserId}
</if>
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/book/SearchRecordSale.Mapper.xml
0 → 100644
View file @
6b68fa95
<?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.SearchRecordSaleDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.book.entity.SearchRecord"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"content"
property=
"content"
jdbcType=
"VARCHAR"
/>
<result
column=
"book_id"
property=
"bookId"
jdbcType=
"INTEGER"
/>
<result
column=
"agent_id"
property=
"agentId"
jdbcType=
"INTEGER"
/>
<result
column=
"wx_id"
property=
"wxId"
jdbcType=
"VARCHAR"
/>
<result
column=
"wechat_user_id"
property=
"wechatUserId"
jdbcType=
"INTEGER"
/>
<result
column=
"hot_book_id"
property=
"hotBookId"
jdbcType=
"INTEGER"
/>
<result
column=
"user_delete"
property=
"userDelete"
jdbcType=
"BOOLEAN"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, content, book_id, agent_id, wx_id, wechat_user_id, hot_book_id, user_delete, create_time
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM search_record_sale
WHERE id = #{id}
</select>
<select
id=
"getList"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM search_record_sale
</select>
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
INSERT INTO search_record_sale(
content,
book_id,
agent_id,
wx_id,
wechat_user_id,
hot_book_id,
create_time,
update_time
) VALUES (
#{content, jdbcType=VARCHAR},
#{bookId, jdbcType=INTEGER},
#{agentId, jdbcType=INTEGER},
#{wxId, jdbcType=VARCHAR},
#{wechatUserId, jdbcType=INTEGER},
#{hotBookId, jdbcType=INTEGER},
now(),
now()
)
</insert>
<insert
id=
"batchInsert"
>
INSERT INTO search_record_sale (
content,
book_id,
agent_id,
wx_id,
wechat_user_id,
hot_book_id,
create_time,
update_time
) VALUES
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(
#{item.content, jdbcType=VARCHAR},
#{item.bookId, jdbcType=INTEGER},
#{item.agentId, jdbcType=INTEGER},
#{item.wxId, jdbcType=VARCHAR},
#{item.wechatUserId, jdbcType=INTEGER},
#{item.hotBookId, jdbcType=INTEGER},
now(),
now()
)
</foreach>
</insert>
<!--通过主键修改数据-->
<update
id=
"update"
>
UPDATE search_record_sale
<set>
<if
test=
"content != null and content != ''"
>
content = #{content},
</if>
<if
test=
"bookId != null"
>
book_id = #{bookId},
</if>
<if
test=
"agentId != null"
>
agent_id = #{agentId},
</if>
<if
test=
"wxId != null and wxId != ''"
>
wx_id = #{wxId},
</if>
<if
test=
"wechatUserId != null"
>
wechat_user_id = #{wechatUserId},
</if>
<if
test=
"hotBookId != null"
>
hot_book_id = #{hotBookId},
</if>
<if
test=
"userDelete != null"
>
user_delete = #{userDelete},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
update_time = #{updateTime},
</set>
WHERE id = #{id}
</update>
<!--通过主键删除-->
<delete
id=
"deleteById"
>
DELETE FROM search_record_sale where id = #{id}
</delete>
<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_sale
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_sale
where content=#{content}
<if
test=
"bookId!=null"
>
and book_id=#{bookId}
</if>
<if
test=
"agentId!=null"
>
and agent_id=#{agentId}
</if>
</select>
<delete
id=
"deleteByWxId"
parameterType=
"string"
>
delete from search_record_sale
where wx_id=#{wxId}
</delete>
<select
id=
"getRecent5WxIds"
parameterType=
"long"
resultType=
"string"
>
select distinct wx_id
from search_record_sale
where book_id=#{bookId}
limit 5
</select>
<update
id=
"updateUserDeleteByWxId"
parameterType=
"map"
>
update search_record_sale
set user_delete=#{userDelete}
where wx_id=#{wxId}
</update>
<select
id=
"getBookSearchTop"
parameterType=
"map"
resultType=
"com.pcloud.book.book.vo.BookSearchTopVO"
>
select
content bookName,
book_id bookId,
agent_id agentId
from search_record_sale
where book_id is not null
and agent_id is not null
group by book_id,agent_id
order by count(1) desc
limit #{top}
</select>
<update
id=
"updateUserDeleteByWechatUserId"
parameterType=
"map"
>
update search_record_sale
set user_delete=#{userDelete},
update_time = now()
where wechat_user_id=#{wechatUserId}
</update>
<select
id=
"getBookSearchCount"
parameterType=
"map"
resultType=
"Integer"
>
select ifnull(count(1),0) from(
SELECT
b.BOOK_ID bookId
FROM
(select book_id bookId from
search_record_sale
where wechat_user_id>0 and book_id>0
GROUP BY book_id)c
INNER JOIN
book_adviser a on c.bookId=a.book_id
INNER JOIN book b ON b.BOOK_ID = a.BOOK_ID AND b.IS_DELETE = 0
WHERE
1=1
<if
test=
"keyword !=null"
>
AND (b.BOOK_NAME LIKE CONCAT('%', #{keyword}, '%') or b.ISBN LIKE
CONCAT(#{keyword},'%'))
</if>
GROUP BY b.BOOK_ID
)t
</select>
<select
id=
"getBookSearchIds"
parameterType=
"map"
resultType=
"com.pcloud.book.book.dto.AdviserBookInfoDTO"
>
SELECT
b.BOOK_ID bookId,
b.ISBN isbn,
b.BOOK_NAME bookName,
a.ADVISER_ID adviserId
FROM
(select book_id bookId from
search_record_sale
where wechat_user_id>0 and book_id>0
GROUP BY book_id)c
INNER JOIN
book_adviser a on c.bookId=a.book_id
INNER JOIN book b ON b.BOOK_ID = a.BOOK_ID AND b.IS_DELETE = 0
WHERE
1=1
<if
test=
"keyword !=null"
>
AND (b.BOOK_NAME LIKE CONCAT('%', #{keyword}, '%') or b.ISBN LIKE CONCAT(#{keyword},'%'))
</if>
group by b.BOOK_ID
order by count(1) desc
limit #{pageNum}, #{numPerPage}
</select>
<select
id=
"getWechatUserIds"
parameterType=
"map"
resultType=
"Long"
>
select distinct wechat_user_id
from search_record_sale
where book_id=#{bookId}
and wechat_user_id>0
</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