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
9ae8a5ae
Commit
9ae8a5ae
authored
Jul 12, 2022
by
zhanghou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改mt_To_mxField76和mt_To_mxField79方法
parent
ffe0eaa1
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
281 additions
and
29 deletions
+281
-29
AbstractMt2MxParseField.java
...a/com/brilliance/swift/mt2mx/AbstractMt2MxParseField.java
+37
-4
Mt2MxCamt029001Creator.java
...liance/swift/mt2mx/camt029001/Mt2MxCamt029001Creator.java
+38
-0
Camt029001Parse76Field.java
...e/swift/mt2mx/camt029001/impl/Camt029001Parse76Field.java
+6
-1
Camt029001Parse77AField.java
.../swift/mt2mx/camt029001/impl/Camt029001Parse77AField.java
+7
-2
Mt2MxCamt054001Creator.java
...liance/swift/mt2mx/camt054001/Mt2MxCamt054001Creator.java
+29
-1
Camt054001Parse50Field.java
...e/swift/mt2mx/camt054001/impl/Camt054001Parse50Field.java
+6
-1
Camt054001Parse52For900Field.java
...t/mt2mx/camt054001/impl/Camt054001Parse52For900Field.java
+6
-2
Camt054001Parse52For910Field.java
...t/mt2mx/camt054001/impl/Camt054001Parse52For910Field.java
+9
-3
Camt054001Parse56Field.java
...e/swift/mt2mx/camt054001/impl/Camt054001Parse56Field.java
+3
-1
Mt2MxCamt056001Creator.java
...liance/swift/mt2mx/camt056001/Mt2MxCamt056001Creator.java
+37
-0
Camt056001Parse32AField.java
.../swift/mt2mx/camt056001/impl/Camt056001Parse32AField.java
+3
-0
Camt056001Parse79Field.java
...e/swift/mt2mx/camt056001/impl/Camt056001Parse79Field.java
+3
-1
Test196.java
...rc/test/java/com/brilliance/mt2mx/camt029001/Test196.java
+24
-3
Test296.java
...rc/test/java/com/brilliance/mt2mx/camt029001/Test296.java
+24
-3
Test192.java
...rc/test/java/com/brilliance/mt2mx/camt056001/Test192.java
+24
-3
Test292.java
...rc/test/java/com/brilliance/mt2mx/camt056001/Test292.java
+24
-3
TestMx2MtFor196.java
...test/java/com/brilliance/mx2mt/mt196/TestMx2MtFor196.java
+1
-1
No files found.
swiftCore/src/main/java/com/brilliance/swift/mt2mx/AbstractMt2MxParseField.java
View file @
9ae8a5ae
...
...
@@ -1669,8 +1669,22 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField {
}
}
protected
String
mt_To_mxField76
(
String
mt76
,
Map
<
String
,
Object
>
maps
){
String
mt76Value
=
mt76
.
replace
(
"\r\n//"
,
" "
).
trim
();
protected
String
mt_To_mxField76
(
List
<
String
>
lines
,
Map
<
String
,
Object
>
maps
){
String
mt76Value
=
""
;
if
(
lines
!=
null
){
for
(
int
i
=
0
;
i
<
lines
.
size
();
i
++)
{
if
(
i
<
lines
.
size
()-
1
){
if
(
lines
.
get
(
i
).
length
()<
35
&&
lines
.
get
(
i
+
1
).
startsWith
(
"//"
)){
mt76Value
=
mt76Value
+
lines
.
get
(
i
)
+
" "
;
}
else
{
mt76Value
=
mt76Value
+
lines
.
get
(
i
);
}
}
else
{
mt76Value
=
mt76Value
+
lines
.
get
(
i
);
}
}
}
mt76Value
=
mt76Value
.
replace
(
"//"
,
""
).
trim
();
String
status
=
""
;
String
reason
=
""
;
if
(
mt76Value
.
length
()>
5
){
...
...
@@ -1734,6 +1748,8 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField {
if
(
additionalInformation
.
length
()>
105
){
list
.
add
(
additionalInformation
.
substring
(
0
,
105
));
list
.
add
(
additionalInformation
.
substring
(
105
));
}
else
{
list
.
add
(
additionalInformation
);
}
JSONArray
addtlInfJsonArray
=
null
;
if
(
cxlStsRsnInfMaps
.
containsKey
(
"addtlInf"
)){
...
...
@@ -1763,11 +1779,26 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField {
mxType
=
"MT"
+
mtType
;
}
else
{
mxType
=
"MT"
+
mtType
;
buildSTErrorInfo
(
ERROR
.
T20089
,
"Undrlyg/TxInf/OrgnlGrpInf/OrgnlMsgId"
,
null
);
}
return
mxType
;
}
protected
void
mt_To_mxField79
(
String
mt79
,
Map
<
String
,
Object
>
maps
){
String
mt79Value
=
mt79
.
replace
(
"\r\n//"
,
" "
).
trim
();
protected
void
mt_To_mxField79
(
List
<
String
>
lines
,
Map
<
String
,
Object
>
maps
){
String
mt79Value
=
""
;
if
(
lines
!=
null
){
for
(
int
i
=
0
;
i
<
lines
.
size
();
i
++)
{
if
(
i
<
lines
.
size
()-
1
){
if
(
lines
.
get
(
i
).
length
()<
50
&&
lines
.
get
(
i
+
1
).
startsWith
(
"//"
)){
mt79Value
=
mt79Value
+
lines
.
get
(
i
)
+
" "
;
}
else
{
mt79Value
=
mt79Value
+
lines
.
get
(
i
);
}
}
else
{
mt79Value
=
mt79Value
+
lines
.
get
(
i
);
}
}
}
mt79Value
=
mt79Value
.
replace
(
"//"
,
""
).
trim
();
String
code
=
""
;
if
(
mt79Value
.
length
()>
5
){
code
=
mt79Value
.
substring
(
1
,
5
);
...
...
@@ -1808,6 +1839,8 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField {
if
(
additionalInformation
.
length
()>
105
){
list
.
add
(
additionalInformation
.
substring
(
0
,
105
));
list
.
add
(
additionalInformation
.
substring
(
105
));
}
else
{
list
.
add
(
additionalInformation
);
}
JSONArray
cxlRsnInfJSONArray
=
null
;
Map
<
String
,
Object
>
cxlRsnInfMaps
=
null
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt029001/Mt2MxCamt029001Creator.java
View file @
9ae8a5ae
package
com
.
brilliance
.
swift
.
mt2mx
.
camt029001
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
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.util.StringUtil
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.vo.SwiftTranslationErrorInfo
;
import
com.brilliance.swift.vo.SwiftTranslationReport
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field77A
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.ArrayList
;
...
...
@@ -87,6 +94,37 @@ public class Mt2MxCamt029001Creator extends AbstractMt2MxCreator {
JSONArray
adrLineJsonArray
=
new
JSONArray
();
pstlAdrMaps
.
put
(
"adrLine"
,
adrLineJsonArray
);
adrLineJsonArray
.
add
(
Mx2MtConstants
.
MT_TO_MX_DEFAULT_VALUE
);
Tag
tag77A
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
"77A"
);
Field77A
field77A
=
(
Field77A
)
tag77A
.
asField
();
String
String77A
=
field77A
.
getValue
().
replace
(
"\r\n//"
,
" "
).
replace
(
"\r\n"
,
""
);
int
index
=
String77A
.
indexOf
(
"/UETR/"
);
String
uetr
=
""
;
if
(
index
>-
1
){
uetr
=
String77A
.
substring
(
index
+
6
);
}
if
(
StringUtil
.
isEmpty
(
orgnlUETR
)&&
StringUtil
.
isEmpty
(
uetr
)){
buildSTErrorInfo
(
ERROR
.
T20087
,
"Block3/UETR"
,
null
);
}
}
protected
void
buildSTErrorInfo
(
String
errorCode
,
String
location
,
String
originalValue
)
{
SwiftTranslationReport
str
=
context
.
get
(
SwiftTranslationReport
.
class
);
SwiftTranslationErrorInfo
errorInfo
=
SwiftTransferUtil
.
getSwiftTranslationErrorInfoByErrorCode
(
errorCode
);
errorInfo
.
setLocation
(
location
);
errorInfo
.
setOriginalValue
(
originalValue
);
List
<
SwiftTranslationErrorInfo
>
errorInfos
=
str
.
getErrorInfos
();
boolean
existFlag
=
false
;
for
(
int
i
=
0
;
i
<
errorInfos
.
size
();
i
++)
{
if
(
SwiftTransferUtil
.
compareStErrorInfo
(
errorInfo
,
errorInfos
.
get
(
i
)))
{
existFlag
=
true
;
break
;
}
}
if
(!
existFlag
)
{
str
.
addErrorInfo
(
errorInfo
);
if
(
"FAILURE"
.
equalsIgnoreCase
(
errorInfo
.
getErrorType
()))
{
throw
new
SwiftException
(
location
+
Mx2MtConstants
.
NEW_LINE
+
"-"
+
errorInfo
.
getErrorType
()
+
":"
+
errorInfo
.
getDescription
());
}
}
}
@Override
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt029001/impl/Camt029001Parse76Field.java
View file @
9ae8a5ae
package
com
.
brilliance
.
swift
.
mt2mx
.
camt029001
.
impl
;
import
com.brilliance.swift.constants.ERROR
;
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.mt.AbstractMT
;
import
java.util.List
;
import
java.util.Map
;
public
class
Camt029001Parse76Field
extends
AbstractMt2MxCamt029001ParseField
{
...
...
@@ -19,9 +21,12 @@ public class Camt029001Parse76Field extends AbstractMt2MxCamt029001ParseField {
if
(
tag76
!=
null
)
{
Field76
field76
=
(
Field76
)
tag76
.
asField
();
Map
<
String
,
Object
>
txInfAndStsMaps
=
getTxInfAndStsMaps
();
String
sts
=
mt_To_mxField76
(
field76
.
getValue
(),
txInfAndStsMaps
);
List
<
String
>
lines
=
field76
.
getLines
();
String
sts
=
mt_To_mxField76
(
lines
,
txInfAndStsMaps
);
if
(
"CNCL"
.
equals
(
sts
)||
"PDCR"
.
equals
(
sts
)||
"RJCR"
.
equals
(
sts
)){
stsMaps
.
put
(
"conf"
,
sts
);
}
else
{
buildSTErrorInfo
(
ERROR
.
T20093
,
"Block4:76:"
,
null
);
}
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt029001/impl/Camt029001Parse77AField.java
View file @
9ae8a5ae
package
com
.
brilliance
.
swift
.
mt2mx
.
camt029001
.
impl
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt029001.AbstractMt2MxCamt029001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -19,12 +20,16 @@ public class Camt029001Parse77AField extends AbstractMt2MxCamt029001ParseField {
if
(
tag77A
!=
null
)
{
Map
<
String
,
Object
>
txInfAndStsMaps
=
getTxInfAndStsMaps
();
Field77A
field77A
=
(
Field77A
)
tag77A
.
asField
();
String
String77A
=
field77A
.
getValue
().
replace
(
"\r\n//"
,
"
"
).
replace
(
"\r\n"
,
""
);
String
String77A
=
field77A
.
getValue
().
replace
(
"\r\n//"
,
""
).
replace
(
"\r\n"
,
""
);
int
index
=
String77A
.
indexOf
(
"/UETR/"
);
String
uetr
=
""
;
if
(
index
>-
1
){
String
uetr
=
String77A
.
substring
(
index
+
6
);
uetr
=
String77A
.
substring
(
index
+
6
);
txInfAndStsMaps
.
put
(
"orgnlUETR"
,
uetr
);
}
if
(!((
uetr
.
length
()+
6
)==
String77A
.
length
())){
buildSTErrorInfo
(
ERROR
.
T20094
,
"Block4:77A:"
,
null
);
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/Mt2MxCamt054001Creator.java
View file @
9ae8a5ae
package
com
.
brilliance
.
swift
.
mt2mx
.
camt054001
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
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.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.vo.SwiftTranslationErrorInfo
;
import
com.brilliance.swift.vo.SwiftTranslationReport
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field32A
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
...
...
@@ -33,7 +38,7 @@ public class Mt2MxCamt054001Creator extends AbstractMt2MxCreator {
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
(
"creDtTm"
,
getCreateDateStr
()
);
grpHdrMaps
.
put
(
"nbOfTxs"
,
"1"
);
Map
<
String
,
Object
>
ntfctnMaps
=
new
HashMap
<>();
...
...
@@ -80,6 +85,7 @@ public class Mt2MxCamt054001Creator extends AbstractMt2MxCreator {
acctMaps
=
new
HashMap
<>();
ntfctnMaps
.
put
(
"acct"
,
acctMaps
);
}
buildSTErrorInfo
(
ERROR
.
T20200
,
"Ntfctn/Acct/Ccy"
,
null
);
acctMaps
.
put
(
"ccy"
,
field32A
.
getValue
().
substring
(
6
,
9
));
}
}
...
...
@@ -90,6 +96,28 @@ public class Mt2MxCamt054001Creator extends AbstractMt2MxCreator {
txDtlsMaps
.
put
(
"refs"
,
refsMaps
);
refsMaps
.
put
(
"uetr"
,
uetr
);
}
context
.
set
(
Mt2MxContextIdentifier
.
MT_TO_MX_FLAG_50
,
"false"
);
}
protected
void
buildSTErrorInfo
(
String
errorCode
,
String
location
,
String
originalValue
)
{
SwiftTranslationReport
str
=
context
.
get
(
SwiftTranslationReport
.
class
);
SwiftTranslationErrorInfo
errorInfo
=
SwiftTransferUtil
.
getSwiftTranslationErrorInfoByErrorCode
(
errorCode
);
errorInfo
.
setLocation
(
location
);
errorInfo
.
setOriginalValue
(
originalValue
);
List
<
SwiftTranslationErrorInfo
>
errorInfos
=
str
.
getErrorInfos
();
boolean
existFlag
=
false
;
for
(
int
i
=
0
;
i
<
errorInfos
.
size
();
i
++)
{
if
(
SwiftTransferUtil
.
compareStErrorInfo
(
errorInfo
,
errorInfos
.
get
(
i
)))
{
existFlag
=
true
;
break
;
}
}
if
(!
existFlag
)
{
str
.
addErrorInfo
(
errorInfo
);
if
(
"FAILURE"
.
equalsIgnoreCase
(
errorInfo
.
getErrorType
()))
{
throw
new
SwiftException
(
location
+
Mx2MtConstants
.
NEW_LINE
+
"-"
+
errorInfo
.
getErrorType
()
+
":"
+
errorInfo
.
getDescription
());
}
}
}
@Override
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse50Field.java
View file @
9ae8a5ae
...
...
@@ -67,7 +67,6 @@ public class Camt054001Parse50Field extends AbstractMt2MxCamt054001ParseField {
ptyMaps
=
(
Map
<
String
,
Object
>)
dbtrMaps
.
get
(
"pty"
);
}
else
{
ptyMaps
=
new
HashMap
<>();
dbtrMaps
.
put
(
"pty"
,
ptyMaps
);
}
Map
<
String
,
Object
>
dbtrAcctMaps
=
null
;
if
(
rltdPtiesMaps
.
containsKey
(
"dbtrAcct"
))
{
...
...
@@ -120,5 +119,11 @@ public class Camt054001Parse50Field extends AbstractMt2MxCamt054001ParseField {
mt_to_mxPartyNameAndAddress
(
nameAddress
,
ptyMaps
);
mt_to_mxPartyAccount
(
account
,
dbtrAcctMaps
);
}
if
(
ptyMaps
.
size
()>
0
){
dbtrMaps
.
put
(
"pty"
,
ptyMaps
);
}
if
(
dbtrAcctMaps
.
size
()>
0
){
rltdPtiesMaps
.
put
(
"dbtrAcct"
,
dbtrAcctMaps
);
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse52For900Field.java
View file @
9ae8a5ae
...
...
@@ -47,7 +47,6 @@ public class Camt054001Parse52For900Field extends AbstractMt2MxCamt054001ParseFi
dbtrAcctMaps
=
(
Map
<
String
,
Object
>)
rltdPtiesMaps
.
get
(
"dbtrAcct"
);
}
else
{
dbtrAcctMaps
=
new
HashMap
<>();
rltdPtiesMaps
.
put
(
"dbtrAcct"
,
dbtrAcctMaps
);
}
Map
<
String
,
Object
>
dbtrMaps
=
null
;
if
(
rltdPtiesMaps
.
containsKey
(
"dbtr"
))
{
...
...
@@ -61,7 +60,6 @@ public class Camt054001Parse52For900Field extends AbstractMt2MxCamt054001ParseFi
agtMaps
=
(
Map
<
String
,
Object
>)
dbtrMaps
.
get
(
"agt"
);
}
else
{
agtMaps
=
new
HashMap
<>();
dbtrMaps
.
put
(
"agt"
,
agtMaps
);
}
String
account
=
""
;
if
(
field52A
!=
null
)
{
...
...
@@ -105,5 +103,11 @@ public class Camt054001Parse52For900Field extends AbstractMt2MxCamt054001ParseFi
mt_to_mxFinancialInstitutionAccount
(
account
,
dbtrAcctMaps
,
"DbtrAcct/Id"
);
}
}
if
(
dbtrAcctMaps
.
size
()>
0
){
rltdPtiesMaps
.
put
(
"dbtrAcct"
,
dbtrAcctMaps
);
}
if
(
agtMaps
.
size
()>
0
){
dbtrMaps
.
put
(
"agt"
,
agtMaps
);
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse52For910Field.java
View file @
9ae8a5ae
...
...
@@ -49,7 +49,6 @@ public class Camt054001Parse52For910Field extends AbstractMt2MxCamt054001ParseFi
dbtrAgtMaps
=
(
Map
<
String
,
Object
>)
rltdAgtsMaps
.
get
(
"dbtrAgt"
);
}
else
{
dbtrAgtMaps
=
new
HashMap
<>();
rltdAgtsMaps
.
put
(
"dbtrAgt"
,
dbtrAgtMaps
);
}
String
account
=
""
;
if
(
field52A
!=
null
)
{
...
...
@@ -90,6 +89,9 @@ public class Camt054001Parse52For910Field extends AbstractMt2MxCamt054001ParseFi
}
mt_to_mxClearingIdentifier
(
account
,
clrSysMmbIdMaps
);
}
if
(
dbtrAgtMaps
.
size
()>
0
){
rltdAgtsMaps
.
put
(
"dbtrAgt"
,
dbtrAgtMaps
);
}
}
}
else
{
Map
<
String
,
Object
>
rltdPtiesMaps
=
null
;
...
...
@@ -104,7 +106,6 @@ public class Camt054001Parse52For910Field extends AbstractMt2MxCamt054001ParseFi
dbtrAcctMaps
=
(
Map
<
String
,
Object
>)
rltdPtiesMaps
.
get
(
"dbtrAcct"
);
}
else
{
dbtrAcctMaps
=
new
HashMap
<>();
rltdPtiesMaps
.
put
(
"dbtrAcct"
,
dbtrAcctMaps
);
}
Map
<
String
,
Object
>
dbtrMaps
=
null
;
if
(
rltdPtiesMaps
.
containsKey
(
"dbtr"
))
{
...
...
@@ -118,7 +119,6 @@ public class Camt054001Parse52For910Field extends AbstractMt2MxCamt054001ParseFi
agtMaps
=
(
Map
<
String
,
Object
>)
dbtrMaps
.
get
(
"agt"
);
}
else
{
agtMaps
=
new
HashMap
<>();
dbtrMaps
.
put
(
"agt"
,
agtMaps
);
}
String
account
=
""
;
if
(
field52A
!=
null
)
{
...
...
@@ -162,6 +162,12 @@ public class Camt054001Parse52For910Field extends AbstractMt2MxCamt054001ParseFi
mt_to_mxFinancialInstitutionAccount
(
account
,
dbtrAcctMaps
,
"DbtrAcct/Id"
);
}
}
if
(
agtMaps
.
size
()>
0
){
dbtrMaps
.
put
(
"agt"
,
agtMaps
);
}
if
(
dbtrAcctMaps
.
size
()>
0
){
rltdPtiesMaps
.
put
(
"dbtrAcct"
,
dbtrAcctMaps
);
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse56Field.java
View file @
9ae8a5ae
...
...
@@ -48,7 +48,6 @@ public class Camt054001Parse56Field extends AbstractMt2MxCamt054001ParseField {
intrmyAgt1Maps
=
(
Map
<
String
,
Object
>)
rltdAgtsMaps
.
get
(
"intrmyAgt1"
);
}
else
{
intrmyAgt1Maps
=
new
HashMap
<>();
rltdAgtsMaps
.
put
(
"intrmyAgt1"
,
intrmyAgt1Maps
);
}
Map
<
String
,
Object
>
finInstnIdMaps
=
null
;
if
(
intrmyAgt1Maps
.
containsKey
(
"finInstnId"
))
{
...
...
@@ -95,5 +94,8 @@ public class Camt054001Parse56Field extends AbstractMt2MxCamt054001ParseField {
String
nameAddress
=
field56D
.
getNameAndAddress
();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress
(
nameAddress
,
intrmyAgt1Maps
);
}
if
(
intrmyAgt1Maps
.
size
()>
0
){
rltdAgtsMaps
.
put
(
"intrmyAgt1"
,
intrmyAgt1Maps
);
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt056001/Mt2MxCamt056001Creator.java
View file @
9ae8a5ae
package
com
.
brilliance
.
swift
.
mt2mx
.
camt056001
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
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.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.vo.SwiftTranslationErrorInfo
;
import
com.brilliance.swift.vo.SwiftTranslationReport
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field79
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.ArrayList
;
...
...
@@ -79,6 +86,36 @@ public class Mt2MxCamt056001Creator extends AbstractMt2MxCreator {
JSONArray
adrLineJsonArray
=
new
JSONArray
();
pstlAdrMaps
.
put
(
"adrLine"
,
adrLineJsonArray
);
adrLineJsonArray
.
add
(
Mx2MtConstants
.
MT_TO_MX_DEFAULT_VALUE
);
Tag
tag79
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
"79"
);
Field79
field79
=
(
Field79
)
tag79
.
asField
();
int
index
=
field79
.
getValue
().
indexOf
(
"/UETR/"
);
String
uetr
=
""
;
if
(
index
>-
1
){
uetr
=
field79
.
getValue
().
substring
(
index
+
6
);
}
if
(
StringUtil
.
isEmpty
(
orgnlUETR
)&&
StringUtil
.
isEmpty
(
uetr
)){
buildSTErrorInfo
(
ERROR
.
T20087
,
"Block3/UETR"
,
null
);
}
}
protected
void
buildSTErrorInfo
(
String
errorCode
,
String
location
,
String
originalValue
)
{
SwiftTranslationReport
str
=
context
.
get
(
SwiftTranslationReport
.
class
);
SwiftTranslationErrorInfo
errorInfo
=
SwiftTransferUtil
.
getSwiftTranslationErrorInfoByErrorCode
(
errorCode
);
errorInfo
.
setLocation
(
location
);
errorInfo
.
setOriginalValue
(
originalValue
);
List
<
SwiftTranslationErrorInfo
>
errorInfos
=
str
.
getErrorInfos
();
boolean
existFlag
=
false
;
for
(
int
i
=
0
;
i
<
errorInfos
.
size
();
i
++)
{
if
(
SwiftTransferUtil
.
compareStErrorInfo
(
errorInfo
,
errorInfos
.
get
(
i
)))
{
existFlag
=
true
;
break
;
}
}
if
(!
existFlag
)
{
str
.
addErrorInfo
(
errorInfo
);
if
(
"FAILURE"
.
equalsIgnoreCase
(
errorInfo
.
getErrorType
()))
{
throw
new
SwiftException
(
location
+
Mx2MtConstants
.
NEW_LINE
+
"-"
+
errorInfo
.
getErrorType
()
+
":"
+
errorInfo
.
getDescription
());
}
}
}
@Override
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt056001/impl/Camt056001Parse32AField.java
View file @
9ae8a5ae
package
com
.
brilliance
.
swift
.
mt2mx
.
camt056001
.
impl
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt056001.AbstractMt2MxCamt056001ParseField
;
import
com.brilliance.swift.util.DateUtil
;
...
...
@@ -31,6 +32,8 @@ public class Camt056001Parse32AField extends AbstractMt2MxCamt056001ParseField {
orgnlIntrBkSttlmAmtMaps
.
put
(
"value"
,
field32A
.
amount
());
orgnlIntrBkSttlmAmtMaps
.
put
(
"ccy"
,
field32A
.
getCurrency
());
txInfMaps
.
put
(
"orgnlIntrBkSttlmAmt"
,
orgnlIntrBkSttlmAmtMaps
);
}
else
{
buildSTErrorInfo
(
ERROR
.
T20088
,
"Block4:32A:"
,
null
);
}
}
catch
(
ParseException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt056001/impl/Camt056001Parse79Field.java
View file @
9ae8a5ae
...
...
@@ -9,6 +9,7 @@ import com.prowidesoftware.swift.model.field.Field79;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
Camt056001Parse79Field
extends
AbstractMt2MxCamt056001ParseField
{
...
...
@@ -22,7 +23,8 @@ public class Camt056001Parse79Field extends AbstractMt2MxCamt056001ParseField {
Map
<
String
,
Object
>
txInfMaps
=
getTxInfMaps
();
if
(
tag79
!=
null
)
{
Field79
field79
=
(
Field79
)
tag79
.
asField
();
mt_To_mxField79
(
field79
.
getValue
(),
txInfMaps
);
List
<
String
>
lines
=
field79
.
getLines
();
mt_To_mxField79
(
lines
,
txInfMaps
);
}
else
{
JSONArray
cxlRsnInfJSONArray
=
null
;
Map
<
String
,
Object
>
cxlRsnInfMaps
=
null
;
...
...
swiftCore/src/test/java/com/brilliance/mt2mx/camt029001/Test196.java
View file @
9ae8a5ae
package
com
.
brilliance
.
mt2mx
.
camt029001
;
import
com.brilliance.swift.SwiftTransfer
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.SwiftTranslationErrorInfo
;
import
com.brilliance.swift.vo.SwiftTranslationReport
;
import
org.apache.commons.io.FileUtils
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.List
;
public
class
Test196
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftTxt\\Mt
196.txt"
);
File
file
=
new
File
(
"E:/TEST/MT/MT
196.txt"
);
String
mtStr
=
FileUtils
.
readFileToString
(
file
);
String
mxXml
=
SwiftTransfer
.
mt2Mx
(
mtStr
,
"D:/test/mt2mx/camt02900108.xml"
,
null
);
System
.
out
.
println
(
mxXml
);
SwiftTranslationReport
str
=
SwiftTransfer
.
mt2MxPlus
(
mtStr
,
"E:/TEST/MX/camt02900109_196.xml"
,
null
);
if
(
str
!=
null
)
{
List
<
SwiftTranslationErrorInfo
>
errorInfos
=
str
.
getErrorInfos
();
if
(
errorInfos
!=
null
&&
errorInfos
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
errorInfos
.
size
();
i
++)
{
SwiftTranslationErrorInfo
errorInfo
=
errorInfos
.
get
(
i
);
String
location
=
errorInfo
.
getLocation
();
String
errorType
=
errorInfo
.
getErrorType
();
String
description
=
errorInfo
.
getDescription
();
System
.
out
.
println
(
location
+
Mx2MtConstants
.
NEW_LINE
+
"-"
+
errorType
+
":"
+
description
);
String
originalValue
=
errorInfo
.
getOriginalValue
();
if
(
StringUtil
.
isNotEmpty
(
originalValue
))
{
System
.
out
.
println
(
originalValue
);
}
}
}
System
.
out
.
println
(
str
.
getMessage
());
}
}
}
swiftCore/src/test/java/com/brilliance/mt2mx/camt029001/Test296.java
View file @
9ae8a5ae
package
com
.
brilliance
.
mt2mx
.
camt029001
;
import
com.brilliance.swift.SwiftTransfer
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.SwiftTranslationErrorInfo
;
import
com.brilliance.swift.vo.SwiftTranslationReport
;
import
org.apache.commons.io.FileUtils
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.List
;
public
class
Test296
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftTxt\\Mt
296.txt"
);
File
file
=
new
File
(
"E:/TEST/MT/MT
296.txt"
);
String
mtStr
=
FileUtils
.
readFileToString
(
file
);
String
mxXml
=
SwiftTransfer
.
mt2Mx
(
mtStr
,
"D:/test/mt2mx/camt02900108.xml"
,
null
);
System
.
out
.
println
(
mxXml
);
SwiftTranslationReport
str
=
SwiftTransfer
.
mt2MxPlus
(
mtStr
,
"E:/TEST/MX/camt02900109_296.xml"
,
null
);
if
(
str
!=
null
)
{
List
<
SwiftTranslationErrorInfo
>
errorInfos
=
str
.
getErrorInfos
();
if
(
errorInfos
!=
null
&&
errorInfos
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
errorInfos
.
size
();
i
++)
{
SwiftTranslationErrorInfo
errorInfo
=
errorInfos
.
get
(
i
);
String
location
=
errorInfo
.
getLocation
();
String
errorType
=
errorInfo
.
getErrorType
();
String
description
=
errorInfo
.
getDescription
();
System
.
out
.
println
(
location
+
Mx2MtConstants
.
NEW_LINE
+
"-"
+
errorType
+
":"
+
description
);
String
originalValue
=
errorInfo
.
getOriginalValue
();
if
(
StringUtil
.
isNotEmpty
(
originalValue
))
{
System
.
out
.
println
(
originalValue
);
}
}
}
System
.
out
.
println
(
str
.
getMessage
());
}
}
}
swiftCore/src/test/java/com/brilliance/mt2mx/camt056001/Test192.java
View file @
9ae8a5ae
package
com
.
brilliance
.
mt2mx
.
camt056001
;
import
com.brilliance.swift.SwiftTransfer
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.SwiftTranslationErrorInfo
;
import
com.brilliance.swift.vo.SwiftTranslationReport
;
import
org.apache.commons.io.FileUtils
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.List
;
public
class
Test192
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftTxt\\Mt
192.txt"
);
File
file
=
new
File
(
"E:/TEST/MT/MT
192.txt"
);
String
mtStr
=
FileUtils
.
readFileToString
(
file
);
String
mxXml
=
SwiftTransfer
.
mt2Mx
(
mtStr
,
"D:/test/mt2mx/camt05600108.xml"
,
null
);
System
.
out
.
println
(
mxXml
);
SwiftTranslationReport
str
=
SwiftTransfer
.
mt2MxPlus
(
mtStr
,
"E:/TEST/MX/camt05600108_192.xml"
,
null
);
if
(
str
!=
null
)
{
List
<
SwiftTranslationErrorInfo
>
errorInfos
=
str
.
getErrorInfos
();
if
(
errorInfos
!=
null
&&
errorInfos
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
errorInfos
.
size
();
i
++)
{
SwiftTranslationErrorInfo
errorInfo
=
errorInfos
.
get
(
i
);
String
location
=
errorInfo
.
getLocation
();
String
errorType
=
errorInfo
.
getErrorType
();
String
description
=
errorInfo
.
getDescription
();
System
.
out
.
println
(
location
+
Mx2MtConstants
.
NEW_LINE
+
"-"
+
errorType
+
":"
+
description
);
String
originalValue
=
errorInfo
.
getOriginalValue
();
if
(
StringUtil
.
isNotEmpty
(
originalValue
))
{
System
.
out
.
println
(
originalValue
);
}
}
}
System
.
out
.
println
(
str
.
getMessage
());
}
}
}
swiftCore/src/test/java/com/brilliance/mt2mx/camt056001/Test292.java
View file @
9ae8a5ae
package
com
.
brilliance
.
mt2mx
.
camt056001
;
import
com.brilliance.swift.SwiftTransfer
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.SwiftTranslationErrorInfo
;
import
com.brilliance.swift.vo.SwiftTranslationReport
;
import
org.apache.commons.io.FileUtils
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.List
;
public
class
Test292
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftTxt\\Mt
292.txt"
);
File
file
=
new
File
(
"E:/TEST/MT/MT
292.txt"
);
String
mtStr
=
FileUtils
.
readFileToString
(
file
);
String
mxXml
=
SwiftTransfer
.
mt2Mx
(
mtStr
,
"D:/test/mt2mx/camt05600108.xml"
,
null
);
System
.
out
.
println
(
mxXml
);
SwiftTranslationReport
str
=
SwiftTransfer
.
mt2MxPlus
(
mtStr
,
"E:/TEST/MX/camt05600108_292.xml"
,
null
);
if
(
str
!=
null
)
{
List
<
SwiftTranslationErrorInfo
>
errorInfos
=
str
.
getErrorInfos
();
if
(
errorInfos
!=
null
&&
errorInfos
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
errorInfos
.
size
();
i
++)
{
SwiftTranslationErrorInfo
errorInfo
=
errorInfos
.
get
(
i
);
String
location
=
errorInfo
.
getLocation
();
String
errorType
=
errorInfo
.
getErrorType
();
String
description
=
errorInfo
.
getDescription
();
System
.
out
.
println
(
location
+
Mx2MtConstants
.
NEW_LINE
+
"-"
+
errorType
+
":"
+
description
);
String
originalValue
=
errorInfo
.
getOriginalValue
();
if
(
StringUtil
.
isNotEmpty
(
originalValue
))
{
System
.
out
.
println
(
originalValue
);
}
}
}
System
.
out
.
println
(
str
.
getMessage
());
}
}
}
swiftCore/src/test/java/com/brilliance/mx2mt/mt196/TestMx2MtFor196.java
View file @
9ae8a5ae
...
...
@@ -11,7 +11,7 @@ import java.util.List;
public
class
TestMx2MtFor196
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt02900108_
1
96.xml"
);
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt02900108_
2
96.xml"
);
String
xmlStr
=
FileUtils
.
readFileToString
(
file
);
SwiftTranslationReport
str
=
SwiftTransfer
.
mx2MtPlus
(
xmlStr
,
null
,
null
);
if
(
str
!=
null
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment