Browse Source

修改日志版本

pull/3440/head
Jiaju Zhuang 1 year ago
parent
commit
228690259a
  1. 2
      easyexcel-test/pom.xml
  2. 19
      easyexcel-test/src/test/java/com/alibaba/easyexcel/test/temp/WriteLargeTest.java
  3. 14
      easyexcel-test/src/test/resources/logback.xml

2
easyexcel-test/pom.xml

@ -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>

19
easyexcel-test/src/test/java/com/alibaba/easyexcel/test/temp/WriteLargeTest.java

@ -2,16 +2,19 @@ package com.alibaba.easyexcel.test.temp;
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;
@ -24,6 +27,7 @@ import org.slf4j.LoggerFactory;
* @author Jiaju Zhuang
**/
@Slf4j
public class WriteLargeTest {
private static final Logger LOGGER = LoggerFactory.getLogger(WriteLargeTest.class);
@ -64,6 +68,21 @@ public class WriteLargeTest {
}
@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 同一个对象

14
easyexcel-test/src/test/resources/logback.xml

@ -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>

Loading…
Cancel
Save