Commit 9ae8a5ae by zhanghou

修改mt_To_mxField76和mt_To_mxField79方法

parent ffe0eaa1
......@@ -1669,8 +1669,22 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField {
}
}
protected String mt_To_mxField76(String mt76, Map<String, Object> maps){
String mt76Value = mt76.replace("\r\n//", " ").trim();
protected String mt_To_mxField76(List<String> lines, Map<String, Object> maps){
String mt76Value = "";
if(lines!=null){
for (int i = 0; i < lines.size(); i++) {
if(i<lines.size()-1){
if(lines.get(i).length()<35&&lines.get(i+1).startsWith("//")){
mt76Value = mt76Value + lines.get(i) + " ";
}else {
mt76Value = mt76Value + lines.get(i);
}
}else {
mt76Value = mt76Value + lines.get(i);
}
}
}
mt76Value = mt76Value.replace("//", "").trim();
String status = "";
String reason = "";
if(mt76Value.length()>5){
......@@ -1734,6 +1748,8 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField {
if (additionalInformation.length()>105){
list.add(additionalInformation.substring(0,105));
list.add(additionalInformation.substring(105));
}else {
list.add(additionalInformation);
}
JSONArray addtlInfJsonArray = null;
if(cxlStsRsnInfMaps.containsKey("addtlInf")){
......@@ -1763,11 +1779,26 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField {
mxType = "MT" + mtType;
}else {
mxType = "MT" + mtType;
buildSTErrorInfo(ERROR.T20089, "Undrlyg/TxInf/OrgnlGrpInf/OrgnlMsgId", null);
}
return mxType;
}
protected void mt_To_mxField79(String mt79, Map<String, Object> maps){
String mt79Value = mt79.replace("\r\n//", " ").trim();
protected void mt_To_mxField79(List<String> lines, Map<String, Object> maps){
String mt79Value = "";
if(lines!=null){
for (int i = 0; i < lines.size(); i++) {
if(i<lines.size()-1){
if(lines.get(i).length()<50&&lines.get(i+1).startsWith("//")){
mt79Value = mt79Value + lines.get(i) + " ";
}else {
mt79Value = mt79Value + lines.get(i);
}
}else {
mt79Value = mt79Value + lines.get(i);
}
}
}
mt79Value = mt79Value.replace("//", "").trim();
String code = "";
if(mt79Value.length()>5){
code = mt79Value.substring(1,5);
......@@ -1808,6 +1839,8 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField {
if (additionalInformation.length()>105){
list.add(additionalInformation.substring(0,105));
list.add(additionalInformation.substring(105));
}else {
list.add(additionalInformation);
}
JSONArray cxlRsnInfJSONArray = null;
Map<String,Object> cxlRsnInfMaps = null;
......
package com.brilliance.swift.mt2mx.camt029001;
import com.alibaba.fastjson.JSONArray;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.AbstractMt2MxCreator;
import com.brilliance.swift.mt2mx.Mt2MxContextIdentifier;
import com.brilliance.swift.mt2mx.Mt2MxParseField;
import com.brilliance.swift.mt2mx.camt029001.impl.*;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.util.SwiftTransferUtil;
import com.brilliance.swift.vo.SwiftTranslationErrorInfo;
import com.brilliance.swift.vo.SwiftTranslationReport;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field77A;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.ArrayList;
......@@ -87,6 +94,37 @@ public class Mt2MxCamt029001Creator extends AbstractMt2MxCreator {
JSONArray adrLineJsonArray = new JSONArray();
pstlAdrMaps.put("adrLine",adrLineJsonArray);
adrLineJsonArray.add(Mx2MtConstants.MT_TO_MX_DEFAULT_VALUE);
Tag tag77A = abstractMT.getSwiftMessage().getBlock4().getTagByName("77A");
Field77A field77A = (Field77A)tag77A.asField();
String String77A = field77A.getValue().replace("\r\n//", " ").replace("\r\n","");
int index = String77A.indexOf("/UETR/");
String uetr = "";
if(index>-1){
uetr = String77A.substring(index+6);
}
if(StringUtil.isEmpty(orgnlUETR)&&StringUtil.isEmpty(uetr)){
buildSTErrorInfo(ERROR.T20087, "Block3/UETR", null);
}
}
protected void buildSTErrorInfo(String errorCode, String location, String originalValue) {
SwiftTranslationReport str = context.get(SwiftTranslationReport.class);
SwiftTranslationErrorInfo errorInfo = SwiftTransferUtil.getSwiftTranslationErrorInfoByErrorCode(errorCode);
errorInfo.setLocation(location);
errorInfo.setOriginalValue(originalValue);
List<SwiftTranslationErrorInfo> errorInfos = str.getErrorInfos();
boolean existFlag = false;
for (int i=0; i<errorInfos.size(); i++) {
if (SwiftTransferUtil.compareStErrorInfo(errorInfo, errorInfos.get(i))) {
existFlag = true;
break;
}
}
if (!existFlag) {
str.addErrorInfo(errorInfo);
if ("FAILURE".equalsIgnoreCase(errorInfo.getErrorType())) {
throw new SwiftException(location + Mx2MtConstants.NEW_LINE + "-" + errorInfo.getErrorType() + ":" + errorInfo.getDescription());
}
}
}
@Override
......
package com.brilliance.swift.mt2mx.camt029001.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.camt029001.AbstractMt2MxCamt029001ParseField;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field76;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.List;
import java.util.Map;
public class Camt029001Parse76Field extends AbstractMt2MxCamt029001ParseField {
......@@ -19,9 +21,12 @@ public class Camt029001Parse76Field extends AbstractMt2MxCamt029001ParseField {
if (tag76 != null) {
Field76 field76 = (Field76)tag76.asField();
Map<String, Object> txInfAndStsMaps = getTxInfAndStsMaps();
String sts = mt_To_mxField76(field76.getValue(), txInfAndStsMaps);
List<String> lines = field76.getLines();
String sts = mt_To_mxField76(lines, txInfAndStsMaps);
if("CNCL".equals(sts)||"PDCR".equals(sts)||"RJCR".equals(sts)){
stsMaps.put("conf",sts);
}else {
buildSTErrorInfo(ERROR.T20093, "Block4:76:", null);
}
}
}
......
package com.brilliance.swift.mt2mx.camt029001.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.camt029001.AbstractMt2MxCamt029001ParseField;
import com.prowidesoftware.swift.model.Tag;
......@@ -19,12 +20,16 @@ public class Camt029001Parse77AField extends AbstractMt2MxCamt029001ParseField {
if (tag77A != null) {
Map<String, Object> txInfAndStsMaps = getTxInfAndStsMaps();
Field77A field77A = (Field77A)tag77A.asField();
String String77A = field77A.getValue().replace("\r\n//", " ").replace("\r\n","");
String String77A = field77A.getValue().replace("\r\n//", "").replace("\r\n","");
int index = String77A.indexOf("/UETR/");
String uetr = "";
if(index>-1){
String uetr = String77A.substring(index+6);
uetr = String77A.substring(index+6);
txInfAndStsMaps.put("orgnlUETR",uetr);
}
if(!((uetr.length()+6)==String77A.length())){
buildSTErrorInfo(ERROR.T20094, "Block4:77A:", null);
}
}
}
}
package com.brilliance.swift.mt2mx.camt054001;
import com.alibaba.fastjson.JSONArray;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.AbstractMt2MxCreator;
import com.brilliance.swift.mt2mx.Mt2MxContextIdentifier;
import com.brilliance.swift.mt2mx.Mt2MxParseField;
import com.brilliance.swift.mt2mx.camt029001.impl.*;
import com.brilliance.swift.mt2mx.camt054001.impl.*;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.util.SwiftTransferUtil;
import com.brilliance.swift.vo.SwiftTranslationErrorInfo;
import com.brilliance.swift.vo.SwiftTranslationReport;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field32A;
import com.prowidesoftware.swift.model.mt.AbstractMT;
......@@ -33,7 +38,7 @@ public class Mt2MxCamt054001Creator extends AbstractMt2MxCreator {
jsonMaps.put("bkToCstmrDbtCdtNtfctn", bkToCstmrDbtCdtNtfctnMaps);
Map<String, Object> grpHdrMaps = new HashMap<>();
bkToCstmrDbtCdtNtfctnMaps.put("grpHdr", grpHdrMaps);
grpHdrMaps.put("creDtTm", "9999-12-31T00:00:00+00:00");
grpHdrMaps.put("creDtTm", getCreateDateStr());
grpHdrMaps.put("nbOfTxs", "1");
Map<String, Object> ntfctnMaps = new HashMap<>();
......@@ -80,6 +85,7 @@ public class Mt2MxCamt054001Creator extends AbstractMt2MxCreator {
acctMaps = new HashMap<>();
ntfctnMaps.put("acct",acctMaps);
}
buildSTErrorInfo(ERROR.T20200, "Ntfctn/Acct/Ccy", null);
acctMaps.put("ccy",field32A.getValue().substring(6,9));
}
}
......@@ -90,6 +96,28 @@ public class Mt2MxCamt054001Creator extends AbstractMt2MxCreator {
txDtlsMaps.put("refs",refsMaps);
refsMaps.put("uetr",uetr);
}
context.set(Mt2MxContextIdentifier.MT_TO_MX_FLAG_50,"false");
}
protected void buildSTErrorInfo(String errorCode, String location, String originalValue) {
SwiftTranslationReport str = context.get(SwiftTranslationReport.class);
SwiftTranslationErrorInfo errorInfo = SwiftTransferUtil.getSwiftTranslationErrorInfoByErrorCode(errorCode);
errorInfo.setLocation(location);
errorInfo.setOriginalValue(originalValue);
List<SwiftTranslationErrorInfo> errorInfos = str.getErrorInfos();
boolean existFlag = false;
for (int i=0; i<errorInfos.size(); i++) {
if (SwiftTransferUtil.compareStErrorInfo(errorInfo, errorInfos.get(i))) {
existFlag = true;
break;
}
}
if (!existFlag) {
str.addErrorInfo(errorInfo);
if ("FAILURE".equalsIgnoreCase(errorInfo.getErrorType())) {
throw new SwiftException(location + Mx2MtConstants.NEW_LINE + "-" + errorInfo.getErrorType() + ":" + errorInfo.getDescription());
}
}
}
@Override
......
......@@ -67,7 +67,6 @@ public class Camt054001Parse50Field extends AbstractMt2MxCamt054001ParseField {
ptyMaps = (Map<String, Object>) dbtrMaps.get("pty");
} else {
ptyMaps = new HashMap<>();
dbtrMaps.put("pty",ptyMaps);
}
Map<String, Object> dbtrAcctMaps = null;
if (rltdPtiesMaps.containsKey("dbtrAcct")) {
......@@ -120,5 +119,11 @@ public class Camt054001Parse50Field extends AbstractMt2MxCamt054001ParseField {
mt_to_mxPartyNameAndAddress(nameAddress, ptyMaps);
mt_to_mxPartyAccount(account, dbtrAcctMaps);
}
if(ptyMaps.size()>0){
dbtrMaps.put("pty",ptyMaps);
}
if(dbtrAcctMaps.size()>0){
rltdPtiesMaps.put("dbtrAcct",dbtrAcctMaps);
}
}
}
......@@ -47,7 +47,6 @@ public class Camt054001Parse52For900Field extends AbstractMt2MxCamt054001ParseFi
dbtrAcctMaps = (Map<String, Object>) rltdPtiesMaps.get("dbtrAcct");
} else {
dbtrAcctMaps = new HashMap<>();
rltdPtiesMaps.put("dbtrAcct",dbtrAcctMaps);
}
Map<String, Object> dbtrMaps = null;
if (rltdPtiesMaps.containsKey("dbtr")) {
......@@ -61,7 +60,6 @@ public class Camt054001Parse52For900Field extends AbstractMt2MxCamt054001ParseFi
agtMaps = (Map<String, Object>) dbtrMaps.get("agt");
} else {
agtMaps = new HashMap<>();
dbtrMaps.put("agt",agtMaps);
}
String account = "";
if (field52A != null) {
......@@ -105,5 +103,11 @@ public class Camt054001Parse52For900Field extends AbstractMt2MxCamt054001ParseFi
mt_to_mxFinancialInstitutionAccount(account, dbtrAcctMaps,"DbtrAcct/Id");
}
}
if(dbtrAcctMaps.size()>0){
rltdPtiesMaps.put("dbtrAcct",dbtrAcctMaps);
}
if(agtMaps.size()>0){
dbtrMaps.put("agt",agtMaps);
}
}
}
......@@ -49,7 +49,6 @@ public class Camt054001Parse52For910Field extends AbstractMt2MxCamt054001ParseFi
dbtrAgtMaps = (Map<String, Object>) rltdAgtsMaps.get("dbtrAgt");
} else {
dbtrAgtMaps = new HashMap<>();
rltdAgtsMaps.put("dbtrAgt",dbtrAgtMaps);
}
String account = "";
if (field52A != null) {
......@@ -90,6 +89,9 @@ public class Camt054001Parse52For910Field extends AbstractMt2MxCamt054001ParseFi
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
}
if(dbtrAgtMaps.size()>0){
rltdAgtsMaps.put("dbtrAgt",dbtrAgtMaps);
}
}
}else {
Map<String, Object> rltdPtiesMaps = null;
......@@ -104,7 +106,6 @@ public class Camt054001Parse52For910Field extends AbstractMt2MxCamt054001ParseFi
dbtrAcctMaps = (Map<String, Object>) rltdPtiesMaps.get("dbtrAcct");
} else {
dbtrAcctMaps = new HashMap<>();
rltdPtiesMaps.put("dbtrAcct",dbtrAcctMaps);
}
Map<String, Object> dbtrMaps = null;
if (rltdPtiesMaps.containsKey("dbtr")) {
......@@ -118,7 +119,6 @@ public class Camt054001Parse52For910Field extends AbstractMt2MxCamt054001ParseFi
agtMaps = (Map<String, Object>) dbtrMaps.get("agt");
} else {
agtMaps = new HashMap<>();
dbtrMaps.put("agt",agtMaps);
}
String account = "";
if (field52A != null) {
......@@ -162,6 +162,12 @@ public class Camt054001Parse52For910Field extends AbstractMt2MxCamt054001ParseFi
mt_to_mxFinancialInstitutionAccount(account, dbtrAcctMaps, "DbtrAcct/Id");
}
}
if(agtMaps.size()>0){
dbtrMaps.put("agt",agtMaps);
}
if(dbtrAcctMaps.size()>0){
rltdPtiesMaps.put("dbtrAcct",dbtrAcctMaps);
}
}
}
}
......@@ -48,7 +48,6 @@ public class Camt054001Parse56Field extends AbstractMt2MxCamt054001ParseField {
intrmyAgt1Maps = (Map<String, Object>) rltdAgtsMaps.get("intrmyAgt1");
} else {
intrmyAgt1Maps = new HashMap<>();
rltdAgtsMaps.put("intrmyAgt1",intrmyAgt1Maps);
}
Map<String, Object> finInstnIdMaps = null;
if (intrmyAgt1Maps.containsKey("finInstnId")) {
......@@ -95,5 +94,8 @@ public class Camt054001Parse56Field extends AbstractMt2MxCamt054001ParseField {
String nameAddress = field56D.getNameAndAddress();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress(nameAddress, intrmyAgt1Maps);
}
if(intrmyAgt1Maps.size()>0){
rltdAgtsMaps.put("intrmyAgt1",intrmyAgt1Maps);
}
}
}
package com.brilliance.swift.mt2mx.camt056001;
import com.alibaba.fastjson.JSONArray;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.AbstractMt2MxCreator;
import com.brilliance.swift.mt2mx.Mt2MxContextIdentifier;
import com.brilliance.swift.mt2mx.Mt2MxParseField;
import com.brilliance.swift.mt2mx.camt056001.impl.*;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.util.SwiftTransferUtil;
import com.brilliance.swift.vo.SwiftTranslationErrorInfo;
import com.brilliance.swift.vo.SwiftTranslationReport;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field79;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.ArrayList;
......@@ -79,6 +86,36 @@ public class Mt2MxCamt056001Creator extends AbstractMt2MxCreator {
JSONArray adrLineJsonArray = new JSONArray();
pstlAdrMaps.put("adrLine",adrLineJsonArray);
adrLineJsonArray.add(Mx2MtConstants.MT_TO_MX_DEFAULT_VALUE);
Tag tag79 = abstractMT.getSwiftMessage().getBlock4().getTagByName("79");
Field79 field79 = (Field79)tag79.asField();
int index = field79.getValue().indexOf("/UETR/");
String uetr = "";
if(index>-1){
uetr = field79.getValue().substring(index+6);
}
if(StringUtil.isEmpty(orgnlUETR)&&StringUtil.isEmpty(uetr)){
buildSTErrorInfo(ERROR.T20087, "Block3/UETR", null);
}
}
protected void buildSTErrorInfo(String errorCode, String location, String originalValue) {
SwiftTranslationReport str = context.get(SwiftTranslationReport.class);
SwiftTranslationErrorInfo errorInfo = SwiftTransferUtil.getSwiftTranslationErrorInfoByErrorCode(errorCode);
errorInfo.setLocation(location);
errorInfo.setOriginalValue(originalValue);
List<SwiftTranslationErrorInfo> errorInfos = str.getErrorInfos();
boolean existFlag = false;
for (int i=0; i<errorInfos.size(); i++) {
if (SwiftTransferUtil.compareStErrorInfo(errorInfo, errorInfos.get(i))) {
existFlag = true;
break;
}
}
if (!existFlag) {
str.addErrorInfo(errorInfo);
if ("FAILURE".equalsIgnoreCase(errorInfo.getErrorType())) {
throw new SwiftException(location + Mx2MtConstants.NEW_LINE + "-" + errorInfo.getErrorType() + ":" + errorInfo.getDescription());
}
}
}
@Override
......
package com.brilliance.swift.mt2mx.camt056001.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.camt056001.AbstractMt2MxCamt056001ParseField;
import com.brilliance.swift.util.DateUtil;
......@@ -31,6 +32,8 @@ public class Camt056001Parse32AField extends AbstractMt2MxCamt056001ParseField {
orgnlIntrBkSttlmAmtMaps.put("value", field32A.amount());
orgnlIntrBkSttlmAmtMaps.put("ccy", field32A.getCurrency());
txInfMaps.put("orgnlIntrBkSttlmAmt",orgnlIntrBkSttlmAmtMaps);
}else {
buildSTErrorInfo(ERROR.T20088, "Block4:32A:", null);
}
} catch (ParseException e) {
throw new SwiftException("ERROR", e.getMessage());
......
......@@ -9,6 +9,7 @@ import com.prowidesoftware.swift.model.field.Field79;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Camt056001Parse79Field extends AbstractMt2MxCamt056001ParseField {
......@@ -22,7 +23,8 @@ public class Camt056001Parse79Field extends AbstractMt2MxCamt056001ParseField {
Map<String, Object> txInfMaps = getTxInfMaps();
if (tag79 != null) {
Field79 field79 = (Field79)tag79.asField();
mt_To_mxField79(field79.getValue(),txInfMaps);
List<String> lines = field79.getLines();
mt_To_mxField79(lines,txInfMaps);
}else {
JSONArray cxlRsnInfJSONArray = null;
Map<String,Object> cxlRsnInfMaps = null;
......
package com.brilliance.mt2mx.camt029001;
import com.brilliance.swift.SwiftTransfer;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.SwiftTranslationErrorInfo;
import com.brilliance.swift.vo.SwiftTranslationReport;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.List;
public class Test196 {
public static void main(String[] args) throws IOException {
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftTxt\\Mt196.txt");
File file = new File("E:/TEST/MT/MT196.txt");
String mtStr = FileUtils.readFileToString(file);
String mxXml = SwiftTransfer.mt2Mx(mtStr, "D:/test/mt2mx/camt02900108.xml", null);
System.out.println(mxXml);
SwiftTranslationReport str = SwiftTransfer.mt2MxPlus(mtStr, "E:/TEST/MX/camt02900109_196.xml", null);
if (str != null) {
List<SwiftTranslationErrorInfo> errorInfos = str.getErrorInfos();
if (errorInfos != null && errorInfos.size() > 0) {
for (int i=0; i<errorInfos.size(); i++) {
SwiftTranslationErrorInfo errorInfo = errorInfos.get(i);
String location = errorInfo.getLocation();
String errorType = errorInfo.getErrorType();
String description = errorInfo.getDescription();
System.out.println(location + Mx2MtConstants.NEW_LINE + "-" + errorType + ":" + description);
String originalValue = errorInfo.getOriginalValue();
if (StringUtil.isNotEmpty(originalValue)) {
System.out.println(originalValue);
}
}
}
System.out.println(str.getMessage());
}
}
}
package com.brilliance.mt2mx.camt029001;
import com.brilliance.swift.SwiftTransfer;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.SwiftTranslationErrorInfo;
import com.brilliance.swift.vo.SwiftTranslationReport;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.List;
public class Test296 {
public static void main(String[] args) throws IOException {
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftTxt\\Mt296.txt");
File file = new File("E:/TEST/MT/MT296.txt");
String mtStr = FileUtils.readFileToString(file);
String mxXml = SwiftTransfer.mt2Mx(mtStr, "D:/test/mt2mx/camt02900108.xml", null);
System.out.println(mxXml);
SwiftTranslationReport str = SwiftTransfer.mt2MxPlus(mtStr, "E:/TEST/MX/camt02900109_296.xml", null);
if (str != null) {
List<SwiftTranslationErrorInfo> errorInfos = str.getErrorInfos();
if (errorInfos != null && errorInfos.size() > 0) {
for (int i=0; i<errorInfos.size(); i++) {
SwiftTranslationErrorInfo errorInfo = errorInfos.get(i);
String location = errorInfo.getLocation();
String errorType = errorInfo.getErrorType();
String description = errorInfo.getDescription();
System.out.println(location + Mx2MtConstants.NEW_LINE + "-" + errorType + ":" + description);
String originalValue = errorInfo.getOriginalValue();
if (StringUtil.isNotEmpty(originalValue)) {
System.out.println(originalValue);
}
}
}
System.out.println(str.getMessage());
}
}
}
package com.brilliance.mt2mx.camt056001;
import com.brilliance.swift.SwiftTransfer;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.SwiftTranslationErrorInfo;
import com.brilliance.swift.vo.SwiftTranslationReport;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.List;
public class Test192 {
public static void main(String[] args) throws IOException {
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftTxt\\Mt192.txt");
File file = new File("E:/TEST/MT/MT192.txt");
String mtStr = FileUtils.readFileToString(file);
String mxXml = SwiftTransfer.mt2Mx(mtStr, "D:/test/mt2mx/camt05600108.xml", null);
System.out.println(mxXml);
SwiftTranslationReport str = SwiftTransfer.mt2MxPlus(mtStr, "E:/TEST/MX/camt05600108_192.xml", null);
if (str != null) {
List<SwiftTranslationErrorInfo> errorInfos = str.getErrorInfos();
if (errorInfos != null && errorInfos.size() > 0) {
for (int i=0; i<errorInfos.size(); i++) {
SwiftTranslationErrorInfo errorInfo = errorInfos.get(i);
String location = errorInfo.getLocation();
String errorType = errorInfo.getErrorType();
String description = errorInfo.getDescription();
System.out.println(location + Mx2MtConstants.NEW_LINE + "-" + errorType + ":" + description);
String originalValue = errorInfo.getOriginalValue();
if (StringUtil.isNotEmpty(originalValue)) {
System.out.println(originalValue);
}
}
}
System.out.println(str.getMessage());
}
}
}
package com.brilliance.mt2mx.camt056001;
import com.brilliance.swift.SwiftTransfer;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.SwiftTranslationErrorInfo;
import com.brilliance.swift.vo.SwiftTranslationReport;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.List;
public class Test292 {
public static void main(String[] args) throws IOException {
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftTxt\\Mt292.txt");
File file = new File("E:/TEST/MT/MT292.txt");
String mtStr = FileUtils.readFileToString(file);
String mxXml = SwiftTransfer.mt2Mx(mtStr, "D:/test/mt2mx/camt05600108.xml", null);
System.out.println(mxXml);
SwiftTranslationReport str = SwiftTransfer.mt2MxPlus(mtStr, "E:/TEST/MX/camt05600108_292.xml", null);
if (str != null) {
List<SwiftTranslationErrorInfo> errorInfos = str.getErrorInfos();
if (errorInfos != null && errorInfos.size() > 0) {
for (int i=0; i<errorInfos.size(); i++) {
SwiftTranslationErrorInfo errorInfo = errorInfos.get(i);
String location = errorInfo.getLocation();
String errorType = errorInfo.getErrorType();
String description = errorInfo.getDescription();
System.out.println(location + Mx2MtConstants.NEW_LINE + "-" + errorType + ":" + description);
String originalValue = errorInfo.getOriginalValue();
if (StringUtil.isNotEmpty(originalValue)) {
System.out.println(originalValue);
}
}
}
System.out.println(str.getMessage());
}
}
}
......@@ -11,7 +11,7 @@ import java.util.List;
public class TestMx2MtFor196 {
public static void main(String[] args) throws Exception {
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt02900108_196.xml");
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt02900108_296.xml");
String xmlStr = FileUtils.readFileToString(file);
SwiftTranslationReport str = SwiftTransfer.mx2MtPlus(xmlStr, null, null);
if (str != null) {
......
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