保存进度
This commit is contained in:
		@@ -4,16 +4,22 @@ root = true
 | 
			
		||||
[*]
 | 
			
		||||
charset = utf-8
 | 
			
		||||
indent_style = space
 | 
			
		||||
indent_size = 2
 | 
			
		||||
indent_size = 4
 | 
			
		||||
end_of_line = lf
 | 
			
		||||
insert_final_newline = true
 | 
			
		||||
trim_trailing_whitespace = true
 | 
			
		||||
 | 
			
		||||
[*.js]
 | 
			
		||||
indent_size = 2
 | 
			
		||||
indent_size = 4
 | 
			
		||||
 | 
			
		||||
[*.ts]
 | 
			
		||||
indent_size = 4
 | 
			
		||||
 | 
			
		||||
[*.py]
 | 
			
		||||
indent_size = 4
 | 
			
		||||
 | 
			
		||||
# [*.java]
 | 
			
		||||
# indent_size = 4
 | 
			
		||||
[*.java]
 | 
			
		||||
indent_size = 4
 | 
			
		||||
 | 
			
		||||
[*.xml]
 | 
			
		||||
indent_size = 2
 | 
			
		||||
@@ -15,9 +15,9 @@
 | 
			
		||||
  <properties>
 | 
			
		||||
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 | 
			
		||||
    <maven.compiler.release>17</maven.compiler.release>
 | 
			
		||||
    <log4j.version>2.24.3</log4j.version>
 | 
			
		||||
    <log4j.version>2.25.1</log4j.version>
 | 
			
		||||
    <jackson.version>2.19.2</jackson.version>
 | 
			
		||||
     <!-- <jackson.version>LATEST</jackson.version> -->
 | 
			
		||||
    <!-- <jackson.version>LATEST</jackson.version> -->
 | 
			
		||||
  </properties>
 | 
			
		||||
 | 
			
		||||
  <dependencyManagement>
 | 
			
		||||
@@ -44,6 +44,7 @@
 | 
			
		||||
      <artifactId>junit-jupiter-params</artifactId>
 | 
			
		||||
      <scope>test</scope>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <!-- POI -->
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.apache.poi</groupId>
 | 
			
		||||
@@ -65,7 +66,8 @@
 | 
			
		||||
      <artifactId>poi-ooxml-schemas</artifactId>
 | 
			
		||||
      <version>4.1.2</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 <!--jackson-->
 | 
			
		||||
 | 
			
		||||
    <!--jackson-->
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>com.fasterxml.jackson.core</groupId>
 | 
			
		||||
      <artifactId>jackson-databind</artifactId>
 | 
			
		||||
@@ -83,6 +85,23 @@
 | 
			
		||||
      <artifactId>jackson-annotations</artifactId>
 | 
			
		||||
      <version>${jackson.version}</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <!-- log-4j -->
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.apache.logging.log4j</groupId>
 | 
			
		||||
      <artifactId>log4j-core</artifactId>
 | 
			
		||||
      <version>${log4j.version}</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.apache.logging.log4j</groupId>
 | 
			
		||||
      <artifactId>log4j-slf4j2-impl</artifactId>
 | 
			
		||||
      <version>${log4j.version}</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.apache.logging.log4j</groupId>
 | 
			
		||||
      <artifactId>log4j-api</artifactId>
 | 
			
		||||
      <version>${log4j.version}</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
  </dependencies>
 | 
			
		||||
 | 
			
		||||
  <build>
 | 
			
		||||
 
 | 
			
		||||
@@ -12,41 +12,125 @@ package com.cpic.xim.east.utils;
 | 
			
		||||
 | 
			
		||||
import java.io.BufferedReader;
 | 
			
		||||
import java.io.FileNotFoundException;
 | 
			
		||||
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;
 | 
			
		||||
 | 
			
		||||
