国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

開源一套文本處理工具:Java+Bat腳本實(shí)現(xiàn)自動(dòng)批量處理對(duì)賬單工具

這篇具有很好參考價(jià)值的文章主要介紹了開源一套文本處理工具:Java+Bat腳本實(shí)現(xiàn)自動(dòng)批量處理對(duì)賬單工具。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

原創(chuàng)/朱季謙

這款工具是筆者在2018年初開發(fā)完成的,時(shí)隔兩載,偶然想起這款小工具,于是,決定將其開源,若有人需要做類似Java批處理實(shí)現(xiàn)整理文檔的工具,可參考該工具邏輯思路來實(shí)現(xiàn)。

該工具是運(yùn)行在windos系統(tǒng)上的,基于bat腳本與jar包形式協(xié)同運(yùn)行。當(dāng)時(shí)開發(fā)該工具的背景是,需要每天定時(shí)處理大批量的對(duì)賬單txt文本信息,將其統(tǒng)一整合到一張Excel文檔上,供會(huì)計(jì)人員獲取。在沒有該工具之前,項(xiàng)目組上的會(huì)計(jì)人員,需要每天手動(dòng)打開大量txt文本,并從每份txt文檔里,復(fù)制所需信息,然后將獲取到的信息再復(fù)制到一份當(dāng)日的Excel文檔里。這個(gè)過程根據(jù)對(duì)賬單數(shù)量而定,若數(shù)量過多,手動(dòng)整理就需花費(fèi)大量時(shí)間,且過程重復(fù)操作?;谶@個(gè)原因,當(dāng)時(shí)就開發(fā)了這款小工具,供會(huì)計(jì)人員使用,其帶來的效果是,節(jié)省了大量整理時(shí)間:會(huì)計(jì)人員只需把每天郵件收到的批量對(duì)賬單txt文件,統(tǒng)一放到指定目錄下,點(diǎn)擊start啟動(dòng)腳本,就可一鍵自動(dòng)批量處理完成。

這個(gè)工具在當(dāng)時(shí)的工作環(huán)境下,是行之有效的,但若換到另一種領(lǐng)域或者環(huán)境,還需二次開發(fā)做修改。工具整體實(shí)現(xiàn)的邏輯并不復(fù)雜,筆者只提供一種解決文檔重復(fù)整理工作的小思路,僅做參考學(xué)習(xí)之用,畢竟,解決問題的本質(zhì)不在于工具,而在于思路。

下面,就圍繞著業(yè)務(wù)與具體實(shí)現(xiàn)來結(jié)束該自動(dòng)處理工具。

整體結(jié)構(gòu)如下:

開源一套原創(chuàng)文本處理工具:Java+Bat腳本實(shí)現(xiàn)自動(dòng)批量處理對(duì)賬單工具,開源,java,python

1.對(duì)賬單:將同類型對(duì)賬單批量放入到對(duì)賬單文件夾中,同類,即格式幾乎一樣,但數(shù)據(jù)不一樣,如下所示:

開源一套原創(chuàng)文本處理工具:Java+Bat腳本實(shí)現(xiàn)自動(dòng)批量處理對(duì)賬單工具,開源,java,python

2.對(duì)賬單集處理結(jié)果:批量處理獲取到的數(shù)據(jù),會(huì)統(tǒng)一寫入到一份自動(dòng)生成的Excel文檔里,該文檔存放在“對(duì)賬單集處理結(jié)果”目錄底下;

3.Auto.jar:由Java語言開發(fā)的jar包,通過循環(huán)讀取各txt文本數(shù)據(jù),從讀取文本指定字段數(shù)據(jù),截取其名字與對(duì)應(yīng)保證金、可用資金,再寫入到自動(dòng)生成的Excel文檔里。

4.CopyName.bat:bat腳本,將本目錄下的txt文件名批量寫入到“對(duì)賬單批量名字集合.txt”;

CopyName.bat如下:

1 @dir /a-d /b *.txt>對(duì)賬單批量名字集合.txt

