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
ffe0eaa1
Commit
ffe0eaa1
authored
Jul 12, 2022
by
zhanghou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据官方文档完成900,910到camt05400108的转化
parent
e400f07f
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1002 additions
and
4 deletions
+1002
-4
AbstractMt2MxParseField.java
...a/com/brilliance/swift/mt2mx/AbstractMt2MxParseField.java
+3
-3
Mt2MxContextIdentifier.java
...va/com/brilliance/swift/mt2mx/Mt2MxContextIdentifier.java
+2
-0
Mt2MxCreatorManager.java
.../java/com/brilliance/swift/mt2mx/Mt2MxCreatorManager.java
+5
-1
AbstractMt2MxCamt054001ParseField.java
...t/mt2mx/camt054001/AbstractMt2MxCamt054001ParseField.java
+88
-0
Mt2MxCamt054001Creator.java
...liance/swift/mt2mx/camt054001/Mt2MxCamt054001Creator.java
+110
-0
Camt054001Parse13DField.java
.../swift/mt2mx/camt054001/impl/Camt054001Parse13DField.java
+75
-0
Camt054001Parse20Field.java
...e/swift/mt2mx/camt054001/impl/Camt054001Parse20Field.java
+22
-0
Camt054001Parse21Field.java
...e/swift/mt2mx/camt054001/impl/Camt054001Parse21Field.java
+32
-0
Camt054001Parse25Field.java
...e/swift/mt2mx/camt054001/impl/Camt054001Parse25Field.java
+42
-0
Camt054001Parse32AField.java
.../swift/mt2mx/camt054001/impl/Camt054001Parse32AField.java
+77
-0
Camt054001Parse50Field.java
...e/swift/mt2mx/camt054001/impl/Camt054001Parse50Field.java
+124
-0
Camt054001Parse52For900Field.java
...t/mt2mx/camt054001/impl/Camt054001Parse52For900Field.java
+109
-0
Camt054001Parse52For910Field.java
...t/mt2mx/camt054001/impl/Camt054001Parse52For910Field.java
+167
-0
Camt054001Parse56Field.java
...e/swift/mt2mx/camt054001/impl/Camt054001Parse56Field.java
+99
-0
Camt054001Parse72Field.java
...e/swift/mt2mx/camt054001/impl/Camt054001Parse72Field.java
+47
-0
No files found.
swiftCore/src/main/java/com/brilliance/swift/mt2mx/AbstractMt2MxParseField.java
View file @
ffe0eaa1
...
...
@@ -128,7 +128,7 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField {
* @param mtAccount
* @param maps(account对应的map对象)
*/
protected
void
mt_to_mxAccount35
(
String
mtAccount
,
Map
<
String
,
Object
>
maps
)
{
protected
void
mt_to_mxAccount35
(
String
mtAccount
,
Map
<
String
,
Object
>
maps
,
String
path
)
{
if
(
StringUtil
.
isEmpty
(
mtAccount
))
{
return
;
}
...
...
@@ -165,9 +165,9 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField {
othrMaps
=
new
HashMap
<>();
idMaps
.
put
(
"othr"
,
othrMaps
);
}
buildSTErrorInfo
(
ERROR
.
T0000T
,
path
,
null
);
othrMaps
.
put
(
"id"
,
mtAccount
.
substring
(
0
,
33
)
+
"+"
);
}
else
if
(
mtAccount
.
length
()
>
1
)
{
mtAccount
=
mtAccount
.
substring
(
1
);
}
else
{
if
(
SwiftTransferUtil
.
checkIbanAccount
(
mtAccount
)){
idMaps
.
put
(
"iban"
,
mtAccount
);
}
else
{
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/Mt2MxContextIdentifier.java
View file @
ffe0eaa1
...
...
@@ -15,4 +15,6 @@ public class Mt2MxContextIdentifier {
* 外部参数
*/
public
static
final
String
EXTERNAL_PARAMETERS_CREATION_DATE
=
"CreationDate"
;
public
static
final
String
MT_TO_MX_FLAG_50
=
"mt.to.mx.flag.50"
;
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/Mt2MxCreatorManager.java
View file @
ffe0eaa1
...
...
@@ -2,6 +2,7 @@ package com.brilliance.swift.mt2mx;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt029001.Mt2MxCamt029001Creator
;
import
com.brilliance.swift.mt2mx.camt054001.Mt2MxCamt054001Creator
;
import
com.brilliance.swift.mt2mx.camt056001.Mt2MxCamt056001Creator
;
import
com.brilliance.swift.mt2mx.pacs008001.Mt2MxPacs008001Creator
;
import
com.brilliance.swift.mt2mx.pacs009001.Mt2MxPacs009001Creator
;
...
...
@@ -53,7 +54,10 @@ public class Mt2MxCreatorManager {
return
new
Mt2MxCamt029001Creator
();
}
else
if
(
"192"
.
equals
(
messageType
)||
"292"
.
equals
(
messageType
))
{
return
new
Mt2MxCamt056001Creator
();
}
else
{
}
else
if
(
"900"
.
equals
(
messageType
)||
"910"
.
equals
(
messageType
))
{
return
new
Mt2MxCamt054001Creator
();
}
else
{
throw
new
SwiftException
(
"ERROR"
,
"Invalid message type"
);
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/AbstractMt2MxCamt054001ParseField.java
0 → 100644
View file @
ffe0eaa1
package
com
.
brilliance
.
swift
.
mt2mx
.
camt054001
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.mt2mx.AbstractMt2MxParseField
;
import
java.util.HashMap
;
import
java.util.Map
;
public
abstract
class
AbstractMt2MxCamt054001ParseField
extends
AbstractMt2MxParseField
{
protected
Map
<
String
,
Object
>
appHdrMaps
=
null
;
protected
Map
<
String
,
Object
>
grpHdrMaps
=
null
;
protected
Map
<
String
,
Object
>
ntfctnMaps
=
null
;
@Override
public
void
initJsonMaps
()
{
super
.
initJsonMaps
();
appHdrMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"appHdr"
);
Map
<
String
,
Object
>
BkToCstmrDbtCdtNtfctnMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"bkToCstmrDbtCdtNtfctn"
);
grpHdrMaps
=
(
Map
<
String
,
Object
>)
BkToCstmrDbtCdtNtfctnMaps
.
get
(
"grpHdr"
);
JSONArray
ntfctnJsonArray
=
(
JSONArray
)
BkToCstmrDbtCdtNtfctnMaps
.
get
(
"ntfctn"
);
ntfctnMaps
=
(
Map
<
String
,
Object
>)
ntfctnJsonArray
.
get
(
0
);
}
public
Map
<
String
,
Object
>
getTransactionDetails
(){
Map
<
String
,
Object
>
ntryMaps
=
null
;
JSONArray
ntryJsonArray
=
null
;
Map
<
String
,
Object
>
ntryDtlsMaps
=
null
;
JSONArray
ntryDtlsJsonArray
=
null
;
Map
<
String
,
Object
>
txDtlsMaps
=
null
;
JSONArray
txDtlsJsonArray
=
null
;
if
(
ntfctnMaps
.
containsKey
(
"ntry"
)){
ntryJsonArray
=
(
JSONArray
)
ntfctnMaps
.
get
(
"ntry"
);
if
(
ntryJsonArray
!=
null
){
if
(
ntryJsonArray
.
size
()>
0
)
{
ntryMaps
=
(
Map
<
String
,
Object
>)
ntryJsonArray
.
get
(
0
);
}
else
{
ntryMaps
=
new
HashMap
<>();
ntryJsonArray
.
add
(
ntryMaps
);
}
}
}
else
{
ntryJsonArray
=
new
JSONArray
();
ntryMaps
=
new
HashMap
<>();
ntfctnMaps
.
put
(
"ntry"
,
ntryJsonArray
);
ntryJsonArray
.
add
(
ntryMaps
);
}
if
(
ntryMaps
!=
null
){
if
(
ntryMaps
.
containsKey
(
"ntryDtls"
)){
ntryDtlsJsonArray
=
(
JSONArray
)
ntryMaps
.
get
(
"ntryDtls"
);
if
(
ntryDtlsJsonArray
!=
null
){
if
(
ntryDtlsJsonArray
.
size
()>
0
)
{
ntryDtlsMaps
=
(
Map
<
String
,
Object
>)
ntryDtlsJsonArray
.
get
(
0
);
}
else
{
ntryDtlsMaps
=
new
HashMap
<>();
ntryDtlsJsonArray
.
add
(
ntryDtlsMaps
);
}
}
}
else
{
ntryDtlsJsonArray
=
new
JSONArray
();
ntryDtlsMaps
=
new
HashMap
<>();
ntryMaps
.
put
(
"ntryDtls"
,
ntryDtlsJsonArray
);
ntryDtlsJsonArray
.
add
(
ntryDtlsMaps
);
}
if
(
ntryDtlsMaps
!=
null
){
if
(
ntryDtlsMaps
.
containsKey
(
"txDtls"
)){
txDtlsJsonArray
=
(
JSONArray
)
ntryDtlsMaps
.
get
(
"txDtls"
);
if
(
txDtlsJsonArray
!=
null
){
if
(
txDtlsJsonArray
.
size
()>
0
)
{
txDtlsMaps
=
(
Map
<
String
,
Object
>)
txDtlsJsonArray
.
get
(
0
);
}
else
{
txDtlsMaps
=
new
HashMap
<>();
txDtlsJsonArray
.
add
(
txDtlsMaps
);
}
}
}
else
{
txDtlsJsonArray
=
new
JSONArray
();
txDtlsMaps
=
new
HashMap
<>();
ntryDtlsMaps
.
put
(
"txDtls"
,
txDtlsJsonArray
);
txDtlsJsonArray
.
add
(
txDtlsMaps
);
}
}
}
return
txDtlsMaps
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/Mt2MxCamt054001Creator.java
0 → 100644
View file @
ffe0eaa1
package
com
.
brilliance
.
swift
.
mt2mx
.
camt054001
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.mt2mx.AbstractMt2MxCreator
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.Mt2MxParseField
;
import
com.brilliance.swift.mt2mx.camt029001.impl.*
;
import
com.brilliance.swift.mt2mx.camt054001.impl.*
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field32A
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mx.dic.CreditDebitCode
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
Mt2MxCamt054001Creator
extends
AbstractMt2MxCreator
{
@Override
public
void
preProcess
()
{
super
.
preProcess
();
jsonMaps
.
put
(
"identifier"
,
"camt.054.001.08"
);
Map
<
String
,
Object
>
appHdrMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"appHdr"
);
appHdrMaps
.
put
(
"msgDefIdr"
,
"camt.054.001.08"
);
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
//初始化转换和不需要BLOCK4的转换
Map
<
String
,
Object
>
bkToCstmrDbtCdtNtfctnMaps
=
new
HashMap
<>();
jsonMaps
.
put
(
"bkToCstmrDbtCdtNtfctn"
,
bkToCstmrDbtCdtNtfctnMaps
);
Map
<
String
,
Object
>
grpHdrMaps
=
new
HashMap
<>();
bkToCstmrDbtCdtNtfctnMaps
.
put
(
"grpHdr"
,
grpHdrMaps
);
grpHdrMaps
.
put
(
"creDtTm"
,
"9999-12-31T00:00:00+00:00"
);
grpHdrMaps
.
put
(
"nbOfTxs"
,
"1"
);
Map
<
String
,
Object
>
ntfctnMaps
=
new
HashMap
<>();
JSONArray
ntfctnJsonArray
=
new
JSONArray
();
ntfctnJsonArray
.
add
(
ntfctnMaps
);
bkToCstmrDbtCdtNtfctnMaps
.
put
(
"ntfctn"
,
ntfctnJsonArray
);
Map
<
String
,
Object
>
ntryMaps
=
new
HashMap
<>();
JSONArray
ntryJsonArray
=
new
JSONArray
();
ntryJsonArray
.
add
(
ntryMaps
);
ntfctnMaps
.
put
(
"ntry"
,
ntryJsonArray
);
Map
<
String
,
Object
>
ntryDtlsMaps
=
new
HashMap
<>();
JSONArray
ntryDtlsJsonArray
=
new
JSONArray
();
ntryDtlsJsonArray
.
add
(
ntryDtlsMaps
);
ntryMaps
.
put
(
"ntryDtls"
,
ntryDtlsJsonArray
);
Map
<
String
,
Object
>
txDtlsMaps
=
new
HashMap
<>();
JSONArray
txDtlsJsonArray
=
new
JSONArray
();
txDtlsJsonArray
.
add
(
txDtlsMaps
);
ntryDtlsMaps
.
put
(
"txDtls"
,
txDtlsJsonArray
);
Map
<
String
,
Object
>
stsMaps
=
new
HashMap
<>();
ntryMaps
.
put
(
"sts"
,
stsMaps
);
Map
<
String
,
Object
>
bkTxCdMaps
=
new
HashMap
<>();
stsMaps
.
put
(
"cd"
,
"BOOK"
);
ntryMaps
.
put
(
"bkTxCd"
,
bkTxCdMaps
);
Map
<
String
,
Object
>
prtryMaps
=
new
HashMap
<>();
bkTxCdMaps
.
put
(
"prtry"
,
prtryMaps
);
prtryMaps
.
put
(
"cd"
,
Mx2MtConstants
.
MT_TO_MX_DEFAULT_VALUE
);
prtryMaps
.
put
(
"issr"
,
Mx2MtConstants
.
MT_TO_MX_DEFAULT_VALUE
);
ntryMaps
.
put
(
"ntryRef"
,
Mx2MtConstants
.
MT_TO_MX_DEFAULT_VALUE
);
if
(
"900"
.
equals
(
abstractMT
.
getMessageType
())){
ntryMaps
.
put
(
"cdtDbtInd"
,
CreditDebitCode
.
DBIT
);
txDtlsMaps
.
put
(
"cdtDbtInd"
,
CreditDebitCode
.
DBIT
);
}
else
if
(
"910"
.
equals
(
abstractMT
.
getMessageType
())){
ntryMaps
.
put
(
"cdtDbtInd"
,
CreditDebitCode
.
CRDT
);
txDtlsMaps
.
put
(
"cdtDbtInd"
,
CreditDebitCode
.
CRDT
);
}
Tag
tag32A
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
"32A"
);
if
(
tag32A
!=
null
){
Field32A
field32A
=
(
Field32A
)
tag32A
.
asField
();
if
(
field32A
.
getValue
().
length
()>
10
){
Map
<
String
,
Object
>
acctMaps
=
null
;
if
(
ntfctnMaps
.
containsKey
(
"acct"
)){
acctMaps
=
(
Map
<
String
,
Object
>)
ntfctnMaps
.
get
(
"acct"
);
}
else
{
acctMaps
=
new
HashMap
<>();
ntfctnMaps
.
put
(
"acct"
,
acctMaps
);
}
acctMaps
.
put
(
"ccy"
,
field32A
.
getValue
().
substring
(
6
,
9
));
}
}
String
uetr
=
abstractMT
.
getSwiftMessage
().
getUETR
();
if
(
StringUtil
.
isNotEmpty
(
uetr
))
{
Map
<
String
,
Object
>
refsMaps
=
new
HashMap
<>();
txDtlsMaps
.
put
(
"refs"
,
refsMaps
);
refsMaps
.
put
(
"uetr"
,
uetr
);
}
}
@Override
public
List
<
Mt2MxParseField
>
getParseFieldList
()
{
List
<
Mt2MxParseField
>
list
=
new
ArrayList
<>();
list
.
add
(
new
Camt054001Parse13DField
());
list
.
add
(
new
Camt054001Parse20Field
());
list
.
add
(
new
Camt054001Parse21Field
());
list
.
add
(
new
Camt054001Parse25Field
());
list
.
add
(
new
Camt054001Parse32AField
());
list
.
add
(
new
Camt054001Parse50Field
());
list
.
add
(
new
Camt054001Parse52For900Field
());
list
.
add
(
new
Camt054001Parse52For910Field
());
list
.
add
(
new
Camt054001Parse56Field
());
list
.
add
(
new
Camt054001Parse72Field
());
return
list
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse13DField.java
0 → 100644
View file @
ffe0eaa1
package
com
.
brilliance
.
swift
.
mt2mx
.
camt054001
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt054001.AbstractMt2MxCamt054001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field13D
;
import
com.prowidesoftware.swift.model.field.Field25
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
Camt054001Parse13DField
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME
=
"13D"
;
@Override
public
void
parseField
()
throws
SwiftException
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag13D
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
Map
<
String
,
Object
>
ntryMaps
=
null
;
JSONArray
ntryJsonArray
=
null
;
if
(
ntfctnMaps
.
containsKey
(
"ntry"
)){
ntryJsonArray
=
(
JSONArray
)
ntfctnMaps
.
get
(
"ntry"
);
if
(
ntryJsonArray
!=
null
){
if
(
ntryJsonArray
.
size
()>
0
)
{
ntryMaps
=
(
Map
<
String
,
Object
>)
ntryJsonArray
.
get
(
0
);
}
else
{
ntryMaps
=
new
HashMap
<>();
ntryJsonArray
.
add
(
ntryMaps
);
}
}
}
else
{
ntryJsonArray
=
new
JSONArray
();
ntryMaps
=
new
HashMap
<>();
ntfctnMaps
.
put
(
"ntry"
,
ntryJsonArray
);
ntryJsonArray
.
add
(
ntryMaps
);
}
Map
<
String
,
Object
>
bookgDtMaps
=
new
HashMap
<>();
ntryMaps
.
put
(
"bookgDt"
,
bookgDtMaps
);
if
(
tag13D
!=
null
)
{
String
xmlDateStr
=
""
;
Field13D
field13D
=
(
Field13D
)
tag13D
.
asField
();
if
(
field13D
.
getDate
().
length
()==
6
){
xmlDateStr
=
"20"
+
field13D
.
getDate
().
substring
(
0
,
2
)
+
"-"
+
field13D
.
getDate
().
substring
(
2
,
4
)
+
"-"
+
field13D
.
getDate
().
substring
(
4
,
6
);
}
else
if
(
field13D
.
getDate
().
length
()==
8
){
xmlDateStr
=
field13D
.
getDate
().
substring
(
0
,
4
)
+
"-"
+
field13D
.
getDate
().
substring
(
4
,
6
)
+
"-"
+
field13D
.
getDate
().
substring
(
6
,
8
);
}
String
mxTime
=
""
;
if
(
field13D
.
getTime
().
length
()==
4
){
mxTime
=
field13D
.
getTime
().
substring
(
0
,
2
)+
":"
+
field13D
.
getTime
().
substring
(
2
)+
":00"
;
}
else
if
(
field13D
.
getTime
().
length
()==
6
){
mxTime
=
field13D
.
getTime
().
substring
(
0
,
2
)+
":"
+
field13D
.
getTime
().
substring
(
2
,
4
)+
":"
+
field13D
.
getTime
().
substring
(
4
);
}
else
{
mxTime
=
field13D
.
getTime
().
substring
(
0
,
2
)+
":"
+
field13D
.
getTime
().
substring
(
2
,
4
)+
":"
+
field13D
.
getTime
().
substring
(
4
,
6
)
+
"."
+
field13D
.
getTime
().
substring
(
7
);
}
String
mxOffset
=
""
;
if
(
field13D
.
getOffset
().
length
()==
4
){
mxOffset
=
field13D
.
getOffset
().
substring
(
0
,
2
)+
":"
+
field13D
.
getOffset
().
substring
(
2
);
}
else
{
mxOffset
=
field13D
.
getOffset
()+
":00"
;
}
xmlDateStr
=
xmlDateStr
+
"T"
+
mxTime
+
"+"
+
mxOffset
;
bookgDtMaps
.
put
(
"dtTm"
,
xmlDateStr
);
}
else
{
bookgDtMaps
.
put
(
"dtTm"
,
"9999-12-31T00:00:00+00:00"
);
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse20Field.java
0 → 100644
View file @
ffe0eaa1
package
com
.
brilliance
.
swift
.
mt2mx
.
camt054001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt054001.AbstractMt2MxCamt054001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
public
class
Camt054001Parse20Field
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME
=
"20"
;
@Override
public
void
parseField
()
throws
SwiftException
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag20
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag20
!=
null
)
{
appHdrMaps
.
put
(
"bizMsgIdr"
,
tag20
.
getValue
());
grpHdrMaps
.
put
(
"msgId"
,
tag20
.
getValue
());
ntfctnMaps
.
put
(
"id"
,
tag20
.
getValue
());
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse21Field.java
0 → 100644
View file @
ffe0eaa1
package
com
.
brilliance
.
swift
.
mt2mx
.
camt054001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt054001.AbstractMt2MxCamt054001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
Camt054001Parse21Field
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME
=
"21"
;
@Override
public
void
parseField
()
throws
SwiftException
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag21
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag21
!=
null
)
{
Map
<
String
,
Object
>
txDtlsMaps
=
getTransactionDetails
();
Map
<
String
,
Object
>
refsMaps
=
null
;
if
(
txDtlsMaps
.
containsKey
(
"refs"
)){
refsMaps
=
(
Map
<
String
,
Object
>)
txDtlsMaps
.
get
(
"refs"
);
}
else
{
refsMaps
=
new
HashMap
<>();
txDtlsMaps
.
put
(
"refs"
,
refsMaps
);
}
refsMaps
.
put
(
"endToEndId"
,
tag21
.
getValue
());
refsMaps
.
put
(
"instrId"
,
tag21
.
getValue
());
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse25Field.java
0 → 100644
View file @
ffe0eaa1
package
com
.
brilliance
.
swift
.
mt2mx
.
camt054001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt054001.AbstractMt2MxCamt054001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field25
;
import
com.prowidesoftware.swift.model.field.Field25P
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
Camt054001Parse25Field
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME_25
=
"25"
;
private
static
final
String
NAME_25P
=
"25P"
;
@Override
public
void
parseField
()
throws
SwiftException
{
Field25
field25
=
null
;
Field25P
field25P
=
null
;
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag25
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_25
);
Tag
tag25P
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_25P
);
Map
<
String
,
Object
>
acctMaps
=
null
;
if
(
ntfctnMaps
.
containsKey
(
"acct"
))
{
acctMaps
=
(
Map
<
String
,
Object
>)
ntfctnMaps
.
get
(
"acct"
);
}
else
{
acctMaps
=
new
HashMap
<>();
ntfctnMaps
.
put
(
"acct"
,
acctMaps
);
}
if
(
tag25
!=
null
){
field25
=
(
Field25
)
tag25
.
asField
();
mt_to_mxAccount35
(
field25
.
getValue
(),
acctMaps
,
"Ntfctn/Acct/Id/Othr/Id"
);
}
if
(
tag25P
!=
null
){
field25P
=
(
Field25P
)
tag25P
.
asField
();
mt_to_mxAccount35
(
field25P
.
getValue
(),
acctMaps
,
"Ntfctn/Acct/Id/Othr/Id"
);
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse32AField.java
0 → 100644
View file @
ffe0eaa1
package
com
.
brilliance
.
swift
.
mt2mx
.
camt054001
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt054001.AbstractMt2MxCamt054001ParseField
;
import
com.brilliance.swift.util.DateUtil
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field32A
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
Camt054001Parse32AField
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME
=
"32A"
;
@Override
public
void
parseField
()
throws
SwiftException
{
try
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag32A
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag32A
!=
null
)
{
Field32A
field32A
=
(
Field32A
)
tag32A
.
asField
();
Date
date
=
DateUtil
.
parseDate
(
"20"
+
field32A
.
getDate
(),
"yyyyMMdd"
);
String
dateStr
=
DateUtil
.
format
(
date
,
"yyyy-MM-dd"
);
Map
<
String
,
Object
>
ntryMaps
=
null
;
JSONArray
ntryJsonArray
=
null
;
if
(
ntfctnMaps
.
containsKey
(
"ntry"
)){
ntryJsonArray
=
(
JSONArray
)
ntfctnMaps
.
get
(
"ntry"
);
if
(
ntryJsonArray
!=
null
){
if
(
ntryJsonArray
.
size
()>
0
)
{
ntryMaps
=
(
Map
<
String
,
Object
>)
ntryJsonArray
.
get
(
0
);
}
else
{
ntryMaps
=
new
HashMap
<>();
ntryJsonArray
.
add
(
ntryMaps
);
}
}
}
else
{
ntryJsonArray
=
new
JSONArray
();
ntryMaps
=
new
HashMap
<>();
ntfctnMaps
.
put
(
"ntry"
,
ntryJsonArray
);
ntryJsonArray
.
add
(
ntryMaps
);
}
Map
<
String
,
Object
>
valDtMaps
=
new
HashMap
<>();
ntryMaps
.
put
(
"valDt"
,
valDtMaps
);
valDtMaps
.
put
(
"dt"
,
dateStr
);
Map
<
String
,
Object
>
txDtlsMaps
=
getTransactionDetails
();
Map
<
String
,
Object
>
rltdDtsMaps
=
new
HashMap
<>();
txDtlsMaps
.
put
(
"rltdDts"
,
rltdDtsMaps
);
rltdDtsMaps
.
put
(
"intrBkSttlmDt"
,
dateStr
);
Map
<
String
,
Object
>
amtMaps
=
null
;
Map
<
String
,
Object
>
txDtlsamtMaps
=
null
;
if
(
ntryMaps
.
containsKey
(
"amt"
)){
amtMaps
=
(
Map
<
String
,
Object
>)
ntryMaps
.
get
(
"amt"
);
}
else
{
amtMaps
=
new
HashMap
<>();
ntryMaps
.
put
(
"amt"
,
amtMaps
);
}
if
(
txDtlsMaps
.
containsKey
(
"amt"
)){
txDtlsamtMaps
=
(
Map
<
String
,
Object
>)
txDtlsMaps
.
get
(
"amt"
);
}
else
{
txDtlsamtMaps
=
new
HashMap
<>();
txDtlsMaps
.
put
(
"amt"
,
txDtlsamtMaps
);
}
amtMaps
.
put
(
"value"
,
field32A
.
amount
());
txDtlsamtMaps
.
put
(
"value"
,
field32A
.
amount
());
amtMaps
.
put
(
"ccy"
,
field32A
.
getCurrency
());
txDtlsamtMaps
.
put
(
"ccy"
,
field32A
.
getCurrency
());
}
}
catch
(
ParseException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse50Field.java
0 → 100644
View file @
ffe0eaa1
package
com
.
brilliance
.
swift
.
mt2mx
.
camt054001
.
impl
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.camt054001.AbstractMt2MxCamt054001ParseField
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field50A
;
import
com.prowidesoftware.swift.model.field.Field50F
;
import
com.prowidesoftware.swift.model.field.Field50K
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
Camt054001Parse50Field
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME_A
=
"50A"
;
private
static
final
String
NAME_F
=
"50F"
;
private
static
final
String
NAME_K
=
"50K"
;
@Override
public
void
parseField
()
throws
SwiftException
{
Field50A
field50A
=
null
;
Field50F
field50F
=
null
;
Field50K
field50K
=
null
;
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
if
(
"900"
.
equals
(
abstractMT
.
getMessageType
())){
return
;
}
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_A
);
if
(
tag
!=
null
)
{
field50A
=
(
Field50A
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_F
);
if
(
tag
!=
null
)
{
field50F
=
(
Field50F
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_K
);
if
(
tag
!=
null
)
{
field50K
=
(
Field50K
)
tag
.
asField
();
}
if
(
field50A
!=
null
||
field50F
!=
null
||
field50K
!=
null
){
context
.
set
(
Mt2MxContextIdentifier
.
MT_TO_MX_FLAG_50
,
"true"
);
}
Map
<
String
,
Object
>
txDtlsMaps
=
getTransactionDetails
();
Map
<
String
,
Object
>
rltdPtiesMaps
=
null
;
if
(
txDtlsMaps
.
containsKey
(
"rltdPties"
))
{
rltdPtiesMaps
=
(
Map
<
String
,
Object
>)
txDtlsMaps
.
get
(
"rltdPties"
);
}
else
{
rltdPtiesMaps
=
new
HashMap
<>();
txDtlsMaps
.
put
(
"rltdPties"
,
rltdPtiesMaps
);
}
Map
<
String
,
Object
>
dbtrMaps
=
null
;
if
(
rltdPtiesMaps
.
containsKey
(
"dbtr"
))
{
dbtrMaps
=
(
Map
<
String
,
Object
>)
rltdPtiesMaps
.
get
(
"dbtr"
);
}
else
{
dbtrMaps
=
new
HashMap
<>();
rltdPtiesMaps
.
put
(
"dbtr"
,
dbtrMaps
);
}
Map
<
String
,
Object
>
ptyMaps
=
null
;
if
(
dbtrMaps
.
containsKey
(
"pty"
))
{
ptyMaps
=
(
Map
<
String
,
Object
>)
dbtrMaps
.
get
(
"pty"
);
}
else
{
ptyMaps
=
new
HashMap
<>();
dbtrMaps
.
put
(
"pty"
,
ptyMaps
);
}
Map
<
String
,
Object
>
dbtrAcctMaps
=
null
;
if
(
rltdPtiesMaps
.
containsKey
(
"dbtrAcct"
))
{
dbtrAcctMaps
=
(
Map
<
String
,
Object
>)
rltdPtiesMaps
.
get
(
"dbtrAcct"
);
}
else
{
dbtrAcctMaps
=
new
HashMap
<>();
}
String
account
=
""
;
if
(
field50A
!=
null
)
{
String
bicCode
=
field50A
.
getBIC
();
if
(
StringUtil
.
isNotEmpty
(
field50A
.
getComponent1
()))
{
account
+=
"/"
+
field50A
.
getComponent1
();
}
mt_to_mxAnyBIC
(
bicCode
,
ptyMaps
);
mt_to_mxPartyAccount
(
account
,
dbtrAcctMaps
);
}
if
(
field50F
!=
null
)
{
String
partyIdentifier
=
field50F
.
getPartyIdentifier
();
String
nameAddress
=
""
;
List
<
String
>
lines
=
field50F
.
getLines
();
for
(
int
i
=
0
;
i
<
lines
.
size
();
i
++)
{
if
(
i
==
0
)
{
continue
;
}
if
(
i
==
lines
.
size
()-
1
)
{
nameAddress
+=
lines
.
get
(
i
);
}
else
{
nameAddress
+=
lines
.
get
(
i
)
+
Mx2MtConstants
.
NEW_LINE
;
}
}
if
(
partyIdentifier
.
startsWith
(
"/"
))
{
mt_to_mxPartyAccount
(
partyIdentifier
,
dbtrAcctMaps
);
}
else
{
Map
<
String
,
Object
>
idMaps
=
null
;
if
(
ptyMaps
.
containsKey
(
"id"
))
{
idMaps
=
(
Map
<
String
,
Object
>)
ptyMaps
.
get
(
"id"
);
}
else
{
idMaps
=
new
HashMap
<>();
ptyMaps
.
put
(
"id"
,
idMaps
);
}
mt_to_mxFATFIdentification
(
partyIdentifier
,
nameAddress
,
idMaps
);
}
mt_to_mxFATFNameAndAddress
(
partyIdentifier
,
nameAddress
,
dbtrMaps
);
}
if
(
field50K
!=
null
)
{
String
nameAddress
=
field50K
.
getNameAndAddress
();
if
(
StringUtil
.
isNotEmpty
(
field50K
.
getComponent1
()))
{
account
+=
"/"
+
field50K
.
getComponent1
();
}
mt_to_mxPartyNameAndAddress
(
nameAddress
,
ptyMaps
);
mt_to_mxPartyAccount
(
account
,
dbtrAcctMaps
);
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse52For900Field.java
0 → 100644
View file @
ffe0eaa1
package
com
.
brilliance
.
swift
.
mt2mx
.
camt054001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.camt054001.AbstractMt2MxCamt054001ParseField
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field52A
;
import
com.prowidesoftware.swift.model.field.Field52D
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
Camt054001Parse52For900Field
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME_A
=
"52A"
;
private
static
final
String
NAME_D
=
"52D"
;
@Override
public
void
parseField
()
throws
SwiftException
{
Field52A
field52A
=
null
;
Field52D
field52D
=
null
;
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
if
(
"910"
.
equals
(
abstractMT
.
getMessageType
())){
return
;
}
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_A
);
if
(
tag
!=
null
)
{
field52A
=
(
Field52A
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_D
);
if
(
tag
!=
null
)
{
field52D
=
(
Field52D
)
tag
.
asField
();
}
Map
<
String
,
Object
>
txDtlsMaps
=
getTransactionDetails
();
Map
<
String
,
Object
>
rltdPtiesMaps
=
null
;
if
(
txDtlsMaps
.
containsKey
(
"rltdPties"
))
{
rltdPtiesMaps
=
(
Map
<
String
,
Object
>)
txDtlsMaps
.
get
(
"rltdPties"
);
}
else
{
rltdPtiesMaps
=
new
HashMap
<>();
txDtlsMaps
.
put
(
"rltdPties"
,
rltdPtiesMaps
);
}
Map
<
String
,
Object
>
dbtrAcctMaps
=
null
;
if
(
rltdPtiesMaps
.
containsKey
(
"dbtrAcct"
))
{
dbtrAcctMaps
=
(
Map
<
String
,
Object
>)
rltdPtiesMaps
.
get
(
"dbtrAcct"
);
}
else
{
dbtrAcctMaps
=
new
HashMap
<>();
rltdPtiesMaps
.
put
(
"dbtrAcct"
,
dbtrAcctMaps
);
}
Map
<
String
,
Object
>
dbtrMaps
=
null
;
if
(
rltdPtiesMaps
.
containsKey
(
"dbtr"
))
{
dbtrMaps
=
(
Map
<
String
,
Object
>)
rltdPtiesMaps
.
get
(
"dbtr"
);
}
else
{
dbtrMaps
=
new
HashMap
<>();
rltdPtiesMaps
.
put
(
"dbtr"
,
dbtrMaps
);
}
Map
<
String
,
Object
>
agtMaps
=
null
;
if
(
rltdPtiesMaps
.
containsKey
(
"agt"
))
{
agtMaps
=
(
Map
<
String
,
Object
>)
dbtrMaps
.
get
(
"agt"
);
}
else
{
agtMaps
=
new
HashMap
<>();
dbtrMaps
.
put
(
"agt"
,
agtMaps
);
}
String
account
=
""
;
if
(
field52A
!=
null
)
{
String
bicCode
=
field52A
.
getBIC
();
mt_to_mxBICFI
(
bicCode
,
agtMaps
);
if
(
StringUtil
.
isNotEmpty
(
field52A
.
getComponent1
()))
{
account
+=
"/"
+
field52A
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field52A
.
getComponent2
()))
{
account
+=
"/"
+
field52A
.
getComponent2
();
}
}
if
(
field52D
!=
null
)
{
if
(
StringUtil
.
isNotEmpty
(
field52D
.
getComponent1
()))
{
account
+=
"/"
+
field52D
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field52D
.
getComponent2
()))
{
account
+=
"/"
+
field52D
.
getComponent2
();
}
String
nameAddress
=
field52D
.
getNameAndAddress
();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress
(
nameAddress
,
agtMaps
);
}
if
(
StringUtil
.
isNotEmpty
(
account
))
{
if
(
account
.
startsWith
(
"//"
)
&&
!
account
.
startsWith
(
"//CH"
)
&&
!
account
.
startsWith
(
"//FW"
))
{
Map
<
String
,
Object
>
finInstnIdMaps
=
null
;
if
(
agtMaps
.
containsKey
(
"finInstnId"
))
{
finInstnIdMaps
=
(
Map
<
String
,
Object
>)
agtMaps
.
get
(
"finInstnId"
);
}
else
{
finInstnIdMaps
=
new
HashMap
<>();
agtMaps
.
put
(
"finInstnId"
,
finInstnIdMaps
);
}
Map
<
String
,
Object
>
clrSysMmbIdMaps
=
null
;
if
(
finInstnIdMaps
.
containsKey
(
"clrSysMmbId"
))
{
clrSysMmbIdMaps
=
(
Map
<
String
,
Object
>)
finInstnIdMaps
.
get
(
"clrSysMmbId"
);
}
else
{
clrSysMmbIdMaps
=
new
HashMap
<>();
finInstnIdMaps
.
put
(
"clrSysMmbId"
,
clrSysMmbIdMaps
);
}
mt_to_mxClearingIdentifier
(
account
,
clrSysMmbIdMaps
);
}
else
if
(!
account
.
startsWith
(
"//"
)
||
account
.
startsWith
(
"//CH"
))
{
mt_to_mxFinancialInstitutionAccount
(
account
,
dbtrAcctMaps
,
"DbtrAcct/Id"
);
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse52For910Field.java
0 → 100644
View file @
ffe0eaa1
package
com
.
brilliance
.
swift
.
mt2mx
.
camt054001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.camt054001.AbstractMt2MxCamt054001ParseField
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field52A
;
import
com.prowidesoftware.swift.model.field.Field52D
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
Camt054001Parse52For910Field
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME_A
=
"52A"
;
private
static
final
String
NAME_D
=
"52D"
;
@Override
public
void
parseField
()
throws
SwiftException
{
Field52A
field52A
=
null
;
Field52D
field52D
=
null
;
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
if
(
"900"
.
equals
(
abstractMT
.
getMessageType
())){
return
;
}
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_A
);
if
(
tag
!=
null
)
{
field52A
=
(
Field52A
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_D
);
if
(
tag
!=
null
)
{
field52D
=
(
Field52D
)
tag
.
asField
();
}
Map
<
String
,
Object
>
txDtlsMaps
=
getTransactionDetails
();
String
flag
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_TO_MX_FLAG_50
);
if
(
"true"
.
equals
(
flag
)){
Map
<
String
,
Object
>
rltdAgtsMaps
=
null
;
if
(
txDtlsMaps
.
containsKey
(
"rltdAgts"
))
{
rltdAgtsMaps
=
(
Map
<
String
,
Object
>)
txDtlsMaps
.
get
(
"rltdAgts"
);
}
else
{
rltdAgtsMaps
=
new
HashMap
<>();
txDtlsMaps
.
put
(
"rltdAgts"
,
rltdAgtsMaps
);
}
Map
<
String
,
Object
>
dbtrAgtMaps
=
null
;
if
(
rltdAgtsMaps
.
containsKey
(
"dbtrAgt"
))
{
dbtrAgtMaps
=
(
Map
<
String
,
Object
>)
rltdAgtsMaps
.
get
(
"dbtrAgt"
);
}
else
{
dbtrAgtMaps
=
new
HashMap
<>();
rltdAgtsMaps
.
put
(
"dbtrAgt"
,
dbtrAgtMaps
);
}
String
account
=
""
;
if
(
field52A
!=
null
)
{
String
bicCode
=
field52A
.
getBIC
();
mt_to_mxBICFI
(
bicCode
,
dbtrAgtMaps
);
if
(
StringUtil
.
isNotEmpty
(
field52A
.
getComponent1
()))
{
account
+=
"/"
+
field52A
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field52A
.
getComponent2
()))
{
account
+=
"/"
+
field52A
.
getComponent2
();
}
}
if
(
field52D
!=
null
)
{
if
(
StringUtil
.
isNotEmpty
(
field52D
.
getComponent1
()))
{
account
+=
"/"
+
field52D
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field52D
.
getComponent2
()))
{
account
+=
"/"
+
field52D
.
getComponent2
();
}
String
nameAddress
=
field52D
.
getNameAndAddress
();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress
(
nameAddress
,
dbtrAgtMaps
);
}
if
(
StringUtil
.
isNotEmpty
(
account
))
{
if
(
account
.
startsWith
(
"//"
)
&&
!
account
.
startsWith
(
"//CH"
)
&&
!
account
.
startsWith
(
"//FW"
))
{
Map
<
String
,
Object
>
finInstnIdMaps
=
null
;
if
(
dbtrAgtMaps
.
containsKey
(
"finInstnId"
))
{
finInstnIdMaps
=
(
Map
<
String
,
Object
>)
dbtrAgtMaps
.
get
(
"finInstnId"
);
}
else
{
finInstnIdMaps
=
new
HashMap
<>();
dbtrAgtMaps
.
put
(
"finInstnId"
,
finInstnIdMaps
);
}
Map
<
String
,
Object
>
clrSysMmbIdMaps
=
null
;
if
(
finInstnIdMaps
.
containsKey
(
"clrSysMmbId"
))
{
clrSysMmbIdMaps
=
(
Map
<
String
,
Object
>)
finInstnIdMaps
.
get
(
"clrSysMmbId"
);
}
else
{
clrSysMmbIdMaps
=
new
HashMap
<>();
finInstnIdMaps
.
put
(
"clrSysMmbId"
,
clrSysMmbIdMaps
);
}
mt_to_mxClearingIdentifier
(
account
,
clrSysMmbIdMaps
);
}
}
}
else
{
Map
<
String
,
Object
>
rltdPtiesMaps
=
null
;
if
(
txDtlsMaps
.
containsKey
(
"rltdPties"
))
{
rltdPtiesMaps
=
(
Map
<
String
,
Object
>)
txDtlsMaps
.
get
(
"rltdPties"
);
}
else
{
rltdPtiesMaps
=
new
HashMap
<>();
txDtlsMaps
.
put
(
"rltdPties"
,
rltdPtiesMaps
);
}
Map
<
String
,
Object
>
dbtrAcctMaps
=
null
;
if
(
rltdPtiesMaps
.
containsKey
(
"dbtrAcct"
))
{
dbtrAcctMaps
=
(
Map
<
String
,
Object
>)
rltdPtiesMaps
.
get
(
"dbtrAcct"
);
}
else
{
dbtrAcctMaps
=
new
HashMap
<>();
rltdPtiesMaps
.
put
(
"dbtrAcct"
,
dbtrAcctMaps
);
}
Map
<
String
,
Object
>
dbtrMaps
=
null
;
if
(
rltdPtiesMaps
.
containsKey
(
"dbtr"
))
{
dbtrMaps
=
(
Map
<
String
,
Object
>)
rltdPtiesMaps
.
get
(
"dbtr"
);
}
else
{
dbtrMaps
=
new
HashMap
<>();
rltdPtiesMaps
.
put
(
"dbtr"
,
dbtrMaps
);
}
Map
<
String
,
Object
>
agtMaps
=
null
;
if
(
rltdPtiesMaps
.
containsKey
(
"agt"
))
{
agtMaps
=
(
Map
<
String
,
Object
>)
dbtrMaps
.
get
(
"agt"
);
}
else
{
agtMaps
=
new
HashMap
<>();
dbtrMaps
.
put
(
"agt"
,
agtMaps
);
}
String
account
=
""
;
if
(
field52A
!=
null
)
{
String
bicCode
=
field52A
.
getBIC
();
mt_to_mxBICFI
(
bicCode
,
agtMaps
);
if
(
StringUtil
.
isNotEmpty
(
field52A
.
getComponent1
()))
{
account
+=
"/"
+
field52A
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field52A
.
getComponent2
()))
{
account
+=
"/"
+
field52A
.
getComponent2
();
}
}
if
(
field52D
!=
null
)
{
if
(
StringUtil
.
isNotEmpty
(
field52D
.
getComponent1
()))
{
account
+=
"/"
+
field52D
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field52D
.
getComponent2
()))
{
account
+=
"/"
+
field52D
.
getComponent2
();
}
String
nameAddress
=
field52D
.
getNameAndAddress
();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress
(
nameAddress
,
agtMaps
);
}
if
(
StringUtil
.
isNotEmpty
(
account
))
{
if
(
account
.
startsWith
(
"//"
)
&&
!
account
.
startsWith
(
"//CH"
)
&&
!
account
.
startsWith
(
"//FW"
))
{
Map
<
String
,
Object
>
finInstnIdMaps
=
null
;
if
(
agtMaps
.
containsKey
(
"finInstnId"
))
{
finInstnIdMaps
=
(
Map
<
String
,
Object
>)
agtMaps
.
get
(
"finInstnId"
);
}
else
{
finInstnIdMaps
=
new
HashMap
<>();
agtMaps
.
put
(
"finInstnId"
,
finInstnIdMaps
);
}
Map
<
String
,
Object
>
clrSysMmbIdMaps
=
null
;
if
(
finInstnIdMaps
.
containsKey
(
"clrSysMmbId"
))
{
clrSysMmbIdMaps
=
(
Map
<
String
,
Object
>)
finInstnIdMaps
.
get
(
"clrSysMmbId"
);
}
else
{
clrSysMmbIdMaps
=
new
HashMap
<>();
finInstnIdMaps
.
put
(
"clrSysMmbId"
,
clrSysMmbIdMaps
);
}
mt_to_mxClearingIdentifier
(
account
,
clrSysMmbIdMaps
);
}
else
if
(!
account
.
startsWith
(
"//"
)
||
account
.
startsWith
(
"//CH"
))
{
mt_to_mxFinancialInstitutionAccount
(
account
,
dbtrAcctMaps
,
"DbtrAcct/Id"
);
}
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse56Field.java
0 → 100644
View file @
ffe0eaa1
package
com
.
brilliance
.
swift
.
mt2mx
.
camt054001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.camt054001.AbstractMt2MxCamt054001ParseField
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field56A
;
import
com.prowidesoftware.swift.model.field.Field56C
;
import
com.prowidesoftware.swift.model.field.Field56D
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
Camt054001Parse56Field
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME_A
=
"56A"
;
private
static
final
String
NAME_D
=
"56D"
;
@Override
public
void
parseField
()
throws
SwiftException
{
Field56A
field56A
=
null
;
Field56D
field56D
=
null
;
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
if
(
"900"
.
equals
(
abstractMT
.
getMessageType
())){
return
;
}
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_A
);
if
(
tag
!=
null
)
{
field56A
=
(
Field56A
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_D
);
if
(
tag
!=
null
)
{
field56D
=
(
Field56D
)
tag
.
asField
();
}
Map
<
String
,
Object
>
txDtlsMaps
=
getTransactionDetails
();
Map
<
String
,
Object
>
rltdAgtsMaps
=
null
;
if
(
txDtlsMaps
.
containsKey
(
"rltdAgts"
))
{
rltdAgtsMaps
=
(
Map
<
String
,
Object
>)
txDtlsMaps
.
get
(
"rltdAgts"
);
}
else
{
rltdAgtsMaps
=
new
HashMap
<>();
txDtlsMaps
.
put
(
"rltdAgts"
,
rltdAgtsMaps
);
}
Map
<
String
,
Object
>
intrmyAgt1Maps
=
null
;
if
(
rltdAgtsMaps
.
containsKey
(
"intrmyAgt1"
))
{
intrmyAgt1Maps
=
(
Map
<
String
,
Object
>)
rltdAgtsMaps
.
get
(
"intrmyAgt1"
);
}
else
{
intrmyAgt1Maps
=
new
HashMap
<>();
rltdAgtsMaps
.
put
(
"intrmyAgt1"
,
intrmyAgt1Maps
);
}
Map
<
String
,
Object
>
finInstnIdMaps
=
null
;
if
(
intrmyAgt1Maps
.
containsKey
(
"finInstnId"
))
{
finInstnIdMaps
=
(
Map
<
String
,
Object
>)
intrmyAgt1Maps
.
get
(
"finInstnId"
);
}
else
{
finInstnIdMaps
=
new
HashMap
<>();
intrmyAgt1Maps
.
put
(
"finInstnId"
,
finInstnIdMaps
);
}
Map
<
String
,
Object
>
clrSysMmbIdMaps
=
null
;
if
(
finInstnIdMaps
.
containsKey
(
"clrSysMmbId"
))
{
clrSysMmbIdMaps
=
(
Map
<
String
,
Object
>)
finInstnIdMaps
.
get
(
"clrSysMmbId"
);
}
else
{
clrSysMmbIdMaps
=
new
HashMap
<>();
finInstnIdMaps
.
put
(
"clrSysMmbId"
,
clrSysMmbIdMaps
);
}
String
account
=
""
;
if
(
field56A
!=
null
){
String
bicCode
=
field56A
.
getBIC
();
mt_to_mxBICFI
(
bicCode
,
intrmyAgt1Maps
);
if
(
StringUtil
.
isNotEmpty
(
field56A
.
getComponent1
()))
{
account
=
"/"
+
field56A
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field56A
.
getComponent2
()))
{
account
=
"/"
+
field56A
.
getComponent2
();
}
if
(
StringUtil
.
isNotEmpty
(
account
))
{
if
(
account
.
startsWith
(
"//"
)
&&
!
account
.
startsWith
(
"//CH"
)&&
!
account
.
startsWith
(
"//FW"
)&&
!
account
.
startsWith
(
"//RT"
))
{
mt_to_mxClearingIdentifier
(
account
,
clrSysMmbIdMaps
);
}
}
}
if
(
field56D
!=
null
)
{
if
(
StringUtil
.
isNotEmpty
(
field56D
.
getComponent1
()))
{
account
=
"/"
+
field56D
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field56D
.
getComponent2
()))
{
account
=
"/"
+
field56D
.
getComponent2
();
}
if
(
StringUtil
.
isNotEmpty
(
account
))
{
if
(
account
.
startsWith
(
"//"
)
&&
!
account
.
startsWith
(
"//CH"
))
{
mt_to_mxClearingIdentifier
(
account
,
clrSysMmbIdMaps
);
}
}
String
nameAddress
=
field56D
.
getNameAndAddress
();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress
(
nameAddress
,
intrmyAgt1Maps
);
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse72Field.java
0 → 100644
View file @
ffe0eaa1
package
com
.
brilliance
.
swift
.
mt2mx
.
camt054001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt054001.AbstractMt2MxCamt054001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field72
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.List
;
import
java.util.Map
;
public
class
Camt054001Parse72Field
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME
=
"72"
;
@Override
public
void
parseField
()
throws
SwiftException
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag72
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag72
!=
null
)
{
Map
<
String
,
Object
>
txDtlsMaps
=
getTransactionDetails
();
Field72
field72
=
(
Field72
)
tag72
.
asField
();
List
<
String
>
lines
=
field72
.
getLines
();
String
addtlTxInf
=
""
;
if
(
lines
!=
null
){
addtlTxInf
=
lines
.
get
(
0
);
if
(
addtlTxInf
.
length
()<
35
){
addtlTxInf
=
addtlTxInf
+
" "
;
}
String
line
=
""
;
for
(
int
i
=
1
;
i
<
lines
.
size
();
i
++)
{
if
(
lines
.
get
(
i
).
startsWith
(
"//"
)){
line
=
lines
.
get
(
i
).
substring
(
2
);
}
else
{
line
=
lines
.
get
(
i
);
}
if
(
line
.
length
()<
35
){
addtlTxInf
=
addtlTxInf
+
line
+
" "
;
}
else
{
addtlTxInf
=
addtlTxInf
+
line
;
}
}
}
txDtlsMaps
.
put
(
"addtlTxInf"
,
addtlTxInf
.
trim
());
}
}
}
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