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
5e157cef
Commit
5e157cef
authored
Jul 22, 2022
by
zhanghou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成mt格式到mx格式camt系列报文的修改
parent
07dd6283
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
59 changed files
with
152 additions
and
444 deletions
+152
-444
AbstractMt2MxParseField.java
...a/com/brilliance/swift/mt2mx/AbstractMt2MxParseField.java
+0
-0
AbstractMt2MxCamt029001ParseField.java
...t/mt2mx/camt029001/AbstractMt2MxCamt029001ParseField.java
+6
-29
Mt2MxCamt029001Creator.java
...liance/swift/mt2mx/camt029001/Mt2MxCamt029001Creator.java
+15
-54
Camt029001Parse11RField.java
.../swift/mt2mx/camt029001/impl/Camt029001Parse11RField.java
+1
-3
Camt029001Parse20Field.java
...e/swift/mt2mx/camt029001/impl/Camt029001Parse20Field.java
+1
-4
Camt029001Parse21Field.java
...e/swift/mt2mx/camt029001/impl/Camt029001Parse21Field.java
+1
-2
Camt029001Parse76Field.java
...e/swift/mt2mx/camt029001/impl/Camt029001Parse76Field.java
+3
-9
Camt029001Parse77AField.java
.../swift/mt2mx/camt029001/impl/Camt029001Parse77AField.java
+6
-3
Mt2MxCamt052001Creator.java
...liance/swift/mt2mx/camt052001/Mt2MxCamt052001Creator.java
+6
-5
Camt052001Parse13DField.java
.../swift/mt2mx/camt052001/impl/Camt052001Parse13DField.java
+1
-1
Camt052001Parse20Field.java
...e/swift/mt2mx/camt052001/impl/Camt052001Parse20Field.java
+1
-1
Camt052001Parse25Field.java
...e/swift/mt2mx/camt052001/impl/Camt052001Parse25Field.java
+1
-2
Camt052001Parse28CField.java
.../swift/mt2mx/camt052001/impl/Camt052001Parse28CField.java
+1
-1
Camt052001Parse34FField.java
.../swift/mt2mx/camt052001/impl/Camt052001Parse34FField.java
+1
-1
Camt052001Parse61Field.java
...e/swift/mt2mx/camt052001/impl/Camt052001Parse61Field.java
+1
-1
Camt052001Parse86Field.java
...e/swift/mt2mx/camt052001/impl/Camt052001Parse86Field.java
+1
-1
Camt052001Parse90CField.java
.../swift/mt2mx/camt052001/impl/Camt052001Parse90CField.java
+1
-1
Camt052001Parse90DField.java
.../swift/mt2mx/camt052001/impl/Camt052001Parse90DField.java
+1
-1
AbstractMt2MxCamt053001ParseField.java
...t/mt2mx/camt053001/AbstractMt2MxCamt053001ParseField.java
+0
-1
Mt2MxCamt053001Creator.java
...liance/swift/mt2mx/camt053001/Mt2MxCamt053001Creator.java
+7
-2
Camt053001Parse20Field.java
...e/swift/mt2mx/camt053001/impl/Camt053001Parse20Field.java
+1
-2
Camt053001Parse25Field.java
...e/swift/mt2mx/camt053001/impl/Camt053001Parse25Field.java
+1
-2
Camt053001Parse28CField.java
.../swift/mt2mx/camt053001/impl/Camt053001Parse28CField.java
+1
-1
Camt053001Parse60Field.java
...e/swift/mt2mx/camt053001/impl/Camt053001Parse60Field.java
+1
-1
Camt053001Parse61Field.java
...e/swift/mt2mx/camt053001/impl/Camt053001Parse61Field.java
+1
-3
Camt053001Parse62Field.java
...e/swift/mt2mx/camt053001/impl/Camt053001Parse62Field.java
+1
-3
Camt053001Parse64Field.java
...e/swift/mt2mx/camt053001/impl/Camt053001Parse64Field.java
+1
-3
Camt053001Parse65Field.java
...e/swift/mt2mx/camt053001/impl/Camt053001Parse65Field.java
+1
-2
Camt053001Parse86Field.java
...e/swift/mt2mx/camt053001/impl/Camt053001Parse86Field.java
+1
-1
AbstractMt2MxCamt054001ParseField.java
...t/mt2mx/camt054001/AbstractMt2MxCamt054001ParseField.java
+12
-63
Mt2MxCamt054001Creator.java
...liance/swift/mt2mx/camt054001/Mt2MxCamt054001Creator.java
+6
-48
Camt054001Parse13DField.java
.../swift/mt2mx/camt054001/impl/Camt054001Parse13DField.java
+1
-21
Camt054001Parse20Field.java
...e/swift/mt2mx/camt054001/impl/Camt054001Parse20Field.java
+1
-1
Camt054001Parse21Field.java
...e/swift/mt2mx/camt054001/impl/Camt054001Parse21Field.java
+1
-2
Camt054001Parse25Field.java
...e/swift/mt2mx/camt054001/impl/Camt054001Parse25Field.java
+1
-2
Camt054001Parse32AField.java
.../swift/mt2mx/camt054001/impl/Camt054001Parse32AField.java
+19
-39
Camt054001Parse50Field.java
...e/swift/mt2mx/camt054001/impl/Camt054001Parse50Field.java
+1
-2
Camt054001Parse52For900Field.java
...t/mt2mx/camt054001/impl/Camt054001Parse52For900Field.java
+1
-3
Camt054001Parse52For910Field.java
...t/mt2mx/camt054001/impl/Camt054001Parse52For910Field.java
+1
-2
Camt054001Parse56Field.java
...e/swift/mt2mx/camt054001/impl/Camt054001Parse56Field.java
+1
-4
Camt054001Parse72Field.java
...e/swift/mt2mx/camt054001/impl/Camt054001Parse72Field.java
+1
-3
AbstractMt2MxCamt056001ParseField.java
...t/mt2mx/camt056001/AbstractMt2MxCamt056001ParseField.java
+8
-26
Mt2MxCamt056001Creator.java
...liance/swift/mt2mx/camt056001/Mt2MxCamt056001Creator.java
+9
-39
Camt056001Parse11SField.java
.../swift/mt2mx/camt056001/impl/Camt056001Parse11SField.java
+1
-3
Camt056001Parse20Field.java
...e/swift/mt2mx/camt056001/impl/Camt056001Parse20Field.java
+1
-3
Camt056001Parse21Field.java
...e/swift/mt2mx/camt056001/impl/Camt056001Parse21Field.java
+1
-2
Camt056001Parse32AField.java
.../swift/mt2mx/camt056001/impl/Camt056001Parse32AField.java
+1
-2
Camt056001Parse79Field.java
...e/swift/mt2mx/camt056001/impl/Camt056001Parse79Field.java
+10
-27
Camt057001Parse20Field.java
...e/swift/mt2mx/camt057001/impl/Camt057001Parse20Field.java
+1
-1
Camt057001Parse21Field.java
...e/swift/mt2mx/camt057001/impl/Camt057001Parse21Field.java
+1
-1
Camt057001Parse25Field.java
...e/swift/mt2mx/camt057001/impl/Camt057001Parse25Field.java
+1
-1
Camt057001Parse30Field.java
...e/swift/mt2mx/camt057001/impl/Camt057001Parse30Field.java
+1
-1
Camt057001Parse32BField.java
.../swift/mt2mx/camt057001/impl/Camt057001Parse32BField.java
+1
-1
Camt057001Parse50Field.java
...e/swift/mt2mx/camt057001/impl/Camt057001Parse50Field.java
+1
-1
Camt057001Parse52Field.java
...e/swift/mt2mx/camt057001/impl/Camt057001Parse52Field.java
+1
-1
Camt057001Parse56Field.java
...e/swift/mt2mx/camt057001/impl/Camt057001Parse56Field.java
+1
-2
TestMx2MtFor192.java
...test/java/com/brilliance/mx2mt/mt192/TestMx2MtFor192.java
+1
-1
TestMx2MtFor196.java
...test/java/com/brilliance/mx2mt/mt196/TestMx2MtFor196.java
+1
-1
TestMx2MtFor910.java
...test/java/com/brilliance/mx2mt/mt910/TestMx2MtFor910.java
+1
-1
No files found.
swiftCore/src/main/java/com/brilliance/swift/mt2mx/AbstractMt2MxParseField.java
View file @
5e157cef
This diff is collapsed.
Click to expand it.
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt029001/AbstractMt2MxCamt029001ParseField.java
View file @
5e157cef
...
...
@@ -3,7 +3,6 @@ package com.brilliance.swift.mt2mx.camt029001;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.mt2mx.AbstractMt2MxParseField
;
import
java.util.HashMap
;
import
java.util.Map
;
public
abstract
class
AbstractMt2MxCamt029001ParseField
extends
AbstractMt2MxParseField
{
...
...
@@ -12,9 +11,11 @@ public abstract class AbstractMt2MxCamt029001ParseField extends AbstractMt2MxPar
protected
Map
<
String
,
Object
>
assgnmtMaps
=
null
;
protected
Map
<
String
,
Object
>
cxlDtlsMaps
=
null
;
protected
Map
<
String
,
Object
>
stsMaps
=
null
;
protected
Map
<
String
,
Object
>
cxlDtl
sMaps
=
null
;
protected
Map
<
String
,
Object
>
txInfAndSt
sMaps
=
null
;
@Override
public
void
initJsonMaps
()
{
...
...
@@ -22,34 +23,10 @@ public abstract class AbstractMt2MxCamt029001ParseField extends AbstractMt2MxPar
appHdrMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"appHdr"
);
Map
<
String
,
Object
>
rsltnOfInvstgtnMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"rsltnOfInvstgtn"
);
assgnmtMaps
=
(
Map
<
String
,
Object
>)
rsltnOfInvstgtnMaps
.
get
(
"assgnmt"
);
if
(
rsltnOfInvstgtnMaps
.
containsKey
(
"sts"
)){
stsMaps
=
(
Map
<
String
,
Object
>)
rsltnOfInvstgtnMaps
.
get
(
"sts"
);
}
else
{
stsMaps
=
new
HashMap
<>();
rsltnOfInvstgtnMaps
.
put
(
"sts"
,
stsMaps
);
}
stsMaps
=
(
Map
<
String
,
Object
>)
rsltnOfInvstgtnMaps
.
get
(
"sts"
);
JSONArray
cxlDtlsJsonArray
=
(
JSONArray
)
rsltnOfInvstgtnMaps
.
get
(
"cxlDtls"
);
cxlDtlsMaps
=
(
Map
<
String
,
Object
>)
cxlDtlsJsonArray
.
get
(
0
);
}
public
Map
<
String
,
Object
>
getTxInfAndStsMaps
(){
Map
<
String
,
Object
>
txInfAndStsMaps
=
null
;
JSONArray
txInfAndStsJsonArray
=
null
;
if
(
cxlDtlsMaps
.
containsKey
(
"txInfAndSts"
)){
txInfAndStsJsonArray
=
(
JSONArray
)
cxlDtlsMaps
.
get
(
"txInfAndSts"
);
if
(
txInfAndStsJsonArray
!=
null
){
if
(
txInfAndStsJsonArray
.
size
()>
0
)
{
txInfAndStsMaps
=
(
Map
<
String
,
Object
>)
txInfAndStsJsonArray
.
get
(
0
);
}
else
{
txInfAndStsMaps
=
new
HashMap
<>();
txInfAndStsJsonArray
.
add
(
txInfAndStsMaps
);
}
}
}
else
{
txInfAndStsJsonArray
=
new
JSONArray
();
txInfAndStsMaps
=
new
HashMap
<>();
cxlDtlsMaps
.
put
(
"txInfAndSts"
,
txInfAndStsJsonArray
);
txInfAndStsJsonArray
.
add
(
txInfAndStsMaps
);
}
return
txInfAndStsMaps
;
JSONArray
txInfAndStsJsonArray
=
(
JSONArray
)
cxlDtlsMaps
.
get
(
"txInfAndSts"
);
txInfAndStsMaps
=
(
Map
<
String
,
Object
>)
txInfAndStsJsonArray
.
get
(
0
);
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt029001/Mt2MxCamt029001Creator.java
View file @
5e157cef
package
com
.
brilliance
.
swift
.
mt2mx
.
camt029001
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.AbstractMt2MxCreator
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.Mt2MxParseField
;
import
com.brilliance.swift.mt2mx.camt029001.impl.*
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.vo.SwiftTranslationErrorInfo
;
import
com.brilliance.swift.vo.SwiftTranslationReport
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field77A
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.ArrayList
;
...
...
@@ -26,16 +19,18 @@ public class Mt2MxCamt029001Creator extends AbstractMt2MxCreator {
@Override
public
void
preProcess
()
{
super
.
preProcess
();
//将报文类型放入jsonMaps集合中,这个maps集合是最上层
jsonMaps
.
put
(
"identifier"
,
"camt.029.001.09"
);
Map
<
String
,
Object
>
appHdrMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"appHdr"
);
//将消息头中的消息名放入头部的map集合中
appHdrMaps
.
put
(
"msgDefIdr"
,
"camt.029.001.09"
);
//得到AbstractMT这个对象用来解析mt文件
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
//初始化转换和不需要BLOCK4的转换
Map
<
String
,
Object
>
rsltnOfInvstgtnMaps
=
new
HashMap
<>();
jsonMaps
.
put
(
"rsltnOfInvstgtn"
,
rsltnOfInvstgtnMaps
);
Map
<
String
,
Object
>
assgnmtMaps
=
new
HashMap
<>();
rsltnOfInvstgtnMaps
.
put
(
"assgnmt"
,
assgnmtMaps
);
//将当前的时间存入这个map集合中
assgnmtMaps
.
put
(
"creDtTm"
,
getCreateDateStr
());
Map
<
String
,
Object
>
cxlDtlsMaps
=
new
HashMap
<>();
...
...
@@ -46,6 +41,7 @@ public class Mt2MxCamt029001Creator extends AbstractMt2MxCreator {
JSONArray
txInfAndStsJsonArray
=
new
JSONArray
();
txInfAndStsJsonArray
.
add
(
txInfAndStsMaps
);
cxlDtlsMaps
.
put
(
"txInfAndSts"
,
txInfAndStsJsonArray
);
//将报文追踪号存入map集合中
String
orgnlUETR
=
abstractMT
.
getSwiftMessage
().
getUETR
();
if
(
StringUtil
.
isNotEmpty
(
orgnlUETR
))
{
txInfAndStsMaps
.
put
(
"orgnlUETR"
,
orgnlUETR
);
...
...
@@ -57,6 +53,7 @@ public class Mt2MxCamt029001Creator extends AbstractMt2MxCreator {
assgnmtMaps
.
put
(
"assgnr"
,
assgnrMaps
);
Map
<
String
,
Object
>
agtMaps
=
new
HashMap
<>();
assgnrMaps
.
put
(
"agt"
,
agtMaps
);
//调用这个方法将转让人(消息发送者)的参与行的行号存入map集合中
mt_to_mxBICFI
(
sendBic
,
agtMaps
);
}
String
receiverBic
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_RECEIVE_BIC
,
true
);
...
...
@@ -65,23 +62,15 @@ public class Mt2MxCamt029001Creator extends AbstractMt2MxCreator {
assgnmtMaps
.
put
(
"assgne"
,
assgneMaps
);
Map
<
String
,
Object
>
agtMaps
=
new
HashMap
<>();
assgneMaps
.
put
(
"agt"
,
agtMaps
);
//调用这个方法将受让人(消息接受者)的参与行的行号存入map集合中
mt_to_mxBICFI
(
receiverBic
,
agtMaps
);
}
Map
<
String
,
Object
>
orgnlGrpInfMaps
=
null
;
if
(
txInfAndStsMaps
.
containsKey
(
"orgnlGrpInf"
)){
orgnlGrpInfMaps
=
(
Map
<
String
,
Object
>)
txInfAndStsMaps
.
get
(
"orgnlGrpInf"
);
}
else
{
orgnlGrpInfMaps
=
new
HashMap
<>();
txInfAndStsMaps
.
put
(
"orgnlGrpInf"
,
orgnlGrpInfMaps
);
}
Map
<
String
,
Object
>
orgnlGrpInfMaps
=
new
HashMap
<>();
txInfAndStsMaps
.
put
(
"orgnlGrpInf"
,
orgnlGrpInfMaps
);
orgnlGrpInfMaps
.
put
(
"orgnlMsgId"
,
Mx2MtConstants
.
MT_TO_MX_DEFAULT_VALUE
);
Map
<
String
,
Object
>
rslvdCaseMaps
=
null
;
if
(
txInfAndStsMaps
.
containsKey
(
"rslvdCase"
)){
rslvdCaseMaps
=
(
Map
<
String
,
Object
>)
txInfAndStsMaps
.
get
(
"rslvdCase"
);
}
else
{
rslvdCaseMaps
=
new
HashMap
<>();
txInfAndStsMaps
.
put
(
"rslvdCase"
,
rslvdCaseMaps
);
}
Map
<
String
,
Object
>
rslvdCaseMaps
=
new
HashMap
<>();
////假定创建者是代理人而不是当事人,在nm和adrLine这两个位置存值NOTPROVIDED
txInfAndStsMaps
.
put
(
"rslvdCase"
,
rslvdCaseMaps
);
Map
<
String
,
Object
>
cretrMaps
=
new
HashMap
<>();
Map
<
String
,
Object
>
agtMaps
=
new
HashMap
<>();
Map
<
String
,
Object
>
finInstnIdMaps
=
new
HashMap
<>();
...
...
@@ -94,37 +83,9 @@ public class Mt2MxCamt029001Creator extends AbstractMt2MxCreator {
JSONArray
adrLineJsonArray
=
new
JSONArray
();
pstlAdrMaps
.
put
(
"adrLine"
,
adrLineJsonArray
);
adrLineJsonArray
.
add
(
Mx2MtConstants
.
MT_TO_MX_DEFAULT_VALUE
);
Tag
tag77A
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
"77A"
);
Field77A
field77A
=
(
Field77A
)
tag77A
.
asField
();
String
String77A
=
field77A
.
getValue
().
replace
(
"\r\n//"
,
" "
).
replace
(
"\r\n"
,
""
);
int
index
=
String77A
.
indexOf
(
"/UETR/"
);
String
uetr
=
""
;
if
(
index
>-
1
){
uetr
=
String77A
.
substring
(
index
+
6
);
}
if
(
StringUtil
.
isEmpty
(
orgnlUETR
)&&
StringUtil
.
isEmpty
(
uetr
)){
buildSTErrorInfo
(
ERROR
.
T20087
,
"Block3/UETR"
,
null
);
}
}
protected
void
buildSTErrorInfo
(
String
errorCode
,
String
location
,
String
originalValue
)
{
SwiftTranslationReport
str
=
context
.
get
(
SwiftTranslationReport
.
class
);
SwiftTranslationErrorInfo
errorInfo
=
SwiftTransferUtil
.
getSwiftTranslationErrorInfoByErrorCode
(
errorCode
);
errorInfo
.
setLocation
(
location
);
errorInfo
.
setOriginalValue
(
originalValue
);
List
<
SwiftTranslationErrorInfo
>
errorInfos
=
str
.
getErrorInfos
();
boolean
existFlag
=
false
;
for
(
int
i
=
0
;
i
<
errorInfos
.
size
();
i
++)
{
if
(
SwiftTransferUtil
.
compareStErrorInfo
(
errorInfo
,
errorInfos
.
get
(
i
)))
{
existFlag
=
true
;
break
;
}
}
if
(!
existFlag
)
{
str
.
addErrorInfo
(
errorInfo
);
if
(
"FAILURE"
.
equalsIgnoreCase
(
errorInfo
.
getErrorType
()))
{
throw
new
SwiftException
(
location
+
Mx2MtConstants
.
NEW_LINE
+
"-"
+
errorInfo
.
getErrorType
()
+
":"
+
errorInfo
.
getDescription
());
}
}
Map
<
String
,
Object
>
stsMaps
=
new
HashMap
<>();
rsltnOfInvstgtnMaps
.
put
(
"sts"
,
stsMaps
);
}
@Override
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt029001/impl/Camt029001Parse11RField.java
View file @
5e157cef
package
com
.
brilliance
.
swift
.
mt2mx
.
camt029001
.
impl
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt029001.AbstractMt2MxCamt029001ParseField
;
import
com.brilliance.swift.util.DateUtil
;
...
...
@@ -12,7 +11,7 @@ import java.text.ParseException;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
//这个域的作用就是将原始消息的名称和原始消息的创建时间存入map集合
public
class
Camt029001Parse11RField
extends
AbstractMt2MxCamt029001ParseField
{
private
static
final
String
NAME
=
"11R"
;
...
...
@@ -26,7 +25,6 @@ public class Camt029001Parse11RField extends AbstractMt2MxCamt029001ParseField {
Field11R
field11R
=
(
Field11R
)
tag
.
asField
();
Date
date
=
DateUtil
.
parseDate
(
"20"
+
field11R
.
getDate
(),
"yyyyMMdd"
);
String
dateStr
=
DateUtil
.
format
(
date
,
"yyyy-MM-dd"
);
Map
<
String
,
Object
>
txInfAndStsMaps
=
getTxInfAndStsMaps
();
Map
<
String
,
Object
>
orgnlGrpInfMaps
=
null
;
if
(
txInfAndStsMaps
.
containsKey
(
"orgnlGrpInf"
)){
orgnlGrpInfMaps
=
(
Map
<
String
,
Object
>)
txInfAndStsMaps
.
get
(
"orgnlGrpInf"
);
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt029001/impl/Camt029001Parse20Field.java
View file @
5e157cef
...
...
@@ -4,9 +4,7 @@ import com.brilliance.swift.exception.SwiftException;
import
com.brilliance.swift.mt2mx.camt029001.AbstractMt2MxCamt029001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.Map
;
//这个域是将唯一标识填入需要唯一标识的map集合中
public
class
Camt029001Parse20Field
extends
AbstractMt2MxCamt029001ParseField
{
private
static
final
String
NAME
=
"20"
;
...
...
@@ -18,7 +16,6 @@ public class Camt029001Parse20Field extends AbstractMt2MxCamt029001ParseField {
if
(
tag20
!=
null
)
{
appHdrMaps
.
put
(
"bizMsgIdr"
,
tag20
.
getValue
());
assgnmtMaps
.
put
(
"id"
,
tag20
.
getValue
());
Map
<
String
,
Object
>
txInfAndStsMaps
=
getTxInfAndStsMaps
();
txInfAndStsMaps
.
put
(
"cxlStsId"
,
tag20
.
getValue
());
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt029001/impl/Camt029001Parse21Field.java
View file @
5e157cef
...
...
@@ -7,7 +7,7 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import
java.util.HashMap
;
import
java.util.Map
;
//将原始消息的标识号填入map集合中
public
class
Camt029001Parse21Field
extends
AbstractMt2MxCamt029001ParseField
{
private
static
final
String
NAME
=
"21"
;
...
...
@@ -17,7 +17,6 @@ public class Camt029001Parse21Field extends AbstractMt2MxCamt029001ParseField {
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag21
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag21
!=
null
)
{
Map
<
String
,
Object
>
txInfAndStsMaps
=
getTxInfAndStsMaps
();
Map
<
String
,
Object
>
rslvdCaseMaps
=
null
;
if
(
txInfAndStsMaps
.
containsKey
(
"rslvdCase"
)){
rslvdCaseMaps
=
(
Map
<
String
,
Object
>)
txInfAndStsMaps
.
get
(
"rslvdCase"
);
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt029001/impl/Camt029001Parse76Field.java
View file @
5e157cef
package
com
.
brilliance
.
swift
.
mt2mx
.
camt029001
.
impl
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt029001.AbstractMt2MxCamt029001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -8,7 +7,6 @@ import com.prowidesoftware.swift.model.field.Field76;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.List
;
import
java.util.Map
;
public
class
Camt029001Parse76Field
extends
AbstractMt2MxCamt029001ParseField
{
...
...
@@ -20,14 +18,10 @@ public class Camt029001Parse76Field extends AbstractMt2MxCamt029001ParseField {
Tag
tag76
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag76
!=
null
)
{
Field76
field76
=
(
Field76
)
tag76
.
asField
();
Map
<
String
,
Object
>
txInfAndStsMaps
=
getTxInfAndStsMaps
();
List
<
String
>
lines
=
field76
.
getLines
();
String
sts
=
mt_To_mxField76
(
lines
,
txInfAndStsMaps
);
if
(
"CNCL"
.
equals
(
sts
)||
"PDCR"
.
equals
(
sts
)||
"RJCR"
.
equals
(
sts
)){
stsMaps
.
put
(
"conf"
,
sts
);
}
else
{
buildSTErrorInfo
(
ERROR
.
T20093
,
"Block4:76:"
,
null
);
}
//第一行: /4!C/[附加信息] 4!C是取消原因代码
//第2-35行:附加信息的继续
mt_To_mxField76
(
lines
,
txInfAndStsMaps
,
stsMaps
);
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt029001/impl/Camt029001Parse77AField.java
View file @
5e157cef
...
...
@@ -3,12 +3,11 @@ package com.brilliance.swift.mt2mx.camt029001.impl;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt029001.AbstractMt2MxCamt029001ParseField
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field77A
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.Map
;
public
class
Camt029001Parse77AField
extends
AbstractMt2MxCamt029001ParseField
{
private
static
final
String
NAME
=
"77A"
;
...
...
@@ -18,7 +17,6 @@ public class Camt029001Parse77AField extends AbstractMt2MxCamt029001ParseField {
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag77A
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag77A
!=
null
)
{
Map
<
String
,
Object
>
txInfAndStsMaps
=
getTxInfAndStsMaps
();
Field77A
field77A
=
(
Field77A
)
tag77A
.
asField
();
String
String77A
=
field77A
.
getValue
().
replace
(
"\r\n//"
,
""
).
replace
(
"\r\n"
,
""
);
int
index
=
String77A
.
indexOf
(
"/UETR/"
);
...
...
@@ -30,6 +28,11 @@ public class Camt029001Parse77AField extends AbstractMt2MxCamt029001ParseField {
if
(!((
uetr
.
length
()+
6
)==
String77A
.
length
())){
buildSTErrorInfo
(
ERROR
.
T20094
,
"Block4:77A:"
,
null
);
}
}
else
{
String
orgnlUETR
=
abstractMT
.
getSwiftMessage
().
getUETR
();
if
(
StringUtil
.
isEmpty
(
orgnlUETR
)){
buildSTErrorInfo
(
ERROR
.
T20087
,
"Block3/UETR"
,
null
);
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt052001/Mt2MxCamt052001Creator.java
View file @
5e157cef
...
...
@@ -11,7 +11,6 @@ import com.prowidesoftware.swift.model.field.Field90D;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mx.dic.CreditDebitCode
;
import
com.prowidesoftware.swift.utils.SwiftFormatUtils
;
import
org.apache.poi.hpsf.Decimal
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
...
...
@@ -24,18 +23,20 @@ public class Mt2MxCamt052001Creator extends AbstractMt2MxCreator {
@Override
public
void
preProcess
()
{
super
.
preProcess
();
//将报文类型放入jsonMaps集合中,这个maps集合是最上层
jsonMaps
.
put
(
"identifier"
,
"camt.052.001.08"
);
Map
<
String
,
Object
>
appHdrMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"appHdr"
);
//将消息头中的消息名放入头部的map集合中
appHdrMaps
.
put
(
"msgDefIdr"
,
"camt.052.001.08"
);
//得到AbstractMT这个对象用来解析mt文件
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
//初始化转换和不需要BLOCK4的转换
Map
<
String
,
Object
>
bkToCstmrAcctRptMaps
=
new
HashMap
<>();
jsonMaps
.
put
(
"bkToCstmrAcctRpt"
,
bkToCstmrAcctRptMaps
);
Map
<
String
,
Object
>
grpHdrMaps
=
new
HashMap
<>();
bkToCstmrAcctRptMaps
.
put
(
"grpHdr"
,
grpHdrMaps
);
//将当前的时间存入这个map集合中
grpHdrMaps
.
put
(
"creDtTm"
,
getCreateDateStr
());
//在sts中存入默认值BOOK,bkTxCd下cd,issr取初始值NOTPROVIDED
Map
<
String
,
Object
>
rptMaps
=
new
HashMap
<>();
JSONArray
rptJsonArray
=
new
JSONArray
();
rptJsonArray
.
add
(
rptMaps
);
...
...
@@ -53,7 +54,7 @@ public class Mt2MxCamt052001Creator extends AbstractMt2MxCreator {
bkTxCdMaps
.
put
(
"prtry"
,
prtryMaps
);
prtryMaps
.
put
(
"cd"
,
Mx2MtConstants
.
MT_TO_MX_DEFAULT_VALUE
);
prtryMaps
.
put
(
"issr"
,
Mx2MtConstants
.
MT_TO_MX_DEFAULT_VALUE
);
//这个操作是将借记和贷记的笔数和金额进行计算
Tag
tag90C
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
"90C"
);
Tag
tag90D
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
"90D"
);
if
(
tag90C
!=
null
||
tag90D
!=
null
){
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt052001/impl/Camt052001Parse13DField.java
View file @
5e157cef
...
...
@@ -5,7 +5,7 @@ import com.brilliance.swift.mt2mx.camt052001.AbstractMt2MxCamt052001ParseField;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field13D
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
//这个域存放的是报文的创建时间,将这个时间放入map集合中
public
class
Camt052001Parse13DField
extends
AbstractMt2MxCamt052001ParseField
{
private
static
final
String
NAME
=
"13D"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt052001/impl/Camt052001Parse20Field.java
View file @
5e157cef
...
...
@@ -4,7 +4,7 @@ import com.brilliance.swift.exception.SwiftException;
import
com.brilliance.swift.mt2mx.camt052001.AbstractMt2MxCamt052001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
//这个域是将唯一标识填入需要唯一标识的map集合中
public
class
Camt052001Parse20Field
extends
AbstractMt2MxCamt052001ParseField
{
private
static
final
String
NAME
=
"20"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt052001/impl/Camt052001Parse25Field.java
View file @
5e157cef
package
com
.
brilliance
.
swift
.
mt2mx
.
camt052001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.camt052001.AbstractMt2MxCamt052001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field25
;
...
...
@@ -10,7 +9,7 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import
java.util.HashMap
;
import
java.util.Map
;
//存储的是账号信息
public
class
Camt052001Parse25Field
extends
AbstractMt2MxCamt052001ParseField
{
private
static
final
String
NAME_25
=
"25"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt052001/impl/Camt052001Parse28CField.java
View file @
5e157cef
...
...
@@ -8,7 +8,7 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import
java.util.HashMap
;
import
java.util.Map
;
//这个域存放了对账单号码和分页序号将这2个值存入map集合中
public
class
Camt052001Parse28CField
extends
AbstractMt2MxCamt052001ParseField
{
private
static
final
String
NAME
=
"28C"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt052001/impl/Camt052001Parse34FField.java
View file @
5e157cef
...
...
@@ -8,7 +8,7 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import
java.util.HashMap
;
import
java.util.Map
;
//这个域是最低金额维护,存储在map集合中是只存币种
public
class
Camt052001Parse34FField
extends
AbstractMt2MxCamt052001ParseField
{
private
static
final
String
NAME
=
"34F"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt052001/impl/Camt052001Parse61Field.java
View file @
5e157cef
...
...
@@ -16,7 +16,7 @@ import java.util.Date;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
//这个域是对账单细目
public
class
Camt052001Parse61Field
extends
AbstractMt2MxCamt052001ParseField
{
private
static
final
String
NAME
=
"61"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt052001/impl/Camt052001Parse86Field.java
View file @
5e157cef
...
...
@@ -8,7 +8,7 @@ import com.prowidesoftware.swift.model.field.Field86;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.List
;
//附加说明的域
public
class
Camt052001Parse86Field
extends
AbstractMt2MxCamt052001ParseField
{
private
static
final
String
NAME
=
"86"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt052001/impl/Camt052001Parse90CField.java
View file @
5e157cef
...
...
@@ -10,7 +10,7 @@ import com.prowidesoftware.swift.utils.SwiftFormatUtils;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.Map
;
//这个域存储的是贷记笔数和金额
public
class
Camt052001Parse90CField
extends
AbstractMt2MxCamt052001ParseField
{
private
static
final
String
NAME
=
"90C"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt052001/impl/Camt052001Parse90DField.java
View file @
5e157cef
...
...
@@ -10,7 +10,7 @@ import com.prowidesoftware.swift.utils.SwiftFormatUtils;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.Map
;
////这个域存储的是借记笔数和金额
public
class
Camt052001Parse90DField
extends
AbstractMt2MxCamt052001ParseField
{
private
static
final
String
NAME
=
"90D"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt053001/AbstractMt2MxCamt053001ParseField.java
View file @
5e157cef
...
...
@@ -3,7 +3,6 @@ package com.brilliance.swift.mt2mx.camt053001;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.mt2mx.AbstractMt2MxParseField
;
import
java.util.HashMap
;
import
java.util.Map
;
public
abstract
class
AbstractMt2MxCamt053001ParseField
extends
AbstractMt2MxParseField
{
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt053001/Mt2MxCamt053001Creator.java
View file @
5e157cef
...
...
@@ -18,18 +18,21 @@ public class Mt2MxCamt053001Creator extends AbstractMt2MxCreator {
@Override
public
void
preProcess
()
{
super
.
preProcess
();
//将报文类型放入jsonMaps集合中,这个maps集合是最上层
jsonMaps
.
put
(
"identifier"
,
"camt.053.001.08"
);
Map
<
String
,
Object
>
appHdrMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"appHdr"
);
//将消息头中的消息名放入头部的map集合中
appHdrMaps
.
put
(
"msgDefIdr"
,
"camt.053.001.08"
);
//得到AbstractMT这个对象用来解析mt文件
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
//初始化转换和不需要BLOCK4的转换
Map
<
String
,
Object
>
bkToCstmrStmtMaps
=
new
HashMap
<>();
jsonMaps
.
put
(
"bkToCstmrStmt"
,
bkToCstmrStmtMaps
);
Map
<
String
,
Object
>
grpHdrMaps
=
new
HashMap
<>();
bkToCstmrStmtMaps
.
put
(
"grpHdr"
,
grpHdrMaps
);
//将当前的时间存入这个map集合中
grpHdrMaps
.
put
(
"creDtTm"
,
getCreateDateStr
());
grpHdrMaps
.
put
(
"nbOfTxs"
,
"1"
);
Map
<
String
,
Object
>
stmtMaps
=
new
HashMap
<>();
JSONArray
stmtJsonArray
=
new
JSONArray
();
stmtJsonArray
.
add
(
stmtMaps
);
...
...
@@ -40,6 +43,7 @@ public class Mt2MxCamt053001Creator extends AbstractMt2MxCreator {
JSONArray
ntryDtlsJsonArray
=
new
JSONArray
();
Map
<
String
,
Object
>
txDtlsMaps
=
new
HashMap
<>();
JSONArray
txDtlsJsonArray
=
new
JSONArray
();
//将报文追踪号存入map集合中
String
uetr
=
abstractMT
.
getSwiftMessage
().
getUETR
();
if
(
StringUtil
.
isNotEmpty
(
uetr
))
{
ntryJsonArray
.
add
(
ntryMaps
);
...
...
@@ -52,6 +56,7 @@ public class Mt2MxCamt053001Creator extends AbstractMt2MxCreator {
txDtlsMaps
.
put
(
"refs"
,
refsMaps
);
refsMaps
.
put
(
"uetr"
,
uetr
);
}
//在sts中存入默认值BOOK,bkTxCd下cd,issr取初始值NOTPROVIDED
Map
<
String
,
Object
>
stsMaps
=
new
HashMap
<>();
ntryMaps
.
put
(
"sts"
,
stsMaps
);
stsMaps
.
put
(
"cd"
,
"BOOK"
);
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt053001/impl/Camt053001Parse20Field.java
View file @
5e157cef
...
...
@@ -2,10 +2,9 @@ package com.brilliance.swift.mt2mx.camt053001.impl;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt053001.AbstractMt2MxCamt053001ParseField
;
import
com.brilliance.swift.mt2mx.camt054001.AbstractMt2MxCamt054001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
//这个域是将唯一标识填入需要唯一标识的map集合中
public
class
Camt053001Parse20Field
extends
AbstractMt2MxCamt053001ParseField
{
private
static
final
String
NAME
=
"20"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt053001/impl/Camt053001Parse25Field.java
View file @
5e157cef
package
com
.
brilliance
.
swift
.
mt2mx
.
camt053001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.camt053001.AbstractMt2MxCamt053001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field25
;
...
...
@@ -10,7 +9,7 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import
java.util.HashMap
;
import
java.util.Map
;
//存储的是账号信息
public
class
Camt053001Parse25Field
extends
AbstractMt2MxCamt053001ParseField
{
private
static
final
String
NAME_25
=
"25"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt053001/impl/Camt053001Parse28CField.java
View file @
5e157cef
...
...
@@ -8,7 +8,7 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import
java.util.HashMap
;
import
java.util.Map
;
//这个域存放了对账单号码和分页序号将这2个值存入map集合中
public
class
Camt053001Parse28CField
extends
AbstractMt2MxCamt053001ParseField
{
private
static
final
String
NAME
=
"28C"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt053001/impl/Camt053001Parse60Field.java
View file @
5e157cef
...
...
@@ -16,7 +16,7 @@ import java.text.ParseException;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
//起始余额
public
class
Camt053001Parse60Field
extends
AbstractMt2MxCamt053001ParseField
{
private
static
final
String
NAME_F
=
"60F"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt053001/impl/Camt053001Parse61Field.java
View file @
5e157cef
...
...
@@ -4,9 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt053001.AbstractMt2MxCamt053001ParseField
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.StringUtil
;
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.Field60F
;
import
com.prowidesoftware.swift.model.field.Field60M
;
...
...
@@ -19,7 +17,7 @@ import java.util.Date;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
//对账单细目
public
class
Camt053001Parse61Field
extends
AbstractMt2MxCamt053001ParseField
{
private
static
final
String
NAME
=
"61"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt053001/impl/Camt053001Parse62Field.java
View file @
5e157cef
...
...
@@ -8,8 +8,6 @@ import com.brilliance.swift.vo.common.BalanceSubTypeCode;
import
com.brilliance.swift.vo.common.BalanceTypeCode
;
import
com.brilliance.swift.vo.common.CdtDbtCode
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field60F
;
import
com.prowidesoftware.swift.model.field.Field60M
;
import
com.prowidesoftware.swift.model.field.Field62F
;
import
com.prowidesoftware.swift.model.field.Field62M
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
...
...
@@ -18,7 +16,7 @@ import java.text.ParseException;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
//结束余额
public
class
Camt053001Parse62Field
extends
AbstractMt2MxCamt053001ParseField
{
private
static
final
String
NAME_F
=
"62F"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt053001/impl/Camt053001Parse64Field.java
View file @
5e157cef
...
...
@@ -7,8 +7,6 @@ import com.brilliance.swift.util.DateUtil;
import
com.brilliance.swift.vo.common.BalanceTypeCode
;
import
com.brilliance.swift.vo.common.CdtDbtCode
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field60F
;
import
com.prowidesoftware.swift.model.field.Field60M
;
import
com.prowidesoftware.swift.model.field.Field64
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
...
...
@@ -16,7 +14,7 @@ import java.text.ParseException;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
//有效余额
public
class
Camt053001Parse64Field
extends
AbstractMt2MxCamt053001ParseField
{
private
static
final
String
NAME_F
=
"64"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt053001/impl/Camt053001Parse65Field.java
View file @
5e157cef
...
...
@@ -7,7 +7,6 @@ import com.brilliance.swift.util.DateUtil;
import
com.brilliance.swift.vo.common.BalanceTypeCode
;
import
com.brilliance.swift.vo.common.CdtDbtCode
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field64
;
import
com.prowidesoftware.swift.model.field.Field65
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
...
...
@@ -15,7 +14,7 @@ import java.text.ParseException;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
//某日有效余额
public
class
Camt053001Parse65Field
extends
AbstractMt2MxCamt053001ParseField
{
private
static
final
String
NAME
=
"65"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt053001/impl/Camt053001Parse86Field.java
View file @
5e157cef
...
...
@@ -8,7 +8,7 @@ import com.prowidesoftware.swift.model.field.Field86;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.List
;
//附加说明
public
class
Camt053001Parse86Field
extends
AbstractMt2MxCamt053001ParseField
{
private
static
final
String
NAME
=
"86"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/AbstractMt2MxCamt054001ParseField.java
View file @
5e157cef
...
...
@@ -3,7 +3,6 @@ package com.brilliance.swift.mt2mx.camt054001;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.mt2mx.AbstractMt2MxParseField
;
import
java.util.HashMap
;
import
java.util.Map
;
public
abstract
class
AbstractMt2MxCamt054001ParseField
extends
AbstractMt2MxParseField
{
...
...
@@ -14,6 +13,12 @@ public abstract class AbstractMt2MxCamt054001ParseField extends AbstractMt2MxPar
protected
Map
<
String
,
Object
>
ntfctnMaps
=
null
;
protected
Map
<
String
,
Object
>
ntryMaps
=
null
;
protected
Map
<
String
,
Object
>
ntryDtlsMaps
=
null
;
protected
Map
<
String
,
Object
>
txDtlsMaps
=
null
;
@Override
public
void
initJsonMaps
()
{
super
.
initJsonMaps
();
...
...
@@ -22,67 +27,11 @@ public abstract class AbstractMt2MxCamt054001ParseField extends AbstractMt2MxPar
grpHdrMaps
=
(
Map
<
String
,
Object
>)
bkToCstmrDbtCdtNtfctnMaps
.
get
(
"grpHdr"
);
JSONArray
ntfctnJsonArray
=
(
JSONArray
)
bkToCstmrDbtCdtNtfctnMaps
.
get
(
"ntfctn"
);
ntfctnMaps
=
(
Map
<
String
,
Object
>)
ntfctnJsonArray
.
get
(
0
);
}
public
Map
<
String
,
Object
>
getTransactionDetails
(){
Map
<
String
,
Object
>
ntryMaps
=
null
;
JSONArray
ntryJsonArray
=
null
;
Map
<
String
,
Object
>
ntryDtlsMaps
=
null
;
JSONArray
ntryDtlsJsonArray
=
null
;
Map
<
String
,
Object
>
txDtlsMaps
=
null
;
JSONArray
txDtlsJsonArray
=
null
;
if
(
ntfctnMaps
.
containsKey
(
"ntry"
)){
ntryJsonArray
=
(
JSONArray
)
ntfctnMaps
.
get
(
"ntry"
);
if
(
ntryJsonArray
!=
null
){
if
(
ntryJsonArray
.
size
()>
0
)
{
ntryMaps
=
(
Map
<
String
,
Object
>)
ntryJsonArray
.
get
(
0
);
}
else
{
ntryMaps
=
new
HashMap
<>();
ntryJsonArray
.
add
(
ntryMaps
);
}
}
}
else
{
ntryJsonArray
=
new
JSONArray
();
ntryMaps
=
new
HashMap
<>();
ntfctnMaps
.
put
(
"ntry"
,
ntryJsonArray
);
ntryJsonArray
.
add
(
ntryMaps
);
}
if
(
ntryMaps
!=
null
){
if
(
ntryMaps
.
containsKey
(
"ntryDtls"
)){
ntryDtlsJsonArray
=
(
JSONArray
)
ntryMaps
.
get
(
"ntryDtls"
);
if
(
ntryDtlsJsonArray
!=
null
){
if
(
ntryDtlsJsonArray
.
size
()>
0
)
{
ntryDtlsMaps
=
(
Map
<
String
,
Object
>)
ntryDtlsJsonArray
.
get
(
0
);
}
else
{
ntryDtlsMaps
=
new
HashMap
<>();
ntryDtlsJsonArray
.
add
(
ntryDtlsMaps
);
}
}
}
else
{
ntryDtlsJsonArray
=
new
JSONArray
();
ntryDtlsMaps
=
new
HashMap
<>();
ntryMaps
.
put
(
"ntryDtls"
,
ntryDtlsJsonArray
);
ntryDtlsJsonArray
.
add
(
ntryDtlsMaps
);
}
if
(
ntryDtlsMaps
!=
null
){
if
(
ntryDtlsMaps
.
containsKey
(
"txDtls"
)){
txDtlsJsonArray
=
(
JSONArray
)
ntryDtlsMaps
.
get
(
"txDtls"
);
if
(
txDtlsJsonArray
!=
null
){
if
(
txDtlsJsonArray
.
size
()>
0
)
{
txDtlsMaps
=
(
Map
<
String
,
Object
>)
txDtlsJsonArray
.
get
(
0
);
}
else
{
txDtlsMaps
=
new
HashMap
<>();
txDtlsJsonArray
.
add
(
txDtlsMaps
);
}
}
}
else
{
txDtlsJsonArray
=
new
JSONArray
();
txDtlsMaps
=
new
HashMap
<>();
ntryDtlsMaps
.
put
(
"txDtls"
,
txDtlsJsonArray
);
txDtlsJsonArray
.
add
(
txDtlsMaps
);
}
}
}
return
txDtlsMaps
;
JSONArray
ntryJsonArray
=
(
JSONArray
)
ntfctnMaps
.
get
(
"ntry"
);
ntryMaps
=
(
Map
<
String
,
Object
>)
ntryJsonArray
.
get
(
0
);
JSONArray
ntryDtlsJsonArray
=
(
JSONArray
)
ntryMaps
.
get
(
"ntryDtls"
);
ntryDtlsMaps
=
(
Map
<
String
,
Object
>)
ntryDtlsJsonArray
.
get
(
0
);
JSONArray
txDtlsJsonArray
=
(
JSONArray
)
ntryDtlsMaps
.
get
(
"txDtls"
);
txDtlsMaps
=
(
Map
<
String
,
Object
>)
txDtlsJsonArray
.
get
(
0
);
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/Mt2MxCamt054001Creator.java
View file @
5e157cef
package
com
.
brilliance
.
swift
.
mt2mx
.
camt054001
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.AbstractMt2MxCreator
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.Mt2MxParseField
;
import
com.brilliance.swift.mt2mx.camt029001.impl.*
;
import
com.brilliance.swift.mt2mx.camt054001.impl.*
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.vo.SwiftTranslationErrorInfo
;
import
com.brilliance.swift.vo.SwiftTranslationReport
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field32A
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mx.dic.CreditDebitCode
;
...
...
@@ -28,19 +20,22 @@ public class Mt2MxCamt054001Creator extends AbstractMt2MxCreator {
@Override
public
void
preProcess
()
{
super
.
preProcess
();
//将报文类型放入jsonMaps集合中,这个maps集合是最上层
jsonMaps
.
put
(
"identifier"
,
"camt.054.001.08"
);
Map
<
String
,
Object
>
appHdrMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"appHdr"
);
//将消息头中的消息名放入头部的map集合中
appHdrMaps
.
put
(
"msgDefIdr"
,
"camt.054.001.08"
);
//得到AbstractMT这个对象用来解析mt文件
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
//初始化转换和不需要BLOCK4的转换
Map
<
String
,
Object
>
bkToCstmrDbtCdtNtfctnMaps
=
new
HashMap
<>();
jsonMaps
.
put
(
"bkToCstmrDbtCdtNtfctn"
,
bkToCstmrDbtCdtNtfctnMaps
);
Map
<
String
,
Object
>
grpHdrMaps
=
new
HashMap
<>();
bkToCstmrDbtCdtNtfctnMaps
.
put
(
"grpHdr"
,
grpHdrMaps
);
grpHdrMaps
.
put
(
"creDtTm"
,
getCreateDateStr
());
//将当前的时间存入这个map集合中
grpHdrMaps
.
put
(
"nbOfTxs"
,
"1"
);
//存储初始值,sts为BOOK,cd,issr,ntryRef的值为NOTPROVIDED
//cdtDbtInd中存储DBIT,CRDT,借记和贷记
Map
<
String
,
Object
>
ntfctnMaps
=
new
HashMap
<>();
JSONArray
ntfctnJsonArray
=
new
JSONArray
();
ntfctnJsonArray
.
add
(
ntfctnMaps
);
...
...
@@ -74,22 +69,6 @@ public class Mt2MxCamt054001Creator extends AbstractMt2MxCreator {
ntryMaps
.
put
(
"cdtDbtInd"
,
CreditDebitCode
.
CRDT
.
value
());
txDtlsMaps
.
put
(
"cdtDbtInd"
,
CreditDebitCode
.
CRDT
.
value
());
}
Tag
tag32A
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
"32A"
);
if
(
tag32A
!=
null
){
Field32A
field32A
=
(
Field32A
)
tag32A
.
asField
();
if
(
field32A
.
getValue
().
length
()>
10
){
Map
<
String
,
Object
>
acctMaps
=
null
;
if
(
ntfctnMaps
.
containsKey
(
"acct"
)){
acctMaps
=
(
Map
<
String
,
Object
>)
ntfctnMaps
.
get
(
"acct"
);
}
else
{
acctMaps
=
new
HashMap
<>();
ntfctnMaps
.
put
(
"acct"
,
acctMaps
);
}
buildSTErrorInfo
(
ERROR
.
T20200
,
"Ntfctn/Acct/Ccy"
,
null
);
acctMaps
.
put
(
"ccy"
,
field32A
.
getValue
().
substring
(
6
,
9
));
}
}
String
uetr
=
abstractMT
.
getSwiftMessage
().
getUETR
();
if
(
StringUtil
.
isNotEmpty
(
uetr
))
{
Map
<
String
,
Object
>
refsMaps
=
new
HashMap
<>();
...
...
@@ -99,27 +78,6 @@ public class Mt2MxCamt054001Creator extends AbstractMt2MxCreator {
context
.
set
(
Mt2MxContextIdentifier
.
MT_TO_MX_FLAG_50
,
"false"
);
}
protected
void
buildSTErrorInfo
(
String
errorCode
,
String
location
,
String
originalValue
)
{
SwiftTranslationReport
str
=
context
.
get
(
SwiftTranslationReport
.
class
);
SwiftTranslationErrorInfo
errorInfo
=
SwiftTransferUtil
.
getSwiftTranslationErrorInfoByErrorCode
(
errorCode
);
errorInfo
.
setLocation
(
location
);
errorInfo
.
setOriginalValue
(
originalValue
);
List
<
SwiftTranslationErrorInfo
>
errorInfos
=
str
.
getErrorInfos
();
boolean
existFlag
=
false
;
for
(
int
i
=
0
;
i
<
errorInfos
.
size
();
i
++)
{
if
(
SwiftTransferUtil
.
compareStErrorInfo
(
errorInfo
,
errorInfos
.
get
(
i
)))
{
existFlag
=
true
;
break
;
}
}
if
(!
existFlag
)
{
str
.
addErrorInfo
(
errorInfo
);
if
(
"FAILURE"
.
equalsIgnoreCase
(
errorInfo
.
getErrorType
()))
{
throw
new
SwiftException
(
location
+
Mx2MtConstants
.
NEW_LINE
+
"-"
+
errorInfo
.
getErrorType
()
+
":"
+
errorInfo
.
getDescription
());
}
}
}
@Override
public
List
<
Mt2MxParseField
>
getParseFieldList
()
{
List
<
Mt2MxParseField
>
list
=
new
ArrayList
<>();
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse13DField.java
View file @
5e157cef
package
com
.
brilliance
.
swift
.
mt2mx
.
camt054001
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt054001.AbstractMt2MxCamt054001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field13D
;
import
com.prowidesoftware.swift.model.field.Field25
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
//这个域存放的是报文的创建时间,将这个时间放入map集合中
public
class
Camt054001Parse13DField
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME
=
"13D"
;
...
...
@@ -19,24 +17,6 @@ public class Camt054001Parse13DField extends AbstractMt2MxCamt054001ParseField {
public
void
parseField
()
throws
SwiftException
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag13D
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
Map
<
String
,
Object
>
ntryMaps
=
null
;
JSONArray
ntryJsonArray
=
null
;
if
(
ntfctnMaps
.
containsKey
(
"ntry"
)){
ntryJsonArray
=
(
JSONArray
)
ntfctnMaps
.
get
(
"ntry"
);
if
(
ntryJsonArray
!=
null
){
if
(
ntryJsonArray
.
size
()>
0
)
{
ntryMaps
=
(
Map
<
String
,
Object
>)
ntryJsonArray
.
get
(
0
);
}
else
{
ntryMaps
=
new
HashMap
<>();
ntryJsonArray
.
add
(
ntryMaps
);
}
}
}
else
{
ntryJsonArray
=
new
JSONArray
();
ntryMaps
=
new
HashMap
<>();
ntfctnMaps
.
put
(
"ntry"
,
ntryJsonArray
);
ntryJsonArray
.
add
(
ntryMaps
);
}
Map
<
String
,
Object
>
bookgDtMaps
=
new
HashMap
<>();
ntryMaps
.
put
(
"bookgDt"
,
bookgDtMaps
);
if
(
tag13D
!=
null
)
{
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse20Field.java
View file @
5e157cef
...
...
@@ -4,7 +4,7 @@ import com.brilliance.swift.exception.SwiftException;
import
com.brilliance.swift.mt2mx.camt054001.AbstractMt2MxCamt054001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
//这个域是将唯一标识填入需要唯一标识的map集合中
public
class
Camt054001Parse20Field
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME
=
"20"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse21Field.java
View file @
5e157cef
...
...
@@ -7,7 +7,7 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import
java.util.HashMap
;
import
java.util.Map
;
//这个域是将业务编号存入map集合中
public
class
Camt054001Parse21Field
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME
=
"21"
;
...
...
@@ -17,7 +17,6 @@ public class Camt054001Parse21Field extends AbstractMt2MxCamt054001ParseField {
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag21
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag21
!=
null
)
{
Map
<
String
,
Object
>
txDtlsMaps
=
getTransactionDetails
();
Map
<
String
,
Object
>
refsMaps
=
null
;
if
(
txDtlsMaps
.
containsKey
(
"refs"
)){
refsMaps
=
(
Map
<
String
,
Object
>)
txDtlsMaps
.
get
(
"refs"
);
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse25Field.java
View file @
5e157cef
package
com
.
brilliance
.
swift
.
mt2mx
.
camt054001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.camt054001.AbstractMt2MxCamt054001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field25
;
...
...
@@ -10,7 +9,7 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import
java.util.HashMap
;
import
java.util.Map
;
//账号信息
public
class
Camt054001Parse25Field
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME_25
=
"25"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse32AField.java
View file @
5e157cef
package
com
.
brilliance
.
swift
.
mt2mx
.
camt054001
.
impl
;
import
com.
alibaba.fastjson.JSONArray
;
import
com.
brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt054001.AbstractMt2MxCamt054001ParseField
;
import
com.brilliance.swift.util.DateUtil
;
...
...
@@ -12,7 +12,7 @@ import java.text.ParseException;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
//这个域存储的是起息日,货币和金额
public
class
Camt054001Parse32AField
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME
=
"32A"
;
...
...
@@ -24,51 +24,31 @@ public class Camt054001Parse32AField extends AbstractMt2MxCamt054001ParseField {
Tag
tag32A
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag32A
!=
null
)
{
Field32A
field32A
=
(
Field32A
)
tag32A
.
asField
();
Date
date
=
DateUtil
.
parseDate
(
"20"
+
field32A
.
getDate
(),
"yyyyMMdd"
);
String
dateStr
=
DateUtil
.
format
(
date
,
"yyyy-MM-dd"
);
Map
<
String
,
Object
>
ntryMaps
=
null
;
JSONArray
ntryJsonArray
=
null
;
if
(
ntfctnMaps
.
containsKey
(
"ntry"
)){
ntryJsonArray
=
(
JSONArray
)
ntfctnMaps
.
get
(
"ntry"
);
if
(
ntryJsonArray
!=
null
){
if
(
ntryJsonArray
.
size
()>
0
)
{
ntryMaps
=
(
Map
<
String
,
Object
>)
ntryJsonArray
.
get
(
0
);
}
else
{
ntryMaps
=
new
HashMap
<>();
ntryJsonArray
.
add
(
ntryMaps
);
}
if
(
field32A
.
getValue
().
length
()>
10
){
Map
<
String
,
Object
>
acctMaps
=
null
;
if
(
ntfctnMaps
.
containsKey
(
"acct"
)){
acctMaps
=
(
Map
<
String
,
Object
>)
ntfctnMaps
.
get
(
"acct"
);
}
else
{
acctMaps
=
new
HashMap
<>();
ntfctnMaps
.
put
(
"acct"
,
acctMaps
);
}
}
else
{
ntryJsonArray
=
new
JSONArray
();
ntryMaps
=
new
HashMap
<>();
ntfctnMaps
.
put
(
"ntry"
,
ntryJsonArray
);
ntryJsonArray
.
add
(
ntryMaps
);
buildSTErrorInfo
(
ERROR
.
T20200
,
"Ntfctn/Acct/Ccy"
,
null
);
acctMaps
.
put
(
"ccy"
,
field32A
.
getValue
().
substring
(
6
,
9
));
}
Date
date
=
DateUtil
.
parseDate
(
"20"
+
field32A
.
getDate
(),
"yyyyMMdd"
);
String
dateStr
=
DateUtil
.
format
(
date
,
"yyyy-MM-dd"
);
Map
<
String
,
Object
>
valDtMaps
=
new
HashMap
<>();
ntryMaps
.
put
(
"valDt"
,
valDtMaps
);
valDtMaps
.
put
(
"dt"
,
dateStr
);
Map
<
String
,
Object
>
txDtlsMaps
=
getTransactionDetails
();
Map
<
String
,
Object
>
rltdDtsMaps
=
new
HashMap
<>();
txDtlsMaps
.
put
(
"rltdDts"
,
rltdDtsMaps
);
rltdDtsMaps
.
put
(
"intrBkSttlmDt"
,
dateStr
);
Map
<
String
,
Object
>
amtMaps
=
null
;
Map
<
String
,
Object
>
txDtlsamtMaps
=
null
;
if
(
ntryMaps
.
containsKey
(
"amt"
)){
amtMaps
=
(
Map
<
String
,
Object
>)
ntryMaps
.
get
(
"amt"
);
}
else
{
amtMaps
=
new
HashMap
<>();
ntryMaps
.
put
(
"amt"
,
amtMaps
);
}
if
(
txDtlsMaps
.
containsKey
(
"amt"
)){
txDtlsamtMaps
=
(
Map
<
String
,
Object
>)
txDtlsMaps
.
get
(
"amt"
);
}
else
{
txDtlsamtMaps
=
new
HashMap
<>();
txDtlsMaps
.
put
(
"amt"
,
txDtlsamtMaps
);
}
amtMaps
.
put
(
"value"
,
field32A
.
amount
());
txDtlsamtMaps
.
put
(
"value"
,
field32A
.
amount
());
amtMaps
.
put
(
"ccy"
,
field32A
.
getCurrency
());
txDtlsamtMaps
.
put
(
"ccy"
,
field32A
.
getCurrency
());
Map
<
String
,
Object
>
amtMaps
=
new
HashMap
<>();
amtMaps
.
put
(
"value"
,
field32A
.
amount
());
amtMaps
.
put
(
"ccy"
,
field32A
.
getCurrency
());
ntryMaps
.
put
(
"amt"
,
amtMaps
);
Map
<
String
,
Object
>
txDtlAmtMaps
=
new
HashMap
<>(
amtMaps
);
txDtlsMaps
.
put
(
"amt"
,
txDtlAmtMaps
);
}
}
catch
(
ParseException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse50Field.java
View file @
5e157cef
...
...
@@ -14,7 +14,7 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
//汇款人信息
public
class
Camt054001Parse50Field
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME_A
=
"50A"
;
...
...
@@ -47,7 +47,6 @@ public class Camt054001Parse50Field extends AbstractMt2MxCamt054001ParseField {
if
(
field50A
!=
null
||
field50F
!=
null
||
field50K
!=
null
){
context
.
set
(
Mt2MxContextIdentifier
.
MT_TO_MX_FLAG_50
,
"true"
);
}
Map
<
String
,
Object
>
txDtlsMaps
=
getTransactionDetails
();
Map
<
String
,
Object
>
rltdPtiesMaps
=
null
;
if
(
txDtlsMaps
.
containsKey
(
"rltdPties"
))
{
rltdPtiesMaps
=
(
Map
<
String
,
Object
>)
txDtlsMaps
.
get
(
"rltdPties"
);
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse52For900Field.java
View file @
5e157cef
package
com
.
brilliance
.
swift
.
mt2mx
.
camt054001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.camt054001.AbstractMt2MxCamt054001ParseField
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.Tag
;
...
...
@@ -11,7 +10,7 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import
java.util.HashMap
;
import
java.util.Map
;
//指示行信息
public
class
Camt054001Parse52For900Field
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME_A
=
"52A"
;
...
...
@@ -34,7 +33,6 @@ public class Camt054001Parse52For900Field extends AbstractMt2MxCamt054001ParseFi
if
(
tag
!=
null
)
{
field52D
=
(
Field52D
)
tag
.
asField
();
}
Map
<
String
,
Object
>
txDtlsMaps
=
getTransactionDetails
();
Map
<
String
,
Object
>
rltdPtiesMaps
=
null
;
if
(
txDtlsMaps
.
containsKey
(
"rltdPties"
))
{
rltdPtiesMaps
=
(
Map
<
String
,
Object
>)
txDtlsMaps
.
get
(
"rltdPties"
);
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse52For910Field.java
View file @
5e157cef
...
...
@@ -11,7 +11,7 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import
java.util.HashMap
;
import
java.util.Map
;
//指示行信息
public
class
Camt054001Parse52For910Field
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME_A
=
"52A"
;
...
...
@@ -34,7 +34,6 @@ public class Camt054001Parse52For910Field extends AbstractMt2MxCamt054001ParseFi
if
(
tag
!=
null
)
{
field52D
=
(
Field52D
)
tag
.
asField
();
}
Map
<
String
,
Object
>
txDtlsMaps
=
getTransactionDetails
();
String
flag
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_TO_MX_FLAG_50
);
if
(
"true"
.
equals
(
flag
)){
Map
<
String
,
Object
>
rltdAgtsMaps
=
null
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse56Field.java
View file @
5e157cef
package
com
.
brilliance
.
swift
.
mt2mx
.
camt054001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.camt054001.AbstractMt2MxCamt054001ParseField
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field56A
;
import
com.prowidesoftware.swift.model.field.Field56C
;
import
com.prowidesoftware.swift.model.field.Field56D
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
//中间行信息
public
class
Camt054001Parse56Field
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME_A
=
"56A"
;
...
...
@@ -35,7 +33,6 @@ public class Camt054001Parse56Field extends AbstractMt2MxCamt054001ParseField {
if
(
tag
!=
null
)
{
field56D
=
(
Field56D
)
tag
.
asField
();
}
Map
<
String
,
Object
>
txDtlsMaps
=
getTransactionDetails
();
Map
<
String
,
Object
>
rltdAgtsMaps
=
null
;
if
(
txDtlsMaps
.
containsKey
(
"rltdAgts"
))
{
rltdAgtsMaps
=
(
Map
<
String
,
Object
>)
txDtlsMaps
.
get
(
"rltdAgts"
);
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt054001/impl/Camt054001Parse72Field.java
View file @
5e157cef
...
...
@@ -7,8 +7,7 @@ import com.prowidesoftware.swift.model.field.Field72;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.List
;
import
java.util.Map
;
//附加说明
public
class
Camt054001Parse72Field
extends
AbstractMt2MxCamt054001ParseField
{
private
static
final
String
NAME
=
"72"
;
...
...
@@ -18,7 +17,6 @@ public class Camt054001Parse72Field extends AbstractMt2MxCamt054001ParseField {
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag72
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag72
!=
null
)
{
Map
<
String
,
Object
>
txDtlsMaps
=
getTransactionDetails
();
Field72
field72
=
(
Field72
)
tag72
.
asField
();
List
<
String
>
lines
=
field72
.
getLines
();
String
addtlTxInf
=
""
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt056001/AbstractMt2MxCamt056001ParseField.java
View file @
5e157cef
...
...
@@ -3,7 +3,6 @@ package com.brilliance.swift.mt2mx.camt056001;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.mt2mx.AbstractMt2MxParseField
;
import
java.util.HashMap
;
import
java.util.Map
;
public
abstract
class
AbstractMt2MxCamt056001ParseField
extends
AbstractMt2MxParseField
{
...
...
@@ -14,34 +13,17 @@ public abstract class AbstractMt2MxCamt056001ParseField extends AbstractMt2MxPar
protected
Map
<
String
,
Object
>
undrlygMaps
=
null
;
protected
Map
<
String
,
Object
>
txInfMaps
=
null
;
@Override
public
void
initJsonMaps
()
{
super
.
initJsonMaps
();
appHdrMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"appHdr"
);
Map
<
String
,
Object
>
fiToFIPmtCxlReqMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"fiToFIPmtCxlReq"
);
assgnmtMaps
=
(
Map
<
String
,
Object
>)
fiToFIPmtCxlReqMaps
.
get
(
"assgnmt"
);
appHdrMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"appHdr"
);
Map
<
String
,
Object
>
fiToFIPmtCxlReqMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"fiToFIPmtCxlReq"
);
assgnmtMaps
=
(
Map
<
String
,
Object
>)
fiToFIPmtCxlReqMaps
.
get
(
"assgnmt"
);
JSONArray
undrlygJsonArray
=
(
JSONArray
)
fiToFIPmtCxlReqMaps
.
get
(
"undrlyg"
);
undrlygMaps
=
(
Map
<
String
,
Object
>)
undrlygJsonArray
.
get
(
0
);
}
public
Map
<
String
,
Object
>
getTxInfMaps
(){
Map
<
String
,
Object
>
txInfMaps
=
null
;
JSONArray
txInfJsonArray
=
null
;
if
(
undrlygMaps
.
containsKey
(
"txInf"
)){
txInfJsonArray
=
(
JSONArray
)
undrlygMaps
.
get
(
"txInf"
);
if
(
txInfJsonArray
!=
null
){
if
(
txInfJsonArray
.
size
()>
0
)
{
txInfMaps
=
(
Map
<
String
,
Object
>)
txInfJsonArray
.
get
(
0
);
}
else
{
txInfMaps
=
new
HashMap
<>();
txInfJsonArray
.
add
(
txInfMaps
);
}
}
}
else
{
txInfJsonArray
=
new
JSONArray
();
txInfMaps
=
new
HashMap
<>();
undrlygMaps
.
put
(
"txInf"
,
txInfJsonArray
);
txInfJsonArray
.
add
(
txInfMaps
);
}
return
txInfMaps
;
undrlygMaps
=
(
Map
<
String
,
Object
>)
undrlygJsonArray
.
get
(
0
);
JSONArray
txInfJsonArray
=
(
JSONArray
)
undrlygMaps
.
get
(
"txInf"
);
txInfMaps
=
(
Map
<
String
,
Object
>)
txInfJsonArray
.
get
(
0
);
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt056001/Mt2MxCamt056001Creator.java
View file @
5e157cef
package
com
.
brilliance
.
swift
.
mt2mx
.
camt056001
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.AbstractMt2MxCreator
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.Mt2MxParseField
;
import
com.brilliance.swift.mt2mx.camt056001.impl.*
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.vo.SwiftTranslationErrorInfo
;
import
com.brilliance.swift.vo.SwiftTranslationReport
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field79
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.ArrayList
;
...
...
@@ -26,16 +19,18 @@ public class Mt2MxCamt056001Creator extends AbstractMt2MxCreator {
@Override
public
void
preProcess
()
{
super
.
preProcess
();
//将报文类型放入jsonMaps集合中,这个maps集合是最上层
jsonMaps
.
put
(
"identifier"
,
"camt.056.001.08"
);
Map
<
String
,
Object
>
appHdrMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"appHdr"
);
//将消息头中的消息名放入头部的map集合中
appHdrMaps
.
put
(
"msgDefIdr"
,
"camt.056.001.08"
);
//得到AbstractMT这个对象用来解析mt文件
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
//初始化转换和不需要BLOCK4的转换
Map
<
String
,
Object
>
fiToFIPmtCxlReqMaps
=
new
HashMap
<>();
jsonMaps
.
put
(
"fiToFIPmtCxlReq"
,
fiToFIPmtCxlReqMaps
);
Map
<
String
,
Object
>
assgnmtMaps
=
new
HashMap
<>();
fiToFIPmtCxlReqMaps
.
put
(
"assgnmt"
,
assgnmtMaps
);
//将当前的时间存入这个map集合中
assgnmtMaps
.
put
(
"creDtTm"
,
getCreateDateStr
());
Map
<
String
,
Object
>
undrlygMaps
=
new
HashMap
<>();
...
...
@@ -46,10 +41,12 @@ public class Mt2MxCamt056001Creator extends AbstractMt2MxCreator {
JSONArray
txInfJsonArray
=
new
JSONArray
();
txInfJsonArray
.
add
(
txInfMaps
);
undrlygMaps
.
put
(
"txInf"
,
txInfJsonArray
);
//将报文追踪号存入map集合中
String
orgnlUETR
=
abstractMT
.
getSwiftMessage
().
getUETR
();
if
(
StringUtil
.
isNotEmpty
(
orgnlUETR
))
{
txInfMaps
.
put
(
"orgnlUETR"
,
orgnlUETR
);
}
//根据官方文档这个位置存值NOTPROVIDED
txInfMaps
.
put
(
"orgnlEndToEndId"
,
Mx2MtConstants
.
MT_TO_MX_DEFAULT_VALUE
);
String
sendBic
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_SEND_BIC
,
true
);
if
(
StringUtil
.
isNotEmpty
(
sendBic
))
{
...
...
@@ -57,6 +54,7 @@ public class Mt2MxCamt056001Creator extends AbstractMt2MxCreator {
assgnmtMaps
.
put
(
"assgnr"
,
assgnrMaps
);
Map
<
String
,
Object
>
agtMaps
=
new
HashMap
<>();
assgnrMaps
.
put
(
"agt"
,
agtMaps
);
//调用这个方法将转让人(消息发送者)的参与行的行号存入map集合中
mt_to_mxBICFI
(
sendBic
,
agtMaps
);
}
String
receiverBic
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_RECEIVE_BIC
,
true
);
...
...
@@ -65,8 +63,10 @@ public class Mt2MxCamt056001Creator extends AbstractMt2MxCreator {
assgnmtMaps
.
put
(
"assgne"
,
assgneMaps
);
Map
<
String
,
Object
>
agtMaps
=
new
HashMap
<>();
assgneMaps
.
put
(
"agt"
,
agtMaps
);
//调用这个方法将受让人(消息接受者)的参与行的行号存入map集合中
mt_to_mxBICFI
(
receiverBic
,
agtMaps
);
}
//假定创建者是代理人而不是当事人,根据官方文档在nm和adrLine这两个位置存值NOTPROVIDED
Map
<
String
,
Object
>
caseMaps
=
null
;
if
(
txInfMaps
.
containsKey
(
"_case"
)){
caseMaps
=
(
Map
<
String
,
Object
>)
txInfMaps
.
get
(
"_case"
);
...
...
@@ -86,36 +86,6 @@ public class Mt2MxCamt056001Creator extends AbstractMt2MxCreator {
JSONArray
adrLineJsonArray
=
new
JSONArray
();
pstlAdrMaps
.
put
(
"adrLine"
,
adrLineJsonArray
);
adrLineJsonArray
.
add
(
Mx2MtConstants
.
MT_TO_MX_DEFAULT_VALUE
);
Tag
tag79
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
"79"
);
Field79
field79
=
(
Field79
)
tag79
.
asField
();
int
index
=
field79
.
getValue
().
indexOf
(
"/UETR/"
);
String
uetr
=
""
;
if
(
index
>-
1
){
uetr
=
field79
.
getValue
().
substring
(
index
+
6
);
}
if
(
StringUtil
.
isEmpty
(
orgnlUETR
)&&
StringUtil
.
isEmpty
(
uetr
)){
buildSTErrorInfo
(
ERROR
.
T20087
,
"Block3/UETR"
,
null
);
}
}
protected
void
buildSTErrorInfo
(
String
errorCode
,
String
location
,
String
originalValue
)
{
SwiftTranslationReport
str
=
context
.
get
(
SwiftTranslationReport
.
class
);
SwiftTranslationErrorInfo
errorInfo
=
SwiftTransferUtil
.
getSwiftTranslationErrorInfoByErrorCode
(
errorCode
);
errorInfo
.
setLocation
(
location
);
errorInfo
.
setOriginalValue
(
originalValue
);
List
<
SwiftTranslationErrorInfo
>
errorInfos
=
str
.
getErrorInfos
();
boolean
existFlag
=
false
;
for
(
int
i
=
0
;
i
<
errorInfos
.
size
();
i
++)
{
if
(
SwiftTransferUtil
.
compareStErrorInfo
(
errorInfo
,
errorInfos
.
get
(
i
)))
{
existFlag
=
true
;
break
;
}
}
if
(!
existFlag
)
{
str
.
addErrorInfo
(
errorInfo
);
if
(
"FAILURE"
.
equalsIgnoreCase
(
errorInfo
.
getErrorType
()))
{
throw
new
SwiftException
(
location
+
Mx2MtConstants
.
NEW_LINE
+
"-"
+
errorInfo
.
getErrorType
()
+
":"
+
errorInfo
.
getDescription
());
}
}
}
@Override
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt056001/impl/Camt056001Parse11SField.java
View file @
5e157cef
...
...
@@ -4,7 +4,6 @@ import com.brilliance.swift.exception.SwiftException;
import
com.brilliance.swift.mt2mx.camt056001.AbstractMt2MxCamt056001ParseField
;
import
com.brilliance.swift.util.DateUtil
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field11R
;
import
com.prowidesoftware.swift.model.field.Field11S
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
...
...
@@ -12,7 +11,7 @@ import java.text.ParseException;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
//这个域的作用就是将原始消息的名称和原始消息的创建时间存入map集合
public
class
Camt056001Parse11SField
extends
AbstractMt2MxCamt056001ParseField
{
private
static
final
String
NAME
=
"11S"
;
...
...
@@ -26,7 +25,6 @@ public class Camt056001Parse11SField extends AbstractMt2MxCamt056001ParseField {
Field11S
field11S
=
(
Field11S
)
tag11S
.
asField
();
Date
date
=
DateUtil
.
parseDate
(
"20"
+
field11S
.
getDate
(),
"yyyyMMdd"
);
String
dateStr
=
DateUtil
.
format
(
date
,
"yyyy-MM-dd"
);
Map
<
String
,
Object
>
txInfMaps
=
getTxInfMaps
();
Map
<
String
,
Object
>
orgnlGrpInfMaps
=
null
;
if
(
txInfMaps
.
containsKey
(
"orgnlGrpInf"
)){
orgnlGrpInfMaps
=
(
Map
<
String
,
Object
>)
txInfMaps
.
get
(
"orgnlGrpInf"
);
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt056001/impl/Camt056001Parse20Field.java
View file @
5e157cef
package
com
.
brilliance
.
swift
.
mt2mx
.
camt056001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt029001.AbstractMt2MxCamt029001ParseField
;
import
com.brilliance.swift.mt2mx.camt056001.AbstractMt2MxCamt056001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
//这个域是将唯一标识填入需要唯一标识的map集合中
public
class
Camt056001Parse20Field
extends
AbstractMt2MxCamt056001ParseField
{
private
static
final
String
NAME
=
"20"
;
...
...
@@ -20,7 +19,6 @@ public class Camt056001Parse20Field extends AbstractMt2MxCamt056001ParseField {
if
(
tag20
!=
null
)
{
appHdrMaps
.
put
(
"bizMsgIdr"
,
tag20
.
getValue
());
assgnmtMaps
.
put
(
"id"
,
tag20
.
getValue
());
Map
<
String
,
Object
>
txInfMaps
=
getTxInfMaps
();
Map
<
String
,
Object
>
caseMaps
=
null
;
if
(
txInfMaps
.
containsKey
(
"_case"
)){
caseMaps
=
(
Map
<
String
,
Object
>)
txInfMaps
.
get
(
"_case"
);
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt056001/impl/Camt056001Parse21Field.java
View file @
5e157cef
...
...
@@ -7,7 +7,7 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import
java.util.HashMap
;
import
java.util.Map
;
//将原始消息的标识号填入map集合中
public
class
Camt056001Parse21Field
extends
AbstractMt2MxCamt056001ParseField
{
private
static
final
String
NAME
=
"21"
;
...
...
@@ -17,7 +17,6 @@ public class Camt056001Parse21Field extends AbstractMt2MxCamt056001ParseField {
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag21
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag21
!=
null
)
{
Map
<
String
,
Object
>
txInfMaps
=
getTxInfMaps
();
txInfMaps
.
put
(
"orgnlInstrId"
,
tag21
.
getValue
());
Map
<
String
,
Object
>
orgnlGrpInfMaps
=
null
;
if
(
txInfMaps
.
containsKey
(
"orgnlGrpInf"
)){
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt056001/impl/Camt056001Parse32AField.java
View file @
5e157cef
...
...
@@ -12,7 +12,7 @@ import java.text.ParseException;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
//这个域的作用是将原始发报行给收报行的金额和原始结算日期填入map集合中
public
class
Camt056001Parse32AField
extends
AbstractMt2MxCamt056001ParseField
{
private
static
final
String
NAME
=
"32A"
;
...
...
@@ -26,7 +26,6 @@ public class Camt056001Parse32AField extends AbstractMt2MxCamt056001ParseField {
Field32A
field32A
=
(
Field32A
)
tag32A
.
asField
();
Date
date
=
DateUtil
.
parseDate
(
"20"
+
field32A
.
getDate
(),
"yyyyMMdd"
);
String
dateStr
=
DateUtil
.
format
(
date
,
"yyyy-MM-dd"
);
Map
<
String
,
Object
>
txInfMaps
=
getTxInfMaps
();
txInfMaps
.
put
(
"orgnlIntrBkSttlmDt"
,
dateStr
);
Map
<
String
,
Object
>
orgnlIntrBkSttlmAmtMaps
=
new
HashMap
();
orgnlIntrBkSttlmAmtMaps
.
put
(
"value"
,
field32A
.
amount
());
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt056001/impl/Camt056001Parse79Field.java
View file @
5e157cef
package
com
.
brilliance
.
swift
.
mt2mx
.
camt056001
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.constants.ERROR
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.camt056001.AbstractMt2MxCamt056001ParseField
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field79
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
//79域就是将取消原因对应代码和取消原因的详情放入对应的map集合中
public
class
Camt056001Parse79Field
extends
AbstractMt2MxCamt056001ParseField
{
private
static
final
String
NAME
=
"79"
;
...
...
@@ -20,34 +18,19 @@ public class Camt056001Parse79Field extends AbstractMt2MxCamt056001ParseField {
public
void
parseField
()
throws
SwiftException
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag79
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
Map
<
String
,
Object
>
txInfMaps
=
getTxInfMaps
();
if
(
tag79
!=
null
)
{
Field79
field79
=
(
Field79
)
tag79
.
asField
();
List
<
String
>
lines
=
field79
.
getLines
();
//第一行: /4!C/[附加信息] 4!C是取消原因代码
//第2-35行:附加信息的继续
//最后一行:/UETR/UETRValue
mt_To_mxField79
(
lines
,
txInfMaps
);
}
else
{
JSONArray
cxlRsnInfJSONArray
=
null
;
Map
<
String
,
Object
>
cxlRsnInfMaps
=
null
;
if
(
txInfMaps
.
containsKey
(
"cxlRsnInf"
)){
cxlRsnInfJSONArray
=
(
JSONArray
)
txInfMaps
.
get
(
"cxlRsnInf"
);
if
(
cxlRsnInfJSONArray
.
size
()>
0
){
cxlRsnInfMaps
=
(
Map
<
String
,
Object
>)
cxlRsnInfJSONArray
.
get
(
0
);
}
else
{
cxlRsnInfMaps
=
new
HashMap
<>();
cxlRsnInfJSONArray
.
add
(
cxlRsnInfMaps
);
}
}
else
{
cxlRsnInfJSONArray
=
new
JSONArray
();
cxlRsnInfMaps
=
new
HashMap
<>();
txInfMaps
.
put
(
"cxlRsnInf"
,
cxlRsnInfJSONArray
);
cxlRsnInfJSONArray
.
add
(
cxlRsnInfMaps
);
String
orgnlUETR
=
abstractMT
.
getSwiftMessage
().
getUETR
();
if
(
StringUtil
.
isEmpty
(
orgnlUETR
)){
buildSTErrorInfo
(
ERROR
.
T20087
,
"Block3/UETR"
,
null
);
}
Map
<
String
,
Object
>
rsnMaps
=
new
HashMap
<>();
cxlRsnInfMaps
.
put
(
"rsn"
,
rsnMaps
);
rsnMaps
.
put
(
"cd"
,
"NARR"
);
JSONArray
addtlInfJSONArray
=
new
JSONArray
();
cxlRsnInfMaps
.
put
(
"addtlInf"
,
addtlInfJSONArray
);
addtlInfJSONArray
.
add
(
Mx2MtConstants
.
MT_TO_MX_DEFAULT_VALUE
);
mt_To_mxField79
(
null
,
txInfMaps
);
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt057001/impl/Camt057001Parse20Field.java
View file @
5e157cef
...
...
@@ -4,7 +4,7 @@ import com.brilliance.swift.exception.SwiftException;
import
com.brilliance.swift.mt2mx.camt057001.AbstractMt2MxCamt057001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
//这个域是将唯一标识填入需要唯一标识的map集合中
public
class
Camt057001Parse20Field
extends
AbstractMt2MxCamt057001ParseField
{
private
static
final
String
NAME
=
"20"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt057001/impl/Camt057001Parse21Field.java
View file @
5e157cef
...
...
@@ -9,7 +9,7 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import
java.util.HashMap
;
import
java.util.Map
;
//这个域是将业务编号存入map集合中
public
class
Camt057001Parse21Field
extends
AbstractMt2MxCamt057001ParseField
{
private
static
final
String
NAME
=
"21"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt057001/impl/Camt057001Parse25Field.java
View file @
5e157cef
...
...
@@ -8,7 +8,7 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import
java.util.HashMap
;
import
java.util.Map
;
//账号信息
public
class
Camt057001Parse25Field
extends
AbstractMt2MxCamt057001ParseField
{
private
static
final
String
NAME
=
"25"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt057001/impl/Camt057001Parse30Field.java
View file @
5e157cef
...
...
@@ -9,7 +9,7 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import
java.text.ParseException
;
import
java.util.Date
;
//起息日
public
class
Camt057001Parse30Field
extends
AbstractMt2MxCamt057001ParseField
{
private
static
final
String
NAME
=
"30"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt057001/impl/Camt057001Parse32BField.java
View file @
5e157cef
...
...
@@ -9,7 +9,7 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import
java.util.HashMap
;
import
java.util.Map
;
//货币和金额
public
class
Camt057001Parse32BField
extends
AbstractMt2MxCamt057001ParseField
{
private
static
final
String
NAME
=
"32B"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt057001/impl/Camt057001Parse50Field.java
View file @
5e157cef
...
...
@@ -12,7 +12,7 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
//汇款人
public
class
Camt057001Parse50Field
extends
AbstractMt2MxCamt057001ParseField
{
private
static
final
String
NAME
=
"50"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt057001/impl/Camt057001Parse52Field.java
View file @
5e157cef
...
...
@@ -9,7 +9,7 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import
java.util.HashMap
;
import
java.util.Map
;
//指示行
public
class
Camt057001Parse52Field
extends
AbstractMt2MxCamt057001ParseField
{
private
static
final
String
NAME_A
=
"52A"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2mx/camt057001/impl/Camt057001Parse56Field.java
View file @
5e157cef
...
...
@@ -9,7 +9,7 @@ import com.prowidesoftware.swift.model.mt.AbstractMT;
import
java.util.HashMap
;
import
java.util.Map
;
//中间行
public
class
Camt057001Parse56Field
extends
AbstractMt2MxCamt057001ParseField
{
private
static
final
String
NAME_A
=
"56A"
;
...
...
@@ -35,7 +35,6 @@ public class Camt057001Parse56Field extends AbstractMt2MxCamt057001ParseField {
}
else
{
intrmyAgtMaps
=
new
HashMap
<>();
}
String
account
=
""
;
if
(
field56A
!=
null
){
String
bicCode
=
field56A
.
getBIC
();
mt_to_mxBICFI
(
bicCode
,
intrmyAgtMaps
);
...
...
swiftCore/src/test/java/com/brilliance/mx2mt/mt192/TestMx2MtFor192.java
View file @
5e157cef
...
...
@@ -11,7 +11,7 @@ import java.util.List;
public
class
TestMx2MtFor192
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\
MxC
amt05600108_192.xml"
);
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\
c
amt05600108_192.xml"
);
String
xmlStr
=
FileUtils
.
readFileToString
(
file
);
SwiftTranslationReport
str
=
SwiftTransfer
.
mx2MtPlus
(
xmlStr
,
null
,
null
);
if
(
str
!=
null
)
{
...
...
swiftCore/src/test/java/com/brilliance/mx2mt/mt196/TestMx2MtFor196.java
View file @
5e157cef
...
...
@@ -11,7 +11,7 @@ import java.util.List;
public
class
TestMx2MtFor196
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\
MxCamt02900108_2
96.xml"
);
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\
camt02900109_1
96.xml"
);
String
xmlStr
=
FileUtils
.
readFileToString
(
file
);
SwiftTranslationReport
str
=
SwiftTransfer
.
mx2MtPlus
(
xmlStr
,
null
,
null
);
if
(
str
!=
null
)
{
...
...
swiftCore/src/test/java/com/brilliance/mx2mt/mt910/TestMx2MtFor910.java
View file @
5e157cef
...
...
@@ -8,7 +8,7 @@ import java.io.File;
public
class
TestMx2MtFor910
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\
MxCamt05400108_CREDIT
.xml"
);
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\
camt05400108_910
.xml"
);
String
xmlStr
=
FileUtils
.
readFileToString
(
file
);
String
mt910
=
SwiftTransfer
.
mx2Mt
(
xmlStr
,
null
,
null
);
System
.
out
.
println
(
mt910
);
...
...
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