5.Start.bat:bat腳本,主要實(shí)現(xiàn)是,將CopyName.bat和“對(duì)賬單批量名字集合.txt”都復(fù)制到“對(duì)賬單”目錄,然后執(zhí)行CopyName.bat,將該目錄底下的所有.txt后綴的文件名,寫入到“對(duì)賬單批量名字集合.txt”,再啟動(dòng)Auto.jar包,該jar會(huì)去“對(duì)賬單批量名字集合.txt”獲取所在目錄下各txt文檔名字,再根據(jù)這些名字去讀取對(duì)應(yīng)的txt文檔。

Start.bat主要代碼如下:

1 @echo off
2 copy /y CopyName.bat 對(duì)賬單
3 copy /y 對(duì)賬單批量名字集合.txt 對(duì)賬單
4 cd D:\批量處理對(duì)賬單\對(duì)賬單
5 call CopyName.bat
6 java -jar D:\批量處理對(duì)賬單\Auto.jar

綜上,業(yè)務(wù)人員只需把對(duì)賬單統(tǒng)一放入到“對(duì)賬單”目錄下:

開源一套原創(chuàng)文本處理工具:Java+Bat腳本實(shí)現(xiàn)自動(dòng)批量處理對(duì)賬單工具,開源,java,python

點(diǎn)擊Start.bat啟動(dòng),就可得到以下指定數(shù)據(jù)的統(tǒng)一獲?。?/p>

開源一套原創(chuàng)文本處理工具:Java+Bat腳本實(shí)現(xiàn)自動(dòng)批量處理對(duì)賬單工具,開源,java,python

接下來,就具體分享一下Java部分的邏輯實(shí)現(xiàn):

代碼結(jié)構(gòu)

開源一套原創(chuàng)文本處理工具:Java+Bat腳本實(shí)現(xiàn)自動(dòng)批量處理對(duì)賬單工具,開源,java,python

以maven進(jìn)行jar依賴,主要有Datas、ExportExcelBase、ExportExcleClient、PutExcel四個(gè)類。

1.引入依賴

 1 <dependencies>
 2      <dependency>
 3          <groupId>org.apache.poi</groupId>
 4          <artifactId>poi</artifactId>
 5          <version>3.10-FINAL</version>
 6      </dependency>
 7      <dependency>
 8          <groupId>org.projectlombok</groupId>
 9          <artifactId>lombok</artifactId>
10          <version>1.18.2</version>
11      </dependency>
12 </dependencies>

2.設(shè)置導(dǎo)出基本類,根據(jù)需生成的Excel展示數(shù)據(jù)設(shè)置,筆者案例里只需展示“組合名”,“保證金占用金額”,“可用資金額”三個(gè)字段,故只需設(shè)置name,margin,avaFunds來接受獲取到的值;

 1 package com.put.data;
 2 import lombok.Data;
 3 ?
 4 /**
 5  * 導(dǎo)出數(shù)據(jù)類
 6  * @author zhujiqian
 7  * @date 2020/10/27 20:09
 8  */
 9 @Data
10 public class Datas {
11     //名字
12     private String name;
13     //保證金
14     private String margin;
15     //可用資金
16     private String avaFunds;
17     
18     public Datas(String name, String margin, String avaFunds) {
19         this.name = name;
20         this.margin = margin;
21         this.avaFunds = avaFunds;
22    }
23 ?
24 }

