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
2ffa4c81
Commit
2ffa4c81
authored
May 08, 2023
by
zhanghou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提供接口可以让sessionNumber和sequenceNumber可以通过实现类生成
(cherry picked from commit e36b97eb82f8a45eda061f8834b024e75883877c)
parent
84b37ad9
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
2 deletions
+53
-2
AbstractMx2MtCreator.java
...java/com/brilliance/swift/mx2mt/AbstractMx2MtCreator.java
+22
-2
GenerateSesSeqNumber.java
...java/com/brilliance/swift/mx2mt/GenerateSesSeqNumber.java
+12
-0
GenerateSesSeqNumberImpl.java
.../com/brilliance/swift/mx2mt/GenerateSesSeqNumberImpl.java
+17
-0
generateSesSeqNumber.properties
swiftCore/src/main/resources/generateSesSeqNumber.properties
+2
-0
No files found.
swiftCore/src/main/java/com/brilliance/swift/mx2mt/AbstractMx2MtCreator.java
View file @
2ffa4c81
...
...
@@ -3,6 +3,7 @@ package com.brilliance.swift.mx2mt;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.MessageUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.util.XmlUtil
;
...
...
@@ -25,6 +26,7 @@ import javax.xml.datatype.XMLGregorianCalendar;
import
java.io.File
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.util.*
;
...
...
@@ -371,8 +373,26 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
}
else
{
block1
.
setLogicalTerminal
(
processBicCode
(
senderBic
));
}
block1
.
setSessionNumber
(
getRandomNumber
(
4
));
//mapping文档中给的是0000
block1
.
setSequenceNumber
(
getRandomNumber
(
6
));
//mapping文档中给的是000000
try
{
String
implName
=
"com.brilliance.swift.mx2mt.GenerateSesSeqNumberImpl"
;
InputStream
resourceAsStream
=
AbstractMx2MtCreator
.
class
.
getResourceAsStream
(
"/generateSesSeqNumber.properties"
);
if
(!
Objects
.
isNull
(
resourceAsStream
)){
Properties
properties
=
new
Properties
();
properties
.
load
(
resourceAsStream
);
implName
=
properties
.
getProperty
(
"generateNumber"
);
if
(
StringUtil
.
isEmpty
(
implName
)){
implName
=
"com.brilliance.swift.mx2mt.GenerateSesSeqNumberImpl"
;
}
}
Object
obj
=
Class
.
forName
(
implName
).
newInstance
();
GenerateSesSeqNumber
generateNumber
=
(
GenerateSesSeqNumber
)
obj
;
block1
.
setSessionNumber
(
generateNumber
.
generateSessionNumber
());
//mapping文档中给的是0000
block1
.
setSequenceNumber
(
generateNumber
.
generateSequenceNumber
());
//mapping文档中给的是000000
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
// block1.setSessionNumber(getRandomNumber(4));//mapping文档中给的是0000
// block1.setSequenceNumber(getRandomNumber(6));//mapping文档中给的是000000
context
.
get
(
SwiftMessage
.
class
).
setBlock1
(
block1
);
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/GenerateSesSeqNumber.java
0 → 100644
View file @
2ffa4c81
package
com
.
brilliance
.
swift
.
mx2mt
;
/**
* @author zh
* @create 2023-05-08-13:44
*/
public
interface
GenerateSesSeqNumber
{
String
generateSessionNumber
();
String
generateSequenceNumber
();
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/GenerateSesSeqNumberImpl.java
0 → 100644
View file @
2ffa4c81
package
com
.
brilliance
.
swift
.
mx2mt
;
/**
* @author zh
* @create 2023-05-08-13:49
*/
public
class
GenerateSesSeqNumberImpl
implements
GenerateSesSeqNumber
{
@Override
public
String
generateSessionNumber
()
{
return
"0000"
;
}
@Override
public
String
generateSequenceNumber
()
{
return
"000000"
;
}
}
swiftCore/src/main/resources/generateSesSeqNumber.properties
0 → 100644
View file @
2ffa4c81
generateNumber
=
com.brilliance.swift.mx2mt.GenerateSesSeqNumberImpl
\ No newline at end of file
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