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
5acd40f1
Commit
5acd40f1
authored
Feb 22, 2023
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
实缴导入校验项目
parent
f3c6dda7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
62 deletions
+17
-62
TPaymentInfoServiceImpl.java
.../v1/yifu/social/service/impl/TPaymentInfoServiceImpl.java
+17
-62
No files found.
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TPaymentInfoServiceImpl.java
View file @
5acd40f1
...
...
@@ -800,8 +800,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
redisUtil
.
set
(
importSuccessKey
,
maerialRatio
,
360L
);
try
{
// 1.list.size()不足
partSize,
直接执行
if
(
list
.
size
()
<
partSize
)
{
// 1.list.size()不足
100时
直接执行
if
(
list
.
size
()
<
100
)
{
CompletableFuture
<
List
<
ErrorDetailVO
>>
listCompletableFuture
=
CompletableFuture
.
supplyAsync
(()
->
executeImportSocialList
(
user
,
list
,
areaMap
,
areaMap2
,
domainMap
,
paymentInfoPensionMap
,
paymentInfoBigMap
,
paymentInfoBirMap
,
...
...
@@ -810,13 +810,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
injuryMoneyMap
,
medicalMoneyMap
,
accrualMoneyMap
,
paymentInfoaccrualMap
),
yfSocialImportThreadPoolExecutor
);
completableFutureList
.
add
(
listCompletableFuture
);
}
// 2.list.size()大于partSize,循环分批执行
int
lastIdx
=
0
;
if
(
partSize
<=
list
.
size
())
{
// 处理第一个0位元素
final
List
<
TPaymentInfoVo
>
finalList
=
list
.
subList
(
0
,
1
);
}
else
{
int
j
=
25
;
for
(
int
i
=
0
;
i
<
100
;
i
=
i
+
25
)
{
// 单个线程每次执行25条
final
List
<
TPaymentInfoVo
>
finalList
=
list
.
subList
(
i
,
i
+
j
);
CompletableFuture
<
List
<
ErrorDetailVO
>>
listCompletableFuture
=
CompletableFuture
.
supplyAsync
(()
->
executeImportSocialList
(
user
,
finalList
,
areaMap
,
areaMap2
,
domainMap
,
paymentInfoPensionMap
,
paymentInfoBigMap
,
paymentInfoBirMap
,
...
...
@@ -825,50 +823,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
injuryMoneyMap
,
medicalMoneyMap
,
accrualMoneyMap
,
paymentInfoaccrualMap
),
yfSocialImportThreadPoolExecutor
);
completableFutureList
.
add
(
listCompletableFuture
);
lastIdx
=
1
;
for
(
int
i
=
1
;
i
<
list
.
size
();
i
++)
{
// partSize数量的list为一个执行单元
tempList
.
add
(
list
.
get
(
i
));
if
(
i
%
partSize
==
0
)
{
lastIdx
=
i
;
List
<
TPaymentInfoVo
>
finalTempList
=
tempList
;
CompletableFuture
<
List
<
ErrorDetailVO
>>
oneCompletableFuture
=
CompletableFuture
.
supplyAsync
(()
->
executeImportSocialList
(
user
,
finalTempList
,
areaMap
,
areaMap2
,
domainMap
,
paymentInfoPensionMap
,
paymentInfoBigMap
,
paymentInfoBirMap
,
paymentInfoMedicalMap
,
paymentInfoUnEmpMap
,
paymentInfoInjuryMap
,
errorMessageList
,
pensionMoneyMap
,
bigMoneyMap
,
unEmpMoneyMap
,
birMoneyMap
,
injuryMoneyMap
,
medicalMoneyMap
,
accrualMoneyMap
,
paymentInfoaccrualMap
),
yfSocialImportThreadPoolExecutor
);
completableFutureList
.
add
(
oneCompletableFuture
);
tempList
=
new
ArrayList
<>();
}
}
}
// 3.第2种方式执行完后,有余数的情况下,执行3
if
(
lastIdx
!=
0
)
{
tempList
=
new
ArrayList
<>();
if
(
lastIdx
==
1
)
{
for
(
int
i
=
lastIdx
;
i
<
list
.
size
();
i
++)
{
tempList
.
add
(
list
.
get
(
i
));
}
}
else
{
for
(
int
i
=
lastIdx
+
1
;
i
<
list
.
size
();
i
++)
{
tempList
.
add
(
list
.
get
(
i
));
}
lastIdx
+=
1
;
}
List
<
TPaymentInfoVo
>
finalTempList
=
tempList
;
CompletableFuture
<
List
<
ErrorDetailVO
>>
listCompletableFuture
=
CompletableFuture
.
supplyAsync
(()
->
executeImportSocialList
(
user
,
finalTempList
,
areaMap
,
areaMap2
,
domainMap
,
paymentInfoPensionMap
,
paymentInfoBigMap
,
paymentInfoBirMap
,
paymentInfoMedicalMap
,
paymentInfoUnEmpMap
,
paymentInfoInjuryMap
,
errorMessageList
,
pensionMoneyMap
,
bigMoneyMap
,
unEmpMoneyMap
,
birMoneyMap
,
injuryMoneyMap
,
medicalMoneyMap
,
accrualMoneyMap
,
paymentInfoaccrualMap
),
yfSocialImportThreadPoolExecutor
);
completableFutureList
.
add
(
listCompletableFuture
);
}
// 阻塞当前线程,等待所有的线程执行完毕
boolean
computeFlag
;
...
...
@@ -2116,7 +2071,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
redisUtil
.
set
(
importSuccessKey
,
maerialRatio
,
360L
);
try
{
// 1.list.size()不足
partSize,
直接执行
// 1.list.size()不足
100时
直接执行
if
(
list
.
size
()
<
100
)
{
CompletableFuture
<
ConcurrentHashMap
<
String
,
ErrorDetailVO
>>
listCompletableFuture
=
CompletableFuture
.
supplyAsync
(()
->
executeImportSocialListThree
(
list
,
areaMap
,
areaMap2
,
...
...
@@ -2129,7 +2084,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
else
{
int
j
=
25
;
for
(
int
i
=
0
;
i
<
100
;
i
=
i
+
25
)
{
//
partSize数量的list为一个执行单元
//
单个线程每次执行25条
List
<
TPaymentHeFeiVo
>
finalTempList1
=
list
.
subList
(
i
,
i
+
j
);
CompletableFuture
<
ConcurrentHashMap
<
String
,
ErrorDetailVO
>>
listCompletableFuture
=
CompletableFuture
.
supplyAsync
(()
->
executeImportSocialListThree
(
finalTempList1
...
...
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