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
3eea67ff
Commit
3eea67ff
authored
Jun 24, 2022
by
zhanghou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加了camt05600109到mt192,mt292的逻辑
parent
99d4aada
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
500 additions
and
28 deletions
+500
-28
AbstractMt2MxParseField.java
...a/com/brilliance/swift/mt2mx/AbstractMt2MxParseField.java
+70
-7
Mt2MxCreatorManager.java
.../java/com/brilliance/swift/mt2mx/Mt2MxCreatorManager.java
+3
-0
AbstractMt2MxCamt029001ParseField.java
...t/mt2mx/camt029001/AbstractMt2MxCamt029001ParseField.java
+7
-5
Mt2MxCamt029001Creator.java
...liance/swift/mt2mx/camt029001/Mt2MxCamt029001Creator.java
+8
-1
Camt029001Parse11RField.java
.../swift/mt2mx/camt029001/impl/Camt029001Parse11RField.java
+0
-4
Camt029001Parse20Field.java
...e/swift/mt2mx/camt029001/impl/Camt029001Parse20Field.java
+0
-3
Camt029001Parse21Field.java
...e/swift/mt2mx/camt029001/impl/Camt029001Parse21Field.java
+0
-1
Camt029001Parse76Field.java
...e/swift/mt2mx/camt029001/impl/Camt029001Parse76Field.java
+0
-1
Camt029001Parse77AField.java
.../swift/mt2mx/camt029001/impl/Camt029001Parse77AField.java
+0
-1
Camt029001Parse79Field.java
...e/swift/mt2mx/camt029001/impl/Camt029001Parse79Field.java
+0
-4
AbstractMt2MxCamt056001ParseField.java
...t/mt2mx/camt056001/AbstractMt2MxCamt056001ParseField.java
+47
-0
Mt2MxCamt056001Creator.java
...liance/swift/mt2mx/camt056001/Mt2MxCamt056001Creator.java
+94
-0
Camt056001Parse11SField.java
.../swift/mt2mx/camt056001/impl/Camt056001Parse11SField.java
+46
-0
Camt056001Parse20Field.java
...e/swift/mt2mx/camt056001/impl/Camt056001Parse20Field.java
+34
-0
Camt056001Parse21Field.java
...e/swift/mt2mx/camt056001/impl/Camt056001Parse21Field.java
+32
-0
Camt056001Parse32AField.java
.../swift/mt2mx/camt056001/impl/Camt056001Parse32AField.java
+39
-0
Camt056001Parse79Field.java
...e/swift/mt2mx/camt056001/impl/Camt056001Parse79Field.java
+51
-0
MT192.txt
swiftCore/src/main/resources/swiftTxt/MT192.txt
+9
-0
MT292.txt
swiftCore/src/main/resources/swiftTxt/MT292.txt
+15
-0
Test192.java
.../test/java/com/brilliance/mt2mx/camt05600108/Test192.java
+22
-0
Test292.java
.../test/java/com/brilliance/mt2mx/camt05600108/Test292.java
+22
-0
TestMx2MtFor296.java
...ava/com/brilliance/mx2mt/mt941/mt296/TestMx2MtFor296.java
+1
-1
No files found.
swiftCore/src/main/java/com/brilliance/swift/mt2mx/AbstractMt2MxParseField.java
View file @
3eea67ff
...
...
@@ -1626,13 +1626,11 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField {
}
String
additionalInformation
=
""
;
//MXReasonList = {AC04, AGNT, AM04, ARDT, CUST, INDM, LEGL, NOAS, NOOR, PTNA, RQDA}
if
(
"AC04"
.
equals
(
reason
)||
"AGNT"
.
equals
(
reason
)||
"AM04"
.
equals
(
reason
)
||
"ARDT"
.
equals
(
reason
)||
"CUST"
.
equals
(
reason
)||
"INDM"
.
equals
(
reason
)
||
"LEGL"
.
equals
(
reason
)||
"NOAS"
.
equals
(
reason
)||
"NOOR"
.
equals
(
reason
)
||
"PTNA"
.
equals
(
reason
)||
"RQDA"
.
equals
(
reason
)){
if
(
mt76Value
.
length
()>
10
){
additionalInformation
=
mt76Value
.
substring
(
11
);
}
String
MXReasonList
=
"{AC04, AGNT, AM04, ARDT, CUST, INDM, LEGL, NOAS, NOOR, PTNA, RQDA}"
;
if
(
MXReasonList
.
contains
(
reason
)){
if
(
mt76Value
.
length
()>
10
){
additionalInformation
=
mt76Value
.
substring
(
11
);
}
}
else
{
if
(
mt76Value
.
length
()>
6
){
additionalInformation
=
mt76Value
.
substring
(
6
);
...
...
@@ -1708,6 +1706,71 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField {
}
return
mxType
;
}
protected
void
mt_To_mxField79
(
String
mt79
,
Map
<
String
,
Object
>
maps
){
String
mt79Value
=
mt79
.
replace
(
"\r\n//"
,
""
).
trim
();
String
code
=
""
;
if
(
mt79Value
.
length
()>
5
){
code
=
mt79Value
.
substring
(
1
,
5
);
}
int
index
=
mt79Value
.
indexOf
(
"/UETR/"
);
if
(
index
>-
1
){
String
uetr
=
mt79Value
.
substring
(
index
+
6
);
maps
.
put
(
"orgnlUETR"
,
uetr
);
}
String
start
=
""
;
String
end
=
""
;
if
(
mt79Value
.
length
()>=
6
){
start
=
mt79Value
.
substring
(
0
,
1
);
if
(
mt79Value
.
length
()==
6
){
end
=
mt79Value
.
substring
(
5
);
}
else
{
end
=
mt79Value
.
substring
(
5
,
6
);
}
}
List
<
String
>
list
=
new
ArrayList
<>();
String
additionalInformation
=
""
;
String
ListOfCode
=
"{AGNT, AM09, COVR, CURR, CUST, CUTA, DUPL, FRAD, TECH, UPAY,NARR}"
;
if
(
ListOfCode
.
contains
(
code
)&&
"/"
.
equals
(
start
)&&
"/"
.
equals
(
end
)){
if
(
mt79Value
.
length
()>
6
){
additionalInformation
=
mt79Value
.
substring
(
6
);
}
if
(
"NARR"
.
equals
(
code
)){
additionalInformation
=
Mx2MtConstants
.
MT_TO_MX_DEFAULT_VALUE
;
list
.
add
(
additionalInformation
);
}
}
else
{
code
=
""
;
}
if
(
additionalInformation
.
length
()>
210
){
additionalInformation
=
additionalInformation
.
substring
(
0
,
209
)
+
"+"
;
}
if
(
additionalInformation
.
length
()>
105
){
list
.
add
(
additionalInformation
.
substring
(
0
,
105
));
list
.
add
(
additionalInformation
.
substring
(
105
));
}
JSONArray
cxlRsnInfJSONArray
=
null
;
Map
<
String
,
Object
>
cxlRsnInfMaps
=
null
;
if
(
maps
.
containsKey
(
"cxlRsnInf"
)){
cxlRsnInfJSONArray
=
(
JSONArray
)
maps
.
get
(
"cxlRsnInf"
);
if
(
cxlRsnInfJSONArray
.
size
()>
0
){
cxlRsnInfMaps
=
(
Map
<
String
,
Object
>)
cxlRsnInfJSONArray
.
get
(
0
);
}
else
{
cxlRsnInfMaps
=
new
HashMap
<>();
cxlRsnInfJSONArray
.
add
(
cxlRsnInfMaps
);
}
}
else
{
cxlRsnInfJSONArray
=
new
JSONArray
();
cxlRsnInfMaps
=
new
HashMap
<>();
maps
.
put
(
"cxlRsnInf"
,
cxlRsnInfJSONArray
);
cxlRsnInfJSONArray
.
add
(
cxlRsnInfMaps
);
}
Map
<
String
,
Object
>
rsnMaps
=
new
HashMap
<>();
cxlRsnInfMaps
.
put
(
"rsn"
,
rsnMaps
);
rsnMaps
.
put
(
"cd"
,
code
);
JSONArray
addtlInfJSONArray
=
new
JSONArray
();
cxlRsnInfMaps
.
put
(
"addtlInf"
,
addtlInfJSONArray
);
addtlInfJSONArray
.
addAll
(
list
);
}
/**
* MT 转 MX 转换函数结束
*/
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/Mt2MxCreatorManager.java
View file @
3eea67ff
...
...
@@ -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.camt056001.Mt2MxCamt056001Creator
;
import
com.brilliance.swift.mt2mx.pacs008001.Mt2MxPacs008001Creator
;
import
com.brilliance.swift.mt2mx.pacs009001.Mt2MxPacs009001Creator
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
...
...
@@ -48,6 +49,8 @@ public class Mt2MxCreatorManager {
return
new
Mt2MxPacs009001Creator
();
}
else
if
(
"196"
.
equals
(
messageType
)
||
"296"
.
equals
(
messageType
))
{
return
new
Mt2MxCamt029001Creator
();
}
else
if
(
"192"
.
equals
(
messageType
)||
"292"
.
equals
(
messageType
))
{
return
new
Mt2MxCamt056001Creator
();
}
else
{
throw
new
SwiftException
(
"ERROR"
,
"Invalid message type"
);
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt029001/AbstractMt2MxCamt029001ParseField.java
View file @
3eea67ff
...
...
@@ -36,11 +36,13 @@ public abstract class AbstractMt2MxCamt029001ParseField extends AbstractMt2MxPar
JSONArray
txInfAndStsJsonArray
=
null
;
if
(
cxlDtlsMaps
.
containsKey
(
"txInfAndSts"
)){
txInfAndStsJsonArray
=
(
JSONArray
)
cxlDtlsMaps
.
get
(
"txInfAndSts"
);
if
(
txInfAndStsJsonArray
.
size
()>
0
)
{
txInfAndStsMaps
=
(
Map
<
String
,
Object
>)
txInfAndStsJsonArray
.
get
(
0
);
}
else
{
txInfAndStsMaps
=
new
HashMap
<>();
txInfAndStsJsonArray
.
add
(
txInfAndStsMaps
);
if
(
txInfAndStsJsonArray
!=
null
){
if
(
txInfAndStsJsonArray
.
size
()>
0
)
{
txInfAndStsMaps
=
(
Map
<
String
,
Object
>)
txInfAndStsJsonArray
.
get
(
0
);
}
else
{
txInfAndStsMaps
=
new
HashMap
<>();
txInfAndStsJsonArray
.
add
(
txInfAndStsMaps
);
}
}
}
else
{
txInfAndStsJsonArray
=
new
JSONArray
();
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt029001/Mt2MxCamt029001Creator.java
View file @
3eea67ff
...
...
@@ -8,7 +8,6 @@ import com.brilliance.swift.mt2mx.Mt2MxParseField;
import
com.brilliance.swift.mt2mx.camt029001.impl.*
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
org.sss.common.model.IFactory
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
...
...
@@ -61,6 +60,14 @@ public class Mt2MxCamt029001Creator extends AbstractMt2MxCreator {
assgneMaps
.
put
(
"agt"
,
agtMaps
);
mt_to_mxBICFI
(
receiverBic
,
agtMaps
);
}
Map
<
String
,
Object
>
orgnlGrpInfMaps
=
null
;
if
(
txInfAndStsMaps
.
containsKey
(
"orgnlGrpInf"
)){
orgnlGrpInfMaps
=
(
Map
<
String
,
Object
>)
txInfAndStsMaps
.
get
(
"orgnlGrpInf"
);
}
else
{
orgnlGrpInfMaps
=
new
HashMap
<>();
txInfAndStsMaps
.
put
(
"orgnlGrpInf"
,
orgnlGrpInfMaps
);
}
orgnlGrpInfMaps
.
put
(
"orgnlMsgId"
,
Mx2MtConstants
.
MT_TO_MX_DEFAULT_VALUE
);
Map
<
String
,
Object
>
rslvdCaseMaps
=
null
;
if
(
txInfAndStsMaps
.
containsKey
(
"rslvdCase"
)){
rslvdCaseMaps
=
(
Map
<
String
,
Object
>)
txInfAndStsMaps
.
get
(
"rslvdCase"
);
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt029001/impl/Camt029001Parse11RField.java
View file @
3eea67ff
package
com
.
brilliance
.
swift
.
mt2mx
.
camt029001
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt029001.AbstractMt2MxCamt029001ParseField
;
import
com.brilliance.swift.util.DateUtil
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field11R
;
import
com.prowidesoftware.swift.model.field.Field32A
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.HashMap
;
...
...
@@ -41,7 +38,6 @@ public class Camt029001Parse11RField extends AbstractMt2MxCamt029001ParseField {
String
mxType
=
getMxType
(
mtType
);
orgnlGrpInfMaps
.
put
(
"orgnlMsgNmId"
,
mxType
);
orgnlGrpInfMaps
.
put
(
"orgnlCreDtTm"
,
dateStr
+
"T00:00:00+00:00"
);
orgnlGrpInfMaps
.
put
(
"orgnlMsgId"
,
Mx2MtConstants
.
MT_TO_MX_DEFAULT_VALUE
);
}
}
catch
(
ParseException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt029001/impl/Camt029001Parse20Field.java
View file @
3eea67ff
package
com
.
brilliance
.
swift
.
mt2mx
.
camt029001
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt029001.AbstractMt2MxCamt029001ParseField
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
Camt029001Parse20Field
extends
AbstractMt2MxCamt029001ParseField
{
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt029001/impl/Camt029001Parse21Field.java
View file @
3eea67ff
package
com
.
brilliance
.
swift
.
mt2mx
.
camt029001
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt029001.AbstractMt2MxCamt029001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt029001/impl/Camt029001Parse76Field.java
View file @
3eea67ff
...
...
@@ -3,7 +3,6 @@ package com.brilliance.swift.mt2mx.camt029001.impl;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt029001.AbstractMt2MxCamt029001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field11R
;
import
com.prowidesoftware.swift.model.field.Field76
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt029001/impl/Camt029001Parse77AField.java
View file @
3eea67ff
...
...
@@ -3,7 +3,6 @@ package com.brilliance.swift.mt2mx.camt029001.impl;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt029001.AbstractMt2MxCamt029001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field76
;
import
com.prowidesoftware.swift.model.field.Field77A
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt029001/impl/Camt029001Parse79Field.java
View file @
3eea67ff
...
...
@@ -2,10 +2,6 @@ package com.brilliance.swift.mt2mx.camt029001.impl;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt029001.AbstractMt2MxCamt029001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.Map
;
public
class
Camt029001Parse79Field
extends
AbstractMt2MxCamt029001ParseField
{
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt056001/AbstractMt2MxCamt056001ParseField.java
0 → 100644
View file @
3eea67ff
package
com
.
brilliance
.
swift
.
mt2mx
.
camt056001
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.mt2mx.AbstractMt2MxParseField
;
import
java.util.HashMap
;
import
java.util.Map
;
public
abstract
class
AbstractMt2MxCamt056001ParseField
extends
AbstractMt2MxParseField
{
protected
Map
<
String
,
Object
>
appHdrMaps
=
null
;
protected
Map
<
String
,
Object
>
assgnmtMaps
=
null
;
protected
Map
<
String
,
Object
>
undrlygMaps
=
null
;
@Override
public
void
initJsonMaps
()
{
super
.
initJsonMaps
();
appHdrMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"appHdr"
);
Map
<
String
,
Object
>
fiToFIPmtCxlReqMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"fiToFIPmtCxlReq"
);
assgnmtMaps
=
(
Map
<
String
,
Object
>)
fiToFIPmtCxlReqMaps
.
get
(
"assgnmt"
);
JSONArray
undrlygJsonArray
=
(
JSONArray
)
fiToFIPmtCxlReqMaps
.
get
(
"undrlyg"
);
undrlygMaps
=
(
Map
<
String
,
Object
>)
undrlygJsonArray
.
get
(
0
);
}
public
Map
<
String
,
Object
>
getTxInfMaps
(){
Map
<
String
,
Object
>
txInfMaps
=
null
;
JSONArray
txInfJsonArray
=
null
;
if
(
undrlygMaps
.
containsKey
(
"txInf"
)){
txInfJsonArray
=
(
JSONArray
)
undrlygMaps
.
get
(
"txInf"
);
if
(
txInfJsonArray
!=
null
){
if
(
txInfJsonArray
.
size
()>
0
)
{
txInfMaps
=
(
Map
<
String
,
Object
>)
txInfJsonArray
.
get
(
0
);
}
else
{
txInfMaps
=
new
HashMap
<>();
txInfJsonArray
.
add
(
txInfMaps
);
}
}
}
else
{
txInfJsonArray
=
new
JSONArray
();
txInfMaps
=
new
HashMap
<>();
undrlygMaps
.
put
(
"txInf"
,
txInfJsonArray
);
txInfJsonArray
.
add
(
txInfMaps
);
}
return
txInfMaps
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt056001/Mt2MxCamt056001Creator.java
0 → 100644
View file @
3eea67ff
package
com
.
brilliance
.
swift
.
mt2mx
.
camt056001
;
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.camt056001.impl.*
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
Mt2MxCamt056001Creator
extends
AbstractMt2MxCreator
{
@Override
public
void
preProcess
()
{
super
.
preProcess
();
jsonMaps
.
put
(
"identifier"
,
"camt.056.001.08"
);
Map
<
String
,
Object
>
appHdrMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"appHdr"
);
appHdrMaps
.
put
(
"msgDefIdr"
,
"camt.056.001.08"
);
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
//初始化转换和不需要BLOCK4的转换
Map
<
String
,
Object
>
fiToFIPmtCxlReqMaps
=
new
HashMap
<>();
jsonMaps
.
put
(
"fiToFIPmtCxlReq"
,
fiToFIPmtCxlReqMaps
);
Map
<
String
,
Object
>
assgnmtMaps
=
new
HashMap
<>();
fiToFIPmtCxlReqMaps
.
put
(
"assgnmt"
,
assgnmtMaps
);
assgnmtMaps
.
put
(
"creDtTm"
,
"9999-12-31T00:00:00+00:00"
);
Map
<
String
,
Object
>
undrlygMaps
=
new
HashMap
<>();
JSONArray
undrlygJsonArray
=
new
JSONArray
();
undrlygJsonArray
.
add
(
undrlygMaps
);
fiToFIPmtCxlReqMaps
.
put
(
"undrlyg"
,
undrlygJsonArray
);
Map
<
String
,
Object
>
txInfMaps
=
new
HashMap
<>();
JSONArray
txInfJsonArray
=
new
JSONArray
();
txInfJsonArray
.
add
(
txInfMaps
);
undrlygMaps
.
put
(
"txInf"
,
txInfJsonArray
);
String
orgnlUETR
=
abstractMT
.
getSwiftMessage
().
getUETR
();
if
(
StringUtil
.
isNotEmpty
(
orgnlUETR
))
{
txInfMaps
.
put
(
"orgnlUETR"
,
orgnlUETR
);
}
String
sendBic
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_SEND_BIC
,
true
);
if
(
StringUtil
.
isNotEmpty
(
sendBic
))
{
Map
<
String
,
Object
>
assgnrMaps
=
new
HashMap
<>();
assgnmtMaps
.
put
(
"assgnr"
,
assgnrMaps
);
Map
<
String
,
Object
>
agtMaps
=
new
HashMap
<>();
assgnrMaps
.
put
(
"agt"
,
agtMaps
);
mt_to_mxBICFI
(
sendBic
,
agtMaps
);
}
String
receiverBic
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_RECEIVE_BIC
,
true
);
if
(
StringUtil
.
isNotEmpty
(
receiverBic
))
{
Map
<
String
,
Object
>
assgneMaps
=
new
HashMap
<>();
assgnmtMaps
.
put
(
"assgne"
,
assgneMaps
);
Map
<
String
,
Object
>
agtMaps
=
new
HashMap
<>();
assgneMaps
.
put
(
"agt"
,
agtMaps
);
mt_to_mxBICFI
(
receiverBic
,
agtMaps
);
}
Map
<
String
,
Object
>
caseMaps
=
null
;
if
(
txInfMaps
.
containsKey
(
"case"
)){
caseMaps
=
(
Map
<
String
,
Object
>)
txInfMaps
.
get
(
"case"
);
}
else
{
caseMaps
=
new
HashMap
<>();
txInfMaps
.
put
(
"case"
,
caseMaps
);
}
Map
<
String
,
Object
>
cretrMaps
=
new
HashMap
<>();
Map
<
String
,
Object
>
agtMaps
=
new
HashMap
<>();
Map
<
String
,
Object
>
finInstnIdMaps
=
new
HashMap
<>();
Map
<
String
,
Object
>
pstlAdrMaps
=
new
HashMap
<>();
caseMaps
.
put
(
"cretr"
,
cretrMaps
);
cretrMaps
.
put
(
"agt"
,
agtMaps
);
agtMaps
.
put
(
"finInstnId"
,
finInstnIdMaps
);
finInstnIdMaps
.
put
(
"nm"
,
Mx2MtConstants
.
MT_TO_MX_DEFAULT_VALUE
);
finInstnIdMaps
.
put
(
"pstlAdr"
,
pstlAdrMaps
);
JSONArray
adrLineJsonArray
=
new
JSONArray
();
pstlAdrMaps
.
put
(
"adrLine"
,
adrLineJsonArray
);
adrLineJsonArray
.
add
(
Mx2MtConstants
.
MT_TO_MX_DEFAULT_VALUE
);
}
@Override
public
List
<
Mt2MxParseField
>
getParseFieldList
()
{
List
<
Mt2MxParseField
>
list
=
new
ArrayList
<>();
list
.
add
(
new
Camt056001Parse20Field
());
list
.
add
(
new
Camt056001Parse21Field
());
list
.
add
(
new
Camt056001Parse11SField
());
list
.
add
(
new
Camt056001Parse79Field
());
list
.
add
(
new
Camt056001Parse32AField
());
return
list
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt056001/impl/Camt056001Parse11SField.java
0 → 100644
View file @
3eea67ff
package
com
.
brilliance
.
swift
.
mt2mx
.
camt056001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt056001.AbstractMt2MxCamt056001ParseField
;
import
com.brilliance.swift.util.DateUtil
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field11R
;
import
com.prowidesoftware.swift.model.field.Field11S
;
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
Camt056001Parse11SField
extends
AbstractMt2MxCamt056001ParseField
{
private
static
final
String
NAME
=
"11S"
;
@Override
public
void
parseField
()
throws
SwiftException
{
try
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag11S
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag11S
!=
null
)
{
Field11S
field11S
=
(
Field11S
)
tag11S
.
asField
();
Date
date
=
DateUtil
.
parseDate
(
"20"
+
field11S
.
getDate
(),
"yyyyMMdd"
);
String
dateStr
=
DateUtil
.
format
(
date
,
"yyyy-MM-dd"
);
Map
<
String
,
Object
>
txInfMaps
=
getTxInfMaps
();
Map
<
String
,
Object
>
orgnlGrpInfMaps
=
null
;
if
(
txInfMaps
.
containsKey
(
"orgnlGrpInf"
)){
orgnlGrpInfMaps
=
(
Map
<
String
,
Object
>)
txInfMaps
.
get
(
"orgnlGrpInf"
);
}
else
{
orgnlGrpInfMaps
=
new
HashMap
<>();
txInfMaps
.
put
(
"orgnlGrpInf"
,
orgnlGrpInfMaps
);
}
String
mtType
=
field11S
.
getMT
();
String
mxType
=
getMxType
(
mtType
);
orgnlGrpInfMaps
.
put
(
"orgnlMsgNmId"
,
mxType
);
orgnlGrpInfMaps
.
put
(
"orgnlCreDtTm"
,
dateStr
+
"T00:00:00+00:00"
);
}
}
catch
(
ParseException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt056001/impl/Camt056001Parse20Field.java
0 → 100644
View file @
3eea67ff
package
com
.
brilliance
.
swift
.
mt2mx
.
camt056001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt029001.AbstractMt2MxCamt029001ParseField
;
import
com.brilliance.swift.mt2mx.camt056001.AbstractMt2MxCamt056001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
Camt056001Parse20Field
extends
AbstractMt2MxCamt056001ParseField
{
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
());
assgnmtMaps
.
put
(
"id"
,
tag20
.
getValue
());
Map
<
String
,
Object
>
txInfMaps
=
getTxInfMaps
();
Map
<
String
,
Object
>
caseMaps
=
null
;
if
(
txInfMaps
.
containsKey
(
"case"
)){
caseMaps
=
(
Map
<
String
,
Object
>)
txInfMaps
.
get
(
"case"
);
}
else
{
caseMaps
=
new
HashMap
<>();
txInfMaps
.
put
(
"case"
,
caseMaps
);
}
caseMaps
.
put
(
"id"
,
tag20
.
getValue
());
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt056001/impl/Camt056001Parse21Field.java
0 → 100644
View file @
3eea67ff
package
com
.
brilliance
.
swift
.
mt2mx
.
camt056001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt056001.AbstractMt2MxCamt056001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
Camt056001Parse21Field
extends
AbstractMt2MxCamt056001ParseField
{
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
>
txInfMaps
=
getTxInfMaps
();
txInfMaps
.
put
(
"OrgnlInstrId"
,
tag21
.
getValue
());
Map
<
String
,
Object
>
orgnlGrpInfMaps
=
null
;
if
(
txInfMaps
.
containsKey
(
"orgnlGrpInf"
)){
orgnlGrpInfMaps
=
(
Map
<
String
,
Object
>)
txInfMaps
.
get
(
"orgnlGrpInf"
);
}
else
{
orgnlGrpInfMaps
=
new
HashMap
<>();
txInfMaps
.
put
(
"orgnlGrpInf"
,
orgnlGrpInfMaps
);
}
orgnlGrpInfMaps
.
put
(
"orgnlMsgId"
,
tag21
.
getValue
());
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt056001/impl/Camt056001Parse32AField.java
0 → 100644
View file @
3eea67ff
package
com
.
brilliance
.
swift
.
mt2mx
.
camt056001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt056001.AbstractMt2MxCamt056001ParseField
;
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
Camt056001Parse32AField
extends
AbstractMt2MxCamt056001ParseField
{
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
>
txInfMaps
=
getTxInfMaps
();
txInfMaps
.
put
(
"orgnlIntrBkSttlmDt"
,
dateStr
);
Map
<
String
,
Object
>
orgnlIntrBkSttlmAmtMaps
=
new
HashMap
();
orgnlIntrBkSttlmAmtMaps
.
put
(
"value"
,
field32A
.
amount
());
orgnlIntrBkSttlmAmtMaps
.
put
(
"ccy"
,
field32A
.
getCurrency
());
txInfMaps
.
put
(
"orgnlIntrBkSttlmAmt"
,
orgnlIntrBkSttlmAmtMaps
);
}
}
catch
(
ParseException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt056001/impl/Camt056001Parse79Field.java
0 → 100644
View file @
3eea67ff
package
com
.
brilliance
.
swift
.
mt2mx
.
camt056001
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt056001.AbstractMt2MxCamt056001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field79
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
Camt056001Parse79Field
extends
AbstractMt2MxCamt056001ParseField
{
private
static
final
String
NAME
=
"79"
;
@Override
public
void
parseField
()
throws
SwiftException
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag79
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
Map
<
String
,
Object
>
txInfMaps
=
getTxInfMaps
();
if
(
tag79
!=
null
)
{
Field79
field79
=
(
Field79
)
tag79
.
asField
();
mt_To_mxField79
(
field79
.
getValue
(),
txInfMaps
);
}
else
{
JSONArray
cxlRsnInfJSONArray
=
null
;
Map
<
String
,
Object
>
cxlRsnInfMaps
=
null
;
if
(
txInfMaps
.
containsKey
(
"cxlRsnInf"
)){
cxlRsnInfJSONArray
=
(
JSONArray
)
txInfMaps
.
get
(
"cxlRsnInf"
);
if
(
cxlRsnInfJSONArray
.
size
()>
0
){
cxlRsnInfMaps
=
(
Map
<
String
,
Object
>)
cxlRsnInfJSONArray
.
get
(
0
);
}
else
{
cxlRsnInfMaps
=
new
HashMap
<>();
cxlRsnInfJSONArray
.
add
(
cxlRsnInfMaps
);
}
}
else
{
cxlRsnInfJSONArray
=
new
JSONArray
();
cxlRsnInfMaps
=
new
HashMap
<>();
txInfMaps
.
put
(
"cxlRsnInf"
,
cxlRsnInfJSONArray
);
cxlRsnInfJSONArray
.
add
(
cxlRsnInfMaps
);
}
Map
<
String
,
Object
>
rsnMaps
=
new
HashMap
<>();
cxlRsnInfMaps
.
put
(
"rsn"
,
rsnMaps
);
rsnMaps
.
put
(
"cd"
,
"NARR"
);
JSONArray
addtlInfJSONArray
=
new
JSONArray
();
cxlRsnInfMaps
.
put
(
"addtlInf"
,
addtlInfJSONArray
);
addtlInfJSONArray
.
add
(
Mx2MtConstants
.
MT_TO_MX_DEFAULT_VALUE
);
}
}
}
swiftCore/src/main/resources/swiftTxt/MT192.txt
0 → 100644
View file @
3eea67ff
{1:F01NDEAFIHHXXXX0000000000}{2:O1920000991231RBOSGB2LXXXX00000000009912310000N}{3:{121:8a562c67-ca16-48ba-b074-65581be6f001}}{4:
:20:CSE-001
:21:pacs8bizmsgidr01
:11S:103
210217
:79:/AM09/
/UETR/8a562c67-ca16-48ba-b074-65581be6f001
:32A:210217EUR1500000,
-}
swiftCore/src/main/resources/swiftTxt/MT292.txt
0 → 100644
View file @
3eea67ff
{1:F01NDEAFIHHXXXX0000000000}{2:O2920000991231RBOSGB2LXXXX00000000009912310000N}{3:{121:8a562c67-ca16-48ba-b074-65581be6f001}}{4:
:20:CSE-001
:21:pacs8bizmsgidr01
:11S:202
210217
:79:/AM09/HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WO
//RLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WO
//RLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WO
//RLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WO
//RLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WO
//RLD.HELLO,WORLD.NICE TO MEET YOU
/UETR/8a562c67-ca16-48ba-b074-65581be6f001
:32A:210217EUR1500000,
-}
\ No newline at end of file
swiftCore/src/test/java/com/brilliance/mt2mx/camt05600108/Test192.java
0 → 100644
View file @
3eea67ff
package
com
.
brilliance
.
mt2mx
.
camt05600108
;
import
com.brilliance.swift.mt2mx.Mt2MxCreatorManager
;
import
org.apache.commons.io.FileUtils
;
import
java.io.File
;
import
java.io.IOException
;
public
class
Test192
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftTxt\\Mt192.txt"
);
String
mtStr
=
FileUtils
.
readFileToString
(
file
);
String
mxXml
=
new
Mt2MxCreatorManager
().
mt2mx
(
mtStr
,
null
,
null
);
System
.
out
.
println
(
mxXml
);
/*AbstractMT abstractMT = AbstractMT.parse(mtStr);
MT103 mt103 = (MT103)abstractMT;
Field53A field53A = mt103.getField53A();
System.out.println(field53A.getComponent(1) + field53A.getComponent2());
System.out.println(field53A.getBIC());*/
}
}
swiftCore/src/test/java/com/brilliance/mt2mx/camt05600108/Test292.java
0 → 100644
View file @
3eea67ff
package
com
.
brilliance
.
mt2mx
.
camt05600108
;
import
com.brilliance.swift.mt2mx.Mt2MxCreatorManager
;
import
org.apache.commons.io.FileUtils
;
import
java.io.File
;
import
java.io.IOException
;
public
class
Test292
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftTxt\\Mt292.txt"
);
String
mtStr
=
FileUtils
.
readFileToString
(
file
);
String
mxXml
=
new
Mt2MxCreatorManager
().
mt2mx
(
mtStr
,
null
,
null
);
System
.
out
.
println
(
mxXml
);
/*AbstractMT abstractMT = AbstractMT.parse(mtStr);
MT103 mt103 = (MT103)abstractMT;
Field53A field53A = mt103.getField53A();
System.out.println(field53A.getComponent(1) + field53A.getComponent2());
System.out.println(field53A.getBIC());*/
}
}
swiftCore/src/test/java/com/brilliance/mx2mt/mt296/TestMx2MtFor296.java
→
swiftCore/src/test/java/com/brilliance/mx2mt/mt
941/mt
296/TestMx2MtFor296.java
View file @
3eea67ff
package
com
.
brilliance
.
mx2mt
.
mt296
;
package
com
.
brilliance
.
mx2mt
.
mt
941
.
mt
296
;
import
com.brilliance.swift.mx2mt.Mx2MtCreatorManager
;
import
org.apache.commons.io.FileUtils
;
...
...
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