Commit e8fcfa39 by lixinyi

Merge remote-tracking branch 'origin/ncbgjzf' into ncbgjzf

parents f18ed3c6 c47b1464
...@@ -312,7 +312,7 @@ Change Log ...@@ -312,7 +312,7 @@ Change Log
<InstdAmt Ccy="USD">555</InstdAmt> <InstdAmt Ccy="USD">555</InstdAmt>
<SttlmPrty>HIGH</SttlmPrty> <SttlmPrty>HIGH</SttlmPrty>
<SttlmTmIndctn> <SttlmTmIndctn>
<CdtDtTm>2020-07-16T19:20:30.45+01:00</CdtDtTm> <CdtDtTm>2020-07-16T19:20:30.40+01:00</CdtDtTm>
<DbtDtTm>2020-07-16T19:20:30.45+01:00</DbtDtTm> <DbtDtTm>2020-07-16T19:20:30.45+01:00</DbtDtTm>
</SttlmTmIndctn> </SttlmTmIndctn>
<SttlmTmReq> <SttlmTmReq>
......
{1:F01RBOSGB2LXXXX0000000000}{2:O2991530210409ABNANL2AXXXX00000000002301050928N}{3:{121:8a562c67-ca16-48ba-b074-65581be6f001}}{4:
:20:pacs002bizmsg299
:21:pacs8bizmsgid299
:79:/REJT/99
/AC01/addInfo
/MREF/pacs9bizmsgid299
/TREF/pacs009EndToEnd+
/TEXT//UETR/9a562c67-ca16-48ba-b074-65581be6f002
-}
\ No newline at end of file
...@@ -28,29 +28,67 @@ Change Log ...@@ -28,29 +28,67 @@ Change Log
</FinInstnId> </FinInstnId>
</FIId> </FIId>
</To> </To>
<BizMsgIdr>pacs8bizmsgidr01</BizMsgIdr> <BizMsgIdr>pacs8bizmsgidr01</BizMsgIdr>
<MsgDefIdr>pacs.008.001.08</MsgDefIdr> <MsgDefIdr>pacs.008.001.08</MsgDefIdr>
<BizSvc>swift.cbprplus.02</BizSvc> <BizSvc>swift.cbprplus.02</BizSvc>
<CreDt>2021-04-09T09:00:00+01:00</CreDt> <CreDt>2021-04-09T09:00:00+01:00</CreDt>
</AppHdr> </AppHdr>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08"> <Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08" xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08 ../xsd/pacs00800108.xsd">
<!--<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08">-->
<FIToFICstmrCdtTrf> <FIToFICstmrCdtTrf>
<GrpHdr> <GrpHdr>
<MsgId>pacs8bizmsgidr01</MsgId> <MsgId>pacs8bizmsgidr01</MsgId>
<CreDtTm>2021-04-09T09:00:00+01:00</CreDtTm> <CreDtTm>2021-04-09T09:00:00+02:00</CreDtTm>
<NbOfTxs>1</NbOfTxs> <NbOfTxs>1</NbOfTxs>
<SttlmInf> <SttlmInf>
<SttlmMtd>INDA</SttlmMtd> <SttlmMtd>INDA</SttlmMtd>
<SttlmAcct>
<Id>
<!--<IBAN>IK00010001</IBAN>-->
<Othr>
<Id>00001</Id>
</Othr>
</Id>
</SttlmAcct>
<InstgRmbrsmntAgt>
<FinInstnId>NYCBCNSHXXX</FinInstnId>
</InstgRmbrsmntAgt>
<InstgRmbrsmntAgtAcct>
<Id>
<!-- <IBAN>IB111</IBAN>-->
<Othr>
<Id>111</Id>
<Issr>abc</Issr>
</Othr>
</Id>
<Tp>
<Cd>cd01</Cd>
<!-- <Prtry></Prtry>-->
</Tp>
<Ccy>CNY</Ccy>
<Nm>ny</Nm>
<Prxy>
<Id></Id>
<Tp>
<Cd>cd02</Cd>
<!--<Prtry> </Prtry>-->
</Tp>
</Prxy>
</InstgRmbrsmntAgtAcct>
</SttlmInf> </SttlmInf>
</GrpHdr> </GrpHdr>
<CdtTrfTxInf> <CdtTrfTxInf>
<PmtId> <PmtId>
<InstrId>pacs8bizmsgidr01</InstrId> <InstrId>pacs8bizmsgidr01</InstrId>
<EndToEndId>pacs008EndToEndId-001</EndToEndId> <EndToEndId>pacs008EndToEndId-001</EndToEndId>
<UETR>8a562c67-ca16-48ba-b074-65581be6f001</UETR> <UETR>8a562c67-ca16-48ba-b074-65581be6f001</UETR>
</PmtId> </PmtId>
<PmtTpInf> <PmtTpInf>
<CtgyPurp>
<Cd>XX</Cd>
</CtgyPurp>
<SvcLvl> <SvcLvl>
<Cd>G001</Cd> <Cd>G001</Cd>
</SvcLvl> </SvcLvl>
...@@ -60,8 +98,15 @@ Change Log ...@@ -60,8 +98,15 @@ Change Log
</PmtTpInf> </PmtTpInf>
<IntrBkSttlmAmt Ccy="EUR">15000000</IntrBkSttlmAmt> <IntrBkSttlmAmt Ccy="EUR">15000000</IntrBkSttlmAmt>
<IntrBkSttlmDt>2021-04-09</IntrBkSttlmDt> <IntrBkSttlmDt>2021-04-09</IntrBkSttlmDt>
<SttlmTmIndctn>
<CdtDtTm>2020-07-16T19:20:30.40+01:00</CdtDtTm>
<DbtDtTm>2020-07-16T20:21:30.45+01:00</DbtDtTm>
</SttlmTmIndctn>
<InstdAmt Ccy="EUR">11111</InstdAmt> <InstdAmt Ccy="EUR">11111</InstdAmt>
<ChrgBr>DEBT</ChrgBr> <ChrgBr>DEBT</ChrgBr>
<Purp>
<Prtry>:26T:AAA</Prtry>
</Purp>
<InstgAgt> <InstgAgt>
<FinInstnId> <FinInstnId>
...@@ -103,12 +148,12 @@ Change Log ...@@ -103,12 +148,12 @@ Change Log
<RgltryRptg> <RgltryRptg>
<DbtCdtRptgInd>DEBT</DbtCdtRptgInd> <DbtCdtRptgInd>DEBT</DbtCdtRptgInd>
<Authrty> <Authrty>
<Ctry>US</Ctry>
<Nm>zhangsan</Nm> <Nm>zhangsan</Nm>
<Ctry>US</Ctry>
</Authrty> </Authrty>
<Dtls> <Dtls>
<Tp>TEST1</Tp> <Tp>TEST1</Tp>
<Dt>2021-04-09T09:00:00+01:00</Dt> <Dt>2021-04-09</Dt>
<Ctry>US</Ctry> <Ctry>US</Ctry>
<Cd>TEST1</Cd> <Cd>TEST1</Cd>
<Amt Ccy="USD">100</Amt> <Amt Ccy="USD">100</Amt>
...@@ -119,12 +164,12 @@ Change Log ...@@ -119,12 +164,12 @@ Change Log
<RgltryRptg> <RgltryRptg>
<DbtCdtRptgInd>CRED</DbtCdtRptgInd> <DbtCdtRptgInd>CRED</DbtCdtRptgInd>
<Authrty> <Authrty>
<Ctry>CN</Ctry>
<Nm>lisi</Nm> <Nm>lisi</Nm>
<Ctry>CN</Ctry>
</Authrty> </Authrty>
<Dtls> <Dtls>
<Tp>TEST2</Tp> <Tp>TEST2</Tp>
<Dt>2022-04-09T09:00:00+01:00</Dt> <Dt>2022-04-10</Dt>
<Ctry>US</Ctry> <Ctry>US</Ctry>
<Cd>TEST2</Cd> <Cd>TEST2</Cd>
<Amt Ccy="USD">100</Amt> <Amt Ccy="USD">100</Amt>
......
...@@ -2,9 +2,11 @@ package com.brilliance; ...@@ -2,9 +2,11 @@ package com.brilliance;
import com.brilliance.swift.SwiftTransfer; import com.brilliance.swift.SwiftTransfer;
import com.brilliance.swift.constants.Mx2MtConstants; import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.util.StringUtil; import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.SwiftTranslationErrorInfo; import com.brilliance.swift.vo.SwiftTranslationErrorInfo;
import com.brilliance.swift.vo.SwiftTranslationReport; import com.brilliance.swift.vo.SwiftTranslationReport;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.junit.Test; import org.junit.Test;
...@@ -48,6 +50,15 @@ public class Mt2MxTest { ...@@ -48,6 +50,15 @@ public class Mt2MxTest {
public void test(String source, Map<String, Object> extraMap) { public void test(String source, Map<String, Object> extraMap) {
File file = FileUtils.toFile(Mx2MtTest.class.getResource(source)); File file = FileUtils.toFile(Mx2MtTest.class.getResource(source));
try {
String mtStr=FileUtils.readFileToString(file);
AbstractMT abstractMT = AbstractMT.parse(mtStr);
abstractMT.getSwiftMessage().getBlock4().getTagValue("50");
} catch (Exception e) {
throw new SwiftException(e.getMessage());
}
SwiftTranslationReport str = SwiftTransfer.mt2MxPlus(file, null, extraMap); SwiftTranslationReport str = SwiftTransfer.mt2MxPlus(file, null, extraMap);
printSwiftTranslationReport(str); printSwiftTranslationReport(str);
} }
...@@ -116,11 +127,17 @@ public class Mt2MxTest { ...@@ -116,11 +127,17 @@ public class Mt2MxTest {
} }
@Test @Test
public void testPacs002001() { public void testPacs002001_199() {
test("/swiftTxt/MT199.txt", null); test("/swiftTxt/MT199.txt", null);
} }
@Test @Test
public void testPacs002001_299() {
test("/swiftTxt/MT299.txt", null);
}
@Test
public void testPacs004001() { public void testPacs004001() {
test("/swiftTxt/MT199.txt", null); test("/swiftTxt/MT199.txt", null);
} }
......
package com.brilliance; package com.brilliance;
import com.brilliance.swift.SwiftTransfer; import com.brilliance.swift.SwiftTransfer;
import com.brilliance.swift.vo.SwiftTranslationReport;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.junit.Test; import org.junit.Test;
...@@ -13,7 +16,7 @@ public class MxXsdValidator { ...@@ -13,7 +16,7 @@ public class MxXsdValidator {
@Test @Test
public void testPacs008001() { public void testPacs008001() {
File file = FileUtils.toFile(Mx2MtTest.class.getResource("/mxjson/Pacs00800108.xml")); File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/Pacs00800108.xml"));
boolean flag = SwiftTransfer.validateMx(file); boolean flag = SwiftTransfer.validateMx(file);
System.out.println(flag); System.out.println(flag);
} }
...@@ -31,6 +34,26 @@ public class MxXsdValidator { ...@@ -31,6 +34,26 @@ public class MxXsdValidator {
Pattern pattern=Pattern.compile("[A-Z0-9]{18,18}[0-9]{2,2}"); Pattern pattern=Pattern.compile("[A-Z0-9]{18,18}[0-9]{2,2}");
Matcher m = pattern.matcher(str); Matcher m = pattern.matcher(str);
System.out.println(m.find()); System.out.println(m.find());
}
@Test
public void tagTest() throws IOException {
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftTxt/MT103.txt"));
File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/Pacs00800108.xml"));
String s = FileUtils.readFileToString(file, "utf-8");
System.out.println(getMxInfoByTag(s,"13C"));
}
public static Object getMxInfoByTag(String swiftISOXml,String tagName) throws IOException {
SwiftTranslationReport swiftTranslationReport = SwiftTransfer.mx2MtPlus(swiftISOXml, null, null);
System.out.println(swiftTranslationReport.getMessage());
System.out.println(swiftTranslationReport.getMtType());
System.out.println(swiftTranslationReport.getMxType());
AbstractMT abstractMT= AbstractMT.parse(swiftTranslationReport.getMessage());
Tag tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(tagName);
return tag.getValue();
} }
} }
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