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
8e3f2963
Commit
8e3f2963
authored
May 07, 2022
by
chengzhuoshen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.swiftDto增加属性version
parent
18c184ec
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
93 additions
and
40 deletions
+93
-40
Mt2SwiftDtoPCamt053001Creator.java
...mt2SwiftDto/camt053001/Mt2SwiftDtoPCamt053001Creator.java
+1
-0
Mt2SwiftDtoPCamt054001Creator.java
...mt2SwiftDto/camt054001/Mt2SwiftDtoPCamt054001Creator.java
+1
-0
Mt2SwiftDtoPacs008001Creator.java
.../mt2SwiftDto/pacs008001/Mt2SwiftDtoPacs008001Creator.java
+1
-0
Mt2SwiftDtoPacs009001Creator.java
.../mt2SwiftDto/pacs009001/Mt2SwiftDtoPacs009001Creator.java
+1
-0
Mx2SwiftDtoContextIdentifier.java
...iance/swift/mx2swiftdto/Mx2SwiftDtoContextIdentifier.java
+2
-0
Mx2SwiftDtoCreatorManager.java
...illiance/swift/mx2swiftdto/Mx2SwiftDtoCreatorManager.java
+4
-0
Mx2SwiftDtoBTCDCNCreator.java
...ift/mx2swiftdto/bankcdbcdnf/Mx2SwiftDtoBTCDCNCreator.java
+2
-0
Mx2SwiftDtoBTCSCreator.java
...e/swift/mx2swiftdto/bankcusta/Mx2SwiftDtoBTCSCreator.java
+2
-0
Mx2SwiftDtoCCTCreator.java
...e/swift/mx2swiftdto/custcdttsf/Mx2SwiftDtoCCTCreator.java
+2
-0
Mx2SwiftDtoFICTCreator.java
...ift/mx2swiftdto/fininstcdttsf/Mx2SwiftDtoFICTCreator.java
+2
-0
SwiftDto.java
...tCore/src/main/java/com/brilliance/swift/vo/SwiftDto.java
+10
-0
BankToCustomerStatement.json
...src/main/resources/swiftJson/BankToCustomerStatement.json
+2
-0
BankToStatement.json
swiftCore/src/main/resources/swiftJson/BankToStatement.json
+40
-27
MT940.txt
swiftCore/src/main/resources/swiftTxt/MT940.txt
+1
-1
MT950.txt
swiftCore/src/main/resources/swiftTxt/MT950.txt
+1
-1
TestPacs008001.java
...com/brilliance/mt2swiftdto/pacs008001/TestPacs008001.java
+3
-6
Test.java
.../src/test/java/com/brilliance/swiftdto2mt/mt940/Test.java
+18
-5
No files found.
swiftCore/src/main/java/com/brilliance/swift/mt2SwiftDto/camt053001/Mt2SwiftDtoPCamt053001Creator.java
View file @
8e3f2963
...
...
@@ -30,6 +30,7 @@ public class Mt2SwiftDtoPCamt053001Creator extends AbstractMt2SwiftDtoCreator {
bankToCustomerStatement
.
setMessagePriority
(
swiftDto
.
getMessagePriority
());
bankToCustomerStatement
.
setUetr
(
swiftDto
.
getUetr
());
bankToCustomerStatement
.
setMessageType
(
"camt.053.001"
);
bankToCustomerStatement
.
setVersion
(
"08"
);
context
.
set
(
bankToCustomerStatement
);
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2SwiftDto/camt054001/Mt2SwiftDtoPCamt054001Creator.java
View file @
8e3f2963
...
...
@@ -31,6 +31,7 @@ public class Mt2SwiftDtoPCamt054001Creator extends AbstractMt2SwiftDtoCreator {
bankToCustomerDebitCreditNotification
.
setMessagePriority
(
swiftDto
.
getMessagePriority
());
bankToCustomerDebitCreditNotification
.
setUetr
(
swiftDto
.
getUetr
());
bankToCustomerDebitCreditNotification
.
setMessageType
(
"camt.054.001"
);
bankToCustomerDebitCreditNotification
.
setVersion
(
"08"
);
context
.
set
(
bankToCustomerDebitCreditNotification
);
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2SwiftDto/pacs008001/Mt2SwiftDtoPacs008001Creator.java
View file @
8e3f2963
...
...
@@ -29,6 +29,7 @@ public class Mt2SwiftDtoPacs008001Creator extends AbstractMt2SwiftDtoCreator {
customerCreditTransfer
.
setMessagePriority
(
swiftDto
.
getMessagePriority
());
customerCreditTransfer
.
setUetr
(
swiftDto
.
getUetr
());
customerCreditTransfer
.
setMessageType
(
"pacs.008.001"
);
customerCreditTransfer
.
setVersion
(
"09"
);
context
.
set
(
customerCreditTransfer
);
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2SwiftDto/pacs009001/Mt2SwiftDtoPacs009001Creator.java
View file @
8e3f2963
...
...
@@ -28,6 +28,7 @@ public class Mt2SwiftDtoPacs009001Creator extends AbstractMt2SwiftDtoCreator {
financialInstitutionCreditTransfer
.
setMessagePriority
(
swiftDto
.
getMessagePriority
());
financialInstitutionCreditTransfer
.
setUetr
(
swiftDto
.
getUetr
());
financialInstitutionCreditTransfer
.
setMessageType
(
"pacs.009.001"
);
financialInstitutionCreditTransfer
.
setVersion
(
"09"
);
context
.
set
(
financialInstitutionCreditTransfer
);
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2swiftdto/Mx2SwiftDtoContextIdentifier.java
View file @
8e3f2963
...
...
@@ -6,6 +6,8 @@ public class Mx2SwiftDtoContextIdentifier {
public
static
final
String
MX_OBJ
=
"mx.obj"
;
public
static
final
String
MX_VERSION
=
"mx.version"
;
public
static
final
String
APPHDR_PARENT_ELEMENT_NAME
=
"apphdr.parent.element.name"
;
public
static
final
String
GRPHDR_PARENT_ELEMENT_NAME
=
"grphdr.parent.element.name"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2swiftdto/Mx2SwiftDtoCreatorManager.java
View file @
8e3f2963
...
...
@@ -17,6 +17,8 @@ public class Mx2SwiftDtoCreatorManager {
private
String
msgType
=
""
;
private
String
version
=
""
;
private
Object
mxObj
=
null
;
private
String
xmlStr
=
""
;
...
...
@@ -31,6 +33,7 @@ public class Mx2SwiftDtoCreatorManager {
.
replace
(
"."
,
""
);
mxObj
=
abstractMX
;
this
.
xmlStr
=
xmlStr
;
version
=
abstractMX
.
getMxId
().
getVersion
();
}
public
SwiftDto
convert
(
String
xmlStr
,
String
outPutFilePath
,
Map
<
String
,
Object
>
extraMap
)
throws
SwiftException
{
...
...
@@ -42,6 +45,7 @@ public class Mx2SwiftDtoCreatorManager {
Document
document
=
DocumentHelper
.
parseText
(
xmlStr
);
context
.
set
(
Mx2SwiftDtoContextIdentifier
.
MX_XMl_DOCUMENT
,
document
);
context
.
set
(
Mx2SwiftDtoContextIdentifier
.
MX_OBJ
,
mxObj
);
context
.
set
(
Mx2SwiftDtoContextIdentifier
.
MX_VERSION
,
version
);
AbstractMx2SwiftDtoCreator
creator
=
getMx2SwiftDtoCreator
(
msgType
);
creator
.
setContext
(
context
);
creator
.
preProcess
();
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2swiftdto/bankcdbcdnf/Mx2SwiftDtoBTCDCNCreator.java
View file @
8e3f2963
...
...
@@ -35,6 +35,8 @@ public class Mx2SwiftDtoBTCDCNCreator extends AbstractMx2SwiftDtoCreator {
bodyHdrParentElementName
=
parentElementMaps
.
get
(
"Ntfctn"
);
bankToCustomerDebitCreditNotification
=
new
BankToCustomerDebitCreditNotification
();
bankToCustomerDebitCreditNotification
.
setMessageType
(
"camt.054.001"
);
String
version
=
(
String
)
context
.
get
(
Mx2SwiftDtoContextIdentifier
.
MX_VERSION
,
true
);
bankToCustomerDebitCreditNotification
.
setVersion
(
StringUtil
.
isEmpty
(
version
)?
"08"
:
version
);
}
@Override
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2swiftdto/bankcusta/Mx2SwiftDtoBTCSCreator.java
View file @
8e3f2963
...
...
@@ -34,6 +34,8 @@ public class Mx2SwiftDtoBTCSCreator extends AbstractMx2SwiftDtoCreator {
bodyHdrParentElementName
=
parentElementMaps
.
get
(
"Stmt"
);
bankToCustomerStatement
=
new
BankToCustomerStatement
();
bankToCustomerStatement
.
setMessageType
(
"camt.053.001"
);
String
version
=
(
String
)
context
.
get
(
Mx2SwiftDtoContextIdentifier
.
MX_VERSION
,
true
);
bankToCustomerStatement
.
setVersion
(
StringUtil
.
isEmpty
(
version
)?
"08"
:
version
);
}
@Override
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2swiftdto/custcdttsf/Mx2SwiftDtoCCTCreator.java
View file @
8e3f2963
...
...
@@ -38,6 +38,8 @@ public class Mx2SwiftDtoCCTCreator extends AbstractMx2SwiftDtoCreator {
bodyHdrParentElementName
=
parentElementMaps
.
get
(
"CdtTrfTxInf"
);
customerCreditTransfer
=
new
VoCustomerCreditTransfer
();
customerCreditTransfer
.
setMessageType
(
"pacs.008.001"
);
String
version
=
(
String
)
context
.
get
(
Mx2SwiftDtoContextIdentifier
.
MX_VERSION
,
true
);
customerCreditTransfer
.
setVersion
(
StringUtil
.
isEmpty
(
version
)?
"09"
:
version
);
}
@Override
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2swiftdto/fininstcdttsf/Mx2SwiftDtoFICTCreator.java
View file @
8e3f2963
...
...
@@ -34,6 +34,8 @@ public class Mx2SwiftDtoFICTCreator extends AbstractMx2SwiftDtoCreator {
bodyHdrParentElementName
=
parentElementMaps
.
get
(
"CdtTrfTxInf"
);
financialInstitutionCreditTransfer
=
new
VoFinancialInstitutionCreditTransfer
();
financialInstitutionCreditTransfer
.
setMessageType
(
"pacs.009.001"
);
String
version
=
(
String
)
context
.
get
(
Mx2SwiftDtoContextIdentifier
.
MX_VERSION
,
true
);
financialInstitutionCreditTransfer
.
setVersion
(
StringUtil
.
isEmpty
(
version
)?
"09"
:
version
);
}
@Override
...
...
swiftCore/src/main/java/com/brilliance/swift/vo/SwiftDto.java
View file @
8e3f2963
...
...
@@ -13,6 +13,8 @@ public class SwiftDto implements Serializable {
private
static
final
long
serialVersionUID
=
2296248553989810638L
;
protected
String
messageType
;
protected
String
version
;
protected
String
senderBic
;
protected
String
receiverBic
;
...
...
@@ -33,6 +35,14 @@ public class SwiftDto implements Serializable {
this
.
messageType
=
messageType
;
}
public
String
getVersion
()
{
return
version
;
}
public
void
setVersion
(
String
version
)
{
this
.
version
=
version
;
}
public
String
getSenderBic
()
{
return
senderBic
;
}
...
...
swiftCore/src/main/resources/swiftJson/BankToCustomerStatement.json
View file @
8e3f2963
...
...
@@ -2,6 +2,8 @@
"account"
:
{
"account"
:
"15612345678012345"
},
"pgNb"
:
"178"
,
"elctrncSeqNb"
:
"200"
,
"openingBalance"
:
{
"code"
:
"ITBD"
,
"cdtDbtCode"
:
"DBIT"
,
...
...
swiftCore/src/main/resources/swiftJson/BankToStatement.json
View file @
8e3f2963
{
"cd"
:
""
,
"account"
:
{
"account"
:
"
S
15612345678012345"
"account"
:
"15612345678012345"
},
"pgNb"
:
"178"
,
"elctrncSeqNb"
:
"200"
,
"openingBalance"
:
{
"c
d
"
:
"ITBD"
,
"
CdtDbtInd
"
:
"DBIT"
,
"c
ode
"
:
"ITBD"
,
"
cdtDbtCode
"
:
"DBIT"
,
"date"
:
"2022-03-30 00:00:00,000"
,
"ccy"
:
"USD"
,
"amt"
:
120274.34
"amt"
:
{
"ccy"
:
"USD"
,
"amt"
:
120274.34
}
},
"
statementLine
"
:
[
"
reportEntries
"
:
[
{
"valueDate"
:
"2022-03-30 00:00:00,000"
,
"BookDate"
:
"2022-03-30 00:00:00,000"
,
"cdtDbtInd"
:
"DBIT"
,
"rvslInd"
:
"false"
,
"ccy"
:
"USD"
,
"amt"
:
393.17
,
"transactionType"
:
"F"
,
"identificationCode"
:
"CHK"
,
"bookDate"
:
"2022-03-30 00:00:00,000"
,
"cdtDbtCode"
:
"DBIT"
,
"amt"
:
{
"ccy"
:
"USD"
,
"amt"
:
393.17
},
"bankTransactionCodeStructure"
:
{
"domianCode"
:
"PMNT"
,
"familyCode"
:
"ICHQ"
,
"subFamilyCode"
:
"CCHQ"
},
"endToEndId"
:
"S100000189-735"
,
"acctSvcrRef"
:
"1309170100000390154395"
,
"addtlTxInf"
:
"PLACI LOVECNAMENSKIH WUHAN"
},
{
"valueDate"
:
"2022-03-30 00:00:00,000"
,
"BookDate"
:
"2022-03-30 00:00:00,000"
,
"cdtDbtInd"
:
"DBIT"
,
"rvslInd"
:
"false"
,
"ccy"
:
"USD"
,
"amt"
:
445
,
"transactionType"
:
"F"
,
"identificationCode"
:
"CHK"
,
"bookDate"
:
"2022-03-30 00:00:00,000"
,
"cdtDbtCode"
:
"DBIT"
,
"amt"
:
{
"ccy"
:
"USD"
,
"amt"
:
445
},
"bankTransactionCodeStructure"
:
{
"domianCode"
:
"PMNT"
,
"familyCode"
:
"ICHQ"
,
"subFamilyCode"
:
"CCHQ"
},
"endToEndId"
:
"S100000189-735"
,
"acctSvcrRef"
:
"1309170100000390154395"
,
"addtlTxInf"
:
"PLACI LOVECNAMENSKIH STORITEV"
}
],
"closingBalance"
:
{
"c
d
"
:
"ITBD"
,
"
CdtDbtInd
"
:
"DBIT"
,
"c
ode
"
:
"ITBD"
,
"
cdtDbtCode
"
:
"DBIT"
,
"date"
:
"2022-03-30 00:00:00,000"
,
"ccy"
:
"USD"
,
"amt"
:
123456.29
"amt"
:
{
"ccy"
:
"USD"
,
"amt"
:
123456.29
}
},
"messageType"
:
"camt.053.001"
,
"version"
:
"08"
,
"senderBic"
:
"SHWHQWER123"
,
"receiverBic"
:
"BJWHS12X"
,
"createDate"
:
"2022-0
4-28 10:24:00,960
"
,
"createDate"
:
"2022-0
5-07 11:39:42,601
"
,
"messagePriority"
:
"NORM"
,
"messageId"
:
"00010013800002001234"
,
"uetr"
:
"8a562c67-ca16-48ba-b074-65581be6f001"
}
}
\ No newline at end of file
swiftCore/src/main/resources/swiftTxt/MT940.txt
View file @
8e3f2963
{1:F01BJWHS12XAXXX7583545445}{2:O9401023220428SHWHQWERA12348676666142205051522N}{3:{108:2205051522140540}{121:8a562c67-ca16-48ba-b074-65581be6f001}}{4:
:20:00010013800002001234
:25:S15612345678012345
:28:178/200
:28
C
:178/200
:60M:D220330USD120274,34
:61:220330220330CUSD393,17FCHKS100000189-735//1309170100000390154395
PLACI LOVECNAMENSKIH WUHAN
...
...
swiftCore/src/main/resources/swiftTxt/MT950.txt
View file @
8e3f2963
{1:F01BJWHS12XAXXX3202321018}{2:O9401024220428SHWHQWERA12308503578012205051522N}{3:{108:2205051522260719}{121:8a562c67-ca16-48ba-b074-65581be6f001}}{4:
:20:00010013800002001234
:25:S15612345678012345
:28:178/200
:28
C
:178/200
:60M:D220330USD120274,34
:61:220330220330DUSD393,17FCHKS100000189-735//1309170100000390154395
PLACI LOVECNAMENSKIH WUHAN
...
...
swiftCore/src/test/java/com/brilliance/mt2swiftdto/pacs008001/TestPacs008001.java
View file @
8e3f2963
package
com
.
brilliance
.
mt2swiftdto
.
pacs008001
;
import
com.brilliance.swift.SwiftTransfer
;
import
java.io.File
;
public
class
TestPacs008001
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftTxt\\MT103.txt"
);
//String xmlStr = new Mt2MxCreateManager().mt2mx(file, "d:/test/pacs008.xml", null);
//System.out.println(xmlStr);
//SwiftDto swiftDto = new Mt2MxCreateManager().mt2SwiftDto(file, "d:/test/pacs008.txt");
// SwiftDto swiftDto = new Mt2MxCreateManager().mt2SwiftDto(file, "D:/test/CustomerCreditTransfer.json");
//System.out.println(swiftDto.toString());
SwiftTransfer
.
mt2SwiftDto
(
file
,
"D:/test/CustomerCreditTransfer.json"
,
null
);
}
}
swiftCore/src/test/java/com/brilliance/swiftdto2mt/mt940/Test.java
View file @
8e3f2963
package
com
.
brilliance
.
swiftdto2mt
.
mt940
;
import
com.brilliance.swift.SwiftTransfer
;
import
org.apache.commons.io.FileUtils
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
Test
{
public
static
void
main
(
String
[]
args
)
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftJson\\BankToCustomerStatement.json"
);
String
mtStr
=
SwiftTransfer
.
swiftDto2Mt
(
file
,
"D:/SwiftToMt/MT940.txt"
,
null
);
System
.
out
.
println
(
mtStr
);
public
static
void
main
(
String
[]
args
)
throws
IOException
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\BankTransactionCode.Properties"
);
List
<
String
>
strings
=
FileUtils
.
readLines
(
file
);
Map
<
String
,
String
>
maps
=
new
HashMap
<>();
for
(
String
s
:
strings
)
{
if
(!
s
.
startsWith
(
"#"
))
{
String
[]
arr
=
s
.
split
(
"="
);
if
(
arr
.
length
==
2
)
{
maps
.
put
(
arr
[
0
],
arr
[
1
]);
}
}
}
maps
.
forEach
((
k
,
v
)->
System
.
out
.
println
(
k
+
"="
+
v
));
}
}
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