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
e991c8ed
Commit
e991c8ed
authored
May 27, 2019
by
gaopeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
广告位
parent
872b7814
Hide whitespace changes
Inline
Side-by-side
Showing
50 changed files
with
5842 additions
and
574 deletions
+5842
-574
AdvertisingSpaceService.java
...oud/book/advertising/service/AdvertisingSpaceService.java
+21
-0
BookDto.java
...-book/src/main/java/com/pcloud/book/book/dto/BookDto.java
+29
-0
AdvertisingSpaceBiz.java
.../com/pcloud/book/advertising/biz/AdvertisingSpaceBiz.java
+218
-18
AdvertisingSpaceBizImpl.java
...ud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
+1343
-152
AdvertisingClickRecordDao.java
...cloud/book/advertising/dao/AdvertisingClickRecordDao.java
+10
-0
AdvertisingDistributionBookDao.java
.../book/advertising/dao/AdvertisingDistributionBookDao.java
+4
-3
AdvertisingExposureRecordDao.java
...ud/book/advertising/dao/AdvertisingExposureRecordDao.java
+8
-0
AdvertisingIncomeDailyDao.java
...cloud/book/advertising/dao/AdvertisingIncomeDailyDao.java
+26
-0
AdvertisingMasterDao.java
...com/pcloud/book/advertising/dao/AdvertisingMasterDao.java
+26
-0
AdvertisingSettlementMethodDao.java
.../book/advertising/dao/AdvertisingSettlementMethodDao.java
+35
-0
AdvertisingSpaceDao.java
.../com/pcloud/book/advertising/dao/AdvertisingSpaceDao.java
+30
-0
AdvertisingClickRecordDaoImpl.java
...k/advertising/dao/impl/AdvertisingClickRecordDaoImpl.java
+11
-0
AdvertisingDistributionBookDaoImpl.java
...ertising/dao/impl/AdvertisingDistributionBookDaoImpl.java
+4
-3
AdvertisingExposureRecordDaoImpl.java
...dvertising/dao/impl/AdvertisingExposureRecordDaoImpl.java
+10
-0
AdvertisingIncomeDailyDaoImpl.java
...k/advertising/dao/impl/AdvertisingIncomeDailyDaoImpl.java
+31
-0
AdvertisingMasterDaoImpl.java
...d/book/advertising/dao/impl/AdvertisingMasterDaoImpl.java
+32
-0
AdvertisingSettlementMethodDaoImpl.java
...ertising/dao/impl/AdvertisingSettlementMethodDaoImpl.java
+45
-0
AdvertisingSpaceDaoImpl.java
...ud/book/advertising/dao/impl/AdvertisingSpaceDaoImpl.java
+37
-0
AdvertisingMasterDTO.java
...com/pcloud/book/advertising/dto/AdvertisingMasterDTO.java
+163
-0
AdvertisingSettlementMethodDTO.java
.../book/advertising/dto/AdvertisingSettlementMethodDTO.java
+134
-0
AdvertisingSpaceDTO.java
.../com/pcloud/book/advertising/dto/AdvertisingSpaceDTO.java
+292
-36
DateCountDTO.java
...in/java/com/pcloud/book/advertising/dto/DateCountDTO.java
+26
-0
WechatGroupClickUserDTO.java
.../pcloud/book/advertising/dto/WechatGroupClickUserDTO.java
+177
-0
AdvertisingClickRecord.java
...cloud/book/advertising/entity/AdvertisingClickRecord.java
+43
-0
AdvertisingDistributionBook.java
.../book/advertising/entity/AdvertisingDistributionBook.java
+51
-8
AdvertisingExposureRecord.java
...ud/book/advertising/entity/AdvertisingExposureRecord.java
+43
-0
AdvertisingIncomeDaily.java
...cloud/book/advertising/entity/AdvertisingIncomeDaily.java
+227
-0
AdvertisingMaster.java
...com/pcloud/book/advertising/entity/AdvertisingMaster.java
+93
-0
AdvertisingSettlementMethod.java
.../book/advertising/entity/AdvertisingSettlementMethod.java
+122
-0
AdvertisingSpace.java
.../com/pcloud/book/advertising/entity/AdvertisingSpace.java
+79
-21
DistributionWechatGroup.java
...loud/book/advertising/entity/DistributionWechatGroup.java
+88
-0
AdPositionDetailEnum.java
...m/pcloud/book/advertising/enums/AdPositionDetailEnum.java
+55
-0
AdPositionEnum.java
...ava/com/pcloud/book/advertising/enums/AdPositionEnum.java
+22
-13
AdPositionModeEnum.java
...com/pcloud/book/advertising/enums/AdPositionModeEnum.java
+76
-0
AdSourceEnum.java
.../java/com/pcloud/book/advertising/enums/AdSourceEnum.java
+0
-27
DistributionTypeEnum.java
...m/pcloud/book/advertising/enums/DistributionTypeEnum.java
+0
-27
SettlementMethodEnum.java
...m/pcloud/book/advertising/enums/SettlementMethodEnum.java
+38
-0
AdvertisingSpaceFacade.java
...cloud/book/advertising/facade/AdvertisingSpaceFacade.java
+499
-41
AdvertisingSpaceFacadeImpl.java
...k/advertising/facade/impl/AdvertisingSpaceFacadeImpl.java
+359
-38
AdvertisingSpaceServiceImpl.java
...advertising/service/impl/AdvertisingSpaceServiceImpl.java
+30
-0
ReaderConsr.java
...ain/java/com/pcloud/book/consumer/reader/ReaderConsr.java
+21
-12
AdGroupQrcodeDTO.java
...main/java/com/pcloud/book/group/dto/AdGroupQrcodeDTO.java
+14
-0
AdvertisingClickRecordMapper.xml
...urces/mapper/advertising/AdvertisingClickRecordMapper.xml
+129
-34
AdvertisingDistributionBookMapper.xml
.../mapper/advertising/AdvertisingDistributionBookMapper.xml
+170
-28
AdvertisingExposureRecordMapper.xml
...es/mapper/advertising/AdvertisingExposureRecordMapper.xml
+176
-58
AdvertisingIncomeDailyMapper.xml
...urces/mapper/advertising/AdvertisingIncomeDailyMapper.xml
+395
-0
AdvertisingMasterMapper.xml
.../resources/mapper/advertising/AdvertisingMasterMapper.xml
+106
-0
AdvertisingSettlementMethodMapper.xml
.../mapper/advertising/AdvertisingSettlementMethodMapper.xml
+126
-0
AdvertisingSpaceMapper.xml
...n/resources/mapper/advertising/AdvertisingSpaceMapper.xml
+137
-26
Book.Mapper.xml
...rvice-book/src/main/resources/mapper/book/Book.Mapper.xml
+31
-29
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/advertising/service/AdvertisingSpaceService.java
0 → 100644
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
service
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
com.pcloud.common.exceptions.BizException
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
@FeignClient
(
value
=
"pcloud-service-book"
,
qualifier
=
"advertisingSpaceServiceCloud"
,
path
=
"book/v1.0/advertisingSpaceService"
)
@Api
(
description
=
"广告位内部接口"
)
public
interface
AdvertisingSpaceService
{
/**
* 每日凌晨计算昨日广告位收益
* @throws BizException
*/
@ApiOperation
(
value
=
"每日凌晨计算昨日广告位收益"
,
httpMethod
=
"GET"
)
@RequestMapping
(
value
=
"calculateAdvertisingIncomeYesterday"
,
method
=
RequestMethod
.
GET
)
void
calculateAdvertisingIncomeYesterday
()
throws
BizException
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/book/dto/BookDto.java
View file @
e991c8ed
...
...
@@ -433,6 +433,16 @@ public class BookDto extends BaseDto {
private
Long
clickNum
;
/**
* 广告位数量
*/
private
Long
advertisingSpaceNum
;
/**
* 点击率
*/
private
BigDecimal
clickRate
;
/**
* 公众号名称
*/
private
String
officialAccountsName
;
...
...
@@ -1271,6 +1281,23 @@ public class BookDto extends BaseDto {
public
void
setIsBookGroup
(
Boolean
isBookGroup
)
{
this
.
isBookGroup
=
isBookGroup
;
}
public
BigDecimal
getClickRate
()
{
return
clickRate
;
}
public
void
setClickRate
(
BigDecimal
clickRate
)
{
this
.
clickRate
=
clickRate
;
}
public
Long
getAdvertisingSpaceNum
()
{
return
advertisingSpaceNum
;
}
public
void
setAdvertisingSpaceNum
(
Long
advertisingSpaceNum
)
{
this
.
advertisingSpaceNum
=
advertisingSpaceNum
;
}
@Override
public
String
toString
()
{
return
"BookDto{"
+
...
...
@@ -1357,6 +1384,8 @@ public class BookDto extends BaseDto {
", distributionTime="
+
distributionTime
+
", exposureNum="
+
exposureNum
+
", clickNum="
+
clickNum
+
", advertisingSpaceNum="
+
advertisingSpaceNum
+
", clickRate="
+
clickRate
+
", officialAccountsName='"
+
officialAccountsName
+
'\''
+
", uniqueNumber='"
+
uniqueNumber
+
'\''
+
", bookGroupId="
+
bookGroupId
+
...
...
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/AdvertisingSpaceBiz.java
View file @
e991c8ed
...
...
@@ -2,13 +2,16 @@ package com.pcloud.book.advertising.biz;
import
java.util.List
;
import
java.util.Map
;
import
com.pcloud.book.advertising.dto.AdvertisingMasterDTO
;
import
com.pcloud.book.advertising.dto.AdvertisingSpaceDTO
;
import
com.pcloud.book.advertising.entity.AdvertisingAdviserPermission
;
import
com.pcloud.book.advertising.entity.AdvertisingAgentPermission
;
import
com.pcloud.book.advertising.entity.AdvertisingClickRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingDistributionBook
;
import
com.pcloud.book.advertising.entity.AdvertisingExposureRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingMaster
;
import
com.pcloud.book.advertising.entity.AdvertisingSpace
;
import
com.pcloud.book.group.dto.AdGroupQrcodeDTO
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBean
;
import
com.pcloud.common.page.PageParam
;
...
...
@@ -44,13 +47,6 @@ public interface AdvertisingSpaceBiz {
void
stop
(
AdvertisingSpace
advertisingSpace
)
throws
BizException
;
/**
* 删除广告位
* @param advertisingSpace 广告位实体
* @throws BizException
*/
void
delete
(
AdvertisingSpace
advertisingSpace
)
throws
BizException
;
/**
* 获取广告位信息
* @param adId 广告位ID
* @return
...
...
@@ -67,6 +63,13 @@ public interface AdvertisingSpaceBiz {
void
distributeBook
(
AdvertisingDistributionBook
book
)
throws
BizException
;
/**
* 投放微信群
* @param book 广告位书刊实体
* @throws BizException
*/
void
distributeWechatGroup
(
AdvertisingDistributionBook
book
)
throws
BizException
;
/**
* 获取出版社书刊权限
* @param agentId 出版社ID
* @return
...
...
@@ -109,6 +112,15 @@ public interface AdvertisingSpaceBiz {
PageBean
listBook4Platform
(
Map
<
String
,
Object
>
paramMap
,
PageParam
pageParam
,
Long
adviserId
)
throws
BizException
;
/**
* 平台端获取社群书微信群列表
* @param paramMap 参数Map
* @param pageParam 分页参数
* @return
* @throws BizException
*/
PageBean
listGroupQrcode4Platform
(
Map
<
String
,
Object
>
paramMap
,
PageParam
pageParam
)
throws
BizException
;
/**
* 获取广告位投放书刊列表
* @param adId 广告位ID
* @param name 书刊名称
...
...
@@ -119,22 +131,39 @@ public interface AdvertisingSpaceBiz {
PageBean
distributionBookList
(
Long
adId
,
String
name
,
PageParam
pageParam
)
throws
BizException
;
/**
* 获取广告位投放作品/应用数据统计
* @param adId 广告位ID
* 获取广告位投放微信群列表
* @param adId 广告位ID
* @param name 书刊名称
* @param pageParam 分页参数
* @return
* @throws BizException
*/
PageBean
distribution
AppStatics
(
Long
adId
,
PageParam
pageParam
)
throws
BizException
;
PageBean
distribution
WechatGroupList
(
Long
adId
,
String
name
,
PageParam
pageParam
)
throws
BizException
;
/**
* 获取广告位投放时间统计
* @param adId 广告位ID
* @param day 天数
* 获取广告位投放书刊列表
* @param name 书刊名称
* @param pageParam 分页参数
* @return
* @throws BizException
*/
PageBean
advertisingBookList
(
String
name
,
PageParam
pageParam
)
throws
BizException
;
/**
* 获取广告位投放微信群列表
* @param name 书刊名称
* @param pageParam 分页参数
* @return
* @throws BizException
*/
List
<
Object
>
distributionDateStatics
(
Long
adId
,
Integer
day
)
throws
BizException
;
PageBean
advertisingWechatGroupList
(
String
name
,
PageParam
pageParam
)
throws
BizException
;
/**
* 获取广告位投放微信群曝光量前几位
* @return
* @throws BizException
*/
List
<
AdGroupQrcodeDTO
>
advertisingWechatGroupRankTop
()
throws
BizException
;
/**
* 获取广告位列表
...
...
@@ -146,14 +175,106 @@ public interface AdvertisingSpaceBiz {
PageBean
list
(
String
name
,
PageParam
pageParam
)
throws
BizException
;
/**
* 书刊广告位明细
* @param bookId 书刊ID
* @param channelId 运营ID
* @param adviserId 编辑ID
* @param statisMonth 统计月份
* @param pageParam 分页参数
* @return
* @throws BizException
*/
PageBean
advertisingDetail4Book
(
Long
bookId
,
Long
channelId
,
Long
adviserId
,
String
statisMonth
,
PageParam
pageParam
)
throws
BizException
;
/**
* 导出书刊广告位明细
* @param bookId 书刊ID
* @param channelId 运营ID
* @param adviserId 编辑ID
* @param statisMonth 统计月份
* @return
* @throws BizException
*/
Map
<
String
,
Object
>
exportAdvertisingDetail4Book
(
Long
bookId
,
Long
channelId
,
Long
adviserId
,
String
statisMonth
)
throws
BizException
;
/**
* 微信群广告位明细
* @param qrcodeId 微信群ID
* @param statisMonth 统计月份
* @param pageParam 分页参数
* @return
* @throws BizException
*/
PageBean
advertisingDetail4WechatGroup
(
Long
qrcodeId
,
String
statisMonth
,
PageParam
pageParam
)
throws
BizException
;
/**
* 导出微信群广告位明细
* @param qrcodeId 微信群ID
* @param statisMonth 统计月份
* @return
* @throws BizException
*/
Map
<
String
,
Object
>
exportAdvertisingDetail4WechatGroup
(
Long
qrcodeId
,
String
statisMonth
)
throws
BizException
;
/**
* 微信群广告位点击读者列表
* @param qrcodeId 微信群ID
* @param adId 广告位ID
* @param statisMonth 统计月份
* @param pageParam 分页参数
* @return
* @throws BizException
*/
PageBean
clickUserList4AdvertisingWechatGroup
(
Long
qrcodeId
,
Long
adId
,
String
statisMonth
,
PageParam
pageParam
)
throws
BizException
;
/**
* 导出微信群广告位点击读者列表
* @param qrcodeId 微信群ID
* @param adId 广告位ID
* @param statisMonth 统计月份
* @return
* @throws BizException
*/
Map
<
String
,
Object
>
exportClickUserList4AdvertisingWechatGroup
(
Long
qrcodeId
,
Long
adId
,
String
statisMonth
)
throws
BizException
;
/**
* 广告主广告位明细
* @param qrcodeId 微信群ID
* @param statisMonth 统计月份
* @param pageParam 分页参数
* @return
* @throws BizException
*/
PageBean
advertisingDetail4Master
(
Long
masterId
,
String
statisMonth
,
PageParam
pageParam
)
throws
BizException
;
/**
* 导出广告主广告位明细
* @param masterId 广告主ID
* @param statisMonth 统计月份
* @return
* @throws BizException
*/
Map
<
String
,
Object
>
exportAdvertisingDetail4Master
(
Long
masterId
,
String
statisMonth
)
throws
BizException
;
/**
* 客户端获取书刊配置的广告位信息
* @param sceneId 二维码ID
* @param adviserId 编辑ID
* @param channelId 运营ID
* @param sceneId 二维码ID
* @param adviserId 编辑ID
* @param channelId 运营ID
* @param adPositionDetail 广告具体位置
* @return
* @throws BizException
*/
List
<
AdvertisingSpaceDTO
>
get4Wechat
(
Long
sceneId
,
Long
adviserId
,
Long
channelId
,
String
adPositionDetail
)
throws
BizException
;
/**
* 获取社群书配置的广告位信息
* @param bookGroupId 社群码ID
* @param adPositionDetail 广告具体位置
* @return
* @throws BizException
*/
AdvertisingSpaceDTO
get
4Wechat
(
Long
sceneId
,
Long
adviserId
,
Long
channelId
)
throws
BizException
;
AdvertisingSpaceDTO
get
BookGroupAd4Wechat
(
Long
bookGroupId
,
String
adPositionDetail
)
throws
BizException
;
/**
* 曝光量埋点
...
...
@@ -168,4 +289,83 @@ public interface AdvertisingSpaceBiz {
* @throws BizException
*/
void
addClickTrack
(
AdvertisingClickRecord
advertisingClickRecord
)
throws
BizException
;
/**
* 添加广告主
* @param advertisingMaster 广告主实体
* @throws BizException
*/
void
createMaster
(
AdvertisingMaster
advertisingMaster
)
throws
BizException
;
/**
* 修改广告主
* @param advertisingMaster 广告主实体
* @throws BizException
*/
void
updateMaster
(
AdvertisingMaster
advertisingMaster
)
throws
BizException
;
/**
* 获取广告主列表
* @param pageParam 分页参数
* @param masterName 广告主名称
* @return
* @throws BizException
*/
PageBean
getMasterList
(
PageParam
pageParam
,
String
masterName
)
throws
BizException
;
/**
* 获取所有广告主
* @return
* @throws BizException
*/
List
<
AdvertisingMasterDTO
>
getAllMaster
()
throws
BizException
;
/**
* 获取广告主信息
* @param masterId 广告主ID
* @return
* @throws BizException
*/
AdvertisingMasterDTO
getMasterInfo
(
Long
masterId
)
throws
BizException
;
/**
* 每日凌晨计算昨日广告位收益
* @throws BizException
*/
void
calculateAdvertisingIncomeYesterday
()
throws
BizException
;
/**
* 获取概览数据
* @return
* @throws BizException
*/
Map
<
String
,
Object
>
overviewStatis
()
throws
BizException
;
/**
* 获取流量趋势
* @param day 天数
* @param startDate 开始时间
* @param endDate 结束时间
* @return
* @throws BizException
*/
List
<
Object
>
getFlowStatisTrend
(
Integer
day
,
String
startDate
,
String
endDate
)
throws
BizException
;
/**
* 获取收益趋势
* @param day 天数
* @param startDate 开始时间
* @param endDate 结束时间
* @return
* @throws BizException
*/
List
<
Object
>
getIncomeStatisTrend
(
Integer
day
,
String
startDate
,
String
endDate
)
throws
BizException
;
/**
* 获取微信群信息
* @param qrcodeId 微信群ID
* @return
* @throws BizException
*/
AdGroupQrcodeDTO
getGroupQrcodeInfo
(
Long
qrcodeId
)
throws
BizException
;
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
biz
.
impl
;
import
java.math.BigDecimal
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.app.dto.AppTypeDto
;
import
com.pcloud.appcenter.app.service.AppTypeService
;
import
com.pcloud.book.advertising.biz.AdvertisingSpaceBiz
;
import
com.pcloud.book.advertising.dao.AdvertisingAdviserPermissionDao
;
import
com.pcloud.book.advertising.dao.AdvertisingAgentPermissionDao
;
import
com.pcloud.book.advertising.dao.AdvertisingClickRecordDao
;
import
com.pcloud.book.advertising.dao.AdvertisingDistributionBookDao
;
import
com.pcloud.book.advertising.dao.AdvertisingExposureRecordDao
;
import
com.pcloud.book.advertising.dao.AdvertisingIncomeDailyDao
;
import
com.pcloud.book.advertising.dao.AdvertisingMasterDao
;
import
com.pcloud.book.advertising.dao.AdvertisingSettlementMethodDao
;
import
com.pcloud.book.advertising.dao.AdvertisingSpaceDao
;
import
com.pcloud.book.advertising.dto.AdvertisingMasterDTO
;
import
com.pcloud.book.advertising.dto.AdvertisingSettlementMethodDTO
;
import
com.pcloud.book.advertising.dto.AdvertisingSpaceDTO
;
import
com.pcloud.book.advertising.dto.
DistributionApp
DTO
;
import
com.pcloud.book.advertising.dto.
WechatGroupClickUser
DTO
;
import
com.pcloud.book.advertising.entity.AdvertisingAdviserPermission
;
import
com.pcloud.book.advertising.entity.AdvertisingAgentPermission
;
import
com.pcloud.book.advertising.entity.AdvertisingClickRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingDistributionBook
;
import
com.pcloud.book.advertising.entity.AdvertisingExposureRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingMaster
;
import
com.pcloud.book.advertising.entity.AdvertisingSettlementMethod
;
import
com.pcloud.book.advertising.entity.AdvertisingSpace
;
import
com.pcloud.book.advertising.entity.DistributionWechatGroup
;
import
com.pcloud.book.advertising.enums.AdPositionDetailEnum
;
import
com.pcloud.book.advertising.enums.AdPositionEnum
;
import
com.pcloud.book.advertising.enums.Ad
Sourc
eEnum
;
import
com.pcloud.book.advertising.enums.
DistributionType
Enum
;
import
com.pcloud.book.advertising.enums.Ad
PositionMod
eEnum
;
import
com.pcloud.book.advertising.enums.
SettlementMethod
Enum
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.biz.BookBiz
;
import
com.pcloud.book.book.dao.BookDao
;
...
...
@@ -37,20 +52,40 @@ import com.pcloud.book.book.dto.BookDto;
import
com.pcloud.book.book.entity.BookAdviser
;
import
com.pcloud.book.book.set.BookSet
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.common.ExportConsr
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.consumer.user.AdviserConsr
;
import
com.pcloud.book.consumer.user.AgentConsr
;
import
com.pcloud.book.consumer.user.ChannelConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.dao.BookGroupClassifyDao
;
import
com.pcloud.book.group.dao.BookGroupDao
;
import
com.pcloud.book.group.dao.GroupQrcodeDao
;
import
com.pcloud.book.group.dto.AdGroupQrcodeDTO
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.ClassifyDTO
;
import
com.pcloud.book.group.dto.GroupQrcodeInfoDTO
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.book.group.entity.GroupQrcode
;
import
com.pcloud.book.util.common.CommonUtils
;
import
com.pcloud.channelcenter.qrcode.service.QrcodeSceneService
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBean
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.DateNewUtils
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.common.utils.httpclient.UrlUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.resourcecenter.product.dto.Product4BookDTO
;
import
com.pcloud.readercenter.wechat.entity.WechatUser
;
import
com.pcloud.resourcecenter.product.service.ProductService
;
import
com.sdk.wxgroup.SendArticleMessageVO
;
import
com.sdk.wxgroup.SendPicMessageVO
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.WxGroupSDK
;
/**
* Description 广告位业务逻辑层接口实现类
...
...
@@ -60,6 +95,9 @@ import com.pcloud.resourcecenter.product.dto.Product4BookDTO;
@Component
(
"advertisingSpaceBiz"
)
public
class
AdvertisingSpaceBizImpl
implements
AdvertisingSpaceBiz
{
@Value
(
"${wechat.group.link.prefix}"
)
private
String
wechatGroupLinkPrefix
;
@Autowired
private
AdvertisingSpaceDao
advertisingSpaceDao
;
@Autowired
...
...
@@ -88,6 +126,30 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
private
ProductConsr
productConsr
;
@Autowired
private
AppConsr
appConsr
;
@Autowired
private
AdvertisingMasterDao
advertisingMasterDao
;
@Autowired
private
AdvertisingSettlementMethodDao
advertisingSettlementMethodDao
;
@Autowired
private
AdvertisingIncomeDailyDao
advertisingIncomeDailyDao
;
@Autowired
private
BookGroupClassifyDao
bookGroupClassifyDao
;
@Autowired
private
GroupQrcodeDao
groupQrcodeDao
;
@Autowired
private
AgentConsr
agentConsr
;
@Autowired
private
WechatGroupConsr
wechatGroupConsr
;
@Autowired
private
ExportConsr
exportConsr
;
@Autowired
private
ProductService
productService
;
@Autowired
private
AppTypeService
appTypeService
;
@Autowired
private
BookGroupDao
bookGroupDao
;
@Autowired
private
ReaderConsr
readerConsr
;
/**
* 创建广告位
...
...
@@ -96,20 +158,49 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
"创建广告位"
)
public
Long
create
(
AdvertisingSpace
advertisingSpace
)
throws
BizException
{
if
(
null
==
advertisingSpace
.
getAdName
()
||
null
==
advertisingSpace
.
getAdPosition
()
||
null
==
advertisingSpace
.
getAdSource
()
||
null
==
advertisingSpace
.
getAdLink
())
{
// 校验参数
checkParamBeforeCreate
(
advertisingSpace
);
String
settlementMethod
=
advertisingSpace
.
getSettlementMethod
();
advertisingSpace
.
setIsOpen
(
true
);
advertisingSpaceDao
.
insert
(
advertisingSpace
);
Long
adId
=
advertisingSpace
.
getId
();
AdvertisingSettlementMethod
method
=
new
AdvertisingSettlementMethod
();
method
.
setMasterId
(
advertisingSpace
.
getMasterId
());
method
.
setAdId
(
adId
);
method
.
setSettlementMethod
(
settlementMethod
);
method
.
setPriceEachTime
(
advertisingSpace
.
getPriceEachTime
());
advertisingSettlementMethodDao
.
insert
(
method
);
return
adId
;
}
/**
* 新增前校验参数
*/
private
void
checkParamBeforeCreate
(
AdvertisingSpace
advertisingSpace
)
{
String
adPosition
=
advertisingSpace
.
getAdPosition
();
if
(
null
==
advertisingSpace
.
getAdName
()
||
null
==
adPosition
||
null
==
advertisingSpace
.
getAdPositionMode
()
||
null
==
advertisingSpace
.
getMasterId
()
||
null
==
advertisingSpace
.
getSettlementMethod
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
if
(!
AdPositionEnum
.
checkCodeExist
(
advertisingSpace
.
getAdPosition
()))
{
if
(!
AdPositionEnum
.
checkCodeExist
(
adPosition
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告位置选择有误!"
);
}
if
(!
AdPositionModeEnum
.
checkCodeExist
(
adPosition
,
advertisingSpace
.
getAdPositionMode
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告位置选择有误!"
);
}
if
(!
ArrayUtils
.
contains
(
AdSourceEnum
.
AD_SOURCE_GATHER
,
advertisingSpace
.
getAdSource
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告来源选择有误!"
);
if
(
AdPositionEnum
.
BOOK_GROUP_PAGE
.
equals
(
adPosition
)
&&
!
AdPositionDetailEnum
.
checkCodeExist
(
adPosition
,
advertisingSpace
.
getAdPositionDetail
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告位置选择有误!"
);
}
String
settlementMethod
=
advertisingSpace
.
getSettlementMethod
();
if
(
AdPositionEnum
.
WECHAT_GROUP_MSG
.
equals
(
adPosition
)
&&
!
SettlementMethodEnum
.
CPM
.
code
.
equals
(
settlementMethod
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"微信群消息仅支持按曝光量结算!"
);
}
if
(
ArrayUtils
.
contains
(
SettlementMethodEnum
.
SETTLEMENT_METHOD_NEED_PRICE_GATHER
,
settlementMethod
)
&&
null
==
advertisingSpace
.
getPriceEachTime
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"按点击量结算和按曝光量结算时每次价格不能为空!"
);
}
advertisingSpace
.
setDistributionType
(
DistributionTypeEnum
.
SIGN_BOOK
.
value
);
advertisingSpace
.
setIsOpen
(
true
);
advertisingSpaceDao
.
insert
(
advertisingSpace
);
return
advertisingSpace
.
getId
();
}
/**
...
...
@@ -119,21 +210,35 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
value
=
"修改广告位"
,
isAfterReturn
=
false
)
public
void
update
(
AdvertisingSpace
advertisingSpace
)
throws
BizException
{
if
(
null
==
advertisingSpace
.
getId
()
||
null
==
advertisingSpace
.
getAdName
()
||
null
==
advertisingSpace
.
getAdPosition
()
||
null
==
advertisingSpace
.
getAdSource
()
||
null
==
advertisingSpace
.
getAdLink
())
{
// 校验参数
checkParamBeforeCreate
(
advertisingSpace
);
if
(
null
==
advertisingSpace
.
getId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
if
(!
AdPositionEnum
.
checkCodeExist
(
advertisingSpace
.
getAdPosition
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告位置选择有误!"
);
}
if
(!
ArrayUtils
.
contains
(
AdSourceEnum
.
AD_SOURCE_GATHER
,
advertisingSpace
.
getAdSource
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告来源选择有误!"
);
}
AdvertisingSpace
space
=
advertisingSpaceDao
.
getById
(
advertisingSpace
.
getId
());
if
(
null
==
space
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告位不存在或已删除!"
);
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"adId"
,
advertisingSpace
.
getId
());
Integer
bookNum
=
(
Integer
)
advertisingDistributionBookDao
.
getBy
(
paramMap
,
"countByAdId"
);
// 已投放
if
(
null
!=
bookNum
&&
bookNum
>
0
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"已投放书刊的广告位不能修改!"
);
}
advertisingSpaceDao
.
update
(
advertisingSpace
);
// 修改结算方式
AdvertisingSettlementMethodDTO
methodDTO
=
advertisingSettlementMethodDao
.
getByMasterIdAndAdId
(
space
.
getMasterId
(),
space
.
getId
());
AdvertisingSettlementMethod
method
=
new
AdvertisingSettlementMethod
();
method
.
setMasterId
(
advertisingSpace
.
getMasterId
());
method
.
setSettlementMethod
(
advertisingSpace
.
getSettlementMethod
());
method
.
setPriceEachTime
(
advertisingSpace
.
getPriceEachTime
());
if
(
null
==
methodDTO
||
null
==
methodDTO
.
getId
())
{
advertisingSettlementMethodDao
.
insert
(
method
);
}
else
{
method
.
setId
(
methodDTO
.
getId
());
advertisingSettlementMethodDao
.
update
(
method
);
}
}
/**
...
...
@@ -158,89 +263,237 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
/**
*
删除广告位
*
获取广告位信息
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
value
=
"删除广告位"
,
isAfterReturn
=
false
)
public
void
delete
(
AdvertisingSpace
advertisingSpace
)
throws
BizException
{
if
(
null
==
advertisingSpace
.
getId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
AdvertisingSpace
space
=
advertisingSpaceDao
.
getById
(
advertisingSpace
.
getId
());
if
(
null
==
space
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告位不存在或已删除!"
);
}
if
(
DistributionTypeEnum
.
NO_SIGN_BOOK
.
value
.
equals
(
space
.
getDistributionType
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告位不能删除!"
);
}
else
{
@ParamLog
(
value
=
"获取广告位信息"
)
public
AdvertisingSpaceDTO
get
(
Long
adId
)
throws
BizException
{
AdvertisingSpaceDTO
spaceDTO
=
advertisingSpaceDao
.
getDTOById
(
adId
);
if
(
null
!=
spaceDTO
)
{
AdvertisingMaster
master
=
advertisingMasterDao
.
getById
(
spaceDTO
.
getMasterId
());
if
(
null
!=
master
)
{
spaceDTO
.
setMasterName
(
master
.
getMasterName
());
}
AdvertisingSettlementMethodDTO
methodDTO
=
advertisingSettlementMethodDao
.
getByMasterIdAndAdId
(
spaceDTO
.
getMasterId
(),
spaceDTO
.
getId
());
if
(
null
!=
methodDTO
)
{
spaceDTO
.
setSettlementMethod
(
methodDTO
.
getSettlementMethod
());
spaceDTO
.
setSettlementMethodName
(
SettlementMethodEnum
.
getNameByCode
(
methodDTO
.
getSettlementMethod
()));
spaceDTO
.
setPriceEachTime
(
methodDTO
.
getPriceEachTime
());
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"adId"
,
advertisingSpace
.
getId
());
Boolean
hasBook
=
(
Boolean
)
advertisingDistributionBookDao
.
getBy
(
paramMap
,
"checkAdSpaceHasBook"
);
if
(
null
!=
hasBook
&&
hasBook
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告位不能删除!"
);
paramMap
.
put
(
"adId"
,
adId
);
Integer
bookNum
=
(
Integer
)
advertisingDistributionBookDao
.
getBy
(
paramMap
,
"countByAdId"
);
spaceDTO
.
setBookNum
(
bookNum
);
// 填充广告位置名称
if
(
AdPositionEnum
.
WECHAT_GROUP_MSG
.
positionCode
.
equals
(
spaceDTO
.
getAdPosition
()))
{
fillAdpositionName4WechatGroupAd
(
spaceDTO
);
}
else
{
fillAdpositionName4CommonAd
(
spaceDTO
);
}
}
advertisingSpaceDao
.
deleteById
(
advertisingSpace
.
getId
())
;
return
spaceDTO
;
}
/**
*
获取广告位信息
*
投放书刊
*/
@Override
@ParamLog
(
value
=
"获取广告位信息"
)
public
AdvertisingSpaceDTO
get
(
Long
adId
)
throws
BizException
{
return
advertisingSpaceDao
.
getDTOById
(
adId
);
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
value
=
"投放书刊"
,
isAfterReturn
=
false
)
public
void
distributeBook
(
AdvertisingDistributionBook
book
)
throws
BizException
{
if
(
null
==
book
.
getAdId
()
||
ListUtils
.
isEmpty
(
book
.
getBooks
())
||
null
==
book
.
getIsBookGroup
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
AdvertisingSpace
advertisingSpace
=
advertisingSpaceDao
.
getById
(
book
.
getAdId
());
if
(
null
==
advertisingSpace
||
!
advertisingSpace
.
getIsOpen
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告位不存在或已关闭!"
);
}
AdvertisingSpace
space
=
new
AdvertisingSpace
();
space
.
setId
(
book
.
getAdId
());
advertisingSpaceDao
.
update
(
space
);
boolean
paramError
=
book
.
getBooks
().
stream
().
anyMatch
(
bookAdviser
->
null
==
bookAdviser
.
getBookId
()
||
null
==
bookAdviser
.
getChannelId
()
||
null
==
bookAdviser
.
getAdviserId
());
if
(
paramError
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
// 校验书刊是否已投广告位
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
if
(
book
.
getIsBookGroup
())
{
// 社群书
for
(
BookAdviser
bookAdviser
:
book
.
getBooks
())
{
paramMap
.
put
(
"adPositionDetail"
,
advertisingSpace
.
getAdPositionDetail
());
paramMap
.
put
(
"bookId"
,
bookAdviser
.
getBookId
());
paramMap
.
put
(
"channelId"
,
bookAdviser
.
getChannelId
());
Integer
existCount
=
(
Integer
)
advertisingDistributionBookDao
.
getBy
(
paramMap
,
"checkBookGroupAdExist"
);
if
(
null
!=
existCount
&&
existCount
>
0
)
{
BookDto
bookDto
=
bookBiz
.
getBaseById
(
bookAdviser
.
getBookId
());
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
StringUtil
.
addBracket
(
bookDto
.
getBookName
())
+
"等社群书"
+
AdPositionDetailEnum
.
getNameByCode
(
advertisingSpace
.
getAdPositionDetail
())
+
"已投放广告位!"
);
}
}
}
else
{
// 非社群书
paramMap
.
put
(
"adPositionDetail"
,
advertisingSpace
.
getAdPositionDetail
());
paramMap
.
put
(
"adPositionMode"
,
advertisingSpace
.
getAdPositionMode
());
for
(
BookAdviser
bookAdviser
:
book
.
getBooks
())
{
paramMap
.
put
(
"bookId"
,
bookAdviser
.
getBookId
());
paramMap
.
put
(
"channelId"
,
bookAdviser
.
getChannelId
());
Integer
existCount
=
(
Integer
)
advertisingDistributionBookDao
.
getBy
(
paramMap
,
"checkBookAdExist"
);
if
(
null
!=
existCount
&&
existCount
>
0
)
{
BookDto
bookDto
=
bookBiz
.
getBaseById
(
bookAdviser
.
getBookId
());
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
StringUtil
.
addBracket
(
bookDto
.
getBookName
())
+
"等书已投放该广告位!"
);
}
}
}
List
<
AdvertisingDistributionBook
>
list
=
new
ArrayList
<>();
for
(
BookAdviser
bookAdviser
:
book
.
getBooks
())
{
AdvertisingDistributionBook
distributionBook
=
new
AdvertisingDistributionBook
();
distributionBook
.
setAdId
(
book
.
getAdId
());
distributionBook
.
setBookId
(
bookAdviser
.
getBookId
());
distributionBook
.
setChannelId
(
bookAdviser
.
getChannelId
());
distributionBook
.
setAdviserId
(
bookAdviser
.
getAdviserId
());
Long
agentId
=
adviserConsr
.
getAgentIdByAdviser
(
bookAdviser
.
getAdviserId
());
distributionBook
.
setAgentId
(
agentId
);
distributionBook
.
setIsBookGroup
(
book
.
getIsBookGroup
());
list
.
add
(
distributionBook
);
}
advertisingDistributionBookDao
.
batchInsert
(
list
);
}
/**
* 投放
书刊
* 投放
微信群
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
value
=
"投放书刊"
,
isAfterReturn
=
false
)
public
void
distributeBook
(
AdvertisingDistributionBook
book
)
throws
BizException
{
if
(
null
==
book
.
getAdId
()
||
null
==
book
.
getDistributionType
()
||
!
ArrayUtils
.
contains
(
DistributionTypeEnum
.
DISTRIBUTION_TYPE_GATHER
,
book
.
getDistributionType
())
||
(
DistributionTypeEnum
.
SIGN_BOOK
.
value
.
equals
(
book
.
getDistributionType
())
&&
(
ListUtils
.
isEmpty
(
book
.
getBooks
())
||
null
==
book
.
getAdviserId
())))
{
@ParamLog
(
value
=
"投放微信群"
,
isAfterReturn
=
false
)
public
void
distributeWechatGroup
(
AdvertisingDistributionBook
book
)
throws
BizException
{
if
(
null
==
book
.
getAdId
()
||
ListUtils
.
isEmpty
(
book
.
getGroups
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
if
(
DistributionTypeEnum
.
NO_SIGN_BOOK
.
value
.
equals
(
book
.
getDistributionType
()))
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"adId"
,
book
.
getAdId
());
AdvertisingSpaceDTO
spaceDTO
=
(
AdvertisingSpaceDTO
)
advertisingSpaceDao
.
getBy
(
paramMap
,
"getNoSignBookAd"
);
if
(
null
!=
spaceDTO
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"只能创建一个不指定书刊的广告位!"
);
}
AdvertisingSpace
advertisingSpace
=
advertisingSpaceDao
.
getById
(
book
.
getAdId
());
if
(
null
==
advertisingSpace
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告位不存在!"
);
}
if
(!
AdPositionEnum
.
WECHAT_GROUP_MSG
.
positionCode
.
equals
(
advertisingSpace
.
getAdPosition
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"该广告位不能投放到微信群!"
);
}
AdvertisingSpace
space
=
new
AdvertisingSpace
();
space
.
setId
(
book
.
getAdId
());
space
.
setDistributionType
(
book
.
getDistributionType
());
advertisingSpaceDao
.
update
(
space
);
if
(
DistributionTypeEnum
.
SIGN_BOOK
.
value
.
equals
(
book
.
getDistributionType
()))
{
boolean
paramError
=
book
.
getBooks
().
stream
().
anyMatch
(
bookAdviser
->
null
==
bookAdviser
.
getBookId
()
||
null
==
bookAdviser
.
getChannelId
());
if
(
paramError
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
List
<
Long
>
bookIds
=
book
.
getBooks
().
stream
().
map
(
BookAdviser:
:
getBookId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
existIds
=
advertisingDistributionBookDao
.
checkBookIdExist
(
bookIds
);
if
(!
ListUtils
.
isEmpty
(
existIds
))
{
Long
bookId
=
existIds
.
get
(
0
);
BookDto
bookDto
=
bookBiz
.
getBaseById
(
bookId
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
StringUtil
.
addBracket
(
bookDto
.
getBookName
())
+
"等"
+
existIds
.
size
()
+
"本书已投放广告位!"
);
boolean
paramError
=
book
.
getGroups
().
stream
().
anyMatch
(
group
->
null
==
group
.
getBookId
()
||
null
==
group
.
getChannelId
()
||
null
==
group
.
getAdviserId
()
||
null
==
group
.
getClassifyId
()
||
null
==
group
.
getQrcodeId
());
if
(
paramError
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
// 校验广告位是否已投放微信群
List
<
Long
>
qrcodeIds
=
book
.
getGroups
().
stream
().
map
(
DistributionWechatGroup:
:
getQrcodeId
).
collect
(
Collectors
.
toList
());
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"adId"
,
book
.
getAdId
());
paramMap
.
put
(
"qrcodeIds"
,
qrcodeIds
);
List
<
Long
>
existIds
=
advertisingDistributionBookDao
.
checkQrcodeIdExist
(
paramMap
);
if
(!
ListUtils
.
isEmpty
(
existIds
))
{
Long
qrcodeId
=
existIds
.
get
(
0
);
GroupQrcode
groupQrcode
=
groupQrcodeDao
.
getById
(
qrcodeId
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
StringUtil
.
addBracket
(
groupQrcode
.
getGroupName
())
+
"等"
+
existIds
.
size
()
+
"个微信群已投放该广告位!"
);
}
List
<
AdvertisingDistributionBook
>
list
=
new
ArrayList
<>();
Map
<
Long
,
Long
>
agentIdMap
=
new
HashMap
<>();
for
(
DistributionWechatGroup
group
:
book
.
getGroups
())
{
AdvertisingDistributionBook
distributionBook
=
new
AdvertisingDistributionBook
();
distributionBook
.
setAdId
(
book
.
getAdId
());
distributionBook
.
setBookId
(
group
.
getBookId
());
distributionBook
.
setChannelId
(
group
.
getChannelId
());
distributionBook
.
setAdviserId
(
group
.
getAdviserId
());
distributionBook
.
setClassifyId
(
group
.
getClassifyId
());
distributionBook
.
setQrcodeId
(
group
.
getQrcodeId
());
Long
agentId
;
if
(!
agentIdMap
.
containsKey
(
group
.
getAdviserId
()))
{
agentId
=
adviserConsr
.
getAgentIdByAdviser
(
group
.
getAdviserId
());
agentIdMap
.
put
(
group
.
getAdviserId
(),
agentId
);
}
else
{
agentId
=
agentIdMap
.
get
(
group
.
getAdviserId
());
}
List
<
AdvertisingDistributionBook
>
list
=
new
ArrayList
<>();
Long
agentId
=
adviserConsr
.
getAgentIdByAdviser
(
book
.
getAdviserId
());
for
(
BookAdviser
bookAdviser
:
book
.
getBooks
())
{
AdvertisingDistributionBook
distributionBook
=
new
AdvertisingDistributionBook
();
distributionBook
.
setAdId
(
book
.
getAdId
());
distributionBook
.
setBookId
(
bookAdviser
.
getBookId
());
distributionBook
.
setChannelId
(
bookAdviser
.
getChannelId
());
distributionBook
.
setAdviserId
(
book
.
getAdviserId
());
distributionBook
.
setAgentId
(
agentId
);
list
.
add
(
distributionBook
);
distributionBook
.
setAgentId
(
agentId
);
distributionBook
.
setIsBookGroup
(
true
);
list
.
add
(
distributionBook
);
}
advertisingDistributionBookDao
.
batchInsert
(
list
);
for
(
DistributionWechatGroup
group
:
book
.
getGroups
())
{
// 获取群信息
GroupQrcode
groupQrcode
=
groupQrcodeDao
.
getById
(
group
.
getQrcodeId
());
String
groupId
=
groupQrcode
.
getWeixinGroupId
();
ClassifyDTO
classifyDTO
=
bookGroupClassifyDao
.
getById
(
group
.
getClassifyId
());
// 获取机器人微信号
String
altId
=
wechatGroupConsr
.
getRobotIdByGroupId
(
groupId
);
if
(
AdPositionModeEnum
.
TEXT_AND_LINK
.
modeCode
.
equals
(
advertisingSpace
.
getAdPositionMode
()))
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setGroupId
(
groupId
);
sendTextMessageVO
.
setAltId
(
altId
);
String
adLink
=
""
;
if
(!
StringUtil
.
isEmpty
(
advertisingSpace
.
getAdLink
()))
{
if
(
advertisingSpace
.
getAdLink
().
contains
(
"?"
))
{
adLink
=
advertisingSpace
.
getAdLink
()
+
"&book_group_id="
+
classifyDTO
.
getBookGroupId
()
+
"&classify_id="
+
group
.
getClassifyId
()
+
"&qrcode_id="
+
group
.
getQrcodeId
()
+
"&ad_id="
+
advertisingSpace
.
getId
();
}
else
{
adLink
=
advertisingSpace
.
getAdLink
()
+
"?book_group_id="
+
classifyDTO
.
getBookGroupId
()
+
"&classify_id="
+
group
.
getClassifyId
()
+
"&qrcode_id="
+
group
.
getQrcodeId
()
+
"&ad_id="
+
advertisingSpace
.
getId
();
}
adLink
=
UrlUtils
.
getShortUrl4Own
(
wechatGroupLinkPrefix
+
"/link?url="
+
URLEncoder
.
encode
(
adLink
));
}
sendTextMessageVO
.
setContent
(
advertisingSpace
.
getAdTitle
()
+
"\n"
+
adLink
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
else
if
(
AdPositionModeEnum
.
NEWS_SHARE
.
modeCode
.
equals
(
advertisingSpace
.
getAdPositionMode
()))
{
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setAltId
(
altId
);
sendArticleMessageVO
.
setTitle
(
advertisingSpace
.
getAdTitle
());
sendArticleMessageVO
.
setDescription
(
advertisingSpace
.
getAdSlogan
());
sendArticleMessageVO
.
setGroupId
(
groupId
);
String
adLink
=
""
;
if
(!
StringUtil
.
isEmpty
(
advertisingSpace
.
getAdLink
()))
{
if
(
advertisingSpace
.
getAdLink
().
contains
(
"?"
))
{
adLink
=
advertisingSpace
.
getAdLink
()
+
"&book_group_id="
+
classifyDTO
.
getBookGroupId
()
+
"&classify_id="
+
group
.
getClassifyId
()
+
"&qrcode_id="
+
group
.
getQrcodeId
()
+
"&ad_id="
+
advertisingSpace
.
getId
();
}
else
{
adLink
=
advertisingSpace
.
getAdLink
()
+
"?book_group_id="
+
classifyDTO
.
getBookGroupId
()
+
"&classify_id="
+
group
.
getClassifyId
()
+
"&qrcode_id="
+
group
.
getQrcodeId
()
+
"&ad_id="
+
advertisingSpace
.
getId
();
}
}
sendArticleMessageVO
.
setLinkUrl
(
adLink
);
sendArticleMessageVO
.
setPicUrl
(
advertisingSpace
.
getAdPic
());
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
}
else
if
(
AdPositionModeEnum
.
JUST_PIC
.
modeCode
.
equals
(
advertisingSpace
.
getAdPositionMode
()))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setAltId
(
altId
);
sendPicMessageVO
.
setGroupId
(
groupId
);
sendPicMessageVO
.
setPicUrl
(
advertisingSpace
.
getAdPic
());
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
}
}
// 根据微信群人数埋点
Map
<
Long
,
GroupQrcodeInfoDTO
>
map
=
groupQrcodeDao
.
listQrcodeInfoByIds
(
qrcodeIds
);
if
(!
MapUtils
.
isEmpty
(
map
))
{
List
<
AdvertisingExposureRecord
>
recordList
=
new
ArrayList
<>();
for
(
DistributionWechatGroup
group
:
book
.
getGroups
())
{
Long
qrcodeId
=
group
.
getQrcodeId
();
if
(
map
.
containsKey
(
qrcodeId
))
{
GroupQrcodeInfoDTO
dto
=
map
.
get
(
qrcodeId
);
Integer
userNumber
=
dto
.
getUserNumber
();
AdvertisingExposureRecord
record
=
new
AdvertisingExposureRecord
();
record
.
setAdId
(
book
.
getAdId
());
record
.
setBookId
(
group
.
getBookId
());
record
.
setIsBookGroup
(
true
);
record
.
setAdviserId
(
group
.
getAdviserId
());
record
.
setAgentId
(
agentIdMap
.
get
(
group
.
getAdviserId
()));
record
.
setChannelId
(
group
.
getChannelId
());
record
.
setFromType
(
"WECHAT_GROUP"
);
record
.
setFromId
(
qrcodeId
);
record
.
setCount
(
userNumber
.
longValue
());
recordList
.
add
(
record
);
}
}
if
(!
ListUtils
.
isEmpty
(
recordList
))
{
advertisingExposureRecordDao
.
insert
(
recordList
);
}
advertisingDistributionBookDao
.
batchInsert
(
list
);
}
}
...
...
@@ -336,8 +589,6 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
*/
@Override
public
PageBean
listBook4Platform
(
Map
<
String
,
Object
>
paramMap
,
PageParam
pageParam
,
Long
adviserId
)
throws
BizException
{
Long
agentId
=
adviserConsr
.
getAgentIdByAdviser
(
adviserId
);
paramMap
.
put
(
"agentId"
,
agentId
);
PageBean
pageBean
=
bookDao
.
listPage
(
pageParam
,
paramMap
,
"listBook4Platform"
);
if
(
pageBean
==
null
||
ListUtils
.
isEmpty
(
pageBean
.
getRecordList
()))
{
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
...
...
@@ -346,6 +597,18 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
/**
* 平台端获取社群书微信群列表
*/
@Override
public
PageBean
listGroupQrcode4Platform
(
Map
<
String
,
Object
>
paramMap
,
PageParam
pageParam
)
throws
BizException
{
PageBean
pageBean
=
bookGroupClassifyDao
.
listPage
(
pageParam
,
paramMap
,
"listGroupQrcode4Platform"
);
if
(
pageBean
==
null
||
ListUtils
.
isEmpty
(
pageBean
.
getRecordList
()))
{
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
}
return
pageBean
;
}
/**
* 获取广告位投放书刊列表
*/
@Override
...
...
@@ -357,12 +620,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"adId"
,
adId
);
paramMap
.
put
(
"name"
,
StringUtil
.
isEmpty
(
name
)
?
null
:
name
);
PageBean
pageBean
;
if
(
DistributionTypeEnum
.
SIGN_BOOK
.
value
.
equals
(
space
.
getDistributionType
()))
{
pageBean
=
bookDao
.
listPage
(
pageParam
,
paramMap
,
"listBook4AdvertisingSpace"
);
}
else
{
pageBean
=
bookDao
.
listPage
(
pageParam
,
paramMap
,
"listBook4AdvertisingSpaceNoSignBook"
);
}
PageBean
pageBean
=
bookDao
.
listPage
(
pageParam
,
paramMap
,
"listBook4AdvertisingSpace"
);
if
(
pageBean
==
null
||
ListUtils
.
isEmpty
(
pageBean
.
getRecordList
()))
{
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
}
...
...
@@ -370,114 +628,234 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
bookSet
.
setAdviserName4BookDto
(
pageBean
.
getRecordList
());
// 设置出版名称
bookSet
.
setAgentName4BookDto
(
pageBean
.
getRecordList
());
// 填充渠道公众号信息
bookSet
.
setChannelOfficialAccountInfoList
(
pageBean
.
getRecordList
());
for
(
Object
object
:
pageBean
.
getRecordList
())
{
BookDto
bookDto
=
(
BookDto
)
object
;
if
(!
DistributionTypeEnum
.
SIGN_BOOK
.
value
.
equals
(
space
.
getDistributionType
()))
{
bookDto
.
setDistributionTime
(
space
.
getCreateTime
());
}
// 曝光量
Long
exposureNum
=
getExposureNumBy
BookId
(
adId
,
bookDto
.
getBookId
(),
bookDto
.
getAdviserId
(),
bookDto
.
getChannelId
()
);
Long
exposureNum
=
getExposureNumBy
AdId
(
adId
,
bookDto
.
getBookId
(),
bookDto
.
getAdviserId
(),
bookDto
.
getChannelId
(),
null
);
bookDto
.
setExposureNum
(
exposureNum
);
// 点击量
Long
clickNum
=
getClickNumBy
BookId
(
adId
,
bookDto
.
getBookId
(),
bookDto
.
getAdviserId
(),
bookDto
.
getChannelId
()
);
Long
clickNum
=
getClickNumBy
AdId
(
adId
,
bookDto
.
getBookId
(),
bookDto
.
getAdviserId
(),
bookDto
.
getChannelId
(),
null
);
bookDto
.
setClickNum
(
clickNum
);
BigDecimal
clickRate
=
(
null
==
bookDto
.
getExposureNum
()
||
bookDto
.
getExposureNum
().
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
bookDto
.
getClickNum
().
doubleValue
()
/
bookDto
.
getExposureNum
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
bookDto
.
setClickRate
(
clickRate
);
BigDecimal
income
=
getIncomeByAdId
(
adId
,
bookDto
.
getBookId
(),
bookDto
.
getChannelId
(),
null
);
bookDto
.
setTotalIncome
(
income
);
}
return
pageBean
;
}
/**
* 获取广告位投放
作品/应用数据统计
* 获取广告位投放
微信群列表
*/
@Override
public
PageBean
distribution
AppStatics
(
Long
adId
,
PageParam
pageParam
)
throws
BizException
{
public
PageBean
distribution
WechatGroupList
(
Long
adId
,
String
name
,
PageParam
pageParam
)
throws
BizException
{
AdvertisingSpace
space
=
advertisingSpaceDao
.
getById
(
adId
);
if
(
null
==
space
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告位不存在或已删除!"
);
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"adId"
,
adId
);
PageBean
pageBean
=
advertisingExposureRecordDao
.
listPage
(
pageParam
,
paramMap
,
"distributionAppStatics"
);
paramMap
.
put
(
"name"
,
StringUtil
.
isEmpty
(
name
)
?
null
:
name
);
PageBean
pageBean
=
advertisingDistributionBookDao
.
listPage
(
pageParam
,
paramMap
,
"distributionWechatGroupList"
);
if
(
pageBean
==
null
||
ListUtils
.
isEmpty
(
pageBean
.
getRecordList
()))
{
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
}
List
<
Long
>
productIds
=
new
ArrayList
<>();
List
<
Long
>
appIds
=
new
ArrayList
<>();
List
<
Long
>
adviserIds
=
new
ArrayList
<>();
List
<
Long
>
agentIds
=
new
ArrayList
<>();
pageBean
.
getRecordList
().
forEach
(
obj
->
{
adviserIds
.
add
(((
AdGroupQrcodeDTO
)
obj
).
getAdviserId
());
agentIds
.
add
(((
AdGroupQrcodeDTO
)
obj
).
getAgentId
());
});
Map
<
Long
,
String
>
adviserNameMap
=
adviserConsr
.
getNames
(
new
ArrayList
<>(
new
HashSet
<>(
adviserIds
)));
Map
<
Long
,
String
>
agentNameMap
=
agentConsr
.
getNames
(
new
ArrayList
<>(
new
HashSet
<>(
agentIds
)));
for
(
Object
object
:
pageBean
.
getRecordList
())
{
DistributionAppDTO
dto
=
(
DistributionAppDTO
)
object
;
if
(
"PRODUCT"
.
equals
(
dto
.
getFromType
()))
{
productIds
.
add
(
dto
.
getFromId
());
}
else
if
(
"APP"
.
equals
(
dto
.
getFromType
()))
{
appIds
.
add
(
dto
.
getFromId
());
AdGroupQrcodeDTO
qrcodeDTO
=
(
AdGroupQrcodeDTO
)
object
;
if
(!
MapUtils
.
isEmpty
(
adviserNameMap
)
&&
adviserNameMap
.
containsKey
(
qrcodeDTO
.
getAdviserId
()))
{
qrcodeDTO
.
setAdviserName
(
adviserNameMap
.
get
(
qrcodeDTO
.
getAdviserId
()));
}
if
(!
MapUtils
.
isEmpty
(
agentNameMap
)
&&
agentNameMap
.
containsKey
(
qrcodeDTO
.
getAgentId
()))
{
qrcodeDTO
.
setAgentName
(
agentNameMap
.
get
(
qrcodeDTO
.
getAgentId
()));
}
// 曝光量
Long
exposureNum
=
getExposureNumByGroupQrcodeId
(
qrcodeDTO
.
getGroupQrcodeId
(),
adId
,
null
);
qrcodeDTO
.
setExposureNum
(
exposureNum
);
// 点击量
Long
clickNum
=
getClickNumByGroupQrcodeId
(
qrcodeDTO
.
getGroupQrcodeId
(),
adId
,
null
);
qrcodeDTO
.
setClickNum
(
clickNum
);
BigDecimal
clickRate
=
(
null
==
qrcodeDTO
.
getExposureNum
()
||
qrcodeDTO
.
getExposureNum
().
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
qrcodeDTO
.
getClickNum
().
doubleValue
()
/
qrcodeDTO
.
getExposureNum
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
qrcodeDTO
.
setClickRate
(
clickRate
);
BigDecimal
income
=
getIncomeByGroupQrcodeId
(
qrcodeDTO
.
getGroupQrcodeId
(),
adId
,
null
);
qrcodeDTO
.
setTotalIncome
(
income
);
// 点击读者量
Long
clickUserNum
=
getClickUserNumByGroupQrcodeId
(
qrcodeDTO
.
getGroupQrcodeId
(),
adId
,
null
);
qrcodeDTO
.
setClickUserNum
(
clickUserNum
);
}
return
pageBean
;
}
/**
* 获取广告位投放书刊列表
*/
@Override
public
PageBean
advertisingBookList
(
String
name
,
PageParam
pageParam
)
throws
BizException
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"name"
,
StringUtil
.
isEmpty
(
name
)
?
null
:
name
);
PageBean
pageBean
=
bookDao
.
listPage
(
pageParam
,
paramMap
,
"advertisingBookList"
);
if
(
pageBean
==
null
||
ListUtils
.
isEmpty
(
pageBean
.
getRecordList
()))
{
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
}
Map
<
Long
,
Product4BookDTO
>
productMap
=
productConsr
.
getProBasesWithSceneByIds
(
productIds
);
Map
<
Long
,
AppDto
>
appMap
=
appConsr
.
getBaseByIds
(
appIds
);
// 设置编辑名称
bookSet
.
setAdviserName4BookDto
(
pageBean
.
getRecordList
());
// 设置出版名称
bookSet
.
setAgentName4BookDto
(
pageBean
.
getRecordList
());
for
(
Object
object
:
pageBean
.
getRecordList
())
{
DistributionAppDTO
dto
=
(
DistributionAppDTO
)
object
;
if
(
"PRODUCT"
.
equals
(
dto
.
getFromType
())
&&
!
MapUtils
.
isEmpty
(
productMap
)
&&
productMap
.
containsKey
(
dto
.
getFromId
()))
{
Product4BookDTO
product4BookDTO
=
productMap
.
get
(
dto
.
getFromId
());
dto
.
setTitle
(
product4BookDTO
.
getProductName
());
dto
.
setSceneCode
(
product4BookDTO
.
getProductSceneCode
());
dto
.
setSceneName
(
product4BookDTO
.
getProductSceneName
());
dto
.
setCreateUser
(
product4BookDTO
.
getMerchantId
());
dto
.
setCreateUserName
(
product4BookDTO
.
getMerchantName
());
dto
.
setCreateRole
(
product4BookDTO
.
getIsSuperMerchant
()
?
"超级作者"
:
"普通作者"
);
}
else
if
(
"APP"
.
equals
(
dto
.
getFromType
())
&&
!
MapUtils
.
isEmpty
(
appMap
)
&&
appMap
.
containsKey
(
dto
.
getFromId
()))
{
AppDto
appDto
=
appMap
.
get
(
dto
.
getFromId
());
dto
.
setTitle
(
appDto
.
getTitle
());
dto
.
setSceneCode
(
appDto
.
getSceneCode
());
dto
.
setSceneName
(
appDto
.
getSceneName
());
dto
.
setCreateUser
(
appDto
.
getCreatedUser
());
dto
.
setCreateUserName
(
appDto
.
getAdviserName
());
dto
.
setCreateRole
(
"编辑"
);
}
BookDto
bookDto
=
(
BookDto
)
object
;
// 曝光量
Long
exposureNum
=
getExposureNumByBookId
(
bookDto
.
getBookId
(),
bookDto
.
getAdviserId
(),
bookDto
.
getChannelId
());
bookDto
.
setExposureNum
(
exposureNum
);
// 点击量
Long
clickNum
=
getClickNumByBookId
(
bookDto
.
getBookId
(),
bookDto
.
getAdviserId
(),
bookDto
.
getChannelId
());
bookDto
.
setClickNum
(
clickNum
);
BigDecimal
clickRate
=
(
null
==
bookDto
.
getExposureNum
()
||
bookDto
.
getExposureNum
().
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
bookDto
.
getClickNum
().
doubleValue
()
/
bookDto
.
getExposureNum
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
bookDto
.
setClickRate
(
clickRate
);
BigDecimal
income
=
getIncomeByBookId
(
bookDto
.
getBookId
(),
bookDto
.
getChannelId
());
bookDto
.
setTotalIncome
(
income
);
}
return
pageBean
;
}
/**
* 获取广告位投放
时间统计
* 获取广告位投放
微信群列表
*/
@Override
@ParamLog
(
"获取广告位投放时间统计"
)
public
List
<
Object
>
distributionDateStatics
(
Long
adId
,
Integer
day
)
throws
BizException
{
public
PageBean
advertisingWechatGroupList
(
String
name
,
PageParam
pageParam
)
throws
BizException
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"adId"
,
adId
);
Date
startTime
=
DateUtils
.
addDay
(
new
Date
(),
-
day
);
Date
endTime
=
DateUtils
.
addDay
(
new
Date
(),
-
1
);
paramMap
.
put
(
"collectDates"
,
CommonUtils
.
collectLocalDates
(
startTime
,
endTime
));
return
advertisingExposureRecordDao
.
listBy
(
paramMap
,
"distributionDateStatics"
);
paramMap
.
put
(
"name"
,
StringUtil
.
isEmpty
(
name
)
?
null
:
name
);
PageBean
pageBean
=
bookGroupClassifyDao
.
listPage
(
pageParam
,
paramMap
,
"advertisingWechatGroupList"
);
if
(
pageBean
==
null
||
ListUtils
.
isEmpty
(
pageBean
.
getRecordList
()))
{
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
}
for
(
Object
object
:
pageBean
.
getRecordList
())
{
AdGroupQrcodeDTO
qrcodeDTO
=
(
AdGroupQrcodeDTO
)
object
;
// 曝光量
Long
exposureNum
=
getExposureNumByGroupQrcodeId
(
qrcodeDTO
.
getGroupQrcodeId
(),
null
,
null
);
qrcodeDTO
.
setExposureNum
(
exposureNum
);
// 点击量
Long
clickNum
=
getClickNumByGroupQrcodeId
(
qrcodeDTO
.
getGroupQrcodeId
(),
null
,
null
);
qrcodeDTO
.
setClickNum
(
clickNum
);
BigDecimal
clickRate
=
(
null
==
qrcodeDTO
.
getExposureNum
()
||
qrcodeDTO
.
getExposureNum
().
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
qrcodeDTO
.
getClickNum
().
doubleValue
()
/
qrcodeDTO
.
getExposureNum
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
qrcodeDTO
.
setClickRate
(
clickRate
);
BigDecimal
income
=
getIncomeByGroupQrcodeId
(
qrcodeDTO
.
getGroupQrcodeId
(),
null
,
null
);
qrcodeDTO
.
setTotalIncome
(
income
);
// 点击读者量
Long
clickUserNum
=
getClickUserNumByGroupQrcodeId
(
qrcodeDTO
.
getGroupQrcodeId
(),
null
,
null
);
qrcodeDTO
.
setClickUserNum
(
clickUserNum
);
}
return
pageBean
;
}
/**
* 获取广告位投放微信群曝光量前几位
*/
@Override
public
List
<
AdGroupQrcodeDTO
>
advertisingWechatGroupRankTop
()
throws
BizException
{
List
<
AdGroupQrcodeDTO
>
list
=
advertisingExposureRecordDao
.
advertisingWechatGroupRankTop
();
return
list
;
}
/**
* 获取书刊广告位曝光量
*/
private
Long
getExposureNumBy
BookId
(
Long
adId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
)
{
private
Long
getExposureNumBy
AdId
(
Long
adId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
,
String
statisMonth
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"adId"
,
adId
);
paramMap
.
put
(
"bookId"
,
bookId
);
paramMap
.
put
(
"adviserId"
,
adviserId
);
paramMap
.
put
(
"channelId"
,
channelId
);
paramMap
.
put
(
"statisMonth"
,
statisMonth
);
Long
exposureNum
=
(
Long
)
advertisingExposureRecordDao
.
getBy
(
paramMap
,
"getExposureNum"
);
return
null
==
exposureNum
?
0L
:
exposureNum
;
}
/**
* 获取书刊广告位曝光量
*/
private
Long
getExposureNumByBookId
(
Long
bookId
,
Long
adviserId
,
Long
channelId
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"bookId"
,
bookId
);
paramMap
.
put
(
"adviserId"
,
adviserId
);
paramMap
.
put
(
"channelId"
,
channelId
);
Long
exposureNum
=
(
Long
)
advertisingExposureRecordDao
.
getBy
(
paramMap
,
"getExposureNumByBookId"
);
return
null
==
exposureNum
?
0L
:
exposureNum
;
}
/**
* 获取书刊广告位曝光量
*/
private
Long
getExposureNumByGroupQrcodeId
(
Long
qrcodeId
,
Long
adId
,
String
statisMonth
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"qrcodeId"
,
qrcodeId
);
paramMap
.
put
(
"adId"
,
adId
);
paramMap
.
put
(
"statisMonth"
,
statisMonth
);
Long
exposureNum
=
(
Long
)
advertisingExposureRecordDao
.
getBy
(
paramMap
,
"getExposureNumByGroupQrcodeId"
);
return
null
==
exposureNum
?
0L
:
exposureNum
;
}
/**
* 获取书刊广告位点击量
*/
private
Long
getClickNumBy
BookId
(
Long
adId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
)
{
private
Long
getClickNumBy
AdId
(
Long
adId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
,
String
statisMonth
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"adId"
,
adId
);
paramMap
.
put
(
"bookId"
,
bookId
);
paramMap
.
put
(
"adviserId"
,
adviserId
);
paramMap
.
put
(
"channelId"
,
channelId
);
paramMap
.
put
(
"statisMonth"
,
statisMonth
);
Long
clickNum
=
(
Long
)
advertisingClickRecordDao
.
getBy
(
paramMap
,
"getClickNum"
);
return
null
==
clickNum
?
0L
:
clickNum
;
}
/**
* 获取书刊广告位点击量
*/
private
Long
getClickNumByBookId
(
Long
bookId
,
Long
adviserId
,
Long
channelId
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"bookId"
,
bookId
);
paramMap
.
put
(
"adviserId"
,
adviserId
);
paramMap
.
put
(
"channelId"
,
channelId
);
Long
clickNum
=
(
Long
)
advertisingClickRecordDao
.
getBy
(
paramMap
,
"getClickNumByBookId"
);
return
null
==
clickNum
?
0L
:
clickNum
;
}
/**
* 获取书刊广告位点击量
*/
private
Long
getClickNumByGroupQrcodeId
(
Long
qrcodeId
,
Long
adId
,
String
statisMonth
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"qrcodeId"
,
qrcodeId
);
paramMap
.
put
(
"adId"
,
adId
);
paramMap
.
put
(
"statisMonth"
,
statisMonth
);
Long
clickNum
=
(
Long
)
advertisingClickRecordDao
.
getBy
(
paramMap
,
"getClickNumByGroupQrcodeId"
);
return
null
==
clickNum
?
0L
:
clickNum
;
}
/**
* 获取书刊广告位点击读者量
*/
private
Long
getClickUserNumByGroupQrcodeId
(
Long
qrcodeId
,
Long
adId
,
String
statisMonth
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"qrcodeId"
,
qrcodeId
);
paramMap
.
put
(
"adId"
,
adId
);
paramMap
.
put
(
"statisMonth"
,
statisMonth
);
Long
clickUserNum
=
(
Long
)
advertisingClickRecordDao
.
getBy
(
paramMap
,
"getClickUserNumByGroupQrcodeId"
);
return
null
==
clickUserNum
?
0L
:
clickUserNum
;
}
/**
* 获取书刊广告位曝光量
*/
private
Long
getExposureNumByAdId
(
Long
adId
)
{
...
...
@@ -488,6 +866,16 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
/**
* 获取书刊广告位曝光量
*/
private
Long
getExposureNumByMasterId
(
Long
masterId
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"masterId"
,
masterId
);
Long
exposureNum
=
(
Long
)
advertisingExposureRecordDao
.
getBy
(
paramMap
,
"getExposureNumByMasterId"
);
return
null
==
exposureNum
?
0L
:
exposureNum
;
}
/**
* 获取书刊广告位点击量
*/
private
Long
getClickNumByAdId
(
Long
adId
)
{
...
...
@@ -498,10 +886,75 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
/**
* 获取书刊广告位点击量
*/
private
Long
getClickNumByMasterId
(
Long
masterId
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"masterId"
,
masterId
);
Long
clickNum
=
(
Long
)
advertisingClickRecordDao
.
getBy
(
paramMap
,
"getClickNumByMasterId"
);
return
null
==
clickNum
?
0L
:
clickNum
;
}
/**
* 获取书刊广告位收益
*/
private
BigDecimal
getIncomeByAdId
(
Long
adId
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"adId"
,
adId
);
BigDecimal
income
=
(
BigDecimal
)
advertisingIncomeDailyDao
.
getBy
(
paramMap
,
"getIncomeByAdId"
);
return
null
==
income
?
BigDecimal
.
ZERO
:
income
;
}
/**
* 获取书刊广告位收益
*/
private
BigDecimal
getIncomeByMasterId
(
Long
masterId
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"masterId"
,
masterId
);
BigDecimal
income
=
(
BigDecimal
)
advertisingIncomeDailyDao
.
getBy
(
paramMap
,
"getIncomeByMasterId"
);
return
null
==
income
?
BigDecimal
.
ZERO
:
income
;
}
/**
* 获取书刊广告位收益
*/
private
BigDecimal
getIncomeByAdId
(
Long
adId
,
Long
bookId
,
Long
channelId
,
String
statisMonth
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"adId"
,
adId
);
paramMap
.
put
(
"bookId"
,
bookId
);
paramMap
.
put
(
"channelId"
,
channelId
);
paramMap
.
put
(
"statisMonth"
,
statisMonth
);
BigDecimal
income
=
(
BigDecimal
)
advertisingIncomeDailyDao
.
getBy
(
paramMap
,
"getIncomeByAdId"
);
return
null
==
income
?
BigDecimal
.
ZERO
:
income
;
}
/**
* 获取书刊广告位点击量
*/
private
BigDecimal
getIncomeByBookId
(
Long
bookId
,
Long
channelId
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"bookId"
,
bookId
);
paramMap
.
put
(
"channelId"
,
channelId
);
BigDecimal
income
=
(
BigDecimal
)
advertisingIncomeDailyDao
.
getBy
(
paramMap
,
"getIncomeByBookId"
);
return
null
==
income
?
BigDecimal
.
ZERO
:
income
;
}
/**
* 获取书刊广告位收益
*/
private
BigDecimal
getIncomeByGroupQrcodeId
(
Long
qrcodeId
,
Long
adId
,
String
statisMonth
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"qrcodeId"
,
qrcodeId
);
paramMap
.
put
(
"adId"
,
adId
);
paramMap
.
put
(
"statisMonth"
,
statisMonth
);
BigDecimal
income
=
(
BigDecimal
)
advertisingIncomeDailyDao
.
getBy
(
paramMap
,
"getIncomeByGroupQrcodeId"
);
return
null
==
income
?
BigDecimal
.
ZERO
:
income
;
}
/**
* 获取广告位列表
*/
@Override
@ParamLog
(
"获取广告位列表"
)
public
PageBean
list
(
String
name
,
PageParam
pageParam
)
throws
BizException
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"name"
,
StringUtil
.
isEmpty
(
name
)
?
null
:
name
);
...
...
@@ -509,23 +962,397 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
if
(
pageBean
==
null
||
ListUtils
.
isEmpty
(
pageBean
.
getRecordList
()))
{
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
}
// 填充投放
书籍
// 填充投放
数据
for
(
Object
object
:
pageBean
.
getRecordList
())
{
AdvertisingSpaceDTO
spaceDTO
=
(
AdvertisingSpaceDTO
)
object
;
if
(
null
==
spaceDTO
)
{
continue
;
}
AdvertisingMaster
master
=
advertisingMasterDao
.
getById
(
spaceDTO
.
getMasterId
());
if
(
null
!=
master
)
{
spaceDTO
.
setMasterName
(
master
.
getMasterName
());
}
spaceDTO
.
setExposureNum
(
getExposureNumByAdId
(
spaceDTO
.
getId
()));
spaceDTO
.
setClickNum
(
getClickNumByAdId
(
spaceDTO
.
getId
()));
if
(
DistributionTypeEnum
.
SIGN_BOOK
.
value
.
equals
(
spaceDTO
.
getDistributionType
()))
{
List
<
AdvertisingDistributionBook
>
list
=
advertisingDistributionBookDao
.
getByAdId
(
spaceDTO
.
getId
());
if
(!
ListUtils
.
isEmpty
(
list
))
{
spaceDTO
.
setBookNum
(
list
.
size
());
Long
bookId
=
list
.
get
(
0
).
getBookId
();
BookDto
bookDto
=
bookBiz
.
getBaseById
(
bookId
);
BigDecimal
clickRate
=
(
null
==
spaceDTO
.
getExposureNum
()
||
spaceDTO
.
getExposureNum
().
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
spaceDTO
.
getClickNum
().
doubleValue
()
/
spaceDTO
.
getExposureNum
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
spaceDTO
.
setClickRate
(
clickRate
);
BigDecimal
income
=
getIncomeByAdId
(
spaceDTO
.
getId
());
spaceDTO
.
setTotalIncome
(
income
);
List
<
AdvertisingDistributionBook
>
list
=
advertisingDistributionBookDao
.
getByAdId
(
spaceDTO
.
getId
());
if
(!
ListUtils
.
isEmpty
(
list
))
{
spaceDTO
.
setBookNum
(
list
.
size
());
Long
bookId
=
list
.
get
(
0
).
getBookId
();
BookDto
bookDto
=
bookBiz
.
getBaseById
(
bookId
);
spaceDTO
.
setBookName
(
StringUtil
.
addBracket
(
bookDto
.
getBookName
()));
}
else
{
spaceDTO
.
setBookNum
(
0
);
}
// 填充广告位置名称
if
(
AdPositionEnum
.
WECHAT_GROUP_MSG
.
positionCode
.
equals
(
spaceDTO
.
getAdPosition
()))
{
fillAdpositionName4WechatGroupAd
(
spaceDTO
);
}
else
{
fillAdpositionName4CommonAd
(
spaceDTO
);
}
}
return
pageBean
;
}
/**
* 书刊广告位明细
*/
@Override
public
PageBean
advertisingDetail4Book
(
Long
bookId
,
Long
channelId
,
Long
adviserId
,
String
statisMonth
,
PageParam
pageParam
)
throws
BizException
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"bookId"
,
bookId
);
paramMap
.
put
(
"channelId"
,
channelId
);
paramMap
.
put
(
"adviserId"
,
adviserId
);
PageBean
pageBean
=
advertisingSpaceDao
.
listPage
(
pageParam
,
paramMap
,
"advertisingDetail4Book"
);
if
(
pageBean
==
null
||
ListUtils
.
isEmpty
(
pageBean
.
getRecordList
()))
{
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
}
// 填充投放数据
for
(
Object
object
:
pageBean
.
getRecordList
())
{
AdvertisingSpaceDTO
spaceDTO
=
(
AdvertisingSpaceDTO
)
object
;
if
(
null
==
spaceDTO
)
{
continue
;
}
AdvertisingMaster
master
=
advertisingMasterDao
.
getById
(
spaceDTO
.
getMasterId
());
if
(
null
!=
master
)
{
spaceDTO
.
setMasterName
(
master
.
getMasterName
());
}
spaceDTO
.
setExposureNum
(
getExposureNumByAdId
(
spaceDTO
.
getId
(),
bookId
,
adviserId
,
channelId
,
statisMonth
));
spaceDTO
.
setClickNum
(
getClickNumByAdId
(
spaceDTO
.
getId
(),
bookId
,
adviserId
,
channelId
,
statisMonth
));
BigDecimal
clickRate
=
(
null
==
spaceDTO
.
getExposureNum
()
||
spaceDTO
.
getExposureNum
().
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
spaceDTO
.
getClickNum
().
doubleValue
()
/
spaceDTO
.
getExposureNum
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
spaceDTO
.
setClickRate
(
clickRate
);
BigDecimal
income
=
getIncomeByAdId
(
spaceDTO
.
getId
(),
bookId
,
channelId
,
statisMonth
);
spaceDTO
.
setTotalIncome
(
income
);
// 填充广告位置名称
fillAdpositionName4CommonAd
(
spaceDTO
);
}
return
pageBean
;
}
/**
* 导出书刊广告位明细
*/
@Override
public
Map
<
String
,
Object
>
exportAdvertisingDetail4Book
(
Long
bookId
,
Long
channelId
,
Long
adviserId
,
String
statisMonth
)
throws
BizException
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"bookId"
,
bookId
);
paramMap
.
put
(
"channelId"
,
channelId
);
paramMap
.
put
(
"adviserId"
,
adviserId
);
List
<
AdvertisingSpaceDTO
>
list
=
advertisingSpaceDao
.
advertisingDetail4Book
(
paramMap
);
if
(
ListUtils
.
isEmpty
(
list
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"暂无数据导出!"
);
}
// 字段名
String
[]
rowsName
=
{
"序号"
,
"广告位名称"
,
"广告主"
,
"广告位置"
,
"投放时间"
,
"曝光量"
,
"点击量"
,
"点击率"
,
"累积收益"
};
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
Object
[]
objs
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
AdvertisingSpaceDTO
spaceDTO
=
list
.
get
(
i
);
objs
=
new
Object
[
rowsName
.
length
];
objs
[
0
]
=
i
+
1
;
objs
[
1
]
=
spaceDTO
.
getAdName
();
AdvertisingMaster
master
=
advertisingMasterDao
.
getById
(
spaceDTO
.
getMasterId
());
objs
[
2
]
=
null
!=
master
?
master
.
getMasterName
()
:
""
;
fillAdpositionName4CommonAd
(
spaceDTO
);
objs
[
3
]
=
spaceDTO
.
getAdPositionName
();
objs
[
4
]
=
DateNewUtils
.
formatDate
(
spaceDTO
.
getDistributionTime
());
Long
exposureNum
=
getExposureNumByAdId
(
spaceDTO
.
getId
(),
bookId
,
adviserId
,
channelId
,
statisMonth
);
objs
[
5
]
=
exposureNum
;
Long
clickNum
=
getClickNumByAdId
(
spaceDTO
.
getId
(),
bookId
,
adviserId
,
channelId
,
statisMonth
);
objs
[
6
]
=
clickNum
;
BigDecimal
clickRate
=
(
null
==
exposureNum
||
exposureNum
.
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
clickNum
.
doubleValue
()
/
exposureNum
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
objs
[
7
]
=
clickRate
.
multiply
(
new
BigDecimal
(
100
)).
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
)
+
"%"
;
BigDecimal
income
=
getIncomeByAdId
(
spaceDTO
.
getId
(),
bookId
,
channelId
,
statisMonth
);
objs
[
8
]
=
income
+
"元"
;
dataList
.
add
(
objs
);
}
BookDto
bookDto
=
bookBiz
.
getBaseById
(
bookId
);
String
[]
dateStr
=
statisMonth
.
split
(
"-"
);
String
fileName
=
StringUtil
.
addBracket
(
bookDto
.
getBookName
())
+
dateStr
[
0
]
+
"年"
+
Integer
.
parseInt
(
dateStr
[
1
])
+
"月广告位明细"
;
String
fileUrl
=
exportConsr
.
exportExcel
(
fileName
,
rowsName
,
dataList
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"fileUrl"
,
fileUrl
);
result
.
put
(
"fileName"
,
fileName
);
return
result
;
}
/**
* 填充作品应用、社群码页面广告位名称
*/
private
void
fillAdpositionName4CommonAd
(
AdvertisingSpaceDTO
spaceDTO
)
{
String
adPositionName
=
""
;
String
adPositionModeName
=
AdPositionModeEnum
.
getNameByCode
(
spaceDTO
.
getAdPositionMode
());
if
(
AdPositionEnum
.
BOOK_GROUP_PAGE
.
positionCode
.
equals
(
spaceDTO
.
getAdPosition
()))
{
adPositionName
=
AdPositionDetailEnum
.
getNameByCode
(
spaceDTO
.
getAdPositionDetail
())
+
">"
+
adPositionModeName
;
}
else
{
int
index
=
spaceDTO
.
getAdPositionDetail
().
indexOf
(
"_"
);
String
type
=
spaceDTO
.
getAdPositionDetail
().
substring
(
0
,
index
);
String
typeCode
=
spaceDTO
.
getAdPositionDetail
().
substring
(
index
+
1
,
spaceDTO
.
getAdPositionDetail
().
length
());
if
(
"APP"
.
equalsIgnoreCase
(
type
))
{
AppTypeDto
appTypeDto
=
ResponseHandleUtil
.
parseResponse
(
appTypeService
.
getByTypeCode
(
typeCode
),
AppTypeDto
.
class
);
if
(
null
!=
appTypeDto
)
{
adPositionName
=
appTypeDto
.
getTypeName
()
+
">"
+
adPositionModeName
;
}
else
{
adPositionName
=
adPositionModeName
;
}
}
else
{
String
productTypeName
=
ResponseHandleUtil
.
parseResponse
(
productService
.
getProTypeName
(
typeCode
),
String
.
class
);
if
(!
StringUtil
.
isEmpty
(
productTypeName
))
{
adPositionName
=
productTypeName
+
">"
+
adPositionModeName
;
}
else
{
adPositionName
=
adPositionModeName
;
}
}
}
spaceDTO
.
setAdPositionName
(
adPositionName
);
}
/**
* 填充作品应用、社群码页面广告位名称
*/
private
void
fillAdpositionName4WechatGroupAd
(
AdvertisingSpaceDTO
spaceDTO
)
{
String
adPositionName
=
AdPositionEnum
.
getNameByCode
(
spaceDTO
.
getAdPosition
())
+
">"
+
AdPositionModeEnum
.
getNameByCode
(
spaceDTO
.
getAdPositionMode
());
spaceDTO
.
setAdPositionName
(
adPositionName
);
}
/**
* 微信群广告位明细
*/
@Override
public
PageBean
advertisingDetail4WechatGroup
(
Long
qrcodeId
,
String
statisMonth
,
PageParam
pageParam
)
throws
BizException
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"qrcodeId"
,
qrcodeId
);
PageBean
pageBean
=
advertisingSpaceDao
.
listPage
(
pageParam
,
paramMap
,
"advertisingDetail4WechatGroup"
);
if
(
pageBean
==
null
||
ListUtils
.
isEmpty
(
pageBean
.
getRecordList
()))
{
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
}
// 填充投放数据
for
(
Object
object
:
pageBean
.
getRecordList
())
{
AdvertisingSpaceDTO
spaceDTO
=
(
AdvertisingSpaceDTO
)
object
;
if
(
null
==
spaceDTO
)
{
continue
;
}
AdvertisingMaster
master
=
advertisingMasterDao
.
getById
(
spaceDTO
.
getMasterId
());
if
(
null
!=
master
)
{
spaceDTO
.
setMasterName
(
master
.
getMasterName
());
}
spaceDTO
.
setExposureNum
(
getExposureNumByGroupQrcodeId
(
qrcodeId
,
spaceDTO
.
getId
(),
statisMonth
));
spaceDTO
.
setClickNum
(
getClickNumByGroupQrcodeId
(
qrcodeId
,
spaceDTO
.
getId
(),
statisMonth
));
BigDecimal
clickRate
=
(
null
==
spaceDTO
.
getExposureNum
()
||
spaceDTO
.
getExposureNum
().
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
spaceDTO
.
getClickNum
().
doubleValue
()
/
spaceDTO
.
getExposureNum
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
spaceDTO
.
setClickRate
(
clickRate
);
BigDecimal
income
=
getIncomeByGroupQrcodeId
(
qrcodeId
,
spaceDTO
.
getId
(),
statisMonth
);
spaceDTO
.
setTotalIncome
(
income
);
// 点击读者量
if
(!
AdPositionModeEnum
.
JUST_PIC
.
modeCode
.
equals
(
spaceDTO
.
getAdPositionMode
())
&&
!
StringUtil
.
isEmpty
(
spaceDTO
.
getAdLink
()))
{
spaceDTO
.
setClickUserNum
(
getClickUserNumByGroupQrcodeId
(
qrcodeId
,
spaceDTO
.
getId
(),
statisMonth
));
}
else
{
spaceDTO
.
setClickUserNum
(
0L
);
}
// 填充广告位置名称
spaceDTO
.
setAdPositionName
(
AdPositionModeEnum
.
getNameByCode
(
spaceDTO
.
getAdPositionMode
()));
}
return
pageBean
;
}
/**
* 导出微信群广告位明细
*/
@Override
public
Map
<
String
,
Object
>
exportAdvertisingDetail4WechatGroup
(
Long
qrcodeId
,
String
statisMonth
)
throws
BizException
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"qrcodeId"
,
qrcodeId
);
List
<
AdvertisingSpaceDTO
>
list
=
advertisingSpaceDao
.
advertisingDetail4WechatGroup
(
paramMap
);
if
(
ListUtils
.
isEmpty
(
list
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"暂无数据导出!"
);
}
// 字段名
String
[]
rowsName
=
{
"序号"
,
"广告位名称"
,
"广告主"
,
"广告位置"
,
"投放时间"
,
"曝光量"
,
"点击量"
,
"点击率"
,
"累积收益"
};
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
Object
[]
objs
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
AdvertisingSpaceDTO
spaceDTO
=
list
.
get
(
i
);
objs
=
new
Object
[
rowsName
.
length
];
objs
[
0
]
=
i
+
1
;
objs
[
1
]
=
spaceDTO
.
getAdName
();
AdvertisingMaster
master
=
advertisingMasterDao
.
getById
(
spaceDTO
.
getMasterId
());
objs
[
2
]
=
null
!=
master
?
master
.
getMasterName
()
:
""
;
objs
[
3
]
=
AdPositionModeEnum
.
getNameByCode
(
spaceDTO
.
getAdPositionMode
());
objs
[
4
]
=
DateNewUtils
.
formatDate
(
spaceDTO
.
getDistributionTime
());
Long
exposureNum
=
getExposureNumByGroupQrcodeId
(
qrcodeId
,
spaceDTO
.
getId
(),
statisMonth
);
objs
[
5
]
=
exposureNum
;
Long
clickNum
=
getClickNumByGroupQrcodeId
(
qrcodeId
,
spaceDTO
.
getId
(),
statisMonth
);
objs
[
6
]
=
clickNum
;
BigDecimal
clickRate
=
(
null
==
exposureNum
||
exposureNum
.
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
clickNum
.
doubleValue
()
/
exposureNum
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
objs
[
7
]
=
clickRate
.
multiply
(
new
BigDecimal
(
100
)).
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
)
+
"%"
;
BigDecimal
income
=
getIncomeByGroupQrcodeId
(
qrcodeId
,
spaceDTO
.
getId
(),
statisMonth
);
objs
[
8
]
=
income
+
"元"
;
dataList
.
add
(
objs
);
}
GroupQrcode
groupQrcode
=
groupQrcodeDao
.
getById
(
qrcodeId
);
String
[]
dateStr
=
statisMonth
.
split
(
"-"
);
String
fileName
=
(
null
!=
groupQrcode
?
groupQrcode
.
getGroupName
()
:
""
)
+
dateStr
[
0
]
+
"年"
+
Integer
.
parseInt
(
dateStr
[
1
])
+
"月广告位明细"
;
String
fileUrl
=
exportConsr
.
exportExcel
(
fileName
,
rowsName
,
dataList
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"fileUrl"
,
fileUrl
);
result
.
put
(
"fileName"
,
fileName
);
return
result
;
}
/**
* 微信群广告位点击读者列表
*/
@Override
public
PageBean
clickUserList4AdvertisingWechatGroup
(
Long
qrcodeId
,
Long
adId
,
String
statisMonth
,
PageParam
pageParam
)
throws
BizException
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"qrcodeId"
,
qrcodeId
);
paramMap
.
put
(
"adId"
,
adId
);
paramMap
.
put
(
"statisMonth"
,
statisMonth
);
PageBean
pageBean
=
advertisingClickRecordDao
.
listPage
(
pageParam
,
paramMap
,
"clickUserList4AdvertisingWechatGroup"
);
if
(
pageBean
==
null
||
ListUtils
.
isEmpty
(
pageBean
.
getRecordList
()))
{
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
}
List
<
Long
>
wechatUserIds
=
new
ArrayList
<>();
pageBean
.
getRecordList
().
forEach
(
obj
->
{
wechatUserIds
.
add
(((
WechatGroupClickUserDTO
)
obj
).
getWechatUserId
());
});
Map
<
Long
,
WechatUser
>
wechatUserMap
=
readerConsr
.
getUserList
(
wechatUserIds
);
for
(
Object
object
:
pageBean
.
getRecordList
())
{
WechatGroupClickUserDTO
dto
=
(
WechatGroupClickUserDTO
)
object
;
if
(!
MapUtils
.
isEmpty
(
wechatUserMap
)
&&
wechatUserMap
.
containsKey
(
dto
.
getWechatUserId
()))
{
WechatUser
wechatUser
=
wechatUserMap
.
get
(
dto
.
getWechatUserId
());
dto
.
setWechatUserName
(
wechatUser
.
getWechatUserNickname
());
dto
.
setWechatUserHeadurl
(
wechatUser
.
getWechatUserHeadurl
());
dto
.
setWechatUserSex
(
wechatUser
.
getWechatUserSex
());
dto
.
setWechatUserProvince
(
wechatUser
.
getWechatUserProvince
());
dto
.
setWechatUserCity
(
wechatUser
.
getWechatUserCity
());
}
}
return
pageBean
;
}
/**
* 导出微信群广告位点击读者列表
*/
@Override
public
Map
<
String
,
Object
>
exportClickUserList4AdvertisingWechatGroup
(
Long
qrcodeId
,
Long
adId
,
String
statisMonth
)
throws
BizException
{
AdvertisingSpace
space
=
advertisingSpaceDao
.
getById
(
adId
);
if
(
null
==
space
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告位不存在或已删除!"
);
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"qrcodeId"
,
qrcodeId
);
paramMap
.
put
(
"adId"
,
adId
);
paramMap
.
put
(
"statisMonth"
,
statisMonth
);
List
<
WechatGroupClickUserDTO
>
list
=
advertisingClickRecordDao
.
clickUserList4AdvertisingWechatGroup
(
paramMap
);
if
(
ListUtils
.
isEmpty
(
list
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"暂无数据导出!"
);
}
List
<
Long
>
wechatUserIds
=
list
.
stream
().
map
(
WechatGroupClickUserDTO:
:
getWechatUserId
).
collect
(
Collectors
.
toList
());
Map
<
Long
,
WechatUser
>
wechatUserMap
=
readerConsr
.
getUserList
(
wechatUserIds
);
// 字段名
String
[]
rowsName
=
{
"序号"
,
"读者信息"
,
"读者标签"
,
"点击时间"
};
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
Object
[]
objs
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
WechatGroupClickUserDTO
dto
=
list
.
get
(
i
);
objs
=
new
Object
[
rowsName
.
length
];
objs
[
0
]
=
i
+
1
;
if
(!
MapUtils
.
isEmpty
(
wechatUserMap
)
&&
wechatUserMap
.
containsKey
(
dto
.
getWechatUserId
()))
{
WechatUser
wechatUser
=
wechatUserMap
.
get
(
dto
.
getWechatUserId
());
objs
[
1
]
=
wechatUser
.
getWechatUserNickname
();
String
sex
=
wechatUser
.
getWechatUserSex
().
equals
(
1
)
?
"男"
:
(
wechatUser
.
getWechatUserSex
().
equals
(
2
)
?
"女"
:
"未知"
);
objs
[
2
]
=
sex
+
","
+
wechatUser
.
getWechatUserCity
();
}
else
{
objs
[
1
]
=
""
;
objs
[
2
]
=
""
;
}
objs
[
3
]
=
DateNewUtils
.
formatDate
(
dto
.
getCreateTime
());
dataList
.
add
(
objs
);
}
GroupQrcode
groupQrcode
=
groupQrcodeDao
.
getById
(
qrcodeId
);
String
[]
dateStr
=
statisMonth
.
split
(
"-"
);
String
fileName
;
if
(
StringUtil
.
isEmpty
(
statisMonth
))
{
fileName
=
(
null
!=
groupQrcode
?
groupQrcode
.
getGroupName
()
:
""
)
+
dateStr
[
0
]
+
"年"
+
Integer
.
parseInt
(
dateStr
[
1
])
+
"月"
+
space
.
getAdName
()
+
"广告位点击读者明细"
;
}
else
{
fileName
=
space
.
getAdName
()
+
"广告位"
+
(
null
!=
groupQrcode
?
groupQrcode
.
getGroupName
()
:
""
)
+
"点击读者明细"
;
}
String
fileUrl
=
exportConsr
.
exportExcel
(
fileName
,
rowsName
,
dataList
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"fileUrl"
,
fileUrl
);
result
.
put
(
"fileName"
,
fileName
);
return
result
;
}
/**
* 广告主广告位明细
*/
@Override
public
PageBean
advertisingDetail4Master
(
Long
masterId
,
String
statisMonth
,
PageParam
pageParam
)
throws
BizException
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"masterId"
,
masterId
);
PageBean
pageBean
=
advertisingSpaceDao
.
listPage
(
pageParam
,
paramMap
,
"advertisingDetail4Master"
);
if
(
pageBean
==
null
||
ListUtils
.
isEmpty
(
pageBean
.
getRecordList
()))
{
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
}
// 填充投放数据
for
(
Object
object
:
pageBean
.
getRecordList
())
{
AdvertisingSpaceDTO
spaceDTO
=
(
AdvertisingSpaceDTO
)
object
;
if
(
null
==
spaceDTO
)
{
continue
;
}
Long
exposureNum
=
0L
;
Long
clickNum
=
0L
;
BigDecimal
income
=
BigDecimal
.
ZERO
;
if
(
null
!=
spaceDTO
.
getBookId
())
{
if
(
AdPositionEnum
.
WECHAT_GROUP_MSG
.
positionCode
.
equals
(
spaceDTO
.
getAdPosition
()))
{
exposureNum
=
getExposureNumByGroupQrcodeId
(
spaceDTO
.
getQrcodeId
(),
spaceDTO
.
getId
(),
statisMonth
);
clickNum
=
getClickNumByGroupQrcodeId
(
spaceDTO
.
getQrcodeId
(),
spaceDTO
.
getId
(),
statisMonth
);
income
=
getIncomeByGroupQrcodeId
(
spaceDTO
.
getQrcodeId
(),
spaceDTO
.
getId
(),
statisMonth
);
}
else
{
exposureNum
=
getExposureNumByAdId
(
spaceDTO
.
getId
(),
spaceDTO
.
getBookId
(),
spaceDTO
.
getAdviserId
(),
spaceDTO
.
getChannelId
(),
statisMonth
);
clickNum
=
getClickNumByAdId
(
spaceDTO
.
getId
(),
spaceDTO
.
getBookId
(),
spaceDTO
.
getAdviserId
(),
spaceDTO
.
getChannelId
(),
statisMonth
);
income
=
getIncomeByAdId
(
spaceDTO
.
getId
(),
spaceDTO
.
getBookId
(),
spaceDTO
.
getChannelId
(),
statisMonth
);
}
}
BigDecimal
clickRate
=
(
null
==
exposureNum
||
exposureNum
.
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
clickNum
.
doubleValue
()
/
exposureNum
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
spaceDTO
.
setExposureNum
(
exposureNum
);
spaceDTO
.
setClickNum
(
clickNum
);
spaceDTO
.
setClickRate
(
clickRate
);
spaceDTO
.
setTotalIncome
(
income
);
// 填充广告位置名称
if
(
AdPositionEnum
.
WECHAT_GROUP_MSG
.
positionCode
.
equals
(
spaceDTO
.
getAdPosition
()))
{
fillAdpositionName4WechatGroupAd
(
spaceDTO
);
}
else
{
fillAdpositionName4CommonAd
(
spaceDTO
);
}
// 填充投放渠道信息
if
(
null
!=
spaceDTO
.
getBookId
())
{
if
(
AdPositionEnum
.
WECHAT_GROUP_MSG
.
positionCode
.
equals
(
spaceDTO
.
getAdPosition
()))
{
GroupQrcode
groupQrcode
=
groupQrcodeDao
.
getById
(
spaceDTO
.
getQrcodeId
());
BookDto
bookDto
=
bookBiz
.
getBaseById
(
spaceDTO
.
getBookId
());
spaceDTO
.
setGroupQrcodeName
(
null
!=
groupQrcode
?
groupQrcode
.
getGroupName
()
:
""
);
spaceDTO
.
setBookName
(
StringUtil
.
addBracket
(
bookDto
.
getBookName
()));
spaceDTO
.
setIsbn
(
bookDto
.
getIsbn
());
}
else
{
spaceDTO
.
setBookNum
(
0
);
BookDto
bookDto
=
bookBiz
.
getBaseById
(
spaceDTO
.
getBookId
());
spaceDTO
.
setBookName
(
StringUtil
.
addBracket
(
bookDto
.
getBookName
()));
spaceDTO
.
setIsbn
(
bookDto
.
getIsbn
());
Map
<
Long
,
String
>
agentNameMap
=
agentConsr
.
getNames
(
Arrays
.
asList
(
spaceDTO
.
getAgentId
()));
if
(!
MapUtils
.
isEmpty
(
agentNameMap
)
&&
agentNameMap
.
containsKey
(
spaceDTO
.
getAgentId
()))
{
spaceDTO
.
setAgentName
(
agentNameMap
.
get
(
spaceDTO
.
getAgentId
()));
}
else
{
spaceDTO
.
setAgentName
(
""
);
}
}
}
}
...
...
@@ -533,15 +1360,95 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
/**
* 导出广告主广告位明细
*/
@Override
public
Map
<
String
,
Object
>
exportAdvertisingDetail4Master
(
Long
masterId
,
String
statisMonth
)
throws
BizException
{
AdvertisingMaster
master
=
advertisingMasterDao
.
getById
(
masterId
);
if
(
null
==
master
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告主不存在!"
);
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"masterId"
,
masterId
);
List
<
AdvertisingSpaceDTO
>
list
=
advertisingSpaceDao
.
advertisingDetail4Master
(
paramMap
);
if
(
ListUtils
.
isEmpty
(
list
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"暂无数据导出!"
);
}
// 字段名
String
[]
rowsName
=
{
"序号"
,
"广告位名称"
,
"对方ID"
,
"广告位置"
,
"投放渠道"
,
"投放时间"
,
"曝光量"
,
"点击量"
,
"点击率"
,
"累积收益"
};
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
Object
[]
objs
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
AdvertisingSpaceDTO
spaceDTO
=
list
.
get
(
i
);
objs
=
new
Object
[
rowsName
.
length
];
objs
[
0
]
=
i
+
1
;
objs
[
1
]
=
spaceDTO
.
getAdName
();
objs
[
2
]
=
spaceDTO
.
getSourceId
();
// 填充广告位置名称
String
distributionChannel
=
""
;
if
(
AdPositionEnum
.
WECHAT_GROUP_MSG
.
positionCode
.
equals
(
spaceDTO
.
getAdPosition
()))
{
fillAdpositionName4WechatGroupAd
(
spaceDTO
);
if
(
null
!=
spaceDTO
.
getBookId
())
{
GroupQrcode
groupQrcode
=
groupQrcodeDao
.
getById
(
spaceDTO
.
getQrcodeId
());
BookDto
bookDto
=
bookBiz
.
getBaseById
(
spaceDTO
.
getBookId
());
distributionChannel
=
(
null
!=
groupQrcode
?
groupQrcode
.
getGroupName
()
:
""
)
+
"\r\n社群书"
+
StringUtil
.
addBracket
(
bookDto
.
getBookName
())
+
"\r\n书号:"
+
bookDto
.
getIsbn
();
}
}
else
{
fillAdpositionName4CommonAd
(
spaceDTO
);
if
(
null
!=
spaceDTO
.
getBookId
())
{
BookDto
bookDto
=
bookBiz
.
getBaseById
(
spaceDTO
.
getBookId
());
Map
<
Long
,
String
>
agentNameMap
=
agentConsr
.
getNames
(
Arrays
.
asList
(
spaceDTO
.
getAgentId
()));
String
agentName
=
""
;
if
(!
MapUtils
.
isEmpty
(
agentNameMap
)
&&
agentNameMap
.
containsKey
(
spaceDTO
.
getAgentId
()))
{
agentName
=
agentNameMap
.
get
(
spaceDTO
.
getAgentId
());
}
distributionChannel
=
StringUtil
.
addBracket
(
bookDto
.
getBookName
())
+
"\r\n出版社:"
+
agentName
+
"\r\n书号:"
+
bookDto
.
getIsbn
();
}
}
objs
[
3
]
=
spaceDTO
.
getAdPositionName
();
objs
[
4
]
=
distributionChannel
;
objs
[
5
]
=
DateNewUtils
.
formatDate
(
spaceDTO
.
getDistributionTime
());
Long
exposureNum
=
0L
;
Long
clickNum
=
0L
;
BigDecimal
income
=
BigDecimal
.
ZERO
;
if
(
null
!=
spaceDTO
.
getBookId
())
{
if
(
AdPositionEnum
.
WECHAT_GROUP_MSG
.
positionCode
.
equals
(
spaceDTO
.
getAdPosition
()))
{
exposureNum
=
getExposureNumByGroupQrcodeId
(
spaceDTO
.
getQrcodeId
(),
spaceDTO
.
getId
(),
statisMonth
);
clickNum
=
getClickNumByGroupQrcodeId
(
spaceDTO
.
getQrcodeId
(),
spaceDTO
.
getId
(),
statisMonth
);
income
=
getIncomeByGroupQrcodeId
(
spaceDTO
.
getQrcodeId
(),
spaceDTO
.
getId
(),
statisMonth
);
}
else
{
exposureNum
=
getExposureNumByAdId
(
spaceDTO
.
getId
(),
spaceDTO
.
getBookId
(),
spaceDTO
.
getAdviserId
(),
spaceDTO
.
getChannelId
(),
statisMonth
);
clickNum
=
getClickNumByAdId
(
spaceDTO
.
getId
(),
spaceDTO
.
getBookId
(),
spaceDTO
.
getAdviserId
(),
spaceDTO
.
getChannelId
(),
statisMonth
);
income
=
getIncomeByAdId
(
spaceDTO
.
getId
(),
spaceDTO
.
getBookId
(),
spaceDTO
.
getChannelId
(),
statisMonth
);
}
}
objs
[
6
]
=
exposureNum
;
objs
[
7
]
=
clickNum
;
BigDecimal
clickRate
=
(
null
==
exposureNum
||
exposureNum
.
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
clickNum
.
doubleValue
()
/
exposureNum
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
objs
[
8
]
=
clickRate
.
multiply
(
new
BigDecimal
(
100
)).
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
)
+
"%"
;
objs
[
9
]
=
income
+
"元"
;
dataList
.
add
(
objs
);
}
String
[]
dateStr
=
statisMonth
.
split
(
"-"
);
String
fileName
=
master
.
getMasterName
()
+
dateStr
[
0
]
+
"年"
+
Integer
.
parseInt
(
dateStr
[
1
])
+
"月广告位明细"
;
String
fileUrl
=
exportConsr
.
exportExcel
(
fileName
,
rowsName
,
dataList
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"fileUrl"
,
fileUrl
);
result
.
put
(
"fileName"
,
fileName
);
return
result
;
}
/**
* 客户端获取书刊配置的广告位信息
*/
@Override
@ParamLog
(
"客户端获取书刊配置的广告位信息"
)
public
AdvertisingSpaceDTO
get4Wechat
(
Long
sceneId
,
Long
adviserId
,
Long
channelId
)
throws
BizException
{
public
List
<
AdvertisingSpaceDTO
>
get4Wechat
(
Long
sceneId
,
Long
adviserId
,
Long
channelId
,
String
adPositionDetail
)
throws
BizException
{
Long
agentId
=
adviserConsr
.
getAgentIdByAdviser
(
adviserId
);
Long
bookId
=
ResponseHandleUtil
.
parseResponse
(
qrcodeSceneService
.
getBookId4SceneId
(
sceneId
),
Long
.
class
);
if
(
null
==
agentId
||
null
==
bookId
)
{
return
new
A
dvertisingSpaceDTO
();
return
new
A
rrayList
<>
();
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"bookId"
,
bookId
);
...
...
@@ -550,15 +1457,45 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
paramMap
.
put
(
"agentId"
,
agentId
);
Boolean
bookIsOpen
=
(
Boolean
)
advertisingAdviserPermissionDao
.
getBy
(
paramMap
,
"checkBookOpen"
);
if
(
null
==
bookIsOpen
||
!
bookIsOpen
)
{
return
new
ArrayList
<>();
}
paramMap
.
put
(
"adPositionDetail"
,
adPositionDetail
);
List
<
AdvertisingSpaceDTO
>
list
=
advertisingSpaceDao
.
getDTOByBookId
(
paramMap
);
if
(
ListUtils
.
isEmpty
(
list
))
{
return
new
ArrayList
<>();
}
if
(!
ListUtils
.
isEmpty
(
list
))
{
list
.
forEach
(
spaceDTO
->
spaceDTO
.
setBookId
(
bookId
));
}
return
list
;
}
/**
* 获取社群书配置的广告位信息
*/
@Override
@ParamLog
(
"获取社群书配置的广告位信息"
)
public
AdvertisingSpaceDTO
getBookGroupAd4Wechat
(
Long
bookGroupId
,
String
adPositionDetail
)
throws
BizException
{
BookGroupDTO
bookGroupDTO
=
bookGroupDao
.
getDTOById
(
bookGroupId
);
if
(
null
==
bookGroupDTO
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"该社群书不存在或已删除!"
);
}
Long
agentId
=
adviserConsr
.
getAgentIdByAdviser
(
bookGroupDTO
.
getCreateUser
());
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"bookId"
,
bookGroupDTO
.
getBookId
());
paramMap
.
put
(
"adviserId"
,
bookGroupDTO
.
getCreateUser
());
paramMap
.
put
(
"channelId"
,
bookGroupDTO
.
getChannelId
());
paramMap
.
put
(
"agentId"
,
agentId
);
Boolean
bookIsOpen
=
(
Boolean
)
advertisingAdviserPermissionDao
.
getBy
(
paramMap
,
"checkBookOpen"
);
if
(
null
==
bookIsOpen
||
!
bookIsOpen
)
{
return
new
AdvertisingSpaceDTO
();
}
AdvertisingSpaceDTO
spaceDTO
=
(
AdvertisingSpaceDTO
)
advertisingSpaceDao
.
getBy
(
paramMap
,
"getDTOByBookId"
);
paramMap
.
put
(
"adPositionDetail"
,
adPositionDetail
);
AdvertisingSpaceDTO
spaceDTO
=
(
AdvertisingSpaceDTO
)
advertisingSpaceDao
.
getBy
(
paramMap
,
"getDTOByBookId4BookGroup"
);
if
(
null
==
spaceDTO
)
{
spaceDTO
=
(
AdvertisingSpaceDTO
)
advertisingSpaceDao
.
getBy
(
paramMap
,
"getNoSignBookAd"
);
}
if
(
null
!=
spaceDTO
)
{
spaceDTO
.
setBookId
(
bookId
);
return
new
AdvertisingSpaceDTO
();
}
spaceDTO
.
setBookId
(
bookGroupDTO
.
getBookId
());
return
spaceDTO
;
}
...
...
@@ -572,8 +1509,18 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
||
advertisingExposureRecord
.
getFromId
()
<=
0L
)
{
return
;
}
AdvertisingSpace
space
=
advertisingSpaceDao
.
getById
(
advertisingExposureRecord
.
getAdId
());
if
(
null
==
space
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告位不存在或已删除!"
);
}
Long
agentId
=
channelConsr
.
getParentId
(
advertisingExposureRecord
.
getChannelId
());
advertisingExposureRecord
.
setAgentId
(
agentId
);
if
(
AdPositionEnum
.
BOOK_GROUP_PAGE
.
positionCode
.
equals
(
space
.
getAdPosition
()))
{
advertisingExposureRecord
.
setIsBookGroup
(
true
);
}
else
{
advertisingExposureRecord
.
setIsBookGroup
(
false
);
}
advertisingExposureRecord
.
setCount
(
1L
);
advertisingExposureRecordDao
.
insert
(
advertisingExposureRecord
);
}
...
...
@@ -587,8 +1534,252 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
||
advertisingClickRecord
.
getFromId
()
<=
0L
)
{
return
;
}
if
(
"WECHAT_GROUP"
.
equals
(
advertisingClickRecord
.
getFromType
()))
{
BookGroup
bookGroup
=
bookGroupDao
.
getById
(
advertisingClickRecord
.
getBookGroupId
());
if
(
null
==
bookGroup
)
{
return
;
}
advertisingClickRecord
.
setBookId
(
bookGroup
.
getBookId
());
advertisingClickRecord
.
setChannelId
(
bookGroup
.
getChannelId
());
advertisingClickRecord
.
setAdviserId
(
bookGroup
.
getCreateUser
());
}
AdvertisingSpace
space
=
advertisingSpaceDao
.
getById
(
advertisingClickRecord
.
getAdId
());
if
(
null
==
space
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告位不存在或已删除!"
);
}
Long
agentId
=
channelConsr
.
getParentId
(
advertisingClickRecord
.
getChannelId
());
advertisingClickRecord
.
setAgentId
(
agentId
);
if
(!
AdPositionEnum
.
APP_OR_PRODUCT
.
positionCode
.
equals
(
space
.
getAdPosition
()))
{
advertisingClickRecord
.
setIsBookGroup
(
true
);
}
else
{
advertisingClickRecord
.
setIsBookGroup
(
false
);
}
advertisingClickRecordDao
.
insert
(
advertisingClickRecord
);
}
/**
* 添加广告主
*/
@Override
@ParamLog
(
value
=
"添加广告主"
,
isAfterReturn
=
false
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
createMaster
(
AdvertisingMaster
advertisingMaster
)
throws
BizException
{
if
(
StringUtil
.
isEmpty
(
advertisingMaster
.
getMasterName
())
||
ListUtils
.
isEmpty
(
advertisingMaster
.
getSettlementMethodList
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
boolean
paramError
=
advertisingMaster
.
getSettlementMethodList
().
stream
().
anyMatch
(
method
->
StringUtil
.
isEmpty
(
method
.
getSettlementMethod
())
||
!
ArrayUtils
.
contains
(
SettlementMethodEnum
.
SETTLEMENT_METHOD_GATHER
,
method
.
getSettlementMethod
()));
if
(
paramError
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"masterName"
,
advertisingMaster
.
getMasterName
());
Boolean
nameExist
=
(
Boolean
)
advertisingMasterDao
.
getBy
(
paramMap
,
"checkMasterNameExist"
);
if
(
null
!=
nameExist
&&
nameExist
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告主已存在!"
);
}
advertisingMasterDao
.
insert
(
advertisingMaster
);
Long
masterId
=
advertisingMaster
.
getId
();
advertisingMaster
.
getSettlementMethodList
().
forEach
(
method
->
method
.
setMasterId
(
masterId
));
advertisingSettlementMethodDao
.
insert
(
advertisingMaster
.
getSettlementMethodList
());
}
/**
* 修改广告主
*/
@Override
@ParamLog
(
value
=
"修改广告主"
,
isAfterReturn
=
false
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateMaster
(
AdvertisingMaster
advertisingMaster
)
throws
BizException
{
if
(
null
==
advertisingMaster
.
getId
()
||
StringUtil
.
isEmpty
(
advertisingMaster
.
getMasterName
())
||
ListUtils
.
isEmpty
(
advertisingMaster
.
getSettlementMethodList
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
boolean
paramError
=
advertisingMaster
.
getSettlementMethodList
().
stream
().
anyMatch
(
method
->
StringUtil
.
isEmpty
(
method
.
getSettlementMethod
())
||
!
ArrayUtils
.
contains
(
SettlementMethodEnum
.
SETTLEMENT_METHOD_GATHER
,
method
.
getSettlementMethod
()));
if
(
paramError
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
Long
masterId
=
advertisingMaster
.
getId
();
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"masterName"
,
advertisingMaster
.
getMasterName
());
paramMap
.
put
(
"masterId"
,
masterId
);
Boolean
nameExist
=
(
Boolean
)
advertisingMasterDao
.
getBy
(
paramMap
,
"checkMasterNameExist"
);
if
(
null
!=
nameExist
&&
nameExist
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告主名称不能重复!"
);
}
advertisingMasterDao
.
update
(
advertisingMaster
);
// 删除广告主之前配置的结算方式
advertisingSettlementMethodDao
.
deleteByMasterId
(
masterId
);
advertisingMaster
.
getSettlementMethodList
().
forEach
(
method
->
method
.
setMasterId
(
masterId
));
advertisingSettlementMethodDao
.
insert
(
advertisingMaster
.
getSettlementMethodList
());
}
/**
* 获取广告主列表
*/
@Override
public
PageBean
getMasterList
(
PageParam
pageParam
,
String
masterName
)
throws
BizException
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"masterName"
,
masterName
);
PageBean
pageBean
=
advertisingMasterDao
.
listPage
(
pageParam
,
paramMap
,
"getMasterList"
);
if
(
pageBean
==
null
||
ListUtils
.
isEmpty
(
pageBean
.
getRecordList
()))
{
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
}
for
(
Object
object
:
pageBean
.
getRecordList
())
{
AdvertisingMasterDTO
masterDTO
=
(
AdvertisingMasterDTO
)
object
;
List
<
AdvertisingSettlementMethodDTO
>
methodDTOList
=
advertisingSettlementMethodDao
.
getByMasterId
(
masterDTO
.
getId
());
if
(!
ListUtils
.
isEmpty
(
methodDTOList
))
{
methodDTOList
.
forEach
(
dto
->
dto
.
setSettlementMethodName
(
SettlementMethodEnum
.
getNameByCode
(
dto
.
getSettlementMethod
())));
}
masterDTO
.
setSettlementMethodList
(
methodDTOList
);
Long
exposureNum
=
getExposureNumByMasterId
(
masterDTO
.
getId
());
masterDTO
.
setExposureNum
(
exposureNum
);
Long
clickNum
=
getClickNumByMasterId
(
masterDTO
.
getId
());
masterDTO
.
setClickNum
(
clickNum
);
BigDecimal
clickRate
=
(
null
==
masterDTO
.
getExposureNum
()
||
masterDTO
.
getExposureNum
().
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
masterDTO
.
getClickNum
().
doubleValue
()
/
masterDTO
.
getExposureNum
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
masterDTO
.
setClickRate
(
clickRate
);
BigDecimal
income
=
getIncomeByMasterId
(
masterDTO
.
getId
());
masterDTO
.
setTotalIncome
(
income
);
}
return
pageBean
;
}
/**
* 获取所有广告主
*/
@Override
public
List
<
AdvertisingMasterDTO
>
getAllMaster
()
throws
BizException
{
List
<
AdvertisingMasterDTO
>
list
=
advertisingMasterDao
.
getAllMaster
();
if
(!
ListUtils
.
isEmpty
(
list
))
{
for
(
AdvertisingMasterDTO
masterDTO
:
list
)
{
List
<
AdvertisingSettlementMethodDTO
>
methodDTOList
=
advertisingSettlementMethodDao
.
getByMasterId
(
masterDTO
.
getId
());
if
(!
ListUtils
.
isEmpty
(
methodDTOList
))
{
methodDTOList
.
forEach
(
dto
->
dto
.
setSettlementMethodName
(
SettlementMethodEnum
.
getNameByCode
(
dto
.
getSettlementMethod
())));
}
masterDTO
.
setSettlementMethodList
(
methodDTOList
);
}
}
return
list
;
}
/**
* 获取广告主信息
*/
@Override
public
AdvertisingMasterDTO
getMasterInfo
(
Long
masterId
)
throws
BizException
{
return
advertisingMasterDao
.
getDTOById
(
masterId
);
}
/**
* 每日凌晨计算昨日广告位收益
*/
@Override
@ParamLog
(
value
=
"每日凌晨计算昨日广告位收益"
,
isAfterReturn
=
false
)
public
void
calculateAdvertisingIncomeYesterday
()
throws
BizException
{
new
Thread
()
{
@Override
public
void
run
()
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"createDay"
,
DateNewUtils
.
getShortDateStr
(
DateNewUtils
.
addDay
(
new
Date
(),
-
1
)));
// 插入扫社群码页面和作品/应用广告位的昨日收益数据
advertisingIncomeDailyDao
.
insertRecordWithoutWechatGroupMsgAd
(
paramMap
);
// 插入微信群消息广告位的昨日收益数据
advertisingIncomeDailyDao
.
insertWechatGroupMsgAdRecord
(
paramMap
);
}
}.
start
();
}
/**
* 获取概览数据
*/
@Override
@ParamLog
(
"获取概览数据"
)
public
Map
<
String
,
Object
>
overviewStatis
()
throws
BizException
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"statis"
,
"all"
);
Long
advertisingSpaceNum
=
(
Long
)
advertisingSpaceDao
.
getBy
(
paramMap
,
"getSpaceNum"
);
result
.
put
(
"advertisingSpaceNum"
,
advertisingSpaceNum
);
Long
distributionBookNum
=
(
Long
)
advertisingDistributionBookDao
.
getBy
(
paramMap
,
"getDistributionBookNum"
);
result
.
put
(
"distributionBookNum"
,
distributionBookNum
);
Long
distributionWechatGroupNum
=
(
Long
)
advertisingDistributionBookDao
.
getBy
(
paramMap
,
"getDistributionWechatGroupNum"
);
result
.
put
(
"distributionWechatGroupNum"
,
distributionWechatGroupNum
);
Long
exposureNum
=
(
Long
)
advertisingExposureRecordDao
.
getBy
(
paramMap
,
"getTotalExposureNum"
);
result
.
put
(
"exposureNum"
,
exposureNum
);
Long
clickNum
=
(
Long
)
advertisingClickRecordDao
.
getBy
(
paramMap
,
"getTotalClickNum"
);
result
.
put
(
"clickNum"
,
clickNum
);
BigDecimal
clickRate
=
(
null
==
exposureNum
||
exposureNum
.
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
clickNum
.
doubleValue
()
/
exposureNum
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
result
.
put
(
"clickRate"
,
clickRate
);
BigDecimal
totalIncome
=
(
BigDecimal
)
advertisingIncomeDailyDao
.
getBy
(
paramMap
,
"getTotalIncome"
);
result
.
put
(
"totalIncome"
,
null
==
totalIncome
?
BigDecimal
.
ZERO
:
totalIncome
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
));
return
result
;
}
/**
* 获取流量趋势
*/
@Override
public
List
<
Object
>
getFlowStatisTrend
(
Integer
day
,
String
startDate
,
String
endDate
)
throws
BizException
{
if
(
null
==
day
&&
(
StringUtil
.
isEmpty
(
startDate
)
||
StringUtil
.
isEmpty
(
endDate
)))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
if
(!
StringUtil
.
isEmpty
(
startDate
)
&&
!
StringUtil
.
isEmpty
(
endDate
))
{
paramMap
.
put
(
"collectDates"
,
CommonUtils
.
collectLocalDates
(
startDate
,
endDate
));
paramMap
.
put
(
"startDate"
,
startDate
);
paramMap
.
put
(
"endDate"
,
endDate
);
}
else
{
Date
startTime
=
DateUtils
.
addDay
(
new
Date
(),
-
day
);
Date
endTime
=
DateUtils
.
addDay
(
new
Date
(),
-
1
);
paramMap
.
put
(
"collectDates"
,
CommonUtils
.
collectLocalDates
(
startTime
,
endTime
));
paramMap
.
put
(
"startDate"
,
DateNewUtils
.
getShortDateStr
(
startTime
));
paramMap
.
put
(
"endDate"
,
DateNewUtils
.
getShortDateStr
(
endTime
));
}
return
advertisingExposureRecordDao
.
listBy
(
paramMap
,
"getFlowStatisTrend"
);
}
/**
* 获取收益趋势
*/
@Override
public
List
<
Object
>
getIncomeStatisTrend
(
Integer
day
,
String
startDate
,
String
endDate
)
throws
BizException
{
if
(
null
==
day
&&
(
StringUtil
.
isEmpty
(
startDate
)
||
StringUtil
.
isEmpty
(
endDate
)))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
if
(!
StringUtil
.
isEmpty
(
startDate
)
&&
!
StringUtil
.
isEmpty
(
endDate
))
{
paramMap
.
put
(
"collectDates"
,
CommonUtils
.
collectLocalDates
(
startDate
,
endDate
));
}
else
{
Date
startTime
=
DateUtils
.
addDay
(
new
Date
(),
-
day
);
Date
endTime
=
DateUtils
.
addDay
(
new
Date
(),
-
1
);
paramMap
.
put
(
"collectDates"
,
CommonUtils
.
collectLocalDates
(
startTime
,
endTime
));
}
return
advertisingIncomeDailyDao
.
listBy
(
paramMap
,
"getIncomeStatisTrend"
);
}
/**
* 获取微信群信息
*/
@Override
public
AdGroupQrcodeDTO
getGroupQrcodeInfo
(
Long
qrcodeId
)
throws
BizException
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"qrcodeId"
,
qrcodeId
);
AdGroupQrcodeDTO
dto
=
(
AdGroupQrcodeDTO
)
groupQrcodeDao
.
getBy
(
paramMap
,
"getGroupQrcodeInfo4Ad"
);
if
(
null
==
dto
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"微信群不存在或已删除!"
);
}
Long
adviserId
=
dto
.
getAdviserId
();
String
adviserName
=
adviserConsr
.
getNameById
(
adviserId
);
dto
.
setAdviserName
(
adviserName
);
Long
agentId
=
adviserConsr
.
getAgentIdByAdviser
(
adviserId
);
if
(
null
!=
agentId
)
{
Map
<
Long
,
String
>
agentNameMap
=
agentConsr
.
getNames
(
Arrays
.
asList
(
agentId
));
if
(!
MapUtils
.
isEmpty
(
agentNameMap
)
&&
agentNameMap
.
containsKey
(
agentId
))
{
dto
.
setAgentName
(
agentNameMap
.
get
(
agentId
));
}
}
return
dto
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/AdvertisingClickRecordDao.java
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
dao
;
import
java.util.List
;
import
java.util.Map
;
import
com.pcloud.book.advertising.dto.WechatGroupClickUserDTO
;
import
com.pcloud.book.advertising.entity.AdvertisingClickRecord
;
import
com.pcloud.common.core.dao.BaseDao
;
...
...
@@ -9,4 +12,11 @@ import com.pcloud.common.core.dao.BaseDao;
* @date 2019/2/28
*/
public
interface
AdvertisingClickRecordDao
extends
BaseDao
<
AdvertisingClickRecord
>
{
/**
* 微信群广告位点击读者列表
* @param paramMap 参数Map
* @return
*/
List
<
WechatGroupClickUserDTO
>
clickUserList4AdvertisingWechatGroup
(
Map
<
String
,
Object
>
paramMap
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/AdvertisingDistributionBookDao.java
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
dao
;
import
java.util.List
;
import
java.util.Map
;
import
com.pcloud.book.advertising.entity.AdvertisingDistributionBook
;
import
com.pcloud.common.core.dao.BaseDao
;
...
...
@@ -19,11 +20,11 @@ public interface AdvertisingDistributionBookDao extends BaseDao<AdvertisingDistr
long
batchInsert
(
List
<
AdvertisingDistributionBook
>
list
);
/**
* 校验
书刊是否已投放
* @param
list 列表
* 校验
广告位是否已投放微信群
* @param
paramMap 参数Map
* @return
*/
List
<
Long
>
check
BookIdExist
(
List
<
Long
>
list
);
List
<
Long
>
check
QrcodeIdExist
(
Map
<
String
,
Object
>
paramMap
);
/**
* 获取广告位投放的书刊列表
...
...
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/AdvertisingExposureRecordDao.java
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
dao
;
import
java.util.List
;
import
com.pcloud.book.advertising.entity.AdvertisingExposureRecord
;
import
com.pcloud.book.group.dto.AdGroupQrcodeDTO
;
import
com.pcloud.common.core.dao.BaseDao
;
/**
...
...
@@ -9,4 +11,10 @@ import com.pcloud.common.core.dao.BaseDao;
* @date 2019/2/28
*/
public
interface
AdvertisingExposureRecordDao
extends
BaseDao
<
AdvertisingExposureRecord
>
{
/**
* 获取广告位投放微信群曝光量前几位
* @return
*/
List
<
AdGroupQrcodeDTO
>
advertisingWechatGroupRankTop
();
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/AdvertisingIncomeDailyDao.java
0 → 100644
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
dao
;
import
java.util.Map
;
import
com.pcloud.book.advertising.entity.AdvertisingIncomeDaily
;
import
com.pcloud.common.core.dao.BaseDao
;
/**
* Description 广告位每日收益统计数据访问层接口
* Created by PENG on 2019/5/6.
*/
public
interface
AdvertisingIncomeDailyDao
extends
BaseDao
<
AdvertisingIncomeDaily
>
{
/**
* 插入扫社群码页面和作品/应用广告位的昨日收益数据
* @param paramMap 参数Map
* @return
*/
long
insertRecordWithoutWechatGroupMsgAd
(
Map
<
String
,
Object
>
paramMap
);
/**
* 插入微信群消息广告位的昨日收益数据
* @param paramMap 参数Map
* @return
*/
long
insertWechatGroupMsgAdRecord
(
Map
<
String
,
Object
>
paramMap
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/AdvertisingMasterDao.java
0 → 100644
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
dao
;
import
java.util.List
;
import
com.pcloud.book.advertising.dto.AdvertisingMasterDTO
;
import
com.pcloud.book.advertising.entity.AdvertisingMaster
;
import
com.pcloud.common.core.dao.BaseDao
;
/**
* Description 广告主数据访问层接口
* Created by PENG on 2019/4/26.
*/
public
interface
AdvertisingMasterDao
extends
BaseDao
<
AdvertisingMaster
>
{
/**
* 获取所有广告主
* @return
*/
List
<
AdvertisingMasterDTO
>
getAllMaster
();
/**
* 获取广告主DTO
* @param masterId 广告主ID
* @return
*/
AdvertisingMasterDTO
getDTOById
(
Long
masterId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/AdvertisingSettlementMethodDao.java
0 → 100644
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
dao
;
import
java.util.List
;
import
com.pcloud.book.advertising.dto.AdvertisingSettlementMethodDTO
;
import
com.pcloud.book.advertising.entity.AdvertisingSettlementMethod
;
import
com.pcloud.common.core.dao.BaseDao
;
/**
* Description 广告结算方式数据访问层接口
* Created by PENG on 2019/4/26.
*/
public
interface
AdvertisingSettlementMethodDao
extends
BaseDao
<
AdvertisingSettlementMethod
>
{
/**
* 删除广告主配置的结算方式
* @param masterId 广告主ID
* @return
*/
long
deleteByMasterId
(
Long
masterId
);
/**
* 获取广告主配置的结算方式列表
* @param masterId 广告主ID
* @return
*/
List
<
AdvertisingSettlementMethodDTO
>
getByMasterId
(
Long
masterId
);
/**
* 获取广告位的结算方式
* @param masterId 广告主ID
* @param adId 广告位ID
* @return
*/
AdvertisingSettlementMethodDTO
getByMasterIdAndAdId
(
Long
masterId
,
Long
adId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/AdvertisingSpaceDao.java
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
dao
;
import
java.util.List
;
import
java.util.Map
;
import
com.pcloud.book.advertising.dto.AdvertisingSpaceDTO
;
import
com.pcloud.book.advertising.entity.AdvertisingSpace
;
import
com.pcloud.common.core.dao.BaseDao
;
...
...
@@ -17,4 +19,32 @@ public interface AdvertisingSpaceDao extends BaseDao<AdvertisingSpace> {
* @return
*/
AdvertisingSpaceDTO
getDTOById
(
Long
adId
);
/**
* 书刊广告位明细
* @param paramMap 参数Map
* @return
*/
List
<
AdvertisingSpaceDTO
>
advertisingDetail4Book
(
Map
<
String
,
Object
>
paramMap
);
/**
* 微信群广告位明细
* @param paramMap 参数Map
* @return
*/
List
<
AdvertisingSpaceDTO
>
advertisingDetail4WechatGroup
(
Map
<
String
,
Object
>
paramMap
);
/**
* 广告主广告位明细
* @param paramMap 参数Map
* @return
*/
List
<
AdvertisingSpaceDTO
>
advertisingDetail4Master
(
Map
<
String
,
Object
>
paramMap
);
/**
* 获取书刊下的广告位列表
* @param paramMap 参数Map
* @return
*/
List
<
AdvertisingSpaceDTO
>
getDTOByBookId
(
Map
<
String
,
Object
>
paramMap
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/impl/AdvertisingClickRecordDaoImpl.java
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
dao
.
impl
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.stereotype.Repository
;
import
com.pcloud.book.advertising.dao.AdvertisingClickRecordDao
;
import
com.pcloud.book.advertising.dto.WechatGroupClickUserDTO
;
import
com.pcloud.book.advertising.entity.AdvertisingClickRecord
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
...
...
@@ -12,4 +15,12 @@ import com.pcloud.common.core.dao.BaseDaoImpl;
*/
@Repository
(
"advertisingClickRecordDao"
)
public
class
AdvertisingClickRecordDaoImpl
extends
BaseDaoImpl
<
AdvertisingClickRecord
>
implements
AdvertisingClickRecordDao
{
/**
* 微信群广告位点击读者列表
*/
@Override
public
List
<
WechatGroupClickUserDTO
>
clickUserList4AdvertisingWechatGroup
(
Map
<
String
,
Object
>
paramMap
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"clickUserList4AdvertisingWechatGroup"
),
paramMap
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/impl/AdvertisingDistributionBookDaoImpl.java
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
dao
.
impl
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.stereotype.Repository
;
import
com.pcloud.book.advertising.dao.AdvertisingDistributionBookDao
;
import
com.pcloud.book.advertising.entity.AdvertisingDistributionBook
;
...
...
@@ -23,11 +24,11 @@ public class AdvertisingDistributionBookDaoImpl extends BaseDaoImpl<AdvertisingD
}
/**
* 校验
书刊是否已投放
* 校验
广告位是否已投放微信群
*/
@Override
public
List
<
Long
>
check
BookIdExist
(
List
<
Long
>
list
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"check
BookIdExist"
),
list
);
public
List
<
Long
>
check
QrcodeIdExist
(
Map
<
String
,
Object
>
paramMap
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"check
QrcodeIdExist"
),
paramMap
);
}
/**
...
...
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/impl/AdvertisingExposureRecordDaoImpl.java
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
dao
.
impl
;
import
java.util.List
;
import
org.springframework.stereotype.Repository
;
import
com.pcloud.book.advertising.dao.AdvertisingExposureRecordDao
;
import
com.pcloud.book.advertising.entity.AdvertisingExposureRecord
;
import
com.pcloud.book.group.dto.AdGroupQrcodeDTO
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
/**
...
...
@@ -12,4 +14,12 @@ import com.pcloud.common.core.dao.BaseDaoImpl;
*/
@Repository
(
"advertisingExposureRecordDao"
)
public
class
AdvertisingExposureRecordDaoImpl
extends
BaseDaoImpl
<
AdvertisingExposureRecord
>
implements
AdvertisingExposureRecordDao
{
/**
* 获取广告位投放微信群曝光量前几位
*/
@Override
public
List
<
AdGroupQrcodeDTO
>
advertisingWechatGroupRankTop
()
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"advertisingWechatGroupRankTop"
));
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/impl/AdvertisingIncomeDailyDaoImpl.java
0 → 100644
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
dao
.
impl
;
import
java.util.Map
;
import
org.springframework.stereotype.Repository
;
import
com.pcloud.book.advertising.dao.AdvertisingIncomeDailyDao
;
import
com.pcloud.book.advertising.entity.AdvertisingIncomeDaily
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
/**
* Description 广告位每日收益统计数据访问层接口实现类
* Created by PENG on 2019/5/6.
*/
@Repository
(
"advertisingIncomeDailyDao"
)
public
class
AdvertisingIncomeDailyDaoImpl
extends
BaseDaoImpl
<
AdvertisingIncomeDaily
>
implements
AdvertisingIncomeDailyDao
{
/**
* 插入扫社群码页面和作品/应用广告位的昨日收益数据
*/
@Override
public
long
insertRecordWithoutWechatGroupMsgAd
(
Map
<
String
,
Object
>
paramMap
)
{
return
super
.
getSqlSession
().
insert
(
getStatement
(
"insertRecordWithoutWechatGroupMsgAd"
),
paramMap
);
}
/**
* 插入微信群消息广告位的昨日收益数据
*/
@Override
public
long
insertWechatGroupMsgAdRecord
(
Map
<
String
,
Object
>
paramMap
)
{
return
super
.
getSqlSession
().
insert
(
getStatement
(
"insertWechatGroupMsgAdRecord"
),
paramMap
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/impl/AdvertisingMasterDaoImpl.java
0 → 100644
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
dao
.
impl
;
import
java.util.List
;
import
org.springframework.stereotype.Repository
;
import
com.pcloud.book.advertising.dao.AdvertisingMasterDao
;
import
com.pcloud.book.advertising.dto.AdvertisingMasterDTO
;
import
com.pcloud.book.advertising.entity.AdvertisingMaster
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
/**
* Description 广告主数据访问层接口实现类
* Created by PENG on 2019/4/26.
*/
@Repository
(
"advertisingMasterDao"
)
public
class
AdvertisingMasterDaoImpl
extends
BaseDaoImpl
<
AdvertisingMaster
>
implements
AdvertisingMasterDao
{
/**
* 获取所有广告主
*/
@Override
public
List
<
AdvertisingMasterDTO
>
getAllMaster
()
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getAllMaster"
));
}
/**
* 获取广告主DTO
*/
@Override
public
AdvertisingMasterDTO
getDTOById
(
Long
masterId
)
{
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getDTOById"
),
masterId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/impl/AdvertisingSettlementMethodDaoImpl.java
0 → 100644
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
dao
.
impl
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.stereotype.Repository
;
import
com.pcloud.book.advertising.dao.AdvertisingSettlementMethodDao
;
import
com.pcloud.book.advertising.dto.AdvertisingSettlementMethodDTO
;
import
com.pcloud.book.advertising.entity.AdvertisingSettlementMethod
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
/**
* Description 广告结算方式数据访问层接口实现类
* Created by PENG on 2019/4/26.
*/
@Repository
(
"advertisingSettlementMethodDao"
)
public
class
AdvertisingSettlementMethodDaoImpl
extends
BaseDaoImpl
<
AdvertisingSettlementMethod
>
implements
AdvertisingSettlementMethodDao
{
/**
* 删除广告主配置的结算方式
*/
@Override
public
long
deleteByMasterId
(
Long
masterId
)
{
return
super
.
getSqlSession
().
delete
(
getStatement
(
"deleteByMasterId"
),
masterId
);
}
/**
* 获取广告主配置的结算方式列表
*/
@Override
public
List
<
AdvertisingSettlementMethodDTO
>
getByMasterId
(
Long
masterId
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getByMasterId"
),
masterId
);
}
/**
* 获取广告位的结算方式
*/
@Override
public
AdvertisingSettlementMethodDTO
getByMasterIdAndAdId
(
Long
masterId
,
Long
adId
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"masterId"
,
masterId
);
paramMap
.
put
(
"adId"
,
adId
);
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getByMasterIdAndAdId"
),
paramMap
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/impl/AdvertisingSpaceDaoImpl.java
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
dao
.
impl
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.stereotype.Repository
;
import
com.pcloud.book.advertising.dao.AdvertisingSpaceDao
;
import
com.pcloud.book.advertising.dto.AdvertisingSpaceDTO
;
...
...
@@ -14,8 +16,43 @@ import com.pcloud.common.core.dao.BaseDaoImpl;
@Repository
(
"advertisingSpaceDao"
)
public
class
AdvertisingSpaceDaoImpl
extends
BaseDaoImpl
<
AdvertisingSpace
>
implements
AdvertisingSpaceDao
{
/**
* 获取广告位信息
*/
@Override
public
AdvertisingSpaceDTO
getDTOById
(
Long
adId
)
{
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getDTOById"
),
adId
);
}
/**
* 书刊广告位明细
*/
@Override
public
List
<
AdvertisingSpaceDTO
>
advertisingDetail4Book
(
Map
<
String
,
Object
>
paramMap
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"advertisingDetail4Book"
),
paramMap
);
}
/**
* 微信群广告位明细
*/
@Override
public
List
<
AdvertisingSpaceDTO
>
advertisingDetail4WechatGroup
(
Map
<
String
,
Object
>
paramMap
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"advertisingDetail4WechatGroup"
),
paramMap
);
}
/**
* 广告主广告位明细
*/
@Override
public
List
<
AdvertisingSpaceDTO
>
advertisingDetail4Master
(
Map
<
String
,
Object
>
paramMap
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"advertisingDetail4Master"
),
paramMap
);
}
/**
* 获取书刊下的广告位列表
*/
@Override
public
List
<
AdvertisingSpaceDTO
>
getDTOByBookId
(
Map
<
String
,
Object
>
paramMap
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getDTOByBookId"
),
paramMap
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dto/AdvertisingMasterDTO.java
0 → 100644
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
dto
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.dto.BaseDto
;
public
class
AdvertisingMasterDTO
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
-
2269268659722737438L
;
/**
* advertising_master.id (唯一标识)
*/
private
Long
id
;
/**
* advertising_master.master_name (广告主名称)
*/
private
String
masterName
;
/**
* advertising_master.create_time (创建时间)
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
/**
* advertising_master.update_time (修改时间)
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
updateTime
;
/**
* 广告结算方式列表
*/
private
List
<
AdvertisingSettlementMethodDTO
>
settlementMethodList
;
/**
* 广告位数量
*/
private
Long
spaceNum
;
/**
* 曝光量
*/
private
Long
exposureNum
;
/**
* 点击量
*/
private
Long
clickNum
;
/**
* 点击率
*/
private
BigDecimal
clickRate
;
/**
* 累积消费
*/
private
BigDecimal
totalIncome
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
String
getMasterName
()
{
return
masterName
;
}
public
void
setMasterName
(
String
masterName
)
{
this
.
masterName
=
masterName
;
}
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
List
<
AdvertisingSettlementMethodDTO
>
getSettlementMethodList
()
{
return
settlementMethodList
;
}
public
void
setSettlementMethodList
(
List
<
AdvertisingSettlementMethodDTO
>
settlementMethodList
)
{
this
.
settlementMethodList
=
settlementMethodList
;
}
public
Long
getSpaceNum
()
{
return
spaceNum
;
}
public
void
setSpaceNum
(
Long
spaceNum
)
{
this
.
spaceNum
=
spaceNum
;
}
public
Long
getExposureNum
()
{
return
exposureNum
;
}
public
void
setExposureNum
(
Long
exposureNum
)
{
this
.
exposureNum
=
exposureNum
;
}
public
Long
getClickNum
()
{
return
clickNum
;
}
public
void
setClickNum
(
Long
clickNum
)
{
this
.
clickNum
=
clickNum
;
}
public
BigDecimal
getClickRate
()
{
return
clickRate
;
}
public
void
setClickRate
(
BigDecimal
clickRate
)
{
this
.
clickRate
=
clickRate
;
}
public
BigDecimal
getTotalIncome
()
{
return
totalIncome
;
}
public
void
setTotalIncome
(
BigDecimal
totalIncome
)
{
this
.
totalIncome
=
totalIncome
;
}
@Override
public
String
toString
()
{
return
"AdvertisingMasterDTO{"
+
"id="
+
id
+
", masterName='"
+
masterName
+
'\''
+
", createTime="
+
createTime
+
", updateTime="
+
updateTime
+
", settlementMethodList="
+
settlementMethodList
+
", spaceNum="
+
spaceNum
+
", exposureNum="
+
exposureNum
+
", clickNum="
+
clickNum
+
", clickRate="
+
clickRate
+
", totalIncome="
+
totalIncome
+
"} "
+
super
.
toString
();
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dto/AdvertisingSettlementMethodDTO.java
0 → 100644
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
dto
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.dto.BaseDto
;
public
class
AdvertisingSettlementMethodDTO
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
8723754417913443287L
;
/**
* advertising_settlement_method.id (唯一标识)
*/
private
Long
id
;
/**
* advertising_settlement_method.master_id (广告主ID)
*/
private
Long
masterId
;
/**
* advertising_settlement_method.ad_id (广告位ID)
*/
private
Long
adId
;
/**
* advertising_settlement_method.settlement_method (结算方式)
*/
private
String
settlementMethod
;
/**
* 结算方式名称
*/
private
String
settlementMethodName
;
/**
* advertising_settlement_method.price_each_time (每次价格)
*/
private
BigDecimal
priceEachTime
;
/**
* advertising_settlement_method.create_time (创建时间)
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
/**
* advertising_settlement_method.update_time (修改时间)
*/
@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
Long
getMasterId
()
{
return
masterId
;
}
public
void
setMasterId
(
Long
masterId
)
{
this
.
masterId
=
masterId
;
}
public
Long
getAdId
()
{
return
adId
;
}
public
void
setAdId
(
Long
adId
)
{
this
.
adId
=
adId
;
}
public
String
getSettlementMethod
()
{
return
settlementMethod
;
}
public
void
setSettlementMethod
(
String
settlementMethod
)
{
this
.
settlementMethod
=
settlementMethod
;
}
public
String
getSettlementMethodName
()
{
return
settlementMethodName
;
}
public
void
setSettlementMethodName
(
String
settlementMethodName
)
{
this
.
settlementMethodName
=
settlementMethodName
;
}
public
BigDecimal
getPriceEachTime
()
{
return
priceEachTime
;
}
public
void
setPriceEachTime
(
BigDecimal
priceEachTime
)
{
this
.
priceEachTime
=
priceEachTime
;
}
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
@Override
public
String
toString
()
{
return
"AdvertisingSettlementMethodDTO{"
+
"id="
+
id
+
", masterId="
+
masterId
+
", adId="
+
adId
+
", settlementMethod='"
+
settlementMethod
+
'\''
+
", settlementMethodName='"
+
settlementMethodName
+
'\''
+
", priceEachTime="
+
priceEachTime
+
", createTime="
+
createTime
+
", updateTime="
+
updateTime
+
"} "
+
super
.
toString
();
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dto/AdvertisingSpaceDTO.java
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
dto
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.dto.BaseDto
;
...
...
@@ -27,44 +28,54 @@ public class AdvertisingSpaceDTO extends BaseDto {
private
String
adPosition
;
/**
* advertising_space.ad_
source (广告来源
)
* advertising_space.ad_
position_mode (广告位置方式
)
*/
private
String
ad
Sourc
e
;
private
String
ad
PositionMod
e
;
/**
* advertising_space.ad_
link (广告位链接
)
* advertising_space.ad_
position_detail (具体广告位置
)
*/
private
String
ad
Link
;
private
String
ad
PositionDetail
;
/**
*
advertising_space.source_id (对方id)
*
广告位置名称
*/
private
String
sourceId
;
private
String
adPositionName
;
/**
* advertising_space.
ad_slogan (广告位文案
)
* advertising_space.
master_id (广告主ID
)
*/
private
String
adSlogan
;
private
Long
masterId
;
/**
*
advertising_space.ad_pic (广告位图片)
*
广告主名称
*/
private
String
adPic
;
private
String
masterName
;
/**
* advertising_space.
distribution_type (投放方式(0:指定书刊;1:不指定书刊)
)
* advertising_space.
ad_link (广告位链接
)
*/
private
Integer
distributionType
;
private
String
adLink
;
/**
* advertising_space.
exposure_num (曝光量
)
* advertising_space.
source_id (对方id
)
*/
private
Long
exposureNum
;
private
String
sourceId
;
/**
* advertising_space.
click_num (点击量
)
* advertising_space.
ad_title (广告位标题
)
*/
private
Long
clickNum
;
private
String
adTitle
;
/**
* advertising_space.ad_slogan (广告位文案)
*/
private
String
adSlogan
;
/**
* advertising_space.ad_pic (广告位图片)
*/
private
String
adPic
;
/**
* advertising_space.create_time (创建时间)
...
...
@@ -98,6 +109,87 @@ public class AdvertisingSpaceDTO extends BaseDto {
*/
private
Long
bookId
;
/**
* 曝光量
*/
private
Long
exposureNum
;
/**
* 点击量
*/
private
Long
clickNum
;
/**
* 点击读者量
*/
private
Long
clickUserNum
;
/**
* 点击率
*/
private
BigDecimal
clickRate
;
/**
* 累积消费
*/
private
BigDecimal
totalIncome
;
/**
* 结算方式
*/
private
String
settlementMethod
;
/**
* 结算方式名称
*/
private
String
settlementMethodName
;
/**
* 每次价格
*/
private
BigDecimal
priceEachTime
;
/**
* 投放时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
distributionTime
;
/**
* 微信群ID
*/
private
Long
qrcodeId
;
/**
* 微信群名称
*/
private
String
groupQrcodeName
;
/**
* 书号
*/
private
String
isbn
;
/**
* 出版社ID
*/
private
Long
agentId
;
/**
* 出版社名称
*/
private
String
agentName
;
/**
* 编辑ID
*/
private
Long
adviserId
;
/**
* 运营ID
*/
private
Long
channelId
;
public
Long
getId
()
{
return
id
;
}
...
...
@@ -122,14 +214,6 @@ public class AdvertisingSpaceDTO extends BaseDto {
this
.
adPosition
=
adPosition
;
}
public
String
getAdSource
()
{
return
adSource
;
}
public
void
setAdSource
(
String
adSource
)
{
this
.
adSource
=
adSource
;
}
public
String
getAdLink
()
{
return
adLink
;
}
...
...
@@ -162,14 +246,6 @@ public class AdvertisingSpaceDTO extends BaseDto {
this
.
adPic
=
adPic
;
}
public
Integer
getDistributionType
()
{
return
distributionType
;
}
public
void
setDistributionType
(
Integer
distributionType
)
{
this
.
distributionType
=
distributionType
;
}
public
Long
getExposureNum
()
{
return
exposureNum
;
}
...
...
@@ -236,26 +312,205 @@ public class AdvertisingSpaceDTO extends BaseDto {
this
.
bookId
=
bookId
;
}
public
String
getAdPositionMode
()
{
return
adPositionMode
;
}
public
void
setAdPositionMode
(
String
adPositionMode
)
{
this
.
adPositionMode
=
adPositionMode
;
}
public
String
getAdPositionDetail
()
{
return
adPositionDetail
;
}
public
void
setAdPositionDetail
(
String
adPositionDetail
)
{
this
.
adPositionDetail
=
adPositionDetail
;
}
public
Long
getMasterId
()
{
return
masterId
;
}
public
void
setMasterId
(
Long
masterId
)
{
this
.
masterId
=
masterId
;
}
public
String
getAdTitle
()
{
return
adTitle
;
}
public
void
setAdTitle
(
String
adTitle
)
{
this
.
adTitle
=
adTitle
;
}
public
String
getMasterName
()
{
return
masterName
;
}
public
void
setMasterName
(
String
masterName
)
{
this
.
masterName
=
masterName
;
}
public
BigDecimal
getClickRate
()
{
return
clickRate
;
}
public
void
setClickRate
(
BigDecimal
clickRate
)
{
this
.
clickRate
=
clickRate
;
}
public
BigDecimal
getTotalIncome
()
{
return
totalIncome
;
}
public
void
setTotalIncome
(
BigDecimal
totalIncome
)
{
this
.
totalIncome
=
totalIncome
;
}
public
String
getSettlementMethod
()
{
return
settlementMethod
;
}
public
void
setSettlementMethod
(
String
settlementMethod
)
{
this
.
settlementMethod
=
settlementMethod
;
}
public
String
getSettlementMethodName
()
{
return
settlementMethodName
;
}
public
void
setSettlementMethodName
(
String
settlementMethodName
)
{
this
.
settlementMethodName
=
settlementMethodName
;
}
public
BigDecimal
getPriceEachTime
()
{
return
priceEachTime
;
}
public
void
setPriceEachTime
(
BigDecimal
priceEachTime
)
{
this
.
priceEachTime
=
priceEachTime
;
}
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
public
Date
getDistributionTime
()
{
return
distributionTime
;
}
public
void
setDistributionTime
(
Date
distributionTime
)
{
this
.
distributionTime
=
distributionTime
;
}
public
String
getAdPositionName
()
{
return
adPositionName
;
}
public
void
setAdPositionName
(
String
adPositionName
)
{
this
.
adPositionName
=
adPositionName
;
}
public
Long
getQrcodeId
()
{
return
qrcodeId
;
}
public
void
setQrcodeId
(
Long
qrcodeId
)
{
this
.
qrcodeId
=
qrcodeId
;
}
public
String
getGroupQrcodeName
()
{
return
groupQrcodeName
;
}
public
void
setGroupQrcodeName
(
String
groupQrcodeName
)
{
this
.
groupQrcodeName
=
groupQrcodeName
;
}
public
String
getIsbn
()
{
return
isbn
;
}
public
void
setIsbn
(
String
isbn
)
{
this
.
isbn
=
isbn
;
}
public
Long
getAgentId
()
{
return
agentId
;
}
public
void
setAgentId
(
Long
agentId
)
{
this
.
agentId
=
agentId
;
}
public
String
getAgentName
()
{
return
agentName
;
}
public
void
setAgentName
(
String
agentName
)
{
this
.
agentName
=
agentName
;
}
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
getClickUserNum
()
{
return
clickUserNum
;
}
public
void
setClickUserNum
(
Long
clickUserNum
)
{
this
.
clickUserNum
=
clickUserNum
;
}
@Override
public
String
toString
()
{
return
"AdvertisingSpaceDTO{"
+
"id="
+
id
+
", adName='"
+
adName
+
'\''
+
", adPosition='"
+
adPosition
+
'\''
+
", adSource='"
+
adSource
+
'\''
+
", adPositionMode='"
+
adPositionMode
+
'\''
+
", adPositionDetail='"
+
adPositionDetail
+
'\''
+
", adPositionName='"
+
adPositionName
+
'\''
+
", masterId="
+
masterId
+
", masterName='"
+
masterName
+
'\''
+
", adLink='"
+
adLink
+
'\''
+
", sourceId='"
+
sourceId
+
'\''
+
", adTitle='"
+
adTitle
+
'\''
+
", adSlogan='"
+
adSlogan
+
'\''
+
", adPic='"
+
adPic
+
'\''
+
", distributionType="
+
distributionType
+
", exposureNum="
+
exposureNum
+
", clickNum="
+
clickNum
+
", createTime="
+
createTime
+
", updateTime="
+
updateTime
+
", isOpen="
+
isOpen
+
", bookNum="
+
bookNum
+
", bookName='"
+
bookName
+
'\''
+
", bookId="
+
bookId
+
", exposureNum="
+
exposureNum
+
", clickNum="
+
clickNum
+
", clickUserNum="
+
clickUserNum
+
", clickRate="
+
clickRate
+
", totalIncome="
+
totalIncome
+
", settlementMethod='"
+
settlementMethod
+
'\''
+
", settlementMethodName='"
+
settlementMethodName
+
'\''
+
", priceEachTime="
+
priceEachTime
+
", distributionTime="
+
distributionTime
+
", qrcodeId="
+
qrcodeId
+
", groupQrcodeName='"
+
groupQrcodeName
+
'\''
+
", isbn='"
+
isbn
+
'\''
+
", agentId="
+
agentId
+
", agentName='"
+
agentName
+
'\''
+
", adviserId="
+
adviserId
+
", channelId="
+
channelId
+
"} "
+
super
.
toString
();
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dto/DateCountDTO.java
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
dto
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
/**
* @description 日期数量DTO
...
...
@@ -8,6 +10,7 @@ import java.io.Serializable;
* @date 2017年6月11日 下午2:08:30
* @version 1.0
*/
@JsonInclude
(
value
=
JsonInclude
.
Include
.
NON_NULL
)
public
class
DateCountDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
4234798666223706295L
;
...
...
@@ -27,6 +30,11 @@ public class DateCountDTO implements Serializable {
*/
private
Long
clickNum
;
/**
* 收益
*/
private
BigDecimal
income
;
public
String
getDate
()
{
return
date
;
}
...
...
@@ -50,4 +58,22 @@ public class DateCountDTO implements Serializable {
public
void
setClickNum
(
Long
clickNum
)
{
this
.
clickNum
=
clickNum
;
}
public
BigDecimal
getIncome
()
{
return
income
;
}
public
void
setIncome
(
BigDecimal
income
)
{
this
.
income
=
income
;
}
@Override
public
String
toString
()
{
return
"DateCountDTO{"
+
"date='"
+
date
+
'\''
+
", exposureNum="
+
exposureNum
+
", clickNum="
+
clickNum
+
", income="
+
income
+
'}'
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dto/WechatGroupClickUserDTO.java
0 → 100644
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
dto
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.dto.BaseDto
;
/**
* @author PENG
*/
public
class
WechatGroupClickUserDTO
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
-
2385429387988628595L
;
/**
* 广告位ID
*/
private
Long
adId
;
/**
* 公众号ID
*/
private
Long
officialAccountId
;
/**
* 来源类型
*/
private
String
fromType
;
/**
* 来源ID
*/
private
Long
fromId
;
/**
* 读者ID
*/
private
Long
wechatUserId
;
/**
* 读者昵称
*/
private
String
wechatUserName
;
/**
* 读者头像
*/
private
String
wechatUserHeadurl
;
/**
* 性别
*/
private
Integer
wechatUserSex
;
/**
* 省份
*/
private
String
wechatUserProvince
;
/**
* 城市
*/
private
String
wechatUserCity
;
/**
* 创建时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
public
Long
getAdId
()
{
return
adId
;
}
public
void
setAdId
(
Long
adId
)
{
this
.
adId
=
adId
;
}
public
Long
getOfficialAccountId
()
{
return
officialAccountId
;
}
public
void
setOfficialAccountId
(
Long
officialAccountId
)
{
this
.
officialAccountId
=
officialAccountId
;
}
public
String
getFromType
()
{
return
fromType
;
}
public
void
setFromType
(
String
fromType
)
{
this
.
fromType
=
fromType
;
}
public
Long
getFromId
()
{
return
fromId
;
}
public
void
setFromId
(
Long
fromId
)
{
this
.
fromId
=
fromId
;
}
public
Long
getWechatUserId
()
{
return
wechatUserId
;
}
public
void
setWechatUserId
(
Long
wechatUserId
)
{
this
.
wechatUserId
=
wechatUserId
;
}
public
String
getWechatUserName
()
{
return
wechatUserName
;
}
public
void
setWechatUserName
(
String
wechatUserName
)
{
this
.
wechatUserName
=
wechatUserName
;
}
public
String
getWechatUserHeadurl
()
{
return
wechatUserHeadurl
;
}
public
void
setWechatUserHeadurl
(
String
wechatUserHeadurl
)
{
this
.
wechatUserHeadurl
=
wechatUserHeadurl
;
}
public
Integer
getWechatUserSex
()
{
return
wechatUserSex
;
}
public
void
setWechatUserSex
(
Integer
wechatUserSex
)
{
this
.
wechatUserSex
=
wechatUserSex
;
}
public
String
getWechatUserProvince
()
{
return
wechatUserProvince
;
}
public
void
setWechatUserProvince
(
String
wechatUserProvince
)
{
this
.
wechatUserProvince
=
wechatUserProvince
;
}
public
String
getWechatUserCity
()
{
return
wechatUserCity
;
}
public
void
setWechatUserCity
(
String
wechatUserCity
)
{
this
.
wechatUserCity
=
wechatUserCity
;
}
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
@Override
public
String
toString
()
{
return
"WechatGroupClickUserDTO{"
+
"adId="
+
adId
+
", officialAccountId="
+
officialAccountId
+
", fromType='"
+
fromType
+
'\''
+
", fromId="
+
fromId
+
", wechatUserId="
+
wechatUserId
+
", wechatUserName='"
+
wechatUserName
+
'\''
+
", wechatUserHeadurl='"
+
wechatUserHeadurl
+
'\''
+
", wechatUserSex="
+
wechatUserSex
+
", wechatUserProvince='"
+
wechatUserProvince
+
'\''
+
", wechatUserCity='"
+
wechatUserCity
+
'\''
+
", createTime="
+
createTime
+
"} "
+
super
.
toString
();
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/entity/AdvertisingClickRecord.java
View file @
e991c8ed
...
...
@@ -26,6 +26,11 @@ public class AdvertisingClickRecord extends BaseEntity {
private
Long
bookId
;
/**
* advertising_click_record.is_book_group (是否是社群书)
*/
private
Boolean
isBookGroup
;
/**
* 二维码ID
*/
private
Long
sceneId
;
...
...
@@ -75,6 +80,16 @@ public class AdvertisingClickRecord extends BaseEntity {
*/
private
Date
createDay
;
/**
* 创建月份
*/
private
String
createMonth
;
/**
* 社群码ID
*/
private
Long
bookGroupId
;
@Override
public
Long
getId
()
{
return
id
;
...
...
@@ -101,6 +116,14 @@ public class AdvertisingClickRecord extends BaseEntity {
this
.
bookId
=
bookId
;
}
public
Boolean
getIsBookGroup
()
{
return
isBookGroup
;
}
public
void
setIsBookGroup
(
Boolean
isBookGroup
)
{
this
.
isBookGroup
=
isBookGroup
;
}
public
Long
getAdviserId
()
{
return
adviserId
;
}
...
...
@@ -183,12 +206,29 @@ public class AdvertisingClickRecord extends BaseEntity {
this
.
sceneId
=
sceneId
;
}
public
String
getCreateMonth
()
{
return
createMonth
;
}
public
void
setCreateMonth
(
String
createMonth
)
{
this
.
createMonth
=
createMonth
;
}
public
Long
getBookGroupId
()
{
return
bookGroupId
;
}
public
void
setBookGroupId
(
Long
bookGroupId
)
{
this
.
bookGroupId
=
bookGroupId
;
}
@Override
public
String
toString
()
{
return
"AdvertisingClickRecord{"
+
"id="
+
id
+
", adId="
+
adId
+
", bookId="
+
bookId
+
", isBookGroup="
+
isBookGroup
+
", sceneId="
+
sceneId
+
", adviserId="
+
adviserId
+
", agentId="
+
agentId
+
...
...
@@ -199,6 +239,8 @@ public class AdvertisingClickRecord extends BaseEntity {
", wechatUserId="
+
wechatUserId
+
", createTime="
+
createTime
+
", createDay="
+
createDay
+
", createMonth='"
+
createMonth
+
'\''
+
", bookGroupId="
+
bookGroupId
+
"} "
+
super
.
toString
();
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/entity/AdvertisingDistributionBook.java
View file @
e991c8ed
...
...
@@ -43,19 +43,34 @@ public class AdvertisingDistributionBook extends BaseEntity {
private
Long
channelId
;
/**
* advertising_distribution_book.is_book_group (是否是社群书)
*/
private
Boolean
isBookGroup
;
/**
* advertising_distribution_book.classify_id (群分类ID)
*/
private
Long
classifyId
;
/**
* advertising_distribution_book.qrcode_id (微信群ID)
*/
private
Long
qrcodeId
;
/**
* advertising_distribution_book.distribution_time (投放时间)
*/
private
Date
distributionTime
;
/**
* 书刊
ID
列表
* 书刊列表
*/
private
List
<
BookAdviser
>
books
;
/**
*
投放方式(0:指定书刊;1:不指定书刊)
*
微信群列表
*/
private
Integer
distributionType
;
private
List
<
DistributionWechatGroup
>
groups
;
@Override
public
Long
getId
()
{
...
...
@@ -107,6 +122,30 @@ public class AdvertisingDistributionBook extends BaseEntity {
this
.
channelId
=
channelId
;
}
public
Boolean
getIsBookGroup
()
{
return
isBookGroup
;
}
public
void
setIsBookGroup
(
Boolean
isBookGroup
)
{
this
.
isBookGroup
=
isBookGroup
;
}
public
Long
getClassifyId
()
{
return
classifyId
;
}
public
void
setClassifyId
(
Long
classifyId
)
{
this
.
classifyId
=
classifyId
;
}
public
Long
getQrcodeId
()
{
return
qrcodeId
;
}
public
void
setQrcodeId
(
Long
qrcodeId
)
{
this
.
qrcodeId
=
qrcodeId
;
}
public
Date
getDistributionTime
()
{
return
distributionTime
;
}
...
...
@@ -123,12 +162,12 @@ public class AdvertisingDistributionBook extends BaseEntity {
this
.
books
=
books
;
}
public
Integer
getDistributionType
()
{
return
distributionType
;
public
List
<
DistributionWechatGroup
>
getGroups
()
{
return
groups
;
}
public
void
set
DistributionType
(
Integer
distributionType
)
{
this
.
distributionType
=
distributionType
;
public
void
set
Groups
(
List
<
DistributionWechatGroup
>
groups
)
{
this
.
groups
=
groups
;
}
@Override
...
...
@@ -140,9 +179,12 @@ public class AdvertisingDistributionBook extends BaseEntity {
", adviserId="
+
adviserId
+
", agentId="
+
agentId
+
", channelId="
+
channelId
+
", isBookGroup="
+
isBookGroup
+
", classifyId="
+
classifyId
+
", qrcodeId="
+
qrcodeId
+
", distributionTime="
+
distributionTime
+
", books="
+
books
+
",
distributionType="
+
distributionType
+
",
groups="
+
groups
+
"} "
+
super
.
toString
();
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/entity/AdvertisingExposureRecord.java
View file @
e991c8ed
...
...
@@ -26,6 +26,11 @@ public class AdvertisingExposureRecord extends BaseEntity {
private
Long
bookId
;
/**
* advertising_exposure_record.is_book_group (是否是社群书)
*/
private
Boolean
isBookGroup
;
/**
* 二维码ID
*/
private
Long
sceneId
;
...
...
@@ -75,6 +80,16 @@ public class AdvertisingExposureRecord extends BaseEntity {
*/
private
Date
createDay
;
/**
* 创建月份
*/
private
String
createMonth
;
/**
* 曝光次数
*/
private
Long
count
;
@Override
public
Long
getId
()
{
return
id
;
...
...
@@ -101,6 +116,14 @@ public class AdvertisingExposureRecord extends BaseEntity {
this
.
bookId
=
bookId
;
}
public
Boolean
getIsBookGroup
()
{
return
isBookGroup
;
}
public
void
setIsBookGroup
(
Boolean
isBookGroup
)
{
this
.
isBookGroup
=
isBookGroup
;
}
public
Long
getAdviserId
()
{
return
adviserId
;
}
...
...
@@ -183,12 +206,29 @@ public class AdvertisingExposureRecord extends BaseEntity {
this
.
sceneId
=
sceneId
;
}
public
Long
getCount
()
{
return
count
;
}
public
void
setCount
(
Long
count
)
{
this
.
count
=
count
;
}
public
String
getCreateMonth
()
{
return
createMonth
;
}
public
void
setCreateMonth
(
String
createMonth
)
{
this
.
createMonth
=
createMonth
;
}
@Override
public
String
toString
()
{
return
"AdvertisingExposureRecord{"
+
"id="
+
id
+
", adId="
+
adId
+
", bookId="
+
bookId
+
", isBookGroup="
+
isBookGroup
+
", sceneId="
+
sceneId
+
", adviserId="
+
adviserId
+
", agentId="
+
agentId
+
...
...
@@ -199,6 +239,8 @@ public class AdvertisingExposureRecord extends BaseEntity {
", wechatUserId="
+
wechatUserId
+
", createTime="
+
createTime
+
", createDay="
+
createDay
+
", createMonth='"
+
createMonth
+
'\''
+
", count="
+
count
+
"} "
+
super
.
toString
();
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/entity/AdvertisingIncomeDaily.java
0 → 100644
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
entity
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
com.pcloud.common.entity.BaseEntity
;
public
class
AdvertisingIncomeDaily
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
2993939729052080207L
;
/**
* advertising_income_daily.id (唯一标识)
*/
private
Long
id
;
/**
* advertising_income_daily.ad_id (广告位ID)
*/
private
Long
adId
;
/**
* advertising_income_daily.master_id (广告主ID)
*/
private
Long
masterId
;
/**
* advertising_income_daily.book_id (书刊ID)
*/
private
Long
bookId
;
/**
* 运营ID
*/
private
Long
channelId
;
/**
* advertising_income_daily.classify_id (分类ID)
*/
private
Long
classifyId
;
/**
* advertising_income_daily.qrcode_id (微信群ID)
*/
private
Long
qrcodeId
;
/**
* advertising_income_daily.settlement_method (结算方式编码)
*/
private
String
settlementMethod
;
/**
* advertising_income_daily.price_each_time (价格)
*/
private
BigDecimal
priceEachTime
;
/**
* advertising_income_daily.exposure_num (曝光量)
*/
private
Integer
exposureNum
;
/**
* advertising_income_daily.click_num (点击量)
*/
private
Integer
clickNum
;
/**
* advertising_income_daily.income (收益)
*/
private
BigDecimal
income
;
/**
* advertising_income_daily.create_time (创建时间)
*/
private
Date
createTime
;
/**
* advertising_income_daily.statis_day (统计日期)
*/
private
Date
statisDay
;
/**
* advertising_income_daily.statis_month (统计月份)
*/
private
String
statisMonth
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Long
getAdId
()
{
return
adId
;
}
public
void
setAdId
(
Long
adId
)
{
this
.
adId
=
adId
;
}
public
Long
getMasterId
()
{
return
masterId
;
}
public
void
setMasterId
(
Long
masterId
)
{
this
.
masterId
=
masterId
;
}
public
Long
getBookId
()
{
return
bookId
;
}
public
void
setBookId
(
Long
bookId
)
{
this
.
bookId
=
bookId
;
}
public
Long
getChannelId
()
{
return
channelId
;
}
public
void
setChannelId
(
Long
channelId
)
{
this
.
channelId
=
channelId
;
}
public
Long
getClassifyId
()
{
return
classifyId
;
}
public
void
setClassifyId
(
Long
classifyId
)
{
this
.
classifyId
=
classifyId
;
}
public
Long
getQrcodeId
()
{
return
qrcodeId
;
}
public
void
setQrcodeId
(
Long
qrcodeId
)
{
this
.
qrcodeId
=
qrcodeId
;
}
public
String
getSettlementMethod
()
{
return
settlementMethod
;
}
public
void
setSettlementMethod
(
String
settlementMethod
)
{
this
.
settlementMethod
=
settlementMethod
;
}
public
BigDecimal
getPriceEachTime
()
{
return
priceEachTime
;
}
public
void
setPriceEachTime
(
BigDecimal
priceEachTime
)
{
this
.
priceEachTime
=
priceEachTime
;
}
public
Integer
getExposureNum
()
{
return
exposureNum
;
}
public
void
setExposureNum
(
Integer
exposureNum
)
{
this
.
exposureNum
=
exposureNum
;
}
public
Integer
getClickNum
()
{
return
clickNum
;
}
public
void
setClickNum
(
Integer
clickNum
)
{
this
.
clickNum
=
clickNum
;
}
public
BigDecimal
getIncome
()
{
return
income
;
}
public
void
setIncome
(
BigDecimal
income
)
{
this
.
income
=
income
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Date
getStatisDay
()
{
return
statisDay
;
}
public
void
setStatisDay
(
Date
statisDay
)
{
this
.
statisDay
=
statisDay
;
}
public
String
getStatisMonth
()
{
return
statisMonth
;
}
public
void
setStatisMonth
(
String
statisMonth
)
{
this
.
statisMonth
=
statisMonth
;
}
@Override
public
String
toString
()
{
return
"AdvertisingIncomeDaily{"
+
"id="
+
id
+
", adId="
+
adId
+
", masterId="
+
masterId
+
", bookId="
+
bookId
+
", channelId="
+
channelId
+
", classifyId="
+
classifyId
+
", qrcodeId="
+
qrcodeId
+
", settlementMethod='"
+
settlementMethod
+
'\''
+
", priceEachTime="
+
priceEachTime
+
", exposureNum="
+
exposureNum
+
", clickNum="
+
clickNum
+
", income="
+
income
+
", createTime="
+
createTime
+
", statisDay="
+
statisDay
+
", statisMonth='"
+
statisMonth
+
'\''
+
"} "
+
super
.
toString
();
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/entity/AdvertisingMaster.java
0 → 100644
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
entity
;
import
java.util.Date
;
import
java.util.List
;
import
com.pcloud.common.entity.BaseEntity
;
public
class
AdvertisingMaster
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
3317585726581741831L
;
/**
* advertising_master.id (唯一标识)
*/
private
Long
id
;
/**
* advertising_master.master_name (广告主名称)
*/
private
String
masterName
;
/**
* advertising_master.create_time (创建时间)
*/
private
Date
createTime
;
/**
* advertising_master.update_time (修改时间)
*/
private
Date
updateTime
;
/**
* 广告结算方式列表
*/
private
List
<
AdvertisingSettlementMethod
>
settlementMethodList
;
@Override
public
Long
getId
()
{
return
id
;
}
@Override
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
String
getMasterName
()
{
return
masterName
;
}
public
void
setMasterName
(
String
masterName
)
{
this
.
masterName
=
masterName
;
}
@Override
public
Date
getCreateTime
()
{
return
createTime
;
}
@Override
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
@Override
public
Date
getUpdateTime
()
{
return
updateTime
;
}
@Override
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
List
<
AdvertisingSettlementMethod
>
getSettlementMethodList
()
{
return
settlementMethodList
;
}
public
void
setSettlementMethodList
(
List
<
AdvertisingSettlementMethod
>
settlementMethodList
)
{
this
.
settlementMethodList
=
settlementMethodList
;
}
@Override
public
String
toString
()
{
return
"AdvertisingMaster{"
+
"id="
+
id
+
", masterName='"
+
masterName
+
'\''
+
", createTime="
+
createTime
+
", updateTime="
+
updateTime
+
", settlementMethodList="
+
settlementMethodList
+
"} "
+
super
.
toString
();
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/entity/AdvertisingSettlementMethod.java
0 → 100644
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
entity
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
com.pcloud.common.entity.BaseEntity
;
public
class
AdvertisingSettlementMethod
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
2834986141520977079L
;
/**
* advertising_settlement_method.id (唯一标识)
*/
private
Long
id
;
/**
* advertising_settlement_method.master_id (广告主ID)
*/
private
Long
masterId
;
/**
* advertising_settlement_method.ad_id (广告位ID)
*/
private
Long
adId
;
/**
* advertising_settlement_method.settlement_method (结算方式)
*/
private
String
settlementMethod
;
/**
* advertising_settlement_method.price_each_time (每次价格)
*/
private
BigDecimal
priceEachTime
;
/**
* advertising_settlement_method.create_time (创建时间)
*/
private
Date
createTime
;
/**
* advertising_settlement_method.update_time (修改时间)
*/
private
Date
updateTime
;
@Override
public
Long
getId
()
{
return
id
;
}
@Override
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Long
getMasterId
()
{
return
masterId
;
}
public
void
setMasterId
(
Long
masterId
)
{
this
.
masterId
=
masterId
;
}
public
Long
getAdId
()
{
return
adId
;
}
public
void
setAdId
(
Long
adId
)
{
this
.
adId
=
adId
;
}
public
String
getSettlementMethod
()
{
return
settlementMethod
;
}
public
void
setSettlementMethod
(
String
settlementMethod
)
{
this
.
settlementMethod
=
settlementMethod
;
}
public
BigDecimal
getPriceEachTime
()
{
return
priceEachTime
;
}
public
void
setPriceEachTime
(
BigDecimal
priceEachTime
)
{
this
.
priceEachTime
=
priceEachTime
;
}
@Override
public
Date
getCreateTime
()
{
return
createTime
;
}
@Override
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
@Override
public
Date
getUpdateTime
()
{
return
updateTime
;
}
@Override
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
@Override
public
String
toString
()
{
return
"AdvertisingSettlementMethod{"
+
"id="
+
id
+
", masterId="
+
masterId
+
", adId="
+
adId
+
", settlementMethod='"
+
settlementMethod
+
'\''
+
", priceEachTime="
+
priceEachTime
+
", createTime="
+
createTime
+
", updateTime="
+
updateTime
+
"} "
+
super
.
toString
();
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/entity/AdvertisingSpace.java
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
entity
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
com.pcloud.common.entity.BaseEntity
;
...
...
@@ -26,9 +27,19 @@ public class AdvertisingSpace extends BaseEntity {
private
String
adPosition
;
/**
* advertising_space.ad_
source (广告来源
)
* advertising_space.ad_
position_mode (广告位置方式
)
*/
private
String
adSource
;
private
String
adPositionMode
;
/**
* advertising_space.ad_position_detail (具体广告位置)
*/
private
String
adPositionDetail
;
/**
* advertising_space.master_id (广告主ID)
*/
private
Long
masterId
;
/**
* advertising_space.ad_link (广告位链接)
...
...
@@ -41,6 +52,11 @@ public class AdvertisingSpace extends BaseEntity {
private
String
sourceId
;
/**
* advertising_space.ad_title (广告位标题)
*/
private
String
adTitle
;
/**
* advertising_space.ad_slogan (广告位文案)
*/
private
String
adSlogan
;
...
...
@@ -51,11 +67,6 @@ public class AdvertisingSpace extends BaseEntity {
private
String
adPic
;
/**
* advertising_space.distribution_type (投放方式(0:指定书刊;1:不指定书刊))
*/
private
Integer
distributionType
;
/**
* advertising_space.create_time (创建时间)
*/
private
Date
createTime
;
...
...
@@ -70,6 +81,16 @@ public class AdvertisingSpace extends BaseEntity {
*/
private
Boolean
isOpen
;
/**
* 结算方式
*/
private
String
settlementMethod
;
/**
* 每次价格
*/
private
BigDecimal
priceEachTime
;
@Override
public
Long
getId
()
{
return
id
;
...
...
@@ -96,12 +117,28 @@ public class AdvertisingSpace extends BaseEntity {
this
.
adPosition
=
adPosition
;
}
public
String
getAdSource
()
{
return
adSource
;
public
String
getAdPositionMode
()
{
return
adPositionMode
;
}
public
void
setAdPositionMode
(
String
adPositionMode
)
{
this
.
adPositionMode
=
adPositionMode
;
}
public
String
getAdPositionDetail
()
{
return
adPositionDetail
;
}
public
void
setAdPositionDetail
(
String
adPositionDetail
)
{
this
.
adPositionDetail
=
adPositionDetail
;
}
public
void
setAdSource
(
String
adSource
)
{
this
.
adSource
=
adSource
;
public
Long
getMasterId
()
{
return
masterId
;
}
public
void
setMasterId
(
Long
masterId
)
{
this
.
masterId
=
masterId
;
}
public
String
getAdLink
()
{
...
...
@@ -120,6 +157,14 @@ public class AdvertisingSpace extends BaseEntity {
this
.
sourceId
=
sourceId
;
}
public
String
getAdTitle
()
{
return
adTitle
;
}
public
void
setAdTitle
(
String
adTitle
)
{
this
.
adTitle
=
adTitle
;
}
public
String
getAdSlogan
()
{
return
adSlogan
;
}
...
...
@@ -136,14 +181,6 @@ public class AdvertisingSpace extends BaseEntity {
this
.
adPic
=
adPic
;
}
public
Integer
getDistributionType
()
{
return
distributionType
;
}
public
void
setDistributionType
(
Integer
distributionType
)
{
this
.
distributionType
=
distributionType
;
}
@Override
public
Date
getCreateTime
()
{
return
createTime
;
...
...
@@ -172,21 +209,41 @@ public class AdvertisingSpace extends BaseEntity {
this
.
isOpen
=
isOpen
;
}
public
String
getSettlementMethod
()
{
return
settlementMethod
;
}
public
void
setSettlementMethod
(
String
settlementMethod
)
{
this
.
settlementMethod
=
settlementMethod
;
}
public
BigDecimal
getPriceEachTime
()
{
return
priceEachTime
;
}
public
void
setPriceEachTime
(
BigDecimal
priceEachTime
)
{
this
.
priceEachTime
=
priceEachTime
;
}
@Override
public
String
toString
()
{
return
"AdvertisingSpace{"
+
"id="
+
id
+
", adName='"
+
adName
+
'\''
+
", adPosition='"
+
adPosition
+
'\''
+
", adSource='"
+
adSource
+
'\''
+
", adPositionMode='"
+
adPositionMode
+
'\''
+
", adPositionDetail='"
+
adPositionDetail
+
'\''
+
", masterId="
+
masterId
+
", adLink='"
+
adLink
+
'\''
+
", sourceId='"
+
sourceId
+
'\''
+
", adTitle='"
+
adTitle
+
'\''
+
", adSlogan='"
+
adSlogan
+
'\''
+
", adPic='"
+
adPic
+
'\''
+
", distributionType="
+
distributionType
+
", createTime="
+
createTime
+
", updateTime="
+
updateTime
+
", isOpen="
+
isOpen
+
", settlementMethod='"
+
settlementMethod
+
'\''
+
", priceEachTime="
+
priceEachTime
+
"} "
+
super
.
toString
();
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/entity/DistributionWechatGroup.java
0 → 100644
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
entity
;
import
java.io.Serializable
;
/**
* Description 投放微信学习群参数实体
* Created by PENG on 2019/5/9.
*/
public
class
DistributionWechatGroup
implements
Serializable
{
private
static
final
long
serialVersionUID
=
7843545114166726847L
;
/**
* 书刊ID
*/
private
Long
bookId
;
/**
* 运营ID
*/
private
Long
channelId
;
/**
* 编辑ID
*/
private
Long
adviserId
;
/**
* 群分类ID
*/
private
Long
classifyId
;
/**
* 微信群ID
*/
private
Long
qrcodeId
;
public
Long
getBookId
()
{
return
bookId
;
}
public
void
setBookId
(
Long
bookId
)
{
this
.
bookId
=
bookId
;
}
public
Long
getChannelId
()
{
return
channelId
;
}
public
void
setChannelId
(
Long
channelId
)
{
this
.
channelId
=
channelId
;
}
public
Long
getAdviserId
()
{
return
adviserId
;
}
public
void
setAdviserId
(
Long
adviserId
)
{
this
.
adviserId
=
adviserId
;
}
public
Long
getClassifyId
()
{
return
classifyId
;
}
public
void
setClassifyId
(
Long
classifyId
)
{
this
.
classifyId
=
classifyId
;
}
public
Long
getQrcodeId
()
{
return
qrcodeId
;
}
public
void
setQrcodeId
(
Long
qrcodeId
)
{
this
.
qrcodeId
=
qrcodeId
;
}
@Override
public
String
toString
()
{
return
"DistributionWechatGroup{"
+
"bookId="
+
bookId
+
", channelId="
+
channelId
+
", adviserId="
+
adviserId
+
", classifyId="
+
classifyId
+
", qrcodeId="
+
qrcodeId
+
'}'
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/enums/AdPositionDetailEnum.java
0 → 100644
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
enums
;
/**
* Description 具体广告位置枚举
* @author PENG
* @date 2019/4/24
*/
public
enum
AdPositionDetailEnum
{
JOIN_PAGE
(
AdPositionEnum
.
BOOK_GROUP_PAGE
.
positionCode
,
"JOIN_PAGE"
,
"入群选择页"
),
GROUP_QRCODE_PAGE
(
AdPositionEnum
.
BOOK_GROUP_PAGE
.
positionCode
,
"GROUP_QRCODE_PAGE"
,
"群二维码页面"
),
FAIL_JOIN_PAGE
(
AdPositionEnum
.
BOOK_GROUP_PAGE
.
positionCode
,
"FAIL_JOIN_PAGE"
,
"群成员已满/无法入群页面"
);
public
final
String
positionCode
;
public
final
String
detailCode
;
public
final
String
detailName
;
AdPositionDetailEnum
(
String
positionCode
,
String
detailCode
,
String
detailName
)
{
this
.
positionCode
=
positionCode
;
this
.
detailCode
=
detailCode
;
this
.
detailName
=
detailName
;
}
/**
* 校验位置是否存在
*/
public
static
Boolean
checkCodeExist
(
String
positionCode
,
String
detailCode
)
{
AdPositionDetailEnum
[]
var1
=
values
();
int
var2
=
var1
.
length
;
for
(
int
var3
=
0
;
var3
<
var2
;
++
var3
)
{
AdPositionDetailEnum
adPositionDetailEnum
=
var1
[
var3
];
if
(
adPositionDetailEnum
.
positionCode
.
equals
(
positionCode
)
&&
adPositionDetailEnum
.
detailCode
.
equals
(
detailCode
))
{
return
true
;
}
}
return
false
;
}
/**
* 根据编码拿名称
*/
public
static
String
getNameByCode
(
String
detailCode
)
{
AdPositionDetailEnum
[]
var1
=
values
();
int
var2
=
var1
.
length
;
for
(
int
var3
=
0
;
var3
<
var2
;
++
var3
)
{
AdPositionDetailEnum
adPositionDetailEnum
=
var1
[
var3
];
if
(
adPositionDetailEnum
.
detailCode
.
equals
(
detailCode
))
{
return
adPositionDetailEnum
.
detailName
;
}
}
return
""
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/enums/AdPositionEnum.java
View file @
e991c8ed
...
...
@@ -7,24 +7,18 @@ package com.pcloud.book.advertising.enums;
*/
public
enum
AdPositionEnum
{
/**
* 应用或作品详情浮标
*/
DETAIL_PAGE
(
"DETAIL_PAGE"
,
"应用或作品详情浮标"
,
true
),
BOOK_GROUP_PAGE
(
"BOOK_GROUP_PAGE"
,
"扫社群码页面"
),
/**
* 扫码消息
*/
SCENE_MESSAGE
(
"SCENE_MESSAGE"
,
"扫码消息"
,
false
);
APP_OR_PRODUCT
(
"APP_OR_PRODUCT"
,
"具体应用/作品"
),
WECHAT_GROUP_MSG
(
"WECHAT_GROUP_MSG"
,
"微信群消息"
);
public
final
String
positionCode
;
public
final
String
positionName
;
public
final
Boolean
isOpen
;
AdPositionEnum
(
String
positionCode
,
String
positionName
,
Boolean
isOpen
)
{
AdPositionEnum
(
String
positionCode
,
String
positionName
)
{
this
.
positionCode
=
positionCode
;
this
.
positionName
=
positionName
;
this
.
isOpen
=
isOpen
;
}
/**
...
...
@@ -35,12 +29,27 @@ public enum AdPositionEnum {
int
var2
=
var1
.
length
;
for
(
int
var3
=
0
;
var3
<
var2
;
++
var3
)
{
AdPositionEnum
adPositionEnum
=
var1
[
var3
];
if
(
adPositionEnum
.
positionCode
.
equals
(
positionCode
)
&&
adPositionEnum
.
isOpen
)
{
if
(
adPositionEnum
.
positionCode
.
equals
(
positionCode
))
{
return
true
;
}
}
return
false
;
}
public
static
final
String
[]
AD_POSITION_GATHER
=
{
DETAIL_PAGE
.
positionCode
,
SCENE_MESSAGE
.
positionCode
};
/**
* 根据编码拿名称
*/
public
static
String
getNameByCode
(
String
positionCode
)
{
AdPositionEnum
[]
var1
=
values
();
int
var2
=
var1
.
length
;
for
(
int
var3
=
0
;
var3
<
var2
;
++
var3
)
{
AdPositionEnum
adPositionEnum
=
var1
[
var3
];
if
(
adPositionEnum
.
positionCode
.
equals
(
positionCode
))
{
return
adPositionEnum
.
positionName
;
}
}
return
""
;
}
public
static
final
String
[]
AD_POSITION_GATHER
=
{
BOOK_GROUP_PAGE
.
positionCode
,
APP_OR_PRODUCT
.
positionCode
,
WECHAT_GROUP_MSG
.
positionCode
};
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/enums/AdPositionModeEnum.java
0 → 100644
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
enums
;
/**
* Description 广告形式枚举类
* Created by PENG on 2019/4/24.
*/
public
enum
AdPositionModeEnum
{
INFORMATION
(
AdPositionEnum
.
BOOK_GROUP_PAGE
.
positionCode
,
AdPositionDetailEnum
.
JOIN_PAGE
.
detailCode
,
"INFORMATION"
,
"信息流"
),
BANNER_MIDDLE
(
AdPositionEnum
.
BOOK_GROUP_PAGE
.
positionCode
,
AdPositionDetailEnum
.
JOIN_PAGE
.
detailCode
,
"BANNER_MIDDLE"
,
"中部通栏"
),
BANNER_BOTTOM
(
AdPositionEnum
.
BOOK_GROUP_PAGE
.
positionCode
,
AdPositionDetailEnum
.
GROUP_QRCODE_PAGE
.
detailCode
,
"BANNER_BOTTOM"
,
"底部通栏"
),
BANNER_BOTTOM_TRACK
(
AdPositionEnum
.
BOOK_GROUP_PAGE
.
positionCode
,
AdPositionDetailEnum
.
FAIL_JOIN_PAGE
.
detailCode
,
"BANNER_BOTTOM_TRACK"
,
"底部通栏(跑道式)"
),
DESC_PAGE_HEAD
(
AdPositionEnum
.
APP_OR_PRODUCT
.
positionCode
,
null
,
"DESC_PAGE_HEAD"
,
"应用说明页头部通栏"
),
DESC_PAGE_MIDDLE
(
AdPositionEnum
.
APP_OR_PRODUCT
.
positionCode
,
null
,
"DESC_PAGE_MIDDLE"
,
"应用说明页中部通栏"
),
DESC_PAGE_BOTTOM
(
AdPositionEnum
.
APP_OR_PRODUCT
.
positionCode
,
null
,
"DESC_PAGE_BOTTOM"
,
"应用说明页底部通栏"
),
TOP_FOCUS_PIC_1
(
AdPositionEnum
.
APP_OR_PRODUCT
.
positionCode
,
null
,
"TOP_FOCUS_PIC_1"
,
"顶部焦点图第1帧"
),
TOP_FOCUS_PIC_2
(
AdPositionEnum
.
APP_OR_PRODUCT
.
positionCode
,
null
,
"TOP_FOCUS_PIC_2"
,
"顶部焦点图第2帧"
),
UNDER_TITLE_BANNER
(
AdPositionEnum
.
APP_OR_PRODUCT
.
positionCode
,
null
,
"UNDER_TITLE_BANNER"
,
"顶部焦点图第2帧"
),
RIGHT_FLOAT_ICON
(
AdPositionEnum
.
APP_OR_PRODUCT
.
positionCode
,
null
,
"RIGHT_FLOAT_ICON"
,
"右侧浮标"
),
PAY_POP_UP
(
AdPositionEnum
.
APP_OR_PRODUCT
.
positionCode
,
null
,
"PAY_POP_UP"
,
"付费后弹窗"
),
MINE_TOP_BANNER
(
AdPositionEnum
.
APP_OR_PRODUCT
.
positionCode
,
null
,
"MINE_TOP_BANNER"
,
"“我的”顶部通栏(大)"
),
TOP_BANNER_SMALL
(
AdPositionEnum
.
APP_OR_PRODUCT
.
positionCode
,
null
,
"TOP_BANNER_SMALL"
,
"顶部通栏(小)"
),
BOTTOM_FLOAT_ICON
(
AdPositionEnum
.
APP_OR_PRODUCT
.
positionCode
,
null
,
"BOTTOM_FLOAT_ICON"
,
"底部浮标"
),
BOTTOM_BANNER_LARGE
(
AdPositionEnum
.
APP_OR_PRODUCT
.
positionCode
,
null
,
"BOTTOM_BANNER_LARGE"
,
"底部通栏(大)"
),
PAY_BOTTOM_BANNER
(
AdPositionEnum
.
APP_OR_PRODUCT
.
positionCode
,
null
,
"PAY_BOTTOM_BANNER"
,
"应用支付页底部通栏"
),
PIC_IN_PIC_MIDDLE
(
AdPositionEnum
.
APP_OR_PRODUCT
.
positionCode
,
null
,
"PIC_IN_PIC_MIDDLE"
,
"画中画(中)"
),
PIC_IN_PIC_BOTTOM
(
AdPositionEnum
.
APP_OR_PRODUCT
.
positionCode
,
null
,
"PIC_IN_PIC_BOTTOM"
,
"画中画(底)"
),
TEXT_AND_LINK
(
AdPositionEnum
.
WECHAT_GROUP_MSG
.
positionCode
,
null
,
"TEXT_AND_LINK"
,
"文字+链接"
),
NEWS_SHARE
(
AdPositionEnum
.
WECHAT_GROUP_MSG
.
positionCode
,
null
,
"NEWS_SHARE"
,
"图文分享"
),
JUST_PIC
(
AdPositionEnum
.
WECHAT_GROUP_MSG
.
positionCode
,
null
,
"JUST_PIC"
,
"纯图片"
);
public
final
String
positionCode
;
public
final
String
detailCode
;
public
final
String
modeCode
;
public
final
String
modeName
;
AdPositionModeEnum
(
String
positionCode
,
String
detailCode
,
String
modeCode
,
String
modeName
)
{
this
.
positionCode
=
positionCode
;
this
.
detailCode
=
detailCode
;
this
.
modeCode
=
modeCode
;
this
.
modeName
=
modeName
;
}
/**
* 校验位置是否存在
*/
public
static
Boolean
checkCodeExist
(
String
positionCode
,
String
modeCode
)
{
AdPositionModeEnum
[]
var1
=
values
();
int
var2
=
var1
.
length
;
for
(
int
var3
=
0
;
var3
<
var2
;
++
var3
)
{
AdPositionModeEnum
adPositionModeEnum
=
var1
[
var3
];
if
(
adPositionModeEnum
.
positionCode
.
equals
(
positionCode
)
&&
adPositionModeEnum
.
modeCode
.
equals
(
modeCode
))
{
return
true
;
}
}
return
false
;
}
/**
* 根据编码拿名称
*/
public
static
String
getNameByCode
(
String
modeCode
)
{
AdPositionModeEnum
[]
var1
=
values
();
int
var2
=
var1
.
length
;
for
(
int
var3
=
0
;
var3
<
var2
;
++
var3
)
{
AdPositionModeEnum
adPositionModeEnum
=
var1
[
var3
];
if
(
adPositionModeEnum
.
modeCode
.
equals
(
modeCode
))
{
return
adPositionModeEnum
.
modeName
;
}
}
return
""
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/enums/AdSourceEnum.java
deleted
100644 → 0
View file @
872b7814
package
com
.
pcloud
.
book
.
advertising
.
enums
;
/**
* Description 广告来源枚举
* @author PENG
* @date 2019/3/1
*/
public
enum
AdSourceEnum
{
/**
* 推啊
*/
TUIA
(
"TUIA"
),
/**
* 招行
*/
CMB
(
"CMB"
);
public
String
code
;
AdSourceEnum
(
String
code
)
{
this
.
code
=
code
;
}
public
static
final
String
[]
AD_SOURCE_GATHER
=
{
TUIA
.
code
,
CMB
.
code
};
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/enums/DistributionTypeEnum.java
deleted
100644 → 0
View file @
872b7814
package
com
.
pcloud
.
book
.
advertising
.
enums
;
/**
* Description 广告投放方式枚举
* @author PENG
* @date 2019/3/1
*/
public
enum
DistributionTypeEnum
{
/**
* 指定书刊
*/
SIGN_BOOK
(
0
),
/**
* 不指定书刊
*/
NO_SIGN_BOOK
(
1
);
public
Integer
value
;
DistributionTypeEnum
(
Integer
value
)
{
this
.
value
=
value
;
}
public
static
final
Integer
[]
DISTRIBUTION_TYPE_GATHER
=
{
SIGN_BOOK
.
value
,
NO_SIGN_BOOK
.
value
};
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/enums/SettlementMethodEnum.java
0 → 100644
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
enums
;
/**
* Description 广告结算方式
* Created by PENG on 2019/4/26.
*/
public
enum
SettlementMethodEnum
{
CPC
(
"CPC"
,
"按点击量"
),
CPM
(
"CPM"
,
"按曝光量"
),
CPA
(
"CPA"
,
"按实际行动"
),
CPS
(
"CPS"
,
"按实际销售"
);
public
final
String
code
;
public
final
String
name
;
SettlementMethodEnum
(
String
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
public
static
String
getNameByCode
(
String
code
)
{
SettlementMethodEnum
[]
var1
=
values
();
int
var2
=
var1
.
length
;
for
(
int
var3
=
0
;
var3
<
var2
;
++
var3
)
{
SettlementMethodEnum
methodEnum
=
var1
[
var3
];
if
(
methodEnum
.
code
.
equals
(
code
))
{
return
methodEnum
.
name
;
}
}
return
null
;
}
public
static
final
String
[]
SETTLEMENT_METHOD_GATHER
=
{
CPC
.
code
,
CPM
.
code
,
CPA
.
code
,
CPS
.
code
};
public
static
final
String
[]
SETTLEMENT_METHOD_NEED_PRICE_GATHER
=
{
CPC
.
code
,
CPM
.
code
};
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/facade/AdvertisingSpaceFacade.java
View file @
e991c8ed
...
...
@@ -13,6 +13,7 @@ import com.pcloud.book.advertising.entity.AdvertisingAgentPermission;
import
com.pcloud.book.advertising.entity.AdvertisingClickRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingDistributionBook
;
import
com.pcloud.book.advertising.entity.AdvertisingExposureRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingMaster
;
import
com.pcloud.book.advertising.entity.AdvertisingSpace
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
...
...
@@ -104,25 +105,25 @@ public interface AdvertisingSpaceFacade {
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
*
删除广告位
* @param token 用户身份信息
* @param advertising
Space 广告位
实体
*
投放书刊
* @param token
用户身份信息
* @param advertising
DistributionBook 广告位书刊
实体
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"
删除广告位
"
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"
投放书刊
"
,
httpMethod
=
"POST"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"用户身份信息"
,
required
=
false
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"advertising
Space"
,
value
=
"广告位实体"
,
required
=
false
,
dataType
=
"AdvertisingSpace
"
,
paramType
=
"body"
)
@ApiImplicitParam
(
name
=
"advertising
DistributionBook"
,
value
=
"广告位书刊实体"
,
required
=
false
,
dataType
=
"AdvertisingDistributionBook
"
,
paramType
=
"body"
)
})
@RequestMapping
(
value
=
"d
elete
"
,
method
=
RequestMethod
.
POST
)
ResponseDto
<?>
d
elete
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
AdvertisingSpace
advertisingSpace
)
@RequestMapping
(
value
=
"d
istributeBook
"
,
method
=
RequestMethod
.
POST
)
ResponseDto
<?>
d
istributeBook
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
AdvertisingDistributionBook
advertisingDistributionBook
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 投放
书刊
* 投放
微信群
* @param token 用户身份信息
* @param advertisingDistributionBook 广告位书刊实体
* @return
...
...
@@ -130,13 +131,13 @@ public interface AdvertisingSpaceFacade {
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"投放
书刊
"
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"投放
微信群
"
,
httpMethod
=
"POST"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"用户身份信息"
,
required
=
false
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"advertisingDistributionBook"
,
value
=
"广告位书刊实体"
,
required
=
false
,
dataType
=
"AdvertisingDistributionBook"
,
paramType
=
"body"
)
})
@RequestMapping
(
value
=
"distribute
Book
"
,
method
=
RequestMethod
.
POST
)
ResponseDto
<?>
distribute
Book
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
AdvertisingDistributionBook
advertisingDistributionBook
)
@RequestMapping
(
value
=
"distribute
WechatGroup
"
,
method
=
RequestMethod
.
POST
)
ResponseDto
<?>
distribute
WechatGroup
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
AdvertisingDistributionBook
advertisingDistributionBook
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
...
...
@@ -215,11 +216,12 @@ public interface AdvertisingSpaceFacade {
/**
* 平台端获取某编辑书刊列表
* @param token 用户身份信息
* @param adviserId 编辑ID
* @param name 书籍名称
* @param currentPage 当前页
* @param numPerPage 每页条数
* @param token 用户身份信息
* @param adviserId 编辑ID
* @param name 书籍名称
* @param currentPage 当前页
* @param numPerPage 每页条数
* @param bookGroupOnly 是否社群书
* @return
* @throws PermissionException
* @throws BizException
...
...
@@ -230,12 +232,36 @@ public interface AdvertisingSpaceFacade {
@ApiImplicitParam
(
name
=
"adviserId"
,
value
=
"编辑ID"
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"书籍名称"
,
dataType
=
"string"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
dataType
=
"int"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页条数"
,
dataType
=
"int"
,
paramType
=
"query"
)
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页条数"
,
dataType
=
"int"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"bookGroupOnly"
,
value
=
"是否社群书"
,
dataType
=
"boolean"
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"listBook4Platform"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
listBook4Platform
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"adviserId"
,
required
=
false
)
Long
adviserId
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
;
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
,
@RequestParam
(
value
=
"bookGroupOnly"
,
required
=
false
)
Boolean
bookGroupOnly
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 平台端获取社群书微信群列表
* @param token 用户身份信息
* @param name 书籍名称
* @param currentPage 当前页
* @param numPerPage 每页条数
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"平台端获取社群书微信群列表"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"书籍名称"
,
dataType
=
"string"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
dataType
=
"int"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页条数"
,
dataType
=
"int"
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"listGroupQrcode4Platform"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
listGroupQrcode4Platform
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 获取广告位列表
...
...
@@ -284,9 +310,10 @@ public interface AdvertisingSpaceFacade {
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 获取广告位投放
作品/应用数据统计
* 获取广告位投放
微信群列表
* @param token 用户身份信息
* @param adId 广告位ID
* @param name 名称
* @param currentPage 当前页
* @param numPerPage 每页条数
* @return
...
...
@@ -294,49 +321,52 @@ public interface AdvertisingSpaceFacade {
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"获取广告位投放
作品/应用数据统计
"
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"获取广告位投放
微信群列表
"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"adId"
,
value
=
"广告位ID"
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"名称"
,
dataType
=
"string"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
dataType
=
"int"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页条数"
,
dataType
=
"int"
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"distribution
AppStatics
"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
distribution
AppStatics
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"adId"
,
required
=
false
)
Long
adId
,
@RequestParam
(
value
=
"
currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
;
@RequestMapping
(
value
=
"distribution
WechatGroupList
"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
distribution
WechatGroupList
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"adId"
,
required
=
false
)
Long
adId
,
@RequestParam
(
value
=
"
name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 获取广告位投放时间统计
* @param token 用户身份信息
* @param adId 广告位ID
* @param day 天数
* 获取书刊配置的广告位信息
* @param userInfo 用户身份信息
* @param adPositionDetail 广告具体位置
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"获取
广告位投放时间统计
"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"
adId"
,
value
=
"广告位ID"
,
dataType
=
"Long"
,
paramType
=
"query
"
),
@ApiImplicitParam
(
name
=
"
day"
,
value
=
"天数"
,
dataType
=
"Long"
,
paramType
=
"query"
)
@ApiOperation
(
value
=
"获取
书刊配置的广告位信息
"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"
userInfo"
,
value
=
"用户身份信息"
,
dataType
=
"string"
,
paramType
=
"header
"
),
@ApiImplicitParam
(
name
=
"
adPositionDetail"
,
value
=
"广告具体位置"
,
dataType
=
"string"
,
paramType
=
"query"
),
})
@RequestMapping
(
value
=
"
distributionDateStatics
"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
distributionDateStatics
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"adId"
,
required
=
false
)
Long
adId
,
@RequestParam
(
value
=
"day"
,
required
=
false
)
Integer
day
)
throws
PermissionException
,
BizException
,
JsonParseException
;
@RequestMapping
(
value
=
"
get4Wechat
"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
get4Wechat
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"adPositionDetail"
,
required
=
false
)
String
adPositionDetail
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 获取书刊配置的广告位信息
* @param userInfo 用户身份信息
* 获取社群书配置的广告位信息
* @param userInfo 用户身份信息
* @param adPositionDetail 广告具体位置
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"获取书刊配置的广告位信息"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"userInfo"
,
value
=
"用户身份信息"
,
dataType
=
"string"
,
paramType
=
"header"
)
@ApiOperation
(
value
=
"获取社群书配置的广告位信息"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"userInfo"
,
value
=
"用户身份信息"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"adPositionDetail"
,
value
=
"广告具体位置"
,
dataType
=
"string"
,
paramType
=
"query"
),
})
@RequestMapping
(
value
=
"get4Wechat"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
get
4Wechat
(
@CookieValue
(
"userInfo"
)
String
userInfo
)
@RequestMapping
(
value
=
"get
BookGroupAd
4Wechat"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
get
BookGroupAd4Wechat
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"adPositionDetail"
,
required
=
false
)
String
adPositionDetail
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
...
...
@@ -374,4 +404,432 @@ public interface AdvertisingSpaceFacade {
@RequestMapping
(
value
=
"addClickTrack"
,
method
=
RequestMethod
.
POST
)
ResponseDto
<?>
addClickTrack
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
AdvertisingClickRecord
advertisingClickRecord
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 添加广告主
* @param token 用户身份信息
* @param advertisingMaster 广告主实体
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"添加广告主"
,
httpMethod
=
"POST"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"用户身份信息"
,
required
=
false
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"advertisingMaster"
,
value
=
"广告主实体"
,
required
=
false
,
dataType
=
"AdvertisingMaster"
,
paramType
=
"body"
)
})
@RequestMapping
(
value
=
"createMaster"
,
method
=
RequestMethod
.
POST
)
ResponseDto
<?>
createMaster
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
AdvertisingMaster
advertisingMaster
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 修改广告主
* @param token 用户身份信息
* @param advertisingMaster 广告主实体
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"修改广告主"
,
httpMethod
=
"POST"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"用户身份信息"
,
required
=
false
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"advertisingMaster"
,
value
=
"广告主实体"
,
required
=
false
,
dataType
=
"AdvertisingMaster"
,
paramType
=
"body"
)
})
@RequestMapping
(
value
=
"updateMaster"
,
method
=
RequestMethod
.
POST
)
ResponseDto
<?>
updateMaster
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
AdvertisingMaster
advertisingMaster
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 获取广告主列表
* @param token 用户身份信息
* @param masterName 广告主名称
* @param currentPage 当前页
* @param numPerPage 每页条数
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"获取广告主列表"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"用户身份信息"
,
required
=
false
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"masterName"
,
value
=
"广告主名称"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
dataType
=
"int"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页条数"
,
dataType
=
"int"
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"getMasterList"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
getMasterList
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"masterName"
,
required
=
false
)
String
masterName
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 获取所有广告主
* @param token 用户身份信息
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"获取所有广告主"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"用户身份信息"
,
required
=
false
,
dataType
=
"string"
,
paramType
=
"header"
),
})
@RequestMapping
(
value
=
"getAllMaster"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
getAllMaster
(
@RequestHeader
(
"token"
)
String
token
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 获取广告主信息
* @param token 用户身份信息
* @param masterId 广告主ID
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"获取广告主信息"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"用户身份信息"
,
required
=
false
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"masterId"
,
value
=
"广告主ID"
,
required
=
false
,
dataType
=
"Long"
,
paramType
=
"query"
),
})
@RequestMapping
(
value
=
"getMasterInfo"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
getMasterInfo
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"masterId"
,
required
=
false
)
Long
masterId
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 获取概览数据
* @param token 用户身份信息
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"获取概览数据"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"用户身份信息"
,
required
=
false
,
dataType
=
"string"
,
paramType
=
"header"
),
})
@RequestMapping
(
value
=
"overviewStatis"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
overviewStatis
(
@RequestHeader
(
"token"
)
String
token
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 获取流量趋势
* @param token 用户身份信息
* @param day 天数
* @param startDate 开始时间
* @param endDate 结束时间
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"获取流量趋势"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"用户身份信息"
,
required
=
false
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"day"
,
value
=
"天数"
,
required
=
false
,
dataType
=
"Integer"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"startDate"
,
value
=
"开始时间"
,
required
=
false
,
dataType
=
"string"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"endDate"
,
value
=
"结束时间"
,
required
=
false
,
dataType
=
"string"
,
paramType
=
"query"
),
})
@RequestMapping
(
value
=
"getFlowStatisTrend"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
getFlowStatisTrend
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"day"
,
required
=
false
)
Integer
day
,
@RequestParam
(
value
=
"startDate"
,
required
=
false
)
String
startDate
,
@RequestParam
(
value
=
"endDate"
,
required
=
false
)
String
endDate
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 获取收益趋势
* @param token 用户身份信息
* @param day 天数
* @param startDate 开始时间
* @param endDate 结束时间
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"获取收益趋势"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"用户身份信息"
,
required
=
false
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"day"
,
value
=
"天数"
,
required
=
false
,
dataType
=
"Integer"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"startDate"
,
value
=
"开始时间"
,
required
=
false
,
dataType
=
"string"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"endDate"
,
value
=
"结束时间"
,
required
=
false
,
dataType
=
"string"
,
paramType
=
"query"
),
})
@RequestMapping
(
value
=
"getIncomeStatisTrend"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
getIncomeStatisTrend
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"day"
,
required
=
false
)
Integer
day
,
@RequestParam
(
value
=
"startDate"
,
required
=
false
)
String
startDate
,
@RequestParam
(
value
=
"endDate"
,
required
=
false
)
String
endDate
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 获取广告位投放书刊列表
* @param token 用户身份信息
* @param name 书刊名称
* @param currentPage 当前页
* @param numPerPage 每页条数
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"获取广告位投放书刊列表"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"书刊名称"
,
dataType
=
"string"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
dataType
=
"int"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页条数"
,
dataType
=
"int"
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"advertisingBookList"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
advertisingBookList
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 获取广告位投放微信群列表
* @param token 用户身份信息
* @param name 书刊名称
* @param currentPage 当前页
* @param numPerPage 每页条数
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"获取广告位投放微信群列表"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"书刊名称"
,
dataType
=
"string"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
dataType
=
"int"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页条数"
,
dataType
=
"int"
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"advertisingWechatGroupList"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
advertisingWechatGroupList
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 获取广告位投放微信群曝光量前几位
* @param token 用户身份信息
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"获取广告位投放微信群曝光量前几位"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
)
})
@RequestMapping
(
value
=
"advertisingWechatGroupRankTop"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
advertisingWechatGroupRankTop
(
@RequestHeader
(
"token"
)
String
token
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 书刊广告位明细
* @param token 用户身份信息
* @param bookId 书刊ID
* @param channelId 运营ID
* @param adviserId 编辑ID
* @param statisMonth 统计月份
* @param currentPage 当前页
* @param numPerPage 每页条数
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"书刊广告位明细"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"bookId"
,
value
=
"书刊ID"
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"channelId"
,
value
=
"运营ID"
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"adviserId"
,
value
=
"编辑ID"
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"statisMonth"
,
value
=
"统计月份"
,
dataType
=
"String"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
dataType
=
"int"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页条数"
,
dataType
=
"int"
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"advertisingDetail4Book"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
advertisingDetail4Book
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
Long
bookId
,
@RequestParam
(
value
=
"channelId"
,
required
=
false
)
Long
channelId
,
@RequestParam
(
value
=
"adviserId"
,
required
=
false
)
Long
adviserId
,
@RequestParam
(
value
=
"statisMonth"
,
required
=
false
)
String
statisMonth
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 导出书刊广告位明细
* @param token 用户身份信息
* @param bookId 书刊ID
* @param channelId 运营ID
* @param adviserId 编辑ID
* @param statisMonth 统计月份
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"导出书刊广告位明细"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"bookId"
,
value
=
"书刊ID"
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"channelId"
,
value
=
"运营ID"
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"adviserId"
,
value
=
"编辑ID"
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"statisMonth"
,
value
=
"统计月份"
,
dataType
=
"String"
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"exportAdvertisingDetail4Book"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
exportAdvertisingDetail4Book
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
Long
bookId
,
@RequestParam
(
value
=
"channelId"
,
required
=
false
)
Long
channelId
,
@RequestParam
(
value
=
"adviserId"
,
required
=
false
)
Long
adviserId
,
@RequestParam
(
value
=
"statisMonth"
,
required
=
false
)
String
statisMonth
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 微信群广告位明细
* @param token 用户身份信息
* @param qrcodeId 微信群ID
* @param statisMonth 统计月份
* @param currentPage 当前页
* @param numPerPage 每页条数
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"微信群广告位明细"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"qrcodeId"
,
value
=
"微信群ID"
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"statisMonth"
,
value
=
"统计月份"
,
dataType
=
"String"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
dataType
=
"int"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页条数"
,
dataType
=
"int"
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"advertisingDetail4WechatGroup"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
advertisingDetail4WechatGroup
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"qrcodeId"
,
required
=
false
)
Long
qrcodeId
,
@RequestParam
(
value
=
"statisMonth"
,
required
=
false
)
String
statisMonth
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 导出微信群广告位明细
* @param token 用户身份信息
* @param qrcodeId 微信群ID
* @param statisMonth 统计月份
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"导出微信群广告位明细"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"qrcodeId"
,
value
=
"微信群ID"
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"statisMonth"
,
value
=
"统计月份"
,
dataType
=
"String"
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"exportAdvertisingDetail4WechatGroup"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
exportAdvertisingDetail4WechatGroup
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"qrcodeId"
,
required
=
false
)
Long
qrcodeId
,
@RequestParam
(
value
=
"statisMonth"
,
required
=
false
)
String
statisMonth
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 微信群广告位点击读者列表
* @param token 用户身份信息
* @param qrcodeId 微信群ID
* @param adId 广告位ID
* @param statisMonth 统计月份
* @param currentPage 当前页
* @param numPerPage 每页条数
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"微信群广告位点击读者列表"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"qrcodeId"
,
value
=
"微信群ID"
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"adId"
,
value
=
"广告位ID"
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"statisMonth"
,
value
=
"统计月份"
,
dataType
=
"String"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
dataType
=
"Integer"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页条数"
,
dataType
=
"Integer"
,
paramType
=
"query"
),
})
@RequestMapping
(
value
=
"clickUserList4AdvertisingWechatGroup"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
clickUserList4AdvertisingWechatGroup
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"qrcodeId"
,
required
=
false
)
Long
qrcodeId
,
@RequestParam
(
value
=
"adId"
,
required
=
false
)
Long
adId
,
@RequestParam
(
value
=
"statisMonth"
,
required
=
false
)
String
statisMonth
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 导出微信群广告位点击读者列表
* @param token 用户身份信息
* @param qrcodeId 微信群ID
* @param adId 广告位ID
* @param statisMonth 统计月份
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"导出微信群广告位点击读者列表"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"qrcodeId"
,
value
=
"微信群ID"
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"adId"
,
value
=
"广告位ID"
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"statisMonth"
,
value
=
"统计月份"
,
dataType
=
"String"
,
paramType
=
"query"
),
})
@RequestMapping
(
value
=
"exportClickUserList4AdvertisingWechatGroup"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
exportClickUserList4AdvertisingWechatGroup
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"qrcodeId"
,
required
=
false
)
Long
qrcodeId
,
@RequestParam
(
value
=
"adId"
,
required
=
false
)
Long
adId
,
@RequestParam
(
value
=
"statisMonth"
,
required
=
false
)
String
statisMonth
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 广告主广告位明细
* @param token 用户身份信息
* @param masterId 广告主ID
* @param statisMonth 统计月份
* @param currentPage 当前页
* @param numPerPage 每页条数
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"广告主广告位明细"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"masterId"
,
value
=
"广告主ID"
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"statisMonth"
,
value
=
"统计月份"
,
dataType
=
"String"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
dataType
=
"int"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页条数"
,
dataType
=
"int"
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"advertisingDetail4Master"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
advertisingDetail4Master
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"masterId"
,
required
=
false
)
Long
masterId
,
@RequestParam
(
value
=
"statisMonth"
,
required
=
false
)
String
statisMonth
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 导出广告主广告位明细
* @param token 用户身份信息
* @param masterId 广告主ID
* @param statisMonth 统计月份
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"导出广告主广告位明细"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"masterId"
,
value
=
"广告主ID"
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"statisMonth"
,
value
=
"统计月份"
,
dataType
=
"String"
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"exportAdvertisingDetail4Master"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
exportAdvertisingDetail4Master
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"masterId"
,
required
=
false
)
Long
masterId
,
@RequestParam
(
value
=
"statisMonth"
,
required
=
false
)
String
statisMonth
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 获取微信群信息
* @param token 用户身份信息
* @param qrcodeId 微信群ID
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"获取微信群信息"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"qrcodeId"
,
value
=
"微信群ID"
,
dataType
=
"Long"
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"getGroupQrcodeInfo"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
getGroupQrcodeInfo
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"qrcodeId"
,
required
=
false
)
Long
qrcodeId
)
throws
PermissionException
,
BizException
,
JsonParseException
;
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/facade/impl/AdvertisingSpaceFacadeImpl.java
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
facade
.
impl
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.codehaus.jackson.JsonParseException
;
...
...
@@ -18,6 +19,7 @@ import com.pcloud.book.advertising.entity.AdvertisingAgentPermission;
import
com.pcloud.book.advertising.entity.AdvertisingClickRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingDistributionBook
;
import
com.pcloud.book.advertising.entity.AdvertisingExposureRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingMaster
;
import
com.pcloud.book.advertising.entity.AdvertisingSpace
;
import
com.pcloud.book.advertising.facade.AdvertisingSpaceFacade
;
import
com.pcloud.book.base.exception.BookBizException
;
...
...
@@ -102,31 +104,30 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
}
/**
*
删除广告位
*
投放书刊
*/
@Override
@RequestMapping
(
value
=
"d
elete
"
,
method
=
RequestMethod
.
POST
)
public
ResponseDto
<?>
d
elete
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
AdvertisingSpace
advertisingSpace
)
@RequestMapping
(
value
=
"d
istributeBook
"
,
method
=
RequestMethod
.
POST
)
public
ResponseDto
<?>
d
istributeBook
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
AdvertisingDistributionBook
advertisingDistributionBook
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
null
==
advertising
Space
)
{
if
(
null
==
advertising
DistributionBook
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
SessionUtil
.
getToken4Redis
(
token
);
advertisingSpaceBiz
.
delete
(
advertisingSpace
);
advertisingSpaceBiz
.
distributeBook
(
advertisingDistributionBook
);
return
new
ResponseDto
<>();
}
/**
* 投放
书刊
* 投放
微信群
*/
@Override
@RequestMapping
(
value
=
"distribute
Book
"
,
method
=
RequestMethod
.
POST
)
public
ResponseDto
<?>
distribute
Book
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
AdvertisingDistributionBook
advertisingDistributionBook
)
@RequestMapping
(
value
=
"distribute
WechatGroup
"
,
method
=
RequestMethod
.
POST
)
public
ResponseDto
<?>
distribute
WechatGroup
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
AdvertisingDistributionBook
advertisingDistributionBook
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
null
==
advertisingDistributionBook
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
advertisingSpaceBiz
.
distribute
Book
(
advertisingDistributionBook
);
advertisingSpaceBiz
.
distribute
WechatGroup
(
advertisingDistributionBook
);
return
new
ResponseDto
<>();
}
...
...
@@ -203,21 +204,43 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
@RequestMapping
(
value
=
"listBook4Platform"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
listBook4Platform
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"adviserId"
,
required
=
false
)
Long
adviserId
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
{
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
,
@RequestParam
(
value
=
"bookGroupOnly"
,
required
=
false
)
Boolean
bookGroupOnly
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
if
(
null
==
adviserId
)
{
/*
if (null == adviserId) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
}*/
if
(
null
==
bookGroupOnly
)
{
bookGroupOnly
=
false
;
}
SessionUtil
.
getToken4Redis
(
token
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"adviserId"
,
adviserId
);
paramMap
.
put
(
"name"
,
StringUtil
.
isEmpty
(
name
)
?
null
:
name
);
paramMap
.
put
(
"bookGroupOnly"
,
bookGroupOnly
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
listBook4Platform
(
paramMap
,
new
PageParam
(
currentPage
,
numPerPage
),
adviserId
));
}
/**
* 平台端获取社群书微信群列表
*/
@Override
@RequestMapping
(
value
=
"listGroupQrcode4Platform"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
listGroupQrcode4Platform
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
SessionUtil
.
getToken4Redis
(
token
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"name"
,
StringUtil
.
isEmpty
(
name
)
?
null
:
name
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
listGroupQrcode4Platform
(
paramMap
,
new
PageParam
(
currentPage
,
numPerPage
)));
}
/**
* 获取广告位列表
*/
@Override
...
...
@@ -250,13 +273,13 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
}
/**
* 获取广告位投放
作品/应用数据统计
* 获取广告位投放
微信群列表
*/
@Override
@RequestMapping
(
value
=
"distribution
AppStatics
"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
distribution
AppStatics
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"adId"
,
required
=
false
)
Long
adId
,
@RequestParam
(
value
=
"
currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
{
@RequestMapping
(
value
=
"distribution
WechatGroupList
"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
distribution
WechatGroupList
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"adId"
,
required
=
false
)
Long
adId
,
@RequestParam
(
value
=
"
name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
...
...
@@ -264,40 +287,43 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
distribution
AppStatics
(
adId
,
new
PageParam
(
currentPage
,
numPerPage
)));
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
distribution
WechatGroupList
(
adId
,
name
,
new
PageParam
(
currentPage
,
numPerPage
)));
}
/**
* 获取
广告位投放时间统计
* 获取
书刊配置的广告位信息
*/
@Override
@RequestMapping
(
value
=
"
distributionDateStatics
"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
distributionDateStatics
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"adId"
,
required
=
false
)
Long
adId
,
@RequestParam
(
value
=
"day"
,
required
=
false
)
Integer
day
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
null
==
adId
)
{
@RequestMapping
(
value
=
"
get4Wechat
"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
get4Wechat
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"adPositionDetail"
,
required
=
false
)
String
adPositionDetail
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
StringUtil
.
isEmpty
(
adPositionDetail
)
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
SessionUtil
.
getToken4Redis
(
token
);
if
(
null
==
day
)
{
day
=
7
;
Long
sceneId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_SCENE_ID
);
Long
adviserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_ADVISER_ID
);
Long
channelId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_CHANNEL_ID
);
if
(
null
==
sceneId
||
null
==
adviserId
||
null
==
channelId
)
{
return
new
ResponseDto
<>(
new
ArrayList
<>());
}
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
distributionDateStatics
(
adId
,
day
));
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
get4Wechat
(
sceneId
,
adviserId
,
channelId
,
adPositionDetail
));
}
/**
* 获取
书刊
配置的广告位信息
* 获取
社群书
配置的广告位信息
*/
@Override
@RequestMapping
(
value
=
"get4Wechat"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
get
4Wechat
(
@CookieValue
(
"userInfo"
)
String
userInfo
)
@RequestMapping
(
value
=
"get
BookGroupAd
4Wechat"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
get
BookGroupAd4Wechat
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"adPositionDetail"
,
required
=
false
)
String
adPositionDetail
)
throws
PermissionException
,
BizException
,
JsonParseException
{
Long
sceneId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_SCENE_ID
);
Long
adviserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_ADVISER_ID
);
Long
channelId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_CHANNEL_ID
);
if
(
null
==
sceneId
||
null
==
adviserId
||
null
==
channelId
)
{
if
(
StringUtil
.
isEmpty
(
adPositionDetail
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
Long
bookGroupId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
BOOK_GROUP_ID
);
if
(
null
==
bookGroupId
)
{
return
new
ResponseDto
<>(
new
AdvertisingSpaceDTO
());
}
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
get
4Wechat
(
sceneId
,
adviserId
,
channelId
));
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
get
BookGroupAd4Wechat
(
bookGroupId
,
adPositionDetail
));
}
/**
...
...
@@ -331,14 +357,20 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
@RequestMapping
(
value
=
"addClickTrack"
,
method
=
RequestMethod
.
POST
)
public
ResponseDto
<?>
addClickTrack
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
AdvertisingClickRecord
advertisingClickRecord
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
null
==
advertisingClickRecord
||
null
==
advertisingClickRecord
.
getAdId
()
||
null
==
advertisingClickRecord
.
getBookId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
Long
sceneId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_SCENE_ID
);
Long
adviserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_ADVISER_ID
);
Long
channelId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_CHANNEL_ID
);
Long
officialAccountsId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_OFFICIAL_ACCOUNTS_ID
);
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
bookGroupId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
BOOK_GROUP_ID
);
if
(
null
==
advertisingClickRecord
||
null
==
advertisingClickRecord
.
getAdId
()
||
null
==
wechatUserId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
if
((
null
==
advertisingClickRecord
.
getBookId
()
&&
!
"WECHAT_GROUP"
.
equals
(
advertisingClickRecord
.
getFromType
()))
||
(
null
==
bookGroupId
&&
"WECHAT_GROUP"
.
equals
(
advertisingClickRecord
.
getFromType
())))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
advertisingClickRecord
.
setBookGroupId
(
bookGroupId
);
advertisingClickRecord
.
setSceneId
(
sceneId
);
advertisingClickRecord
.
setAdviserId
(
adviserId
);
advertisingClickRecord
.
setChannelId
(
channelId
);
...
...
@@ -347,4 +379,293 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
advertisingSpaceBiz
.
addClickTrack
(
advertisingClickRecord
);
return
new
ResponseDto
<>();
}
/**
* 添加广告主
*/
@Override
@RequestMapping
(
value
=
"createMaster"
,
method
=
RequestMethod
.
POST
)
public
ResponseDto
<?>
createMaster
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
AdvertisingMaster
advertisingMaster
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
null
==
advertisingMaster
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
SessionUtil
.
getToken4Redis
(
token
);
advertisingSpaceBiz
.
createMaster
(
advertisingMaster
);
return
new
ResponseDto
<>();
}
/**
* 修改广告主
*/
@Override
@RequestMapping
(
value
=
"updateMaster"
,
method
=
RequestMethod
.
POST
)
public
ResponseDto
<?>
updateMaster
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
AdvertisingMaster
advertisingMaster
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
null
==
advertisingMaster
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
SessionUtil
.
getToken4Redis
(
token
);
advertisingSpaceBiz
.
updateMaster
(
advertisingMaster
);
return
new
ResponseDto
<>();
}
/**
* 获取广告主列表
*/
@Override
@RequestMapping
(
value
=
"getMasterList"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
getMasterList
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"masterName"
,
required
=
false
)
String
masterName
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
getMasterList
(
new
PageParam
(
currentPage
,
numPerPage
),
masterName
));
}
/**
* 获取所有广告主
*/
@Override
@RequestMapping
(
value
=
"getAllMaster"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
getAllMaster
(
@RequestHeader
(
"token"
)
String
token
)
throws
PermissionException
,
BizException
,
JsonParseException
{
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
getAllMaster
());
}
/**
* 获取广告主信息
*/
@Override
@RequestMapping
(
value
=
"getMasterInfo"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
getMasterInfo
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"masterId"
,
required
=
false
)
Long
masterId
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
null
==
masterId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
getMasterInfo
(
masterId
));
}
/**
* 获取概览数据
*/
@Override
@RequestMapping
(
value
=
"overviewStatis"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
overviewStatis
(
@RequestHeader
(
"token"
)
String
token
)
throws
PermissionException
,
BizException
,
JsonParseException
{
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
overviewStatis
());
}
/**
* 获取流量趋势
*/
@Override
@RequestMapping
(
value
=
"getFlowStatisTrend"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
getFlowStatisTrend
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"day"
,
required
=
false
)
Integer
day
,
@RequestParam
(
value
=
"startDate"
,
required
=
false
)
String
startDate
,
@RequestParam
(
value
=
"endDate"
,
required
=
false
)
String
endDate
)
throws
PermissionException
,
BizException
,
JsonParseException
{
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
getFlowStatisTrend
(
day
,
startDate
,
endDate
));
}
/**
* 获取收益趋势
*/
@Override
@RequestMapping
(
value
=
"getIncomeStatisTrend"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
getIncomeStatisTrend
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"day"
,
required
=
false
)
Integer
day
,
@RequestParam
(
value
=
"startDate"
,
required
=
false
)
String
startDate
,
@RequestParam
(
value
=
"endDate"
,
required
=
false
)
String
endDate
)
throws
PermissionException
,
BizException
,
JsonParseException
{
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
getIncomeStatisTrend
(
day
,
startDate
,
endDate
));
}
/**
* 获取广告位投放书刊列表
*/
@Override
@RequestMapping
(
value
=
"advertisingBookList"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
advertisingBookList
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
advertisingBookList
(
name
,
new
PageParam
(
currentPage
,
numPerPage
)));
}
/**
* 获取广告位投放微信群列表
*/
@Override
@RequestMapping
(
value
=
"advertisingWechatGroupList"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
advertisingWechatGroupList
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
advertisingWechatGroupList
(
name
,
new
PageParam
(
currentPage
,
numPerPage
)));
}
/**
* 获取广告位投放微信群曝光量前几位
*/
@Override
@RequestMapping
(
value
=
"advertisingWechatGroupRankTop"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
advertisingWechatGroupRankTop
(
@RequestHeader
(
"token"
)
String
token
)
throws
PermissionException
,
BizException
,
JsonParseException
{
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
advertisingWechatGroupRankTop
());
}
/**
* 书刊广告位明细
*/
@Override
@RequestMapping
(
value
=
"advertisingDetail4Book"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
advertisingDetail4Book
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
Long
bookId
,
@RequestParam
(
value
=
"channelId"
,
required
=
false
)
Long
channelId
,
@RequestParam
(
value
=
"adviserId"
,
required
=
false
)
Long
adviserId
,
@RequestParam
(
value
=
"statisMonth"
,
required
=
false
)
String
statisMonth
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
null
==
bookId
||
null
==
adviserId
||
null
==
channelId
||
null
==
statisMonth
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
advertisingDetail4Book
(
bookId
,
channelId
,
adviserId
,
statisMonth
,
new
PageParam
(
currentPage
,
numPerPage
)));
}
/**
* 导出书刊广告位明细
*/
@Override
@RequestMapping
(
value
=
"exportAdvertisingDetail4Book"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
exportAdvertisingDetail4Book
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
Long
bookId
,
@RequestParam
(
value
=
"channelId"
,
required
=
false
)
Long
channelId
,
@RequestParam
(
value
=
"adviserId"
,
required
=
false
)
Long
adviserId
,
@RequestParam
(
value
=
"statisMonth"
,
required
=
false
)
String
statisMonth
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
null
==
bookId
||
null
==
adviserId
||
null
==
channelId
||
null
==
statisMonth
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
exportAdvertisingDetail4Book
(
bookId
,
channelId
,
adviserId
,
statisMonth
));
}
/**
* 微信群广告位明细
*/
@Override
@RequestMapping
(
value
=
"advertisingDetail4WechatGroup"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
advertisingDetail4WechatGroup
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"qrcodeId"
,
required
=
false
)
Long
qrcodeId
,
@RequestParam
(
value
=
"statisMonth"
,
required
=
false
)
String
statisMonth
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
null
==
qrcodeId
||
null
==
statisMonth
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
advertisingDetail4WechatGroup
(
qrcodeId
,
statisMonth
,
new
PageParam
(
currentPage
,
numPerPage
)));
}
/**
* 导出微信群广告位明细
*/
@Override
@RequestMapping
(
value
=
"exportAdvertisingDetail4WechatGroup"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
exportAdvertisingDetail4WechatGroup
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"qrcodeId"
,
required
=
false
)
Long
qrcodeId
,
@RequestParam
(
value
=
"statisMonth"
,
required
=
false
)
String
statisMonth
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
null
==
qrcodeId
||
null
==
statisMonth
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
exportAdvertisingDetail4WechatGroup
(
qrcodeId
,
statisMonth
));
}
/**
* 微信群广告位点击读者列表
*/
@Override
@RequestMapping
(
value
=
"clickUserList4AdvertisingWechatGroup"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
clickUserList4AdvertisingWechatGroup
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"qrcodeId"
,
required
=
false
)
Long
qrcodeId
,
@RequestParam
(
value
=
"adId"
,
required
=
false
)
Long
adId
,
@RequestParam
(
value
=
"statisMonth"
,
required
=
false
)
String
statisMonth
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
null
==
qrcodeId
||
null
==
adId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
clickUserList4AdvertisingWechatGroup
(
qrcodeId
,
adId
,
statisMonth
,
new
PageParam
(
currentPage
,
numPerPage
)));
}
/**
* 导出微信群广告位点击读者列表
*/
@Override
@RequestMapping
(
value
=
"exportClickUserList4AdvertisingWechatGroup"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
exportClickUserList4AdvertisingWechatGroup
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"qrcodeId"
,
required
=
false
)
Long
qrcodeId
,
@RequestParam
(
value
=
"adId"
,
required
=
false
)
Long
adId
,
@RequestParam
(
value
=
"statisMonth"
,
required
=
false
)
String
statisMonth
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
null
==
qrcodeId
||
null
==
adId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
exportClickUserList4AdvertisingWechatGroup
(
qrcodeId
,
adId
,
statisMonth
));
}
/**
* 广告主广告位明细
*/
@Override
@RequestMapping
(
value
=
"advertisingDetail4Master"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
advertisingDetail4Master
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"masterId"
,
required
=
false
)
Long
masterId
,
@RequestParam
(
value
=
"statisMonth"
,
required
=
false
)
String
statisMonth
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
null
==
masterId
||
null
==
statisMonth
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
advertisingDetail4Master
(
masterId
,
statisMonth
,
new
PageParam
(
currentPage
,
numPerPage
)));
}
/**
* 导出广告主广告位明细
*/
@Override
@RequestMapping
(
value
=
"exportAdvertisingDetail4Master"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
exportAdvertisingDetail4Master
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"masterId"
,
required
=
false
)
Long
masterId
,
@RequestParam
(
value
=
"statisMonth"
,
required
=
false
)
String
statisMonth
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
null
==
masterId
||
null
==
statisMonth
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
exportAdvertisingDetail4Master
(
masterId
,
statisMonth
));
}
/**
* 获取微信群信息
*/
@Override
@RequestMapping
(
value
=
"getGroupQrcodeInfo"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
getGroupQrcodeInfo
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"qrcodeId"
,
required
=
false
)
Long
qrcodeId
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
null
==
qrcodeId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
getGroupQrcodeInfo
(
qrcodeId
));
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/service/impl/AdvertisingSpaceServiceImpl.java
0 → 100644
View file @
e991c8ed
package
com
.
pcloud
.
book
.
advertising
.
service
.
impl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.pcloud.book.advertising.biz.AdvertisingSpaceBiz
;
import
com.pcloud.book.advertising.service.AdvertisingSpaceService
;
import
com.pcloud.common.exceptions.BizException
;
/**
* Description 广告位内部接口实现类
* Created by PENG on 2019/5/6.
*/
@RestController
(
"advertisingSpaceService"
)
@RequestMapping
(
"advertisingSpaceService"
)
public
class
AdvertisingSpaceServiceImpl
implements
AdvertisingSpaceService
{
@Autowired
private
AdvertisingSpaceBiz
advertisingSpaceBiz
;
/**
* 每日凌晨计算昨日广告位收益
*/
@Override
@RequestMapping
(
value
=
"calculateAdvertisingIncomeYesterday"
,
method
=
RequestMethod
.
GET
)
public
void
calculateAdvertisingIncomeYesterday
()
throws
BizException
{
advertisingSpaceBiz
.
calculateAdvertisingIncomeYesterday
();
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/reader/ReaderConsr.java
View file @
e991c8ed
package
com
.
pcloud
.
book
.
consumer
.
reader
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
com.alibaba.druid.support.json.JSONUtils
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.exceptions.BizException
;
...
...
@@ -8,13 +16,6 @@ import com.pcloud.common.utils.ResponseHandleUtil;
import
com.pcloud.readercenter.wechat.dto.WechatUserRobotDto
;
import
com.pcloud.readercenter.wechat.entity.WechatUser
;
import
com.pcloud.readercenter.wechat.service.WechatUserService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @author lily
...
...
@@ -27,8 +28,6 @@ public class ReaderConsr {
*/
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ReaderConsr
.
class
);
@Autowired
private
WechatUserService
wechatUserService
;
...
...
@@ -37,14 +36,24 @@ public class ReaderConsr {
return
null
;
}
try
{
return
ResponseHandleUtil
.
parseResponse
(
wechatUserService
.
getWechatUser
(
wechatUserId
),
WechatUser
.
class
);
return
ResponseHandleUtil
.
parseResponse
(
wechatUserService
.
getWechatUser
(
wechatUserId
),
WechatUser
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"获取微信用户信息失败[wechatUserService.getWechatUser]:"
+
e
.
getMessage
(),
e
);
}
return
null
;
}
public
Map
<
Long
,
WechatUser
>
getUserList
(
List
<
Long
>
wechatUserIds
)
throws
BizException
{
if
(
ListUtils
.
isEmpty
(
wechatUserIds
))
{
return
new
HashMap
<>();
}
try
{
return
ResponseHandleUtil
.
parseMap
(
wechatUserService
.
getUserList
(
wechatUserIds
),
Long
.
class
,
WechatUser
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"获取微信用户信息失败[wechatUserService.getUserList]:"
+
e
.
getMessage
(),
e
);
}
return
null
;
}
@ParamLog
(
value
=
"随机获取n个用户"
,
isAfterReturn
=
false
)
public
List
<
WechatUserRobotDto
>
selectRobotsRandom
(
Integer
number
)
throws
BizException
{
...
...
@@ -52,7 +61,7 @@ public class ReaderConsr {
return
null
;
}
try
{
return
ResponseHandleUtil
.
parseListResponse
(
wechatUserService
.
selectRobotsRandom
(
number
),
WechatUserRobotDto
.
class
);
return
ResponseHandleUtil
.
parseListResponse
(
wechatUserService
.
selectRobotsRandom
(
number
),
WechatUserRobotDto
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"随机获取n个用户失败[wechatUserService.getWechatUserRand]:"
+
e
.
getMessage
(),
e
);
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/dto/AdGroupQrcodeDTO.java
View file @
e991c8ed
...
...
@@ -82,6 +82,11 @@ public class AdGroupQrcodeDTO implements Serializable {
private
Long
clickNum
;
/**
* 点击读者量
*/
private
Long
clickUserNum
;
/**
* 广告位数量
*/
private
Long
advertisingSpaceNum
;
...
...
@@ -259,6 +264,14 @@ public class AdGroupQrcodeDTO implements Serializable {
this
.
distributionTime
=
distributionTime
;
}
public
Long
getClickUserNum
()
{
return
clickUserNum
;
}
public
void
setClickUserNum
(
Long
clickUserNum
)
{
this
.
clickUserNum
=
clickUserNum
;
}
@Override
public
String
toString
()
{
return
"AdGroupQrcodeDTO{"
+
...
...
@@ -276,6 +289,7 @@ public class AdGroupQrcodeDTO implements Serializable {
", agentName='"
+
agentName
+
'\''
+
", exposureNum="
+
exposureNum
+
", clickNum="
+
clickNum
+
", clickUserNum="
+
clickUserNum
+
", advertisingSpaceNum="
+
advertisingSpaceNum
+
", clickRate="
+
clickRate
+
", totalIncome="
+
totalIncome
+
...
...
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingClickRecordMapper.xml
View file @
e991c8ed
...
...
@@ -2,24 +2,26 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.advertising.dao.impl.AdvertisingClickRecordDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.advertising.entity.AdvertisingClickRecord"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"ad_id"
property=
"adId"
jdbcType=
"INTEGER"
/>
<result
column=
"book_id"
property=
"bookId"
jdbcType=
"INTEGER"
/>
<result
column=
"scene_id"
property=
"sceneId"
jdbcType=
"INTEGER"
/>
<result
column=
"adviser_id"
property=
"adviserId"
jdbcType=
"INTEGER"
/>
<result
column=
"agent_id"
property=
"agentId"
jdbcType=
"INTEGER"
/>
<result
column=
"channel_id"
property=
"channelId"
jdbcType=
"INTEGER"
/>
<result
column=
"official_account_id"
property=
"officialAccountId"
jdbcType=
"INTEGER"
/>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"ad_id"
property=
"adId"
jdbcType=
"BIGINT"
/>
<result
column=
"book_id"
property=
"bookId"
jdbcType=
"BIGINT"
/>
<result
column=
"is_book_group"
property=
"isBookGroup"
jdbcType=
"BIT"
/>
<result
column=
"scene_id"
property=
"sceneId"
jdbcType=
"BIGINT"
/>
<result
column=
"adviser_id"
property=
"adviserId"
jdbcType=
"BIGINT"
/>
<result
column=
"agent_id"
property=
"agentId"
jdbcType=
"BIGINT"
/>
<result
column=
"channel_id"
property=
"channelId"
jdbcType=
"BIGINT"
/>
<result
column=
"official_account_id"
property=
"officialAccountId"
jdbcType=
"BIGINT"
/>
<result
column=
"from_type"
property=
"fromType"
jdbcType=
"VARCHAR"
/>
<result
column=
"from_id"
property=
"fromId"
jdbcType=
"
INTEGER
"
/>
<result
column=
"wechat_user_id"
property=
"wechatUserId"
jdbcType=
"
INTEGER
"
/>
<result
column=
"from_id"
property=
"fromId"
jdbcType=
"
BIGINT
"
/>
<result
column=
"wechat_user_id"
property=
"wechatUserId"
jdbcType=
"
BIGINT
"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"create_day"
property=
"createDay"
jdbcType=
"DATE"
/>
<result
column=
"create_month"
property=
"createMonth"
jdbcType=
"VARCHAR"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, ad_id, book_id, scene_id, adviser_id, agent_id, channel_id, official_account_id, from_type,
from_id, wechat_user_id, create_time, create_day
id, ad_id, book_id,
is_book_group,
scene_id, adviser_id, agent_id, channel_id, official_account_id, from_type,
from_id, wechat_user_id, create_time, create_day
, create_month
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"Long"
>
...
...
@@ -41,23 +43,109 @@
AND adviser_id = #{adviserId}
AND channel_id = #{channelId}
</if>
<if
test=
"fromId != null"
>
AND from_id = #{fromId}
AND from_type = #{fromType}
<if
test=
"statisMonth != null"
>
and create_month = #{statisMonth}
</if>
</select>
<select
id=
"getClickNumByMasterId"
parameterType=
"map"
resultType=
"Long"
>
SELECT
count(1)
FROM
advertising_click_record r
INNER JOIN advertising_space s ON r.ad_id = s.id
WHERE
s.master_id = #{masterId}
</select>
<select
id=
"getClickNumByBookId"
parameterType=
"map"
resultType=
"Long"
>
SELECT
count(1)
FROM
advertising_click_record
WHERE
book_id = #{bookId}
AND adviser_id = #{adviserId}
AND channel_id = #{channelId}
AND from_type != 'WECHAT_GROUP'
</select>
<select
id=
"getClickNumByGroupQrcodeId"
parameterType=
"map"
resultType=
"Long"
>
SELECT
count(1)
FROM
advertising_click_record
WHERE
from_id = #{qrcodeId}
AND from_type = 'WECHAT_GROUP'
<if
test=
"adId != null"
>
AND ad_id = #{adId}
</if>
<if
test=
"statisMonth != null"
>
AND create_month = #{statisMonth}
</if>
</select>
<select
id=
"getClickUserNumByGroupQrcodeId"
parameterType=
"map"
resultType=
"Long"
>
SELECT
count(DISTINCT wechat_user_id)
FROM
advertising_click_record
WHERE
from_id = #{qrcodeId}
AND from_type = 'WECHAT_GROUP'
<if
test=
"adId != null"
>
AND ad_id = #{adId}
</if>
<if
test=
"statisMonth != null"
>
AND create_month = #{statisMonth}
</if>
AND wechat_user_id IS NOT NULL
</select>
<select
id=
"getTotalClickNum"
resultType=
"Long"
>
SELECT
count(1)
FROM
advertising_click_record
</select>
<delete
id=
"deleteById"
parameterType=
"Long"
>
delete from advertising_click_record
where id = #{id}
</delete>
<select
id=
"clickUserList4AdvertisingWechatGroup"
parameterType=
"map"
resultType=
"com.pcloud.book.advertising.dto.WechatGroupClickUserDTO"
>
SELECT
ad_id adId,
official_account_id officialAccountId,
from_type fromType,
from_id fromId,
wechat_user_id wechatUserId,
max(create_time) createTime
FROM
advertising_click_record
WHERE
from_id = #{qrcodeId}
AND from_type = 'WECHAT_GROUP'
AND ad_id = #{adId}
<if
test=
"statisMonth != null"
>
AND create_month = #{statisMonth}
</if>
AND wechat_user_id IS NOT NULL
GROUP BY
wechat_user_id
ORDER BY
createTime DESC
</select>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.advertising.entity.AdvertisingClickRecord"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into advertising_click_record
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
ad_id,
book_id,
is_book_group,
scene_id,
adviser_id,
agent_id,
...
...
@@ -68,20 +156,23 @@
wechat_user_id,
create_time,
create_day,
create_month,
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{adId,jdbcType=INTEGER},
#{bookId,jdbcType=INTEGER},
#{sceneId,jdbcType=INTEGER},
#{adviserId,jdbcType=INTEGER},
#{agentId,jdbcType=INTEGER},
#{channelId,jdbcType=INTEGER},
#{officialAccountId,jdbcType=INTEGER},
#{adId,jdbcType=BIGINT},
#{bookId,jdbcType=BIGINT},
#{isBookGroup,jdbcType=BIT},
#{sceneId,jdbcType=BIGINT},
#{adviserId,jdbcType=BIGINT},
#{agentId,jdbcType=BIGINT},
#{channelId,jdbcType=BIGINT},
#{officialAccountId,jdbcType=BIGINT},
#{fromType,jdbcType=VARCHAR},
#{fromId,jdbcType=
INTEGER
},
#{wechatUserId,jdbcType=
INTEGER
},
#{fromId,jdbcType=
BIGINT
},
#{wechatUserId,jdbcType=
BIGINT
},
NOW(),
NOW(),
DATE_FORMAT(NOW(), '%Y-%m'),
</trim>
</insert>
...
...
@@ -89,36 +180,39 @@
update advertising_click_record
<set>
<if
test=
"adId != null"
>
ad_id = #{adId,jdbcType=
INTEGER
},
ad_id = #{adId,jdbcType=
BIGINT
},
</if>
<if
test=
"bookId != null"
>
book_id = #{bookId,jdbcType=INTEGER},
book_id = #{bookId,jdbcType=BIGINT},
</if>
<if
test=
"isBookGroup != null"
>
is_book_group = #{isBookGroup,jdbcType=BIT},
</if>
<if
test=
"sceneId != null"
>
scene_id = #{sceneId,jdbcType=
INTEGER
},
scene_id = #{sceneId,jdbcType=
BIGINT
},
</if>
<if
test=
"adviserId != null"
>
adviser_id = #{adviserId,jdbcType=
INTEGER
},
adviser_id = #{adviserId,jdbcType=
BIGINT
},
</if>
<if
test=
"agentId != null"
>
agent_id = #{agentId,jdbcType=
INTEGER
},
agent_id = #{agentId,jdbcType=
BIGINT
},
</if>
<if
test=
"channelId != null"
>
channel_id = #{channelId,jdbcType=
INTEGER
},
channel_id = #{channelId,jdbcType=
BIGINT
},
</if>
<if
test=
"officialAccountId != null"
>
official_account_id = #{officialAccountId,jdbcType=
INTEGER
},
official_account_id = #{officialAccountId,jdbcType=
BIGINT
},
</if>
<if
test=
"fromType != null"
>
from_type = #{fromType,jdbcType=VARCHAR},
</if>
<if
test=
"fromId != null"
>
from_id = #{fromId,jdbcType=
INTEGER
},
from_id = #{fromId,jdbcType=
BIGINT
},
</if>
<if
test=
"wechatUserId != null"
>
wechat_user_id = #{wechatUserId,jdbcType=
INTEGER
},
wechat_user_id = #{wechatUserId,jdbcType=
BIGINT
},
</if>
</set>
where id = #{id,jdbcType=
INTEGER
}
where id = #{id,jdbcType=
BIGINT
}
</update>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingDistributionBookMapper.xml
View file @
e991c8ed
...
...
@@ -2,17 +2,20 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.advertising.dao.impl.AdvertisingDistributionBookDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.advertising.entity.AdvertisingDistributionBook"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"ad_id"
property=
"adId"
jdbcType=
"INTEGER"
/>
<result
column=
"book_id"
property=
"bookId"
jdbcType=
"INTEGER"
/>
<result
column=
"adviser_id"
property=
"adviserId"
jdbcType=
"INTEGER"
/>
<result
column=
"agent_id"
property=
"agentId"
jdbcType=
"INTEGER"
/>
<result
column=
"channel_id"
property=
"channelId"
jdbcType=
"INTEGER"
/>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"ad_id"
property=
"adId"
jdbcType=
"BIGINT"
/>
<result
column=
"book_id"
property=
"bookId"
jdbcType=
"BIGINT"
/>
<result
column=
"adviser_id"
property=
"adviserId"
jdbcType=
"BIGINT"
/>
<result
column=
"agent_id"
property=
"agentId"
jdbcType=
"BIGINT"
/>
<result
column=
"channel_id"
property=
"channelId"
jdbcType=
"BIGINT"
/>
<result
column=
"is_book_group"
property=
"isBookGroup"
jdbcType=
"BIT"
/>
<result
column=
"classify_id"
property=
"classifyId"
jdbcType=
"BIGINT"
/>
<result
column=
"qrcode_id"
property=
"qrcodeId"
jdbcType=
"BIGINT"
/>
<result
column=
"distribution_time"
property=
"distributionTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, ad_id, book_id, adviser_id, agent_id, channel_id, distribution_time
id, ad_id, book_id, adviser_id, agent_id, channel_id,
is_book_group, classify_id, qrcode_id,
distribution_time
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"Long"
>
...
...
@@ -29,22 +32,139 @@
where ad_id = #{adId}
</select>
<select
id=
"c
heckBookIdExist"
parameterType=
"list"
resultType=
"Long
"
>
<select
id=
"c
ountByAdId"
resultType=
"Integer"
parameterType=
"map
"
>
select
b.book_id
count(1)
from advertising_distribution_book
where ad_id = #{adId}
</select>
<select
id=
"getDistributionBookNum"
resultType=
"Long"
>
SELECT
count(
DISTINCT (
CONCAT(a.BOOK_ID, '-', a.CHANNEL_ID)
)
)
FROM
BOOK_ADVISER a
INNER JOIN BOOK b ON a.BOOK_ID = b.BOOK_ID
AND a.IS_DELETE = 0
AND b.IS_DELETE = 0
INNER JOIN advertising_distribution_book db ON db.book_id = a.BOOK_ID
AND db.channel_id = a.CHANNEL_ID
AND db.adviser_id = a.ADVISER_ID
AND db.qrcode_id IS NULL
LEFT JOIN advertising_agent_permission ap ON ap.agent_id = db.agent_id
LEFT JOIN advertising_adviser_permission adp ON adp.adviser_id = a.ADVISER_ID
AND adp.channel_id = a.CHANNEL_ID
AND adp.book_id = a.BOOK_ID
</select>
<select
id=
"getDistributionWechatGroupNum"
resultType=
"Long"
>
select
count(distinct qrcode_id)
from
advertising_distribution_book
where
qrcode_id is not null
</select>
<select
id=
"distributionWechatGroupList"
parameterType=
"map"
resultType=
"AdGroupQrcodeDTO"
>
SELECT
c.book_id bookId,
c.channel_id channelId,
c.create_user adviserId,
q.id groupQrcodeId,
q.group_name groupQrcodeName,
db.agent_id agentId,
b.ISBN isbn,
b.BOOK_NAME bookName,
db.distribution_time distributionTime,
IF (
adp.is_open = 0
OR (
adp.is_open IS NULL
AND ap.is_open = 0
),
0,
1
) isOpen
FROM
book_group_classify c
INNER JOIN book b ON b.BOOK_ID = c.book_id
INNER JOIN book_group_qrcode q ON c.id = q.classify_id
INNER JOIN advertising_distribution_book db ON db.qrcode_id = q.id
AND db.ad_id = #{adId}
AND db.classify_id = c.id
AND db.book_id = c.book_id
LEFT JOIN advertising_agent_permission ap ON ap.agent_id = db.agent_id
LEFT JOIN advertising_adviser_permission adp ON adp.adviser_id = c.create_user
AND adp.channel_id = c.channel_id
AND adp.book_id = c.book_id
WHERE
1 = 1
<if
test=
"name != null"
>
AND (b.BOOK_NAME LIKE CONCAT('%', #{name}, '%') OR q.group_name LIKE CONCAT('%', #{name}, '%'))
</if>
GROUP BY
db.qrcode_id
ORDER BY
db.distribution_time DESC
</select>
<select
id=
"checkBookGroupAdExist"
parameterType=
"map"
resultType=
"Integer"
>
SELECT
count(1)
FROM
advertising_distribution_book b,
advertising_space s
WHERE
b.ad_id = s.id
AND b.book_id = #{bookId}
AND b.channel_id = #{channelId}
AND b.is_book_group = 1
AND s.is_open = 1
AND s.ad_position = 'BOOK_GROUP_PAGE'
AND s.ad_position_detail = #{adPositionDetail}
</select>
<select
id=
"checkBookAdExist"
parameterType=
"map"
resultType=
"Integer"
>
SELECT
count(1)
FROM
advertising_distribution_book b,
advertising_space s
WHERE
b.ad_id = s.id
AND b.book_id = #{bookId}
AND b.channel_id = #{channelId}
AND b.is_book_group = 0
AND s.is_open = 1
AND s.ad_position = 'APP_OR_PRODUCT'
AND s.ad_position_detail = #{adPositionDetail}
AND s.ad_position_mode = #{adPositionMode}
</select>
<select
id=
"checkQrcodeIdExist"
parameterType=
"map"
resultType=
"Long"
>
select
b.qrcode_id
from
advertising_distribution_book b,
advertising_space s
where
b.ad_id = s.id
and b.ad_id = #{adId}
and s.is_open = 1
and b.
book
_id in
<foreach
collection=
"
list
"
index=
"i"
item=
"item"
open=
"("
and b.
qrcode
_id in
<foreach
collection=
"
qrcodeIds
"
index=
"i"
item=
"item"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
group by
b.qrcode_id
</select>
<select
id=
"checkAdSpaceHasBook"
parameterType=
"map"
resultType=
"Boolean"
>
select
exists (
...
...
@@ -71,14 +191,20 @@
adviser_id,
agent_id,
channel_id,
is_book_group,
classify_id,
qrcode_id,
distribution_time,
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{adId,jdbcType=INTEGER},
#{bookId,jdbcType=INTEGER},
#{adviserId,jdbcType=INTEGER},
#{agentId,jdbcType=INTEGER},
#{channelId,jdbcType=INTEGER},
#{adId,jdbcType=BIGINT},
#{bookId,jdbcType=BIGINT},
#{adviserId,jdbcType=BIGINT},
#{agentId,jdbcType=BIGINT},
#{channelId,jdbcType=BIGINT},
#{isBookGroup,jdbcType=BIT},
#{classifyId,jdbcType=BIGINT},
#{qrcodeId,jdbcType=BIGINT},
NOW(),
</trim>
</insert>
...
...
@@ -91,15 +217,21 @@
adviser_id,
agent_id,
channel_id,
is_book_group,
classify_id,
qrcode_id,
distribution_time
) values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(#{item.adId,jdbcType=INTEGER},
#{item.bookId,jdbcType=INTEGER},
#{item.adviserId,jdbcType=INTEGER},
#{item.agentId,jdbcType=INTEGER},
#{item.channelId,jdbcType=INTEGER},
(#{item.adId,jdbcType=BIGINT},
#{item.bookId,jdbcType=BIGINT},
#{item.adviserId,jdbcType=BIGINT},
#{item.agentId,jdbcType=BIGINT},
#{item.channelId,jdbcType=BIGINT},
#{item.isBookGroup,jdbcType=BIT},
#{item.classifyId,jdbcType=BIGINT},
#{item.qrcodeId,jdbcType=BIGINT},
NOW())
</foreach>
</insert>
...
...
@@ -108,21 +240,30 @@
update advertising_distribution_book
<set>
<if
test=
"adId != null"
>
ad_id = #{adId,jdbcType=
INTEGER
},
ad_id = #{adId,jdbcType=
BIGINT
},
</if>
<if
test=
"bookId != null"
>
book_id = #{bookId,jdbcType=
INTEGER
},
book_id = #{bookId,jdbcType=
BIGINT
},
</if>
<if
test=
"adviserId != null"
>
adviser_id = #{adviserId,jdbcType=
INTEGER
},
adviser_id = #{adviserId,jdbcType=
BIGINT
},
</if>
<if
test=
"agentId != null"
>
agent_id = #{agentId,jdbcType=
INTEGER
},
agent_id = #{agentId,jdbcType=
BIGINT
},
</if>
<if
test=
"channelId != null"
>
channel_id = #{channelId,jdbcType=INTEGER},
channel_id = #{channelId,jdbcType=BIGINT},
</if>
<if
test=
"isBookGroup != null"
>
is_book_group = #{isBookGroup,jdbcType=BIT},
</if>
<if
test=
"classifyId != null"
>
classify_id = #{classifyId,jdbcType=BIGINT},
</if>
<if
test=
"qrcodeId != null"
>
qrcode_id = #{qrcodeId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=
INTEGER
}
where id = #{id,jdbcType=
BIGINT
}
</update>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingExposureRecordMapper.xml
View file @
e991c8ed
...
...
@@ -2,24 +2,27 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.advertising.dao.impl.AdvertisingExposureRecordDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.advertising.entity.AdvertisingExposureRecord"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"ad_id"
property=
"adId"
jdbcType=
"INTEGER"
/>
<result
column=
"book_id"
property=
"bookId"
jdbcType=
"INTEGER"
/>
<result
column=
"scene_id"
property=
"sceneId"
jdbcType=
"INTEGER"
/>
<result
column=
"adviser_id"
property=
"adviserId"
jdbcType=
"INTEGER"
/>
<result
column=
"agent_id"
property=
"agentId"
jdbcType=
"INTEGER"
/>
<result
column=
"channel_id"
property=
"channelId"
jdbcType=
"INTEGER"
/>
<result
column=
"official_account_id"
property=
"officialAccountId"
jdbcType=
"INTEGER"
/>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"ad_id"
property=
"adId"
jdbcType=
"BIGINT"
/>
<result
column=
"book_id"
property=
"bookId"
jdbcType=
"BIGINT"
/>
<result
column=
"is_book_group"
property=
"isBookGroup"
jdbcType=
"BIT"
/>
<result
column=
"scene_id"
property=
"sceneId"
jdbcType=
"BIGINT"
/>
<result
column=
"adviser_id"
property=
"adviserId"
jdbcType=
"BIGINT"
/>
<result
column=
"agent_id"
property=
"agentId"
jdbcType=
"BIGINT"
/>
<result
column=
"channel_id"
property=
"channelId"
jdbcType=
"BIGINT"
/>
<result
column=
"official_account_id"
property=
"officialAccountId"
jdbcType=
"BIGINT"
/>
<result
column=
"from_type"
property=
"fromType"
jdbcType=
"VARCHAR"
/>
<result
column=
"from_id"
property=
"fromId"
jdbcType=
"
INTEGER
"
/>
<result
column=
"wechat_user_id"
property=
"wechatUserId"
jdbcType=
"
INTEGER
"
/>
<result
column=
"from_id"
property=
"fromId"
jdbcType=
"
BIGINT
"
/>
<result
column=
"wechat_user_id"
property=
"wechatUserId"
jdbcType=
"
BIGINT
"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"create_day"
property=
"createDay"
jdbcType=
"DATE"
/>
<result
column=
"create_month"
property=
"createMonth"
jdbcType=
"VARCHAR"
/>
<result
column=
"count"
property=
"count"
jdbcType=
"BIGINT"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, ad_id, book_id, scene_id, adviser_id, agent_id, channel_id, official_account_id, from_type,
from_id, wechat_user_id, create_time, create_day
id, ad_id, book_id,
is_book_group,
scene_id, adviser_id, agent_id, channel_id, official_account_id, from_type,
from_id, wechat_user_id, create_time, create_day
, create_month, count
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"Long"
>
...
...
@@ -31,7 +34,7 @@
<select
id=
"getExposureNum"
parameterType=
"map"
resultType=
"Long"
>
SELECT
count(1
)
ifnull(sum(count), 0
)
FROM
advertising_exposure_record
WHERE
...
...
@@ -41,49 +44,114 @@
AND adviser_id = #{adviserId}
AND channel_id = #{channelId}
</if>
<if
test=
"fromId != null"
>
AND from_id = #{fromId}
AND from_type = #{fromType}
<if
test=
"statisMonth != null"
>
and create_month = #{statisMonth}
</if>
</select>
<select
id=
"distributionDateStatics"
resultType=
"com.pcloud.book.advertising.dto.DateCountDTO"
parameterType=
"map"
>
<select
id=
"getExposureNumByMasterId"
parameterType=
"map"
resultType=
"Long"
>
SELECT
ifnull(sum(count), 0)
FROM
advertising_exposure_record r
INNER JOIN advertising_space s ON r.ad_id = s.id
WHERE
s.master_id = #{masterId}
</select>
<select
id=
"getExposureNumByBookId"
parameterType=
"map"
resultType=
"Long"
>
SELECT
ifnull(sum(count), 0)
FROM
advertising_exposure_record
WHERE
book_id = #{bookId}
AND adviser_id = #{adviserId}
AND channel_id = #{channelId}
AND from_type != 'WECHAT_GROUP'
</select>
<select
id=
"getExposureNumByGroupQrcodeId"
parameterType=
"map"
resultType=
"Long"
>
SELECT
ifnull(sum(count), 0)
FROM
advertising_exposure_record
WHERE
from_id = #{qrcodeId}
AND from_type = 'WECHAT_GROUP'
<if
test=
"adId != null"
>
AND ad_id = #{adId}
</if>
<if
test=
"statisMonth != null"
>
AND create_month = #{statisMonth}
</if>
</select>
<select
id=
"getTotalExposureNum"
resultType=
"Long"
>
SELECT
ifnull(sum(count), 0)
FROM
advertising_exposure_record
</select>
<select
id=
"getFlowStatisTrend"
resultType=
"com.pcloud.book.advertising.dto.DateCountDTO"
parameterType=
"map"
>
SELECT
tmp.date,
ifnull(
count(DISTINCT er.id)
, 0) exposureNum,
ifnull(c
ount(DISTINCT cr.id)
, 0) clickNum
ifnull(
er.exposure_num
, 0) exposureNum,
ifnull(c
r.click_num
, 0) clickNum
FROM
<foreach
collection=
"collectDates"
index=
"index"
item=
"item"
open=
"("
separator=
"date union all"
close=
"date ) tmp"
>
select '${item}'
</foreach>
LEFT JOIN advertising_exposure_record er ON er.create_day = tmp.date
AND er.ad_id = #{adId}
LEFT JOIN advertising_click_record cr ON cr.create_day = tmp.date
AND cr.ad_id = #{adId}
<foreach
collection=
"collectDates"
index=
"index"
item=
"item"
open=
"("
separator=
"date union all"
close=
"date ) tmp"
>
select '${item}'
</foreach>
LEFT JOIN (
SELECT
create_day,
sum(count) exposure_num
FROM
advertising_exposure_record
WHERE
create_day BETWEEN #{startDate}
AND #{endDate}
GROUP BY
create_day
) er ON er.create_day = tmp.date
LEFT JOIN (
SELECT
create_day,
count(id) click_num
FROM
advertising_click_record
WHERE
create_day BETWEEN #{startDate}
AND #{endDate}
GROUP BY
create_day
) cr ON cr.create_day = tmp.date
GROUP BY
tmp.date
ORDER BY
tmp.date
</select>
<select
id=
"
distributionAppStatics"
resultType=
"com.pcloud.book.advertising.dto.DistributionAppDTO"
parameterType=
"map
"
>
<select
id=
"
advertisingWechatGroupRankTop"
resultType=
"AdGroupQrcodeDTO
"
>
SELECT
er.from_type fromType,
er.from_id fromId,
count(DISTINCT er.id) exposureNum,
count(DISTINCT cr.id) clickNum
r.from_id groupQrcodeId,
q.group_name groupQrcodeName,
r.book_id bookId,
b.BOOK_NAME bookName,
sum(r.count) exposureNum
FROM
advertising_exposure_record er
LEFT JOIN advertising_click_record cr ON er.ad_id = cr.ad_id
AND er.from_type = cr.from_type
AND er.from_id = cr.from_id
advertising_exposure_record r
LEFT JOIN book_group_qrcode q ON q.id = r.from_id
LEFT JOIN book b ON b.BOOK_ID = r.book_id
WHERE
er.ad_id = #{adId}
r.from_type = 'WECHAT_GROUP'
GROUP BY
er.from_type,
er.from_id
r.from_id
ORDER BY
er.create_time ASC
exposureNum DESC,
q.id DESC
LIMIT 6
</select>
<delete
id=
"deleteById"
parameterType=
"Long"
>
...
...
@@ -97,6 +165,7 @@
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
ad_id,
book_id,
is_book_group,
scene_id,
adviser_id,
agent_id,
...
...
@@ -107,57 +176,105 @@
wechat_user_id,
create_time,
create_day,
create_month,
count
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{adId,jdbcType=INTEGER},
#{bookId,jdbcType=INTEGER},
#{sceneId,jdbcType=INTEGER},
#{adviserId,jdbcType=INTEGER},
#{agentId,jdbcType=INTEGER},
#{channelId,jdbcType=INTEGER},
#{officialAccountId,jdbcType=INTEGER},
#{adId,jdbcType=BIGINT},
#{bookId,jdbcType=BIGINT},
#{isBookGroup,jdbcType=BIT},
#{sceneId,jdbcType=BIGINT},
#{adviserId,jdbcType=BIGINT},
#{agentId,jdbcType=BIGINT},
#{channelId,jdbcType=BIGINT},
#{officialAccountId,jdbcType=BIGINT},
#{fromType,jdbcType=VARCHAR},
#{fromId,jdbcType=
INTEGER
},
#{wechatUserId,jdbcType=
INTEGER
},
#{fromId,jdbcType=
BIGINT
},
#{wechatUserId,jdbcType=
BIGINT
},
NOW(),
NOW(),
DATE_FORMAT(NOW(), '%Y-%m'),
#{count,jdbcType=BIGINT}
</trim>
</insert>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.advertising.entity.AdvertisingExposureRecord"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into advertising_exposure_record
(
ad_id,
book_id,
is_book_group,
scene_id,
adviser_id,
agent_id,
channel_id,
official_account_id,
from_type,
from_id,
wechat_user_id,
create_time,
create_day,
create_month,
count
) values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(#{item.adId,jdbcType=BIGINT},
#{item.bookId,jdbcType=BIGINT},
#{item.isBookGroup,jdbcType=BIT},
#{item.sceneId,jdbcType=BIGINT},
#{item.adviserId,jdbcType=BIGINT},
#{item.agentId,jdbcType=BIGINT},
#{item.channelId,jdbcType=BIGINT},
#{item.officialAccountId,jdbcType=BIGINT},
#{item.fromType,jdbcType=VARCHAR},
#{item.fromId,jdbcType=BIGINT},
#{item.wechatUserId,jdbcType=BIGINT},
NOW(),
NOW(),
DATE_FORMAT(NOW(), '%Y-%m'),
#{item.count,jdbcType=BIGINT})
</foreach>
</insert>
<update
id=
"update"
parameterType=
"com.pcloud.book.advertising.entity.AdvertisingExposureRecord"
>
update advertising_exposure_record
<set>
<if
test=
"adId != null"
>
ad_id = #{adId,jdbcType=
INTEGER
},
ad_id = #{adId,jdbcType=
BIGINT
},
</if>
<if
test=
"bookId != null"
>
book_id = #{bookId,jdbcType=INTEGER},
book_id = #{bookId,jdbcType=BIGINT},
</if>
<if
test=
"isBookGroup != null"
>
is_book_group = #{isBookGroup,jdbcType=BIT},
</if>
<if
test=
"sceneId != null"
>
scene_id = #{sceneId,jdbcType=
INTEGER
},
scene_id = #{sceneId,jdbcType=
BIGINT
},
</if>
<if
test=
"adviserId != null"
>
adviser_id = #{adviserId,jdbcType=
INTEGER
},
adviser_id = #{adviserId,jdbcType=
BIGINT
},
</if>
<if
test=
"agentId != null"
>
agent_id = #{agentId,jdbcType=
INTEGER
},
agent_id = #{agentId,jdbcType=
BIGINT
},
</if>
<if
test=
"channelId != null"
>
channel_id = #{channelId,jdbcType=
INTEGER
},
channel_id = #{channelId,jdbcType=
BIGINT
},
</if>
<if
test=
"officialAccountId != null"
>
official_account_id = #{officialAccountId,jdbcType=
INTEGER
},
official_account_id = #{officialAccountId,jdbcType=
BIGINT
},
</if>
<if
test=
"fromType != null"
>
from_type = #{fromType,jdbcType=VARCHAR},
</if>
<if
test=
"fromId != null"
>
from_id = #{fromId,jdbcType=
INTEGER
},
from_id = #{fromId,jdbcType=
BIGINT
},
</if>
<if
test=
"wechatUserId != null"
>
wechat_user_id = #{wechatUserId,jdbcType=
INTEGER
},
wechat_user_id = #{wechatUserId,jdbcType=
BIGINT
},
</if>
</set>
where id = #{id,jdbcType=
INTEGER
}
where id = #{id,jdbcType=
BIGINT
}
</update>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingIncomeDailyMapper.xml
0 → 100644
View file @
e991c8ed
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.advertising.dao.impl.AdvertisingIncomeDailyDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.advertising.entity.AdvertisingIncomeDaily"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"ad_id"
property=
"adId"
jdbcType=
"BIGINT"
/>
<result
column=
"master_id"
property=
"masterId"
jdbcType=
"BIGINT"
/>
<result
column=
"book_id"
property=
"bookId"
jdbcType=
"BIGINT"
/>
<result
column=
"channel_id"
property=
"channelId"
jdbcType=
"BIGINT"
/>
<result
column=
"classify_id"
property=
"classifyId"
jdbcType=
"BIGINT"
/>
<result
column=
"qrcode_id"
property=
"qrcodeId"
jdbcType=
"BIGINT"
/>
<result
column=
"settlement_method"
property=
"settlementMethod"
jdbcType=
"VARCHAR"
/>
<result
column=
"price_each_time"
property=
"priceEachTime"
jdbcType=
"DECIMAL"
/>
<result
column=
"exposure_num"
property=
"exposureNum"
jdbcType=
"INTEGER"
/>
<result
column=
"click_num"
property=
"clickNum"
jdbcType=
"INTEGER"
/>
<result
column=
"income"
property=
"income"
jdbcType=
"DECIMAL"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"statis_day"
property=
"statisDay"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"statis_month"
property=
"statisMonth"
jdbcType=
"VARCHAR"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, ad_id, master_id, book_id, channel_id, classify_id, qrcode_id, settlement_method, price_each_time,
exposure_num, click_num, income, create_time, statis_day, statis_month
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
<include
refid=
"Base_Column_List"
/>
from advertising_income_daily
where id = #{id,jdbcType=BIGINT}
</select>
<select
id=
"getTotalIncome"
resultType=
"Decimal"
>
select
ifnull(sum(income), 0)
from
advertising_income_daily
</select>
<select
id=
"getIncomeByAdId"
resultType=
"Decimal"
parameterType=
"map"
>
select
ifnull(sum(income), 0)
from
advertising_income_daily
where
ad_id = #{adId}
<if
test=
"bookId != null"
>
AND book_id = #{bookId}
AND channel_id = #{channelId}
</if>
<if
test=
"statisMonth != null"
>
and statis_month = #{statisMonth}
</if>
</select>
<select
id=
"getIncomeByMasterId"
resultType=
"Decimal"
parameterType=
"map"
>
select
ifnull(sum(income), 0)
from
advertising_income_daily
where
master_id = #{masterId}
</select>
<select
id=
"getIncomeByBookId"
resultType=
"Decimal"
parameterType=
"map"
>
select
ifnull(sum(income), 0)
from
advertising_income_daily
where
book_id = #{bookId}
AND channel_id = #{channelId}
AND qrcode_id = 0
</select>
<select
id=
"getIncomeByGroupQrcodeId"
resultType=
"Decimal"
parameterType=
"map"
>
select
ifnull(sum(income), 0)
from
advertising_income_daily
where
qrcode_id = #{qrcodeId}
<if
test=
"adId != null"
>
and ad_id = #{adId}
</if>
<if
test=
"statisMonth != null"
>
and statis_month = #{statisMonth}
</if>
</select>
<select
id=
"getIncomeStatisTrend"
resultType=
"com.pcloud.book.advertising.dto.DateCountDTO"
parameterType=
"map"
>
SELECT
tmp.date,
ifnull(sum(d.income), 0) income
FROM
<foreach
collection=
"collectDates"
index=
"index"
item=
"item"
open=
"("
separator=
"date union all"
close=
"date ) tmp"
>
select '${item}'
</foreach>
LEFT JOIN advertising_income_daily d ON d.statis_day = tmp.date
GROUP BY
tmp.date
ORDER BY
tmp.date
</select>
<delete
id=
"deleteById"
parameterType=
"java.lang.Long"
>
delete from advertising_income_daily
where id = #{id,jdbcType=BIGINT}
</delete>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.advertising.entity.AdvertisingIncomeDaily"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into advertising_income_daily
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
ad_id,
master_id,
book_id,
channel_id,
classify_id,
qrcode_id,
settlement_method,
price_each_time,
exposure_num,
click_num,
income,
create_time,
statis_day,
statis_month,
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{adId,jdbcType=BIGINT},
#{masterId,jdbcType=BIGINT},
#{bookId,jdbcType=BIGINT},
#{channelId,jdbcType=BIGINT},
#{classifyId,jdbcType=BIGINT},
#{qrcodeId,jdbcType=BIGINT},
#{settlementMethod,jdbcType=VARCHAR},
#{priceEachTime,jdbcType=DECIMAL},
#{exposureNum,jdbcType=INTEGER},
#{clickNum,jdbcType=INTEGER},
#{income,jdbcType=DECIMAL},
NOW(),
#{statisDay,jdbcType=TIMESTAMP},
#{statisMonth,jdbcType=VARCHAR},
</trim>
</insert>
<insert
id=
"insertRecordWithoutWechatGroupMsgAd"
parameterType=
"map"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
INSERT INTO advertising_income_daily (
ad_id,
master_id,
book_id,
channel_id,
classify_id,
qrcode_id,
settlement_method,
price_each_time,
exposure_num,
click_num,
income,
create_time,
statis_day,
statis_month
) SELECT
b.ad_id,
s.master_id,
b.book_id,
b.channel_id,
ifnull(b.classify_id, 0),
ifnull(b.qrcode_id, 0),
m.settlement_method,
m.price_each_time,
ifnull(er.exposure_num, 0) exposure_num,
ifnull(cr.click_num, 0) click_num,
(
CASE m.settlement_method
WHEN 'CPC' THEN
ifnull(cr.click_num, 0) * m.price_each_time
WHEN 'CPM' THEN
ifnull(er.exposure_num, 0) * m.price_each_time
ELSE
0
END
) income,
now(),
#{createDay},
DATE_FORMAT(#{createDay}, '%Y-%m')
FROM
advertising_settlement_method m,
advertising_space s,
advertising_distribution_book b
LEFT JOIN (
SELECT
ad_id,
book_id,
channel_id,
sum(count) exposure_num
FROM
advertising_exposure_record
WHERE
create_day = #{createDay}
AND from_type != 'WECHAT_GROUP'
GROUP BY
ad_id,
book_id,
channel_id
) er ON er.ad_id = b.ad_id
AND er.book_id = b.book_id
AND er.channel_id = b.channel_id
LEFT JOIN (
SELECT
ad_id,
book_id,
channel_id,
count(id) click_num
FROM
advertising_click_record
WHERE
create_day = #{createDay}
AND from_type != 'WECHAT_GROUP'
GROUP BY
ad_id,
book_id,
channel_id
) cr ON cr.ad_id = b.ad_id
AND cr.book_id = b.book_id
AND cr.channel_id = b.channel_id
WHERE
b.ad_id = s.id
AND s.id = m.ad_id
AND (
s.ad_position = 'BOOK_GROUP_PAGE'
OR s.ad_position = 'APP_OR_PRODUCT'
)
AND b.qrcode_id IS NULL
GROUP BY
b.ad_id,
b.book_id,
b.channel_id
HAVING
income > 0
</insert>
<insert
id=
"insertWechatGroupMsgAdRecord"
parameterType=
"map"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
INSERT INTO advertising_income_daily (
ad_id,
master_id,
book_id,
channel_id,
classify_id,
qrcode_id,
settlement_method,
price_each_time,
exposure_num,
click_num,
income,
create_time,
statis_day,
statis_month
) SELECT
b.ad_id,
s.master_id,
b.book_id,
b.channel_id,
ifnull(b.classify_id, 0),
ifnull(b.qrcode_id, 0),
m.settlement_method,
m.price_each_time,
ifnull(er.exposure_num, 0) exposure_num,
ifnull(cr.click_num, 0) click_num,
(
CASE m.settlement_method
WHEN 'CPC' THEN
ifnull(cr.click_num, 0) * m.price_each_time
WHEN 'CPM' THEN
ifnull(er.exposure_num, 0) * m.price_each_time
ELSE
0
END
) income,
now(),
#{createDay},
DATE_FORMAT(#{createDay}, '%Y-%m')
FROM
advertising_settlement_method m,
advertising_space s,
advertising_distribution_book b
LEFT JOIN (
SELECT
ad_id,
book_id,
channel_id,
from_id,
sum(count) exposure_num
FROM
advertising_exposure_record
WHERE
create_day = #{createDay}
AND from_type = 'WECHAT_GROUP'
GROUP BY
ad_id,
book_id,
channel_id,
from_id
) er ON er.ad_id = b.ad_id
AND er.book_id = b.book_id
AND er.channel_id = b.channel_id
AND er.from_id = b.qrcode_id
LEFT JOIN (
SELECT
ad_id,
book_id,
channel_id,
from_id,
count(id) click_num
FROM
advertising_click_record
WHERE
create_day = #{createDay}
AND from_type = 'WECHAT_GROUP'
GROUP BY
ad_id,
book_id,
channel_id,
from_id
) cr ON cr.ad_id = b.ad_id
AND cr.book_id = b.book_id
AND cr.channel_id = b.channel_id
AND cr.from_id = b.qrcode_id
WHERE
b.ad_id = s.id
AND s.id = m.ad_id
AND s.ad_position = 'WECHAT_GROUP_MSG'
AND b.qrcode_id IS NOT NULL
GROUP BY
b.ad_id,
b.book_id,
b.channel_id,
b.classify_id,
b.qrcode_id
HAVING
income > 0
</insert>
<update
id=
"update"
parameterType=
"com.pcloud.book.advertising.entity.AdvertisingIncomeDaily"
>
update advertising_income_daily
<set>
<if
test=
"adId != null"
>
ad_id = #{adId,jdbcType=BIGINT},
</if>
<if
test=
"masterId != null"
>
master_id = #{masterId,jdbcType=BIGINT},
</if>
<if
test=
"bookId != null"
>
book_id = #{bookId,jdbcType=BIGINT},
</if>
<if
test=
"channelId != null"
>
channel_id = #{channelId,jdbcType=BIGINT},
</if>
<if
test=
"classifyId != null"
>
classify_id = #{classifyId,jdbcType=BIGINT},
</if>
<if
test=
"qrcodeId != null"
>
qrcode_id = #{qrcodeId,jdbcType=BIGINT},
</if>
<if
test=
"settlementMethod != null"
>
settlement_method = #{settlementMethod,jdbcType=VARCHAR},
</if>
<if
test=
"priceEachTime != null"
>
price_each_time = #{priceEachTime,jdbcType=DECIMAL},
</if>
<if
test=
"exposureNum != null"
>
exposure_num = #{exposureNum,jdbcType=INTEGER},
</if>
<if
test=
"clickNum != null"
>
click_num = #{clickNum,jdbcType=INTEGER},
</if>
<if
test=
"income != null"
>
income = #{income,jdbcType=DECIMAL},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"statisDay != null"
>
statis_day = #{statisDay,jdbcType=TIMESTAMP},
</if>
<if
test=
"statisMonth != null"
>
statis_month = #{statisMonth,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingMasterMapper.xml
0 → 100644
View file @
e991c8ed
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.advertising.dao.impl.AdvertisingMasterDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.advertising.entity.AdvertisingMaster"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"master_name"
property=
"masterName"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<resultMap
id=
"AdvertisingMasterDTO"
type=
"com.pcloud.book.advertising.dto.AdvertisingMasterDTO"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"master_name"
property=
"masterName"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, master_name, create_time, update_time
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
<include
refid=
"Base_Column_List"
/>
from advertising_master
where id = #{id,jdbcType=BIGINT}
</select>
<select
id=
"getDTOById"
resultMap=
"AdvertisingMasterDTO"
parameterType=
"java.lang.Long"
>
select
<include
refid=
"Base_Column_List"
/>
from advertising_master
where id = #{id,jdbcType=BIGINT}
</select>
<select
id=
"checkMasterNameExist"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
exists (
select
id
from
advertising_master
where
master_name = #{masterName,jdbcType=VARCHAR}
<if
test=
"masterId != null"
>
and id != #{masterId,jdbcType=BIGINT}
</if>
)
</select>
<delete
id=
"deleteById"
parameterType=
"java.lang.Long"
>
delete from advertising_master
where id = #{id,jdbcType=BIGINT}
</delete>
<select
id=
"getMasterList"
parameterType=
"map"
resultMap=
"AdvertisingMasterDTO"
>
select
m.id,
m.master_name,
m.create_time,
m.update_time,
count(s.id) spaceNum
from
advertising_master m
left join advertising_space s on s.master_id = m.id
where 1 = 1
<if
test=
"null != masterName and masterName != ''"
>
and m.master_name like concat('%', #{masterName}, '%')
</if>
group by
m.id
</select>
<select
id=
"getAllMaster"
resultMap=
"AdvertisingMasterDTO"
>
select
<include
refid=
"Base_Column_List"
/>
from advertising_master
</select>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.advertising.entity.AdvertisingMaster"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into advertising_master
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
master_name,
create_time,
update_time,
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{masterName,jdbcType=VARCHAR},
NOW(),
NOW(),
</trim>
</insert>
<update
id=
"update"
parameterType=
"com.pcloud.book.advertising.entity.AdvertisingMaster"
>
update advertising_master
<set>
<if
test=
"masterName != null"
>
master_name = #{masterName,jdbcType=VARCHAR},
</if>
update_time = NOW(),
</set>
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingSettlementMethodMapper.xml
0 → 100644
View file @
e991c8ed
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.advertising.dao.impl.AdvertisingSettlementMethodDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.advertising.entity.AdvertisingSettlementMethod"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"master_id"
property=
"masterId"
jdbcType=
"BIGINT"
/>
<result
column=
"ad_id"
property=
"adId"
jdbcType=
"BIGINT"
/>
<result
column=
"settlement_method"
property=
"settlementMethod"
jdbcType=
"VARCHAR"
/>
<result
column=
"price_each_time"
property=
"priceEachTime"
jdbcType=
"DECIMAL"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<resultMap
id=
"AdvertisingSettlementMethodDTO"
type=
"com.pcloud.book.advertising.dto.AdvertisingSettlementMethodDTO"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"master_id"
property=
"masterId"
jdbcType=
"BIGINT"
/>
<result
column=
"ad_id"
property=
"adId"
jdbcType=
"BIGINT"
/>
<result
column=
"settlement_method"
property=
"settlementMethod"
jdbcType=
"VARCHAR"
/>
<result
column=
"price_each_time"
property=
"priceEachTime"
jdbcType=
"DECIMAL"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, master_id, ad_id, settlement_method, price_each_time, create_time, update_time
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
<include
refid=
"Base_Column_List"
/>
from advertising_settlement_method
where id = #{id,jdbcType=BIGINT}
</select>
<delete
id=
"deleteById"
parameterType=
"java.lang.Long"
>
delete from advertising_settlement_method
where id = #{id,jdbcType=BIGINT}
</delete>
<delete
id=
"deleteByMasterId"
parameterType=
"java.lang.Long"
>
delete from advertising_settlement_method
where master_id = #{masterId,jdbcType=BIGINT}
and ad_id is null
</delete>
<select
id=
"getByMasterId"
parameterType=
"java.lang.Long"
resultMap=
"AdvertisingSettlementMethodDTO"
>
select
<include
refid=
"Base_Column_List"
/>
from advertising_settlement_method
where master_id = #{masterId,jdbcType=BIGINT}
and ad_id is null
</select>
<select
id=
"getByMasterIdAndAdId"
parameterType=
"map"
resultMap=
"AdvertisingSettlementMethodDTO"
>
select
<include
refid=
"Base_Column_List"
/>
from advertising_settlement_method
where master_id = #{masterId,jdbcType=BIGINT}
and ad_id = #{adId,jdbcType=BIGINT}
order by create_time desc
limit 1
</select>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.advertising.entity.AdvertisingSettlementMethod"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into advertising_settlement_method
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
master_id,
ad_id,
settlement_method,
price_each_time,
create_time,
update_time,
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{masterId,jdbcType=BIGINT},
#{adId,jdbcType=BIGINT},
#{settlementMethod,jdbcType=VARCHAR},
#{priceEachTime,jdbcType=DECIMAL},
NOW(),
NOW(),
</trim>
</insert>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.advertising.entity.AdvertisingSettlementMethod"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into advertising_settlement_method (
master_id,
ad_id,
settlement_method,
price_each_time,
create_time,
update_time
) values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(#{item.masterId,jdbcType=BIGINT},
#{item.adId,jdbcType=BIGINT},
#{item.settlementMethod,jdbcType=VARCHAR},
#{item.priceEachTime,jdbcType=DECIMAL},
NOW(),
NOW())
</foreach>
</insert>
<update
id=
"update"
parameterType=
"com.pcloud.book.advertising.entity.AdvertisingSettlementMethod"
>
update advertising_settlement_method
<set>
<if
test=
"masterId != null"
>
master_id = #{masterId,jdbcType=BIGINT},
</if>
<if
test=
"adId != null"
>
ad_id = #{adId,jdbcType=BIGINT},
</if>
<if
test=
"settlementMethod != null"
>
settlement_method = #{settlementMethod,jdbcType=VARCHAR},
</if>
<if
test=
"priceEachTime != null"
>
price_each_time = #{priceEachTime,jdbcType=DECIMAL},
</if>
update_time = NOW(),
</set>
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingSpaceMapper.xml
View file @
e991c8ed
...
...
@@ -2,38 +2,42 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.advertising.dao.impl.AdvertisingSpaceDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.advertising.entity.AdvertisingSpace"
>
<id
column=
"id"
property=
"id"
jdbcType=
"
INTEGER
"
/>
<id
column=
"id"
property=
"id"
jdbcType=
"
BIGINT
"
/>
<result
column=
"ad_name"
property=
"adName"
jdbcType=
"VARCHAR"
/>
<result
column=
"ad_position"
property=
"adPosition"
jdbcType=
"VARCHAR"
/>
<result
column=
"ad_source"
property=
"adSource"
jdbcType=
"VARCHAR"
/>
<result
column=
"ad_position_mode"
property=
"adPositionMode"
jdbcType=
"VARCHAR"
/>
<result
column=
"ad_position_detail"
property=
"adPositionDetail"
jdbcType=
"VARCHAR"
/>
<result
column=
"master_id"
property=
"masterId"
jdbcType=
"BIGINT"
/>
<result
column=
"ad_link"
property=
"adLink"
jdbcType=
"VARCHAR"
/>
<result
column=
"source_id"
property=
"sourceId"
jdbcType=
"VARCHAR"
/>
<result
column=
"ad_title"
property=
"adTitle"
jdbcType=
"VARCHAR"
/>
<result
column=
"ad_slogan"
property=
"adSlogan"
jdbcType=
"VARCHAR"
/>
<result
column=
"ad_pic"
property=
"adPic"
jdbcType=
"VARCHAR"
/>
<result
column=
"distribution_type"
property=
"distributionType"
jdbcType=
"BIT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"is_open"
property=
"isOpen"
jdbcType=
"BIT"
/>
</resultMap>
<resultMap
id=
"AdvertisingSpaceDTO"
type=
"com.pcloud.book.advertising.dto.AdvertisingSpaceDTO"
>
<id
column=
"id"
property=
"id"
jdbcType=
"
INTEGER
"
/>
<id
column=
"id"
property=
"id"
jdbcType=
"
BIGINT
"
/>
<result
column=
"ad_name"
property=
"adName"
jdbcType=
"VARCHAR"
/>
<result
column=
"ad_position"
property=
"adPosition"
jdbcType=
"VARCHAR"
/>
<result
column=
"ad_source"
property=
"adSource"
jdbcType=
"VARCHAR"
/>
<result
column=
"ad_position_mode"
property=
"adPositionMode"
jdbcType=
"VARCHAR"
/>
<result
column=
"ad_position_detail"
property=
"adPositionDetail"
jdbcType=
"VARCHAR"
/>
<result
column=
"master_id"
property=
"masterId"
jdbcType=
"BIGINT"
/>
<result
column=
"ad_link"
property=
"adLink"
jdbcType=
"VARCHAR"
/>
<result
column=
"source_id"
property=
"sourceId"
jdbcType=
"VARCHAR"
/>
<result
column=
"ad_title"
property=
"adTitle"
jdbcType=
"VARCHAR"
/>
<result
column=
"ad_slogan"
property=
"adSlogan"
jdbcType=
"VARCHAR"
/>
<result
column=
"ad_pic"
property=
"adPic"
jdbcType=
"VARCHAR"
/>
<result
column=
"distribution_type"
property=
"distributionType"
jdbcType=
"BIT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"is_open"
property=
"isOpen"
jdbcType=
"BIT"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, ad_name, ad_position, ad_
source, ad_link, source_id, ad_slogan, ad_pic, distribution_type
,
create_time, update_time, is_open
id, ad_name, ad_position, ad_
position_mode, ad_position_detail, master_id, ad_link, source_id
,
ad_title, ad_slogan, ad_pic,
create_time, update_time, is_open
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"Long"
>
...
...
@@ -56,8 +60,10 @@
s.ad_name,
s.ad_link,
s.ad_position,
s.ad_source,
s.ad_position_detail,
s.ad_position_mode,
s.source_id,
s.ad_title,
s.ad_slogan,
s.ad_pic
FROM
...
...
@@ -66,32 +72,48 @@
WHERE
b.ad_id = s.id
AND s.is_open = 1
AND s.ad_position_detail = #{adPositionDetail}
AND b.book_id = #{bookId}
AND b.adviser_id = #{adviserId}
AND b.channel_id = #{channelId}
AND b.is_book_group = 0
ORDER BY
b.distribution_time DESC
LIMIT 1
</select>
<select
id=
"get
NoSignBookAd
"
resultMap=
"AdvertisingSpaceDTO"
parameterType=
"map"
>
<select
id=
"get
DTOByBookId4BookGroup
"
resultMap=
"AdvertisingSpaceDTO"
parameterType=
"map"
>
SELECT
s.id,
s.ad_name,
s.ad_link,
s.ad_position,
s.ad_source,
s.ad_position_detail,
s.ad_position_mode,
s.source_id,
s.ad_title,
s.ad_slogan,
s.ad_pic
FROM
advertising_distribution_book b,
advertising_space s
WHERE
s.is_open = 1
and s.distribution_type = 1
b.ad_id = s.id
AND s.is_open = 1
AND s.ad_position_detail = #{adPositionDetail}
AND b.book_id = #{bookId}
AND b.adviser_id = #{adviserId}
AND b.channel_id = #{channelId}
AND b.is_book_group = 1
ORDER BY
s.create_time DESC
LIMIT 1
b.distribution_time DESC
limit 1
</select>
<select
id=
"getSpaceNum"
resultType=
"Long"
>
select
count(1)
from
advertising_space
</select>
<select
id=
"list"
parameterType=
"map"
resultMap=
"AdvertisingSpaceDTO"
>
...
...
@@ -102,8 +124,87 @@
<if
test=
"name != null"
>
AND (ad_name LIKE CONCAT('%', #{name}, '%') OR source_id LIKE CONCAT(#{name},'%'))
</if>
order by
create_time desc
</select>
<select
id=
"advertisingDetail4Book"
parameterType=
"map"
resultMap=
"AdvertisingSpaceDTO"
>
SELECT
s.id,
s.ad_name,
s.ad_position,
s.ad_position_detail,
s.ad_position_mode,
s.master_id,
s.ad_pic,
s.is_open,
b.distribution_time distributionTime
FROM
advertising_distribution_book b,
advertising_space s
WHERE
b.ad_id = s.id
AND b.book_id = #{bookId}
AND b.channel_id = #{channelId}
AND b.adviser_id = #{adviserId}
AND s.ad_position != 'WECHAT_GROUP_MSG'
ORDER BY
b.distribution_time DESC
</select>
<select
id=
"advertisingDetail4WechatGroup"
parameterType=
"map"
resultMap=
"AdvertisingSpaceDTO"
>
SELECT
s.id,
s.ad_name,
s.ad_position,
s.ad_position_detail,
s.ad_position_mode,
s.master_id,
s.ad_pic,
s.ad_link,
s.is_open,
b.distribution_time distributionTime
FROM
advertising_distribution_book b,
advertising_space s
WHERE
b.ad_id = s.id
AND b.qrcode_id = #{qrcodeId}
AND s.ad_position = 'WECHAT_GROUP_MSG'
ORDER BY
b.distribution_time DESC
</select>
<select
id=
"advertisingDetail4Master"
parameterType=
"map"
resultMap=
"AdvertisingSpaceDTO"
>
SELECT
s.id,
s.ad_name,
s.ad_position,
s.ad_position_detail,
s.ad_position_mode,
s.master_id,
s.source_id,
s.ad_pic,
s.is_open,
b.distribution_time distributionTime,
b.book_id bookId,
b.qrcode_id qrcodeId,
b.agent_id agentId,
b.adviser_id adviserId,
b. channel_id channelId
FROM
advertising_space s
LEFT JOIN advertising_distribution_book b ON b.ad_id = s.id
WHERE
s.master_id = #{masterId}
GROUP BY
s.id,
b.book_id,
b.channel_id,
b.classify_id,
b.qrcode_id
ORDER BY
create
_time DESC
b.distribution
_time DESC
</select>
<delete
id=
"deleteById"
parameterType=
"Long"
>
...
...
@@ -117,12 +218,14 @@
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
ad_name,
ad_position,
ad_source,
ad_position_mode,
ad_position_detail,
master_id,
ad_link,
source_id,
ad_title,
ad_slogan,
ad_pic,
distribution_type,
create_time,
update_time,
is_open,
...
...
@@ -130,12 +233,14 @@
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{adName,jdbcType=VARCHAR},
#{adPosition,jdbcType=VARCHAR},
#{adSource,jdbcType=VARCHAR},
#{adPositionMode,jdbcType=VARCHAR},
#{adPositionDetail,jdbcType=VARCHAR},
#{masterId,jdbcType=BIGINT},
#{adLink,jdbcType=VARCHAR},
#{sourceId,jdbcType=VARCHAR},
#{adTitle,jdbcType=VARCHAR},
#{adSlogan,jdbcType=VARCHAR},
#{adPic,jdbcType=VARCHAR},
#{distributionType,jdbcType=BIT},
NOW(),
NOW(),
#{isOpen,jdbcType=BIT},
...
...
@@ -151,8 +256,14 @@
<if
test=
"adPosition != null"
>
ad_position = #{adPosition,jdbcType=VARCHAR},
</if>
<if
test=
"adSource != null"
>
ad_source = #{adSource,jdbcType=VARCHAR},
<if
test=
"adPositionMode != null"
>
ad_position_mode = #{adPositionMode,jdbcType=VARCHAR},
</if>
<if
test=
"adPositionDetail != null"
>
ad_position_detail = #{adPositionDetail,jdbcType=VARCHAR},
</if>
<if
test=
"masterId != null"
>
master_id = #{masterId,jdbcType=BIGINT},
</if>
<if
test=
"adLink != null"
>
ad_link = #{adLink,jdbcType=VARCHAR},
...
...
@@ -160,15 +271,15 @@
<if
test=
"sourceId != null"
>
source_id = #{sourceId,jdbcType=VARCHAR},
</if>
<if
test=
"adTitle != null"
>
ad_title = #{adTitle,jdbcType=VARCHAR},
</if>
<if
test=
"adSlogan != null"
>
ad_slogan = #{adSlogan,jdbcType=VARCHAR},
</if>
<if
test=
"adPic != null"
>
ad_pic = #{adPic,jdbcType=VARCHAR},
</if>
<if
test=
"distributionType != null"
>
distribution_type = #{distributionType,jdbcType=BIT},
</if>
update_time = NOW(),
<if
test=
"isOpen != null"
>
is_open = #{isOpen,jdbcType=BIT},
...
...
pcloud-service-book/src/main/resources/mapper/book/Book.Mapper.xml
View file @
e991c8ed
...
...
@@ -726,7 +726,7 @@
</select>
<!-- 获取书籍列表(编辑) -->
<select
id=
"
listBook4AdvertisingSpaceNoSignBook
"
resultMap=
"bookMap"
parameterType=
"map"
>
<select
id=
"
advertisingBookList
"
resultMap=
"bookMap"
parameterType=
"map"
>
SELECT
a.BOOK_ID,
a.CHANNEL_ID,
...
...
@@ -735,37 +735,25 @@
b.ISBN,
b.BOOK_NAME,
b.COVER_IMG,
IF (
adp.is_open = 0
OR (
adp.is_open IS NULL
AND ap.is_open = 0
),
0,
1
) isOpen
count(DISTINCT db.id) advertisingSpaceNum,
IF (
adp.is_open = 0
OR (
adp.is_open IS NULL
AND ap.is_open = 0
),
0,
1
) isOpen
FROM
BOOK_ADVISER a
INNER JOIN BOOK b ON a.BOOK_ID = b.BOOK_ID
AND a.IS_DELETE = 0
AND b.IS_DELETE = 0
INNER JOIN (
SELECT
book_id,
adviser_id,
channel_id,
agent_id
FROM
advertising_exposure_record
WHERE
ad_id = #{adId}
GROUP BY
book_id,
adviser_id,
channel_id
) db ON db.book_id = a.BOOK_ID
INNER JOIN advertising_distribution_book db ON db.book_id = a.BOOK_ID
AND db.channel_id = a.CHANNEL_ID
AND db.adviser_id = a.ADVISER_ID
AND db.qrcode_id IS NULL
LEFT JOIN advertising_agent_permission ap ON ap.agent_id = db.agent_id
LEFT JOIN advertising_adviser_permission adp ON adp.adviser_id = a.ADVISER_ID
AND adp.channel_id = a.CHANNEL_ID
...
...
@@ -779,7 +767,7 @@
a.BOOK_ID,
a.CHANNEL_ID
ORDER BY
a.CREATED_DATE DE
SC
db.id A
SC
</select>
<!-- 获取书籍列表(平台) -->
...
...
@@ -809,9 +797,14 @@
FROM
BOOK_ADVISER a
INNER JOIN BOOK b ON a.BOOK_ID = b.BOOK_ID
AND a.ADVISER_ID = #{adviserId}
AND a.IS_DELETE = 0
AND b.IS_DELETE = 0
<if
test=
"bookGroupOnly != null and bookGroupOnly == 1"
>
INNER JOIN book_group g ON g.BOOK_ID = a.BOOK_ID
AND g.CHANNEL_ID = a.CHANNEL_ID
AND g.CREATE_USER = a.ADVISER_ID
AND g.IS_DELETE = 0
</if>
LEFT JOIN (
SELECT
db.id,
...
...
@@ -828,14 +821,23 @@
AND t.book_id = a.BOOK_ID
WHERE
a.IS_MAIN_EDITOR = 1
<if
test=
"adviserId != null"
>
AND a.ADVISER_ID = #{adviserId}
</if>
<if
test=
"name != null"
>
AND (b.BOOK_NAME LIKE CONCAT('%', #{name}, '%') OR b.ISBN LIKE CONCAT(#{name},'%'))
</if>
GROUP BY
a.BOOK_ID,
a.CHANNEL_ID
ORDER BY
a.CREATED_DATE DESC
<if
test=
"bookGroupOnly != null and bookGroupOnly == 1"
>
ORDER BY
g.create_time DESC
</if>
<if
test=
"bookGroupOnly == null or bookGroupOnly != 1"
>
ORDER BY
a.CREATED_DATE DESC
</if>
</select>
<!-- 获取书籍列表(编辑) -->
...
...
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