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
20dbb89e
Commit
20dbb89e
authored
Nov 03, 2020
by
桂前礼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: [1003651] 强化banner的转化和灵活配置能力
parent
636613d8
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
782 additions
and
102 deletions
+782
-102
AppletBannerBiz.java
...main/java/com/pcloud/book/applet/biz/AppletBannerBiz.java
+3
-1
AppletBannerBizImpl.java
.../com/pcloud/book/applet/biz/impl/AppletBannerBizImpl.java
+222
-10
AppletBannerDTO.java
...main/java/com/pcloud/book/applet/dto/AppletBannerDTO.java
+21
-1
AppletBannerStats.java
...in/java/com/pcloud/book/applet/dto/AppletBannerStats.java
+14
-0
ServeItemInfoDTO.java
...ain/java/com/pcloud/book/applet/dto/ServeItemInfoDTO.java
+47
-0
AppletBanner.java
...main/java/com/pcloud/book/applet/entity/AppletBanner.java
+16
-1
AppletBannerRecord.java
...ava/com/pcloud/book/applet/entity/AppletBannerRecord.java
+62
-0
AppletHomeFacade.java
.../java/com/pcloud/book/applet/facade/AppletHomeFacade.java
+17
-7
AppletBannerRecordMapper.java
...m/pcloud/book/applet/mapper/AppletBannerRecordMapper.java
+29
-0
RightsSettingBiz.java
...a/com/pcloud/book/rightsSetting/biz/RightsSettingBiz.java
+2
-0
RightsSettingBizImpl.java
...oud/book/rightsSetting/biz/impl/RightsSettingBizImpl.java
+46
-8
AppletBanner.xml
...ce-book/src/main/resources/mapper/applet/AppletBanner.xml
+163
-74
AppletBannerRecordMapper.xml
...main/resources/mapper/applet/AppletBannerRecordMapper.xml
+140
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AppletBannerBiz.java
View file @
20dbb89e
...
@@ -49,5 +49,7 @@ public interface AppletBannerBiz {
...
@@ -49,5 +49,7 @@ public interface AppletBannerBiz {
* @date:2020/7/17 16:03
* @date:2020/7/17 16:03
* * @param null
* * @param null
*/
*/
PageBeanNew
<
AppletBannerDTO
>
listBanner4Wechat
(
Integer
currentPage
,
Integer
numPerPage
,
Boolean
showState
,
Long
officialAccountsId
);
PageBeanNew
<
AppletBannerDTO
>
listBanner4Wechat
(
Integer
currentPage
,
Integer
numPerPage
,
Boolean
showState
,
Long
officialAccountsId
,
Long
wechatUserId
);
void
bannerClickRecord
(
Long
wechatUserId
,
Long
bannerId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletBannerBizImpl.java
View file @
20dbb89e
package
com
.
pcloud
.
book
.
applet
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
applet
.
biz
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.applet.biz.AppletBannerBiz
;
import
com.pcloud.book.applet.biz.AppletBannerBiz
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
import
com.pcloud.book.applet.dao.AppletBannerDao
;
import
com.pcloud.book.applet.dao.AppletBannerDao
;
import
com.pcloud.book.applet.dao.AppletUserBookcaseDao
;
import
com.pcloud.book.applet.dto.AppletBannerDTO
;
import
com.pcloud.book.applet.dto.AppletBannerDTO
;
import
com.pcloud.book.applet.dto.AppletBannerStats
;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.book.applet.dto.ServeItemInfoDTO
;
import
com.pcloud.book.applet.entity.AppletBanner
;
import
com.pcloud.book.applet.entity.AppletBanner
;
import
com.pcloud.book.applet.entity.AppletBannerRecord
;
import
com.pcloud.book.applet.entity.AppletUserBookcase
;
import
com.pcloud.book.applet.enums.AppletRecordTypeEnum
;
import
com.pcloud.book.applet.mapper.AppletBannerRecordMapper
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.user.ChannelConsr
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.util.properties.BookProps
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.channelcenter.wechat.entity.AccountSetting
;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.group.tools.SendWeixinRequestTools
;
import
com.pcloud.book.rightsSetting.biz.RightsSettingBiz
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ParamChecker
;
import
com.pcloud.common.utils.ServeLinkUtils
;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.ExecutionException
;
import
java.util.stream.Collectors
;
/**
/**
* 小程序banner
* 小程序banner
*/
*/
@Component
@Component
@Slf4j
public
class
AppletBannerBizImpl
implements
AppletBannerBiz
{
public
class
AppletBannerBizImpl
implements
AppletBannerBiz
{
@Autowired
@Autowired
private
AppletBannerDao
appletBannerDao
;
private
AppletBannerDao
appletBannerDao
;
@Autowired
@Autowired
private
AppletNewsBiz
appletNewsBiz
;
private
AppletNewsBiz
appletNewsBiz
;
@Autowired
private
AppletBannerRecordMapper
appletBannerRecordMapper
;
@Autowired
private
ProductConsr
productConsr
;
@Autowired
private
AppConsr
appConsr
;
@Autowired
private
AppletUserBookcaseDao
appletUserBookcaseDao
;
@Autowired
private
RightsSettingBiz
rightsSettingBiz
;
@Autowired
private
QrcodeSceneConsr
qrcodeSceneConsr
;
@Override
@Override
public
Long
addBanner
(
AppletBanner
appletBanner
)
{
public
Long
addBanner
(
AppletBanner
appletBanner
)
{
if
(!
ListUtil
.
toList
(
3
,
4
).
contains
(
appletBanner
.
getJumpType
()))
{
ParamChecker
.
checkStringIsEmpty
(
appletBanner
.
getBannerPic
(),
"Banner图缺失!"
);
}
if
(
null
==
appletBanner
.
getAgentId
()){
if
(
null
==
appletBanner
.
getAgentId
()){
appletBanner
.
setAgentId
(
0L
);
appletBanner
.
setAgentId
(
0L
);
}
}
...
@@ -48,6 +89,9 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
...
@@ -48,6 +89,9 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
if
(
null
==
appletBanner
.
getId
()){
if
(
null
==
appletBanner
.
getId
()){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少id"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少id"
);
}
}
if
(
Objects
.
nonNull
(
appletBanner
.
getJumpType
())
&&
!
ListUtil
.
toList
(
3
,
4
).
contains
(
appletBanner
.
getJumpType
()))
{
ParamChecker
.
checkStringIsEmpty
(
appletBanner
.
getBannerPic
(),
"Banner图缺失!"
);
}
appletBannerDao
.
update
(
appletBanner
);
appletBannerDao
.
update
(
appletBanner
);
}
}
...
@@ -62,23 +106,191 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
...
@@ -62,23 +106,191 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
AppletBannerDTO
appletBannerDTO
=
new
AppletBannerDTO
();
AppletBannerDTO
appletBannerDTO
=
new
AppletBannerDTO
();
if
(
null
!=
appletBanner
){
if
(
null
!=
appletBanner
){
BeanUtils
.
copyProperties
(
appletBanner
,
appletBannerDTO
);
BeanUtils
.
copyProperties
(
appletBanner
,
appletBannerDTO
);
fillServeInfo
(
ListUtil
.
toList
(
appletBannerDTO
));
List
<
AppletBannerStats
>
bannerPVUV
=
appletBannerRecordMapper
.
getBannerPVUV
(
ListUtil
.
toList
(
appletBanner
.
getId
()));
if
(
CollUtil
.
isNotEmpty
(
bannerPVUV
)
&&
Objects
.
nonNull
(
bannerPVUV
.
get
(
0
))){
AppletBannerStats
appletBannerStats
=
bannerPVUV
.
get
(
0
);
String
pv
=
Objects
.
nonNull
(
appletBannerStats
.
getPv
())
?
String
.
valueOf
(
appletBannerStats
.
getPv
())
:
"0"
;
String
uv
=
Objects
.
nonNull
(
appletBannerStats
.
getUv
())
?
String
.
valueOf
(
appletBannerStats
.
getUv
())
:
"0"
;
appletBannerDTO
.
setClickPVUV
(
pv
+
"/"
+
uv
);
}
}
}
return
appletBannerDTO
;
return
appletBannerDTO
;
}
}
@Override
@Override
public
PageBeanNew
<
AppletBannerDTO
>
listBanner
(
Integer
currentPage
,
Integer
numPerPage
,
Boolean
showState
,
Long
agentId
)
{
public
PageBeanNew
<
AppletBannerDTO
>
listBanner
(
Integer
currentPage
,
Integer
numPerPage
,
Boolean
showState
,
Long
agentId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"showState"
,
showState
);
map
.
put
(
"showState"
,
showState
);
map
.
put
(
"agentId"
,
agentId
);
map
.
put
(
"agentId"
,
agentId
);
PageBeanNew
<
AppletBannerDTO
>
pageBeanNew
=
appletBannerDao
.
listPageNew
(
PageBeanNew
<
AppletBannerDTO
>
banner
=
appletBannerDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"listBanner"
);
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"listBanner"
);
if
(
Objects
.
isNull
(
banner
)
||
CollUtil
.
isEmpty
(
banner
.
getRecordList
()))
{
return
pageBeanNew
;
return
banner
;
}
// 填充 资讯 | 作品 | 应用 信息
fillServeInfo
(
banner
.
getRecordList
());
List
<
Long
>
bannerIds
=
banner
.
getRecordList
().
stream
().
filter
(
Objects:
:
nonNull
).
map
(
AppletBannerDTO:
:
getId
).
collect
(
Collectors
.
toList
());
if
(
CollUtil
.
isEmpty
(
bannerIds
))
{
return
banner
;
}
// 根据 bannerId 统计 PV/UV
List
<
AppletBannerStats
>
bannerPVUV
=
appletBannerRecordMapper
.
getBannerPVUV
(
bannerIds
);
if
(
CollUtil
.
isEmpty
(
bannerPVUV
))
{
return
banner
;
}
Map
<
Long
,
AppletBannerStats
>
bannerStatsMap
=
bannerPVUV
.
stream
()
.
collect
(
Collectors
.
toMap
(
AppletBannerStats:
:
getBannerId
,
AppletBannerStats
->
AppletBannerStats
));
banner
.
getRecordList
().
forEach
(
item
->
{
if
(
Objects
.
nonNull
(
item
)
&&
Objects
.
nonNull
(
item
.
getId
())
&&
CollUtil
.
isNotEmpty
(
bannerStatsMap
)
&&
Objects
.
nonNull
(
bannerStatsMap
.
get
(
item
.
getId
())))
{
AppletBannerStats
bannerStats
=
bannerStatsMap
.
get
(
item
.
getId
());
String
pv
=
Objects
.
nonNull
(
bannerStats
.
getPv
())
?
String
.
valueOf
(
bannerStats
.
getPv
())
:
"0"
;
String
uv
=
Objects
.
nonNull
(
bannerStats
.
getUv
())
?
String
.
valueOf
(
bannerStats
.
getUv
())
:
"0"
;
item
.
setClickPVUV
(
pv
+
"/"
+
uv
);
}
});
return
banner
;
}
private
void
fillServeInfo
(
List
<
AppletBannerDTO
>
recordList
)
{
// 获取资讯信息
Map
<
Long
,
AppletNewsDTO
>
newsDTOMap
=
new
HashMap
<>();
CompletableFuture
<
List
<
Long
>>
newsBannerFuture
=
CompletableFuture
.
supplyAsync
(()
->
recordList
.
stream
()
.
filter
(
x
->
Objects
.
nonNull
(
x
)
&&
Objects
.
equals
(
x
.
getJumpType
(),
3
))
.
map
(
AppletBannerDTO:
:
getServeId
).
filter
(
Objects:
:
nonNull
).
distinct
()
.
collect
(
Collectors
.
toList
())).
whenComplete
((
list
,
throwable
)
->
{
if
(
Objects
.
nonNull
(
throwable
))
{
log
.
error
(
"[fillServeInfo] banner 图填充资讯信息失败,err:{}"
,
throwable
.
getMessage
(),
throwable
);
}
else
{
if
(
CollUtil
.
isEmpty
(
list
)){
return
;
}
Map
<
Long
,
AppletNewsDTO
>
dtoMap
=
appletNewsBiz
.
getByIds
(
list
);
newsDTOMap
.
putAll
(
Objects
.
nonNull
(
dtoMap
)
?
dtoMap
:
new
HashMap
<>());
}
});
// 获取应用信息
Map
<
Long
,
AppDto
>
appDtoMap
=
new
HashMap
<>();
CompletableFuture
<
List
<
Long
>>
appBannerFuture
=
CompletableFuture
.
supplyAsync
(()
->
recordList
.
stream
()
.
filter
(
x
->
Objects
.
nonNull
(
x
)
&&
Objects
.
equals
(
x
.
getServeType
(),
AppletRecordTypeEnum
.
APP
.
value
))
.
map
(
AppletBannerDTO:
:
getServeId
).
collect
(
Collectors
.
toList
())).
whenComplete
((
list
,
throwable
)
->
{
if
(
Objects
.
nonNull
(
throwable
))
{
log
.
error
(
"[fillServeInfo] banner 图填充应用信息失败,err:{}"
,
throwable
.
getMessage
(),
throwable
);
}
else
{
Map
<
Long
,
AppDto
>
dtoMap
=
!
ListUtils
.
isEmpty
(
list
)
?
appConsr
.
mapByIds4AuditPass
(
list
)
:
new
HashMap
<>();
appDtoMap
.
putAll
(
dtoMap
);
}
});
// 获取作品信息
Map
<
Long
,
ProductDto
>
productDtoMap
=
new
HashMap
<>();
CompletableFuture
<
List
<
Long
>>
productBannerFuture
=
CompletableFuture
.
supplyAsync
(()
->
recordList
.
stream
()
.
filter
(
x
->
Objects
.
nonNull
(
x
)
&&
Objects
.
equals
(
x
.
getServeType
(),
AppletRecordTypeEnum
.
PRODUCT
.
value
))
.
map
(
AppletBannerDTO:
:
getServeId
).
collect
(
Collectors
.
toList
())).
whenComplete
((
list
,
throwable
)
->
{
if
(
Objects
.
nonNull
(
throwable
))
{
log
.
error
(
"[fillServeInfo] banner 图填充作品信息失败,err:{}"
,
throwable
.
getMessage
(),
throwable
);
}
else
{
Map
<
Long
,
ProductDto
>
dtoMap
=
!
ListUtils
.
isEmpty
(
list
)
?
productConsr
.
getProBasesByIds
(
list
)
:
new
HashMap
<>();
productDtoMap
.
putAll
(
dtoMap
);
}
});
try
{
CompletableFuture
.
allOf
(
newsBannerFuture
,
appBannerFuture
,
productBannerFuture
).
get
();
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
log
.
error
(
"[fillServeInfo] banner 填充信息失败,err:{}"
,
e
.
getMessage
(),
e
);
}
// 填充信息
for
(
AppletBannerDTO
banner
:
recordList
)
{
if
(
Objects
.
nonNull
(
banner
)
&&
Objects
.
nonNull
(
banner
.
getServeId
())
&&
Objects
.
nonNull
(
banner
.
getServeType
()))
{
Integer
serveType
=
banner
.
getServeType
();
if
(
Objects
.
equals
(
banner
.
getJumpType
(),
3
)
&&
Objects
.
nonNull
(
newsDTOMap
.
get
(
banner
.
getServeId
())))
{
banner
.
setNewsItem
(
newsDTOMap
.
get
(
banner
.
getServeId
()));
}
else
if
(
Objects
.
equals
(
serveType
,
AppletRecordTypeEnum
.
APP
.
value
)
&&
Objects
.
nonNull
(
appDtoMap
.
get
(
banner
.
getServeId
())))
{
AppDto
appDto
=
appDtoMap
.
get
(
banner
.
getServeId
());
String
resultLinkUrl
=
null
;
if
(
Objects
.
nonNull
(
appDto
.
getChannelId
()))
{
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
appDto
.
getChannelId
());
// 根据 APP 拼接 linkUrl
String
linkUrl
=
ServeLinkUtils
.
getServeLink
(
"APP"
,
appDto
.
getTypeCode
(),
appDto
.
getAppId
().
toString
(),
appDto
.
getSceneCode
(),
appDto
.
getChannelId
().
toString
(),
appDto
.
getCreatedUser
().
toString
(),
null
);
if
(
Objects
.
nonNull
(
accountSettingDto
))
{
resultLinkUrl
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
linkUrl
);
}
}
ServeItemInfoDTO
build
=
ServeItemInfoDTO
.
builder
().
serveId
(
appDto
.
getAppId
()).
serveType
(
serveType
)
.
serveName
(
appDto
.
getTitle
()).
servePic
(
appDto
.
getSquareImg
()).
transverseImg
(
appDto
.
getTransverseImg
())
.
resultUrl
(
resultLinkUrl
).
hasThirdLink
(
StrUtil
.
isNotBlank
(
appDto
.
getTurnUrl
()))
.
serveTypeName
(
appDto
.
getTypeName
()).
build
();
banner
.
setAppItem
(
build
);
}
else
if
(
Objects
.
equals
(
serveType
,
AppletRecordTypeEnum
.
PRODUCT
.
value
)
&&
Objects
.
nonNull
(
productDtoMap
.
get
(
banner
.
getServeId
())))
{
ProductDto
productDto
=
productDtoMap
.
get
(
banner
.
getServeId
());
String
resultLinkUrl
=
null
;
if
(
Objects
.
nonNull
(
productDto
.
getChannelId
()))
{
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
productDto
.
getChannelId
());
if
(
null
!=
accountSettingDto
)
{
resultLinkUrl
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
productDto
.
getTurnUrl
());
}
}
ServeItemInfoDTO
build
=
ServeItemInfoDTO
.
builder
().
serveId
(
productDto
.
getProductId
()).
serveType
(
serveType
)
.
serveName
(
productDto
.
getProductName
()).
servePic
(
productDto
.
getCoverImg
()).
transverseImg
(
productDto
.
getPicture1
())
.
resultUrl
(
resultLinkUrl
).
hasThirdLink
(
StrUtil
.
isNotBlank
(
productDto
.
getSkipUrl
()))
.
serveTypeName
(
productDto
.
getProductTypeName
()).
build
();
banner
.
setAppItem
(
build
);
}
}
}
}
}
@Override
@Override
public
PageBeanNew
<
AppletBannerDTO
>
listBanner4Wechat
(
Integer
currentPage
,
Integer
numPerPage
,
Boolean
showState
,
Long
officialAccountsId
)
{
public
PageBeanNew
<
AppletBannerDTO
>
listBanner4Wechat
(
Integer
currentPage
,
Integer
numPerPage
,
Boolean
showState
,
Long
officialAccountsId
,
Long
wechatUserId
)
{
Long
agentId
=
appletNewsBiz
.
getAgentIdByAccountId
(
officialAccountsId
);
Long
agentId
=
appletNewsBiz
.
getAgentIdByAccountId
(
officialAccountsId
);
return
listBanner
(
currentPage
,
numPerPage
,
showState
,
agentId
);
PageBeanNew
<
AppletBannerDTO
>
pageBeanNew
=
listBanner
(
currentPage
,
numPerPage
,
showState
,
agentId
);
// 依据当前用户正在读的书,所属分类获取最新上架的资讯
processFillType
(
pageBeanNew
.
getRecordList
(),
wechatUserId
);
return
pageBeanNew
;
}
private
void
processFillType
(
List
<
AppletBannerDTO
>
recordList
,
Long
wechatUserId
)
{
if
(
CollUtil
.
isEmpty
(
recordList
))
{
return
;
}
List
<
AppletBannerDTO
>
fillBanner
=
recordList
.
stream
().
filter
(
x
->
Objects
.
nonNull
(
x
)
&&
Objects
.
equals
(
x
.
getJumpType
(),
3
)
&&
Objects
.
equals
(
x
.
getFillType
(),
2
)).
collect
(
Collectors
.
toList
());
if
(
CollUtil
.
isEmpty
(
fillBanner
))
{
return
;
}
AppletUserBookcase
userReadBook
=
appletUserBookcaseDao
.
getUserReadBook
(
wechatUserId
);
if
(
Objects
.
isNull
(
userReadBook
))
{
recordList
.
removeAll
(
fillBanner
);
return
;
}
AppletNewsDTO
newsDTO
=
rightsSettingBiz
.
getAppletNewsDTO4UserReadBook
(
userReadBook
);
if
(
Objects
.
isNull
(
newsDTO
)
||
Objects
.
isNull
(
newsDTO
.
getId
()))
{
recordList
.
removeAll
(
fillBanner
);
return
;
}
recordList
.
stream
().
filter
(
x
->
Objects
.
nonNull
(
x
)
&&
Objects
.
equals
(
x
.
getJumpType
(),
3
)
&&
Objects
.
equals
(
x
.
getFillType
(),
2
)).
forEach
(
item
->
item
.
setNewsItem
(
newsDTO
));
}
@Override
public
void
bannerClickRecord
(
Long
wechatUserId
,
Long
bannerId
)
{
AppletBanner
banner
=
appletBannerDao
.
getById
(
bannerId
);
if
(
Objects
.
isNull
(
banner
))
{
appletBannerRecordMapper
.
insert
(
AppletBannerRecord
.
builder
()
.
bannerId
(
bannerId
).
createTime
(
new
Date
()).
wechatUserId
(
wechatUserId
).
build
());
}
else
{
AppletBannerRecord
record
=
AppletBannerRecord
.
builder
()
.
createTime
(
new
Date
()).
wechatUserId
(
wechatUserId
)
.
bannerId
(
bannerId
).
jumpType
(
banner
.
getJumpType
())
.
serveId
(
banner
.
getServeId
()).
serveType
(
banner
.
getServeType
()).
build
();
appletBannerRecordMapper
.
insert
(
record
);
}
}
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/AppletBannerDTO.java
View file @
20dbb89e
...
@@ -4,7 +4,9 @@ import com.pcloud.common.dto.BaseDto;
...
@@ -4,7 +4,9 @@ import com.pcloud.common.dto.BaseDto;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
@Data
@ApiModel
(
"小程序banner"
)
@ApiModel
(
"小程序banner"
)
public
class
AppletBannerDTO
extends
BaseDto
{
public
class
AppletBannerDTO
extends
BaseDto
{
...
@@ -15,7 +17,7 @@ public class AppletBannerDTO extends BaseDto {
...
@@ -15,7 +17,7 @@ public class AppletBannerDTO extends BaseDto {
@ApiModelProperty
(
"banner图"
)
@ApiModelProperty
(
"banner图"
)
private
String
bannerPic
;
private
String
bannerPic
;
@ApiModelProperty
(
"跳转类型
(1指定页面2web页面)
"
)
@ApiModelProperty
(
"跳转类型
1指定页面, 2web页面, 3资讯, 4应用作品
"
)
private
Integer
jumpType
;
private
Integer
jumpType
;
@ApiModelProperty
(
"跳转地址"
)
@ApiModelProperty
(
"跳转地址"
)
...
@@ -26,4 +28,22 @@ public class AppletBannerDTO extends BaseDto {
...
@@ -26,4 +28,22 @@ public class AppletBannerDTO extends BaseDto {
@ApiModelProperty
(
"是否展示"
)
@ApiModelProperty
(
"是否展示"
)
private
Boolean
showState
;
private
Boolean
showState
;
@ApiModelProperty
(
"点击量PV/UV"
)
private
String
clickPVUV
;
@ApiModelProperty
(
"咨询的选择方式 1自定义, 2自动获取"
)
private
Integer
fillType
;
@ApiModelProperty
(
"作品/应用/咨询的ID"
)
private
Long
serveId
;
@ApiModelProperty
(
"作品/应用/咨询的类型"
)
private
Integer
serveType
;
@ApiModelProperty
(
"咨询具体信息"
)
private
AppletNewsDTO
newsItem
;
@ApiModelProperty
(
"咨询具体信息"
)
private
ServeItemInfoDTO
appItem
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/AppletBannerStats.java
0 → 100644
View file @
20dbb89e
package
com
.
pcloud
.
book
.
applet
.
dto
;
import
lombok.Data
;
@Data
public
class
AppletBannerStats
{
private
Long
bannerId
;
private
Long
pv
;
private
Long
uv
;
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/ServeItemInfoDTO.java
0 → 100644
View file @
20dbb89e
package
com
.
pcloud
.
book
.
applet
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
"作品 应用信息封装"
)
public
class
ServeItemInfoDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
127018233194941988L
;
@ApiModelProperty
(
"ID"
)
private
Long
serveId
;
@ApiModelProperty
(
"类型"
)
private
Integer
serveType
;
@ApiModelProperty
(
"名称"
)
private
String
serveName
;
@ApiModelProperty
(
"类型名称"
)
private
String
serveTypeName
;
@ApiModelProperty
(
"图片"
)
private
String
servePic
;
@ApiModelProperty
(
"宽图"
)
private
String
transverseImg
;
@ApiModelProperty
(
"跳转链接"
)
private
String
resultUrl
;
@ApiModelProperty
(
"是否包含第三方链接"
)
private
Boolean
hasThirdLink
;
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AppletBanner.java
View file @
20dbb89e
...
@@ -4,7 +4,9 @@ import com.pcloud.common.entity.BaseEntity;
...
@@ -4,7 +4,9 @@ import com.pcloud.common.entity.BaseEntity;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
@Data
@ApiModel
(
"小程序banner"
)
@ApiModel
(
"小程序banner"
)
public
class
AppletBanner
extends
BaseEntity
{
public
class
AppletBanner
extends
BaseEntity
{
...
@@ -12,7 +14,7 @@ public class AppletBanner extends BaseEntity {
...
@@ -12,7 +14,7 @@ public class AppletBanner extends BaseEntity {
@ApiModelProperty
(
"banner图"
)
@ApiModelProperty
(
"banner图"
)
private
String
bannerPic
;
private
String
bannerPic
;
@ApiModelProperty
(
"跳转类型
(1指定页面2web页面)
"
)
@ApiModelProperty
(
"跳转类型
1指定页面, 2web页面, 3资讯, 4应用|作品
"
)
private
Integer
jumpType
;
private
Integer
jumpType
;
@ApiModelProperty
(
"跳转地址"
)
@ApiModelProperty
(
"跳转地址"
)
...
@@ -26,4 +28,17 @@ public class AppletBanner extends BaseEntity {
...
@@ -26,4 +28,17 @@ public class AppletBanner extends BaseEntity {
@ApiModelProperty
(
"出版社id"
)
@ApiModelProperty
(
"出版社id"
)
private
Long
agentId
;
private
Long
agentId
;
/**
* 选择自动获取,将依据当前用户正在读的书,所属分类获取最新上架的资讯,
* 同时,如果不传banner将会自动获取咨询对应的大图
*/
@ApiModelProperty
(
"咨询的选择方式 1自定义, 2自动获取"
)
private
Integer
fillType
;
@ApiModelProperty
(
"作品/应用/咨询的ID"
)
private
Long
serveId
;
@ApiModelProperty
(
"作品/应用/咨询的类型"
)
private
Integer
serveType
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AppletBannerRecord.java
0 → 100644
View file @
20dbb89e
package
com
.
pcloud
.
book
.
applet
.
entity
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* applet_banner_record
* @author guiq
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
AppletBannerRecord
implements
Serializable
{
/**
* 编号
*/
private
Long
id
;
/**
* banner图
*/
private
Long
bannerId
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 修改时间
*/
private
Date
updateTime
;
/**
* 用户id
*/
private
Long
wechatUserId
;
/**
* ID
*/
private
Long
serveId
;
/**
* 资讯1 | 作品6 | 应用5
*/
private
Integer
serveType
;
/**
* 跳转类型
*/
private
Integer
jumpType
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/AppletHomeFacade.java
View file @
20dbb89e
...
@@ -39,10 +39,13 @@ import com.pcloud.common.page.PageBeanNew;
...
@@ -39,10 +39,13 @@ import com.pcloud.common.page.PageBeanNew;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.NumberUtil
;
import
com.pcloud.common.utils.NumberUtil
;
import
com.pcloud.common.utils.ParamChecker
;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.MediaType
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
...
@@ -55,15 +58,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -55,15 +58,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
@Api
(
description
=
"小睿小程序首页"
)
@Api
(
description
=
"小睿小程序首页"
)
@RestController
(
"appletHomeFacade"
)
@RestController
(
"appletHomeFacade"
)
@RequestMapping
(
"appletHome"
)
@RequestMapping
(
"appletHome"
)
...
@@ -343,10 +342,12 @@ public class AppletHomeFacade {
...
@@ -343,10 +342,12 @@ public class AppletHomeFacade {
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页数量"
)
Integer
numPerPage
)
{
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页数量"
)
Integer
numPerPage
)
{
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
currentPage
||
null
==
numPerPage
){
if
(
null
==
currentPage
||
null
==
numPerPage
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少分页参数"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少分页参数"
);
}
}
return
new
ResponseDto
<>(
appletBannerBiz
.
listBanner4Wechat
(
currentPage
,
numPerPage
,
true
,
officialAccountsId
));
return
new
ResponseDto
<>(
appletBannerBiz
.
listBanner4Wechat
(
currentPage
,
numPerPage
,
true
,
officialAccountsId
,
wechatUserId
));
}
}
@ApiOperation
(
"获取书单下书籍列表"
)
@ApiOperation
(
"获取书单下书籍列表"
)
...
@@ -1174,6 +1175,15 @@ public class AppletHomeFacade {
...
@@ -1174,6 +1175,15 @@ public class AppletHomeFacade {
answerSubscribeDTO
.
setWechatUserId
(
wechatUserId
);
answerSubscribeDTO
.
setWechatUserId
(
wechatUserId
);
return
new
ResponseDto
<>(
answerSubscribeBiz
.
getSubscribeState
(
answerSubscribeDTO
));
return
new
ResponseDto
<>(
answerSubscribeBiz
.
getSubscribeState
(
answerSubscribeDTO
));
}
}
@ApiOperation
(
"小程序首页banner点击埋点"
)
@RequestMapping
(
value
=
"/bannerClickRecord"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<
Void
>
bannerClickRecord
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"bannerId"
)
Long
bannerId
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
ParamChecker
.
checkNumberIsNull
(
bannerId
,
"参数缺失!"
);
appletBannerBiz
.
bannerClickRecord
(
wechatUserId
,
bannerId
);
return
new
ResponseDto
<>();
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/mapper/AppletBannerRecordMapper.java
0 → 100644
View file @
20dbb89e
package
com
.
pcloud
.
book
.
applet
.
mapper
;
import
com.pcloud.book.applet.dto.AppletBannerStats
;
import
com.pcloud.book.applet.entity.AppletBannerRecord
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
@Mapper
@Component
public
interface
AppletBannerRecordMapper
{
int
deleteByPrimaryKey
(
Long
id
);
int
insert
(
AppletBannerRecord
record
);
int
insertSelective
(
AppletBannerRecord
record
);
AppletBannerRecord
selectByPrimaryKey
(
Long
id
);
int
updateByPrimaryKeySelective
(
AppletBannerRecord
record
);
int
updateByPrimaryKey
(
AppletBannerRecord
record
);
List
<
AppletBannerStats
>
getBannerPVUV
(
@Param
(
"bannerIds"
)
List
<
Long
>
bannerIds
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/biz/RightsSettingBiz.java
View file @
20dbb89e
...
@@ -195,4 +195,6 @@ public interface RightsSettingBiz {
...
@@ -195,4 +195,6 @@ public interface RightsSettingBiz {
* @param nowItems
* @param nowItems
*/
*/
void
fillProductAndApp
(
List
<
RightsNowItem
>
nowItems
);
void
fillProductAndApp
(
List
<
RightsNowItem
>
nowItems
);
AppletNewsDTO
getAppletNewsDTO4UserReadBook
(
AppletUserBookcase
userReadBook
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/biz/impl/RightsSettingBizImpl.java
View file @
20dbb89e
package
com
.
pcloud
.
book
.
rightsSetting
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
rightsSetting
.
biz
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.util.RandomUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.book.applet.biz.AppletBooklistBiz
;
import
com.pcloud.book.applet.biz.AppletBooklistBiz
;
...
@@ -111,9 +113,8 @@ import com.pcloud.common.utils.NumberUtil;
...
@@ -111,9 +113,8 @@ import com.pcloud.common.utils.NumberUtil;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtilParent
;
import
com.pcloud.common.utils.string.StringUtilParent
;
import
com.pcloud.readercenter.common.enums.YesOrNoNumEnum
;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
...
@@ -137,11 +138,6 @@ import java.util.concurrent.atomic.AtomicInteger;
...
@@ -137,11 +138,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.util.RandomUtil
;
import
cn.hutool.core.util.StrUtil
;
import
lombok.extern.slf4j.Slf4j
;
@Service
@Service
@Slf4j
@Slf4j
public
class
RightsSettingBizImpl
implements
RightsSettingBiz
{
public
class
RightsSettingBizImpl
implements
RightsSettingBiz
{
...
@@ -1585,6 +1581,48 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -1585,6 +1581,48 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
nowItems
.
removeAll
(
list_remove
);
nowItems
.
removeAll
(
list_remove
);
}
}
@Override
public
AppletNewsDTO
getAppletNewsDTO4UserReadBook
(
AppletUserBookcase
userReadBook
)
{
AppletNewsDTO
appletNewsDTO
=
new
AppletNewsDTO
();
BaseTempletClassify
baseTempletClassify
=
appletUserBookcaseDao
.
getBookClassifyInfo
(
userReadBook
.
getBookId
(),
userReadBook
.
getChannelId
(),
userReadBook
.
getAdviserId
());
if
(
Objects
.
nonNull
(
baseTempletClassify
)
&&
Objects
.
nonNull
(
baseTempletClassify
.
getFirstClassify
()))
{
rightsSettingBiz
.
setClassifyAndLabel
(
baseTempletClassify
);
Integer
deepRead
=
null
;
Integer
easyRead
=
null
;
Integer
efficientRead
=
null
;
if
(
ReadTypeEnum
.
QS_READ
.
value
.
equals
(
userReadBook
.
getReadType
()))
{
easyRead
=
1
;
}
else
if
(
ReadTypeEnum
.
GX_READ
.
value
.
equals
(
userReadBook
.
getReadType
()))
{
efficientRead
=
1
;
}
else
if
(
ReadTypeEnum
.
SD_READ
.
value
.
equals
(
userReadBook
.
getReadType
()))
{
deepRead
=
1
;
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"firstClassify"
,
baseTempletClassify
.
getFirstClassify
());
map
.
put
(
"secondClassify"
,
baseTempletClassify
.
getSecondClassify
());
map
.
put
(
"gradeLabelId"
,
baseTempletClassify
.
getGradeLabelId
());
map
.
put
(
"subjectLabelId"
,
baseTempletClassify
.
getSubjectLabelId
());
map
.
put
(
"deepRead"
,
deepRead
);
map
.
put
(
"easyRead"
,
easyRead
);
map
.
put
(
"efficientRead"
,
efficientRead
);
PageBeanNew
<
AppletNewsDTO
>
page
=
appletNewsDao
.
listPageNew
(
new
PageParam
(
0
,
1
),
map
,
"getClassifyNewsByTempletLabel"
);
if
(
Objects
.
nonNull
(
page
)
&&
CollUtil
.
isNotEmpty
(
page
.
getRecordList
()))
{
appletNewsDTO
=
page
.
getRecordList
().
get
(
0
);
}
else
{
map
.
put
(
"firstClassify"
,
baseTempletClassify
.
getFirstClassify
());
map
.
put
(
"secondClassify"
,
baseTempletClassify
.
getSecondClassify
());
map
.
put
(
"gradeLabelId"
,
baseTempletClassify
.
getGradeLabelId
());
map
.
put
(
"subjectLabelId"
,
baseTempletClassify
.
getSubjectLabelId
());
map
.
put
(
"rightsType"
,
null
);
page
=
appletNewsDao
.
listPageNew
(
new
PageParam
(
0
,
1
),
map
,
"getPageByNewsByTempletLabel"
);
if
(
Objects
.
nonNull
(
page
)
&&
CollUtil
.
isNotEmpty
(
page
.
getRecordList
()))
{
appletNewsDTO
=
page
.
getRecordList
().
get
(
0
);
}
}
}
return
appletNewsDTO
;
}
private
void
fillGiftCouponPack
(
RightsSetting
rightsSetting
,
Integer
readType
)
{
private
void
fillGiftCouponPack
(
RightsSetting
rightsSetting
,
Integer
readType
)
{
RightsSettingTitle
rightsSettingTitle
=
getRightsSettingTitle
(
rightsSetting
,
RightsNowItemTypeNew
.
GIFT_COUPON_PACKAGE
,
readType
);
RightsSettingTitle
rightsSettingTitle
=
getRightsSettingTitle
(
rightsSetting
,
RightsNowItemTypeNew
.
GIFT_COUPON_PACKAGE
,
readType
);
if
(
null
!=
rightsSettingTitle
){
if
(
null
!=
rightsSettingTitle
){
...
...
pcloud-service-book/src/main/resources/mapper/applet/AppletBanner.xml
View file @
20dbb89e
<?xml version="1.0" encoding="UTF-8" ?>
<?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" >
<!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.AppletBannerDaoImpl"
>
<mapper
namespace=
"com.pcloud.book.applet.dao.impl.AppletBannerDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.applet.entity.AppletBanner"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.applet.entity.AppletBanner"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"banner_pic"
property=
"bannerPic"
jdbcType=
"VARCHAR"
/>
<result
column=
"banner_pic"
jdbcType=
"VARCHAR"
property=
"bannerPic"
/>
<result
column=
"jump_type"
property=
"jumpType"
jdbcType=
"INTEGER"
/>
<result
column=
"jump_type"
jdbcType=
"INTEGER"
property=
"jumpType"
/>
<result
column=
"jump_url"
property=
"jumpUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"jump_url"
jdbcType=
"VARCHAR"
property=
"jumpUrl"
/>
<result
column=
"seq"
property=
"seq"
jdbcType=
"INTEGER"
/>
<result
column=
"seq"
jdbcType=
"INTEGER"
property=
"seq"
/>
<result
column=
"show_state"
property=
"showState"
jdbcType=
"BOOLEAN"
/>
<result
column=
"show_state"
jdbcType=
"BOOLEAN"
property=
"showState"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"agent_id"
property=
"agentId"
jdbcType=
"BIGINT"
/>
<result
column=
"agent_id"
jdbcType=
"BIGINT"
property=
"agentId"
/>
</resultMap>
<result
column=
"serve_id"
jdbcType=
"BIGINT"
property=
"serveId"
/>
<result
column=
"serve_type"
jdbcType=
"TINYINT"
property=
"serveType"
/>
<result
column=
"fill_type"
jdbcType=
"TINYINT"
property=
"fillType"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id, banner_pic, jump_type, jump_url, seq, show_state, create_time, update_time, agent_id
id, banner_pic, jump_type, jump_url, seq, show_state, create_time, update_time, agent_id,
serve_id, serve_type, fill_type
</sql>
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.applet.entity.AppletBanner"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
<insert
id=
"insert"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.pcloud.book.applet.entity.AppletBanner"
insert into applet_banner(
useGeneratedKeys=
"true"
>
banner_pic, jump_type, jump_url, seq, show_state, create_time, update_time, agent_id
insert into applet_banner
)
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
values (
<if
test=
"bannerPic != null"
>
#{bannerPic}, #{jumpType}, #{jumpUrl}, #{seq}, #{showState}, NOW(), NOW(), #{agentId}
banner_pic,
)
</if>
</insert>
<if
test=
"jumpType != null"
>
jump_type,
</if>
<if
test=
"jumpUrl != null"
>
jump_url,
</if>
<if
test=
"seq != null"
>
seq,
</if>
<if
test=
"showState != null"
>
show_state,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"agentId != null"
>
agent_id,
</if>
<if
test=
"serveId != null"
>
serve_id,
</if>
<if
test=
"serveType != null"
>
serve_type,
</if>
<if
test=
"fillType != null"
>
fill_type,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"bannerPic != null"
>
#{bannerPic,jdbcType=VARCHAR},
</if>
<if
test=
"jumpType != null"
>
#{jumpType,jdbcType=INTEGER},
</if>
<if
test=
"jumpUrl != null"
>
#{jumpUrl,jdbcType=VARCHAR},
</if>
<if
test=
"seq != null"
>
#{seq,jdbcType=INTEGER},
</if>
<if
test=
"showState != null"
>
#{showState,jdbcType=BOOLEAN},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"agentId != null"
>
#{agentId,jdbcType=BIGINT},
</if>
<if
test=
"serveId != null"
>
#{serveId,jdbcType=BIGINT},
</if>
<if
test=
"serveType != null"
>
#{serveType,jdbcType=TINYINT},
</if>
<if
test=
"fillType != null"
>
#{fillType,jdbcType=BOOLEAN},
</if>
</trim>
</insert>
<update
id=
"update"
parameterType=
"com.pcloud.book.applet.entity.AppletBanner"
>
<update
id=
"update"
parameterType=
"com.pcloud.book.applet.entity.AppletBanner"
>
update applet_banner
update applet_banner
<set>
<set>
<if
test=
"bannerPic != null"
>
<if
test=
"bannerPic != null"
>
banner_pic = #{bannerPic},
banner_pic = #{bannerPic,jdbcType=VARCHAR},
</if>
</if>
<if
test=
"jumpType != null"
>
<if
test=
"jumpType != null"
>
jump_type = #{jumpType,jdbcType=INTEGER},
jump_type = #{jumpType,jdbcType=INTEGER},
</if>
</if>
<if
test=
"jumpUrl != null"
>
<if
test=
"jumpUrl != null"
>
jump_url = #{jumpUrl},
jump_url = #{jumpUrl,jdbcType=VARCHAR},
</if>
</if>
<if
test=
"seq != null"
>
<if
test=
"seq != null"
>
seq = #{seq,jdbcType=INTEGER},
seq = #{seq,jdbcType=INTEGER},
</if>
</if>
<if
test=
"showState != null"
>
<if
test=
"showState != null"
>
show_state = #{showState,jdbcType=BOOLEAN},
show_state = #{showState,jdbcType=BOOLEAN},
</if>
</if>
update_time=NOW()
<if
test=
"createTime != null"
>
</set>
create_time = #{createTime,jdbcType=TIMESTAMP},
where id = #{id,jdbcType=BIGINT}
</if>
</update>
update_time = NOW(),
<if
test=
"agentId != null"
>
agent_id = #{agentId,jdbcType=BIGINT},
</if>
<if
test=
"serveId != null"
>
serve_id = #{serveId,jdbcType=BIGINT},
</if>
<if
test=
"serveType != null"
>
serve_type = #{serveType,jdbcType=TINYINT},
</if>
<if
test=
"fillType != null"
>
fill_type = #{fillType,jdbcType=BOOLEAN},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select
id=
"getById"
parameterType=
"long"
resultMap=
"BaseResultMap"
>
<select
id=
"getById"
parameterType=
"long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
select
from applet_banner
<include
refid=
"Base_Column_List"
/>
where id=#{id}
from applet_banner
</select>
where id=#{id}
</select>
<delete
id=
"deleteById"
parameterType=
"long"
>
<delete
id=
"deleteById"
parameterType=
"long"
>
delete from applet_banner
delete from applet_banner
where id=#{id}
where id=#{id}
</delete>
</delete>
<select
id=
"listBanner"
resultType=
"com.pcloud.book.applet.dto.AppletBannerDTO"
parameterType=
"map"
>
<select
id=
"listBanner"
resultType=
"com.pcloud.book.applet.dto.AppletBannerDTO"
parameterType=
"map"
>
SELECT
SELECT
id id,
id id,
banner_pic bannerPic,
banner_pic bannerPic,
seq seq,
seq seq,
show_state showState,
show_state showState,
jump_type jumpType,
jump_type jumpType,
jump_url jumpUrl
jump_url jumpUrl,
FROM applet_banner
fill_type fillType,
where 1=1
serve_id serveId,
<if
test=
"showState != null"
>
serve_type serveType
and show_state = #{showState}
FROM applet_banner
</if>
where 1=1
<choose>
<if
test=
"showState != null"
>
<when
test=
"agentId != null"
>
and show_state = #{showState}
and agent_id = #{agentId}
</if>
</when>
<choose>
<otherwise>
<when
test=
"agentId != null"
>
and agent_id = 0
and agent_id = #{agentId}
</otherwise>
</when>
</choose>
<otherwise>
ORDER BY seq ASC
and agent_id = 0
</select>
</otherwise>
</choose>
ORDER BY seq ASC
</select>
<select
id=
"getMaxSeq"
resultType=
"Integer"
parameterType=
"map"
>
<select
id=
"getMaxSeq"
resultType=
"Integer"
parameterType=
"map"
>
SELECT IFNULL(MAX(seq),0) FROM applet_banner
SELECT IFNULL(MAX(seq),0) FROM applet_banner
WHERE agent_id = #{agentId}
WHERE agent_id = #{agentId}
</select>
</select>
...
...
pcloud-service-book/src/main/resources/mapper/applet/AppletBannerRecordMapper.xml
0 → 100644
View file @
20dbb89e
<?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.mapper.AppletBannerRecordMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.applet.entity.AppletBannerRecord"
>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"banner_id"
jdbcType=
"BIGINT"
property=
"bannerId"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"wechat_user_id"
jdbcType=
"BIGINT"
property=
"wechatUserId"
/>
<result
column=
"serve_id"
jdbcType=
"BIGINT"
property=
"serveId"
/>
<result
column=
"serve_type"
jdbcType=
"TINYINT"
property=
"serveType"
/>
<result
column=
"jump_type"
jdbcType=
"BOOLEAN"
property=
"jumpType"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, banner_id, create_time, update_time, wechat_user_id, serve_id, serve_type, jump_type
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from applet_banner_record
where id = #{id,jdbcType=BIGINT}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
delete from applet_banner_record
where id = #{id,jdbcType=BIGINT}
</delete>
<insert
id=
"insert"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.pcloud.book.applet.entity.AppletBannerRecord"
useGeneratedKeys=
"true"
>
insert into applet_banner_record (banner_id, create_time, update_time,
wechat_user_id, serve_id, serve_type,
jump_type)
values (#{bannerId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{wechatUserId,jdbcType=BIGINT}, #{serveId,jdbcType=BIGINT}, #{serveType,jdbcType=TINYINT},
#{jumpType,jdbcType=BOOLEAN})
</insert>
<insert
id=
"insertSelective"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.pcloud.book.applet.entity.AppletBannerRecord"
useGeneratedKeys=
"true"
>
insert into applet_banner_record
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"bannerId != null"
>
banner_id,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"wechatUserId != null"
>
wechat_user_id,
</if>
<if
test=
"serveId != null"
>
serve_id,
</if>
<if
test=
"serveType != null"
>
serve_type,
</if>
<if
test=
"jumpType != null"
>
jump_type,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"bannerId != null"
>
#{bannerId,jdbcType=BIGINT},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"wechatUserId != null"
>
#{wechatUserId,jdbcType=BIGINT},
</if>
<if
test=
"serveId != null"
>
#{serveId,jdbcType=BIGINT},
</if>
<if
test=
"serveType != null"
>
#{serveType,jdbcType=TINYINT},
</if>
<if
test=
"jumpType != null"
>
#{jumpType,jdbcType=BOOLEAN},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.pcloud.book.applet.entity.AppletBannerRecord"
>
update applet_banner_record
<set>
<if
test=
"bannerId != null"
>
banner_id = #{bannerId,jdbcType=BIGINT},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"wechatUserId != null"
>
wechat_user_id = #{wechatUserId,jdbcType=BIGINT},
</if>
<if
test=
"serveId != null"
>
serve_id = #{serveId,jdbcType=BIGINT},
</if>
<if
test=
"serveType != null"
>
serve_type = #{serveType,jdbcType=TINYINT},
</if>
<if
test=
"jumpType != null"
>
jump_type = #{jumpType,jdbcType=BOOLEAN},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.pcloud.book.applet.entity.AppletBannerRecord"
>
update applet_banner_record
set banner_id = #{bannerId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
wechat_user_id = #{wechatUserId,jdbcType=BIGINT},
serve_id = #{serveId,jdbcType=BIGINT},
serve_type = #{serveType,jdbcType=TINYINT},
jump_type = #{jumpType,jdbcType=BOOLEAN}
where id = #{id,jdbcType=BIGINT}
</update>
<select
id=
"getBannerPVUV"
resultType=
"com.pcloud.book.applet.dto.AppletBannerStats"
>
SELECT
t.banner_id bannerId,
count( 0 ) uv,
SUM( t.p ) pv
FROM
( SELECT banner_id, count( 0 ) p FROM applet_banner_record WHERE
banner_id IN
<foreach
collection=
"bannerIds"
close=
")"
item=
"item"
open=
"("
separator=
","
>
${item}
</foreach>
GROUP BY banner_id, wechat_user_id ) t
GROUP BY
t.banner_id
</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