保存进度
This commit is contained in:
		@@ -4,16 +4,22 @@ root = true
 | 
				
			|||||||
[*]
 | 
					[*]
 | 
				
			||||||
charset = utf-8
 | 
					charset = utf-8
 | 
				
			||||||
indent_style = space
 | 
					indent_style = space
 | 
				
			||||||
indent_size = 2
 | 
					indent_size = 4
 | 
				
			||||||
end_of_line = lf
 | 
					end_of_line = lf
 | 
				
			||||||
insert_final_newline = true
 | 
					insert_final_newline = true
 | 
				
			||||||
trim_trailing_whitespace = true
 | 
					trim_trailing_whitespace = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[*.js]
 | 
					[*.js]
 | 
				
			||||||
indent_size = 2
 | 
					indent_size = 4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[*.ts]
 | 
				
			||||||
 | 
					indent_size = 4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[*.py]
 | 
					[*.py]
 | 
				
			||||||
indent_size = 4
 | 
					indent_size = 4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# [*.java]
 | 
					[*.java]
 | 
				
			||||||
# indent_size = 4
 | 
					indent_size = 4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[*.xml]
 | 
				
			||||||
 | 
					indent_size = 2
 | 
				
			||||||
@@ -15,9 +15,9 @@
 | 
				
			|||||||
  <properties>
 | 
					  <properties>
 | 
				
			||||||
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 | 
					    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 | 
				
			||||||
    <maven.compiler.release>17</maven.compiler.release>
 | 
					    <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>2.19.2</jackson.version>
 | 
				
			||||||
     <!-- <jackson.version>LATEST</jackson.version> -->
 | 
					    <!-- <jackson.version>LATEST</jackson.version> -->
 | 
				
			||||||
  </properties>
 | 
					  </properties>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <dependencyManagement>
 | 
					  <dependencyManagement>
 | 
				
			||||||
@@ -44,6 +44,7 @@
 | 
				
			|||||||
      <artifactId>junit-jupiter-params</artifactId>
 | 
					      <artifactId>junit-jupiter-params</artifactId>
 | 
				
			||||||
      <scope>test</scope>
 | 
					      <scope>test</scope>
 | 
				
			||||||
    </dependency>
 | 
					    </dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <!-- POI -->
 | 
					    <!-- POI -->
 | 
				
			||||||
    <dependency>
 | 
					    <dependency>
 | 
				
			||||||
      <groupId>org.apache.poi</groupId>
 | 
					      <groupId>org.apache.poi</groupId>
 | 
				
			||||||
@@ -65,7 +66,8 @@
 | 
				
			|||||||
      <artifactId>poi-ooxml-schemas</artifactId>
 | 
					      <artifactId>poi-ooxml-schemas</artifactId>
 | 
				
			||||||
      <version>4.1.2</version>
 | 
					      <version>4.1.2</version>
 | 
				
			||||||
    </dependency>
 | 
					    </dependency>
 | 
				
			||||||
 <!--jackson-->
 | 
					
 | 
				
			||||||
 | 
					    <!--jackson-->
 | 
				
			||||||
    <dependency>
 | 
					    <dependency>
 | 
				
			||||||
      <groupId>com.fasterxml.jackson.core</groupId>
 | 
					      <groupId>com.fasterxml.jackson.core</groupId>
 | 
				
			||||||
      <artifactId>jackson-databind</artifactId>
 | 
					      <artifactId>jackson-databind</artifactId>
 | 
				
			||||||
@@ -83,6 +85,23 @@
 | 
				
			|||||||
      <artifactId>jackson-annotations</artifactId>
 | 
					      <artifactId>jackson-annotations</artifactId>
 | 
				
			||||||
      <version>${jackson.version}</version>
 | 
					      <version>${jackson.version}</version>
 | 
				
			||||||
    </dependency>
 | 
					    </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>
 | 
					  </dependencies>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <build>
 | 
					  <build>
 | 
				
			||||||
@@ -150,4 +169,4 @@
 | 
				
			|||||||
      </plugin>
 | 
					      </plugin>
 | 
				
			||||||
    </plugins>
 | 
					    </plugins>
 | 
				
			||||||
  </build>
 | 
					  </build>
 | 
				
			||||||
</project>
 | 
					</project>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,41 +12,125 @@ package com.cpic.xim.east.utils;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import java.io.BufferedReader;
 | 
					import java.io.BufferedReader;
 | 
				
			||||||
import java.io.FileNotFoundException;
 | 
					import java.io.FileNotFoundException;
 | 
				
			||||||
 | 
					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.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.LoggerFactory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class DataFileConverter
 | 
					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,
 | 
					    public static void convertEASTDataFileToXLSX( String eastDataFilePath,
 | 
				
			||||||
                                                  String xlsxFilePath,
 | 
					                                                  String xlsxFilePath,
 | 
				
			||||||
                                                  String spliteString
 | 
					                                                  String spliterString
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
      throws FileNotFoundException,
 | 
					      throws FileNotFoundException,
 | 
				
			||||||
      IOException
 | 
					      IOException
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        Workbook       workbook = new XSSFWorkbook();
 | 
					        FileOutputStream xlsxFile = null;
 | 
				
			||||||
        Sheet          sheet    = workbook.createSheet( "sheet1" );
 | 
					        BufferedReader   reader   = null;
 | 
				
			||||||
        BufferedReader reader   = null;
 | 
					        Workbook         workbook = null;
 | 
				
			||||||
        String         line;
 | 
					        Sheet            sheet    = null;
 | 
				
			||||||
        int            rowIndex = 0;
 | 
					
 | 
				
			||||||
        
 | 
					        String line;
 | 
				
			||||||
        reader = new BufferedReader( new FileReader( eastDataFilePath ) );
 | 
					        int    rowIndex = 0;
 | 
				
			||||||
        
 | 
					
 | 
				
			||||||
        while ( (line = reader.readLine()) != null )
 | 
					        try
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            String[] rowData = line.split( spliteString );
 | 
					            reader = new BufferedReader( new FileReader( eastDataFilePath ) );
 | 
				
			||||||
            
 | 
					        }
 | 
				
			||||||
            for ( String cellData : rowData )
 | 
					        catch ( IOException error )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            logger.error( "打开文件" + eastDataFilePath + "失败!!!!" );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            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.FileReader;
 | 
				
			||||||
import java.io.FileWriter;
 | 
					import java.io.FileWriter;
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					import org.slf4j.Logger;
 | 
				
			||||||
 | 
					import org.slf4j.LoggerFactory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @author Kane
 | 
					 * @author Kane
 | 
				
			||||||
@@ -23,6 +25,7 @@ import java.io.IOException;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
public class DataFileSpliter
 | 
					public class DataFileSpliter
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    private static Logger logger = LoggerFactory.getLogger( DataFileSpliter.class );
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public static void splitFile( File inputFile,
 | 
					    public static void splitFile( File inputFile,
 | 
				
			||||||
                                  int lineCountPerFile,
 | 
					                                  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