保存进度!
This commit is contained in:
0
code/east-datafile-spliter/.mvn/jvm.config
Normal file
0
code/east-datafile-spliter/.mvn/jvm.config
Normal file
0
code/east-datafile-spliter/.mvn/maven.config
Normal file
0
code/east-datafile-spliter/.mvn/maven.config
Normal file
87
code/east-datafile-spliter/.vscode/fileheader.template.js
vendored
Normal file
87
code/east-datafile-spliter/.vscode/fileheader.template.js
vendored
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* These comments can help you write your own template with type hint
|
||||||
|
* @typedef {Object} FileheaderVariable Fileheader variables
|
||||||
|
* @property {string} birthtime file birth time. will get it from VCS or fallback to filesystem when it is not available
|
||||||
|
* @property {string} mtime file modification time. will get it from VCS or fallback to filesystem when it is not available
|
||||||
|
* @property {string} authorName if the file is tracked by VCS, it will get the author name from VCS. else it will get it from current user name
|
||||||
|
* @property {string} authorEmail if the file is tracked by VCS, it will get the author email from VCS. else it will get it from current user email
|
||||||
|
* @property {string} userName else it will get it from current user name
|
||||||
|
* @property {string} userEmail user email is from VSCode config, and fallback to VCS config
|
||||||
|
* @property {string} companyName
|
||||||
|
* @property {string} projectName name of current project
|
||||||
|
* @property {string} filePath the file 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Please confirm your provider extends from globalThis.FileheaderLanguageProvider
|
||||||
|
*/
|
||||||
|
class CustomLanguageProvider extends globalThis.FileheaderLanguageProvider {
|
||||||
|
/**
|
||||||
|
* @type {string[]}
|
||||||
|
*/
|
||||||
|
languages = [
|
||||||
|
"java",
|
||||||
|
"javascript",
|
||||||
|
"typescript",
|
||||||
|
"javascriptreact",
|
||||||
|
"typescriptreact",
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {string=} the language block comment start string.
|
||||||
|
* this is for future feature: support detect old custom template when custom template changes
|
||||||
|
*/
|
||||||
|
blockCommentStart = "/**";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {string=}
|
||||||
|
*/
|
||||||
|
blockCommentEnd = "*/";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get your template when document language matched
|
||||||
|
* @param {ITemplateFunction} tpl template function, it is a tagged function, support nested interpolation
|
||||||
|
* @param {FileheaderVariable} variables template variables
|
||||||
|
* @returns {Template}
|
||||||
|
*/
|
||||||
|
getTemplate(tpl, variables) {
|
||||||
|
// prettier-ignore
|
||||||
|
return tpl
|
||||||
|
`/**
|
||||||
|
* @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
|
||||||
|
*/`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// export your provider classes
|
||||||
|
module.exports = [CustomLanguageProvider];
|
3
code/east-datafile-spliter/.vscode/settings.json
vendored
Normal file
3
code/east-datafile-spliter/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"java.configuration.updateBuildConfiguration": "automatic"
|
||||||
|
}
|
152
code/east-datafile-spliter/pom.xml
Normal file
152
code/east-datafile-spliter/pom.xml
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.cpic.xim</groupId>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<maven.compiler.release>17</maven.compiler.release>
|
||||||
|
<log4j.version>2.24.3</log4j.version>
|
||||||
|
<jackson.version>2.19.2</jackson.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit</groupId>
|
||||||
|
<artifactId>junit-bom</artifactId>
|
||||||
|
<version>5.11.0</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- Optionally: parameterized tests support -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-params</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- POI -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi</artifactId>
|
||||||
|
<version>5.4.1</version> <!-- 请根据实际情况选择最新版本 -->
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<version>5.4.1</version> <!-- 请根据实际情况选择最新版本 -->
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.xmlbeans</groupId>
|
||||||
|
<artifactId>xmlbeans</artifactId>
|
||||||
|
<version>5.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml-schemas</artifactId>
|
||||||
|
<version>4.1.2</version>
|
||||||
|
</dependency>
|
||||||
|
<!--jackson-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>${jackson.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-core</artifactId>
|
||||||
|
<version>${jackson.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-annotations</artifactId>
|
||||||
|
<version>${jackson.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<defaultGoal>compile</defaultGoal>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>3.5.2</version>
|
||||||
|
<configuration>
|
||||||
|
<skip>true</skip>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.14.0</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
<compilerArguments>
|
||||||
|
<extdirs>${project.basedir}/lib</extdirs>
|
||||||
|
</compilerArguments>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<version>3.7.1</version>
|
||||||
|
<configuration>
|
||||||
|
<descriptorRefs>
|
||||||
|
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||||
|
</descriptorRefs>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<mainClass>com.cpic.xim.huixiabao.AppMain</mainClass>
|
||||||
|
</manifest>
|
||||||
|
</archive>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>make-assembly</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>2.6.0</version>
|
||||||
|
<configuration>
|
||||||
|
<mainClass>com.cpic.xim.huixiabao.AppMain</mainClass>
|
||||||
|
<includeSystemScope>true</includeSystemScope>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>repackage</id>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@@ -0,0 +1,33 @@
|
|||||||
|
/**
|
||||||
|
* @Author: Kane Wang <wangkane@qq.com>
|
||||||
|
* @Date: 2025-08-08 17:21:32
|
||||||
|
* @LastEditors: Kane Wang
|
||||||
|
* @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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hello world!
|
||||||
|
*/
|
||||||
|
public class App
|
||||||
|
{
|
||||||
|
private static final int MAX_LINE_COUNT_PER_FILE = 250000;
|
||||||
|
private static final String TITLE_BDJBXXB = "流水号$保险机构代码$保险机构名称$采集日期$保单编号$虚拟单标志$保单件数$险类$保单团个性质$监管辖区$司法管辖$业务性质$续保标志$被续保保单编号$保单状态$保单终止原因$核保类型$联共保类型$涉农标志$分保标志$统保标志$投保单申请日期$签单日期$核保通过时间$保费收费确认时间$保单生成时间$保单起始日期$保单终止日期$保单中止日期$保单效力恢复日期$保单满期日期$约定分期交费次数$累计保费$交费方式$被保险人数量$保险金额$保险金额币种$保险金额人民币金额$保险费率$基准保费$签单保费$税额$政府补贴保费金额$保费币种$保费人民币金额$管理机构代码$管理机构名称$核保机构代码$核保机构名称$承保地区$争议解决方式$佣金比例$佣金$佣金币种$佣金人民币金额$特别约定标志$特别约定$经办业务标志$经办管理费$医保个人账户购买标志";
|
||||||
|
|
||||||
|
public static void main( String[] args )
|
||||||
|
{
|
||||||
|
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 );
|
||||||
|
|
||||||
|
System.out.println( "拆完了!" );
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,85 @@
|
|||||||
|
/**
|
||||||
|
* @Author: Kane Wang <wangkane@qq.com>
|
||||||
|
* @Date: 2025-08-08 17:23:44
|
||||||
|
* @LastEditors: Kane Wang
|
||||||
|
* @LastModified: 2025-08-08 17:25:07
|
||||||
|
* @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;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Kane
|
||||||
|
* @description 用于拆分大文件。
|
||||||
|
*/
|
||||||
|
public class DataFileSpliter
|
||||||
|
{
|
||||||
|
|
||||||
|
public static void splitFile( File inputFile, int lineCountPerFile , String titleString )
|
||||||
|
{
|
||||||
|
try (
|
||||||
|
BufferedReader reader = new BufferedReader( new FileReader( inputFile ) )
|
||||||
|
)
|
||||||
|
{
|
||||||
|
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 )
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 )
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user