Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
rop-dj-pad
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit cae85b28
authored
Jun 22, 2026
by
chenxi
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
策略活动接口接口功能实现、sop营销策略接口功能实现
1 parent
725acf01
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
742 additions
and
0 deletions
src/main/java/cn/com/glsx/dj/pad/controller/strategy/CustomerSopController.java
src/main/java/cn/com/glsx/dj/pad/controller/strategy/MarketingActivityProductController.java
src/main/java/cn/com/glsx/dj/pad/request/strategy/CustomerSopTaskDetailRequest.java
src/main/java/cn/com/glsx/dj/pad/request/strategy/CustomerSopTaskPageRequest.java
src/main/java/cn/com/glsx/dj/pad/request/strategy/MarketingActivityProductRequest.java
src/main/java/cn/com/glsx/dj/pad/response/strategy/CarSeriesResponse.java
src/main/java/cn/com/glsx/dj/pad/response/strategy/CustomerSopTaskDetailResponse.java
src/main/java/cn/com/glsx/dj/pad/response/strategy/CustomerSopTaskPageResponse.java
src/main/java/cn/com/glsx/dj/pad/response/strategy/MarketingStageGroupResponse.java
src/main/java/cn/com/glsx/dj/pad/response/strategy/ProductResponse.java
src/main/java/cn/com/glsx/dj/pad/service/CustomerSopService.java
src/main/java/cn/com/glsx/dj/pad/service/MarketingActivityProductService.java
src/main/java/cn/com/glsx/dj/pad/controller/strategy/CustomerSopController.java
0 → 100644
View file @
cae85b2
package
cn
.
com
.
glsx
.
dj
.
pad
.
controller
.
strategy
;
import
cn.com.glsx.dj.pad.request.strategy.CustomerSopTaskDetailRequest
;
import
cn.com.glsx.dj.pad.request.strategy.CustomerSopTaskPageRequest
;
import
cn.com.glsx.dj.pad.response.strategy.CustomerSopTaskDetailResponse
;
import
cn.com.glsx.dj.pad.response.strategy.CustomerSopTaskPageResponse
;
import
cn.com.glsx.dj.pad.service.CustomerSopService
;
import
cn.com.glsx.dj.pad.util.CommonUtil
;
import
cn.com.glsx.framework.core.beans.rpc.RpcPagination
;
import
cn.com.glsx.framework.core.enums.DefaultErrorEnum
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
cn.com.glsx.framework.rop.response.RopResponse
;
import
com.rop.annotation.NeedInSessionType
;
import
com.rop.annotation.ServiceMethod
;
import
com.rop.annotation.ServiceMethodBean
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
java.util.List
;
@Slf4j
@Api
(
"SOP任务客户接口"
)
@RequiredArgsConstructor
@ServiceMethodBean
(
version
=
"1.0.0"
,
needInSession
=
NeedInSessionType
.
YES
)
public
class
CustomerSopController
{
private
final
CustomerSopService
customerSopService
;
@ApiOperation
(
"查询今日待执行触达客户"
)
@ServiceMethod
(
method
=
"dj.pad.api.today.sop.task.customer.page"
,
needInSession
=
NeedInSessionType
.
YES
)
public
RopResponse
<
RpcPagination
<
CustomerSopTaskPageResponse
>>
pageTodayPendingCustomers
(
CustomerSopTaskPageRequest
request
)
{
try
{
CommonUtil
.
getMerchantId
();
return
RopResponse
.
success
(
customerSopService
.
pageTodayPendingCustomers
(
request
));
}
catch
(
RpcServiceException
e
)
{
log
.
info
(
e
.
getMessage
(),
e
);
return
RopResponse
.
error
(
e
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
(),
e
);
return
RopResponse
.
result
(
DefaultErrorEnum
.
SERVICE_ERROR
);
}
}
@ApiOperation
(
"查询近7天已触达客户"
)
@ServiceMethod
(
method
=
"dj.pad.api.last.week.sop.task.customer.page"
,
needInSession
=
NeedInSessionType
.
YES
)
public
RopResponse
<
RpcPagination
<
CustomerSopTaskPageResponse
>>
pageLastWeekReachedCustomers
(
CustomerSopTaskPageRequest
request
)
{
try
{
return
RopResponse
.
success
(
customerSopService
.
pageLastWeekReachedCustomers
(
request
));
}
catch
(
RpcServiceException
e
)
{
log
.
info
(
e
.
getMessage
(),
e
);
return
RopResponse
.
error
(
e
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
(),
e
);
return
RopResponse
.
result
(
DefaultErrorEnum
.
SERVICE_ERROR
);
}
}
@ApiOperation
(
"查询客户今日未触达任务列表"
)
@ServiceMethod
(
method
=
"dj.pad.api.today.sop.task.detail.list"
,
needInSession
=
NeedInSessionType
.
YES
)
public
RopResponse
<
List
<
CustomerSopTaskDetailResponse
>>
listTodayPendingTaskDetails
(
CustomerSopTaskDetailRequest
request
)
{
try
{
return
RopResponse
.
success
(
customerSopService
.
listTodayPendingTaskDetails
(
request
));
}
catch
(
RpcServiceException
e
)
{
log
.
info
(
e
.
getMessage
(),
e
);
return
RopResponse
.
error
(
e
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
(),
e
);
return
RopResponse
.
result
(
DefaultErrorEnum
.
SERVICE_ERROR
);
}
}
@ApiOperation
(
"查询客户近7天推送任务记录列表"
)
@ServiceMethod
(
method
=
"dj.pad.api.last.week.sop.task.detail.list"
,
needInSession
=
NeedInSessionType
.
YES
)
public
RopResponse
<
List
<
CustomerSopTaskDetailResponse
>>
listLastWeekTaskRecords
(
CustomerSopTaskDetailRequest
request
)
{
try
{
return
RopResponse
.
success
(
customerSopService
.
listLastWeekTaskRecords
(
request
));
}
catch
(
RpcServiceException
e
)
{
log
.
info
(
e
.
getMessage
(),
e
);
return
RopResponse
.
error
(
e
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
(),
e
);
return
RopResponse
.
result
(
DefaultErrorEnum
.
SERVICE_ERROR
);
}
}
}
src/main/java/cn/com/glsx/dj/pad/controller/strategy/MarketingActivityProductController.java
0 → 100644
View file @
cae85b2
package
cn
.
com
.
glsx
.
dj
.
pad
.
controller
.
strategy
;
import
cn.com.glsx.dj.pad.request.strategy.MarketingActivityProductRequest
;
import
cn.com.glsx.dj.pad.response.strategy.MarketingStageGroupResponse
;
import
cn.com.glsx.dj.pad.service.MarketingActivityProductService
;
import
cn.com.glsx.framework.core.enums.DefaultErrorEnum
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
cn.com.glsx.framework.rop.response.RopResponse
;
import
com.rop.annotation.NeedInSessionType
;
import
com.rop.annotation.ServiceMethod
;
import
com.rop.annotation.ServiceMethodBean
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
java.util.List
;
@Slf4j
@Api
(
"营销活动商品接口"
)
@RequiredArgsConstructor
@ServiceMethodBean
(
version
=
"1.0.0"
,
needInSession
=
NeedInSessionType
.
YES
)
public
class
MarketingActivityProductController
{
private
final
MarketingActivityProductService
marketingActivityProductService
;
@ApiOperation
(
"查询当前进行中的营销活动商品列表"
)
@ServiceMethod
(
method
=
"dj.pad.api.active.marketing.activity.product.list"
,
needInSession
=
NeedInSessionType
.
YES
)
public
RopResponse
<
List
<
MarketingStageGroupResponse
>>
listActiveProducts
(
MarketingActivityProductRequest
request
)
{
try
{
return
RopResponse
.
success
(
marketingActivityProductService
.
listActiveProducts
(
request
));
}
catch
(
RpcServiceException
e
)
{
log
.
info
(
e
.
getMessage
(),
e
);
return
RopResponse
.
error
(
e
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
(),
e
);
return
RopResponse
.
result
(
DefaultErrorEnum
.
SERVICE_ERROR
);
}
}
}
src/main/java/cn/com/glsx/dj/pad/request/strategy/CustomerSopTaskDetailRequest.java
0 → 100644
View file @
cae85b2
package
cn
.
com
.
glsx
.
dj
.
pad
.
request
.
strategy
;
import
com.rop.AbstractRopRequest
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
"SOP任务客户明细查询请求"
)
public
class
CustomerSopTaskDetailRequest
extends
AbstractRopRequest
{
@ApiModelProperty
(
value
=
"4S店商户号"
,
required
=
true
)
private
Integer
merchantId
;
@ApiModelProperty
(
value
=
"客户ID"
,
required
=
true
)
private
Integer
customerInstanceId
;
}
src/main/java/cn/com/glsx/dj/pad/request/strategy/CustomerSopTaskPageRequest.java
0 → 100644
View file @
cae85b2
package
cn
.
com
.
glsx
.
dj
.
pad
.
request
.
strategy
;
import
com.rop.AbstractRopRequest
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
"SOP任务客户分页查询请求"
)
public
class
CustomerSopTaskPageRequest
extends
AbstractRopRequest
{
@ApiModelProperty
(
value
=
"当前页码"
,
required
=
true
)
private
Integer
pageNum
;
@ApiModelProperty
(
value
=
"每页数据条数"
,
required
=
true
)
private
Integer
pageSize
;
@ApiModelProperty
(
value
=
"4S店商户号"
,
required
=
true
)
private
Integer
merchantId
;
}
src/main/java/cn/com/glsx/dj/pad/request/strategy/MarketingActivityProductRequest.java
0 → 100644
View file @
cae85b2
package
cn
.
com
.
glsx
.
dj
.
pad
.
request
.
strategy
;
import
com.rop.AbstractRopRequest
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
"营销活动商品查询请求"
)
public
class
MarketingActivityProductRequest
extends
AbstractRopRequest
{
@ApiModelProperty
(
value
=
"4S店商户号"
,
required
=
true
)
private
Integer
merchantId
;
}
src/main/java/cn/com/glsx/dj/pad/response/strategy/CarSeriesResponse.java
0 → 100644
View file @
cae85b2
package
cn
.
com
.
glsx
.
dj
.
pad
.
response
.
strategy
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
@Data
@ApiModel
(
"车系响应"
)
public
class
CarSeriesResponse
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
name
=
"carSeriesId"
,
notes
=
"车系ID,通用车系为-1"
)
private
Integer
carSeriesId
;
@ApiModelProperty
(
name
=
"carSeriesName"
,
notes
=
"车系名称"
)
private
String
carSeriesName
;
@ApiModelProperty
(
name
=
"productList"
,
notes
=
"车系下商品/套餐列表"
)
private
List
<
ProductResponse
>
productList
;
}
src/main/java/cn/com/glsx/dj/pad/response/strategy/CustomerSopTaskDetailResponse.java
0 → 100644
View file @
cae85b2
package
cn
.
com
.
glsx
.
dj
.
pad
.
response
.
strategy
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
@ApiModel
(
"SOP任务明细响应"
)
public
class
CustomerSopTaskDetailResponse
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
name
=
"taskId"
,
notes
=
"任务ID"
)
private
Integer
taskId
;
@ApiModelProperty
(
name
=
"strategyId"
,
notes
=
"策略ID"
)
private
Integer
strategyId
;
@ApiModelProperty
(
name
=
"actionType"
,
notes
=
"任务动态类型,1=向客户群发送消息"
)
private
Integer
actionType
;
@ApiModelProperty
(
name
=
"messageType"
,
notes
=
"消息类型,1=文本 2=图片 3=视频 4=网页链接"
)
private
Integer
messageType
;
@ApiModelProperty
(
name
=
"messageContent"
,
notes
=
"消息内容"
)
private
String
messageContent
;
@ApiModelProperty
(
name
=
"taskStatus"
,
notes
=
"任务状态,0=待确认(不触发) 1=已触达 2=不触达(已拒绝) 3=推送失败"
)
private
Integer
taskStatus
;
@ApiModelProperty
(
name
=
"confirmBy"
,
notes
=
"操作人(任务确认人)"
)
private
String
confirmBy
;
@ApiModelProperty
(
name
=
"pushResult"
,
notes
=
"推送结果,2=成功 3=失败"
)
private
Integer
pushResult
;
}
src/main/java/cn/com/glsx/dj/pad/response/strategy/CustomerSopTaskPageResponse.java
0 → 100644
View file @
cae85b2
package
cn
.
com
.
glsx
.
dj
.
pad
.
response
.
strategy
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
@Data
@ApiModel
(
"SOP任务客户分页列表响应"
)
public
class
CustomerSopTaskPageResponse
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
name
=
"customerInstanceId"
,
notes
=
"客户ID"
)
private
Integer
customerInstanceId
;
@ApiModelProperty
(
name
=
"customerName"
,
notes
=
"客户姓名"
)
private
String
customerName
;
@ApiModelProperty
(
name
=
"customerPhone"
,
notes
=
"客户手机号"
)
private
String
customerPhone
;
@ApiModelProperty
(
name
=
"customerStatus"
,
notes
=
"客户状态"
)
private
String
customerStatus
;
@ApiModelProperty
(
name
=
"qwGroupName"
,
notes
=
"企微客户群名称"
)
private
String
qwGroupName
;
@ApiModelProperty
(
name
=
"carSeriesName"
,
notes
=
"车型名称"
)
private
String
carSeriesName
;
@ApiModelProperty
(
name
=
"orderHandleTime"
,
notes
=
"订单处理时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
orderHandleTime
;
@ApiModelProperty
(
name
=
"confirmBy"
,
notes
=
"跟进人"
)
private
String
confirmBy
;
@ApiModelProperty
(
name
=
"lastExecuteTime"
,
notes
=
"最近一次任务执行时间"
)
@JsonFormat
(
pattern
=
"MM-dd HH:mm"
,
timezone
=
"GMT+8"
)
private
Date
lastExecuteTime
;
@ApiModelProperty
(
name
=
"tagList"
,
notes
=
"客户标签名称列表"
)
private
List
<
String
>
tagList
;
}
src/main/java/cn/com/glsx/dj/pad/response/strategy/MarketingStageGroupResponse.java
0 → 100644
View file @
cae85b2
package
cn
.
com
.
glsx
.
dj
.
pad
.
response
.
strategy
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
@Data
@ApiModel
(
"营销阶段分组响应"
)
public
class
MarketingStageGroupResponse
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
name
=
"marketingStage"
,
notes
=
"活动类型,0=售前活动 1=售后活动"
)
private
Integer
marketingStage
;
@ApiModelProperty
(
name
=
"carSeriesList"
,
notes
=
"车系列表"
)
private
List
<
CarSeriesResponse
>
carSeriesList
;
}
src/main/java/cn/com/glsx/dj/pad/response/strategy/ProductResponse.java
0 → 100644
View file @
cae85b2
package
cn
.
com
.
glsx
.
dj
.
pad
.
response
.
strategy
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
@Data
@ApiModel
(
"营销活动商品响应"
)
public
class
ProductResponse
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
name
=
"productId"
,
notes
=
"商品套餐主键ID"
)
private
Integer
productId
;
@ApiModelProperty
(
name
=
"productType"
,
notes
=
"商品类型,0=套餐 1=商品(枚举见ProductTypeEnum)"
)
private
Integer
productType
;
@ApiModelProperty
(
name
=
"tabName"
,
notes
=
"套餐/商品名称"
)
private
String
tabName
;
@ApiModelProperty
(
name
=
"tabDescription"
,
notes
=
"商品描述"
)
private
String
tabDescription
;
@ApiModelProperty
(
name
=
"isMainPush"
,
notes
=
"主推/次推,0=否 1=是"
)
private
Integer
isMainPush
;
@ApiModelProperty
(
name
=
"currentPrice"
,
notes
=
"原价"
)
private
BigDecimal
currentPrice
;
@ApiModelProperty
(
name
=
"discountPrice"
,
notes
=
"活动价"
)
private
BigDecimal
discountPrice
;
@ApiModelProperty
(
name
=
"mainImageUrl"
,
notes
=
"Banner图"
)
private
String
mainImageUrl
;
@ApiModelProperty
(
name
=
"thumbImageUrl"
,
notes
=
"小图"
)
private
String
thumbImageUrl
;
@ApiModelProperty
(
name
=
"detailImageUrl"
,
notes
=
"详情图"
)
private
String
detailImageUrl
;
@ApiModelProperty
(
name
=
"startTime"
,
notes
=
"活动开始时间"
)
@JsonFormat
(
pattern
=
"MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
startTime
;
@ApiModelProperty
(
name
=
"endTime"
,
notes
=
"活动结束时间"
)
@JsonFormat
(
pattern
=
"MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
endTime
;
}
src/main/java/cn/com/glsx/dj/pad/service/CustomerSopService.java
0 → 100644
View file @
cae85b2
package
cn
.
com
.
glsx
.
dj
.
pad
.
service
;
import
cn.com.glsx.dj.pad.request.strategy.CustomerSopTaskDetailRequest
;
import
cn.com.glsx.dj.pad.request.strategy.CustomerSopTaskPageRequest
;
import
cn.com.glsx.dj.pad.response.strategy.CustomerSopTaskDetailResponse
;
import
cn.com.glsx.dj.pad.response.strategy.CustomerSopTaskPageResponse
;
import
cn.com.glsx.dj.pad.util.CommonUtil
;
import
cn.com.glsx.dj.strategy.dto.ProfileQueryReqDTO
;
import
cn.com.glsx.dj.strategy.dto.CustomerProfileRespDTO
;
import
cn.com.glsx.dj.strategy.dto.sop.CustomerSopTaskDetailReqDTO
;
import
cn.com.glsx.dj.strategy.dto.sop.CustomerSopTaskDetailRespDTO
;
import
cn.com.glsx.dj.strategy.dto.sop.CustomerSopTaskPageReqDTO
;
import
cn.com.glsx.dj.strategy.dto.sop.CustomerSopTaskRespDTO
;
import
cn.com.glsx.dj.strategy.remote.CustomerSopRemote
;
import
cn.com.glsx.dj.strategy.remote.CustomerTagProfileRemote
;
import
cn.com.glsx.framework.core.beans.rpc.RpcPagination
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Slf4j
@Service
@RequiredArgsConstructor
public
class
CustomerSopService
{
private
final
CustomerSopRemote
customerSopRemote
;
private
final
CustomerTagProfileRemote
customerTagProfileRemote
;
public
RpcPagination
<
CustomerSopTaskPageResponse
>
pageTodayPendingCustomers
(
CustomerSopTaskPageRequest
request
)
{
RpcPagination
<
CustomerSopTaskPageReqDTO
>
pagination
=
CommonUtil
.
getRpcPagination
(
CustomerSopTaskPageReqDTO
.
class
);
pagination
.
setPageNum
(
request
.
getPageNum
());
pagination
.
setPageSize
(
request
.
getPageSize
());
CustomerSopTaskPageReqDTO
condition
=
new
CustomerSopTaskPageReqDTO
();
condition
.
setMerchantId
(
request
.
getMerchantId
());
pagination
.
setCondition
(
condition
);
RpcResponse
<
RpcPagination
<
CustomerSopTaskRespDTO
>>
response
=
customerSopRemote
.
pageTodayPendingCustomers
(
pagination
);
if
(!
response
.
isSuccess
())
{
throw
new
RpcServiceException
(
response
.
getMessage
());
}
RpcPagination
<
CustomerSopTaskRespDTO
>
rpcPage
=
response
.
getResult
();
List
<
CustomerSopTaskRespDTO
>
rpcList
=
rpcPage
.
getList
();
if
(
CollectionUtils
.
isEmpty
(
rpcList
))
{
return
buildEmptyPage
(
request
);
}
Map
<
String
,
List
<
String
>>
tagMap
=
queryTags
(
rpcList
);
List
<
CustomerSopTaskPageResponse
>
respList
=
rpcList
.
stream
()
.
map
(
dto
->
convertToPageResponse
(
dto
,
tagMap
))
.
collect
(
Collectors
.
toList
());
RpcPagination
<
CustomerSopTaskPageResponse
>
result
=
new
RpcPagination
<>();
result
.
setPageNum
(
rpcPage
.
getPageNum
());
result
.
setPageSize
(
rpcPage
.
getPageSize
());
result
.
setTotal
(
rpcPage
.
getTotal
());
result
.
setList
(
respList
);
return
result
;
}
public
RpcPagination
<
CustomerSopTaskPageResponse
>
pageLastWeekReachedCustomers
(
CustomerSopTaskPageRequest
request
)
{
RpcPagination
<
CustomerSopTaskPageReqDTO
>
pagination
=
CommonUtil
.
getRpcPagination
(
CustomerSopTaskPageReqDTO
.
class
);
pagination
.
setPageNum
(
request
.
getPageNum
());
pagination
.
setPageSize
(
request
.
getPageSize
());
CustomerSopTaskPageReqDTO
condition
=
new
CustomerSopTaskPageReqDTO
();
condition
.
setMerchantId
(
request
.
getMerchantId
());
pagination
.
setCondition
(
condition
);
RpcResponse
<
RpcPagination
<
CustomerSopTaskRespDTO
>>
response
=
customerSopRemote
.
pageLastWeekReachedCustomers
(
pagination
);
if
(!
response
.
isSuccess
())
{
throw
new
RpcServiceException
(
response
.
getMessage
());
}
RpcPagination
<
CustomerSopTaskRespDTO
>
rpcPage
=
response
.
getResult
();
List
<
CustomerSopTaskRespDTO
>
rpcList
=
rpcPage
.
getList
();
if
(
CollectionUtils
.
isEmpty
(
rpcList
))
{
return
buildEmptyPage
(
request
);
}
Map
<
String
,
List
<
String
>>
tagMap
=
queryTags
(
rpcList
);
List
<
CustomerSopTaskPageResponse
>
respList
=
rpcList
.
stream
()
.
map
(
dto
->
convertToPageResponse
(
dto
,
tagMap
))
.
collect
(
Collectors
.
toList
());
RpcPagination
<
CustomerSopTaskPageResponse
>
result
=
new
RpcPagination
<>();
result
.
setPageNum
(
rpcPage
.
getPageNum
());
result
.
setPageSize
(
rpcPage
.
getPageSize
());
result
.
setTotal
(
rpcPage
.
getTotal
());
result
.
setList
(
respList
);
return
result
;
}
public
List
<
CustomerSopTaskDetailResponse
>
listTodayPendingTaskDetails
(
CustomerSopTaskDetailRequest
request
)
{
CustomerSopTaskDetailReqDTO
reqDTO
=
new
CustomerSopTaskDetailReqDTO
();
reqDTO
.
setMerchantId
(
request
.
getMerchantId
());
reqDTO
.
setCustomerInstanceId
(
request
.
getCustomerInstanceId
());
RpcResponse
<
List
<
CustomerSopTaskDetailRespDTO
>>
response
=
customerSopRemote
.
listTodayPendingTaskDetails
(
reqDTO
);
if
(!
response
.
isSuccess
())
{
throw
new
RpcServiceException
(
response
.
getMessage
());
}
List
<
CustomerSopTaskDetailRespDTO
>
rpcList
=
response
.
getResult
();
if
(
CollectionUtils
.
isEmpty
(
rpcList
))
{
return
Collections
.
emptyList
();
}
return
rpcList
.
stream
()
.
map
(
this
::
convertToDetailResponse
)
.
collect
(
Collectors
.
toList
());
}
public
List
<
CustomerSopTaskDetailResponse
>
listLastWeekTaskRecords
(
CustomerSopTaskDetailRequest
request
)
{
CustomerSopTaskDetailReqDTO
reqDTO
=
new
CustomerSopTaskDetailReqDTO
();
reqDTO
.
setMerchantId
(
request
.
getMerchantId
());
reqDTO
.
setCustomerInstanceId
(
request
.
getCustomerInstanceId
());
RpcResponse
<
List
<
CustomerSopTaskDetailRespDTO
>>
response
=
customerSopRemote
.
listLastWeekTaskRecords
(
reqDTO
);
if
(!
response
.
isSuccess
())
{
throw
new
RpcServiceException
(
response
.
getMessage
());
}
List
<
CustomerSopTaskDetailRespDTO
>
rpcList
=
response
.
getResult
();
if
(
CollectionUtils
.
isEmpty
(
rpcList
))
{
return
Collections
.
emptyList
();
}
return
rpcList
.
stream
()
.
map
(
this
::
convertToDetailResponse
)
.
collect
(
Collectors
.
toList
());
}
private
Map
<
String
,
List
<
String
>>
queryTags
(
List
<
CustomerSopTaskRespDTO
>
rpcList
)
{
List
<
String
>
phones
=
rpcList
.
stream
()
.
map
(
CustomerSopTaskRespDTO:
:
getCustomerPhone
)
.
filter
(
phone
->
phone
!=
null
&&
!
phone
.
isEmpty
())
.
distinct
()
.
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
phones
))
{
return
Collections
.
emptyMap
();
}
ProfileQueryReqDTO
req
=
new
ProfileQueryReqDTO
();
req
.
setPhoneList
(
phones
);
RpcResponse
<
List
<
CustomerProfileRespDTO
>>
response
=
customerTagProfileRemote
.
queryCustomerProfileByPhones
(
req
);
if
(!
response
.
isSuccess
()
||
CollectionUtils
.
isEmpty
(
response
.
getResult
()))
{
return
Collections
.
emptyMap
();
}
return
response
.
getResult
().
stream
()
.
collect
(
Collectors
.
groupingBy
(
CustomerProfileRespDTO:
:
getPhone
,
Collectors
.
mapping
(
CustomerProfileRespDTO:
:
getEnumName
,
Collectors
.
toList
())
));
}
private
CustomerSopTaskPageResponse
convertToPageResponse
(
CustomerSopTaskRespDTO
dto
,
Map
<
String
,
List
<
String
>>
tagMap
)
{
CustomerSopTaskPageResponse
resp
=
new
CustomerSopTaskPageResponse
();
BeanUtils
.
copyProperties
(
dto
,
resp
);
resp
.
setTagList
(
tagMap
.
getOrDefault
(
dto
.
getCustomerPhone
(),
Collections
.
emptyList
()));
return
resp
;
}
private
CustomerSopTaskDetailResponse
convertToDetailResponse
(
CustomerSopTaskDetailRespDTO
dto
)
{
CustomerSopTaskDetailResponse
resp
=
new
CustomerSopTaskDetailResponse
();
BeanUtils
.
copyProperties
(
dto
,
resp
);
return
resp
;
}
private
RpcPagination
<
CustomerSopTaskPageResponse
>
buildEmptyPage
(
CustomerSopTaskPageRequest
request
)
{
RpcPagination
<
CustomerSopTaskPageResponse
>
result
=
new
RpcPagination
<>();
result
.
setPageNum
(
request
.
getPageNum
());
result
.
setPageSize
(
request
.
getPageSize
());
result
.
setTotal
(
0L
);
result
.
setList
(
Collections
.
emptyList
());
return
result
;
}
}
src/main/java/cn/com/glsx/dj/pad/service/MarketingActivityProductService.java
0 → 100644
View file @
cae85b2
package
cn
.
com
.
glsx
.
dj
.
pad
.
service
;
import
cn.com.glsx.dj.pad.request.strategy.MarketingActivityProductRequest
;
import
cn.com.glsx.dj.pad.response.strategy.CarSeriesResponse
;
import
cn.com.glsx.dj.pad.response.strategy.MarketingStageGroupResponse
;
import
cn.com.glsx.dj.pad.response.strategy.ProductResponse
;
import
cn.com.glsx.dj.strategy.dto.marketing.ActivityProductListReqDTO
;
import
cn.com.glsx.dj.strategy.dto.marketing.CarSeriesRespDTO
;
import
cn.com.glsx.dj.strategy.dto.marketing.MarketingStageGroupRespDTO
;
import
cn.com.glsx.dj.strategy.dto.marketing.ProductRespDTO
;
import
cn.com.glsx.dj.strategy.remote.MarketingActivityProductRemote
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Slf4j
@Service
@RequiredArgsConstructor
public
class
MarketingActivityProductService
{
private
final
MarketingActivityProductRemote
marketingActivityProductRemote
;
public
List
<
MarketingStageGroupResponse
>
listActiveProducts
(
MarketingActivityProductRequest
request
)
{
ActivityProductListReqDTO
reqDTO
=
new
ActivityProductListReqDTO
();
reqDTO
.
setMerchantId
(
request
.
getMerchantId
());
RpcResponse
<
List
<
MarketingStageGroupRespDTO
>>
response
=
marketingActivityProductRemote
.
listActiveProducts
(
reqDTO
);
if
(!
response
.
isSuccess
())
{
throw
new
RpcServiceException
(
response
.
getMessage
());
}
List
<
MarketingStageGroupRespDTO
>
rpcList
=
response
.
getResult
();
if
(
CollectionUtils
.
isEmpty
(
rpcList
))
{
return
Collections
.
emptyList
();
}
return
rpcList
.
stream
()
.
map
(
this
::
convertStageGroup
)
.
collect
(
Collectors
.
toList
());
}
private
MarketingStageGroupResponse
convertStageGroup
(
MarketingStageGroupRespDTO
dto
)
{
MarketingStageGroupResponse
resp
=
new
MarketingStageGroupResponse
();
resp
.
setMarketingStage
(
dto
.
getMarketingStage
());
List
<
CarSeriesResponse
>
carSeriesList
=
dto
.
getCarSeriesList
().
stream
()
.
map
(
this
::
convertCarSeries
)
.
collect
(
Collectors
.
toList
());
resp
.
setCarSeriesList
(
carSeriesList
);
return
resp
;
}
private
CarSeriesResponse
convertCarSeries
(
CarSeriesRespDTO
dto
)
{
CarSeriesResponse
resp
=
new
CarSeriesResponse
();
BeanUtils
.
copyProperties
(
dto
,
resp
,
"productList"
);
List
<
ProductResponse
>
productList
=
dto
.
getProductList
().
stream
()
.
map
(
this
::
convertProduct
)
.
collect
(
Collectors
.
toList
());
resp
.
setProductList
(
productList
);
return
resp
;
}
private
ProductResponse
convertProduct
(
ProductRespDTO
dto
)
{
ProductResponse
resp
=
new
ProductResponse
();
BeanUtils
.
copyProperties
(
dto
,
resp
);
return
resp
;
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment