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
8baf1905
Commit
8baf1905
authored
Jul 15, 2019
by
朱亚洁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合并-广告位数据统计
parent
f725f7e2
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
713 additions
and
160 deletions
+713
-160
BmBiz.java
.../src/main/java/com/pcloud/book/advertising/biz/BmBiz.java
+12
-3
AdvertisingSpaceBizImpl.java
...ud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
+50
-37
BmBizImpl.java
.../java/com/pcloud/book/advertising/biz/impl/BmBizImpl.java
+71
-31
AdvertisingClickRecordDao.java
...cloud/book/advertising/dao/AdvertisingClickRecordDao.java
+27
-0
BmOptionDao.java
...ain/java/com/pcloud/book/advertising/dao/BmOptionDao.java
+7
-0
BmRegisterDao.java
...n/java/com/pcloud/book/advertising/dao/BmRegisterDao.java
+27
-5
BmRegisterItemDao.java
...va/com/pcloud/book/advertising/dao/BmRegisterItemDao.java
+9
-0
AdvertisingClickRecordDaoImpl.java
...k/advertising/dao/impl/AdvertisingClickRecordDaoImpl.java
+34
-3
BmOptionDaoImpl.java
...com/pcloud/book/advertising/dao/impl/BmOptionDaoImpl.java
+5
-0
BmRegisterDaoImpl.java
...m/pcloud/book/advertising/dao/impl/BmRegisterDaoImpl.java
+39
-13
BmRegisterItemDaoImpl.java
...loud/book/advertising/dao/impl/BmRegisterItemDaoImpl.java
+13
-0
AdvertisingBmRegister.java
...pcloud/book/advertising/entity/AdvertisingBmRegister.java
+151
-0
BmFacade.java
...ain/java/com/pcloud/book/advertising/facade/BmFacade.java
+13
-6
BmFacadeImpl.java
...com/pcloud/book/advertising/facade/impl/BmFacadeImpl.java
+32
-15
AdvertisingBmOptionMapper.xml
...esources/mapper/advertising/AdvertisingBmOptionMapper.xml
+15
-0
AdvertisingBmRegisterItemMapper.xml
...es/mapper/advertising/AdvertisingBmRegisterItemMapper.xml
+16
-0
AdvertisingBmRegisterMapper.xml
...ources/mapper/advertising/AdvertisingBmRegisterMapper.xml
+114
-25
AdvertisingClickRecordMapper.xml
...urces/mapper/advertising/AdvertisingClickRecordMapper.xml
+47
-3
AdvertisingIncomeDailyMapper.xml
...urces/mapper/advertising/AdvertisingIncomeDailyMapper.xml
+31
-19
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/BmBiz.java
View file @
8baf1905
...
...
@@ -72,7 +72,7 @@ public interface BmBiz {
* @param wechatUserId
* @return
*/
Long
userSubmit
(
AdvertisingBmRegister
bmRegister
,
Long
wechatUserId
,
Long
qrcodeId
);
Long
userSubmit
(
AdvertisingBmRegister
bmRegister
,
Long
wechatUserId
);
/**
* 微信端获取个人报名详情
* @param adId 应用ID
...
...
@@ -87,7 +87,7 @@ public interface BmBiz {
* @param adId
* @return
*/
public
Long
getRegisterCountByAdId
(
Long
adId
,
String
statisMonth
);
public
Long
getRegisterCountByAdId
(
Long
adId
,
String
statisMonth
,
Long
bookId
,
Long
adviserId
,
Long
channelId
);
/**
* 获取微信群报名次数
...
...
@@ -109,5 +109,14 @@ public interface BmBiz {
* 导出报名表单
* @param adId
*/
Map
<
String
,
Object
>
exportRegisterInfoByAdId
(
Long
adId
,
Long
qrcodeId
);
Map
<
String
,
Object
>
exportRegisterInfoByAdId
(
Long
adId
,
Long
qrcodeId
,
String
statisMonth
,
Long
bookId
,
Long
adviserId
,
Long
channelId
);
/**
* 获取微信群报名人数
* @param qrcodeId
* @param adId
* @param statisMonth
* @return
*/
Long
getRegisterUserNumByAdIdQrcodeId
(
Long
qrcodeId
,
Long
adId
,
String
statisMonth
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
View file @
8baf1905
...
...
@@ -628,7 +628,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
sendTextMessageVO
.
setGroupId
(
groupId
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setContent
(
adTitle
);
LOGGER
.
info
(
"发送微信消息"
+
sendTextMessageVO
.
toString
());
LOGGER
.
info
(
"发送微信消息
-文字链接
"
+
sendTextMessageVO
.
toString
());
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
else
if
(
AdPositionModeEnum
.
NEWS_SHARE
.
modeCode
.
equals
(
advertisingSpace
.
getAdPositionMode
()))
{
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
...
...
@@ -651,14 +651,14 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
sendArticleMessageVO
.
setLinkUrl
(
adLink
);
sendArticleMessageVO
.
setPicUrl
(
advertisingSpace
.
getAdPic
());
LOGGER
.
info
(
"发送微信消息"
+
sendArticleMessageVO
.
toString
());
LOGGER
.
info
(
"发送微信消息
-图文分享
"
+
sendArticleMessageVO
.
toString
());
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
());
LOGGER
.
info
(
"发送微信消息"
+
sendPicMessageVO
.
toString
());
LOGGER
.
info
(
"发送微信消息
-纯图片
"
+
sendPicMessageVO
.
toString
());
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
}
}
...
...
@@ -885,14 +885,14 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
Long
clickNum
=
getClickNumByAdId
(
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
);
new
BigDecimal
(
bookDto
.
getClickNum
().
doubleValue
()
/
bookDto
.
getExposureNum
()).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
bookDto
.
setClickRate
(
clickRate
);
BigDecimal
income
=
getIncomeByAdId
(
adId
,
bookDto
.
getBookId
(),
bookDto
.
getChannelId
(),
null
);
bookDto
.
setTotalIncome
(
income
);
//报名量报名率
Long
registerNum
=
bmBiz
.
getRegisterCountByAdId
(
adId
,
null
);
Long
registerNum
=
bmBiz
.
getRegisterCountByAdId
(
adId
,
null
,
bookDto
.
getBookId
(),
bookDto
.
getAdviserId
(),
bookDto
.
getChannelId
()
);
BigDecimal
registerRate
=
(
null
==
clickNum
||
clickNum
.
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
registerNum
.
doubleValue
()
/
clickNum
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
new
BigDecimal
(
registerNum
.
doubleValue
()
/
clickNum
).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
bookDto
.
setRegisterNum
(
registerNum
);
bookDto
.
setRegisterRate
(
registerRate
);
}
...
...
@@ -938,7 +938,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
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
);
new
BigDecimal
(
qrcodeDTO
.
getClickNum
().
doubleValue
()
/
qrcodeDTO
.
getExposureNum
()).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
qrcodeDTO
.
setClickRate
(
clickRate
);
BigDecimal
income
=
getIncomeByGroupQrcodeId
(
qrcodeDTO
.
getGroupQrcodeId
(),
adId
,
null
);
qrcodeDTO
.
setTotalIncome
(
income
);
...
...
@@ -946,9 +946,9 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
Long
clickUserNum
=
getClickUserNumByGroupQrcodeId
(
qrcodeDTO
.
getGroupQrcodeId
(),
adId
,
null
);
qrcodeDTO
.
setClickUserNum
(
clickUserNum
);
//报名量报名率
Long
registerNum
=
bmBiz
.
getRegisterCountByAdId
(
adId
,
null
);
Long
registerNum
=
bmBiz
.
getRegisterCountByAdId
QrcodeId
(
adId
,
null
,
qrcodeDTO
.
getGroupQrcodeId
()
);
BigDecimal
registerRate
=
(
null
==
clickNum
||
clickNum
.
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
registerNum
.
doubleValue
()
/
clickNum
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
new
BigDecimal
(
registerNum
.
doubleValue
()
/
clickNum
).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
qrcodeDTO
.
setRegisterNum
(
registerNum
);
qrcodeDTO
.
setRegisterRate
(
registerRate
);
}
...
...
@@ -979,7 +979,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
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
);
new
BigDecimal
(
bookDto
.
getClickNum
().
doubleValue
()
/
bookDto
.
getExposureNum
()).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
bookDto
.
setClickRate
(
clickRate
);
BigDecimal
income
=
getIncomeByBookId
(
bookDto
.
getBookId
(),
bookDto
.
getChannelId
());
bookDto
.
setTotalIncome
(
income
);
...
...
@@ -1007,13 +1007,19 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
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
);
new
BigDecimal
(
qrcodeDTO
.
getClickNum
().
doubleValue
()
/
qrcodeDTO
.
getExposureNum
()).
setScale
(
4
,
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
);
//报名量报名率
Long
registerNum
=
bmBiz
.
getRegisterCountByAdIdQrcodeId
(
null
,
null
,
qrcodeDTO
.
getGroupQrcodeId
());
BigDecimal
registerRate
=
(
null
==
clickNum
||
clickNum
.
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
registerNum
.
doubleValue
()
/
clickNum
).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
qrcodeDTO
.
setRegisterNum
(
registerNum
);
qrcodeDTO
.
setRegisterRate
(
registerRate
);
}
return
pageBean
;
}
...
...
@@ -1237,14 +1243,14 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
spaceDTO
.
setExposureNum
(
getExposureNumByAdId
(
spaceDTO
.
getId
()));
spaceDTO
.
setClickNum
(
getClickNumByAdId
(
spaceDTO
.
getId
()));
BigDecimal
clickRate
=
(
null
==
spaceDTO
.
getExposureNum
()
||
spaceDTO
.
getExposureNum
().
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
spaceDTO
.
getClickNum
().
doubleValue
()
/
spaceDTO
.
getExposureNum
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
new
BigDecimal
(
spaceDTO
.
getClickNum
().
doubleValue
()
/
spaceDTO
.
getExposureNum
()).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
spaceDTO
.
setClickRate
(
clickRate
);
BigDecimal
income
=
getIncomeByAdId
(
spaceDTO
.
getId
());
spaceDTO
.
setTotalIncome
(
income
);
//报名量报名率
Long
registerNum
=
bmBiz
.
getRegisterCountByAdId
(
spaceDTO
.
getId
(),
null
);
Long
registerNum
=
bmBiz
.
getRegisterCountByAdId
(
spaceDTO
.
getId
(),
null
,
null
,
null
,
null
);
BigDecimal
registerRate
=
(
null
==
spaceDTO
.
getClickNum
()
||
spaceDTO
.
getClickNum
().
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
registerNum
.
doubleValue
()
/
spaceDTO
.
getClickNum
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
new
BigDecimal
(
registerNum
.
doubleValue
()
/
spaceDTO
.
getClickNum
()).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
spaceDTO
.
setRegisterNum
(
registerNum
);
spaceDTO
.
setRegisterRate
(
registerRate
);
...
...
@@ -1293,15 +1299,15 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
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
);
new
BigDecimal
(
spaceDTO
.
getClickNum
().
doubleValue
()
/
spaceDTO
.
getExposureNum
()).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
spaceDTO
.
setClickRate
(
clickRate
);
BigDecimal
income
=
getIncomeByAdId
(
spaceDTO
.
getId
(),
bookId
,
channelId
,
statisMonth
);
spaceDTO
.
setTotalIncome
(
income
);
//报名量报名率
Long
clickNum
=
spaceDTO
.
getClickNum
();
Long
registerNum
=
bmBiz
.
getRegisterCountByAdId
(
spaceDTO
.
getId
(),
statisMonth
);
Long
registerNum
=
bmBiz
.
getRegisterCountByAdId
(
spaceDTO
.
getId
(),
statisMonth
,
bookId
,
adviserId
,
channelId
);
BigDecimal
registerRate
=
(
null
==
clickNum
||
clickNum
.
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
registerNum
.
doubleValue
()
/
clickNum
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
new
BigDecimal
(
registerNum
.
doubleValue
()
/
clickNum
).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
spaceDTO
.
setRegisterNum
(
registerNum
);
spaceDTO
.
setRegisterRate
(
registerRate
);
// 填充广告位置名称
...
...
@@ -1324,7 +1330,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"暂无数据导出!"
);
}
// 字段名
String
[]
rowsName
=
{
"序号"
,
"广告位名称"
,
"广告主"
,
"广告位置"
,
"投放时间"
,
"曝光量"
,
"点击量"
,
"点击率"
,
"
报名量"
,
"报名
率"
,
"累计收益"
};
String
[]
rowsName
=
{
"序号"
,
"广告位名称"
,
"广告主"
,
"广告位置"
,
"投放时间"
,
"曝光量"
,
"点击量"
,
"点击率"
,
"
留资量"
,
"留资
率"
,
"累计收益"
};
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
Object
[]
objs
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
...
...
@@ -1342,15 +1348,15 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
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
)
+
"%"
;
new
BigDecimal
(
clickNum
.
doubleValue
()
/
exposureNum
).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
objs
[
7
]
=
clickRate
.
multiply
(
new
BigDecimal
(
100
))
+
"%"
;
//报名量报名率
Long
registerNum
=
bmBiz
.
getRegisterCountByAdId
(
spaceDTO
.
getId
(),
statisMonth
);
Long
registerNum
=
bmBiz
.
getRegisterCountByAdId
(
spaceDTO
.
getId
(),
statisMonth
,
bookId
,
adviserId
,
channelId
);
BigDecimal
registerRate
=
(
null
==
clickNum
||
clickNum
.
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
registerNum
.
doubleValue
()
/
clickNum
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
new
BigDecimal
(
registerNum
.
doubleValue
()
/
clickNum
).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
objs
[
8
]
=
registerNum
;
objs
[
9
]
=
registerRate
.
multiply
(
new
BigDecimal
(
100
))
.
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
)
+
"%"
;
objs
[
9
]
=
registerRate
.
multiply
(
new
BigDecimal
(
100
))
+
"%"
;
BigDecimal
income
=
getIncomeByAdId
(
spaceDTO
.
getId
(),
bookId
,
channelId
,
statisMonth
);
objs
[
10
]
=
income
+
"元"
;
dataList
.
add
(
objs
);
...
...
@@ -1428,7 +1434,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
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
);
new
BigDecimal
(
spaceDTO
.
getClickNum
().
doubleValue
()
/
spaceDTO
.
getExposureNum
()).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
spaceDTO
.
setClickRate
(
clickRate
);
BigDecimal
income
=
getIncomeByGroupQrcodeId
(
qrcodeId
,
spaceDTO
.
getId
(),
statisMonth
);
spaceDTO
.
setTotalIncome
(
income
);
...
...
@@ -1440,6 +1446,13 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
// 填充广告位置名称
spaceDTO
.
setAdPositionName
(
AdPositionModeEnum
.
getNameByCode
(
spaceDTO
.
getAdPositionMode
()));
//报名量报名率
Long
clickNum
=
spaceDTO
.
getClickNum
();
Long
registerNum
=
bmBiz
.
getRegisterCountByAdIdQrcodeId
(
spaceDTO
.
getId
(),
statisMonth
,
qrcodeId
);
BigDecimal
registerRate
=
(
null
==
clickNum
||
clickNum
.
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
registerNum
.
doubleValue
()
/
clickNum
).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
spaceDTO
.
setRegisterNum
(
registerNum
);
spaceDTO
.
setRegisterRate
(
registerRate
);
}
return
pageBean
;
}
...
...
@@ -1619,18 +1632,18 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
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
);
registerNum
=
bmBiz
.
getRegisterCountByAdId
(
spaceDTO
.
getId
(),
statisMonth
);
registerNum
=
bmBiz
.
getRegisterCountByAdId
(
spaceDTO
.
getId
(),
statisMonth
,
spaceDTO
.
getBookId
(),
spaceDTO
.
getAdviserId
(),
spaceDTO
.
getChannelId
()
);
}
}
BigDecimal
clickRate
=
(
null
==
exposureNum
||
exposureNum
.
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
clickNum
.
doubleValue
()
/
exposureNum
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
new
BigDecimal
(
clickNum
.
doubleValue
()
/
exposureNum
).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
spaceDTO
.
setExposureNum
(
exposureNum
);
spaceDTO
.
setClickNum
(
clickNum
);
spaceDTO
.
setClickRate
(
clickRate
);
spaceDTO
.
setTotalIncome
(
income
);
//报名量报名率
BigDecimal
registerRate
=
(
null
==
clickNum
||
clickNum
.
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
registerNum
.
doubleValue
()
/
clickNum
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
new
BigDecimal
(
registerNum
.
doubleValue
()
/
clickNum
).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
spaceDTO
.
setRegisterNum
(
registerNum
);
spaceDTO
.
setRegisterRate
(
registerRate
);
...
...
@@ -1680,7 +1693,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"暂无数据导出!"
);
}
// 字段名
String
[]
rowsName
=
{
"序号"
,
"广告位名称"
,
"对方ID"
,
"广告位置"
,
"投放渠道"
,
"投放时间"
,
"曝光量"
,
"点击量"
,
"点击率"
,
"
报名量"
,
"报名
率"
,
"累计收益"
};
String
[]
rowsName
=
{
"序号"
,
"广告位名称"
,
"对方ID"
,
"广告位置"
,
"投放渠道"
,
"投放时间"
,
"曝光量"
,
"点击量"
,
"点击率"
,
"
留资量"
,
"留资
率"
,
"累计收益"
};
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
Object
[]
objs
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
...
...
@@ -1727,19 +1740,19 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
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
);
registerNum
=
bmBiz
.
getRegisterCountByAdId
(
spaceDTO
.
getId
(),
statisMonth
);
registerNum
=
bmBiz
.
getRegisterCountByAdId
(
spaceDTO
.
getId
(),
statisMonth
,
spaceDTO
.
getBookId
(),
spaceDTO
.
getAdviserId
(),
spaceDTO
.
getChannelId
()
);
}
}
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
)
+
"%"
;
new
BigDecimal
(
clickNum
.
doubleValue
()
/
exposureNum
).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
objs
[
8
]
=
clickRate
.
multiply
(
new
BigDecimal
(
100
))
+
"%"
;
//报名量报名率
BigDecimal
registerRate
=
(
null
==
clickNum
||
clickNum
.
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
registerNum
.
doubleValue
()
/
clickNum
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
new
BigDecimal
(
registerNum
.
doubleValue
()
/
clickNum
).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
objs
[
9
]
=
registerNum
;
objs
[
10
]
=
registerRate
.
multiply
(
new
BigDecimal
(
100
))
.
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
)
+
"%"
;
objs
[
10
]
=
registerRate
.
multiply
(
new
BigDecimal
(
100
))
+
"%"
;
objs
[
11
]
=
income
+
"元"
;
dataList
.
add
(
objs
);
}
...
...
@@ -1989,7 +2002,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
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
);
new
BigDecimal
(
masterDTO
.
getClickNum
().
doubleValue
()
/
masterDTO
.
getExposureNum
()).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
masterDTO
.
setClickRate
(
clickRate
);
BigDecimal
income
=
getIncomeByMasterId
(
masterDTO
.
getId
());
masterDTO
.
setTotalIncome
(
income
);
...
...
@@ -1997,7 +2010,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
//报名量报名率
Long
registerNum
=
bmBiz
.
getRegisterCountByAdIds
(
adIdList
);
BigDecimal
registerRate
=
(
null
==
clickNum
||
clickNum
.
equals
(
0L
))
?
BigDecimal
.
ZERO
:
new
BigDecimal
(
registerNum
.
doubleValue
()
/
clickNum
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
new
BigDecimal
(
registerNum
.
doubleValue
()
/
clickNum
).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
masterDTO
.
setRegisterNum
(
registerNum
);
masterDTO
.
setRegisterRate
(
registerRate
);
}
...
...
@@ -2069,10 +2082,10 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
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
);
new
BigDecimal
(
clickNum
.
doubleValue
()
/
exposureNum
).
setScale
(
4
,
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
));
result
.
put
(
"totalIncome"
,
null
==
totalIncome
?
BigDecimal
.
ZERO
:
totalIncome
.
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
));
return
result
;
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/impl/BmBizImpl.java
View file @
8baf1905
...
...
@@ -14,8 +14,13 @@ import com.pcloud.book.advertising.entity.AdvertisingBmOption;
import
com.pcloud.book.advertising.entity.AdvertisingBmOptionItem
;
import
com.pcloud.book.advertising.entity.AdvertisingBmRegister
;
import
com.pcloud.book.advertising.entity.AdvertisingBmRegisterItem
;
import
com.pcloud.book.advertising.entity.AdvertisingSpace
;
import
com.pcloud.book.advertising.enums.AdPositionEnum
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.consumer.user.ChannelConsr
;
import
com.pcloud.book.group.dao.BookGroupDao
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.book.util.common.ExcelUtils
;
import
com.pcloud.common.entity.UploadResultInfo
;
import
com.pcloud.common.exceptions.BizException
;
...
...
@@ -23,7 +28,6 @@ import com.pcloud.common.exceptions.ExportException;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.aliyun.OssUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.validate.ValidateUtils
;
import
com.pcloud.readercenter.wechat.entity.WechatUser
;
import
org.apache.poi.ss.usermodel.CellStyle
;
...
...
@@ -49,6 +53,7 @@ import java.util.ArrayList;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.UUID
;
/**
...
...
@@ -74,6 +79,10 @@ public class BmBizImpl implements BmBiz {
private
BmRegisterItemDao
bmRegisterItemDao
;
@Autowired
private
AdvertisingSpaceDao
advertisingSpaceDao
;
@Autowired
private
BookGroupDao
bookGroupDao
;
@Autowired
private
ChannelConsr
channelConsr
;
/**
* 获取报名商品选项类型
...
...
@@ -252,21 +261,48 @@ public class BmBizImpl implements BmBiz {
}
@Override
public
Long
userSubmit
(
AdvertisingBmRegister
bmRegister
,
Long
wechatUserId
,
Long
qrcodeId
)
{
public
Long
userSubmit
(
AdvertisingBmRegister
bmRegister
,
Long
wechatUserId
)
{
// 检测参数
Long
adId
=
bmRegister
.
getAdId
();
if
(
adId
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
// 获取用户昵称
AdvertisingSpace
space
=
advertisingSpaceDao
.
getById
(
adId
);
if
(
null
==
space
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告位不存在或已删除!"
);
}
List
<
AdvertisingBmRegisterItem
>
items
=
bmRegister
.
getBmRegisterItemList
();
if
(
ListUtils
.
isEmpty
(
items
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"请填写表单"
);
}
Long
mobilePhoneOptionId
=
bmOptionDao
.
getMobilePhoneOptionIdByAd
(
adId
);
Optional
<
AdvertisingBmRegisterItem
>
itemOptional
=
items
.
stream
().
filter
(
s
->
s
!=
null
&&
s
.
getOptionId
()
==
mobilePhoneOptionId
).
findFirst
();
if
(
itemOptional
.
isPresent
())
{
// 存在
AdvertisingBmRegisterItem
registerItem
=
itemOptional
.
get
();
if
(
null
!=
registerItem
&&
!
StringUtil
.
isEmpty
(
registerItem
.
getOptionValue
()))
{
Integer
count
=
bmRegisterItemDao
.
checkMobilePhone
(
adId
,
bmRegister
.
getFromType
(),
bmRegister
.
getFromId
(),
registerItem
.
getOptionValue
());
if
(
count
>
0
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"手机号已存在"
);
}
}
}
if
(
"WECHAT_GROUP"
.
equals
(
bmRegister
.
getFromType
()))
{
BookGroup
bookGroup
=
bookGroupDao
.
getById
(
bmRegister
.
getBookGroupId
());
if
(
null
==
bookGroup
)
{
return
0L
;
}
bmRegister
.
setBookId
(
bookGroup
.
getBookId
());
bmRegister
.
setChannelId
(
bookGroup
.
getChannelId
());
bmRegister
.
setAdviserId
(
bookGroup
.
getCreateUser
());
}
Long
agentId
=
channelConsr
.
getParentId
(
bmRegister
.
getChannelId
());
bmRegister
.
setAgentId
(
agentId
);
WechatUser
wechat
=
readerConsr
.
getWechatUser
(
wechatUserId
);
bmRegister
.
setNickName
(
wechat
==
null
?
""
:
wechat
.
getWechatUserNickname
());
bmRegister
.
setQrcodeId
(
qrcodeId
);
bmRegisterDao
.
insert
(
bmRegister
);
Long
registerId
=
bmRegister
.
getId
();
// 添加用户选项
addRegisterItem
(
bmRegister
.
getBmRegisterItemList
()
,
adId
,
wechatUserId
,
registerId
);
addRegisterItem
(
items
,
adId
,
wechatUserId
,
registerId
);
return
registerId
;
}
...
...
@@ -320,8 +356,8 @@ public class BmBizImpl implements BmBiz {
}
@Override
public
Long
getRegisterCountByAdId
(
Long
adId
,
String
statisMonth
)
{
return
bmRegisterDao
.
getRegisterCountByAdId
(
adId
,
statisMonth
);
public
Long
getRegisterCountByAdId
(
Long
adId
,
String
statisMonth
,
Long
bookId
,
Long
adviserId
,
Long
channelId
)
{
return
bmRegisterDao
.
getRegisterCountByAdId
(
adId
,
statisMonth
,
bookId
,
adviserId
,
channelId
);
}
@Override
...
...
@@ -338,18 +374,23 @@ public class BmBizImpl implements BmBiz {
}
@Override
public
Map
<
String
,
Object
>
exportRegisterInfoByAdId
(
Long
adId
,
Long
qrcodeId
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
Long
registerCount
=
bmRegisterDao
.
getRegisterCountByAdId
(
adId
,
null
);
if
(
registerCount
==
0
)
{
public
Map
<
String
,
Object
>
exportRegisterInfoByAdId
(
Long
adId
,
Long
qrcodeId
,
String
statisMonth
,
Long
bookId
,
Long
adviserId
,
Long
channelId
){
AdvertisingSpaceDTO
spaceDTO
=
advertisingSpaceDao
.
getDTOById
(
adId
);
if
(
null
==
spaceDTO
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告位不存在!"
);
}
List
<
BmRegisterDTO
>
registerDtos
=
new
ArrayList
<>();
if
(
AdPositionEnum
.
WECHAT_GROUP_MSG
.
positionCode
.
equals
(
spaceDTO
.
getAdPosition
()))
{
registerDtos
=
bmRegisterDao
.
getRegisterInfoListByAdIdQrcodeId
(
adId
,
statisMonth
,
qrcodeId
);
}
else
{
registerDtos
=
bmRegisterDao
.
getRegisterInfoListByAdId
(
adId
,
statisMonth
,
bookId
,
adviserId
,
channelId
);
}
if
(
ListUtils
.
isEmpty
(
registerDtos
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"无报名信息!"
);
}
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
try
{
String
title
=
"报名用户信息"
;
AdvertisingSpaceDTO
advertisingSpaceDTO
=
advertisingSpaceDao
.
getDTOById
(
adId
);
if
(
null
!=
advertisingSpaceDTO
)
{
title
=
advertisingSpaceDTO
.
getAdName
()
+
"-"
+
title
;
}
String
title
=
spaceDTO
.
getAdName
()
+
"-客户信息"
;
List
<
AdvertisingBmOption
>
optionList
=
bmOptionDao
.
getByAdId
(
adId
);
List
<
String
>
rowsNameList
=
new
ArrayList
<>();
rowsNameList
.
add
(
"序号"
);
...
...
@@ -360,9 +401,7 @@ public class BmBizImpl implements BmBiz {
rowsNameList
.
add
(
option
.
getItemTitle
());
}
String
[]
rowsName
=
rowsNameList
.
toArray
(
new
String
[
0
]);
String
fileUrl
=
""
;
//异步导出
String
filePath
=
exportRegisterInfo
(
title
,
rowsName
,
adId
,
optionList
,
qrcodeId
);
String
filePath
=
exportRegisterInfo
(
title
,
rowsName
,
optionList
,
registerDtos
);
result
.
put
(
"fileName"
,
title
);
result
.
put
(
"filePath"
,
filePath
);
return
result
;
...
...
@@ -376,8 +415,11 @@ public class BmBizImpl implements BmBiz {
}
}
private
String
exportRegisterInfo
(
String
title
,
String
[]
rowsName
,
Long
adId
,
List
<
AdvertisingBmOption
>
optionList
,
Long
qrcodeId
)
{
LOGGER
.
info
(
"导出相关信息:adId="
+
adId
+
",optionList="
+
optionList
);
/**
* excel数据导出
*/
private
String
exportRegisterInfo
(
String
title
,
String
[]
rowsName
,
List
<
AdvertisingBmOption
>
optionList
,
List
<
BmRegisterDTO
>
registerDtos
)
{
LOGGER
.
info
(
"导出相关信息:registerDtos="
+
registerDtos
+
",optionList="
+
optionList
);
SXSSFWorkbook
wb
=
new
SXSSFWorkbook
(
200
);
int
columnNum
=
rowsName
.
length
;
int
rowIndex
=
0
;
...
...
@@ -407,7 +449,6 @@ public class BmBizImpl implements BmBiz {
//准备初始数据
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
int
k
=
1
;
List
<
BmRegisterDTO
>
registerDtos
=
bmRegisterDao
.
exportRegisterInfoById
(
adId
,
qrcodeId
);
if
(!
ListUtils
.
isEmpty
(
registerDtos
))
{
//excel数据准备
this
.
exportExcelByDataList
(
registerDtos
,
dataStyle
,
k
,
rowIndex
,
sheet
,
optionList
,
df
);
...
...
@@ -438,15 +479,8 @@ public class BmBizImpl implements BmBiz {
/**
* excel数据导出
* @param registerDtos
* @param dataStyle
* @param k
* @param rowIndex
* @param sheet
* @param optionList
* @param df
*/
private
void
exportExcelByDataList
(
List
<
BmRegisterDTO
>
registerDtos
,
CellStyle
dataStyle
,
int
k
,
int
rowIndex
,
SXSSFSheet
sheet
,
List
<
AdvertisingBmOption
>
optionList
,
SimpleDateFormat
df
)
{
private
void
exportExcelByDataList
(
List
<
BmRegisterDTO
>
registerDtos
,
CellStyle
dataStyle
,
int
k
,
int
rowIndex
,
SXSSFSheet
sheet
,
List
<
AdvertisingBmOption
>
optionList
,
SimpleDateFormat
df
)
{
LOGGER
.
info
(
"excel数据导出"
);
for
(
BmRegisterDTO
registerDto
:
registerDtos
)
{
SXSSFRow
srow
=
sheet
.
createRow
(++
rowIndex
);
...
...
@@ -478,4 +512,10 @@ public class BmBizImpl implements BmBiz {
}
}
}
@Override
public
Long
getRegisterUserNumByAdIdQrcodeId
(
Long
qrcodeId
,
Long
adId
,
String
statisMonth
)
{
return
bmRegisterDao
.
getRegisterUserNumByAdIdQrcodeId
(
qrcodeId
,
adId
,
statisMonth
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/AdvertisingClickRecordDao.java
View file @
8baf1905
...
...
@@ -19,4 +19,31 @@ public interface AdvertisingClickRecordDao extends BaseDao<AdvertisingClickRecor
* @return
*/
List
<
WechatGroupClickUserDTO
>
clickUserList4AdvertisingWechatGroup
(
Map
<
String
,
Object
>
paramMap
);
/**
* 获得点击人数
* @param masterId
* @return
*/
public
Long
getClickUserNumByMasterId
(
Long
masterId
);
/**
* 微信群点击人数
* @param qrcodeId
* @param adId
* @param statisMonth
* @return
*/
Long
getClickUserNumByQrcode
(
Long
qrcodeId
,
Long
adId
,
String
statisMonth
);
/**
* 广告点击人数
* @param adId
* @param bookId
*@param adviserId
* @param channelId
* @param statisMonth @return
*/
Long
getClickUserNumByAdId
(
Long
adId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
,
String
statisMonth
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/BmOptionDao.java
View file @
8baf1905
...
...
@@ -33,4 +33,11 @@ public interface BmOptionDao extends BaseDao<AdvertisingBmOption> {
* @return
*/
List
<
Long
>
getOptionIdsByAdId
(
Long
adId
);
/**
* 查手机号选项id
* @param adId
* @return
*/
Long
getMobilePhoneOptionIdByAd
(
Long
adId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/BmRegisterDao.java
View file @
8baf1905
...
...
@@ -27,7 +27,7 @@ public interface BmRegisterDao extends BaseDao<AdvertisingBmRegister> {
* @param adId
* @return
*/
Long
getRegisterCountByAdId
(
Long
adId
,
String
statisMonth
)
;
public
Long
getRegisterCountByAdId
(
Long
adId
,
String
statisMonth
,
Long
bookId
,
Long
adviserId
,
Long
channelId
);
;
/**
* 报名数量
...
...
@@ -37,18 +37,40 @@ public interface BmRegisterDao extends BaseDao<AdvertisingBmRegister> {
Long
getRegisterCountByAdIds
(
List
<
Long
>
adIdList
);
/**
*
查报名信息
*
获取微信群报名次数
* @param adId
* @param statisMonth
* @param qrcodeId
* @return
*/
L
ist
<
BmRegisterDTO
>
exportRegisterInfoById
(
Long
adId
,
Long
qrcodeId
);
L
ong
getRegisterCountByAdIdQrcodeId
(
Long
adId
,
String
statisMonth
,
Long
qrcodeId
);
/**
* 获取微信群报名次数
* 获取微信群报名人数
* @param qrcodeId
* @param adId
* @param statisMonth
* @return
*/
Long
getRegisterUserNumByAdIdQrcodeId
(
Long
qrcodeId
,
Long
adId
,
String
statisMonth
);
/**
* 查微信群报名用户信息
* @param adId
* @param statisMonth
* @param qrcodeId
* @return
*/
Long
getRegisterCountByAdIdQrcodeId
(
Long
adId
,
String
statisMonth
,
Long
qrcodeId
);
List
<
BmRegisterDTO
>
getRegisterInfoListByAdIdQrcodeId
(
Long
adId
,
String
statisMonth
,
Long
qrcodeId
);
/**
* 查报名用户信息
* @param adId
* @param statisMonth
* @param bookId
* @param adviserId
* @param channelId
* @return
*/
List
<
BmRegisterDTO
>
getRegisterInfoListByAdId
(
Long
adId
,
String
statisMonth
,
Long
bookId
,
Long
adviserId
,
Long
channelId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/BmRegisterItemDao.java
View file @
8baf1905
...
...
@@ -10,4 +10,13 @@ import com.pcloud.common.core.dao.BaseDao;
* @版本:1.0
*/
public
interface
BmRegisterItemDao
extends
BaseDao
<
AdvertisingBmRegisterItem
>
{
/**
* 手机号是否有重复
* @param adId
* @param fromType
* @param optionValue
* @return
*/
Integer
checkMobilePhone
(
Long
adId
,
String
fromType
,
Long
fromId
,
String
optionValue
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/impl/AdvertisingClickRecordDaoImpl.java
View file @
8baf1905
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
;
import
org.springframework.stereotype.Repository
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* Description 广告位点击记录数据访问层接口实现类
* @author PENG
...
...
@@ -23,4 +26,32 @@ public class AdvertisingClickRecordDaoImpl extends BaseDaoImpl<AdvertisingClickR
public
List
<
WechatGroupClickUserDTO
>
clickUserList4AdvertisingWechatGroup
(
Map
<
String
,
Object
>
paramMap
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"clickUserList4AdvertisingWechatGroup"
),
paramMap
);
}
@Override
public
Long
getClickUserNumByMasterId
(
Long
masterId
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"masterId"
,
masterId
);
Long
clickNum
=
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getClickUserNumByMasterId"
),
paramMap
);
return
null
==
clickNum
?
0L
:
clickNum
;
}
@Override
public
Long
getClickUserNumByQrcode
(
Long
qrcodeId
,
Long
adId
,
String
statisMonth
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"qrcodeId"
,
qrcodeId
);
paramMap
.
put
(
"adId"
,
adId
);
paramMap
.
put
(
"statisMonth"
,
statisMonth
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getClickUserNumByGroupQrcodeId"
),
paramMap
);
}
@Override
public
Long
getClickUserNumByAdId
(
Long
adId
,
Long
bookId
,
Long
adviserId
,
Long
channelId
,
String
statisMonth
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"adId"
,
adId
);
paramMap
.
put
(
"statisMonth"
,
statisMonth
);
paramMap
.
put
(
"adviserId"
,
adviserId
);
paramMap
.
put
(
"channelId"
,
channelId
);
paramMap
.
put
(
"statisMonth"
,
statisMonth
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getClickUserNumByAdId"
),
paramMap
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/impl/BmOptionDaoImpl.java
View file @
8baf1905
...
...
@@ -30,4 +30,9 @@ public class BmOptionDaoImpl extends BaseDaoImpl<AdvertisingBmOption> implements
public
List
<
Long
>
getOptionIdsByAdId
(
Long
adId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getOptionIdsByAdId"
),
adId
);
}
@Override
public
Long
getMobilePhoneOptionIdByAd
(
Long
adId
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getMobilePhoneOptionIdByAd"
),
adId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/impl/BmRegisterDaoImpl.java
View file @
8baf1905
...
...
@@ -25,11 +25,14 @@ public class BmRegisterDaoImpl extends BaseDaoImpl<AdvertisingBmRegister> implem
}
@Override
public
Long
getRegisterCountByAdId
(
Long
adId
,
String
statisMonth
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"adId"
,
adId
);
map
.
put
(
"statisMonth"
,
statisMonth
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getRegisterCountByAdId"
),
map
);
public
Long
getRegisterCountByAdId
(
Long
adId
,
String
statisMonth
,
Long
bookId
,
Long
adviserId
,
Long
channelId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"adId"
,
adId
);
map
.
put
(
"statisMonth"
,
statisMonth
);
map
.
put
(
"bookId"
,
bookId
);
map
.
put
(
"adviserId"
,
adviserId
);
map
.
put
(
"channelId"
,
channelId
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getRegisterCountByAdId"
),
map
);
}
@Override
...
...
@@ -38,19 +41,42 @@ public class BmRegisterDaoImpl extends BaseDaoImpl<AdvertisingBmRegister> implem
}
@Override
public
L
ist
<
BmRegisterDTO
>
exportRegisterInfoById
(
Long
adId
,
Long
qrcodeId
)
{
public
L
ong
getRegisterCountByAdIdQrcodeId
(
Long
adId
,
String
statisMonth
,
Long
qrcodeId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"adId"
,
adId
);
map
.
put
(
"statisMonth"
,
statisMonth
);
map
.
put
(
"qrcodeId"
,
qrcodeId
);
return
getSessionTemplate
().
select
List
(
getStatement
(
"exportRegisterInfoBy
Id"
),
map
);
return
getSessionTemplate
().
select
One
(
getStatement
(
"getRegisterCountByAdIdQrcode
Id"
),
map
);
}
@Override
public
Long
getRegisterCountByAdIdQrcodeId
(
Long
adId
,
String
statisMonth
,
Long
qrcodeId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"adId"
,
adId
);
map
.
put
(
"statisMonth"
,
statisMonth
);
map
.
put
(
"qrcodeId"
,
qrcodeId
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getRegisterCountByAdIdQrcodeId"
),
map
);
public
Long
getRegisterUserNumByAdIdQrcodeId
(
Long
qrcodeId
,
Long
adId
,
String
statisMonth
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"adId"
,
adId
);
map
.
put
(
"statisMonth"
,
statisMonth
);
map
.
put
(
"qrcodeId"
,
qrcodeId
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getRegisterUserNumByAdIdQrcodeId"
),
map
);
}
@Override
public
List
<
BmRegisterDTO
>
getRegisterInfoListByAdIdQrcodeId
(
Long
adId
,
String
statisMonth
,
Long
qrcodeId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"adId"
,
adId
);
map
.
put
(
"statisMonth"
,
statisMonth
);
map
.
put
(
"qrcodeId"
,
qrcodeId
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getRegisterInfoListByAdIdQrcodeId"
),
map
);
}
@Override
public
List
<
BmRegisterDTO
>
getRegisterInfoListByAdId
(
Long
adId
,
String
statisMonth
,
Long
bookId
,
Long
adviserId
,
Long
channelId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"adId"
,
adId
);
map
.
put
(
"statisMonth"
,
statisMonth
);
map
.
put
(
"bookId"
,
bookId
);
map
.
put
(
"adviserId"
,
adviserId
);
map
.
put
(
"channelId"
,
channelId
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getRegisterInfoListByAdId"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/impl/BmRegisterItemDaoImpl.java
View file @
8baf1905
...
...
@@ -6,6 +6,9 @@ import com.pcloud.common.core.dao.BaseDaoImpl;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @描述:报名选项记录
* @作者:zhuyajie
...
...
@@ -14,4 +17,14 @@ import org.springframework.stereotype.Component;
*/
@Component
(
"bmRegisterItemDao"
)
public
class
BmRegisterItemDaoImpl
extends
BaseDaoImpl
<
AdvertisingBmRegisterItem
>
implements
BmRegisterItemDao
{
@Override
public
Integer
checkMobilePhone
(
Long
adId
,
String
fromType
,
Long
fromId
,
String
optionValue
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"adId"
,
adId
);
map
.
put
(
"fromType"
,
fromType
);
map
.
put
(
"fromId"
,
fromId
);
map
.
put
(
"optionValue"
,
optionValue
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"checkMobilePhone"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/entity/AdvertisingBmRegister.java
View file @
8baf1905
...
...
@@ -38,6 +38,57 @@ public class AdvertisingBmRegister extends BaseEntity{
*/
private
Long
qrcodeId
;
/**
* 二维码ID
*/
private
Long
sceneId
;
/**
* 编辑ID
*/
private
Long
adviserId
;
/**
* 出版社ID
*/
private
Long
agentId
;
/**
* 运营ID
*/
private
Long
channelId
;
/**
* 公众号ID
*/
private
Long
officialAccountId
;
/**
*来源类型
*/
private
String
fromType
;
/**
* 来源ID
*/
private
Long
fromId
;
/**
* 书刊ID
*/
private
Long
bookId
;
/**
* 创建日期
*/
private
Date
createDay
;
/**
* 创建月份
*/
private
String
createMonth
;
/**
* 社群码ID
*/
private
Long
bookGroupId
;
public
Long
getUserId
()
{
return
userId
;
...
...
@@ -87,6 +138,94 @@ public class AdvertisingBmRegister extends BaseEntity{
this
.
qrcodeId
=
qrcodeId
;
}
public
Long
getSceneId
()
{
return
sceneId
;
}
public
void
setSceneId
(
Long
sceneId
)
{
this
.
sceneId
=
sceneId
;
}
public
Long
getAdviserId
()
{
return
adviserId
;
}
public
void
setAdviserId
(
Long
adviserId
)
{
this
.
adviserId
=
adviserId
;
}
public
Long
getAgentId
()
{
return
agentId
;
}
public
void
setAgentId
(
Long
agentId
)
{
this
.
agentId
=
agentId
;
}
public
Long
getChannelId
()
{
return
channelId
;
}
public
void
setChannelId
(
Long
channelId
)
{
this
.
channelId
=
channelId
;
}
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
getBookId
()
{
return
bookId
;
}
public
void
setBookId
(
Long
bookId
)
{
this
.
bookId
=
bookId
;
}
public
Date
getCreateDay
()
{
return
createDay
;
}
public
void
setCreateDay
(
Date
createDay
)
{
this
.
createDay
=
createDay
;
}
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
"AdvertisingBmRegister{"
+
...
...
@@ -96,6 +235,17 @@ public class AdvertisingBmRegister extends BaseEntity{
", createTime="
+
createTime
+
", bmRegisterItemList="
+
bmRegisterItemList
+
", qrcodeId="
+
qrcodeId
+
", sceneId="
+
sceneId
+
", adviserId="
+
adviserId
+
", agentId="
+
agentId
+
", channelId="
+
channelId
+
", officialAccountId="
+
officialAccountId
+
", fromType='"
+
fromType
+
'\''
+
", fromId="
+
fromId
+
", bookId="
+
bookId
+
", createDay="
+
createDay
+
", createMonth='"
+
createMonth
+
'\''
+
", bookGroupId="
+
bookGroupId
+
'}'
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/facade/BmFacade.java
View file @
8baf1905
...
...
@@ -92,13 +92,20 @@ public interface BmFacade {
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation
(
value
=
"导出报名信息"
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"导出报名信息"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"adId"
,
value
=
"广告位id"
,
required
=
false
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"qrcodeId"
,
value
=
"群二维码id"
,
required
=
false
,
dataType
=
"Long"
,
paramType
=
"query"
)
@ApiImplicitParam
(
name
=
"adId"
,
value
=
"广告位id"
,
required
=
false
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"qrcodeId"
,
value
=
"群二维码id"
,
required
=
false
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"statisMonth"
,
value
=
"月份"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"bookId"
,
value
=
"bookId"
,
required
=
false
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"adviserId"
,
value
=
"adviserId"
,
required
=
false
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"channelId"
,
value
=
"channelId"
,
required
=
false
,
dataType
=
"Long"
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"/exportRegisterInfoByAdId"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<
Map
<
String
,
Object
>>
exportRegisterInfoByAdId
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"adId"
)
Long
adId
,
@RequestParam
(
value
=
"qrcodeId"
,
required
=
false
)
Long
qrcodeId
)
@RequestMapping
(
value
=
"/exportRegisterInfoByAdId"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<
Map
<
String
,
Object
>>
exportRegisterInfoByAdId
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"adId"
)
Long
adId
,
@RequestParam
(
value
=
"qrcodeId"
,
required
=
false
)
Long
qrcodeId
,
@RequestParam
(
value
=
"statisMonth"
,
required
=
false
)
String
statisMonth
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
Long
bookId
,
@RequestParam
(
value
=
"adviserId"
,
required
=
false
)
Long
adviserId
,
@RequestParam
(
value
=
"channelId"
,
required
=
false
)
Long
channelId
)
throws
PermissionException
,
BizException
,
JsonParseException
;
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/facade/impl/BmFacadeImpl.java
View file @
8baf1905
package
com
.
pcloud
.
book
.
advertising
.
facade
.
impl
;
import
com.pcloud.book.advertising.biz.BmBiz
;
import
com.pcloud.book.advertising.entity.AdvertisingBmOption
;
import
com.pcloud.book.advertising.entity.AdvertisingBmRegister
;
import
com.pcloud.book.advertising.facade.BmFacade
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.biz.BookBiz
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
com.pcloud.common.utils.string.StringUtil
;
import
org.codehaus.jackson.JsonParseException
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -24,8 +23,6 @@ import org.springframework.web.bind.annotation.RestController;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
/**
* 报名
*/
...
...
@@ -63,16 +60,33 @@ public class BmFacadeImpl implements BmFacade {
*/
@Override
@RequestMapping
(
value
=
"/userSubmit4Wechat"
,
method
=
RequestMethod
.
POST
)
public
ResponseDto
<?>
userSubmit4Wechat
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
AdvertisingBmRegister
bmRegister
)
public
ResponseDto
<?>
userSubmit4Wechat
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
AdvertisingBmRegister
bmRegister
)
throws
PermissionException
,
BizException
,
JsonParseException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
qrcodeId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
QRCODE_ID
);
if
(
bmRegister
==
null
)
{
if
(
null
==
bmRegister
||
null
==
bmRegister
.
getAdId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
if
(
StringUtil
.
isEmpty
(
bmRegister
.
getFromType
())
||
null
==
bmRegister
.
getFromId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
Long
qrcodeId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
QRCODE_ID
);
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
==
bmRegister
.
getBookId
()
&&
!
"WECHAT_GROUP"
.
equals
(
bmRegister
.
getFromType
()))
||
(
null
==
bookGroupId
&&
"WECHAT_GROUP"
.
equals
(
bmRegister
.
getFromType
())))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数有误!"
);
}
bmRegister
.
setQrcodeId
(
qrcodeId
);
bmRegister
.
setSceneId
(
sceneId
);
bmRegister
.
setAdviserId
(
adviserId
);
bmRegister
.
setChannelId
(
channelId
);
bmRegister
.
setOfficialAccountId
(
officialAccountsId
);
bmRegister
.
setUserId
(
wechatUserId
);
Long
result
=
bmBiz
.
userSubmit
(
bmRegister
,
wechatUserId
,
qrcodeId
);
bmRegister
.
setBookGroupId
(
bookGroupId
);
Long
result
=
bmBiz
.
userSubmit
(
bmRegister
,
wechatUserId
);
return
new
ResponseDto
<>(
result
);
}
...
...
@@ -95,15 +109,18 @@ public class BmFacadeImpl implements BmFacade {
* 报名信息导出
*/
@Override
@RequestMapping
(
value
=
"/exportRegisterInfoByAdId"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/exportRegisterInfoByAdId"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<
Map
<
String
,
Object
>>
exportRegisterInfoByAdId
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"adId"
)
Long
adId
,
@RequestParam
(
value
=
"qrcodeId"
,
required
=
false
)
Long
qrcodeId
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
null
==
adId
){
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"adId"
)
Long
adId
,
@RequestParam
(
value
=
"qrcodeId"
,
required
=
false
)
Long
qrcodeId
,
@RequestParam
(
value
=
"statisMonth"
,
required
=
false
)
String
statisMonth
,
@RequestParam
(
value
=
"bookId"
,
required
=
false
)
Long
bookId
,
@RequestParam
(
value
=
"adviserId"
,
required
=
false
)
Long
adviserId
,
@RequestParam
(
value
=
"channelId"
,
required
=
false
)
Long
channelId
)
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
null
==
adId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
SessionUtil
.
getInfoToken4Redis
(
token
);
Map
<
String
,
Object
>
map
=
bmBiz
.
exportRegisterInfoByAdId
(
adId
,
qrcode
Id
);
Map
<
String
,
Object
>
map
=
bmBiz
.
exportRegisterInfoByAdId
(
adId
,
qrcodeId
,
statisMonth
,
bookId
,
adviserId
,
channel
Id
);
return
new
ResponseDto
<>(
map
);
}
...
...
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingBmOptionMapper.xml
View file @
8baf1905
...
...
@@ -86,4 +86,18 @@
WHERE ad_id = #{adId,jdbcType=BIGINT}
</select>
<select
id=
"getMobilePhoneOptionIdByAd"
parameterType=
"Long"
resultType=
"Long"
>
SELECT
id
FROM
advertising_bm_option
WHERE
ad_id = #{adId,jdbcType=BIGINT}
AND item_title = '手机号'
AND item_input_type = 'input'
AND item_data_type = 'mobile'
AND required = 1
LIMIT 1
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingBmRegisterItemMapper.xml
View file @
8baf1905
...
...
@@ -50,5 +50,20 @@
b.seq ASC,
b.id ASC
</select>
<select
id=
"checkMobilePhone"
resultType=
"Integer"
parameterType=
"map"
>
SELECT
COUNT(1)
FROM
advertising_bm_register_item i
LEFT JOIN advertising_bm_register r ON i.register_id = r.id
LEFT JOIN advertising_bm_option o ON i.option_id = o.id
WHERE
i.ad_id = #{adId}
AND r.from_type = #{fromType}
AND r.from_id = #{fromId}
AND o.item_title = '手机号'
AND i.option_value = #{optionValue}
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingBmRegisterMapper.xml
View file @
8baf1905
...
...
@@ -8,6 +8,16 @@
<result
column=
"nick_name"
property=
"nickName"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"qrcode_id"
property=
"qrcodeId"
jdbcType=
"BIGINT"
/>
<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=
"BIGINT"
/>
<result
column=
"book_id"
property=
"bookId"
jdbcType=
"BIGINT"
/>
<result
column=
"create_day"
property=
"createDay"
jdbcType=
"DATE"
/>
<result
column=
"create_month"
property=
"createMonth"
jdbcType=
"VARCHAR"
/>
</resultMap>
<!-- 微信端用户详细信息 -->
...
...
@@ -25,14 +35,46 @@
<sql
id=
"Base_Column_List"
>
id, user_id, ad_id, nick_name, create_time, qrcode_id
id, user_id, ad_id, nick_name, create_time, qrcode_id, scene_id, adviser_id, agent_id, channel_id, official_account_id, from_type,
from_id,book_id,create_day, create_month
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.advertising.entity.AdvertisingBmRegister"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into advertising_bm_register (user_id, ad_id,
nick_name, create_time, qrcode_id)
values (#{userId,jdbcType=BIGINT}, #{adId,jdbcType=BIGINT},
#{nickName,jdbcType=VARCHAR}, NOW(), #{qrcodeId})
INSERT INTO advertising_bm_register (
user_id,
ad_id,
nick_name,
create_time,
qrcode_id,
scene_id,
adviser_id,
agent_id,
channel_id,
official_account_id,
from_type,
from_id,
book_id,
create_day,
create_month
)
VALUES
(
#{userId,jdbcType=BIGINT},
#{adId,jdbcType=BIGINT},
#{nickName,jdbcType=VARCHAR},
NOW(),
#{qrcodeId},
#{sceneId,jdbcType=BIGINT},
#{adviserId,jdbcType=BIGINT},
#{agentId,jdbcType=BIGINT},
#{channelId,jdbcType=BIGINT},
#{officialAccountId,jdbcType=BIGINT},
#{fromType,jdbcType=VARCHAR},
#{fromId,jdbcType=BIGINT},
#{bookId,jdbcType=BIGINT},
NOW(),
DATE_FORMAT(NOW(), '%Y-%m')
)
</insert>
<!-- 微信端获取个人报名信息 -->
...
...
@@ -50,19 +92,24 @@
<select
id=
"getRegisterCountByAdId"
parameterType=
"map"
resultType=
"Long"
>
SELECT
IFNULL(COUNT(1), 0
)
COUNT(1
)
FROM
advertising_bm_register
WHERE
ad_id = #{adId,jdbcType=BIGINT}
<if
test=
"statisMonth != null"
>
AND DATE_FORMAT(create_time, "%Y-%m") = #{statisMonth}
</if>
<if
test=
"bookId != null"
>
AND book_id = #{bookId}
AND adviser_id = #{adviserId}
AND channel_id = #{channelId}
</if>
<if
test=
"statisMonth != null"
>
and create_month = #{statisMonth}
</if>
</select>
<select
id=
"getRegisterCountByAdIds"
parameterType=
"list"
resultType=
"Long"
>
SELECT
IFNULL(COUNT(1), 0
)
COUNT(1
)
FROM
advertising_bm_register
WHERE ad_id in
...
...
@@ -71,28 +118,69 @@
</foreach>
</select>
<select
id=
"exportRegisterInfoById"
parameterType=
"map"
resultMap=
"wechatDetailMap"
>
select
<include
refid=
"Base_Column_List"
/>
from advertising_bm_register
where ad_id = #{adId}
<if
test=
"qrcodeId != null"
>
AND qrcode_id = #{qrcodeId}
</if>
ORDER BY create_time DESC
</select>
<select
id=
"getRegisterCountByAdIdQrcodeId"
parameterType=
"map"
resultType=
"Long"
>
SELECT
IFNULL(COUNT(1), 0
)
COUNT(1
)
FROM
advertising_bm_register
WHERE
ad_id = #{adId,jdbcType=BIGINT}
AND qrcode_id = #{qrcodeId}
from_id = #{qrcodeId}
AND from_type = 'WECHAT_GROUP'
<if
test=
"adId != null"
>
AND ad_id = #{adId,jdbcType=BIGINT}
</if>
<if
test=
"statisMonth != null"
>
AND
DATE_FORMAT(create_time, "%Y-%m")
= #{statisMonth}
AND
create_month
= #{statisMonth}
</if>
</select>
<select
id=
"getRegisterUserNumByAdIdQrcodeId"
resultType=
"Long"
parameterType=
"map"
>
SELECT
COUNT(DISTINCT user_id)
FROM
advertising_bm_register
WHERE
from_id = #{qrcodeId}
AND from_type = 'WECHAT_GROUP'
<if
test=
"adId != null"
>
AND ad_id = #{adId,jdbcType=BIGINT}
</if>
<if
test=
"statisMonth != null"
>
AND create_month = #{statisMonth}
</if>
</select>
<select
id=
"getRegisterInfoListByAdIdQrcodeId"
parameterType=
"map"
resultMap=
"wechatDetailMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM advertising_bm_register
WHERE
ad_id = #{adId}
<if
test=
"qrcodeId != null"
>
AND from_id = #{qrcodeId}
AND from_type = 'WECHAT_GROUP'
</if>
<if
test=
"statisMonth != null"
>
AND create_month = #{statisMonth}
</if>
ORDER BY create_time DESC
</select>
<select
id=
"getRegisterInfoListByAdId"
parameterType=
"map"
resultMap=
"wechatDetailMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM advertising_bm_register
WHERE
ad_id = #{adId}
<if
test=
"bookId != null"
>
AND book_id = #{bookId}
AND adviser_id = #{adviserId}
AND channel_id = #{channelId}
</if>
<if
test=
"statisMonth != null"
>
AND create_month = #{statisMonth}
</if>
ORDER BY create_time DESC
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingClickRecordMapper.xml
View file @
8baf1905
...
...
@@ -86,21 +86,28 @@
</if>
</select>
<!--计算点击人数-包含userId=null-->
<select
id=
"getClickUserNumByGroupQrcodeId"
parameterType=
"map"
resultType=
"Long"
>
SELECT
count(DISTINCT wechat_user_id)
count(1)
FROM
(
SELECT
wechat_user_id
FROM
advertising_click_record
WHERE
from_id = #{qrcodeId}
AND from_type = 'WECHAT_GROUP'
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
GROUP BY
wechat_user_id
) AS a
</select>
<select
id=
"getTotalClickNum"
resultType=
"Long"
>
...
...
@@ -212,4 +219,40 @@
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select
id=
"getClickUserNumByMasterId"
parameterType=
"map"
resultType=
"Long"
>
SELECT
COUNT(DISTINCT wechat_user_id)
FROM
advertising_click_record r
INNER JOIN advertising_space s ON r.ad_id = s.id
WHERE
s.master_id = #{masterId}
</select>
<!--计算点击人数-包含userId=null-->
<select
id=
"getClickUserNumByAdId"
parameterType=
"map"
resultType=
"Long"
>
SELECT
COUNT(1)
FROM
(
SELECT
wechat_user_id
FROM
advertising_click_record
WHERE
ad_id = #{adId}
<if
test=
"bookId != null"
>
AND book_id = #{bookId}
AND adviser_id = #{adviserId}
AND channel_id = #{channelId}
</if>
<if
test=
"statisMonth != null"
>
and create_month = #{statisMonth}
</if>
GROUP BY
wechat_user_id
) AS a
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingIncomeDailyMapper.xml
View file @
8baf1905
...
...
@@ -230,16 +230,22 @@
AND cr.channel_id = b.channel_id
LEFT JOIN (
SELECT
ad_id,
COUNT(id) register_num
ad_id,
book_id,
channel_id,
COUNT(id) register_num
FROM
advertising_bm_register
advertising_bm_register
WHERE
DATE_FORMAT(create_time, '%Y-%m-%d')
= #{createDay}
AND
qrcode_id IS NULL
create_day
= #{createDay}
AND
from_type != 'WECHAT_GROUP'
GROUP BY
ad_id
ad_id,
book_id,
channel_id
) br ON br.ad_id = b.ad_id
AND br.book_id = b.book_id
AND br.channel_id = b.channel_id
WHERE
b.ad_id = s.id
AND s.id = m.ad_id
...
...
@@ -345,20 +351,26 @@
AND cr.channel_id = b.channel_id
AND cr.from_id = b.qrcode_id
LEFT JOIN (
SELECT
ad_id,
qrcode_id,
COUNT(id) register_num
FROM
advertising_bm_register
WHERE
DATE_FORMAT(create_time, '%Y-%m-%d') = #{createDay}
AND qrcode_id IS NOT NULL
GROUP BY
ad_id,
qrcode_id
SELECT
ad_id,
book_id,
channel_id,
from_id,
COUNT(id) register_num
FROM
advertising_bm_register
WHERE
create_day = #{createDay}
AND from_type = 'WECHAT_GROUP'
GROUP BY
ad_id,
book_id,
channel_id,
from_id
) br ON br.ad_id = b.ad_id
AND br.qrcode_id = b.qrcode_id
AND br.book_id = b.book_id
AND br.channel_id = b.channel_id
AND br.from_id = b.qrcode_id
WHERE
b.ad_id = s.id
AND s.id = m.ad_id
...
...
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