3.設(shè)置Excel表格生成類

  1 package com.put.put;
  2 ?
  3 import org.apache.poi.hssf.usermodel.*;
  4 import org.apache.poi.hssf.util.Region;
  5 ?
  6 import java.io.File;
  7 import java.io.FileNotFoundException;
  8 import java.io.FileOutputStream;
  9 import java.io.IOException;
 10 ?
 11 /**
 12  * HSSF - 提供讀寫Microsoft Excel格式檔案的功能。
 13  *
 14  * XSSF - 提供讀寫Microsoft Excel OOXML格式檔案的功能。
 15  *
 16  * @author zhujiqian
 17  * @date 2020/10/27 20:33
 18  */
 19 public class ExportExcelBase {
 20     private HSSFWorkbook hwb=null;
 21     private HSSFSheet sheet=null;
 22     public ExportExcelBase(HSSFWorkbook hwb,HSSFSheet sheet){
 23         this.hwb=hwb;
 24         this.sheet=sheet;
 25    }
 26     public HSSFWorkbook getHwb() {
 27         return hwb;
 28    }
 29     public void setHwb(HSSFWorkbook hwb) {
 30         this.hwb = hwb;
 31    }
 32     public HSSFSheet getSheet() {
 33         return sheet;
 34    }
 35     public void setSheet(HSSFSheet sheet) {
 36         this.sheet = sheet;
 37    }
 38 ?
 39     /**
 40      * 創(chuàng)建設(shè)置表格頭
 41      */
 42     public void createNormalHead(String headString,int colSum){
 43         //創(chuàng)建表格標(biāo)題行,第一行
 44         HSSFRow row=this.sheet.createRow(0);
 45         //創(chuàng)建指定行的列,第一列
 46         HSSFCell cell=row.createCell(0);
 47         //設(shè)置標(biāo)題行默認(rèn)行高
 48         row.setHeight((short) 500);
 49         //設(shè)置表格內(nèi)容類型:0-數(shù)值型;1-字符串;2-公式型;3-空值;4-布爾型;5-錯(cuò)誤
 50         cell.setCellType(1);
 51         //設(shè)置表格標(biāo)題內(nèi)容
 52         cell.setCellValue(new HSSFRichTextString(headString));
 53         // 指定合并區(qū)域
 54         this.sheet.addMergedRegion(new Region(0, (short)0, 0, (short)colSum));
 55         // 定義單元格格式,添加單元格表樣式,并添加到工作簿
 56         HSSFCellStyle cellStyle=this.hwb.createCellStyle();
 57         // 設(shè)置單元格水平對(duì)齊居中類型
 58         cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
 59         // 指定單元格垂直居中對(duì)齊
 60         cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
 61         // 指定單元格自動(dòng)換行
 62         cellStyle.setWrapText(true);
 63         //設(shè)置字體
 64         HSSFFont font=this.hwb.createFont();
 65         font.setBoldweight((short) 700);
 66         font.setFontName("宋體");
 67         font.setFontHeight((short) 300);
 68         cellStyle.setFont(font);
 69         cell.setCellStyle(cellStyle);
 70    }
 71 ?
 72     /**
 73      *表單第二行
 74      * @param params
 75      * @param colSum
 76      */
 77     public void createNormalTwoRow(String[] params,int colSum){
 78         HSSFRow row1=this.sheet.createRow(1);
 79         row1.setHeight((short) 300);
 80         HSSFCell cell2=row1.createCell(0);
 81         cell2.setCellType(1);
 82         cell2.setCellValue(new HSSFRichTextString("統(tǒng)計(jì)時(shí)間"+params[0]+"至"+params[1]));
 83         this.sheet.addMergedRegion(new Region(1, (short) 0,1,(short)colSum));
 84         HSSFCellStyle cellStyle=this.hwb.createCellStyle();
 85         cellStyle.setAlignment((short) 2);
 86         cellStyle.setVerticalAlignment((short) 1);
 87         cellStyle.setWrapText(true);
 88         HSSFFont font=this.hwb.createFont();
 89         font.setBoldweight((short) 700);
 90         font.setFontName("宋體");
 91         font.setFontHeight((short) 250);
 92         cellStyle.setFont(font);
 93         cell2.setCellStyle(cellStyle);
 94    }
 95 ?
 96 ?
 97     /**
 98      * 表單內(nèi)容
 99      * @param wb
100      * @param row
101      * @param col
102      * @param align
103      * @param val
104      */
105     public void cteateCell(HSSFWorkbook wb, HSSFRow row, int col, short align, String val) {
106         HSSFCell cell = row.createCell(col);
107         cell.setCellType(1);
108         cell.setCellValue(new HSSFRichTextString(val));
109         HSSFCellStyle cellstyle = wb.createCellStyle();
110         cellstyle.setAlignment(align);
111         cell.setCellStyle(cellstyle);
112    }
113 ?
114 ?
115     /**
116      * 文檔輸出流
117      * @param fileName
118      */
119     public void outputExcle(String fileName) {
120         FileOutputStream fos = null;
121         try {
122             fos = new FileOutputStream(new File(fileName));
123             this.hwb.write(fos);
124             fos.close();
125        } catch (FileNotFoundException var4) {
126             var4.printStackTrace();
127        } catch (IOException var5) {
128             var5.printStackTrace();
129        }
130    }
131 }

