Commit e400f07f by chengzhuoshen

完成Mt2Mx,103->pacs008,202->pacs009报文转换详细报告

parent d30ba29b
......@@ -70,6 +70,20 @@ public class SwiftTransfer {
}
public static String mt2Mx(String mtStr, String outPutFilePath, Map<String, Object> extraMap) throws SwiftException {
SwiftTranslationReport str = new Mt2MxCreatorManager().mt2mx(mtStr, outPutFilePath, extraMap);
return str.getMessage();
}
public static SwiftTranslationReport mt2MxPlus(File file, String outPutFilePath, Map<String, Object> extraMap) throws SwiftException {
try{
String mtStr = FileUtils.readFileToString(file);
return mt2MxPlus(mtStr, outPutFilePath, extraMap);
} catch (IOException e) {
throw new SwiftException(e.getMessage());
}
}
public static SwiftTranslationReport mt2MxPlus(String mtStr, String outPutFilePath, Map<String, Object> extraMap) throws SwiftException {
return new Mt2MxCreatorManager().mt2mx(mtStr, outPutFilePath, extraMap);
}
......
......@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.util.DateUtil;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.SwiftTranslationReport;
import com.brilliance.swift.vo.common.MessagePriority;
import com.prowidesoftware.swift.model.SwiftBlock5;
import com.prowidesoftware.swift.model.SwiftBlock5Field;
......@@ -11,6 +12,9 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import com.prowidesoftware.swift.model.mx.AbstractMX;
import javax.xml.datatype.DatatypeConfigurationException;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
......@@ -32,6 +36,8 @@ public abstract class AbstractMt2MxCreator implements Mt2MxCreator{
@Override
public void preProcess() {
SwiftTranslationReport str = new SwiftTranslationReport();
context.set(str);
context.set(Mt2MxContextIdentifier.MT_TO_MX_JSON_MAP, jsonMaps);
Map<String, Object> appHdrMaps = new HashMap<>();
jsonMaps.put("appHdr", appHdrMaps);
......@@ -83,9 +89,23 @@ public abstract class AbstractMt2MxCreator implements Mt2MxCreator{
String swiftGsonStr = new JSONObject(jsonMaps).toJSONString();
AbstractMX abstractMX = AbstractMX.fromJson(swiftGsonStr);
String xml = abstractMX.message();
context.set(Mt2MxContextIdentifier.MT_TO_MX_XML, xml);
SwiftTranslationReport str = context.get(SwiftTranslationReport.class);
str.setMessage(xml);
try {
String outputFilePath = (String)context.get(Mt2MxContextIdentifier.MT_TO_MX_OUTPUT_FILE_PATH, true);
if (StringUtil.isNotEmpty(outputFilePath)) {
File file = new File(outputFilePath);
if (!file.exists()) {
file.createNewFile();
}
FileOutputStream stream = new FileOutputStream(file.getAbsoluteFile());
stream.write(xml.getBytes("UTF-8"));
stream.close();
}
} catch (IOException e) {
throw new SwiftException(e.getMessage());
}
}
/**
* 公共方法
*/
......
......@@ -4,16 +4,12 @@ public class Mt2MxContextIdentifier {
public static final String MT_TO_MX_OUTPUT_FILE_PATH = "mt.to.mx.output.file.path";
public static final String MT_TO_MX_XML = "mt.to.mx.xml";
public static final String MT_TO_MX_JSON_MAP = "mt.to.mx.json.map";
public static final String MT_SEND_BIC = "mt.send.bic";
public static final String MT_RECEIVE_BIC = "mt.receive.bic";
public static final String MT_TO_MX_INSTRUCTION_FOR_NEXT_AGENT_FIN53 = "mt.to.mx.instruction.for.next.agent.fin53";
public static final String MT_TO_MX_NOW = "mt.to.mx.now";
/**
* 外部参数
......
......@@ -5,6 +5,7 @@ import com.brilliance.swift.mt2mx.camt029001.Mt2MxCamt029001Creator;
import com.brilliance.swift.mt2mx.camt056001.Mt2MxCamt056001Creator;
import com.brilliance.swift.mt2mx.pacs008001.Mt2MxPacs008001Creator;
import com.brilliance.swift.mt2mx.pacs009001.Mt2MxPacs009001Creator;
import com.brilliance.swift.vo.SwiftTranslationReport;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.List;
......@@ -22,7 +23,7 @@ public class Mt2MxCreatorManager {
}
}
public String mt2mx(String mtStr, String outPutFilePath, Map<String, Object> extraMap) throws SwiftException {
public SwiftTranslationReport mt2mx(String mtStr, String outPutFilePath, Map<String, Object> extraMap) throws SwiftException {
init(mtStr);
AbstractMt2MxCreator creator = getMt2MxCreator();
Mt2MxContext context = new Mt2MxContext();
......@@ -38,7 +39,8 @@ public class Mt2MxCreatorManager {
parseField.parseField();
}
creator.postProcess();
return (String) context.get(Mt2MxContextIdentifier.MT_TO_MX_XML);
SwiftTranslationReport str = context.get(SwiftTranslationReport.class);
return str;
}
public AbstractMt2MxCreator getMt2MxCreator() throws SwiftException {
......
......@@ -19,7 +19,7 @@ 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/");
if(index>-1){
String uetr = String77A.substring(index+6);
......
......@@ -18,7 +18,7 @@ public class Pacs00801Parse23EField extends AbstractMt2MxPacs008001ParseField {
private static final String NAME_23E = "23E";
private static final String NAME_70 = "70";
private static final String NAME_72 = "72";
@Override
public void parseField() throws SwiftException {
......@@ -64,7 +64,6 @@ public class Pacs00801Parse23EField extends AbstractMt2MxPacs008001ParseField {
ctgyPurpMaps = (Map<String, Object>)pmtTpInfMaps.get("ctgyPurp");
} else {
ctgyPurpMaps = new HashMap<>();
pmtTpInfMaps.put("ctgyPurp", ctgyPurpMaps);
}
if (intcField23E != null && cortField23E != null) {
ctgyPurpMaps.put("prtry", CategoryPurposeCode.INTC.value() + " " + CategoryPurposeCode.CORT.value());
......@@ -73,12 +72,15 @@ public class Pacs00801Parse23EField extends AbstractMt2MxPacs008001ParseField {
} else if (cortField23E != null) {
ctgyPurpMaps.put("cd", CategoryPurposeCode.CORT.value());
}
if (ctgyPurpMaps.size() > 0) {
pmtTpInfMaps.put("ctgyPurp", ctgyPurpMaps);
}
}
Tag tag70 = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME_70);
String mt70 = "";
if (tag70 != null) {
mt70 = tag70.getValue();
Tag tag72 = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME_72);
String mt72 = "";
if (tag72 != null) {
mt72 = tag72.getValue();
}
mt_to_mxInstructionForCreditorAgent(field23EList, mt70, cdtTrfTxInfMaps);
mt_to_mxInstructionForCreditorAgent(field23EList, mt72, cdtTrfTxInfMaps);
}
}
......@@ -18,7 +18,7 @@ public class Pacs00801Parse36Field extends AbstractMt2MxPacs008001ParseField {
Tag tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME);
if (tag != null) {
Field36 field36 = (Field36)tag.asField();
cdtTrfTxInfMaps.put("xchgRate", new BigDecimal(field36.getRateAsNumber().toString()));
cdtTrfTxInfMaps.put("xchgRate", new BigDecimal(field36.getRateAsNumber().toString()).stripTrailingZeros());
}
}
}
......@@ -48,17 +48,17 @@ public class Pacs00801Parse52Field extends AbstractMt2MxPacs008001ParseField {
String bicCode = field52A.getBIC();
mt_to_mxBICFI(bicCode, dbtrAgtMaps);
if (StringUtil.isNotEmpty(field52A.getComponent1())) {
account = "/" + field52A.getComponent1();
account += "/" + field52A.getComponent1();
}
if (StringUtil.isNotEmpty(field52A.getComponent2())) {
account = "/" + field52A.getComponent2();
account += "/" + field52A.getComponent2();
}
} else if (field52D != null) {
if (StringUtil.isNotEmpty(field52D.getComponent1())) {
account = "/" + field52D.getComponent1();
account += "/" + field52D.getComponent1();
}
if (StringUtil.isNotEmpty(field52D.getComponent2())) {
account = "/" + field52D.getComponent2();
account += "/" + field52D.getComponent2();
}
String nameAddress = field52D.getNameAndAddress();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress(nameAddress, dbtrAgtMaps);
......@@ -84,7 +84,7 @@ public class Pacs00801Parse52Field extends AbstractMt2MxPacs008001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, dbtrAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, dbtrAgtAcctMaps, "DbtrAgtAcct/Id");
}
}
if (dbtrAgtMaps.size() > 0) {
......
......@@ -95,7 +95,7 @@ public class Pacs00801Parse53Field extends AbstractMt2MxPacs008001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else {
mt_to_mxFinancialInstitutionAccount(account, instgRmbrsmntAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, instgRmbrsmntAgtAcctMaps, "InstgRmbrsmntAgtAcct/Id");
}
}
}
......
package com.brilliance.swift.mt2mx.pacs008001.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField;
......@@ -67,10 +68,10 @@ public class Pacs00801Parse54Field extends AbstractMt2MxPacs008001ParseField {
String bicCode = field54A.getBIC();
mt_to_mxBICFI(bicCode, instdRmbrsmntAgtMaps);
if (StringUtil.isNotEmpty(field54A.getComponent1())) {
account = "/" + field54A.getComponent1();
account += "/" + field54A.getComponent1();
}
if (StringUtil.isNotEmpty(field54A.getComponent2())) {
account = "/" + field54A.getComponent2();
account += "/" + field54A.getComponent2();
}
if (account.startsWith("//") && !account.startsWith("//CH")) {
Map<String, Object> finInstnIdMaps = null;
......@@ -89,14 +90,14 @@ public class Pacs00801Parse54Field extends AbstractMt2MxPacs008001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, instdRmbrsmntAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, instdRmbrsmntAgtAcctMaps, "InstdRmbrsmntAgtAcct/Id");
}
} else if (field54B != null) {
if (StringUtil.isNotEmpty(field54B.getComponent1())) {
account = "/" + field54B.getComponent1();
account += "/" + field54B.getComponent1();
}
if (StringUtil.isNotEmpty(field54B.getComponent2())) {
account = "/" + field54B.getComponent2();
account += "/" + field54B.getComponent2();
}
String location = field54B.getLocation();
Map<String, Object> finInstnIdMaps = null;
......@@ -129,10 +130,13 @@ public class Pacs00801Parse54Field extends AbstractMt2MxPacs008001ParseField {
adrLineList.add(StringUtil.isEmpty(location)?Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE:location);
pstlAdrMaps.put("adrLine", adrLineList);
} else {
mt_to_mxClearingSystemToNameAndAddressLine(account, location, finInstnIdMaps);
mt_to_mxClearingSystemToNameAndAddressLine(account, location, finInstnIdMaps, "InstdRmbrsmntAgt/FinInstnId");
}
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, instdRmbrsmntAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, instdRmbrsmntAgtAcctMaps, "InstdRmbrsmntAgtAcct/Id");
if (StringUtil.isEmpty(account)) {
buildSTErrorInfo(ERROR.T20004, "Block4/:54B:", null);
}
//name address 设置NOTPROVIDED
finInstnIdMaps.put("nm", Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
Map<String, Object> pstlAdrMaps = null;
......@@ -148,10 +152,10 @@ public class Pacs00801Parse54Field extends AbstractMt2MxPacs008001ParseField {
}
} else if (field54D != null) {
if (StringUtil.isNotEmpty(field54D.getComponent1())) {
account = "/" + field54D.getComponent1();
account += "/" + field54D.getComponent1();
}
if (StringUtil.isNotEmpty(field54D.getComponent2())) {
account = "/" + field54D.getComponent2();
account += "/" + field54D.getComponent2();
}
String nameAddress = field54D.getNameAndAddress();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress(nameAddress, instdRmbrsmntAgtMaps);
......@@ -172,7 +176,7 @@ public class Pacs00801Parse54Field extends AbstractMt2MxPacs008001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, instdRmbrsmntAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, instdRmbrsmntAgtAcctMaps, "InstdRmbrsmntAgtAcct/Id");
}
}
if (instdRmbrsmntAgtMaps.size() > 0) {
......
package com.brilliance.swift.mt2mx.pacs008001.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.VoSettlementMethodHelper;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.*;
import com.prowidesoftware.swift.model.field.Field55A;
import com.prowidesoftware.swift.model.field.Field55B;
import com.prowidesoftware.swift.model.field.Field55D;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.ArrayList;
......@@ -69,10 +72,10 @@ public class Pacs00801Parse55Field extends AbstractMt2MxPacs008001ParseField {
String bicCode = field55A.getBIC();
mt_to_mxBICFI(bicCode, thrdRmbrsmntAgtMaps);
if (StringUtil.isNotEmpty(field55A.getComponent1())) {
account = "/" + field55A.getComponent1();
account += "/" + field55A.getComponent1();
}
if (StringUtil.isNotEmpty(field55A.getComponent2())) {
account = "/" + field55A.getComponent2();
account += "/" + field55A.getComponent2();
}
if (account.startsWith("//") && !account.startsWith("//CH")) {
Map<String, Object> finInstnIdMaps = null;
......@@ -91,14 +94,14 @@ public class Pacs00801Parse55Field extends AbstractMt2MxPacs008001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, thrdRmbrsmntAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, thrdRmbrsmntAgtAcctMaps, "ThrdRmbrsmntAgtAcct/Id");
}
} else if (field55B != null) {
if (StringUtil.isNotEmpty(field55B.getComponent1())) {
account = "/" + field55B.getComponent1();
account += "/" + field55B.getComponent1();
}
if (StringUtil.isNotEmpty(field55B.getComponent2())) {
account = "/" + field55B.getComponent2();
account += "/" + field55B.getComponent2();
}
String location = field55B.getLocation();
Map<String, Object> finInstnIdMaps = null;
......@@ -131,10 +134,13 @@ public class Pacs00801Parse55Field extends AbstractMt2MxPacs008001ParseField {
adrLineList.add(StringUtil.isEmpty(location)?Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE:location);
pstlAdrMaps.put("adrLine", adrLineList);
} else {
mt_to_mxClearingSystemToNameAndAddressLine(account, location, finInstnIdMaps);
mt_to_mxClearingSystemToNameAndAddressLine(account, location, finInstnIdMaps, "ThrdRmbrsmntAgt/FinInstnId");
}
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, thrdRmbrsmntAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, thrdRmbrsmntAgtAcctMaps, "ThrdRmbrsmntAgtAcct/Id");
if (StringUtil.isEmpty(account)) {
buildSTErrorInfo(ERROR.T20005, "Block4/:55B:", null);
}
//name address 设置NOTPROVIDED
finInstnIdMaps.put("nm", Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
Map<String, Object> pstlAdrMaps = null;
......@@ -150,10 +156,10 @@ public class Pacs00801Parse55Field extends AbstractMt2MxPacs008001ParseField {
}
} else if (field55D != null) {
if (StringUtil.isNotEmpty(field55D.getComponent1())) {
account = "/" + field55D.getComponent1();
account += "/" + field55D.getComponent1();
}
if (StringUtil.isNotEmpty(field55D.getComponent2())) {
account = "/" + field55D.getComponent2();
account += "/" + field55D.getComponent2();
}
String nameAddress = field55D.getNameAndAddress();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress(nameAddress, thrdRmbrsmntAgtMaps);
......@@ -174,7 +180,7 @@ public class Pacs00801Parse55Field extends AbstractMt2MxPacs008001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, thrdRmbrsmntAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, thrdRmbrsmntAgtAcctMaps, "ThrdRmbrsmntAgtAcct/Id");
}
}
if (thrdRmbrsmntAgtMaps.size() > 0) {
......
......@@ -59,10 +59,10 @@ public class Pacs00801Parse56Field extends AbstractMt2MxPacs008001ParseField {
String bicCode = field56A.getBIC();
mt_to_mxBICFI(bicCode, intrmyAgt1Maps);
if (StringUtil.isNotEmpty(field56A.getComponent1())) {
account = "/" + field56A.getComponent1();
account += "/" + field56A.getComponent1();
}
if (StringUtil.isNotEmpty(field56A.getComponent2())) {
account = "/" + field56A.getComponent2();
account += "/" + field56A.getComponent2();
}
if (account.startsWith("//RT") || account.startsWith("//FW")) {
clearingChannelRTGSFlag = true;
......@@ -84,7 +84,7 @@ public class Pacs00801Parse56Field extends AbstractMt2MxPacs008001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps);
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps, "ThrdRmbrsmntAgtAcct/Id");
}
} else if (field56C != null) {
account = field56C.getValue();
......@@ -121,10 +121,10 @@ public class Pacs00801Parse56Field extends AbstractMt2MxPacs008001ParseField {
adrLineList.add(Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
pstlAdrMaps.put("adrLine", adrLineList);
} else {
mt_to_mxClearingSystemToNameAndAddressLine(account, null, finInstnIdMaps);
mt_to_mxClearingSystemToNameAndAddressLine(account, null, finInstnIdMaps, "IntrmyAgt1/FinInstnId");
}
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps);
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps, "IntrmyAgt1Acct/Id");
//name address 设置NOTPROVIDED
finInstnIdMaps.put("nm", Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
Map<String, Object> pstlAdrMaps = null;
......@@ -140,10 +140,10 @@ public class Pacs00801Parse56Field extends AbstractMt2MxPacs008001ParseField {
}
} else if (field56D != null) {
if (StringUtil.isNotEmpty(field56D.getComponent1())) {
account = "/" + field56D.getComponent1();
account += "/" + field56D.getComponent1();
}
if (StringUtil.isNotEmpty(field56D.getComponent2())) {
account = "/" + field56D.getComponent2();
account += "/" + field56D.getComponent2();
}
if (account.startsWith("//RT")) {
clearingChannelRTGSFlag = true;
......@@ -167,7 +167,7 @@ public class Pacs00801Parse56Field extends AbstractMt2MxPacs008001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps);
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps, "IntrmyAgt1Acct/Id");
}
}
if (intrmyAgt1Maps.size() > 0) {
......
package com.brilliance.swift.mt2mx.pacs008001.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.Mt2MxContextIdentifier;
import com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField;
import com.brilliance.swift.util.StringUtil;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.*;
import com.prowidesoftware.swift.model.field.Field57A;
import com.prowidesoftware.swift.model.field.Field57B;
import com.prowidesoftware.swift.model.field.Field57C;
import com.prowidesoftware.swift.model.field.Field57D;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.ArrayList;
......@@ -65,10 +69,10 @@ public class Pacs00801Parse57Field extends AbstractMt2MxPacs008001ParseField {
String bicCode = field57A.getBIC();
mt_to_mxBICFI(bicCode, cdtrAgtMaps);
if (StringUtil.isNotEmpty(field57A.getComponent1())) {
account = "/" + field57A.getComponent1();
account += "/" + field57A.getComponent1();
}
if (StringUtil.isNotEmpty(field57A.getComponent2())) {
account = "/" + field57A.getComponent2();
account += "/" + field57A.getComponent2();
}
if (account.startsWith("//RT") || account.startsWith("//FW")) {
clearingChannelRTGSFlag = true;
......@@ -90,14 +94,14 @@ public class Pacs00801Parse57Field extends AbstractMt2MxPacs008001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps, "CdtrAgtAcct/Id");
}
} else if (field57B != null) {
if (StringUtil.isNotEmpty(field57B.getComponent1())) {
account = "/" + field57B.getComponent1();
account += "/" + field57B.getComponent1();
}
if (StringUtil.isNotEmpty(field57B.getComponent2())) {
account = "/" + field57B.getComponent2();
account += "/" + field57B.getComponent2();
}
String location = field57B.getLocation();
Map<String, Object> finInstnIdMaps = null;
......@@ -130,10 +134,13 @@ public class Pacs00801Parse57Field extends AbstractMt2MxPacs008001ParseField {
adrLineList.add(StringUtil.isEmpty(location)?Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE:location);
pstlAdrMaps.put("adrLine", adrLineList);
} else {
mt_to_mxClearingSystemToNameAndAddressLine(account, location, finInstnIdMaps);
mt_to_mxClearingSystemToNameAndAddressLine(account, location, finInstnIdMaps, "CdtrAgt/FinInstnId");
}
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps, "CdtrAgtAcct/Id");
if (StringUtil.isEmpty(account)) {
buildSTErrorInfo(ERROR.T20007, "Block4/:57B:", null);
}
//name address 设置NOTPROVIDED
finInstnIdMaps.put("nm", Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
Map<String, Object> pstlAdrMaps = null;
......@@ -182,10 +189,10 @@ public class Pacs00801Parse57Field extends AbstractMt2MxPacs008001ParseField {
adrLineList.add(Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
pstlAdrMaps.put("adrLine", adrLineList);
} else {
mt_to_mxClearingSystemToNameAndAddressLine(account, null, finInstnIdMaps);
mt_to_mxClearingSystemToNameAndAddressLine(account, null, finInstnIdMaps, "CdtrAgt/FinInstnId");
}
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps, "CdtrAgtAcct/Id");
//name address 设置NOTPROVIDED
finInstnIdMaps.put("nm", Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
Map<String, Object> pstlAdrMaps = null;
......@@ -201,10 +208,10 @@ public class Pacs00801Parse57Field extends AbstractMt2MxPacs008001ParseField {
}
} else if (field57D != null) {
if (StringUtil.isNotEmpty(field57D.getComponent1())) {
account = "/" + field57D.getComponent1();
account += "/" + field57D.getComponent1();
}
if (StringUtil.isNotEmpty(field57D.getComponent2())) {
account = "/" + field57D.getComponent2();
account += "/" + field57D.getComponent2();
}
if (account.startsWith("//RT")) {
clearingChannelRTGSFlag = true;
......@@ -228,7 +235,7 @@ public class Pacs00801Parse57Field extends AbstractMt2MxPacs008001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps, "CdtrAgtAcct/Id");
}
} else {
String receiverBic = (String) context.get(Mt2MxContextIdentifier.MT_RECEIVE_BIC, true);
......
package com.brilliance.swift.mt2mx.pacs008001.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField;
import com.brilliance.swift.util.StringUtil;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field72;
import com.prowidesoftware.swift.model.mt.AbstractMT;
......@@ -19,6 +21,10 @@ public class Pacs00801Parse72Field extends AbstractMt2MxPacs008001ParseField {
Tag tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME);
if (tag != null) {
Field72 field72 = (Field72)tag.asField();
if (StringUtil.isNotEmpty(field72.getValue())
&& (field72.getValue().startsWith("/REJT/") || field72.getValue().startsWith("/RETN/"))) {
buildSTErrorInfo(ERROR.T20063, "Block4/:72:", null);
}
mt72ins_to_mxAgent(field72.getValue(), cdtTrfTxInfMaps);
List<String> excludeCodeList = new ArrayList<>();
excludeCodeList.add("/ACC/");
......
......@@ -83,7 +83,7 @@ public class Pacs00801ParseSetlAcctField extends AbstractMt2MxPacs008001ParseFie
sttlmAcctMaps = new HashMap<>();
sttlmInfMaps.put("sttlmAcct", sttlmAcctMaps);
}
mt_to_mxFinancialInstitutionAccount(account, sttlmAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, sttlmAcctMaps, "SttlmAcct/Id");
}
}
}
......@@ -48,17 +48,17 @@ public class Pacs009001Parse52Field extends AbstractMt2MxPacs009001ParseField {
String bicCode = field52A.getBIC();
mt_to_mxBICFI(bicCode, dbtrMaps);
if (StringUtil.isNotEmpty(field52A.getComponent1())) {
account = "/" + field52A.getComponent1();
account += "/" + field52A.getComponent1();
}
if (StringUtil.isNotEmpty(field52A.getComponent2())) {
account = "/" + field52A.getComponent2();
account += "/" + field52A.getComponent2();
}
} else if (field52D != null) {
if (StringUtil.isNotEmpty(field52D.getComponent1())) {
account = "/" + field52D.getComponent1();
account += "/" + field52D.getComponent1();
}
if (StringUtil.isNotEmpty(field52D.getComponent2())) {
account = "/" + field52D.getComponent2();
account += "/" + field52D.getComponent2();
}
String nameAddress = field52D.getNameAndAddress();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress(nameAddress, dbtrMaps);
......@@ -84,7 +84,7 @@ public class Pacs009001Parse52Field extends AbstractMt2MxPacs009001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, dbtrAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, dbtrAcctMaps, "DbtrAcct/Id");
}
}
if (dbtrMaps.size() > 0) {
......
......@@ -95,7 +95,7 @@ public class Pacs009001Parse53Field extends AbstractMt2MxPacs009001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else {
mt_to_mxFinancialInstitutionAccount(account, instgRmbrsmntAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, instgRmbrsmntAgtAcctMaps, "InstgRmbrsmntAgtAcct/Id");
}
}
}
......
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
......@@ -67,10 +68,10 @@ public class Pacs009001Parse54Field extends AbstractMt2MxPacs009001ParseField {
String bicCode = field54A.getBIC();
mt_to_mxBICFI(bicCode, instdRmbrsmntAgtMaps);
if (StringUtil.isNotEmpty(field54A.getComponent1())) {
account = "/" + field54A.getComponent1();
account += "/" + field54A.getComponent1();
}
if (StringUtil.isNotEmpty(field54A.getComponent2())) {
account = "/" + field54A.getComponent2();
account += "/" + field54A.getComponent2();
}
if (account.startsWith("//") && !account.startsWith("//CH")) {
Map<String, Object> finInstnIdMaps = null;
......@@ -89,14 +90,14 @@ public class Pacs009001Parse54Field extends AbstractMt2MxPacs009001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, instdRmbrsmntAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, instdRmbrsmntAgtAcctMaps, "InstdRmbrsmntAgtAcct/Id");
}
} else if (field54B != null) {
if (StringUtil.isNotEmpty(field54B.getComponent1())) {
account = "/" + field54B.getComponent1();
account += "/" + field54B.getComponent1();
}
if (StringUtil.isNotEmpty(field54B.getComponent2())) {
account = "/" + field54B.getComponent2();
account += "/" + field54B.getComponent2();
}
String location = field54B.getLocation();
Map<String, Object> finInstnIdMaps = null;
......@@ -129,10 +130,13 @@ public class Pacs009001Parse54Field extends AbstractMt2MxPacs009001ParseField {
adrLineList.add(StringUtil.isEmpty(location)?Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE:location);
pstlAdrMaps.put("adrLine", adrLineList);
} else {
mt_to_mxClearingSystemToNameAndAddressLine(account, location, finInstnIdMaps);
mt_to_mxClearingSystemToNameAndAddressLine(account, location, finInstnIdMaps, "InstdRmbrsmntAgt/FinInstnId");
}
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, instdRmbrsmntAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, instdRmbrsmntAgtAcctMaps, "InstdRmbrsmntAgtAcct/Id");
if (StringUtil.isEmpty(account)) {
buildSTErrorInfo(ERROR.T20004, "Block4/:54B:", null);
}
//name address 设置NOTPROVIDED
finInstnIdMaps.put("nm", Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
Map<String, Object> pstlAdrMaps = null;
......@@ -148,10 +152,10 @@ public class Pacs009001Parse54Field extends AbstractMt2MxPacs009001ParseField {
}
} else if (field54D != null) {
if (StringUtil.isNotEmpty(field54D.getComponent1())) {
account = "/" + field54D.getComponent1();
account += "/" + field54D.getComponent1();
}
if (StringUtil.isNotEmpty(field54D.getComponent2())) {
account = "/" + field54D.getComponent2();
account += "/" + field54D.getComponent2();
}
String nameAddress = field54D.getNameAndAddress();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress(nameAddress, instdRmbrsmntAgtMaps);
......@@ -172,7 +176,7 @@ public class Pacs009001Parse54Field extends AbstractMt2MxPacs009001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, instdRmbrsmntAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, instdRmbrsmntAgtAcctMaps, "InstdRmbrsmntAgtAcct/Id");
}
}
if (instdRmbrsmntAgtMaps.size() > 0) {
......
......@@ -50,10 +50,10 @@ public class Pacs009001Parse56Field extends AbstractMt2MxPacs009001ParseField {
String bicCode = field56A.getBIC();
mt_to_mxBICFI(bicCode, intrmyAgt1Maps);
if (StringUtil.isNotEmpty(field56A.getComponent1())) {
account = "/" + field56A.getComponent1();
account += "/" + field56A.getComponent1();
}
if (StringUtil.isNotEmpty(field56A.getComponent2())) {
account = "/" + field56A.getComponent2();
account += "/" + field56A.getComponent2();
}
if (account.startsWith("//RT") || account.startsWith("//FW")) {
clearingChannelRTGSFlag = true;
......@@ -75,14 +75,14 @@ public class Pacs009001Parse56Field extends AbstractMt2MxPacs009001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps);
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps, "IntrmyAgt1Acct/Id");
}
} else if (field56D != null) {
if (StringUtil.isNotEmpty(field56D.getComponent1())) {
account = "/" + field56D.getComponent1();
account += "/" + field56D.getComponent1();
}
if (StringUtil.isNotEmpty(field56D.getComponent2())) {
account = "/" + field56D.getComponent2();
account += "/" + field56D.getComponent2();
}
if (account.startsWith("//RT")) {
clearingChannelRTGSFlag = true;
......@@ -106,7 +106,7 @@ public class Pacs009001Parse56Field extends AbstractMt2MxPacs009001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps);
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps, "IntrmyAgt1Acct/Id");
}
}
if (intrmyAgt1Maps.size() > 0) {
......
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
......@@ -61,10 +62,10 @@ public class Pacs009001Parse57Field extends AbstractMt2MxPacs009001ParseField {
String bicCode = field57A.getBIC();
mt_to_mxBICFI(bicCode, cdtrAgtMaps);
if (StringUtil.isNotEmpty(field57A.getComponent1())) {
account = "/" + field57A.getComponent1();
account += "/" + field57A.getComponent1();
}
if (StringUtil.isNotEmpty(field57A.getComponent2())) {
account = "/" + field57A.getComponent2();
account += "/" + field57A.getComponent2();
}
if (account.startsWith("//RT") || account.startsWith("//FW")) {
clearingChannelRTGSFlag = true;
......@@ -86,14 +87,14 @@ public class Pacs009001Parse57Field extends AbstractMt2MxPacs009001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps, "CdtrAgtAcct/Id");
}
} else if (field57B != null) {
if (StringUtil.isNotEmpty(field57B.getComponent1())) {
account = "/" + field57B.getComponent1();
account += "/" + field57B.getComponent1();
}
if (StringUtil.isNotEmpty(field57B.getComponent2())) {
account = "/" + field57B.getComponent2();
account += "/" + field57B.getComponent2();
}
String location = field57B.getLocation();
Map<String, Object> finInstnIdMaps = null;
......@@ -126,10 +127,13 @@ public class Pacs009001Parse57Field extends AbstractMt2MxPacs009001ParseField {
adrLineList.add(StringUtil.isEmpty(location)?Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE:location);
pstlAdrMaps.put("adrLine", adrLineList);
} else {
mt_to_mxClearingSystemToNameAndAddressLine(account, location, finInstnIdMaps);
mt_to_mxClearingSystemToNameAndAddressLine(account, location, finInstnIdMaps, "CdtrAgt/FinInstnId");
}
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps, "CdtrAgtAcct/Id");
if (StringUtil.isEmpty(account)) {
buildSTErrorInfo(ERROR.T20007, "Block4/:57B:", null);
}
//name address 设置NOTPROVIDED
finInstnIdMaps.put("nm", Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
Map<String, Object> pstlAdrMaps = null;
......@@ -145,10 +149,10 @@ public class Pacs009001Parse57Field extends AbstractMt2MxPacs009001ParseField {
}
} else if (field57D != null) {
if (StringUtil.isNotEmpty(field57D.getComponent1())) {
account = "/" + field57D.getComponent1();
account += "/" + field57D.getComponent1();
}
if (StringUtil.isNotEmpty(field57D.getComponent2())) {
account = "/" + field57D.getComponent2();
account += "/" + field57D.getComponent2();
}
if (account.startsWith("//RT")) {
clearingChannelRTGSFlag = true;
......@@ -172,7 +176,7 @@ public class Pacs009001Parse57Field extends AbstractMt2MxPacs009001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps, "CdtrAgtAcct/Id");
}
}
if (cdtrAgtMaps.size() > 0) {
......
......@@ -48,10 +48,10 @@ public class Pacs009001Parse58Field extends AbstractMt2MxPacs009001ParseField {
String bicCode = field58A.getBIC();
mt_to_mxBICFI(bicCode, cdtrMaps);
if (StringUtil.isNotEmpty(field58A.getComponent1())) {
account = "/" + field58A.getComponent1();
account += "/" + field58A.getComponent1();
}
if (StringUtil.isNotEmpty(field58A.getComponent2())) {
account = "/" + field58A.getComponent2();
account += "/" + field58A.getComponent2();
}
if (account.startsWith("//RT") || account.startsWith("//FW")) {
clearingChannelRTGSFlag = true;
......@@ -73,14 +73,14 @@ public class Pacs009001Parse58Field extends AbstractMt2MxPacs009001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, cdtrAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, cdtrAcctMaps, "CdtrAcct/Id");
}
} else if (field58D != null) {
if (StringUtil.isNotEmpty(field58D.getComponent1())) {
account = "/" + field58D.getComponent1();
account += "/" + field58D.getComponent1();
}
if (StringUtil.isNotEmpty(field58D.getComponent2())) {
account = "/" + field58D.getComponent2();
account += "/" + field58D.getComponent2();
}
if (account.startsWith("//RT")) {
clearingChannelRTGSFlag = true;
......@@ -104,7 +104,7 @@ public class Pacs009001Parse58Field extends AbstractMt2MxPacs009001ParseField {
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, cdtrAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, cdtrAcctMaps, "CdtrAcct/Id");
}
}
if (cdtrMaps.size() > 0) {
......
......@@ -65,17 +65,17 @@ public class Pacs009001ParseSeqB52Field extends AbstractMt2MxPacs009001ParseFiel
String bicCode = field52A.getBIC();
mt_to_mxBICFI(bicCode, dbtrAgtMaps);
if (StringUtil.isNotEmpty(field52A.getComponent1())) {
account = "/" + field52A.getComponent1();
account += "/" + field52A.getComponent1();
}
if (StringUtil.isNotEmpty(field52A.getComponent2())) {
account = "/" + field52A.getComponent2();
account += "/" + field52A.getComponent2();
}
} else if (field52D != null) {
if (StringUtil.isNotEmpty(field52D.getComponent1())) {
account = "/" + field52D.getComponent1();
account += "/" + field52D.getComponent1();
}
if (StringUtil.isNotEmpty(field52D.getComponent2())) {
account = "/" + field52D.getComponent2();
account += "/" + field52D.getComponent2();
}
String nameAddress = field52D.getNameAndAddress();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress(nameAddress, dbtrAgtMaps);
......@@ -101,7 +101,7 @@ public class Pacs009001ParseSeqB52Field extends AbstractMt2MxPacs009001ParseFiel
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, dbtrAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, dbtrAgtAcctMaps, "DbtrAgtAcct/Id");
}
}
if (dbtrAgtMaps.size() > 0) {
......
......@@ -63,10 +63,10 @@ public class Pacs009001ParseSeqB56Field extends AbstractMt2MxPacs009001ParseFiel
String bicCode = field56A.getBIC();
mt_to_mxBICFI(bicCode, intrmyAgt1Maps);
if (StringUtil.isNotEmpty(field56A.getComponent1())) {
account = "/" + field56A.getComponent1();
account += "/" + field56A.getComponent1();
}
if (StringUtil.isNotEmpty(field56A.getComponent2())) {
account = "/" + field56A.getComponent2();
account += "/" + field56A.getComponent2();
}
if (account.startsWith("//") && !account.startsWith("//CH") && !account.startsWith("//FW") && !account.startsWith("//RT")) {
Map<String, Object> finInstnIdMaps = null;
......@@ -85,7 +85,7 @@ public class Pacs009001ParseSeqB56Field extends AbstractMt2MxPacs009001ParseFiel
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps);
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps, "IntrmyAgt1Acct/Id");
}
} else if (field56C != null) {
account = field56C.getValue();
......@@ -119,10 +119,10 @@ public class Pacs009001ParseSeqB56Field extends AbstractMt2MxPacs009001ParseFiel
adrLineList.add(Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
pstlAdrMaps.put("adrLine", adrLineList);
} else {
mt_to_mxClearingSystemToNameAndAddressLine(account, null, finInstnIdMaps);
mt_to_mxClearingSystemToNameAndAddressLine(account, null, finInstnIdMaps, "IntrmyAgt1/FinInstnId");
}
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps);
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps, "IntrmyAgt1Acct/Id");
//name address 设置NOTPROVIDED
finInstnIdMaps.put("nm", Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
Map<String, Object> pstlAdrMaps = null;
......@@ -138,10 +138,10 @@ public class Pacs009001ParseSeqB56Field extends AbstractMt2MxPacs009001ParseFiel
}
} else if (field56D != null) {
if (StringUtil.isNotEmpty(field56D.getComponent1())) {
account = "/" + field56D.getComponent1();
account += "/" + field56D.getComponent1();
}
if (StringUtil.isNotEmpty(field56D.getComponent2())) {
account = "/" + field56D.getComponent2();
account += "/" + field56D.getComponent2();
}
String nameAddress = field56D.getNameAndAddress();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress(nameAddress, intrmyAgt1Maps);
......@@ -162,7 +162,7 @@ public class Pacs009001ParseSeqB56Field extends AbstractMt2MxPacs009001ParseFiel
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps);
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps, "IntrmyAgt1Acct/Id");
}
}
if (intrmyAgt1Maps.size() > 0) {
......
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
......@@ -71,10 +72,10 @@ public class Pacs009001ParseSeqB57Field extends AbstractMt2MxPacs009001ParseFiel
String bicCode = field57A.getBIC();
mt_to_mxBICFI(bicCode, cdtrAgtMaps);
if (StringUtil.isNotEmpty(field57A.getComponent1())) {
account = "/" + field57A.getComponent1();
account += "/" + field57A.getComponent1();
}
if (StringUtil.isNotEmpty(field57A.getComponent2())) {
account = "/" + field57A.getComponent2();
account += "/" + field57A.getComponent2();
}
if (account.startsWith("//") && !account.startsWith("//CH") && !account.startsWith("//FW") && !account.startsWith("//RT")) {
Map<String, Object> finInstnIdMaps = null;
......@@ -93,14 +94,14 @@ public class Pacs009001ParseSeqB57Field extends AbstractMt2MxPacs009001ParseFiel
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps, "CdtrAgtAcct/Id");
}
} else if (field57B != null) {
if (StringUtil.isNotEmpty(field57B.getComponent1())) {
account = "/" + field57B.getComponent1();
account += "/" + field57B.getComponent1();
}
if (StringUtil.isNotEmpty(field57B.getComponent2())) {
account = "/" + field57B.getComponent2();
account += "/" + field57B.getComponent2();
}
String location = field57B.getLocation();
Map<String, Object> finInstnIdMaps = null;
......@@ -133,10 +134,10 @@ public class Pacs009001ParseSeqB57Field extends AbstractMt2MxPacs009001ParseFiel
adrLineList.add(StringUtil.isEmpty(location)?Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE:location);
pstlAdrMaps.put("adrLine", adrLineList);
} else {
mt_to_mxClearingSystemToNameAndAddressLine(account, location, finInstnIdMaps);
mt_to_mxClearingSystemToNameAndAddressLine(account, location, finInstnIdMaps, "CdtrAgt/FinInstnId");
}
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps, "CdtrAgtAcct/Id");
//name address 设置NOTPROVIDED
finInstnIdMaps.put("nm", Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
Map<String, Object> pstlAdrMaps = null;
......@@ -182,10 +183,13 @@ public class Pacs009001ParseSeqB57Field extends AbstractMt2MxPacs009001ParseFiel
adrLineList.add(Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
pstlAdrMaps.put("adrLine", adrLineList);
} else {
mt_to_mxClearingSystemToNameAndAddressLine(account, null, finInstnIdMaps);
mt_to_mxClearingSystemToNameAndAddressLine(account, null, finInstnIdMaps, "CdtrAgt/FinInstnId");
}
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps, "CdtrAgtAcct/Id");
if (StringUtil.isEmpty(account)) {
buildSTErrorInfo(ERROR.T20007, "Block4/SeqB/:57B:", null);
}
//name address 设置NOTPROVIDED
finInstnIdMaps.put("nm", Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
Map<String, Object> pstlAdrMaps = null;
......@@ -201,10 +205,10 @@ public class Pacs009001ParseSeqB57Field extends AbstractMt2MxPacs009001ParseFiel
}
} else if (field57D != null) {
if (StringUtil.isNotEmpty(field57D.getComponent1())) {
account = "/" + field57D.getComponent1();
account += "/" + field57D.getComponent1();
}
if (StringUtil.isNotEmpty(field57D.getComponent2())) {
account = "/" + field57D.getComponent2();
account += "/" + field57D.getComponent2();
}
String nameAddress = field57D.getNameAndAddress();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress(nameAddress, cdtrAgtMaps);
......@@ -225,7 +229,7 @@ public class Pacs009001ParseSeqB57Field extends AbstractMt2MxPacs009001ParseFiel
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps, "CdtrAgtAcct/Id");
}
}
if (cdtrAgtMaps.size() > 0) {
......
......@@ -83,7 +83,7 @@ public class Pacs009001ParseSetlAcctField extends AbstractMt2MxPacs009001ParseFi
sttlmAcctMaps = new HashMap<>();
sttlmInfMaps.put("sttlmAcct", sttlmAcctMaps);
}
mt_to_mxFinancialInstitutionAccount(account, sttlmAcctMaps);
mt_to_mxFinancialInstitutionAccount(account, sttlmAcctMaps, "SttlmAcct/Id");
}
}
}
package com.brilliance.swift.mt2mx.setlmtd;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.Mt2MxContext;
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.Field;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.List;
public abstract class AbstractSettlementMethodAnalyzer implements SettlementMethodAnalyzer{
......@@ -37,4 +46,49 @@ public abstract class AbstractSettlementMethodAnalyzer implements SettlementMeth
this.field54 = field54;
return this;
}
/**
* 封装报文转换详细报告
* @param errorCode
* @param location
* @param originalValue
* @return
*/
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());
}
}
}
protected Boolean exist55a() {
AbstractMT abstractMT = context.get(AbstractMT.class);
Tag tag = abstractMT.getSwiftMessage().getBlock4().getTagByName("55A");
if (tag != null) {
return true;
}
tag = abstractMT.getSwiftMessage().getBlock4().getTagByName("55B");
if (tag != null) {
return true;
}
tag = abstractMT.getSwiftMessage().getBlock4().getTagByName("55D");
if (tag != null) {
return true;
}
return false;
}
}
package com.brilliance.swift.mt2mx.setlmtd.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.mt2mx.Mt2MxContextIdentifier;
import com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer;
import com.brilliance.swift.util.StringUtil;
......@@ -34,6 +35,11 @@ public class Field53A54AAnalyzer extends AbstractSettlementMethodAnalyzer {
String receiveBic = (String) context.get(Mt2MxContextIdentifier.MT_RECEIVE_BIC, true);
if (field53BicCode.equals(sendBic) && field54BicCode.equals(receiveBic)) {
seltMtdHelper.setSettlementMethod("INDA");
buildSTErrorInfo(ERROR.T20009, "Block4/:53A:", null);
buildSTErrorInfo(ERROR.T20010, "Block4/:54A:", null);
if (exist55a()) {
buildSTErrorInfo(ERROR.T20008, "Block4/:55a:", null);
}
} else if (StringUtil.isNotEmpty(sendBic)
&& field53BicCode.substring(0, 6).equals(sendBic.substring(0, 6))
&& SwiftTransferUtil.isAccount(account)) {
......@@ -43,10 +49,17 @@ public class Field53A54AAnalyzer extends AbstractSettlementMethodAnalyzer {
seltMtdHelper.setSettlementMethod("INDA");
}
seltMtdHelper.setTranslateSetlAcctFlag(true);
buildSTErrorInfo(ERROR.T20071, "Block4/:53A:", null);
buildSTErrorInfo(ERROR.T20018, "Block4/:54A:", null);
if (exist55a()) {
buildSTErrorInfo(ERROR.T20008, "Block4/:55a:", null);
}
} else {
AbstractMT abstractMT = context.get(AbstractMT.class);
if (abstractMT.getSwiftMessage().isCOV()) {
seltMtdHelper.setSettlementMethod("INDA");
buildSTErrorInfo(ERROR.T20024, "Block4/:53A:", null);
buildSTErrorInfo(ERROR.T20023, "Block4/:54A:", null);
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate53Flag(true);
......
package com.brilliance.swift.mt2mx.setlmtd.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.mt2mx.Mt2MxContextIdentifier;
import com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer;
import com.brilliance.swift.util.StringUtil;
......@@ -31,10 +32,17 @@ public class Field53A54BAnalyzer extends AbstractSettlementMethodAnalyzer {
seltMtdHelper.setSettlementMethod("INDA");
}
seltMtdHelper.setTranslateSetlAcctFlag(true);
buildSTErrorInfo(ERROR.T20071, "Block4/:53A:", null);
buildSTErrorInfo(ERROR.T20023, "Block4/:54B:", null);
if (exist55a()) {
buildSTErrorInfo(ERROR.T20008, "Block4/:55a:", null);
}
} else {
AbstractMT abstractMT = context.get(AbstractMT.class);
if (abstractMT.getSwiftMessage().isCOV()) {
seltMtdHelper.setSettlementMethod("INDA");
buildSTErrorInfo(ERROR.T20024, "Block4/:53A:", null);
buildSTErrorInfo(ERROR.T20023, "Block4/:54B:", null);
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate53Flag(true);
......
package com.brilliance.swift.mt2mx.setlmtd.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.mt2mx.Mt2MxContextIdentifier;
import com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer;
import com.brilliance.swift.util.StringUtil;
......@@ -31,10 +32,17 @@ public class Field53A54DAnalyzer extends AbstractSettlementMethodAnalyzer {
seltMtdHelper.setSettlementMethod("INDA");
}
seltMtdHelper.setTranslateSetlAcctFlag(true);
buildSTErrorInfo(ERROR.T20071, "Block4/:53A:", null);
buildSTErrorInfo(ERROR.T20023, "Block4/:54D:", null);
if (exist55a()) {
buildSTErrorInfo(ERROR.T20008, "Block4/:55a:", null);
}
} else {
AbstractMT abstractMT = context.get(AbstractMT.class);
if (abstractMT.getSwiftMessage().isCOV()) {
seltMtdHelper.setSettlementMethod("INDA");
buildSTErrorInfo(ERROR.T20024, "Block4/:53A:", null);
buildSTErrorInfo(ERROR.T20023, "Block4/:54D:", null);
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate53Flag(true);
......
package com.brilliance.swift.mt2mx.setlmtd.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.util.SwiftTransferUtil;
......@@ -25,8 +26,16 @@ public class Field53B54aAnalyzer extends AbstractSettlementMethodAnalyzer {
seltMtdHelper.setSettlementMethod("INDA");
}
seltMtdHelper.setTranslateSetlAcctFlag(true);
if (StringUtil.isNotEmpty(field53B.getLocation())) {
buildSTErrorInfo(ERROR.T20070, "Block4/:53B:", null);
}
} else {
seltMtdHelper.setSettlementMethod("INDA");
buildSTErrorInfo(ERROR.T20001, "Block4/:53B:", null);
}
buildSTErrorInfo(ERROR.T20002, "Block4/:54a:", null);
if (exist55a()) {
buildSTErrorInfo(ERROR.T20008, "Block4/:55a:", null);
}
return seltMtdHelper;
}
......
package com.brilliance.swift.mt2mx.setlmtd.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.util.SwiftTransferUtil;
......@@ -26,10 +27,17 @@ public class Field53D54aAnalyzer extends AbstractSettlementMethodAnalyzer {
seltMtdHelper.setSettlementMethod("INDA");
}
seltMtdHelper.setTranslateSetlAcctFlag(true);
buildSTErrorInfo(ERROR.T20069, "Block4/:53D:", null);
buildSTErrorInfo(ERROR.T20023, "Block4/:54a:", null);
if (exist55a()) {
buildSTErrorInfo(ERROR.T20008, "Block4/:55a:", null);
}
} else {
AbstractMT abstractMT = context.get(AbstractMT.class);
if (abstractMT.getSwiftMessage().isCOV()) {
seltMtdHelper.setSettlementMethod("INDA");
buildSTErrorInfo(ERROR.T20024, "Block4/:53D:", null);
buildSTErrorInfo(ERROR.T20023, "Block4/:54a:", null);
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate53Flag(true);
......
package com.brilliance.swift.mt2mx.setlmtd.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.mt2mx.Mt2MxContextIdentifier;
import com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer;
import com.brilliance.swift.util.StringUtil;
......@@ -29,6 +30,7 @@ public class FieldOnly53AAnalyzer extends AbstractSettlementMethodAnalyzer {
}
seltMtdHelper.setTranslateSetlAcctFlag(true);
seltMtdHelper.setInstructionForNextAgent("/FIN53/"+bicCode);
buildSTErrorInfo(ERROR.T20021, "Block4/:53A:", null);
} else {
String sendBic = (String) context.get(Mt2MxContextIdentifier.MT_SEND_BIC, true);
String receiveBic = (String) context.get(Mt2MxContextIdentifier.MT_RECEIVE_BIC, true);
......@@ -36,10 +38,15 @@ public class FieldOnly53AAnalyzer extends AbstractSettlementMethodAnalyzer {
|| (StringUtil.isNotEmpty(receiveBic) && bicCode.substring(0, 6).equals(receiveBic.substring(0, 6)))) {
seltMtdHelper.setSettlementMethod("INDA");
seltMtdHelper.setInstructionForNextAgent("/FIN53/"+bicCode);
buildSTErrorInfo(ERROR.T20021, "Block4/:53A:", null);
if (StringUtil.isNotEmpty(account)) {
buildSTErrorInfo(ERROR.T20068, "Block4/:53A:", null);
}
} else {
AbstractMT abstractMT = context.get(AbstractMT.class);
if (abstractMT.getSwiftMessage().isCOV()) {
seltMtdHelper.setSettlementMethod("INDA");
buildSTErrorInfo(ERROR.T20024, "Block4/:53A:", null);
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate53Flag(true);
......
package com.brilliance.swift.mt2mx.setlmtd.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.util.SwiftTransferUtil;
......@@ -25,8 +26,12 @@ public class FieldOnly53BAnalyzer extends AbstractSettlementMethodAnalyzer {
seltMtdHelper.setSettlementMethod("INDA");
}
seltMtdHelper.setTranslateSetlAcctFlag(true);
if (StringUtil.isNotEmpty(field53B.getLocation())) {
buildSTErrorInfo(ERROR.T20070, "Block4/:53B:", null);
}
} else {
seltMtdHelper.setSettlementMethod("INDA");
buildSTErrorInfo(ERROR.T20001, "Block4/:53B:", null);
}
return seltMtdHelper;
}
......
package com.brilliance.swift.mt2mx.setlmtd.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.util.SwiftTransferUtil;
......@@ -25,8 +26,10 @@ public class FieldOnly53DAnalyzer extends AbstractSettlementMethodAnalyzer {
seltMtdHelper.setSettlementMethod("INDA");
}
seltMtdHelper.setTranslateSetlAcctFlag(true);
buildSTErrorInfo(ERROR.T20069, "Block4/:53D:", null);
} else {
seltMtdHelper.setSettlementMethod("INDA");
buildSTErrorInfo(ERROR.T20022, "Block4/:53D:", null);
}
return seltMtdHelper;
}
......
package com.brilliance.swift.mt2mx.setlmtd.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.mt2mx.Mt2MxContextIdentifier;
import com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer;
import com.brilliance.swift.util.StringUtil;
......@@ -18,10 +19,12 @@ public class FieldOnly54AAnalyzer extends AbstractSettlementMethodAnalyzer {
if ((StringUtil.isNotEmpty(sendBic) && bicCode.substring(0, 8).equals(sendBic.substring(0, 8)))
|| (StringUtil.isNotEmpty(receiveBic) && bicCode.substring(0, 8).equals(receiveBic.substring(0, 8)))) {
seltMtdHelper.setSettlementMethod("INDA");
buildSTErrorInfo(ERROR.T20010, "Block4/:54A:", null);
} else {
AbstractMT abstractMT = context.get(AbstractMT.class);
if (abstractMT.getSwiftMessage().isCOV()) {
seltMtdHelper.setSettlementMethod("INDA");
buildSTErrorInfo(ERROR.T20023, "Block4/:54A:", null);
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate54Flag(true);
......
package com.brilliance.swift.mt2mx.setlmtd.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer;
import com.brilliance.swift.vo.VoSettlementMethodHelper;
import com.prowidesoftware.swift.model.mt.AbstractMT;
......@@ -11,6 +12,7 @@ public class FieldOnly54BAnalyzer extends AbstractSettlementMethodAnalyzer {
AbstractMT abstractMT = context.get(AbstractMT.class);
if (abstractMT.getSwiftMessage().isCOV()) {
seltMtdHelper.setSettlementMethod("INDA");
buildSTErrorInfo(ERROR.T20023, "Block4/:54B:", null);
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate54Flag(true);
......
package com.brilliance.swift.mt2mx.setlmtd.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer;
import com.brilliance.swift.vo.VoSettlementMethodHelper;
import com.prowidesoftware.swift.model.mt.AbstractMT;
......@@ -11,6 +12,7 @@ public class FieldOnly54DAnalyzer extends AbstractSettlementMethodAnalyzer {
AbstractMT abstractMT = context.get(AbstractMT.class);
if (abstractMT.getSwiftMessage().isCOV()) {
seltMtdHelper.setSettlementMethod("INDA");
buildSTErrorInfo(ERROR.T20023, "Block4/:54D:", null);
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate54Flag(true);
......
package com.brilliance.mt2mx.camt029001;
import com.brilliance.swift.mt2mx.Mt2MxCreatorManager;
import com.brilliance.swift.SwiftTransfer;
import org.apache.commons.io.FileUtils;
import java.io.File;
......@@ -11,7 +11,7 @@ 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");
String mtStr = FileUtils.readFileToString(file);
String mxXml = new Mt2MxCreatorManager().mt2mx(mtStr, null, null);
String mxXml = SwiftTransfer.mt2Mx(mtStr, "D:/test/mt2mx/camt02900108.xml", null);
System.out.println(mxXml);
}
}
package com.brilliance.mt2mx.camt029001;
import com.brilliance.swift.mt2mx.Mt2MxCreatorManager;
import com.brilliance.swift.SwiftTransfer;
import org.apache.commons.io.FileUtils;
import java.io.File;
......@@ -11,7 +11,7 @@ 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");
String mtStr = FileUtils.readFileToString(file);
String mxXml = new Mt2MxCreatorManager().mt2mx(mtStr, null, null);
String mxXml = SwiftTransfer.mt2Mx(mtStr, "D:/test/mt2mx/camt02900108.xml", null);
System.out.println(mxXml);
}
}
package com.brilliance.mt2mx.camt056001;
import com.brilliance.swift.mt2mx.Mt2MxCreatorManager;
import com.brilliance.swift.SwiftTransfer;
import org.apache.commons.io.FileUtils;
import java.io.File;
......@@ -11,7 +11,7 @@ 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");
String mtStr = FileUtils.readFileToString(file);
String mxXml = new Mt2MxCreatorManager().mt2mx(mtStr, null, null);
String mxXml = SwiftTransfer.mt2Mx(mtStr, "D:/test/mt2mx/camt05600108.xml", null);
System.out.println(mxXml);
}
}
package com.brilliance.mt2mx.camt056001;
import com.brilliance.swift.mt2mx.Mt2MxCreatorManager;
import com.brilliance.swift.SwiftTransfer;
import org.apache.commons.io.FileUtils;
import java.io.File;
......@@ -11,7 +11,7 @@ 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");
String mtStr = FileUtils.readFileToString(file);
String mxXml = new Mt2MxCreatorManager().mt2mx(mtStr, null, null);
String mxXml = SwiftTransfer.mt2Mx(mtStr, "D:/test/mt2mx/camt05600108.xml", null);
System.out.println(mxXml);
}
}
package com.brilliance.mt2mx.pacs008001;
import com.brilliance.swift.mt2mx.Mt2MxCreatorManager;
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 Test {
public static void main(String[] args) throws IOException {
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftTxt\\Mt103.txt");
//File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftTxt\\Mt103.txt");
File file = new File("d:/test/MT103.txt");
String mtStr = FileUtils.readFileToString(file);
String mxXml = new Mt2MxCreatorManager().mt2mx(mtStr, null, null);
System.out.println(mxXml);
/*AbstractMT abstractMT = AbstractMT.parse(mtStr);
MT103 mt103 = (MT103)abstractMT;
Field53A field53A = mt103.getField53A();
System.out.println(field53A.getComponent(1) + field53A.getComponent2());
System.out.println(field53A.getBIC());*/
SwiftTranslationReport str = SwiftTransfer.mt2MxPlus(mtStr, "D:/test/mt2mx/pacs00800108.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.pacs009001;
import com.brilliance.swift.mt2mx.Mt2MxCreatorManager;
import com.brilliance.swift.SwiftTransfer;
import org.apache.commons.io.FileUtils;
import java.io.File;
......@@ -11,14 +11,14 @@ public class Test {
private static void test202() throws IOException {
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftTxt\\Mt202.txt");
String mtStr = FileUtils.readFileToString(file);
String mxXml = new Mt2MxCreatorManager().mt2mx(mtStr, null, null);
String mxXml = SwiftTransfer.mt2Mx(mtStr, "D:/test/mt2mx/pacs00900108.xml", null);
System.out.println(mxXml);
}
private static void test202Cov() throws IOException {
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftTxt\\Mt202_COV.txt");
String mtStr = FileUtils.readFileToString(file);
String mxXml = new Mt2MxCreatorManager().mt2mx(mtStr, null, null);
String mxXml = SwiftTransfer.mt2Mx(mtStr, "D:/test/mt2mx/pacs00900108.xml", null);
System.out.println(mxXml);
}
......
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