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
16fa7d77
Commit
16fa7d77
authored
Jun 30, 2022
by
zhanghou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了mt210,mt192292,mt196296,mt942的异常警告的定义和对判断是转成mt941还是mt942逻辑的修改
parent
f3d17e8a
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
158 additions
and
94 deletions
+158
-94
Mx2MtContextIdentifier.java
...va/com/brilliance/swift/mx2mt/Mx2MtContextIdentifier.java
+2
-0
Mx2Mtn92Creator.java
.../com/brilliance/swift/mx2mt/mt192292/Mx2Mtn92Creator.java
+1
-1
Field11SGenerate.java
...rilliance/swift/mx2mt/mt192292/impl/Field11SGenerate.java
+2
-2
Mx2Mtn96Creator.java
.../com/brilliance/swift/mx2mt/mt196296/Mx2Mtn96Creator.java
+1
-1
Field11RGenerate.java
...rilliance/swift/mx2mt/mt196296/impl/Field11RGenerate.java
+2
-2
Field20Generate.java
...om/brilliance/swift/mx2mt/mt210/impl/Field20Generate.java
+3
-1
Field21Generate.java
...om/brilliance/swift/mx2mt/mt210/impl/Field21Generate.java
+3
-1
Field30Generate.java
...om/brilliance/swift/mx2mt/mt210/impl/Field30Generate.java
+2
-1
Field50aGenerate.java
...m/brilliance/swift/mx2mt/mt210/impl/Field50aGenerate.java
+5
-3
Field52aGenerate.java
...m/brilliance/swift/mx2mt/mt210/impl/Field52aGenerate.java
+1
-0
Mx2Mt941942Creator.java
...m/brilliance/swift/mx2mt/mt941942/Mx2Mt941942Creator.java
+11
-7
Field28CGenerate.java
...rilliance/swift/mx2mt/mt941942/impl/Field28CGenerate.java
+6
-8
Field60FGenerate.java
...rilliance/swift/mx2mt/mt941942/impl/Field60FGenerate.java
+8
-2
Field61Generate.java
...brilliance/swift/mx2mt/mt941942/impl/Field61Generate.java
+14
-20
Field62FGenerate.java
...rilliance/swift/mx2mt/mt941942/impl/Field62FGenerate.java
+8
-2
Field64Generate.java
...brilliance/swift/mx2mt/mt941942/impl/Field64Generate.java
+8
-2
Field65Generate.java
...brilliance/swift/mx2mt/mt941942/impl/Field65Generate.java
+6
-2
Field90CGenerate.java
...rilliance/swift/mx2mt/mt941942/impl/Field90CGenerate.java
+0
-6
Field90DGenerate.java
...rilliance/swift/mx2mt/mt941942/impl/Field90DGenerate.java
+0
-6
MxCamt02900108_196.xml
swiftCore/src/main/resources/swiftXml/MxCamt02900108_196.xml
+4
-4
MxCamt05600108_192.xml
swiftCore/src/main/resources/swiftXml/MxCamt05600108_192.xml
+1
-1
MxCamt05700106.xml
swiftCore/src/main/resources/swiftXml/MxCamt05700106.xml
+15
-15
TestMx2MtFor196.java
...test/java/com/brilliance/mx2mt/mt196/TestMx2MtFor196.java
+19
-3
TestMx2MtFor210.java
...test/java/com/brilliance/mx2mt/mt210/TestMx2MtFor210.java
+18
-2
TestMx2MtFor942.java
...test/java/com/brilliance/mx2mt/mt942/TestMx2MtFor942.java
+18
-2
No files found.
swiftCore/src/main/java/com/brilliance/swift/mx2mt/Mx2MtContextIdentifier.java
View file @
16fa7d77
...
...
@@ -24,4 +24,6 @@ public class Mx2MtContextIdentifier {
public
static
final
String
MX_TO_MT_ERROR_LOCATION
=
"mx.to.mt.error.location"
;
public
static
final
String
MX_TO_MT_TYPE
=
"mx.to.mt.type"
;
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt192292/Mx2Mtn92Creator.java
View file @
16fa7d77
...
...
@@ -83,7 +83,7 @@ public class Mx2Mtn92Creator extends AbstractMx2MtCreator {
}
else
if
(
orgMsgNameIdentification
.
matches
(
"MT20[0-9]{1}"
))
{
mtType
=
Mx2MtConstants
.
MT_TYPE_292
;
}
else
{
buildSTErrorInfo
(
ERROR
.
T20092
,
""
,
bodyParentPath
+
"Undrlyg.TxInf.OrgnlGrpInf.OrgnlMsgNmId"
);
buildSTErrorInfo
(
ERROR
.
T20092
,
null
,
null
);
}
}
return
mtType
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt192292/impl/Field11SGenerate.java
View file @
16fa7d77
...
...
@@ -40,7 +40,7 @@ public class Field11SGenerate extends AbstractMx2MtTagsGenerate {
orgnlMsgNmId
=
mtType
.
substring
(
2
);
}
else
{
orgnlMsgNmId
=
"202"
;
buildSTErrorInfo
(
ERROR
.
T20083
,
""
,
""
);
buildSTErrorInfo
(
ERROR
.
T20083
,
null
,
null
);
}
}
}
...
...
@@ -48,7 +48,7 @@ public class Field11SGenerate extends AbstractMx2MtTagsGenerate {
if
(
dateStr
.
length
()>
0
){
date
=
mXToMTDate
(
dateStr
);
}
else
{
date
=
mXToMTDate
(
"993112"
)
;
date
=
"993112"
;
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt196296/Mx2Mtn96Creator.java
View file @
16fa7d77
...
...
@@ -83,7 +83,7 @@ public class Mx2Mtn96Creator extends AbstractMx2MtCreator {
}
else
if
(
orgMsgNameIdentification
.
matches
(
"MT20[0-9]{1}"
))
{
mtType
=
Mx2MtConstants
.
MT_TYPE_296
;
}
else
{
buildSTErrorInfo
(
ERROR
.
T20092
,
""
,
bodyParentPath
+
"CxlDtls.TxInfAndSts.OrgnlGrpInf.OrgnlMsgNmId"
);
buildSTErrorInfo
(
ERROR
.
T20092
,
null
,
null
);
}
}
return
mtType
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt196296/impl/Field11RGenerate.java
View file @
16fa7d77
...
...
@@ -51,7 +51,7 @@ public class Field11RGenerate extends AbstractMx2MtTagsGenerate {
if
(
dateStr
.
length
()>
0
){
date
=
mXToMTDate
(
dateStr
);
}
else
{
date
=
mXToMTDate
(
"993112"
)
;
date
=
"993112"
;
boolean2
=
true
;
}
}
...
...
@@ -60,7 +60,7 @@ public class Field11RGenerate extends AbstractMx2MtTagsGenerate {
}
else
{
tags
.
add
(
new
Tag
(
name
,
orgnlMsgNmId
+
Mx2MtConstants
.
NEW_LINE
+
date
));
if
(
boolean1
){
buildSTErrorInfo
(
ERROR
.
T20083
,
""
,
""
);
buildSTErrorInfo
(
ERROR
.
T20083
,
null
,
null
);
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt210/impl/Field20Generate.java
View file @
16fa7d77
package
com
.
brilliance
.
swift
.
mx2mt
.
mt210
.
impl
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
...
...
@@ -24,11 +25,12 @@ public class Field20Generate extends AbstractMx2MtTagsGenerate {
if
(
StringUtil
.
isNotEmpty
(
messageId
))
{
if
(
messageId
.
length
()
>
16
)
{
messageId
=
messageId
.
substring
(
0
,
15
)
+
"+"
;
buildSTErrorInfo
(
ERROR
.
T0000T
,
"BLOCK4/:20:"
,
messageId
);
}
String
value
=
messageId
;
if
(
value
.
startsWith
(
"/"
)
||
value
.
endsWith
(
"/"
)
||
value
.
contains
(
"//"
))
{
value
=
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
;
//TODO,填入location:mt210/block3/:20:,errorcode:T20051
buildSTErrorInfo
(
ERROR
.
T20051
,
"BLOCK4/:20:"
,
messageId
);
}
tags
.
add
(
new
Tag
(
name
,
value
));
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt210/impl/Field21Generate.java
View file @
16fa7d77
package
com
.
brilliance
.
swift
.
mx2mt
.
mt210
.
impl
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
...
...
@@ -29,12 +30,13 @@ public class Field21Generate extends AbstractMx2MtTagsGenerate {
}
if
(
StringUtil
.
isNotEmpty
(
filed21
))
{
if
(
filed21
.
length
()
>
16
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"BLOCK4/:21:"
,
endToEndId
);
filed21
=
filed21
.
substring
(
0
,
15
)
+
"+"
;
}
String
value
=
filed21
;
if
(
value
.
startsWith
(
"/"
)
||
value
.
endsWith
(
"/"
)
||
value
.
contains
(
"//"
))
{
value
=
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
;
//TODO,填入location:mt210/block3/:21:,errorcode:T20055
buildSTErrorInfo
(
ERROR
.
T20055
,
"BLOCK4/:21:"
,
endToEndId
);
}
tags
.
add
(
new
Tag
(
name
,
value
));
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt210/impl/Field30Generate.java
View file @
16fa7d77
package
com
.
brilliance
.
swift
.
mx2mt
.
mt210
.
impl
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.util.StringUtil
;
...
...
@@ -31,7 +32,7 @@ public class Field30Generate extends AbstractMx2MtTagsGenerate {
mtDate
=
mXToMTDate
(
mxDate
);
}
else
{
mtDate
=
mXToMTDate
(
"991231"
);
//TODO,填入location:mt210/block3/:30:,errorcode:T00062
buildSTErrorInfo
(
ERROR
.
T20062
,
"BLOCK4/:20:"
,
""
);
}
tags
.
add
(
new
Tag
(
name
,
mtDate
));
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt210/impl/Field50aGenerate.java
View file @
16fa7d77
package
com
.
brilliance
.
swift
.
mx2mt
.
mt210
.
impl
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
...
...
@@ -24,6 +25,7 @@ public class Field50aGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/50a"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
int
counts1
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"Ntfctn.Dbtr.Pty"
);
...
...
@@ -96,7 +98,7 @@ public class Field50aGenerate extends AbstractMx2MtTagsGenerate {
tags
.
add
(
new
Tag
(
name_F
,
account
+
Mx2MtConstants
.
NEW_LINE
+
mtNameAddress
));
}
}
else
{
//TODO,填入location:mt210/block3/:50a:,errorcode:T20102
buildSTErrorInfo
(
ERROR
.
T20102
,
"BLOCK4/:50a:"
,
""
);
}
if
(
counts3
>
0
||
counts4
>
0
)
{
if
(
StringUtil
.
isNotEmpty
(
bicCode
))
{
...
...
@@ -109,10 +111,10 @@ public class Field50aGenerate extends AbstractMx2MtTagsGenerate {
tags
.
add
(
new
Tag
(
name_
,
nameAddress
));
}
else
if
(
StringUtil
.
isNotEmpty
(
clearSystemId
))
{
tags
.
add
(
new
Tag
(
name_
,
clearSystemId
));
//TODO,填入location:mt210/block3/:50a:,errorcode:T20097
buildSTErrorInfo
(
ERROR
.
T20097
,
"BLOCK4/:50a:"
,
""
);
}
}
else
{
//TODO,填入location:mt210/block3/:50a:,errorcode:T20102
buildSTErrorInfo
(
ERROR
.
T20102
,
"BLOCK4/:50a:"
,
""
);
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt210/impl/Field52aGenerate.java
View file @
16fa7d77
...
...
@@ -21,6 +21,7 @@ public class Field52aGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/52a"
);
String
s
=
(
String
)
context
.
get
(
Mx2MtContextIdentifier
.
MT_TYPE_210_50_FLAG
);
if
(
Mx2MtConstants
.
YES
.
equals
(
s
)){
return
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt941942/Mx2Mt941942Creator.java
View file @
16fa7d77
...
...
@@ -48,14 +48,18 @@ public class Mx2Mt941942Creator extends AbstractMx2MtCreator {
@Override
protected
String
getMtType
()
{
/*
Document document = (Document)context.get(Mx2MtContextIdentifier.MX_XMl_DOCUMENT);
Document
document
=
(
Document
)
context
.
get
(
Mx2MtContextIdentifier
.
MX_XMl_DOCUMENT
);
String
bodyParentPath
=
(
String
)
context
.
get
(
Mx2MtContextIdentifier
.
BODY_PARENT_ELEMENT_NAME
,
true
);
int balanceTypeCount = getXmlNodeCounts(bodyParentPath, document, "Rpt.Bal");
if(balanceTypeCount>0){
return Mx2MtConstants.MT_TYPE_941;
}else {
int
entryCount
=
getXmlNodeCounts
(
bodyParentPath
,
document
,
"Rpt.Ntry"
);
String
sumc
=
getXmlNodeValue
(
bodyParentPath
,
document
,
"Rpt.TxsSummry.TtlCdtNtries.Sum"
);
String
sumd
=
getXmlNodeValue
(
bodyParentPath
,
document
,
"Rpt.TxsSummry.TtlDbtNtries.Sum"
);
if
(
entryCount
!=
0
||
StringUtil
.
isNotEmpty
(
sumc
)||
StringUtil
.
isNotEmpty
(
sumd
)){
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_TYPE
,
Mx2MtConstants
.
MT_TYPE_942
);
return
Mx2MtConstants
.
MT_TYPE_942
;
}*/
return
Mx2MtConstants
.
MT_TYPE_942
;
}
else
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_TYPE
,
Mx2MtConstants
.
MT_TYPE_941
);
return
Mx2MtConstants
.
MT_TYPE_941
;
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt941942/impl/Field28CGenerate.java
View file @
16fa7d77
...
...
@@ -20,18 +20,16 @@ public class Field28CGenerate extends AbstractMx2MtTagsGenerate {
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
leSeNum
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.LglSeqNb"
);
String
mt
=
""
;
if
(
StringUtil
.
isEmpty
(
leSeNum
)||
leSeNum
.
length
()>
5
){
mt
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.ElctrncSeqNb"
);
if
(
StringUtil
.
isEmpty
(
mt
)||
mt
.
length
()>
5
){
String
num
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.LglSeqNb"
);
if
(
StringUtil
.
isEmpty
(
num
)||
num
.
length
()>
5
){
num
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.ElctrncSeqNb"
);
if
(
StringUtil
.
isEmpty
(
num
)||
num
.
length
()>
5
){
buildSTErrorInfo
(
ERROR
.
T20103
,
"BLOCK4/:28:"
,
bodyHdrParentElementName
+
"Rpt.ElctrncSeqNb"
);
return
;
}
}
else
{
String
pageNum
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.RptPgntn.PgNb"
);
mt
=
leSeNum
+
"/"
+
pageNum
;
}
String
pageNum
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.RptPgntn.PgNb"
);
String
mt
=
num
+
"/"
+
pageNum
;
tags
.
add
(
new
Tag
(
name
,
mt
));
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt941942/impl/Field60FGenerate.java
View file @
16fa7d77
package
com
.
brilliance
.
swift
.
mx2mt
.
mt941942
.
impl
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.NumberUtil
;
import
com.brilliance.swift.util.StringUtil
;
...
...
@@ -25,7 +27,11 @@ public class Field60FGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
/*SwiftMessage swiftMessage = context.get(SwiftMessage.class);
String
mtType
=
(
String
)
context
.
get
(
Mx2MtContextIdentifier
.
MX_TO_MT_TYPE
);
if
(
Mx2MtConstants
.
MT_TYPE_942
.
equals
(
mtType
)){
return
;
}
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
int
balanceTypeCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"Rpt.Bal"
);
int
index
=
-
1
;
...
...
@@ -66,6 +72,6 @@ public class Field60FGenerate extends AbstractMx2MtTagsGenerate {
}
catch
(
DatatypeConfigurationException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
*/
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt941942/impl/Field61Generate.java
View file @
16fa7d77
...
...
@@ -30,21 +30,15 @@ public class Field61Generate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
try
{
String
mtType
=
(
String
)
context
.
get
(
Mx2MtContextIdentifier
.
MX_TO_MT_TYPE
);
if
(
Mx2MtConstants
.
MT_TYPE_941
.
equals
(
mtType
)){
return
;
}
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
/*int balanceTypeCount = getXmlNodeCounts(bodyHdrParentElementName, document, "Rpt.Bal");
if(balanceTypeCount>0){
return;
}*/
int
entryCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"Rpt.Ntry"
);
if
(
entryCount
>
189
){
buildSTErrorInfo
(
ERROR
.
T20110
,
"BLOCK4/:61:"
,
bodyHdrParentElementName
+
"Rpt.Ntry"
);
return
;
}
String
sumc
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.TxsSummry.TtlCdtNtries.Sum"
);
String
sumd
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.TxsSummry.TtlDbtNtries.Sum"
);
if
(
entryCount
<
0
||
StringUtil
.
isEmpty
(
sumc
)&&
StringUtil
.
isEmpty
(
sumd
)){
buildSTErrorInfo
(
ERROR
.
T20114
,
"BLOCK4/:61:"
,
""
);
buildSTErrorInfo
(
ERROR
.
T20110
,
"BLOCK4/:61:"
,
entryCount
+
""
);
return
;
}
String
ccy2
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.Acct.Ccy"
);
...
...
@@ -87,28 +81,25 @@ public class Field61Generate extends AbstractMx2MtTagsGenerate {
}
String
amt
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.Ntry("
+
i
+
").Amt"
);
String
ccy
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.Ntry("
+
i
+
").Amt@Ccy"
);
if
(
amt
.
length
()>
14
){
buildSTErrorInfo
(
ERROR
.
T20113
,
"BLOCK4/:61:"
,
amt
);
return
;
}
if
(
StringUtil
.
isNotEmpty
(
amt
)
&&
StringUtil
.
isNotEmpty
(
ccy
))
{
String
amount
=
NumberUtil
.
formatAmt
(
new
BigDecimal
(
amt
),
ccy
);
if
(
amount
.
length
()>
15
){
buildSTErrorInfo
(
ERROR
.
T20113
,
"BLOCK4/:61:"
,
amt
);
return
;
}
value
+=
amount
;
}
if
(
StringUtil
.
isNotEmpty
(
ccy
)&&
StringUtil
.
isNotEmpty
(
ccy2
)){
if
(
ccy
.
equals
(
ccy2
)){
if
(
!
ccy
.
equals
(
ccy2
)){
buildSTErrorInfo
(
ERROR
.
T20116
,
"BLOCK4/:61:"
,
ccy
);
return
;
}
}
if
(
amt
.
length
()>
14
){
buildSTErrorInfo
(
ERROR
.
T20113
,
"BLOCK4/:61:"
,
bodyHdrParentElementName
+
"Rpt.Ntry("
+
i
+
").Amt"
);
return
;
}
value
+=
"NTRF"
;
String
endToEndId
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.Ntry("
+
i
+
").NtryDtls.TxDtls.Refs.EndToEndId"
);
if
(
StringUtil
.
isNotEmpty
(
endToEndId
))
{
if
(
endToEndId
.
length
()
>
16
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"BLOCK4/:61:"
,
endToEndId
);
endToEndId
=
endToEndId
.
substring
(
0
,
15
)
+
"+"
;
}
value
+=
endToEndId
;
...
...
@@ -118,6 +109,7 @@ public class Field61Generate extends AbstractMx2MtTagsGenerate {
String
accountServicerReference
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.Ntry("
+
i
+
").AcctSvcrRef"
);
if
(
StringUtil
.
isNotEmpty
(
accountServicerReference
))
{
if
(
accountServicerReference
.
length
()
>
16
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"BLOCK4/:61:"
,
accountServicerReference
);
accountServicerReference
=
accountServicerReference
.
substring
(
0
,
15
)
+
"+"
;
}
value
+=
"//"
+
accountServicerReference
;
...
...
@@ -125,6 +117,7 @@ public class Field61Generate extends AbstractMx2MtTagsGenerate {
String
additionalInformation
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.Ntry("
+
i
+
").NtryDtls.TxDtls.AddtlTxInf"
);
if
(
StringUtil
.
isNotEmpty
(
additionalInformation
))
{
if
(
additionalInformation
.
length
()
>
34
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"BLOCK4/:61:"
,
additionalInformation
);
additionalInformation
=
additionalInformation
.
substring
(
0
,
33
)
+
"+"
;
}
value
+=
Mx2MtConstants
.
NEW_LINE
+
additionalInformation
;
...
...
@@ -133,6 +126,7 @@ public class Field61Generate extends AbstractMx2MtTagsGenerate {
String
additionalEntryInformation
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.Ntry("
+
i
+
").AddtlNtryInf"
);
if
(
StringUtil
.
isNotEmpty
(
additionalEntryInformation
))
{
if
(
additionalEntryInformation
.
length
()
>
390
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"BLOCK4/:61:"
,
additionalEntryInformation
);
additionalEntryInformation
=
additionalEntryInformation
.
substring
(
0
,
389
)
+
"+"
;
}
String
value86
=
StringUtil
.
getStringByEnter
(
additionalEntryInformation
,
65
,
6
);
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt941942/impl/Field62FGenerate.java
View file @
16fa7d77
package
com
.
brilliance
.
swift
.
mx2mt
.
mt941942
.
impl
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.NumberUtil
;
import
com.brilliance.swift.util.StringUtil
;
...
...
@@ -25,7 +27,11 @@ public class Field62FGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
/*SwiftMessage swiftMessage = context.get(SwiftMessage.class);
String
mtType
=
(
String
)
context
.
get
(
Mx2MtContextIdentifier
.
MX_TO_MT_TYPE
);
if
(
Mx2MtConstants
.
MT_TYPE_942
.
equals
(
mtType
)){
return
;
}
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
int
balanceTypeCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"Rpt.Bal"
);
int
index
=
-
1
;
...
...
@@ -66,6 +72,6 @@ public class Field62FGenerate extends AbstractMx2MtTagsGenerate {
}
catch
(
DatatypeConfigurationException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
*/
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt941942/impl/Field64Generate.java
View file @
16fa7d77
package
com
.
brilliance
.
swift
.
mx2mt
.
mt941942
.
impl
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.NumberUtil
;
import
com.brilliance.swift.util.StringUtil
;
...
...
@@ -25,7 +27,11 @@ public class Field64Generate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
/*SwiftMessage swiftMessage = context.get(SwiftMessage.class);
String
mtType
=
(
String
)
context
.
get
(
Mx2MtContextIdentifier
.
MX_TO_MT_TYPE
);
if
(
Mx2MtConstants
.
MT_TYPE_942
.
equals
(
mtType
)){
return
;
}
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
int
balanceTypeCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"Rpt.Bal"
);
int
index
=
-
1
;
...
...
@@ -66,6 +72,6 @@ public class Field64Generate extends AbstractMx2MtTagsGenerate {
}
catch
(
DatatypeConfigurationException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
*/
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt941942/impl/Field65Generate.java
View file @
16fa7d77
...
...
@@ -27,7 +27,11 @@ public class Field65Generate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
/* SwiftMessage swiftMessage = context.get(SwiftMessage.class);
String
mtType
=
(
String
)
context
.
get
(
Mx2MtContextIdentifier
.
MX_TO_MT_TYPE
);
if
(
Mx2MtConstants
.
MT_TYPE_942
.
equals
(
mtType
)){
return
;
}
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
int
balanceTypeCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"Rpt.Bal"
);
if
(
balanceTypeCount
>
0
)
{
...
...
@@ -64,6 +68,6 @@ public class Field65Generate extends AbstractMx2MtTagsGenerate {
}
}
}
}
*/
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt941942/impl/Field90CGenerate.java
View file @
16fa7d77
...
...
@@ -24,12 +24,6 @@ public class Field90CGenerate extends AbstractMx2MtTagsGenerate {
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
sumc
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.TxsSummry.TtlCdtNtries.Sum"
);
String
nbOfNtries
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.TxsSummry.TtlCdtNtries.NbOfNtries"
);
int
entryCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"Rpt.Ntry"
);
String
sumd
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.TxsSummry.TtlDbtNtries.Sum"
);
if
(
entryCount
<
0
||
StringUtil
.
isEmpty
(
sumc
)&&
StringUtil
.
isEmpty
(
sumd
)){
buildSTErrorInfo
(
ERROR
.
T20114
,
"BLOCK4/:90C:"
,
bodyHdrParentElementName
+
"Rpt.TxsSummry.TtlCdtNtries.Sum"
);
return
;
}
if
(
StringUtil
.
isNotEmpty
(
sumc
)&&
StringUtil
.
isNotEmpty
(
nbOfNtries
))
{
String
currency
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.Acct.Ccy"
);
String
amt
=
NumberUtil
.
formatAmt
(
new
BigDecimal
(
sumc
),
currency
);
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt941942/impl/Field90DGenerate.java
View file @
16fa7d77
...
...
@@ -22,14 +22,8 @@ public class Field90DGenerate extends AbstractMx2MtTagsGenerate {
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
sumc
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.TxsSummry.TtlCdtNtries.Sum"
);
String
sumd
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.TxsSummry.TtlDbtNtries.Sum"
);
String
nbOfNtries
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.TxsSummry.TtlDbtNtries.NbOfNtries"
);
int
entryCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"Rpt.Ntry"
);
if
(
entryCount
<
0
||
StringUtil
.
isEmpty
(
sumc
)&&
StringUtil
.
isEmpty
(
sumd
)){
buildSTErrorInfo
(
ERROR
.
T20114
,
"BLOCK4/:90D:"
,
bodyHdrParentElementName
+
"Rpt.TxsSummry.TtlDbtNtries.Sum"
);
return
;
}
if
(
StringUtil
.
isNotEmpty
(
sumd
)&&
StringUtil
.
isNotEmpty
(
nbOfNtries
))
{
String
currency
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Rpt.Acct.Ccy"
);
String
amt
=
NumberUtil
.
formatAmt
(
new
BigDecimal
(
sumd
),
currency
);
...
...
swiftCore/src/main/resources/swiftXml/MxCamt02900108_196.xml
View file @
16fa7d77
...
...
@@ -78,9 +78,9 @@ Change Log
</Sts>
<CxlDtls>
<TxInfAndSts>
<CxlStsId>
CNCL-ID001
</CxlStsId>
<CxlStsId>
CNCL-ID001
</CxlStsId>
<RslvdCase>
<Id>
CSE-001
</Id>
<Id>
CSE-001
</Id>
<Cretr>
<Agt>
<FinInstnId>
...
...
@@ -90,8 +90,8 @@ Change Log
</Cretr>
</RslvdCase>
<OrgnlGrpInf>
<OrgnlMsgId>
pacs8bizmsgidr01
</OrgnlMsgId>
<OrgnlMsgNmId>
pacs.008.001.08
</OrgnlMsgNmId>
<OrgnlMsgId>
pacs8bizmsgidr01
</OrgnlMsgId>
<OrgnlMsgNmId>
pacs.008.001.08
</OrgnlMsgNmId>
<OrgnlCreDtTm>
2021-02-17T08:30:00+01:00
</OrgnlCreDtTm>
</OrgnlGrpInf>
<OrgnlInstrId>
pacs8bizmsgidr01
</OrgnlInstrId>
...
...
swiftCore/src/main/resources/swiftXml/MxCamt05600108_192.xml
View file @
16fa7d77
...
...
@@ -66,7 +66,7 @@ Change Log
</Cretr>
</Case>
<OrgnlGrpInf>
<OrgnlMsgId>
pacs8bizmsgidr01
</OrgnlMsgId>
<OrgnlMsgId>
pacs8bizmsgidr01
</OrgnlMsgId>
<OrgnlMsgNmId>
pacs.008.001.08
</OrgnlMsgNmId>
<OrgnlCreDtTm>
2021-02-17T08:30:00+01:00
</OrgnlCreDtTm>
</OrgnlGrpInf>
...
...
swiftCore/src/main/resources/swiftXml/MxCamt05700106.xml
View file @
16fa7d77
...
...
@@ -38,7 +38,7 @@ Change Log
<Document
xmlns=
"urn:iso:std:iso:20022:tech:xsd:camt.057.001.06"
>
<NtfctnToRcv>
<GrpHdr>
<MsgId>
camt57bizmsgidr1
</MsgId>
<MsgId>
camt57bizmsgidr1
</MsgId>
<CreDtTm>
2020-11-30T09:00:00+01:00
</CreDtTm>
</GrpHdr>
<Ntfctn>
...
...
@@ -62,21 +62,21 @@ Change Log
<BICFI>
KREDBEBB
</BICFI>
</FinInstnId>
</AcctSvcr>
<Dbtr>
<Pty>
<Nm>
ABC Ltd
</Nm>
<PstlAdr>
<StrtNm>
10 Broad Street
</StrtNm>
<TwnNm>
London
</TwnNm>
<Ctry>
GB
</Ctry>
</PstlAdr>
</Pty>
</Dbtr>
<DbtrAgt>
<FinInstnId>
<Dbtr>
<Pty>
<Nm>
ABC Ltd
</Nm>
<PstlAdr>
<StrtNm>
10 Broad Street
</StrtNm>
<TwnNm>
London
</TwnNm>
<Ctry>
GB
</Ctry>
</PstlAdr>
</Pty>
</Dbtr>
<DbtrAgt>
<FinInstnId>
<BICFI>
BARCGB22
</BICFI>
</FinInstnId>
</DbtrAgt>
</FinInstnId>
</DbtrAgt>
<IntrmyAgt>
<FinInstnId>
<BICFI>
CBPXBE99
</BICFI>
...
...
swiftCore/src/test/java/com/brilliance/mx2mt/mt196/TestMx2MtFor196.java
View file @
16fa7d77
package
com
.
brilliance
.
mx2mt
.
mt196
;
import
com.brilliance.swift.SwiftTransfer
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.vo.SwiftTranslationErrorInfo
;
import
com.brilliance.swift.vo.SwiftTranslationReport
;
import
org.apache.commons.io.FileUtils
;
import
java.io.File
;
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\\Mx
c
amt02900108_196.xml"
);
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\Mx
C
amt02900108_196.xml"
);
String
xmlStr
=
FileUtils
.
readFileToString
(
file
);
String
mt196
=
SwiftTransfer
.
mx2Mt
(
xmlStr
,
null
,
null
);
System
.
out
.
println
(
mt196
);
SwiftTranslationReport
str
=
SwiftTransfer
.
mx2MtPlus
(
xmlStr
,
null
,
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
);
}
}
System
.
out
.
println
(
str
.
getMessage
());
}
}
}
swiftCore/src/test/java/com/brilliance/mx2mt/mt210/TestMx2MtFor210.java
View file @
16fa7d77
package
com
.
brilliance
.
mx2mt
.
mt210
;
import
com.brilliance.swift.SwiftTransfer
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.vo.SwiftTranslationErrorInfo
;
import
com.brilliance.swift.vo.SwiftTranslationReport
;
import
org.apache.commons.io.FileUtils
;
import
java.io.File
;
import
java.util.List
;
public
class
TestMx2MtFor210
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt05700106.xml"
);
String
xmlStr
=
FileUtils
.
readFileToString
(
file
);
String
mt210
=
SwiftTransfer
.
mx2Mt
(
xmlStr
,
null
,
null
);
System
.
out
.
println
(
mt210
);
SwiftTranslationReport
str
=
SwiftTransfer
.
mx2MtPlus
(
xmlStr
,
null
,
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
);
}
}
System
.
out
.
println
(
str
.
getMessage
());
}
}
}
swiftCore/src/test/java/com/brilliance/mx2mt/mt942/TestMx2MtFor942.java
View file @
16fa7d77
package
com
.
brilliance
.
mx2mt
.
mt942
;
import
com.brilliance.swift.SwiftTransfer
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.vo.SwiftTranslationErrorInfo
;
import
com.brilliance.swift.vo.SwiftTranslationReport
;
import
org.apache.commons.io.FileUtils
;
import
java.io.File
;
import
java.util.List
;
public
class
TestMx2MtFor942
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MXcamt05200108_942.xml"
);
String
xmlStr
=
FileUtils
.
readFileToString
(
file
);
String
mt942
=
SwiftTransfer
.
mx2Mt
(
xmlStr
,
null
,
null
);
System
.
out
.
println
(
mt942
);
SwiftTranslationReport
str
=
SwiftTransfer
.
mx2MtPlus
(
xmlStr
,
null
,
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
);
}
}
System
.
out
.
println
(
str
.
getMessage
());
}
}
}
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