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
f3d17e8a
Commit
f3d17e8a
authored
Jun 30, 2022
by
chengzhuoshen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
封装报文转换详细报告方法
parent
961ca0f0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
50 additions
and
11 deletions
+50
-11
AbstractMx2MtCreator.java
...java/com/brilliance/swift/mx2mt/AbstractMx2MtCreator.java
+1
-1
AbstractMx2MtTagsGenerate.java
...com/brilliance/swift/mx2mt/AbstractMx2MtTagsGenerate.java
+0
-0
Mx2MtContextIdentifier.java
...va/com/brilliance/swift/mx2mt/Mx2MtContextIdentifier.java
+2
-0
Mx2Mt103Creator.java
...ava/com/brilliance/swift/mx2mt/mt103/Mx2Mt103Creator.java
+6
-0
Field20Generate.java
...om/brilliance/swift/mx2mt/mt103/impl/Field20Generate.java
+1
-4
Field32AGenerate.java
...m/brilliance/swift/mx2mt/mt103/impl/Field32AGenerate.java
+5
-0
Field33BGenerate.java
...m/brilliance/swift/mx2mt/mt103/impl/Field33BGenerate.java
+2
-0
Field50AGenerate.java
...m/brilliance/swift/mx2mt/mt103/impl/Field50AGenerate.java
+2
-0
Field52AGenerate.java
...m/brilliance/swift/mx2mt/mt103/impl/Field52AGenerate.java
+2
-0
Field53AGenerate.java
...m/brilliance/swift/mx2mt/mt103/impl/Field53AGenerate.java
+2
-0
SwiftTransferUtil.java
...ain/java/com/brilliance/swift/util/SwiftTransferUtil.java
+27
-6
ErrorCodeList.xlsx
swiftCore/src/main/resources/ErrorCodeList.xlsx
+0
-0
No files found.
swiftCore/src/main/java/com/brilliance/swift/mx2mt/AbstractMx2MtCreator.java
View file @
f3d17e8a
...
...
@@ -50,7 +50,7 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
errorInfo
.
setOriginalValue
(
originalValue
);
str
.
addErrorInfo
(
errorInfo
);
if
(
"FAILURE"
.
equalsIgnoreCase
(
errorInfo
.
getErrorType
()))
{
throw
new
SwiftException
(
location
+
Mx2MtConstants
.
NEW_LINE
+
"-"
+
errorInfo
.
getErrorType
()
+
":"
+
errorInfo
.
getDescription
());
throw
new
SwiftException
(
location
+
"-"
+
errorInfo
.
getErrorType
()
+
":"
+
errorInfo
.
getDescription
());
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/AbstractMx2MtTagsGenerate.java
View file @
f3d17e8a
This diff is collapsed.
Click to expand it.
swiftCore/src/main/java/com/brilliance/swift/mx2mt/Mx2MtContextIdentifier.java
View file @
f3d17e8a
...
...
@@ -22,4 +22,6 @@ public class Mx2MtContextIdentifier {
public
static
final
String
MT_TYPE_210_50_FLAG
=
"mt.type.210.50.flag"
;
public
static
final
String
MX_TO_MT_ERROR_LOCATION
=
"mx.to.mt.error.location"
;
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103/Mx2Mt103Creator.java
View file @
f3d17e8a
package
com
.
brilliance
.
swift
.
mx2mt
.
mt103
;
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 Mx2Mt103Creator 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
(
"CdtTrfTxInf"
));
String
bodyParentPath
=
parentElementMaps
.
get
(
"CdtTrfTxInf"
);
int
counts
=
getXmlNodeCounts
(
bodyParentPath
,
document
,
"CdtTrfTxInf"
);
if
(
counts
>
1
)
{
buildSTErrorInfo
(
ERROR
.
T20053
,
bodyParentPath
+
".CdtTrfTxInf"
,
null
);
}
}
@Override
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103/impl/Field20Generate.java
View file @
f3d17e8a
...
...
@@ -4,9 +4,6 @@ import com.brilliance.swift.constants.ERROR;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.vo.SwiftTranslationErrorInfo
;
import
com.brilliance.swift.vo.SwiftTranslationReport
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -34,7 +31,7 @@ public class Field20Generate extends AbstractMx2MtTagsGenerate {
}
if
(
StringUtil
.
isNotEmpty
(
messageId
))
{
if
(
messageId
.
length
()
>
16
)
{
buildSTErrorInfo
(
ERROR
.
T0000T
,
"
MT103/BLOCK
4/:20:"
,
messageId
);
buildSTErrorInfo
(
ERROR
.
T0000T
,
"
Block
4/:20:"
,
messageId
);
messageId
=
messageId
.
substring
(
0
,
15
)
+
"+"
;
}
tags
.
add
(
new
Tag
(
name
,
messageId
));
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103/impl/Field32AGenerate.java
View file @
f3d17e8a
package
com
.
brilliance
.
swift
.
mx2mt
.
mt103
.
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
,
"CdtTrfTxInf.IntrBkSttlmAmt"
);
String
ccy
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.IntrBkSttlmAmt@Ccy"
);
if
(
"XAU"
.
equalsIgnoreCase
(
ccy
)
||
"XAG"
.
equalsIgnoreCase
(
ccy
)
||
"XPD"
.
equalsIgnoreCase
(
ccy
)
||
"XPT"
.
equalsIgnoreCase
(
ccy
))
{
buildSTErrorInfo
(
ERROR
.
T20054
,
bodyHdrParentElementName
+
".CdtTrfTxInf.IntrBkSttlmAmt"
,
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/mt103/impl/Field33BGenerate.java
View file @
f3d17e8a
package
com
.
brilliance
.
swift
.
mx2mt
.
mt103
.
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
,
"CdtTrfTxInf.IntrBkSttlmAmt"
);
ccy
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.IntrBkSttlmAmt@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/mt103/impl/Field50AGenerate.java
View file @
f3d17e8a
...
...
@@ -3,6 +3,7 @@ package com.brilliance.swift.mx2mt.mt103.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
;
...
...
@@ -22,6 +23,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
partyPath
=
bodyHdrParentElementName
+
".CdtTrfTxInf.Dbtr"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103/impl/Field52AGenerate.java
View file @
f3d17e8a
...
...
@@ -3,6 +3,7 @@ package com.brilliance.swift.mx2mt.mt103.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
;
...
...
@@ -20,6 +21,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.DbtrAgt"
);
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103/impl/Field53AGenerate.java
View file @
f3d17e8a
...
...
@@ -3,6 +3,7 @@ package com.brilliance.swift.mx2mt.mt103.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.SettlementMethodCode
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
...
...
@@ -24,6 +25,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/util/SwiftTransferUtil.java
View file @
f3d17e8a
...
...
@@ -2,6 +2,7 @@ package com.brilliance.swift.util;
import
cn.hutool.poi.excel.ExcelReader
;
import
cn.hutool.poi.excel.ExcelUtil
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.vo.MxMtReasonCodeInfo
;
import
com.brilliance.swift.vo.SwiftTranslationErrorInfo
;
...
...
@@ -761,21 +762,24 @@ public class SwiftTransferUtil {
}
}
}
SwiftTranslationErrorInfo
e
rrorInfo
=
null
;
SwiftTranslationErrorInfo
tmpE
rrorInfo
=
null
;
if
(
stErrorInfos
!=
null
&&
stErrorInfos
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
stErrorInfos
.
size
();
i
++)
{
SwiftTranslationErrorInfo
tmpErrorInfo
=
stErrorInfos
.
get
(
i
);
if
(
key
.
equalsIgnoreCase
(
tmpErrorInfo
.
getErrorCode
()))
{
errorInfo
=
tmpErrorInfo
;
if
(
key
.
equalsIgnoreCase
(
stErrorInfos
.
get
(
i
).
getErrorCode
()))
{
tmpErrorInfo
=
stErrorInfos
.
get
(
i
);
break
;
}
}
}
if
(
errorInfo
==
null
)
{
//在errorcode list里面找不到,生成默认值
errorInfo
=
new
SwiftTranslationErrorInfo
();
SwiftTranslationErrorInfo
errorInfo
=
new
SwiftTranslationErrorInfo
();
if
(
tmpErrorInfo
==
null
)
{
//在errorcode list里面找不到,生成默认值
errorInfo
.
setErrorCode
(
key
);
errorInfo
.
setDescription
(
key
);
errorInfo
.
setErrorType
(
"WARNING"
);
}
else
{
errorInfo
.
setErrorCode
(
tmpErrorInfo
.
getErrorCode
());
errorInfo
.
setDescription
(
tmpErrorInfo
.
getDescription
());
errorInfo
.
setErrorType
(
tmpErrorInfo
.
getErrorType
());
}
return
errorInfo
;
}
...
...
@@ -809,4 +813,21 @@ public class SwiftTransferUtil {
throw
new
SwiftException
(
"Validate "
+
xsdName
+
".xsd Error;"
+
e
.
getMessage
());
}
}
public
static
boolean
compareStErrorInfo
(
SwiftTranslationErrorInfo
target
,
SwiftTranslationErrorInfo
source
)
{
boolean
flag
=
false
;
if
(
target
!=
null
&&
source
!=
null
)
{
if
(
target
.
getErrorCode
().
equals
(
source
.
getErrorCode
())
&&
target
.
getLocation
().
equals
(
source
.
getLocation
()))
{
if
(
ERROR
.
T0000T
.
equals
(
target
.
getErrorCode
())
||
ERROR
.
T0000R
.
equals
(
target
.
getErrorCode
()))
{
if
(
target
.
getOriginalValue
().
equals
(
source
.
getOriginalValue
()))
{
flag
=
true
;
}
}
else
{
flag
=
true
;
}
}
}
return
flag
;
}
}
swiftCore/src/main/resources/ErrorCodeList.xlsx
View file @
f3d17e8a
No preview for this file type
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