Commit 98e670b3 by chengzhuoshen

修复转换代码bug-2

parent 90ea8c07
...@@ -148,6 +148,14 @@ public class SwiftTransfer { ...@@ -148,6 +148,14 @@ public class SwiftTransfer {
if (StringUtil.isNotEmpty(endToEndId)) { if (StringUtil.isNotEmpty(endToEndId)) {
maps.put("endToEndId", endToEndId); maps.put("endToEndId", endToEndId);
} }
} else if (messageType.startsWith("pacs.004.001")) {
Document document = DocumentHelper.parseText(xmlStr);
Map<String, String> parentElementMaps = XmlUtil.getParentElementMaps(document);
String bodyParentElementName = parentElementMaps.get("TxInf");
String endToEndId = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".TxInf.OrgnlEndToEndId");
if (StringUtil.isNotEmpty(endToEndId)) {
maps.put("endToEndId", endToEndId);
}
} }
} }
return maps; return maps;
......
...@@ -112,10 +112,11 @@ public class Field61Generate extends AbstractMx2MtTagsGenerate { ...@@ -112,10 +112,11 @@ public class Field61Generate extends AbstractMx2MtTagsGenerate {
value += Mx2MtConstants.MT_21_DEFAULT_VALUE; value += Mx2MtConstants.MT_21_DEFAULT_VALUE;
} }
} }
//MX转MT mapping文档中不翻译以下信息 //MX转MT mapping文档中不翻译以下信息,PSBC版本需要此逻辑完成MT103 MX950对账关联勾销
/*String accountServicerReference = getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.Ntry("+i+").AcctSvcrRef"); String accountServicerReference = getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.Ntry("+i+").AcctSvcrRef");
if (StringUtil.isNotEmpty(accountServicerReference)) { if (StringUtil.isNotEmpty(accountServicerReference)) {
if (accountServicerReference.length() > 16) { if (accountServicerReference.length() > 16) {
buildSTErrorInfo(12, "Block4/:61:", accountServicerReference);
accountServicerReference = accountServicerReference.substring(0, 15) + "+"; accountServicerReference = accountServicerReference.substring(0, 15) + "+";
} }
value += "//" + accountServicerReference; value += "//" + accountServicerReference;
...@@ -123,11 +124,11 @@ public class Field61Generate extends AbstractMx2MtTagsGenerate { ...@@ -123,11 +124,11 @@ public class Field61Generate extends AbstractMx2MtTagsGenerate {
String additionalInformation = getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.Ntry("+i+").NtryDtls.TxDtls.AddtlTxInf"); String additionalInformation = getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.Ntry("+i+").NtryDtls.TxDtls.AddtlTxInf");
if (StringUtil.isNotEmpty(additionalInformation)) { if (StringUtil.isNotEmpty(additionalInformation)) {
if (additionalInformation.length() > 34) { if (additionalInformation.length() > 34) {
buildSTErrorInfo(12, "Block4/61", additionalInformation); buildSTErrorInfo(12, "Block4/:61:", additionalInformation);
additionalInformation = additionalInformation.substring(0, 33) + "+"; additionalInformation = additionalInformation.substring(0, 33) + "+";
} }
value += Mx2MtConstants.NEW_LINE + additionalInformation; value += Mx2MtConstants.NEW_LINE + additionalInformation;
}*/ }
value = mx_to_mtStartingLineCharacter(value, "Block4/61"); value = mx_to_mtStartingLineCharacter(value, "Block4/61");
tags.add(new Tag(name_61, value)); tags.add(new Tag(name_61, value));
......
...@@ -103,7 +103,7 @@ public class Field61Generate extends AbstractMx2MtTagsGenerate { ...@@ -103,7 +103,7 @@ public class Field61Generate extends AbstractMx2MtTagsGenerate {
value += Mx2MtConstants.MT_21_DEFAULT_VALUE; value += Mx2MtConstants.MT_21_DEFAULT_VALUE;
} }
//MX转MT mapping文档中不翻译以下信息 //MX转MT mapping文档中不翻译以下信息
/*String accountServicerReference = getXmlNodeValue(bodyHdrParentElementName, document, "Rpt.Ntry("+i+").AcctSvcrRef"); String accountServicerReference = getXmlNodeValue(bodyHdrParentElementName, document, "Rpt.Ntry("+i+").AcctSvcrRef");
if (StringUtil.isNotEmpty(accountServicerReference)) { if (StringUtil.isNotEmpty(accountServicerReference)) {
if (accountServicerReference.length() > 16) { if (accountServicerReference.length() > 16) {
buildSTErrorInfo(12, "BLOCK4/:61:", accountServicerReference); buildSTErrorInfo(12, "BLOCK4/:61:", accountServicerReference);
...@@ -118,7 +118,7 @@ public class Field61Generate extends AbstractMx2MtTagsGenerate { ...@@ -118,7 +118,7 @@ public class Field61Generate extends AbstractMx2MtTagsGenerate {
additionalInformation = additionalInformation.substring(0, 33) + "+"; additionalInformation = additionalInformation.substring(0, 33) + "+";
} }
value += Mx2MtConstants.NEW_LINE + additionalInformation; value += Mx2MtConstants.NEW_LINE + additionalInformation;
}*/ }
tags.add(new Tag(name_61, value)); tags.add(new Tag(name_61, value));
//MX转MT mapping文档中不翻译以下信息 //MX转MT mapping文档中不翻译以下信息
/*String additionalEntryInformation = getXmlNodeValue(bodyHdrParentElementName, document, "Rpt.Ntry("+i+").AddtlNtryInf"); /*String additionalEntryInformation = getXmlNodeValue(bodyHdrParentElementName, document, "Rpt.Ntry("+i+").AddtlNtryInf");
......
{1:F01PSBCCNBJAXXX1103110461}{2:O1030825201018CITIUS33AXXX71512921532010182025N}{3:{108:PM22082600000100}{111:001}{121:6bd1dbad-21cf-4334-8dd5-64e92c270124}}{4: {1:F01PSBCCNBJXXXX0000000000}{2:O1031010220915CITIUS33XXXX00000000002209201350N}{3:{119:STP}{111:001}{121:6bd1dbad-21cf-4334-8dd5-64e92c270124}}{4:
:20:PM220914MX103001 :20:PM220914MX103001
:23B:CRED :23B:CRED
:32A:220906USD1000, :32A:220906USD1000,
...@@ -8,14 +8,14 @@ ...@@ -8,14 +8,14 @@
beijingshifengtaiqu beijingshifengtaiqu
beijingshikunlunzhongxin beijingshikunlunzhongxin
beijingshi beijingshi
:53A:PSBCCNBJXXX :52A:CITIUS33XXX
:54A:CITIUS33XXX :57A:PSBCCNBJXXX
:59:/FTT883320000031295 :59:/FTT883320000031295
zhangxinyao zhangxinyao
beijingshifengtaiqu beijingshifengtaiqu
beijingshikunlunzhongxin beijingshikunlunzhongxin
beijingshi beijingshi
:70:.BUYING GOODS :70:/ROC/NOTPROVIDED///URI/.BUYING GOOD
ADDL REMITTER INFO:CR 355255 S ADDL REMITTER INFO:CR 355255
:71A:SHA :71A:SHA
-} -}
\ No newline at end of file
{1:F01BJWHS12XAXXX3202321018}{2:O9501024220428SHWHQWERA12308503578012205051522N}{3:{108:2205051522260719}{121:8a562c67-ca16-48ba-b074-65581be6f001}}{4: {1:F01PSBCCNBJXXXX3202321018}{2:O9501024220428CITIUS33AXXX08503578012205051522N}{3:{108:2205051522260719}{121:6bd1dbad-21cf-4334-8dd5-64e92c270124}}{4:
:20:00010013800002001234 :20:MX2MX95009200001
:25:S15612345678012345 :25:36921469
:28C:178/200 :28C:00006/00001
:60M:D220330USD377583,30 :60F:C220906USD2008000,
:61:220330220330DUSD4371,FCHKS100000189-735//1309170100000390154395 :61:2209070907CUSD1500,NTRF20220920ENDID001
PLACI LOVECNAMENSKIH WUHAN :62F:C220907USD2009500,
:61:220330220430DUSD445,FCHKS100000189-735//1309170100000390154395
PLACI LOVECNAMENSKIH STORITEV
:62M:D220330USD3372767,30
-} -}
\ No newline at end of file
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
<TxDtls> <TxDtls>
<Refs> <Refs>
<AcctSvcrRef>HSBCREF-125646</AcctSvcrRef> <AcctSvcrRef>HSBCREF-125646</AcctSvcrRef>
<EndToEndId>pacs008EndToEndId-001</EndToEndId> <!--<EndToEndId>pacs008EndToEndId-001</EndToEndId>-->
<UETR>02713bdc-7257-4205-aebc-c3cd0a84d9c5</UETR> <UETR>02713bdc-7257-4205-aebc-c3cd0a84d9c5</UETR>
</Refs> </Refs>
<Amt Ccy="EUR">65124.23</Amt> <Amt Ccy="EUR">65124.23</Amt>
......
<Request> <?xml version="1.0" encoding="UTF-8" ?>
<RequestPayload>
<AppHdr xmlns="urn:iso:std:iso:20022:tech:xsd:head.001.001.02"> <AppHdr xmlns="urn:iso:std:iso:20022:tech:xsd:head.001.001.02">
<Fr> <Fr>
<FIId> <FIId>
<FinInstnId> <FinInstnId>
<BICFI>AABBGB2X</BICFI> <BICFI>CITIUS33XXX</BICFI>
</FinInstnId> </FinInstnId>
</FIId> </FIId>
</Fr> </Fr>
<To> <To>
<FIId> <FIId>
<FinInstnId> <FinInstnId>
<BICFI>AABBIE2X</BICFI> <BICFI>PSBCCNBJXXX</BICFI>
</FinInstnId> </FinInstnId>
</FIId> </FIId>
</To> </To>
<BizMsgIdr>Buzmsgidtfr/020322/001</BizMsgIdr> <BizMsgIdr>PM220914MX103001</BizMsgIdr>
<MsgDefIdr>Msgidtfr/020322/001</MsgDefIdr> <MsgDefIdr>pacs.008.001.08</MsgDefIdr>
<BizSvc>swift.cbprplus.02</BizSvc> <BizSvc>swift.cbprplus.02</BizSvc>
<CreDt>2022-03-03T08:22:08+01:00</CreDt> <CreDt>2022-09-15T10:10:28.966+08:00</CreDt>
<PssblDplct>false</PssblDplct>
<Prty>NORM</Prty>
</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">
<FIToFICstmrCdtTrf> <FIToFICstmrCdtTrf>
<GrpHdr> <GrpHdr>
<MsgId>Msgidetfcn/02/03/2022/001</MsgId> <MsgId>PM220914MX103001</MsgId>
<CreDtTm>2022-03-02T09:24:16+01:00</CreDtTm> <CreDtTm>2022-09-15T10:10:28.966+08:00</CreDtTm>
<NbOfTxs>1</NbOfTxs> <NbOfTxs>1</NbOfTxs>
<SttlmInf> <SttlmInf>
<SttlmMtd>INDA</SttlmMtd> <SttlmMtd>COVE</SttlmMtd>
<InstgRmbrsmntAgt>
<FinInstnId>
<BICFI>PSBCCNBJXXX</BICFI>
</FinInstnId>
</InstgRmbrsmntAgt>
<InstdRmbrsmntAgt>
<FinInstnId>
<BICFI>CITIUS33XXX</BICFI>
</FinInstnId>
</InstdRmbrsmntAgt>
</SttlmInf> </SttlmInf>
</GrpHdr> </GrpHdr>
<CdtTrfTxInf> <CdtTrfTxInf>
<PmtId> <PmtId>
<InstrId>Instrid-001</InstrId> <InstrId>PM220914MX103001</InstrId>
<EndToEndId>e2eid/02/03/2022/001</EndToEndId> <EndToEndId>NOTPROVIDED</EndToEndId>
<UETR>5ddd156b-ba52-4d7d-a7ea-197cf311dc19</UETR> <UETR>6bd1dbad-21cf-4334-8dd5-64e92c270124</UETR>
<ClrSysRef>ddd</ClrSysRef>
</PmtId> </PmtId>
<IntrBkSttlmAmt Ccy="EUR">100.</IntrBkSttlmAmt> <PmtTpInf>
<IntrBkSttlmDt>2022-03-04+01:00</IntrBkSttlmDt> <SvcLvl>
<InstdAmt Ccy="EUR">110.</InstdAmt> <Cd>G001</Cd>
<ChrgBr>DEBT</ChrgBr> </SvcLvl>
<ChrgsInf> </PmtTpInf>
<Amt Ccy="EUR">99999999999999.</Amt> <IntrBkSttlmAmt Ccy="USD">1000</IntrBkSttlmAmt>
<Agt> <IntrBkSttlmDt>2022-09-06</IntrBkSttlmDt>
<FinInstnId>PSBCCNBJ</FinInstnId> <InstdAmt Ccy="USD">1000</InstdAmt>
</Agt> <ChrgBr>SHAR</ChrgBr>
</ChrgsInf>
<ChrgsInf>
<Amt Ccy="EUR">99999999999999.</Amt>
<Agt>
<FinInstnId>PSBCCNBJ</FinInstnId>
</Agt>
</ChrgsInf>
<InstgAgt> <InstgAgt>
<FinInstnId> <FinInstnId>
<BICFI>AABBGB2X</BICFI> <BICFI>CITIUS33XXX</BICFI>
</FinInstnId> </FinInstnId>
</InstgAgt> </InstgAgt>
<InstdAgt> <InstdAgt>
<FinInstnId> <FinInstnId>
<BICFI>AABBIE2X</BICFI> <BICFI>PSBCCNBJXXX</BICFI>
<LEI>123456789</LEI>
</FinInstnId> </FinInstnId>
</InstdAgt> </InstdAgt>
<Dbtr> <Dbtr>
<Nm>Mr. Debtor </Nm> <Nm>10</Nm>
<PstlAdr> <PstlAdr>
<StrtNm>EAST 45TH ST</StrtNm> <AdrLine>beijingshifengtaiqu</AdrLine>
<BldgNb>25</BldgNb> <AdrLine>beijingshikunlunzhongxin</AdrLine>
<PstCd>834009</PstCd> <AdrLine>beijingshi</AdrLine>
<TwnNm>Manhattan</TwnNm>
<Ctry>US</Ctry>
</PstlAdr> </PstlAdr>
</Dbtr> </Dbtr>
<DbtrAcct>
<Id>
<Othr>
<Id>36921469</Id>
</Othr>
</Id>
</DbtrAcct>
<DbtrAgt> <DbtrAgt>
<FinInstnId> <FinInstnId>
<BICFI>AABBGB2X</BICFI> <BICFI>CITIUS33XXX</BICFI>
</FinInstnId> </FinInstnId>
</DbtrAgt> </DbtrAgt>
<CdtrAgt> <CdtrAgt>
<FinInstnId> <FinInstnId>
<BICFI>AABBGB2X</BICFI> <BICFI>PSBCCNBJXXX</BICFI>
</FinInstnId> </FinInstnId>
</CdtrAgt> </CdtrAgt>
<Cdtr> <Cdtr>
<Nm>Mr. Creditor </Nm> <Nm>zhangxinyao</Nm>
<PstlAdr> <PstlAdr>
<StrtNm>Cable Walk </StrtNm> <AdrLine>beijingshifengtaiqu</AdrLine>
<BldgNb>89</BldgNb> <AdrLine>beijingshikunlunzhongxin</AdrLine>
<PstCd>SE120</PstCd> <AdrLine>beijingshi</AdrLine>
<TwnNm>California</TwnNm>
<Ctry>US</Ctry>
</PstlAdr> </PstlAdr>
</Cdtr> </Cdtr>
<RgltryRptg> <CdtrAcct>
<DbtCdtRptgInd>CRED</DbtCdtRptgInd> <Id>
</RgltryRptg> <Othr>
<Id>FTT883320000031295</Id>
</Othr>
</Id>
</CdtrAcct>
<RmtInf>
<Ustrd>.BUYING GOODS ADDL REMITTER INFO:CR 355255</Ustrd>
</RmtInf>
</CdtTrfTxInf> </CdtTrfTxInf>
</FIToFICstmrCdtTrf> </FIToFICstmrCdtTrf>
</Document> </Document>
</Request> </RequestPayload>
\ No newline at end of file \ No newline at end of file
...@@ -50,4 +50,9 @@ public class Mt2MxTest { ...@@ -50,4 +50,9 @@ public class Mt2MxTest {
public void testPacs008001() { public void testPacs008001() {
test("/swiftTxt/MT103.txt", null); test("/swiftTxt/MT103.txt", null);
} }
@Test
public void testCamt053001() {
test("/swiftTxt/MT950.txt", null);
}
} }
...@@ -263,7 +263,7 @@ public class Mx2MtTest { ...@@ -263,7 +263,7 @@ public class Mx2MtTest {
@Test @Test
public void testMx2MtMap() throws IOException { public void testMx2MtMap() throws IOException {
File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxCamt05400108_CREDIT.xml")); File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxPacs004001_Pacs008.xml"));
String xmlStr = FileUtils.readFileToString(file); String xmlStr = FileUtils.readFileToString(file);
Map<String, String> maps = SwiftTransfer.mx2MtMap(xmlStr, null); Map<String, String> maps = SwiftTransfer.mx2MtMap(xmlStr, null);
for (String key : maps.keySet()) { for (String key : maps.keySet()) {
......
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