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
d30ba29b
Commit
d30ba29b
authored
Jul 11, 2022
by
chengzhuoshen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改MXMT相互转换createdate的逻辑,取当前系统时间,之前的逻辑是取默认值
parent
4d10ee51
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
41 additions
and
19 deletions
+41
-19
AbstractMt2MxCreator.java
...java/com/brilliance/swift/mt2mx/AbstractMt2MxCreator.java
+25
-4
AbstractMt2MxParseField.java
...a/com/brilliance/swift/mt2mx/AbstractMt2MxParseField.java
+3
-0
Mt2MxContextIdentifier.java
...va/com/brilliance/swift/mt2mx/Mt2MxContextIdentifier.java
+2
-0
Mt2MxCamt029001Creator.java
...liance/swift/mt2mx/camt029001/Mt2MxCamt029001Creator.java
+1
-1
Mt2MxCamt056001Creator.java
...liance/swift/mt2mx/camt056001/Mt2MxCamt056001Creator.java
+1
-1
Mt2MxPacs008001Creator.java
...liance/swift/mt2mx/pacs008001/Mt2MxPacs008001Creator.java
+1
-1
Mt2MxPacs009001Creator.java
...liance/swift/mt2mx/pacs009001/Mt2MxPacs009001Creator.java
+1
-1
AbstractMx2MtCreator.java
...java/com/brilliance/swift/mx2mt/AbstractMx2MtCreator.java
+7
-11
No files found.
swiftCore/src/main/java/com/brilliance/swift/mt2mx/AbstractMt2MxCreator.java
View file @
d30ba29b
package
com
.
brilliance
.
swift
.
mt2mx
;
import
com.alibaba.fastjson.JSONObject
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.common.MessagePriority
;
import
com.prowidesoftware.swift.model.SwiftBlock5
;
...
...
@@ -8,6 +10,9 @@ import com.prowidesoftware.swift.model.SwiftBlock5Field;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mx.AbstractMX
;
import
javax.xml.datatype.DatatypeConfigurationException
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -51,10 +56,7 @@ public abstract class AbstractMt2MxCreator implements Mt2MxCreator{
Map
<
String
,
Object
>
toFiIdFinInstnIdMaps
=
new
HashMap
<>();
toFiIdMaps
.
put
(
"finInstnId"
,
toFiIdFinInstnIdMaps
);
toFiIdFinInstnIdMaps
.
put
(
"bicfi"
,
receiverBic
);
String
createDateStr
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
EXTERNAL_PARAMETERS_CREATION_DATE
,
true
);
if
(
StringUtil
.
isEmpty
(
createDateStr
))
{
createDateStr
=
"9999-12-31T00:00:00+00:00"
;
}
String
createDateStr
=
getCreateDateStr
();
appHdrMaps
.
put
(
"creDt"
,
createDateStr
);
boolean
covFlag
=
abstractMT
.
getSwiftMessage
().
isCOV
();
if
(
covFlag
)
{
...
...
@@ -105,4 +107,23 @@ public abstract class AbstractMt2MxCreator implements Mt2MxCreator{
}
finInstnIdMaps
.
put
(
"bicfi"
,
mtBicCode
);
}
protected
String
getCreateDateStr
()
{
String
createDateStr
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
EXTERNAL_PARAMETERS_CREATION_DATE
,
true
);
if
(
StringUtil
.
isEmpty
(
createDateStr
))
{
try
{
Date
now
=
(
Date
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_TO_MX_NOW
,
true
);
if
(
now
==
null
)
{
now
=
new
Date
();
context
.
set
(
Mt2MxContextIdentifier
.
MT_TO_MX_NOW
,
now
);
}
createDateStr
=
DateUtil
.
parseXMLGregorianCalendar
(
now
).
toXMLFormat
();
}
catch
(
DatatypeConfigurationException
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
catch
(
ParseException
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
return
createDateStr
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/AbstractMt2MxParseField.java
View file @
d30ba29b
...
...
@@ -9,6 +9,7 @@ import com.brilliance.swift.util.SwiftTransferUtil;
import
com.brilliance.swift.vo.common.*
;
import
com.prowidesoftware.swift.model.field.Field23E
;
import
javax.xml.datatype.DatatypeConfigurationException
;
import
java.text.ParseException
;
import
java.util.*
;
import
java.util.regex.Matcher
;
...
...
@@ -32,6 +33,8 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField {
public
void
initJsonMaps
()
{
jsonMaps
=
(
Map
<
String
,
Object
>)
context
.
get
(
Mt2MxContextIdentifier
.
MT_TO_MX_JSON_MAP
,
true
);
}
/**
* MT 转 MX 转换函数开始
*/
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/Mt2MxContextIdentifier.java
View file @
d30ba29b
...
...
@@ -13,6 +13,8 @@ public class Mt2MxContextIdentifier {
public
static
final
String
MT_RECEIVE_BIC
=
"mt.receive.bic"
;
public
static
final
String
MT_TO_MX_INSTRUCTION_FOR_NEXT_AGENT_FIN53
=
"mt.to.mx.instruction.for.next.agent.fin53"
;
public
static
final
String
MT_TO_MX_NOW
=
"mt.to.mx.now"
;
/**
* 外部参数
*/
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt029001/Mt2MxCamt029001Creator.java
View file @
d30ba29b
...
...
@@ -29,7 +29,7 @@ public class Mt2MxCamt029001Creator extends AbstractMt2MxCreator {
jsonMaps
.
put
(
"rsltnOfInvstgtn"
,
rsltnOfInvstgtnMaps
);
Map
<
String
,
Object
>
assgnmtMaps
=
new
HashMap
<>();
rsltnOfInvstgtnMaps
.
put
(
"assgnmt"
,
assgnmtMaps
);
assgnmtMaps
.
put
(
"creDtTm"
,
"9999-12-31T00:00:00+00:00"
);
assgnmtMaps
.
put
(
"creDtTm"
,
getCreateDateStr
()
);
Map
<
String
,
Object
>
cxlDtlsMaps
=
new
HashMap
<>();
JSONArray
cxlDtlsJsonArray
=
new
JSONArray
();
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt056001/Mt2MxCamt056001Creator.java
View file @
d30ba29b
...
...
@@ -29,7 +29,7 @@ public class Mt2MxCamt056001Creator extends AbstractMt2MxCreator {
jsonMaps
.
put
(
"fiToFIPmtCxlReq"
,
fiToFIPmtCxlReqMaps
);
Map
<
String
,
Object
>
assgnmtMaps
=
new
HashMap
<>();
fiToFIPmtCxlReqMaps
.
put
(
"assgnmt"
,
assgnmtMaps
);
assgnmtMaps
.
put
(
"creDtTm"
,
"9999-12-31T00:00:00+00:00"
);
assgnmtMaps
.
put
(
"creDtTm"
,
getCreateDateStr
()
);
Map
<
String
,
Object
>
undrlygMaps
=
new
HashMap
<>();
JSONArray
undrlygJsonArray
=
new
JSONArray
();
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/Mt2MxPacs008001Creator.java
View file @
d30ba29b
...
...
@@ -29,7 +29,7 @@ public class Mt2MxPacs008001Creator extends AbstractMt2MxCreator {
jsonMaps
.
put
(
"fiToFICstmrCdtTrf"
,
fiToFICstmrCdtTrfMaps
);
Map
<
String
,
Object
>
grpHdrMaps
=
new
HashMap
<>();
fiToFICstmrCdtTrfMaps
.
put
(
"grpHdr"
,
grpHdrMaps
);
grpHdrMaps
.
put
(
"creDtTm"
,
"9999-12-31T00:00:00+00:00"
);
grpHdrMaps
.
put
(
"creDtTm"
,
getCreateDateStr
()
);
grpHdrMaps
.
put
(
"nbOfTxs"
,
"1"
);
Map
<
String
,
Object
>
cdtTrfTxInfMaps
=
new
HashMap
<>();
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs009001/Mt2MxPacs009001Creator.java
View file @
d30ba29b
...
...
@@ -29,7 +29,7 @@ public class Mt2MxPacs009001Creator extends AbstractMt2MxCreator {
jsonMaps
.
put
(
"fiCdtTrf"
,
fiCdtTrfMaps
);
Map
<
String
,
Object
>
grpHdrMaps
=
new
HashMap
<>();
fiCdtTrfMaps
.
put
(
"grpHdr"
,
grpHdrMaps
);
grpHdrMaps
.
put
(
"creDtTm"
,
"9999-12-31T00:00:00+00:00"
);
grpHdrMaps
.
put
(
"creDtTm"
,
getCreateDateStr
()
);
grpHdrMaps
.
put
(
"nbOfTxs"
,
"1"
);
Map
<
String
,
Object
>
cdtTrfTxInfMaps
=
new
HashMap
<>();
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/AbstractMx2MtCreator.java
View file @
d30ba29b
...
...
@@ -22,8 +22,10 @@ import org.dom4j.Document;
import
java.io.File
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.text.ParseException
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
public
abstract
class
AbstractMx2MtCreator
implements
Mx2MtCreator
{
...
...
@@ -195,20 +197,14 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
}
Date
outputDate
=
(
Date
)
context
.
get
(
Mx2MtConstants
.
OUTPUT_DATE
,
true
);
if
(
outputDate
==
null
)
{
try
{
outputDate
=
DateUtil
.
parseDate
(
"9999-12-31"
,
"yyyy-MM-dd"
);
}
catch
(
ParseException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
outputDate
=
new
Date
();
}
String
applicationMode
=
(
String
)
context
.
get
(
Mx2MtConstants
.
APPLICATION_MODE
,
true
);
if
(
"O"
.
equalsIgnoreCase
(
applicationMode
))
{
SwiftBlock2Output
block2
=
new
SwiftBlock2Output
();
block2
.
setMessageType
(
getMtType
());
//block2.setSenderInputTime(DateUtil.format(inputDate, "HHmm"));
//block2.setMIRDate(DateUtil.format(inputDate, "yyMMdd"));
block2
.
setSenderInputTime
(
"0000"
);
block2
.
setMIRDate
(
"991231"
);
block2
.
setSenderInputTime
(
DateUtil
.
format
(
inputDate
,
"HHmm"
));
block2
.
setMIRDate
(
DateUtil
.
format
(
inputDate
,
"yyMMdd"
));
block2
.
setMIRLogicalTerminal
(
processBicCode
(
senderBic
));
block2
.
setMIRSessionNumber
(
getRandomNumber
(
4
));
block2
.
setMIRSequenceNumber
(
getRandomNumber
(
6
));
...
...
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