4.設(shè)置Excel根據(jù)數(shù)據(jù)導(dǎo)出類

1 package com.put.put;
 2 ?
 3 ?
 4 import com.put.data.Datas;
 5 import org.apache.poi.hssf.usermodel.*;
 6 ?
 7 import java.text.SimpleDateFormat;
 8 import java.util.Date;
 9 import java.util.List;
10 ?
11 /**
12  * TODO
13  *
14  * @author zhujiqian
15  * @date 2020/10/27 20:24
16  */
17 public class ExportExcleClient {
18     private HSSFWorkbook hwb=null;
19     private HSSFSheet sheet=null;
20 ?
21     ExportExcelBase exportExcel = null;
22     SimpleDateFormat df = new SimpleDateFormat("yyyy年MM月dd日");
23 ?
24     public ExportExcleClient() {
25         this.hwb = new HSSFWorkbook();
26         this.exportExcel = new ExportExcelBase(this.hwb, this.sheet);
27    }
28 ?
29     /**
30      * 導(dǎo)出Excel
31      * @return
32      */
33     public String exportExcel() {
34         String a = this.df.format(new Date()) + "對(duì)賬單集合.xls";
35         String b = "D:\\批量處理對(duì)賬單\\對(duì)賬單集處理結(jié)果\\" + a;
36         this.exportExcel.outputExcle(b);
37         return b;
38    }
39 ?
40     /**
41      * 設(shè)置導(dǎo)出格式
42      * @param data
43      * @return
44      */
45     public String alldata(List<Datas> data) {
46         if (data.size() != 0) {
47             this.sheet = this.exportExcel.getHwb().createSheet("對(duì)賬單集合");
48             this.exportExcel.setSheet(this.sheet);
49             int number = 2;
50 ?
51             for(int i = 0; i < number; ++i) {
52                 this.sheet.setColumnWidth(i, 8000);
53            }
54 ?
55             HSSFCellStyle cellStyle = this.hwb.createCellStyle();
56             cellStyle.setAlignment((short)2);
57             cellStyle.setVerticalAlignment((short)1);
58             cellStyle.setWrapText(true);
59             HSSFFont font = this.hwb.createFont();
60             font.setBoldweight((short)700);
61             font.setFontName("宋體");
62             font.setFontHeight((short)200);
63             cellStyle.setFont(font);
64             this.exportExcel.createNormalHead("對(duì)賬單整合表", number);
65             String[] params = new String[]{this.df.format(new Date()), this.df.format(new Date())};
66             this.exportExcel.createNormalTwoRow(params, number);
67             HSSFRow row2 = this.sheet.createRow(2);
68             HSSFCell cell0 = row2.createCell(0);
69             cell0.setCellStyle(cellStyle);
70             cell0.setCellValue(new HSSFRichTextString("組合名"));
71             HSSFCell cell1 = row2.createCell(1);
72             cell1.setCellStyle(cellStyle);
73             cell1.setCellValue(new HSSFRichTextString("保證金占用金額"));
74             HSSFCell cell2 = row2.createCell(2);
75             cell2.setCellStyle(cellStyle);
76             cell2.setCellValue(new HSSFRichTextString("可用資金額"));
77 ?
78             for(int i = 0; i < data.size(); ++i) {
79                 System.out.println("==============" + ((Datas)data.get(i)).getName() + " " + ((Datas)data.get(i)).getMargin() + " " + ((Datas)data.get(i)).getAvaFunds());
80                 HSSFRow row = this.sheet.createRow((short)i + 3);
81                 this.exportExcel.cteateCell(this.hwb, row, 0, (short)6, ((Datas)data.get(i)).getName());
82                 this.exportExcel.cteateCell(this.hwb, row, 1, (short)6, ((Datas)data.get(i)).getMargin());
83                 this.exportExcel.cteateCell(this.hwb, row, 2, (short)6, ((Datas)data.get(i)).getAvaFunds());
84            }
85        }
86 ?
87         return "";
88    }
89 }

