Skip to content

Commit

Permalink
修改日志版本
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuangjiaju committed Jun 1, 2023
1 parent de4e536 commit 2286902
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion easyexcel-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.7</version>
<version>1.2.12</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.alibaba.easyexcel.test.core.large.LargeData;
import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.read.listener.PageReadListener;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.metadata.style.WriteFont;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;

import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.junit.jupiter.api.Test;
Expand All @@ -24,6 +27,7 @@
* @author Jiaju Zhuang
**/

@Slf4j
public class WriteLargeTest {

private static final Logger LOGGER = LoggerFactory.getLogger(WriteLargeTest.class);
Expand Down Expand Up @@ -64,6 +68,21 @@ public void test() throws Exception {

}

@Test
public void read() throws Exception {
log.info("start");
String fileName = "/Users/zhuangjiaju/Downloads/1e9e0578a9634abbbbd9b67f338f142a.xls";
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
// 这里默认每次会读取100条数据 然后返回过来 直接调用使用数据就行
// 具体需要返回多少行可以在`PageReadListener`的构造函数设置
EasyExcel.read(fileName, new PageReadListener<List<Map<String, String>>>(dataList -> {
log.info("SIZEL:{}", dataList.size());
})).sheet().doRead();

log.info("test");

}

@Test
public void test2() throws Exception {
// 方法2 如果写到不同的sheet 同一个对象
Expand Down
14 changes: 8 additions & 6 deletions easyexcel-test/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="LOG_PATTERN"
value="%d{yyyy-MM-dd HH:mm:ss.SSS} %level [%thread] %class:%line - %msg%n"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>

<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf8</charset>
</encoder>
</appender>

<root level="DEBUG">
<appender-ref ref="STDOUT"/>
<appender-ref ref="CONSOLE"/>
</root>
</configuration>

0 comments on commit 2286902

Please sign in to comment.