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