5.批量讀取txt文本截取指定數(shù)據(jù)類

  1 package com.put;
  2 ?
  3 import com.put.data.Datas;
  4 import com.put.put.ExportExcleClient;
  5 import java.io.*;
  6 import java.util.ArrayList;
  7 import java.util.List;
  8 ?
  9 /**
 10  * TODO
 11  *
 12  * @author zhujiqian
 13  * @date 2020/10/27 20:08
 14  */
 15 public class PutExcel {
 16     public PutExcel() {
 17    }
 18     public static List<String> readTxtFile1(String TxtName, String filePath) {
 19         ArrayList list = new ArrayList();
 20         try {
 21             System.out.println("該組合:" + TxtName);
 22             File file = new File(filePath);
 23             if (file.isFile() && file.exists()) {
 24                 InputStreamReader read = new InputStreamReader(new FileInputStream(file), "GBK");
 25                 BufferedReader bufferedReader = new BufferedReader(read);
 26                 String lineTxt = null;
 27 ?
 28                 while(true) {
 29                     do {
 30                         if ((lineTxt = bufferedReader.readLine()) == null) {
 31                             read.close();
 32                             return list;
 33                        }
 34                    } while(!lineTxt.contains("持倉保證金:") && !lineTxt.contains("保證金占用:") && !lineTxt.contains("保證金占用 Margin Occupied:") && !lineTxt.contains("保證金占用 Margin Occupied:"));
 35                     String ZiJin;
 36                     int a;
 37                     String b;
 38                     int c;
 39                     String d;
 40                     int e;
 41                     int f;
 42                     String E;
 43                     if (lineTxt.contains("持倉保證金:")) {
 44                         ZiJin = lineTxt.replace(" ", "");
 45                         a = ZiJin.indexOf("持");
 46                         b = ZiJin.substring(a);
 47                         c = b.indexOf(".");
 48                         d = b.substring(0, c + 3);
 49                         e = d.indexOf(":");
 50                         f = d.length();
 51                         E = d.substring(e + 1, f);
 52                         list.add(E);
 53                    } else if (lineTxt.contains("保證金占用:")) {
 54                         ZiJin = lineTxt.replace(" ", "");
 55                         a = ZiJin.indexOf("保");
 56                         b = ZiJin.substring(a);
 57                         c = b.indexOf(".");
 58                         d = b.substring(0, c + 3);
 59                         e = d.indexOf(":");
 60                         f = d.length();
 61                         E = d.substring(e + 1, f);
 62                         list.add(E);
 63                    } else if (lineTxt.contains("保證金占用 Margin Occupied:")) {
 64                         ZiJin = lineTxt.replace(" ", "");
 65                         a = ZiJin.indexOf("保");
 66                         b = ZiJin.substring(a);
 67                         c = b.indexOf(".");
 68                         d = b.substring(0, c + 3);
 69                         e = d.indexOf(":");
 70                         f = d.length();
 71                         E = d.substring(e + 1, f);
 72                         list.add(E);
 73                    } else if (lineTxt.contains("保證金占用 Margin Occupied:")) {
 74                         ZiJin = lineTxt.replace(" ", "");
 75                         a = ZiJin.indexOf("保");
 76                         b = ZiJin.substring(a);
 77                         c = b.indexOf(".");
 78                         d = b.substring(0, c + 3);
 79                         e = d.indexOf(":");
 80                         f = d.length();
 81                         E = d.substring(e + 1, f);
 82                         list.add(E);
 83                    }
 84                }
 85            } else {
 86                 System.out.println("找不到指定的文件");
 87            }
 88        } catch (Exception var16) {
 89             System.out.println("讀取文件內(nèi)容出錯(cuò)");
 90             var16.printStackTrace();
 91        }
 92         return list;
 93    }
 94     public static List<String> readTxtFile2(String TxtName, String filePath) {
 95         ArrayList list = new ArrayList();
 96 ?
 97         try {
 98 ?
 99             System.out.println("該組合:" + TxtName);
100             File file = new File(filePath);
101             if (file.isFile() && file.exists()) {
102                 InputStreamReader read = new InputStreamReader(new FileInputStream(file), "GBK");
103                 BufferedReader bufferedReader = new BufferedReader(read);
104                 String lineTxt = null;
105 ?
106                 while(true) {
107                     do {
108                         if ((lineTxt = bufferedReader.readLine()) == null) {
109                             read.close();
110                             return list;
111                        }
112                    } while(!lineTxt.contains("可用資金:") && !lineTxt.contains("可用資金 Fund Avail.:") && !lineTxt.contains("可用資金 Fund Avail.:"));
113                     String ZiJin;
114                     int a;
115                     String b;
116                     int c;
117                     String d;
118                     int e;
119                     int f;
120                     String E;
121                     if (lineTxt.contains("可用資金:")) {
122                         ZiJin = lineTxt.replace(" ", "");
123                         ZiJin = lineTxt.replace(" ", "");
124                         a = ZiJin.indexOf("可");
125                         b = ZiJin.substring(a);
126                         c = b.indexOf(".");
127                         d = b.substring(0, c + 3);
128                         e = d.indexOf(":");
129                         f = d.length();
130                         E = d.substring(e + 1, f);
131                         list.add(E);
132                    } else if (lineTxt.contains("可用資金 Fund Avail.:")) {
133                         ZiJin = lineTxt.replace(" ", "");
134                         ZiJin = lineTxt.replace(" ", "");
135                         a = ZiJin.indexOf("可");
136                         b = ZiJin.substring(a);
137                         c = b.lastIndexOf(".");
138                         d = b.substring(0, c + 3);
139                         e = d.indexOf(":");
140                         f = d.length();
141                         E = d.substring(e + 1, f);
142                         list.add(E);
143                    } else if (lineTxt.contains("可用資金 Fund Avail.:")) {
144                         lineTxt.replace(" ", "");
145                         ZiJin = lineTxt.replace(" ", "");
146                         a = ZiJin.indexOf("可");
147                         b = ZiJin.substring(a);
148                         c = b.lastIndexOf(".");
149                         d = b.substring(0, c + 3);
150                         e = d.indexOf(":");
151                         f = d.length();
152                         E = d.substring(e + 1, f);
153                         list.add(E);
154                    }
155                }
156            } else {
157                 System.out.println("找不到指定的文件");
158            }
159        } catch (Exception var16) {
160             System.out.println("讀取文件內(nèi)容出錯(cuò)");
161             var16.printStackTrace();
162        }
163 ?
164         return list;
165    }
166 ?
167     public static void main(String[] argv) {
168         String path = "D:\\批量處理對(duì)賬單\\對(duì)賬單\\對(duì)賬單批量名字集合.txt";
169         List<String> nums = writeToDat(path);
170         List<Datas> listData = new ArrayList();
171         for(int i = 0; i < nums.size(); ++i) {
172             if (!(nums.get(i)).equals("對(duì)賬單批量名字集合.txt")) {
173                 listData.add(ZuHe(nums.get(i)));
174                 System.out.println("--------==========" + ZuHe(nums.get(i)));
175            }
176        }
177 ?
178         System.out.println("-----------" + listData);
179         ExportExcleClient client = new ExportExcleClient();
180         client.alldata(listData);
181         String url = client.exportExcel();
182         System.out.println(url);
183    }
184 ?
185     public static Datas ZuHe(String TxtName) {
186         String address = "D:\\批量處理對(duì)賬單\\對(duì)賬單\\" + TxtName;
187         List<String> r1 = readTxtFile1(TxtName, address);
188         List<String> r2 = readTxtFile2(TxtName, address);
189         int c = TxtName.indexOf(".");
190         String txt = TxtName.substring(0, c);
191         System.out.println(txt);
192         System.out.println(r1);
193         Datas d = null;
194         if (r1.isEmpty() && r2.isEmpty()) {
195             if (r1.isEmpty() && r2.isEmpty()) {
196                 System.out.println(txt + "--" + r1 + "---" + r2);
197                 d = new Datas(txt, "無", "無");
198            }
199        } else {
200             d = new Datas(txt, r1.get(0), r2.get(0));
201        }
202         return d;
203    }
204     public static List<String> writeToDat(String path) {
205         File file = new File(path);
206         ArrayList list = new ArrayList();
207         try {
208             String encoding = "GBK";
209             InputStreamReader read = new InputStreamReader(new FileInputStream(file), encoding);
210             BufferedReader bw = new BufferedReader(read);
211             String line = null;
212 ?
213             while((line = bw.readLine()) != null) {
214                 list.add(line);
215            }
216             bw.close();
217        } catch (IOException var7) {
218             var7.printStackTrace();
219        }
220         return list;
221    }
222 }

