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
a841b4e6
Commit
a841b4e6
authored
Jun 24, 2019
by
朱亚洁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
广告投放-文本本链接
parent
26e17da5
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
350 additions
and
58 deletions
+350
-58
AdvertisingSpaceBizImpl.java
...ud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
+119
-31
AdvertisingSpaceFacade.java
...cloud/book/advertising/facade/AdvertisingSpaceFacade.java
+20
-12
AdvertisingSpaceFacadeImpl.java
...k/advertising/facade/impl/AdvertisingSpaceFacadeImpl.java
+22
-14
LabelConsr.java
.../main/java/com/pcloud/book/consumer/label/LabelConsr.java
+93
-0
GroupQrcodeVO.java
...src/main/java/com/pcloud/book/group/vo/GroupQrcodeVO.java
+81
-0
BookGroupClassify.Mapper.xml
.../main/resources/mapper/group/BookGroupClassify.Mapper.xml
+15
-1
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
View file @
a841b4e6
package
com
.
pcloud
.
book
.
advertising
.
biz
.
impl
;
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.AppTypeDto
;
import
com.pcloud.appcenter.app.dto.AppTypeDto
;
import
com.pcloud.appcenter.app.service.AppTypeService
;
import
com.pcloud.appcenter.app.service.AppTypeService
;
import
com.pcloud.book.advertising.biz.AdvertisingSpaceBiz
;
import
com.pcloud.book.advertising.biz.AdvertisingSpaceBiz
;
...
@@ -53,6 +37,7 @@ import com.pcloud.book.book.entity.BookAdviser;
...
@@ -53,6 +37,7 @@ import com.pcloud.book.book.entity.BookAdviser;
import
com.pcloud.book.book.set.BookSet
;
import
com.pcloud.book.book.set.BookSet
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.common.ExportConsr
;
import
com.pcloud.book.consumer.common.ExportConsr
;
import
com.pcloud.book.consumer.label.LabelConsr
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.consumer.user.AdviserConsr
;
import
com.pcloud.book.consumer.user.AdviserConsr
;
...
@@ -68,6 +53,7 @@ import com.pcloud.book.group.dto.ClassifyDTO;
...
@@ -68,6 +53,7 @@ import com.pcloud.book.group.dto.ClassifyDTO;
import
com.pcloud.book.group.dto.GroupQrcodeInfoDTO
;
import
com.pcloud.book.group.dto.GroupQrcodeInfoDTO
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.book.group.entity.GroupQrcode
;
import
com.pcloud.book.group.entity.GroupQrcode
;
import
com.pcloud.book.group.vo.GroupQrcodeVO
;
import
com.pcloud.book.util.common.CommonUtils
;
import
com.pcloud.book.util.common.CommonUtils
;
import
com.pcloud.channelcenter.qrcode.service.QrcodeSceneService
;
import
com.pcloud.channelcenter.qrcode.service.QrcodeSceneService
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.aspect.ParamLog
;
...
@@ -87,6 +73,28 @@ import com.sdk.wxgroup.SendPicMessageVO;
...
@@ -87,6 +73,28 @@ import com.sdk.wxgroup.SendPicMessageVO;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
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
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.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
/**
/**
* Description 广告位业务逻辑层接口实现类
* Description 广告位业务逻辑层接口实现类
* @author PENG
* @author PENG
...
@@ -94,6 +102,7 @@ import com.sdk.wxgroup.WxGroupSDK;
...
@@ -94,6 +102,7 @@ import com.sdk.wxgroup.WxGroupSDK;
*/
*/
@Component
(
"advertisingSpaceBiz"
)
@Component
(
"advertisingSpaceBiz"
)
public
class
AdvertisingSpaceBizImpl
implements
AdvertisingSpaceBiz
{
public
class
AdvertisingSpaceBizImpl
implements
AdvertisingSpaceBiz
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
AdvertisingSpaceBizImpl
.
class
);
@Value
(
"${wechat.group.link.prefix}"
)
@Value
(
"${wechat.group.link.prefix}"
)
private
String
wechatGroupLinkPrefix
;
private
String
wechatGroupLinkPrefix
;
...
@@ -150,6 +159,8 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -150,6 +159,8 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
private
BookGroupDao
bookGroupDao
;
private
BookGroupDao
bookGroupDao
;
@Autowired
@Autowired
private
ReaderConsr
readerConsr
;
private
ReaderConsr
readerConsr
;
@Autowired
private
LabelConsr
labelConsr
;
/**
/**
* 创建广告位
* 创建广告位
...
@@ -201,6 +212,24 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -201,6 +212,24 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
&&
null
==
advertisingSpace
.
getPriceEachTime
())
{
&&
null
==
advertisingSpace
.
getPriceEachTime
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"按点击量结算和按曝光量结算时每次价格不能为空!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"按点击量结算和按曝光量结算时每次价格不能为空!"
);
}
}
if
(
AdPositionEnum
.
WECHAT_GROUP_MSG
.
positionCode
.
equals
(
advertisingSpace
.
getAdPosition
()))
{
//微信群投放
if
(
AdPositionModeEnum
.
TEXT_AND_LINK
.
modeCode
.
equals
(
advertisingSpace
.
getAdPositionMode
()))
{
//多文字+多链接
String
adTitle
=
advertisingSpace
.
getAdTitle
();
List
<
String
>
linkList
=
getLinkList
(
adTitle
);
int
linkLength
=
0
;
//短链接长度
if
(!
ListUtils
.
isEmpty
(
linkList
))
{
for
(
String
link
:
linkList
)
{
adTitle
=
adTitle
.
replace
(
link
,
""
);
linkLength
=
linkLength
+
26
;
}
}
int
length
=
linkLength
+
adTitle
.
length
();
if
(
length
>
300
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"文本长度超过300!"
);
}
}
}
}
}
/**
/**
...
@@ -426,21 +455,32 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -426,21 +455,32 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
// 获取机器人微信号
// 获取机器人微信号
String
altId
=
wechatGroupConsr
.
getRobotIdByGroupId
(
groupId
);
String
altId
=
wechatGroupConsr
.
getRobotIdByGroupId
(
groupId
);
if
(
AdPositionModeEnum
.
TEXT_AND_LINK
.
modeCode
.
equals
(
advertisingSpace
.
getAdPositionMode
()))
{
if
(
AdPositionModeEnum
.
TEXT_AND_LINK
.
modeCode
.
equals
(
advertisingSpace
.
getAdPositionMode
()))
{
//多文字+多链接 modifyby zhuyajie
//例如:[色]123<link>http://www.baidu.com</link>1111111[闭嘴]
String
adTitle
=
advertisingSpace
.
getAdTitle
();
List
<
String
>
linkList
=
getLinkList
(
adTitle
);
if
(!
ListUtils
.
isEmpty
(
linkList
))
{
for
(
String
link
:
linkList
)
{
String
adLink
=
""
;
String
adLinkOld
=
link
.
replaceAll
(
"<link>"
,
""
).
replace
(
"</link>"
,
""
);
if
(!
StringUtil
.
isEmpty
(
adLinkOld
))
{
if
(
adLinkOld
.
contains
(
"?"
))
{
adLink
=
adLinkOld
+
"&book_group_id="
+
classifyDTO
.
getBookGroupId
()
+
"&classify_id="
+
group
.
getClassifyId
()
+
"&qrcode_id="
+
group
.
getQrcodeId
()
+
"&ad_id="
+
advertisingSpace
.
getId
();
}
else
{
adLink
=
adLinkOld
+
"?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
));
}
adTitle
=
adTitle
.
replace
(
link
,
adLink
);
}
}
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setGroupId
(
groupId
);
sendTextMessageVO
.
setGroupId
(
groupId
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setAltId
(
altId
);
String
adLink
=
""
;
sendTextMessageVO
.
setContent
(
adTitle
);
if
(!
StringUtil
.
isEmpty
(
advertisingSpace
.
getAdLink
()))
{
LOGGER
.
info
(
"发送微信消息"
+
sendTextMessageVO
.
toString
());
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
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
else
if
(
AdPositionModeEnum
.
NEWS_SHARE
.
modeCode
.
equals
(
advertisingSpace
.
getAdPositionMode
()))
{
}
else
if
(
AdPositionModeEnum
.
NEWS_SHARE
.
modeCode
.
equals
(
advertisingSpace
.
getAdPositionMode
()))
{
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
...
@@ -498,6 +538,21 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -498,6 +538,21 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
}
/**
/**
* 提取文本中链接
* @param title
* @return
*/
private
List
<
String
>
getLinkList
(
String
title
)
{
List
<
String
>
list
=
new
ArrayList
<>();
Pattern
pa
=
Pattern
.
compile
(
"<link>.*?</link>"
);
//标题正则表达式
Matcher
ma
=
pa
.
matcher
(
title
);
while
(
ma
.
find
())
{
list
.
add
(
ma
.
group
());
}
return
list
;
}
/**
* 获取出版社书刊权限
* 获取出版社书刊权限
*/
*/
@Override
@Override
...
@@ -605,6 +660,39 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -605,6 +660,39 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
if
(
pageBean
==
null
||
ListUtils
.
isEmpty
(
pageBean
.
getRecordList
()))
{
if
(
pageBean
==
null
||
ListUtils
.
isEmpty
(
pageBean
.
getRecordList
()))
{
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
}
}
List
<
Object
>
objs
=
pageBean
.
getRecordList
();
Object
objectlist
=
(
Object
)
objs
;
List
<
GroupQrcodeVO
>
groupQrcodeVOList
=
(
List
<
GroupQrcodeVO
>)
objectlist
;
List
<
Long
>
labelIds
=
new
ArrayList
<>();
List
<
Long
>
proLabels
=
groupQrcodeVOList
.
stream
().
filter
(
s
->
s
.
getProLabelId
()!=
null
).
map
(
GroupQrcodeVO:
:
getProLabelId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
depLabels
=
groupQrcodeVOList
.
stream
().
filter
(
s
->
s
.
getDepLabelId
()!=
null
).
map
(
GroupQrcodeVO:
:
getDepLabelId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
purLabels
=
groupQrcodeVOList
.
stream
().
filter
(
s
->
s
.
getPurLabelId
()!=
null
).
map
(
GroupQrcodeVO:
:
getPurLabelId
).
distinct
().
collect
(
Collectors
.
toList
());
if
(!
ListUtils
.
isEmpty
(
proLabels
)){
labelIds
.
addAll
(
proLabels
);
}
if
(!
ListUtils
.
isEmpty
(
depLabels
)){
labelIds
.
addAll
(
depLabels
);
}
if
(!
ListUtils
.
isEmpty
(
purLabels
)){
labelIds
.
addAll
(
purLabels
);
}
if
(!
ListUtils
.
isEmpty
(
labelIds
))
{
Map
<
Long
,
String
>
labelMap
=
labelConsr
.
getLabelName
(
labelIds
);
if
(!
MapUtils
.
isEmpty
(
labelMap
))
{
for
(
Object
object:
objs
){
GroupQrcodeVO
qrcodeVO
=
(
GroupQrcodeVO
)
object
;
if
(
null
!=
qrcodeVO
.
getProLabelId
()
&&
labelMap
.
containsKey
(
qrcodeVO
.
getProLabelId
()))
{
qrcodeVO
.
setProLabelName
(
labelMap
.
get
(
qrcodeVO
.
getProLabelId
()));
}
if
(
null
!=
qrcodeVO
.
getDepLabelId
()
&&
labelMap
.
containsKey
(
qrcodeVO
.
getDepLabelId
()))
{
qrcodeVO
.
setDepLabelName
(
labelMap
.
get
(
qrcodeVO
.
getDepLabelId
()));
}
if
(
null
!=
qrcodeVO
.
getPurLabelId
()
&&
labelMap
.
containsKey
(
qrcodeVO
.
getPurLabelId
()))
{
qrcodeVO
.
setPurLabelName
(
labelMap
.
get
(
qrcodeVO
.
getPurLabelId
()));
}
}
}
}
return
pageBean
;
return
pageBean
;
}
}
...
@@ -1049,7 +1137,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -1049,7 +1137,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"暂无数据导出!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"暂无数据导出!"
);
}
}
// 字段名
// 字段名
String
[]
rowsName
=
{
"序号"
,
"广告位名称"
,
"广告主"
,
"广告位置"
,
"投放时间"
,
"曝光量"
,
"点击量"
,
"点击率"
,
"累
积
收益"
};
String
[]
rowsName
=
{
"序号"
,
"广告位名称"
,
"广告主"
,
"广告位置"
,
"投放时间"
,
"曝光量"
,
"点击量"
,
"点击率"
,
"累
计
收益"
};
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
Object
[]
objs
;
Object
[]
objs
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
...
@@ -1174,7 +1262,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -1174,7 +1262,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"暂无数据导出!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"暂无数据导出!"
);
}
}
// 字段名
// 字段名
String
[]
rowsName
=
{
"序号"
,
"广告位名称"
,
"广告主"
,
"广告位置"
,
"投放时间"
,
"曝光量"
,
"点击量"
,
"点击率"
,
"累
积
收益"
};
String
[]
rowsName
=
{
"序号"
,
"广告位名称"
,
"广告主"
,
"广告位置"
,
"投放时间"
,
"曝光量"
,
"点击量"
,
"点击率"
,
"累
计
收益"
};
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
Object
[]
objs
;
Object
[]
objs
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
...
@@ -1376,7 +1464,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -1376,7 +1464,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"暂无数据导出!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"暂无数据导出!"
);
}
}
// 字段名
// 字段名
String
[]
rowsName
=
{
"序号"
,
"广告位名称"
,
"对方ID"
,
"广告位置"
,
"投放渠道"
,
"投放时间"
,
"曝光量"
,
"点击量"
,
"点击率"
,
"累
积
收益"
};
String
[]
rowsName
=
{
"序号"
,
"广告位名称"
,
"对方ID"
,
"广告位置"
,
"投放渠道"
,
"投放时间"
,
"曝光量"
,
"点击量"
,
"点击率"
,
"累
计
收益"
};
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
Object
[]
objs
;
Object
[]
objs
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
...
...
pcloud-service-book/src/main/java/com/pcloud/book/advertising/facade/AdvertisingSpaceFacade.java
View file @
a841b4e6
package
com
.
pcloud
.
book
.
advertising
.
facade
;
package
com
.
pcloud
.
book
.
advertising
.
facade
;
import
org.codehaus.jackson.JsonParseException
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
com.pcloud.book.advertising.entity.AdvertisingAdviserPermission
;
import
com.pcloud.book.advertising.entity.AdvertisingAdviserPermission
;
import
com.pcloud.book.advertising.entity.AdvertisingAgentPermission
;
import
com.pcloud.book.advertising.entity.AdvertisingAgentPermission
;
import
com.pcloud.book.advertising.entity.AdvertisingClickRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingClickRecord
;
...
@@ -18,6 +10,16 @@ import com.pcloud.book.advertising.entity.AdvertisingSpace;
...
@@ -18,6 +10,16 @@ import com.pcloud.book.advertising.entity.AdvertisingSpace;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.permission.PermissionException
;
import
org.codehaus.jackson.JsonParseException
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
...
@@ -254,13 +256,19 @@ public interface AdvertisingSpaceFacade {
...
@@ -254,13 +256,19 @@ public interface AdvertisingSpaceFacade {
*/
*/
@ApiOperation
(
value
=
"平台端获取社群书微信群列表"
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"平台端获取社群书微信群列表"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"书籍名称"
,
dataType
=
"string"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"书籍名称"
,
dataType
=
"string"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
dataType
=
"int"
,
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
=
"proLabelId"
,
value
=
"专业标签id"
,
dataType
=
"long"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"depLabelId"
,
value
=
"深度标签id"
,
dataType
=
"long"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"purLabelId"
,
value
=
"目的标签id"
,
dataType
=
"string"
,
required
=
false
,
paramType
=
"query"
)
})
})
@RequestMapping
(
value
=
"listGroupQrcode4Platform"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"listGroupQrcode4Platform"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
listGroupQrcode4Platform
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
ResponseDto
<?>
listGroupQrcode4Platform
(
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
@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
,
@RequestParam
(
value
=
"proLabelId"
,
required
=
false
)
Long
proLabelId
,
@RequestParam
(
value
=
"depLabelId"
,
required
=
false
)
Long
depLabelId
,
@RequestParam
(
value
=
"purLabelId"
,
required
=
false
)
Long
purLabelId
)
throws
PermissionException
,
BizException
,
JsonParseException
;
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
/**
...
...
pcloud-service-book/src/main/java/com/pcloud/book/advertising/facade/impl/AdvertisingSpaceFacadeImpl.java
View file @
a841b4e6
package
com
.
pcloud
.
book
.
advertising
.
facade
.
impl
;
package
com
.
pcloud
.
book
.
advertising
.
facade
.
impl
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.codehaus.jackson.JsonParseException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.pcloud.book.advertising.biz.AdvertisingSpaceBiz
;
import
com.pcloud.book.advertising.biz.AdvertisingSpaceBiz
;
import
com.pcloud.book.advertising.dto.AdvertisingSpaceDTO
;
import
com.pcloud.book.advertising.dto.AdvertisingSpaceDTO
;
import
com.pcloud.book.advertising.entity.AdvertisingAdviserPermission
;
import
com.pcloud.book.advertising.entity.AdvertisingAdviserPermission
;
...
@@ -31,6 +19,20 @@ import com.pcloud.common.utils.SessionUtil;
...
@@ -31,6 +19,20 @@ import com.pcloud.common.utils.SessionUtil;
import
com.pcloud.common.utils.cookie.Cookie
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
org.codehaus.jackson.JsonParseException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
/**
* Description 广告位接口层接口实现类
* Description 广告位接口层接口实现类
* @author PENG
* @author PENG
...
@@ -228,8 +230,11 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
...
@@ -228,8 +230,11 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
*/
*/
@Override
@Override
@RequestMapping
(
value
=
"listGroupQrcode4Platform"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"listGroupQrcode4Platform"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
listGroupQrcode4Platform
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
public
ResponseDto
<?>
listGroupQrcode4Platform
(
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
@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
,
@RequestParam
(
value
=
"proLabelId"
,
required
=
false
)
Long
proLabelId
,
@RequestParam
(
value
=
"depLabelId"
,
required
=
false
)
Long
depLabelId
,
@RequestParam
(
value
=
"purLabelId"
,
required
=
false
)
Long
purLabelId
)
throws
PermissionException
,
BizException
,
JsonParseException
{
throws
PermissionException
,
BizException
,
JsonParseException
{
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
throw
BookBizException
.
PAGE_PARAM_DELETION
;
...
@@ -237,6 +242,9 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
...
@@ -237,6 +242,9 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
SessionUtil
.
getToken4Redis
(
token
);
SessionUtil
.
getToken4Redis
(
token
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"name"
,
StringUtil
.
isEmpty
(
name
)
?
null
:
name
);
paramMap
.
put
(
"name"
,
StringUtil
.
isEmpty
(
name
)
?
null
:
name
);
paramMap
.
put
(
"proLabelId"
,
proLabelId
);
paramMap
.
put
(
"depLabelId"
,
depLabelId
);
paramMap
.
put
(
"purLabelId"
,
purLabelId
);
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
listGroupQrcode4Platform
(
paramMap
,
new
PageParam
(
currentPage
,
numPerPage
)));
return
new
ResponseDto
<>(
advertisingSpaceBiz
.
listGroupQrcode4Platform
(
paramMap
,
new
PageParam
(
currentPage
,
numPerPage
)));
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/consumer/label/LabelConsr.java
0 → 100644
View file @
a841b4e6
/**
*
*/
package
com
.
pcloud
.
book
.
consumer
.
label
;
import
com.pcloud.common.core.biz.LabelUsedQueueBiz
;
import
com.pcloud.common.core.dto.LabelUsedMessageDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.labelcenter.label.service.LabelService
;
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.Map
;
import
lombok.extern.slf4j.Slf4j
;
/**
* @描述:标签中间件
* @作者:songx
* @创建时间:2016年12月21日,下午3:04:17 @版本:1.0
*/
@Slf4j
@Component
(
"labelConsr"
)
public
class
LabelConsr
{
@Autowired
private
LabelService
labelService
;
@Autowired
private
LabelUsedQueueBiz
labelUsedQueueBiz
;
/**
* 标签使用量
*/
public
void
sendLabelUsed
(
Long
partyId
,
Long
proLabelId
,
Long
depLabelId
,
Long
purLabelId
)
throws
BizException
{
log
.
info
(
"【标签中心(消)】标签使用量,<START>.[partyId]="
+
partyId
+
",[proLabelId]="
+
proLabelId
+
",[depLabelId]="
+
depLabelId
+
",[purLabelId]="
+
purLabelId
);
if
(
proLabelId
==
null
&&
depLabelId
==
null
&&
purLabelId
==
null
)
{
return
;
}
LabelUsedMessageDto
labelUsedMessageDto
=
new
LabelUsedMessageDto
(
partyId
,
proLabelId
,
depLabelId
,
purLabelId
);
try
{
labelUsedQueueBiz
.
sendMessageQueue
(
labelUsedMessageDto
);
}
catch
(
Exception
e
)
{
log
.
error
(
"【标签中心(消)】标签使用量.[sendMessageQueue]:"
+
e
.
getMessage
(),
e
);
}
log
.
info
(
"【标签中心(消)】标签使用量,<END>"
);
}
/**
* 获取标签的名称
*/
public
Map
<
Long
,
String
>
getLabelName
(
List
<
Long
>
labelIds
)
throws
BizException
{
log
.
info
(
"【标签中心(消)】获取标签的名称,<START>.[labelIds]="
+
labelIds
.
toString
());
if
(
ListUtils
.
isEmpty
(
labelIds
))
{
return
null
;
}
Map
<
Long
,
String
>
labelNameMap
=
null
;
try
{
labelNameMap
=
ResponseHandleUtil
.
parseMap
(
labelService
.
getLabelName
(
labelIds
),
Long
.
class
,
String
.
class
);
}
catch
(
Exception
e
)
{
log
.
error
(
"【标签中心(消)】获取标签的名称.[getLabelName]:"
+
e
.
getMessage
(),
e
);
}
log
.
info
(
"【标签中心(消)】获取标签的名称,<END>.[labelNameMap]="
+
(
labelNameMap
==
null
?
null
:
labelNameMap
.
toString
()));
return
labelNameMap
;
}
/**
* 根据标签名称获取标签id
*/
public
Long
getLabelIdByName
(
Long
partyId
,
String
code
,
String
labelName
,
Long
parentLabelId
)
{
log
.
info
(
"【标签中心(消)】根据标签名称获取标签id,<START>.[partyId]="
+
partyId
+
",[code]="
+
code
+
",[labelName]="
+
labelName
+
",[parentLabelId]="
+
parentLabelId
);
if
(
parentLabelId
==
null
)
{
return
null
;
}
Long
labelId
=
null
;
try
{
labelId
=
ResponseHandleUtil
.
parseResponse
(
labelService
.
getLableIdByName
(
partyId
,
code
,
labelName
,
parentLabelId
),
Long
.
class
);
}
catch
(
Exception
e
)
{
log
.
error
(
"【标签中心(消)】根据标签名称获取标签id.[getLableIdByName]:"
+
e
.
getMessage
(),
e
);
}
log
.
info
(
"【标签中心(消)】根据标签名称获取标签id,<START>.[labelId]="
+
labelId
);
return
labelId
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/vo/GroupQrcodeVO.java
View file @
a841b4e6
...
@@ -48,6 +48,25 @@ public class GroupQrcodeVO implements Serializable {
...
@@ -48,6 +48,25 @@ public class GroupQrcodeVO implements Serializable {
@ApiModelProperty
(
"是否已选"
)
@ApiModelProperty
(
"是否已选"
)
private
Boolean
isSelect
;
private
Boolean
isSelect
;
@ApiModelProperty
(
"专业标签ID"
)
private
Long
proLabelId
;
@ApiModelProperty
(
"专业标签名称"
)
private
String
proLabelName
;
@ApiModelProperty
(
"深度标签ID"
)
private
Long
depLabelId
;
@ApiModelProperty
(
"深度标签名称"
)
private
String
depLabelName
;
@ApiModelProperty
(
"目的标签ID"
)
private
Long
purLabelId
;
@ApiModelProperty
(
"目的标签名称"
)
private
String
purLabelName
;
public
Long
getClassifyId
()
{
public
Long
getClassifyId
()
{
return
classifyId
;
return
classifyId
;
}
}
...
@@ -136,6 +155,62 @@ public class GroupQrcodeVO implements Serializable {
...
@@ -136,6 +155,62 @@ public class GroupQrcodeVO implements Serializable {
this
.
isSelect
=
isSelect
;
this
.
isSelect
=
isSelect
;
}
}
public
Boolean
getSelect
()
{
return
isSelect
;
}
public
void
setSelect
(
Boolean
select
)
{
isSelect
=
select
;
}
public
Long
getProLabelId
()
{
return
proLabelId
;
}
public
void
setProLabelId
(
Long
proLabelId
)
{
this
.
proLabelId
=
proLabelId
;
}
public
String
getProLabelName
()
{
return
proLabelName
;
}
public
void
setProLabelName
(
String
proLabelName
)
{
this
.
proLabelName
=
proLabelName
;
}
public
Long
getDepLabelId
()
{
return
depLabelId
;
}
public
void
setDepLabelId
(
Long
depLabelId
)
{
this
.
depLabelId
=
depLabelId
;
}
public
String
getDepLabelName
()
{
return
depLabelName
;
}
public
void
setDepLabelName
(
String
depLabelName
)
{
this
.
depLabelName
=
depLabelName
;
}
public
Long
getPurLabelId
()
{
return
purLabelId
;
}
public
void
setPurLabelId
(
Long
purLabelId
)
{
this
.
purLabelId
=
purLabelId
;
}
public
String
getPurLabelName
()
{
return
purLabelName
;
}
public
void
setPurLabelName
(
String
purLabelName
)
{
this
.
purLabelName
=
purLabelName
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"GroupQrcodeVO{"
+
return
"GroupQrcodeVO{"
+
...
@@ -150,6 +225,12 @@ public class GroupQrcodeVO implements Serializable {
...
@@ -150,6 +225,12 @@ public class GroupQrcodeVO implements Serializable {
", channelId="
+
channelId
+
", channelId="
+
channelId
+
", adviserId="
+
adviserId
+
", adviserId="
+
adviserId
+
", isSelect="
+
isSelect
+
", isSelect="
+
isSelect
+
", proLabelId="
+
proLabelId
+
", proLabelName='"
+
proLabelName
+
'\''
+
", depLabelId="
+
depLabelId
+
", depLabelName='"
+
depLabelName
+
'\''
+
", purLabelId="
+
purLabelId
+
", purLabelName='"
+
purLabelName
+
'\''
+
'}'
;
'}'
;
}
}
}
}
pcloud-service-book/src/main/resources/mapper/group/BookGroupClassify.Mapper.xml
View file @
a841b4e6
...
@@ -408,13 +408,17 @@
...
@@ -408,13 +408,17 @@
c.classify,
c.classify,
c.book_group_id bookGroupId,
c.book_group_id bookGroupId,
g.group_name groupQrcodeName,
g.group_name groupQrcodeName,
IF (t.id IS NOT NULL, 1, 0) isSelect
IF (t.id IS NOT NULL, 1, 0) isSelect,
bg.dep_label_id depLabelId,
bg.pro_label_id proLabelId,
bg.pur_label_id purLabelId
FROM
FROM
book_group_classify c
book_group_classify c
JOIN book_group_qrcode g ON c.id = g.classify_id
JOIN book_group_qrcode g ON c.id = g.classify_id
AND c.is_delete = 0
AND c.is_delete = 0
AND g.is_delete = 0
AND g.is_delete = 0
LEFT JOIN book b ON c.book_id = b.book_id
LEFT JOIN book b ON c.book_id = b.book_id
LEFT JOIN book_group bg ON c.book_group_id = bg.id
LEFT JOIN (
LEFT JOIN (
SELECT
SELECT
db.id,
db.id,
...
@@ -439,8 +443,18 @@
...
@@ -439,8 +443,18 @@
AND (
AND (
book_name LIKE CONCAT('%', #{name},'%')
book_name LIKE CONCAT('%', #{name},'%')
OR group_name LIKE CONCAT('%', #{name},'%')
OR group_name LIKE CONCAT('%', #{name},'%')
OR classify LIKE CONCAT('%', #{name},'%')
)
)
</if>
</if>
<if
test=
"depLabelId != null"
>
AND bg.dep_label_id = #{depLabelId}
</if>
<if
test=
"proLabelId != null"
>
AND bg.pro_label_id = #{proLabelId}
</if>
<if
test=
"purLabelId != null"
>
AND bg.pur_label_id = #{purLabelId}
</if>
GROUP BY
GROUP BY
g.id
g.id
ORDER BY
ORDER BY
...
...
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