parent
3135905dcc
commit
143f7f9088
8 changed files with 350 additions and 14 deletions
|
|
@ -10,53 +10,124 @@ public class SWTHeaderData {
|
||||||
private String type;
|
private String type;
|
||||||
private LocalDateTime dateTime;
|
private LocalDateTime dateTime;
|
||||||
private String valFor20Tag;
|
private String valFor20Tag;
|
||||||
|
private String valFor18ATag;
|
||||||
private String valFor21Tag;
|
private String valFor21Tag;
|
||||||
private String valFor23Tag;
|
private String valFor23Tag;
|
||||||
private String valFor35ATag;
|
private String valFor35ATag;
|
||||||
private String valFor35BTag;
|
private String valFor35BTag;
|
||||||
|
private String valFor76Tag;
|
||||||
|
private String valFor77ATag;
|
||||||
private String valFor82DTag;
|
private String valFor82DTag;
|
||||||
private String valFor87CTag;
|
private String valFor87CTag;
|
||||||
|
|
||||||
|
public String getTo() {
|
||||||
|
return to;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValFor76Tag() {
|
||||||
|
return valFor76Tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValFor76Tag(String valFor76Tag) {
|
||||||
|
this.valFor76Tag = valFor76Tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValFor77ATag() {
|
||||||
|
return valFor77ATag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValFor77ATag(String valFor77ATag) {
|
||||||
|
this.valFor77ATag = valFor77ATag;
|
||||||
|
}
|
||||||
|
|
||||||
public void setTo(String to) {
|
public void setTo(String to) {
|
||||||
this.to = to;
|
this.to = to;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFrom() {
|
||||||
|
return from;
|
||||||
|
}
|
||||||
|
|
||||||
public void setFrom(String from) {
|
public void setFrom(String from) {
|
||||||
this.from = from;
|
this.from = from;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
public void setType(String type) {
|
public void setType(String type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getDateTime() {
|
||||||
|
return dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDateTime(LocalDateTime dateTime) {
|
public void setDateTime(LocalDateTime dateTime) {
|
||||||
this.dateTime = dateTime;
|
this.dateTime = dateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getValFor20Tag() {
|
||||||
|
return valFor20Tag;
|
||||||
|
}
|
||||||
|
|
||||||
public void setValFor20Tag(String valFor20Tag) {
|
public void setValFor20Tag(String valFor20Tag) {
|
||||||
this.valFor20Tag = valFor20Tag;
|
this.valFor20Tag = valFor20Tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getValFor18ATag() {
|
||||||
|
return valFor18ATag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValFor18ATag(String valFor18ATag) {
|
||||||
|
this.valFor18ATag = valFor18ATag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValFor21Tag() {
|
||||||
|
return valFor21Tag;
|
||||||
|
}
|
||||||
|
|
||||||
public void setValFor21Tag(String valFor21Tag) {
|
public void setValFor21Tag(String valFor21Tag) {
|
||||||
this.valFor21Tag = valFor21Tag;
|
this.valFor21Tag = valFor21Tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getValFor23Tag() {
|
||||||
|
return valFor23Tag;
|
||||||
|
}
|
||||||
|
|
||||||
public void setValFor23Tag(String valFor23Tag) {
|
public void setValFor23Tag(String valFor23Tag) {
|
||||||
this.valFor23Tag = valFor23Tag;
|
this.valFor23Tag = valFor23Tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getValFor35ATag() {
|
||||||
|
return valFor35ATag;
|
||||||
|
}
|
||||||
|
|
||||||
public void setValFor35ATag(String valFor35ATag) {
|
public void setValFor35ATag(String valFor35ATag) {
|
||||||
this.valFor35ATag = valFor35ATag;
|
this.valFor35ATag = valFor35ATag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getValFor35BTag() {
|
||||||
|
return valFor35BTag;
|
||||||
|
}
|
||||||
|
|
||||||
public void setValFor35BTag(String valFor35BTag) {
|
public void setValFor35BTag(String valFor35BTag) {
|
||||||
this.valFor35BTag = valFor35BTag;
|
this.valFor35BTag = valFor35BTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getValFor82DTag() {
|
||||||
|
return valFor82DTag;
|
||||||
|
}
|
||||||
|
|
||||||
public void setValFor82DTag(String valFor82DTag) {
|
public void setValFor82DTag(String valFor82DTag) {
|
||||||
this.valFor82DTag = valFor82DTag;
|
this.valFor82DTag = valFor82DTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getValFor87CTag() {
|
||||||
|
return valFor87CTag;
|
||||||
|
}
|
||||||
|
|
||||||
public void setValFor87CTag(String valFor87CTag) {
|
public void setValFor87CTag(String valFor87CTag) {
|
||||||
this.valFor87CTag = valFor87CTag;
|
this.valFor87CTag = valFor87CTag;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package ru.spcex.clearing.swt.importer.logic.data.tables;
|
package ru.spcex.clearing.swt.importer.logic.data.tables;
|
||||||
|
|
||||||
|
import ru.spcex.clearing.swt.importer.util.SWTHeaderData;
|
||||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||||
import ru.spcex.platform.imdg.iml.hazelcast.adapter.ImdgHazelcast;
|
import ru.spcex.platform.imdg.iml.hazelcast.adapter.ImdgHazelcast;
|
||||||
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||||
|
|
@ -31,7 +32,7 @@ public abstract class AbstractTable<T extends SpcexObjectBase> {
|
||||||
this.hazelcastService = hazelcastService;
|
this.hazelcastService = hazelcastService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract T getEntity(String[] entity);
|
public abstract T getEntity(SWTHeaderData header, String[] entity);
|
||||||
|
|
||||||
public void injectEntity(T obj) {
|
public void injectEntity(T obj) {
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package ru.spcex.clearing.swt.importer.logic.data.tables;
|
||||||
import ru.clearing.classes.statics.data.sdf.SDf08;
|
import ru.clearing.classes.statics.data.sdf.SDf08;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.swt.importer.logic.data.enums.ETable;
|
import ru.spcex.clearing.swt.importer.logic.data.enums.ETable;
|
||||||
|
import ru.spcex.clearing.swt.importer.util.SWTHeaderData;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
||||||
|
|
@ -17,8 +18,9 @@ public class SDf08Table extends AbstractTable<SDf08> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SDf08 getEntity(String[] entity) {
|
public SDf08 getEntity(SWTHeaderData header, String[] entity) {
|
||||||
SDf08 result = new SDf08();
|
SDf08 result = new SDf08();
|
||||||
|
result.setOutDocument(header.getValFor20Tag());
|
||||||
result.setDepoCode(entity[0]);
|
result.setDepoCode(entity[0]);
|
||||||
result.setQuantity(entity[1]);
|
result.setQuantity(entity[1]);
|
||||||
result.setSecurityCode(entity[2]);
|
result.setSecurityCode(entity[2]);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package ru.spcex.clearing.swt.importer.logic.data.tables;
|
||||||
import ru.clearing.classes.statics.data.sdf.SDf10;
|
import ru.clearing.classes.statics.data.sdf.SDf10;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.swt.importer.logic.data.enums.ETable;
|
import ru.spcex.clearing.swt.importer.logic.data.enums.ETable;
|
||||||
|
import ru.spcex.clearing.swt.importer.util.SWTHeaderData;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
||||||
|
|
@ -17,7 +18,7 @@ public class SDf10Table extends AbstractTable<SDf10> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SDf10 getEntity(String[] entity) {
|
public SDf10 getEntity(SWTHeaderData header, String[] entity) {
|
||||||
SDf10 result = new SDf10();
|
SDf10 result = new SDf10();
|
||||||
result.setDepoCode(entity[0]);
|
result.setDepoCode(entity[0]);
|
||||||
result.setQuantity(entity[1]);
|
result.setQuantity(entity[1]);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package ru.spcex.clearing.swt.importer.logic.data.tables;
|
||||||
import ru.clearing.classes.statics.data.sdf.SDf13;
|
import ru.clearing.classes.statics.data.sdf.SDf13;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.swt.importer.logic.data.enums.ETable;
|
import ru.spcex.clearing.swt.importer.logic.data.enums.ETable;
|
||||||
|
import ru.spcex.clearing.swt.importer.util.SWTHeaderData;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
||||||
|
|
@ -17,7 +18,7 @@ public class SDf13Table extends AbstractTable<SDf13> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SDf13 getEntity(String[] entity) {
|
public SDf13 getEntity(SWTHeaderData header, String[] entity) {
|
||||||
SDf13 result = new SDf13();
|
SDf13 result = new SDf13();
|
||||||
result.setFileName(filename);
|
result.setFileName(filename);
|
||||||
result.setGenerationTime(Instant.now());
|
result.setGenerationTime(Instant.now());
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import ru.spcex.clearing.swt.importer.logic.data.ResultContainer;
|
||||||
import ru.spcex.clearing.swt.importer.logic.data.enums.ETable;
|
import ru.spcex.clearing.swt.importer.logic.data.enums.ETable;
|
||||||
import ru.spcex.clearing.swt.importer.logic.data.enums.StageResult;
|
import ru.spcex.clearing.swt.importer.logic.data.enums.StageResult;
|
||||||
import ru.spcex.clearing.swt.importer.logic.data.tables.AbstractTable;
|
import ru.spcex.clearing.swt.importer.logic.data.tables.AbstractTable;
|
||||||
|
import ru.spcex.clearing.swt.importer.util.SWTHeaderData;
|
||||||
import ru.spcex.clearing.swt.importer.util.SWTReader;
|
import ru.spcex.clearing.swt.importer.util.SWTReader;
|
||||||
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||||
import ru.spcex.platform.utils.log.ExceptionUtils;
|
import ru.spcex.platform.utils.log.ExceptionUtils;
|
||||||
|
|
@ -43,16 +44,15 @@ public class ImportToDB extends Stage {
|
||||||
byte[] source = resultContainer.getSwtSource();
|
byte[] source = resultContainer.getSwtSource();
|
||||||
Charset sourceCharset = Charset.forName(settings.getCommon().getEncodingSource());
|
Charset sourceCharset = Charset.forName(settings.getCommon().getEncodingSource());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try (InputStream is = new ByteArrayInputStream(source);
|
try (InputStream is = new ByteArrayInputStream(source);
|
||||||
SWTReader swtReader = new SWTReader(is, sourceCharset)) {
|
SWTReader swtReader = new SWTReader(is, sourceCharset, resultContainer)) {
|
||||||
AbstractTable table = mappingEnumTableObjectTable.get(currTable);
|
AbstractTable table = mappingEnumTableObjectTable.get(currTable);
|
||||||
table.setHazelcastService(hazelcastService);
|
table.setHazelcastService(hazelcastService);
|
||||||
table.setFilename(resultContainer.getSwtFile().getName());
|
table.setFilename(resultContainer.getSwtFile().getName());
|
||||||
Long fileId = hazelcastService.getImdgIdGenerator().nextId();
|
Long fileId = hazelcastService.getImdgIdGenerator().nextId();
|
||||||
table.setFileId(fileId);
|
table.setFileId(fileId);
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
|
SWTHeaderData swtHeaderData = swtReader.getSWTHeader();
|
||||||
while (swtReader.hasNextRecord()) {
|
while (swtReader.hasNextRecord()) {
|
||||||
counter++;
|
counter++;
|
||||||
String[] entity = swtReader.nextRecord();
|
String[] entity = swtReader.nextRecord();
|
||||||
|
|
@ -60,7 +60,7 @@ public class ImportToDB extends Stage {
|
||||||
log.warn("record index {} null", counter);
|
log.warn("record index {} null", counter);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
table.injectEntity(table.getEntity(entity));
|
table.injectEntity(table.getEntity(swtHeaderData, entity));
|
||||||
}
|
}
|
||||||
kafkaMessenger.notifySystemIfNeeded(currTable, fileId);
|
kafkaMessenger.notifySystemIfNeeded(currTable, fileId);
|
||||||
} catch (IOException exception) {
|
} catch (IOException exception) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,172 @@
|
||||||
|
package ru.spcex.clearing.swt.importer.util;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
public class SWTHeaderData {
|
||||||
|
private static final DateTimeFormatter dtInFileHeaderFormatter = DateTimeFormatter.ofPattern("yyyyMMdd'/'HHmm");
|
||||||
|
private String to;
|
||||||
|
private String from;
|
||||||
|
private String type;
|
||||||
|
private LocalDateTime dateTime;
|
||||||
|
private String valFor20Tag;
|
||||||
|
private String valFor18ATag;
|
||||||
|
private String valFor21Tag;
|
||||||
|
private String valFor23Tag;
|
||||||
|
private String valFor35ATag;
|
||||||
|
private String valFor35BTag;
|
||||||
|
private String valFor76Tag;
|
||||||
|
private String valFor77ATag;
|
||||||
|
private String valFor82DTag;
|
||||||
|
private String valFor87CTag;
|
||||||
|
|
||||||
|
public String getTo() {
|
||||||
|
return to;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValFor76Tag() {
|
||||||
|
return valFor76Tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValFor76Tag(String valFor76Tag) {
|
||||||
|
this.valFor76Tag = valFor76Tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValFor77ATag() {
|
||||||
|
return valFor77ATag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValFor77ATag(String valFor77ATag) {
|
||||||
|
this.valFor77ATag = valFor77ATag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTo(String to) {
|
||||||
|
this.to = to;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFrom() {
|
||||||
|
return from;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFrom(String from) {
|
||||||
|
this.from = from;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getDateTime() {
|
||||||
|
return dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDateTime(LocalDateTime dateTime) {
|
||||||
|
this.dateTime = dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValFor20Tag() {
|
||||||
|
return valFor20Tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValFor20Tag(String valFor20Tag) {
|
||||||
|
this.valFor20Tag = valFor20Tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValFor18ATag() {
|
||||||
|
return valFor18ATag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValFor18ATag(String valFor18ATag) {
|
||||||
|
this.valFor18ATag = valFor18ATag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValFor21Tag() {
|
||||||
|
return valFor21Tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValFor21Tag(String valFor21Tag) {
|
||||||
|
this.valFor21Tag = valFor21Tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValFor23Tag() {
|
||||||
|
return valFor23Tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValFor23Tag(String valFor23Tag) {
|
||||||
|
this.valFor23Tag = valFor23Tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValFor35ATag() {
|
||||||
|
return valFor35ATag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValFor35ATag(String valFor35ATag) {
|
||||||
|
this.valFor35ATag = valFor35ATag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValFor35BTag() {
|
||||||
|
return valFor35BTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValFor35BTag(String valFor35BTag) {
|
||||||
|
this.valFor35BTag = valFor35BTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValFor82DTag() {
|
||||||
|
return valFor82DTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValFor82DTag(String valFor82DTag) {
|
||||||
|
this.valFor82DTag = valFor82DTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValFor87CTag() {
|
||||||
|
return valFor87CTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValFor87CTag(String valFor87CTag) {
|
||||||
|
this.valFor87CTag = valFor87CTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String buildString() {
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
if (to != null) {
|
||||||
|
stringBuilder.append("To:").append(to).append('\n');
|
||||||
|
}
|
||||||
|
if (from != null) {
|
||||||
|
stringBuilder.append("From:").append(from).append('\n');
|
||||||
|
}
|
||||||
|
if (type != null)
|
||||||
|
stringBuilder.append("Type:").append(type).append('\n');
|
||||||
|
if (dateTime != null) {
|
||||||
|
String timeS = dtInFileHeaderFormatter.format(dateTime);
|
||||||
|
stringBuilder.append("Date/Time:").append(timeS).append('\n');
|
||||||
|
}
|
||||||
|
if (valFor20Tag != null) {
|
||||||
|
stringBuilder.append(":20:").append(valFor20Tag).append('\n');
|
||||||
|
}
|
||||||
|
if (valFor21Tag != null) {
|
||||||
|
stringBuilder.append(":21:").append(valFor21Tag).append('\n');
|
||||||
|
}
|
||||||
|
if (valFor23Tag != null) {
|
||||||
|
stringBuilder.append(":23:").append(valFor23Tag).append('\n');
|
||||||
|
}
|
||||||
|
if (valFor35ATag != null) {
|
||||||
|
stringBuilder.append(":35A:SHS").append(valFor35ATag).append('\n');
|
||||||
|
}
|
||||||
|
if (valFor35BTag != null) {
|
||||||
|
stringBuilder.append(":35B:ISIN ").append(valFor35BTag).append('\n');
|
||||||
|
}
|
||||||
|
if (valFor82DTag != null) {
|
||||||
|
stringBuilder.append(":82D:").append(valFor82DTag).append('\n');
|
||||||
|
}
|
||||||
|
if (valFor87CTag != null) {
|
||||||
|
stringBuilder.append(":87C:").append(valFor87CTag).append('\n');
|
||||||
|
}
|
||||||
|
return stringBuilder.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.spcex.clearing.swt.importer.util;
|
package ru.spcex.clearing.swt.importer.util;
|
||||||
|
|
||||||
|
import ru.spcex.clearing.swt.importer.logic.data.ResultContainer;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
@ -9,19 +11,105 @@ import java.util.Scanner;
|
||||||
public class SWTReader implements Closeable {
|
public class SWTReader implements Closeable {
|
||||||
protected InputStream inputStream;
|
protected InputStream inputStream;
|
||||||
protected Scanner scanner;
|
protected Scanner scanner;
|
||||||
|
protected ResultContainer resultContainer;
|
||||||
|
|
||||||
public SWTReader(InputStream inputStream, Charset charset) {
|
public SWTReader(InputStream inputStream, Charset charset, ResultContainer resultContainer) {
|
||||||
this.inputStream = inputStream;
|
this.inputStream = inputStream;
|
||||||
this.scanner = new Scanner(inputStream, charset);
|
this.scanner = new Scanner(inputStream, charset);
|
||||||
|
this.resultContainer = resultContainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWTHeaderData getSWTHeader() {
|
||||||
|
SWTHeaderData swtHeaderData = new SWTHeaderData();
|
||||||
|
String to, from, type, dateTime;
|
||||||
|
/*
|
||||||
|
* To:SPCEX
|
||||||
|
From:RDC
|
||||||
|
Type:596
|
||||||
|
Date/Time:20220908/1534
|
||||||
|
S_DF_08
|
||||||
|
S_DF_10
|
||||||
|
S_DF_13
|
||||||
|
* */
|
||||||
|
String line = scanner.nextLine();
|
||||||
|
to = line.substring(line.lastIndexOf("To:"));
|
||||||
|
line = scanner.nextLine();
|
||||||
|
from = line.substring(line.lastIndexOf("From:"));
|
||||||
|
line = scanner.nextLine();
|
||||||
|
type = line.substring(line.lastIndexOf("Type:"));
|
||||||
|
line = scanner.nextLine();
|
||||||
|
dateTime = line.substring(line.lastIndexOf("Date/Time:"));
|
||||||
|
switch (resultContainer.getSwtTable()) {
|
||||||
|
case S_DF_08: {
|
||||||
|
String val20, val21, val18A;
|
||||||
|
/*
|
||||||
|
* :20:SDC230227084839
|
||||||
|
:21:NONREF
|
||||||
|
:18A:46
|
||||||
|
* */
|
||||||
|
line = scanner.nextLine();
|
||||||
|
val20 = line.substring(line.lastIndexOf(":20:"));
|
||||||
|
line = scanner.nextLine();
|
||||||
|
val21 = line.substring(line.lastIndexOf(":21:"));
|
||||||
|
line = scanner.nextLine();
|
||||||
|
val18A = line.substring(line.lastIndexOf(":18A:"));
|
||||||
|
swtHeaderData.setValFor20Tag(val20);
|
||||||
|
swtHeaderData.setValFor21Tag(val21);
|
||||||
|
swtHeaderData.setValFor18ATag(val18A);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case S_DF_10: {
|
||||||
|
/*
|
||||||
|
* :20:RNCB_2210170001-010
|
||||||
|
* */
|
||||||
|
String val20;
|
||||||
|
line = scanner.nextLine();
|
||||||
|
val20 = line.substring(line.lastIndexOf(":20:"));
|
||||||
|
swtHeaderData.setValFor20Tag(val20);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case S_DF_13:
|
||||||
|
/*
|
||||||
|
* :20:220908M58C0001EX
|
||||||
|
:21:XXX202209081526
|
||||||
|
:76:EXECUTED
|
||||||
|
|
||||||
|
:77A:Поручение исполнено
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
String val20, val21, val76, val77A;
|
||||||
|
line = scanner.nextLine();
|
||||||
|
val20 = line.substring(line.lastIndexOf(":20:"));
|
||||||
|
line = scanner.nextLine();
|
||||||
|
val21 = line.substring(line.lastIndexOf(":21:"));
|
||||||
|
line = scanner.nextLine();
|
||||||
|
val76 = line.substring(line.lastIndexOf(":76:"));
|
||||||
|
line = scanner.nextLine();
|
||||||
|
val77A = line.substring(line.lastIndexOf(":77A:"));
|
||||||
|
swtHeaderData.setValFor20Tag(val20);
|
||||||
|
swtHeaderData.setValFor21Tag(val21);
|
||||||
|
swtHeaderData.setValFor76Tag(val76);
|
||||||
|
swtHeaderData.setValFor77ATag(val77A);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException("Could not map header data for " + resultContainer.getSwtTable().name());
|
||||||
|
}
|
||||||
|
return swtHeaderData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] nextRecord() {
|
public String[] nextRecord() {
|
||||||
String line = scanner.nextLine();
|
switch (resultContainer.getSwtTable()) {
|
||||||
String[] separetedLine = line.split(":");
|
case S_DF_08, S_DF_10:
|
||||||
if (separetedLine.length < 5) {
|
String line = scanner.nextLine();
|
||||||
return null;
|
String[] separetedLine = line.split(":");
|
||||||
|
if (separetedLine.length < 5) {
|
||||||
|
return new String[0];
|
||||||
|
}
|
||||||
|
return separetedLine;
|
||||||
|
case S_DF_13:
|
||||||
|
default:
|
||||||
|
return new String[0];
|
||||||
}
|
}
|
||||||
return separetedLine;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasNextRecord() {
|
public boolean hasNextRecord() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue