保存进度
This commit is contained in:
		
							
								
								
									
										19
									
								
								code/east-datafile-utils/.editorconfig1
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								code/east-datafile-utils/.editorconfig1
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
# top-most EditorConfig file
 | 
			
		||||
root = true
 | 
			
		||||
 | 
			
		||||
[*]
 | 
			
		||||
charset = utf-8
 | 
			
		||||
indent_style = space
 | 
			
		||||
indent_size = 2
 | 
			
		||||
end_of_line = lf
 | 
			
		||||
insert_final_newline = true
 | 
			
		||||
trim_trailing_whitespace = true
 | 
			
		||||
 | 
			
		||||
[*.js]
 | 
			
		||||
indent_size = 2
 | 
			
		||||
 | 
			
		||||
[*.py]
 | 
			
		||||
indent_size = 4
 | 
			
		||||
 | 
			
		||||
# [*.java]
 | 
			
		||||
# indent_size = 4
 | 
			
		||||
@@ -0,0 +1,52 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: Kane Wang <wangkane@qq.com>
 | 
			
		||||
 * @Date: 2025-08-09 01:09:26
 | 
			
		||||
 * @LastEditors: Kane Wang
 | 
			
		||||
 * @LastModified: 2025-08-09 01:09:26
 | 
			
		||||
 * @FilePath: src/main/java/com/cpic/xim/east/utils/DataFileConverter.java
 | 
			
		||||
 * @Description:
 | 
			
		||||
 *
 | 
			
		||||
 *               Copyright (c) 2025 by Kane All rights reserved
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.east.utils;
 | 
			
		||||
 | 
			
		||||
import java.io.BufferedReader;
 | 
			
		||||
import java.io.FileNotFoundException;
 | 
			
		||||
import java.io.FileReader;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
 | 
			
		||||
import org.apache.poi.ss.usermodel.Sheet;
 | 
			
		||||
import org.apache.poi.ss.usermodel.Workbook;
 | 
			
		||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 | 
			
		||||
 | 
			
		||||
public class DataFileConverter
 | 
			
		||||
{
 | 
			
		||||
    public static void convertEASTDataFileToXLSX( String eastDataFilePath,
 | 
			
		||||
                                                  String xlsxFilePath,
 | 
			
		||||
                                                  String spliteString
 | 
			
		||||
    )
 | 
			
		||||
      throws FileNotFoundException,
 | 
			
		||||
      IOException
 | 
			
		||||
    {
 | 
			
		||||
        Workbook       workbook = new XSSFWorkbook();
 | 
			
		||||
        Sheet          sheet    = workbook.createSheet( "sheet1" );
 | 
			
		||||
        BufferedReader reader   = null;
 | 
			
		||||
        String         line;
 | 
			
		||||
        int            rowIndex = 0;
 | 
			
		||||
        
 | 
			
		||||
        reader = new BufferedReader( new FileReader( eastDataFilePath ) );
 | 
			
		||||
        
 | 
			
		||||
        while ( (line = reader.readLine()) != null )
 | 
			
		||||
        {
 | 
			
		||||
            String[] rowData = line.split( spliteString );
 | 
			
		||||
            
 | 
			
		||||
            for ( String cellData : rowData )
 | 
			
		||||
            {
 | 
			
		||||
                
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        reader.close();
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -4,7 +4,7 @@
 | 
			
		||||
 * @LastEditors: Kane Wang
 | 
			
		||||
 * @LastModified: 2025-08-08 17:25:07
 | 
			
		||||
 * @FilePath: src/main/java/com/cpic/xim/east/utils/DataFileSpliter.java
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * @Description:
 | 
			
		||||
 * 
 | 
			
		||||
 *               Copyright (c) 2025 by Kane All rights reserved
 | 
			
		||||
 */
 | 
			
		||||
@@ -23,8 +23,10 @@ import java.io.IOException;
 | 
			
		||||
 */
 | 
			
		||||
public class DataFileSpliter
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    public static void splitFile( File inputFile, int lineCountPerFile , String titleString )
 | 
			
		||||
    
 | 
			
		||||
    public static void splitFile( File inputFile,
 | 
			
		||||
                                  int lineCountPerFile,
 | 
			
		||||
                                  String titleString )
 | 
			
		||||
    {
 | 
			
		||||
        try (
 | 
			
		||||
                BufferedReader reader = new BufferedReader( new FileReader( inputFile ) )
 | 
			
		||||
@@ -33,28 +35,28 @@ 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 );
 | 
			
		||||
                    
 | 
			
		||||
                    writer = createWriterForFile( inputFile, fileCount );
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                
 | 
			
		||||
                // 如果是第一行,则写入标题
 | 
			
		||||
                if ( lineCount == 0 && !titleString.isEmpty() )
 | 
			
		||||
                {
 | 
			
		||||
                    writer.write( titleString );
 | 
			
		||||
                    writer.newLine();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                
 | 
			
		||||
                writer.write( line );
 | 
			
		||||
                writer.newLine();
 | 
			
		||||
                lineCount++;
 | 
			
		||||
@@ -66,7 +68,7 @@ public class DataFileSpliter
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    private static BufferedWriter createWriterForFile( File inputFile, int fileCount )
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user