-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 56ca6a4
Showing
14 changed files
with
1,133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
target/ | ||
*/target/ | ||
*/classes/ | ||
*.jar | ||
*.class | ||
*/application-test.properties | ||
*/application-prod.properties | ||
*.iml | ||
.idea/ | ||
.settings/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<groupId>io.xream.sspoin</groupId> | ||
<version>0.0.1</version> | ||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>sspoin</artifactId> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> | ||
<maven.test.skip>true</maven.test.skip> | ||
<poi.version>3.17</poi.version> | ||
<commons-lang3.version>3.12.0</commons-lang3.version> | ||
</properties> | ||
|
||
<scm> | ||
<connection>scm:git:https://github.com/x-ream/sspoin</connection> | ||
<developerConnection>scm:git:https://github.com/x-ream/sspoin</developerConnection> | ||
<url>scm:git:https://github.com/x-ream/sspoin</url> | ||
<tag>0.0.1</tag> | ||
</scm> | ||
|
||
<licenses> | ||
<license> | ||
<name>Apache 2</name> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0</url> | ||
<distribution>repo</distribution> | ||
<comments>A business-friendly OSS license</comments> | ||
</license> | ||
</licenses> | ||
|
||
<developers> | ||
<developer> | ||
<name>Sim Wang</name> | ||
<email>[email protected]</email> | ||
</developer> | ||
</developers> | ||
|
||
<distributionManagement> | ||
<snapshotRepository> | ||
<id>oss-s</id> | ||
<name>sqli snapshots repo</name> | ||
<url>https://oss.sonatype.org/content/repositories/snapshots</url> | ||
</snapshotRepository> | ||
<repository> | ||
<id>oss-r</id> | ||
<name>sqli release repo</name> | ||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url> | ||
</repository> | ||
</distributionManagement> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.poi</groupId> | ||
<artifactId>poi</artifactId> | ||
<version>${poi.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.poi</groupId> | ||
<artifactId>poi-ooxml</artifactId> | ||
<version>${poi.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
<version>${commons-lang3.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
|
||
<build> | ||
|
||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>versions-maven-plugin</artifactId> | ||
<version>2.7</version> | ||
<configuration> | ||
<generateBackupPoms>false</generateBackupPoms> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-javadoc-plugin</artifactId> | ||
<version>3.1.1</version> | ||
<configuration> | ||
<encoding>UTF-8</encoding> | ||
<charset>UTF-8</charset> | ||
<docencoding>UTF-8</docencoding> | ||
<additionalJOption>-Xdoclint:none</additionalJOption> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>attach-javadocs</id> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-source-plugin</artifactId> | ||
<version>3.2.0</version> | ||
<configuration> | ||
<attach>true</attach> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>source-jar</id> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<!-- | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-gpg-plugin</artifactId> | ||
<version>1.6</version> | ||
<executions> | ||
<execution> | ||
<id>sign-artifacts</id> | ||
<phase>verify</phase> | ||
<goals> | ||
<goal>sign</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
--> | ||
</plugins> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
</resource> | ||
</resources> | ||
</build> | ||
|
||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.xream.sspoin; | ||
|
||
/** | ||
* @author Sim | ||
*/ | ||
public class CellError { | ||
|
||
private String meta; | ||
private String error; | ||
|
||
public String getMeta() { | ||
return meta; | ||
} | ||
|
||
public void setMeta(String meta) { | ||
this.meta = meta; | ||
} | ||
|
||
public String getError() { | ||
return error; | ||
} | ||
|
||
public void setError(String error) { | ||
this.error = error; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package io.xream.sspoin; | ||
|
||
import java.util.HashSet; | ||
import java.util.Iterator; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
/** | ||
* @author Sim | ||
*/ | ||
public interface ErrorAppender { | ||
|
||
static void append(Errors errors, List list) { | ||
|
||
Set<Integer> rowNumSet = new HashSet<Integer>(); | ||
|
||
for (Object t : list) { | ||
Templated obj = (Templated) t; | ||
final List<CellError> cellErrorList = obj.getRowError().getCellErrors(); | ||
if (!cellErrorList.isEmpty()) { | ||
int rowNum = obj.getRowNum(); | ||
RowError rowErrorExist = null; | ||
for (RowError rowError : errors.getRowErrors()){ | ||
if (rowNum == rowError.getRowNum()){ | ||
rowErrorExist = rowError; | ||
break; | ||
} | ||
} | ||
if (rowErrorExist == null) { | ||
rowErrorExist = new RowError(); | ||
rowErrorExist.setRowNum(rowNum); | ||
errors.getRowErrors().add(rowErrorExist); | ||
} | ||
rowErrorExist.getCellErrors().addAll(cellErrorList); | ||
|
||
rowNumSet.add(obj.getRowNum()); | ||
} | ||
} | ||
|
||
Iterator<Templated> iterator = list.iterator(); | ||
while (iterator.hasNext()) { | ||
Templated obj = iterator.next(); | ||
Integer v = obj.getRowNum(); | ||
if (rowNumSet.contains(v)) { | ||
iterator.remove(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package io.xream.sspoin; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* @author Sim | ||
*/ | ||
public class Errors { | ||
|
||
private String fileName; | ||
private int rowOffset; | ||
private List<String> metas = new ArrayList<>(); | ||
private List<RowError> rowErrors; | ||
|
||
private Errors(Parsed parsed,String fileName) { | ||
this.fileName = fileName; | ||
this.rowOffset = parsed.getMetaRow(); | ||
this.rowErrors = new ArrayList<>(); | ||
} | ||
|
||
public String getFileName() { | ||
return fileName; | ||
} | ||
|
||
public void setFileName(String fileName) { | ||
this.fileName = fileName; | ||
} | ||
|
||
public int getRowOffset() { | ||
return rowOffset; | ||
} | ||
|
||
public void setRowOffset(int rowOffset) { | ||
this.rowOffset = rowOffset; | ||
} | ||
|
||
public List<String> getMetas() { | ||
return metas; | ||
} | ||
|
||
public List<RowError> getRowErrors() { | ||
return rowErrors; | ||
} | ||
|
||
public void setRowErrors(List<RowError> rowErrors) { | ||
this.rowErrors = rowErrors; | ||
} | ||
|
||
public static Errors of(Parsed parsed, String fileName) { | ||
if (parsed == null){ | ||
throw new IllegalArgumentException("parsed before, then init errors"); | ||
} | ||
return new Errors(parsed,fileName); | ||
} | ||
|
||
} |
Oops, something went wrong.