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
87416a0f
Commit
87416a0f
authored
Jul 07, 2022
by
zhanghou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成mt192292,mt196296中文的报文要素展示
parent
6860890b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
239 additions
and
2 deletions
+239
-2
Mx2MapCreatorManager.java
...ava/com/brilliance/swift/mx2map/Mx2MapCreatorManager.java
+8
-1
Mx2MapCamt056Creator.java
...brilliance/swift/mx2map/camt056/Mx2MapCamt056Creator.java
+73
-0
Mx2MapCamt057Creator.java
...brilliance/swift/mx2map/camt057/Mx2MapCamt057Creator.java
+151
-0
Messages_CN.properties
swiftCore/src/main/resources/Messages_CN.properties
+7
-1
No files found.
swiftCore/src/main/java/com/brilliance/swift/mx2map/Mx2MapCreatorManager.java
View file @
87416a0f
package
com
.
brilliance
.
swift
.
mx2map
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2map.camt029.Mx2MapCamt029Creator
;
import
com.brilliance.swift.mx2map.camt053.Mx2MapCamt053Creator
;
import
com.brilliance.swift.mx2map.camt056.Mx2MapCamt056Creator
;
import
com.prowidesoftware.swift.model.mx.AbstractMX
;
import
java.util.Map
;
...
...
@@ -26,7 +28,12 @@ public class Mx2MapCreatorManager {
public
AbstractMx2MapCreator
getCreator
(
String
messageType
)
{
if
(
"camt.053.001"
.
equals
(
messageType
)){
return
new
Mx2MapCamt053Creator
();
}
else
{
}
else
if
(
"camt.029.001"
.
equals
(
messageType
))
{
return
new
Mx2MapCamt029Creator
();
}
else
if
(
"camt.056.001"
.
equals
(
messageType
))
{
return
new
Mx2MapCamt056Creator
();
}
else
{
return
new
DefaultMx2MapCreator
();
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2map/camt056/Mx2MapCamt056Creator.java
0 → 100644
View file @
87416a0f
package
com
.
brilliance
.
swift
.
mx2map
.
camt056
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2map.AbstractMx2MapCreator
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.XmlUtil
;
import
org.dom4j.Document
;
import
org.dom4j.DocumentException
;
import
org.dom4j.DocumentHelper
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
java.util.Map
;
public
class
Mx2MapCamt056Creator
extends
AbstractMx2MapCreator
{
@Override
public
Map
<
String
,
String
>
mx2Map
()
throws
SwiftException
{
try
{
Document
document
=
DocumentHelper
.
parseText
(
xmlStr
);
Map
<
String
,
String
>
parentElementMaps
=
XmlUtil
.
getParentElementMaps
(
document
);
String
appHdrParentElementName
=
parentElementMaps
.
get
(
"AppHdr"
);
String
grpHdrParentElementName
=
parentElementMaps
.
get
(
"GrpHdr"
);
String
bodyParentElementName
=
parentElementMaps
.
get
(
"Undrlyg"
);
String
sendBic
=
abstractMX
.
getAppHdr
().
from
();
maps
.
put
(
getPropertyValue
(
"app.header.sendBic"
),
sendBic
);
String
receiverBic
=
abstractMX
.
getAppHdr
().
to
();
maps
.
put
(
getPropertyValue
(
"app.header.receiverBic"
),
receiverBic
);
String
uetr
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Undrlyg.TxInf.OrgnlUETR"
);
if
(
StringUtil
.
isNotEmpty
(
uetr
)){
maps
.
put
(
getPropertyValue
(
"uetr"
),
uetr
);
}
String
msgDefId
=
abstractMX
.
getAppHdr
().
messageName
();
maps
.
put
(
getPropertyValue
(
"app.header.msgDefId"
),
msgDefId
);
String
bizSvc
=
abstractMX
.
getAppHdr
().
serviceName
();
maps
.
put
(
getPropertyValue
(
"app.header.bizSvc"
),
bizSvc
);
XMLGregorianCalendar
creDt
=
abstractMX
.
getAppHdr
().
creationDate
();
maps
.
put
(
getPropertyValue
(
"app.header.creDt"
),
creDt
.
toXMLFormat
());
String
caseId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Undrlyg.TxInf.Case.Id"
);
if
(
StringUtil
.
isNotEmpty
(
caseId
)){
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"message.id"
),
caseId
);
}
String
id
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Undrlyg.TxInf.OrgnlInstrId"
);
if
(
StringUtil
.
isNotEmpty
(
id
)){
maps
.
put
(
getPropertyValue
(
"endToEnd.id"
),
id
);
}
String
nameId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Undrlyg.TxInf.OrgnlGrpInf.OrgnlMsgNmId"
);
String
dateStr
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".CxlDtls.TxInfAndSts.OrgnlGrpInf.OrgnlCreDtTm"
);
if
(
StringUtil
.
isNotEmpty
(
nameId
)){
maps
.
put
(
getPropertyValue
(
"originalGroupInformation.orgnlMsgId"
),
nameId
);
}
if
(
StringUtil
.
isNotEmpty
(
dateStr
)){
maps
.
put
(
getPropertyValue
(
"originalGroupInformation.orgnlCreDtTm"
),
dateStr
);
}
String
reason
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Undrlyg.TxInf.CxlRsnInf.Rsn.Cd"
);
if
(
StringUtil
.
isNotEmpty
(
reason
)){
maps
.
put
(
getPropertyValue
(
"underlying.transactionInformation.cancellationReasonInformation.reason.cd"
),
reason
);
}
int
count
=
XmlUtil
.
getChildrenCount
(
document
,
bodyParentElementName
+
".Undrlyg.TxInf.CxlRsnInf.AddtlInf"
,
null
);
String
information
=
""
;
if
(
count
>
0
){
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
information
=
information
+
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Undrlyg.TxInf.CxlRsnInf.AddtlInf("
+
i
+
")"
);
}
}
if
(
StringUtil
.
isNotEmpty
(
information
)){
maps
.
put
(
getPropertyValue
(
"underlying.transactionInformation.cancellationReasonInformation.addtlInf"
),
information
);
}
}
catch
(
DocumentException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
return
maps
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2map/camt057/Mx2MapCamt057Creator.java
0 → 100644
View file @
87416a0f
package
com
.
brilliance
.
swift
.
mx2map
.
camt057
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2map.AbstractMx2MapCreator
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.XmlUtil
;
import
org.dom4j.Document
;
import
org.dom4j.DocumentException
;
import
org.dom4j.DocumentHelper
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
java.util.Map
;
public
class
Mx2MapCamt057Creator
extends
AbstractMx2MapCreator
{
@Override
public
Map
<
String
,
String
>
mx2Map
()
throws
SwiftException
{
try
{
Document
document
=
DocumentHelper
.
parseText
(
xmlStr
);
Map
<
String
,
String
>
parentElementMaps
=
XmlUtil
.
getParentElementMaps
(
document
);
String
appHdrParentElementName
=
parentElementMaps
.
get
(
"AppHdr"
);
String
grpHdrParentElementName
=
parentElementMaps
.
get
(
"GrpHdr"
);
String
bodyParentElementName
=
parentElementMaps
.
get
(
"Ntfctn"
);
String
sendBic
=
abstractMX
.
getAppHdr
().
from
();
maps
.
put
(
getPropertyValue
(
"app.header.sendBic"
),
sendBic
);
String
receiverBic
=
abstractMX
.
getAppHdr
().
to
();
maps
.
put
(
getPropertyValue
(
"app.header.receiverBic"
),
receiverBic
);
String
bizMsgId
=
abstractMX
.
getAppHdr
().
reference
();
maps
.
put
(
getPropertyValue
(
"app.header.bizMsgId"
),
bizMsgId
);
String
msgDefId
=
abstractMX
.
getAppHdr
().
messageName
();
maps
.
put
(
getPropertyValue
(
"app.header.msgDefId"
),
msgDefId
);
String
bizSvc
=
abstractMX
.
getAppHdr
().
serviceName
();
maps
.
put
(
getPropertyValue
(
"app.header.bizSvc"
),
bizSvc
);
XMLGregorianCalendar
creDt
=
abstractMX
.
getAppHdr
().
creationDate
();
maps
.
put
(
getPropertyValue
(
"app.header.creDt"
),
creDt
.
toXMLFormat
());
String
accountId
=
""
;
String
iban
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Acct.Id.IBAN"
);
String
id
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Acct.Id.Othr.Id"
);
if
(
StringUtil
.
isNotEmpty
(
iban
)){
accountId
=
iban
;
}
else
if
(
StringUtil
.
isNotEmpty
(
id
)){
accountId
=
id
;
}
else
if
(
StringUtil
.
isEmpty
(
iban
)&&
StringUtil
.
isEmpty
(
id
))
{
String
itemIban
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").Acct.Id.IBAN"
);
String
itemId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").Acct.Id.Othr.Id"
);
if
(
StringUtil
.
isNotEmpty
(
itemIban
))
{
accountId
=
itemIban
;
}
else
if
(
StringUtil
.
isNotEmpty
(
itemId
))
{
accountId
=
itemId
;
}
}
if
(
StringUtil
.
isNotEmpty
(
accountId
)){
maps
.
put
(
getPropertyValue
(
"notification.account.id"
),
accountId
);
}
String
reference
=
""
;
String
endToEndId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").EndToEndId"
);
if
(
StringUtil
.
isNotEmpty
(
endToEndId
)){
reference
=
endToEndId
;
}
else
{
reference
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").Id"
);
}
if
(
StringUtil
.
isNotEmpty
(
reference
)){
maps
.
put
(
getPropertyValue
(
"notification.item.reference"
),
reference
);
}
String
ccy
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").Amt@Ccy"
);
if
(
StringUtil
.
isNotEmpty
(
ccy
))
{
maps
.
put
(
getPropertyValue
(
"notification.amount.ccy"
),
ccy
);
}
String
amt
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").Amt"
);
if
(
StringUtil
.
isNotEmpty
(
amt
))
{
maps
.
put
(
getPropertyValue
(
"notification.amount.amt"
),
amt
);
}
String
valDtStr
=
""
;
String
valDt
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.XpctdValDt"
);
if
(
StringUtil
.
isNotEmpty
(
valDt
)){
valDtStr
=
valDt
;
}
else
{
valDtStr
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").XpctdValDt"
);
}
if
(
StringUtil
.
isNotEmpty
(
valDtStr
)){
maps
.
put
(
getPropertyValue
(
"notification.xpctdValDt"
),
valDtStr
);
}
int
count1
=
XmlUtil
.
getChildrenCount
(
document
,
bodyParentElementName
+
".Ntfctn.Dbtr.Pty"
,
null
);
int
count2
=
XmlUtil
.
getChildrenCount
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").Dbtr.Pty"
,
null
);
int
count3
=
XmlUtil
.
getChildrenCount
(
document
,
bodyParentElementName
+
".Ntfctn.Dbtr.Agt"
,
null
);
int
count4
=
XmlUtil
.
getChildrenCount
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").Dbtr.Agt"
,
null
);
String
bicCode
=
""
;
String
country
=
""
;
int
addressLineCount
=
0
;
String
name
=
""
;
String
clearingSystemCode
=
""
;
String
ClearingSystemId
=
""
;
if
(
count1
>
0
){
bicCode
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Dbtr.Pty.Id.OrgId.AnyBIC"
);
country
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Dbtr.Pty.PstlAdr.Ctry"
);
addressLineCount
=
XmlUtil
.
getChildrenCount
(
document
,
bodyParentElementName
+
".Ntfctn.Dbtr.Pty.PstlAdr.AdrLine"
,
null
);
name
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Dbtr.Pty.Nm"
);
}
if
(
count2
>
0
){
bicCode
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").Dbtr.Pty.Id.OrgId.AnyBIC"
);
country
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").Dbtr.Pty.PstlAdr.Ctry"
);
addressLineCount
=
XmlUtil
.
getChildrenCount
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").Dbtr.Pty.PstlAdr.AdrLine"
,
null
);
name
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").Dbtr.Pty.Nm"
);
}
if
(
count3
>
0
){
bicCode
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Dbtr.Agt.Id.OrgId.AnyBIC"
);
country
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Dbtr.Agt.FinInstnId.PstlAdr.Ctry"
);
addressLineCount
=
XmlUtil
.
getChildrenCount
(
document
,
bodyParentElementName
+
".Ntfctn.Dbtr.Agt.FinInstnId.PstlAdr.AdrLine"
,
null
);
name
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Dbtr.Agt.FinInstnId.Nm"
);
clearingSystemCode
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
"..Ntfctn.Dbtr.Agt.FinInstnId.ClrSysMmbId.ClrSysId.Cd"
);
ClearingSystemId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
"..Ntfctn.Dbtr.Agt.FinInstnId.ClrSysMmbId.MmbId"
);
}
if
(
count4
>
0
){
bicCode
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
"..Ntfctn.Itm("
+
0
+
").Dbtr.Agt.Id.OrgId.AnyBIC"
);
country
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").Dbtr.Agt.FinInstnId.PstlAdr.Ctry"
);
addressLineCount
=
XmlUtil
.
getChildrenCount
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").Dbtr.Agt.FinInstnId.PstlAdr.AdrLine"
,
null
);
name
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").Dbtr.Agt.FinInstnId.Nm"
);
clearingSystemCode
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").Dbtr.Agt.FinInstnId.ClrSysMmbId.ClrSysId.Cd"
);
ClearingSystemId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").Dbtr.Agt.FinInstnId.ClrSysMmbId.MmbId"
);
}
String
address
=
""
;
for
(
int
i
=
0
;
i
<
addressLineCount
;
i
++)
{
if
(
i
!=
1
||
i
!=
addressLineCount
-
1
){
address
=
address
+
","
;
}
address
=
address
+
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").Dbtr.Agt.FinInstnId.PstlAdr.AdrLine("
+
i
+
")"
);
}
if
(
StringUtil
.
isNotEmpty
(
bicCode
)){
maps
.
put
(
getPropertyValue
(
"notification.debtor.party.identification.organisationIdentification.anyBIC"
),
bicCode
);
}
if
(
StringUtil
.
isNotEmpty
(
country
)){
maps
.
put
(
getPropertyValue
(
"notification.debtor.party.postalAddress.ctry"
),
country
);
}
if
(
StringUtil
.
isNotEmpty
(
address
)){
maps
.
put
(
getPropertyValue
(
"notification.debtor.party.postalAddress.adrLine"
),
address
);
}
if
(
StringUtil
.
isNotEmpty
(
name
)){
maps
.
put
(
getPropertyValue
(
"notification.debtor.party.nm"
),
name
);
}
if
(
StringUtil
.
isNotEmpty
(
clearingSystemCode
)){
maps
.
put
(
getPropertyValue
(
"notification.debtor.agent.financialInstitutionIdentification.clearingSystemMemberIdentification.clearingSystemIdentification.cd"
),
clearingSystemCode
);
}
if
(
StringUtil
.
isNotEmpty
(
ClearingSystemId
)){
maps
.
put
(
getPropertyValue
(
"notification.debtor.agent.financialInstitutionIdentification.clearingSystemMemberIdentification.mmbId"
),
ClearingSystemId
);
}
}
catch
(
DocumentException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
return
maps
;
}
}
swiftCore/src/main/resources/Messages_CN.properties
View file @
87416a0f
...
...
@@ -25,8 +25,14 @@ statement.entry.crdr=\u5bf9\u8d26\u5355\u501f\u8d37\u6807\u8bc6
statement.entry.ccy
=
\u
5bf9
\u
8d26
\u5355\u
5e01
\u
79cd
statement.entry.amt
=
\u
5bf9
\u
8d26
\u5355\u
91d1
\u
989d
statement.entry.endToEndId
=
\u
5bf9
\u
8d26
\u5355\u
76f8
\u5173\u
4ea4
\u6613\u6807\u
8bc6
originalGroupInformation.orgnlMsgId
=
\u
539f
\u
59cb
\u
4ea4
\u6613\u
540d
\u
79f0
originalGroupInformation.orgnlCreDtTm
=
\u
539f
\u
59cb
\u
4ea4
\u6613\u
521b
\u
5efa
\u
65f6
\u
95f4
cancellationDetails.transactionInformationAndStatus.cancellationStatusReasonInformation.reason.cd
=
\u
4ea4
\u6613\u
64a4
\u9500\u
8bf7
\u
6c42
\u
54cd
\u
5e94
\u
4ee3
\u7801
cancellationDetails.transactionInformationAndStatus.cancellationStatusReasonInformation.addtlInf
=
\u
4ea4
\u6613\u
64a4
\u9500\u
8bf7
\u
6c42
\u
54cd
\u
5e94
\u
8be6
\u
60c5
underlying.transactionInformation.cancellationReasonInformation.reason.cd
=
\u
4ea4
\u6613\u
64a4
\u9500\u
8bf7
\u
6c42
\u
4ee3
\u7801
underlying.transactionInformation.cancellationReasonInformation.addtlInf
=
\u
4ea4
\u6613\u
64a4
\u9500\u
8bf7
\u
6c42
\u
8be6
\u
60c5
#
message.id
=
\u
4e1a
\u
52a1
\u
7f16
\u
53f7
endToEnd.id
=
\u
7
aef
\u5230\u
7aef
\u6807\u
8bc6
endToEnd.id
=
\u
7
6f8
\u5173\u
4e1a
\u
52a1
\u
7f16
\u
53f7
uetr
=
UETR
\u6807\u
8bc6
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