保存进度
This commit is contained in:
		@@ -1,12 +1,3 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2025-03-16 00:35:09
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /cpicxim-huixiabao/.vscode/fileheader.template.js
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2023} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
/**
 | 
			
		||||
 * This file is generated by VSCode extension: Fileheader Pro
 | 
			
		||||
 */
 | 
			
		||||
@@ -26,10 +17,10 @@
 | 
			
		||||
 * @property {string} dirPath the directory path, relative to project root with POSIX path separator
 | 
			
		||||
 * @property {string} fileName filename with extension
 | 
			
		||||
 */
 | 
			
		||||
 
 | 
			
		||||
 | 
			
		||||
 /**
 | 
			
		||||
 * @typedef {string | number | null | undefined | Template | boolean} TemplateInterpolation NOTE: boolean or falsy value will render empty string
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * @typedef {{ strings: TemplateStringsArray; interpolations: TemplateInterpolation[]; }} Template
 | 
			
		||||
 * @typedef {(strings: TemplateStringsArray, ...values: any[]) => string} ITemplateFunction
 | 
			
		||||
 *
 | 
			
		||||
@@ -71,14 +62,14 @@ class CustomLanguageProvider extends globalThis.FileheaderLanguageProvider {
 | 
			
		||||
    // prettier-ignore
 | 
			
		||||
    return tpl
 | 
			
		||||
`/**
 | 
			
		||||
 * @Author:        ${variables.authorName} <${variables.authorEmail}>
 | 
			
		||||
 * @Date:          ${variables.birthtime}
 | 
			
		||||
 * @LastEditors:   ${variables.userName}
 | 
			
		||||
 * @LastModified:  ${variables.mtime}
 | 
			
		||||
 * @FilePath:      ${variables.filePath}
 | 
			
		||||
 * @Author: ${variables.authorName} <${variables.authorEmail}>
 | 
			
		||||
 * @Date: ${variables.birthtime}
 | 
			
		||||
 * @LastEditors: ${variables.userName}
 | 
			
		||||
 * @LastModified: ${variables.mtime}
 | 
			
		||||
 * @FilePath: ${variables.filePath}
 | 
			
		||||
 * @Description:
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2025} by Kane All rights reserved
 | 
			
		||||
 *
 | 
			
		||||
 *               Copyright (c) ${2025} by Kane All rights reserved
 | 
			
		||||
 */`;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -8,9 +8,8 @@
 | 
			
		||||
  <artifactId>east-utils</artifactId>
 | 
			
		||||
  <version>20250808.1921</version>
 | 
			
		||||
 | 
			
		||||
  <name>east</name>
 | 
			
		||||
  <!-- FIXME change it to the project's website -->
 | 
			
		||||
  <url>http://www.example.com</url>
 | 
			
		||||
  <name>east-utils</name>
 | 
			
		||||
  <url>http://www.cpic.com.cn</url>
 | 
			
		||||
 | 
			
		||||
  <properties>
 | 
			
		||||
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 | 
			
		||||
 
 | 
			
		||||
@@ -5,16 +5,14 @@
 | 
			
		||||
 * @LastModified: 2025-08-08 19:05:06
 | 
			
		||||
 * @FilePath: src/main/java/com/cpic/xim/App.java
 | 
			
		||||
 * @Description:
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 *               Copyright (c) 2025 by Kane All rights reserved
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import com.cpic.xim.east.utils.DataFileSpliter;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Hello world!
 | 
			
		||||
 */
 | 
			
		||||
public class App
 | 
			
		||||
{
 | 
			
		||||
    private static final int    MAX_LINE_COUNT_PER_FILE = 250000;
 | 
			
		||||
@@ -24,9 +22,16 @@ public class App
 | 
			
		||||
    {
 | 
			
		||||
        String fileNameBDJBXXB = "L:\\east\\MD5_BDJCXX_BDJBXXB_RESULT_3080100.txt";
 | 
			
		||||
 | 
			
		||||
        com.cpic.xim.east.utils.DataFileSpliter.splitFile( new File( fileNameBDJBXXB ),
 | 
			
		||||
                                                           MAX_LINE_COUNT_PER_FILE,
 | 
			
		||||
                                                           TITLE_BDJBXXB );
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            DataFileSpliter.splitFile( new File( fileNameBDJBXXB ),
 | 
			
		||||
                                       MAX_LINE_COUNT_PER_FILE,
 | 
			
		||||
                                       TITLE_BDJBXXB );
 | 
			
		||||
        }
 | 
			
		||||
        catch ( Exception error )
 | 
			
		||||
        {
 | 
			
		||||
            error.printStackTrace();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        System.out.println( "拆完了!" );
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 * @Author: Kane Wang <wangkane@qq.com>
 | 
			
		||||
 * @Date: 2025-08-09 01:09:26
 | 
			
		||||
 * @LastEditors: Kane Wang
 | 
			
		||||
 * @LastModified: 2025-08-09 01:09:26
 | 
			
		||||
 * @LastModified: 2025-08-09 12:07:23
 | 
			
		||||
 * @FilePath: src/main/java/com/cpic/xim/east/utils/DataFileConverter.java
 | 
			
		||||
 * @Description:
 | 
			
		||||
 *
 | 
			
		||||
@@ -16,12 +16,10 @@ import java.io.FileOutputStream;
 | 
			
		||||
import java.io.FileReader;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
 | 
			
		||||
import org.apache.poi.ss.usermodel.Cell;
 | 
			
		||||
import org.apache.poi.ss.usermodel.Row;
 | 
			
		||||
import org.apache.poi.ss.usermodel.Sheet;
 | 
			
		||||
import org.apache.poi.ss.usermodel.Workbook;
 | 
			
		||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 | 
			
		||||
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,11 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: Kane Wang <wangkane@qq.com>
 | 
			
		||||
 * @Date: 2025-08-08 17:23:44
 | 
			
		||||
 * @Date: 2025-08-09 00:10:12
 | 
			
		||||
 * @LastEditors: Kane Wang
 | 
			
		||||
 * @LastModified: 2025-08-08 17:25:07
 | 
			
		||||
 * @LastModified: 2025-08-09 12:06:41
 | 
			
		||||
 * @FilePath: src/main/java/com/cpic/xim/east/utils/DataFileSpliter.java
 | 
			
		||||
 * @Description:
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 *               Copyright (c) 2025 by Kane All rights reserved
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.east.utils;
 | 
			
		||||
@@ -13,6 +13,7 @@ package com.cpic.xim.east.utils;
 | 
			
		||||
import java.io.BufferedReader;
 | 
			
		||||
import java.io.BufferedWriter;
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.io.FileNotFoundException;
 | 
			
		||||
import java.io.FileReader;
 | 
			
		||||
import java.io.FileWriter;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
@@ -26,10 +27,13 @@ import org.slf4j.LoggerFactory;
 | 
			
		||||
public class DataFileSpliter
 | 
			
		||||
{
 | 
			
		||||
    private static Logger logger = LoggerFactory.getLogger( DataFileSpliter.class );
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    public static void splitFile( File inputFile,
 | 
			
		||||
                                  int lineCountPerFile,
 | 
			
		||||
                                  String titleString )
 | 
			
		||||
                                  String titleString
 | 
			
		||||
    )
 | 
			
		||||
      throws FileNotFoundException,
 | 
			
		||||
      IOException
 | 
			
		||||
    {
 | 
			
		||||
        try (
 | 
			
		||||
                BufferedReader reader = new BufferedReader( new FileReader( inputFile ) )
 | 
			
		||||
@@ -38,47 +42,49 @@ public class DataFileSpliter
 | 
			
		||||
            String line;
 | 
			
		||||
            int    lineCount = 0;
 | 
			
		||||
            int    fileCount = 1;
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
            BufferedWriter writer = createWriterForFile( inputFile, fileCount );
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
            while ( (line = reader.readLine()) != null )
 | 
			
		||||
            {
 | 
			
		||||
                if ( lineCount >= lineCountPerFile )
 | 
			
		||||
                {
 | 
			
		||||
                    writer.close();
 | 
			
		||||
                    
 | 
			
		||||
 | 
			
		||||
                    fileCount++;
 | 
			
		||||
                    lineCount = 0;
 | 
			
		||||
                    
 | 
			
		||||
 | 
			
		||||
                    writer = createWriterForFile( inputFile, fileCount );
 | 
			
		||||
                }
 | 
			
		||||
                
 | 
			
		||||
 | 
			
		||||
                // 如果是第一行,则写入标题
 | 
			
		||||
                if ( lineCount == 0 && !titleString.isEmpty() )
 | 
			
		||||
                {
 | 
			
		||||
                    writer.write( titleString );
 | 
			
		||||
                    writer.newLine();
 | 
			
		||||
                }
 | 
			
		||||
                
 | 
			
		||||
 | 
			
		||||
                writer.write( line );
 | 
			
		||||
                writer.newLine();
 | 
			
		||||
                lineCount++;
 | 
			
		||||
            }
 | 
			
		||||
            writer.close();
 | 
			
		||||
        }
 | 
			
		||||
        catch ( IOException e )
 | 
			
		||||
        catch ( IOException error )
 | 
			
		||||
        {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
            logger.error( "出现异常" + error.getMessage() );
 | 
			
		||||
 | 
			
		||||
            throw error;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    private static BufferedWriter createWriterForFile( File inputFile, int fileCount )
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            String     outputFileName = String.format( "%s_part%d.txt", inputFile.getName(), fileCount );
 | 
			
		||||
            FileWriter fileWriter     = new FileWriter( new File( inputFile.getParent(), outputFileName ) );
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
            return new BufferedWriter( fileWriter );
 | 
			
		||||
        }
 | 
			
		||||
        catch ( IOException e )
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user