Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
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
fangxinjiang
yifu-mvp
Commits
348cf714
Commit
348cf714
authored
May 06, 2025
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化-fxj
parent
79a48d60
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
7 deletions
+33
-7
TInsuranceWarnServiceImpl.java
...ces/service/insurance/impl/TInsuranceWarnServiceImpl.java
+33
-7
No files found.
yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/service/insurance/impl/TInsuranceWarnServiceImpl.java
View file @
348cf714
...
...
@@ -96,19 +96,45 @@ public class TInsuranceWarnServiceImpl extends ServiceImpl<TInsuranceWarnMapper,
log
.
error
(
"商险不购买提醒初始化停用客服异常:"
,
e
);
}
//处理已经离职数据,分批请求,每次请求1000条数据,返回在职人员信息
R
<
Set
<
String
>>
onlineSet
;
R
<
Set
<
String
>>
onlineSetTemp
=
new
R
<>();
if
(
list
.
size
()
<=
1
000
){
if
(
list
.
size
()
<=
2
000
){
onlineSetTemp
=
archivesDaprUtil
.
getEmpOnlineMap
(
list
.
stream
().
map
(
TInsuranceAlert:
:
getEmpIdcardNo
).
collect
(
Collectors
.
toList
()));
}
else
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
if
(
i
%
1000
==
0
)
{
onlineSet
=
archivesDaprUtil
.
getEmpOnlineMap
(
list
.
stream
().
map
(
TInsuranceAlert:
:
getEmpIdcardNo
).
collect
(
Collectors
.
toList
()));
if
(
null
!=
onlineSet
&&
Common
.
isNotNull
(
onlineSet
.
getData
()))
{
onlineSetTemp
.
getData
().
addAll
(
onlineSet
.
getData
());
// 提前提取身份证号列表,避免重复 stream 操作
List
<
String
>
idCardNoList
=
list
.
stream
()
.
map
(
TInsuranceAlert:
:
getEmpIdcardNo
)
.
collect
(
Collectors
.
toList
());
int
batchSize
=
2000
;
int
totalSize
=
idCardNoList
.
size
();
// 初始化 onlineSetTemp,防止 NullPointerException
if
(
onlineSetTemp
==
null
)
{
onlineSetTemp
=
new
R
<>();
// 替换为实际类型
}
R
<
Set
<
String
>>
onlineSet
;
Set
<
String
>
temp
=
new
HashSet
<>();
for
(
int
i
=
0
;
i
<
totalSize
;
i
++)
{
if
(
i
%
batchSize
==
0
)
{
// 计算当前批次的结束索引
int
end
=
Math
.
min
(
i
+
batchSize
,
totalSize
);
// 获取当前批次的数据
List
<
String
>
subList
=
idCardNoList
.
subList
(
i
,
end
);
// 调用接口获取在职人员信息
onlineSet
=
archivesDaprUtil
.
getEmpOnlineMap
(
subList
);
// 判空处理
if
(
onlineSet
!=
null
&&
onlineSet
.
getData
()
!=
null
&&
Common
.
isNotNull
(
onlineSet
.
getData
()))
{
temp
.
addAll
(
onlineSet
.
getData
());
}
}
}
if
(
temp
!=
null
){
onlineSetTemp
.
setData
(
temp
);
}
}
//如果不存在离职人员直接走生成逻辑
if
(
Common
.
isNotKong
(
onlineSetTemp
.
getData
())){
...
...
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