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
8e808049
Commit
8e808049
authored
Jul 04, 2022
by
chengzhuoshen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mx转103retn,202,202cov,202retn的转换详细报告
parent
844c8594
Hide whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
449 additions
and
71 deletions
+449
-71
AbstractMx2MtTagsGenerate.java
...com/brilliance/swift/mx2mt/AbstractMx2MtTagsGenerate.java
+17
-2
Mx2MtCreatorManager.java
.../java/com/brilliance/swift/mx2mt/Mx2MtCreatorManager.java
+3
-3
Field20Generate.java
...om/brilliance/swift/mx2mt/mt103/impl/Field20Generate.java
+5
-0
Mx2Mt103RetnCreator.java
...brilliance/swift/mx2mt/mt103Retn/Mx2Mt103RetnCreator.java
+6
-0
Field20Generate.java
...rilliance/swift/mx2mt/mt103Retn/impl/Field20Generate.java
+7
-5
Field32AGenerate.java
...illiance/swift/mx2mt/mt103Retn/impl/Field32AGenerate.java
+5
-0
Field33BGenerate.java
...illiance/swift/mx2mt/mt103Retn/impl/Field33BGenerate.java
+2
-0
Field50AGenerate.java
...illiance/swift/mx2mt/mt103Retn/impl/Field50AGenerate.java
+9
-0
Field52AGenerate.java
...illiance/swift/mx2mt/mt103Retn/impl/Field52AGenerate.java
+3
-0
Field53AGenerate.java
...illiance/swift/mx2mt/mt103Retn/impl/Field53AGenerate.java
+2
-0
Field56AGenerate.java
...illiance/swift/mx2mt/mt103Retn/impl/Field56AGenerate.java
+3
-0
Field57AGenerate.java
...illiance/swift/mx2mt/mt103Retn/impl/Field57AGenerate.java
+30
-0
Field59Generate.java
...rilliance/swift/mx2mt/mt103Retn/impl/Field59Generate.java
+9
-0
Field70Generate.java
...rilliance/swift/mx2mt/mt103Retn/impl/Field70Generate.java
+36
-8
Field71AGenerate.java
...illiance/swift/mx2mt/mt103Retn/impl/Field71AGenerate.java
+10
-1
Field72Generate.java
...rilliance/swift/mx2mt/mt103Retn/impl/Field72Generate.java
+5
-2
Field77BGenerate.java
...illiance/swift/mx2mt/mt103Retn/impl/Field77BGenerate.java
+1
-0
Mx2Mt202RetnCreator.java
...brilliance/swift/mx2mt/mt202Retn/Mx2Mt202RetnCreator.java
+6
-0
Field21Generate.java
...rilliance/swift/mx2mt/mt202Retn/impl/Field21Generate.java
+7
-5
Field52AGenerate.java
...illiance/swift/mx2mt/mt202Retn/impl/Field52AGenerate.java
+8
-0
Field58AGenerate.java
...illiance/swift/mx2mt/mt202Retn/impl/Field58AGenerate.java
+8
-0
Field72Generate.java
...rilliance/swift/mx2mt/mt202Retn/impl/Field72Generate.java
+5
-2
Field21Generate.java
...lliance/swift/mx2mt/mt202cov202/impl/Field21Generate.java
+7
-5
Field52AGenerate.java
...liance/swift/mx2mt/mt202cov202/impl/Field52AGenerate.java
+3
-0
Field58AGenerate.java
...liance/swift/mx2mt/mt202cov202/impl/Field58AGenerate.java
+59
-0
Field72Generate.java
...lliance/swift/mx2mt/mt202cov202/impl/Field72Generate.java
+3
-0
Field50AGenerate.java
...ce/swift/mx2mt/mt202cov202/impl/cov/Field50AGenerate.java
+4
-0
Field52AGenerate.java
...ce/swift/mx2mt/mt202cov202/impl/cov/Field52AGenerate.java
+3
-0
Field56AGenerate.java
...ce/swift/mx2mt/mt202cov202/impl/cov/Field56AGenerate.java
+3
-0
Field57AGenerate.java
...ce/swift/mx2mt/mt202cov202/impl/cov/Field57AGenerate.java
+3
-0
Field59AGenerate.java
...ce/swift/mx2mt/mt202cov202/impl/cov/Field59AGenerate.java
+4
-0
Field70Generate.java
...nce/swift/mx2mt/mt202cov202/impl/cov/Field70Generate.java
+49
-10
Field72Generate.java
...nce/swift/mx2mt/mt202cov202/impl/cov/Field72Generate.java
+3
-0
Field12Generate.java
...om/brilliance/swift/mx2mt/mt920/impl/Field12Generate.java
+2
-2
Field20Generate.java
...om/brilliance/swift/mx2mt/mt920/impl/Field20Generate.java
+9
-0
Mx2MtN99Creator.java
...ava/com/brilliance/swift/mx2mt/mtn99/Mx2MtN99Creator.java
+4
-4
Field79Generate.java
...om/brilliance/swift/mx2mt/mtn99/impl/Field79Generate.java
+14
-14
Test.java
...e/src/test/java/com/brilliance/mx2mt/mt103/retn/Test.java
+23
-2
TestMx2MtFor202.java
...test/java/com/brilliance/mx2mt/mt202/TestMx2MtFor202.java
+23
-2
TestMx2MtFor202COV.java
...t/java/com/brilliance/mx2mt/mt202/TestMx2MtFor202COV.java
+23
-2
Test.java
...e/src/test/java/com/brilliance/mx2mt/mt202/retn/Test.java
+23
-2
No files found.
swiftCore/src/main/java/com/brilliance/swift/mx2mt/AbstractMx2MtTagsGenerate.java
View file @
8e808049
...
...
@@ -2048,8 +2048,13 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate {
}
}
protected
String
subFunctionIDTruncation
(
String
mxId
)
{
protected
String
subFunctionIDTruncation
(
String
mxId
,
boolean
isInstructionId
)
{
if
(
StringUtil
.
isEmpty
(
mxId
))
{
if
(
isInstructionId
)
{
buildSTErrorInfo
(
ERROR
.
T20072
,
null
,
null
);
}
else
{
buildSTErrorInfo
(
ERROR
.
T20073
,
null
,
null
);
}
return
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
;
}
if
(
mxId
.
length
()
>
16
)
{
...
...
@@ -2058,6 +2063,11 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate {
}
String
mtId
=
mxId
;
if
(
mtId
.
startsWith
(
"/"
)
||
mtId
.
endsWith
(
"/"
)
||
mtId
.
contains
(
"//"
))
{
if
(
isInstructionId
)
{
buildSTErrorInfo
(
ERROR
.
T20095
,
null
,
null
);
}
else
{
buildSTErrorInfo
(
ERROR
.
T20035
,
null
,
null
);
}
mtId
=
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
;
}
return
mtId
;
...
...
@@ -2066,6 +2076,7 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate {
protected
String
subFunctionChargeCalculation
(
String
chargesInfoPath
)
{
BigDecimal
totalAmt
=
BigDecimal
.
ZERO
;
String
ccy
=
""
;
boolean
errorFlag
=
false
;
int
chrgsInfCount
=
XmlUtil
.
getChildrenCount
(
document
,
chargesInfoPath
,
null
);
if
(
chrgsInfCount
>
0
)
{
ccy
=
XmlUtil
.
getXmlNodeValue
(
document
,
chargesInfoPath
+
"(0).Amt@Ccy"
);
...
...
@@ -2076,11 +2087,15 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate {
if
(
ccy
.
equals
(
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"TxInf.ChrgsInf("
+
i
+
").Amt@Ccy"
)))
{
BigDecimal
tmpAmt
=
new
BigDecimal
(
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"TxInf.ChrgsInf("
+
i
+
").Amt"
));
totalAmt
=
totalAmt
.
add
(
tmpAmt
);
}
else
{
errorFlag
=
true
;
buildSTErrorInfo
(
ERROR
.
T22003
,
null
,
null
);
break
;
}
}
}
}
if
(
totalAmt
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
if
(
totalAmt
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
&&
!
errorFlag
)
{
return
"/CHGS/"
+
ccy
+
NumberUtil
.
formatAmt
(
totalAmt
,
ccy
);
}
else
{
return
null
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/Mx2MtCreatorManager.java
View file @
8e808049
...
...
@@ -122,11 +122,11 @@ public class Mx2MtCreatorManager {
String
grpParentElementName
=
parentElementMaps
.
get
(
"OrgnlGrpInf"
);
String
orgMessageNameId
=
XmlUtil
.
getXmlNodeValue
(
document
,
grpParentElementName
+
"OrgnlGrpInf.OrgnlMsgNmId"
);
if
(
StringUtil
.
isNotEmpty
(
orgMessageNameId
))
{
if
(
orgMessageNameId
.
startsWith
(
"pacs.008"
)
||
orgMessageNameId
.
startsWith
(
"MT103"
))
{
if
(
orgMessageNameId
.
indexOf
(
"pacs.008"
)
>
-
1
||
orgMessageNameId
.
startsWith
(
"MT103"
))
{
messageType
+=
".MT103"
;
}
else
if
(
orgMessageNameId
.
startsWith
(
"pacs.009"
)
||
orgMessageNameId
.
startsWith
(
"MT202"
))
{
}
else
if
(
orgMessageNameId
.
indexOf
(
"pacs.009"
)
>
-
1
||
orgMessageNameId
.
startsWith
(
"MT202"
))
{
messageType
+=
".MT202"
;
}
else
if
(
orgMessageNameId
.
startsWith
(
"pacs.009"
)
||
orgMessageNameId
.
startsWith
(
"MT205"
))
{
}
else
if
(
orgMessageNameId
.
indexOf
(
"pacs.009"
)
>
-
1
||
orgMessageNameId
.
startsWith
(
"MT205"
))
{
messageType
+=
".MT205"
;
}
}
else
{
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103/impl/Field20Generate.java
View file @
8e808049
package
com
.
brilliance
.
swift
.
mx2mt
.
mt103
.
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
;
import
com.brilliance.swift.util.StringUtil
;
...
...
@@ -30,6 +31,10 @@ public class Field20Generate extends AbstractMx2MtTagsGenerate {
messageId
=
getXmlNodeValue
(
appHdrParentElementName
,
document
,
"AppHdr.BizMsgIdr"
);
}
if
(
StringUtil
.
isNotEmpty
(
messageId
))
{
if
(
messageId
.
startsWith
(
"/"
)
||
messageId
.
endsWith
(
"/"
)
||
messageId
.
contains
(
"//"
))
{
buildSTErrorInfo
(
ERROR
.
T20051
,
"Block4/:20:"
,
messageId
);
messageId
=
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
;
}
if
(
messageId
.
length
()
>
16
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"Block4/:20:"
,
messageId
);
messageId
=
messageId
.
substring
(
0
,
15
)
+
"+"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103Retn/Mx2Mt103RetnCreator.java
View file @
8e808049
package
com
.
brilliance
.
swift
.
mx2mt
.
mt103Retn
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtCreator
;
...
...
@@ -29,6 +30,11 @@ public class Mx2Mt103RetnCreator extends AbstractMx2MtCreator {
context
.
set
(
Mx2MtContextIdentifier
.
APPHDR_PARENT_ELEMENT_NAME
,
parentElementMaps
.
get
(
"AppHdr"
));
context
.
set
(
Mx2MtContextIdentifier
.
GRPHDR_PARENT_ELEMENT_NAME
,
parentElementMaps
.
get
(
"GrpHdr"
));
context
.
set
(
Mx2MtContextIdentifier
.
BODY_PARENT_ELEMENT_NAME
,
parentElementMaps
.
get
(
"TxInf"
));
String
bodyParentPath
=
parentElementMaps
.
get
(
"TxInf"
);
int
counts
=
getXmlNodeCounts
(
bodyParentPath
,
document
,
"TxInf"
);
if
(
counts
>
1
)
{
buildSTErrorInfo
(
ERROR
.
T20053
,
bodyParentPath
+
".TxInf"
,
null
);
}
}
@Override
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103Retn/impl/Field20Generate.java
View file @
8e808049
package
com
.
brilliance
.
swift
.
mx2mt
.
mt103Retn
.
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
;
...
...
@@ -22,14 +23,15 @@ public class Field20Generate extends AbstractMx2MtTagsGenerate {
messageId
=
getXmlNodeValue
(
appHdrParentElementName
,
document
,
"AppHdr.BizMsgIdr"
);
}
if
(
StringUtil
.
isNotEmpty
(
messageId
))
{
if
(
messageId
.
startsWith
(
"/"
)
||
messageId
.
endsWith
(
"/"
)
||
messageId
.
contains
(
"//"
))
{
buildSTErrorInfo
(
ERROR
.
T20051
,
"Block4/:20:"
,
messageId
);
messageId
=
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
;
}
if
(
messageId
.
length
()
>
16
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"Block4/:20:"
,
messageId
);
messageId
=
messageId
.
substring
(
0
,
15
)
+
"+"
;
}
String
value
=
messageId
;
if
(
value
.
startsWith
(
"/"
)
||
value
.
endsWith
(
"/"
)
||
value
.
contains
(
"//"
))
{
value
=
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
;
}
tags
.
add
(
new
Tag
(
name
,
value
));
tags
.
add
(
new
Tag
(
name
,
messageId
));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103Retn/impl/Field32AGenerate.java
View file @
8e808049
package
com
.
brilliance
.
swift
.
mx2mt
.
mt103Retn
.
impl
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.util.DateUtil
;
...
...
@@ -33,6 +34,10 @@ public class Field32AGenerate extends AbstractMx2MtTagsGenerate {
}
String
amt
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"TxInf.RtrdIntrBkSttlmAmt"
);
String
ccy
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"TxInf.RtrdIntrBkSttlmAmt@Ccy"
);
if
(
"XAU"
.
equalsIgnoreCase
(
ccy
)
||
"XAG"
.
equalsIgnoreCase
(
ccy
)
||
"XPD"
.
equalsIgnoreCase
(
ccy
)
||
"XPT"
.
equalsIgnoreCase
(
ccy
))
{
buildSTErrorInfo
(
ERROR
.
T20054
,
bodyHdrParentElementName
+
".TxInf.RtrdIntrBkSttlmAmt"
,
null
);
}
if
(
StringUtil
.
isNotEmpty
(
amt
)
&&
StringUtil
.
isNotEmpty
(
ccy
))
{
intrBkSttlmAmt
=
NumberUtil
.
formatAmt
(
new
BigDecimal
(
amt
),
ccy
);
intrBkSttlmccy
=
ccy
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103Retn/impl/Field33BGenerate.java
View file @
8e808049
package
com
.
brilliance
.
swift
.
mx2mt
.
mt103Retn
.
impl
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
...
...
@@ -32,6 +33,7 @@ public class Field33BGenerate extends AbstractMx2MtTagsGenerate {
amt
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"TxInf.RtrdIntrBkSttlmAmt"
);
ccy
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"TxInf.RtrdIntrBkSttlmAmt@Ccy"
);
if
(
StringUtil
.
isNotEmpty
(
amt
)
&&
StringUtil
.
isNotEmpty
(
ccy
))
{
buildSTErrorInfo
(
ERROR
.
T20025
,
"Block4/:"
+
name
+
":"
,
null
);
tags
.
add
(
new
Tag
(
name
,
ccy
+
NumberUtil
.
formatAmt
(
new
BigDecimal
(
amt
),
ccy
)));
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103Retn/impl/Field50AGenerate.java
View file @
8e808049
package
com
.
brilliance
.
swift
.
mx2mt
.
mt103Retn
.
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
;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -22,6 +24,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
();
String
value
=
""
;
...
...
@@ -36,12 +39,16 @@ public class Field50AGenerate extends AbstractMx2MtTagsGenerate {
tags
.
add
(
new
Tag
(
name_A
,
value
));
}
else
if
(
StringUtil
.
isNotEmpty
(
countryCode
))
{
value
=
mx_to_mtFinancialInstitutionNameAndStructuredAddress
(
agtPath
+
".FinInstnId"
,
false
);
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/:50k:"
);
tags
.
add
(
new
Tag
(
name_K
,
value
));
}
else
if
(
addressLineCount
>
0
||
StringUtil
.
isNotEmpty
(
agtName
))
{
value
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
agtPath
+
".FinInstnId"
);
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/:50k:"
);
tags
.
add
(
new
Tag
(
name_K
,
value
));
}
else
if
(
StringUtil
.
isNotEmpty
(
clearingMemberId
))
{
buildSTErrorInfo
(
ERROR
.
T20097
,
"Block4/:50k:"
,
null
);
value
=
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
+
Mx2MtConstants
.
NEW_LINE
+
mx_to_mtClearingIdentifier
(
agtPath
);
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/:50k:"
);
tags
.
add
(
new
Tag
(
name_K
,
value
));
}
if
(
StringUtil
.
isEmpty
(
value
))
{
...
...
@@ -78,10 +85,12 @@ public class Field50AGenerate extends AbstractMx2MtTagsGenerate {
tags
.
add
(
new
Tag
(
name_F
,
value
));
}
else
{
String
mtNameAddress
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
partyPath
);
mtNameAddress
=
mx_to_mtStartingLineCharacter
(
mtNameAddress
,
"Block4/:50k:"
);
tags
.
add
(
new
Tag
(
name_K
,
mtNameAddress
));
}
}
else
if
(
StringUtil
.
isNotEmpty
(
name
))
{
String
mtNameAddress
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
partyPath
);
mtNameAddress
=
mx_to_mtStartingLineCharacter
(
mtNameAddress
,
"Block4/:50k:"
);
tags
.
add
(
new
Tag
(
name_K
,
mtNameAddress
));
}
else
{
tags
.
add
(
new
Tag
(
name_K
,
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
));
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103Retn/impl/Field52AGenerate.java
View file @
8e808049
...
...
@@ -3,6 +3,7 @@ package com.brilliance.swift.mx2mt.mt103Retn.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.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -21,6 +22,7 @@ public class Field52AGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/52a"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
bicCode
=
mx_to_mtBICFI
(
bodyHdrParentElementName
+
".TxInf.RtrChain.DbtrAgt"
);
...
...
@@ -51,6 +53,7 @@ public class Field52AGenerate extends AbstractMx2MtTagsGenerate {
}
else
{
value
=
mtNameAddress
;
}
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/:52D:"
);
tags
.
add
(
new
Tag
(
name_D
,
value
));
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103Retn/impl/Field53AGenerate.java
View file @
8e808049
...
...
@@ -2,6 +2,7 @@ package com.brilliance.swift.mx2mt.mt103Retn.impl;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -18,6 +19,7 @@ public class Field53AGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/53a"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
settlementMethod
=
getXmlNodeValue
(
grpHdrParentElementName
,
document
,
"GrpHdr.SttlmInf.SttlmMtd"
);
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103Retn/impl/Field56AGenerate.java
View file @
8e808049
...
...
@@ -3,6 +3,7 @@ package com.brilliance.swift.mx2mt.mt103Retn.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.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -21,6 +22,7 @@ public class Field56AGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/56a"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
bicCode
=
mx_to_mtBICFI
(
bodyHdrParentElementName
+
".TxInf.RtrChain.IntrmyAgt1"
);
...
...
@@ -51,6 +53,7 @@ public class Field56AGenerate extends AbstractMx2MtTagsGenerate {
}
else
{
value
=
mtNameAddress
;
}
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/:56D:"
);
tags
.
add
(
new
Tag
(
name_D
,
value
));
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103Retn/impl/Field57AGenerate.java
View file @
8e808049
...
...
@@ -3,6 +3,7 @@ package com.brilliance.swift.mx2mt.mt103Retn.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.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -21,6 +22,7 @@ public class Field57AGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/57a"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
bicCode
=
mx_to_mtBICFI
(
bodyHdrParentElementName
+
".TxInf.RtrChain.CdtrAgt"
);
...
...
@@ -45,13 +47,41 @@ public class Field57AGenerate extends AbstractMx2MtTagsGenerate {
}
else
if
(
StringUtil
.
isNotEmpty
(
name
))
{
mtNameAddress
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
bodyHdrParentElementName
+
".TxInf.RtrChain.CdtrAgt.FinInstnId"
);
}
//mapping转换文档 Translation Post Conditions -> POSTC004
boolean
exist56aFlag
=
exist56a
(
tags
);
if
(
StringUtil
.
isEmpty
(
mtNameAddress
)
&&
exist56aFlag
)
{
mtNameAddress
=
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
;
if
(
StringUtil
.
isEmpty
(
mtClearSystemId
))
{
mtClearSystemId
=
"/"
+
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
;
}
}
if
(
StringUtil
.
isEmpty
(
mtNameAddress
))
return
;
//如果name和地址不存在,返回。
if
(
StringUtil
.
isNotEmpty
(
mtClearSystemId
))
{
value
=
mtClearSystemId
+
Mx2MtConstants
.
NEW_LINE
+
mtNameAddress
;
}
else
{
value
=
mtNameAddress
;
}
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/:57D:"
);
tags
.
add
(
new
Tag
(
name_D
,
value
));
}
}
/**
* 56a 是否存在
* @param tags
* @return
*/
private
boolean
exist56a
(
List
<
Tag
>
tags
)
{
boolean
flag
=
false
;
if
(
tags
!=
null
&&
tags
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
tags
.
size
();
i
++)
{
Tag
tag
=
tags
.
get
(
i
);
if
(
"56A"
.
equals
(
tag
.
getName
())
||
"56D"
.
equals
(
tag
.
getName
()))
{
flag
=
true
;
break
;
}
}
}
return
flag
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103Retn/impl/Field59Generate.java
View file @
8e808049
package
com
.
brilliance
.
swift
.
mx2mt
.
mt103Retn
.
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
;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -28,6 +30,7 @@ public class Field59Generate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/59a"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
agtPath
=
bodyHdrParentElementName
+
"TxInf.RtrChain.Cdtr.Agt"
;
...
...
@@ -42,12 +45,16 @@ public class Field59Generate extends AbstractMx2MtTagsGenerate {
tags
.
add
(
new
Tag
(
name_A
,
value
));
}
else
if
(
StringUtil
.
isNotEmpty
(
countryCode
))
{
value
=
mx_to_mtFinancialInstitutionNameAndStructuredAddress
(
agtPath
+
".FinInstnId"
,
false
);
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/:59:"
);
tags
.
add
(
new
Tag
(
name
,
value
));
}
else
if
(
addressLineCount
>
0
||
StringUtil
.
isNotEmpty
(
agtName
))
{
value
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
agtPath
+
".FinInstnId"
);
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/:59:"
);
tags
.
add
(
new
Tag
(
name
,
value
));
}
else
if
(
StringUtil
.
isNotEmpty
(
clearingMemberId
))
{
buildSTErrorInfo
(
ERROR
.
T20098
,
"Block4/:59:"
,
null
);
value
=
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
+
Mx2MtConstants
.
NEW_LINE
+
mx_to_mtClearingIdentifier
(
agtPath
);
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/:59:"
);
tags
.
add
(
new
Tag
(
name
,
value
));
}
if
(
StringUtil
.
isEmpty
(
value
))
{
...
...
@@ -68,10 +75,12 @@ public class Field59Generate extends AbstractMx2MtTagsGenerate {
tags
.
add
(
new
Tag
(
name_F
,
nameAddress
));
}
else
{
String
nameAddress
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
partyPath
);
nameAddress
=
mx_to_mtStartingLineCharacter
(
nameAddress
,
"Block4/:59:"
);
tags
.
add
(
new
Tag
(
name
,
nameAddress
));
}
}
else
if
(
StringUtil
.
isNotEmpty
(
partyName
)){
String
nameAddress
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
partyPath
);
nameAddress
=
mx_to_mtStartingLineCharacter
(
nameAddress
,
"Block4/:59:"
);
tags
.
add
(
new
Tag
(
name
,
nameAddress
));
}
else
{
tags
.
add
(
new
Tag
(
name
,
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
));
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103Retn/impl/Field70Generate.java
View file @
8e808049
package
com
.
brilliance
.
swift
.
mx2mt
.
mt103Retn
.
impl
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -22,31 +24,57 @@ public class Field70Generate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/:70:"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
mt70FullString
=
""
;
String
mtUltimateCreditor
=
mx_to_mtUltimateParty
(
bodyHdrParentElementName
+
".TxInf.RtrChain.UltmtCdtr"
);
if
(
StringUtil
.
isNotEmpty
(
mtUltimateCreditor
))
{
String
str
=
"/ULTB/"
+
mtUltimateCreditor
;
if
(
str
.
length
()
>
140
)
str
=
str
.
substring
(
0
,
139
)
+
"+"
;
if
(
StringUtil
.
isEmpty
(
mt70FullString
))
{
mt70FullString
+=
str
;
int
remainLength
=
140
-
mt70FullString
.
length
()
-
6
;
if
(
remainLength
>
0
)
{
if
(
mtUltimateCreditor
.
length
()
>
remainLength
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"Block4/:70:/ULTB/"
,
mtUltimateCreditor
);
mtUltimateCreditor
=
mtUltimateCreditor
.
substring
(
0
,
remainLength
-
1
)
+
"+"
;
}
mt70FullString
+=
"/ULTB/"
+
mtUltimateCreditor
;
}
}
else
{
mt70FullString
+=
"//"
+
str
;
int
remainLength
=
140
-
mt70FullString
.
length
()
-
8
;
if
(
remainLength
>
0
)
{
if
(
mtUltimateCreditor
.
length
()
>
remainLength
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"Block4/:70:///ULTB/"
,
mtUltimateCreditor
);
mtUltimateCreditor
=
mtUltimateCreditor
.
substring
(
0
,
remainLength
-
1
)
+
"+"
;
}
mt70FullString
+=
"///ULTB/"
+
mtUltimateCreditor
;
}
}
}
String
mtUltimateDebtor
=
mx_to_mtUltimateParty
(
bodyHdrParentElementName
+
".TxInf.RtrChain.UltmtDbtr"
);
if
(
StringUtil
.
isNotEmpty
(
mtUltimateDebtor
))
{
String
str
=
"/ULTD/"
+
mtUltimateDebtor
;
if
(
str
.
length
()
>
140
)
str
=
str
.
substring
(
0
,
139
)
+
"+"
;
if
(
StringUtil
.
isEmpty
(
mt70FullString
))
{
mt70FullString
+=
str
;
int
remainLength
=
140
-
mt70FullString
.
length
()
-
6
;
if
(
remainLength
>
0
)
{
if
(
mtUltimateDebtor
.
length
()
>
remainLength
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"Block4/:70:/ULTD/"
,
mtUltimateDebtor
);
mtUltimateDebtor
=
mtUltimateDebtor
.
substring
(
0
,
remainLength
-
1
)
+
"+"
;
}
mt70FullString
+=
"/ULTD/"
+
mtUltimateDebtor
;
}
}
else
{
mt70FullString
+=
"//"
+
str
;
int
remainLength
=
140
-
mt70FullString
.
length
()
-
8
;
if
(
remainLength
>
0
)
{
if
(
mtUltimateDebtor
.
length
()
>
remainLength
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"Block4/:70:///ULTD/"
,
mtUltimateDebtor
);
mtUltimateDebtor
=
mtUltimateDebtor
.
substring
(
0
,
remainLength
-
1
)
+
"+"
;
}
mt70FullString
+=
"///ULTD/"
+
mtUltimateDebtor
;
}
}
}
if
(
StringUtil
.
isNotEmpty
(
mt70FullString
))
{
String
value
=
StringUtil
.
getStringByEnter
(
mt70FullString
,
35
,
4
);
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/:70:"
);
tags
.
add
(
new
Tag
(
name
,
value
));
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103Retn/impl/Field71AGenerate.java
View file @
8e808049
package
com
.
brilliance
.
swift
.
mx2mt
.
mt103Retn
.
impl
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.util.NumberUtil
;
...
...
@@ -56,10 +57,18 @@ public class Field71AGenerate extends AbstractMx2MtTagsGenerate {
if
(
ccy
.
equals
(
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"TxInf.ChrgsInf("
+
i
+
").Amt@Ccy"
)))
{
BigDecimal
tmpAmt
=
new
BigDecimal
(
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"TxInf.ChrgsInf("
+
i
+
").Amt"
));
sumAmt
=
sumAmt
.
add
(
tmpAmt
);
}
else
{
buildSTErrorInfo
(
ERROR
.
T20045
,
"block4/:"
+
name_G
+
":"
,
null
);
}
}
}
tags
.
add
(
new
Tag
(
name_G
,
ccy
+
NumberUtil
.
formatAmt
(
sumAmt
,
ccy
)));
//mapping转换文档 Translation Post Conditions -> POSTC003
String
intrBkSttlmAmtCcy
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.IntrBkSttlmAmt@Ccy"
);
if
(
ccy
.
equals
(
intrBkSttlmAmtCcy
))
{
tags
.
add
(
new
Tag
(
name_G
,
ccy
+
NumberUtil
.
formatAmt
(
sumAmt
,
ccy
)));
}
else
{
buildSTErrorInfo
(
ERROR
.
T20042
,
"Block4/:"
+
name_G
+
":"
,
null
);
}
}
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103Retn/impl/Field72Generate.java
View file @
8e808049
...
...
@@ -3,6 +3,7 @@ package com.brilliance.swift.mx2mt.mt103Retn.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.StringUtil
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.vo.MxMtReasonCodeInfo
;
...
...
@@ -33,6 +34,7 @@ public class Field72Generate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/:72:"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
List
<
String
>
mt72List
=
new
ArrayList
<>();
...
...
@@ -94,11 +96,11 @@ public class Field72Generate extends AbstractMx2MtTagsGenerate {
mt72List
.
add
(
mtLine2
);
}
String
orgInstructionId
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"TxInf.OrgnlInstrId"
);
String
mtLine3
=
"/MREF/"
+
subFunctionIDTruncation
(
orgInstructionId
);
String
mtLine3
=
"/MREF/"
+
subFunctionIDTruncation
(
orgInstructionId
,
true
);
mt72List
.
add
(
mtLine3
);
String
orgEndToEndId
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"TxInf.OrgnlEndToEndId"
);
if
(
StringUtil
.
isNotEmpty
(
orgEndToEndId
))
{
String
mtLine4
=
"/TREF/"
+
subFunctionIDTruncation
(
orgEndToEndId
);
String
mtLine4
=
"/TREF/"
+
subFunctionIDTruncation
(
orgEndToEndId
,
false
);
mt72List
.
add
(
mtLine4
);
}
//没有mtLine5
...
...
@@ -121,6 +123,7 @@ public class Field72Generate extends AbstractMx2MtTagsGenerate {
value
+=
Mx2MtConstants
.
NEW_LINE
+
list
.
get
(
i
);
}
}
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/:72:"
);
tags
.
add
(
new
Tag
(
name
,
value
));
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103Retn/impl/Field77BGenerate.java
View file @
8e808049
...
...
@@ -49,6 +49,7 @@ public class Field77BGenerate extends AbstractMx2MtTagsGenerate {
}
}
if
(
StringUtil
.
isNotEmpty
(
value
))
{
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/:77B:"
);
tags
.
add
(
new
Tag
(
name
,
value
));
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202Retn/Mx2Mt202RetnCreator.java
View file @
8e808049
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202Retn
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtCreator
;
...
...
@@ -29,6 +30,11 @@ public class Mx2Mt202RetnCreator extends AbstractMx2MtCreator {
context
.
set
(
Mx2MtContextIdentifier
.
APPHDR_PARENT_ELEMENT_NAME
,
parentElementMaps
.
get
(
"AppHdr"
));
context
.
set
(
Mx2MtContextIdentifier
.
GRPHDR_PARENT_ELEMENT_NAME
,
parentElementMaps
.
get
(
"GrpHdr"
));
context
.
set
(
Mx2MtContextIdentifier
.
BODY_PARENT_ELEMENT_NAME
,
parentElementMaps
.
get
(
"TxInf"
));
String
bodyParentPath
=
parentElementMaps
.
get
(
"TxInf"
);
int
counts
=
getXmlNodeCounts
(
bodyParentPath
,
document
,
"TxInf"
);
if
(
counts
>
1
)
{
buildSTErrorInfo
(
ERROR
.
T20053
,
bodyParentPath
+
".TxInf"
,
null
);
}
}
@Override
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202Retn/impl/Field21Generate.java
View file @
8e808049
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202Retn
.
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
;
...
...
@@ -25,14 +26,15 @@ public class Field21Generate extends AbstractMx2MtTagsGenerate {
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
endToEndId
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"TxInf.OrgnlEndToEndId"
);
if
(
StringUtil
.
isNotEmpty
(
endToEndId
))
{
if
(
endToEndId
.
startsWith
(
"/"
)
||
endToEndId
.
endsWith
(
"/"
)
||
endToEndId
.
contains
(
"//"
))
{
buildSTErrorInfo
(
ERROR
.
T20035
,
"Block4/:21:"
,
endToEndId
);
endToEndId
=
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
;
}
if
(
endToEndId
.
length
()
>
16
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"Block4/:21:"
,
endToEndId
);
endToEndId
=
endToEndId
.
substring
(
0
,
15
)
+
"+"
;
}
String
value
=
endToEndId
;
if
(
value
.
startsWith
(
"/"
)
||
value
.
endsWith
(
"/"
)
||
value
.
contains
(
"//"
))
{
value
=
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
;
}
tags
.
add
(
new
Tag
(
name
,
value
));
tags
.
add
(
new
Tag
(
name
,
endToEndId
));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202Retn/impl/Field52AGenerate.java
View file @
8e808049
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202Retn
.
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
;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -21,8 +23,13 @@ public class Field52AGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/52a"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
int
dbtrPartyCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"TxInf.RtrChain.Dbtr.Pty"
);
if
(
dbtrPartyCount
>
0
)
{
buildSTErrorInfo
(
ERROR
.
T20048
,
null
,
null
);
}
String
agtPath
=
bodyHdrParentElementName
+
".TxInf.RtrChain.Dbtr.Agt"
;
String
bicCode
=
mx_to_mtBICFI
(
agtPath
);
String
mtClearSystemId
=
mx_to_mtClearingIdentifier
(
agtPath
);
...
...
@@ -52,6 +59,7 @@ public class Field52AGenerate extends AbstractMx2MtTagsGenerate {
}
else
{
value
=
mtNameAddress
;
}
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/:52D:"
);
tags
.
add
(
new
Tag
(
name_D
,
value
));
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202Retn/impl/Field58AGenerate.java
View file @
8e808049
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202Retn
.
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
;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -20,8 +22,13 @@ public class Field58AGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/58a"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
int
cdtrPartyCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"TxInf.RtrChain.Cdtr.Pty"
);
if
(
cdtrPartyCount
>
0
)
{
buildSTErrorInfo
(
ERROR
.
T20049
,
null
,
null
);
}
String
agtPath
=
bodyHdrParentElementName
+
".TxInf.RtrChain.Cdtr.Agt"
;
String
bicCode
=
mx_to_mtBICFI
(
agtPath
);
String
mtClearSystemId
=
mx_to_mtClearingIdentifier
(
agtPath
);
...
...
@@ -51,6 +58,7 @@ public class Field58AGenerate extends AbstractMx2MtTagsGenerate {
}
else
{
value
=
mtNameAddress
;
}
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/:58D:"
);
tags
.
add
(
new
Tag
(
name_D
,
value
));
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202Retn/impl/Field72Generate.java
View file @
8e808049
...
...
@@ -3,6 +3,7 @@ package com.brilliance.swift.mx2mt.mt202Retn.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.StringUtil
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.vo.MxMtReasonCodeInfo
;
...
...
@@ -33,6 +34,7 @@ public class Field72Generate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/:72:"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
List
<
String
>
mt72List
=
new
ArrayList
<>();
...
...
@@ -94,11 +96,11 @@ public class Field72Generate extends AbstractMx2MtTagsGenerate {
mt72List
.
add
(
mtLine2
);
}
String
orgInstructionId
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"TxInf.OrgnlInstrId"
);
String
mtLine3
=
"/MREF/"
+
subFunctionIDTruncation
(
orgInstructionId
);
String
mtLine3
=
"/MREF/"
+
subFunctionIDTruncation
(
orgInstructionId
,
true
);
mt72List
.
add
(
mtLine3
);
String
orgEndToEndId
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"TxInf.OrgnlEndToEndId"
);
if
(
StringUtil
.
isNotEmpty
(
orgEndToEndId
))
{
String
mtLine4
=
"/TREF/"
+
subFunctionIDTruncation
(
orgEndToEndId
);
String
mtLine4
=
"/TREF/"
+
subFunctionIDTruncation
(
orgEndToEndId
,
false
);
mt72List
.
add
(
mtLine4
);
}
String
mtLine5
=
subFunctionChargeCalculation
(
bodyHdrParentElementName
+
".TxInf.ChrgsInf"
);
...
...
@@ -124,6 +126,7 @@ public class Field72Generate extends AbstractMx2MtTagsGenerate {
value
+=
Mx2MtConstants
.
NEW_LINE
+
list
.
get
(
i
);
}
}
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/:72:"
);
tags
.
add
(
new
Tag
(
name
,
value
));
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/Field21Generate.java
View file @
8e808049
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
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
;
...
...
@@ -25,14 +26,15 @@ public class Field21Generate extends AbstractMx2MtTagsGenerate {
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
endToEndId
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.PmtId.EndToEndId"
);
if
(
StringUtil
.
isNotEmpty
(
endToEndId
))
{
if
(
endToEndId
.
startsWith
(
"/"
)
||
endToEndId
.
endsWith
(
"/"
)
||
endToEndId
.
contains
(
"//"
))
{
buildSTErrorInfo
(
ERROR
.
T20035
,
"Block4/:21:"
,
endToEndId
);
endToEndId
=
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
;
}
if
(
endToEndId
.
length
()
>
16
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"Block4/:21:"
,
endToEndId
);
endToEndId
=
endToEndId
.
substring
(
0
,
15
)
+
"+"
;
}
String
value
=
endToEndId
;
if
(
value
.
startsWith
(
"/"
)
||
value
.
endsWith
(
"/"
)
||
value
.
contains
(
"//"
))
{
value
=
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
;
}
tags
.
add
(
new
Tag
(
name
,
value
));
tags
.
add
(
new
Tag
(
name
,
endToEndId
));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/Field52AGenerate.java
View file @
8e808049
...
...
@@ -4,6 +4,7 @@ package com.brilliance.swift.mx2mt.mt202cov202.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.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -21,6 +22,7 @@ public class Field52AGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/52a"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
bicCode
=
mx_to_mtBICFI
(
bodyHdrParentElementName
+
".CdtTrfTxInf.Dbtr"
);
...
...
@@ -63,6 +65,7 @@ public class Field52AGenerate extends AbstractMx2MtTagsGenerate {
}
else
{
value
=
mtNameAddress
;
}
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/:52D:"
);
tags
.
add
(
new
Tag
(
name_D
,
value
));
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/Field58AGenerate.java
View file @
8e808049
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
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
;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -20,8 +22,10 @@ public class Field58AGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/58a"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
boolean
flag
=
exist56a57aStartWithFWRT
(
tags
);
String
bicCode
=
mx_to_mtBICFI
(
bodyHdrParentElementName
+
".CdtTrfTxInf.Cdtr"
);
String
account
=
mx_to_mtAccount
(
bodyHdrParentElementName
+
".CdtTrfTxInf.CdtrAcct"
);
String
mtClearSystemId
=
mx_to_mtClearingIdentifier
(
bodyHdrParentElementName
+
".CdtTrfTxInf.Cdtr"
);
...
...
@@ -36,6 +40,15 @@ public class Field58AGenerate extends AbstractMx2MtTagsGenerate {
}
else
{
mtAccount
=
mtClearSystemId
;
}
//mapping转换文档 Translation Post Conditions -> POSTC004
if
(
flag
&&
StringUtil
.
isNotEmpty
(
mtAccount
)
&&
(
mtAccount
.
startsWith
(
"//FW"
)
||
mtAccount
.
startsWith
(
"//RT"
)))
{
if
(
StringUtil
.
isEmpty
(
mtClearSystemId
)
||
mtClearSystemId
.
startsWith
(
"//FW"
))
{
mtAccount
=
""
;
buildSTErrorInfo
(
ERROR
.
T20224
,
"Block4/:"
+
name_A
+
":"
,
null
);
}
else
{
mtAccount
=
mtClearSystemId
;
}
}
if
(
StringUtil
.
isNotEmpty
(
mtAccount
))
{
value
=
mtAccount
+
Mx2MtConstants
.
NEW_LINE
+
bicCode
;
}
else
{
...
...
@@ -62,14 +75,60 @@ public class Field58AGenerate extends AbstractMx2MtTagsGenerate {
}
else
{
mtAccount
=
account
;
}
//mapping转换文档 Translation Post Conditions -> POSTC004
if
(
flag
&&
StringUtil
.
isNotEmpty
(
mtAccount
)
&&
(
mtAccount
.
startsWith
(
"//FW"
)
||
mtAccount
.
startsWith
(
"//RT"
)))
{
if
(
StringUtil
.
isEmpty
(
mtClearSystemId
)
||
mtClearSystemId
.
startsWith
(
"//FW"
))
{
mtAccount
=
""
;
buildSTErrorInfo
(
ERROR
.
T20224
,
"Block4/:"
+
name_A
+
":"
,
null
);
}
else
{
mtAccount
=
mtClearSystemId
;
}
}
if
(
StringUtil
.
isNotEmpty
(
mtAccount
))
{
value
=
mtAccount
+
Mx2MtConstants
.
NEW_LINE
+
mtNameAddress
;
}
else
{
value
=
mtNameAddress
;
}
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/:58D:"
);
tags
.
add
(
new
Tag
(
name_D
,
value
));
}
}
/**
* 56a 是否以 //FW or //RT 开始
* 否则 57a 是否以 //FW or //RT 开始
* @param tags
* @return
*/
private
boolean
exist56a57aStartWithFWRT
(
List
<
Tag
>
tags
)
{
boolean
flag
=
false
;
if
(
tags
!=
null
&&
tags
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
tags
.
size
();
i
++)
{
Tag
tag
=
tags
.
get
(
i
);
if
(
"56A"
.
equals
(
tag
.
getName
())
||
"56D"
.
equals
(
tag
.
getName
()))
{
String
value
=
tag
.
getValue
();
if
(
value
.
startsWith
(
"//FW"
)
||
value
.
startsWith
(
"//RT"
))
{
flag
=
true
;
break
;
}
}
}
}
if
(!
flag
)
{
if
(
tags
!=
null
&&
tags
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
tags
.
size
();
i
++)
{
Tag
tag
=
tags
.
get
(
i
);
if
(
"57A"
.
equals
(
tag
.
getName
())
||
"57D"
.
equals
(
tag
.
getName
()))
{
String
value
=
tag
.
getValue
();
if
(
value
.
startsWith
(
"//FW"
)
||
value
.
startsWith
(
"//RT"
))
{
flag
=
true
;
break
;
}
}
}
}
}
return
flag
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/Field72Generate.java
View file @
8e808049
...
...
@@ -3,6 +3,7 @@ package com.brilliance.swift.mx2mt.mt202cov202.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.StringUtil
;
import
com.brilliance.swift.vo.common.CategoryPurposeCode
;
import
com.brilliance.swift.vo.common.ServiceLevelCode
;
...
...
@@ -47,6 +48,7 @@ public class Field72Generate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/:72:"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
List
<
String
>
mt72List
=
new
ArrayList
<>();
...
...
@@ -159,6 +161,7 @@ public class Field72Generate extends AbstractMx2MtTagsGenerate {
value
+=
Mx2MtConstants
.
NEW_LINE
+
list
.
get
(
i
);
}
}
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/:72:"
);
tags
.
add
(
new
Tag
(
name
,
value
));
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/Field50AGenerate.java
View file @
8e808049
...
...
@@ -3,6 +3,7 @@ package com.brilliance.swift.mx2mt.mt202cov202.impl.cov;
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.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftBlock3
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
...
...
@@ -22,6 +23,7 @@ public class Field50AGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/SequenceB/50a"
);
boolean
covFlag
=
false
;
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
...
...
@@ -77,6 +79,7 @@ public class Field50AGenerate extends AbstractMx2MtTagsGenerate {
}
else
{
value
=
mtNameAddress
;
}
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/SequenceB/:50K:"
);
tags
.
add
(
new
Tag
(
name_K
,
value
));
covFlag
=
true
;
}
...
...
@@ -87,6 +90,7 @@ public class Field50AGenerate extends AbstractMx2MtTagsGenerate {
}
else
{
value
=
mtNameAddress
;
}
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/SequenceB/:50K:"
);
tags
.
add
(
new
Tag
(
name_K
,
value
));
covFlag
=
true
;
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/Field52AGenerate.java
View file @
8e808049
...
...
@@ -3,6 +3,7 @@ package com.brilliance.swift.mx2mt.mt202cov202.impl.cov;
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.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -17,6 +18,7 @@ public class Field52AGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/SequenceB/52a"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
bicCode
=
mx_to_mtBICFI
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.DbtrAgt"
);
...
...
@@ -59,6 +61,7 @@ public class Field52AGenerate extends AbstractMx2MtTagsGenerate {
}
else
{
value
=
mtNameAddress
;
}
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/SequenceB/:52D:"
);
tags
.
add
(
new
Tag
(
name_D
,
value
));
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/Field56AGenerate.java
View file @
8e808049
...
...
@@ -3,6 +3,7 @@ package com.brilliance.swift.mx2mt.mt202cov202.impl.cov;
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.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -18,6 +19,7 @@ public class Field56AGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/SequenceB/56a"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
bicCode
=
mx_to_mtBICFI
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.IntrmyAgt1"
);
...
...
@@ -60,6 +62,7 @@ public class Field56AGenerate extends AbstractMx2MtTagsGenerate {
}
else
{
value
=
mtNameAddress
;
}
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/SequenceB/:56D:"
);
tags
.
add
(
new
Tag
(
name_D
,
value
));
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/Field57AGenerate.java
View file @
8e808049
...
...
@@ -3,6 +3,7 @@ package com.brilliance.swift.mx2mt.mt202cov202.impl.cov;
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.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -18,6 +19,7 @@ public class Field57AGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/SequenceB/57a"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
bicCode
=
mx_to_mtBICFI
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.CdtrAgt"
);
...
...
@@ -60,6 +62,7 @@ public class Field57AGenerate extends AbstractMx2MtTagsGenerate {
}
else
{
value
=
mtNameAddress
;
}
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/SequenceB/:57D:"
);
tags
.
add
(
new
Tag
(
name_D
,
value
));
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/Field59AGenerate.java
View file @
8e808049
...
...
@@ -3,6 +3,7 @@ package com.brilliance.swift.mx2mt.mt202cov202.impl.cov;
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.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -20,6 +21,7 @@ public class Field59AGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/SequenceB/59a"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
partyPath
=
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.Cdtr"
;
...
...
@@ -62,6 +64,7 @@ public class Field59AGenerate extends AbstractMx2MtTagsGenerate {
}
else
{
value
=
nameAddress
;
}
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/SequenceB/:59:"
);
tags
.
add
(
new
Tag
(
name
,
value
));
}
}
else
if
(
StringUtil
.
isNotEmpty
(
partyName
)){
...
...
@@ -71,6 +74,7 @@ public class Field59AGenerate extends AbstractMx2MtTagsGenerate {
}
else
{
value
=
nameAddress
;
}
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/SequenceB/:59:"
);
tags
.
add
(
new
Tag
(
name
,
value
));
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/Field70Generate.java
View file @
8e808049
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -14,35 +16,71 @@ public class Field70Generate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/SequenceB/:70:"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
mt70FullString
=
""
;
String
mtUltimateCreditor
=
mx_to_mtUltimateParty
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.UltmtCdtr"
);
if
(
StringUtil
.
isNotEmpty
(
mtUltimateCreditor
))
{
String
str
=
"/ULTB/"
+
mtUltimateCreditor
;
if
(
str
.
length
()
>
140
)
str
=
str
.
substring
(
0
,
139
)
+
"+"
;
if
(
StringUtil
.
isEmpty
(
mt70FullString
))
{
mt70FullString
+=
str
;
int
remainLength
=
140
-
mt70FullString
.
length
()
-
6
;
if
(
remainLength
>
0
)
{
if
(
mtUltimateCreditor
.
length
()
>
remainLength
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"Block4/SequenceB/:70:/ULTB/"
,
mtUltimateCreditor
);
mtUltimateCreditor
=
mtUltimateCreditor
.
substring
(
0
,
remainLength
-
1
)
+
"+"
;
}
mt70FullString
+=
"/ULTB/"
+
mtUltimateCreditor
;
}
}
else
{
mt70FullString
+=
"//"
+
str
;
int
remainLength
=
140
-
mt70FullString
.
length
()
-
8
;
if
(
remainLength
>
0
)
{
if
(
mtUltimateCreditor
.
length
()
>
remainLength
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"Block4/SequenceB/:70:///ULTB/"
,
mtUltimateCreditor
);
mtUltimateCreditor
=
mtUltimateCreditor
.
substring
(
0
,
remainLength
-
1
)
+
"+"
;
}
mt70FullString
+=
"///ULTB/"
+
mtUltimateCreditor
;
}
}
}
String
mtUltimateDebtor
=
mx_to_mtUltimateParty
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.UltmtDbtr"
);
if
(
StringUtil
.
isNotEmpty
(
mtUltimateDebtor
))
{
String
str
=
"/ULTD/"
+
mtUltimateDebtor
;
if
(
str
.
length
()
>
140
)
str
=
str
.
substring
(
0
,
139
)
+
"+"
;
if
(
StringUtil
.
isEmpty
(
mt70FullString
))
{
mt70FullString
+=
str
;
int
remainLength
=
140
-
mt70FullString
.
length
()
-
6
;
if
(
remainLength
>
0
)
{
if
(
mtUltimateDebtor
.
length
()
>
remainLength
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"Block4/SequenceB/:70:/ULTD/"
,
mtUltimateDebtor
);
mtUltimateDebtor
=
mtUltimateDebtor
.
substring
(
0
,
remainLength
-
1
)
+
"+"
;
}
mt70FullString
+=
"/ULTD/"
+
mtUltimateDebtor
;
}
}
else
{
mt70FullString
+=
"//"
+
str
;
int
remainLength
=
140
-
mt70FullString
.
length
()
-
8
;
if
(
remainLength
>
0
)
{
if
(
mtUltimateDebtor
.
length
()
>
remainLength
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"Block4/SequenceB/:70:///ULTD/"
,
mtUltimateDebtor
);
mtUltimateDebtor
=
mtUltimateDebtor
.
substring
(
0
,
remainLength
-
1
)
+
"+"
;
}
mt70FullString
+=
"///ULTD/"
+
mtUltimateDebtor
;
}
}
}
String
remittanceInfoUnstructured
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.RmtInf.Ustrd"
);
if
(
StringUtil
.
isNotEmpty
(
remittanceInfoUnstructured
))
{
if
(
StringUtil
.
isEmpty
(
mt70FullString
))
{
mt70FullString
+=
"/URI/"
+
remittanceInfoUnstructured
;
if
(
remittanceInfoUnstructured
.
length
()
>
140
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"Block4/SequenceB/:70:"
,
remittanceInfoUnstructured
);
remittanceInfoUnstructured
=
remittanceInfoUnstructured
.
substring
(
0
,
139
)
+
"+"
;
}
mt70FullString
+=
remittanceInfoUnstructured
;
}
else
{
mt70FullString
+=
"///URI/"
+
remittanceInfoUnstructured
;
int
remainLength
=
140
-
mt70FullString
.
length
()
-
7
;
if
(
remainLength
>
0
)
{
if
(
remittanceInfoUnstructured
.
length
()
>
remainLength
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"Block4/SequenceB/:70:///URI/"
,
remittanceInfoUnstructured
);
remittanceInfoUnstructured
=
remittanceInfoUnstructured
.
substring
(
0
,
remainLength
-
1
)
+
"+"
;
}
mt70FullString
+=
"///URI/"
+
remittanceInfoUnstructured
;
}
}
}
int
remittanceInfoStructuredCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.RmtInf.Strd"
);
...
...
@@ -55,6 +93,7 @@ public class Field70Generate extends AbstractMx2MtTagsGenerate {
}
if
(
StringUtil
.
isNotEmpty
(
mt70FullString
))
{
String
value
=
StringUtil
.
getStringByEnter
(
mt70FullString
,
35
,
4
);
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/SequenceB/:70:"
);
tags
.
add
(
new
Tag
(
name
,
value
));
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/Field72Generate.java
View file @
8e808049
...
...
@@ -3,6 +3,7 @@ package com.brilliance.swift.mx2mt.mt202cov202.impl.cov;
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.StringUtil
;
import
com.brilliance.swift.vo.common.SettlementMethodCode
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
...
...
@@ -17,6 +18,7 @@ public class Field72Generate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/SequenceB/:72:"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
List
<
String
>
mt72List
=
new
ArrayList
<>();
...
...
@@ -62,6 +64,7 @@ public class Field72Generate extends AbstractMx2MtTagsGenerate {
value
+=
Mx2MtConstants
.
NEW_LINE
+
list
.
get
(
i
);
}
}
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/SequenceB/:72:"
);
tags
.
add
(
new
Tag
(
name
,
value
));
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt920/impl/Field12Generate.java
View file @
8e808049
...
...
@@ -27,9 +27,9 @@ public class Field12Generate extends AbstractMx2MtTagsGenerate {
String
msgNameId
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"RptgReq("
+
index
+
").ReqdMsgNmId"
);
if
(
StringUtil
.
isNotEmpty
(
msgNameId
))
{
String
value
=
""
;
if
(
msgNameId
.
startsWith
(
"camt.053"
)
)
{
if
(
msgNameId
.
indexOf
(
"camt.053"
)
>
-
1
)
{
value
=
Mx2MtConstants
.
MT_TYPE_950
;
}
else
if
(
msgNameId
.
startsWith
(
"camt.052"
)
)
{
}
else
if
(
msgNameId
.
indexOf
(
"camt.052"
)
>
-
1
)
{
value
=
Mx2MtConstants
.
MT_TYPE_942
;
}
else
if
(
msgNameId
.
contains
(
Mx2MtConstants
.
MT_TYPE_941
))
{
value
=
Mx2MtConstants
.
MT_TYPE_941
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt920/impl/Field20Generate.java
View file @
8e808049
package
com
.
brilliance
.
swift
.
mx2mt
.
mt920
.
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
;
import
com.brilliance.swift.util.StringUtil
;
...
...
@@ -21,6 +23,13 @@ public class Field20Generate extends AbstractMx2MtTagsGenerate {
messageId
=
getXmlNodeValue
(
appHdrParentElementName
,
document
,
"AppHdr.BizMsgIdr"
);
}
if
(
StringUtil
.
isNotEmpty
(
messageId
))
{
if
(
messageId
.
startsWith
(
"/"
)
||
messageId
.
endsWith
(
"/"
)
||
messageId
.
contains
(
"//"
))
{
buildSTErrorInfo
(
ERROR
.
T20051
,
"Block4/:20:"
,
messageId
);
messageId
=
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
;
}
if
(
messageId
.
length
()
>
16
)
{
messageId
=
messageId
.
substring
(
0
,
15
)
+
"+"
;
}
tags
.
add
(
new
Tag
(
NAME
,
messageId
));
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mtn99/Mx2MtN99Creator.java
View file @
8e808049
...
...
@@ -60,11 +60,11 @@ public class Mx2MtN99Creator extends AbstractMx2MtCreator {
String
orgMsgNameIdentification
=
getXmlNodeValue
(
bodyParentPath
,
document
,
"TxInfAndSts.OrgnlGrpInf.OrgnlMsgNmId"
);
String
mtType
=
Mx2MtConstants
.
MT_TYPE_299
;
if
(
StringUtil
.
isNotEmpty
(
orgMsgNameIdentification
))
{
if
(
orgMsgNameIdentification
.
startsWith
(
"pacs.008"
)
||
orgMsgNameIdentification
.
startsWith
(
"pacs.003"
)
)
{
if
(
orgMsgNameIdentification
.
indexOf
(
"pacs.008"
)
>
-
1
||
orgMsgNameIdentification
.
indexOf
(
"pacs.003"
)
>
-
1
)
{
mtType
=
Mx2MtConstants
.
MT_TYPE_199
;
}
else
if
(
orgMsgNameIdentification
.
startsWith
(
"pacs.009"
)
||
orgMsgNameIdentification
.
startsWith
(
"pacs.010"
)
)
{
}
else
if
(
orgMsgNameIdentification
.
indexOf
(
"pacs.009"
)
>
-
1
||
orgMsgNameIdentification
.
indexOf
(
"pacs.010"
)
>
-
1
)
{
mtType
=
Mx2MtConstants
.
MT_TYPE_299
;
}
else
if
(
orgMsgNameIdentification
.
matches
(
"MT10[0-9]{1}"
))
{
mtType
=
Mx2MtConstants
.
MT_TYPE_199
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mtn99/impl/Field79Generate.java
View file @
8e808049
...
...
@@ -14,13 +14,13 @@ import java.util.List;
public
class
Field79Generate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name
=
"
21
"
;
private
static
String
name
=
"
79
"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
List
<
String
>
mt7
2
List
=
new
ArrayList
<>();
List
<
String
>
mt7
9
List
=
new
ArrayList
<>();
List
<
MxMtReasonCodeInfo
>
mxMtReasonCodeInfos
=
SwiftTransferUtil
.
getMxMtReasonCodes
();
String
mxAddtlInf
=
""
;
int
addtlInfCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"TxInfAndSts.StsRsnInf.AddtlInf"
);
...
...
@@ -38,7 +38,7 @@ public class Field79Generate extends AbstractMx2MtTagsGenerate {
}
}
}
mt7
2
List
.
add
(
"/REJT/99"
);
mt7
9
List
.
add
(
"/REJT/99"
);
String
mtLine2
=
""
;
String
mtLine6
=
""
;
String
mxReasonCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"TxInfAndSts.StsRsnInf.Rsn.Cd"
);
...
...
@@ -54,15 +54,15 @@ public class Field79Generate extends AbstractMx2MtTagsGenerate {
mtLine2
=
mtLine2
.
substring
(
0
,
50
);
}
if
(
StringUtil
.
isNotEmpty
(
mtLine2
))
{
mt7
2
List
.
add
(
mtLine2
);
mt7
9
List
.
add
(
mtLine2
);
}
String
orgMsgId
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"TxInfAndSts.OrgnlGrpInf.OrgnlMsgId"
);
String
mtLine3
=
"/MREF/"
+
subFunctionIDTruncation
(
orgMsgId
);
mt7
2
List
.
add
(
mtLine3
);
String
mtLine3
=
"/MREF/"
+
subFunctionIDTruncation
(
orgMsgId
,
true
);
mt7
9
List
.
add
(
mtLine3
);
String
orgEndToEndId
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"TxInfAndSts.OrgnlEndToEndId"
);
if
(
StringUtil
.
isNotEmpty
(
orgEndToEndId
))
{
String
mtLine4
=
"/TREF/"
+
subFunctionIDTruncation
(
orgEndToEndId
);
mt7
2
List
.
add
(
mtLine4
);
String
mtLine4
=
"/TREF/"
+
subFunctionIDTruncation
(
orgEndToEndId
,
false
);
mt7
9
List
.
add
(
mtLine4
);
}
//没有mtLine5
String
mtUetr
=
""
;
...
...
@@ -72,17 +72,17 @@ public class Field79Generate extends AbstractMx2MtTagsGenerate {
mtUetr
=
"/UETR/"
+
uetr
;
}
if
(
StringUtil
.
isNotEmpty
(
mtLine6
))
{
mt7
2
List
.
add
(
mtLine6
);
mt7
9
List
.
add
(
mtLine6
);
if
(
StringUtil
.
isNotEmpty
(
mtUetr
))
{
mt7
2
List
.
add
(
"//"
+
mtUetr
);
mt7
9
List
.
add
(
"//"
+
mtUetr
);
}
}
else
{
mt7
2
List
.
add
(
"/TEXT/"
+
mtUetr
);
mt7
9
List
.
add
(
"/TEXT/"
+
mtUetr
);
}
if
(
mt7
2
List
.
size
()
>
0
)
{
if
(
mt7
9
List
.
size
()
>
0
)
{
List
<
String
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
mt7
2
List
.
size
();
i
++)
{
String
mt72FullField
=
mt7
2
List
.
get
(
i
);
for
(
int
i
=
0
;
i
<
mt7
9
List
.
size
();
i
++)
{
String
mt72FullField
=
mt7
9
List
.
get
(
i
);
List
<
String
>
tmplist
=
StringUtil
.
outStringList
(
mt72FullField
,
50
,
"//"
);
list
.
addAll
(
tmplist
);
}
...
...
swiftCore/src/test/java/com/brilliance/mx2mt/mt103/retn/Test.java
View file @
8e808049
package
com
.
brilliance
.
mx2mt
.
mt103
.
retn
;
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.util.List
;
public
class
Test
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs004001_Pacs008.xml"
);
String
xmlStr
=
FileUtils
.
readFileToString
(
file
);
String
mt103Retn
=
SwiftTransfer
.
mx2Mt
(
xmlStr
,
null
,
null
);
System
.
out
.
println
(
mt103Retn
);
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
);
String
originalValue
=
errorInfo
.
getOriginalValue
();
if
(
StringUtil
.
isNotEmpty
(
originalValue
))
{
System
.
out
.
println
(
originalValue
);
}
}
}
System
.
out
.
println
(
str
.
getMessage
());
}
}
}
swiftCore/src/test/java/com/brilliance/mx2mt/mt202/TestMx2MtFor202.java
View file @
8e808049
package
com
.
brilliance
.
mx2mt
.
mt202
;
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.util.List
;
public
class
TestMx2MtFor202
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900108.xml"
);
String
xmlStr
=
FileUtils
.
readFileToString
(
file
);
String
mt202
=
SwiftTransfer
.
mx2Mt
(
xmlStr
,
null
,
null
);
System
.
out
.
println
(
mt202
);
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
);
String
originalValue
=
errorInfo
.
getOriginalValue
();
if
(
StringUtil
.
isNotEmpty
(
originalValue
))
{
System
.
out
.
println
(
originalValue
);
}
}
}
System
.
out
.
println
(
str
.
getMessage
());
}
}
}
swiftCore/src/test/java/com/brilliance/mx2mt/mt202/TestMx2MtFor202COV.java
View file @
8e808049
package
com
.
brilliance
.
mx2mt
.
mt202
;
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.util.List
;
public
class
TestMx2MtFor202COV
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900108_COV.xml"
);
String
xmlStr
=
FileUtils
.
readFileToString
(
file
);
String
mt202
=
SwiftTransfer
.
mx2Mt
(
xmlStr
,
null
,
null
);
System
.
out
.
println
(
mt202
);
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
);
String
originalValue
=
errorInfo
.
getOriginalValue
();
if
(
StringUtil
.
isNotEmpty
(
originalValue
))
{
System
.
out
.
println
(
originalValue
);
}
}
}
System
.
out
.
println
(
str
.
getMessage
());
}
}
}
swiftCore/src/test/java/com/brilliance/mx2mt/mt202/retn/Test.java
View file @
8e808049
package
com
.
brilliance
.
mx2mt
.
mt202
.
retn
;
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.util.List
;
public
class
Test
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs004001_Pacs009.xml"
);
String
xmlStr
=
FileUtils
.
readFileToString
(
file
);
String
mt202Retn
=
SwiftTransfer
.
mx2Mt
(
xmlStr
,
null
,
null
);
System
.
out
.
println
(
mt202Retn
);
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
);
String
originalValue
=
errorInfo
.
getOriginalValue
();
if
(
StringUtil
.
isNotEmpty
(
originalValue
))
{
System
.
out
.
println
(
originalValue
);
}
}
}
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