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
47f5ea56
Commit
47f5ea56
authored
Sep 02, 2019
by
朱亚洁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
广告主打标
parent
f4259b6f
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
2266 additions
and
43 deletions
+2266
-43
AdvertisingSpaceService.java
...oud/book/advertising/service/AdvertisingSpaceService.java
+16
-3
GroupMasterTagBiz.java
...va/com/pcloud/book/advertising/biz/GroupMasterTagBiz.java
+109
-0
AdvertisingSpaceBizImpl.java
...ud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
+110
-5
GroupMasterTagBizImpl.java
...loud/book/advertising/biz/impl/GroupMasterTagBizImpl.java
+551
-0
AdvertisingGroupTagDao.java
...m/pcloud/book/advertising/dao/AdvertisingGroupTagDao.java
+55
-0
AdvertisingMasterDao.java
...com/pcloud/book/advertising/dao/AdvertisingMasterDao.java
+29
-1
AdvertisingGroupTagDaoImpl.java
...book/advertising/dao/impl/AdvertisingGroupTagDaoImpl.java
+54
-0
AdvertisingMasterDaoImpl.java
...d/book/advertising/dao/impl/AdvertisingMasterDaoImpl.java
+29
-2
AdvertisingMasterDTO.java
...com/pcloud/book/advertising/dto/AdvertisingMasterDTO.java
+40
-0
Book4AdvertisingMasterDTO.java
...cloud/book/advertising/dto/Book4AdvertisingMasterDTO.java
+102
-0
GroupMasterAddDTO.java
...va/com/pcloud/book/advertising/dto/GroupMasterAddDTO.java
+67
-0
GroupMasterDTO.java
.../java/com/pcloud/book/advertising/dto/GroupMasterDTO.java
+315
-0
AdvertisingGroupTag.java
...m/pcloud/book/advertising/entity/AdvertisingGroupTag.java
+75
-0
AdvertisingMaster.java
...com/pcloud/book/advertising/entity/AdvertisingMaster.java
+43
-1
SettlementMethodEnum.java
...m/pcloud/book/advertising/enums/SettlementMethodEnum.java
+3
-2
AdvertisingSpaceFacade.java
...cloud/book/advertising/facade/AdvertisingSpaceFacade.java
+211
-2
AdvertisingSpaceFacadeImpl.java
...k/advertising/facade/impl/AdvertisingSpaceFacadeImpl.java
+205
-4
AdvertisingSpaceServiceImpl.java
...advertising/service/impl/AdvertisingSpaceServiceImpl.java
+29
-5
PartyConsr.java
...c/main/java/com/pcloud/book/consumer/user/PartyConsr.java
+55
-10
WechatGroupConsr.java
...om/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
+21
-6
AdvertisingGroupTagMapper.xml
...esources/mapper/advertising/AdvertisingGroupTagMapper.xml
+99
-0
AdvertisingMasterMapper.xml
.../resources/mapper/advertising/AdvertisingMasterMapper.xml
+48
-2
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/advertising/service/AdvertisingSpaceService.java
View file @
47f5ea56
package
com
.
pcloud
.
book
.
advertising
.
service
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
com.pcloud.common.exceptions.BizException
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
import
java.util.Map
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
@FeignClient
(
value
=
"pcloud-service-book"
,
qualifier
=
"advertisingSpaceServiceCloud"
,
path
=
"book/v1.0/advertisingSpaceService"
)
@Api
(
description
=
"广告位内部接口"
)
public
interface
AdvertisingSpaceService
{
...
...
@@ -26,4 +34,9 @@ public interface AdvertisingSpaceService {
@ApiOperation
(
"发送广告计划"
)
@PostMapping
(
"sendAdvertisingPlan"
)
void
sendAdvertisingPlan
(
@RequestBody
Map
<
String
,
Object
>
map
)
throws
BizException
;
@ApiOperation
(
value
=
"根据登录用户获取标记的微信群列表"
,
httpMethod
=
"GET"
)
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户登录id"
,
dataType
=
"long"
,
required
=
true
,
paramType
=
"query"
)
@GetMapping
(
"getTagWxGroupIdsByUserId"
)
ResponseEntity
<
ResponseDto
<
List
<
String
>>>
getTagWxGroupIdsByUserId
(
@RequestParam
(
"userId"
)
Long
userId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/GroupMasterTagBiz.java
0 → 100644
View file @
47f5ea56
package
com
.
pcloud
.
book
.
advertising
.
biz
;
import
com.pcloud.book.advertising.dto.AdvertisingMasterDTO
;
import
com.pcloud.book.advertising.dto.Book4AdvertisingMasterDTO
;
import
com.pcloud.book.advertising.dto.GroupMasterAddDTO
;
import
com.pcloud.book.advertising.dto.GroupMasterDTO
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
java.util.List
;
import
java.util.Map
;
/**
* @描述:微信群标记广告主
* @作者:zhuyajie
* @创建时间:18:47 2019/8/22
* @版本:1.0
*/
public
interface
GroupMasterTagBiz
{
/**
* 微信群广告主标记列表
* @param currentPage
* @param numPerPage
* @param paramMap
* @return
*/
PageBeanNew
<
GroupMasterDTO
>
listPageGroupMaster
(
Integer
currentPage
,
Integer
numPerPage
,
Map
<
String
,
Object
>
paramMap
);
/**
* 获取品牌方广告主
* @return
* @throws BizException
*/
List
<
AdvertisingMasterDTO
>
getBrandMaster
()
throws
BizException
;
/**
* 微信群标记广告主
* @param groupMasterAddDTO
*/
void
setGroupMaster
(
GroupMasterAddDTO
groupMasterAddDTO
);
/**
* 广告主标记-图书列表
* @param currentPage
* @param numPerPage
* @param name
* @return
*/
PageBeanNew
<
Book4AdvertisingMasterDTO
>
listPageBook4AdMaster
(
Integer
currentPage
,
Integer
numPerPage
,
String
name
);
/**
* 品牌方广告主-微信群列表
* @param userId
* @param currentPage
* @param numPerPage
* @param paramMap
* @return
*/
PageBeanNew
<
GroupMasterDTO
>
listPageGroupList4Master
(
Long
userId
,
Integer
currentPage
,
Integer
numPerPage
,
Map
<
String
,
Object
>
paramMap
);
/**
* 微信群广告主标记列表-导出
* @param name
* @param proLabelId
* @param depLabelId
* @param purLabelId
* @param masterId
*/
void
exportGroupMaster
(
String
name
,
Long
proLabelId
,
Long
depLabelId
,
Long
purLabelId
,
Long
masterId
,
Long
partyId
);
/**
* 品牌方广告主-微信群导出
* @param partyId
* @param paramMap
*/
void
exportGroupList4Master
(
Long
partyId
,
Map
<
String
,
Object
>
paramMap
,
Long
userId
);
/**
* 根据登录用户获取标记的微信群列表
* @param userId
* @return
*/
List
<
String
>
getTagWxGroupIdsByUserId
(
Long
userId
);
/**
* 品牌方广告主-微信群基本信息列表
* @param currentPage
* @param numPerPage
* @param name
* @param userId
* @return
*/
PageBeanNew
<
GroupMasterDTO
>
listPageGroupBaseInfo4Master
(
Integer
currentPage
,
Integer
numPerPage
,
String
name
,
Long
userId
);
/**
* 修改广告主的登录id
* @param masterId
* @param loginId
*/
void
updateMasterLoginId
(
Long
masterId
,
Long
loginId
);
/**
* 广告主已标记的书刊id
* @param masterId
* @return
*/
List
<
Long
>
getTagBookIds4AdMatser
(
Long
masterId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
View file @
47f5ea56
...
...
@@ -5,10 +5,51 @@ import com.pcloud.appcenter.app.service.AppTypeService;
import
com.pcloud.book.advertising.biz.AdvertisingSpaceBiz
;
import
com.pcloud.book.advertising.biz.BmBiz
;
import
com.pcloud.book.advertising.check.AdvertisingPlanCheck
;
import
com.pcloud.book.advertising.dao.*
;
import
com.pcloud.book.advertising.dto.*
;
import
com.pcloud.book.advertising.entity.*
;
import
com.pcloud.book.advertising.enums.*
;
import
com.pcloud.book.advertising.dao.AdvertisingAdviserPermissionDao
;
import
com.pcloud.book.advertising.dao.AdvertisingAgentPermissionDao
;
import
com.pcloud.book.advertising.dao.AdvertisingBrowseRecordDao
;
import
com.pcloud.book.advertising.dao.AdvertisingClickRecordDao
;
import
com.pcloud.book.advertising.dao.AdvertisingDetailFileDao
;
import
com.pcloud.book.advertising.dao.AdvertisingDistributionBookDao
;
import
com.pcloud.book.advertising.dao.AdvertisingExposureRecordDao
;
import
com.pcloud.book.advertising.dao.AdvertisingGroupTagDao
;
import
com.pcloud.book.advertising.dao.AdvertisingIncomeDailyDao
;
import
com.pcloud.book.advertising.dao.AdvertisingMasterDao
;
import
com.pcloud.book.advertising.dao.AdvertisingPilotRecordDao
;
import
com.pcloud.book.advertising.dao.AdvertisingPlanDao
;
import
com.pcloud.book.advertising.dao.AdvertisingPlanGroupDao
;
import
com.pcloud.book.advertising.dao.AdvertisingPutDao
;
import
com.pcloud.book.advertising.dao.AdvertisingSettlementMethodDao
;
import
com.pcloud.book.advertising.dao.AdvertisingSpaceDao
;
import
com.pcloud.book.advertising.dto.AdvertisingDistributionDTO
;
import
com.pcloud.book.advertising.dto.AdvertisingMasterDTO
;
import
com.pcloud.book.advertising.dto.AdvertisingSettlementMethodDTO
;
import
com.pcloud.book.advertising.dto.AdvertisingSpaceDTO
;
import
com.pcloud.book.advertising.dto.BookAndChannelDTO
;
import
com.pcloud.book.advertising.dto.QrcodeAdvertisingSpaceCountDTO
;
import
com.pcloud.book.advertising.dto.WechatGroupClickUserDTO
;
import
com.pcloud.book.advertising.dto.WeixinClassifyInfoDTO
;
import
com.pcloud.book.advertising.entity.AdvertisingAdviserPermission
;
import
com.pcloud.book.advertising.entity.AdvertisingAgentPermission
;
import
com.pcloud.book.advertising.entity.AdvertisingBrowseRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingClickRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingDetailFile
;
import
com.pcloud.book.advertising.entity.AdvertisingDistributionBook
;
import
com.pcloud.book.advertising.entity.AdvertisingExposureRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingMaster
;
import
com.pcloud.book.advertising.entity.AdvertisingPilotRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingPlan
;
import
com.pcloud.book.advertising.entity.AdvertisingPlanGroup
;
import
com.pcloud.book.advertising.entity.AdvertisingPut
;
import
com.pcloud.book.advertising.entity.AdvertisingSettlementMethod
;
import
com.pcloud.book.advertising.entity.AdvertisingSpace
;
import
com.pcloud.book.advertising.entity.DistributionWechatGroup
;
import
com.pcloud.book.advertising.enums.AdDetailModeEnum
;
import
com.pcloud.book.advertising.enums.AdPositionDetailEnum
;
import
com.pcloud.book.advertising.enums.AdPositionEnum
;
import
com.pcloud.book.advertising.enums.AdPositionModeEnum
;
import
com.pcloud.book.advertising.enums.PutTypeEnum
;
import
com.pcloud.book.advertising.enums.SettlementMethodEnum
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.biz.BookBiz
;
import
com.pcloud.book.book.dao.BookDao
;
...
...
@@ -24,6 +65,7 @@ import com.pcloud.book.consumer.resource.ProductConsr;
import
com.pcloud.book.consumer.user.AdviserConsr
;
import
com.pcloud.book.consumer.user.AgentConsr
;
import
com.pcloud.book.consumer.user.ChannelConsr
;
import
com.pcloud.book.consumer.user.PartyConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.biz.WeixinQrcodeBiz
;
import
com.pcloud.book.group.dao.BookGroupClassifyDao
;
...
...
@@ -60,6 +102,7 @@ import com.pcloud.facade.quartz.entity.ScheduleJob;
import
com.pcloud.facade.quartz.service.ScheduleService
;
import
com.pcloud.readercenter.wechat.entity.WechatUser
;
import
com.pcloud.resourcecenter.product.service.ProductService
;
import
com.pcloud.usercenter.user.entity.UserLogin
;
import
com.pcloud.wechatgroup.message.dto.GroupChatCountDTO
;
import
com.sdk.wxgroup.SendArticleMessageVO
;
import
com.sdk.wxgroup.SendPicMessageVO
;
...
...
@@ -77,7 +120,16 @@ import org.springframework.transaction.annotation.Transactional;
import
java.math.BigDecimal
;
import
java.net.URLEncoder
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.UUID
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
...
...
@@ -176,6 +228,10 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
private
ConvertConsr
convertConsr
;
@Autowired
private
AdvertisingDetailFileDao
detailFileDao
;
@Autowired
private
PartyConsr
partyConsr
;
@Autowired
private
AdvertisingGroupTagDao
advertisingGroupTagDao
;
private
static
final
String
ADVERTISING_PUT_PLAN_SCHEDULE_PRE
=
"ADVERTISING_PUT_PALN_"
;
...
...
@@ -2252,6 +2308,18 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
if
(
null
!=
nameExist
&&
nameExist
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告主已存在!"
);
}
//包含品牌方结算方式
List
<
String
>
methods
=
advertisingMaster
.
getSettlementMethodList
().
stream
().
filter
(
s
->
s
.
getSettlementMethod
()
!=
null
).
map
(
AdvertisingSettlementMethod:
:
getSettlementMethod
).
collect
(
Collectors
.
toList
());
if
(
methods
.
contains
(
SettlementMethodEnum
.
Brand
.
code
))
{
/*if (StringUtil.isEmpty(advertisingMaster.getLoginName())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "登录名为空!");
} else {
Long loginUserId = partyConsr.addLoginAccount(advertisingMaster.getLoginName(), advertisingMaster.getPassword());
advertisingMaster.setLoginId(loginUserId);
}*/
//创建子账号,通过更新数据库与广告主关联,登录账号不在这里创建,返回默认的loginUserId
advertisingMaster
.
setLoginId
(
123
l
);
}
advertisingMasterDao
.
insert
(
advertisingMaster
);
Long
masterId
=
advertisingMaster
.
getId
();
advertisingMaster
.
getSettlementMethodList
().
forEach
(
method
->
method
.
setMasterId
(
masterId
));
...
...
@@ -2281,6 +2349,34 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
if
(
null
!=
nameExist
&&
nameExist
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告主名称不能重复!"
);
}
AdvertisingMaster
master
=
advertisingMasterDao
.
getById
(
masterId
);
if
(
null
==
master
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"广告主不存在!"
);
}
//包含品牌方结算方式
List
<
String
>
methods
=
advertisingMaster
.
getSettlementMethodList
().
stream
().
filter
(
s
->
s
.
getSettlementMethod
()
!=
null
).
map
(
AdvertisingSettlementMethod:
:
getSettlementMethod
).
collect
(
Collectors
.
toList
());
if
(
methods
.
contains
(
SettlementMethodEnum
.
Brand
.
code
))
{
Long
loginId
=
master
.
getLoginId
();
/*if (StringUtil.isEmpty(advertisingMaster.getLoginName()) || StringUtil.isEmpty(advertisingMaster.getPassword())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "登录名或密码为空!");
}
if (null == loginId) {//新增账号
loginId = partyConsr.addLoginAccount(advertisingMaster.getLoginName(), advertisingMaster.getPassword());
advertisingMaster.setLoginId(loginId);
} else {//修改账号
partyConsr.updateLoginAccount(advertisingMaster.getLoginName(), advertisingMaster.getPassword(), loginId);
}*/
//账号修改通过子账号完成
if
(
null
==
loginId
)
{
LOGGER
.
error
(
"广告主"
+
masterId
+
"是品牌方结算,子账号为空"
);
}
}
else
{
if
(
null
!=
master
.
getLoginId
())
{
//删除账号,标记记录
// partyConsr.deleteLoginAccount(master.getLoginId());
advertisingMaster
.
setLoginId
(
null
);
advertisingGroupTagDao
.
deleteByMasterId
(
masterId
);
}
}
advertisingMasterDao
.
update
(
advertisingMaster
);
// 删除广告主之前配置的结算方式
advertisingSettlementMethodDao
.
deleteByMasterId
(
masterId
);
...
...
@@ -2330,6 +2426,15 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
new
BigDecimal
(
pilotFinishUserNum
.
doubleValue
()
/
clickUserNum
).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
masterDTO
.
setPilotFinishUserNum
(
pilotFinishUserNum
);
masterDTO
.
setPilotFinishRate
(
pilotFinishRate
);
//广告主登录名
AdvertisingMaster
master
=
advertisingMasterDao
.
getById
(
masterDTO
.
getId
());
if
(
null
!=
master
&&
null
!=
master
.
getLoginId
())
{
UserLogin
userLogin
=
partyConsr
.
getUserLoginInfo
(
master
.
getLoginId
());
if
(
null
!=
userLogin
)
{
masterDTO
.
setLoginName
(
userLogin
.
getUserName
());
masterDTO
.
setPassword
(
userLogin
.
getCurrentPassword
());
}
}
}
return
pageBean
;
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/impl/GroupMasterTagBizImpl.java
0 → 100644
View file @
47f5ea56
package
com
.
pcloud
.
book
.
advertising
.
biz
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pcloud.book.advertising.biz.AdvertisingSpaceBiz
;
import
com.pcloud.book.advertising.biz.GroupMasterTagBiz
;
import
com.pcloud.book.advertising.dao.AdvertisingGroupTagDao
;
import
com.pcloud.book.advertising.dao.AdvertisingMasterDao
;
import
com.pcloud.book.advertising.dto.AdvertisingMasterDTO
;
import
com.pcloud.book.advertising.dto.Book4AdvertisingMasterDTO
;
import
com.pcloud.book.advertising.dto.GroupMasterAddDTO
;
import
com.pcloud.book.advertising.dto.GroupMasterDTO
;
import
com.pcloud.book.advertising.dto.QrcodeAdvertisingSpaceCountDTO
;
import
com.pcloud.book.advertising.entity.AdvertisingGroupTag
;
import
com.pcloud.book.advertising.entity.AdvertisingMaster
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.common.ExportConsr
;
import
com.pcloud.book.consumer.label.LabelConsr
;
import
com.pcloud.book.consumer.user.AdviserConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.dao.BookGroupDao
;
import
com.pcloud.book.group.dao.GroupQrcodeDao
;
import
com.pcloud.common.core.biz.MessageBiz
;
import
com.pcloud.common.core.constant.SystemCode
;
import
com.pcloud.common.core.dto.SendNotifyDto
;
import
com.pcloud.common.core.enums.NotifyOriginTypeEnum
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto
;
import
org.apache.commons.collections.MapUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.stream.Collectors
;
import
lombok.extern.slf4j.Slf4j
;
/**
* @描述:微信群标记广告主
* @作者:zhuyajie
* @创建时间:18:48 2019/8/22
* @版本:1.0
*/
@Slf4j
@Component
(
"groupMasterBiz"
)
public
class
GroupMasterTagBizImpl
implements
GroupMasterTagBiz
{
private
static
final
ExecutorService
EXECUTOR_SINGLE_SERVICE
=
Executors
.
newSingleThreadExecutor
();
@Autowired
private
GroupQrcodeDao
groupQrcodeDao
;
@Autowired
private
AdviserConsr
adviserConsr
;
@Autowired
private
AdvertisingSpaceBiz
advertisingSpaceBiz
;
@Autowired
private
WechatGroupConsr
wechatGroupConsr
;
@Autowired
private
LabelConsr
labelConsr
;
@Autowired
private
AdvertisingMasterDao
advertisingMasterDao
;
@Autowired
private
AdvertisingGroupTagDao
advertisingGroupTagDao
;
@Autowired
private
BookGroupDao
bookGroupDao
;
@Autowired
private
ExportConsr
exportConsr
;
@Autowired
private
MessageBiz
messageBiz
;
@Override
public
PageBeanNew
<
GroupMasterDTO
>
listPageGroupMaster
(
Integer
currentPage
,
Integer
numPerPage
,
Map
<
String
,
Object
>
paramMap
)
{
PageBeanNew
<
GroupMasterDTO
>
pageBeanNew
=
groupQrcodeDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listPageGroupMaster"
);
if
(
null
==
pageBeanNew
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
}
List
<
GroupMasterDTO
>
groupMasterDTOS
=
pageBeanNew
.
getRecordList
();
setGroupInfo
(
groupMasterDTOS
);
return
pageBeanNew
;
}
/**
* 填充群信息
* @param groupMasterDTOS
*/
private
void
setGroupInfo
(
List
<
GroupMasterDTO
>
groupMasterDTOS
)
{
List
<
Long
>
adviserIds
=
groupMasterDTOS
.
stream
().
filter
(
s
->
s
.
getAdviserId
()
!=
null
).
map
(
GroupMasterDTO:
:
getAdviserId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
qrcodeIds
=
groupMasterDTOS
.
stream
().
filter
(
s
->
s
.
getGroupQrcodeId
()
!=
null
).
map
(
GroupMasterDTO:
:
getGroupQrcodeId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
labelIds
=
new
ArrayList
<>();
List
<
Long
>
proLabels
=
groupMasterDTOS
.
stream
().
filter
(
s
->
s
.
getProLabelId
()
!=
null
).
map
(
GroupMasterDTO:
:
getProLabelId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
depLabels
=
groupMasterDTOS
.
stream
().
filter
(
s
->
s
.
getDepLabelId
()
!=
null
).
map
(
GroupMasterDTO:
:
getDepLabelId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
purLabels
=
groupMasterDTOS
.
stream
().
filter
(
s
->
s
.
getPurLabelId
()
!=
null
).
map
(
GroupMasterDTO:
:
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
);
}
Map
<
Long
,
AdviserBaseInfoDto
>
baseInfoDtoMap
=
new
HashMap
<>();
Map
<
Long
,
String
>
adviserNameMap
=
new
HashMap
<>();
Map
<
Long
,
QrcodeAdvertisingSpaceCountDTO
>
advertisingSpaceNumMap
=
new
HashMap
<>();
Map
<
Long
,
String
>
labelMap
=
new
HashMap
<>();
Map
<
Long
,
Integer
>
activeCountMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
adviserIds
))
{
baseInfoDtoMap
=
adviserConsr
.
getAdviserId2AdviserInfoDtoMap
(
adviserIds
);
adviserNameMap
=
adviserConsr
.
getNames
(
adviserIds
);
}
if
(!
ListUtils
.
isEmpty
(
qrcodeIds
))
{
advertisingSpaceNumMap
=
advertisingSpaceBiz
.
mapAdvertisingSpaceNum
(
qrcodeIds
);
activeCountMap
=
wechatGroupConsr
.
get7DayActiveCountByQrcode
(
qrcodeIds
);
}
if
(!
ListUtils
.
isEmpty
(
labelIds
))
{
labelMap
=
labelConsr
.
getLabelName
(
labelIds
);
}
for
(
GroupMasterDTO
groupMasterDTO
:
groupMasterDTOS
)
{
//出版社信息
if
(!
MapUtils
.
isEmpty
(
baseInfoDtoMap
)
&&
null
!=
groupMasterDTO
.
getAdviserId
())
{
AdviserBaseInfoDto
adviserBaseInfoDto
=
baseInfoDtoMap
.
get
(
groupMasterDTO
.
getAdviserId
());
if
(
null
!=
adviserBaseInfoDto
)
{
groupMasterDTO
.
setAgentName
(
adviserBaseInfoDto
.
getAgentName
());
}
}
//编辑名称
if
(!
MapUtils
.
isEmpty
(
adviserNameMap
)
&&
null
!=
groupMasterDTO
.
getAdviserId
())
{
groupMasterDTO
.
setAdviserName
(
adviserNameMap
.
get
(
groupMasterDTO
.
getAdviserId
()));
}
//获取广告位数量
Integer
spaceNum
=
0
;
if
(!
MapUtils
.
isEmpty
(
advertisingSpaceNumMap
)
&&
null
!=
groupMasterDTO
.
getGroupQrcodeId
())
{
QrcodeAdvertisingSpaceCountDTO
dto
=
advertisingSpaceNumMap
.
get
(
groupMasterDTO
.
getGroupQrcodeId
());
if
(
null
!=
dto
)
{
spaceNum
=
dto
.
getAdvertisingSpaceNum
();
}
}
groupMasterDTO
.
setAdvertisingSpaceNum
(
spaceNum
);
//标签名称
if
(!
MapUtils
.
isEmpty
(
labelMap
))
{
if
(
null
!=
groupMasterDTO
.
getProLabelId
()
&&
labelMap
.
containsKey
(
groupMasterDTO
.
getProLabelId
()))
{
groupMasterDTO
.
setProLabelName
(
labelMap
.
get
(
groupMasterDTO
.
getProLabelId
()));
}
if
(
null
!=
groupMasterDTO
.
getDepLabelId
()
&&
labelMap
.
containsKey
(
groupMasterDTO
.
getDepLabelId
()))
{
groupMasterDTO
.
setDepLabelName
(
labelMap
.
get
(
groupMasterDTO
.
getDepLabelId
()));
}
if
(
null
!=
groupMasterDTO
.
getPurLabelId
()
&&
labelMap
.
containsKey
(
groupMasterDTO
.
getPurLabelId
()))
{
groupMasterDTO
.
setPurLabelName
(
labelMap
.
get
(
groupMasterDTO
.
getPurLabelId
()));
}
}
//群活跃度
Integer
activeCount
=
0
;
if
(!
MapUtils
.
isEmpty
(
activeCountMap
)
&&
null
!=
groupMasterDTO
.
getGroupQrcodeId
())
{
activeCount
=
activeCountMap
.
get
(
groupMasterDTO
.
getGroupQrcodeId
());
}
groupMasterDTO
.
setActiveCount
(
activeCount
);
//广告主名称
List
<
AdvertisingMaster
>
masterList
=
advertisingMasterDao
.
getByGroup
(
groupMasterDTO
.
getGroupQrcodeId
());
if
(!
ListUtils
.
isEmpty
(
masterList
))
{
groupMasterDTO
.
setMasterList
(
masterList
);
}
}
}
@Override
public
List
<
AdvertisingMasterDTO
>
getBrandMaster
()
throws
BizException
{
List
<
AdvertisingMasterDTO
>
list
=
advertisingMasterDao
.
getBrandMaster
();
return
list
;
}
@Override
public
void
setGroupMaster
(
GroupMasterAddDTO
groupMasterAddDTO
)
{
//多个微信群标记多个广告主
if
(!
ListUtils
.
isEmpty
(
groupMasterAddDTO
.
getGroupQrcodeIdList
()))
{
for
(
Long
groupQrcodeId
:
groupMasterAddDTO
.
getGroupQrcodeIdList
())
{
advertisingGroupTagDao
.
deleteByGroupQrcodeId
(
groupQrcodeId
);
if
(!
ListUtils
.
isEmpty
(
groupMasterAddDTO
.
getMasterIdList
()))
{
List
<
AdvertisingGroupTag
>
tagList
=
new
ArrayList
<>();
Long
bookId
=
groupQrcodeDao
.
getBookIdByGroupQrcodeId
(
groupQrcodeId
);
for
(
Long
masterId
:
groupMasterAddDTO
.
getMasterIdList
())
{
AdvertisingGroupTag
groupTag
=
new
AdvertisingGroupTag
();
groupTag
.
setGroupQrcodeId
(
groupQrcodeId
);
groupTag
.
setMasterId
(
masterId
);
groupTag
.
setTagBookId
(
bookId
);
tagList
.
add
(
groupTag
);
}
advertisingGroupTagDao
.
insert
(
tagList
);
}
}
return
;
}
//一个广告主标记多本书下的微信群
if
(
null
!=
groupMasterAddDTO
.
getMasterId
())
{
//已标记的
List
<
Long
>
beforeBookIds
=
advertisingGroupTagDao
.
getBookIdsByMasterId
(
groupMasterAddDTO
.
getMasterId
());
if
(!
ListUtils
.
isEmpty
(
groupMasterAddDTO
.
getBookIdList
()))
{
List
<
Long
>
addIds
=
new
ArrayList
<>();
List
<
Long
>
deleteIds
=
new
ArrayList
<>();
if
(
ListUtils
.
isEmpty
(
beforeBookIds
))
{
addIds
.
addAll
(
groupMasterAddDTO
.
getBookIdList
());
}
else
{
addIds
.
addAll
(
groupMasterAddDTO
.
getBookIdList
());
addIds
.
removeAll
(
beforeBookIds
);
deleteIds
.
addAll
(
beforeBookIds
);
deleteIds
.
removeAll
(
groupMasterAddDTO
.
getBookIdList
());
}
this
.
addBookTag
(
addIds
,
groupMasterAddDTO
.
getMasterId
());
this
.
deleteBookTag
(
deleteIds
,
groupMasterAddDTO
.
getMasterId
());
}
else
{
this
.
deleteBookTag
(
beforeBookIds
,
groupMasterAddDTO
.
getMasterId
());
}
}
}
/**
* 添加图书标记
*/
private
void
addBookTag
(
List
<
Long
>
bookIds
,
Long
masterId
)
{
if
(
ListUtils
.
isEmpty
(
bookIds
))
{
return
;
}
List
<
AdvertisingGroupTag
>
tagList
=
new
ArrayList
<>();
for
(
Long
bookId
:
bookIds
)
{
AdvertisingGroupTag
groupTag
=
new
AdvertisingGroupTag
();
groupTag
.
setTagBookId
(
bookId
);
groupTag
.
setMasterId
(
masterId
);
groupTag
.
setGroupQrcodeId
(
0L
);
tagList
.
add
(
groupTag
);
}
advertisingGroupTagDao
.
insert
(
tagList
);
//书下每个群添加记录
EXECUTOR_SINGLE_SERVICE
.
execute
(()
->
{
List
<
Long
>
beforeQrcodeIds
=
advertisingGroupTagDao
.
getGroupQrcodeIdsByMasterId
(
masterId
);
for
(
Long
bookId
:
bookIds
)
{
List
<
AdvertisingGroupTag
>
addList
=
new
ArrayList
<>();
List
<
Long
>
qrcodeIds
=
groupQrcodeDao
.
getIdsByBookId
(
bookId
);
if
(
ListUtils
.
isEmpty
(
qrcodeIds
))
{
continue
;
}
if
(!
ListUtils
.
isEmpty
(
beforeQrcodeIds
))
{
//去除已标记的
qrcodeIds
.
removeAll
(
beforeQrcodeIds
);
}
if
(
ListUtils
.
isEmpty
(
qrcodeIds
))
{
continue
;
}
for
(
Long
qrcodeId
:
qrcodeIds
)
{
AdvertisingGroupTag
tag
=
new
AdvertisingGroupTag
();
tag
.
setGroupQrcodeId
(
qrcodeId
);
tag
.
setTagBookId
(
bookId
);
tag
.
setMasterId
(
masterId
);
addList
.
add
(
tag
);
}
advertisingGroupTagDao
.
insert
(
addList
);
}
});
}
/**
* 删除图书标记
*/
private
void
deleteBookTag
(
List
<
Long
>
bookIds
,
Long
masterId
)
{
if
(
ListUtils
.
isEmpty
(
bookIds
))
{
return
;
}
advertisingGroupTagDao
.
deleteByBook
(
bookIds
,
masterId
);
}
@Override
public
PageBeanNew
<
Book4AdvertisingMasterDTO
>
listPageBook4AdMaster
(
Integer
currentPage
,
Integer
numPerPage
,
String
name
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"name"
,
StringUtil
.
isEmpty
(
name
)
?
null
:
name
);
PageBeanNew
<
Book4AdvertisingMasterDTO
>
pageBeanNew
=
bookGroupDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listPageBook4AdMaster"
);
if
(
null
==
pageBeanNew
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
}
for
(
Book4AdvertisingMasterDTO
dto
:
pageBeanNew
.
getRecordList
())
{
Map
<
String
,
Object
>
map
=
groupQrcodeDao
.
getGroupCountUserCountByBookId
(
dto
.
getBookId
());
Integer
groupCount
=
0
;
Integer
userNum
=
0
;
if
(!
MapUtils
.
isEmpty
(
map
))
{
groupCount
=
Integer
.
valueOf
(
map
.
get
(
"groupCount"
).
toString
());
userNum
=
Integer
.
valueOf
(
map
.
get
(
"userNum"
).
toString
());
}
dto
.
setGroupCount
(
groupCount
);
dto
.
setGroupUserNum
(
userNum
);
}
return
pageBeanNew
;
}
@Override
public
PageBeanNew
<
GroupMasterDTO
>
listPageGroupList4Master
(
Long
userId
,
Integer
currentPage
,
Integer
numPerPage
,
Map
<
String
,
Object
>
paramMap
)
{
Long
masterId
=
advertisingMasterDao
.
getIdByUserLoginId
(
userId
);
if
(
null
==
masterId
)
{
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"广告主不存在"
);
}
paramMap
.
put
(
"masterId"
,
masterId
);
PageBeanNew
<
GroupMasterDTO
>
pageBeanNew
=
groupQrcodeDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listPageGroupMaster"
);
if
(
null
==
pageBeanNew
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
}
List
<
GroupMasterDTO
>
groupMasterDTOS
=
pageBeanNew
.
getRecordList
();
setLabelName
(
groupMasterDTOS
);
return
pageBeanNew
;
}
/**
* 填充标签名称
* @param groupMasterDTOS
*/
private
void
setLabelName
(
List
<
GroupMasterDTO
>
groupMasterDTOS
)
{
List
<
Long
>
labelIds
=
new
ArrayList
<>();
List
<
Long
>
proLabels
=
groupMasterDTOS
.
stream
().
filter
(
s
->
s
.
getProLabelId
()
!=
null
).
map
(
GroupMasterDTO:
:
getProLabelId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
depLabels
=
groupMasterDTOS
.
stream
().
filter
(
s
->
s
.
getDepLabelId
()
!=
null
).
map
(
GroupMasterDTO:
:
getDepLabelId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
purLabels
=
groupMasterDTOS
.
stream
().
filter
(
s
->
s
.
getPurLabelId
()
!=
null
).
map
(
GroupMasterDTO:
:
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
);
}
Map
<
Long
,
String
>
labelMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
labelIds
))
{
labelMap
=
labelConsr
.
getLabelName
(
labelIds
);
}
for
(
GroupMasterDTO
groupMasterDTO
:
groupMasterDTOS
)
{
//标签名称
if
(!
MapUtils
.
isEmpty
(
labelMap
))
{
if
(
null
!=
groupMasterDTO
.
getProLabelId
()
&&
labelMap
.
containsKey
(
groupMasterDTO
.
getProLabelId
()))
{
groupMasterDTO
.
setProLabelName
(
labelMap
.
get
(
groupMasterDTO
.
getProLabelId
()));
}
if
(
null
!=
groupMasterDTO
.
getDepLabelId
()
&&
labelMap
.
containsKey
(
groupMasterDTO
.
getDepLabelId
()))
{
groupMasterDTO
.
setDepLabelName
(
labelMap
.
get
(
groupMasterDTO
.
getDepLabelId
()));
}
if
(
null
!=
groupMasterDTO
.
getPurLabelId
()
&&
labelMap
.
containsKey
(
groupMasterDTO
.
getPurLabelId
()))
{
groupMasterDTO
.
setPurLabelName
(
labelMap
.
get
(
groupMasterDTO
.
getPurLabelId
()));
}
}
}
}
@Override
public
void
exportGroupMaster
(
String
name
,
Long
proLabelId
,
Long
depLabelId
,
Long
purLabelId
,
Long
masterId
,
Long
partyId
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"name"
,
StringUtil
.
isEmpty
(
name
)
?
null
:
name
);
paramMap
.
put
(
"proLabelId"
,
proLabelId
);
paramMap
.
put
(
"depLabelId"
,
depLabelId
);
paramMap
.
put
(
"purLabelId"
,
purLabelId
);
paramMap
.
put
(
"masterId"
,
masterId
);
List
<
GroupMasterDTO
>
list
=
groupQrcodeDao
.
listPageGroupMaster
(
paramMap
);
if
(
ListUtils
.
isEmpty
(
list
))
{
return
;
}
EXECUTOR_SINGLE_SERVICE
.
execute
(()
->
{
String
fileName
=
"微信群导出_"
+
DateUtils
.
getShortDateStr
();
Boolean
isSuccess
=
true
;
String
fileUrl
=
""
;
try
{
setGroupInfo
(
list
);
fileUrl
=
exportGroupMastefile
(
list
,
fileName
);
}
catch
(
Exception
e
)
{
log
.
error
(
"生成导出文件失败"
+
e
.
getMessage
(),
e
);
isSuccess
=
false
;
}
// 发送消息
if
(
isSuccess
)
{
sendNotify
(
partyId
,
fileUrl
,
fileName
);
}
});
}
@Override
public
void
exportGroupList4Master
(
Long
partyId
,
Map
<
String
,
Object
>
paramMap
,
Long
userId
)
{
Long
masterId
=
advertisingMasterDao
.
getIdByUserLoginId
(
userId
);
if
(
null
==
masterId
)
{
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"广告主不存在"
);
}
paramMap
.
put
(
"masterId"
,
masterId
);
List
<
GroupMasterDTO
>
list
=
groupQrcodeDao
.
listPageGroupMaster
(
paramMap
);
if
(
ListUtils
.
isEmpty
(
list
))
{
return
;
}
EXECUTOR_SINGLE_SERVICE
.
execute
(()
->
{
String
fileName
=
"微信群导出_"
+
DateUtils
.
getShortDateStr
();
Boolean
isSuccess
=
true
;
String
fileUrl
=
""
;
try
{
setLabelName
(
list
);
fileUrl
=
exportGroupList4Master
(
list
,
fileName
);
}
catch
(
Exception
e
)
{
log
.
error
(
"生成导出文件失败"
+
e
.
getMessage
(),
e
);
isSuccess
=
false
;
}
// 发送消息
if
(
isSuccess
)
{
sendNotify
(
partyId
,
fileUrl
,
fileName
);
}
});
}
/**
* 广告主分配微信群导出
*/
private
String
exportGroupMastefile
(
List
<
GroupMasterDTO
>
list
,
String
fileName
)
{
// 字段名
String
[]
rowsName
=
{
"序号"
,
"群名称"
,
"群分类名称"
,
"社群标签(专业)"
,
"社群标签(深度)"
,
"社群标签(目的)"
,
"社群书"
,
"所属出版社"
,
"创建编辑"
,
"近7天活跃度"
,
"当前群人数"
,
"广告位数量"
,
"群二维码"
,
"标签"
,
"群创建时间"
};
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
Object
[]
objs
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
GroupMasterDTO
dto
=
list
.
get
(
i
);
objs
=
new
Object
[
rowsName
.
length
];
objs
[
0
]
=
i
+
1
;
objs
[
1
]
=
dto
.
getGroupName
();
objs
[
2
]
=
dto
.
getClassify
();
objs
[
3
]
=
dto
.
getProLabelName
();
objs
[
4
]
=
dto
.
getDepLabelName
();
objs
[
5
]
=
dto
.
getPurLabelName
();
objs
[
6
]
=
dto
.
getBookName
();
objs
[
7
]
=
dto
.
getAgentName
();
objs
[
8
]
=
dto
.
getAdviserName
();
objs
[
9
]
=
dto
.
getActiveCount
()
==
null
?
0
:
dto
.
getActiveCount
();
objs
[
10
]
=
dto
.
getUserNumber
();
objs
[
11
]
=
dto
.
getAdvertisingSpaceNum
()
==
null
?
0
:
dto
.
getAdvertisingSpaceNum
();
String
qrcodeUrl
=
""
;
if
(!
StringUtil
.
isEmpty
(
dto
.
getQrcodeUrl
()))
{
qrcodeUrl
=
dto
.
getQrcodeUrl
().
replace
(
"oss.5rs.me"
,
"file.5rs.me"
);
}
objs
[
12
]
=
qrcodeUrl
;
String
masterName
=
""
;
List
<
AdvertisingMaster
>
masterList
=
dto
.
getMasterList
();
if
(!
ListUtils
.
isEmpty
(
masterList
))
{
for
(
AdvertisingMaster
master
:
masterList
)
{
if
(
StringUtil
.
isEmpty
(
masterName
))
{
masterName
=
master
.
getMasterName
();
}
else
{
masterName
=
masterName
+
"; "
+
master
.
getMasterName
();
}
}
}
objs
[
13
]
=
masterName
;
objs
[
14
]
=
DateUtils
.
formatDate
(
dto
.
getCreateTime
(),
DateUtils
.
DATE_FORMAT_DATEONLY
);
dataList
.
add
(
objs
);
}
return
exportConsr
.
exportExcel
(
fileName
,
rowsName
,
dataList
);
}
/**
* 广告主-微信群导出
*/
private
String
exportGroupList4Master
(
List
<
GroupMasterDTO
>
list
,
String
fileName
)
{
// 字段名
String
[]
rowsName
=
{
"序号"
,
"群名称"
,
"群分类名称"
,
"社群书"
,
"社群标签(专业)"
,
"社群标签(深度)"
,
"社群标签(目的)"
,
"当前群人数"
,
"群二维码"
,
"群创建时间"
,
"分配时间"
};
List
<
Object
[]>
dataList
=
new
ArrayList
<>();
Object
[]
objs
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
GroupMasterDTO
dto
=
list
.
get
(
i
);
objs
=
new
Object
[
rowsName
.
length
];
objs
[
0
]
=
i
+
1
;
objs
[
1
]
=
dto
.
getGroupName
();
objs
[
2
]
=
dto
.
getClassify
();
objs
[
3
]
=
dto
.
getBookName
();
objs
[
4
]
=
dto
.
getProLabelName
();
objs
[
5
]
=
dto
.
getDepLabelName
();
objs
[
6
]
=
dto
.
getPurLabelName
();
objs
[
7
]
=
dto
.
getUserNumber
();
String
qrcodeUrl
=
""
;
if
(!
StringUtil
.
isEmpty
(
dto
.
getQrcodeUrl
()))
{
qrcodeUrl
=
dto
.
getQrcodeUrl
().
replace
(
"oss.5rs.me"
,
"file.5rs.me"
);
}
objs
[
8
]
=
qrcodeUrl
;
objs
[
9
]
=
DateUtils
.
formatDate
(
dto
.
getCreateTime
(),
DateUtils
.
DATE_FORMAT_DATEONLY
);
objs
[
10
]
=
DateUtils
.
formatDate
(
dto
.
getTagTime
(),
DateUtils
.
DATE_FORMAT_DATEONLY
);
dataList
.
add
(
objs
);
}
return
exportConsr
.
exportExcel
(
fileName
,
rowsName
,
dataList
);
}
/**
* 发送站内信
*/
private
void
sendNotify
(
Long
partyId
,
String
fileUrl
,
String
fileName
)
{
JSONObject
content
=
new
JSONObject
();
content
.
put
(
"commitTime"
,
DateUtils
.
formatDate
(
new
Date
()));
content
.
put
(
"type"
,
"微信群导出"
);
SendNotifyDto
sendNotifyDto
=
new
SendNotifyDto
();
sendNotifyDto
.
setCreatedTime
(
new
Date
());
sendNotifyDto
.
setFromId
(
partyId
);
sendNotifyDto
.
setToId
(
partyId
);
sendNotifyDto
.
setNotifyContent
(
content
.
toJSONString
());
sendNotifyDto
.
setSystemCode
(
SystemCode
.
pcloud
.
code
);
sendNotifyDto
.
setTypeCode
(
"wechat_learn_export"
);
sendNotifyDto
.
setResourceId
(
fileUrl
);
sendNotifyDto
.
setFileName
(
fileName
);
sendNotifyDto
.
setOriginType
(
NotifyOriginTypeEnum
.
BOOK_GROUP
.
value
);
try
{
messageBiz
.
sendLetter
(
sendNotifyDto
);
}
catch
(
Exception
e
)
{
log
.
error
(
"【站内信(消)】发送站内信.[sendLetter]:"
+
e
.
getMessage
(),
e
);
}
}
@Override
public
List
<
String
>
getTagWxGroupIdsByUserId
(
Long
userId
)
{
Long
masterId
=
advertisingMasterDao
.
getIdByUserLoginId
(
userId
);
if
(
null
==
masterId
)
{
return
new
ArrayList
<>();
}
List
<
String
>
groupIds
=
advertisingGroupTagDao
.
getTagWxGroupIdsByMasterId
(
masterId
);
return
groupIds
;
}
@Override
public
PageBeanNew
<
GroupMasterDTO
>
listPageGroupBaseInfo4Master
(
Integer
currentPage
,
Integer
numPerPage
,
String
name
,
Long
userId
)
{
Long
masterId
=
advertisingMasterDao
.
getIdByUserLoginId
(
userId
);
if
(
null
==
masterId
)
{
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"广告主不存在"
);
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"query"
,
name
);
paramMap
.
put
(
"masterId"
,
masterId
);
PageBeanNew
<
GroupMasterDTO
>
pageBeanNew
=
groupQrcodeDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listPageGroupMaster"
);
if
(
null
==
pageBeanNew
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
}
return
pageBeanNew
;
}
@Override
public
void
updateMasterLoginId
(
Long
masterId
,
Long
loginId
)
{
advertisingMasterDao
.
updateMasterLoginId
(
masterId
,
loginId
);
}
@Override
public
List
<
Long
>
getTagBookIds4AdMatser
(
Long
masterId
)
{
List
<
Long
>
bookIds
=
advertisingGroupTagDao
.
getBookIdsByMasterId
(
masterId
);
return
bookIds
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/AdvertisingGroupTagDao.java
0 → 100644
View file @
47f5ea56
package
com
.
pcloud
.
book
.
advertising
.
dao
;
import
com.pcloud.book.advertising.entity.AdvertisingGroupTag
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* @描述:群标记广告主
* @作者:zhuyajie
* @创建时间:14:52 2019/8/21
* @版本:1.0
*/
public
interface
AdvertisingGroupTagDao
extends
BaseDao
<
AdvertisingGroupTag
>
{
/**
* 根据广告主删除
* @param masterId
*/
public
void
deleteByMasterId
(
Long
masterId
);
/**
* 已标记的书
* @param masterId
* @return
*/
public
List
<
Long
>
getBookIdsByMasterId
(
Long
masterId
);
/**
* 根据群删除标记
* @param groupQrcodeId
*/
public
void
deleteByGroupQrcodeId
(
Long
groupQrcodeId
);
/**
* 已标记的群
* @param masterId
* @return
*/
public
List
<
Long
>
getGroupQrcodeIdsByMasterId
(
Long
masterId
);
/**
* 根据图书删除标记
* @param bookIds
* @param masterId
*/
void
deleteByBook
(
List
<
Long
>
bookIds
,
Long
masterId
);
/**
* 查已标记的微信群id
* @param masterId
* @return
*/
List
<
String
>
getTagWxGroupIdsByMasterId
(
Long
masterId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/AdvertisingMasterDao.java
View file @
47f5ea56
package
com
.
pcloud
.
book
.
advertising
.
dao
;
import
java.util.List
;
import
com.pcloud.book.advertising.dto.AdvertisingMasterDTO
;
import
com.pcloud.book.advertising.entity.AdvertisingMaster
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* Description 广告主数据访问层接口
* Created by PENG on 2019/4/26.
...
...
@@ -23,4 +24,31 @@ public interface AdvertisingMasterDao extends BaseDao<AdvertisingMaster> {
* @return
*/
AdvertisingMasterDTO
getDTOById
(
Long
masterId
);
/**
* 查微信群标记的广告主
* @param groupQrcodeId
* @return
*/
List
<
AdvertisingMaster
>
getByGroup
(
Long
groupQrcodeId
);
/**
* 获取品牌方广告主
* @return
*/
List
<
AdvertisingMasterDTO
>
getBrandMaster
();
/**
* 根据登录id查广告主id
* @param loginId
* @return
*/
public
Long
getIdByUserLoginId
(
Long
loginId
);
/**
* 修改广告主登录id
* @param masterId
* @param loginId
*/
public
void
updateMasterLoginId
(
Long
masterId
,
Long
loginId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/impl/AdvertisingGroupTagDaoImpl.java
0 → 100644
View file @
47f5ea56
package
com
.
pcloud
.
book
.
advertising
.
dao
.
impl
;
import
com.pcloud.book.advertising.dao.AdvertisingGroupTagDao
;
import
com.pcloud.book.advertising.entity.AdvertisingGroupTag
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @描述:群标记广告主
* @作者:zhuyajie
* @创建时间:14:53 2019/8/21
* @版本:1.0
*/
@Component
(
"advertisingGroupTagDao"
)
public
class
AdvertisingGroupTagDaoImpl
extends
BaseDaoImpl
<
AdvertisingGroupTag
>
implements
AdvertisingGroupTagDao
{
@Override
public
void
deleteByMasterId
(
Long
masterId
)
{
getSessionTemplate
().
delete
(
getStatement
(
"deleteByMasterId"
),
masterId
);
}
@Override
public
List
<
Long
>
getBookIdsByMasterId
(
Long
masterId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getBookIdsByMasterId"
),
masterId
);
}
@Override
public
void
deleteByGroupQrcodeId
(
Long
groupQrcodeId
)
{
getSessionTemplate
().
delete
(
getStatement
(
"deleteByGroupQrcodeId"
),
groupQrcodeId
);
}
@Override
public
List
<
Long
>
getGroupQrcodeIdsByMasterId
(
Long
masterId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getGroupQrcodeIdsByMasterId"
),
masterId
);
}
@Override
public
void
deleteByBook
(
List
<
Long
>
bookIds
,
Long
masterId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"bookIds"
,
bookIds
);
map
.
put
(
"masterId"
,
masterId
);
getSessionTemplate
().
delete
(
getStatement
(
"deleteByBook"
),
map
);
}
@Override
public
List
<
String
>
getTagWxGroupIdsByMasterId
(
Long
masterId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getTagWxGroupIdsByMasterId"
),
masterId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/impl/AdvertisingMasterDaoImpl.java
View file @
47f5ea56
package
com
.
pcloud
.
book
.
advertising
.
dao
.
impl
;
import
java.util.List
;
import
org.springframework.stereotype.Repository
;
import
com.pcloud.book.advertising.dao.AdvertisingMasterDao
;
import
com.pcloud.book.advertising.dto.AdvertisingMasterDTO
;
import
com.pcloud.book.advertising.entity.AdvertisingMaster
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* Description 广告主数据访问层接口实现类
* Created by PENG on 2019/4/26.
...
...
@@ -29,4 +33,27 @@ public class AdvertisingMasterDaoImpl extends BaseDaoImpl<AdvertisingMaster> imp
public
AdvertisingMasterDTO
getDTOById
(
Long
masterId
)
{
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getDTOById"
),
masterId
);
}
@Override
public
List
<
AdvertisingMaster
>
getByGroup
(
Long
groupQrcodeId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getByGroup"
),
groupQrcodeId
);
}
@Override
public
List
<
AdvertisingMasterDTO
>
getBrandMaster
()
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getBrandMaster"
));
}
@Override
public
Long
getIdByUserLoginId
(
Long
loginId
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getIdByUserLoginId"
),
loginId
);
}
@Override
public
void
updateMasterLoginId
(
Long
masterId
,
Long
loginId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"masterId"
,
masterId
);
map
.
put
(
"loginId"
,
loginId
);
getSessionTemplate
().
update
(
getStatement
(
"updateMasterLoginId"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dto/AdvertisingMasterDTO.java
View file @
47f5ea56
...
...
@@ -84,6 +84,18 @@ public class AdvertisingMasterDTO extends BaseDto {
*/
private
BigDecimal
pilotFinishRate
;
/**
* 登录账号id
*/
private
Long
loginId
;
/**
* 登录名
*/
private
String
loginName
;
/**
* 登录密码
*/
private
String
password
;
public
Long
getId
()
{
return
id
;
...
...
@@ -207,6 +219,30 @@ public class AdvertisingMasterDTO extends BaseDto {
this
.
pilotFinishRate
=
pilotFinishRate
;
}
public
Long
getLoginId
()
{
return
loginId
;
}
public
void
setLoginId
(
Long
loginId
)
{
this
.
loginId
=
loginId
;
}
public
String
getLoginName
()
{
return
loginName
;
}
public
void
setLoginName
(
String
loginName
)
{
this
.
loginName
=
loginName
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
@Override
public
String
toString
()
{
return
"AdvertisingMasterDTO{"
+
...
...
@@ -225,6 +261,9 @@ public class AdvertisingMasterDTO extends BaseDto {
", clickUserNum="
+
clickUserNum
+
", pilotFinishUserNum="
+
pilotFinishUserNum
+
", pilotFinishRate="
+
pilotFinishRate
+
", loginId="
+
loginId
+
", loginName='"
+
loginName
+
'\''
+
", password='"
+
password
+
'\''
+
'}'
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dto/Book4AdvertisingMasterDTO.java
0 → 100644
View file @
47f5ea56
package
com
.
pcloud
.
book
.
advertising
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.dto.BaseDto
;
import
java.util.Date
;
/**
* @描述:广告主标记书刊列表
* @作者:zhuyajie
* @创建时间:11:51 2019/8/22
* @版本:1.0
*/
public
class
Book4AdvertisingMasterDTO
extends
BaseDto
{
/**
* 书籍标识
*/
private
Long
bookId
;
/**
* 书籍ISBN码
*/
private
String
isbn
;
/**
* 书籍名称
*/
private
String
bookName
;
/**
* 创建日期
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
/**
* 微信群数量
*/
private
Integer
groupCount
;
/**
* 群总人数
*/
private
Integer
groupUserNum
;
public
Long
getBookId
()
{
return
bookId
;
}
public
void
setBookId
(
Long
bookId
)
{
this
.
bookId
=
bookId
;
}
public
String
getIsbn
()
{
return
isbn
;
}
public
void
setIsbn
(
String
isbn
)
{
this
.
isbn
=
isbn
;
}
public
String
getBookName
()
{
return
bookName
;
}
public
void
setBookName
(
String
bookName
)
{
this
.
bookName
=
bookName
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Integer
getGroupCount
()
{
return
groupCount
;
}
public
void
setGroupCount
(
Integer
groupCount
)
{
this
.
groupCount
=
groupCount
;
}
public
Integer
getGroupUserNum
()
{
return
groupUserNum
;
}
public
void
setGroupUserNum
(
Integer
groupUserNum
)
{
this
.
groupUserNum
=
groupUserNum
;
}
@Override
public
String
toString
()
{
return
"Book4AdvertisingMasterDTO{"
+
"bookId="
+
bookId
+
", isbn='"
+
isbn
+
'\''
+
", bookName='"
+
bookName
+
'\''
+
", createTime="
+
createTime
+
", groupCount="
+
groupCount
+
", groupUserNum="
+
groupUserNum
+
'}'
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dto/GroupMasterAddDTO.java
0 → 100644
View file @
47f5ea56
package
com
.
pcloud
.
book
.
advertising
.
dto
;
import
com.pcloud.common.dto.BaseDto
;
import
java.util.List
;
/**
* @描述:微信群标记广告主
* @作者:zhuyajie
* @创建时间:17:19 2019/8/21
* @版本:1.0
*/
public
class
GroupMasterAddDTO
extends
BaseDto
{
//按微信群标记
/**
* 微信群二维码id
*/
private
List
<
Long
>
groupQrcodeIdList
;
/**
* 广告主id列表
*/
private
List
<
Long
>
masterIdList
;
//按图书标记
/**
* 广告主id
*/
private
Long
masterId
;
/**
* 图书id列表
*/
private
List
<
Long
>
bookIdList
;
public
List
<
Long
>
getGroupQrcodeIdList
()
{
return
groupQrcodeIdList
;
}
public
void
setGroupQrcodeIdList
(
List
<
Long
>
groupQrcodeIdList
)
{
this
.
groupQrcodeIdList
=
groupQrcodeIdList
;
}
public
List
<
Long
>
getMasterIdList
()
{
return
masterIdList
;
}
public
void
setMasterIdList
(
List
<
Long
>
masterIdList
)
{
this
.
masterIdList
=
masterIdList
;
}
public
Long
getMasterId
()
{
return
masterId
;
}
public
void
setMasterId
(
Long
masterId
)
{
this
.
masterId
=
masterId
;
}
public
List
<
Long
>
getBookIdList
()
{
return
bookIdList
;
}
public
void
setBookIdList
(
List
<
Long
>
bookIdList
)
{
this
.
bookIdList
=
bookIdList
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dto/GroupMasterDTO.java
0 → 100644
View file @
47f5ea56
package
com
.
pcloud
.
book
.
advertising
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.book.advertising.entity.AdvertisingMaster
;
import
com.pcloud.common.dto.BaseDto
;
import
java.util.Date
;
import
java.util.List
;
/**
* @描述:群广告主标记列表
* @作者:zhuyajie
* @创建时间:15:00 2019/8/21
* @版本:1.0
*/
public
class
GroupMasterDTO
extends
BaseDto
{
/**
* 微信群id
*/
private
String
wxGroupId
;
/**
* 群二维码id
*/
private
Long
groupQrcodeId
;
/**
* 微信群名称
*/
private
String
groupName
;
/**
* 图书名称
*/
private
String
bookName
;
/**
* 群分类名称
*/
private
String
classify
;
/**
* 专业标签ID
*/
private
Long
proLabelId
;
/**
* 专业标签名称
*/
private
String
proLabelName
;
/**
* 深度标签ID
*/
private
Long
depLabelId
;
/**
* 深度标签名称
*/
private
String
depLabelName
;
/**
* 目的标签ID
*/
private
Long
purLabelId
;
/**
* 目的标签名称
*/
private
String
purLabelName
;
/**
* 出版社名称
*/
private
String
agentName
;
/**
* 编辑id
*/
private
Long
adviserId
;
/**
* 编辑名称
*/
private
String
adviserName
;
/**
* 活跃度
*/
private
Integer
activeCount
;
/**
* 当前群人数
*/
private
Integer
userNumber
;
/**
* 广告位数量
*/
private
Integer
advertisingSpaceNum
;
/**
* 群二维码url
*/
private
String
qrcodeUrl
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
/**
* 标记的广告主列表
*/
List
<
AdvertisingMaster
>
masterList
;
/**
* 标记时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
tagTime
;
/**
* isbn
*/
private
String
isbn
;
public
String
getWxGroupId
()
{
return
wxGroupId
;
}
public
void
setWxGroupId
(
String
wxGroupId
)
{
this
.
wxGroupId
=
wxGroupId
;
}
public
Long
getGroupQrcodeId
()
{
return
groupQrcodeId
;
}
public
void
setGroupQrcodeId
(
Long
groupQrcodeId
)
{
this
.
groupQrcodeId
=
groupQrcodeId
;
}
public
String
getGroupName
()
{
return
groupName
;
}
public
void
setGroupName
(
String
groupName
)
{
this
.
groupName
=
groupName
;
}
public
String
getBookName
()
{
return
bookName
;
}
public
void
setBookName
(
String
bookName
)
{
this
.
bookName
=
bookName
;
}
public
String
getClassify
()
{
return
classify
;
}
public
void
setClassify
(
String
classify
)
{
this
.
classify
=
classify
;
}
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
;
}
public
String
getAgentName
()
{
return
agentName
;
}
public
void
setAgentName
(
String
agentName
)
{
this
.
agentName
=
agentName
;
}
public
Long
getAdviserId
()
{
return
adviserId
;
}
public
void
setAdviserId
(
Long
adviserId
)
{
this
.
adviserId
=
adviserId
;
}
public
String
getAdviserName
()
{
return
adviserName
;
}
public
void
setAdviserName
(
String
adviserName
)
{
this
.
adviserName
=
adviserName
;
}
public
Integer
getActiveCount
()
{
return
activeCount
;
}
public
void
setActiveCount
(
Integer
activeCount
)
{
this
.
activeCount
=
activeCount
;
}
public
Integer
getUserNumber
()
{
return
userNumber
;
}
public
void
setUserNumber
(
Integer
userNumber
)
{
this
.
userNumber
=
userNumber
;
}
public
Integer
getAdvertisingSpaceNum
()
{
return
advertisingSpaceNum
;
}
public
void
setAdvertisingSpaceNum
(
Integer
advertisingSpaceNum
)
{
this
.
advertisingSpaceNum
=
advertisingSpaceNum
;
}
public
String
getQrcodeUrl
()
{
return
qrcodeUrl
;
}
public
void
setQrcodeUrl
(
String
qrcodeUrl
)
{
this
.
qrcodeUrl
=
qrcodeUrl
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
List
<
AdvertisingMaster
>
getMasterList
()
{
return
masterList
;
}
public
void
setMasterList
(
List
<
AdvertisingMaster
>
masterList
)
{
this
.
masterList
=
masterList
;
}
public
Date
getTagTime
()
{
return
tagTime
;
}
public
void
setTagTime
(
Date
tagTime
)
{
this
.
tagTime
=
tagTime
;
}
public
String
getIsbn
()
{
return
isbn
;
}
public
void
setIsbn
(
String
isbn
)
{
this
.
isbn
=
isbn
;
}
@Override
public
String
toString
()
{
return
"GroupMasterDTO{"
+
"wxGroupId='"
+
wxGroupId
+
'\''
+
", groupQrcodeId="
+
groupQrcodeId
+
", groupName='"
+
groupName
+
'\''
+
", bookName='"
+
bookName
+
'\''
+
", classify='"
+
classify
+
'\''
+
", proLabelId="
+
proLabelId
+
", proLabelName='"
+
proLabelName
+
'\''
+
", depLabelId="
+
depLabelId
+
", depLabelName='"
+
depLabelName
+
'\''
+
", purLabelId="
+
purLabelId
+
", purLabelName='"
+
purLabelName
+
'\''
+
", agentName='"
+
agentName
+
'\''
+
", adviserId="
+
adviserId
+
", adviserName='"
+
adviserName
+
'\''
+
", activeCount="
+
activeCount
+
", userNumber="
+
userNumber
+
", advertisingSpaceNum="
+
advertisingSpaceNum
+
", qrcodeUrl='"
+
qrcodeUrl
+
'\''
+
", createTime="
+
createTime
+
", masterList="
+
masterList
+
", tagTime="
+
tagTime
+
", isbn='"
+
isbn
+
'\''
+
'}'
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/entity/AdvertisingGroupTag.java
0 → 100644
View file @
47f5ea56
package
com
.
pcloud
.
book
.
advertising
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.entity.BaseEntity
;
import
java.util.Date
;
/**
* 群标记广告主
*/
public
class
AdvertisingGroupTag
extends
BaseEntity
{
/**
* 被标记的图书id
*/
private
Long
tagBookId
;
/**
* 群二维码id
*/
private
Long
groupQrcodeId
;
/**
* 广告主id
*/
private
Long
masterId
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
public
Long
getTagBookId
()
{
return
tagBookId
;
}
public
void
setTagBookId
(
Long
tagBookId
)
{
this
.
tagBookId
=
tagBookId
;
}
public
Long
getGroupQrcodeId
()
{
return
groupQrcodeId
;
}
public
void
setGroupQrcodeId
(
Long
groupQrcodeId
)
{
this
.
groupQrcodeId
=
groupQrcodeId
;
}
public
Long
getMasterId
()
{
return
masterId
;
}
public
void
setMasterId
(
Long
masterId
)
{
this
.
masterId
=
masterId
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
@Override
public
String
toString
()
{
return
"AdvertisingGroupTag{"
+
"tagBookId="
+
tagBookId
+
", groupQrcodeId="
+
groupQrcodeId
+
", masterId="
+
masterId
+
", createTime="
+
createTime
+
'}'
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/entity/AdvertisingMaster.java
View file @
47f5ea56
...
...
@@ -33,6 +33,19 @@ public class AdvertisingMaster extends BaseEntity {
*/
private
List
<
AdvertisingSettlementMethod
>
settlementMethodList
;
/**
* 登录名
*/
private
String
loginName
;
/**
* 登录密码
*/
private
String
password
;
/**
* 登录账号id
*/
private
Long
loginId
;
@Override
public
Long
getId
()
{
return
id
;
...
...
@@ -79,6 +92,30 @@ public class AdvertisingMaster extends BaseEntity {
this
.
settlementMethodList
=
settlementMethodList
;
}
public
String
getLoginName
()
{
return
loginName
;
}
public
void
setLoginName
(
String
loginName
)
{
this
.
loginName
=
loginName
;
}
public
Long
getLoginId
()
{
return
loginId
;
}
public
void
setLoginId
(
Long
loginId
)
{
this
.
loginId
=
loginId
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
@Override
public
String
toString
()
{
return
"AdvertisingMaster{"
+
...
...
@@ -87,6 +124,10 @@ public class AdvertisingMaster extends BaseEntity {
", createTime="
+
createTime
+
", updateTime="
+
updateTime
+
", settlementMethodList="
+
settlementMethodList
+
"} "
+
super
.
toString
();
", loginName='"
+
loginName
+
'\''
+
", password='"
+
password
+
'\''
+
", loginId="
+
loginId
+
'}'
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/enums/SettlementMethodEnum.java
View file @
47f5ea56
...
...
@@ -9,7 +9,8 @@ public enum SettlementMethodEnum {
CPC
(
"CPC"
,
"按点击量"
),
CPM
(
"CPM"
,
"按曝光量"
),
CPA
(
"CPA"
,
"按实际行动"
),
CPS
(
"CPS"
,
"按实际销售"
);
CPS
(
"CPS"
,
"按实际销售"
),
Brand
(
"Brand"
,
"品牌方,线下结算"
);
public
final
String
code
;
...
...
@@ -32,7 +33,7 @@ public enum SettlementMethodEnum {
return
null
;
}
public
static
final
String
[]
SETTLEMENT_METHOD_GATHER
=
{
CPC
.
code
,
CPM
.
code
,
CPA
.
code
,
CPS
.
code
};
public
static
final
String
[]
SETTLEMENT_METHOD_GATHER
=
{
CPC
.
code
,
CPM
.
code
,
CPA
.
code
,
CPS
.
code
,
Brand
.
code
};
public
static
final
String
[]
SETTLEMENT_METHOD_NEED_PRICE_GATHER
=
{
CPC
.
code
,
CPM
.
code
,
CPA
.
code
};
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/facade/AdvertisingSpaceFacade.java
View file @
47f5ea56
package
com
.
pcloud
.
book
.
advertising
.
facade
;
import
com.pcloud.book.advertising.dto.AdvertisingSpaceDTO
;
import
com.pcloud.book.advertising.dto.Book4AdvertisingMasterDTO
;
import
com.pcloud.book.advertising.dto.GroupMasterAddDTO
;
import
com.pcloud.book.advertising.dto.GroupMasterDTO
;
import
com.pcloud.book.advertising.dto.TestParamDTO
;
import
com.pcloud.book.advertising.entity.*
;
import
com.pcloud.book.advertising.entity.AdvertisingAdviserPermission
;
import
com.pcloud.book.advertising.entity.AdvertisingAgentPermission
;
import
com.pcloud.book.advertising.entity.AdvertisingBrowseRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingClickRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingDistributionBook
;
import
com.pcloud.book.advertising.entity.AdvertisingExposureRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingMaster
;
import
com.pcloud.book.advertising.entity.AdvertisingPilotRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingPlan
;
import
com.pcloud.book.advertising.entity.AdvertisingSpace
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.permission.PermissionException
;
import
org.codehaus.jackson.JsonParseException
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -955,4 +977,191 @@ public interface AdvertisingSpaceFacade {
@RequestParam
(
value
=
"statisMonth"
,
required
=
false
)
String
statisMonth
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
,
@RequestParam
(
value
=
"adId"
,
required
=
false
)
Long
adId
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 微信群广告主标记列表
* @param token
* @param currentPage
* @param numPerPage
* @param name
* @param proLabelId
* @param depLabelId
* @param purLabelId
* @param masterId
* @return
* @throws PermissionException
*/
@ApiOperation
(
value
=
"微信群广告主标记列表"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
dataType
=
"integer"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页数量"
,
dataType
=
"integer"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"书籍名称"
,
dataType
=
"string"
,
required
=
false
,
paramType
=
"query"
),
@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"
),
@ApiImplicitParam
(
name
=
"masterId"
,
value
=
"广告主id"
,
dataType
=
"string"
,
required
=
false
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"listPageGroupMaster"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<
PageBeanNew
<
GroupMasterDTO
>>
listPageGroupMaster
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"proLabelId"
,
required
=
false
)
Long
proLabelId
,
@RequestParam
(
value
=
"depLabelId"
,
required
=
false
)
Long
depLabelId
,
@RequestParam
(
value
=
"purLabelId"
,
required
=
false
)
Long
purLabelId
,
@RequestParam
(
value
=
"masterId"
,
required
=
false
)
Long
masterId
)
throws
PermissionException
;
@ApiOperation
(
value
=
"获取品牌方广告主"
,
httpMethod
=
"GET"
)
@RequestMapping
(
value
=
"getBrandMaster"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
getBrandMaster
(
@RequestHeader
(
"token"
)
String
token
)
throws
PermissionException
,
BizException
,
JsonParseException
;
/**
* 微信群标记广告主
* @param token
* @param groupMasterAddDTO
* @return
* @throws PermissionException
*/
@ApiOperation
(
value
=
"微信群标记广告主"
,
httpMethod
=
"POST"
)
@PostMapping
(
"setGroupMaster"
)
public
ResponseDto
<?>
setGroupMaster
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@ApiParam
GroupMasterAddDTO
groupMasterAddDTO
)
throws
PermissionException
;
/**
* 广告主标记书刊列表
* @param token
* @param currentPage
* @param numPerPage
* @param name
* @return
* @throws PermissionException
*/
@ApiOperation
(
value
=
"广告主标记书刊列表"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
dataType
=
"integer"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页数量"
,
dataType
=
"integer"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"书籍名称"
,
dataType
=
"string"
,
required
=
false
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"listPageBook4AdMaster"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<
PageBeanNew
<
Book4AdvertisingMasterDTO
>>
listPageBook4AdMaster
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
)
throws
PermissionException
;
/**
* 品牌方广告主-微信群列表
* @param token
* @param currentPage
* @param numPerPage
* @param name
* @param proLabelId
* @param depLabelId
* @param purLabelId
* @param startTime
* @param endTime
* @return
* @throws PermissionException
*/
@ApiOperation
(
value
=
"品牌方广告主-微信群列表"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
dataType
=
"integer"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页数量"
,
dataType
=
"integer"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"书籍名称"
,
dataType
=
"string"
,
required
=
false
,
paramType
=
"query"
),
@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"
),
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"startTime"
,
dataType
=
"string"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"endTime"
,
dataType
=
"string"
,
required
=
false
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"listPageGroupList4Master"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<
PageBeanNew
<
GroupMasterDTO
>>
listPageGroupList4Master
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"proLabelId"
,
required
=
false
)
Long
proLabelId
,
@RequestParam
(
value
=
"depLabelId"
,
required
=
false
)
Long
depLabelId
,
@RequestParam
(
value
=
"purLabelId"
,
required
=
false
)
Long
purLabelId
,
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
String
startTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
String
endTime
)
throws
PermissionException
;
/**
* 导出-微信群广告主标记列表
* @param token
* @param name
* @param proLabelId
* @param depLabelId
* @param purLabelId
* @param masterId
* @return
* @throws PermissionException
*/
@ApiOperation
(
value
=
"导出-微信群广告主标记列表"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"name"
,
value
=
"书籍名称"
,
dataType
=
"string"
,
required
=
false
,
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"
),
@ApiImplicitParam
(
name
=
"masterId"
,
value
=
"广告主id"
,
dataType
=
"string"
,
required
=
false
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"exportGroupMaster"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
exportGroupMaster
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"proLabelId"
,
required
=
false
)
Long
proLabelId
,
@RequestParam
(
value
=
"depLabelId"
,
required
=
false
)
Long
depLabelId
,
@RequestParam
(
value
=
"purLabelId"
,
required
=
false
)
Long
purLabelId
,
@RequestParam
(
value
=
"masterId"
,
required
=
false
)
Long
masterId
)
throws
PermissionException
;
/**
* 品牌方广告主-微信群列表-导出
* @param token
* @param name
* @param proLabelId
* @param depLabelId
* @param purLabelId
* @param startTime
* @param endTime
* @return
* @throws PermissionException
*/
@ApiOperation
(
value
=
"品牌方广告主-微信群列表-导出"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"name"
,
value
=
"书籍名称"
,
dataType
=
"string"
,
required
=
false
,
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"
),
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"startTime"
,
dataType
=
"string"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"endTime"
,
dataType
=
"string"
,
required
=
false
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"exportGroupList4Master"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<
PageBeanNew
<
GroupMasterDTO
>>
exportGroupList4Master
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"proLabelId"
,
required
=
false
)
Long
proLabelId
,
@RequestParam
(
value
=
"depLabelId"
,
required
=
false
)
Long
depLabelId
,
@RequestParam
(
value
=
"purLabelId"
,
required
=
false
)
Long
purLabelId
,
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
String
startTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
String
endTime
)
throws
PermissionException
;
/**
* 品牌方广告主-微信群基本信息列表
* @param token
* @param currentPage
* @param numPerPage
* @param name
* @return
* @throws PermissionException
*/
@ApiOperation
(
value
=
"品牌方广告主-微信群基本信息列表"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
dataType
=
"integer"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页数量"
,
dataType
=
"integer"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"书籍名称"
,
dataType
=
"string"
,
required
=
false
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"listPageGroupBaseInfo4Master"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<
PageBeanNew
<
GroupMasterDTO
>>
listPageGroupBaseInfo4Master
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
)
throws
PermissionException
;
/**
* 广告主已标记的书刊id
* @param token
* @param masterId
* @return
* @throws PermissionException
*/
@ApiOperation
(
value
=
"广告主已标记的书刊id"
,
httpMethod
=
"GET"
)
@ApiImplicitParam
(
name
=
"masterId"
,
value
=
"广告主id"
,
dataType
=
"long"
,
paramType
=
"query"
)
@GetMapping
(
"getTagBookIds4AdMatser"
)
public
ResponseDto
<
List
<
Long
>>
getTagBookIds4AdMatser
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"masterId"
,
required
=
false
)
Long
masterId
)
throws
PermissionException
;
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/facade/impl/AdvertisingSpaceFacadeImpl.java
View file @
47f5ea56
package
com
.
pcloud
.
book
.
advertising
.
facade
.
impl
;
import
com.pcloud.book.advertising.biz.AdvertisingSpaceBiz
;
import
com.pcloud.book.advertising.biz.GroupMasterTagBiz
;
import
com.pcloud.book.advertising.dto.AdvertisingSpaceDTO
;
import
com.pcloud.book.advertising.dto.Book4AdvertisingMasterDTO
;
import
com.pcloud.book.advertising.dto.GroupMasterAddDTO
;
import
com.pcloud.book.advertising.dto.GroupMasterDTO
;
import
com.pcloud.book.advertising.dto.TestParamDTO
;
import
com.pcloud.book.advertising.entity.*
;
import
com.pcloud.book.advertising.entity.AdvertisingAdviserPermission
;
import
com.pcloud.book.advertising.entity.AdvertisingAgentPermission
;
import
com.pcloud.book.advertising.entity.AdvertisingBrowseRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingClickRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingDistributionBook
;
import
com.pcloud.book.advertising.entity.AdvertisingExposureRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingMaster
;
import
com.pcloud.book.advertising.entity.AdvertisingPilotRecord
;
import
com.pcloud.book.advertising.entity.AdvertisingPlan
;
import
com.pcloud.book.advertising.entity.AdvertisingSpace
;
import
com.pcloud.book.advertising.facade.AdvertisingSpaceFacade
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBean
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.wechatgroup.message.enums.IsSystem
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.codehaus.jackson.JsonParseException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.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.List
;
import
java.util.Map
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
/**
* Description 广告位接口层接口实现类
* @author PENG
...
...
@@ -36,6 +62,8 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
@Autowired
private
AdvertisingSpaceBiz
advertisingSpaceBiz
;
@Autowired
private
GroupMasterTagBiz
groupMasterTagBiz
;
/**
* 创建广告位
...
...
@@ -880,5 +908,178 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
return
new
ResponseDto
<>(
pageBean
);
}
/**
* 微信群广告主标记列表
*/
@Override
@RequestMapping
(
value
=
"listPageGroupMaster"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<
PageBeanNew
<
GroupMasterDTO
>>
listPageGroupMaster
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"proLabelId"
,
required
=
false
)
Long
proLabelId
,
@RequestParam
(
value
=
"depLabelId"
,
required
=
false
)
Long
depLabelId
,
@RequestParam
(
value
=
"purLabelId"
,
required
=
false
)
Long
purLabelId
,
@RequestParam
(
value
=
"masterId"
,
required
=
false
)
Long
masterId
)
throws
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"name"
,
StringUtil
.
isEmpty
(
name
)
?
null
:
name
);
paramMap
.
put
(
"proLabelId"
,
proLabelId
);
paramMap
.
put
(
"depLabelId"
,
depLabelId
);
paramMap
.
put
(
"purLabelId"
,
purLabelId
);
paramMap
.
put
(
"masterId"
,
masterId
);
PageBeanNew
<
GroupMasterDTO
>
pageBeanNew
=
groupMasterTagBiz
.
listPageGroupMaster
(
currentPage
,
numPerPage
,
paramMap
);
return
new
ResponseDto
<>(
pageBeanNew
);
}
/**
* 获取品牌方广告主
*/
@Override
@RequestMapping
(
value
=
"getBrandMaster"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
getBrandMaster
(
@RequestHeader
(
"token"
)
String
token
)
throws
PermissionException
,
BizException
,
JsonParseException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
return
new
ResponseDto
<>(
groupMasterTagBiz
.
getBrandMaster
());
}
/**
* 微信群标记广告主
*/
@Override
@PostMapping
(
"setGroupMaster"
)
public
ResponseDto
<?>
setGroupMaster
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@ApiParam
GroupMasterAddDTO
groupMasterAddDTO
)
throws
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
if
(
null
==
groupMasterAddDTO
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数缺失!"
);
}
if
(
ListUtils
.
isEmpty
(
groupMasterAddDTO
.
getGroupQrcodeIdList
())
&&
null
==
groupMasterAddDTO
.
getMasterId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少微信群或广告主id!"
);
}
groupMasterTagBiz
.
setGroupMaster
(
groupMasterAddDTO
);
return
new
ResponseDto
<>();
}
/**
* 广告主标记书刊列表
*/
@Override
@RequestMapping
(
value
=
"listPageBook4AdMaster"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<
PageBeanNew
<
Book4AdvertisingMasterDTO
>>
listPageBook4AdMaster
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
)
throws
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
PageBeanNew
<
Book4AdvertisingMasterDTO
>
pageBeanNew
=
groupMasterTagBiz
.
listPageBook4AdMaster
(
currentPage
,
numPerPage
,
name
);
return
new
ResponseDto
<>(
pageBeanNew
);
}
/**
* 品牌方广告主-微信群列表
*/
@RequestMapping
(
value
=
"listPageGroupList4Master"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<
PageBeanNew
<
GroupMasterDTO
>>
listPageGroupList4Master
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"proLabelId"
,
required
=
false
)
Long
proLabelId
,
@RequestParam
(
value
=
"depLabelId"
,
required
=
false
)
Long
depLabelId
,
@RequestParam
(
value
=
"purLabelId"
,
required
=
false
)
Long
purLabelId
,
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
String
startTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
String
endTime
)
throws
PermissionException
{
Long
userId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
USER_ID
);
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"name"
,
name
);
paramMap
.
put
(
"proLabelId"
,
proLabelId
);
paramMap
.
put
(
"depLabelId"
,
depLabelId
);
paramMap
.
put
(
"purLabelId"
,
purLabelId
);
paramMap
.
put
(
"startTime"
,
startTime
);
paramMap
.
put
(
"endTime"
,
endTime
);
PageBeanNew
<
GroupMasterDTO
>
pageBeanNew
=
groupMasterTagBiz
.
listPageGroupList4Master
(
userId
,
currentPage
,
numPerPage
,
paramMap
);
return
new
ResponseDto
<>(
pageBeanNew
);
}
/**
* 导出-微信群广告主标记列表
*/
@Override
@RequestMapping
(
value
=
"exportGroupMaster"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
exportGroupMaster
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"proLabelId"
,
required
=
false
)
Long
proLabelId
,
@RequestParam
(
value
=
"depLabelId"
,
required
=
false
)
Long
depLabelId
,
@RequestParam
(
value
=
"purLabelId"
,
required
=
false
)
Long
purLabelId
,
@RequestParam
(
value
=
"masterId"
,
required
=
false
)
Long
masterId
)
throws
PermissionException
{
Map
<
String
,
Object
>
map
=
SessionUtil
.
getToken4Redis
(
token
);
String
isSystem
=
(
String
)
map
.
get
(
SessionUtil
.
IS_SYSTEM
);
Long
partyId
=
(
Long
)
map
.
get
(
SessionUtil
.
PARTY_ID
);
if
(
IsSystem
.
NOT_SYSTEM
.
code
.
equals
(
isSystem
))
{
partyId
=
(
Long
)
map
.
get
(
SessionUtil
.
MEMBER_ID
);
}
groupMasterTagBiz
.
exportGroupMaster
(
name
,
proLabelId
,
depLabelId
,
purLabelId
,
masterId
,
partyId
);
return
new
ResponseDto
<>();
}
/**
* 品牌方广告主-微信群列表-导出
*/
@Override
@RequestMapping
(
value
=
"exportGroupList4Master"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<
PageBeanNew
<
GroupMasterDTO
>>
exportGroupList4Master
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"proLabelId"
,
required
=
false
)
Long
proLabelId
,
@RequestParam
(
value
=
"depLabelId"
,
required
=
false
)
Long
depLabelId
,
@RequestParam
(
value
=
"purLabelId"
,
required
=
false
)
Long
purLabelId
,
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
String
startTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
String
endTime
)
throws
PermissionException
{
Map
<
String
,
Object
>
map
=
SessionUtil
.
getToken4Redis
(
token
);
String
isSystem
=
(
String
)
map
.
get
(
SessionUtil
.
IS_SYSTEM
);
Long
partyId
=
(
Long
)
map
.
get
(
SessionUtil
.
PARTY_ID
);
if
(
IsSystem
.
NOT_SYSTEM
.
code
.
equals
(
isSystem
))
{
partyId
=
(
Long
)
map
.
get
(
SessionUtil
.
MEMBER_ID
);
}
Long
userId
=
(
Long
)
map
.
get
(
SessionUtil
.
USER_ID
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"name"
,
name
);
paramMap
.
put
(
"proLabelId"
,
proLabelId
);
paramMap
.
put
(
"depLabelId"
,
depLabelId
);
paramMap
.
put
(
"purLabelId"
,
purLabelId
);
paramMap
.
put
(
"startTime"
,
startTime
);
paramMap
.
put
(
"endTime"
,
endTime
);
groupMasterTagBiz
.
exportGroupList4Master
(
partyId
,
paramMap
,
userId
);
return
new
ResponseDto
<>();
}
/**
* 品牌方广告主-微信群基本信息列表
*/
@Override
@RequestMapping
(
value
=
"listPageGroupBaseInfo4Master"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<
PageBeanNew
<
GroupMasterDTO
>>
listPageGroupBaseInfo4Master
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
)
throws
PermissionException
{
Long
userId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
USER_ID
);
PageBeanNew
<
GroupMasterDTO
>
pageBeanNew
=
groupMasterTagBiz
.
listPageGroupBaseInfo4Master
(
currentPage
,
numPerPage
,
name
,
userId
);
return
new
ResponseDto
<>(
pageBeanNew
);
}
@ApiOperation
(
value
=
"更新广告主登录id,内部人员使用!!"
,
httpMethod
=
"GET"
)
@GetMapping
(
"updateMasterLoginId"
)
public
ResponseDto
<?>
updateMasterLoginId
(
@RequestParam
(
"masterId"
)
Long
masterId
,
@RequestParam
(
"loginId"
)
Long
loginId
)
{
groupMasterTagBiz
.
updateMasterLoginId
(
masterId
,
loginId
);
return
new
ResponseDto
<>();
}
/**
* 广告主已标记的书刊id
*/
@Override
@GetMapping
(
"getTagBookIds4AdMatser"
)
public
ResponseDto
<
List
<
Long
>>
getTagBookIds4AdMatser
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"masterId"
,
required
=
false
)
Long
masterId
)
throws
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
if
(
null
==
masterId
)
{
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"请选择广告主"
);
}
List
<
Long
>
bookIds
=
groupMasterTagBiz
.
getTagBookIds4AdMatser
(
masterId
);
return
new
ResponseDto
<>(
bookIds
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/service/impl/AdvertisingSpaceServiceImpl.java
View file @
47f5ea56
package
com
.
pcloud
.
book
.
advertising
.
service
.
impl
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
com.pcloud.book.advertising.biz.AdvertisingSpaceBiz
;
import
com.pcloud.book.advertising.biz.GroupMasterTagBiz
;
import
com.pcloud.book.advertising.service.AdvertisingSpaceService
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.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.List
;
import
java.util.Map
;
import
io.swagger.annotations.ApiOperation
;
/**
* Description 广告位内部接口实现类
* Created by PENG on 2019/5/6.
...
...
@@ -23,6 +37,8 @@ public class AdvertisingSpaceServiceImpl implements AdvertisingSpaceService {
@Autowired
private
AdvertisingSpaceBiz
advertisingSpaceBiz
;
@Autowired
private
GroupMasterTagBiz
groupMasterTagBiz
;
/**
* 每日凌晨计算昨日广告位收益
...
...
@@ -40,4 +56,12 @@ public class AdvertisingSpaceServiceImpl implements AdvertisingSpaceService {
LOGGER
.
info
(
"内部接口群发广告被调用"
+
map
.
toString
());
advertisingSpaceBiz
.
sendAdvertisingPlan
(
new
Long
(
map
.
get
(
"advertisingPutId"
).
toString
()));
}
@Override
@GetMapping
(
"getTagWxGroupIdsByUserId"
)
@ParamLog
(
"根据登录用户获取标记的微信群列表"
)
public
ResponseEntity
<
ResponseDto
<
List
<
String
>>>
getTagWxGroupIdsByUserId
(
@RequestParam
(
"userId"
)
Long
userId
)
{
List
<
String
>
list
=
groupMasterTagBiz
.
getTagWxGroupIdsByUserId
(
userId
);
return
ResponseHandleUtil
.
toResponse
(
list
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/user/PartyConsr.java
View file @
47f5ea56
...
...
@@ -3,26 +3,26 @@
*/
package
com
.
pcloud
.
book
.
consumer
.
user
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.usercenter.party.common.dto.PartyListDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.usercenter.party.agent.entity.Agent
;
import
com.pcloud.usercenter.party.common.service.PartyService
;
import
com.pcloud.usercenter.party.common.vo.PartyIdListVO
;
import
com.pcloud.usercenter.user.entity.UserLogin
;
import
com.pcloud.usercenter.user.service.UserLoginService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Component
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.usercenter.party.agent.entity.Agent
;
import
com.pcloud.usercenter.party.common.service.PartyService
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @描述:当事人中间类
...
...
@@ -76,4 +76,49 @@ public class PartyConsr {
PartyIdListVO
partyIdListVO
=
ResponseHandleUtil
.
parseResponse
(
partyIdList
,
PartyIdListVO
.
class
);
return
partyIdListVO
;
}
@ParamLog
(
"创建平台端登录账号"
)
public
Long
addLoginAccount
(
String
loginName
,
String
password
)
{
Long
loginId
=
null
;
try
{
//todo
loginId
=
000
l
;
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"【用户中心】创建平台端登录账号失败"
+
e
.
getMessage
(),
e
);
}
return
loginId
;
}
@ParamLog
(
"修改平台端登录账号"
)
public
void
updateLoginAccount
(
String
loginName
,
String
password
,
Long
loginId
)
{
try
{
//todo
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"【用户中心】修改平台端登录账号失败"
+
e
.
getMessage
(),
e
);
}
}
@ParamLog
(
"删除登录账号"
)
public
void
deleteLoginAccount
(
Long
loginId
)
{
try
{
//todo
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"【用户中心】删除平台端登录账号失败"
+
e
.
getMessage
(),
e
);
}
}
@ParamLog
(
"获取登录账号信息"
)
public
UserLogin
getUserLoginInfo
(
Long
loginId
)
{
UserLogin
userLogin
=
new
UserLogin
();
try
{
userLogin
=
ResponseHandleUtil
.
parseResponse
(
userLoginService
.
getUserLoginInfo
(
loginId
),
UserLogin
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"【用户中心】获取平台端登录账号失败"
+
e
.
getMessage
(),
e
);
}
return
userLogin
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
View file @
47f5ea56
...
...
@@ -325,6 +325,17 @@ public class WechatGroupConsr {
return
map
;
}
@ParamLog
(
"根据用户微信ID获取用户信息"
)
public
GroupUserDTO
getWxUserInfoByWxUserId
(
String
wxUserId
)
{
GroupUserDTO
dto
=
new
GroupUserDTO
();
try
{
dto
=
ResponseHandleUtil
.
parseResponse
(
groupMemberService
.
getWxUserInfoByWxId
(
wxUserId
),
GroupUserDTO
.
class
);
}
catch
(
Exception
e
)
{
log
.
error
(
"根据用户微信ID获取用户信息.[getWxUserInfoByWxId]:"
+
e
.
getMessage
(),
e
);
}
return
dto
;
}
@ParamLog
(
value
=
"获取可用机器人"
)
public
SelfRobotDTO
getAvailableRobot
(
Long
wechatUserId
,
Integer
largeTemplet
,
Long
classifyId
)
{
SelfRobotDTO
selfRobotDTO
=
null
;
...
...
@@ -335,15 +346,19 @@ public class WechatGroupConsr {
}
return
selfRobotDTO
;
}
@ParamLog
(
"根据用户微信ID获取用户信息"
)
public
GroupUserDTO
getWxUserInfoByWxUserId
(
String
wxUserId
)
{
GroupUserDTO
dto
=
new
GroupUserDTO
();
@ParamLog
(
value
=
"根据群id集合最近7天群活跃度"
)
public
Map
<
Long
,
Integer
>
get7DayActiveCountByQrcode
(
List
<
Long
>
qrcodeIds
)
{
Map
<
Long
,
Integer
>
map
=
new
HashMap
<>();
try
{
dto
=
ResponseHandleUtil
.
parseResponse
(
groupMemberService
.
getWxUserInfoByWxId
(
wxUserId
),
GroupUserDTO
.
class
);
map
=
ResponseHandleUtil
.
parseMapResponse
(
messageService
.
get7DayActiveCountByQrcode
(
qrcodeIds
),
Long
.
class
,
Integer
.
class
);
}
catch
(
Exception
e
)
{
log
.
error
(
"根据
用户微信ID获取用户信息.[getWxUserInfoByWxId
]:"
+
e
.
getMessage
(),
e
);
log
.
error
(
"根据
群id集合最近7天群活跃度.[get7DayActiveCountByQrcode
]:"
+
e
.
getMessage
(),
e
);
}
return
dto
;
if
(
map
==
null
)
{
return
new
HashMap
<>();
}
return
map
;
}
}
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingGroupTagMapper.xml
0 → 100644
View file @
47f5ea56
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.advertising.dao.impl.AdvertisingGroupTagDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.advertising.entity.AdvertisingGroupTag"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"tag_book_id"
property=
"tagBookId"
jdbcType=
"BIGINT"
/>
<result
column=
"group_qrcode_id"
property=
"groupQrcodeId"
jdbcType=
"BIGINT"
/>
<result
column=
"master_id"
property=
"masterId"
jdbcType=
"BIGINT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, tag_book_id, group_qrcode_id, master_id, create_time
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.advertising.entity.AdvertisingGroupTag"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into advertising_group_tag (tag_book_id, group_qrcode_id,
master_id, create_time)
values (#{tagBookId,jdbcType=BIGINT}, #{groupQrcodeId,jdbcType=BIGINT},
#{masterId,jdbcType=BIGINT},NOW())
</insert>
<delete
id=
"deleteByMasterId"
parameterType=
"long"
>
DELETE
FROM
advertising_group_tag
WHERE
master_id = #{masterId}
</delete>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.advertising.entity.AdvertisingGroupTag"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into advertising_group_tag (
tag_book_id,
group_qrcode_id,
master_id,
create_time
) values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(#{item.tagBookId,jdbcType=BIGINT},
#{item.groupQrcodeId,jdbcType=BIGINT},
#{item.masterId,jdbcType=BIGINT},
NOW())
</foreach>
</insert>
<select
id=
"getBookIdsByMasterId"
parameterType=
"long"
resultType=
"long"
>
SELECT DISTINCT
tag_book_id
FROM
advertising_group_tag
WHERE
master_id = #{masterId}
AND tag_book_id IS NOT NULL
AND group_qrcode_id = 0
</select>
<delete
id=
"deleteByGroupQrcodeId"
parameterType=
"long"
>
DELETE
FROM
advertising_group_tag
WHERE group_qrcode_id = #{groupQrcodeId}
</delete>
<select
id=
"getGroupQrcodeIdsByMasterId"
parameterType=
"long"
resultType=
"long"
>
SELECT DISTINCT
group_qrcode_id
FROM
advertising_group_tag
WHERE
master_id = #{masterId}
AND group_qrcode_id != 0
</select>
<delete
id=
"deleteByBook"
parameterType=
"map"
>
DELETE
FROM
advertising_group_tag
WHERE
master_id = #{masterId}
AND tag_book_id in
<foreach
collection=
"bookIds"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
</delete>
<select
id=
"getTagWxGroupIdsByMasterId"
parameterType=
"long"
resultType=
"string"
>
SELECT DISTINCT
q.weixin_group_id
FROM
book_group_qrcode q
LEFT JOIN advertising_group_tag t ON q.id = t.group_qrcode_id
WHERE
t.master_id = #{masterId}
AND q.weixin_group_id IS NOT NULL
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingMasterMapper.xml
View file @
47f5ea56
...
...
@@ -6,6 +6,7 @@
<result
column=
"master_name"
property=
"masterName"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"login_id"
property=
"loginId"
jdbcType=
"BIGINT"
/>
</resultMap>
<resultMap
id=
"AdvertisingMasterDTO"
type=
"com.pcloud.book.advertising.dto.AdvertisingMasterDTO"
>
...
...
@@ -13,10 +14,11 @@
<result
column=
"master_name"
property=
"masterName"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"login_id"
property=
"loginId"
jdbcType=
"BIGINT"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, master_name, create_time, update_time
id, master_name, create_time, update_time
, login_id
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
...
...
@@ -84,11 +86,13 @@
master_name,
create_time,
update_time,
login_id,
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{masterName,jdbcType=VARCHAR},
NOW(),
NOW(),
#{loginId},
</trim>
</insert>
...
...
@@ -98,8 +102,49 @@
<if
test=
"masterName != null"
>
master_name = #{masterName,jdbcType=VARCHAR},
</if>
update_time = NOW(),
update_time = NOW(),
login_id = #{loginId},
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select
id=
"getByGroup"
parameterType=
"long"
resultType=
"com.pcloud.book.advertising.entity.AdvertisingMaster"
>
SELECT
m.id id,
m.master_name masterName
FROM
advertising_master m
LEFT JOIN advertising_group_tag t ON m.id = t.master_id
WHERE
t.group_qrcode_id = #{groupQrcodeId}
</select>
<select
id=
"getBrandMaster"
resultType=
"com.pcloud.book.advertising.dto.AdvertisingMasterDTO"
>
SELECT
m.id id,
m.master_name masterName
FROM
advertising_master m
LEFT JOIN advertising_settlement_method s ON m.id = s.master_id
WHERE
s.settlement_method = 'Brand'
GROUP BY
m.id
</select>
<select
id=
"getIdByUserLoginId"
resultType=
"long"
parameterType=
"long"
>
SELECT
id
FROM
advertising_master
WHERE
login_id = #{loginId}
</select>
<update
id=
"updateMasterLoginId"
parameterType=
"map"
>
UPDATE advertising_master
SET login_id = #{loginId}
WHERE
id = #{masterId}
</update>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment