Skip to content

Commit

Permalink
[update][plugin][excelwriter] Simplify dependencies, add missing log4…
Browse files Browse the repository at this point in the history
…j-core deps
  • Loading branch information
wgzhao committed Oct 9, 2024
1 parent 4ea03b3 commit e26003e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
6 changes: 3 additions & 3 deletions plugin/writer/excelwriter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${poi.version}</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.23.1</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Collections;
import java.util.List;

import static com.wgzhao.addax.common.base.Constant.DEFAULT_DATE_FORMAT;
import static com.wgzhao.addax.common.base.Key.FILE_NAME;
import static com.wgzhao.addax.common.base.Key.HEADER;
import static com.wgzhao.addax.common.base.Key.PATH;
Expand Down Expand Up @@ -77,11 +78,7 @@ private void validateParameter()
"Create directory '" + path + "' failure: permission deny: ", se);
}
}
@Override
public void prepare()
{

}
@Override
public void destroy()
{
Expand All @@ -100,17 +97,15 @@ public static class Task
extends Writer.Task
{

private Configuration conf;

private String filePath;
private List<String> header;

@Override
public void init()
{
this.conf = this.getPluginJobConf();
this.filePath = this.conf.get(PATH) + "/" + this.conf.get(FILE_NAME);
this.header =this.conf.getList(HEADER, String.class);
Configuration conf = this.getPluginJobConf();
this.filePath = conf.get(PATH) + "/" + conf.get(FILE_NAME);
this.header = conf.getList(HEADER, String.class);
}

@Override
Expand Down Expand Up @@ -139,7 +134,7 @@ public void startWrite(RecordReceiver lineReceiver)
// set date format
CellStyle dateStyle = workbook.createCellStyle();
CreationHelper createHelper = workbook.getCreationHelper();
dateStyle.setDataFormat(createHelper.createDataFormat().getFormat("yyyy-MM-dd HH:mm:ss"));
dateStyle.setDataFormat(createHelper.createDataFormat().getFormat(DEFAULT_DATE_FORMAT));

while ( (record = lineReceiver.getFromReader()) != null)
{
Expand Down

0 comments on commit e26003e

Please sign in to comment.