Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public class DemoDataListener implements ReadListener<DemoData> {

@Override
public void invoke(DemoData data, AnalysisContext context) {
System.out.println("Parsed a data entry" + JSON.toJSONString(data));
System.out.println("Parsed a data entry" + data);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public class DemoDataListener implements ReadListener<DemoData> {

@Override
public void invoke(DemoData data, AnalysisContext context) {
System.out.println("解析了一条数据" + JSON.toJSONString(data));
System.out.println("解析了一条数据" + data);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

package org.apache.fesod.sheet.converter;

import com.alibaba.fastjson2.JSON;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
Expand All @@ -51,7 +50,7 @@ public void doAfterAllAnalysed(AnalysisContext context) {}

@Override
public void extra(CellExtra extra, AnalysisContext context) {
log.info("extra data:{}", JSON.toJSONString(extra));
log.info("extra data:{}", extra);
extras.add(extra);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

package org.apache.fesod.sheet.format;

import com.alibaba.fastjson2.JSON;
import java.io.File;
import java.math.BigDecimal;
import java.nio.file.Files;
Expand Down Expand Up @@ -67,7 +66,7 @@ public void readXlsWithSpecialCharacters() {
public void readXlsxWithSharedStringNamespace() {
// Exist in `sharedStrings.xml` `x:t` start tag, need to be compatible
List<Map<Integer, Object>> list = readCompatibilityFile("t02.xlsx", 0);
log.info("data:{}", JSON.toJSONString(list));
log.info("data:{}", list);
Assertions.assertEquals(3, list.size());
Map<Integer, Object> row2 = list.get(2);
Assertions.assertEquals("1,2-戊二醇", row2.get(2));
Expand All @@ -77,7 +76,7 @@ public void readXlsxWithSharedStringNamespace() {
public void readXlsxIgnoreNullColumns() {
// In the presence of the first line of a lot of null columns, ignore null columns
List<Map<Integer, Object>> list = readCompatibilityFile("t03.xlsx");
log.info("data:{}", JSON.toJSONString(list));
log.info("data:{}", list);
Assertions.assertEquals(1, list.size());
Map<Integer, Object> row0 = list.get(0);
Assertions.assertEquals(12, row0.size());
Expand All @@ -87,7 +86,7 @@ public void readXlsxIgnoreNullColumns() {
public void readXlsxWithNamespacedTag() {
// Exist in `sheet1.xml` `ns2:t` start tag, need to be compatible
List<Map<Integer, Object>> list = readCompatibilityFile("t04.xlsx");
log.info("data:{}", JSON.toJSONString(list));
log.info("data:{}", list);
Assertions.assertEquals(56, list.size());
Map<Integer, Object> row0 = list.get(0);
Assertions.assertEquals("QQSJK28F152A012242S0081", row0.get(5));
Expand All @@ -97,7 +96,7 @@ public void readXlsxWithNamespacedTag() {
public void readXlsxDateRounding() {
// Excel read date needs to be rounded
List<Map<Integer, String>> list = readCompatibilityFile("t05.xlsx");
log.info("data:{}", JSON.toJSONString(list));
log.info("data:{}", list);
Assertions.assertEquals("2023-01-01 00:00:00", list.get(0).get(0));
Assertions.assertEquals("2023-01-01 00:00:00", list.get(1).get(0));
Assertions.assertEquals("2023-01-01 00:00:00", list.get(2).get(0));
Expand All @@ -109,7 +108,7 @@ public void readXlsxDateRounding() {
public void readXlsxPrecisionFormat() {
// Keep error precision digital format
List<Map<Integer, String>> list = readCompatibilityFile("t06.xlsx", 0);
log.info("data:{}", JSON.toJSONString(list));
log.info("data:{}", list);
Assertions.assertEquals("2087.03", list.get(0).get(2));
}

Expand All @@ -120,12 +119,12 @@ public void readXlsxActualDataReturn() {
.readDefaultReturn(ReadDefaultReturnEnum.ACTUAL_DATA)
.sheet()
.doReadSync();
log.info("data:{}", JSON.toJSONString(list));
log.info("data:{}", list);
Assertions.assertEquals(0, new BigDecimal("24.1998124").compareTo((BigDecimal)
list.get(0).get(11)));

list = readCompatibilityFile("t07.xlsx");
log.info("data:{}", JSON.toJSONString(list));
log.info("data:{}", list);
Assertions.assertEquals("24.20", list.get(0).get(11));
}

Expand Down Expand Up @@ -158,7 +157,7 @@ public void readXlsxWithEscapeSequence() {
File file = compatibilityFile("t09.xlsx");
List<Map<Integer, Object>> list =
FesodSheet.read(file).headRowNumber(0).sheet().doReadSync();
log.info("data:{}", JSON.toJSONString(list));
log.info("data:{}", list);
Assertions.assertEquals(1, list.size());

Assertions.assertEquals("SH_x000D_Z002", list.get(0).get(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

package org.apache.fesod.sheet.format;

import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.fesod.sheet.context.AnalysisContext;
import org.apache.fesod.sheet.event.AnalysisEventListener;
Expand All @@ -43,7 +42,7 @@ public void onException(Exception exception, AnalysisContext context) {

@Override
public void invoke(Object data, AnalysisContext context) {
log.info("data:{}", JSON.toJSONString(data));
log.info("data:{}", data);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

package org.apache.fesod.sheet.head;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONWriter;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.apache.fesod.sheet.context.AnalysisContext;
Expand All @@ -38,7 +36,7 @@ public void invoke(Map<Integer, String> data, AnalysisContext context) {

@Override
public void doAfterAllAnalysed(AnalysisContext context) {
log.info("origin head : {}", JSON.toJSONString(headTitleMap, JSONWriter.Feature.WriteMapNullValue));
log.info("origin head : {}", headTitleMap);
log.info("max not empty head size : {}", context.readSheetHolder().getMaxNotEmptyDataHeadSize());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

package org.apache.fesod.sheet.head;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONWriter;
import java.io.File;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -66,7 +64,7 @@ private void readFileWithMap(File file, int expectHeadSize) {
// default
dataList = FesodSheet.read(file).excelType(ExcelTypeEnum.XLSX).sheet().doReadSync();
dataList.forEach(d -> {
log.info(JSON.toJSONString(d, JSONWriter.Feature.WriteMapNullValue));
log.info("{}", d);
Assertions.assertTrue(d.size() >= expectHeadSize);
});

Expand All @@ -76,7 +74,7 @@ private void readFileWithMap(File file, int expectHeadSize) {
.sheet()
.doReadSync();
dataList.forEach(d -> {
log.info(JSON.toJSONString(d, JSONWriter.Feature.WriteMapNullValue));
log.info("{}", d);
Assertions.assertTrue(d.size() >= expectHeadSize);
});
}
Expand All @@ -88,7 +86,7 @@ private void readFileWithPOJO(File file) {
.sheet()
.doReadSync();
dataList.forEach(d -> {
log.info(JSON.toJSONString(d, JSONWriter.Feature.WriteMapNullValue));
log.info("{}", d);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

package org.apache.fesod.sheet.readwrite;

import com.alibaba.fastjson2.JSON;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -111,7 +110,7 @@ private void testAutoStripSheetNameInternal(
.registerReadListenerIfNotNull(new AnalysisEventListener<SimpleData>() {
@Override
public void invoke(SimpleData data, AnalysisContext context) {
log.info("Read one record: {}", JSON.toJSONString(data));
log.info("Read one record: {}", data);
}

@Override
Expand Down Expand Up @@ -175,7 +174,7 @@ private void testAutoStripContentInternal(
.sheet()
.doReadSync();

log.info("Read records: {}", JSON.toJSONString(dataList));
log.info("Read records: {}", dataList);
Assertions.assertEquals(2, dataList.size());
if (Boolean.TRUE.equals(autoStrip)) {
Assertions.assertEquals(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

package org.apache.fesod.sheet.readwrite;

import com.alibaba.fastjson2.JSON;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -72,7 +71,7 @@ public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context)
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
if (!list.isEmpty()) {
log.debug("First row:{}", JSON.toJSONString(list.get(0)));
log.debug("First row:{}", list.get(0));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

package org.apache.fesod.sheet.readwrite;

import com.alibaba.fastjson2.JSON;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.fesod.sheet.context.AnalysisContext;
Expand All @@ -42,11 +41,11 @@ public class LargeDataListener extends AnalysisEventListener<LargeData> {
@Override
public void invoke(LargeData data, AnalysisContext context) {
if (count == 0) {
log.info("First row:{}", JSON.toJSONString(data));
log.info("First row:{}", data);
}
count++;
if (count % 100000 == 0) {
log.info("Already read:{},{}", count, JSON.toJSONString(data));
log.info("Already read:{},{}", count, data);
}
}

Expand Down
11 changes: 0 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ under the License.
<slf4j-api.version>2.0.20</slf4j-api.version>
<lombok.version>1.18.44</lombok.version>
<spring-core.version>5.3.39</spring-core.version>
<fastjson2.version>2.0.65</fastjson2.version>
<spring-boot-starter-web.version>2.7.18</spring-boot-starter-web.version>
<slf4j-simple.version>2.0.20</slf4j-simple.version>
<jcl-over-slf4j.version>2.0.20</jcl-over-slf4j.version>
Expand Down Expand Up @@ -206,11 +205,6 @@ under the License.
<artifactId>spring-core</artifactId>
<version>${spring-core.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>${fastjson2.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
Expand Down Expand Up @@ -308,11 +302,6 @@ under the License.
<scope>provided</scope>
</dependency>
<!-- test -->
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down
Loading