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
223a5b45
Commit
223a5b45
authored
Apr 29, 2020
by
朱亚洁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1002752品牌方数据
parent
8e19c524
Show whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
1735 additions
and
315 deletions
+1735
-315
BrandDataDTO4Channel.java
...com/pcloud/book/advertising/dto/BrandDataDTO4Channel.java
+60
-0
AdvertisingSpaceService.java
...oud/book/advertising/service/AdvertisingSpaceService.java
+10
-0
AdvertisingBrandDataBiz.java
.../pcloud/book/advertising/biz/AdvertisingBrandDataBiz.java
+56
-0
LinkRevertBiz.java
...n/java/com/pcloud/book/advertising/biz/LinkRevertBiz.java
+7
-0
AdvertisingBrandDataBizImpl.java
...ook/advertising/biz/impl/AdvertisingBrandDataBizImpl.java
+344
-0
GroupTagBizImpl.java
...com/pcloud/book/advertising/biz/impl/GroupTagBizImpl.java
+7
-0
LinkRevertBizImpl.java
...m/pcloud/book/advertising/biz/impl/LinkRevertBizImpl.java
+8
-38
BrandDataCheck.java
...ava/com/pcloud/book/advertising/check/BrandDataCheck.java
+77
-0
AdvertisingBrandBookDao.java
.../pcloud/book/advertising/dao/AdvertisingBrandBookDao.java
+25
-0
AdvertisingBrandDataDao.java
.../pcloud/book/advertising/dao/AdvertisingBrandDataDao.java
+42
-0
AdvertisingLinkRevertDao.java
...pcloud/book/advertising/dao/AdvertisingLinkRevertDao.java
+5
-0
AdvertisingBrandBookDaoImpl.java
...ook/advertising/dao/impl/AdvertisingBrandBookDaoImpl.java
+46
-0
AdvertisingBrandDataDaoImpl.java
...ook/advertising/dao/impl/AdvertisingBrandDataDaoImpl.java
+59
-0
AdvertisingLinkRevertDaoImpl.java
...ok/advertising/dao/impl/AdvertisingLinkRevertDaoImpl.java
+5
-0
AddAdvertisingBrandBooksDTO.java
...oud/book/advertising/dto/AddAdvertisingBrandBooksDTO.java
+19
-0
BookListForAdvertisingDTO.java
...cloud/book/advertising/dto/BookListForAdvertisingDTO.java
+65
-0
BrandDataAddDTO.java
...java/com/pcloud/book/advertising/dto/BrandDataAddDTO.java
+24
-0
BrandDataParamDTO.java
...va/com/pcloud/book/advertising/dto/BrandDataParamDTO.java
+46
-0
LinkRevertRecordDTO.java
.../com/pcloud/book/advertising/dto/LinkRevertRecordDTO.java
+15
-85
AdvertisingBrandBook.java
.../pcloud/book/advertising/entity/AdvertisingBrandBook.java
+23
-0
AdvertisingBrandData.java
.../pcloud/book/advertising/entity/AdvertisingBrandData.java
+158
-0
AdvertisingLinkRevert.java
...pcloud/book/advertising/entity/AdvertisingLinkRevert.java
+16
-47
BrandDataAddTypeEnum.java
...m/pcloud/book/advertising/enums/BrandDataAddTypeEnum.java
+54
-0
BrandDataFromTypeEnum.java
.../pcloud/book/advertising/enums/BrandDataFromTypeEnum.java
+33
-0
AdvertisingBrandDataFacade.java
...d/book/advertising/facade/AdvertisingBrandDataFacade.java
+95
-0
AdvertisingSpaceFacade.java
...cloud/book/advertising/facade/AdvertisingSpaceFacade.java
+40
-38
LinkRevertFacade.java
.../com/pcloud/book/advertising/facade/LinkRevertFacade.java
+34
-0
AdvertisingSpaceFacadeImpl.java
...k/advertising/facade/impl/AdvertisingSpaceFacadeImpl.java
+104
-103
AdvertisingSpaceServiceImpl.java
...advertising/service/impl/AdvertisingSpaceServiceImpl.java
+16
-0
AdvertisingBrandBook.xml
...ain/resources/mapper/advertising/AdvertisingBrandBook.xml
+65
-0
AdvertisingBrandDataMapper.xml
...sources/mapper/advertising/AdvertisingBrandDataMapper.xml
+119
-0
AdvertisingLinkRevertMapper.xml
...ources/mapper/advertising/AdvertisingLinkRevertMapper.xml
+19
-4
BookAdviser.Mapper.xml
...ook/src/main/resources/mapper/book/BookAdviser.Mapper.xml
+39
-0
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/advertising/dto/BrandDataDTO4Channel.java
0 → 100644
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
dto
;
import
com.pcloud.common.dto.BaseDto
;
import
java.util.List
;
import
lombok.Data
;
/**
* @描述:二维码及资源数据查询参数
* @作者:zhuyajie
* @创建时间:16:02 2020/4/16
* @版本:1.0
*/
@Data
public
class
BrandDataDTO4Channel
extends
BaseDto
{
/**
* 来源类型(BOOK/QRCODE/APP/PRODUCT)
*/
private
String
fromType
;
/**
* 书刊id
*/
private
Long
bookId
;
/**
* 编辑id
*/
private
Long
adviserId
;
/**
* 运营id
*/
private
Long
channelId
;
/**
* 二维码id
*/
private
Long
sceneId
;
/**
* 二维码列表
*/
private
List
<
Long
>
sceneIdList
;
/**
* 应用或作品id
*/
private
List
<
Long
>
serveIdList
;
/**
* 扫码人数
*/
private
Integer
scanQrUserCount
;
/**
* 读者量
*/
private
Integer
readerNum
;
/**
* 浏览量
*/
private
Integer
browseNum
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/advertising/service/AdvertisingSpaceService.java
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
service
;
import
com.pcloud.book.advertising.dto.BrandDataDTO4Channel
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
...
...
@@ -18,6 +19,7 @@ import java.util.Map;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
@FeignClient
(
value
=
"pcloud-service-book"
,
qualifier
=
"advertisingSpaceServiceCloud"
,
path
=
"book/v1.0/advertisingSpaceService"
)
@Api
(
description
=
"广告位内部接口"
)
...
...
@@ -44,4 +46,12 @@ public interface AdvertisingSpaceService {
@ApiImplicitParam
(
name
=
"wxGroupId"
,
value
=
"微信群id"
,
dataType
=
"string"
,
required
=
true
,
paramType
=
"query"
)
@GetMapping
(
"getBrandIdsByWxGroupId"
)
ResponseEntity
<
ResponseDto
<
List
<
Long
>>>
getBrandIdsByWxGroupId
(
@RequestParam
(
"wxGroupId"
)
String
wxGroupId
);
@ApiOperation
(
"品牌方增加的二维码下资源数据"
)
@PostMapping
(
"mapBrandQrServeAddData"
)
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
BrandDataDTO4Channel
>>>
mapBrandQrServeAddData
(
@RequestBody
@ApiParam
BrandDataDTO4Channel
brandDataDTO4Channel
);
@ApiOperation
(
"品牌方增加的二维码数据"
)
@PostMapping
(
"mapBrandQrAddData"
)
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
BrandDataDTO4Channel
>>>
mapBrandQrAddData
(
@RequestBody
@ApiParam
BrandDataDTO4Channel
brandDataDTO4Channel
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/AdvertisingBrandDataBiz.java
0 → 100644
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
biz
;
import
com.pcloud.book.advertising.dto.AddAdvertisingBrandBooksDTO
;
import
com.pcloud.book.advertising.dto.BookListForAdvertisingDTO
;
import
com.pcloud.book.advertising.dto.BrandDataDTO4Channel
;
import
com.pcloud.book.advertising.entity.AdvertisingBrandBook
;
import
com.pcloud.book.advertising.dto.BrandDataParamDTO
;
import
com.pcloud.book.advertising.entity.AdvertisingBrandData
;
import
com.pcloud.common.page.PageBeanNew
;
import
java.util.Map
;
import
java.util.List
;
/**
* @描述:品牌方数据修改
* @作者:zhuyajie
* @创建时间:11:56 2020/4/16
* @版本:1.0
*/
public
interface
AdvertisingBrandDataBiz
{
/**
* 添加品牌方数据
*/
public
void
addBrandData
(
BrandDataParamDTO
brandDataParamDTO
);
/**
* 获取品牌方数据
* @param advertisingBrandData
* @return
*/
Map
<
String
,
Integer
>
getBrandData
(
AdvertisingBrandData
advertisingBrandData
);
void
addAdvertisingBrandBooks
(
AddAdvertisingBrandBooksDTO
addAdvertisingBrandBooksDTO
);
void
deleteAdvertisingBrandBooksByBookIds
(
List
<
Long
>
bookIds
);
PageBeanNew
<
BookListForAdvertisingDTO
>
getBookListForAdvertising
(
Integer
currentPage
,
Integer
numPerPage
,
String
keyword
,
Long
advertisingBrandId
,
Boolean
isPitch
,
Boolean
is1v1
);
/**
* 品牌方增加的二维码下资源数据
* @param brandDataDTO4Channel
* @return
*/
Map
<
Long
,
BrandDataDTO4Channel
>
mapBrandQrServeAddData
(
BrandDataDTO4Channel
brandDataDTO4Channel
);
/**
* 品牌方增加的二维码数据
* @param brandDataDTO4Channel
* @return
*/
Map
<
Long
,
BrandDataDTO4Channel
>
mapBrandQrAddData
(
BrandDataDTO4Channel
brandDataDTO4Channel
);
List
<
Long
>
getAdvertisingBrandBooksIds
(
Long
advertisingBrandId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/LinkRevertBiz.java
View file @
223a5b45
...
...
@@ -57,4 +57,11 @@ public interface LinkRevertBiz {
* 统计昨日链接发送次数
*/
void
addYesterdaySendStatistic
();
/**
* 修改链接数据变化值
* @param linkRevert
*/
void
updateLinkBrandData
(
AdvertisingLinkRevert
linkRevert
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/impl/AdvertisingBrandDataBizImpl.java
0 → 100644
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
biz
.
impl
;
import
com.pcloud.analysisengine.browse.dto.BrowseCacheRecordDto
;
import
com.pcloud.book.advertising.biz.AdvertisingBrandDataBiz
;
import
com.pcloud.book.advertising.check.BrandDataCheck
;
import
com.pcloud.book.advertising.dao.AdvertisingBrandBookDao
;
import
com.pcloud.book.advertising.dao.AdvertisingBrandDataDao
;
import
com.pcloud.book.advertising.dto.AddAdvertisingBrandBooksDTO
;
import
com.pcloud.book.advertising.dto.BookListForAdvertisingDTO
;
import
com.pcloud.book.advertising.dto.BrandDataAddDTO
;
import
com.pcloud.book.advertising.dto.BrandDataDTO4Channel
;
import
com.pcloud.book.advertising.dto.BrandDataParamDTO
;
import
com.pcloud.book.advertising.entity.AdvertisingBrandBook
;
import
com.pcloud.book.advertising.entity.AdvertisingBrandData
;
import
com.pcloud.book.advertising.enums.BrandDataAddTypeEnum
;
import
com.pcloud.book.advertising.enums.BrandDataFromTypeEnum
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.dao.BookAdviserDao
;
import
com.pcloud.book.consumer.analysisengine.BrowseRecordConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.dao.AppClickRecordDao
;
import
com.pcloud.book.group.dao.BookGroupCipherUserDao
;
import
com.pcloud.book.group.dto.BookGroupIdAndCountDTO
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.wechatgroup.group.dto.GroupUserCountDTO
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @描述:品牌方数据修改
* @作者:zhuyajie
* @创建时间:11:58 2020/4/16
* @版本:1.0
*/
@Component
(
"advertisingBrandDataBiz"
)
public
class
AdvertisingBrandDataBizImpl
implements
AdvertisingBrandDataBiz
{
@Autowired
private
AdvertisingBrandDataDao
advertisingBrandDataDao
;
@Autowired
private
BrandDataCheck
brandDataCheck
;
@Autowired
private
AdvertisingBrandBookDao
advertisingBrandBookDao
;
@Autowired
private
BookAdviserDao
bookAdviserDao
;
@Autowired
private
QrcodeSceneConsr
qrcodeSceneConsr
;
@Autowired
private
BrowseRecordConsr
browseRecordConsr
;
@Autowired
private
BookGroupCipherUserDao
bookGroupCipherUserDao
;
@Autowired
private
WechatGroupConsr
wechatGroupConsr
;
@Autowired
private
AppClickRecordDao
appClickRecordDao
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
"添加品牌方数据"
)
public
void
addBrandData
(
BrandDataParamDTO
brandDataParamDTO
)
{
//参数校验
brandDataCheck
.
checkAddData
(
brandDataParamDTO
);
//是否已存在
AdvertisingBrandData
brandData
=
new
AdvertisingBrandData
();
BeanUtils
.
copyProperties
(
brandDataParamDTO
,
brandData
);
List
<
AdvertisingBrandData
>
dataList
=
advertisingBrandDataDao
.
queryAll
(
brandData
);
if
(!
ListUtils
.
isEmpty
(
dataList
)){
for
(
AdvertisingBrandData
data:
dataList
){
advertisingBrandDataDao
.
deleteById
(
data
.
getId
());
}
}
List
<
AdvertisingBrandData
>
brandDataList
=
new
ArrayList
<>();
for
(
BrandDataAddDTO
dataAddDTO:
brandDataParamDTO
.
getDataAddDTOS
()){
AdvertisingBrandData
advertisingBrandData
=
new
AdvertisingBrandData
();
BeanUtils
.
copyProperties
(
brandDataParamDTO
,
advertisingBrandData
);
advertisingBrandData
.
setAddCount
(
dataAddDTO
.
getAddCount
());
advertisingBrandData
.
setAddType
(
dataAddDTO
.
getAddType
());
brandDataList
.
add
(
advertisingBrandData
);
}
advertisingBrandDataDao
.
insert
(
brandDataList
);
}
@Override
public
Map
<
String
,
Integer
>
getBrandData
(
AdvertisingBrandData
advertisingBrandData
)
{
List
<
AdvertisingBrandData
>
dataList
=
advertisingBrandDataDao
.
queryAll
(
advertisingBrandData
);
if
(
ListUtils
.
isEmpty
(
dataList
)){
return
new
HashMap
<>();
}
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
for
(
AdvertisingBrandData
brandData:
dataList
){
map
.
put
(
brandData
.
getAddType
(),
brandData
.
getAddCount
());
}
return
map
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
"更新品牌方和书的关联关系"
)
@Override
public
void
addAdvertisingBrandBooks
(
AddAdvertisingBrandBooksDTO
dto
)
{
if
(
dto
==
null
||
dto
.
getAdvertisingBrandId
()==
null
||
ListUtils
.
isEmpty
(
dto
.
getBookIds
())){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数错误!"
);
}
List
<
Long
>
bookIds
=
dto
.
getBookIds
();
List
<
Long
>
ids
=
bookIds
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
if
(
bookIds
.
size
()!=
ids
.
size
()){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"一本书只能被一个品牌方标记!"
);
}
//看下之前是否被标记
List
<
AdvertisingBrandBook
>
olds
=
advertisingBrandBookDao
.
getByBookIds
(
bookIds
);
if
(!
ListUtils
.
isEmpty
(
olds
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"一本书只能被一个品牌方标记!"
);
}
List
<
AdvertisingBrandBook
>
advertisingBrandBooks
=
new
ArrayList
<>();
for
(
Long
bookId:
bookIds
){
AdvertisingBrandBook
advertisingBrandBook
=
new
AdvertisingBrandBook
();
advertisingBrandBook
.
setBookId
(
bookId
);
advertisingBrandBook
.
setAdvertisingBrandId
(
dto
.
getAdvertisingBrandId
());
advertisingBrandBooks
.
add
(
advertisingBrandBook
);
}
//新增
advertisingBrandBookDao
.
batchInsert
(
advertisingBrandBooks
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
"按书id批量删除品牌方和书的关联关系"
)
@Override
public
void
deleteAdvertisingBrandBooksByBookIds
(
List
<
Long
>
bookIds
)
{
if
(
ListUtils
.
isEmpty
(
bookIds
)){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
advertisingBrandBookDao
.
deleteByBookIds
(
bookIds
);
}
@ParamLog
(
"获取品牌方书刊列表"
)
@Override
public
PageBeanNew
<
BookListForAdvertisingDTO
>
getBookListForAdvertising
(
Integer
currentPage
,
Integer
numPerPage
,
String
keyword
,
Long
advertisingBrandId
,
Boolean
isPitch
,
Boolean
is1v1
)
{
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<=
0
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"分页参数有误!"
);
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"keyword"
,
keyword
);
map
.
put
(
"advertisingBrandId"
,
advertisingBrandId
);
map
.
put
(
"isPitch"
,
isPitch
);
map
.
put
(
"is1v1"
,
is1v1
);
PageBeanNew
<
BookListForAdvertisingDTO
>
pageNew
=
bookAdviserDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"getBookListForAdvertising"
);
fillOtherInfo
(
pageNew
.
getRecordList
(),
is1v1
);
fillAdd
(
pageNew
.
getRecordList
(),
is1v1
);
return
pageNew
;
}
private
void
fillAdd
(
List
<
BookListForAdvertisingDTO
>
list
,
Boolean
is1v1
)
{
List
<
Long
>
bookIds
=
list
.
stream
().
filter
(
s
->
s
.
getBookId
()!=
null
).
map
(
BookListForAdvertisingDTO:
:
getBookId
).
distinct
().
collect
(
Collectors
.
toList
());
if
(
ListUtils
.
isEmpty
(
bookIds
)){
return
;
}
List
<
AdvertisingBrandData
>
scan
;
List
<
AdvertisingBrandData
>
scanUser
;
List
<
AdvertisingBrandData
>
serveClick
;
Map
<
Long
,
Integer
>
friendsCountMap
=
new
HashMap
<>();
if
(
is1v1
!=
null
&&
is1v1
)
{
List
<
AdvertisingBrandData
>
friendsCount
=
advertisingBrandDataDao
.
getBookAddByType
(
bookIds
,
BrandDataAddTypeEnum
.
FRIENDS_COUNT
.
value
);
for
(
AdvertisingBrandData
data
:
friendsCount
)
{
friendsCountMap
.
put
(
data
.
getBookId
(),
data
.
getAddCount
());
}
scan
=
advertisingBrandDataDao
.
getBookAddByType
(
bookIds
,
BrandDataAddTypeEnum
.
GROUP_SCAN
.
value
);
scanUser
=
advertisingBrandDataDao
.
getBookAddByType
(
bookIds
,
BrandDataAddTypeEnum
.
GROUP_SCAN_USER
.
value
);
serveClick
=
advertisingBrandDataDao
.
getBookAddByType
(
bookIds
,
BrandDataAddTypeEnum
.
GROUP_SERVE_CLICK
.
value
);
}
else
{
scan
=
advertisingBrandDataDao
.
getBookAddByType
(
bookIds
,
BrandDataAddTypeEnum
.
SCAN
.
value
);
scanUser
=
advertisingBrandDataDao
.
getBookAddByType
(
bookIds
,
BrandDataAddTypeEnum
.
SCAN_USER
.
value
);
serveClick
=
advertisingBrandDataDao
.
getBookAddByType
(
bookIds
,
BrandDataAddTypeEnum
.
SERVE_CLICK
.
value
);
}
Map
<
Long
,
Integer
>
scanMap
=
new
HashMap
<>();
Map
<
Long
,
Integer
>
scanUserMap
=
new
HashMap
<>();
Map
<
Long
,
Integer
>
serveClickMap
=
new
HashMap
<>();
for
(
AdvertisingBrandData
data:
scan
){
scanMap
.
put
(
data
.
getBookId
(),
data
.
getAddCount
());
}
for
(
AdvertisingBrandData
data:
scanUser
){
scanUserMap
.
put
(
data
.
getBookId
(),
data
.
getAddCount
());
}
for
(
AdvertisingBrandData
data:
serveClick
){
serveClickMap
.
put
(
data
.
getBookId
(),
data
.
getAddCount
());
}
for
(
BookListForAdvertisingDTO
dto:
list
){
dto
.
setAddScanCount
(
scanMap
.
get
(
dto
.
getBookId
()));
dto
.
setAddScanPeople
(
scanUserMap
.
get
(
dto
.
getBookId
()));
dto
.
setAddServeBrowseCount
(
serveClickMap
.
get
(
dto
.
getBookId
()));
if
(
is1v1
!=
null
&&
is1v1
)
{
dto
.
setAddFriendCount
(
friendsCountMap
.
get
(
dto
.
getBookId
()));
}
}
}
private
void
fillOtherInfo
(
List
<
BookListForAdvertisingDTO
>
list
,
Boolean
is1v1
)
{
if
(
ListUtils
.
isEmpty
(
list
)){
return
;
}
//填充二维码个数,扫码次数,扫码人数,服务点击次
List
<
Long
>
channelIds
=
new
ArrayList
<>();
List
<
Long
>
adviserIds
=
new
ArrayList
<>();
List
<
Long
>
bookIds
=
new
ArrayList
<>();
List
<
Long
>
bookGroupIds
=
new
ArrayList
<>();
for
(
BookListForAdvertisingDTO
dto
:
list
)
{
if
(!
channelIds
.
contains
(
dto
.
getChannelId
())){
channelIds
.
add
(
dto
.
getChannelId
());
}
if
(!
adviserIds
.
contains
(
dto
.
getAdviserId
())){
adviserIds
.
add
(
dto
.
getAdviserId
());
}
if
(!
bookIds
.
contains
(
dto
.
getBookId
())){
bookIds
.
add
(
dto
.
getBookId
());
}
if
(
is1v1
!=
null
&&
is1v1
&&
!
bookGroupIds
.
contains
(
dto
.
getBookGroupId
()))
{
bookGroupIds
.
add
(
dto
.
getBookGroupId
());
}
}
Map
<
Long
,
GroupUserCountDTO
>
scanCountByGroup
=
wechatGroupConsr
.
getScanCountByGroup
(
bookGroupIds
,
null
);
Map
<
String
,
BrowseCacheRecordDto
>
bookScanAndUv
=
browseRecordConsr
.
getBookScanAndUv
(
adviserIds
,
channelIds
,
bookIds
);
Map
<
String
,
Long
>
bookServeBrowseCount
=
browseRecordConsr
.
getBookServeBrowseCount
(
adviserIds
,
channelIds
,
bookIds
);
Map
<
Long
,
Integer
>
addFriend
=
new
HashMap
<>();
Map
<
Long
,
Integer
>
serveClickCountMap
=
new
HashMap
<>();
if
(
is1v1
!=
null
&&
is1v1
&&
!
ListUtils
.
isEmpty
(
bookGroupIds
))
{
List
<
BookGroupIdAndCountDTO
>
addFriendByBookGroupIds
=
bookGroupCipherUserDao
.
getAddFriendByBookGroupIds
(
bookGroupIds
);
if
(!
ListUtils
.
isEmpty
(
addFriendByBookGroupIds
))
{
for
(
BookGroupIdAndCountDTO
dto
:
addFriendByBookGroupIds
)
{
addFriend
.
put
(
dto
.
getBookGroupId
(),
dto
.
getCount
());
}
}
List
<
BookGroupIdAndCountDTO
>
serveClickCounts
=
appClickRecordDao
.
getClCoByBookGroupIds
(
bookGroupIds
);
for
(
BookGroupIdAndCountDTO
se
:
serveClickCounts
)
{
serveClickCountMap
.
put
(
se
.
getBookGroupId
(),
se
.
getCount
());
}
}
for
(
BookListForAdvertisingDTO
dto
:
list
)
{
if
(
is1v1
!=
null
&&
is1v1
)
{
Long
bookGroupId
=
dto
.
getBookGroupId
();
if
(
addFriend
.
get
(
bookGroupId
)
!=
null
)
{
dto
.
setFriendCount
(
addFriend
.
get
(
bookGroupId
));
}
else
{
dto
.
setFriendCount
(
0
);
}
//如果是1v1就取社群码的扫码量,扫码人数,服务点击量
if
(
scanCountByGroup
.
get
(
bookGroupId
)
!=
null
)
{
dto
.
setScanPeople
(
scanCountByGroup
.
get
(
bookGroupId
).
getUserCount
().
longValue
());
dto
.
setScanCount
(
scanCountByGroup
.
get
(
bookGroupId
).
getCount
().
longValue
());
}
else
{
dto
.
setScanPeople
(
0L
);
dto
.
setScanCount
(
0L
);
}
if
(
serveClickCountMap
.
get
(
bookGroupId
)!=
null
){
dto
.
setServeBrowseCount
(
serveClickCountMap
.
get
(
bookGroupId
).
longValue
());
}
else
{
dto
.
setServeBrowseCount
(
0L
);
}
}
else
{
String
key
=
dto
.
getBookId
()
+
"-"
+
dto
.
getAdviserId
()
+
"-"
+
dto
.
getChannelId
();
BrowseCacheRecordDto
browseCacheRecordDto
=
bookScanAndUv
.
get
(
key
);
if
(
browseCacheRecordDto
!=
null
)
{
dto
.
setScanPeople
(
browseCacheRecordDto
.
getBrowserCounts
());
dto
.
setScanCount
(
browseCacheRecordDto
.
getScanCount
());
}
dto
.
setServeBrowseCount
(
bookServeBrowseCount
.
get
(
key
));
Integer
qrCount
=
qrcodeSceneConsr
.
getBookQRCountByMap
(
dto
.
getAdviserId
(),
dto
.
getChannelId
(),
dto
.
getBookId
());
dto
.
setQrcodeCount
(
qrCount
);
}
}
}
@Override
public
Map
<
Long
,
BrandDataDTO4Channel
>
mapBrandQrServeAddData
(
BrandDataDTO4Channel
brandDataDTO4Channel
)
{
if
(
null
==
brandDataDTO4Channel
||
ListUtils
.
isEmpty
(
brandDataDTO4Channel
.
getServeIdList
())
||
null
==
brandDataDTO4Channel
.
getSceneId
()
||
null
==
brandDataDTO4Channel
.
getBookId
()){
return
new
HashMap
<>();
}
if
(!
BrandDataFromTypeEnum
.
APP
.
value
.
equals
(
brandDataDTO4Channel
.
getFromType
())&&!
BrandDataFromTypeEnum
.
PRODUCT
.
value
.
equals
(
brandDataDTO4Channel
.
getFromType
())){
return
new
HashMap
<>();
}
List
<
AdvertisingBrandData
>
dataList
=
advertisingBrandDataDao
.
getQrServeData4Channel
(
brandDataDTO4Channel
);
if
(
ListUtils
.
isEmpty
(
dataList
)){
return
new
HashMap
<>();
}
Map
<
Long
,
BrandDataDTO4Channel
>
map
=
new
HashMap
<>();
Map
<
Long
,
List
<
AdvertisingBrandData
>>
dataMap
=
dataList
.
stream
().
collect
(
Collectors
.
groupingBy
(
AdvertisingBrandData:
:
getServeId
));
for
(
Map
.
Entry
<
Long
,
List
<
AdvertisingBrandData
>>
entry
:
dataMap
.
entrySet
()){
BrandDataDTO4Channel
dto4Channel
=
new
BrandDataDTO4Channel
();
for
(
AdvertisingBrandData
brandData:
entry
.
getValue
()){
if
(
BrandDataAddTypeEnum
.
READER
.
value
.
equals
(
brandData
.
getAddType
())){
dto4Channel
.
setReaderNum
(
brandData
.
getAddCount
());
}
else
if
(
BrandDataAddTypeEnum
.
BROWSE
.
value
.
equals
(
brandData
.
getAddType
())){
dto4Channel
.
setBrowseNum
(
brandData
.
getAddCount
());
}
}
map
.
put
(
entry
.
getKey
(),
dto4Channel
);
}
return
map
;
}
@Override
public
Map
<
Long
,
BrandDataDTO4Channel
>
mapBrandQrAddData
(
BrandDataDTO4Channel
brandDataDTO4Channel
)
{
if
(
null
==
brandDataDTO4Channel
||
ListUtils
.
isEmpty
(
brandDataDTO4Channel
.
getSceneIdList
())
||
null
==
brandDataDTO4Channel
.
getChannelId
()
||
null
==
brandDataDTO4Channel
.
getBookId
()
||
!
BrandDataFromTypeEnum
.
QRCODE
.
value
.
equals
(
brandDataDTO4Channel
.
getFromType
())){
return
new
HashMap
<>();
}
List
<
AdvertisingBrandData
>
dataList
=
advertisingBrandDataDao
.
getQrData4Channel
(
brandDataDTO4Channel
);
if
(
ListUtils
.
isEmpty
(
dataList
)){
return
new
HashMap
<>();
}
Map
<
Long
,
BrandDataDTO4Channel
>
map
=
new
HashMap
<>();
Map
<
Long
,
List
<
AdvertisingBrandData
>>
dataMap
=
dataList
.
stream
().
collect
(
Collectors
.
groupingBy
(
AdvertisingBrandData:
:
getSceneId
));
for
(
Map
.
Entry
<
Long
,
List
<
AdvertisingBrandData
>>
entry
:
dataMap
.
entrySet
()){
BrandDataDTO4Channel
dto4Channel
=
new
BrandDataDTO4Channel
();
for
(
AdvertisingBrandData
brandData:
entry
.
getValue
()){
if
(
BrandDataAddTypeEnum
.
SCAN_USER
.
value
.
equals
(
brandData
.
getAddType
())){
dto4Channel
.
setScanQrUserCount
(
brandData
.
getAddCount
());
}
}
map
.
put
(
entry
.
getKey
(),
dto4Channel
);
}
return
map
;
}
@Override
public
List
<
Long
>
getAdvertisingBrandBooksIds
(
Long
advertisingBrandId
)
{
if
(
advertisingBrandId
==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
return
advertisingBrandBookDao
.
getBookIdsByAdvertisingBrandId
(
advertisingBrandId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/impl/GroupTagBizImpl.java
View file @
223a5b45
...
...
@@ -57,6 +57,8 @@ import java.util.Date;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.stream.Collectors
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -429,6 +431,10 @@ public class GroupTagBizImpl implements GroupTagBiz {
/**
* excel打包
* @param list
* @param fileName
* @param zipTitle
* @return
*/
private
String
packExcelZip4GroupBrand
(
List
<
GroupTagDTO
>
list
,
String
fileName
,
String
zipTitle
)
{
Integer
totalCount
=
list
.
size
();
...
...
@@ -816,6 +822,7 @@ public class GroupTagBizImpl implements GroupTagBiz {
if
(
null
!=
brandDTO
)
{
map
.
put
(
"brandName"
,
brandDTO
.
getBrandName
());
map
.
put
(
"loginName"
,
brandDTO
.
getLoginName
());
map
.
put
(
"userId"
,
userId
);
}
return
map
;
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/impl/LinkRevertBizImpl.java
View file @
223a5b45
...
...
@@ -98,26 +98,9 @@ public class LinkRevertBizImpl implements LinkRevertBiz {
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
}
List
<
LinkRevertRecordDTO
>
list
=
pageBean
.
getRecordList
();
List
<
LinkGroupParamDTO
>
paramDTOS
=
new
ArrayList
<>();
for
(
LinkRevertRecordDTO
linkRevertRecordDTO
:
list
)
{
if
(
null
==
linkRevertRecordDTO
||
StringUtil
.
isEmpty
(
linkRevertRecordDTO
.
getShortLink
()))
{
continue
;
}
List
<
String
>
groupIds
=
advertisingGroupTagDao
.
getTagWxGroupIdsByBrandId
(
linkRevertRecordDTO
.
getBrandId
());
if
(
ListUtils
.
isEmpty
(
groupIds
))
{
continue
;
}
LinkGroupParamDTO
paramDTO
=
new
LinkGroupParamDTO
();
paramDTO
.
setLink
(
linkRevertRecordDTO
.
getShortLink
());
paramDTO
.
setWxGroupIds
(
groupIds
);
paramDTO
.
setDate
(
DateUtils
.
today
());
paramDTOS
.
add
(
paramDTO
);
}
//今日之前发送次数
//今日之前发送次数,因耗时不统计今天的20200106bug1019123
List
<
Long
>
linkIds
=
list
.
stream
().
filter
(
s
->
s
.
getLink
()
!=
null
).
map
(
LinkRevertRecordDTO:
:
getId
).
distinct
().
collect
(
Collectors
.
toList
());
Map
<
Long
,
LinkRevertRecordDTO
>
sendCountMap
=
advertisingLinkSendDao
.
mapSendCount
(
linkIds
);
//今日发送次数,因耗时不统计今天的20200106bug1019123
// Map<String, Integer> sendCountTodayMap = wechatGroupConsr.getLinkSendCount(paramDTOS);
for
(
LinkRevertRecordDTO
revertRecordDTO
:
list
)
{
AdvertisingBrandDTO
brandDTO
=
advertisingBrandDao
.
getBrandById
(
revertRecordDTO
.
getBrandId
());
revertRecordDTO
.
setBrandName
(
null
==
brandDTO
?
""
:
brandDTO
.
getBrandName
());
...
...
@@ -128,9 +111,6 @@ public class LinkRevertBizImpl implements LinkRevertBiz {
if
(!
MapUtils
.
isEmpty
(
sendCountMap
)
&&
sendCountMap
.
containsKey
(
revertRecordDTO
.
getId
()))
{
sendCount
=
sendCountMap
.
get
(
revertRecordDTO
.
getId
()).
getSendCount
();
}
// if (!MapUtils.isEmpty(sendCountTodayMap) && sendCountTodayMap.containsKey(revertRecordDTO.getShortLink())) {
// sendCount = sendCount + sendCountTodayMap.get(revertRecordDTO.getShortLink());
// }
revertRecordDTO
.
setSendCount
(
sendCount
);
}
return
pageBean
;
...
...
@@ -145,23 +125,9 @@ public class LinkRevertBizImpl implements LinkRevertBiz {
ThreadPoolUtils
.
EXPORT_THREAD_POOL
.
execute
(()
->
{
String
[]
rowsName
=
{
"序号"
,
"品牌方"
,
"外链"
,
"短链"
,
"链接发送次数"
,
"浏览量"
,
"浏览人数"
,
"生成时间"
};
List
<
Object
[]>
dataList
=
new
ArrayList
<
Object
[]>();
List
<
LinkGroupParamDTO
>
paramDTOS
=
new
ArrayList
<>();
for
(
LinkRevertRecordDTO
linkRevertRecordDTO
:
list
)
{
List
<
String
>
groupIds
=
advertisingGroupTagDao
.
getTagWxGroupIdsByBrandId
(
linkRevertRecordDTO
.
getBrandId
());
if
(
ListUtils
.
isEmpty
(
groupIds
))
{
continue
;
}
LinkGroupParamDTO
paramDTO
=
new
LinkGroupParamDTO
();
paramDTO
.
setLink
(
linkRevertRecordDTO
.
getShortLink
());
paramDTO
.
setWxGroupIds
(
groupIds
);
paramDTO
.
setDate
(
DateUtils
.
today
());
paramDTOS
.
add
(
paramDTO
);
}
//今日之前发送次数
List
<
Long
>
linkIds
=
list
.
stream
().
filter
(
s
->
s
.
getLink
()
!=
null
).
map
(
LinkRevertRecordDTO:
:
getId
).
distinct
().
collect
(
Collectors
.
toList
());
Map
<
Long
,
LinkRevertRecordDTO
>
sendCountMap
=
advertisingLinkSendDao
.
mapSendCount
(
linkIds
);
//今日发送次数
// Map<String, Integer> sendCountTodayMap = wechatGroupConsr.getLinkSendCount(paramDTOS);
for
(
int
i
=
0
,
size
=
list
.
size
();
i
<
size
;
i
++)
{
LinkRevertRecordDTO
revertRecordDTO
=
list
.
get
(
i
);
Object
[]
obj
=
new
Object
[
rowsName
.
length
];
...
...
@@ -174,9 +140,7 @@ public class LinkRevertBizImpl implements LinkRevertBiz {
if
(!
MapUtils
.
isEmpty
(
sendCountMap
)
&&
sendCountMap
.
containsKey
(
revertRecordDTO
.
getId
()))
{
sendCount
=
sendCountMap
.
get
(
revertRecordDTO
.
getId
()).
getSendCount
();
}
// if (!MapUtils.isEmpty(sendCountTodayMap) && sendCountTodayMap.containsKey(revertRecordDTO.getShortLink())) {
// sendCount = sendCount + sendCountTodayMap.get(revertRecordDTO.getShortLink());
// }
obj
[
4
]
=
sendCount
;
LinkRevertRecordDTO
clickStatistic
=
advertisingLinkClickDao
.
getCountByLink
(
revertRecordDTO
.
getShortLink
());
obj
[
5
]
=
null
==
clickStatistic
?
0
:
clickStatistic
.
getClickCount
();
...
...
@@ -243,4 +207,10 @@ public class LinkRevertBizImpl implements LinkRevertBiz {
}
}.
start
();
}
@Override
public
void
updateLinkBrandData
(
AdvertisingLinkRevert
linkRevert
)
{
advertisingLinkRevertDao
.
updateLinkBrandData
(
linkRevert
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/check/BrandDataCheck.java
0 → 100644
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
check
;
import
com.pcloud.book.advertising.dto.BrandDataAddDTO
;
import
com.pcloud.book.advertising.dto.BrandDataParamDTO
;
import
com.pcloud.book.advertising.enums.BrandDataFromTypeEnum
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
* @描述:品牌方数据校验
* @作者:zhuyajie
* @创建时间:14:04 2020/4/16
* @版本:1.0
*/
@Component
public
class
BrandDataCheck
{
/**
* 添加参数校验
* @param brandDataParamDTO
*/
public
void
checkAddData
(
BrandDataParamDTO
brandDataParamDTO
)
{
if
(
null
==
brandDataParamDTO
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数为空!"
);
}
if
(
StringUtil
.
isEmpty
(
brandDataParamDTO
.
getFromType
())){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"来源类型为空!"
);
}
String
fromType
=
brandDataParamDTO
.
getFromType
();
//书刊
if
(
BrandDataFromTypeEnum
.
BOOK
.
value
.
equals
(
fromType
)){
if
(
null
==
brandDataParamDTO
.
getBookId
()
||
null
==
brandDataParamDTO
.
getChannelId
()
||
null
==
brandDataParamDTO
.
getAdviserId
()){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"书刊参数有误!"
);
}
brandDataParamDTO
.
setSceneId
(
null
);
brandDataParamDTO
.
setServeId
(
null
);
}
//二维码
if
(
BrandDataFromTypeEnum
.
QRCODE
.
value
.
equals
(
fromType
)){
if
(
null
==
brandDataParamDTO
.
getSceneId
()){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"二维码参数有误!"
);
}
brandDataParamDTO
.
setServeId
(
null
);
}
//应用、作品
if
(
BrandDataFromTypeEnum
.
APP
.
value
.
equals
(
fromType
)||
BrandDataFromTypeEnum
.
PRODUCT
.
value
.
equals
(
fromType
)){
if
(
null
==
brandDataParamDTO
.
getSceneId
()){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"二维码参数有误!"
);
}
if
(
null
==
brandDataParamDTO
.
getServeId
()){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"资源服务参数有误!"
);
}
}
//数据类型
if
(
ListUtils
.
isEmpty
(
brandDataParamDTO
.
getDataAddDTOS
())){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"数据列表有误!"
);
}
for
(
BrandDataAddDTO
dataAddDTO:
brandDataParamDTO
.
getDataAddDTOS
()){
if
(
null
==
dataAddDTO
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数为空!"
);
}
if
(
StringUtil
.
isEmpty
(
dataAddDTO
.
getAddType
())){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"数据类型参数为空!"
);
}
dataAddDTO
.
setAddCount
(
dataAddDTO
.
getAddCount
()==
null
?
0
:
dataAddDTO
.
getAddCount
());
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/AdvertisingBrandBookDao.java
0 → 100644
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
dao
;
import
com.pcloud.book.advertising.entity.AdvertisingBrandBook
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* @Description
* @Author ruansiyuan
* @Date 2020/4/16 14:00
**/
public
interface
AdvertisingBrandBookDao
extends
BaseDao
<
AdvertisingBrandBook
>
{
void
deleteByBookId
(
Long
bookId
);
Integer
batchInsert
(
List
<
AdvertisingBrandBook
>
list
);
void
deleteByBookIds
(
List
<
Long
>
bookIds
);
List
<
AdvertisingBrandBook
>
getByBookIds
(
List
<
Long
>
bookIds
);
List
<
Long
>
getBookIdsByAdvertisingBrandId
(
Long
advertisingBrandId
);
void
deleteByAdvertisingBrandId
(
Long
advertisingBrandId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/AdvertisingBrandDataDao.java
0 → 100644
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
dao
;
import
com.pcloud.book.advertising.dto.BrandDataDTO4Channel
;
import
com.pcloud.book.advertising.entity.AdvertisingBrandData
;
import
com.pcloud.common.core.dao.BaseDao
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 品牌方数据修改(AdvertisingBrandData)表数据库访问层
*
* @author zhuyajie
* @since 2020-04-16 11:39:50
*/
public
interface
AdvertisingBrandDataDao
extends
BaseDao
<
AdvertisingBrandData
>
{
/**
* 通过实体作为筛选条件查询
*
* @param advertisingBrandData 实例对象
* @return 对象列表
*/
List
<
AdvertisingBrandData
>
queryAll
(
AdvertisingBrandData
advertisingBrandData
);
/**
* 二维码资源数据
* @param brandDataDTO4Channel
* @return
*/
List
<
AdvertisingBrandData
>
getQrServeData4Channel
(
BrandDataDTO4Channel
brandDataDTO4Channel
);
/**
* 二维码数据
* @param brandDataDTO4Channel
* @return
*/
List
<
AdvertisingBrandData
>
getQrData4Channel
(
BrandDataDTO4Channel
brandDataDTO4Channel
);
List
<
AdvertisingBrandData
>
getBookAddByType
(
List
<
Long
>
bookIds
,
String
addType
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/AdvertisingLinkRevertDao.java
View file @
223a5b45
...
...
@@ -27,4 +27,9 @@ public interface AdvertisingLinkRevertDao extends BaseDao<AdvertisingLinkRevert>
*/
public
List
<
AdvertisingLinkRevert
>
getAll
();
/**
* 修改品牌方数据
* @param linkRevert
*/
void
updateLinkBrandData
(
AdvertisingLinkRevert
linkRevert
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/impl/AdvertisingBrandBookDaoImpl.java
0 → 100644
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
dao
.
impl
;
import
com.pcloud.book.advertising.dao.AdvertisingBrandBookDao
;
import
com.pcloud.book.advertising.entity.AdvertisingBrandBook
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* @Description
* @Author ruansiyuan
* @Date 2020/4/16 14:01
**/
@Repository
(
"advertisingBrandBookDao"
)
public
class
AdvertisingBrandBookDaoImpl
extends
BaseDaoImpl
<
AdvertisingBrandBook
>
implements
AdvertisingBrandBookDao
{
@Override
public
void
deleteByBookId
(
Long
bookId
)
{
super
.
getSqlSession
().
delete
(
getStatement
(
"deleteByBookId"
),
bookId
);
}
@Override
public
Integer
batchInsert
(
List
<
AdvertisingBrandBook
>
list
)
{
return
super
.
getSqlSession
().
insert
(
getStatement
(
"batchInsert"
),
list
);
}
@Override
public
void
deleteByBookIds
(
List
<
Long
>
bookIds
)
{
super
.
getSqlSession
().
delete
(
getStatement
(
"deleteByBookIds"
),
bookIds
);
}
@Override
public
List
<
AdvertisingBrandBook
>
getByBookIds
(
List
<
Long
>
bookIds
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getByBookIds"
),
bookIds
);
}
@Override
public
List
<
Long
>
getBookIdsByAdvertisingBrandId
(
Long
advertisingBrandId
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getBookIdsByAdvertisingBrandId"
),
advertisingBrandId
);
}
@Override
public
void
deleteByAdvertisingBrandId
(
Long
advertisingBrandId
)
{
super
.
getSqlSession
().
delete
(
getStatement
(
"deleteByAdvertisingBrandId"
),
advertisingBrandId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/impl/AdvertisingBrandDataDaoImpl.java
0 → 100644
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
dao
.
impl
;
import
com.pcloud.book.advertising.dao.AdvertisingBrandDataDao
;
import
com.pcloud.book.advertising.dto.BrandDataDTO4Channel
;
import
com.pcloud.book.advertising.entity.AdvertisingBrandData
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @描述:品牌方数据修改
* @作者:zhuyajie
* @创建时间:11:49 2020/4/16
* @版本:1.0
*/
@Component
(
"dvertisingBrandDataDao"
)
public
class
AdvertisingBrandDataDaoImpl
extends
BaseDaoImpl
<
AdvertisingBrandData
>
implements
AdvertisingBrandDataDao
{
@Override
public
List
<
AdvertisingBrandData
>
queryAll
(
AdvertisingBrandData
advertisingBrandData
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"queryAll"
),
advertisingBrandData
);
}
@Override
public
List
<
AdvertisingBrandData
>
getQrServeData4Channel
(
BrandDataDTO4Channel
brandDataDTO4Channel
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"fromType"
,
brandDataDTO4Channel
.
getFromType
());
map
.
put
(
"bookId"
,
brandDataDTO4Channel
.
getBookId
());
map
.
put
(
"sceneId"
,
brandDataDTO4Channel
.
getSceneId
());
map
.
put
(
"serveIdList"
,
brandDataDTO4Channel
.
getServeIdList
());
map
.
put
(
"adviserId"
,
brandDataDTO4Channel
.
getAdviserId
());
map
.
put
(
"channelId"
,
brandDataDTO4Channel
.
getChannelId
());
return
getSessionTemplate
().
selectList
(
getStatement
(
"getQrServeData4Channel"
),
map
);
}
@Override
public
List
<
AdvertisingBrandData
>
getQrData4Channel
(
BrandDataDTO4Channel
brandDataDTO4Channel
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"fromType"
,
brandDataDTO4Channel
.
getFromType
());
map
.
put
(
"bookId"
,
brandDataDTO4Channel
.
getBookId
());
map
.
put
(
"sceneIdList"
,
brandDataDTO4Channel
.
getSceneIdList
());
map
.
put
(
"adviserId"
,
brandDataDTO4Channel
.
getAdviserId
());
map
.
put
(
"channelId"
,
brandDataDTO4Channel
.
getChannelId
());
return
getSessionTemplate
().
selectList
(
getStatement
(
"getQrData4Channel"
),
map
);
}
@Override
public
List
<
AdvertisingBrandData
>
getBookAddByType
(
List
<
Long
>
bookIds
,
String
addType
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"bookIds"
,
bookIds
);
map
.
put
(
"addType"
,
addType
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getBookAddByType"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/impl/AdvertisingLinkRevertDaoImpl.java
View file @
223a5b45
...
...
@@ -31,4 +31,9 @@ public class AdvertisingLinkRevertDaoImpl extends BaseDaoImpl<AdvertisingLinkRev
public
List
<
AdvertisingLinkRevert
>
getAll
()
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getAll"
));
}
@Override
public
void
updateLinkBrandData
(
AdvertisingLinkRevert
linkRevert
)
{
getSessionTemplate
().
update
(
getStatement
(
"updateLinkBrandData"
),
linkRevert
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dto/AddAdvertisingBrandBooksDTO.java
0 → 100644
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
dto
;
import
lombok.Data
;
import
java.util.List
;
/**
* @Description
* @Author ruansiyuan
* @Date 2020/4/24 11:08
**/
@Data
public
class
AddAdvertisingBrandBooksDTO
{
private
Long
advertisingBrandId
;
private
List
<
Long
>
bookIds
;
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dto/BookListForAdvertisingDTO.java
0 → 100644
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @Description
* @Author ruansiyuan
* @Date 2020/4/16 15:05
**/
@Data
public
class
BookListForAdvertisingDTO
{
@ApiModelProperty
(
"书id"
)
private
Long
bookId
;
@ApiModelProperty
(
"书名"
)
private
String
bookName
;
@ApiModelProperty
(
"编辑id"
)
private
Long
adviserId
;
@ApiModelProperty
(
"渠道Id"
)
private
Long
channelId
;
@ApiModelProperty
(
"社群书id"
)
private
Long
bookGroupId
;
@ApiModelProperty
(
"isbn"
)
private
String
isbn
;
@ApiModelProperty
(
"品牌方id"
)
private
Long
advertisingBrandId
;
@ApiModelProperty
(
"品牌方名称"
)
private
String
brandName
;
@ApiModelProperty
(
"二维码个数"
)
private
Integer
qrcodeCount
;
@ApiModelProperty
(
"扫码次数"
)
private
Long
scanCount
;
@ApiModelProperty
(
"扫码人数"
)
private
Long
scanPeople
;
@ApiModelProperty
(
"服务点击次数"
)
private
Long
serveBrowseCount
;
@ApiModelProperty
(
"好友人数"
)
private
Integer
friendCount
;
@ApiModelProperty
(
"增加扫码次数"
)
private
Integer
addScanCount
;
@ApiModelProperty
(
"增加扫码人数"
)
private
Integer
addScanPeople
;
@ApiModelProperty
(
"增加服务点击次数"
)
private
Integer
addServeBrowseCount
;
@ApiModelProperty
(
"增加加好友人数"
)
private
Integer
addFriendCount
;
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dto/BrandDataAddDTO.java
0 → 100644
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
dto
;
import
com.pcloud.common.dto.BaseDto
;
import
lombok.Data
;
/**
* @描述:数据类型和数值
* @作者:zhuyajie
* @创建时间:13:59 2020/4/16
* @版本:1.0
*/
@Data
public
class
BrandDataAddDTO
extends
BaseDto
{
/**
* 修改的数据类型
*/
private
String
addType
;
/**
* 增加数量
*/
private
Integer
addCount
;
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dto/BrandDataParamDTO.java
0 → 100644
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
dto
;
import
com.pcloud.common.dto.BaseDto
;
import
java.util.List
;
import
lombok.Data
;
/**
* @描述:品牌方数据修改
* @作者:zhuyajie
* @创建时间:14:01 2020/4/16
* @版本:1.0
*/
@Data
public
class
BrandDataParamDTO
extends
BaseDto
{
/**
* 来源类型(BOOK/QRCODE/APP/PRODUCT)
*/
private
String
fromType
;
/**
* 书刊id
*/
private
Long
bookId
;
/**
* 编辑id
*/
private
Long
adviserId
;
/**
* 运营id
*/
private
Long
channelId
;
/**
* 二维码id
*/
private
Long
sceneId
;
/**
* 应用或作品id
*/
private
Long
serveId
;
/**
* 数据类型和数值
*/
private
List
<
BrandDataAddDTO
>
dataAddDTOS
;
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dto/LinkRevertRecordDTO.java
View file @
223a5b45
...
...
@@ -5,12 +5,15 @@ import com.pcloud.common.dto.BaseDto;
import
java.util.Date
;
import
lombok.Data
;
/**
* @描述:链接转换记录
* @作者:zhuyajie
* @创建时间:17:13 2019/10/10
* @版本:1.0
*/
@Data
public
class
LinkRevertRecordDTO
extends
BaseDto
{
/**
...
...
@@ -51,91 +54,18 @@ public class LinkRevertRecordDTO extends BaseDto {
* 点击人数
*/
private
Integer
clickUserCount
;
/**
* 发送次数变化
*/
private
Integer
sendCountChange
;
/**
*点击次数变化
*/
private
Integer
clickCountChange
;
/**
*点击人数变化
*/
private
Integer
clickUserCountChange
;
public
Long
getBrandId
()
{
return
brandId
;
}
public
void
setBrandId
(
Long
brandId
)
{
this
.
brandId
=
brandId
;
}
public
String
getBrandName
()
{
return
brandName
;
}
public
void
setBrandName
(
String
brandName
)
{
this
.
brandName
=
brandName
;
}
public
String
getLink
()
{
return
link
;
}
public
void
setLink
(
String
link
)
{
this
.
link
=
link
;
}
public
String
getShortLink
()
{
return
shortLink
;
}
public
void
setShortLink
(
String
shortLink
)
{
this
.
shortLink
=
shortLink
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Integer
getSendCount
()
{
return
sendCount
;
}
public
void
setSendCount
(
Integer
sendCount
)
{
this
.
sendCount
=
sendCount
;
}
public
Integer
getClickCount
()
{
return
clickCount
;
}
public
void
setClickCount
(
Integer
clickCount
)
{
this
.
clickCount
=
clickCount
;
}
public
Integer
getClickUserCount
()
{
return
clickUserCount
;
}
public
void
setClickUserCount
(
Integer
clickUserCount
)
{
this
.
clickUserCount
=
clickUserCount
;
}
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
@Override
public
String
toString
()
{
return
"LinkRevertRecordDTO{"
+
"id="
+
id
+
", brandId="
+
brandId
+
", brandName='"
+
brandName
+
'\''
+
", link='"
+
link
+
'\''
+
", shortLink='"
+
shortLink
+
'\''
+
", createTime="
+
createTime
+
", sendCount="
+
sendCount
+
", clickCount="
+
clickCount
+
", clickUserCount="
+
clickUserCount
+
'}'
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/entity/AdvertisingBrandBook.java
0 → 100644
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @Description
* @Author ruansiyuan
* @Date 2020/4/16 13:58
**/
@ApiModel
(
"品牌方与书关联关系"
)
@Data
public
class
AdvertisingBrandBook
extends
BaseEntity
{
@ApiModelProperty
(
"书id"
)
private
Long
bookId
;
@ApiModelProperty
(
"品牌方id"
)
private
Long
advertisingBrandId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/entity/AdvertisingBrandData.java
0 → 100644
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.entity.BaseEntity
;
import
java.util.Date
;
import
java.io.Serializable
;
/**
* 品牌方数据修改(AdvertisingBrandData)实体类
*
* @author zhuyajie
* @since 2020-04-16 11:39:22
*/
public
class
AdvertisingBrandData
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
-
93346942764371273L
;
private
Long
id
;
/**
* 来源类型(BOOK/QRCODE/APP/PRODUCT)
*/
private
String
fromType
;
/**
* 书刊id
*/
private
Long
bookId
;
/**
* 编辑id
*/
private
Long
adviserId
;
/**
* 运营id
*/
private
Long
channelId
;
/**
* 二维码id
*/
private
Long
sceneId
;
/**
* 应用或作品id
*/
private
Long
serveId
;
/**
* 修改的数据类型
*/
private
String
addType
;
/**
* 增加数量
*/
private
Integer
addCount
;
/**
* 创建时间
*/
@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
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
String
getFromType
()
{
return
fromType
;
}
public
void
setFromType
(
String
fromType
)
{
this
.
fromType
=
fromType
;
}
public
Long
getBookId
()
{
return
bookId
;
}
public
void
setBookId
(
Long
bookId
)
{
this
.
bookId
=
bookId
;
}
public
Long
getAdviserId
()
{
return
adviserId
;
}
public
void
setAdviserId
(
Long
adviserId
)
{
this
.
adviserId
=
adviserId
;
}
public
Long
getChannelId
()
{
return
channelId
;
}
public
void
setChannelId
(
Long
channelId
)
{
this
.
channelId
=
channelId
;
}
public
Long
getSceneId
()
{
return
sceneId
;
}
public
void
setSceneId
(
Long
sceneId
)
{
this
.
sceneId
=
sceneId
;
}
public
Long
getServeId
()
{
return
serveId
;
}
public
void
setServeId
(
Long
serveId
)
{
this
.
serveId
=
serveId
;
}
public
String
getAddType
()
{
return
addType
;
}
public
void
setAddType
(
String
addType
)
{
this
.
addType
=
addType
;
}
public
Integer
getAddCount
()
{
return
addCount
;
}
public
void
setAddCount
(
Integer
addCount
)
{
this
.
addCount
=
addCount
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/entity/AdvertisingLinkRevert.java
View file @
223a5b45
...
...
@@ -5,9 +5,12 @@ import com.pcloud.common.entity.BaseEntity;
import
java.util.Date
;
import
lombok.Data
;
/**
*链接转换记录
*/
@Data
public
class
AdvertisingLinkRevert
extends
BaseEntity
{
/**
...
...
@@ -34,51 +37,16 @@ public class AdvertisingLinkRevert extends BaseEntity {
private
Long
createUser
;
public
Long
getBrandId
()
{
return
brandId
;
}
public
void
setBrandId
(
Long
brandId
)
{
this
.
brandId
=
brandId
;
}
public
String
getLink
()
{
return
link
;
}
public
void
setLink
(
String
link
)
{
this
.
link
=
link
==
null
?
null
:
link
.
trim
();
}
public
String
getRevertLink
()
{
return
revertLink
;
}
public
void
setRevertLink
(
String
revertLink
)
{
this
.
revertLink
=
revertLink
;
}
public
String
getShortLink
()
{
return
shortLink
;
}
public
void
setShortLink
(
String
shortLink
)
{
this
.
shortLink
=
shortLink
==
null
?
null
:
shortLink
.
trim
();
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Long
getCreateUser
()
{
return
createUser
;
}
public
void
setCreateUser
(
Long
createUser
)
{
this
.
createUser
=
createUser
;
}
/**
* 发送次数变化
*/
private
Integer
sendCountChange
;
/**
*点击次数变化
*/
private
Integer
clickCountChange
;
/**
*点击人数变化
*/
private
Integer
clickUserCountChange
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/enums/BrandDataAddTypeEnum.java
0 → 100644
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
enums
;
/**
* @描述:修改的数据类型
* @作者:zhuyajie
* @创建时间:13:47 2020/4/16
* @版本:1.0
*/
public
enum
BrandDataAddTypeEnum
{
/**
* 扫码量
*/
SCAN
(
"SCAN"
),
/**
* 扫码人数
*/
SCAN_USER
(
"SCAN_USER"
),
/**
*服务点击次数
*/
SERVE_CLICK
(
"SERVE_CLICK"
),
/**
*读者量
*/
READER
(
"READER"
),
/**
*浏览量
*/
BROWSE
(
"BROWSE"
),
/**
*好友数量
*/
FRIENDS_COUNT
(
"FRIENDS_COUNT"
),
/**
* 1v1扫码量
*/
GROUP_SCAN
(
"GROUP_SCAN"
),
/**
* 1v1扫码人数
*/
GROUP_SCAN_USER
(
"GROUP_SCAN_USER"
),
/**
*1v1服务点击次数
*/
GROUP_SERVE_CLICK
(
"GROUP_SERVE_CLICK"
);
public
String
value
;
BrandDataAddTypeEnum
(
String
value
)
{
this
.
value
=
value
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/enums/BrandDataFromTypeEnum.java
0 → 100644
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
enums
;
/**
* @描述:数据来源类型
* @作者:zhuyajie
* @创建时间:13:36 2020/4/16
* @版本:1.0
*/
public
enum
BrandDataFromTypeEnum
{
/**
* 书刊
*/
BOOK
(
"BOOK"
),
/**
* 二维码
*/
QRCODE
(
"QRCODE"
),
/**
* 应用
*/
APP
(
"APP"
),
/**
* 作品
*/
PRODUCT
(
"PRODUCT"
);
public
String
value
;
BrandDataFromTypeEnum
(
String
value
)
{
this
.
value
=
value
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/facade/AdvertisingBrandDataFacade.java
0 → 100644
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
facade
;
import
com.pcloud.book.advertising.biz.AdvertisingBrandDataBiz
;
import
com.pcloud.book.advertising.dto.AddAdvertisingBrandBooksDTO
;
import
com.pcloud.book.advertising.dto.BrandDataParamDTO
;
import
com.pcloud.book.advertising.entity.AdvertisingBrandBook
;
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.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.codehaus.jackson.JsonParseException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* @描述:品牌方数据修改
* @作者:zhuyajie
* @创建时间:12:06 2020/4/16
* @版本:1.0
*/
@Api
(
description
=
"品牌方数据修改外部接口"
)
@RequestMapping
(
value
=
"/brandData"
)
@RestController
(
"advertisingBrandData"
)
public
class
AdvertisingBrandDataFacade
{
@Autowired
private
AdvertisingBrandDataBiz
advertisingBrandDataBiz
;
@ApiOperation
(
"添加品牌方数据"
)
@PostMapping
(
"addBrandData"
)
public
ResponseDto
<?>
addBrandData
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@ApiParam
BrandDataParamDTO
brandDataParamDTO
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
advertisingBrandDataBiz
.
addBrandData
(
brandDataParamDTO
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"添加品牌方和书的关联关系"
)
@PostMapping
(
"addAdvertisingBrandBooks"
)
public
ResponseDto
<?>
addAdvertisingBrandBooks
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
AddAdvertisingBrandBooksDTO
addAdvertisingBrandBooksDTO
)
throws
PermissionException
,
BizException
,
JsonParseException
{
SessionUtil
.
getToken4Redis
(
token
);
advertisingBrandDataBiz
.
addAdvertisingBrandBooks
(
addAdvertisingBrandBooksDTO
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"获取品牌方已经标记的书id集合"
)
@GetMapping
(
"getAdvertisingBrandBooksIds"
)
public
ResponseDto
<?>
getAdvertisingBrandBooksIds
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"advertisingBrandId"
)
Long
advertisingBrandId
)
throws
PermissionException
,
BizException
,
JsonParseException
{
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingBrandDataBiz
.
getAdvertisingBrandBooksIds
(
advertisingBrandId
));
}
@ApiOperation
(
"按书id批量删除品牌方和书的关联关系"
)
@PostMapping
(
"deleteAdvertisingBrandBooksByBookIds"
)
public
ResponseDto
<?>
deleteAdvertisingBrandBooksByBookIds
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
List
<
Long
>
bookIds
)
throws
PermissionException
,
BizException
,
JsonParseException
{
SessionUtil
.
getToken4Redis
(
token
);
advertisingBrandDataBiz
.
deleteAdvertisingBrandBooksByBookIds
(
bookIds
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"获取品牌方书刊列表"
)
@GetMapping
(
"getBookListForAdvertising"
)
public
ResponseDto
<?>
getBookListForAdvertising
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
,
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
,
@RequestParam
(
value
=
"advertisingBrandId"
,
required
=
false
)
Long
advertisingBrandId
,
@RequestParam
(
value
=
"isPitch"
,
required
=
false
)
Boolean
isPitch
,
@RequestParam
(
value
=
"is1v1"
,
required
=
false
)
Boolean
is1v1
)
throws
PermissionException
,
BizException
,
JsonParseException
{
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingBrandDataBiz
.
getBookListForAdvertising
(
currentPage
,
numPerPage
,
keyword
,
advertisingBrandId
,
isPitch
,
is1v1
));
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/facade/AdvertisingSpaceFacade.java
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
facade
;
import
com.pcloud.book.advertising.dto.AdvertisingCpaDTO
;
import
com.pcloud.book.advertising.dto.AdvertisingBrandDTO
;
import
com.pcloud.book.advertising.dto.AdvertisingCpaDTO
;
import
com.pcloud.book.advertising.dto.AdvertisingSpaceDTO
;
import
com.pcloud.book.advertising.dto.AdvertisingWechatMsgDTO
;
import
com.pcloud.book.advertising.dto.Book4AdvertisingTagDTO
;
...
...
@@ -1183,42 +1183,6 @@ public interface AdvertisingSpaceFacade {
public
ResponseDto
<
List
<
Long
>>
getTagBookIds4AdMatser
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"brandId"
,
required
=
false
)
Long
brandId
)
throws
PermissionException
;
@ApiOperation
(
value
=
"创建品牌方账号"
,
httpMethod
=
"POST"
)
@PostMapping
(
"createBrand"
)
public
ResponseDto
<?>
createBrand
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@ApiParam
AdvertisingBrand
advertisingBrand
)
throws
PermissionException
;
@ApiOperation
(
value
=
"根据id获得品牌方信息"
,
httpMethod
=
"GET"
)
@ApiImplicitParam
(
name
=
"brandId"
,
value
=
"品牌方id"
,
dataType
=
"long"
,
paramType
=
"query"
)
@GetMapping
(
"getBrandById"
)
public
ResponseDto
<
AdvertisingBrandDTO
>
getBrandById
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"brandId"
)
Long
brandId
)
throws
PermissionException
;
@ApiOperation
(
value
=
"修改品牌方密码"
,
httpMethod
=
"POST"
)
@PostMapping
(
"updateBrandPassword"
)
public
ResponseDto
<?>
updateBrandPassword
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@ApiParam
AdvertisingBrand
advertisingBrand
)
throws
PermissionException
;
@ApiOperation
(
value
=
"根据id删除品牌方"
,
httpMethod
=
"GET"
)
@ApiImplicitParam
(
name
=
"brandId"
,
value
=
"品牌方id"
,
dataType
=
"long"
,
paramType
=
"query"
)
@GetMapping
(
"deleteBrandById"
)
public
ResponseDto
<?>
deleteBrandById
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"brandId"
)
Long
brandId
)
throws
PermissionException
;
@ApiOperation
(
value
=
"分页查询品牌方"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
dataType
=
"integer"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页数量"
,
dataType
=
"integer"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"登录账号"
,
dataType
=
"string"
,
required
=
false
,
paramType
=
"query"
)})
@GetMapping
(
"listPageBrand"
)
public
ResponseDto
<
PageBean
>
listPageBrand
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
)
throws
PermissionException
;
@ApiOperation
(
value
=
"品牌方登录"
,
httpMethod
=
"POST"
)
@PostMapping
(
"brandLogin"
)
public
ResponseDto
<?>
brandLogin
(
@RequestBody
@ApiParam
AdvertisingBrandDTO
advertisingBrandDTO
);
@ApiOperation
(
value
=
"获得品牌方登录信息"
,
httpMethod
=
"GET"
)
@GetMapping
(
"getBrandLoginInfo"
)
public
ResponseDto
<?>
getBrandLoginInfo
(
@RequestHeader
(
"token"
)
String
token
)
throws
PermissionException
;
@ApiOperation
(
value
=
"创建多条微信群消息"
,
httpMethod
=
"POST"
)
@PostMapping
(
"createWechatGroupMsg"
)
public
ResponseDto
<?>
createWechatGroupMsg
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@ApiParam
List
<
AdvertisingWechatMsg
>
advertisingWechatMsgList
)
throws
PermissionException
;
...
...
@@ -1272,10 +1236,48 @@ public interface AdvertisingSpaceFacade {
@ApiOperation
(
value
=
"根据广告位查询配置的微信群消息"
,
httpMethod
=
"GET"
)
@ApiImplicitParam
(
name
=
"adId"
,
value
=
"广告id"
,
dataType
=
"long"
,
paramType
=
"query"
)
@GetMapping
(
"getWechatGroupMsgListByAdId"
)
public
ResponseDto
<
List
<
AdvertisingWechatMsgDTO
>>
getWechatGroupMsgListByAdId
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"adId"
)
Long
adId
)
throws
PermissionException
;
public
ResponseDto
<
List
<
AdvertisingWechatMsgDTO
>>
getWechatGroupMsgListByAdId
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"adId"
)
Long
adId
)
throws
PermissionException
;
@ApiOperation
(
value
=
"创建品牌方账号"
,
httpMethod
=
"POST"
)
@PostMapping
(
"createBrand"
)
public
ResponseDto
<?>
createBrand
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@ApiParam
AdvertisingBrand
advertisingBrand
)
throws
PermissionException
;
@ApiOperation
(
value
=
"根据id获得品牌方信息"
,
httpMethod
=
"GET"
)
@ApiImplicitParam
(
name
=
"brandId"
,
value
=
"品牌方id"
,
dataType
=
"long"
,
paramType
=
"query"
)
@GetMapping
(
"getBrandById"
)
public
ResponseDto
<
AdvertisingBrandDTO
>
getBrandById
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"brandId"
)
Long
brandId
)
throws
PermissionException
;
@ApiOperation
(
value
=
"修改品牌方密码"
,
httpMethod
=
"POST"
)
@PostMapping
(
"updateBrandPassword"
)
public
ResponseDto
<?>
updateBrandPassword
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@ApiParam
AdvertisingBrand
advertisingBrand
)
throws
PermissionException
;
@ApiOperation
(
value
=
"根据id删除品牌方"
,
httpMethod
=
"GET"
)
@ApiImplicitParam
(
name
=
"brandId"
,
value
=
"品牌方id"
,
dataType
=
"long"
,
paramType
=
"query"
)
@GetMapping
(
"deleteBrandById"
)
public
ResponseDto
<?>
deleteBrandById
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"brandId"
)
Long
brandId
)
throws
PermissionException
;
@ApiOperation
(
value
=
"分页查询品牌方"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
dataType
=
"integer"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页数量"
,
dataType
=
"integer"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"登录账号"
,
dataType
=
"string"
,
required
=
false
,
paramType
=
"query"
)})
@GetMapping
(
"listPageBrand"
)
public
ResponseDto
<
PageBean
>
listPageBrand
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
)
throws
PermissionException
;
@ApiOperation
(
value
=
"品牌方登录"
,
httpMethod
=
"POST"
)
@PostMapping
(
"brandLogin"
)
public
ResponseDto
<?>
brandLogin
(
@RequestBody
@ApiParam
AdvertisingBrandDTO
advertisingBrandDTO
);
@ApiOperation
(
value
=
"客户端-根据id查询cpa内容"
,
httpMethod
=
"GET"
)
@ApiImplicitParam
(
name
=
"cpaId"
,
value
=
"cpa内容id"
,
dataType
=
"Long"
,
paramType
=
"query"
)
@GetMapping
(
"getCPAContentById4Wechat"
)
public
ResponseDto
<
AdvertisingCpaDTO
>
getCPAContentById4Wechat
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"cpaId"
)
Long
cpaId
)
throws
PermissionException
;
@ApiOperation
(
value
=
"获得品牌方登录信息"
,
httpMethod
=
"GET"
)
@GetMapping
(
"getBrandLoginInfo"
)
public
ResponseDto
<?>
getBrandLoginInfo
(
@RequestHeader
(
"token"
)
String
token
)
throws
PermissionException
;
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/facade/LinkRevertFacade.java
View file @
223a5b45
...
...
@@ -133,4 +133,38 @@ public class LinkRevertFacade {
AdvertisingLinkRevert
revert
=
linkRevertBiz
.
getById
(
id
);
return
new
ResponseDto
<>(
revert
);
}
@ApiOperation
(
"修改链接数据变化值"
)
@PostMapping
(
"updateLinkBrandData"
)
public
ResponseDto
<?>
updateLinkBrandData
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@ApiParam
AdvertisingLinkRevert
linkRevert
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
if
(
null
==
linkRevert
||
null
==
linkRevert
.
getId
()){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少参数"
);
}
linkRevert
.
setSendCountChange
(
linkRevert
.
getSendCountChange
()==
null
?
0
:
linkRevert
.
getSendCountChange
());
linkRevert
.
setClickCountChange
(
linkRevert
.
getClickCountChange
()==
null
?
0
:
linkRevert
.
getClickCountChange
());
linkRevert
.
setClickUserCountChange
(
linkRevert
.
getClickUserCountChange
()==
null
?
0
:
linkRevert
.
getClickUserCountChange
());
linkRevertBiz
.
updateLinkBrandData
(
linkRevert
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
value
=
"品牌方-转换记录列表查询"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
dataType
=
"integer"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页数量"
,
dataType
=
"integer"
,
paramType
=
"query"
)
})
@GetMapping
(
"listPageRevertRecord4Brand"
)
public
ResponseDto
<
PageBeanNew
<
LinkRevertRecordDTO
>>
listPageRevertRecord4Brand
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
)
throws
PermissionException
{
Long
userId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
USER_ID
);
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
//品牌方登录,userId=brandId
PageBeanNew
<
LinkRevertRecordDTO
>
pageBean
=
linkRevertBiz
.
listPageRevertRecord
(
userId
,
currentPage
,
numPerPage
);
return
new
ResponseDto
<>(
pageBean
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/facade/impl/AdvertisingSpaceFacadeImpl.java
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
facade
.
impl
;
import
com.pcloud.book.advertising.biz.AdvertisingSpaceBiz
;
import
com.pcloud.book.advertising.dto.AdvertisingCpaDTO
;
import
com.pcloud.book.advertising.biz.GroupTagBiz
;
import
com.pcloud.book.advertising.dto.AdvertisingBrandDTO
;
import
com.pcloud.book.advertising.dto.AdvertisingCpaDTO
;
import
com.pcloud.book.advertising.dto.AdvertisingSpaceDTO
;
import
com.pcloud.book.advertising.dto.AdvertisingWechatMsgDTO
;
import
com.pcloud.book.advertising.dto.Book4AdvertisingTagDTO
;
import
com.pcloud.book.advertising.dto.GroupTagAddDTO
;
import
com.pcloud.book.advertising.dto.GroupTagDTO
;
import
com.pcloud.book.advertising.dto.AdvertisingWechatMsgDTO
;
import
com.pcloud.book.advertising.dto.TestParamDTO
;
import
com.pcloud.book.advertising.entity.AdvertisingAdviserPermission
;
import
com.pcloud.book.advertising.entity.AdvertisingAgentPermission
;
...
...
@@ -1095,6 +1095,108 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
return
new
ResponseDto
<>();
}
@Override
@PostMapping
(
"createCPAContent"
)
public
ResponseDto
<?>
createCPAContent
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@ApiParam
AdvertisingCpa
advertisingCpa
)
throws
PermissionException
{
if
(
null
==
advertisingCpa
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
SessionUtil
.
getToken4Redis
(
token
);
Long
cpaId
=
advertisingSpaceBiz
.
createCPAContent
(
advertisingCpa
);
return
new
ResponseDto
<>(
cpaId
);
}
@Override
@PostMapping
(
"updateCPAContent"
)
public
ResponseDto
<?>
updateCPAContent
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@ApiParam
AdvertisingCpa
advertisingCpa
)
throws
PermissionException
{
if
(
null
==
advertisingCpa
||
null
==
advertisingCpa
.
getId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
SessionUtil
.
getToken4Redis
(
token
);
advertisingSpaceBiz
.
updateCPAContent
(
advertisingCpa
);
return
new
ResponseDto
<>();
}
@Override
@GetMapping
(
"deleteCPAContent"
)
public
ResponseDto
<?>
deleteCPAContent
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"cpaId"
)
Long
cpaId
)
throws
PermissionException
{
if
(
null
==
cpaId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
SessionUtil
.
getToken4Redis
(
token
);
advertisingSpaceBiz
.
deleteCPAContent
(
cpaId
);
return
new
ResponseDto
<>();
}
@Override
@GetMapping
(
"getCPAContentById"
)
public
ResponseDto
<
AdvertisingCpaDTO
>
getCPAContentById
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"cpaId"
)
Long
cpaId
)
throws
PermissionException
{
if
(
null
==
cpaId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
SessionUtil
.
getToken4Redis
(
token
);
AdvertisingCpaDTO
dto
=
advertisingSpaceBiz
.
getCPAContentById
(
cpaId
);
return
new
ResponseDto
<>(
dto
);
}
@Override
@GetMapping
(
"listPageCPAContent"
)
public
ResponseDto
<
PageBeanNew
<
AdvertisingCpaDTO
>>
listPageCPAContent
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"title"
,
required
=
false
)
String
title
,
@RequestParam
(
value
=
"detailMode"
,
required
=
false
)
String
detailMode
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
PageBeanNew
<
AdvertisingCpaDTO
>
pageBeanNew
=
advertisingSpaceBiz
.
listPageCPAContent
(
title
,
detailMode
,
currentPage
,
numPerPage
);
return
new
ResponseDto
<>(
pageBeanNew
);
}
@Override
@GetMapping
(
"listPageCPALink"
)
public
ResponseDto
<
PageBeanNew
<
AdvertisingCpaDTO
>>
listPageCPALink
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"title"
,
required
=
false
)
String
title
,
@RequestParam
(
value
=
"detailMode"
,
required
=
false
)
String
detailMode
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
PageBeanNew
<
AdvertisingCpaDTO
>
pageBeanNew
=
advertisingSpaceBiz
.
listPageCPALink
(
title
,
detailMode
,
currentPage
,
numPerPage
);
return
new
ResponseDto
<>(
pageBeanNew
);
}
@Override
@GetMapping
(
"getWechatGroupMsgListByAdId"
)
public
ResponseDto
<
List
<
AdvertisingWechatMsgDTO
>>
getWechatGroupMsgListByAdId
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"adId"
)
Long
adId
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
if
(
null
==
adId
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"广告id为空"
);
}
List
<
AdvertisingWechatMsgDTO
>
list
=
advertisingSpaceBiz
.
getWechatGroupMsgListByAdId
(
adId
);
return
new
ResponseDto
<>(
list
);
}
@ApiOperation
(
value
=
"cpa内容旧数据处理---内部使用!!"
,
httpMethod
=
"GET"
)
@GetMapping
(
"dealOldCPAContent"
)
public
ResponseDto
<?>
dealOldCPAContent
(){
advertisingSpaceBiz
.
dealOldCPAContent
();
return
new
ResponseDto
<>();
}
@Override
@GetMapping
(
"getCPAContentById4Wechat"
)
public
ResponseDto
<
AdvertisingCpaDTO
>
getCPAContentById4Wechat
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"cpaId"
)
Long
cpaId
)
throws
PermissionException
{
if
(
null
==
cpaId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
AdvertisingCpaDTO
dto
=
advertisingSpaceBiz
.
getCPAContentById
(
cpaId
);
return
new
ResponseDto
<>(
dto
);
}
/**
* 创建品牌方账号
*/
...
...
@@ -1220,105 +1322,4 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
return
new
ResponseDto
<>(
map
);
}
@Override
@PostMapping
(
"createCPAContent"
)
public
ResponseDto
<?>
createCPAContent
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@ApiParam
AdvertisingCpa
advertisingCpa
)
throws
PermissionException
{
if
(
null
==
advertisingCpa
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
SessionUtil
.
getToken4Redis
(
token
);
Long
cpaId
=
advertisingSpaceBiz
.
createCPAContent
(
advertisingCpa
);
return
new
ResponseDto
<>(
cpaId
);
}
@Override
@PostMapping
(
"updateCPAContent"
)
public
ResponseDto
<?>
updateCPAContent
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@ApiParam
AdvertisingCpa
advertisingCpa
)
throws
PermissionException
{
if
(
null
==
advertisingCpa
||
null
==
advertisingCpa
.
getId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
SessionUtil
.
getToken4Redis
(
token
);
advertisingSpaceBiz
.
updateCPAContent
(
advertisingCpa
);
return
new
ResponseDto
<>();
}
@Override
@GetMapping
(
"deleteCPAContent"
)
public
ResponseDto
<?>
deleteCPAContent
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"cpaId"
)
Long
cpaId
)
throws
PermissionException
{
if
(
null
==
cpaId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
SessionUtil
.
getToken4Redis
(
token
);
advertisingSpaceBiz
.
deleteCPAContent
(
cpaId
);
return
new
ResponseDto
<>();
}
@Override
@GetMapping
(
"getCPAContentById"
)
public
ResponseDto
<
AdvertisingCpaDTO
>
getCPAContentById
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"cpaId"
)
Long
cpaId
)
throws
PermissionException
{
if
(
null
==
cpaId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
SessionUtil
.
getToken4Redis
(
token
);
AdvertisingCpaDTO
dto
=
advertisingSpaceBiz
.
getCPAContentById
(
cpaId
);
return
new
ResponseDto
<>(
dto
);
}
@Override
@GetMapping
(
"listPageCPAContent"
)
public
ResponseDto
<
PageBeanNew
<
AdvertisingCpaDTO
>>
listPageCPAContent
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"title"
,
required
=
false
)
String
title
,
@RequestParam
(
value
=
"detailMode"
,
required
=
false
)
String
detailMode
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
PageBeanNew
<
AdvertisingCpaDTO
>
pageBeanNew
=
advertisingSpaceBiz
.
listPageCPAContent
(
title
,
detailMode
,
currentPage
,
numPerPage
);
return
new
ResponseDto
<>(
pageBeanNew
);
}
@Override
@GetMapping
(
"listPageCPALink"
)
public
ResponseDto
<
PageBeanNew
<
AdvertisingCpaDTO
>>
listPageCPALink
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"title"
,
required
=
false
)
String
title
,
@RequestParam
(
value
=
"detailMode"
,
required
=
false
)
String
detailMode
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
PageBeanNew
<
AdvertisingCpaDTO
>
pageBeanNew
=
advertisingSpaceBiz
.
listPageCPALink
(
title
,
detailMode
,
currentPage
,
numPerPage
);
return
new
ResponseDto
<>(
pageBeanNew
);
}
@Override
@GetMapping
(
"getWechatGroupMsgListByAdId"
)
public
ResponseDto
<
List
<
AdvertisingWechatMsgDTO
>>
getWechatGroupMsgListByAdId
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"adId"
)
Long
adId
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
if
(
null
==
adId
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"广告id为空"
);
}
List
<
AdvertisingWechatMsgDTO
>
list
=
advertisingSpaceBiz
.
getWechatGroupMsgListByAdId
(
adId
);
return
new
ResponseDto
<>(
list
);
}
@ApiOperation
(
value
=
"cpa内容旧数据处理---内部使用!!"
,
httpMethod
=
"GET"
)
@GetMapping
(
"dealOldCPAContent"
)
public
ResponseDto
<?>
dealOldCPAContent
(){
advertisingSpaceBiz
.
dealOldCPAContent
();
return
new
ResponseDto
<>();
}
@Override
@GetMapping
(
"getCPAContentById4Wechat"
)
public
ResponseDto
<
AdvertisingCpaDTO
>
getCPAContentById4Wechat
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"cpaId"
)
Long
cpaId
)
throws
PermissionException
{
if
(
null
==
cpaId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
AdvertisingCpaDTO
dto
=
advertisingSpaceBiz
.
getCPAContentById
(
cpaId
);
return
new
ResponseDto
<>(
dto
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/service/impl/AdvertisingSpaceServiceImpl.java
View file @
223a5b45
package
com
.
pcloud
.
book
.
advertising
.
service
.
impl
;
import
com.pcloud.book.advertising.biz.AdvertisingBrandDataBiz
;
import
com.pcloud.book.advertising.biz.AdvertisingSpaceBiz
;
import
com.pcloud.book.advertising.biz.GroupTagBiz
;
import
com.pcloud.book.advertising.biz.LinkRevertBiz
;
import
com.pcloud.book.advertising.dto.BrandDataDTO4Channel
;
import
com.pcloud.book.advertising.service.AdvertisingSpaceService
;
import
com.pcloud.book.group.service.BookGroupService
;
import
com.pcloud.common.core.aspect.ParamLog
;
...
...
@@ -45,6 +47,8 @@ public class AdvertisingSpaceServiceImpl implements AdvertisingSpaceService {
private
LinkRevertBiz
linkRevertBiz
;
@Autowired
private
BookGroupService
bookGroupService
;
@Autowired
private
AdvertisingBrandDataBiz
advertisingBrandDataBiz
;
/**
* 每日凌晨计算昨日广告位收益
...
...
@@ -83,4 +87,16 @@ public class AdvertisingSpaceServiceImpl implements AdvertisingSpaceService {
return
ResponseHandleUtil
.
toResponse
(
brandIds
);
}
@Override
@PostMapping
(
"mapBrandQrServeAddData"
)
public
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
BrandDataDTO4Channel
>>>
mapBrandQrServeAddData
(
@RequestBody
BrandDataDTO4Channel
brandDataDTO4Channel
)
{
return
ResponseHandleUtil
.
toResponse
(
advertisingBrandDataBiz
.
mapBrandQrServeAddData
(
brandDataDTO4Channel
));
}
@Override
@PostMapping
(
"mapBrandQrAddData"
)
public
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
BrandDataDTO4Channel
>>>
mapBrandQrAddData
(
@RequestBody
BrandDataDTO4Channel
brandDataDTO4Channel
)
{
return
ResponseHandleUtil
.
toResponse
(
advertisingBrandDataBiz
.
mapBrandQrAddData
(
brandDataDTO4Channel
));
}
}
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingBrandBook.xml
0 → 100644
View file @
223a5b45
<?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.advertising.dao.impl.AdvertisingBrandBookDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.advertising.entity.AdvertisingBrandBook"
>
<result
property=
"id"
column=
"id"
jdbcType=
"INTEGER"
/>
<result
property=
"bookId"
column=
"book_id"
jdbcType=
"BIGINT"
/>
<result
property=
"advertisingBrandId"
column=
"advertising_brand_id"
jdbcType=
"BIGINT"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id,book_id,advertising_brand_id,create_time
</sql>
<!--新增所有列-->
<insert
id=
"insert"
parameterType=
"com.pcloud.book.advertising.entity.AdvertisingBrandBook"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into advertising_brand_book (book_id, advertising_brand_id,create_time)
values (#{bookId}, #{advertisingBrandId},NOW())
</insert>
<delete
id=
"deleteByBookId"
parameterType=
"long"
>
delete from advertising_brand_book
where book_id=#{bookId}
</delete>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.advertising.entity.AdvertisingBrandBook"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into advertising_brand_book (
book_id, advertising_brand_id,create_time
) values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.bookId}, #{item.advertisingBrandId},NOW()
)
</foreach>
</insert>
<delete
id=
"deleteByBookIds"
parameterType=
"long"
>
delete from advertising_brand_book
where book_id in
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
</delete>
<select
id=
"getByBookIds"
parameterType=
"long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from advertising_brand_book
where book_id in
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
</select>
<select
id=
"getBookIdsByAdvertisingBrandId"
parameterType=
"long"
resultType=
"long"
>
select book_id from advertising_brand_book
where advertising_brand_id=#{advertisingBrandId}
</select>
<delete
id=
"deleteByAdvertisingBrandId"
parameterType=
"long"
>
delete from advertising_brand_book
where advertising_brand_id=#{advertisingBrandId}
</delete>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingBrandDataMapper.xml
0 → 100644
View file @
223a5b45
<?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.advertising.dao.impl.AdvertisingBrandDataDaoImpl"
>
<resultMap
type=
"com.pcloud.book.advertising.entity.AdvertisingBrandData"
id=
"AdvertisingBrandDataMap"
>
<result
property=
"id"
column=
"id"
jdbcType=
"INTEGER"
/>
<result
property=
"fromType"
column=
"from_type"
jdbcType=
"VARCHAR"
/>
<result
property=
"bookId"
column=
"book_id"
jdbcType=
"INTEGER"
/>
<result
property=
"adviserId"
column=
"adviser_id"
jdbcType=
"INTEGER"
/>
<result
property=
"channelId"
column=
"channel_id"
jdbcType=
"INTEGER"
/>
<result
property=
"sceneId"
column=
"scene_id"
jdbcType=
"INTEGER"
/>
<result
property=
"serveId"
column=
"serve_id"
jdbcType=
"INTEGER"
/>
<result
property=
"addType"
column=
"add_type"
jdbcType=
"VARCHAR"
/>
<result
property=
"addCount"
column=
"add_count"
jdbcType=
"INTEGER"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"updateTime"
column=
"update_time"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<!--通过实体作为筛选条件查询-->
<select
id=
"queryAll"
resultMap=
"AdvertisingBrandDataMap"
parameterType=
"com.pcloud.book.advertising.entity.AdvertisingBrandData"
>
select
id, from_type, book_id, adviser_id, channel_id, scene_id, serve_id, add_type, add_count, create_time, update_time
from book.advertising_brand_data
<where>
<if
test=
"fromType != null and fromType != ''"
>
and from_type = #{fromType}
</if>
<if
test=
"bookId != null"
>
and book_id = #{bookId}
</if>
<if
test=
"adviserId != null"
>
and adviser_id = #{adviserId}
</if>
<if
test=
"channelId != null"
>
and channel_id = #{channelId}
</if>
<if
test=
"sceneId != null"
>
and scene_id = #{sceneId}
</if>
<if
test=
"serveId != null"
>
and serve_id = #{serveId}
</if>
</where>
</select>
<!--新增所有列-->
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into book.advertising_brand_data(from_type, book_id, adviser_id, channel_id, scene_id, serve_id, add_type, add_count, create_time, update_time)
values (#{fromType}, #{bookId}, #{adviserId}, #{channelId}, #{sceneId}, #{serveId}, #{addType}, #{addCount}, NOW(), NOW())
</insert>
<insert
id=
"batchInsert"
useGeneratedKeys=
"true"
parameterType=
"java.util.List"
>
insert into advertising_brand_data (
from_type, book_id, adviser_id, channel_id,
scene_id, serve_id, add_type, add_count, create_time, update_time
)
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.fromType}, #{item.bookId}, #{item.adviserId}, #{item.channelId},
#{item.sceneId}, #{item.serveId}, #{item.addType}, #{item.addCount}, NOW(), NOW()
)
</foreach>
</insert>
<!--通过主键删除-->
<delete
id=
"deleteById"
>
delete from book.advertising_brand_data where id = #{id}
</delete>
<select
id=
"getQrServeData4Channel"
parameterType=
"map"
resultMap=
"AdvertisingBrandDataMap"
>
select
id, from_type, book_id, adviser_id, channel_id, scene_id, serve_id, add_type, add_count, create_time, update_time
from advertising_brand_data
WHERE from_type = #{fromType}
and book_id = #{bookId}
and scene_id = #{sceneId}
<if
test=
"adviserId != null"
>
and adviser_id = #{adviserId}
</if>
<if
test=
"channelId != null"
>
and channel_id = #{channelId}
</if>
and serve_id in
<foreach
collection=
"serveIdList"
item=
"item"
open=
"("
close=
")"
separator=
","
index=
"index"
>
#{item}
</foreach>
</select>
<select
id=
"getQrData4Channel"
parameterType=
"map"
resultMap=
"AdvertisingBrandDataMap"
>
select
id, from_type, book_id, adviser_id, channel_id, scene_id, serve_id, add_type, add_count, create_time, update_time
from advertising_brand_data
WHERE from_type = #{fromType}
and book_id = #{bookId}
and adviser_id = #{adviserId}
and channel_id = #{channelId}
and scene_id in
<foreach
collection=
"sceneIdList"
item=
"item"
open=
"("
close=
")"
separator=
","
index=
"index"
>
#{item}
</foreach>
</select>
<select
id=
"getBookAddByType"
parameterType=
"map"
resultMap=
"AdvertisingBrandDataMap"
>
select
book_id, add_count
from advertising_brand_data
WHERE from_type = 'BOOK'
and book_id in
<foreach
collection=
"bookIds"
item=
"item"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
and add_type=#{addType}
group by book_id
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingLinkRevertMapper.xml
View file @
223a5b45
...
...
@@ -9,19 +9,22 @@
<result
column=
"short_link"
property=
"shortLink"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"create_user"
property=
"createUser"
jdbcType=
"BIGINT"
/>
<result
column=
"send_count_change"
property=
"sendCountChange"
jdbcType=
"INTEGER"
/>
<result
column=
"click_count_change"
property=
"clickCountChange"
jdbcType=
"INTEGER"
/>
<result
column=
"click_user_count_change"
property=
"clickUserCountChange"
jdbcType=
"INTEGER"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, brand_id, link, revert_link, short_link, create_time, create_user
id, brand_id, link, revert_link, short_link, create_time, create_user
,send_count_change,click_count_change,click_user_count_change
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.advertising.entity.AdvertisingLinkRevert"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into advertising_link_revert (id, brand_id, link, revert_link,
short_link, create_time, create_user
short_link, create_time, create_user
,send_count_change,click_count_change,click_user_count_change
)
values (#{id,jdbcType=BIGINT}, #{brandId,jdbcType=BIGINT}, #{link,jdbcType=VARCHAR}, #{revertLink},
#{shortLink,jdbcType=VARCHAR}, NOW(), #{createUser,jdbcType=BIGINT}
#{shortLink,jdbcType=VARCHAR}, NOW(), #{createUser,jdbcType=BIGINT}
,0,0,0
)
</insert>
...
...
@@ -36,7 +39,10 @@
brand_id brandId,
link link,
short_link shortLink,
create_time createTime
create_time createTime,
send_count_change sendCountChange,
click_count_change clickCountChange,
click_user_count_change clickUserCountChange
FROM
advertising_link_revert
WHERE
...
...
@@ -76,4 +82,12 @@
FROM advertising_link_revert
</select>
<update
id=
"updateLinkBrandData"
parameterType=
"com.pcloud.book.advertising.entity.AdvertisingLinkRevert"
>
UPDATE advertising_link_revert
SET send_count_change = #{sendCountChange},
click_count_change = #{clickCountChange},
click_user_count_change = #{clickUserCountChange}
WHERE id = #{id}
</update>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/book/BookAdviser.Mapper.xml
View file @
223a5b45
...
...
@@ -652,4 +652,42 @@
AND IS_MAIN_EDITOR=1 AND IS_DELETE=0
LIMIT 1
</select>
<select
id=
"getBookListForAdvertising"
parameterType=
"map"
resultType=
"com.pcloud.book.advertising.dto.BookListForAdvertisingDTO"
>
SELECT
t.BOOK_ID bookId,
t.channel_id channelId,
t.adviser_id adviserId,
<if
test=
"is1v1!=null and is1v1"
>
tt.id bookGroupId,
</if>
t1.BOOK_NAME bookName,
t1.ISBN,
t2.advertising_brand_id advertisingBrandId,
t3.brand_name brandName
FROM
book_adviser t
INNER JOIN book t1 ON t.BOOK_ID = t1.BOOK_ID
<if
test=
"is1v1!=null and is1v1"
>
INNER JOIN book_group tt on t.BOOK_ID = tt.BOOK_ID and tt.join_group_type=2
</if>
AND t.IS_DELETE = 0
AND t1.IS_DELETE = 0
LEFT JOIN advertising_brand_book t2
on t2.book_id=t.BOOK_ID
LEFT JOIN advertising_brand t3 on t2.advertising_brand_id=t3.id
WHERE
t.IS_MAIN_EDITOR = 1
<if
test=
"keyword != null"
>
AND (t1.BOOK_NAME LIKE CONCAT('%', #{keyword}, '%') or t1.ISBN LIKE CONCAT('%', #{keyword},'%'))
</if>
<if
test=
"advertisingBrandId!=null"
>
and t2.advertising_brand_id=#{advertisingBrandId}
</if>
<if
test=
"isPitch!=null and isPitch"
>
and t2.advertising_brand_id is null
</if>
group by t.BOOK_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