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
c8727197
Commit
c8727197
authored
Jul 25, 2024
by
gechengyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mx2mtMap函数逻辑判断,增加iso ACK/NAK报文 的报文处理
parent
97a641b7
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
124 additions
and
3 deletions
+124
-3
SwiftTransfer.java
...ore/src/main/java/com/brilliance/swift/SwiftTransfer.java
+5
-1
Mx2MtCreatorManager.java
.../java/com/brilliance/swift/mx2mt/Mx2MtCreatorManager.java
+2
-1
SwiftTransferUtil.java
...ain/java/com/brilliance/swift/util/SwiftTransferUtil.java
+37
-0
iso_ack.xml
swiftCore/src/main/resources/swiftXml/iso_ack.xml
+78
-0
Mx2MtTest.java
swiftCore/src/test/java/com/brilliance/Mx2MtTest.java
+2
-1
No files found.
swiftCore/src/main/java/com/brilliance/swift/SwiftTransfer.java
View file @
c8727197
...
...
@@ -121,12 +121,16 @@ public class SwiftTransfer {
* 用于邮储版本
* @param xmlStr
* @param extraMap
* @return
* @throws SwiftException
*/
public
static
Map
<
String
,
String
>
mx2MtMap
(
String
xmlStr
,
Map
<
String
,
Object
>
extraMap
)
throws
SwiftException
{
try
{
xmlStr
=
XmlUtil
.
handlingXml
(
xmlStr
);
//增加ISO ACK/NAK处理逻辑
Map
<
String
,
String
>
ackNakMap
=
SwiftTransferUtil
.
anasyIsoACKNAK
(
xmlStr
);
if
(
ackNakMap
!=
null
){
return
ackNakMap
;
}
SwiftTranslationReport
str
=
mx2MtPlus
(
xmlStr
,
null
,
extraMap
);
Map
<
String
,
String
>
maps
=
MxMessageReader
.
getSwfMsgInfoViaMsg
(
str
);
AbstractMX
abstractMx
=
AbstractMX
.
parse
(
xmlStr
);
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/Mx2MtCreatorManager.java
View file @
c8727197
...
...
@@ -34,12 +34,13 @@ public class Mx2MtCreatorManager {
public
SwiftTranslationReport
mx2Mt
(
String
xml
,
String
fileOutputPath
,
Map
<
String
,
Object
>
extraMap
)
throws
SwiftException
{
try
{
String
messageType
=
null
;
xml
=
XmlUtil
.
handlingXml
(
xml
);
MxId
mxId
=
XmlUtil
.
getMxMessageType
(
xml
);
if
(
mxId
==
null
)
{
throw
new
SwiftException
(
"找不到MX报文类型"
);
}
String
messageType
=
(
mxId
.
getBusinessProcess
().
name
()
messageType
=
(
mxId
.
getBusinessProcess
().
name
()
+
mxId
.
getFunctionality
()
+
mxId
.
getVariant
())
//+ abstractMX.getMxId().getVersion())
...
...
swiftCore/src/main/java/com/brilliance/swift/util/SwiftTransferUtil.java
View file @
c8727197
...
...
@@ -6,7 +6,11 @@ import com.brilliance.swift.constants.ERROR;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.vo.MxMtReasonCodeInfo
;
import
com.brilliance.swift.vo.SwiftTranslationErrorInfo
;
import
com.brilliance.swift.vo.SwiftTranslationReport
;
import
com.brilliance.swift.vo.common.*
;
import
org.dom4j.Document
;
import
org.dom4j.DocumentException
;
import
org.dom4j.DocumentHelper
;
import
org.xml.sax.SAXException
;
import
javax.xml.datatype.DatatypeConfigurationException
;
...
...
@@ -917,4 +921,37 @@ public class SwiftTransferUtil {
}
return
flag
;
}
public
static
Map
<
String
,
String
>
anasyIsoACKNAK
(
String
xmlStr
){
if
(
StringUtil
.
isNotEmpty
(
xmlStr
)
&&
(
xmlStr
.
contains
(
"<PseudoAckNack>"
)&&
xmlStr
.
contains
(
"</PseudoAckNack>"
))){
SwiftTranslationReport
swiftTranslationReport
=
new
SwiftTranslationReport
();
String
mtType
=
""
;
Document
document
=
null
;
try
{
document
=
DocumentHelper
.
parseText
(
xmlStr
);
}
catch
(
DocumentException
e
)
{
throw
new
SwiftException
(
"parse iso xml error:"
+
e
.
getMessage
());
}
String
mtAckNakStr
=
XmlUtil
.
getXmlNodeValue
(
document
,
"DataPDU.Header.TransmissionReport.Interventions.Intervention.Contents.AckNack.PseudoAckNack"
);
String
senderReference
=
XmlUtil
.
getXmlNodeValue
(
document
,
"DataPDU.Header.TransmissionReport.Message.SenderReference"
);
String
messageIdentifier
=
XmlUtil
.
getXmlNodeValue
(
document
,
"DataPDU.Header.TransmissionReport.Message.MessageIdentifier"
);
Map
<
String
,
String
>
maps
=
new
HashMap
<>();
String
result
=
""
;
maps
.
put
(
"mtAckNakStr"
,
mtAckNakStr
);
maps
.
put
(
"senderReference"
,
senderReference
);
maps
.
put
(
"messageIdentifier"
,
messageIdentifier
);
if
(
StringUtil
.
isNotEmpty
(
mtAckNakStr
)){
if
(
mtAckNakStr
.
contains
(
"{311:ACK"
)){
result
=
"ACK"
;
}
else
if
(
mtAckNakStr
.
contains
(
"{311:NAK"
)){
result
=
"NAK"
;
}
}
maps
.
put
(
"result"
,
result
);
// System.out.println("maps="+maps);
return
maps
;
}
return
null
;
}
}
swiftCore/src/main/resources/swiftXml/iso_ack.xml
0 → 100644
View file @
c8727197
<?xml version="1.0" encoding="UTF-8" ?>
<Saa:DataPDU
xmlns:Saa=
"urn:swift:saa:xsd:saa.2.0"
xmlns:Sw=
"urn:swift:snl:ns.Sw"
xmlns:SwInt=
"urn:swift:snl:ns.SwInt"
xmlns:SwGbl=
"urn:swift:snl:ns.SwGbl"
xmlns:SwSec=
"urn:swift:snl:ns.SwSec"
>
<Saa:Revision>
2.0.15
</Saa:Revision>
<Saa:Header>
<Saa:TransmissionReport>
<Saa:SenderReference>
2024072400023204
</Saa:SenderReference>
<Saa:ReconciliationInfo>
swi03002-2024-07-25T06:22:23.19563.358889Z
</Saa:ReconciliationInfo>
<Saa:NetworkDeliveryStatus>
NetworkAcked
</Saa:NetworkDeliveryStatus>
<Saa:OriginalInstanceAddressee>
<Saa:X1>
NYCBCNSHXXX
</Saa:X1>
<Saa:X2>
xxx
</Saa:X2>
</Saa:OriginalInstanceAddressee>
<Saa:ReportingApplication>
SWIFTNetInterface
</Saa:ReportingApplication>
<Saa:NetworkInfo>
<Saa:Priority>
Normal
</Saa:Priority>
<Saa:IsPossibleDuplicate>
true
</Saa:IsPossibleDuplicate>
<Saa:Service>
swift.finplus!pc
</Saa:Service>
<Saa:Network>
SWIFTNet
</Saa:Network>
<Saa:SessionNr>
000002
</Saa:SessionNr>
<Saa:SeqNr>
000000027
</Saa:SeqNr>
<Saa:SWIFTNetNetworkInfo>
<Saa:RequestType>
pacs.008.001.08
</Saa:RequestType>
<Saa:SWIFTRef>
swi03002-2024-07-25T06:22:23.19563.358889Z
</Saa:SWIFTRef>
<Saa:SNLRef>
SNL35282-2024-07-25T06:23:18.6584.000445Z
</Saa:SNLRef>
<Saa:Reference>
769c43c1-17d0-4012-93f1-b4462d765d08
</Saa:Reference>
<Saa:SnFInputTime>
0301:2024-07-25T06:22:23
</Saa:SnFInputTime>
<Saa:ResponsePayloadAttributes>
<Saa:PayloadAttribute>
<Saa:Name>
type
</Saa:Name>
<Saa:Value>
swift.emptyresponse
</Saa:Value>
</Saa:PayloadAttribute>
</Saa:ResponsePayloadAttributes>
</Saa:SWIFTNetNetworkInfo>
</Saa:NetworkInfo>
<Saa:Interventions>
<Saa:Intervention>
<Saa:IntvCategory>
TransmissionReport
</Saa:IntvCategory>
<Saa:CreationTime>
20240725142317
</Saa:CreationTime>
<Saa:OperatorOrigin>
SYSTEM
</Saa:OperatorOrigin>
<Saa:Contents>
<AckNack>
<PseudoAckNack>
{1:F21NYCBCNSHAXXX000002000000027}{4:{177:2407251423}{451:0}{311:ACK}{108:2024072400023204}}
</PseudoAckNack>
</AckNack>
</Saa:Contents>
</Saa:Intervention>
</Saa:Interventions>
<Saa:IsRelatedInstanceOriginal>
true
</Saa:IsRelatedInstanceOriginal>
<Saa:MessageCreator>
ApplicationInterface
</Saa:MessageCreator>
<Saa:IsMessageModified>
false
</Saa:IsMessageModified>
<Saa:MessageFields>
MinimumInfo
</Saa:MessageFields>
<Saa:Message>
<Saa:SenderReference>
2024072400023204
</Saa:SenderReference>
<Saa:MessageIdentifier>
pacs.008.001.08
</Saa:MessageIdentifier>
<Saa:Format>
MX
</Saa:Format>
<Saa:SubFormat>
Input
</Saa:SubFormat>
<Saa:Sender>
<Saa:DN>
ou=xxx,o=nycbcnsh,o=swift
</Saa:DN>
<Saa:FullName>
<Saa:X1>
NYCBCNSHXXX
</Saa:X1>
<Saa:X2>
xxx
</Saa:X2>
</Saa:FullName>
</Saa:Sender>
<Saa:Receiver>
<Saa:DN>
ou=xxx,o=nycbcnsh,o=swift
</Saa:DN>
<Saa:FullName>
<Saa:X1>
NYCBCNSHXXX
</Saa:X1>
<Saa:X2>
xxx
</Saa:X2>
</Saa:FullName>
</Saa:Receiver>
</Saa:Message>
</Saa:TransmissionReport>
</Saa:Header>
</Saa:DataPDU>
\ No newline at end of file
swiftCore/src/test/java/com/brilliance/Mx2MtTest.java
View file @
c8727197
...
...
@@ -298,7 +298,8 @@ public class Mx2MtTest {
@Test
public
void
testMx2MtMap
()
throws
IOException
{
File
file
=
FileUtils
.
toFile
(
Mx2MtTest
.
class
.
getResource
(
"/swiftXml/MxPacs00900108_COV.xml"
));
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxPacs00900108_COV.xml"));
File
file
=
FileUtils
.
toFile
(
Mx2MtTest
.
class
.
getResource
(
"/swiftXml/iso_ack.xml"
));
String
xmlStr
=
FileUtils
.
readFileToString
(
file
);
Map
<
String
,
String
>
maps
=
SwiftTransfer
.
mx2MtMap
(
xmlStr
,
null
);
for
(
String
key
:
maps
.
keySet
())
{
...
...
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