Commit 9e53a111 by lixinyi

新增解析通用方法

parent 028d4975
...@@ -78,6 +78,10 @@ public abstract class AbstractMx2ElementCreator implements Mx2ElementCreator{ ...@@ -78,6 +78,10 @@ public abstract class AbstractMx2ElementCreator implements Mx2ElementCreator{
resourceAsStream = AbstractMx2ElementCreator.class.getResourceAsStream(fileName); resourceAsStream = AbstractMx2ElementCreator.class.getResourceAsStream(fileName);
} }
if (resourceAsStream == null){
fileName = "/template/mx.properties";
resourceAsStream = AbstractMx2ElementCreator.class.getResourceAsStream(fileName);
}
List<String> properties = StringUtil.inputStreamToLines(resourceAsStream); List<String> properties = StringUtil.inputStreamToLines(resourceAsStream);
readPropertyFile(mxGsonMaps, maps, properties); readPropertyFile(mxGsonMaps, maps, properties);
return maps; return maps;
......
...@@ -17,6 +17,7 @@ import com.brilliance.swift.mx2element.camt108001.Mx2ElementCamt108001Creator; ...@@ -17,6 +17,7 @@ import com.brilliance.swift.mx2element.camt108001.Mx2ElementCamt108001Creator;
import com.brilliance.swift.mx2element.camt109001.Mx2ElementCamt109001Creator; import com.brilliance.swift.mx2element.camt109001.Mx2ElementCamt109001Creator;
import com.brilliance.swift.mx2element.camt110001.Mx2ElementCamt110001Creator; import com.brilliance.swift.mx2element.camt110001.Mx2ElementCamt110001Creator;
import com.brilliance.swift.mx2element.camt111001.Mx2ElementCamt111001Creator; import com.brilliance.swift.mx2element.camt111001.Mx2ElementCamt111001Creator;
import com.brilliance.swift.mx2element.mx.Mx2ElementCreator;
import com.brilliance.swift.mx2element.pacs002001.Mx2ElementPacs002001Creator; import com.brilliance.swift.mx2element.pacs002001.Mx2ElementPacs002001Creator;
import com.brilliance.swift.mx2element.pacs003001.Mx2ElementPacs003001Creator; import com.brilliance.swift.mx2element.pacs003001.Mx2ElementPacs003001Creator;
import com.brilliance.swift.mx2element.pacs004001.Mx2ElementPacs004001Creator; import com.brilliance.swift.mx2element.pacs004001.Mx2ElementPacs004001Creator;
...@@ -130,7 +131,7 @@ public class Mx2ElementCreatorManager { ...@@ -130,7 +131,7 @@ public class Mx2ElementCreatorManager {
} else if (messageType.matches("xsys012001[0-9]{2}")) { } else if (messageType.matches("xsys012001[0-9]{2}")) {
return new Mx2ElementXsys012001Creator(); return new Mx2ElementXsys012001Creator();
} else { } else {
throw new SwiftException("无效的MX报文类型"); return new Mx2ElementCreator();
} }
} }
} }
package com.brilliance.swift.mx2element.mx;
import com.brilliance.swift.mx2element.AbstractMx2ElementCreator;
import java.util.Map;
public class Mx2ElementCreator extends AbstractMx2ElementCreator {
@Override
public Map<String, Object> buildElement() {
return super.buildElement();
}
}
<?xml version="1.0" encoding="UTF-8"?><!--
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.
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 pn.1.1.1 Debtor AB Inbev Holdings sends a pain.001 to Agent F HSBC
========================================================================================================================
Change Log
2021-06-30 Original Version
=============================
-->
<Envelope xmlns="urn:swift:xsd:envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:swift:xsd:envelope ../../../../March21Schemas/Translator_envelope.xsd">
<AppHdr xmlns="urn:iso:std:iso:20022:tech:xsd:head.001.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Fr>
<FIId>
<FinInstnId>
<BICFI>SABMGB2L</BICFI>
</FinInstnId>
</FIId>
</Fr>
<To>
<FIId>
<FinInstnId>
<BICFI>HBUKGB4B</BICFI>
</FinInstnId>
</FIId>
</To>
<BizMsgIdr>INBEVINITIATE</BizMsgIdr>
<MsgDefIdr>pain.001.001.09</MsgDefIdr>
<BizSvc>swift.cbprplus.02</BizSvc>
<CreDt>2021-05-31T12:43:41+00:00</CreDt>
</AppHdr>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.09">
<CstmrCdtTrfInitn>
<GrpHdr>
<MsgId>INBEVINITIATE</MsgId>
<CreDtTm>2021-05-31T12:43:41+00:00</CreDtTm>
<NbOfTxs>1</NbOfTxs>
<InitgPty>
<Id>
<OrgId>
<AnyBIC>SABMGB2L</AnyBIC>
</OrgId>
</Id>
</InitgPty>
<FwdgAgt>
<FinInstnId>
<BICFI>HBUKGB4B</BICFI>
</FinInstnId>
</FwdgAgt>
</GrpHdr>
<PmtInf>
<PmtInfId>INITIATEID001</PmtInfId>
<PmtMtd>TRF</PmtMtd>
<PmtTpInf>
<CtgyPurp>
<Cd>PENS</Cd>
</CtgyPurp>
</PmtTpInf>
<ReqdExctnDt>
<Dt>2021-05-31</Dt>
</ReqdExctnDt>
<Dbtr>
<Id>
<OrgId>
<AnyBIC>SABMGB2L</AnyBIC>
</OrgId>
</Id>
</Dbtr>
<DbtrAcct>
<Id>
<Othr>
<Id>60779465</Id>
</Othr>
</Id>
<Ccy>EUR</Ccy>
</DbtrAcct>
<DbtrAgt>
<FinInstnId>
<BICFI>RBOSGB2L</BICFI>
</FinInstnId>
</DbtrAgt>
<CdtTrfTxInf>
<PmtId>
<InstrId>INBEVINITIATE</InstrId>
<EndToEndId>E2E04044506271305</EndToEndId>
<UETR>174c245f-2682-4291-ad67-2a41e530cd27</UETR>
</PmtId>
<Amt>
<InstdAmt Ccy="EUR">45698</InstdAmt>
</Amt>
<ChrgBr>DEBT</ChrgBr>
<CdtrAgt>
<FinInstnId>
<BICFI>KREDBEBB</BICFI>
</FinInstnId>
</CdtrAgt>
<Cdtr>
<Nm>Axa Investments</Nm>
<PstlAdr>
<StrtNm>AnderLaan 10</StrtNm>
<TwnNm>Antwerp</TwnNm>
<Ctry>BE</Ctry>
</PstlAdr>
</Cdtr>
<RmtInf>
<Ustrd>Pension Scheme ABC123</Ustrd>
</RmtInf>
</CdtTrfTxInf>
</PmtInf>
</CstmrCdtTrfInitn>
</Document>
</Envelope>
\ No newline at end of file
#APPLICATION HEADER
frBic=appHdr.fr.fiId.finInstnId.bicfi
toBic=appHdr.to.fiId.finInstnId.bicfi
bizMsgIdr=appHdr.bizMsgIdr
msgId=cstmrPmtStsRpt.grpHdr.msgId
msgDefIdr=appHdr.msgDefIdr
bizSvc=appHdr.bizSvc
creDt=appHdr.creDt
priority=appHdr.prty
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