Commit 7f0d7a8a authored by wujipeng's avatar wujipeng
Browse files

解析数据去除垃圾数据

parent d8846085
......@@ -141,15 +141,29 @@ public class AnalysisServiceImpl implements AnalysisService {
//保存excel数据,判断是否使用默认模板
if (!ObjectUtils.isEmpty(ExcelTemplate) && !filterIndex.isEmpty()) {
List<ExcelDataEntity> afterDeduplication = Lists.newArrayList();
List<ExcelDataEntity> afterDeduplication1 = Lists.newArrayList();
deduplicationData(excelDataMap, excelData, filterIndex);
//excelDataMap中的value传给afterDeduplication
excelDataMap.forEach(
(key, excelDatum) -> afterDeduplication.add(excelDatum)
);
excelDataService.saveBatch(afterDeduplication);
for (ExcelDataEntity excelDataEntity : afterDeduplication) {
if (StringUtils.isNotEmpty(excelDataEntity.getPayeeName()) && !"-".equals(excelDataEntity.getPayeeName())){
if(excelDataEntity.getPayeeName().contains("(个人)")){
excelDataEntity.setPayeeName(excelDataEntity.getPayeeName().replace("(个人)", ""));
afterDeduplication1.add(excelDataEntity);
}else if (excelDataEntity.getPayeeName().contains("(商户)")){
excelDataEntity.setPayeeName(excelDataEntity.getPayeeName().replace("(商户)", ""));
afterDeduplication1.add(excelDataEntity);
}else {
afterDeduplication1.add(excelDataEntity);
}
}
}
excelDataService.saveBatch(afterDeduplication1);
//保存无主用户
//afterDeduplication转换成payeeName的字符串集合并去重
List<String> payeeNameList = afterDeduplication.stream().map(ExcelDataEntity::getPayeeName).distinct().collect(Collectors.toList());
List<String> payeeNameList = afterDeduplication1.stream().map(ExcelDataEntity::getPayeeName).distinct().collect(Collectors.toList());
for (String s : payeeNameList) {
userList.add(UserEntity.builder()
.userName(s)
......@@ -159,10 +173,24 @@ public class AnalysisServiceImpl implements AnalysisService {
}
userService.saveUserBatch(userList);
} else {
excelDataService.saveBatch(excelData);
List<ExcelDataEntity> excelData1 = Lists.newArrayList();
for (ExcelDataEntity excelDataEntity : excelData) {
if (StringUtils.isNotEmpty(excelDataEntity.getPayeeName()) && !"-".equals(excelDataEntity.getPayeeName())){
if(excelDataEntity.getPayeeName().contains("(个人)")){
excelDataEntity.setPayeeName(excelDataEntity.getPayeeName().replace("(个人)", ""));
excelData1.add(excelDataEntity);
}else if (excelDataEntity.getPayeeName().contains("(商户)")){
excelDataEntity.setPayeeName(excelDataEntity.getPayeeName().replace("(商户)", ""));
excelData1.add(excelDataEntity);
}else {
excelData1.add(excelDataEntity);
}
}
}
excelDataService.saveBatch(excelData1);
//保存无主用户
//afterDeduplication转换成payeeName的字符串集合并去重
List<String> payeeNameList = excelData.stream().map(ExcelDataEntity::getPayeeName).distinct().collect(Collectors.toList());
List<String> payeeNameList = excelData1.stream().map(ExcelDataEntity::getPayeeName).distinct().collect(Collectors.toList());
for (String s : payeeNameList) {
userList.add(UserEntity.builder()
.userName(s)
......
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