Commit 2b903880 by chengzhuoshen

开发camt029001,camt054001,camt056001 要素转MX报文功能

parent 2e0641a6
......@@ -40,14 +40,29 @@ public abstract class AbstractElement2MxCreator implements Element2MxCreator{
this.elementMaps = elementMaps;
}
/**
* 判断节点是否是数组,应用于putObj方法
* @param key
* @return
*/
protected boolean isArray(String key) {
return false;
}
/**
* 重新build Properties文件
*/
protected void rebuildProperties() {
}
/**
* 反射方法逻辑
* @param methodName
* @param where
* @param maps
* @param value
*/
private void invokeHere(String methodName, Object where, Map<String, Object> maps, Object value) {
try {
Method method = getClass().getMethod(methodName, maps.getClass(), new Object().getClass());
......
package com.brilliance.swift.element2mx;
import com.alibaba.fastjson.JSONObject;
import com.brilliance.swift.element2mx.camt029001.Element2MxCamt029001Creator;
import com.brilliance.swift.element2mx.camt053001.Element2MxCamt053001Creator;
import com.brilliance.swift.element2mx.camt054001.Element2MxCamt054001Creator;
import com.brilliance.swift.element2mx.camt056001.Element2MxCamt056001Creator;
import com.brilliance.swift.element2mx.pacs008001.Element2MxPacs008001Creator;
import com.brilliance.swift.element2mx.pacs009001.Element2MxPacs009001Creator;
import com.brilliance.swift.exception.SwiftException;
......@@ -32,6 +35,12 @@ public class Element2MxCreatorManager {
return new Element2MxPacs009001Creator();
} else if (messageType.matches("camt053001[0-9]{2}")) {
return new Element2MxCamt053001Creator();
} else if (messageType.matches("camt054001[0-9]{2}")) {
return new Element2MxCamt054001Creator();
} else if (messageType.matches("camt029001[0-9]{2}")) {
return new Element2MxCamt029001Creator();
} else if (messageType.matches("camt056001[0-9]{2}")) {
return new Element2MxCamt056001Creator();
} else {
throw new SwiftException("无效的MX类型:" + messageType);
}
......
package com.brilliance.swift.element2mx.camt029001;
import com.brilliance.swift.element2mx.AbstractElement2MxCreator;
public class Element2MxCamt029001Creator extends AbstractElement2MxCreator {
@Override
protected boolean isArray(String key) {
if ("cxlDtls".equals(key) || "txInfAndSts".equals(key)
|| "cxlStsRsnInf".equals(key)) {
return true;
}
return false;
}
}
package com.brilliance.swift.element2mx.camt054001;
import com.brilliance.swift.element2mx.AbstractElement2MxCreator;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.util.DateUtil;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
public class Element2MxCamt054001Creator extends AbstractElement2MxCreator {
@Override
protected boolean isArray(String key) {
if ("ntfctn".equals(key) || "ntry".equals(key)
|| "ntryDtls".equals(key) || "txDtls".equals(key)
|| "orgId.othr".equals(key)
|| "prvtId.othr".equals(key) || "finInstnId.othr".equals(key)) {
return true;
}
return false;
}
@Override
protected void rebuildProperties() {
properties.remove("valDt"); //处理逻辑在 postProcess() 方法中
properties.remove("dbtrInfo");
properties.remove("dbtrAgtInfo");
properties.put("dbtrNm", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.nm");
properties.put("dbtrOrgAnyBIC", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.orgId.anyBIC");
properties.put("dbtrOrgLei", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.orgId.lei");
properties.put("dbtrOrgOthrId", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.orgId.othr.id");
properties.put("dbtrOrgOthrIdType", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.orgId.othr.schmeNm.cd");
properties.put("dbtrOrgOthrIdTypePrtry", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.orgId.othr.schmeNm.prtry");
properties.put("dbtrOrgOthrIssr", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.orgId.othr.issr");
properties.put("dbtrPstlAdrType", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.pstlAdr.adrTp");
properties.put("dbtrPstlAdrCtry", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.pstlAdr.ctry");
properties.put("dbtrPstlAdrDept", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.pstlAdr.dept");
properties.put("dbtrPstlAdrSubDept", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.pstlAdr.subDept");
properties.put("dbtrPstlAdrStrtNm", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.pstlAdr.strtNm");
properties.put("dbtrPstlAdrBldgNb", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.pstlAdr.bldgNb");
properties.put("dbtrPstlAdrBldgNm", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.pstlAdr.bldgNm");
properties.put("dbtrPstlAdrFlr", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.pstlAdr.flr");
properties.put("dbtrPstlAdrRoom", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.pstlAdr.room");
properties.put("dbtrPstlAdrTwnNm", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.pstlAdr.twnNm");
properties.put("dbtrPstlAdrPstBx", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.pstlAdr.pstBx");
properties.put("dbtrPstlAdrPstCd", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.pstlAdr.pstCd");
properties.put("dbtrPstlAdrCtrySubDvsn", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.pstlAdr.ctrySubDvsn");
properties.put("dbtrPstlAdrDstrctNm", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.pstlAdr.dstrctNm");
properties.put("dbtrPstlAdrTwnLctnNm", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.pstlAdr.twnLctnNm");
properties.put("dbtrAdrLines", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.PstlAdr.adrLine");
properties.put("dbtrAgtBicfi", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.bicfi");
properties.put("dbtrAgtClrSysId", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.clrSysMmbId.mmbId");
properties.put("dbtrAgtClrSysIdType", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.clrSysMmbId.clrSysId.cd");
properties.put("dbtrAgtClrSysIdTypePrtry", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.clrSysMmbId.clrSysId.prtry");
properties.put("dbtrAgtLei", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.lei");
properties.put("dbtrAgtNm", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.nm");
properties.put("dbtrAgtPstlAdrType", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.pstlAdr.adrTp");
properties.put("dbtrAgtPstlAdrCtry", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.pstlAdr.ctry");
properties.put("dbtrAgtPstlAdrDept", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.pstlAdr.dept");
properties.put("dbtrAgtPstlAdrSubDept", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.pstlAdr.subDept");
properties.put("dbtrAgtPstlAdrStrtNm", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.pstlAdr.strtNm");
properties.put("dbtrAgtPstlAdrBldgNb", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.pstlAdr.bldgNb");
properties.put("dbtrAgtPstlAdrBldgNm", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.pstlAdr.bldgNm");
properties.put("dbtrAgtPstlAdrFlr", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.pstlAdr.flr");
properties.put("dbtrAgtPstlAdrRoom", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.pstlAdr.room");
properties.put("dbtrAgtPstlAdrTwnNm", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.pstlAdr.twnNm");
properties.put("dbtrAgtPstlAdrPstBx", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.pstlAdr.pstBx");
properties.put("dbtrAgtPstlAdrPstCd", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.pstlAdr.pstCd");
properties.put("dbtrAgtPstlAdrCtrySubDvsn", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.pstlAdr.ctrySubDvsn");
properties.put("dbtrAgtPstlAdrDstrctNm", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.pstlAdr.dstrctNm");
properties.put("dbtrAgtPstlAdrTwnLctnNm", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.pstlAdr.twnLctnNm");
properties.put("dbtrAgtAdrLines", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.PstlAdr.adrLines");
properties.put("dbtrAgtOthrId", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.othr.id");
properties.put("dbtrAgtOthrIdType", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.othr.schmeNm.cd");
properties.put("dbtrAgtOthrIdTypePrtry", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.othr.schmeNm.prtry");
properties.put("dbtrAgtOthrIssr", "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdAgts.dbtrAgt.finInstnId.othr.issr");
}
@Override
public void postProcess() {
//特殊处理 valDt
if (elementMaps.containsKey("valDt")) {
String valDtStr = (String) elementMaps.get("valDt");
if (valDtStr.indexOf("T") > -1) {
try {
XMLGregorianCalendar setlDt = DatatypeFactory.newInstance().newXMLGregorianCalendar(valDtStr);
putObj(jsonMaps, "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.valDt.dtTm", valDtStr);
putObj(jsonMaps, "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdDts.intrBkSttlmDt", DateUtil.format(setlDt, "yyyy-MM-dd"));
} catch (DatatypeConfigurationException e) {
throw new SwiftException(e.getMessage());
}
} else {
putObj(jsonMaps, "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.valDt.dt", valDtStr);
putObj(jsonMaps, "bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdDts.intrBkSttlmDt", valDtStr);
}
}
super.postProcess();
}
}
package com.brilliance.swift.element2mx.camt056001;
import com.brilliance.swift.element2mx.AbstractElement2MxCreator;
public class Element2MxCamt056001Creator extends AbstractElement2MxCreator {
@Override
protected boolean isArray(String key) {
if ("undrlyg".equals(key) || "txInf".equals(key)
|| "cxlRsnInf".equals(key)) {
return true;
}
return false;
}
}
......@@ -23,6 +23,8 @@ public abstract class AbstractMx2ElementCreator implements Mx2ElementCreator{
protected Map<String, Object> maps = new LinkedHashMap<>();
protected String messageType;
public AbstractMX getAbstractMX() {
return abstractMX;
}
......@@ -39,6 +41,14 @@ public abstract class AbstractMx2ElementCreator implements Mx2ElementCreator{
this.xmlStr = xmlStr;
}
public String getMessageType() {
return messageType;
}
public void setMessageType(String messageType) {
this.messageType = messageType;
}
private Object invokeHere(String methodName, Object where) {
try {
Method method = getClass().getMethod(methodName);
......@@ -52,11 +62,6 @@ public abstract class AbstractMx2ElementCreator implements Mx2ElementCreator{
@Override
public Map<String, Object> buildElement() {
//AbstractMX abstractMX = AbstractMX.parse(xmlStr);
String messageType = abstractMX.getMxId().getBusinessProcess().name()
+ abstractMX.getMxId().getFunctionality()
+ abstractMX.getMxId().getVariant()
+ abstractMX.getMxId().getVersion();
maps.put("messageType", messageType);
String gsonStr = abstractMX.toJson();
Map<String, Object> mxGsonMaps = JSON.parseObject(gsonStr);
......
......@@ -10,6 +10,7 @@ import com.brilliance.swift.mx2element.pacs009001.Mx2ElementPacs009001Creator;
import com.brilliance.swift.util.XmlUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.prowidesoftware.swift.model.MxId;
import com.prowidesoftware.swift.model.mx.AbstractMX;
import java.util.LinkedHashMap;
......@@ -18,58 +19,45 @@ import java.util.Map;
public class Mx2ElementCreatorManager {
public String mx2Element(String xmlStr) throws SwiftException {
xmlStr = XmlUtil.handlingXml(xmlStr);
//去掉命名空间前缀
xmlStr = XmlUtil.clearXmlNamespacePrefix(xmlStr);
AbstractMX abstractMX = AbstractMX.parse(xmlStr);
String messageType = (abstractMX.getMxId().getBusinessProcess().name()
+ "."
+ abstractMX.getMxId().getFunctionality()
+ "."
+ abstractMX.getMxId().getVariant())
//+ abstractMX.getMxId().getVersion())
.trim();
AbstractMx2ElementCreator creator = getCreator(messageType);
creator.setAbstractMX(abstractMX);
creator.setXmlStr(xmlStr);
Map<String, Object> maps = creator.buildElement();
Map<String, Object> maps = mx2ElementMaps(xmlStr);
Gson gson = new GsonBuilder().setPrettyPrinting().create();
return gson.toJson(maps, LinkedHashMap.class);
}
public Map<String, Object> mx2ElementMaps(String xmlStr) throws SwiftException {
xmlStr = XmlUtil.handlingXml(xmlStr);
//去掉命名空间前缀
MxId mxId = XmlUtil.getMxMessageType(xmlStr);
String messageType = mxId.getBusinessProcess().name()
+ mxId.getFunctionality()
+ mxId.getVariant()
+ mxId.getVersion();
if (mxId == null) {
throw new SwiftException("找不到MX报文类型");
}
xmlStr = XmlUtil.clearXmlNamespacePrefix(xmlStr);
AbstractMX abstractMX = AbstractMX.parse(xmlStr);
String messageType = (abstractMX.getMxId().getBusinessProcess().name()
+ "."
+ abstractMX.getMxId().getFunctionality()
+ "."
+ abstractMX.getMxId().getVariant())
//+ abstractMX.getMxId().getVersion())
.trim();
AbstractMX abstractMX = AbstractMX.parse(xmlStr, mxId);
AbstractMx2ElementCreator creator = getCreator(messageType);
creator.setAbstractMX(abstractMX);
creator.setXmlStr(xmlStr);
creator.setMessageType(messageType);
return creator.buildElement();
}
public AbstractMx2ElementCreator getCreator(String messageType) {
if ("pacs.008.001".equals(messageType)) {
if (messageType.matches("pacs008001[0-9]{2}")) {
return new Mx2ElementPacs008001Creator();
} else if("camt.054.001".equals(messageType)){
} else if (messageType.matches("pacs009001[0-9]{2}")) {
return new Mx2ElementPacs009001Creator();
} else if (messageType.matches("camt054001[0-9]{2}")) {
return new Mx2ElementCamt054001Creator();
} else if("camt.053.001".equals(messageType)){
} else if (messageType.matches("camt053001[0-9]{2}")) {
return new Mx2ElementCamt053001Creator();
} else if("camt.029.001".equals(messageType)){
} else if (messageType.matches("camt029001[0-9]{2}")) {
return new Mx2ElementCamt029001Creator();
} else if("camt.056.001".equals(messageType)){
} else if (messageType.matches("camt056001[0-9]{2}")) {
return new Mx2ElementCamt056001Creator();
} else if("pacs.009.001".equals(messageType)){
return new Mx2ElementPacs009001Creator();
} else {
return new Mx2ElementDefaultCreator();
throw new SwiftException("无效的MX报文类型");
}
}
}
......@@ -130,51 +130,6 @@ public class Mx2ElementCamt054001Creator extends AbstractMx2ElementCreator {
}
maps.put("dbtrAdrLines", list);
}
String prvtIdBirthDt = XmlUtil.getXmlNodeValue(document, bodyParentPath+".Ntfctn.Ntry.NtryDtls.TxDtls.RltdPties.Dbtr.Pty.Id.PrvtId.DtAndPlcOfBirth.BirthDt");
if (StringUtil.isNotEmpty(prvtIdBirthDt)) {
maps.put("dbtrPrvtIdBirthDt", prvtIdBirthDt);
}
String prvtIdPrvcOfBirth = XmlUtil.getXmlNodeValue(document, bodyParentPath+".Ntfctn.Ntry.NtryDtls.TxDtls.RltdPties.Dbtr.Pty.Id.PrvtId.DtAndPlcOfBirth.PrvcOfBirth");
if (StringUtil.isNotEmpty(prvtIdPrvcOfBirth)) {
maps.put("dbtrPrvtIdPrvcOfBirth", prvtIdPrvcOfBirth);
}
String prvtIdCityOfBirth = XmlUtil.getXmlNodeValue(document, bodyParentPath+".Ntfctn.Ntry.NtryDtls.TxDtls.RltdPties.Dbtr.Pty.Id.PrvtId.DtAndPlcOfBirth.CityOfBirth");
if (StringUtil.isNotEmpty(prvtIdCityOfBirth)) {
maps.put("dbtrPrvtIdCityOfBirth", prvtIdCityOfBirth);
}
String prvtIdCtryOfBirth = XmlUtil.getXmlNodeValue(document, bodyParentPath+".Ntfctn.Ntry.NtryDtls.TxDtls.RltdPties.Dbtr.Pty.Id.PrvtId.DtAndPlcOfBirth.CtryOfBirth");
if (StringUtil.isNotEmpty(prvtIdCtryOfBirth)) {
maps.put("dbtrPrvtIdCtryOfBirth", prvtIdCtryOfBirth);
}
String prvtIdOthrId = XmlUtil.getXmlNodeValue(document, bodyParentPath+".Ntfctn.Ntry.NtryDtls.TxDtls.RltdPties.Dbtr.Pty.Id.PrvtId.Othr.Id");
if (StringUtil.isNotEmpty(prvtIdOthrId)) {
maps.put("dbtrPrvtIdOthrId", prvtIdOthrId);
}
String prvtIdOthrSchmeCode = XmlUtil.getXmlNodeValue(document, bodyParentPath+".Ntfctn.Ntry.NtryDtls.TxDtls.RltdPties.Dbtr.Pty.Id.PrvtId.Othr.SchmeNm.Cd");
if (StringUtil.isNotEmpty(prvtIdOthrSchmeCode)) {
maps.put("dbtrPrvtIdOthrIdType", prvtIdOthrSchmeCode);
}
String prvtIdOthrSchmeCodePrtry = XmlUtil.getXmlNodeValue(document, bodyParentPath+".Ntfctn.Ntry.NtryDtls.TxDtls.RltdPties.Dbtr.Pty.Id.PrvtId.Othr.SchmeNm.Prtry");
if (StringUtil.isNotEmpty(prvtIdOthrSchmeCodePrtry)) {
maps.put("dbtrPrvtIdOthrIdTypePrtry", prvtIdOthrSchmeCodePrtry);
}
String prvtIdOthrIssr = XmlUtil.getXmlNodeValue(document, bodyParentPath+".Ntfctn.Ntry.NtryDtls.TxDtls.RltdPties.Dbtr.Pty.Id.PrvtId.Othr.Issr");
if (StringUtil.isNotEmpty(prvtIdOthrIssr)) {
maps.put("dbtrPrvtIdOthrIssr", prvtIdOthrIssr);
}
String ctryOfRes = XmlUtil.getXmlNodeValue(document, bodyParentPath+".Ntfctn.Ntry.NtryDtls.TxDtls.RltdPties.Dbtr.Pty.CtryOfRes");
if (StringUtil.isNotEmpty(ctryOfRes)) {
maps.put("dbtrCtryOfRes", ctryOfRes);
}
} else {//Debtor.Agent
String nm = XmlUtil.getXmlNodeValue(document, bodyParentPath+".Ntfctn.Ntry.NtryDtls.TxDtls.RltdPties.Dbtr.Agt.FinInstnId.Nm");
if (StringUtil.isNotEmpty(nm)) {
......
......@@ -6,6 +6,7 @@ import com.brilliance.swift.mx2map.camt054.Mx2MapCamt054Creator;
import com.brilliance.swift.mx2map.pacs008.Mx2MapPacs008Creator;
import com.brilliance.swift.mx2map.pacs009.Mx2MapPacs009Creator;
import com.brilliance.swift.util.XmlUtil;
import com.prowidesoftware.swift.model.MxId;
import com.prowidesoftware.swift.model.mx.AbstractMX;
import java.util.Map;
......@@ -13,13 +14,14 @@ import java.util.Map;
public class Mx2MapCreatorManager {
public Map<String, Object> mx2Map(String xml, String localCode) throws SwiftException {
xml = XmlUtil.handlingXml(xml);
AbstractMX abstractMX = AbstractMX.parse(xml);
String messageType = (abstractMX.getMxId().getBusinessProcess().name()
+ "."
+ abstractMX.getMxId().getFunctionality()
+ "."
+ abstractMX.getMxId().getVariant())
xml = XmlUtil.handlingXml(xml);
MxId mxId = XmlUtil.getMxMessageType(xml);
if (mxId == null) {
throw new SwiftException("找不到MX报文类型");
}
String messageType = (mxId.getBusinessProcess().name()
+ mxId.getFunctionality()
+ mxId.getVariant())
//+ abstractMX.getMxId().getVersion())
.trim();
AbstractMx2MapCreator creator = getCreator(messageType);
......@@ -29,13 +31,13 @@ public class Mx2MapCreatorManager {
}
public AbstractMx2MapCreator getCreator(String messageType) {
if("camt.053.001".equals(messageType)){
if ("camt053001".equals(messageType)) {
return new Mx2MapCamt053Creator();
} else if("pacs.008.001".equals(messageType)){
} else if ("pacs008001".equals(messageType)) {
return new Mx2MapPacs008Creator();
} else if("pacs.009.001".equals(messageType)){
} else if ("pacs009001".equals(messageType)) {
return new Mx2MapPacs009Creator();
} else if("camt.054.001".equals(messageType)){
} else if ("camt054001".equals(messageType)) {
return new Mx2MapCamt054Creator();
} else {
throw new SwiftException("无效的报文类型");
......
......@@ -14,7 +14,6 @@ import com.prowidesoftware.swift.io.IConversionService;
import com.prowidesoftware.swift.io.writer.SwiftWriter;
import com.prowidesoftware.swift.model.*;
import com.prowidesoftware.swift.model.field.*;
import com.prowidesoftware.swift.model.mx.AbstractMX;
import com.prowidesoftware.swift.model.mx.NamespaceReader;
import org.apache.commons.lang3.Validate;
import org.dom4j.*;
......@@ -507,12 +506,12 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
IConversionService srv = new ConversionService();
String mtStr = srv.getFIN(swiftMessage);
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());
MxId mxId = (MxId)context.get(Mx2MtContextIdentifier.MX_TYPE_OBJ, true);
if (mxId != null) {
str.setMxType(mxId.getBusinessProcess().name()
+ mxId.getFunctionality()
+ mxId.getVariant()
+ mxId.getVersion());
}
str.setMtType(getMtType());
str.setMessage(mtStr);
......
......@@ -6,7 +6,7 @@ public class Mx2MtContextIdentifier {
public static final String MX_XMl = "mx.xml";
public static final String MX_OBJ = "mx.obj";
public static final String MX_TYPE_OBJ = "mx.type.obj";
public static final String MX_TO_MT_OUTPUT_FILE_PATH = "mx.to.mt.output.filepath";
......
......@@ -18,6 +18,7 @@ import com.brilliance.swift.mx2mt.mtn99.Mx2MtN99Creator;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.util.XmlUtil;
import com.brilliance.swift.vo.SwiftTranslationReport;
import com.prowidesoftware.swift.model.MxId;
import com.prowidesoftware.swift.model.mx.AbstractMX;
import org.dom4j.Document;
import org.dom4j.DocumentException;
......@@ -30,12 +31,13 @@ public class Mx2MtCreatorManager {
public SwiftTranslationReport mx2Mt(String xml, String fileOutputPath, Map<String, Object> extraMap) throws SwiftException {
try {
xml = XmlUtil.handlingXml(xml);
AbstractMX abstractMX = AbstractMX.parse(xml);
String messageType = (abstractMX.getMxId().getBusinessProcess().name()
+ "."
+ abstractMX.getMxId().getFunctionality()
+ "."
+ abstractMX.getMxId().getVariant())
MxId mxId = XmlUtil.getMxMessageType(xml);
if (mxId == null) {
throw new SwiftException("找不到MX报文类型");
}
String messageType = (mxId.getBusinessProcess().name()
+ mxId.getFunctionality()
+ mxId.getVariant())
//+ abstractMX.getMxId().getVersion())
.trim();
Mx2MtContext context = new Mx2MtContext();
......@@ -43,15 +45,16 @@ public class Mx2MtCreatorManager {
context.set(Mx2MtContextIdentifier.MX_TO_MT_LISTENER_CLASS, new Mx2MtListener()); //注册监听器
context.set(Mx2MtContextIdentifier.MX_XMl_DOCUMENT, document);
context.set(Mx2MtContextIdentifier.MX_TO_MT_OUTPUT_FILE_PATH, fileOutputPath);
context.set(Mx2MtContextIdentifier.MX_OBJ, abstractMX);
context.set(Mx2MtContextIdentifier.MX_TYPE_OBJ, mxId);
context.set(Mx2MtContextIdentifier.MX_XMl, xml);
String applicationMode = "O";//代表是收报,默认值
if (extraMap != null) {
applicationMode = (String) extraMap.get(Mx2MtConstants.APPLICATION_MODE);
if (StringUtil.isEmpty(applicationMode)) {
String bnkBic = (String)extraMap.get("bnkBic");//得到本行的bicCode
if (StringUtil.isNotEmpty(bnkBic) && abstractMX.getAppHdr() != null) {
if (bnkBic.equals(abstractMX.getAppHdr().from())) {
if (StringUtil.isNotEmpty(bnkBic)) {
AbstractMX abstractMX = AbstractMX.parse(xml, mxId);
if (abstractMX != null && abstractMX.getAppHdr() != null && bnkBic.equals(abstractMX.getAppHdr().from())) {
applicationMode = "I";//如果发报行和本行bic一样,表示是发报
}
}
......@@ -76,31 +79,31 @@ public class Mx2MtCreatorManager {
}
public AbstractMx2MtCreator getCreator(String messageType) {
if ("pacs.008.001".equals(messageType)) {
if ("pacs008001".equals(messageType)) {
return new Mx2Mt103Creator();
} else if ("pacs.009.001".equals(messageType)) {
} else if ("pacs009001".equals(messageType)) {
return new Mx2Mt202Creator();
}else if("camt.054.001".equals(messageType)){
}else if("camt054001".equals(messageType)){
return new Mx2Mt900910Creator();
} else if("camt.053.001".equals(messageType)){
} else if("camt053001".equals(messageType)){
return new Mx2Mt940950Creator();
} else if("camt.056.001".equals(messageType)){
} else if("camt056001".equals(messageType)){
return new Mx2Mtn92Creator();
} else if("camt.029.001".equals(messageType)){
} else if("camt029001".equals(messageType)){
return new Mx2Mtn96Creator();
} else if("camt.052.001".equals(messageType)){
} else if("camt052001".equals(messageType)){
return new Mx2Mt942Creator();
} else if("pacs.004.001.MT103".equals(messageType)){
} else if("pacs004001.MT103".equals(messageType)){
return new Mx2Mt103RetnCreator();
} else if("pacs.004.001.MT202".equals(messageType)){
} else if("pacs004001.MT202".equals(messageType)){
return new Mx2Mt202RetnCreator();
} else if("pacs.004.001.MT205".equals(messageType)){
} else if("pacs004001.MT205".equals(messageType)){
return new Mx2Mt205RetnCreator();
} else if("camt.057.001".equals(messageType)){
} else if("camt057001".equals(messageType)){
return new Mx2Mt210Creator();
} else if("pacs.002.001".equals(messageType)){
} else if("pacs002001".equals(messageType)){
return new Mx2MtN99Creator();
} else if("camt.060.001".equals(messageType)){
} else if("camt060001".equals(messageType)){
return new Mx2Mt920Creator();
} else {
throw new SwiftException("Invalid message type");
......@@ -120,7 +123,7 @@ public class Mx2MtCreatorManager {
* @return
*/
private String handlingMessageType(Document document, String messageType) {
if ("pacs.004.001".equals(messageType)) {
if ("pacs004001".equals(messageType)) {
boolean findFlag = false;
Map<String, String> parentElementMaps = XmlUtil.getParentElementMaps(document);
String grpParentElementName = parentElementMaps.get("OrgnlGrpInf");
......
package com.brilliance.swift.util;
import com.brilliance.swift.SwiftTransfer;
import com.prowidesoftware.swift.model.MxId;
import com.prowidesoftware.swift.model.mx.NamespaceReader;
import org.dom4j.*;
import org.dom4j.io.SAXReader;
......@@ -12,6 +14,7 @@ import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -192,16 +195,20 @@ public class XmlUtil {
}
public static String clearXmlNamespacePrefix(String xmlStr) {
String regex = "[AppHdr|Document][\\s]*xmlns:([\\w]*)=";
String regex = "<([\\w]+):AppHdr";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(xmlStr);
String prefix = "";
while (m.find()) {
prefix = m.group(1);
xmlStr = xmlStr.replace("<" + prefix + ":", "<").replace("</" + prefix + ":", "</");
String prefix = m.group(1);
xmlStr = xmlStr.replace("<" + prefix + ":", "<").replace("</" + prefix + ":", "</");
}
regex = "<([\\w]+):Document";
p = Pattern.compile(regex);
m = p.matcher(xmlStr);
while (m.find()) {
String prefix = m.group(1);
xmlStr = xmlStr.replace("<" + prefix + ":", "<").replace("</" + prefix + ":", "</");
}
xmlStr = xmlStr.replaceAll("AppHdr[\\s]*xmlns:([\\w]*)=", "AppHdr xmlns=");
xmlStr = xmlStr.replaceAll("Document[\\s]*xmlns:([\\w]*)=", "Document xmlns=");
return xmlStr;
}
......@@ -224,4 +231,17 @@ public class XmlUtil {
return SwiftTransfer.fetchXmlFromMixMessage(xmlStr);
}
}
/**
* 找到MX报文的报文类型
* @param xml
* @return
*/
public static MxId getMxMessageType(String xml) {
Optional<String> namespace = NamespaceReader.findDocumentNamespace(xml);
if (namespace.isPresent()) {
return new MxId(namespace.get());
}
return null;
}
}
#APPLICATION HEADER
frBic=appHdr.fr.fiId.finInstnId.bicfi
toBic=appHdr.to.fiId.finInstnId.bicfi
bizMsgIdr=rsltnOfInvstgtn.assgnmt.id?rsltnOfInvstgtn.cxlDtls.txInfAndSts.cxlStsId?appHdr.bizMsgIdr?rsltnOfInvstgtn.assgnmt.id
bizMsgIdr=rsltnOfInvstgtn.cxlDtls.txInfAndSts.cxlStsId?rsltnOfInvstgtn.assgnmt.id?appHdr.bizMsgIdr
msgDefIdr=appHdr.msgDefIdr
bizSvc=appHdr.bizSvc
creDt=rsltnOfInvstgtn.assgnmt.creDtTm?appHdr.creDt
priority=appHdr.prty
uetr=rsltnOfInvstgtn.cxlDtls.txInfAndSts.orgnlUETR
#BODY
#11R
orgnlMsgNmId=rsltnOfInvstgtn.cxlDtls.txInfAndSts.orgnlGrpInf.orgnlMsgNmId
orgnlCreDtTm=rsltnOfInvstgtn.cxlDtls.txInfAndSts.orgnlGrpInf.orgnlCreDtTm
#21
rslvdCaseId=rsltnOfInvstgtn.cxlDtls.txInfAndSts.rslvdCase.id
#76
stsConf=sts.conf
rsnCd=rsltnOfInvstgtn.cxlDtls.txInfAndSts.cxlStsRsnInf.rsn.cd
rsnPrtry=rsltnOfInvstgtn.cxlDtls.txInfAndSts.cxlStsRsnInf.rsn.prtry
addtlInf=rsltnOfInvstgtn.cxlDtls.txInfAndSts.cxlStsRsnInf.addtlInf
#Other
assgnrBic=rsltnOfInvstgtn.assgnmt.assgnr.agt.finInstnId.bicfi
assgnrClrSysId=rsltnOfInvstgtn.assgnmt.assgnr.agt.finInstnId.clrSysMmbId.mmbId
assgnrClrSysIdType=rsltnOfInvstgtn.assgnmt.assgnr.agt.finInstnId.clrSysMmbId.clrSysId.cd
assgnrClrSysIdTypePrtry=rsltnOfInvstgtn.assgnmt.assgnr.agt.finInstnId.clrSysMmbId.clrSysId.prtry
assgnrLei=rsltnOfInvstgtn.assgnmt.assgnr.agt.finInstnId.lei
assgneBic=rsltnOfInvstgtn.assgnmt.assgne.pty.id.orgId.anyBIC?rsltnOfInvstgtn.assgnmt.assgne.agt.finInstnId.bicfi
assgneBic=rsltnOfInvstgtn.assgnmt.assgne.agt.finInstnId.bicfi
assgneClrSysId=rsltnOfInvstgtn.assgnmt.assgne.agt.finInstnId.clrSysMmbId.mmbId
assgneClrSysIdType=rsltnOfInvstgtn.assgnmt.assgne.agt.finInstnId.clrSysMmbId.clrSysId.cd
assgneClrSysIdTypePrtry=rsltnOfInvstgtn.assgnmt.assgne.agt.finInstnId.clrSysMmbId.clrSysId.prtry
assgneLei=rsltnOfInvstgtn.assgnmt.assgne.agt.finInstnId.lei
orgnlMsgId=rsltnOfInvstgtn.cxlDtls.txInfAndSts.orgnlGrpInf.orgnlMsgId
orgnlInstrId=rsltnOfInvstgtn.cxlDtls.txInfAndSts.orgnlInstrId
orgnlEndToEndId=rsltnOfInvstgtn.cxlDtls.txInfAndSts.orgnlInstrId
stsConf=rsltnOfInvstgtn.sts.conf
rslvdCaseId=rsltnOfInvstgtn.cxlDtls.txInfAndSts.rslvdCase.id
rslvdCaseCretrPty=rsltnOfInvstgtn.cxlDtls.txInfAndSts.rslvdCase.cretr.pty#party
rslvdCaseCretrAgt=rsltnOfInvstgtn.cxlDtls.txInfAndSts.rslvdCase.cretr.agt#agent
orgnlMsgId=rsltnOfInvstgtn.cxlDtls.txInfAndSts.orgnlGrpInf.orgnlMsgId
orgnlMsgNmId=rsltnOfInvstgtn.cxlDtls.txInfAndSts.orgnlGrpInf.orgnlMsgNmId
orgnlCreDtTm=rsltnOfInvstgtn.cxlDtls.txInfAndSts.orgnlGrpInf.orgnlCreDtTm
orgnlInstrId=rsltnOfInvstgtn.cxlDtls.txInfAndSts.orgnlInstrId
orgnlEndToEndId=rsltnOfInvstgtn.cxlDtls.txInfAndSts.orgnlEndToEndId
orgnlTxId=rsltnOfInvstgtn.cxlDtls.txInfAndSts.orgnlTxId
uetr=rsltnOfInvstgtn.cxlDtls.txInfAndSts.orgnlUETR
orgtrNm=rsltnOfInvstgtn.cxlDtls.txInfAndSts.cxlStsRsnInf.orgtr.nm
orgtrOrgAnyBIC=rsltnOfInvstgtn.cxlDtls.txInfAndSts.cxlStsRsnInf.orgtr.id.orgId.anyBIC
orgtrOrgLei=rsltnOfInvstgtn.cxlDtls.txInfAndSts.cxlStsRsnInf.orgtr.id.orgId.lei
......@@ -68,3 +62,5 @@ orgtrPhneNb=rsltnOfInvstgtn.cxlDtls.txInfAndSts.cxlStsRsnInf.orgtr.ctctDtls.phne
orgtrMobNb=rsltnOfInvstgtn.cxlDtls.txInfAndSts.cxlStsRsnInf.orgtr.ctctDtls.mobNb
orgtrFaxNb=rsltnOfInvstgtn.cxlDtls.txInfAndSts.cxlStsRsnInf.orgtr.ctctDtls.faxNb
orgtrEmailAdr=rsltnOfInvstgtn.cxlDtls.txInfAndSts.cxlStsRsnInf.orgtr.ctctDtls.emailAdr
rsnCd=rsltnOfInvstgtn.cxlDtls.txInfAndSts.cxlStsRsnInf.rsn.cd
addtlInf=rsltnOfInvstgtn.cxlDtls.txInfAndSts.cxlStsRsnInf.addtlInf
\ No newline at end of file
#APPLICATION HEADER
frBic=appHdr.fr.fiId.finInstnId.bicfi
toBic=appHdr.to.fiId.finInstnId.bicfi
bizMsgIdr=bkToCstmrDbtCdtNtfctn.grpHdr.msgId?appHdr.bizMsgIdr
bizMsgIdr=bkToCstmrDbtCdtNtfctn.grpHdr.msgId?appHdr.bizMsgIdr?bkToCstmrDbtCdtNtfctn.ntfctn.id
msgDefIdr=appHdr.msgDefIdr
bizSvc=appHdr.bizSvc
creDt=bkToCstmrDbtCdtNtfctn.grpHdr.creDtTm?appHdr.creDt
creDt=bkToCstmrDbtCdtNtfctn.grpHdr.creDtTm?appHdr.creDt?bkToCstmrDbtCdtNtfctn.ntfctn.creDtTm
priority=appHdr.prty
cdtDbtInd=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.cdtDbtInd
#BODY
cdtDbtInd=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.cdtDbtInd?bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.cdtDbtInd
entryRef=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryRef
uetr=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.refs.uetr
sts=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.sts.cd
stsPrtry=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.sts.prtry
ntryBkTxCdDomnCd=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.bkTxCd.domn.cd
ntryBkTxCdFmlyCd=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.bkTxCd.domn.fmly.cd
ntryBkTxCdFmlySubFmlyCd=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.bkTxCd.domn.fmly.subFmlyCd
ntryAcctSvcrRef=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.acctSvcrRef
#13
bookgDt=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.bookgDt.dtTm
#21
......@@ -24,12 +29,13 @@ ntfctnAcctType=bkToCstmrDbtCdtNtfctn.ntfctn.acct.tp.cd
ntfctnAcctTypePrtry=bkToCstmrDbtCdtNtfctn.ntfctn.acct.tp.prtry
ntfctnAcctCcy=bkToCstmrDbtCdtNtfctn.ntfctn.acct.ccy
ntfctnAcctNm=bkToCstmrDbtCdtNtfctn.ntfctn.acct.nm
ntfctnAcctOwnerAnyBIC=bkToCstmrDbtCdtNtfctn.ntfctn.acct.Ownr.Id.OrgId.AnyBIC
ntfctnAcctOwnerAnyBIC=bkToCstmrDbtCdtNtfctn.ntfctn.acct.ownr.id.orgId.anyBIC
#32
valDt=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.valDt.dt?bkToCstmrDbtCdtNtfctn.ntfctn.ntry.valDt.dtTm?bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdDts.intrBkSttlmDt
ntryAmt=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.amt.value&bigdecimal
ntryCcy=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.amt.ccy
ntryAmt=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.amt.value&bigdecimal?bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.amt.value&bigdecimal
ntryCcy=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.amt.ccy?bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.amt.ccy
dbtrInfo=@buildDbtrInfo
#??KEY??
dbtrPrvtBirthDt=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.prvtId.dtAndPlcOfBirth.birthDt
dbtrPrvtPrvcOfBirth=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.prvtId.dtAndPlcOfBirth.prvcOfBirth
dbtrPrvtCityOfBirth=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.prvtId.dtAndPlcOfBirth.cityOfBirth
......@@ -37,6 +43,15 @@ dbtrPrvtCtryOfBirth=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.
dbtrPrvtId=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.prvtId.othr.id
dbtrPrvtIdType=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.prvtId.othr.schmeNm.cd
dbtrPrvtIdTypePrtry=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.prvtId.othr.schmeNm.prtry
#??KEY??
dbtrPrvtIdBirthDt=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.prvtId.dtAndPlcOfBirth.birthDt
dbtrPrvtIdPrvcOfBirth=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.prvtId.dtAndPlcOfBirth.prvcOfBirth
dbtrPrvtIdCityOfBirth=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.prvtId.dtAndPlcOfBirth.cityOfBirth
dbtrPrvtIdCtryOfBirth=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.prvtId.dtAndPlcOfBirth.ctryOfBirth
dbtrPrvtIdOthrId=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.prvtId.othr.id
dbtrPrvtIdOthrIdType=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.prvtId.othr.schmeNm.cd
dbtrPrvtIdOthrIdTypePrtry=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.prvtId.othr.schmeNm.prtry
dbtrPrvtIdOthrIssr=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.id.prvtId.othr.issr
dbtrCtryOfRes=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.ctryOfRes
dbtrPhneNb=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.ctctDtls.phneNb
dbtrMobNb=bkToCstmrDbtCdtNtfctn.ntfctn.ntry.ntryDtls.txDtls.rltdPties.dbtr.pty.ctctDtls.mobNb
......
......@@ -6,48 +6,29 @@ msgDefIdr=appHdr.msgDefIdr
bizSvc=appHdr.bizSvc
creDt=fiToFIPmtCxlReq.assgnmt.creDtTm?appHdr.creDt
priority=appHdr.prty
uetr=fiToFIPmtCxlReq.undrlyg.txInf.orgnlUETR
#BODY
#11S
assgnrBic=fiToFIPmtCxlReq.assgnmt.assgnr.agt.finInstnId.bicfi
assgnrClrSysId=fiToFIPmtCxlReq.assgnmt.assgnr.agt.finInstnId.clrSysMmbId.mmbId
assgnrClrSysIdType=fiToFIPmtCxlReq.assgnmt.assgnr.agt.finInstnId.clrSysMmbId.clrSysId.cd
assgnrClrSysIdTypePrtry=fiToFIPmtCxlReq.assgnmt.assgnr.agt.finInstnId.clrSysMmbId.clrSysId.prtry
assgnrLei=fiToFIPmtCxlReq.assgnmt.assgnr.agt.finInstnId.lei
assgneBic=fiToFIPmtCxlReq.assgnmt.assgne.agt.finInstnId.bicfi
assgneClrSysId=fiToFIPmtCxlReq.assgnmt.assgne.agt.finInstnId.clrSysMmbId.mmbId
assgneClrSysIdType=fiToFIPmtCxlReq.assgnmt.assgne.agt.finInstnId.clrSysMmbId.clrSysId.cd
assgneClrSysIdTypePrtry=fiToFIPmtCxlReq.assgnmt.assgne.agt.finInstnId.clrSysMmbId.clrSysId.prtry
assgneLei=fiToFIPmtCxlReq.assgnmt.assgne.agt.finInstnId.lei
caseCretrPty=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty#party
caseCretrAgt=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt#agent
orgnlMsgId=fiToFIPmtCxlReq.undrlyg.txInf.orgnlGrpInf.orgnlMsgId
orgnlMsgNmId=fiToFIPmtCxlReq.undrlyg.txInf.orgnlGrpInf.orgnlMsgNmId
orgnlCreDtTm=fiToFIPmtCxlReq.undrlyg.txInf.orgnlGrpInf.orgnlCreDtTm
#21
orgnlInstrId=fiToFIPmtCxlReq.undrlyg.txInf.orgnlInstrId
#32
orgnlEndToEndId=fiToFIPmtCxlReq.undrlyg.txInf.orgnlEndToEndId
orgnlTxId=fiToFIPmtCxlReq.undrlyg.txInf.orgnlTxId
uetr=fiToFIPmtCxlReq.undrlyg.txInf.orgnlUETR
orgnlIntrBkSttlmAmt=fiToFIPmtCxlReq.undrlyg.txInf.orgnlIntrBkSttlmAmt.value&bigdecimal
orgnlIntrBkSttlmCcy=fiToFIPmtCxlReq.undrlyg.txInf.orgnlIntrBkSttlmAmt.ccy
orgnlIntrBkSttlmDt=fiToFIPmtCxlReq.undrlyg.txInf.orgnlIntrBkSttlmDt
#79
rsnCd=fiToFIPmtCxlReq.undrlyg.txInf.cxlRsnInf.rsn.cd
rsnPrtry=fiToFIPmtCxlReq.undrlyg.txInf.cxlRsnInf.rsn.prtry
addtlInf=fiToFIPmtCxlReq.undrlyg.txInf.cxlRsnInf.addtlInf
#Other
orgnlMsgId=fiToFIPmtCxlReq.undrlyg.txInf.orgnlGrpInf.orgnlMsgId
orgnlEndToEndId=fiToFIPmtCxlReq.undrlyg.txInf.orgnlEndToEndId
assgnrBic=fiToFIPmtCxlReq.assgnmt.assgnr.pty.id.orgId.anyBIC?fiToFIPmtCxlReq.assgnmt.assgnr.agt.finInstnId.bicfi
assgneBic=fiToFIPmtCxlReq.assgnmt.assgne.pty.id.orgId.anyBIC?fiToFIPmtCxlReq.assgnmt.assgne.agt.finInstnId.bicfi
caseCretrNm=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.nm?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.nm
caseCretrOrgAnyBIC=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.id.orgId.anyBIC?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.bicfi
caseCretrOrgLei=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.id.orgId.lei?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.lei
caseCretrOrgOthrId=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.id.orgId.othr.id?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.othr.id
caseCretrOrgOthrIdType=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.id.orgId.othr.schmeNm.cd?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.othr.schmeNm.cd
caseCretrOrgOthrIdTypePrtry=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.id.orgId.othr.schmeNm.prtry?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.othr.schmeNm.prtry
caseCretrPstlAdrType=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.pstlAdr.adrTp.cd?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.pstlAdr.adrTp.cd
caseCretrPstlAdrCtry=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.pstlAdr.ctry?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.pstlAdr.ctry
caseCretrPstlAdrDept=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.pstlAdr.dept?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.pstlAdr.dept
caseCretrPstlAdrSubDept=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.pstlAdr.subDept?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.pstlAdr.subDept
caseCretrPstlAdrStrtNm=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.pstlAdr.strtNm?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.pstlAdr.strtNm
caseCretrPstlAdrBldgNb=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.pstlAdr.bldgNb?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.pstlAdr.bldgNb
caseCretrPstlAdrBldgNm=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.pstlAdr.bldgNm?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.pstlAdr.bldgNm
caseCretrPstlAdrFlr=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.pstlAdr.flr?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.pstlAdr.flr
caseCretrPstlAdrRoom=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.pstlAdr.room?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.pstlAdr.room
caseCretrPstlAdrTwnNm=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.pstlAdr.twnNm?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.pstlAdr.twnNm
caseCretrPstlAdrPstBx=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.pstlAdr.pstBx?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.pstlAdr.pstBx
caseCretrPstlAdrPstCd=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.pstlAdr.pstCd?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.pstlAdr.pstCd
caseCretrPstlAdrCtrySubDvsn=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.pstlAdr.ctrySubDvsn?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.pstlAdr.ctrySubDvsn
caseCretrPstlAdrDstrctNm=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.pstlAdr.dstrctNm?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.pstlAdr.dstrctNm
caseCretrPstlAdrTwnLctnNm=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.pstlAdr.twnLctnNm?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.pstlAdr.twnLctnNm
caseCretrAdrLines=fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.pty.pstlAdr.adrLine?fiToFIPmtCxlReq.undrlyg.txInf._case.cretr.agt.finInstnId.pstlAdr.adrLine
orgtrNm=fiToFIPmtCxlReq.undrlyg.txInf.cxlRsnInf.orgtr.nm
orgtrOrgAnyBIC=fiToFIPmtCxlReq.undrlyg.txInf.cxlRsnInf.orgtr.id.orgId.anyBIC
orgtrOrgLei=fiToFIPmtCxlReq.undrlyg.txInf.cxlRsnInf.orgtr.id.orgId.lei
......@@ -82,3 +63,5 @@ orgtrPhneNb=fiToFIPmtCxlReq.undrlyg.txInf.cxlRsnInf.orgtr.ctctDtls.phneNb
orgtrMobNb=fiToFIPmtCxlReq.undrlyg.txInf.cxlRsnInf.orgtr.ctctDtls.mobNb
orgtrFaxNb=fiToFIPmtCxlReq.undrlyg.txInf.cxlRsnInf.orgtr.ctctDtls.faxNb
orgtrEmailAdr=fiToFIPmtCxlReq.undrlyg.txInf.cxlRsnInf.orgtr.ctctDtls.emailAdr
rsnCd=fiToFIPmtCxlReq.undrlyg.txInf.cxlRsnInf.rsn.cd
addtlInf=fiToFIPmtCxlReq.undrlyg.txInf.cxlRsnInf.addtlInf
\ No newline at end of file
......@@ -11,9 +11,12 @@ public class Element2MxTest {
@Test
public void test() {
File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxCamt05300108_950.xml"));
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxCamt05300108_950.xml"));
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxPacs00800108.xml"));
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxPacs00900108.xml"));
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxCamt05400108_CREDIT.xml"));
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxCamt02900109_196.xml"));
File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxCamt05600108_192.xml"));
String elementStr = SwiftTransfer.mx2Element(file);
String xmlStr = new Element2MxCreatorManager().element2Mx(elementStr);
......
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