Commit 9a6e1316 by chengzhuoshen

增加camt053001 页面要素展示代码

parent 43b90713
package com.brilliance.swift;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2SwiftDto.Mt2SwiftDtoCreateManager;
import com.brilliance.swift.mx2map.Mx2MapCreatorManager;
import com.brilliance.swift.mx2mt.Mx2MtCreatorManager;
import com.brilliance.swift.mx2swiftdto.Mx2SwiftDtoCreatorManager;
import com.brilliance.swift.swiftdto2mt.SwiftDto2MtCreatorManager;
......@@ -20,9 +18,7 @@ import org.dom4j.DocumentHelper;
import java.io.File;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
public class SwiftTransfer {
......@@ -201,78 +197,7 @@ public class SwiftTransfer {
*/
public static Map<String, String> mx2Map(String xmlStr) {
if (StringUtil.isEmpty(xmlStr)) return null;
Map<String, String> maps = new LinkedHashMap<>();
AbstractMX abstractMX = AbstractMX.parse(xmlStr);
String gsonStr = abstractMX.toJson();
Map<String, Object> mxGsonMaps = (Map<String, Object>) JSON.parseObject(gsonStr);
parseMxGsonMap(maps, mxGsonMaps, null);
return maps;
}
/**
* 把mxGsonMaps解析成Map<String, String>,回调函数然后拼接前缀
* @param maps
* @param mxGsonMaps
* @param prefix
*/
public static void parseMxGsonMap(Map<String, String> maps, Map<String, Object> mxGsonMaps, String prefix) {
Set<String> keys = mxGsonMaps.keySet();
for (String key : keys) {
Object object = (Object)mxGsonMaps.get(key);
if (object == null) continue;
if (object instanceof JSONArray) {
if (StringUtil.isEmpty(prefix)) {
parseMxGsonArray(maps, (JSONArray)object, key);
} else {
parseMxGsonArray(maps, (JSONArray)object, prefix + "." + key);
}
} else if (object instanceof JSONObject) {
if (StringUtil.isEmpty(prefix)) {
parseMxGsonMap(maps, (Map<String, Object>)object, key);
} else {
parseMxGsonMap(maps, (Map<String, Object>)object, prefix + "." + key);
}
} else {
if (StringUtil.isEmpty(prefix)) {
maps.put(key, String.valueOf(object));
} else {
maps.put(prefix + "." + key, String.valueOf(object));
}
}
}
}
/**
* jsonArray 是json数组格式 回调函数
* 如果长度只有1,那么就不需要下标
* 否则需要下标(0) (1) (2) (3)
* @param maps
* @param jsonArray
* @param prefix
*/
public static void parseMxGsonArray(Map<String, String> maps, JSONArray jsonArray, String prefix) {
Object[] jsonArrays = jsonArray.toArray();
if (jsonArrays.length == 1) {
Object object = jsonArrays[0];
if (object instanceof JSONArray) {
parseMxGsonArray(maps, (JSONArray)object, prefix);
} else if (object instanceof JSONObject) {
parseMxGsonMap(maps, (Map<String, Object>)object, prefix);
} else {
maps.put(prefix, String.valueOf(object));
}
} else {
for (int i=0; i<jsonArrays.length; i++) {
Object object = jsonArrays[i];
if (object instanceof JSONArray) {
parseMxGsonArray(maps, (JSONArray)object, prefix+"("+i+")");
} else if (object instanceof JSONObject) {
parseMxGsonMap(maps, (Map<String, Object>)object, prefix+"("+i+")");
} else {
maps.put(prefix+"("+i+")", String.valueOf(object));
}
}
}
return new Mx2MapCreatorManager().mx2Map(xmlStr);
}
}
package com.brilliance.swift.mx2map;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.util.SwiftTransferUtil;
import com.prowidesoftware.swift.model.mx.AbstractMX;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Properties;
public abstract class AbstractMx2MapCreator implements Mx2MapCreator{
protected String xmlStr;
protected AbstractMX abstractMX;
protected Properties keyProperties;
protected String localCode;
protected Map<String, String> maps = new LinkedHashMap<>();
public String getXmlStr() {
return xmlStr;
}
public void setXmlStr(String xmlStr) {
this.xmlStr = xmlStr;
}
public AbstractMX getAbstractMX() {
return abstractMX;
}
public void setAbstractMX(AbstractMX abstractMX) {
this.abstractMX = abstractMX;
}
public String getLocalCode() {
return localCode;
}
public void setLocalCode(String localCode) {
this.localCode = localCode;
}
protected String getPropertyValue(String key) {
if (keyProperties == null) {
keyProperties = SwiftTransferUtil.getProperty(localCode);
}
String value = keyProperties.getProperty(key);
if (StringUtil.isEmpty(value)) {
return key;
} else {
return value;
}
}
}
package com.brilliance.swift.mx2map;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.util.StringUtil;
import java.util.Map;
import java.util.Set;
public class DefaultMx2MapCreator extends AbstractMx2MapCreator{
@Override
public Map<String, String> mx2Map() throws SwiftException {
String gsonStr = abstractMX.toJson();
Map<String, Object> mxGsonMaps = JSON.parseObject(gsonStr);
parseMxGsonMap(maps, mxGsonMaps, null);
return maps;
}
/**
* 把mxGsonMaps解析成Map<String, String>,回调函数然后拼接前缀
* @param maps
* @param mxGsonMaps
* @param prefix
*/
public void parseMxGsonMap(Map<String, String> maps, Map<String, Object> mxGsonMaps, String prefix) {
Set<String> keys = mxGsonMaps.keySet();
for (String key : keys) {
Object object = (Object)mxGsonMaps.get(key);
if (object == null) continue;
if (object instanceof JSONArray) {
if (StringUtil.isEmpty(prefix)) {
parseMxGsonArray(maps, (JSONArray)object, key);
} else {
parseMxGsonArray(maps, (JSONArray)object, prefix + "." + key);
}
} else if (object instanceof JSONObject) {
if (StringUtil.isEmpty(prefix)) {
parseMxGsonMap(maps, (Map<String, Object>)object, key);
} else {
parseMxGsonMap(maps, (Map<String, Object>)object, prefix + "." + key);
}
} else {
if (StringUtil.isEmpty(prefix)) {
maps.put(key, String.valueOf(object));
} else {
maps.put(prefix + "." + key, String.valueOf(object));
}
}
}
}
/**
* jsonArray 是json数组格式 回调函数
* 如果长度只有1,那么就不需要下标
* 否则需要下标(0) (1) (2) (3)
* @param maps
* @param jsonArray
* @param prefix
*/
public void parseMxGsonArray(Map<String, String> maps, JSONArray jsonArray, String prefix) {
Object[] jsonArrays = jsonArray.toArray();
if (jsonArrays.length == 1) {
Object object = jsonArrays[0];
if (object instanceof JSONArray) {
parseMxGsonArray(maps, (JSONArray)object, prefix);
} else if (object instanceof JSONObject) {
parseMxGsonMap(maps, (Map<String, Object>)object, prefix);
} else {
maps.put(prefix, String.valueOf(object));
}
} else {
for (int i=0; i<jsonArrays.length; i++) {
Object object = jsonArrays[i];
if (object instanceof JSONArray) {
parseMxGsonArray(maps, (JSONArray)object, prefix+"("+i+")");
} else if (object instanceof JSONObject) {
parseMxGsonMap(maps, (Map<String, Object>)object, prefix+"("+i+")");
} else {
maps.put(prefix+"("+i+")", String.valueOf(object));
}
}
}
}
}
package com.brilliance.swift.mx2map;
import com.brilliance.swift.exception.SwiftException;
import java.util.Map;
public interface Mx2MapCreator {
public Map<String, String> mx2Map() throws SwiftException;
}
package com.brilliance.swift.mx2map;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2map.camt053.Mx2MapCamt053Creator;
import com.prowidesoftware.swift.model.mx.AbstractMX;
import java.util.Map;
public class Mx2MapCreatorManager {
public Map<String, String> mx2Map(String xml) throws SwiftException {
AbstractMX abstractMX = AbstractMX.parse(xml);
String messageType = (abstractMX.getMxId().getBusinessProcess().name()
+ "."
+ abstractMX.getMxId().getFunctionality()
+ "."
+ abstractMX.getMxId().getVariant())
//+ abstractMX.getMxId().getVersion())
.trim();
AbstractMx2MapCreator creator = getCreator(messageType);
creator.setXmlStr(xml);
creator.setAbstractMX(abstractMX);
return creator.mx2Map();
}
public AbstractMx2MapCreator getCreator(String messageType) {
if("camt.053.001".equals(messageType)){
return new Mx2MapCamt053Creator();
} else {
return new DefaultMx2MapCreator();
}
}
}
package com.brilliance.swift.mx2map.camt053;
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 com.brilliance.swift.vo.common.BalanceTypeCode;
import com.brilliance.swift.vo.common.CdtDbtCode;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import javax.xml.datatype.XMLGregorianCalendar;
import java.util.Map;
public class Mx2MapCamt053Creator 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("Stmt");
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 statementId = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Stmt.Id");
maps.put(getPropertyValue("statement.id"), statementId);
String iban = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Stmt.Acct.Id.IBAN");
String acctId = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Stmt.Acct.Id.Othr.Id");
String account = StringUtil.isNotEmpty(iban) ? iban : acctId;
if (StringUtil.isNotEmpty(account)) {
maps.put(getPropertyValue("statement.account"), account);
}
String elctrncSeqNb = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Stmt.LglSeqNb");
if (StringUtil.isEmpty(elctrncSeqNb) || elctrncSeqNb.length() > 5) {
elctrncSeqNb = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Stmt.ElctrncSeqNb");
}
if (StringUtil.isNotEmpty(elctrncSeqNb)) {
maps.put(getPropertyValue("statement.sequence.number"), elctrncSeqNb);
}
String pageNumber = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Stmt.StmtPgntn.PgNb");
if (StringUtil.isNotEmpty(pageNumber)){
maps.put(getPropertyValue("statement.page.number"), pageNumber);
}
int opbdIndex = -1;
int clbdIndex = -1;
int balanceCount = XmlUtil.getChildrenCount(document, bodyParentElementName + ".Stmt.Bal", null);
if (balanceCount > 0) {
for (int i=0; i<balanceCount; i++) {
String balanceType = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Stmt.Bal("+i+").Tp.CdOrPrtry.Cd");
if (BalanceTypeCode.OPBD.value().equals(balanceType)) {
opbdIndex = i;
}
if (BalanceTypeCode.CLBD.value().equals(balanceType)) {
clbdIndex = i;
}
}
}
if (opbdIndex > -1) {
String cdtDbtInd = XmlUtil.getXmlNodeValue(document, bodyParentElementName+ ".Stmt.Bal("+opbdIndex+").CdtDbtInd");
if (CdtDbtCode.CRDT.value().equals(cdtDbtInd)) {
maps.put(Mx2MtConstants.NEW_LINE + getPropertyValue("statement.openingBooked.crdr"), getPropertyValue("credit"));
} else {//if (CdtDbtCode.DBIT.value().equals(cdtDbtInd)) {
maps.put(Mx2MtConstants.NEW_LINE + getPropertyValue("statement.openingBooked.crdr"), getPropertyValue("debit"));
}
String dateStr = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Stmt.Bal("+opbdIndex+").Dt.Dt");
if (StringUtil.isNotEmpty(dateStr)) {
maps.put(getPropertyValue("statement.openingBooked.date"), dateStr);
}
String ccy = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Stmt.Bal("+opbdIndex+").Amt@Ccy");
if (StringUtil.isNotEmpty(ccy)) {
maps.put(getPropertyValue("statement.openingBooked.ccy"), ccy);
}
String amt = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Stmt.Bal("+opbdIndex+").Amt");
if (StringUtil.isNotEmpty(amt)) {
maps.put(getPropertyValue("statement.openingBooked.amt"), amt);
}
}
int entryCount = XmlUtil.getChildrenCount(document, bodyParentElementName + ".Stmt.Ntry", null);
if (entryCount > 0) {
for (int i=0; i<entryCount; i++) {
String reversalIndicator = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Stmt.Ntry("+i+").RvslInd");
String creditDebitIndicator = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Stmt.Ntry("+i+").CdtDbtInd");
if (StringUtil.isNotEmpty(reversalIndicator) && Boolean.valueOf(reversalIndicator)) {
if (CdtDbtCode.DBIT.value().equals(creditDebitIndicator)) {
maps.put(Mx2MtConstants.NEW_LINE + getPropertyValue("statement.entry.crdr")+"("+(i+1)+")", getPropertyValue("reversal.credit"));
} else {
maps.put(Mx2MtConstants.NEW_LINE + getPropertyValue("statement.entry.crdr")+"("+(i+1)+")", getPropertyValue("reversal.debit"));
}
} else {
if (CdtDbtCode.DBIT.value().equals(creditDebitIndicator)) {
maps.put(Mx2MtConstants.NEW_LINE + getPropertyValue("statement.entry.crdr")+"("+(i+1)+")", getPropertyValue("debit"));
} else {
maps.put(Mx2MtConstants.NEW_LINE + getPropertyValue("statement.entry.crdr")+"("+(i+1)+")", getPropertyValue("credit"));
}
}
String valueDateStr = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Stmt.Ntry("+i+").ValDt.Dt");
if (StringUtil.isNotEmpty(valueDateStr)) {
maps.put(getPropertyValue("statement.entry.valueDate")+"("+(i+1)+")", valueDateStr);
}
String amt = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Stmt.Ntry("+i+").Amt");
String ccy = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Stmt.Ntry("+i+").Amt@Ccy");
if (StringUtil.isNotEmpty(ccy)) {
maps.put(getPropertyValue("statement.entry.ccy")+"("+(i+1)+")", ccy);
}
if (StringUtil.isNotEmpty(amt)) {
maps.put(getPropertyValue("statement.entry.amt")+"("+(i+1)+")", amt);
}
String endToEndId = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Stmt.Ntry("+i+").NtryDtls.TxDtls.Refs.EndToEndId");
if (StringUtil.isNotEmpty(endToEndId)) {
maps.put(getPropertyValue("statement.entry.endToEndId")+"("+(i+1)+")", endToEndId);
}
}
}
if (clbdIndex > -1) {
String cdtDbtInd = XmlUtil.getXmlNodeValue(document, bodyParentElementName+ ".Stmt.Bal("+clbdIndex+").CdtDbtInd");
if (CdtDbtCode.CRDT.value().equals(cdtDbtInd)) {
maps.put(Mx2MtConstants.NEW_LINE + getPropertyValue("statement.closingBooked.crdr"), getPropertyValue("credit"));
} else {//if (CdtDbtCode.DBIT.value().equals(cdtDbtInd)) {
maps.put(Mx2MtConstants.NEW_LINE + getPropertyValue("statement.closingBooked.crdr"), getPropertyValue("debit"));
}
String dateStr = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Stmt.Bal("+clbdIndex+").Dt.Dt");
if (StringUtil.isNotEmpty(dateStr)) {
maps.put(getPropertyValue("statement.closingBooked.date"), dateStr);
}
String ccy = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Stmt.Bal("+clbdIndex+").Amt@Ccy");
if (StringUtil.isNotEmpty(ccy)) {
maps.put(getPropertyValue("statement.closingBooked.ccy"), ccy);
}
String amt = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".Stmt.Bal("+clbdIndex+").Amt");
if (StringUtil.isNotEmpty(amt)) {
maps.put(getPropertyValue("statement.closingBooked.amt"), amt);
}
}
} catch (DocumentException e) {
throw new SwiftException("ERROR", e.getMessage());
}
return maps;
}
}
......@@ -2,6 +2,7 @@ package com.brilliance.swift.util;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.vo.MxMtReasonCodeInfo;
import com.brilliance.swift.vo.SwiftTransferErrorInfo;
import com.brilliance.swift.vo.common.ClearingSystemMemberCode;
......@@ -11,6 +12,7 @@ import com.brilliance.swift.vo.common.PersonIdentificationCode;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
......@@ -18,6 +20,8 @@ import java.util.*;
public class SwiftTransferUtil {
private static Properties properties = null;
public static XMLGregorianCalendar getXMLGregorianCalendarNow() {
GregorianCalendar gregorianCalendar = new GregorianCalendar();
DatatypeFactory datatypeFactory = null;
......@@ -673,4 +677,19 @@ public class SwiftTransferUtil {
}
return list;
}
public static Properties getProperty(String localCode) {
try {
String fileName = "/Messages_CN.properties";
if ("US".equals(localCode)) {
fileName = "/Messages_US.properties";
}
InputStream resourceAsStream = SwiftTransferUtil.class.getResourceAsStream(fileName);
Properties properties = new Properties();
properties.load(resourceAsStream);
return properties;
} catch (IOException e) {
throw new SwiftException("ERROR", e.getMessage());
}
}
}
app.header.sendBic=\u53d1\u62a5\u884c\u884c\u53f7
app.header.receiverBic=\u6536\u62a5\u884c\u884c\u53f7
app.header.bizMsgId=\u4e1a\u52a1\u6807\u8bc6
app.header.msgDefId=\u62a5\u6587\u7c7b\u578b
app.header.bizSvc=\u4e1a\u52a1\u670d\u52a1\u6807\u8bc6
app.header.creDt=\u53d1\u9001\u65f6\u95f4
credit=\u8d37\u8bb0
debit=\u501f\u8bb0
reversal.credit=\u4ee5\u501f\u51b2\u8d37
reversal.debit=\u4ee5\u8d37\u51b2\u501f
statement.id=\u5bf9\u8d26\u5355\u6807\u8bc6
statement.account=\u5bf9\u8d26\u5355\u8d26\u53f7
statement.sequence.number=\u5bf9\u8d26\u5355\u53f7\u7801
statement.page.number=\u5bf9\u8d26\u5355\u5206\u9875\u5e8f\u53f7
statement.openingBooked.crdr=\u8d77\u59cb\u4f59\u989d\u501f\u8d37\u6807\u8bc6
statement.openingBooked.date=\u8d77\u59cb\u4f59\u989d\u65e5\u671f
statement.openingBooked.ccy=\u8d77\u59cb\u4f59\u989d\u5e01\u79cd
statement.openingBooked.amt=\u8d77\u59cb\u4f59\u989d\u91d1\u989d
statement.closingBooked.crdr=\u8d26\u9762\u4f59\u989d\u501f\u8d37\u6807\u8bc6
statement.closingBooked.date=\u8d26\u9762\u4f59\u989d\u65e5\u671f
statement.closingBooked.ccy=\u8d26\u9762\u4f59\u989d\u5e01\u79cd
statement.closingBooked.amt=\u8d26\u9762\u4f59\u989d\u91d1\u989d
statement.entry.valueDate=\u5bf9\u8d26\u5355\u8d77\u606f\u65e5
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
\ No newline at end of file
app.header.sendBic=Sender Bic
app.header.receiverBic=Receiver Bic
app.header.bizMsgId=Business Message Identifier
app.header.msgDefId=Message Definition Identifier
app.header.bizSvc=Business Service
app.header.creDt=Create Date
credit=Credit
debit=Debit
reversal.credit=Reversal Credit
reversal.debit=Reversal Debit
statement.id=Statement Identifier
statement.account=Statement Account Number
statement.sequence.number=Statement Sequence Number
statement.page.number=Statement Page Number
statement.openingBooked.crdr=Opening Booked Credit Debit Indicator
statement.openingBooked.date=Opening Booked Value Date
statement.openingBooked.ccy=Opening Booked Currency
statement.openingBooked.amt=Opening Booked Amount
statement.closingBooked.crdr=Colsing Booked Credit Debit Indicator
statement.closingBooked.date=Colsing Booked Value Date
statement.closingBooked.ccy=Colsing Booked Currency
statement.closingBooked.amt=Colsing Booked Amount
statement.entry.valueDate=Statement Entry Value Date
statement.entry.crdr=Statement Entry Credit Debit Indicator
statement.entry.ccy=Statement Entry Currency
statement.entry.amt=Statement Entry Currency
statement.entry.endToEndId=Statement Entry End To End Identification
\ No newline at end of file
......@@ -2,12 +2,12 @@
<!--
THE MESSAGE WILL WORK “AS IS” IN THE READINESS PORTAL. IT IS ESSENTIAL THAT USERS REMOVE THE ENVELOPE AND REPLACE IT WITH THEIR OWN TRANSPORT HEADER (FOR EXAMPLE FOR ALLIANCE ACCESS YOU WOULD USE THE XML V2 HEADERS).
=========================================================================================================================================================================================
SWIFT © 2020. All rights reserved.
SWIFT © 2020. All rights reserved.
This publication contains SWIFT or third-party confidential information. Do not disclose this publication outside your organisation without SWIFT’s prior written consent.
The use of this document is governed by the legal notices appearing at the end of this document. By using this document, you will be deemed to have accepted those legal notices.
=========================================================================================================================================================================================
Use Case p.5.3.2 Creditor Agent Dellen Private Bank sends a camt.053 statement to Creditor Baunat
Use Case p.5.3.2 Creditor Agent Dellen Private Bank sends a copy of the camt.053 statement to Authorised Party
========================================================================================================================
Change Log
2020-10-16 - Original version
......@@ -25,7 +25,7 @@ Change Log
<To>
<FIId>
<FinInstnId>
<BICFI>RABONL2U</BICFI>
<BICFI>VDSPBE22</BICFI>
</FinInstnId>
</FIId>
</To>
......@@ -46,7 +46,8 @@ Change Log
<PgNb>1</PgNb>
<LastPgInd>true</LastPgInd>
</StmtPgntn>
<LglSeqNb>14532</LglSeqNb>
<LglSeqNb>12543</LglSeqNb>
<CpyDplctInd>COPY</CpyDplctInd>
<Acct>
<Id>
<Othr>
......@@ -110,6 +111,38 @@ Change Log
</TxDtls>
</NtryDtls>
</Ntry>
<Ntry>
<Amt Ccy="EUR">100.23</Amt>
<CdtDbtInd>DBIT</CdtDbtInd>
<RvslInd>True</RvslInd>
<Sts>
<Cd>BOOK</Cd>
</Sts>
<BookgDt>
<Dt>2021-08-04</Dt>
</BookgDt>
<ValDt>
<Dt>2021-08-04</Dt>
</ValDt>
<AcctSvcrRef>HSBCREF-125646</AcctSvcrRef>
<BkTxCd>
<Prtry>
<Cd>TXCD</Cd>
<Issr>ABANK</Issr>
</Prtry>
</BkTxCd>
<NtryDtls>
<TxDtls>
<Refs>
<AcctSvcrRef>HSBCREF-125646</AcctSvcrRef>
<EndToEndId>pacs008EndToEndId-001</EndToEndId>
<UETR>02713bdc-7257-4205-aebc-c3cd0a84d9c5</UETR>
</Refs>
<Amt Ccy="EUR">65124.23</Amt>
<CdtDbtInd>CRDT</CdtDbtInd>
</TxDtls>
</NtryDtls>
</Ntry>
</Stmt>
</BkToCstmrStmt>
</Document>
......
......@@ -5,17 +5,13 @@ import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class Test {
public static void main(String[] args) throws IOException {
String xmlStr = FileUtils.readFileToString(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt05300108_950.xml"));
Map<String, Object> extraMap = new HashMap<>();
//extraMap.put("bnkBic", "SHWHQWER123");//发报
extraMap.put("bnkBic", "BJWHS12X");//收报
Map<String, String> maps = SwiftTransfer.mx2MtMap(xmlStr, extraMap);
maps.forEach((k, v) -> System.out.println(k + "=" + v));
String xmlStr = FileUtils.readFileToString(new File(System.getProperty("user.dir") + "\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt05300108_950.xml"));
Map<String, String> maps = SwiftTransfer.mx2Map(xmlStr);
maps.forEach((k, v) -> System.out.println(k + ":" + v));
}
}
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