以上的代碼,大部分都是在2018年左右寫成,現(xiàn)再閱讀,代碼風(fēng)格甚為稚嫩。我沒有做大的修改,原因是,想要留住這些代碼最初的樣子,就像留住剛畢業(yè)那會(huì)的記憶一般。整體實(shí)現(xiàn)邏輯并不算復(fù)雜,但再簡(jiǎn)單的東西,能解決問題,都是值得分享的東西。在此基礎(chǔ)上,還可繼續(xù)完善與擴(kuò)展,給需要用到的業(yè)務(wù)人員帶來方便。

這是我開源的第一個(gè)小工具,以此為勵(lì),在以后的日子里,要更加深入地學(xué)習(xí),并將所學(xué)與所得,多多分享。在我看來,輸入的東西,不一定是自己的,但輸出的,一定是自己的。

這,就是我喜歡輸出的原因之一。

最后,附上第一個(gè)github源碼鏈接:https://github.com/z924931408/auto-put-tool文章來源地址http://www.zghlxwxcb.cn/news/detail-779829.html

到了這里,關(guān)于開源一套文本處理工具:Java+Bat腳本實(shí)現(xiàn)自動(dòng)批量處理對(duì)賬單工具的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • BAT 批處理腳本教程

    第一節(jié) 常用批處理內(nèi)部命令簡(jiǎn)介 批處理定義:顧名思義,批處理文件是將一系列命令按一定的順序集合為一個(gè)可執(zhí)行的文本文件,其擴(kuò)展名為BAT或者CMD。這些命令統(tǒng)稱批處理命令。 小知識(shí):可以在鍵盤上按下Ctrl+C組合鍵來強(qiáng)行終止一個(gè)批處理的執(zhí)行過程。 了解了大概意思后

    2024年02月02日
    瀏覽(29)
  • 超詳細(xì) 批處理文件腳本(bat) 教程(持續(xù)更新)

    超詳細(xì) 批處理文件腳本(bat) 教程(持續(xù)更新)

    ?目錄 前言 (1)使用echo輸出字符串 (2)使用echo拼接字符串 i)沒有變量,直接拼接 ii)有變量,拼接變量 ?(3)只想打印結(jié)果,不想顯示回顯,可以用@echo off (4)pause 作用是將dos界面暫停關(guān)閉 (5)title標(biāo)識(shí)符,用來設(shè)置dos的標(biāo)題 (6)rem用于注釋,bat腳本

    2024年02月02日
    瀏覽(42)
  • BAT批處理腳本自動(dòng)執(zhí)行指定路徑下程序

    BAT批處理腳本自動(dòng)執(zhí)行指定路徑下程序

    需求來源: 使用nacos+springboot的微服務(wù)架構(gòu),每次跑程序前要先啟動(dòng)nacos比較麻煩,然后就寫了個(gè)簡(jiǎn)單的批處理,雙擊直接打開一個(gè)cmd執(zhí)行nacos啟動(dòng)命令; 知識(shí)點(diǎn): 1. start cmd /k? ? 啟動(dòng)一個(gè)CMD且不關(guān)閉cmd 2.start cmd /c? ? 啟動(dòng)一個(gè)CMD且關(guān)閉cmd 3.? start cmd /k? \\\"命令1 命令2 命令3\\\"

    2024年02月16日
    瀏覽(31)
  • 【bat批處理】bat腳本編寫:循環(huán),間隔,定時(shí)自動(dòng)獲取TCP連接并寫入本地文件

    【bat批處理】bat腳本編寫:循環(huán),間隔,定時(shí)自動(dòng)獲取TCP連接并寫入本地文件

    情景 需要固定時(shí)間間隔比如60秒運(yùn)行一次檢測(cè)TCP連接數(shù),網(wǎng)上查了下最簡(jiǎn)單的就是用 goto 語句,如果不加延時(shí)那就是死循環(huán),在文件里面加上延時(shí)變量SETLOCAL ENABLEDELAYEDEXPANSION 延時(shí)間隔語句為choice /t 60 /d y /n nul 。下面的批處理作用就是每隔60秒獲取一次tcp連接數(shù),并寫入txt文

    2024年02月15日
    瀏覽(20)
  • 批處理批量替換文本內(nèi)容,用bat代碼全篇替換txt文本文件中指定字符信息

    批處理批量全篇替換txt文本文件中指定字符信息,修改三個(gè)參數(shù)后即可使用,話不多說直接上代碼: @echo off setlocal EnableDelayedExpansion set path_str=\\\"C:UsersAdministratorDesktop1.txt\\\" set old_str=需要替換的原文本內(nèi)容 set new_str=替換后的文本內(nèi)容 set souerce_path=%path_str% for /f \\\"tokens=1* delims=

    2024年02月11日
    瀏覽(16)
  • 每日一記:一個(gè)windows的bat腳本工具集

    每日一記:一個(gè)windows的bat腳本工具集

    最近在工作上遇到要校驗(yàn)文件的問題,例如,下載了一個(gè)文件之后,通過查看文件的md5來校驗(yàn)文件是否完整,這個(gè)動(dòng)作在linux上很簡(jiǎn)單,但在windows上也不難,可以通過?certutil 命令實(shí)現(xiàn),該命令通??捎糜赪indows系統(tǒng)。 由上述問題引發(fā)的一個(gè)思考就是,是否可以把windows上的一

    2024年01月17日
    瀏覽(24)
  • 免費(fèi)開源的高精度OCR文本提取,支持 100 多種語言、自動(dòng)文本定位和腳本檢測(cè),幾行代碼即可實(shí)現(xiàn)離線使用(附源碼)

    免費(fèi)開源的高精度OCR文本提取,支持 100 多種語言、自動(dòng)文本定位和腳本檢測(cè),幾行代碼即可實(shí)現(xiàn)離線使用(附源碼)

    免費(fèi)開源的高精度OCR文本提取,支持 100 多種語言、自動(dòng)文本定位和腳本檢測(cè),幾行代碼即可實(shí)現(xiàn)離線使用(附源碼)。 要從圖像、照片中提取文本嗎?是否剛剛拍了講義的照片并想將其轉(zhuǎn)換為文本?那么您將需要一個(gè)可以通過 OCR(光學(xué)字符識(shí)別)識(shí)別文本的應(yīng)用程序。 圖

    2024年02月01日
    瀏覽(101)
  • bat腳本啟動(dòng)Java服務(wù)

    bat腳本啟動(dòng)Java服務(wù)

    Java項(xiàng)目一般會(huì)被打包成jar后啟動(dòng),在windows系統(tǒng)中可以通過終端窗口cmd啟動(dòng)jar包,即在jar包所在的目錄中打開cmd,或在cmd中進(jìn)入到j(luò)ar包目錄,執(zhí)行如下命令: 如果想指定jar包啟動(dòng)時(shí)用的配置文件,可用-Dspring.config.location指定配置文件路徑,這樣即可達(dá)到配置文件參數(shù)可修改的

    2024年02月13日
    瀏覽(42)
  • 開源一套快速部署程序的工具(CI/CD)

    開源一套快速部署程序的工具(CI/CD)

    隨著微服務(wù)越寫越多,程序發(fā)布就成了一個(gè)麻煩事,這里開源一個(gè)快速部署工具:Vela,只要填寫一個(gè)git地址、編譯命令等簡(jiǎn)單信息,就能自動(dòng)完成程序的部署。 代碼可在任意一臺(tái)電腦自動(dòng)完成編譯,再自動(dòng)上傳至服務(wù)器 可指定程序以Docker容器方式運(yùn)行 編譯命令采用終端運(yùn)行

    2024年02月04日
    瀏覽(16)
  • 使用java執(zhí)行bat、sh腳本文件

    在工作中,由于需求,需要完成讓java去調(diào)用.bat文件和.sh文件的操作,接下來開始編碼 此處用到了糊涂工具類 maven如下 由此代碼來執(zhí)行bat或sh腳本文件(PS:糊涂工具包用不用無所謂,只是用來判斷是否為windows系統(tǒng)的)

    2024年02月12日
    瀏覽(27)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包