소스 검색

代码重构

tom.xu@informa.com 2 년 전
부모
커밋
a4aadf21ef
1개의 변경된 파일9개의 추가작업 그리고 6개의 파일을 삭제
  1. 9 6
      src/main/java/ieven/server/webapp/domain/file/FileService.java

+ 9 - 6
src/main/java/ieven/server/webapp/domain/file/FileService.java

@@ -112,8 +112,10 @@ public class FileService {
             String nickname = ""; // 微信手机账单文件  添加一列 微信昵称  需要单独处理
             for (CSVRecord record : csvParser) {
               List<String> strings = record.toList();
+              List<String> strings2 = new ArrayList<>(strings);
               /*************      此处内容一下均为处理微信账单表头             ****************/
-              if (strings.size() == 1 && strings.get(0).equals("微信支付账单明细")) {
+              String join = String.join("", strings);
+              if (join.equals("微信支付账单明细")) {
                 wxFile = true;
               }
               if (wxFile && curRowWxFile < 16) {
@@ -126,19 +128,20 @@ public class FileService {
                 curRowWxFile++;
                 continue;
               }
-              if (wxFile && curRowWxFile == 16) {
-                strings.add(0, "微信昵称");
+              if (wxFile && curRowWxFile > 16) {
+                strings2.add(0, nickname);
                 curRowWxFile++;
               }
-              if (wxFile && curRowWxFile > 16) {
-                strings.add(0, nickname);
+              if (wxFile && curRowWxFile == 16) {
+                strings2.add(0, "微信昵称");
                 curRowWxFile++;
               }
+
               /*************      此处内容以上均为处理微信账单表头             ****************/
               mongoExcelService.getRows(
                   0,
                   curRow,
-                  strings.stream()
+                  strings2.stream()
                       .map(PublicStatic::removeAllSpecial)
                       .collect(Collectors.toList()));
               curRow++;