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
840937a0
Commit
840937a0
authored
Sep 30, 2022
by
chengzhuoshen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重写MX报文要素展示功能,支持国际化
parent
599bbbed
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
535 additions
and
1065 deletions
+535
-1065
SwiftTransfer.java
...ore/src/main/java/com/brilliance/swift/SwiftTransfer.java
+34
-16
Mx2ElementCreatorManager.java
...brilliance/swift/mx2element/Mx2ElementCreatorManager.java
+40
-0
AbstractMx2MapCreator.java
...va/com/brilliance/swift/mx2map/AbstractMx2MapCreator.java
+70
-169
DefaultMx2MapCreator.java
...ava/com/brilliance/swift/mx2map/DefaultMx2MapCreator.java
+0
-87
Mx2MapCreator.java
.../main/java/com/brilliance/swift/mx2map/Mx2MapCreator.java
+1
-1
Mx2MapCreatorManager.java
...ava/com/brilliance/swift/mx2map/Mx2MapCreatorManager.java
+31
-4
Mx2MapCamt029Creator.java
...brilliance/swift/mx2map/camt029/Mx2MapCamt029Creator.java
+0
-73
Mx2MapCamt052Creator.java
...brilliance/swift/mx2map/camt052/Mx2MapCamt052Creator.java
+0
-121
Mx2MapCamt053Creator.java
...brilliance/swift/mx2map/camt053/Mx2MapCamt053Creator.java
+117
-108
Mx2MapCamt056Creator.java
...brilliance/swift/mx2map/camt056/Mx2MapCamt056Creator.java
+0
-73
Mx2MapCamt057Creator.java
...brilliance/swift/mx2map/camt057/Mx2MapCamt057Creator.java
+0
-265
Mx2MapPacs008Creator.java
...brilliance/swift/mx2map/pacs008/Mx2MapPacs008Creator.java
+101
-60
AbstractMx2MtCreator.java
...java/com/brilliance/swift/mx2mt/AbstractMx2MtCreator.java
+4
-0
Field77BGenerate.java
...m/brilliance/swift/mx2mt/mt103/impl/Field77BGenerate.java
+5
-1
Messages_CN.properties
swiftCore/src/main/resources/Messages_CN.properties
+62
-81
Messages_US.properties
swiftCore/src/main/resources/Messages_US.properties
+54
-2
entry.properties
swiftCore/src/main/resources/template/entry.properties
+5
-4
Mx2ElementTest.java
swiftCore/src/test/java/com/brilliance/Mx2ElementTest.java
+11
-0
No files found.
swiftCore/src/main/java/com/brilliance/swift/SwiftTransfer.java
View file @
840937a0
...
@@ -23,6 +23,7 @@ import java.io.File;
...
@@ -23,6 +23,7 @@ import java.io.File;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.Optional
;
import
java.util.Set
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
...
@@ -203,28 +204,41 @@ public class SwiftTransfer {
...
@@ -203,28 +204,41 @@ public class SwiftTransfer {
}
}
}
}
/**
/**
*
将MX xml转换成Map<String, String>
*
展示MX报文要素
* @param xmlStr
* @param xmlStr
* @return
* @return
*/
*/
public
static
Map
<
String
,
String
>
mx2Map
(
String
xmlStr
)
{
public
static
String
showMxElement
(
String
xmlStr
,
String
localCode
)
{
if
(
StringUtil
.
isEmpty
(
xmlStr
))
return
null
;
String
mxElementStr
=
""
;
return
new
Mx2MapCreatorManager
().
mx2Map
(
xmlStr
);
Map
<
String
,
Object
>
maps
=
mx2Map
(
xmlStr
,
localCode
);
}
if
(
maps
.
size
()
>
0
)
{
Set
<
String
>
keys
=
maps
.
keySet
();
public
static
Map
<
String
,
String
>
mx2Map
(
String
xmlFilePath
,
boolean
filePathFlag
)
{
for
(
String
key
:
keys
)
{
try
{
if
(
maps
.
get
(
key
)
instanceof
Map
)
{
if
(
filePathFlag
)
{
mxElementStr
+=
Mx2MtConstants
.
NEW_LINE
;
File
file
=
new
File
(
xmlFilePath
);
mxElementStr
+=
key
+
":"
+
Mx2MtConstants
.
NEW_LINE
;
String
mxStr
=
FileUtils
.
readFileToString
(
file
);
Map
<
String
,
Object
>
newMaps
=
(
Map
<
String
,
Object
>)
maps
.
get
(
key
);
return
mx2Map
(
mxStr
);
for
(
String
tmpKey
:
newMaps
.
keySet
())
{
}
else
{
mxElementStr
+=
tmpKey
+
":"
+
newMaps
.
get
(
tmpKey
)
+
Mx2MtConstants
.
NEW_LINE
;
return
mx2Map
(
xmlFilePath
);
}
}
else
{
mxElementStr
+=
key
+
":"
+
maps
.
get
(
key
)
+
Mx2MtConstants
.
NEW_LINE
;
}
}
}
}
catch
(
IOException
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
return
mxElementStr
;
}
/**
* 将MX xml转换成Map<String, String>
* 支持国际化 US CN
* @param xmlStr
* @return
*/
public
static
Map
<
String
,
Object
>
mx2Map
(
String
xmlStr
,
String
localCode
)
{
if
(
StringUtil
.
isEmpty
(
xmlStr
))
return
null
;
return
new
Mx2MapCreatorManager
().
mx2Map
(
xmlStr
,
localCode
);
}
}
public
static
boolean
validateMx
(
String
xmlFilePath
,
boolean
filePathFlag
)
{
public
static
boolean
validateMx
(
String
xmlFilePath
,
boolean
filePathFlag
)
{
...
@@ -321,6 +335,10 @@ public class SwiftTransfer {
...
@@ -321,6 +335,10 @@ public class SwiftTransfer {
}
}
}
}
public
static
Map
<
String
,
Object
>
mx2ElementMaps
(
String
xmlStr
)
{
return
new
Mx2ElementCreatorManager
().
mx2ElementMaps
(
xmlStr
);
}
/**
/**
* 从混合格式(MXMT)的报文中提取MX报文
* 从混合格式(MXMT)的报文中提取MX报文
* @param mixStr
* @param mixStr
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2element/Mx2ElementCreatorManager.java
View file @
840937a0
package
com
.
brilliance
.
swift
.
mx2element
;
package
com
.
brilliance
.
swift
.
mx2element
;
import
com.brilliance.swift.SwiftTransfer
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2element.camt029001.Mx2ElementCamt029001Creator
;
import
com.brilliance.swift.mx2element.camt029001.Mx2ElementCamt029001Creator
;
import
com.brilliance.swift.mx2element.camt053001.Mx2ElementCamt053001Creator
;
import
com.brilliance.swift.mx2element.camt053001.Mx2ElementCamt053001Creator
;
...
@@ -11,12 +12,15 @@ import com.google.gson.Gson;
...
@@ -11,12 +12,15 @@ import com.google.gson.Gson;
import
com.google.gson.GsonBuilder
;
import
com.google.gson.GsonBuilder
;
import
com.prowidesoftware.swift.model.mx.AbstractMX
;
import
com.prowidesoftware.swift.model.mx.AbstractMX
;
import
javax.xml.parsers.DocumentBuilder
;
import
javax.xml.parsers.DocumentBuilderFactory
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.Map
;
public
class
Mx2ElementCreatorManager
{
public
class
Mx2ElementCreatorManager
{
public
String
mx2Element
(
String
xmlStr
)
throws
SwiftException
{
public
String
mx2Element
(
String
xmlStr
)
throws
SwiftException
{
xmlStr
=
handlingXml
(
xmlStr
);
AbstractMX
abstractMX
=
AbstractMX
.
parse
(
xmlStr
);
AbstractMX
abstractMX
=
AbstractMX
.
parse
(
xmlStr
);
String
messageType
=
(
abstractMX
.
getMxId
().
getBusinessProcess
().
name
()
String
messageType
=
(
abstractMX
.
getMxId
().
getBusinessProcess
().
name
()
+
"."
+
"."
...
@@ -33,6 +37,22 @@ public class Mx2ElementCreatorManager {
...
@@ -33,6 +37,22 @@ public class Mx2ElementCreatorManager {
return
gson
.
toJson
(
maps
,
LinkedHashMap
.
class
);
return
gson
.
toJson
(
maps
,
LinkedHashMap
.
class
);
}
}
public
Map
<
String
,
Object
>
mx2ElementMaps
(
String
xmlStr
)
throws
SwiftException
{
xmlStr
=
handlingXml
(
xmlStr
);
AbstractMX
abstractMX
=
AbstractMX
.
parse
(
xmlStr
);
String
messageType
=
(
abstractMX
.
getMxId
().
getBusinessProcess
().
name
()
+
"."
+
abstractMX
.
getMxId
().
getFunctionality
()
+
"."
+
abstractMX
.
getMxId
().
getVariant
())
//+ abstractMX.getMxId().getVersion())
.
trim
();
AbstractMx2ElementCreator
creator
=
getCreator
(
messageType
);
creator
.
setAbstractMX
(
abstractMX
);
creator
.
setXmlStr
(
xmlStr
);
return
creator
.
buildElement
();
}
public
AbstractMx2ElementCreator
getCreator
(
String
messageType
)
{
public
AbstractMx2ElementCreator
getCreator
(
String
messageType
)
{
if
(
"pacs.008.001"
.
equals
(
messageType
))
{
if
(
"pacs.008.001"
.
equals
(
messageType
))
{
return
new
Mx2ElementPacs008001Creator
();
return
new
Mx2ElementPacs008001Creator
();
...
@@ -50,4 +70,24 @@ public class Mx2ElementCreatorManager {
...
@@ -50,4 +70,24 @@ public class Mx2ElementCreatorManager {
return
new
Mx2ElementDefaultCreator
();
return
new
Mx2ElementDefaultCreator
();
}
}
}
}
/**
* 如果传入的xml 没有报文头,导致dom4j无法解析
* 提取xml里面的AppHdr和Document,重新组装成有效的xml报文
*/
private
String
handlingXml
(
String
xmlStr
)
{
boolean
flag
=
true
;
try
{
DocumentBuilderFactory
documentBuilderFactory
=
DocumentBuilderFactory
.
newInstance
();
DocumentBuilder
documentBuilder
=
documentBuilderFactory
.
newDocumentBuilder
();
documentBuilder
.
parse
(
xmlStr
);
}
catch
(
Exception
e
)
{
flag
=
false
;
}
if
(
flag
)
{
//如果是有效xml报文,直接返回
return
xmlStr
;
}
else
{
return
SwiftTransfer
.
fetchXmlFromMixMessage
(
xmlStr
);
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2map/AbstractMx2MapCreator.java
View file @
840937a0
package
com
.
brilliance
.
swift
.
mx2map
;
package
com
.
brilliance
.
swift
.
mx2map
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.util.MessageUtil
;
import
com.brilliance.swift.util.MessageUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.StringUtil
;
...
@@ -15,13 +16,9 @@ public abstract class AbstractMx2MapCreator implements Mx2MapCreator{
...
@@ -15,13 +16,9 @@ public abstract class AbstractMx2MapCreator implements Mx2MapCreator{
protected
String
xmlStr
;
protected
String
xmlStr
;
protected
AbstractMX
abstractMX
;
protected
String
localCode
;
protected
String
localCode
;
protected
Document
document
;
protected
Map
<
String
,
Object
>
maps
=
new
LinkedHashMap
<>();
protected
Map
<
String
,
String
>
maps
=
new
LinkedHashMap
<>();
public
String
getXmlStr
()
{
public
String
getXmlStr
()
{
return
xmlStr
;
return
xmlStr
;
...
@@ -31,14 +28,6 @@ public abstract class AbstractMx2MapCreator implements Mx2MapCreator{
...
@@ -31,14 +28,6 @@ public abstract class AbstractMx2MapCreator implements Mx2MapCreator{
this
.
xmlStr
=
xmlStr
;
this
.
xmlStr
=
xmlStr
;
}
}
public
AbstractMX
getAbstractMX
()
{
return
abstractMX
;
}
public
void
setAbstractMX
(
AbstractMX
abstractMX
)
{
this
.
abstractMX
=
abstractMX
;
}
public
String
getLocalCode
()
{
public
String
getLocalCode
()
{
return
localCode
;
return
localCode
;
}
}
...
@@ -47,178 +36,90 @@ public abstract class AbstractMx2MapCreator implements Mx2MapCreator{
...
@@ -47,178 +36,90 @@ public abstract class AbstractMx2MapCreator implements Mx2MapCreator{
this
.
localCode
=
localCode
;
this
.
localCode
=
localCode
;
}
}
public
Document
getDocument
()
{
return
document
;
}
public
void
setDocument
(
Document
document
)
{
this
.
document
=
document
;
}
protected
String
getPropertyValue
(
String
key
)
{
protected
String
getPropertyValue
(
String
key
)
{
return
MessageUtil
.
getPropertyValue
(
localCode
,
key
);
return
MessageUtil
.
getPropertyValue
(
localCode
,
key
);
}
}
protected
void
buildCommonHeader
(
String
uetr
)
{
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
());
if
(
StringUtil
.
isNotEmpty
(
uetr
))
{
maps
.
put
(
getPropertyValue
(
"uetr"
),
uetr
);
}
}
/**
/**
* 组装party信息
* 组装party信息
* @param name 表示party的名字
* @param name 表示party的名字
* @param
path 表示party的xml路径
* @param
elementMaps 平铺要素MAP
*/
*/
protected
void
buildPartyInfo
(
String
name
,
String
path
)
{
protected
void
buildPartyInfo
(
String
name
,
Map
<
String
,
Object
>
elementMaps
)
{
int
count
=
XmlUtil
.
getChildrenCount
(
document
,
path
,
null
);
String
[]
keys
=
new
String
[]{
name
+
"AcctIdIban"
,
name
+
"AcctId"
,
name
+
"Nm"
,
name
+
"OrgAnyBIC"
,
if
(
count
<=
0
)
return
;
name
+
"PstlAdrCtry"
,
name
+
"PstlAdrDept"
,
name
+
"PstlAdrSubDept"
,
maps
.
put
(
getPropertyValue
(
name
),
Mx2MtConstants
.
NEW_LINE
+
"\t"
);
name
+
"PstlAdrStrtNm"
,
name
+
"PstlAdrBldgNb"
,
name
+
"PstlAdrBldgNm"
,
String
partyName
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".Nm"
);
name
+
"PstlAdrFlr"
,
name
+
"PstlAdrRoom"
,
name
+
"PstlAdrTwnNm"
,
if
(
StringUtil
.
isNotEmpty
(
partyName
))
{
name
+
"PstlAdrPstBx"
,
name
+
"PstlAdrPstCd"
,
name
+
"PstlAdrCtrySubDvsn"
,
maps
.
put
(
getPropertyValue
(
"name"
),
partyName
);
name
+
"PstlAdrDstrctNm"
,
name
+
"PstlAdrTwnLctnNm"
,
name
+
"AdrLines"
}
};
String
orgBicCode
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".Id.OrgId.AnyBIC"
);
boolean
existFlag
=
false
;
if
(
StringUtil
.
isNotEmpty
(
orgBicCode
))
{
for
(
String
key
:
keys
)
{
maps
.
put
(
getPropertyValue
(
"organisation.bic"
),
orgBicCode
);
if
(
elementMaps
.
get
(
key
)
!=
null
)
{
}
existFlag
=
true
;
String
orgLei
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".Id.OrgId.LEI"
);
break
;
if
(
StringUtil
.
isNotEmpty
(
orgLei
))
{
}
maps
.
put
(
getPropertyValue
(
"organisation.lei"
),
orgLei
);
}
String
orgOtherCode
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".Id.OrgId.Othr.SchmeNm.Cd"
);
if
(
StringUtil
.
isNotEmpty
(
orgOtherCode
))
{
maps
.
put
(
getPropertyValue
(
"organisation.other.code"
),
orgOtherCode
);
}
String
orgOtherId
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".Id.OrgId.Othr.Id"
);
if
(
StringUtil
.
isNotEmpty
(
orgOtherId
))
{
maps
.
put
(
getPropertyValue
(
"organisation.other.id"
),
orgOtherId
);
}
String
prvtBrithDate
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".Id.PrvtId.DtAndPlcOfBirth.BirthDt"
);
if
(
StringUtil
.
isNotEmpty
(
prvtBrithDate
))
{
maps
.
put
(
getPropertyValue
(
"private.brith.date"
),
prvtBrithDate
);
}
String
prvtBrithCountry
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".Id.PrvtId.DtAndPlcOfBirth.CtryOfBirth"
);
if
(
StringUtil
.
isNotEmpty
(
prvtBrithCountry
))
{
maps
.
put
(
getPropertyValue
(
"private.brith.country"
),
prvtBrithCountry
);
}
String
prvtBrithProvince
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".Id.PrvtId.DtAndPlcOfBirth.PrvcOfBirth"
);
if
(
StringUtil
.
isNotEmpty
(
prvtBrithProvince
))
{
maps
.
put
(
getPropertyValue
(
"private.brith.province"
),
prvtBrithProvince
);
}
String
prvtBrithCity
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".Id.PrvtId.DtAndPlcOfBirth.CityOfBirth"
);
if
(
StringUtil
.
isNotEmpty
(
prvtBrithCity
))
{
maps
.
put
(
getPropertyValue
(
"private.brith.city"
),
prvtBrithCity
);
}
String
prvtOtherCode
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".Id/PrvtId/Othr/SchmeNm/Cd"
);
if
(
StringUtil
.
isNotEmpty
(
prvtOtherCode
))
{
maps
.
put
(
getPropertyValue
(
"private.other.code"
),
prvtOtherCode
);
}
String
prvtOtherId
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".Id.PrvtId.Othr.Id"
);
if
(
StringUtil
.
isNotEmpty
(
prvtOtherId
))
{
maps
.
put
(
getPropertyValue
(
"private.other.id"
),
prvtOtherId
);
}
String
phoneNumber
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".CtctDtls.PhneNb"
);
if
(
StringUtil
.
isNotEmpty
(
phoneNumber
))
{
maps
.
put
(
getPropertyValue
(
"phone.number"
),
phoneNumber
);
}
String
mobileNumber
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".CtctDtls.MobNb"
);
if
(
StringUtil
.
isNotEmpty
(
mobileNumber
))
{
maps
.
put
(
getPropertyValue
(
"mobile.number"
),
mobileNumber
);
}
String
faxNumber
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".CtctDtls.FaxNb"
);
if
(
StringUtil
.
isNotEmpty
(
faxNumber
))
{
maps
.
put
(
getPropertyValue
(
"fax.number"
),
faxNumber
);
}
String
emailAddress
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".CtctDtls.EmailAdr"
);
if
(
StringUtil
.
isNotEmpty
(
emailAddress
))
{
maps
.
put
(
getPropertyValue
(
"email.number"
),
emailAddress
);
}
String
contactOtherType
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".CtctDtls.Othr.ChanlTp"
);
if
(
StringUtil
.
isNotEmpty
(
contactOtherType
))
{
maps
.
put
(
getPropertyValue
(
"contact.other.type"
),
contactOtherType
);
}
}
String
contactOtherId
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".CtctDtls.Othr.Id"
);
if
(
existFlag
)
{
if
(
StringUtil
.
isNotEmpty
(
contactOtherId
))
{
Map
<
String
,
Object
>
newMaps
=
new
LinkedHashMap
<>();
maps
.
put
(
getPropertyValue
(
"contact.other.id"
),
contactOtherId
);
maps
.
put
(
getPropertyValue
(
name
+
"Info"
),
newMaps
);
for
(
String
key
:
keys
)
{
if
(
elementMaps
.
get
(
key
)
!=
null
)
{
Object
obj
=
elementMaps
.
get
(
key
);
String
suffixKey
=
key
.
substring
(
key
.
indexOf
(
name
)
+
name
.
length
());
if
(
obj
instanceof
String
)
{
newMaps
.
put
(
getPropertyValue
(
suffixKey
.
substring
(
0
,
1
).
toLowerCase
()
+
suffixKey
.
substring
(
1
)),
obj
);
}
else
if
(
obj
instanceof
JSONArray
)
{
JSONArray
jsonArray
=
(
JSONArray
)
obj
;
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
Object
object
=
jsonArray
.
get
(
i
);
newMaps
.
put
(
getPropertyValue
(
suffixKey
.
substring
(
0
,
1
).
toLowerCase
()
+
suffixKey
.
substring
(
1
))
+
"("
+(
i
+
1
)
+
")"
,
object
);
}
}
}
}
}
}
buildAddressInfo
(
path
+
".PstlAdr"
);
}
}
/**
/**
* 组装address信息
* 组装Agent信息
* @param path 表示address的xml路径
* @param name 表示Agent的名字
* @param elementMaps 平铺要素MAP
*/
*/
protected
void
buildAddressInfo
(
String
path
)
{
protected
void
buildAgentInfo
(
String
name
,
Map
<
String
,
Object
>
elementMaps
)
{
String
addressType
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".AdrTp.Cd"
);
String
[]
keys
=
new
String
[]{
name
+
"AcctIdIban"
,
name
+
"AcctId"
,
name
+
"Bicfi"
,
if
(
StringUtil
.
isNotEmpty
(
addressType
))
{
name
+
"Nm"
,
name
+
"ClrSysIdType"
,
name
+
"ClrSysId"
,
maps
.
put
(
getPropertyValue
(
"address.type"
),
addressType
);
name
+
"PstlAdrCtry"
,
name
+
"PstlAdrDept"
,
name
+
"PstlAdrSubDept"
,
}
name
+
"PstlAdrStrtNm"
,
name
+
"PstlAdrBldgNb"
,
name
+
"PstlAdrBldgNm"
,
String
addressCountry
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".Ctry"
);
name
+
"PstlAdrFlr"
,
name
+
"PstlAdrRoom"
,
name
+
"PstlAdrTwnNm"
,
if
(
StringUtil
.
isNotEmpty
(
addressCountry
))
{
name
+
"PstlAdrPstBx"
,
name
+
"PstlAdrPstCd"
,
name
+
"PstlAdrCtrySubDvsn"
,
maps
.
put
(
getPropertyValue
(
"address.country"
),
addressCountry
);
name
+
"PstlAdrDstrctNm"
,
name
+
"PstlAdrTwnLctnNm"
,
name
+
"AdrLines"
}
};
String
addressDepartment
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".Dept"
);
boolean
existFlag
=
false
;
if
(
StringUtil
.
isNotEmpty
(
addressDepartment
))
{
for
(
String
key
:
keys
)
{
maps
.
put
(
getPropertyValue
(
"address.department"
),
addressDepartment
);
if
(
elementMaps
.
get
(
key
)
!=
null
)
{
}
existFlag
=
true
;
String
addressSubDepartment
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".SubDept"
);
break
;
if
(
StringUtil
.
isNotEmpty
(
addressSubDepartment
))
{
maps
.
put
(
getPropertyValue
(
"address.sub.department"
),
addressSubDepartment
);
}
String
addressTownName
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".TwnNm"
);
if
(
StringUtil
.
isNotEmpty
(
addressTownName
))
{
maps
.
put
(
getPropertyValue
(
"address.town.name"
),
addressTownName
);
}
String
addressStreetName
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".StrtNm"
);
if
(
StringUtil
.
isNotEmpty
(
addressStreetName
))
{
maps
.
put
(
getPropertyValue
(
"address.street.name"
),
addressStreetName
);
}
String
addressBuildingName
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".BldgNm"
);
if
(
StringUtil
.
isNotEmpty
(
addressBuildingName
))
{
maps
.
put
(
getPropertyValue
(
"address.building.name"
),
addressBuildingName
);
}
String
addressBuildingNumber
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".BldgNb"
);
if
(
StringUtil
.
isNotEmpty
(
addressBuildingNumber
))
{
maps
.
put
(
getPropertyValue
(
"address.building.number"
),
addressBuildingNumber
);
}
String
addressFloor
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".Flr"
);
if
(
StringUtil
.
isNotEmpty
(
addressFloor
))
{
maps
.
put
(
getPropertyValue
(
"address.floor"
),
addressFloor
);
}
String
addressRoom
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".Room"
);
if
(
StringUtil
.
isNotEmpty
(
addressRoom
))
{
maps
.
put
(
getPropertyValue
(
"address.room"
),
addressRoom
);
}
String
addressPostCode
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".PstCd"
);
if
(
StringUtil
.
isNotEmpty
(
addressPostCode
))
{
maps
.
put
(
getPropertyValue
(
"address.post.code"
),
addressPostCode
);
}
String
addressPostBox
=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".PstBx"
);
if
(
StringUtil
.
isNotEmpty
(
addressPostBox
))
{
maps
.
put
(
getPropertyValue
(
"address.post.box"
),
addressPostBox
);
}
String
addressLine
=
""
;
int
addressLineCount
=
XmlUtil
.
getChildrenCount
(
document
,
path
+
".AdrLine"
,
null
);
if
(
addressLineCount
>
0
)
{
for
(
int
i
=
0
;
i
<
addressLineCount
;
i
++)
{
addressLine
+=
XmlUtil
.
getXmlNodeValue
(
document
,
path
+
".AdrLine("
+
i
+
")"
);
}
}
}
}
if
(
StringUtil
.
isNotEmpty
(
addressLine
))
{
if
(
existFlag
)
{
maps
.
put
(
getPropertyValue
(
"address.line"
),
addressLine
);
Map
<
String
,
Object
>
newMaps
=
new
LinkedHashMap
<>();
maps
.
put
(
getPropertyValue
(
name
+
"Info"
),
newMaps
);
for
(
String
key
:
keys
)
{
if
(
elementMaps
.
get
(
key
)
!=
null
)
{
Object
obj
=
elementMaps
.
get
(
key
);
String
suffixKey
=
key
.
substring
(
key
.
indexOf
(
name
)
+
name
.
length
());
if
(
obj
instanceof
String
)
{
newMaps
.
put
(
getPropertyValue
(
suffixKey
.
substring
(
0
,
1
).
toLowerCase
()
+
suffixKey
.
substring
(
1
)),
obj
);
}
else
if
(
obj
instanceof
JSONArray
)
{
JSONArray
jsonArray
=
(
JSONArray
)
obj
;
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
Object
object
=
jsonArray
.
get
(
i
);
newMaps
.
put
(
getPropertyValue
(
suffixKey
.
substring
(
0
,
1
).
toLowerCase
()
+
suffixKey
.
substring
(
1
))
+
"("
+(
i
+
1
)
+
")"
,
object
);
}
}
}
}
}
}
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2map/DefaultMx2MapCreator.java
deleted
100644 → 0
View file @
599bbbed
package
com
.
brilliance
.
swift
.
mx2map
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.util.StringUtil
;
import
java.util.Map
;
import
java.util.Set
;
public
class
DefaultMx2MapCreator
extends
AbstractMx2MapCreator
{
@Override
public
Map
<
String
,
String
>
mx2Map
()
throws
SwiftException
{
String
gsonStr
=
abstractMX
.
toJson
();
Map
<
String
,
Object
>
mxGsonMaps
=
JSON
.
parseObject
(
gsonStr
);
parseMxGsonMap
(
maps
,
mxGsonMaps
,
null
);
return
maps
;
}
/**
* 把mxGsonMaps解析成Map<String, String>,回调函数然后拼接前缀
* @param maps
* @param mxGsonMaps
* @param prefix
*/
public
void
parseMxGsonMap
(
Map
<
String
,
String
>
maps
,
Map
<
String
,
Object
>
mxGsonMaps
,
String
prefix
)
{
Set
<
String
>
keys
=
mxGsonMaps
.
keySet
();
for
(
String
key
:
keys
)
{
Object
object
=
(
Object
)
mxGsonMaps
.
get
(
key
);
if
(
object
==
null
)
continue
;
if
(
object
instanceof
JSONArray
)
{
if
(
StringUtil
.
isEmpty
(
prefix
))
{
parseMxGsonArray
(
maps
,
(
JSONArray
)
object
,
key
);
}
else
{
parseMxGsonArray
(
maps
,
(
JSONArray
)
object
,
prefix
+
"."
+
key
);
}
}
else
if
(
object
instanceof
JSONObject
)
{
if
(
StringUtil
.
isEmpty
(
prefix
))
{
parseMxGsonMap
(
maps
,
(
Map
<
String
,
Object
>)
object
,
key
);
}
else
{
parseMxGsonMap
(
maps
,
(
Map
<
String
,
Object
>)
object
,
prefix
+
"."
+
key
);
}
}
else
{
if
(
StringUtil
.
isEmpty
(
prefix
))
{
maps
.
put
(
key
,
String
.
valueOf
(
object
));
}
else
{
maps
.
put
(
prefix
+
"."
+
key
,
String
.
valueOf
(
object
));
}
}
}
}
/**
* jsonArray 是json数组格式 回调函数
* 如果长度只有1,那么就不需要下标
* 否则需要下标(0) (1) (2) (3)
* @param maps
* @param jsonArray
* @param prefix
*/
public
void
parseMxGsonArray
(
Map
<
String
,
String
>
maps
,
JSONArray
jsonArray
,
String
prefix
)
{
Object
[]
jsonArrays
=
jsonArray
.
toArray
();
if
(
jsonArrays
.
length
==
1
)
{
Object
object
=
jsonArrays
[
0
];
if
(
object
instanceof
JSONArray
)
{
parseMxGsonArray
(
maps
,
(
JSONArray
)
object
,
prefix
);
}
else
if
(
object
instanceof
JSONObject
)
{
parseMxGsonMap
(
maps
,
(
Map
<
String
,
Object
>)
object
,
prefix
);
}
else
{
maps
.
put
(
prefix
,
String
.
valueOf
(
object
));
}
}
else
{
for
(
int
i
=
0
;
i
<
jsonArrays
.
length
;
i
++)
{
Object
object
=
jsonArrays
[
i
];
if
(
object
instanceof
JSONArray
)
{
parseMxGsonArray
(
maps
,
(
JSONArray
)
object
,
prefix
+
"("
+
i
+
")"
);
}
else
if
(
object
instanceof
JSONObject
)
{
parseMxGsonMap
(
maps
,
(
Map
<
String
,
Object
>)
object
,
prefix
+
"("
+
i
+
")"
);
}
else
{
maps
.
put
(
prefix
+
"("
+
i
+
")"
,
String
.
valueOf
(
object
));
}
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2map/Mx2MapCreator.java
View file @
840937a0
...
@@ -6,5 +6,5 @@ import java.util.Map;
...
@@ -6,5 +6,5 @@ import java.util.Map;
public
interface
Mx2MapCreator
{
public
interface
Mx2MapCreator
{
public
Map
<
String
,
String
>
mx2Map
()
throws
SwiftException
;
public
Map
<
String
,
Object
>
mx2Map
()
throws
SwiftException
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2map/Mx2MapCreatorManager.java
View file @
840937a0
package
com
.
brilliance
.
swift
.
mx2map
;
package
com
.
brilliance
.
swift
.
mx2map
;
import
com.brilliance.swift.SwiftTransfer
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2map.camt053.Mx2MapCamt053Creator
;
import
com.brilliance.swift.mx2map.camt053.Mx2MapCamt053Creator
;
import
com.brilliance.swift.mx2map.pacs008.Mx2MapPacs008Creator
;
import
com.prowidesoftware.swift.model.mx.AbstractMX
;
import
com.prowidesoftware.swift.model.mx.AbstractMX
;
import
javax.xml.parsers.DocumentBuilder
;
import
javax.xml.parsers.DocumentBuilderFactory
;
import
java.util.Map
;
import
java.util.Map
;
public
class
Mx2MapCreatorManager
{
public
class
Mx2MapCreatorManager
{
public
Map
<
String
,
String
>
mx2Map
(
String
xml
)
throws
SwiftException
{
public
Map
<
String
,
Object
>
mx2Map
(
String
xml
,
String
localCode
)
throws
SwiftException
{
xml
=
handlingXml
(
xml
);
AbstractMX
abstractMX
=
AbstractMX
.
parse
(
xml
);
AbstractMX
abstractMX
=
AbstractMX
.
parse
(
xml
);
String
messageType
=
(
abstractMX
.
getMxId
().
getBusinessProcess
().
name
()
String
messageType
=
(
abstractMX
.
getMxId
().
getBusinessProcess
().
name
()
+
"."
+
"."
...
@@ -19,14 +24,16 @@ public class Mx2MapCreatorManager {
...
@@ -19,14 +24,16 @@ public class Mx2MapCreatorManager {
.
trim
();
.
trim
();
AbstractMx2MapCreator
creator
=
getCreator
(
messageType
);
AbstractMx2MapCreator
creator
=
getCreator
(
messageType
);
creator
.
setXmlStr
(
xml
);
creator
.
setXmlStr
(
xml
);
creator
.
set
AbstractMX
(
abstractMX
);
creator
.
set
LocalCode
(
localCode
);
return
creator
.
mx2Map
();
return
creator
.
mx2Map
();
}
}
public
AbstractMx2MapCreator
getCreator
(
String
messageType
)
{
public
AbstractMx2MapCreator
getCreator
(
String
messageType
)
{
if
(
"camt.053.001"
.
equals
(
messageType
)){
if
(
"camt.053.001"
.
equals
(
messageType
)){
return
new
Mx2MapCamt053Creator
();
return
new
Mx2MapCamt053Creator
();
}
/*else if("camt.029.001".equals(messageType)) {
}
else
if
(
"pacs.008.001"
.
equals
(
messageType
)){
return
new
Mx2MapPacs008Creator
();
}
/*else if("camt.029.001".equals(messageType)) {
return new Mx2MapCamt029Creator();
return new Mx2MapCamt029Creator();
} else if("camt.056.001".equals(messageType)) {
} else if("camt.056.001".equals(messageType)) {
return new Mx2MapCamt056Creator();
return new Mx2MapCamt056Creator();
...
@@ -37,7 +44,27 @@ public class Mx2MapCreatorManager {
...
@@ -37,7 +44,27 @@ public class Mx2MapCreatorManager {
} else if("pacs.008.001".equals(messageType)){
} else if("pacs.008.001".equals(messageType)){
return new Mx2MapPacs008Creator();
return new Mx2MapPacs008Creator();
} */
else
{
} */
else
{
return
new
DefaultMx2MapCreator
();
throw
new
SwiftException
(
"无效的报文类型"
);
}
}
/**
* 如果传入的xml 没有报文头,导致dom4j无法解析
* 提取xml里面的AppHdr和Document,重新组装成有效的xml报文
*/
private
String
handlingXml
(
String
xmlStr
)
{
boolean
flag
=
true
;
try
{
DocumentBuilderFactory
documentBuilderFactory
=
DocumentBuilderFactory
.
newInstance
();
DocumentBuilder
documentBuilder
=
documentBuilderFactory
.
newDocumentBuilder
();
documentBuilder
.
parse
(
xmlStr
);
}
catch
(
Exception
e
)
{
flag
=
false
;
}
if
(
flag
)
{
//如果是有效xml报文,直接返回
return
xmlStr
;
}
else
{
return
SwiftTransfer
.
fetchXmlFromMixMessage
(
xmlStr
);
}
}
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2map/camt029/Mx2MapCamt029Creator.java
deleted
100644 → 0
View file @
599bbbed
package
com
.
brilliance
.
swift
.
mx2map
.
camt029
;
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
Mx2MapCamt029Creator
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
(
"CxlDtls"
);
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
+
".CxlDtls.TxInfAndSts.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
messageId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".CxlDtls.TxInfAndSts.CxlStsId"
);
if
(
StringUtil
.
isNotEmpty
(
messageId
)){
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"message.id"
),
messageId
);
}
String
endToEndId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".CxlDtls.TxInfAndSts.RslvdCase.Id"
);
if
(
StringUtil
.
isNotEmpty
(
endToEndId
)){
maps
.
put
(
getPropertyValue
(
"endToEnd.id"
),
endToEndId
);
}
String
nameId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".CxlDtls.TxInfAndSts.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
+
".CxlDtls.TxInfAndSts.CxlStsRsnInf.Rsn.Cd"
);
if
(
StringUtil
.
isNotEmpty
(
reason
)){
maps
.
put
(
getPropertyValue
(
"cancellationDetails.transactionInformationAndStatus.cancellationStatusReasonInformation.reason.cd"
),
reason
);
}
int
count
=
XmlUtil
.
getChildrenCount
(
document
,
bodyParentElementName
+
".CxlDtls.TxInfAndSts.CxlStsRsnInf.AddtlInf"
,
null
);
String
information
=
""
;
if
(
count
>
0
){
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
information
=
information
+
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".CxlDtls.TxInfAndSts.CxlStsRsnInf.AddtlInf("
+
i
+
")"
);
}
}
if
(
StringUtil
.
isNotEmpty
(
information
)){
maps
.
put
(
getPropertyValue
(
"cancellationDetails.transactionInformationAndStatus.cancellationStatusReasonInformation.addtlInf"
),
information
);
}
}
catch
(
DocumentException
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
return
maps
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2map/camt052/Mx2MapCamt052Creator.java
deleted
100644 → 0
View file @
599bbbed
package
com
.
brilliance
.
swift
.
mx2map
.
camt052
;
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
com.brilliance.swift.vo.common.CdtDbtCode
;
import
org.dom4j.Document
;
import
org.dom4j.DocumentException
;
import
org.dom4j.DocumentHelper
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
java.util.Map
;
public
class
Mx2MapCamt052Creator
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
(
"Rpt"
);
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
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
messageId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Rpt.Id"
);
if
(
StringUtil
.
isNotEmpty
(
messageId
)){
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"message.id"
),
messageId
);
}
String
iban
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Rpt.Acct.Id.IBAN"
);
String
acctId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Rpt.Acct.Id.Othr.Id"
);
String
account
=
StringUtil
.
isNotEmpty
(
iban
)
?
iban
:
acctId
;
if
(
StringUtil
.
isNotEmpty
(
account
))
{
maps
.
put
(
getPropertyValue
(
"statement.account"
),
account
);
}
String
elctrncSeqNb
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Rpt.LglSeqNb"
);
if
(
StringUtil
.
isEmpty
(
elctrncSeqNb
)
||
elctrncSeqNb
.
length
()
>
5
)
{
elctrncSeqNb
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Rpt.ElctrncSeqNb"
);
}
if
(
StringUtil
.
isNotEmpty
(
elctrncSeqNb
))
{
maps
.
put
(
getPropertyValue
(
"statement.sequence.number"
),
elctrncSeqNb
);
}
String
pageNumber
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Rpt.RptPgntn.PgNb"
);
if
(
StringUtil
.
isNotEmpty
(
pageNumber
)){
maps
.
put
(
getPropertyValue
(
"statement.page.number"
),
pageNumber
);
}
String
amount
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Rpt.Acct.Ccy"
);
if
(
StringUtil
.
isNotEmpty
(
amount
)){
maps
.
put
(
getPropertyValue
(
"report.account.currency"
),
amount
+
"0"
);
}
String
dateStr
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Rpt.CreDtTm"
);
if
(
StringUtil
.
isEmpty
(
dateStr
)){
dateStr
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".GrpHdr.CreDtTm"
);
}
if
(
StringUtil
.
isEmpty
(
dateStr
)){
maps
.
put
(
getPropertyValue
(
"report.creDtTm"
),
dateStr
);
}
int
entryCount
=
XmlUtil
.
getChildrenCount
(
document
,
bodyParentElementName
+
".Rpt.Ntry"
,
null
);
if
(
entryCount
>
0
)
{
for
(
int
i
=
0
;
i
<
entryCount
;
i
++)
{
String
reversalIndicator
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Rpt.Ntry("
+
i
+
").RvslInd"
);
String
creditDebitIndicator
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Rpt.Ntry("
+
i
+
").CdtDbtInd"
);
if
(
StringUtil
.
isNotEmpty
(
reversalIndicator
)
&&
Boolean
.
valueOf
(
reversalIndicator
))
{
if
(
CdtDbtCode
.
DBIT
.
value
().
equals
(
creditDebitIndicator
))
{
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"statement.entry.crdr"
)+
"("
+(
i
+
1
)+
")"
,
getPropertyValue
(
"reversal.credit"
));
}
else
{
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"statement.entry.crdr"
)+
"("
+(
i
+
1
)+
")"
,
getPropertyValue
(
"reversal.debit"
));
}
}
else
{
if
(
CdtDbtCode
.
DBIT
.
value
().
equals
(
creditDebitIndicator
))
{
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"statement.entry.crdr"
)+
"("
+(
i
+
1
)+
")"
,
getPropertyValue
(
"debit"
));
}
else
{
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"statement.entry.crdr"
)+
"("
+(
i
+
1
)+
")"
,
getPropertyValue
(
"credit"
));
}
}
String
valueDateStr
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Rpt.Ntry("
+
i
+
").ValDt.Dt"
);
if
(
StringUtil
.
isNotEmpty
(
valueDateStr
))
{
maps
.
put
(
getPropertyValue
(
"statement.entry.valueDate"
)+
"("
+(
i
+
1
)+
")"
,
valueDateStr
);
}
String
amt
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Rpt.Ntry("
+
i
+
").Amt"
);
String
ccy
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Rpt.Ntry("
+
i
+
").Amt@Ccy"
);
if
(
StringUtil
.
isNotEmpty
(
ccy
))
{
maps
.
put
(
getPropertyValue
(
"statement.entry.ccy"
)+
"("
+(
i
+
1
)+
")"
,
ccy
);
}
if
(
StringUtil
.
isNotEmpty
(
amt
))
{
maps
.
put
(
getPropertyValue
(
"statement.entry.amt"
)+
"("
+(
i
+
1
)+
")"
,
amt
);
}
String
endToEndId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Rpt.Ntry("
+
i
+
").NtryDtls.TxDtls.Refs.EndToEndId"
);
if
(
StringUtil
.
isNotEmpty
(
endToEndId
))
{
maps
.
put
(
getPropertyValue
(
"statement.entry.endToEndId"
)+
"("
+(
i
+
1
)+
")"
,
endToEndId
);
}
String
sumc
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Rpt.TxsSummry.TtlCdtNtries.Sum"
);
String
nbOfNtriesc
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Rpt.TxsSummry.TtlCdtNtries.NbOfNtries"
);
if
(
StringUtil
.
isNotEmpty
(
sumc
)&&
StringUtil
.
isNotEmpty
(
nbOfNtriesc
)){
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"report.transactionsSummary.totalCreditEntries.nbOfNtries"
),
nbOfNtriesc
);
maps
.
put
(
getPropertyValue
(
"report.transactionsSummary.totalCreditEntries.sum"
),
sumc
);
}
String
sumd
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Rpt.TxsSummry.TtlDbtNtries.Sum"
);
String
nbOfNtriesd
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Rpt.TxsSummry.TtlDbtNtries.NbOfNtries"
);
if
(
StringUtil
.
isNotEmpty
(
sumd
)&&
StringUtil
.
isNotEmpty
(
nbOfNtriesd
)){
maps
.
put
(
getPropertyValue
(
"report.transactionsSummary.totalDebitEntries.nbOfNtries"
),
nbOfNtriesd
);
maps
.
put
(
getPropertyValue
(
"report.transactionsSummary.totalDebitEntries.sum"
),
sumd
);
}
}
}
}
catch
(
DocumentException
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
return
maps
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2map/camt053/Mx2MapCamt053Creator.java
View file @
840937a0
package
com
.
brilliance
.
swift
.
mx2map
.
camt053
;
package
com
.
brilliance
.
swift
.
mx2map
.
camt053
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
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.exception.SwiftException
;
import
com.brilliance.swift.mx2map.AbstractMx2MapCreator
;
import
com.brilliance.swift.mx2map.AbstractMx2MapCreator
;
...
@@ -12,88 +16,86 @@ import org.dom4j.DocumentException;
...
@@ -12,88 +16,86 @@ import org.dom4j.DocumentException;
import
org.dom4j.DocumentHelper
;
import
org.dom4j.DocumentHelper
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
public
class
Mx2MapCamt053Creator
extends
AbstractMx2MapCreator
{
public
class
Mx2MapCamt053Creator
extends
AbstractMx2MapCreator
{
@Override
@Override
public
Map
<
String
,
String
>
mx2Map
()
throws
SwiftException
{
public
Map
<
String
,
Object
>
mx2Map
()
throws
SwiftException
{
try
{
Map
<
String
,
Object
>
elementMaps
=
SwiftTransfer
.
mx2ElementMaps
(
xmlStr
);
Document
document
=
DocumentHelper
.
parseText
(
xmlStr
);
if
(
elementMaps
.
get
(
"frBic"
)
!=
null
)
{
Map
<
String
,
String
>
parentElementMaps
=
XmlUtil
.
getParentElementMaps
(
document
);
maps
.
put
(
getPropertyValue
(
"app.header.sendBic"
),
elementMaps
.
get
(
"frBic"
));
String
appHdrParentElementName
=
parentElementMaps
.
get
(
"AppHdr"
);
}
String
grpHdrParentElementName
=
parentElementMaps
.
get
(
"GrpHdr"
);
if
(
elementMaps
.
get
(
"toBic"
)
!=
null
)
{
String
bodyParentElementName
=
parentElementMaps
.
get
(
"Stmt"
);
maps
.
put
(
getPropertyValue
(
"app.header.receiverBic"
),
elementMaps
.
get
(
"toBic"
));
String
sendBic
=
abstractMX
.
getAppHdr
().
from
();
}
maps
.
put
(
getPropertyValue
(
"app.header.sendBic"
),
sendBic
);
if
(
elementMaps
.
get
(
"msgDefIdr"
)
!=
null
)
{
String
receiverBic
=
abstractMX
.
getAppHdr
().
to
();
maps
.
put
(
getPropertyValue
(
"app.header.msgDefId"
),
elementMaps
.
get
(
"msgDefIdr"
));
maps
.
put
(
getPropertyValue
(
"app.header.receiverBic"
),
receiverBic
);
}
String
bizMsgId
=
abstractMX
.
getAppHdr
().
reference
();
if
(
elementMaps
.
get
(
"bizSvc"
)
!=
null
)
{
maps
.
put
(
getPropertyValue
(
"app.header.bizMsgId"
),
bizMsgId
);
maps
.
put
(
getPropertyValue
(
"app.header.bizSvc"
),
elementMaps
.
get
(
"bizSvc"
));
String
msgDefId
=
abstractMX
.
getAppHdr
().
messageName
();
}
maps
.
put
(
getPropertyValue
(
"app.header.msgDefId"
),
msgDefId
);
if
(
elementMaps
.
get
(
"creDt"
)
!=
null
)
{
String
bizSvc
=
abstractMX
.
getAppHdr
().
serviceName
();
maps
.
put
(
getPropertyValue
(
"app.header.creDt"
),
elementMaps
.
get
(
"creDt"
));
maps
.
put
(
getPropertyValue
(
"app.header.bizSvc"
),
bizSvc
);
}
XMLGregorianCalendar
creDt
=
abstractMX
.
getAppHdr
().
creationDate
();
if
(
elementMaps
.
get
(
"bizMsgIdr"
)
!=
null
)
{
maps
.
put
(
getPropertyValue
(
"app.header.creDt"
),
creDt
.
toXMLFormat
());
maps
.
put
(
getPropertyValue
(
"statement.id"
),
elementMaps
.
get
(
"bizMsgIdr"
));
String
statementId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.Id"
);
}
maps
.
put
(
getPropertyValue
(
"statement.id"
),
statementId
);
if
(
elementMaps
.
get
(
"acctIdIban"
)
!=
null
)
{
String
iban
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.Acct.Id.IBAN"
);
maps
.
put
(
getPropertyValue
(
"statement.account"
),
elementMaps
.
get
(
"acctIdIban"
));
String
acctId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.Acct.Id.Othr.Id"
);
}
String
account
=
StringUtil
.
isNotEmpty
(
iban
)
?
iban
:
acctId
;
if
(
elementMaps
.
get
(
"acctId"
)
!=
null
)
{
if
(
StringUtil
.
isNotEmpty
(
account
))
{
maps
.
put
(
getPropertyValue
(
"statement.account"
),
elementMaps
.
get
(
"acctId"
));
maps
.
put
(
getPropertyValue
(
"statement.account"
),
account
);
}
}
if
(
elementMaps
.
get
(
"acctCcy"
)
!=
null
)
{
String
elctrncSeqNb
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.LglSeqNb"
);
maps
.
put
(
getPropertyValue
(
"statement.account.ccy"
),
elementMaps
.
get
(
"acctCcy"
));
if
(
StringUtil
.
isEmpty
(
elctrncSeqNb
)
||
elctrncSeqNb
.
length
()
>
5
)
{
}
elctrncSeqNb
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.ElctrncSeqNb"
);
if
(
elementMaps
.
get
(
"lglSeqNb"
)
!=
null
)
{
}
maps
.
put
(
getPropertyValue
(
"statement.sequence.number"
),
elementMaps
.
get
(
"lglSeqNb"
));
if
(
StringUtil
.
isNotEmpty
(
elctrncSeqNb
))
{
}
maps
.
put
(
getPropertyValue
(
"statement.sequence.number"
),
elctrncSeqNb
);
if
(
elementMaps
.
get
(
"pgNb"
)
!=
null
)
{
}
maps
.
put
(
getPropertyValue
(
"statement.page.number"
),
elementMaps
.
get
(
"pgNb"
));
String
pageNumber
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.StmtPgntn.PgNb"
);
}
if
(
StringUtil
.
isNotEmpty
(
pageNumber
)){
if
(
elementMaps
.
get
(
"lastPgInd"
)
!=
null
)
{
maps
.
put
(
getPropertyValue
(
"statement.page.number"
),
pageNumber
);
Boolean
lastPgInd
=
(
Boolean
)
elementMaps
.
get
(
"lastPgInd"
);
maps
.
put
(
getPropertyValue
(
"statement.lastPgInd"
),
lastPgInd
?
getPropertyValue
(
"yes"
)
:
getPropertyValue
(
"no"
));
}
else
{
maps
.
put
(
getPropertyValue
(
"statement.lastPgInd"
),
getPropertyValue
(
"no"
));
}
//期初余额
if
(
elementMaps
.
get
(
"opbdBalCdtDbtInd"
)
!=
null
)
{
String
cdtDbtInd
=
String
.
valueOf
(
elementMaps
.
get
(
"opbdBalCdtDbtInd"
));
if
(
CdtDbtCode
.
CRDT
.
value
().
equals
(
cdtDbtInd
))
{
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"statement.openingBooked.crdr"
),
getPropertyValue
(
"credit"
));
}
else
{
//if (CdtDbtCode.DBIT.value().equals(cdtDbtInd)) {
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"statement.openingBooked.crdr"
),
getPropertyValue
(
"debit"
));
}
}
int
opbdIndex
=
-
1
;
}
int
clbdIndex
=
-
1
;
if
(
elementMaps
.
get
(
"opbdBalDt"
)
!=
null
)
{
int
balanceCount
=
XmlUtil
.
getChildrenCount
(
document
,
bodyParentElementName
+
".Stmt.Bal"
,
null
);
maps
.
put
(
getPropertyValue
(
"statement.openingBooked.date"
),
elementMaps
.
get
(
"opbdBalDt"
));
if
(
balanceCount
>
0
)
{
}
for
(
int
i
=
0
;
i
<
balanceCount
;
i
++)
{
if
(
elementMaps
.
get
(
"opbdBalCcy"
)
!=
null
)
{
String
balanceType
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.Bal("
+
i
+
").Tp.CdOrPrtry.Cd"
);
maps
.
put
(
getPropertyValue
(
"statement.openingBooked.ccy"
),
elementMaps
.
get
(
"opbdBalCcy"
));
if
(
BalanceTypeCode
.
OPBD
.
value
().
equals
(
balanceType
))
{
}
opbdIndex
=
i
;
if
(
elementMaps
.
get
(
"opbdBalAmt"
)
!=
null
)
{
BigDecimal
amt
=
(
BigDecimal
)
elementMaps
.
get
(
"opbdBalAmt"
);
maps
.
put
(
getPropertyValue
(
"statement.openingBooked.amt"
),
amt
.
toPlainString
());
}
if
(
elementMaps
.
get
(
"ntry"
)
!=
null
)
{
List
<
Map
<
String
,
Object
>>
list
=
(
List
<
Map
<
String
,
Object
>>)
elementMaps
.
get
(
"ntry"
);
if
(
list
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
Map
<
String
,
Object
>
tmpMap
=
list
.
get
(
i
);
Boolean
reversalIndicator
=
false
;
if
(
tmpMap
.
get
(
"ntryRvslInd"
)
!=
null
)
{
reversalIndicator
=
(
Boolean
)
tmpMap
.
get
(
"ntryRvslInd"
);
}
}
if
(
BalanceTypeCode
.
CLBD
.
value
().
equals
(
balanceType
))
{
String
creditDebitIndicator
=
""
;
clbdIndex
=
i
;
if
(
tmpMap
.
get
(
"cdtDbtInd"
)
!=
null
)
{
creditDebitIndicator
=
(
String
)
tmpMap
.
get
(
"cdtDbtInd"
);
}
}
}
if
(
reversalIndicator
)
{
}
if
(
opbdIndex
>
-
1
)
{
String
cdtDbtInd
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.Bal("
+
opbdIndex
+
").CdtDbtInd"
);
if
(
CdtDbtCode
.
CRDT
.
value
().
equals
(
cdtDbtInd
))
{
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"statement.openingBooked.crdr"
),
getPropertyValue
(
"credit"
));
}
else
{
//if (CdtDbtCode.DBIT.value().equals(cdtDbtInd)) {
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"statement.openingBooked.crdr"
),
getPropertyValue
(
"debit"
));
}
String
dateStr
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.Bal("
+
opbdIndex
+
").Dt.Dt"
);
if
(
StringUtil
.
isNotEmpty
(
dateStr
))
{
maps
.
put
(
getPropertyValue
(
"statement.openingBooked.date"
),
dateStr
);
}
String
ccy
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.Bal("
+
opbdIndex
+
").Amt@Ccy"
);
if
(
StringUtil
.
isNotEmpty
(
ccy
))
{
maps
.
put
(
getPropertyValue
(
"statement.openingBooked.ccy"
),
ccy
);
}
String
amt
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.Bal("
+
opbdIndex
+
").Amt"
);
if
(
StringUtil
.
isNotEmpty
(
amt
))
{
maps
.
put
(
getPropertyValue
(
"statement.openingBooked.amt"
),
amt
);
}
}
int
entryCount
=
XmlUtil
.
getChildrenCount
(
document
,
bodyParentElementName
+
".Stmt.Ntry"
,
null
);
if
(
entryCount
>
0
)
{
for
(
int
i
=
0
;
i
<
entryCount
;
i
++)
{
String
reversalIndicator
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.Ntry("
+
i
+
").RvslInd"
);
String
creditDebitIndicator
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.Ntry("
+
i
+
").CdtDbtInd"
);
if
(
StringUtil
.
isNotEmpty
(
reversalIndicator
)
&&
Boolean
.
valueOf
(
reversalIndicator
))
{
if
(
CdtDbtCode
.
DBIT
.
value
().
equals
(
creditDebitIndicator
))
{
if
(
CdtDbtCode
.
DBIT
.
value
().
equals
(
creditDebitIndicator
))
{
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"statement.entry.crdr"
)+
"("
+(
i
+
1
)+
")"
,
getPropertyValue
(
"reversal.credit"
));
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"statement.entry.crdr"
)+
"("
+(
i
+
1
)+
")"
,
getPropertyValue
(
"reversal.credit"
));
}
else
{
}
else
{
...
@@ -106,46 +108,53 @@ public class Mx2MapCamt053Creator extends AbstractMx2MapCreator {
...
@@ -106,46 +108,53 @@ public class Mx2MapCamt053Creator extends AbstractMx2MapCreator {
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"statement.entry.crdr"
)+
"("
+(
i
+
1
)+
")"
,
getPropertyValue
(
"credit"
));
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"statement.entry.crdr"
)+
"("
+(
i
+
1
)+
")"
,
getPropertyValue
(
"credit"
));
}
}
}
}
String
valueDateStr
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.Ntry("
+
i
+
").ValDt.Dt"
);
if
(
tmpMap
.
get
(
"ntryValDt"
)
!=
null
)
{
if
(
StringUtil
.
isNotEmpty
(
valueDateStr
))
{
maps
.
put
(
getPropertyValue
(
"statement.entry.valueDate"
)+
"("
+(
i
+
1
)+
")"
,
tmpMap
.
get
(
"ntryValDt"
));
maps
.
put
(
getPropertyValue
(
"statement.entry.valueDate"
)+
"("
+(
i
+
1
)+
")"
,
valueDateStr
);
}
if
(
tmpMap
.
get
(
"ntryCcy"
)
!=
null
)
{
maps
.
put
(
getPropertyValue
(
"statement.entry.ccy"
)+
"("
+(
i
+
1
)+
")"
,
tmpMap
.
get
(
"ntryCcy"
));
}
if
(
tmpMap
.
get
(
"ntryAmt"
)
!=
null
)
{
BigDecimal
amt
=
(
BigDecimal
)
tmpMap
.
get
(
"ntryAmt"
);
maps
.
put
(
getPropertyValue
(
"statement.entry.amt"
)+
"("
+(
i
+
1
)+
")"
,
amt
.
toPlainString
());
}
}
String
amt
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.Ntry("
+
i
+
").Amt"
);
if
(
CdtDbtCode
.
DBIT
.
value
().
equals
(
creditDebitIndicator
))
{
String
ccy
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.Ntry("
+
i
+
").Amt@Ccy"
);
if
(
tmpMap
.
get
(
"instrId"
)
!=
null
)
{
if
(
StringUtil
.
isNotEmpty
(
ccy
))
{
maps
.
put
(
getPropertyValue
(
"statement.entry.txnRef"
)+
"("
+(
i
+
1
)+
")"
,
tmpMap
.
get
(
"instrId"
));
maps
.
put
(
getPropertyValue
(
"statement.entry.ccy"
)+
"("
+(
i
+
1
)+
")"
,
ccy
);
}
}
else
{
if
(
tmpMap
.
get
(
"endToEndId"
)
!=
null
)
{
maps
.
put
(
getPropertyValue
(
"statement.entry.txnRef"
)+
"("
+(
i
+
1
)+
")"
,
tmpMap
.
get
(
"endToEndId"
));
}
}
}
if
(
StringUtil
.
isNotEmpty
(
amt
)
)
{
if
(
tmpMap
.
get
(
"ntryAcctSvcrRef"
)
!=
null
)
{
maps
.
put
(
getPropertyValue
(
"statement.entry.a
mt"
)+
"("
+(
i
+
1
)+
")"
,
amt
);
maps
.
put
(
getPropertyValue
(
"statement.entry.a
cctSvcrRef"
)+
"("
+(
i
+
1
)+
")"
,
tmpMap
.
get
(
"ntryAcctSvcrRef"
)
);
}
}
String
endToEndId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.Ntry("
+
i
+
").NtryDtls.TxDtls.Refs.EndToEndId"
);
if
(
tmpMap
.
get
(
"addtlTxInf"
)
!=
null
)
{
if
(
StringUtil
.
isNotEmpty
(
endToEndId
))
{
maps
.
put
(
getPropertyValue
(
"statement.entry.addtlTxInf"
)+
"("
+(
i
+
1
)+
")"
,
tmpMap
.
get
(
"addtlTxInf"
));
maps
.
put
(
getPropertyValue
(
"statement.entry.endToEndId"
)+
"("
+(
i
+
1
)+
")"
,
endToEndId
);
}
}
}
}
}
}
if
(
clbdIndex
>
-
1
)
{
}
String
cdtDbtInd
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.Bal("
+
clbdIndex
+
").CdtDbtInd"
);
if
(
CdtDbtCode
.
CRDT
.
value
().
equals
(
cdtDbtInd
))
{
//期末余额
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"statement.closingBooked.crdr"
),
getPropertyValue
(
"credit"
));
if
(
elementMaps
.
get
(
"clbdBalCdtDbtInd"
)
!=
null
)
{
}
else
{
//if (CdtDbtCode.DBIT.value().equals(cdtDbtInd)) {
String
cdtDbtInd
=
String
.
valueOf
(
elementMaps
.
get
(
"clbdBalCdtDbtInd"
));
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"statement.closingBooked.crdr"
),
getPropertyValue
(
"debit"
));
if
(
CdtDbtCode
.
CRDT
.
value
().
equals
(
cdtDbtInd
))
{
}
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"statement.closingBooked.crdr"
),
getPropertyValue
(
"credit"
));
String
dateStr
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.Bal("
+
clbdIndex
+
").Dt.Dt"
);
}
else
{
//if (CdtDbtCode.DBIT.value().equals(cdtDbtInd)) {
if
(
StringUtil
.
isNotEmpty
(
dateStr
))
{
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"statement.closingBooked.crdr"
),
getPropertyValue
(
"debit"
));
maps
.
put
(
getPropertyValue
(
"statement.closingBooked.date"
),
dateStr
);
}
String
ccy
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.Bal("
+
clbdIndex
+
").Amt@Ccy"
);
if
(
StringUtil
.
isNotEmpty
(
ccy
))
{
maps
.
put
(
getPropertyValue
(
"statement.closingBooked.ccy"
),
ccy
);
}
String
amt
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Stmt.Bal("
+
clbdIndex
+
").Amt"
);
if
(
StringUtil
.
isNotEmpty
(
amt
))
{
maps
.
put
(
getPropertyValue
(
"statement.closingBooked.amt"
),
amt
);
}
}
}
}
catch
(
DocumentException
e
)
{
}
throw
new
SwiftException
(
e
.
getMessage
());
if
(
elementMaps
.
get
(
"clbdBalDt"
)
!=
null
)
{
maps
.
put
(
getPropertyValue
(
"statement.closingBooked.date"
),
elementMaps
.
get
(
"clbdBalDt"
));
}
if
(
elementMaps
.
get
(
"clbdBalCcy"
)
!=
null
)
{
maps
.
put
(
getPropertyValue
(
"statement.closingBooked.ccy"
),
elementMaps
.
get
(
"clbdBalCcy"
));
}
if
(
elementMaps
.
get
(
"clbdBalAmt"
)
!=
null
)
{
BigDecimal
amt
=
(
BigDecimal
)
elementMaps
.
get
(
"clbdBalAmt"
);
maps
.
put
(
getPropertyValue
(
"statement.closingBooked.amt"
),
amt
.
toPlainString
());
}
}
return
maps
;
return
maps
;
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2map/camt056/Mx2MapCamt056Creator.java
deleted
100644 → 0
View file @
599bbbed
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
messageId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Undrlyg.TxInf.Case.Id"
);
if
(
StringUtil
.
isNotEmpty
(
messageId
)){
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"message.id"
),
messageId
);
}
String
endToEndId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Undrlyg.TxInf.OrgnlInstrId"
);
if
(
StringUtil
.
isNotEmpty
(
endToEndId
)){
maps
.
put
(
getPropertyValue
(
"endToEnd.id"
),
endToEndId
);
}
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
(
e
.
getMessage
());
}
return
maps
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2map/camt057/Mx2MapCamt057Creator.java
deleted
100644 → 0
View file @
599bbbed
package
com
.
brilliance
.
swift
.
mx2map
.
camt057
;
import
com.alibaba.fastjson.JSONArray
;
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.apache.commons.collections4.CollectionUtils
;
import
org.dom4j.Document
;
import
org.dom4j.DocumentException
;
import
org.dom4j.DocumentHelper
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
java.util.HashMap
;
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
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
messageId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".GrpHdr.MsgId"
);
if
(
StringUtil
.
isNotEmpty
(
messageId
)){
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"message.id"
),
messageId
);
}
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
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
);
}
String
endToEndId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").EndToEndId"
);
if
(
StringUtil
.
isEmpty
(
endToEndId
)){
endToEndId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".Ntfctn.Itm("
+
0
+
").Id"
);
}
if
(
StringUtil
.
isNotEmpty
(
endToEndId
)){
maps
.
put
(
Mx2MtConstants
.
NEW_LINE
+
getPropertyValue
(
"endToEnd.id"
),
endToEndId
);
}
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
partyPath1
=
".Ntfctn.Dbtr.Pty"
;
String
partyPath2
=
".Ntfctn.Itm("
+
0
+
").Dbtr.Pty"
;
String
agentPath1
=
".Ntfctn.Dbtr.Agt"
;
String
agentPath2
=
".Ntfctn.Itm("
+
0
+
").Dbtr.Agt"
;
Map
<
String
,
String
>
partyMessage1
=
getPartyAndAgentAndAccountMessage
(
document
,
bodyParentElementName
,
partyPath1
,
"party"
);
Map
<
String
,
String
>
partyMessage2
=
getPartyAndAgentAndAccountMessage
(
document
,
bodyParentElementName
,
partyPath2
,
"party"
);
Map
<
String
,
String
>
agentMessage1
=
getPartyAndAgentAndAccountMessage
(
document
,
bodyParentElementName
,
agentPath1
,
"agent"
);
Map
<
String
,
String
>
agentMessage2
=
getPartyAndAgentAndAccountMessage
(
document
,
bodyParentElementName
,
agentPath2
,
"agent"
);
maps
.
put
(
getPropertyValue
(
"remitter.anyBIC"
),
partyMessage1
.
get
(
"anyBIC"
));
maps
.
put
(
getPropertyValue
(
"remitter.ctry"
),
partyMessage1
.
get
(
"ctry"
));
maps
.
put
(
getPropertyValue
(
"remitter.nm"
),
partyMessage1
.
get
(
"nm"
));
maps
.
put
(
getPropertyValue
(
"remitter.adrLine"
),
partyMessage1
.
get
(
"adrLine"
));
maps
.
put
(
getPropertyValue
(
"remitter.cd"
),
partyMessage1
.
get
(
"cd"
));
maps
.
put
(
getPropertyValue
(
"remitter.mmbId"
),
partyMessage1
.
get
(
"mmbId"
));
/*String agentPath3 = ".Ntfctn.DbtrAgt";
String agentPath4 = ".Ntfctn.Itm("+0+").DbtrAgt";
maps.put("instructingBank",null);
Map<String, String> agentMessage3 = getPartyAndAgentAndAccountMessage(document, bodyParentElementName, agentPath3);
Map<String, String> agentMessage4 = getPartyAndAgentAndAccountMessage(document, bodyParentElementName, agentPath4);
if(agentMessage3!=null||agentMessage4!=null){
maps.clear();
}
if (agentMessage3!=null){
maps.putAll(agentMessage3);
}else if(agentMessage4!=null){
maps.putAll(agentMessage4);
}
String agentPath5 = ".Ntfctn.IntrmyAgt";
String agentPath6 = ".Ntfctn.Itm("+0+").IntrmyAgt";
maps.put("intermediaryBank",null);
Map<String, String> agentMessage5 = getPartyAndAgentAndAccountMessage(document, bodyParentElementName, agentPath5);
Map<String, String> agentMessage6 = getPartyAndAgentAndAccountMessage(document, bodyParentElementName, agentPath6);
if(agentMessage5!=null||agentMessage6!=null){
maps.clear();
}
if(agentMessage5!=null){
maps.putAll(agentMessage5);
}else if(agentMessage6!=null){
maps.putAll(agentMessage6);
}*/
/*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
(
e
.
getMessage
());
}
return
maps
;
}
//choice选项为party和agent
public
Map
<
String
,
String
>
getPartyAndAgentAndAccountMessage
(
Document
document
,
String
bodyParentElementName
,
String
partyAndAgentAndAccountPath
,
String
choice
){
String
bicCode
=
""
;
String
country
=
""
;
int
addressLineCount
=
0
;
String
address
=
""
;
String
name
=
""
;
String
clearingSystemCode
=
""
;
String
ClearingSystemId
=
""
;
String
account
=
""
;
Map
<
String
,
String
>
maps
=
new
HashMap
<>();
if
(
"party"
.
equals
(
choice
)){
int
countParty
=
XmlUtil
.
getChildrenCount
(
document
,
bodyParentElementName
+
partyAndAgentAndAccountPath
,
null
);
if
(
countParty
>
0
){
bicCode
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
partyAndAgentAndAccountPath
+
".Id.OrgId.AnyBIC"
);
country
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
partyAndAgentAndAccountPath
+
".PstlAdr.Ctry"
);
addressLineCount
=
XmlUtil
.
getChildrenCount
(
document
,
bodyParentElementName
+
partyAndAgentAndAccountPath
+
".PstlAdr.AdrLine"
,
null
);
name
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
partyAndAgentAndAccountPath
+
".Nm"
);
for
(
int
i
=
0
;
i
<
addressLineCount
;
i
++)
{
if
(
i
!=
1
||
i
!=
addressLineCount
-
1
){
address
=
address
+
","
;
}
address
=
address
+
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
".PstlAdr.AdrLine("
+
i
+
")"
);
}
}
}
if
(
"agent"
.
equals
(
choice
)){
int
countAgent
=
XmlUtil
.
getChildrenCount
(
document
,
bodyParentElementName
+
partyAndAgentAndAccountPath
,
null
);
if
(
countAgent
>
0
){
bicCode
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
partyAndAgentAndAccountPath
+
".Id.OrgId.AnyBIC"
);
country
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
partyAndAgentAndAccountPath
+
".FinInstnId.PstlAdr.Ctry"
);
addressLineCount
=
XmlUtil
.
getChildrenCount
(
document
,
bodyParentElementName
+
partyAndAgentAndAccountPath
+
".FinInstnId.PstlAdr.AdrLine"
,
null
);
name
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
partyAndAgentAndAccountPath
+
".FinInstnId.Nm"
);
clearingSystemCode
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
partyAndAgentAndAccountPath
+
".FinInstnId.ClrSysMmbId.ClrSysId.Cd"
);
ClearingSystemId
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
partyAndAgentAndAccountPath
+
".FinInstnId.ClrSysMmbId.MmbId"
);
for
(
int
i
=
0
;
i
<
addressLineCount
;
i
++)
{
if
(
i
!=
1
||
i
!=
addressLineCount
-
1
){
address
=
address
+
","
;
}
address
=
address
+
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
partyAndAgentAndAccountPath
+
".FinInstnId.PstlAdr.AdrLine("
+
i
+
")"
);
}
}
}
if
(
"account"
.
equals
(
choice
)){
account
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
partyAndAgentAndAccountPath
+
".Id.IBAN"
);
if
(
StringUtil
.
isEmpty
(
account
)){
account
=
XmlUtil
.
getXmlNodeValue
(
document
,
bodyParentElementName
+
partyAndAgentAndAccountPath
+
".Id.Othr.Id"
);
}
}
if
(
StringUtil
.
isNotEmpty
(
bicCode
)){
maps
.
put
(
getPropertyValue
(
"anyBIC"
),
bicCode
);
}
if
(
StringUtil
.
isNotEmpty
(
country
)){
maps
.
put
(
getPropertyValue
(
"ctry"
),
country
);
}
if
(
StringUtil
.
isNotEmpty
(
account
)){
maps
.
put
(
getPropertyValue
(
"account"
),
account
);
}
if
(
StringUtil
.
isNotEmpty
(
name
)){
maps
.
put
(
getPropertyValue
(
"nm"
),
name
);
}
if
(
StringUtil
.
isNotEmpty
(
address
)){
maps
.
put
(
getPropertyValue
(
"adrLine"
),
address
);
}
if
(
StringUtil
.
isNotEmpty
(
clearingSystemCode
)){
maps
.
put
(
getPropertyValue
(
"cd"
),
clearingSystemCode
);
}
if
(
StringUtil
.
isNotEmpty
(
ClearingSystemId
)){
maps
.
put
(
getPropertyValue
(
"mmbId"
),
ClearingSystemId
);
}
return
maps
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2map/pacs008/Mx2MapPacs008Creator.java
View file @
840937a0
package
com
.
brilliance
.
swift
.
mx2map
.
pacs008
;
package
com
.
brilliance
.
swift
.
mx2map
.
pacs008
;
import
com.alibaba.fastjson.JSON
;
import
com.brilliance.swift.SwiftTransfer
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2map.AbstractMx2MapCreator
;
import
com.brilliance.swift.mx2map.AbstractMx2MapCreator
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.NumberUtil
;
import
com.brilliance.swift.util.NumberUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.XmlUtil
;
import
com.brilliance.swift.util.XmlUtil
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer
;
import
org.dom4j.DocumentException
;
import
org.dom4j.DocumentException
;
import
org.dom4j.DocumentHelper
;
import
org.dom4j.DocumentHelper
;
import
javax.xml.datatype.DatatypeConfigurationException
;
import
javax.xml.datatype.DatatypeConfigurationException
;
import
javax.xml.datatype.DatatypeFactory
;
import
javax.xml.datatype.DatatypeFactory
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
public
class
Mx2MapPacs008Creator
extends
AbstractMx2MapCreator
{
public
class
Mx2MapPacs008Creator
extends
AbstractMx2MapCreator
{
@Override
@Override
public
Map
<
String
,
String
>
mx2Map
()
throws
SwiftException
{
public
Map
<
String
,
Object
>
mx2Map
()
throws
SwiftException
{
try
{
Map
<
String
,
Object
>
elementMaps
=
SwiftTransfer
.
mx2ElementMaps
(
xmlStr
);
document
=
DocumentHelper
.
parseText
(
xmlStr
);
if
(
elementMaps
.
get
(
"frBic"
)
!=
null
)
{
Map
<
String
,
String
>
parentElementMaps
=
XmlUtil
.
getParentElementMaps
(
document
);
maps
.
put
(
getPropertyValue
(
"app.header.sendBic"
),
elementMaps
.
get
(
"frBic"
));
String
appHdrParentElementName
=
parentElementMaps
.
get
(
"AppHdr"
);
}
String
grpHdrParentElementName
=
parentElementMaps
.
get
(
"GrpHdr"
);
if
(
elementMaps
.
get
(
"toBic"
)
!=
null
)
{
String
cdtTrfTxInfParentElementName
=
parentElementMaps
.
get
(
"CdtTrfTxInf"
);
maps
.
put
(
getPropertyValue
(
"app.header.receiverBic"
),
elementMaps
.
get
(
"toBic"
));
String
uetr
=
XmlUtil
.
getXmlNodeValue
(
document
,
cdtTrfTxInfParentElementName
+
".CdtTrfTxInf.PmtId.uetr"
);
}
buildCommonHeader
(
uetr
);
if
(
elementMaps
.
get
(
"msgDefIdr"
)
!=
null
)
{
String
messageId
=
XmlUtil
.
getXmlNodeValue
(
document
,
cdtTrfTxInfParentElementName
+
".CdtTrfTxInf.PmtId.InstrId"
);
maps
.
put
(
getPropertyValue
(
"app.header.msgDefId"
),
elementMaps
.
get
(
"msgDefIdr"
));
if
(
StringUtil
.
isEmpty
(
messageId
))
{
}
messageId
=
XmlUtil
.
getXmlNodeValue
(
document
,
grpHdrParentElementName
+
".GrpHdr.MsgId"
);
if
(
elementMaps
.
get
(
"bizSvc"
)
!=
null
)
{
}
maps
.
put
(
getPropertyValue
(
"app.header.bizSvc"
),
elementMaps
.
get
(
"bizSvc"
));
if
(
StringUtil
.
isEmpty
(
messageId
))
{
}
messageId
=
abstractMX
.
getAppHdr
().
reference
();
if
(
elementMaps
.
get
(
"creDt"
)
!=
null
)
{
}
maps
.
put
(
getPropertyValue
(
"app.header.creDt"
),
elementMaps
.
get
(
"creDt"
));
maps
.
put
(
getPropertyValue
(
"message.id"
),
messageId
);
}
String
endToEndId
=
XmlUtil
.
getXmlNodeValue
(
document
,
cdtTrfTxInfParentElementName
+
".CdtTrfTxInf.PmtId.EndToEndId"
);
if
(
elementMaps
.
get
(
"bizMsgIdr"
)
!=
null
)
{
maps
.
put
(
getPropertyValue
(
"endToEnd.id"
),
endToEndId
);
maps
.
put
(
getPropertyValue
(
"message.id"
),
elementMaps
.
get
(
"bizMsgIdr"
));
String
intrBkSttlmDtValue
=
XmlUtil
.
getXmlNodeValue
(
document
,
cdtTrfTxInfParentElementName
+
".CdtTrfTxInf.IntrBkSttlmDt"
);
}
if
(
StringUtil
.
isNotEmpty
(
intrBkSttlmDtValue
))
{
if
(
elementMaps
.
get
(
"endToEndId"
)
!=
null
)
{
XMLGregorianCalendar
intrBkSttlmDt
=
DatatypeFactory
.
newInstance
().
newXMLGregorianCalendar
(
intrBkSttlmDtValue
);
maps
.
put
(
getPropertyValue
(
"endToEnd.id"
),
elementMaps
.
get
(
"endToEndId"
));
String
intrBkSttlmDtStr
=
DateUtil
.
format
(
intrBkSttlmDt
,
"yyyy-MM-dd"
);
}
maps
.
put
(
getPropertyValue
(
"settlement.date"
),
intrBkSttlmDtStr
);
if
(
elementMaps
.
get
(
"uetr"
)
!=
null
)
{
}
maps
.
put
(
getPropertyValue
(
"uetr"
),
elementMaps
.
get
(
"uetr"
));
String
setlAmt
=
XmlUtil
.
getXmlNodeValue
(
document
,
cdtTrfTxInfParentElementName
+
".CdtTrfTxInf.IntrBkSttlmAmt"
);
}
String
setlCcy
=
XmlUtil
.
getXmlNodeValue
(
document
,
cdtTrfTxInfParentElementName
+
".CdtTrfTxInf.IntrBkSttlmAmt@Ccy"
);
if
(
elementMaps
.
get
(
"sttlmMtd"
)
!=
null
)
{
if
(
StringUtil
.
isNotEmpty
(
setlAmt
)
&&
StringUtil
.
isNotEmpty
(
setlCcy
))
{
maps
.
put
(
getPropertyValue
(
"settlement.method"
),
elementMaps
.
get
(
"sttlmMtd"
));
maps
.
put
(
getPropertyValue
(
"settlement.amt"
),
setlCcy
+
" "
+
NumberUtil
.
round
(
new
BigDecimal
(
setlAmt
),
setlCcy
));
}
}
if
(
elementMaps
.
get
(
"sttlmAcctIdIban"
)
!=
null
)
{
String
instdAmt
=
XmlUtil
.
getXmlNodeValue
(
document
,
cdtTrfTxInfParentElementName
+
".CdtTrfTxInf.InstdAmt"
);
maps
.
put
(
getPropertyValue
(
"settlement.acct"
),
elementMaps
.
get
(
"sttlmAcctIdIban"
));
String
instdCcy
=
XmlUtil
.
getXmlNodeValue
(
document
,
cdtTrfTxInfParentElementName
+
".CdtTrfTxInf.InstdAmt@Ccy"
);
}
if
(
StringUtil
.
isNotEmpty
(
instdAmt
)
&&
StringUtil
.
isNotEmpty
(
instdCcy
))
{
if
(
elementMaps
.
get
(
"sttlmAcctId"
)
!=
null
)
{
maps
.
put
(
getPropertyValue
(
"original.settlement.amt"
),
instdCcy
+
" "
+
NumberUtil
.
round
(
new
BigDecimal
(
instdAmt
),
instdCcy
));
maps
.
put
(
getPropertyValue
(
"settlement.acct"
),
elementMaps
.
get
(
"sttlmAcctId"
));
}
if
(
elementMaps
.
get
(
"intrBkSttlmDt"
)
!=
null
)
{
maps
.
put
(
getPropertyValue
(
"settlement.date"
),
elementMaps
.
get
(
"intrBkSttlmDt"
));
}
if
(
elementMaps
.
get
(
"intrBkSttlmAmt"
)
!=
null
)
{
BigDecimal
amt
=
(
BigDecimal
)
elementMaps
.
get
(
"intrBkSttlmAmt"
);
if
(
elementMaps
.
get
(
"intrBkSttlmCcy"
)
!=
null
)
{
maps
.
put
(
getPropertyValue
(
"settlement.amt"
),
elementMaps
.
get
(
"intrBkSttlmCcy"
)
+
" "
+
amt
.
toPlainString
());
}
else
{
maps
.
put
(
getPropertyValue
(
"settlement.amt"
),
amt
.
toPlainString
());
}
}
String
exchangeRateStr
=
XmlUtil
.
getXmlNodeValue
(
document
,
cdtTrfTxInfParentElementName
+
".CdtTrfTxInf.XchgRate"
);
}
if
(
StringUtil
.
isNotEmpty
(
exchangeRateStr
))
{
if
(
elementMaps
.
get
(
"instdAmt"
)
!=
null
)
{
maps
.
put
(
getPropertyValue
(
"exchange.rate"
),
exchangeRateStr
);
BigDecimal
amt
=
(
BigDecimal
)
elementMaps
.
get
(
"instdAmt"
);
if
(
elementMaps
.
get
(
"instdAmtCcy"
)
!=
null
)
{
maps
.
put
(
getPropertyValue
(
"original.settlement.amt"
),
elementMaps
.
get
(
"instdAmtCcy"
)
+
" "
+
amt
.
toPlainString
());
}
else
{
maps
.
put
(
getPropertyValue
(
"original.settlement.amt"
),
amt
.
toPlainString
());
}
}
String
chrgBr
=
XmlUtil
.
getXmlNodeValue
(
document
,
cdtTrfTxInfParentElementName
+
".CdtTrfTxInf.ChrgBr"
);
}
if
(
StringUtil
.
isNotEmpty
(
chrgBr
))
{
if
(
elementMaps
.
get
(
"xchgRate"
)
!=
null
)
{
maps
.
put
(
getPropertyValue
(
"charge.by"
),
chrgBr
);
BigDecimal
xchgRate
=
(
BigDecimal
)
elementMaps
.
get
(
"xchgRate"
);
maps
.
put
(
getPropertyValue
(
"exchange.rate"
),
xchgRate
.
toPlainString
());
}
buildPartyInfo
(
"dbtr"
,
elementMaps
);
buildAgentInfo
(
"dbtrAgt"
,
elementMaps
);
buildAgentInfo
(
"instgRmbrsmntAgt"
,
elementMaps
);
buildAgentInfo
(
"instdRmbrsmntAgt"
,
elementMaps
);
buildAgentInfo
(
"thrdRmbrsmntAgt"
,
elementMaps
);
buildAgentInfo
(
"intrmyAgt1"
,
elementMaps
);
buildAgentInfo
(
"cdtrAgt"
,
elementMaps
);
buildPartyInfo
(
"cdtr"
,
elementMaps
);
if
(
elementMaps
.
get
(
"chrgBr"
)
!=
null
)
{
maps
.
put
(
getPropertyValue
(
"charge.by"
),
elementMaps
.
get
(
"chrgBr"
));
}
if
(
elementMaps
.
get
(
"chrgsInf"
)
!=
null
)
{
List
<
Map
<
String
,
Object
>>
list
=
(
List
<
Map
<
String
,
Object
>>)
elementMaps
.
get
(
"chrgsInf"
);
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
Map
<
String
,
Object
>
tmpMaps
=
list
.
get
(
i
);
BigDecimal
amt
=
(
BigDecimal
)
tmpMaps
.
get
(
"amt"
);
if
(
tmpMaps
.
get
(
"ccy"
)
!=
null
)
{
maps
.
put
(
getPropertyValue
(
"charge.info"
)
+
"("
+
(
i
+
1
)
+
")"
,
tmpMaps
.
get
(
"ccy"
)
+
" "
+
amt
.
toPlainString
());
}
else
{
maps
.
put
(
getPropertyValue
(
"charge.info"
)
+
"("
+
(
i
+
1
)
+
")"
,
amt
.
toPlainString
());
}
}
}
int
chrgsInfCount
=
XmlUtil
.
getChildrenCount
(
document
,
cdtTrfTxInfParentElementName
+
".CdtTrfTxInf.ChrgsInf"
,
null
);
}
if
(
chrgsInfCount
>
0
)
{
try
{
String
ccy
=
XmlUtil
.
getXmlNodeValue
(
document
,
cdtTrfTxInfParentElementName
+
".CdtTrfTxInf.ChrgsInf(0).Amt@Ccy"
);
String
mtMessage
=
SwiftTransfer
.
mx2Mt
(
xmlStr
,
null
,
null
);
String
amt
=
XmlUtil
.
getXmlNodeValue
(
document
,
cdtTrfTxInfParentElementName
+
".CdtTrfTxInf.ChrgsInf(0).Amt"
);
if
(
StringUtil
.
isNotEmpty
(
mtMessage
))
{
if
(
StringUtil
.
isNotEmpty
(
ccy
)
&&
StringUtil
.
isNotEmpty
(
amt
))
{
AbstractMT
abstractMT
=
AbstractMT
.
parse
(
mtMessage
);
BigDecimal
sumAmt
=
new
BigDecimal
(
amt
);
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
"70"
);
if
(
chrgsInfCount
>
1
)
{
if
(
tag
!=
null
)
{
for
(
int
i
=
1
;
i
<
chrgsInfCount
;
i
++)
{
maps
.
put
(
getPropertyValue
(
"remittanceInformation"
),
tag
.
getValue
());
if
(
ccy
.
equals
(
XmlUtil
.
getXmlNodeValue
(
document
,
cdtTrfTxInfParentElementName
+
".CdtTrfTxInf.ChrgsInf("
+
i
+
").Amt@Ccy"
)))
{
}
BigDecimal
tmpAmt
=
new
BigDecimal
(
XmlUtil
.
getXmlNodeValue
(
document
,
cdtTrfTxInfParentElementName
+
".CdtTrfTxInf.ChrgsInf("
+
i
+
").Amt"
));
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
"72"
);
sumAmt
=
sumAmt
.
add
(
tmpAmt
);
if
(
tag
!=
null
)
{
}
maps
.
put
(
getPropertyValue
(
"statement.entry.addtlTxInf"
),
tag
.
getValue
());
}
}
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
"77B"
);
maps
.
put
(
getPropertyValue
(
"charge.amt"
),
ccy
+
" "
+
NumberUtil
.
round
(
sumAmt
,
ccy
));
if
(
tag
!=
null
)
{
maps
.
put
(
getPropertyValue
(
"regulatoryReporting"
),
tag
.
getValue
());
}
}
}
}
buildPartyInfo
(
"debtor.info"
,
cdtTrfTxInfParentElementName
+
".CdtTrfTxInf.Dbtr"
);
}
catch
(
IOException
e
)
{
buildPartyInfo
(
"creditor.info"
,
cdtTrfTxInfParentElementName
+
".CdtTrfTxInf.Cdtr"
);
}
catch
(
DocumentException
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
catch
(
DatatypeConfigurationException
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
throw
new
SwiftException
(
e
.
getMessage
());
}
}
return
maps
;
return
maps
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/AbstractMx2MtCreator.java
View file @
840937a0
...
@@ -107,6 +107,10 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
...
@@ -107,6 +107,10 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
find
=
true
;
find
=
true
;
value
=
value
.
replace
(
"\""
,
"."
);
value
=
value
.
replace
(
"\""
,
"."
);
}
}
if
(
value
.
indexOf
(
"\\"
)
>
-
1
)
{
find
=
true
;
value
=
value
.
replace
(
"\\"
,
"."
);
}
tag
.
setValue
(
value
);
tag
.
setValue
(
value
);
if
(
find
)
{
if
(
find
)
{
if
(
"20"
.
equals
(
tag
.
getName
())
||
"21"
.
equals
(
tag
.
getName
()))
{
if
(
"20"
.
equals
(
tag
.
getName
())
||
"21"
.
equals
(
tag
.
getName
()))
{
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103/impl/Field77BGenerate.java
View file @
840937a0
...
@@ -46,7 +46,11 @@ public class Field77BGenerate extends AbstractMx2MtTagsGenerate {
...
@@ -46,7 +46,11 @@ public class Field77BGenerate extends AbstractMx2MtTagsGenerate {
int
mxRegulatoryReportingDetailInfCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.RgltryRptg("
+
i
+
").Dtls("
+
j
+
").Inf"
);
int
mxRegulatoryReportingDetailInfCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.RgltryRptg("
+
i
+
").Dtls("
+
j
+
").Inf"
);
if
(
mxRegulatoryReportingDetailInfCount
>
0
)
{
if
(
mxRegulatoryReportingDetailInfCount
>
0
)
{
for
(
int
k
=
0
;
k
<
mxRegulatoryReportingDetailInfCount
;
k
++)
{
for
(
int
k
=
0
;
k
<
mxRegulatoryReportingDetailInfCount
;
k
++)
{
mtRegulatoryReporting
+=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.RgltryRptg("
+
i
+
").Dtls("
+
j
+
").Inf("
+
k
+
")"
);
if
(
StringUtil
.
isEmpty
(
mtRegulatoryReporting
))
{
mtRegulatoryReporting
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.RgltryRptg("
+
i
+
").Dtls("
+
j
+
").Inf("
+
k
+
")"
);
}
else
{
mtRegulatoryReporting
+=
" "
+
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.RgltryRptg("
+
i
+
").Dtls("
+
j
+
").Inf("
+
k
+
")"
);
}
}
}
}
}
}
}
...
...
swiftCore/src/main/resources/Messages_CN.properties
View file @
840937a0
...
@@ -8,92 +8,72 @@ credit=\u8d37\u8bb0
...
@@ -8,92 +8,72 @@ credit=\u8d37\u8bb0
debit
=
\u
501f
\u
8bb0
debit
=
\u
501f
\u
8bb0
reversal.credit
=
\u
4ee5
\u
501f
\u
51b2
\u
8d37
reversal.credit
=
\u
4ee5
\u
501f
\u
51b2
\u
8d37
reversal.debit
=
\u
4ee5
\u
8d37
\u
51b2
\u
501f
reversal.debit
=
\u
4ee5
\u
8d37
\u
51b2
\u
501f
yes
=
\u
662f
no
=
\u5426
statement.id
=
\u
5bf9
\u
8d26
\u5355\u6807\u
8bc6
statement.id
=
\u
5bf9
\u
8d26
\u5355\u6807\u
8bc6
statement.account
=
\u
5bf9
\u
8d26
\u5355\u
8d26
\u
53f7
statement.account
=
\u
5bf9
\u
8d26
\u5355\u
8d26
\u
53f7
statement.account.ccy
=
\u
5bf9
\u
8d26
\u5355\u
8d26
\u
53f7
\u
5e01
\u
79cd
statement.sequence.number
=
\u
5bf9
\u
8d26
\u5355\u
53f7
\u7801
statement.sequence.number
=
\u
5bf9
\u
8d26
\u5355\u
53f7
\u7801
statement.page.number
=
\u
5bf9
\u
8d26
\u5355\u5206\u9875\u
5e8f
\u
53f7
statement.page.number
=
\u
5bf9
\u
8d26
\u5355\u9875\u7801
statement.openingBooked.crdr
=
\u
8d77
\u
59cb
\u
4f59
\u
989d
\u
501f
\u
8d37
\u6807\u
8bc6
statement.lastPgInd
=
\u
662f
\u5426\u6700\u
540e
\u
4e00
\u9875
statement.openingBooked.date
=
\u
8d77
\u
59cb
\u
4f59
\u
989d
\u
65e5
\u
671f
statement.openingBooked.crdr
=
\u
671f
\u
521d
\u
4f59
\u
989d
\u
501f
\u
8d37
\u6807\u
8bc6
statement.openingBooked.ccy
=
\u
8d77
\u
59cb
\u
4f59
\u
989d
\u
5e01
\u
79cd
statement.openingBooked.date
=
\u
671f
\u
521d
\u
4f59
\u
989d
\u
65e5
\u
671f
statement.openingBooked.amt
=
\u
8d77
\u
59cb
\u
4f59
\u
989d
\u
91d1
\u
989d
statement.openingBooked.ccy
=
\u
671f
\u
521d
\u
4f59
\u
989d
\u
5e01
\u
79cd
statement.closingBooked.crdr
=
\u
8d26
\u9762\u
4f59
\u
989d
\u
501f
\u
8d37
\u6807\u
8bc6
statement.openingBooked.amt
=
\u
671f
\u
521d
\u
4f59
\u
989d
\u
91d1
\u
989d
statement.closingBooked.date
=
\u
8d26
\u9762\u
4f59
\u
989d
\u
65e5
\u
671f
statement.closingBooked.crdr
=
\u
671f
\u
672b
\u
4f59
\u
989d
\u
501f
\u
8d37
\u6807\u
8bc6
statement.closingBooked.ccy
=
\u
8d26
\u9762\u
4f59
\u
989d
\u
5e01
\u
79cd
statement.closingBooked.date
=
\u
671f
\u
672b
\u
4f59
\u
989d
\u
65e5
\u
671f
statement.closingBooked.amt
=
\u
8d26
\u9762\u
4f59
\u
989d
\u
91d1
\u
989d
statement.closingBooked.ccy
=
\u
671f
\u
672b
\u
4f59
\u
989d
\u
5e01
\u
79cd
statement.entry.valueDate
=
\u
5bf9
\u
8d26
\u5355\u
8d77
\u
606f
\u
65e5
statement.closingBooked.amt
=
\u
671f
\u
672b
\u
4f59
\u
989d
\u
91d1
\u
989d
statement.entry.crdr
=
\u
5bf9
\u
8d26
\u5355\u
501f
\u
8d37
\u6807\u
8bc6
statement.entry.valueDate
=
\u
4ea4
\u6613\u
8d77
\u
606f
\u
65e5
statement.entry.ccy
=
\u
5bf9
\u
8d26
\u5355\u
5e01
\u
79cd
statement.entry.crdr
=
\u
4ea4
\u6613\u
501f
\u
8d37
\u6807\u
8bc6
statement.entry.amt
=
\u
5bf9
\u
8d26
\u5355\u
91d1
\u
989d
statement.entry.ccy
=
\u
4ea4
\u6613\u
5e01
\u
79cd
statement.entry.endToEndId
=
\u
5bf9
\u
8d26
\u5355\u
76f8
\u5173\u
4ea4
\u6613\u6807\u
8bc6
statement.entry.amt
=
\u
4ea4
\u6613\u
91d1
\u
989d
originalGroupInformation.orgnlMsgId
=
\u
539f
\u
59cb
\u
4ea4
\u6613\u
540d
\u
79f0
statement.entry.txnRef
=
\u
5f00
\u6237\u
884c
\u
53c2
\u8003\u6807\u
8bc6
originalGroupInformation.orgnlCreDtTm
=
\u
539f
\u
59cb
\u
4ea4
\u6613\u
521b
\u
5efa
\u
65f6
\u
95f4
statement.entry.acctSvcrRef
=
\u
5e10
\u6237\u
884c
\u
53c2
\u8003\u6807\u
8bc6
cancellationDetails.transactionInformationAndStatus.cancellationStatusReasonInformation.reason.cd
=
\u
4ea4
\u6613\u
64a4
\u9500\u
8bf7
\u
6c42
\u
54cd
\u
5e94
\u
4ee3
\u7801
statement.entry.addtlTxInf
=
\u9644\u
8a00
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
report.account.currency
=
\u6700\u
4f4e
\u
91d1
\u
989d
\u
89c4
\u
5b9a
report.creDtTm
=
\u
65e5
\u
671f
report.transactionsSummary.totalCreditEntries.nbOfNtries
=
\u
501f
\u
8bb0
\u
7b14
\u6570
report.transactionsSummary.totalCreditEntries.sum
=
\u
501f
\u
8bb0
\u
603b
\u
91d1
\u
989d
report.transactionsSummary.totalDebitEntries.nbOfNtries
=
\u
8d37
\u
8bb0
\u
7b14
\u6570
report.transactionsSummary.totalDebitEntries.sum
=
\u
8d37
\u
8bb0
\u
603b
\u
91d1
\u
989d
notification.amount.ccy
=
\u
8d27
\u
5e01
notification.amount.amt
=
\u
91d1
\u
989d
remitter
=
\u
6c47
\u
6b3e
\u
4eba
instructingBank
=
\u6307\u
793a
\u
884c
intermediaryBank
=
\u
4e2d
\u
95f4
\u
884c
remitter.anyBIC
=
\u
6c47
\u
6b3e
\u
4eba
\u
91d1
\u
878d
\u
673a
\u6784
bic
\u
4ee3
\u7801
remitter.ctry
=
\u
6c47
\u
6b3e
\u
4eba
\u
56fd
\u
5bb6
remitter.nm
=
\u
6c47
\u
6b3e
\u
4eba
\u
540d
\u
79f0
account
=
\u
8d26
\u6237
remitter.adrLine
=
\u
6c47
\u
6b3e
\u
4eba
\u5730\u5740
remitter.cd
=
\u
6c47
\u
6b3e
\u
4eba
\u
6e05
\u
7b97
\u
884c
\u
7cfb
\u
7edf
\u
4ee3
\u7801
remitter.mmbId
=
\u
6c47
\u
6b3e
\u
4eba
\u
6e05
\u
7b97
\u
884c
\u
7cfb
\u
7edf
\u
8d26
\u
53f7
#
message.id
=
\u
4e1a
\u
52a1
\u
7f16
\u
53f7
message.id
=
\u
4e1a
\u
52a1
\u
7f16
\u
53f7
endToEnd.id
=
\u
7
6f8
\u5173\u
4e1a
\u
52a1
\u
7f16
\u
53f7
endToEnd.id
=
\u
7
aef
\u5230\u
7aef
\u
552f
\u
4e00
\u6807\u
8bc6
uetr
=
\u
62a5
\u6587\u
8ddf
\u
8e2a
\u
53f7
uetr
=
\u
62a5
\u6587\u
8ddf
\u
8e2a
\u
53f7
settlement.date
=
\u
7ed3
\u
7b97
\u
91d1
\u
989d
settlement.method
=
\u
7ed3
\u
7b97
\u
65b9
\u
5f0f
settlement.amt
=
\u
7ed3
\u
7b97
\u
91d1
\u
989d
settlement.acct
=
\u
7ed3
\u
7b97
\u
8d26
\u
53f7
original.settlement.amt
=
\u
539f
\u
59cb
\u
7ed3
\u
7b97
\u
91d1
\u
989d
settlement.date
=
\u
8d77
\u
606f
\u
65e5
settlement.amt
=
\u
53d1
\u
6c47
\u
91d1
\u
989d
original.settlement.amt
=
\u6536\u
6c47
\u
91d1
\u
989d
exchange.rate
=
\u
6c47
\u7387
exchange.rate
=
\u
6c47
\u7387
charge.by
=
\u
8d39
\u7528\u
627f
\u
62c5
\u
65b9
charge.amt
=
\u
8d39
\u7528\u
91d1
\u
989d
ccy
=
\u
5e01
\u
79cd
ccy
=
\u
5e01
\u
79cd
debtor.info
=
\u
6c47
\u
6b3e
\u
65b9
\u
4fe1
\u
606f
dbtrInfo
=
\u
6c47
\u
6b3e
\u
65b9
\u
4fe1
\u
606f
debtor.acct.info
=
\u
6c47
\u
6b3e
\u
65b9
\u
8d26
\u6237\u
4fe1
\u
606f
dbtrAgtInfo
=
\u
6c47
\u
6b3e
\u
884c
\u
4fe1
\u
606f
creditor.info
=
\u6536\u
6b3e
\u
4eba
\u
4fe1
\u
606f
instgRmbrsmntAgtInfo
=
\u
53d1
\u
62a5
\u
884c
\u7684\u
4ee3
\u7406\u
884c
\u
4fe1
\u
606f
#party
instdRmbrsmntAgtInfo
=
\u6536\u
62a5
\u
884c
\u7684\u
4ee3
\u7406\u
884c
\u
4fe1
\u
606f
name
=
\u
540d
\u
79f0
thrdRmbrsmntAgtInfo
=
\u
7b2c
\u
4e09
\u
65b9
\u
507f
\u
4ed8
\u
884c
\u
4fe1
\u
606f
organisation.bic
=
\u
7ec4
\u
7ec7
\u
673a
\u6784\u6807\u
8bc6
intrmyAgt1Info
=
\u
4e2d
\u
95f4
\u
884c
\u
4fe1
\u
606f
organisation.lei
=
\u
7ec4
\u
7ec7
\u
673a
\u6784\u
6cd5
\u
4eba
\u6807\u
8bc6
cdtrAgtInfo
=
\u6536\u
6b3e
\u
884c
\u
4fe1
\u
606f
organisation.other.code
=
\u
7ec4
\u
7ec7
\u
673a
\u6784\u5176\u
4ed6
\u6807\u
8bc6
\u
4ee3
\u7801
cdtrInfo
=
\u6536\u
6b3e
\u
65b9
\u
4fe1
\u
606f
organisation.other.id
=
\u
7ec4
\u
7ec7
\u
673a
\u6784\u5176\u
4ed6
\u6807\u
8bc6
charge.by
=
\u
8d39
\u7528\u
627f
\u
62c5
\u
65b9
\u
5f0f
private.brith.date
=
\u
51fa
\u
751f
\u
65e5
\u
671f
charge.info
=
\u
8d39
\u7528\u
660e
\u
7ec6
private.brith.country
=
\u
51fa
\u
751f
\u
56fd
\u
5bb6
remittanceInformation
=
\u
6c47
\u
6b3e
\u
4fe1
\u
606f
private.brith.province
=
\u
51fa
\u
751f
\u7701\u
4efd
regulatoryReporting
=
\u
6cd5
\u
89c4
\u
8bf4
\u
660e
private.brith.city
=
\u
51fa
\u
751f
\u
57ce
\u
5e02
private.other.code
=
\u
4e2a
\u
4eba
\u
4fe1
\u
606f
\u5176\u
4ed6
\u6807\u
8bc6
\u
4ee3
\u7801
private.other.id
=
\u
4e2a
\u
4eba
\u
4fe1
\u
606f
\u5176\u
4ed6
\u6807\u
8bc6
phone.number
=
\u7535\u
8bdd
\u
53f7
\u7801
mobile.number
=
\u
624b
\u
673a
\u
53f7
\u7801
fax.number=
\u
4f20
\u
771f
\u
53f7
\u7801
email.number
=
\u
90ae
\u
7bb1
\u5730\u5740
contact.other.type
=
\u5176\u
4ed6
\u8054\u
7cfb
\u
65b9
\u
5f0f
contact.other.id
=
\u5176\u
4ed6
\u8054\u
7cfb
\u
65b9
\u
5f0f
\u6807\u
8bc6
#address
address.type
=
\u5730\u5740\u
7c7b
\u
578b
address.country
=
\u
56fd
\u
5bb6
address.department
=
\u7701\u
4efd
address.sub.department
=
\u
57ce
\u
5e02
address.town.name
=
\u
57ce
\u9547
address.street.name
=
\u8857\u9053
address.building.number
=
\u
5efa
\u
7b51
\u
95e8
\u
724c
\u
53f7
address.building.name
=
\u
5efa
\u
7b51
\u
540d
\u
79f0
address.floor
=
\u
697c
\u
5c42
address.room
=
\u
623f
\u
95f4
\u
53f7
address.post.box
=
\u
90ae
\u
7bb1
address.post.code
=
\u
90ae
\u
653f
\u
7f16
\u7801
address.line
=
\u5730\u5740\u
4fe1
\u
606f
#party&agent
acctIdIban
=
\u
8d26
\u
53f7
acctId
=
\u
8d26
\u
53f7
nm
=
\u
540d
\u
79f0
orgAnyBIC
=
\u
7ec4
\u
7ec7
\u
673a
\u6784\u
884c
\u
53f7
pstlAdrCtry
=
\u
5c45
\u
4f4f
\u5730\u
56fd
\u
5bb6
pstlAdrCtrySubDvsn
=
\u
5c45
\u
4f4f
\u5730\u7701\u
4efd
pstlAdrDstrctNm
=
\u
5c45
\u
4f4f
\u5730\u
57ce
\u
5e02
pstlAdrTwnLctnNm
=
\u
5c45
\u
4f4f
\u5730\u
533a
\u
53bf
pstlAdrDept
=
\u
90e8
\u
95e8
\u
540d
\u
79f0
pstlAdrSubDept
=
\u
5b50
\u
90e8
\u
95e8
\u
540d
\u
79f0
pstlAdrStrtNm
=
\u
5c45
\u
4f4f
\u5730\u8857\u9053
pstlAdrBldgNb
=
\u
4f4f
\u5740\u
95e8
\u
724c
\u
53f7
pstlAdrBldgNm
=
\u
4f4f
\u5740\u
540d
\u
79f0
pstlAdrFlr
=
\u
4f4f
\u5740\u
697c
\u
5c42
pstlAdrRoom
=
\u
4f4f
\u5740\u
623f
\u
95f4
\u
53f7
pstlAdrTwnNm
=
\u
5c45
\u
4f4f
\u5730\u
57ce
\u9547\u
540d
\u
79f0
pstlAdrPstBx
=
\u
4f4f
\u5740\u
90ae
\u
7bb1
\u
7f16
\u
53f7
pstlAdrPstCd
=
\u
4f4f
\u5740\u
90ae
\u
7f16
adrLines
=
\u
4f4f
\u5740\u
4fe1
\u
606f
bicfi
=
\u
7ec4
\u
7ec7
\u
673a
\u6784\u
884c
\u
53f7
clrSysIdType
=
\u
6e05
\u
7b97
\u
7cfb
\u
7edf
\u
4ee3
\u7801
clrSysId
=
\u
6e05
\u
7b97
\u
7cfb
\u
7edf
\u
884c
\u
53f7
\ No newline at end of file
swiftCore/src/main/resources/Messages_US.properties
View file @
840937a0
...
@@ -8,10 +8,14 @@ credit=Credit
...
@@ -8,10 +8,14 @@ credit=Credit
debit
=
Debit
debit
=
Debit
reversal.credit
=
Reversal Credit
reversal.credit
=
Reversal Credit
reversal.debit
=
Reversal Debit
reversal.debit
=
Reversal Debit
yes
=
Yes
no
=
No
statement.id
=
Statement Identifier
statement.id
=
Statement Identifier
statement.account
=
Statement Account Number
statement.account
=
Statement Account Number
statement.account.ccy
=
Statement Account Currency
statement.sequence.number
=
Statement Sequence Number
statement.sequence.number
=
Statement Sequence Number
statement.page.number
=
Statement Page Number
statement.page.number
=
Statement Page Number
statement.lastPgInd
=
Last Page Indicator
statement.openingBooked.crdr
=
Opening Booked Credit Debit Indicator
statement.openingBooked.crdr
=
Opening Booked Credit Debit Indicator
statement.openingBooked.date
=
Opening Booked Value Date
statement.openingBooked.date
=
Opening Booked Value Date
statement.openingBooked.ccy
=
Opening Booked Currency
statement.openingBooked.ccy
=
Opening Booked Currency
...
@@ -24,4 +28,52 @@ statement.entry.valueDate=Statement Entry Value Date
...
@@ -24,4 +28,52 @@ statement.entry.valueDate=Statement Entry Value Date
statement.entry.crdr
=
Statement Entry Credit Debit Indicator
statement.entry.crdr
=
Statement Entry Credit Debit Indicator
statement.entry.ccy
=
Statement Entry Currency
statement.entry.ccy
=
Statement Entry Currency
statement.entry.amt
=
Statement Entry Currency
statement.entry.amt
=
Statement Entry Currency
statement.entry.endToEndId
=
Statement Entry End To End Identification
statement.entry.txnRef
=
Statement Entry Transaction Reference
\ No newline at end of file
statement.entry.acctSvcrRef
=
Statement Entry Account Service Reference
statement.entry.addtlTxInf
=
Additional Information
message.id
=
Message Identifier
endToEnd.id
=
End To End Identification
uetr
=
UETR
settlement.method
=
Settlement Method
settlement.acct
=
Settlement Account Number
settlement.date
=
Interbank Settlement Date
settlement.amt
=
Interbank Settlement Amount
original.settlement.amt
=
Instructed Amount
exchange.rate
=
Exchange Rate
ccy
=
Currency
dbtrInfo
=
Debtor
dbtrAgtInfo
=
Debtor Agent
instgRmbrsmntAgtInfo
=
Instructing Reimbursement Agent
instdRmbrsmntAgtInfo
=
Instructed Reimbursement Agent
thrdRmbrsmntAgtInfo
=
Third Reimbursement Agent
intrmyAgt1Info
=
Intermediary Agent 1
cdtrAgtInfo
=
Creditor Agent
cdtrInfo
=
Creditor
charge.by
=
Charge Bearer
charge.info
=
Charges Information
remittanceInformation
=
Remittance Information
regulatoryReporting
=
Regulatory Reporting
#party&agent
acctIdIban
=
Account Number(IBAN)
acctId
=
Account Number
nm
=
Name
orgAnyBIC
=
Organisation Identification BIC
pstlAdrCtry
=
Country
pstlAdrCtrySubDvsn
=
Country Sub Division
pstlAdrDstrctNm
=
District Name
pstlAdrTwnLctnNm
=
Town Location Name
pstlAdrDept
=
Department
pstlAdrSubDept
=
Sub Department
pstlAdrStrtNm
=
Street Name
pstlAdrBldgNb
=
Building Number
pstlAdrBldgNm
=
Building Name
pstlAdrFlr
=
Floor
pstlAdrRoom
=
Room
pstlAdrTwnNm
=
Town Name
pstlAdrPstBx
=
Post Box
pstlAdrPstCd
=
Post Code
adrLines
=
Address Line
bicfi
=
Financial Institution BIC
clrSysIdType
=
Clearing System Code
clrSysId
=
Clearing System Identification
\ No newline at end of file
swiftCore/src/main/resources/template/entry.properties
View file @
840937a0
...
@@ -5,12 +5,13 @@ ntryCdtDbtInd=cdtDbtInd
...
@@ -5,12 +5,13 @@ ntryCdtDbtInd=cdtDbtInd
ntryRvslInd
=
rvslInd&boolean
ntryRvslInd
=
rvslInd&boolean
ntrySts
=
sts.cd
ntrySts
=
sts.cd
ntryStsPrtry
=
sts.prtry
ntryStsPrtry
=
sts.prtry
ntryBookgDt
=
bookgDt.dt
ntryBookgDt
=
bookgDt.dt
?bookgDt.dtTm
ntryValDt
=
valDt.dt
ntryValDt
=
valDt.dt
?valDt.dtTm
ntryAcctSvcrRef
=
acctSvcrRef
ntryAcctSvcrRef
=
acctSvcrRef
ntryBkTxCdDomnCd
=
bkTxCd.domn.cd
ntryBkTxCdDomnCd
=
bkTxCd.domn.cd
ntryBkTxCdFmlyCd
=
bkTxCd.domn.fmly.cd
ntryBkTxCdFmlyCd
=
bkTxCd.domn.fmly.cd
ntryBkTxCdFmlySubFmlyCd
=
bkTxCd.domn.fmly.subFmlyCd
ntryBkTxCdFmlySubFmlyCd
=
bkTxCd.domn.fmly.subFmlyCd
ntryBkTxCdPrtryCd
=
bkTxCd.prtry.cd
ntryBkTxCdPrtryCd
=
bkTxCd.prtry.cd
endToEndId
=
ntryDtls.txDtls.refs.endToEndId
endToEndId
=
ntryDtls.txDtls.refs.endToEndId
addtlTxInf
=
ntryDtls.txDtls.addtlTxInf
addtlTxInf
=
ntryDtls.txDtls.addtlTxInf
\ No newline at end of file
instrId
=
ntryDtls.txDtls.refs.instrId
\ No newline at end of file
swiftCore/src/test/java/com/brilliance/Mx2ElementTest.java
View file @
840937a0
...
@@ -5,6 +5,8 @@ import org.apache.commons.io.FileUtils;
...
@@ -5,6 +5,8 @@ import org.apache.commons.io.FileUtils;
import
org.junit.Test
;
import
org.junit.Test
;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.Map
;
public
class
Mx2ElementTest
{
public
class
Mx2ElementTest
{
...
@@ -14,4 +16,13 @@ public class Mx2ElementTest {
...
@@ -14,4 +16,13 @@ public class Mx2ElementTest {
String
elementStr
=
SwiftTransfer
.
mx2Element
(
file
);
String
elementStr
=
SwiftTransfer
.
mx2Element
(
file
);
System
.
out
.
println
(
elementStr
);
System
.
out
.
println
(
elementStr
);
}
}
@Test
public
void
testMx2Map
()
throws
IOException
{
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxPacs00800108.xml"));
File
file
=
FileUtils
.
toFile
(
Mx2MtTest
.
class
.
getResource
(
"/swiftXml/MxCamt05300108_950.xml"
));
String
xmlStr
=
FileUtils
.
readFileToString
(
file
);
String
elementStr
=
SwiftTransfer
.
showMxElement
(
xmlStr
,
"CN"
);
System
.
out
.
println
(
elementStr
);
}
}
}
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