Commit 991c3a50 by chengzhuoshen

0822swift官网MX2MT更新-3

parent 915882ea
...@@ -14,6 +14,7 @@ import com.prowidesoftware.swift.io.IConversionService; ...@@ -14,6 +14,7 @@ import com.prowidesoftware.swift.io.IConversionService;
import com.prowidesoftware.swift.io.writer.SwiftWriter; import com.prowidesoftware.swift.io.writer.SwiftWriter;
import com.prowidesoftware.swift.model.*; import com.prowidesoftware.swift.model.*;
import com.prowidesoftware.swift.model.field.*; import com.prowidesoftware.swift.model.field.*;
import com.prowidesoftware.swift.model.mx.AbstractMX;
import com.prowidesoftware.swift.model.mx.NamespaceReader; import com.prowidesoftware.swift.model.mx.NamespaceReader;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.dom4j.*; import org.dom4j.*;
...@@ -512,6 +513,14 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator { ...@@ -512,6 +513,14 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
IConversionService srv = new ConversionService(); IConversionService srv = new ConversionService();
String mtStr = srv.getFIN(swiftMessage); String mtStr = srv.getFIN(swiftMessage);
SwiftTranslationReport str = context.get(SwiftTranslationReport.class); SwiftTranslationReport str = context.get(SwiftTranslationReport.class);
AbstractMX abstractMX = (AbstractMX)context.get(Mx2MtContextIdentifier.MX_OBJ, true);
if (abstractMX != null && abstractMX.getMxId() != null) {
str.setMxType(abstractMX.getMxId().getBusinessProcess().name()
+ abstractMX.getMxId().getFunctionality()
+ abstractMX.getMxId().getVariant()
+ abstractMX.getMxId().getVersion());
}
str.setMtType(getMtType());
str.setMessage(mtStr); str.setMessage(mtStr);
String outputFilePath = (String)context.get(Mx2MtContextIdentifier.MX_TO_MT_OUTPUT_FILE_PATH, true); String outputFilePath = (String)context.get(Mx2MtContextIdentifier.MX_TO_MT_OUTPUT_FILE_PATH, true);
if (StringUtil.isNotEmpty(outputFilePath)) { if (StringUtil.isNotEmpty(outputFilePath)) {
......
...@@ -49,6 +49,9 @@ public class Field60Generate extends AbstractMx2MtTagsGenerate { ...@@ -49,6 +49,9 @@ public class Field60Generate extends AbstractMx2MtTagsGenerate {
if (counter != 1) { //没有OPBD 或者 OPBD不止一条数据 if (counter != 1) { //没有OPBD 或者 OPBD不止一条数据
buildSTErrorInfo(84, "Block4/60a", null); buildSTErrorInfo(84, "Block4/60a", null);
} }
if (index == -1) {
return;
}
String pageNumber = getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.StmtPgntn.PgNb"); String pageNumber = getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.StmtPgntn.PgNb");
if (StringUtil.isNotEmpty(pageNumber)) { if (StringUtil.isNotEmpty(pageNumber)) {
int pgNb = Integer.parseInt(pageNumber); int pgNb = Integer.parseInt(pageNumber);
......
...@@ -49,6 +49,9 @@ public class Field62Generate extends AbstractMx2MtTagsGenerate { ...@@ -49,6 +49,9 @@ public class Field62Generate extends AbstractMx2MtTagsGenerate {
if (counter != 1) { //没有CLBD 或者 CLBD不止一条数据 if (counter != 1) { //没有CLBD 或者 CLBD不止一条数据
buildSTErrorInfo(87, "Block4/62a", null); buildSTErrorInfo(87, "Block4/62a", null);
} }
if (index == -1) {
return;
}
String lastPageIndicator = getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.StmtPgntn.LastPgInd"); String lastPageIndicator = getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.StmtPgntn.LastPgInd");
if (StringUtil.isNotEmpty(lastPageIndicator) && Boolean.TRUE.equals(Boolean.valueOf(lastPageIndicator))) { if (StringUtil.isNotEmpty(lastPageIndicator) && Boolean.TRUE.equals(Boolean.valueOf(lastPageIndicator))) {
String subTypeCode = getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.Bal("+index+").Tp.SubTp.Cd"); String subTypeCode = getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.Bal("+index+").Tp.SubTp.Cd");
......
...@@ -766,7 +766,7 @@ public class SwiftTransferUtil { ...@@ -766,7 +766,7 @@ public class SwiftTransferUtil {
* List<SwiftTransferErrorInfo> * List<SwiftTransferErrorInfo>
*/ */
public static SwiftTranslationErrorInfo getSwiftTranslationErrorInfoById(long id) { public static SwiftTranslationErrorInfo getSwiftTranslationErrorInfoById(long id) {
//if (stErrorInfos == null) { if (stErrorInfos == null) {
try { try {
stErrorInfos = new ArrayList<>(); stErrorInfos = new ArrayList<>();
InputStream resourceAsStream = SwiftTransferUtil.class.getResourceAsStream("/ErrorCodeList.xlsx"); InputStream resourceAsStream = SwiftTransferUtil.class.getResourceAsStream("/ErrorCodeList.xlsx");
...@@ -791,7 +791,7 @@ public class SwiftTransferUtil { ...@@ -791,7 +791,7 @@ public class SwiftTransferUtil {
stErrorInfos = null; //如果出现异常,stErrorInfos=null,下次仍需初始化 stErrorInfos = null; //如果出现异常,stErrorInfos=null,下次仍需初始化
throw e; throw e;
} }
// } }
SwiftTranslationErrorInfo tmpErrorInfo = null; SwiftTranslationErrorInfo tmpErrorInfo = null;
if (stErrorInfos != null && stErrorInfos.size() > 0) { if (stErrorInfos != null && stErrorInfos.size() > 0) {
for (int i=0; i<stErrorInfos.size(); i++) { for (int i=0; i<stErrorInfos.size(); i++) {
......
...@@ -16,6 +16,10 @@ public class SwiftTranslationReport { ...@@ -16,6 +16,10 @@ public class SwiftTranslationReport {
private String translationResult; private String translationResult;
private String mxType;
private String mtType;
public List<SwiftTranslationErrorInfo> getErrorInfos() { public List<SwiftTranslationErrorInfo> getErrorInfos() {
if (errorInfos == null) { if (errorInfos == null) {
errorInfos = new ArrayList<>(); errorInfos = new ArrayList<>();
...@@ -42,4 +46,20 @@ public class SwiftTranslationReport { ...@@ -42,4 +46,20 @@ public class SwiftTranslationReport {
public void setTranslationResult(String translationResult) { public void setTranslationResult(String translationResult) {
this.translationResult = translationResult; this.translationResult = translationResult;
} }
public String getMxType() {
return mxType;
}
public void setMxType(String mxType) {
this.mxType = mxType;
}
public String getMtType() {
return mtType;
}
public void setMtType(String mtType) {
this.mtType = mtType;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment