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
a61b6569
Commit
a61b6569
authored
Jul 28, 2022
by
chengzhuoshen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加MT920转CAMT06000105.xml的代码
parent
0889c5e3
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
350 additions
and
14 deletions
+350
-14
Mt2MxCreatorManager.java
.../java/com/brilliance/swift/mt2mx/Mt2MxCreatorManager.java
+6
-4
AbstractMt2MxCamt060001ParseField.java
...t/mt2mx/camt060001/AbstractMt2MxCamt060001ParseField.java
+43
-0
Mt2MxCamt060001Creator.java
...liance/swift/mt2mx/camt060001/Mt2MxCamt060001Creator.java
+50
-0
Camt060001Parse12Field.java
...e/swift/mt2mx/camt060001/impl/Camt060001Parse12Field.java
+43
-0
Camt060001Parse20Field.java
...e/swift/mt2mx/camt060001/impl/Camt060001Parse20Field.java
+20
-0
Camt060001Parse25Field.java
...e/swift/mt2mx/camt060001/impl/Camt060001Parse25Field.java
+61
-0
Camt060001Parse34FField.java
.../swift/mt2mx/camt060001/impl/Camt060001Parse34FField.java
+93
-0
Field34CGenerate.java
...m/brilliance/swift/mx2mt/mt920/impl/Field34CGenerate.java
+1
-1
Field34DGenerate.java
...m/brilliance/swift/mx2mt/mt920/impl/Field34DGenerate.java
+1
-1
MxCamt06000105.xml
swiftCore/src/main/resources/swiftXml/MxCamt06000105.xml
+15
-8
Test.java
...e/src/test/java/com/brilliance/mt2mx/camt060001/Test.java
+17
-0
No files found.
swiftCore/src/main/java/com/brilliance/swift/mt2mx/Mt2MxCreatorManager.java
View file @
a61b6569
...
...
@@ -7,6 +7,7 @@ import com.brilliance.swift.mt2mx.camt053001.Mt2MxCamt053001Creator;
import
com.brilliance.swift.mt2mx.camt054001.Mt2MxCamt054001Creator
;
import
com.brilliance.swift.mt2mx.camt056001.Mt2MxCamt056001Creator
;
import
com.brilliance.swift.mt2mx.camt057001.Mt2MxCamt057001Creator
;
import
com.brilliance.swift.mt2mx.camt060001.Mt2MxCamt060001Creator
;
import
com.brilliance.swift.mt2mx.pacs002001.Mt2MxPacs002001Creator
;
import
com.brilliance.swift.mt2mx.pacs004001.Mt2MxPacs004001Creator
;
import
com.brilliance.swift.mt2mx.pacs008001.Mt2MxPacs008001Creator
;
...
...
@@ -70,12 +71,13 @@ public class Mt2MxCreatorManager {
return
new
Mt2MxCamt054001Creator
();
}
else
if
(
"940"
.
equals
(
messageType
)||
"950"
.
equals
(
messageType
))
{
return
new
Mt2MxCamt053001Creator
();
}
else
if
(
"942"
.
equals
(
messageType
)){
}
else
if
(
"942"
.
equals
(
messageType
)){
return
new
Mt2MxCamt052001Creator
();
}
else
if
(
"210"
.
equals
(
messageType
)){
}
else
if
(
"210"
.
equals
(
messageType
)){
return
new
Mt2MxCamt057001Creator
();
}
else
{
}
else
if
(
"920"
.
equals
(
messageType
))
{
return
new
Mt2MxCamt060001Creator
();
}
else
{
throw
new
SwiftException
(
"Invalid message type"
);
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt060001/AbstractMt2MxCamt060001ParseField.java
0 → 100644
View file @
a61b6569
package
com
.
brilliance
.
swift
.
mt2mx
.
camt060001
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.mt2mx.AbstractMt2MxParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
public
abstract
class
AbstractMt2MxCamt060001ParseField
extends
AbstractMt2MxParseField
{
protected
Map
<
String
,
Object
>
appHdrMaps
=
null
;
protected
Map
<
String
,
Object
>
grpHdrMaps
=
null
;
protected
JSONArray
rptgReqJsonArray
=
null
;
protected
List
<
List
<
Tag
>>
list
=
new
ArrayList
<>();
@Override
public
void
initJsonMaps
()
{
super
.
initJsonMaps
();
appHdrMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"appHdr"
);
Map
<
String
,
Object
>
acctRptgReqMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"acctRptgReq"
);
grpHdrMaps
=
(
Map
<
String
,
Object
>)
acctRptgReqMaps
.
get
(
"grpHdr"
);
rptgReqJsonArray
=
(
JSONArray
)
acctRptgReqMaps
.
get
(
"rptgReq"
);
List
<
Tag
>
tags
=
null
;
List
<
Tag
>
tagList
=
context
.
get
(
AbstractMT
.
class
).
getSwiftMessage
().
getBlock4
().
getTags
();
for
(
int
i
=
0
;
i
<
tagList
.
size
();
i
++)
{
Tag
tag
=
tagList
.
get
(
i
);
if
(
"12"
.
equals
(
tag
.
getName
()))
{
tags
=
new
ArrayList
<>();
tags
.
add
(
tag
);
list
.
add
(
tags
);
}
else
if
(
tags
!=
null
){
tags
.
add
(
tag
);
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt060001/Mt2MxCamt060001Creator.java
0 → 100644
View file @
a61b6569
package
com
.
brilliance
.
swift
.
mt2mx
.
camt060001
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.mt2mx.AbstractMt2MxCreator
;
import
com.brilliance.swift.mt2mx.Mt2MxParseField
;
import
com.brilliance.swift.mt2mx.camt060001.impl.*
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
Mt2MxCamt060001Creator
extends
AbstractMt2MxCreator
{
@Override
public
void
preProcess
()
{
super
.
preProcess
();
jsonMaps
.
put
(
"identifier"
,
"camt.060.001.05"
);
Map
<
String
,
Object
>
appHdrMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"appHdr"
);
appHdrMaps
.
put
(
"msgDefIdr"
,
"camt.060.001.05"
);
appHdrMaps
.
put
(
"bizSvc"
,
"swift.cbprplus.02"
);
Map
<
String
,
Object
>
acctRptgReqMaps
=
new
HashMap
<>();
jsonMaps
.
put
(
"acctRptgReq"
,
acctRptgReqMaps
);
Map
<
String
,
Object
>
grpHdrMaps
=
new
HashMap
<>();
acctRptgReqMaps
.
put
(
"grpHdr"
,
grpHdrMaps
);
grpHdrMaps
.
put
(
"creDtTm"
,
getCreateDateStr
());
JSONArray
rptgReqJsonArray
=
new
JSONArray
();
acctRptgReqMaps
.
put
(
"rptgReq"
,
rptgReqJsonArray
);
}
@Override
public
List
<
Mt2MxParseField
>
getParseFieldList
()
{
List
<
Mt2MxParseField
>
list
=
new
ArrayList
<>();
list
.
add
(
new
Camt060001Parse20Field
());
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
[]
tags
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagsByName
(
"12"
);
if
(
tags
!=
null
&&
tags
.
length
>
0
)
{
for
(
int
i
=
0
;
i
<
tags
.
length
;
i
++)
{
list
.
add
(
new
Camt060001Parse12Field
(
i
));
list
.
add
(
new
Camt060001Parse25Field
(
i
));
list
.
add
(
new
Camt060001Parse34FField
(
i
));
}
}
return
list
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt060001/impl/Camt060001Parse12Field.java
0 → 100644
View file @
a61b6569
package
com
.
brilliance
.
swift
.
mt2mx
.
camt060001
.
impl
;
import
com.brilliance.swift.mt2mx.camt060001.AbstractMt2MxCamt060001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
Camt060001Parse12Field
extends
AbstractMt2MxCamt060001ParseField
{
private
static
final
String
NAME
=
"12"
;
private
int
index
=
-
1
;
//存在多个域循环, 表示xml节点的下标.
public
Camt060001Parse12Field
(
int
index
)
{
this
.
index
=
index
;
}
@Override
public
void
parseField
()
{
List
<
Tag
>
tags
=
list
.
get
(
index
);
if
(
tags
!=
null
&&
tags
.
size
()
>
0
)
{
Tag
tag
=
null
;
for
(
int
i
=
0
;
i
<
tags
.
size
();
i
++)
{
if
(
NAME
.
equals
(
tags
.
get
(
i
).
getName
()))
{
tag
=
tags
.
get
(
i
);
break
;
}
}
if
(
tag
!=
null
)
{
Map
<
String
,
Object
>
rptgReqMaps
=
null
;
if
(
rptgReqJsonArray
.
size
()
==
(
index
+
1
))
{
rptgReqMaps
=
(
Map
<
String
,
Object
>)
rptgReqJsonArray
.
get
(
index
);
}
else
{
rptgReqMaps
=
new
HashMap
<>();
rptgReqJsonArray
.
add
(
rptgReqMaps
);
}
rptgReqMaps
.
put
(
"reqdMsgNmId"
,
"MT"
+
tag
.
getValue
());
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt060001/impl/Camt060001Parse20Field.java
0 → 100644
View file @
a61b6569
package
com
.
brilliance
.
swift
.
mt2mx
.
camt060001
.
impl
;
import
com.brilliance.swift.mt2mx.camt060001.AbstractMt2MxCamt060001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
public
class
Camt060001Parse20Field
extends
AbstractMt2MxCamt060001ParseField
{
private
static
final
String
NAME
=
"20"
;
@Override
public
void
parseField
()
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag20
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag20
!=
null
)
{
grpHdrMaps
.
put
(
"msgId"
,
tag20
.
getValue
());
appHdrMaps
.
put
(
"bizMsgIdr"
,
tag20
.
getValue
());
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt060001/impl/Camt060001Parse25Field.java
0 → 100644
View file @
a61b6569
package
com
.
brilliance
.
swift
.
mt2mx
.
camt060001
.
impl
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.camt060001.AbstractMt2MxCamt060001ParseField
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.Tag
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
Camt060001Parse25Field
extends
AbstractMt2MxCamt060001ParseField
{
private
static
final
String
NAME
=
"25"
;
private
int
index
=
-
1
;
//存在多个域循环, 表示xml节点的下标.
public
Camt060001Parse25Field
(
int
index
)
{
this
.
index
=
index
;
}
@Override
public
void
parseField
()
{
List
<
Tag
>
tags
=
list
.
get
(
index
);
if
(
tags
!=
null
&&
tags
.
size
()
>
0
)
{
Tag
tag
=
null
;
for
(
int
i
=
0
;
i
<
tags
.
size
();
i
++)
{
if
(
NAME
.
equals
(
tags
.
get
(
i
).
getName
()))
{
tag
=
tags
.
get
(
i
);
break
;
}
}
if
(
tag
!=
null
)
{
Map
<
String
,
Object
>
rptgReqMaps
=
null
;
if
(
rptgReqJsonArray
.
size
()
==
(
index
+
1
))
{
rptgReqMaps
=
(
Map
<
String
,
Object
>)
rptgReqJsonArray
.
get
(
index
);
}
else
{
rptgReqMaps
=
new
HashMap
<>();
rptgReqJsonArray
.
add
(
rptgReqMaps
);
}
Map
<
String
,
Object
>
acctMaps
=
null
;
if
(
rptgReqMaps
.
containsKey
(
"acct"
))
{
acctMaps
=
(
Map
<
String
,
Object
>)
rptgReqMaps
.
get
(
"acct"
);
}
else
{
acctMaps
=
new
HashMap
<>();
rptgReqMaps
.
put
(
"acct"
,
acctMaps
);
}
mt_to_mxAccount35
(
tag
.
getValue
(),
acctMaps
,
"AcctRptgReq/RptgReq/Acct/Id/Othr/Id"
);
String
sendBic
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_SEND_BIC
,
true
);
if
(
StringUtil
.
isNotEmpty
(
sendBic
))
{
Map
<
String
,
Object
>
acctOwnrMaps
=
new
HashMap
<>();
rptgReqMaps
.
put
(
"acctOwnr"
,
acctOwnrMaps
);
Map
<
String
,
Object
>
agtMaps
=
new
HashMap
<>();
acctOwnrMaps
.
put
(
"agt"
,
agtMaps
);
mt_to_mxBICFI
(
sendBic
,
agtMaps
);
}
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt060001/impl/Camt060001Parse34FField.java
0 → 100644
View file @
a61b6569
package
com
.
brilliance
.
swift
.
mt2mx
.
camt060001
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.mt2mx.camt060001.AbstractMt2MxCamt060001ParseField
;
import
com.brilliance.swift.vo.common.CdtDbtCode
;
import
com.brilliance.swift.vo.common.EntryStatusCode
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field34F
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
Camt060001Parse34FField
extends
AbstractMt2MxCamt060001ParseField
{
private
static
final
String
NAME
=
"34F"
;
private
int
index
=
-
1
;
//存在多个域循环, 表示xml节点的下标.
public
Camt060001Parse34FField
(
int
index
)
{
this
.
index
=
index
;
}
@Override
public
void
parseField
()
{
List
<
Tag
>
tags
=
list
.
get
(
index
);
if
(
tags
!=
null
&&
tags
.
size
()
>
0
)
{
List
<
Tag
>
tag34List
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
tags
.
size
();
i
++)
{
if
(
NAME
.
equals
(
tags
.
get
(
i
).
getName
()))
{
tag34List
.
add
(
tags
.
get
(
i
));
}
}
if
(
tag34List
.
size
()
>
0
)
{
Map
<
String
,
Object
>
rptgReqMaps
=
null
;
if
(
rptgReqJsonArray
.
size
()
==
(
index
+
1
))
{
rptgReqMaps
=
(
Map
<
String
,
Object
>)
rptgReqJsonArray
.
get
(
index
);
}
else
{
rptgReqMaps
=
new
HashMap
<>();
rptgReqJsonArray
.
add
(
rptgReqMaps
);
}
Map
<
String
,
Object
>
reqdTxTpMaps
=
null
;
if
(
rptgReqMaps
.
containsKey
(
"reqdTxTp"
))
{
reqdTxTpMaps
=
(
Map
<
String
,
Object
>)
rptgReqMaps
.
get
(
"reqdTxTp"
);
}
else
{
reqdTxTpMaps
=
new
HashMap
<>();
rptgReqMaps
.
put
(
"reqdTxTp"
,
reqdTxTpMaps
);
}
//设置 Status节点
Map
<
String
,
Object
>
stsMaps
=
null
;
if
(
reqdTxTpMaps
.
containsKey
(
"sts"
))
{
stsMaps
=
(
Map
<
String
,
Object
>)
reqdTxTpMaps
.
get
(
"sts"
);
}
else
{
stsMaps
=
new
HashMap
<>();
reqdTxTpMaps
.
put
(
"sts"
,
stsMaps
);
}
stsMaps
.
put
(
"cd"
,
EntryStatusCode
.
INFO
.
value
());
BigDecimal
crAmt
=
BigDecimal
.
ZERO
;
BigDecimal
drAmt
=
BigDecimal
.
ZERO
;
JSONArray
flrLmtJsonArray
=
null
;
if
(
reqdTxTpMaps
.
containsKey
(
"flrLmt"
))
{
flrLmtJsonArray
=
(
JSONArray
)
reqdTxTpMaps
.
get
(
"flrLmt"
);
}
else
{
flrLmtJsonArray
=
new
JSONArray
();
reqdTxTpMaps
.
put
(
"flrLmt"
,
flrLmtJsonArray
);
}
for
(
Tag
tag
:
tag34List
)
{
Map
<
String
,
Object
>
flrLmtMaps
=
new
HashMap
<>();
Field34F
field34
=
(
Field34F
)
tag
.
asField
();
if
(
"C"
.
equals
(
field34
.
getDCMark
()))
{
crAmt
=
crAmt
.
add
(
field34
.
amount
());
flrLmtMaps
.
put
(
"cdtDbtInd"
,
"CRED"
);
}
else
{
drAmt
=
drAmt
.
add
(
field34
.
amount
());
flrLmtMaps
.
put
(
"cdtDbtInd"
,
"DEBT"
);
}
Map
<
String
,
Object
>
amtMaps
=
new
HashMap
<>();
amtMaps
.
put
(
"ccy"
,
field34
.
getCurrency
());
amtMaps
.
put
(
"value"
,
field34
.
amount
());
flrLmtMaps
.
put
(
"amt"
,
amtMaps
);
flrLmtJsonArray
.
add
(
flrLmtMaps
);
}
if
(
crAmt
.
compareTo
(
drAmt
)
>
-
1
)
{
reqdTxTpMaps
.
put
(
"cdtDbtInd"
,
CdtDbtCode
.
CRDT
.
value
());
}
else
{
reqdTxTpMaps
.
put
(
"cdtDbtInd"
,
CdtDbtCode
.
DBIT
.
value
());
}
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt920/impl/Field34CGenerate.java
View file @
a61b6569
...
...
@@ -11,7 +11,7 @@ import java.util.List;
public
class
Field34CGenerate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
NAME
=
"34"
;
private
static
String
NAME
=
"34
F
"
;
private
int
index
=
-
1
;
//存在多个域循环, 表示xml节点的下标.
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt920/impl/Field34DGenerate.java
View file @
a61b6569
...
...
@@ -11,7 +11,7 @@ import java.util.List;
public
class
Field34DGenerate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
NAME
=
"34"
;
private
static
String
NAME
=
"34
F
"
;
private
int
index
=
-
1
;
//存在多个域循环, 表示xml节点的下标.
...
...
swiftCore/src/main/resources/swiftXml/MxCamt06000105.xml
View file @
a61b6569
...
...
@@ -56,23 +56,30 @@ Change Log
</Othr>
</Id>
</Acct>
<AcctOwnr>
<Agt>
<FinInstnId>
<BICFI>
ABNANL2A
</BICFI>
</FinInstnId>
</Agt>
</AcctOwnr>
<ReqdTxTp>
<Sts>
<Cd>
PDNG
</Cd>
<Cd>
INFO
</Cd>
</Sts>
<CdtDbtInd>
CRDT
</CdtDbtInd>
<FlrLmt>
<Amt
Ccy=
"
KWR
"
>
123.45
</Amt>
<Amt
Ccy=
"
USD
"
>
123.45
</Amt>
<CdtDbtInd>
DEBT
</CdtDbtInd>
</FlrLmt>
<FlrLmt>
<Amt
Ccy=
"
KWR
"
>
3456.50
</Amt>
<Amt
Ccy=
"
USD
"
>
3456.50
</Amt>
<CdtDbtInd>
CRED
</CdtDbtInd>
</FlrLmt>
</ReqdTxTp>
</RptgReq>
<RptgReq>
<Id>
cmt060bizmsgidr-00
1
</Id>
<Id>
cmt060bizmsgidr-00
2
</Id>
<ReqdMsgNmId>
camt.052.001.08
</ReqdMsgNmId>
<Acct>
<Id>
...
...
@@ -90,15 +97,15 @@ Change Log
</AcctOwnr>
<ReqdTxTp>
<Sts>
<Cd>
PDNG
</Cd>
<Cd>
INFO
</Cd>
</Sts>
<CdtDbtInd>
CRD
T
</CdtDbtInd>
<CdtDbtInd>
DBI
T
</CdtDbtInd>
<FlrLmt>
<Amt
Ccy=
"
KWD"
>
7878.5687
</Amt>
<Amt
Ccy=
"
USD"
>
7878.56
</Amt>
<CdtDbtInd>
DEBT
</CdtDbtInd>
</FlrLmt>
<FlrLmt>
<Amt
Ccy=
"
KWD"
>
1234.4563
</Amt>
<Amt
Ccy=
"
USD"
>
1234.46
</Amt>
<CdtDbtInd>
CRED
</CdtDbtInd>
</FlrLmt>
</ReqdTxTp>
...
...
swiftCore/src/test/java/com/brilliance/mt2mx/camt060001/Test.java
0 → 100644
View file @
a61b6569
package
com
.
brilliance
.
mt2mx
.
camt060001
;
import
com.brilliance.swift.SwiftTransfer
;
import
org.apache.commons.io.FileUtils
;
import
java.io.File
;
import
java.io.IOException
;
public
class
Test
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
File
file
=
new
File
(
"D:/test/MT920.txt"
);
String
mtStr
=
FileUtils
.
readFileToString
(
file
);
String
xmlStr
=
SwiftTransfer
.
mt2Mx
(
mtStr
,
null
,
null
);
System
.
out
.
println
(
xmlStr
);
}
}
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