Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
rpc-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 5a79038b
authored
Jun 01, 2026
by
范富荣
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化查询人员列表-驻店类型标识逻辑
1 parent
59e8fca5
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
159 additions
and
16 deletions
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/dto/StaffTempSupportReqDTO.java
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/remote/StrategyInfoRemote.java
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/mapper/StrategyInfoMapper.java
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/remote/StrategyInfoRemoteImpl.java
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/StrategyInfoService.java
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/StrategyMerchantTimelineService.java
rpc-dj-strategy/src/main/resources/META-INF/orm/StrategyInfoMapper.xml
rpc-dj-strategy/src/test/java/cn/com/glsx/dj/strategy/service/StrategyInfoServiceTest.java
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/dto/StaffTempSupportReqDTO.java
0 → 100644
View file @
5a79038
package
cn
.
com
.
glsx
.
dj
.
strategy
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
@Data
public
class
StaffTempSupportReqDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
notes
=
"门店号"
,
required
=
true
)
private
Integer
merchantId
;
@ApiModelProperty
(
notes
=
"开始时间"
,
required
=
true
)
private
String
startDate
;
@ApiModelProperty
(
notes
=
"结束时间"
,
required
=
true
)
private
String
endDate
;
@ApiModelProperty
(
notes
=
"员工UUID列表"
,
required
=
true
)
private
List
<
String
>
staffIds
;
@ApiModelProperty
(
notes
=
"业务类型(1.延保 2.轻改 3.权益 4.二手车)"
)
private
Integer
bizs
;
}
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/remote/StrategyInfoRemote.java
View file @
5a79038
...
...
@@ -90,4 +90,9 @@ public interface StrategyInfoRemote {
@ApiParam
(
name
=
"reqDTO"
,
notes
=
"策略校验请求参数"
,
dataType
=
ApiParam
.
DataTypeEnum
.
OBJECT
,
required
=
true
)
@ApiResponse
(
"策略校验结果"
)
RpcResponse
<
OrderStrategyCheckRespDTO
>
checkOrderStrategyRestriction
(
OrderStrategyCheckReqDTO
reqDTO
);
@ApiMethod
(
"查询指定时间范围内的临时支援员工UUID列表"
)
@ApiParam
(
name
=
"reqDTO"
,
notes
=
"查询条件"
,
dataType
=
ApiParam
.
DataTypeEnum
.
OBJECT
,
required
=
true
)
@ApiResponse
(
"临时支援员工UUID列表"
)
RpcResponse
<
List
<
String
>>
selectStaffTempSupportByDateRange
(
StaffTempSupportReqDTO
reqDTO
);
}
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/mapper/StrategyInfoMapper.java
View file @
5a79038
...
...
@@ -94,7 +94,9 @@ public interface StrategyInfoMapper extends OreMapper<StrategyInfo> {
* @param userUuidList
* @return
*/
List
<
String
>
selectStaffTempSupport
(
@Param
(
"merchantId"
)
Integer
merchantId
,
@Param
(
"yearMonth"
)
String
yearMonth
,
@Param
(
"userUuidList"
)
List
<
String
>
userUuidList
);
List
<
String
>
selectStaffTempSupport
(
@Param
(
"merchantId"
)
Integer
merchantId
,
@Param
(
"yearMonth"
)
String
yearMonth
,
@Param
(
"userUuidList"
)
List
<
String
>
userUuidList
,
@Param
(
"bizs"
)
Integer
bizs
);
List
<
String
>
selectStaffTempSupportByDateRange
(
@Param
(
"merchantId"
)
Integer
merchantId
,
@Param
(
"startDate"
)
String
startDate
,
@Param
(
"endDate"
)
String
endDate
,
@Param
(
"userUuidList"
)
List
<
String
>
userUuidList
,
@Param
(
"bizs"
)
Integer
bizs
);
/**
* 查询指定业务+周期内有策略记录的门店号列表。
...
...
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/remote/StrategyInfoRemoteImpl.java
View file @
5a79038
...
...
@@ -249,4 +249,17 @@ public class StrategyInfoRemoteImpl implements StrategyInfoRemote {
return
RpcResponse
.
error
(
e
);
}
}
@Override
public
RpcResponse
<
List
<
String
>>
selectStaffTempSupportByDateRange
(
StaffTempSupportReqDTO
reqDTO
)
{
try
{
return
RpcResponse
.
success
(
strategyInfoService
.
selectStaffTempSupportByDateRange
(
reqDTO
));
}
catch
(
RpcServiceException
e
)
{
log
.
error
(
"查询临时支援员工 occur RpcServiceException"
,
e
);
return
RpcResponse
.
error
(
e
);
}
catch
(
Exception
e
)
{
log
.
error
(
"查询临时支援员工 occur Exception"
,
e
);
return
RpcResponse
.
error
(
e
);
}
}
}
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/StrategyInfoService.java
View file @
5a79038
...
...
@@ -7,6 +7,8 @@ import cn.com.glsx.dj.mindworkplate.remote.PadMessageBoxRemote;
import
cn.com.glsx.dj.peanalysis.dto.DataBizQueryParamsDTO
;
import
cn.com.glsx.dj.peanalysis.dto.DataBusinessDTO
;
import
cn.com.glsx.dj.smartcarlife.dto.scene.ListStaffStationTypeParamDTO
;
import
cn.com.glsx.dj.smartcarlife.dto.scene.SceneDTO
;
import
cn.com.glsx.dj.smartcarlife.dto.scene.SceneQueryFilterDTO
;
import
cn.com.glsx.dj.smartcarlife.dto.scene.StaffStationTypeDTO
;
import
cn.com.glsx.dj.smartcarlife.enums.SceneTypeEnum
;
import
cn.com.glsx.dj.smartcarlife.remote.SceneRemote
;
...
...
@@ -29,6 +31,7 @@ import cn.com.glsx.dj.strategy.dto.OrderStrategyCheckReqDTO;
import
cn.com.glsx.dj.strategy.dto.OrderStrategyCheckRespDTO
;
import
cn.com.glsx.dj.strategy.dto.StaffHistoryRecordDTO
;
import
cn.com.glsx.dj.strategy.dto.StaffInfoDTO
;
import
cn.com.glsx.dj.strategy.dto.StaffTempSupportReqDTO
;
import
cn.com.glsx.dj.strategy.enums.BiAggregationTypeEnum
;
import
cn.com.glsx.dj.strategy.enums.BiDateTypeEnum
;
import
cn.com.glsx.dj.strategy.enums.BiMetricCodeEnum
;
...
...
@@ -786,9 +789,11 @@ public class StrategyInfoService {
// 查询员工禁用情况
List
<
String
>
staffIds
=
totalOutputList
.
stream
().
map
(
DataBusinessDTO:
:
getStaffId
).
distinct
().
collect
(
Collectors
.
toList
());
Map
<
String
,
String
>
staffDisabledFlagMap
=
queryStaffStatus
(
merchantId
,
staffIds
);
// 提前解析 bizs -> baseSceneCodeList,供后续方法共用
List
<
String
>
baseSceneCodeList
=
resolveBaseSceneCodeList
(
bizs
);
Map
<
String
,
String
>
staffDisabledFlagMap
=
queryStaffStatus
(
merchantId
,
staffIds
,
baseSceneCodeList
);
//根据bizs查询驻店类型(station_type)
Map
<
String
,
Integer
>
staffStationTypeMap
=
queryStaffStationType
(
bizs
,
staffIds
);
Map
<
String
,
Integer
>
staffStationTypeMap
=
queryStaffStationType
(
staffIds
,
baseSceneCodeList
);
// 遍历员工分组, 查询每个员工是否“临时支援”:员工在对应月份中存在策略记录属于带教人员或销售精英到店提拉记录(通过对应月份与执行周期进行匹配存在重合即符合,通过员工手机号与带教人员或销售精英手机号进行匹配一致即符合,两个条件需同时满足),则标记“临时支援”;
// 转换封装对象,返回结果
...
...
@@ -804,7 +809,7 @@ public class StrategyInfoService {
dto
.
setStaffList
(
staffList
);
List
<
DataBusinessDTO
>
value
=
entry
.
getValue
();
List
<
String
>
userUuids
=
strategyInfoMapper
.
selectStaffTempSupport
(
merchantId
,
yearMonth
,
value
.
stream
().
map
(
DataBusinessDTO:
:
getStaffId
).
collect
(
Collectors
.
toList
()));
List
<
String
>
userUuids
=
strategyInfoMapper
.
selectStaffTempSupport
(
merchantId
,
yearMonth
,
value
.
stream
().
map
(
DataBusinessDTO:
:
getStaffId
).
collect
(
Collectors
.
toList
())
,
bizs
);
for
(
DataBusinessDTO
dataBusinessDTO
:
value
)
{
StaffInfoDTO
e
=
new
StaffInfoDTO
();
...
...
@@ -835,22 +840,57 @@ public class StrategyInfoService {
}
/**
* 解析 bizs -> baseSceneCodeList(公共方法,避免重复查询)
*/
private
List
<
String
>
resolveBaseSceneCodeList
(
Integer
bizs
)
{
if
(
bizs
==
null
)
{
return
Collections
.
emptyList
();
}
String
bizsStr
=
String
.
valueOf
(
bizs
);
SceneTypeEnum
sceneTypeEnum
=
java
.
util
.
Arrays
.
asList
(
"1"
,
"3"
).
contains
(
bizsStr
)
?
SceneTypeEnum
.
SCENE1_0
:
SceneTypeEnum
.
SCENE1_1
;
SceneQueryFilterDTO
sceneQueryFilter
=
new
SceneQueryFilterDTO
();
sceneQueryFilter
.
setSceneType
((
int
)
sceneTypeEnum
.
getValue
());
if
(
"1"
.
equals
(
bizsStr
))
{
sceneQueryFilter
.
setBusinessType
(
2
);
}
else
if
(
"3"
.
equals
(
bizsStr
))
{
sceneQueryFilter
.
setBusinessType
(
1
);
}
RpcResponse
<
List
<
SceneDTO
>>
sceneResponse
=
sceneRemote
.
getScenesByParams
(
sceneQueryFilter
);
if
(
sceneResponse
.
hasError
()
||
CollectionUtils
.
isEmpty
(
sceneResponse
.
getResult
()))
{
return
Collections
.
emptyList
();
}
return
sceneResponse
.
getResult
().
stream
()
.
map
(
SceneDTO:
:
getBaseSceneCode
)
.
filter
(
StrUtil:
:
isNotBlank
)
.
distinct
()
.
collect
(
Collectors
.
toList
());
}
/**
* 根据bizs查询驻店类型(station_type)
* <p>
* bizs 转为 businessType(参考 StrategyMerchantTimelineService#buildMerchantBusinessDTO),
* 再转为 sceneTypeEnum,调用 SceneRemote#getScenesByParams 获取 baseSceneCode 列表,
* 最终从 StaffAccountAssignRecord、StaffAccountAssignScene 关联表查询 station_type。
*
* @param bizs 业务类型编码
* @param staffIds 员工UUID列表
* @param baseSceneCodeList 场景编码列表
* @return staffUuid -> stationType (1:门店常驻, 2:临时调动支援)
*/
private
Map
<
String
,
Integer
>
queryStaffStationType
(
Integer
bizs
,
List
<
String
>
staffIds
)
{
if
(
bizs
==
null
||
cn
.
hutool
.
core
.
collection
.
CollUtil
.
isEmpty
(
staffIds
))
{
private
Map
<
String
,
Integer
>
queryStaffStationType
(
List
<
String
>
staffIds
,
List
<
String
>
baseSceneCodeList
)
{
if
(
CollectionUtils
.
isEmpty
(
baseSceneCodeList
)
||
cn
.
hutool
.
core
.
collection
.
CollUtil
.
isEmpty
(
staffIds
))
{
return
new
HashMap
<>();
}
RpcResponse
<
List
<
StaffStationTypeDTO
>>
response
=
sceneRemote
.
listStaffStationType
(
new
ListStaffStationTypeParamDTO
(
bizs
,
staffIds
));
ListStaffStationTypeParamDTO
param
=
new
ListStaffStationTypeParamDTO
();
param
.
setStaffUuids
(
staffIds
);
param
.
setBaseSceneCodeList
(
baseSceneCodeList
);
RpcResponse
<
List
<
StaffStationTypeDTO
>>
response
=
sceneRemote
.
listStaffStationType
(
param
);
if
(!
response
.
isSuccess
()
||
cn
.
hutool
.
core
.
collection
.
CollUtil
.
isEmpty
(
response
.
getResult
()))
{
return
new
HashMap
<>();
}
...
...
@@ -864,18 +904,40 @@ public class StrategyInfoService {
}
/**
* 查询指定时间范围内的临时支援员工UUID列表
*/
public
List
<
String
>
selectStaffTempSupportByDateRange
(
StaffTempSupportReqDTO
reqDTO
)
{
if
(
reqDTO
==
null
||
reqDTO
.
getMerchantId
()
==
null
||
CollectionUtils
.
isEmpty
(
reqDTO
.
getStaffIds
()))
{
return
Collections
.
emptyList
();
}
try
{
return
strategyInfoMapper
.
selectStaffTempSupportByDateRange
(
reqDTO
.
getMerchantId
(),
reqDTO
.
getStartDate
(),
reqDTO
.
getEndDate
(),
reqDTO
.
getStaffIds
(),
reqDTO
.
getBizs
());
}
catch
(
Exception
e
)
{
log
.
error
(
"查询临时支援员工异常: {}"
,
e
.
getMessage
(),
e
);
throw
new
RpcServiceException
(
DefaultErrorEnum
.
DATABASE_ERROR
);
}
}
/**
* 处理员工禁用标识
* @param merchantId 商户ID
* @param staffIds 员工ID列表
* @param baseSceneCodeList 场景编码列表
*/
public
Map
<
String
,
String
>
queryStaffStatus
(
Integer
merchantId
,
List
<
String
>
staffIds
)
{
public
Map
<
String
,
String
>
queryStaffStatus
(
Integer
merchantId
,
List
<
String
>
staffIds
,
List
<
String
>
baseSceneCodeList
)
{
if
(
CollectionUtils
.
isEmpty
(
baseSceneCodeList
)
||
CollectionUtils
.
isEmpty
(
staffIds
))
{
return
Collections
.
EMPTY_MAP
;
}
cn
.
com
.
glsx
.
dj
.
smartcarlife
.
dto
.
StaffInfoDTO
staffParam
=
new
cn
.
com
.
glsx
.
dj
.
smartcarlife
.
dto
.
StaffInfoDTO
();
staffParam
.
setStaffUuidList
(
staffIds
);
staffParam
.
setShopMerchantId
(
merchantId
);
staffParam
.
setSubMerchantTypeList
(
Arrays
.
asList
(
6
,
8
));
staffParam
.
setS
ceneType
((
byte
)
0
);
// 业务场景(0.会员权益,1.精品升级),必须,默认会员权益
staffParam
.
set
StaffDeletedFlags
(
Arrays
.
asList
(
BaseModel
.
DeletedFlagEnum
.
N
.
name
(),
BaseModel
.
DeletedFlagEnum
.
D
.
name
(),
"I"
)
);
RpcResponse
<
List
<
cn
.
com
.
glsx
.
dj
.
smartcarlife
.
dto
.
StaffInfoDTO
>>
listRpcResponse
=
staffInfoRemote
.
listBySceneShop
(
staffParam
);
staffParam
.
setSubMerchantTypeList
(
java
.
util
.
Arrays
.
asList
(
6
,
8
));
staffParam
.
setS
taffDeletedFlags
(
java
.
util
.
Arrays
.
asList
(
BaseModel
.
DeletedFlagEnum
.
N
.
name
(),
BaseModel
.
DeletedFlagEnum
.
D
.
name
(),
"I"
));
staffParam
.
set
BaseSceneCodeList
(
baseSceneCodeList
);
RpcResponse
<
List
<
cn
.
com
.
glsx
.
dj
.
smartcarlife
.
dto
.
StaffInfoDTO
>>
listRpcResponse
=
staffInfoRemote
.
listBySceneShop
WithBizs
(
staffParam
);
if
(
listRpcResponse
.
hasError
())
{
log
.
error
(
"查询员工禁用标识异常: {}"
,
listRpcResponse
.
getMessage
());
throw
new
RpcServiceException
(
listRpcResponse
.
getError
(),
listRpcResponse
.
getMessage
());
...
...
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/StrategyMerchantTimelineService.java
View file @
5a79038
...
...
@@ -2,6 +2,7 @@ package cn.com.glsx.dj.strategy.service;
import
cn.com.glsx.dj.mindworkplate.enums.messagebox.BusinessTypeEnums
;
import
cn.com.glsx.dj.peanalysis.dto.req.output.SceneBaseReq
;
import
cn.com.glsx.dj.peanalysis.enums.BusinessTypeEnum
;
import
cn.com.glsx.dj.peanalysis.remote.BusinessSceneAnalysisRemote
;
import
cn.com.glsx.dj.riskmanage.dto.learningcenter.CourseSearchDTO
;
import
cn.com.glsx.dj.riskmanage.dto.learningcenter.StaffCourseSummaryDTO
;
...
...
@@ -171,7 +172,7 @@ public class StrategyMerchantTimelineService {
if
(
CollectionUtils
.
isEmpty
(
dbLines
))
{
//数据库无数据,需要初始化
//1.查询业务场景+门店 :产品首次上架时间
handlerProductFirstShelveDate
(
request
,
now
,
nodes
);
if
(
BusinessTypeEnum
s
.
EXTENDED_WARRANTY
.
getCode
().
equals
(
request
.
getBizs
(
)))
{
if
(
BusinessTypeEnum
.
BUSINESS_TYPE_1
.
getCode
().
equals
(
String
.
valueOf
(
request
.
getBizs
()
)))
{
//3. 查询业务场景+门店 :安心包产品上架时间
handlerAnxiousPackageShelveDate
(
request
,
now
,
nodes
);
//4. 查询业务场景+门店 :延保-轮胎上架时间
...
...
@@ -187,7 +188,7 @@ public class StrategyMerchantTimelineService {
//1.查询业务场景+门店 :产品首次上架时间
handlerProductFirstShelveDate
(
request
,
now
,
nodes
);
}
if
(
BusinessTypeEnum
s
.
EXTENDED_WARRANTY
.
getCode
().
equals
(
request
.
getBizs
(
)))
{
if
(
BusinessTypeEnum
.
BUSINESS_TYPE_1
.
getCode
().
equals
(
String
.
valueOf
(
request
.
getBizs
()
)))
{
if
(!
nodeTypeList
.
contains
(
MerchantNodeTypeEnum
.
ANXIOUS_PACKAGE_SHELVE
.
getValue
()))
{
//3. 查询业务场景+门店 :安心包产品上架时间
handlerAnxiousPackageShelveDate
(
request
,
now
,
nodes
);
...
...
rpc-dj-strategy/src/main/resources/META-INF/orm/StrategyInfoMapper.xml
View file @
5a79038
...
...
@@ -239,6 +239,31 @@
AND si.merchant_id = #{merchantId}
AND DATE_FORMAT(si.start_date, '%Y-%m')
<
= #{yearMonth}
AND DATE_FORMAT(si.end_date, '%Y-%m') >= #{yearMonth}
<if
test=
"bizs != null"
>
AND si.biz = #{bizs}
</if>
AND user_uuid in
<foreach
collection=
"userUuidList"
item=
"uuid"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{uuid}
</foreach>
</select>
<select
id=
"selectStaffTempSupportByDateRange"
resultType=
"java.lang.String"
>
SELECT DISTINCT
ssr.user_uuid
FROM dj_car_life_strategy_info si
INNER JOIN dj_car_life_strategy_staff_rel ssr ON si.id = ssr.strategy_id
WHERE si.deleted_flag = 'N'
AND ssr.deleted_flag = 'N'
AND si.strategy_type IN (2, 4)
AND si.end_date IS NOT NULL
AND si.start_date IS NOT NULL
AND si.merchant_id = #{merchantId}
AND si.start_date
<
= #{endDate}
AND si.end_date
>
= #{startDate}
<if
test=
"bizs != null"
>
AND si.biz = #{bizs}
</if>
AND user_uuid in
<foreach
collection=
"userUuidList"
item=
"uuid"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{uuid}
...
...
rpc-dj-strategy/src/test/java/cn/com/glsx/dj/strategy/service/StrategyInfoServiceTest.java
View file @
5a79038
...
...
@@ -99,11 +99,19 @@ public class StrategyInfoServiceTest extends BaseServiceTest {
@Test
public
void
testQueryStrategyMerchantTimelineList
()
{
MerchantBusinessInfo
request
=
new
MerchantBusinessInfo
();
request
.
setMerchantId
(
442
1164
0
);
request
.
setMerchantId
(
442
0939
0
);
request
.
setSceneType
(
SceneTypeEnum
.
SCENE1_0
.
getValue
());
request
.
setBizs
(
1
);
MerchantBusinessOverview
overview
=
strategyMerchantTimelineService
.
listStrategyMerchantTimeline
(
request
);
log
.
info
(
"strategyMerchantTimelineList: {}"
,
overview
);
request
.
setBizs
(
3
);
overview
=
strategyMerchantTimelineService
.
listStrategyMerchantTimeline
(
request
);
log
.
info
(
"strategyMerchantTimelineList: {}"
,
overview
);
request
.
setSceneType
(
SceneTypeEnum
.
SCENE1_1
.
getValue
());
request
.
setBizs
(
2
);
overview
=
strategyMerchantTimelineService
.
listStrategyMerchantTimeline
(
request
);
log
.
info
(
"strategyMerchantTimelineList: {}"
,
overview
);
}
@Test
...
...
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