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 a6ab8d87
authored
Jan 27, 2026
by
春觉晓
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改创建策略接口
1 parent
bc90a4f4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
4 deletions
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/StrategyStaffRelService.java
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/StrategyInfoService.java
View file @
a6ab8d8
...
...
@@ -6,6 +6,7 @@ import cn.com.glsx.dj.mindworkplate.model.PadMessageBox;
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.enums.SceneTypeEnum
;
import
cn.com.glsx.dj.smartcarlife.remote.StaffInfoRemote
;
import
cn.com.glsx.dj.strategy.config.DataStatsConfig
;
import
cn.com.glsx.dj.strategy.config.KafkaTopicConfig
;
...
...
@@ -130,7 +131,7 @@ public class StrategyInfoService {
//批量插入策略基础信息
strategyInfoMapper
.
insertList
(
strategyInfoList
);
//批量插入策略人员关联信息
strategyStaffRelService
.
batchInsert
(
strategyInfoList
,
batchStrategyInfo
.
getStaffList
());
strategyStaffRelService
.
batchInsert
(
strategyInfoList
,
batchStrategyInfo
.
getStaffList
()
,
SceneTypeEnum
.
SCENE1_0
.
getValue
()
);
//批量插入策略课程关联关系
strategyCourseRelService
.
batchInsert
(
strategyInfoList
,
batchStrategyInfo
.
getCourseList
());
//批量插入策略-录音关联关系
...
...
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/StrategyStaffRelService.java
View file @
a6ab8d8
package
cn
.
com
.
glsx
.
dj
.
strategy
.
service
;
import
cn.com.glsx.dj.smartcarlife.dto.StaffInfoDTO
;
import
cn.com.glsx.dj.smartcarlife.remote.StaffInfoRemote
;
import
cn.com.glsx.dj.strategy.mapper.StrategyStaffRelMapper
;
import
cn.com.glsx.dj.strategy.model.StrategyInfo
;
import
cn.com.glsx.dj.strategy.model.StrategyStaffRel
;
import
cn.com.glsx.framework.core.beans.rpc.RpcPagination
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
import
cn.com.glsx.framework.core.enums.DefaultErrorEnum
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
cn.com.glsx.framework.core.util.RpcAssert
;
import
cn.com.glsx.merchants.dto.beisen.BeiSenEmployeeListRequestDTO
;
import
cn.com.glsx.merchants.dto.beisen.BeiSenEmployeeListResonseDTO
;
...
...
@@ -30,13 +33,16 @@ public class StrategyStaffRelService {
@Autowired
private
MerchantStaffRemote
merchantStaffRemote
;
@Autowired
private
StaffInfoRemote
staffInfoRemote
;
/**
* 批量插入策略人员关联关系
* @param strategyInfoList
* @param staffList
* @return
*/
public
int
batchInsert
(
List
<
StrategyInfo
>
strategyInfoList
,
List
<
StrategyStaffRel
>
staffList
)
{
public
int
batchInsert
(
List
<
StrategyInfo
>
strategyInfoList
,
List
<
StrategyStaffRel
>
staffList
,
Byte
sceneType
)
{
if
(
CollectionUtils
.
isEmpty
(
staffList
))
return
0
;
//根据手机号,查询北森人员userId
List
<
String
>
phoneList
=
staffList
.
stream
().
map
(
StrategyStaffRel:
:
getUserPhone
).
collect
(
Collectors
.
toList
());
...
...
@@ -46,16 +52,24 @@ public class StrategyStaffRelService {
//构建map
phoneUserIdMap
=
employeeList
.
stream
().
collect
(
Collectors
.
toMap
(
BeiSenEmployeeListResonseDTO:
:
getMobilePhone
,
BeiSenEmployeeListResonseDTO:
:
getUserID
));
}
//根据员工id查询 员工信息
Map
<
String
,
StaffInfoDTO
>
userMap
=
queryUserMap
(
strategyInfoList
,
staffList
,
sceneType
);
//构建对象,遍历2个对象创建新StrategyStaffRel
List
<
StrategyStaffRel
>
all
=
new
ArrayList
<>();
for
(
StrategyInfo
strategyInfo
:
strategyInfoList
)
{
for
(
StrategyStaffRel
staff
:
staffList
)
{
StrategyStaffRel
rel
=
new
StrategyStaffRel
();
rel
.
setUserUuid
(
staff
.
getUserUuid
());
rel
.
setUserName
(
staff
.
getUserName
());
//rel.setUserName(staff.getUserName());
String
key
=
staff
.
getUserUuid
()
+
staff
.
getUserPosition
();
if
(
userMap
.
containsKey
(
key
))
{
StaffInfoDTO
user
=
userMap
.
get
(
key
);
rel
.
setUserName
(
user
.
getStaffName
());
rel
.
setUserPhone
(
user
.
getPhoneNumber
());
}
rel
.
setStrategyId
(
strategyInfo
.
getId
());
rel
.
setUserPosition
(
staff
.
getUserPosition
());
rel
.
setUserPhone
(
staff
.
getUserPhone
());
//
rel.setUserPhone(staff.getUserPhone());
rel
.
setCreatedBy
(
strategyInfo
.
getCreatedBy
());
rel
.
setCreatedDate
(
strategyInfo
.
getCreatedDate
());
rel
.
setDeletedFlag
(
DeleteFlagEnum
.
N
.
getValue
());
...
...
@@ -66,6 +80,33 @@ public class StrategyStaffRelService {
return
strategyStaffRelMapper
.
insertList
(
all
);
}
public
Map
<
String
,
StaffInfoDTO
>
queryUserMap
(
List
<
StrategyInfo
>
strategyInfoList
,
List
<
StrategyStaffRel
>
staffList
,
Byte
sceneType
)
{
//根据员工id查询 员工信息
List
<
String
>
userUuidList
=
staffList
.
stream
().
map
(
x
->
x
.
getUserUuid
()).
collect
(
Collectors
.
toList
());
List
<
Integer
>
merchantIdList
=
strategyInfoList
.
stream
().
map
(
x
->
x
.
getMerchantId
()).
collect
(
Collectors
.
toList
());
RpcPagination
<
StaffInfoDTO
>
pagination
=
new
RpcPagination
<>();
pagination
.
setPageNum
(
1
);
pagination
.
setPageSize
(
staffList
.
size
());
StaffInfoDTO
staffInfoDTO
=
new
StaffInfoDTO
();
staffInfoDTO
.
setStaffUuidList
(
userUuidList
);
staffInfoDTO
.
setMerchantIdList
(
merchantIdList
);
staffInfoDTO
.
setSceneType
(
sceneType
);
List
<
Integer
>
postList
=
staffList
.
stream
().
map
(
StrategyStaffRel:
:
getUserPosition
).
distinct
().
collect
(
Collectors
.
toList
());
staffInfoDTO
.
setPositionTypeList
(
postList
);
pagination
.
setCondition
(
staffInfoDTO
);
RpcResponse
<
RpcPagination
<
StaffInfoDTO
>>
response
=
staffInfoRemote
.
listMultipleRolesStaffWithPage
(
pagination
);
if
(
response
.
hasError
())
{
log
.
error
(
"创建策略,查询人员失败, response: {}"
,
response
);
throw
new
RpcServiceException
(
DefaultErrorEnum
.
RPC_ERROR
,
response
.
getMessage
());
}
Map
<
String
,
StaffInfoDTO
>
userMap
=
new
HashMap
<>();
if
(
response
.
getResult
()
!=
null
&&
CollectionUtils
.
isNotEmpty
(
response
.
getResult
().
getList
()))
{
//以 staff_uuid +positionType 为key 构建map
userMap
=
response
.
getResult
().
getList
().
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getStaffUuid
()
+
x
.
getPositionType
(),
x
->
x
,
(
oldVal
,
newVal
)
->
newVal
));
}
return
userMap
;
}
/**
* 根据策略id删除关联关系
* @param strategyId
...
...
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