Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
邬吉朋
relation
Commits
a1c1470b
Commit
a1c1470b
authored
Aug 05, 2025
by
wujipeng
Browse files
解析excel优化
parent
a745522e
Changes
2
Show whitespace changes
Inline
Side-by-side
src/main/java/com/platform/model/entity/UserAccountEntity.java
View file @
a1c1470b
...
@@ -27,4 +27,6 @@ public class UserAccountEntity {
...
@@ -27,4 +27,6 @@ public class UserAccountEntity {
private
String
userName
;
private
String
userName
;
private
String
account
;
private
String
account
;
private
String
number
;
}
}
src/main/java/com/platform/service/impl/AnalysisServiceImpl.java
View file @
a1c1470b
...
@@ -268,15 +268,24 @@ public class AnalysisServiceImpl implements AnalysisService {
...
@@ -268,15 +268,24 @@ public class AnalysisServiceImpl implements AnalysisService {
if
(
StringUtils
.
isNotEmpty
(
folderName
))
{
if
(
StringUtils
.
isNotEmpty
(
folderName
))
{
String
userName
=
trimChineseNameFromFilename
(
folderName
);
String
userName
=
trimChineseNameFromFilename
(
folderName
);
if
(!
excelData
.
isEmpty
())
{
if
(!
excelData
.
isEmpty
())
{
List
<
String
>
paymentBankNames
=
excelData
.
stream
().
map
(
ExcelDataEntity:
:
getPaymentBankName
).
distinct
().
collect
(
Collectors
.
toList
());
//excelData转化成以paymentAccount为键paymentBankName为值的map
Map
<
String
,
String
>
groupedMap
=
excelData
.
stream
().
collect
(
Collectors
.
toMap
(
ExcelDataEntity:
:
getPaymentAccount
,
ExcelDataEntity:
:
getPaymentBankName
));
// List<String> paymentBankNames = excelData.stream().map(ExcelDataEntity::getPaymentBankName).distinct().collect(Collectors.toList());
List
<
UserAccountEntity
>
userAccountList
=
Lists
.
newArrayList
();
List
<
UserAccountEntity
>
userAccountList
=
Lists
.
newArrayList
();
for
(
String
paymentBankName
:
paymentBankNames
)
{
// for (String paymentBankName : paymentBankNames) {
// userAccountList.add(UserAccountEntity.builder()
// .userName(userName)
// .account(paymentBankName)
// .caseId(caseId)
// .build());
// }
groupedMap
.
forEach
((
paymentAccount
,
paymentBankName
)
->
userAccountList
.
add
(
UserAccountEntity
.
builder
()
userAccountList
.
add
(
UserAccountEntity
.
builder
()
.
userName
(
userName
)
.
userName
(
userName
)
.
account
(
paymentBankName
)
.
account
(
paymentBankName
)
.
caseId
(
caseId
)
.
caseId
(
caseId
)
.
build
());
.
number
(
paymentAccount
)
}
.
build
()));
userAccountService
.
saveUserBatch
(
userAccountList
);
userAccountService
.
saveUserBatch
(
userAccountList
);
}
}
}
}
...
...
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