Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
rop-dj-strategy
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 60d9e648
authored
May 30, 2026
by
杨卫
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:预警引擎功能策略中心列表,策略分析等接口
1 parent
947242a0
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
558 additions
and
0 deletions
src/main/java/cn/com/glsx/dj/strategy/config/dubbo/DubboConfig.java
src/main/java/cn/com/glsx/dj/strategy/controller/WarningController.java
src/main/java/cn/com/glsx/dj/strategy/request/EffectAnalysisRopRequest.java
src/main/java/cn/com/glsx/dj/strategy/request/WarningDetailQueryRopRequest.java
src/main/java/cn/com/glsx/dj/strategy/request/WarningGroupListRopRequest.java
src/main/java/cn/com/glsx/dj/strategy/request/WarningMetricListRopRequest.java
src/main/java/cn/com/glsx/dj/strategy/request/WarningRecordQueryRopRequest.java
src/main/java/cn/com/glsx/dj/strategy/service/StoreDetailService.java
src/main/java/cn/com/glsx/dj/strategy/config/dubbo/DubboConfig.java
View file @
60d9e64
...
@@ -7,6 +7,7 @@ import cn.com.glsx.dj.smartcarlife.remote.SceneRemote;
...
@@ -7,6 +7,7 @@ import cn.com.glsx.dj.smartcarlife.remote.SceneRemote;
import
cn.com.glsx.dj.smartcarlife.remote.StaffInfoRemote
;
import
cn.com.glsx.dj.smartcarlife.remote.StaffInfoRemote
;
import
cn.com.glsx.dj.strategy.remote.ProjectGroupRemote
;
import
cn.com.glsx.dj.strategy.remote.ProjectGroupRemote
;
import
cn.com.glsx.dj.strategy.remote.StrategyInfoRemote
;
import
cn.com.glsx.dj.strategy.remote.StrategyInfoRemote
;
import
cn.com.glsx.dj.strategy.remote.WarningEngineRemote
;
import
cn.com.glsx.merchants.remote.MerchantRemote
;
import
cn.com.glsx.merchants.remote.MerchantRemote
;
import
cn.com.glsx.scrm.proxy.remote.CommonProxyRemote
;
import
cn.com.glsx.scrm.proxy.remote.CommonProxyRemote
;
import
org.oreframework.boot.autoconfigure.dubbo.reference.ReferenceBuilderFactory
;
import
org.oreframework.boot.autoconfigure.dubbo.reference.ReferenceBuilderFactory
;
...
@@ -70,4 +71,9 @@ public class DubboConfig {
...
@@ -70,4 +71,9 @@ public class DubboConfig {
public
SceneRemote
sceneRemote
()
{
public
SceneRemote
sceneRemote
()
{
return
factory
.
builder
(
SceneRemote
.
class
).
check
(
check
).
timeout
(
timeout
).
version
(
"1.0.0"
).
build
();
return
factory
.
builder
(
SceneRemote
.
class
).
check
(
check
).
timeout
(
timeout
).
version
(
"1.0.0"
).
build
();
}
}
@Bean
public
WarningEngineRemote
warningEngineRemote
()
{
return
factory
.
builder
(
WarningEngineRemote
.
class
).
check
(
check
).
timeout
(
timeout
).
version
(
"1.0.0"
).
build
();
}
}
}
src/main/java/cn/com/glsx/dj/strategy/controller/WarningController.java
0 → 100644
View file @
60d9e64
package
cn
.
com
.
glsx
.
dj
.
strategy
.
controller
;
import
cn.com.glsx.dj.strategy.dto.projectgroup.GroupOptionDTO
;
import
cn.com.glsx.dj.strategy.dto.projectgroup.MetricOptionDTO
;
import
cn.com.glsx.dj.strategy.dto.projectgroup.ProjectGroupMetricQueryDTO
;
import
cn.com.glsx.dj.strategy.dto.projectgroup.WarningTypeOptionDTO
;
import
cn.com.glsx.dj.strategy.dto.warning.EffectAnalysisDTO
;
import
cn.com.glsx.dj.strategy.dto.warning.EffectAnalysisRequest
;
import
cn.com.glsx.dj.strategy.dto.warning.StoreWarningSummaryDTO
;
import
cn.com.glsx.framework.core.beans.rpc.RpcPagination
;
import
cn.com.glsx.dj.strategy.dto.warning.WarningRecordDTO
;
import
cn.com.glsx.dj.strategy.dto.warning.WarningRecordQueryRequest
;
import
cn.com.glsx.dj.strategy.remote.ProjectGroupRemote
;
import
cn.com.glsx.dj.strategy.remote.WarningEngineRemote
;
import
cn.com.glsx.dj.strategy.request.EffectAnalysisRopRequest
;
import
cn.com.glsx.dj.strategy.request.WarningDetailQueryRopRequest
;
import
cn.com.glsx.dj.strategy.request.WarningGroupListRopRequest
;
import
cn.com.glsx.dj.strategy.request.WarningMetricListRopRequest
;
import
cn.com.glsx.dj.strategy.request.WarningRecordQueryRopRequest
;
import
cn.com.glsx.dj.strategy.service.StoreDetailService
;
import
cn.com.glsx.dj.strategy.service.StrategyDetailService
;
import
cn.com.glsx.dj.strategy.uitl.CommonUtil
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
cn.com.glsx.framework.rop.response.RopResponse
;
import
cn.hutool.core.collection.CollUtil
;
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.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.text.SimpleDateFormat
;
import
java.util.List
;
/**
* 预警引擎查询控制器。
*
* @author yangwei_by_claude
* @version 1.0
* @since 2026/05/28 14:00
*/
@Slf4j
@ServiceMethodBean
(
version
=
"1.0.0"
,
needInSession
=
NeedInSessionType
.
YES
)
@Api
(
"预警引擎"
)
public
class
WarningController
{
@Autowired
private
WarningEngineRemote
warningEngineRemote
;
@Autowired
private
ProjectGroupRemote
projectGroupRemote
;
@Autowired
private
StrategyDetailService
strategyDetailService
;
@Autowired
private
StoreDetailService
storeDetailService
;
@ApiOperation
(
"预警类型下拉"
)
@ServiceMethod
(
method
=
"dj.api.strategy.warning.type.list"
)
public
RopResponse
<
List
<
WarningTypeOptionDTO
>>
listWarningTypes
()
{
try
{
RpcResponse
<
List
<
WarningTypeOptionDTO
>>
response
=
projectGroupRemote
.
listWarningTypes
();
if
(
response
.
hasError
())
{
log
.
error
(
response
.
getMessage
());
return
RopResponse
.
error
(
response
.
getError
(),
response
.
getMessage
());
}
return
RopResponse
.
success
(
response
.
getResult
());
}
catch
(
RpcServiceException
e
)
{
log
.
error
(
"dj.api.strategy.warning.type.list rpcServiceException"
,
e
);
return
RopResponse
.
error
(
e
);
}
catch
(
Exception
e
)
{
log
.
error
(
"dj.api.strategy.warning.type.list exception"
,
e
);
return
RopResponse
.
error
(
e
.
getMessage
());
}
}
@ApiOperation
(
"项目组下拉列表"
)
@ServiceMethod
(
method
=
"dj.api.strategy.warning.group.list"
)
public
RopResponse
<
List
<
GroupOptionDTO
>>
listGroups
(
WarningGroupListRopRequest
request
)
{
try
{
RpcResponse
<
List
<
GroupOptionDTO
>>
response
=
warningEngineRemote
.
listGroups
();
if
(
response
.
hasError
())
{
log
.
error
(
response
.
getMessage
());
return
RopResponse
.
error
(
response
.
getError
(),
response
.
getMessage
());
}
return
RopResponse
.
success
(
response
.
getResult
());
}
catch
(
RpcServiceException
e
)
{
log
.
error
(
"dj.api.strategy.warning.group.list rpcServiceException"
,
e
);
return
RopResponse
.
error
(
e
);
}
catch
(
Exception
e
)
{
log
.
error
(
"dj.api.strategy.warning.group.list exception"
,
e
);
return
RopResponse
.
error
(
e
.
getMessage
());
}
}
@ApiOperation
(
"指标类型下拉"
)
@ServiceMethod
(
method
=
"dj.api.strategy.warning.metric.list"
)
public
RopResponse
<
List
<
MetricOptionDTO
>>
listMetrics
(
WarningMetricListRopRequest
request
)
{
try
{
ProjectGroupMetricQueryDTO
dto
=
new
ProjectGroupMetricQueryDTO
();
dto
.
setWarningType
(
request
.
getWarningType
());
dto
.
setBiz
(
request
.
getBusinessType
());
RpcResponse
<
List
<
MetricOptionDTO
>>
response
=
warningEngineRemote
.
listMetrics
(
dto
);
if
(
response
.
hasError
())
{
log
.
error
(
response
.
getMessage
());
return
RopResponse
.
error
(
response
.
getError
(),
response
.
getMessage
());
}
return
RopResponse
.
success
(
response
.
getResult
());
}
catch
(
RpcServiceException
e
)
{
log
.
error
(
"dj.api.strategy.warning.metric.list rpcServiceException"
,
e
);
return
RopResponse
.
error
(
e
);
}
catch
(
Exception
e
)
{
log
.
error
(
"dj.api.strategy.warning.metric.list exception"
,
e
);
return
RopResponse
.
error
(
e
.
getMessage
());
}
}
@ApiOperation
(
"门店预警汇总列表"
)
@ServiceMethod
(
method
=
"dj.api.strategy.warning.summary"
,
needInSession
=
NeedInSessionType
.
YES
)
public
RopResponse
<
List
<
StoreWarningSummaryDTO
>>
findWarningSummary
(
WarningRecordQueryRopRequest
request
)
{
try
{
WarningRecordQueryRequest
req
=
CommonUtil
.
convertRequest
(
WarningRecordQueryRequest
.
class
);
RpcResponse
<
List
<
StoreWarningSummaryDTO
>>
response
=
warningEngineRemote
.
findWarningSummary
(
req
);
if
(
response
.
hasError
())
{
log
.
error
(
response
.
getMessage
());
return
RopResponse
.
error
(
response
.
getError
(),
response
.
getMessage
());
}
List
<
StoreWarningSummaryDTO
>
result
=
response
.
getResult
();
if
(
CollUtil
.
isNotEmpty
(
result
)
&&
request
.
getBusinessType
()
!=
null
)
{
storeDetailService
.
enrichStoreWarningSummaries
(
result
,
request
.
getBusinessType
());
}
return
RopResponse
.
success
(
result
);
}
catch
(
RpcServiceException
e
)
{
log
.
error
(
"dj.api.strategy.warning.summary rpcServiceException"
,
e
);
return
RopResponse
.
error
(
e
);
}
catch
(
Exception
e
)
{
log
.
error
(
"dj.api.strategy.warning.summary exception"
,
e
);
return
RopResponse
.
error
(
e
.
getMessage
());
}
}
@ApiOperation
(
"指定门店+员工预警明细"
)
@ServiceMethod
(
method
=
"dj.api.strategy.warning.store.staff.detail"
,
needInSession
=
NeedInSessionType
.
YES
)
public
RopResponse
<
List
<
WarningRecordDTO
>>
findWarningDetailByStoreAndStaff
(
WarningDetailQueryRopRequest
request
)
{
try
{
WarningRecordQueryRequest
req
=
CommonUtil
.
convertRequest
(
WarningRecordQueryRequest
.
class
);
RpcResponse
<
List
<
WarningRecordDTO
>>
response
=
warningEngineRemote
.
findWarningDetailByStoreAndStaff
(
req
);
if
(
response
.
hasError
())
{
log
.
error
(
response
.
getMessage
());
return
RopResponse
.
error
(
response
.
getError
(),
response
.
getMessage
());
}
return
RopResponse
.
success
(
response
.
getResult
());
}
catch
(
RpcServiceException
e
)
{
log
.
error
(
"dj.api.strategy.warning.store.staff.detail rpcServiceException"
,
e
);
return
RopResponse
.
error
(
e
);
}
catch
(
Exception
e
)
{
log
.
error
(
"dj.api.strategy.warning.store.staff.detail exception"
,
e
);
return
RopResponse
.
error
(
e
.
getMessage
());
}
}
@ApiOperation
(
"效果分析"
)
@ServiceMethod
(
method
=
"dj.api.strategy.analysis.effect"
,
needInSession
=
NeedInSessionType
.
YES
)
public
RopResponse
<
RpcPagination
<
EffectAnalysisDTO
>>
analysisEffect
(
EffectAnalysisRopRequest
request
)
{
try
{
EffectAnalysisRequest
req
=
new
EffectAnalysisRequest
();
req
.
setBusinessType
(
request
.
getBusinessType
());
req
.
setWarningType
(
request
.
getWarningType
());
req
.
setTimeDimension
(
request
.
getTimeDimension
());
req
.
setStartDate
(
request
.
getStartDate
());
req
.
setEndDate
(
request
.
getEndDate
());
req
.
setPageNum
(
request
.
getPageNum
());
req
.
setPageSize
(
request
.
getPageSize
());
RpcResponse
<
RpcPagination
<
EffectAnalysisDTO
>>
response
=
warningEngineRemote
.
analysisEffect
(
req
);
if
(
response
.
hasError
())
{
log
.
error
(
response
.
getMessage
());
return
RopResponse
.
error
(
response
.
getError
(),
response
.
getMessage
());
}
// 填充门店详情(品牌、运营人员、策略统计)
RpcPagination
<
EffectAnalysisDTO
>
pageResult
=
response
.
getResult
();
if
(
pageResult
!=
null
&&
CollUtil
.
isNotEmpty
(
pageResult
.
getList
()))
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
storeDetailService
.
enrichStoreDetails
(
pageResult
.
getList
(),
request
.
getBusinessType
(),
sdf
.
parse
(
request
.
getStartDate
()),
sdf
.
parse
(
request
.
getEndDate
()));
}
return
RopResponse
.
success
(
pageResult
);
}
catch
(
RpcServiceException
e
)
{
log
.
error
(
"dj.api.strategy.analysis.effect rpcServiceException"
,
e
);
return
RopResponse
.
error
(
e
);
}
catch
(
Exception
e
)
{
log
.
error
(
"dj.api.strategy.analysis.effect exception"
,
e
);
return
RopResponse
.
error
(
e
.
getMessage
());
}
}
}
src/main/java/cn/com/glsx/dj/strategy/request/EffectAnalysisRopRequest.java
0 → 100644
View file @
60d9e64
package
cn
.
com
.
glsx
.
dj
.
strategy
.
request
;
import
com.rop.AbstractRopRequest
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* 效果分析 ROP 请求。
*
* @author yangwei_by_claude
* @version 1.0
* @since 2026/05/29 14:00
*/
@Data
public
class
EffectAnalysisRopRequest
extends
AbstractRopRequest
{
@ApiModelProperty
(
notes
=
"业务线: 1=延保 2=轻改 3=权益"
,
required
=
true
)
private
Integer
businessType
;
@ApiModelProperty
(
notes
=
"预警类型: 5=黄色预警 4=红色预警 3=生态预警 2=兜底预警"
,
required
=
true
)
private
Integer
warningType
;
@ApiModelProperty
(
notes
=
"时间维度: W/M/LDW/LDM"
,
required
=
true
)
private
String
timeDimension
;
@ApiModelProperty
(
notes
=
"开始日期 yyyy-MM-dd"
,
required
=
true
)
private
String
startDate
;
@ApiModelProperty
(
notes
=
"结束日期 yyyy-MM-dd"
,
required
=
true
)
private
String
endDate
;
@ApiModelProperty
(
notes
=
"页码,默认1"
)
private
Integer
pageNum
=
1
;
@ApiModelProperty
(
notes
=
"每页数量,默认10"
)
private
Integer
pageSize
=
10
;
}
src/main/java/cn/com/glsx/dj/strategy/request/WarningDetailQueryRopRequest.java
0 → 100644
View file @
60d9e64
package
cn
.
com
.
glsx
.
dj
.
strategy
.
request
;
import
com.rop.AbstractRopRequest
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.ToString
;
/**
* 门店员工预警明细查询 ROP 请求。
*
* @author yangwei_by_claude
* @version 1.0
* @since 2026/05/30 15:00
*/
@Data
@ToString
(
callSuper
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
public
class
WarningDetailQueryRopRequest
extends
AbstractRopRequest
{
@ApiModelProperty
(
notes
=
"业务线: 1=延保 2=轻改 3=权益"
,
required
=
true
)
private
Integer
businessType
;
@ApiModelProperty
(
notes
=
"时间维度: W/M/LDW/LDM"
,
required
=
true
)
private
String
timeDimension
;
@ApiModelProperty
(
notes
=
"开始日期 yyyy-MM-dd"
,
required
=
true
)
private
String
startDate
;
@ApiModelProperty
(
notes
=
"结束日期 yyyy-MM-dd"
,
required
=
true
)
private
String
endDate
;
}
src/main/java/cn/com/glsx/dj/strategy/request/WarningGroupListRopRequest.java
0 → 100644
View file @
60d9e64
package
cn
.
com
.
glsx
.
dj
.
strategy
.
request
;
import
com.rop.AbstractRopRequest
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.ToString
;
/**
* 项目组下拉列表 ROP 请求。
*
* @author yangwei_by_claude
* @version 1.0
* @since 2026/05/29 16:00
*/
@Data
@ToString
(
callSuper
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
public
class
WarningGroupListRopRequest
extends
AbstractRopRequest
{
}
src/main/java/cn/com/glsx/dj/strategy/request/WarningMetricListRopRequest.java
0 → 100644
View file @
60d9e64
package
cn
.
com
.
glsx
.
dj
.
strategy
.
request
;
import
com.rop.AbstractRopRequest
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.ToString
;
/**
* 预警指标列表 ROP 请求。
*
* @author yangwei_by_claude
* @version 1.0
* @since 2026/05/29 17:00
*/
@Data
@ToString
(
callSuper
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
public
class
WarningMetricListRopRequest
extends
AbstractRopRequest
{
@ApiModelProperty
(
notes
=
"业务线: 1=延保 2=轻改 3=权益"
,
required
=
true
)
private
Integer
businessType
;
@ApiModelProperty
(
notes
=
"预警类型: 5=黄色预警 4=红色预警 3=生态预警 2=兜底预警"
,
required
=
true
)
private
Integer
warningType
;
}
src/main/java/cn/com/glsx/dj/strategy/request/WarningRecordQueryRopRequest.java
0 → 100644
View file @
60d9e64
package
cn
.
com
.
glsx
.
dj
.
strategy
.
request
;
import
com.rop.AbstractRopRequest
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
/**
* 预警记录查询 ROP 请求。
*
* @author yangwei_by_claude
* @version 1.0
* @since 2026/05/28 14:00
*/
@Data
public
class
WarningRecordQueryRopRequest
extends
AbstractRopRequest
{
@ApiModelProperty
(
notes
=
"业务线: 1=延保 2=轻改 3=权益"
,
required
=
true
)
private
Integer
businessType
;
@ApiModelProperty
(
notes
=
"预警类型: 5=黄色预警 4=红色预警 3=生态预警 2=兜底预警 (null=全部)"
)
private
Integer
warningType
;
@ApiModelProperty
(
notes
=
"指标类型ID"
)
private
Integer
metricTypeId
;
@ApiModelProperty
(
notes
=
"时间维度: W/M/LDW/LDM"
)
private
String
timeDimension
;
@ApiModelProperty
(
notes
=
"开始日期 yyyy-MM-dd"
,
required
=
true
)
private
String
startDate
;
@ApiModelProperty
(
notes
=
"结束日期 yyyy-MM-dd"
,
required
=
true
)
private
String
endDate
;
@ApiModelProperty
(
notes
=
"项目组筛选"
)
private
Integer
groupId
;
@ApiModelProperty
(
notes
=
"门店名称模糊搜索"
)
private
String
storeName
;
@ApiModelProperty
(
notes
=
"是否已下发策略"
)
private
Integer
isStrategySent
;
@ApiModelProperty
(
notes
=
"区域ID"
)
private
Integer
regionId
;
@ApiModelProperty
(
notes
=
"一级品牌ID列表"
)
private
List
<
Integer
>
firstbrandIds
;
@ApiModelProperty
(
notes
=
"二级品牌ID列表"
)
private
List
<
Integer
>
twoBrandIds
;
@ApiModelProperty
(
notes
=
"区域运营人员ID"
)
private
String
regionalOperatorId
;
@ApiModelProperty
(
notes
=
"线上运营人员ID"
)
private
String
onlineOperatorId
;
@ApiModelProperty
(
notes
=
"区域督导人员ID"
)
private
String
flightSupervisionId
;
@ApiModelProperty
(
notes
=
"门店ID(查询指定门店预警明细时使用)"
)
private
Integer
storeId
;
@ApiModelProperty
(
notes
=
"员工ID(查询指定员工预警明细时使用)"
)
private
String
staffId
;
}
src/main/java/cn/com/glsx/dj/strategy/service/StoreDetailService.java
0 → 100644
View file @
60d9e64
package
cn
.
com
.
glsx
.
dj
.
strategy
.
service
;
import
cn.com.glsx.dj.strategy.dto.MerchantStrategyStatisticsReqDTO
;
import
cn.com.glsx.dj.strategy.dto.MerchantStrategyStatisticsRespDTO
;
import
cn.com.glsx.dj.strategy.dto.warning.EffectAnalysisDTO
;
import
cn.com.glsx.dj.strategy.dto.warning.StoreWarningSummaryDTO
;
import
cn.com.glsx.dj.strategy.remote.StrategyDetailRemote
;
import
cn.com.glsx.dj.strategy.response.MerchantDetailResponse
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
import
cn.hutool.core.collection.CollUtil
;
import
com.google.common.collect.Lists
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
* 门店详情查询服务——复用 StrategyDetailService.findMerchantDetail 获取品牌和运营人员。
*
* @author yangwei_by_claude
* @version 1.0
* @since 2026/05/29 16:00
*/
@Slf4j
@Service
@RequiredArgsConstructor
public
class
StoreDetailService
{
private
final
StrategyDetailService
strategyDetailService
;
private
final
StrategyDetailRemote
strategyDetailRemote
;
/**
* 批量填充效果分析DTO的门店详情字段(品牌、运营人员、策略统计)。
*
* @param dtoList 效果分析DTO列表
* @param businessType 业务类型
* @param startDate 统计开始日期
* @param endDate 统计结束日期
*/
public
void
enrichStoreDetails
(
List
<
EffectAnalysisDTO
>
dtoList
,
Integer
businessType
,
Date
startDate
,
Date
endDate
)
{
if
(
CollUtil
.
isEmpty
(
dtoList
))
{
return
;
}
String
bizStr
=
String
.
valueOf
(
businessType
);
List
<
Integer
>
storeIds
=
dtoList
.
stream
()
.
map
(
dto
->
Integer
.
valueOf
(
dto
.
getMerchantNo
()))
.
collect
(
Collectors
.
toList
());
// 1. 复用 StrategyDetailService.findMerchantDetail 获取品牌和运营人员
Map
<
Integer
,
MerchantDetailResponse
>
merchantDetailMap
=
Collections
.
emptyMap
();
try
{
List
<
MerchantDetailResponse
>
details
=
strategyDetailService
.
findMerchantDetail
(
storeIds
,
bizStr
);
if
(
CollUtil
.
isNotEmpty
(
details
))
{
merchantDetailMap
=
details
.
stream
()
.
collect
(
Collectors
.
toMap
(
MerchantDetailResponse:
:
getMerchantNo
,
Function
.
identity
(),
(
a
,
b
)
->
a
));
}
}
catch
(
Exception
e
)
{
log
.
error
(
"查询商户详情失败"
,
e
);
}
// 2. 查询策略统计
Map
<
Integer
,
MerchantStrategyStatisticsRespDTO
>
strategyMap
=
Collections
.
emptyMap
();
try
{
RpcResponse
<
List
<
MerchantStrategyStatisticsRespDTO
>>
resp
=
strategyDetailRemote
.
findStrategyStatisticsGroupMerchantNo
(
MerchantStrategyStatisticsReqDTO
.
builder
()
.
businessType
(
bizStr
)
.
startDate
(
startDate
)
.
endDate
(
endDate
)
.
merchantNos
(
storeIds
)
.
build
());
if
(
resp
.
isSuccess
()
&&
CollUtil
.
isNotEmpty
(
resp
.
getResult
()))
{
strategyMap
=
resp
.
getResult
().
stream
()
.
filter
(
d
->
d
.
getMerchantNo
()
!=
null
)
.
collect
(
Collectors
.
toMap
(
MerchantStrategyStatisticsRespDTO:
:
getMerchantNo
,
Function
.
identity
(),
(
a
,
b
)
->
a
));
}
}
catch
(
Exception
e
)
{
log
.
error
(
"查询策略数失败"
,
e
);
}
// 3. 填充每个DTO
for
(
EffectAnalysisDTO
dto
:
dtoList
)
{
Integer
storeId
=
Integer
.
valueOf
(
dto
.
getMerchantNo
());
MerchantDetailResponse
detail
=
merchantDetailMap
.
get
(
storeId
);
if
(
detail
!=
null
)
{
dto
.
setMainBrandsStr
(
detail
.
getMainBrandsStr
());
dto
.
setOnlineOperator
(
detail
.
getOnlineOperator
());
dto
.
setAreaOperator
(
detail
.
getAreaOperator
());
dto
.
setMainServiceMerchantName
(
detail
.
getMainServiceMerchantName
());
dto
.
setFlightSupervision
(
detail
.
getFlightSupervision
());
}
else
{
dto
.
setOnlineOperator
(
Collections
.
emptyList
());
dto
.
setAreaOperator
(
Collections
.
emptyList
());
dto
.
setFlightSupervision
(
Collections
.
emptyList
());
}
MerchantStrategyStatisticsRespDTO
strategyStats
=
strategyMap
.
get
(
storeId
);
if
(
strategyStats
!=
null
)
{
dto
.
setStrategyTotalCount
(
Optional
.
ofNullable
(
strategyStats
.
getStrategyCount
()).
orElse
(
0
));
dto
.
setStrategyTypeStatisticsResponse
(
strategyStats
.
getStrategyTypeStatisticsList
());
}
else
{
dto
.
setStrategyTotalCount
(
0
);
dto
.
setStrategyTypeStatisticsResponse
(
Collections
.
emptyList
());
}
}
}
/**
* 批量填充门店预警汇总的门店详情字段(品牌、运营人员、督导),不查策略统计。
*
* @param dtoList 门店预警汇总列表
* @param businessType 业务类型
*/
public
void
enrichStoreWarningSummaries
(
List
<
StoreWarningSummaryDTO
>
dtoList
,
Integer
businessType
)
{
if
(
CollUtil
.
isEmpty
(
dtoList
))
{
return
;
}
String
bizStr
=
String
.
valueOf
(
businessType
);
List
<
Integer
>
storeIds
=
dtoList
.
stream
()
.
map
(
dto
->
Integer
.
valueOf
(
dto
.
getMerchantNo
()))
.
collect
(
Collectors
.
toList
());
Map
<
Integer
,
MerchantDetailResponse
>
merchantDetailMap
=
Collections
.
emptyMap
();
try
{
List
<
MerchantDetailResponse
>
details
=
strategyDetailService
.
findMerchantDetail
(
storeIds
,
bizStr
);
if
(
CollUtil
.
isNotEmpty
(
details
))
{
merchantDetailMap
=
details
.
stream
()
.
collect
(
Collectors
.
toMap
(
MerchantDetailResponse:
:
getMerchantNo
,
Function
.
identity
(),
(
a
,
b
)
->
a
));
}
}
catch
(
Exception
e
)
{
log
.
error
(
"查询商户详情失败"
,
e
);
}
for
(
StoreWarningSummaryDTO
dto
:
dtoList
)
{
Integer
storeId
=
Integer
.
valueOf
(
dto
.
getMerchantNo
());
MerchantDetailResponse
detail
=
merchantDetailMap
.
get
(
storeId
);
if
(
detail
!=
null
)
{
dto
.
setMainBrandsStr
(
detail
.
getMainBrandsStr
());
dto
.
setOnlineOperator
(
detail
.
getOnlineOperator
());
dto
.
setAreaOperator
(
detail
.
getAreaOperator
());
dto
.
setFlightSupervision
(
detail
.
getFlightSupervision
());
}
else
{
dto
.
setOnlineOperator
(
Collections
.
emptyList
());
dto
.
setAreaOperator
(
Collections
.
emptyList
());
dto
.
setFlightSupervision
(
Collections
.
emptyList
());
}
}
}
}
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