Commit a1c1470b authored by wujipeng's avatar wujipeng
Browse files

解析excel优化

parent a745522e
...@@ -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;
} }
...@@ -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);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment