Commit 98e670b3 by chengzhuoshen

修复转换代码bug-2

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