public class DataFileConverter
 | 
			
		||||
{
 | 
			
		||||
    private static Logger logger = LoggerFactory.getLogger( DataFileConverter.class );
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @param eastDataFilePath
 | 
			
		||||
     * @param xlsxFilePath
 | 
			
		||||
     * @param spliterString
 | 
			
		||||
     * @throws FileNotFoundException
 | 
			
		||||
     * @throws IOException
 | 
			
		||||
     */
 | 
			
		||||
    public static void convertEASTDataFileToXLSX( String eastDataFilePath,
 | 
			
		||||
                                                  String xlsxFilePath,
 | 
			
		||||
                                                  String spliteString
 | 
			
		||||
                                                  String spliterString
 | 
			
		||||
    )
 | 
			
		||||
      throws FileNotFoundException,
 | 
			
		||||
      IOException
 | 
			
		||||
    {
 | 
			
		||||
        Workbook       workbook = new XSSFWorkbook();
 | 
			
		||||
        Sheet          sheet    = workbook.createSheet( "sheet1" );
 | 
			
		||||
        BufferedReader reader   = null;
 | 
			
		||||
        String         line;
 | 
			
		||||
        int            rowIndex = 0;
 | 
			
		||||
        FileOutputStream xlsxFile = null;
 | 
			
		||||
        BufferedReader   reader   = null;
 | 
			
		||||
        Workbook         workbook = null;
 | 
			
		||||
        Sheet            sheet    = null;
 | 
			
		||||
 | 
			
		||||
        reader = new BufferedReader( new FileReader( eastDataFilePath ) );
 | 
			
		||||
        String line;
 | 
			
		||||
        int    rowIndex = 0;
 | 
			
		||||
 | 
			
		||||
        while ( (line = reader.readLine()) != null )
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            String[] rowData = line.split( spliteString );
 | 
			
		||||
            reader = new BufferedReader( new FileReader( eastDataFilePath ) );
 | 
			
		||||
        }
 | 
			
		||||
        catch ( IOException error )
 | 
			
		||||
        {
 | 
			
		||||
            logger.error( "打开文件" + eastDataFilePath + "失败!!!!" );
 | 
			
		||||
 | 
			
		||||
            for ( String cellData : rowData )
 | 
			
		||||
            throw error;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            workbook = new XSSFWorkbook();
 | 
			
		||||
            sheet    = workbook.createSheet( "sheet1" );
 | 
			
		||||
 | 
			
		||||
            while ( (line = reader.readLine()) != null )
 | 
			
		||||
            {
 | 
			
		||||
                String[] rowData   = line.split( spliterString );
 | 
			
		||||
                Row      row       = sheet.createRow( rowIndex );
 | 
			
		||||
                int      cellIndex = 0;
 | 
			
		||||
 | 
			
		||||
                for ( String cellData : rowData )
 | 
			
		||||
                {
 | 
			
		||||
                    row.createCell( cellIndex++ ).setCellValue( cellData );
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                rowIndex++;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            xlsxFile = new FileOutputStream( xlsxFilePath );
 | 
			
		||||
            workbook.write( xlsxFile );
 | 
			
		||||
 | 
			
		||||
            xlsxFile.close();
 | 
			
		||||
            workbook.close();
 | 
			
		||||
            reader.close();
 | 
			
		||||
        }
 | 
			
		||||
        catch ( IOException error )
 | 
			
		||||
        {
 | 
			
		||||
            throw error;
 | 
			
		||||
        }
 | 
			
		||||
        finally
 | 
			
		||||
        {
 | 
			
		||||
            if ( xlsxFile != null )
 | 
			
		||||
            {
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    xlsxFile.close();
 | 
			
		||||
                }
 | 
			
		||||
                catch ( IOException error )
 | 
			
		||||
                {
 | 
			
		||||
                    error.printStackTrace();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if ( workbook != null )
 | 
			
		||||
            {
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    workbook.close();
 | 
			
		||||
                }
 | 
			
		||||
                catch ( IOException error )
 | 
			
		||||
                {
 | 
			
		||||
                    error.printStackTrace();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if ( reader != null )
 | 
			
		||||
            {
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    reader.close();
 | 
			
		||||
                }
 | 
			
		||||
                catch ( IOException error )
 | 
			
		||||
                {
 | 
			
		||||
                    error.printStackTrace();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        reader.close();
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -16,6 +16,8 @@ import java.io.File;
 | 
			
		||||
import java.io.FileReader;
 | 
			
		||||
import java.io.FileWriter;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author Kane
 | 
			
		||||
@@ -23,6 +25,7 @@ import java.io.IOException;
 | 
			
		||||
 */
 | 
			
		||||
public class DataFileSpliter
 | 
			
		||||
{
 | 
			
		||||
    private static Logger logger = LoggerFactory.getLogger( DataFileSpliter.class );
 | 
			
		||||
    
 | 
			
		||||
    public static void splitFile( File inputFile,
 | 
			
		||||
                                  int lineCountPerFile,
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										40
									
								
								code/east-datafile-utils/src/main/resources/log4j2.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								code/east-datafile-utils/src/main/resources/log4j2.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
<Configuration status="WARN" monitorInterval="300">
 | 
			
		||||
    <Appenders>
 | 
			
		||||
        <Console name="Console" target="SYSTEM_OUT">
 | 
			
		||||
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} ### %msg%n" />
 | 
			
		||||
            <ThresholdFilter level="trace" onMatch="ACCEPT" onMismatch="DENY" />
 | 
			
		||||
        </Console>
 | 
			
		||||
        <RollingFile name="rolling_file_win"
 | 
			
		||||
            filePattern="./logs/$${date:yyyy-MM}/huixiabao-%d{MM-dd-yyyy}-%i.log.gz">
 | 
			
		||||
            <PatternLayout>
 | 
			
		||||
                <Pattern>[%t][%level][%d{HH:mm:ss.SSS}][%logger.%M{36}#%L] %msg%n</Pattern>
 | 
			
		||||
            </PatternLayout>
 | 
			
		||||
            <Policies>
 | 
			
		||||
                <TimeBasedTriggeringPolicy interval="1" />
 | 
			
		||||
                <SizeBasedTriggeringPolicy size="20MB" />
 | 
			
		||||
                <DefaultRolloverStrategy max="20" />
 | 
			
		||||
            </Policies>
 | 
			
		||||
        </RollingFile>
 | 
			
		||||
        <RollingFile name="rolling_file_linux"
 | 
			
		||||
            filePattern="/logs/east/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
 | 
			
		||||
            <PatternLayout>
 | 
			
		||||
                <Pattern>[%t][%level][%d{HH:mm:ss.SSS}][%logger.%M{36}#%L] %msg%n</Pattern>
 | 
			
		||||
            </PatternLayout>
 | 
			
		||||
            <Policies>
 | 
			
		||||
                <TimeBasedTriggeringPolicy interval="1" />
 | 
			
		||||
                <SizeBasedTriggeringPolicy size="20MB" />
 | 
			
		||||
                <DefaultRolloverStrategy max="20" />
 | 
			
		||||
            </Policies>
 | 
			
		||||
        </RollingFile>
 | 
			
		||||
    </Appenders>
 | 
			
		||||
    <Loggers>
 | 
			
		||||
        <!-- <Logger name="mylog" level="info">
 | 
			
		||||
            <AppenderRef ref="rolling_file" />
 | 
			
		||||
        </Logger> -->
 | 
			
		||||
        <Root level="debug">
 | 
			
		||||
            <AppenderRef ref="rolling_file_linux" />
 | 
			
		||||
            <AppenderRef ref="rolling_file_win" />
 | 
			
		||||
            <AppenderRef ref="Console" />
 | 
			
		||||
        </Root>
 | 
			
		||||
    </Loggers>
 | 
			
		||||
</Configuration>
 | 
			
		||||
		Reference in New Issue
	
	Block a user