Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
swiftMtMx
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
isc-v3.1-tmp
swiftMtMx
Commits
21610024
Commit
21610024
authored
Aug 28, 2023
by
gechengyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交测试类和测试报文
parent
f449d2d1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
652 additions
and
18 deletions
+652
-18
Element2MxCreatorManager.java
...brilliance/swift/element2mx/Element2MxCreatorManager.java
+1
-1
AbstractMx2MtCreator.java
...java/com/brilliance/swift/mx2mt/AbstractMx2MtCreator.java
+5
-1
MT03_tag72.txt
swiftCore/src/main/resources/swiftTxt/MT03_tag72.txt
+32
-0
MT103.txt
swiftCore/src/main/resources/swiftTxt/MT103.txt
+4
-1
MT202_tag72.txt
swiftCore/src/main/resources/swiftTxt/MT202_tag72.txt
+19
-0
MT202_tag72_2.txt
swiftCore/src/main/resources/swiftTxt/MT202_tag72_2.txt
+22
-0
MT940.txt
swiftCore/src/main/resources/swiftTxt/MT940.txt
+1
-0
MxCamt05300108_950.xml
swiftCore/src/main/resources/swiftXml/MxCamt05300108_950.xml
+33
-1
Pacs00800108.xml
swiftCore/src/main/resources/swiftXml/Pacs00800108.xml
+1
-1
Pacs00800108_gcy.xml
swiftCore/src/main/resources/swiftXml/Pacs00800108_gcy.xml
+240
-0
pacs008001_gcy.xml
swiftCore/src/main/resources/swiftXml/pacs008001_gcy.xml
+124
-0
pacs008001.properties
swiftCore/src/main/resources/template/pacs008001.properties
+0
-0
Element2MxTest.java
swiftCore/src/test/java/com/brilliance/Element2MxTest.java
+50
-13
JavaBean2XmlTest.java
swiftCore/src/test/java/com/brilliance/JavaBean2XmlTest.java
+68
-0
Mt2MxTest.java
swiftCore/src/test/java/com/brilliance/Mt2MxTest.java
+40
-0
Mx2MtTest.java
swiftCore/src/test/java/com/brilliance/Mx2MtTest.java
+12
-0
No files found.
swiftCore/src/main/java/com/brilliance/swift/element2mx/Element2MxCreatorManager.java
View file @
21610024
...
...
@@ -21,7 +21,7 @@ public class Element2MxCreatorManager {
public
String
element2Mx
(
Map
elementMaps
)
throws
SwiftException
{
String
messageType
=
(
String
)
elementMaps
.
get
(
"messageType"
);
if
(
StringUtil
.
isEmpty
(
messageType
))
{
throw
new
SwiftException
(
"找不到MX类型
"
);
throw
new
SwiftException
(
"找不到MX类型
:"
+
messageType
);
}
AbstractElement2MxCreator
creator
=
getCreator
(
messageType
);
creator
.
setElementMaps
(
elementMaps
);
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/AbstractMx2MtCreator.java
View file @
21610024
...
...
@@ -3,7 +3,6 @@ package com.brilliance.swift.mx2mt;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.MessageUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.util.XmlUtil
;
...
...
@@ -544,6 +543,11 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
str
.
setMtType
(
getMtType
());
str
.
setMessage
(
mtStr
);
String
outputFilePath
=
(
String
)
context
.
get
(
Mx2MtContextIdentifier
.
MX_TO_MT_OUTPUT_FILE_PATH
,
true
);
File
destFile
=
new
File
(
outputFilePath
);
if
(
destFile
!=
null
&&(!
destFile
.
getParentFile
().
exists
())){
destFile
.
getParentFile
().
mkdirs
();
}
if
(
StringUtil
.
isNotEmpty
(
outputFilePath
))
{
write
(
swiftMessage
,
new
File
(
outputFilePath
));
}
...
...
swiftCore/src/main/resources/swiftTxt/MT03_tag72.txt
0 → 100644
View file @
21610024
{1:F01PSBCCNBJXXXX0000000000}{2:O1031010220915CITIUS00XXXX00000000002209201350N}{3:{119:STP}{111:001}{121:6bd1dbad-21cf-4334-8dd5-64e92c270124}}{4:
:20:PM220914MX103001
:23B:CRED
:32A:220906USD1000,
:33B:USD1000,
:50F:/36921469
1/10
2/beijingshifengtaiqu
3/CN/beijingshikunlunzhongxin
:51A:CITIUS11XXX
:52A:CITIUS22XXX
:53A:CITIUS33XXX
:54A:CITIUS44XXX
:55A:CITIUS55XXX
:56A:CITIUS66XXX
:57A:CITIUS77XXX
:59F:/FTT883320000031295
1/zhangxinyao
2/beijingshifengtaiqu
3/beijingshikunlunzhongxin
3/beijingshi
:70:/ROC/NOTPROVIDED///URI/.BUYING GOOD
S ADDL REMITTER INFO:CR 355255
:71A:SHA
:72:/ACC/111QWERFDSA123345QWERFDSA123345
/INS/HHHHHSA123345
/INS/CCCC456
/INS/LLLLins123
/INS/555
/INS/666
-}
\ No newline at end of file
swiftCore/src/main/resources/swiftTxt/MT103.txt
View file @
21610024
...
...
@@ -14,7 +14,9 @@
2/beijingshifengtaiqu
3/beijingshikunlunzhongxin
3/beijingshi
:70:/ROC/NOTPROVIDED///URI/.BUYING GOOD
:70:/RO1/NOTPROVIDED///URI/.BUYING GOOD
S ADDL REMITTER INFO:CR 355255
S ADDL REMITTER INFO:CR 355255
S ADDL REMITTER INFO:CR 355255
:71A:SHA
-}
\ No newline at end of file
swiftCore/src/main/resources/swiftTxt/MT202_tag72.txt
0 → 100644
View file @
21610024
{1:F01NYCBCNSHAXXX7165860797}{2:O2020506220816CHASUS33AXXX97797048922208161706N}{3:{108:0440650228FC}{111:004}{121:4d71c706-437f-4ee9-9b67-90c87d83d766}}{4:
:20:0440650228FC
:21:COMMSH7425NYCBSH
:13C:/RNCTIME/0506-0400
:32A:220816USD4000000,
:52D:/6290409301
BANK OF COMMUNICATIONS
HEAD OFFICE
1111 SHANGFENG ROAD, PUDONG
SHANGHAI 201203, CHINA
:58D:/793617432
NANYANG COMMERCIAL BANK (CHINA)
PUMING RD NO 898
13-20F
SHANGHAI CHINA CHINA CN
:72:/INS/BOFAUS3N
///CHPREF/0188423
-}{5:{MAC:00000000}{CHK:EA220120288B}}{S:{SAC:}{COP:P}}
\ No newline at end of file
swiftCore/src/main/resources/swiftTxt/MT202_tag72_2.txt
0 → 100644
View file @
21610024
{1:F01NYCBCNSHAXXX7239964565}{2:O2020147320815CHASUS33CXXX84754100752308141347N}{3:{108:0363260226FC}{111:004}{121:75b796c8-3a3f-41ee-95ef-980761c00090}}{4:
:20:0363320815FC
:21:457A23EL00016203
:13C:/RNCTIME/0146-0400
:32A:320815USD8780433,30
:52D:/000000895002
SUMITOMO MITSUI BANKING CORPORATION
HEAD OFFICE ACCOUNT
1-2 MARUNOUCHI 1-CHOME, CHIYODA-KU
TOKYO 100-0005, JAPAN
:58D:/793617432
NANYANG COMMERCIAL BANK (CHINA)
PUMING RD NO 898
13-20F
SHANGHAI CHINA CHINA CN
:72:/CHGS/USD15,00/
/BNF/BNF IN FAVOUR OF YOUR DALIAN B
//RANC H. CHARGES DEDUCTED USD20,00
///INS/SMBCUS33
///CHPREF/0086051
-}{5:{MAC:00000000}{CHK:9B95855172A4}}{S:{SAC:}{COP:P}}
\ No newline at end of file
swiftCore/src/main/resources/swiftTxt/MT940.txt
View file @
21610024
...
...
@@ -4,6 +4,7 @@
:28C:178/200
:60M:D220330USD120274,34
:61:220330220330CUSD393,17FCHKS100000189-735//1309170100000390154395
:61:2209070907CUSD1500,NTRF20220920ENDID001
PLACI LOVECNAMENSKIH WUHAN
:86:CHINESE BEIJING
CHINESE SHANGHAI
...
...
swiftCore/src/main/resources/swiftXml/MxCamt05300108_950.xml
View file @
21610024
...
...
@@ -73,7 +73,7 @@
<Cd>
BOOK
</Cd>
</Sts>
<BookgDt>
<Dt>
2020-08-0
4
</Dt>
<Dt>
2020-08-0
5
</Dt>
</BookgDt>
<ValDt>
<Dt>
2020-08-04
</Dt>
...
...
@@ -97,6 +97,38 @@
</TxDtls>
</NtryDtls>
</Ntry>
<Ntry>
<Amt
Ccy=
"EUR"
>
1
</Amt>
<CdtDbtInd>
CRDT
</CdtDbtInd>
<Sts>
<Cd>
BOOK
</Cd>
</Sts>
<BookgDt>
<Dt>
2020-08-04
</Dt>
</BookgDt>
<ValDt>
<Dt>
2020-08-04
</Dt>
</ValDt>
<AcctSvcrRef>
HSBCREF-125601
</AcctSvcrRef>
<BkTxCd>
<Prtry>
<Cd>
TXCD
</Cd>
<Issr>
ABANK
</Issr>
</Prtry>
</BkTxCd>
<NtryDtls>
<TxDtls>
<Refs>
<AcctSvcrRef>
HSBCREF-125602
</AcctSvcrRef>
<!--<EndToEndId>pacs008EndToEndId-001</EndToEndId>-->
<UETR>
02713bdc-7257-4205-aebc-c3cd0a84d9c6
</UETR>
</Refs>
<Amt
Ccy=
"EUR"
>
1
</Amt>
<CdtDbtInd>
CRDT
</CdtDbtInd>
</TxDtls>
</NtryDtls>
</Ntry>
</Stmt>
</BkToCstmrStmt>
</Document>
...
...
swiftCore/src/main/resources/swiftXml/Pacs00800108.xml
View file @
21610024
...
...
@@ -17,7 +17,7 @@ Change Log
<Fr>
<FIId>
<FinInstnId>
<BICFI>
RBOSGB2L
XXX
</BICFI>
<BICFI>
RBOSGB2L
000
</BICFI>
</FinInstnId>
</FIId>
</Fr>
...
...
swiftCore/src/main/resources/swiftXml/Pacs00800108_gcy.xml
0 → 100644
View file @
21610024
<?xml version="1.0" encoding="UTF-8"?>
<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>
RBOSGB2LXXX
</BICFI>
<!--以下节点已经删除-->
<!--<Nm>zzz</Nm>
<PstlAdr>
<Ctry></Ctry>
<AdrTp>
<Cd></Cd>
<Prtry>
<Id></Id>
<Issr></Issr>
</Prtry>
</AdrTp>
<BldgNb></BldgNb>
<BldgNm></BldgNm>
<Dept></Dept>
<SubDept></SubDept>
<Flr></Flr>
<PstBx></PstBx>
<PstCd></PstCd>
<CtrySubDvsn></CtrySubDvsn>
<AdrLine>adr1</AdrLine>
<AdrLine>adr2</AdrLine>
</PstlAdr>
<Othr>
<Id></Id>
<Issr></Issr>
<SchmeNm>
<Cd></Cd>
<Prtry></Prtry>
</SchmeNm>
</Othr>-->
<ClrSysMmbId>
<ClrSysId>
<Cd>
HKNCC
</Cd>
<Prtry>
IFT02
</Prtry>
</ClrSysId>
<MmbId>
000
</MmbId>
</ClrSysMmbId>
</FinInstnId>
</FIId>
</Fr>
<To>
<FIId>
<FinInstnId>
<BICFI>
ABNANL2AXXX
</BICFI>
</FinInstnId>
</FIId>
</To>
<BizMsgIdr>
pacs8bizmsgidr01
</BizMsgIdr>
<MsgDefIdr>
pacs.008.001.08
</MsgDefIdr>
<BizSvc>
swift.cbprplus.02
</BizSvc>
<CreDt>
2021-04-09T09:00:00+01:00
</CreDt>
<PssblDplct>
false
</PssblDplct>
<Prty>
HIGH
</Prty>
<CpyDplct>
COPY
</CpyDplct>
</AppHdr>
<Document
xmlns=
"urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08"
>
<FIToFICstmrCdtTrf>
<GrpHdr>
<MsgId>
pacs8bizmsgidr01
</MsgId>
<CreDtTm>
2021-04-09T09:00:00+01:00
</CreDtTm>
<NbOfTxs>
1
</NbOfTxs>
<SttlmInf>
<SttlmMtd>
INDA
</SttlmMtd>
<SttlmAcct>
<Id>
<IBAN>
BN001BN001BN001BN001BN001BN001BN00
</IBAN>
<Othr>
<Id>
1111
</Id>
<SchmeNm>
<Cd>
HAAA
</Cd>
<Prtry>
1111
</Prtry>
</SchmeNm>
<Issr>
aaaa
</Issr>
</Othr>
</Id>
<Tp>
<Cd>
a
</Cd>
<Prtry>
a
</Prtry>
</Tp>
<Ccy>
USDS
</Ccy>
<Nm>
aa
</Nm>
<Prxy>
<Id>
111
</Id>
<Tp>
<Cd>
a
</Cd>
<Prtry>
a
</Prtry>
</Tp>
</Prxy>
</SttlmAcct>
<!--发报行代理行-->
<InstgRmbrsmntAgt>
<FinInstnId>
<BICFI>
PSBCCNBJXXX
</BICFI>
<ClrSysMmbId>
<ClrSysId>
<Cd>
HKNCC
</Cd>
</ClrSysId>
<MmbId>
000
</MmbId>
</ClrSysMmbId>
<LEI>
1111
</LEI>
<Nm>
zzz
</Nm>
<PstlAdr>
<Ctry></Ctry>
<BldgNb></BldgNb>
<BldgNm></BldgNm>
<Dept></Dept>
<SubDept></SubDept>
<Flr></Flr>
<PstBx></PstBx>
<PstCd></PstCd>
<CtrySubDvsn></CtrySubDvsn>
<!--AdrLine每行最多35字符-->
<AdrLine>
adr1
</AdrLine>
<AdrLine>
adr2
</AdrLine>
</PstlAdr>
</FinInstnId>
</InstgRmbrsmntAgt>
<InstgRmbrsmntAgtAcct>
<Id>
<IBAN>
1111
</IBAN>
<Othr>
<Id>
1111
</Id>
<SchmeNm>
<Cd>
a
</Cd>
<Prtry>
a
</Prtry>
</SchmeNm>
<Issr>
aaa
</Issr>
</Othr>
</Id>
<Tp>
<Cd>
a
</Cd>
<Prtry>
a
</Prtry>
</Tp>
<Ccy>
USD
</Ccy>
<Nm>
a
</Nm>
<Prxy>
<Id>
1111
</Id>
<Tp>
<Cd>
a
</Cd>
<Prtry>
a
</Prtry>
</Tp>
</Prxy>
</InstgRmbrsmntAgtAcct>
</SttlmInf>
</GrpHdr>
<CdtTrfTxInf>
<PmtId>
<InstrId>
pacs8bizmsgidr01
</InstrId>
<EndToEndId>
pacs008EndToEndId-001
</EndToEndId>
<UETR>
8a562c67-ca16-48ba-b074-65581be6f001
</UETR>
<ClrSysRef>
aa
</ClrSysRef>
<TxId>
aa
</TxId>
</PmtId>
<IntrBkSttlmAmt
Ccy=
"EUR"
>
15000000
</IntrBkSttlmAmt>
<IntrBkSttlmDt>
2021-04-09
</IntrBkSttlmDt>
<InstdAmt
Ccy=
"EUR"
>
11111
</InstdAmt>
<ChrgBr>
DEBT
</ChrgBr>
<InstgAgt>
<FinInstnId>
<BICFI>
RBOSGB2LXXX
</BICFI>
</FinInstnId>
</InstgAgt>
<InstdAgt>
<FinInstnId>
<BICFI>
ABNANL2AXXX
</BICFI>
</FinInstnId>
</InstdAgt>
<Dbtr>
<Nm>
Large Company
</Nm>
<PstlAdr>
<StrtNm>
High Street
</StrtNm>
<TwnNm>
Epping
</TwnNm>
<Ctry>
GB
</Ctry>
</PstlAdr>
</Dbtr>
<DbtrAgt>
<FinInstnId>
<BICFI>
RBOSGB2LXXX
</BICFI>
</FinInstnId>
</DbtrAgt>
<CdtrAgt>
<FinInstnId>
<BICFI>
KREDBEBB
</BICFI>
</FinInstnId>
</CdtrAgt>
<Cdtr>
<Nm>
Ardent Finance
</Nm>
<PstlAdr>
<StrtNm>
Rue Saint Exupery
</StrtNm>
<TwnNm>
17/13 4460 GRACE-HOLLOGNE
</TwnNm>
<Ctry>
BG
</Ctry>
</PstlAdr>
</Cdtr>
<RgltryRptg>
<DbtCdtRptgInd>
DEBT
</DbtCdtRptgInd>
<Authrty>
<Ctry>
US
</Ctry>
<Nm>
zhangsan
</Nm>
</Authrty>
<Dtls>
<Tp>
TEST1
</Tp>
<Dt>
2021-04-09T09:00:00+01:00
</Dt>
<Ctry>
US
</Ctry>
<Cd>
TEST1
</Cd>
<Amt
Ccy=
"USD"
>
100
</Amt>
<Inf>
testInfo111
</Inf>
</Dtls>
</RgltryRptg>
<RgltryRptg>
<DbtCdtRptgInd>
CRED
</DbtCdtRptgInd>
<Authrty>
<Ctry>
CN
</Ctry>
<Nm>
lisi
</Nm>
</Authrty>
<Dtls>
<Tp>
TEST2
</Tp>
<Dt>
2022-04-09T09:00:00+01:00
</Dt>
<Ctry>
US
</Ctry>
<Cd>
TEST2
</Cd>
<Amt
Ccy=
"USD"
>
100
</Amt>
<Inf>
testInfo222
</Inf>
</Dtls>
</RgltryRptg>
<RmtInf>
<Ustrd>
SWEEP 454-9663
</Ustrd>
</RmtInf>
</CdtTrfTxInf>
</FIToFICstmrCdtTrf>
</Document>
</Envelope>
swiftCore/src/main/resources/swiftXml/pacs008001_gcy.xml
0 → 100644
View file @
21610024
<?xml version="1.0" encoding="UTF-8"?>
<Envelope
xmlns=
"urn:swift:xsd:envelope"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
>
<head:AppHdr
xmlns:head=
"urn:iso:std:iso:20022:tech:xsd:head.001.001.02"
>
<head:Fr>
<head:FIId>
<head:FinInstnId>
<head:BICFI>
CITIUS00XXX
</head:BICFI>
</head:FinInstnId>
</head:FIId>
</head:Fr>
<head:To>
<head:FIId>
<head:FinInstnId>
<head:BICFI>
PSBCCNBJXXX
</head:BICFI>
</head:FinInstnId>
</head:FIId>
</head:To>
<head:BizMsgIdr>
PM220914MX103001
</head:BizMsgIdr>
<head:MsgDefIdr>
pacs.008.001.08
</head:MsgDefIdr>
<head:BizSvc>
swift.cbprplus.02
</head:BizSvc>
<head:CreDt>
9999-12-31T00:00:00+00:00
</head:CreDt>
</head:AppHdr>
<pacs:Document
xmlns:pacs=
"urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08"
>
<pacs:FIToFICstmrCdtTrf>
<pacs:GrpHdr>
<pacs:MsgId>
PM220914MX103001
</pacs:MsgId>
<pacs:CreDtTm>
9999-12-31T00:00:00+00:00
</pacs:CreDtTm>
<pacs:NbOfTxs>
1
</pacs:NbOfTxs>
<pacs:SttlmInf>
<pacs:SttlmMtd>
COVE
</pacs:SttlmMtd>
<pacs:InstgRmbrsmntAgt>
<pacs:FinInstnId>
<pacs:BICFI>
CITIUS33XXX
</pacs:BICFI>
</pacs:FinInstnId>
</pacs:InstgRmbrsmntAgt>
<pacs:InstdRmbrsmntAgt>
<pacs:FinInstnId>
<pacs:BICFI>
CITIUS44XXX
</pacs:BICFI>
</pacs:FinInstnId>
</pacs:InstdRmbrsmntAgt>
<pacs:ThrdRmbrsmntAgt>
<pacs:FinInstnId>
<pacs:BICFI>
CITIUS55XXX
</pacs:BICFI>
</pacs:FinInstnId>
</pacs:ThrdRmbrsmntAgt>
</pacs:SttlmInf>
</pacs:GrpHdr>
<pacs:CdtTrfTxInf>
<pacs:PmtId>
<pacs:InstrId>
PM220914MX103001
</pacs:InstrId>
<pacs:EndToEndId>
NOTPROVIDED
</pacs:EndToEndId>
<pacs:UETR>
6bd1dbad-21cf-4334-8dd5-64e92c270124
</pacs:UETR>
</pacs:PmtId>
<pacs:PmtTpInf>
<pacs:SvcLvl>
<pacs:Cd>
G001
</pacs:Cd>
</pacs:SvcLvl>
</pacs:PmtTpInf>
<pacs:IntrBkSttlmAmt
Ccy=
"USD"
>
1000
</pacs:IntrBkSttlmAmt>
<pacs:IntrBkSttlmDt>
2022-09-06
</pacs:IntrBkSttlmDt>
<pacs:InstdAmt
Ccy=
"USD"
>
1000
</pacs:InstdAmt>
<pacs:ChrgBr>
SHAR
</pacs:ChrgBr>
<pacs:InstgAgt>
<pacs:FinInstnId>
<pacs:BICFI>
CITIUS00XXX
</pacs:BICFI>
</pacs:FinInstnId>
</pacs:InstgAgt>
<pacs:InstdAgt>
<pacs:FinInstnId>
<pacs:BICFI>
PSBCCNBJXXX
</pacs:BICFI>
</pacs:FinInstnId>
</pacs:InstdAgt>
<pacs:IntrmyAgt1>
<pacs:FinInstnId>
<pacs:BICFI>
CITIUS66XXX
</pacs:BICFI>
</pacs:FinInstnId>
</pacs:IntrmyAgt1>
<pacs:Dbtr>
<pacs:Nm>
10
</pacs:Nm>
<pacs:PstlAdr>
<pacs:AdrLine>
2/beijingshifengtaiqu
</pacs:AdrLine>
<pacs:AdrLine>
3/CN/beijingshikunlunzhongxin
</pacs:AdrLine>
</pacs:PstlAdr>
</pacs:Dbtr>
<pacs:DbtrAcct>
<pacs:Id>
<pacs:Othr>
<pacs:Id>
36921469
</pacs:Id>
</pacs:Othr>
</pacs:Id>
</pacs:DbtrAcct>
<pacs:DbtrAgt>
<pacs:FinInstnId>
<pacs:BICFI>
CITIUS22XXX
</pacs:BICFI>
</pacs:FinInstnId>
</pacs:DbtrAgt>
<pacs:CdtrAgt>
<pacs:FinInstnId>
<pacs:BICFI>
CITIUS77XXX
</pacs:BICFI>
</pacs:FinInstnId>
</pacs:CdtrAgt>
<pacs:Cdtr>
<pacs:Nm>
zhangxinyao
</pacs:Nm>
<pacs:PstlAdr>
<pacs:AdrLine>
2/beijingshifengtaiqu
</pacs:AdrLine>
<pacs:AdrLine>
3/beijingshikunlunzhongxin
</pacs:AdrLine>
<pacs:AdrLine>
3/beijingshi
</pacs:AdrLine>
</pacs:PstlAdr>
</pacs:Cdtr>
<pacs:CdtrAcct>
<pacs:Id>
<pacs:Othr>
<pacs:Id>
FTT883320000031295
</pacs:Id>
</pacs:Othr>
</pacs:Id>
</pacs:CdtrAcct>
<pacs:RmtInf>
<pacs:Ustrd>
/ROC/NOTPROVIDED///URI/.BUYING GOODS ADDL REMITTER INFO:CR 355255
</pacs:Ustrd>
</pacs:RmtInf>
</pacs:CdtTrfTxInf>
</pacs:FIToFICstmrCdtTrf>
</pacs:Document>
</Envelope>
\ No newline at end of file
swiftCore/src/main/resources/template/pacs008001.properties
View file @
21610024
This diff is collapsed.
Click to expand it.
swiftCore/src/test/java/com/brilliance/Element2MxTest.java
View file @
21610024
...
...
@@ -2,14 +2,18 @@ package com.brilliance;
import
com.brilliance.swift.SwiftTransfer
;
import
com.brilliance.swift.element2mx.Element2MxCreatorManager
;
import
com.brilliance.swift.util.XmlUtil
;
import
com.prowidesoftware.swift.model.MxId
;
import
com.prowidesoftware.swift.model.mx.AbstractMX
;
import
com.brilliance.swift.util.StringUtil
;
import
org.apache.commons.io.FileUtils
;
import
org.junit.Test
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
public
class
Element2MxTest
{
...
...
@@ -17,27 +21,60 @@ public class Element2MxTest {
public
void
test
()
throws
IOException
{
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxCamt05300108_950.xml"));
// File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxPacs00800108.xml"));
File
file
=
FileUtils
.
toFile
(
Mx2MtTest
.
class
.
getResource
(
"/swiftXml/Pacs00800108.xml"
));
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/Pacs00800108.xml"));
File
file
=
FileUtils
.
toFile
(
Mx2MtTest
.
class
.
getResource
(
"/swiftXml/pacs008001_gcy.xml"
));
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxPacs00900108.xml"));
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxCamt05400108_CREDIT.xml"));
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxCamt02900109_196.xml"));
// File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/camt05400108_900.xml.xml"));'
String
xmlStr1
=
FileUtils
.
readFileToString
(
file
);
/*
String xmlStr1 = FileUtils.readFileToString(file);
MxId mxId = XmlUtil.getMxMessageType(xmlStr1);
AbstractMX abstractMX = AbstractMX.parse(file,mxId);
String
json
=
abstractMX
.
toJson
();
String json=abstractMX.toJson();
*/
String
elementStr
=
SwiftTransfer
.
mx2Element
(
file
);
System
.
out
.
println
(
"elementStr="
+
elementStr
);
System
.
out
.
println
(
"*****************************"
);
Map
map
=
new
HashMap
();
map
.
put
(
"frBic"
,
"NYCBCNSHXXX"
);
map
.
put
(
"toBic"
,
"PSBCCNBJXXX"
);
map
.
put
(
"messageType"
,
"pacs00800108"
);
List
svcLvlList
=
new
ArrayList
();
Map
tmap
=
new
HashMap
();
tmap
.
put
(
"cd"
,
"G001"
);
svcLvlList
.
add
(
tmap
);
map
.
put
(
"svcLvl"
,
svcLvlList
);
String
xmlStr1
=
new
Element2MxCreatorManager
().
element2Mx
(
map
);
System
.
out
.
println
(
xmlStr1
);
// String xmlStr = new Element2MxCreatorManager().element2Mx(elementStr);
// System.out.println("iso======"+xmlStr);
}
String
xmlStr
=
new
Element2MxCreatorManager
().
element2Mx
(
elementStr
);
System
.
out
.
println
(
xmlStr
);
@Test
public
void
testRefreshValue
()
{
String
value
=
"/INS/BOFAUS3N^&**!!!\r\n"
+
"///CHPREF/0188423"
;
String
s
=
refreshValue
(
value
,
"//"
,
35
);
System
.
out
.
println
(
s
.
replace
(
"\r\n//"
,
""
));
}
String
str
=
"ABC"
;
try
{
int
length
=
str
.
getBytes
(
"GBK"
).
length
;
}
catch
(
java
.
io
.
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
protected
String
refreshValue
(
String
value
,
String
continuePattern
,
int
maxLength
)
{
if
(
StringUtil
.
isEmpty
(
value
))
{
return
""
;
}
String
regex
=
"(.*)\\\r\\\n"
+
continuePattern
;
Pattern
p
=
Pattern
.
compile
(
regex
);
Matcher
m
=
p
.
matcher
(
value
);
while
(
m
.
find
())
{
String
findStr
=
m
.
group
(
1
);
if
(
findStr
.
length
()
<
maxLength
)
{
value
=
value
.
replace
(
findStr
,
findStr
+
" "
);
}
}
return
value
;
}
}
swiftCore/src/test/java/com/brilliance/JavaBean2XmlTest.java
0 → 100644
View file @
21610024
package
com
.
brilliance
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mt1xx.MT103
;
import
com.prowidesoftware.swift.model.mx.BusinessAppHdrV02
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800108
;
import
com.prowidesoftware.swift.model.mx.dic.BranchAndFinancialInstitutionIdentification6
;
import
com.prowidesoftware.swift.model.mx.dic.FinancialInstitutionIdentification18
;
import
com.prowidesoftware.swift.model.mx.dic.Party44Choice
;
import
org.apache.commons.io.FileUtils
;
import
org.junit.Test
;
import
javax.xml.bind.JAXBContext
;
import
javax.xml.bind.Marshaller
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.IOException
;
public
class
JavaBean2XmlTest
{
@Test
public
void
javaBean2XmlTest
()
throws
Exception
{
JAXBContext
context
=
JAXBContext
.
newInstance
(
MxPacs00800108
.
_classes
);
// 获取上下文对象
Marshaller
marshaller
=
context
.
createMarshaller
();
// 根据上下文获取marshaller对象
marshaller
.
setProperty
(
Marshaller
.
JAXB_ENCODING
,
"UTF-8"
);
// 设置编码字符集
marshaller
.
setProperty
(
Marshaller
.
JAXB_FORMATTED_OUTPUT
,
true
);
// 格式化XML输出,有分行和缩进
MxPacs00800108
mxPacs00800108
=
new
MxPacs00800108
();
BusinessAppHdrV02
businessAppHdrV02
=
new
BusinessAppHdrV02
();
Party44Choice
party44Choice
=
new
Party44Choice
();
BranchAndFinancialInstitutionIdentification6
fiId
=
new
BranchAndFinancialInstitutionIdentification6
();
FinancialInstitutionIdentification18
finInstnId
=
new
FinancialInstitutionIdentification18
();
finInstnId
.
setBICFI
(
"NCBKCNSHXXX"
);
fiId
.
setFinInstnId
(
finInstnId
);
party44Choice
.
setFIId
(
fiId
);
businessAppHdrV02
.
setFr
(
party44Choice
);
mxPacs00800108
.
setAppHdr
(
businessAppHdrV02
);
System
.
out
.
println
(
mxPacs00800108
.
getAppHdr
().
xml
());
marshaller
.
marshal
(
mxPacs00800108
,
System
.
out
);
// 打印到控制台
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
marshaller
.
marshal
(
mxPacs00800108
,
baos
);
String
xmlObj
=
new
String
(
baos
.
toByteArray
());
// 生成XML字符串
// System.out.println(xmlObj);
}
@Test
public
void
test
(){
/* ClearingSystemMemberCode[] values = ClearingSystemMemberCode.values();
for (ClearingSystemMemberCode tmpCode : values) {
System.out.println(tmpCode.value());
System.out.println(tmpCode.desc());
break;
}*/
File
file
=
FileUtils
.
toFile
(
Mx2MtTest
.
class
.
getResource
(
"/swiftTxt/MT103_gcy.txt"
));
try
{
AbstractMT
abstractMT
=
AbstractMT
.
parse
(
file
);
MT103
mt103
=
(
MT103
)
abstractMT
;
System
.
out
.
println
(
abstractMT
.
getMessageType
());
//System.out.println(abstractMT.getField50K().getName());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
swiftCore/src/test/java/com/brilliance/Mt2MxTest.java
View file @
21610024
...
...
@@ -11,6 +11,8 @@ import org.junit.Test;
import
java.io.File
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
public
class
Mt2MxTest
{
...
...
@@ -50,17 +52,55 @@ public class Mt2MxTest {
printSwiftTranslationReport
(
str
);
}
public
String
refreshValue
(
String
value
,
String
continuePattern
,
int
maxLength
)
{
if
(
StringUtil
.
isEmpty
(
value
))
{
return
""
;
}
String
regex
=
"(.*)\\\r\\\n"
+
continuePattern
;
Pattern
p
=
Pattern
.
compile
(
regex
);
Matcher
m
=
p
.
matcher
(
value
);
while
(
m
.
find
())
{
String
findStr
=
m
.
group
(
1
);
if
(
findStr
.
length
()
<
maxLength
)
{
value
=
value
.
replace
(
findStr
,
findStr
+
" "
);
}
}
return
value
;
}
@Test
public
void
testRefreshValue1
()
{
String
tag72
=
"\\abc\r\n\\122\r\n//INSabc"
;
String
s
=
refreshValue
(
tag72
,
"//"
,
35
);
System
.
out
.
println
(
"s====="
+
s
);
}
@Test
public
void
testPacs008001
()
{
test
(
"/swiftTxt/MT103.txt"
,
null
);
}
@Test
public
void
testPacs008001_tag72
()
{
test
(
"/swiftTxt/MT03_tag72.txt"
,
null
);
}
@Test
public
void
testPacs009001
()
{
test
(
"/swiftTxt/MT202.txt"
,
null
);
}
@Test
public
void
testPacs009001_tag72
()
{
test
(
"/swiftTxt/MT202_tag72.txt"
,
null
);
}
@Test
public
void
testPacs009001_tag72_2
()
{
test
(
"/swiftTxt/MT202_tag72_2.txt"
,
null
);
}
@Test
public
void
testCamt052001
()
{
test
(
"/swiftTxt/MT942.txt"
,
null
);
}
...
...
swiftCore/src/test/java/com/brilliance/Mx2MtTest.java
View file @
21610024
...
...
@@ -48,12 +48,24 @@ public class Mx2MtTest {
printSwiftTranslationReport
(
str
);
}
public
void
test_js
(
String
source
,
Map
<
String
,
Object
>
extraMap
)
{
File
file
=
FileUtils
.
toFile
(
Mx2MtTest
.
class
.
getResource
(
source
));
String
dest
=
"d:/123/mt103.txt"
;
SwiftTranslationReport
str
=
SwiftTransfer
.
mx2MtPlus
(
file
,
dest
,
extraMap
);
printSwiftTranslationReport
(
str
);
}
@Test
public
void
test103
()
{
test
(
"/swiftXml/Pacs00800108.xml"
,
null
);
}
@Test
public
void
test103_js
()
{
test_js
(
"/swiftXml/Pacs00800108.xml"
,
null
);
}
@Test
public
void
test103Retn
()
{
test
(
"/swiftXml/MxPacs004001_Pacs008.xml"
,
null
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment