Commit 87416a0f by zhanghou

完成mt192292,mt196296中文的报文要素展示

parent 6860890b
package com.brilliance.swift.mx2map;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2map.camt029.Mx2MapCamt029Creator;
import com.brilliance.swift.mx2map.camt053.Mx2MapCamt053Creator;
import com.brilliance.swift.mx2map.camt056.Mx2MapCamt056Creator;
import com.prowidesoftware.swift.model.mx.AbstractMX;
import java.util.Map;
......@@ -26,7 +28,12 @@ public class Mx2MapCreatorManager {
public AbstractMx2MapCreator getCreator(String messageType) {
if("camt.053.001".equals(messageType)){
return new Mx2MapCamt053Creator();
} else {
}else if("camt.029.001".equals(messageType)) {
return new Mx2MapCamt029Creator();
} else if("camt.056.001".equals(messageType)) {
return new Mx2MapCamt056Creator();
}
else {
return new DefaultMx2MapCreator();
}
}
......
package com.brilliance.swift.mx2map.camt056;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2map.AbstractMx2MapCreator;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.util.XmlUtil;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import javax.xml.datatype.XMLGregorianCalendar;
import java.util.Map;
public class Mx2MapCamt056Creator extends AbstractMx2MapCreator {
@Override
public Map<String, String> mx2Map() throws SwiftException {
try {
Document document = DocumentHelper.parseText(xmlStr);
Map<String, String> parentElementMaps = XmlUtil.getParentElementMaps(document);
String appHdrParentElementName = parentElementMaps.get("AppHdr");
String grpHdrParentElementName = parentElementMaps.get("GrpHdr");
String bodyParentElementName = parentElementMaps.get("Undrlyg");
String sendBic = abstractMX.getAppHdr().from();
maps.put(getPropertyValue("app.header.sendBic"), sendBic);
String receiverBic = abstractMX.getAppHdr().to();
maps.put(getPropertyValue("app.header.receiverBic"), receiverBic);
String uetr = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Undrlyg.TxInf.OrgnlUETR");
if(StringUtil.isNotEmpty(uetr)){
maps.put(getPropertyValue("uetr"), uetr);
}
String msgDefId = abstractMX.getAppHdr().messageName();
maps.put(getPropertyValue("app.header.msgDefId"), msgDefId);
String bizSvc = abstractMX.getAppHdr().serviceName();
maps.put(getPropertyValue("app.header.bizSvc"), bizSvc);
XMLGregorianCalendar creDt = abstractMX.getAppHdr().creationDate();
maps.put(getPropertyValue("app.header.creDt"), creDt.toXMLFormat());
String caseId = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Undrlyg.TxInf.Case.Id");
if(StringUtil.isNotEmpty(caseId)){
maps.put(Mx2MtConstants.NEW_LINE+getPropertyValue("message.id"), caseId);
}
String id = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Undrlyg.TxInf.OrgnlInstrId");
if(StringUtil.isNotEmpty(id)){
maps.put(getPropertyValue("endToEnd.id"), id);
}
String nameId = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Undrlyg.TxInf.OrgnlGrpInf.OrgnlMsgNmId");
String dateStr = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".CxlDtls.TxInfAndSts.OrgnlGrpInf.OrgnlCreDtTm");
if(StringUtil.isNotEmpty(nameId)){
maps.put(getPropertyValue("originalGroupInformation.orgnlMsgId"), nameId);
}
if(StringUtil.isNotEmpty(dateStr)){
maps.put(getPropertyValue("originalGroupInformation.orgnlCreDtTm"), dateStr);
}
String reason = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Undrlyg.TxInf.CxlRsnInf.Rsn.Cd");
if(StringUtil.isNotEmpty(reason)){
maps.put(getPropertyValue("underlying.transactionInformation.cancellationReasonInformation.reason.cd"), reason);
}
int count = XmlUtil.getChildrenCount(document, bodyParentElementName + ".Undrlyg.TxInf.CxlRsnInf.AddtlInf",null);
String information = "";
if(count>0){
for (int i = 0; i < count; i++) {
information = information + XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Undrlyg.TxInf.CxlRsnInf.AddtlInf("+i+")");
}
}
if(StringUtil.isNotEmpty(information)){
maps.put(getPropertyValue("underlying.transactionInformation.cancellationReasonInformation.addtlInf"), information);
}
} catch (DocumentException e) {
throw new SwiftException("ERROR", e.getMessage());
}
return maps;
}
}
package com.brilliance.swift.mx2map.camt057;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2map.AbstractMx2MapCreator;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.util.XmlUtil;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import javax.xml.datatype.XMLGregorianCalendar;
import java.util.Map;
public class Mx2MapCamt057Creator extends AbstractMx2MapCreator {
@Override
public Map<String, String> mx2Map() throws SwiftException {
try {
Document document = DocumentHelper.parseText(xmlStr);
Map<String, String> parentElementMaps = XmlUtil.getParentElementMaps(document);
String appHdrParentElementName = parentElementMaps.get("AppHdr");
String grpHdrParentElementName = parentElementMaps.get("GrpHdr");
String bodyParentElementName = parentElementMaps.get("Ntfctn");
String sendBic = abstractMX.getAppHdr().from();
maps.put(getPropertyValue("app.header.sendBic"), sendBic);
String receiverBic = abstractMX.getAppHdr().to();
maps.put(getPropertyValue("app.header.receiverBic"), receiverBic);
String bizMsgId = abstractMX.getAppHdr().reference();
maps.put(getPropertyValue("app.header.bizMsgId"), bizMsgId);
String msgDefId = abstractMX.getAppHdr().messageName();
maps.put(getPropertyValue("app.header.msgDefId"), msgDefId);
String bizSvc = abstractMX.getAppHdr().serviceName();
maps.put(getPropertyValue("app.header.bizSvc"), bizSvc);
XMLGregorianCalendar creDt = abstractMX.getAppHdr().creationDate();
maps.put(getPropertyValue("app.header.creDt"), creDt.toXMLFormat());
String accountId = "";
String iban = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Acct.Id.IBAN");
String id = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Acct.Id.Othr.Id");
if(StringUtil.isNotEmpty(iban)){
accountId = iban;
}else if(StringUtil.isNotEmpty(id)){
accountId = id;
}else if(StringUtil.isEmpty(iban)&&StringUtil.isEmpty(id)) {
String itemIban = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Itm(" + 0 + ").Acct.Id.IBAN");
String itemId = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Itm(" + 0 + ").Acct.Id.Othr.Id");
if (StringUtil.isNotEmpty(itemIban)) {
accountId = itemIban;
} else if (StringUtil.isNotEmpty(itemId)) {
accountId = itemId;
}
}
if(StringUtil.isNotEmpty(accountId)){
maps.put(getPropertyValue("notification.account.id"), accountId);
}
String reference = "";
String endToEndId = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Itm("+0+").EndToEndId");
if(StringUtil.isNotEmpty(endToEndId)){
reference = endToEndId;
}else {
reference = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Itm("+0+").Id");
}
if(StringUtil.isNotEmpty(reference)){
maps.put(getPropertyValue("notification.item.reference"), reference);
}
String ccy = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Itm("+0+").Amt@Ccy");
if (StringUtil.isNotEmpty(ccy)) {
maps.put(getPropertyValue("notification.amount.ccy"), ccy);
}
String amt = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Itm("+0+").Amt");
if (StringUtil.isNotEmpty(amt)) {
maps.put(getPropertyValue("notification.amount.amt"), amt);
}
String valDtStr = "";
String valDt = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.XpctdValDt");
if(StringUtil.isNotEmpty(valDt)){
valDtStr = valDt;
}else {
valDtStr = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Itm("+0+").XpctdValDt");
}
if(StringUtil.isNotEmpty(valDtStr)){
maps.put(getPropertyValue("notification.xpctdValDt"), valDtStr);
}
int count1 = XmlUtil.getChildrenCount(document, bodyParentElementName + ".Ntfctn.Dbtr.Pty",null);
int count2 = XmlUtil.getChildrenCount(document, bodyParentElementName + ".Ntfctn.Itm("+0+").Dbtr.Pty",null);
int count3 = XmlUtil.getChildrenCount(document, bodyParentElementName + ".Ntfctn.Dbtr.Agt",null);
int count4 = XmlUtil.getChildrenCount(document, bodyParentElementName + ".Ntfctn.Itm("+0+").Dbtr.Agt",null);
String bicCode = "";
String country = "";
int addressLineCount = 0;
String name = "";
String clearingSystemCode = "";
String ClearingSystemId = "";
if(count1>0){
bicCode = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Dbtr.Pty.Id.OrgId.AnyBIC");
country = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Dbtr.Pty.PstlAdr.Ctry");
addressLineCount = XmlUtil.getChildrenCount(document, bodyParentElementName + ".Ntfctn.Dbtr.Pty.PstlAdr.AdrLine",null);
name = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Dbtr.Pty.Nm");
}
if(count2>0){
bicCode = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Itm("+0+").Dbtr.Pty.Id.OrgId.AnyBIC");
country = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Itm("+0+").Dbtr.Pty.PstlAdr.Ctry");
addressLineCount = XmlUtil.getChildrenCount(document, bodyParentElementName + ".Ntfctn.Itm("+0+").Dbtr.Pty.PstlAdr.AdrLine",null);
name = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Itm("+0+").Dbtr.Pty.Nm");
}
if(count3>0){
bicCode = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Dbtr.Agt.Id.OrgId.AnyBIC");
country = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Dbtr.Agt.FinInstnId.PstlAdr.Ctry");
addressLineCount = XmlUtil.getChildrenCount(document, bodyParentElementName + ".Ntfctn.Dbtr.Agt.FinInstnId.PstlAdr.AdrLine",null);
name = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Dbtr.Agt.FinInstnId.Nm");
clearingSystemCode = XmlUtil.getXmlNodeValue(document, bodyParentElementName + "..Ntfctn.Dbtr.Agt.FinInstnId.ClrSysMmbId.ClrSysId.Cd");
ClearingSystemId = XmlUtil.getXmlNodeValue(document, bodyParentElementName + "..Ntfctn.Dbtr.Agt.FinInstnId.ClrSysMmbId.MmbId");
}
if(count4>0){
bicCode = XmlUtil.getXmlNodeValue(document, bodyParentElementName + "..Ntfctn.Itm("+0+").Dbtr.Agt.Id.OrgId.AnyBIC");
country = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Itm("+0+").Dbtr.Agt.FinInstnId.PstlAdr.Ctry");
addressLineCount = XmlUtil.getChildrenCount(document, bodyParentElementName + ".Ntfctn.Itm("+0+").Dbtr.Agt.FinInstnId.PstlAdr.AdrLine",null);
name = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Itm("+0+").Dbtr.Agt.FinInstnId.Nm");
clearingSystemCode = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Itm("+0+").Dbtr.Agt.FinInstnId.ClrSysMmbId.ClrSysId.Cd");
ClearingSystemId = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Itm("+0+").Dbtr.Agt.FinInstnId.ClrSysMmbId.MmbId");
}
String address = "";
for (int i = 0; i < addressLineCount; i++) {
if(i!=1||i!=addressLineCount-1){
address = address + ",";
}
address = address + XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Ntfctn.Itm("+0+").Dbtr.Agt.FinInstnId.PstlAdr.AdrLine("+i+")");
}
if(StringUtil.isNotEmpty(bicCode)){
maps.put(getPropertyValue("notification.debtor.party.identification.organisationIdentification.anyBIC"), bicCode);
}
if(StringUtil.isNotEmpty(country)){
maps.put(getPropertyValue("notification.debtor.party.postalAddress.ctry"), country);
}
if(StringUtil.isNotEmpty(address)){
maps.put(getPropertyValue("notification.debtor.party.postalAddress.adrLine"), address);
}
if(StringUtil.isNotEmpty(name)){
maps.put(getPropertyValue("notification.debtor.party.nm"), name);
}
if (StringUtil.isNotEmpty(clearingSystemCode)){
maps.put(getPropertyValue("notification.debtor.agent.financialInstitutionIdentification.clearingSystemMemberIdentification.clearingSystemIdentification.cd"), clearingSystemCode);
}
if(StringUtil.isNotEmpty(ClearingSystemId)){
maps.put(getPropertyValue("notification.debtor.agent.financialInstitutionIdentification.clearingSystemMemberIdentification.mmbId"), ClearingSystemId);
}
} catch (DocumentException e) {
throw new SwiftException("ERROR", e.getMessage());
}
return maps;
}
}
......@@ -25,8 +25,14 @@ statement.entry.crdr=\u5bf9\u8d26\u5355\u501f\u8d37\u6807\u8bc6
statement.entry.ccy=\u5bf9\u8d26\u5355\u5e01\u79cd
statement.entry.amt=\u5bf9\u8d26\u5355\u91d1\u989d
statement.entry.endToEndId=\u5bf9\u8d26\u5355\u76f8\u5173\u4ea4\u6613\u6807\u8bc6
originalGroupInformation.orgnlMsgId=\u539f\u59cb\u4ea4\u6613\u540d\u79f0
originalGroupInformation.orgnlCreDtTm=\u539f\u59cb\u4ea4\u6613\u521b\u5efa\u65f6\u95f4
cancellationDetails.transactionInformationAndStatus.cancellationStatusReasonInformation.reason.cd=\u4ea4\u6613\u64a4\u9500\u8bf7\u6c42\u54cd\u5e94\u4ee3\u7801
cancellationDetails.transactionInformationAndStatus.cancellationStatusReasonInformation.addtlInf=\u4ea4\u6613\u64a4\u9500\u8bf7\u6c42\u54cd\u5e94\u8be6\u60c5
underlying.transactionInformation.cancellationReasonInformation.reason.cd=\u4ea4\u6613\u64a4\u9500\u8bf7\u6c42\u4ee3\u7801
underlying.transactionInformation.cancellationReasonInformation.addtlInf=\u4ea4\u6613\u64a4\u9500\u8bf7\u6c42\u8be6\u60c5
#
message.id=\u4e1a\u52a1\u7f16\u53f7
endToEnd.id=\u7aef\u5230\u7aef\u6807\u8bc6
endToEnd.id=\u76f8\u5173\u4e1a\u52a1\u7f16\u53f7
uetr=UETR\u6807\u8bc6
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