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
904a5834
Commit
904a5834
authored
Jun 19, 2022
by
chengzhuoshen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MT2MX,mt103转pacs008001
parent
57dda6f4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
57 changed files
with
3096 additions
and
48 deletions
+3096
-48
AbstractMt2MxCreator.java
...java/com/brilliance/swift/mt2mx/AbstractMt2MxCreator.java
+108
-0
AbstractMt2MxParseField.java
...a/com/brilliance/swift/mt2mx/AbstractMt2MxParseField.java
+0
-0
Mt2MxContext.java
...rc/main/java/com/brilliance/swift/mt2mx/Mt2MxContext.java
+7
-0
Mt2MxContextIdentifier.java
...va/com/brilliance/swift/mt2mx/Mt2MxContextIdentifier.java
+20
-0
Mt2MxCreator.java
...rc/main/java/com/brilliance/swift/mt2mx/Mt2MxCreator.java
+13
-0
Mt2MxCreatorManager.java
.../java/com/brilliance/swift/mt2mx/Mt2MxCreatorManager.java
+49
-0
Mt2MxParseField.java
...main/java/com/brilliance/swift/mt2mx/Mt2MxParseField.java
+6
-0
AbstractMt2MxPacs008001ParseField.java
...t/mt2mx/pacs008001/AbstractMt2MxPacs008001ParseField.java
+26
-0
Mt2MxPacs008001Creator.java
...liance/swift/mt2mx/pacs008001/Mt2MxPacs008001Creator.java
+107
-0
Pacs00801Parse13CField.java
...e/swift/mt2mx/pacs008001/impl/Pacs00801Parse13CField.java
+66
-0
Pacs00801Parse20Field.java
...ce/swift/mt2mx/pacs008001/impl/Pacs00801Parse20Field.java
+32
-0
Pacs00801Parse23BField.java
...e/swift/mt2mx/pacs008001/impl/Pacs00801Parse23BField.java
+11
-0
Pacs00801Parse23EField.java
...e/swift/mt2mx/pacs008001/impl/Pacs00801Parse23EField.java
+84
-0
Pacs00801Parse26TField.java
...e/swift/mt2mx/pacs008001/impl/Pacs00801Parse26TField.java
+31
-0
Pacs00801Parse32AField.java
...e/swift/mt2mx/pacs008001/impl/Pacs00801Parse32AField.java
+38
-0
Pacs00801Parse33BField.java
...e/swift/mt2mx/pacs008001/impl/Pacs00801Parse33BField.java
+28
-0
Pacs00801Parse36Field.java
...ce/swift/mt2mx/pacs008001/impl/Pacs00801Parse36Field.java
+24
-0
Pacs00801Parse50Field.java
...ce/swift/mt2mx/pacs008001/impl/Pacs00801Parse50Field.java
+158
-0
Pacs00801Parse52Field.java
...ce/swift/mt2mx/pacs008001/impl/Pacs00801Parse52Field.java
+97
-0
Pacs00801Parse53Field.java
...ce/swift/mt2mx/pacs008001/impl/Pacs00801Parse53Field.java
+103
-0
Pacs00801Parse54Field.java
...ce/swift/mt2mx/pacs008001/impl/Pacs00801Parse54Field.java
+186
-0
Pacs00801Parse55Field.java
...ce/swift/mt2mx/pacs008001/impl/Pacs00801Parse55Field.java
+188
-0
Pacs00801Parse56Field.java
...ce/swift/mt2mx/pacs008001/impl/Pacs00801Parse56Field.java
+190
-0
Pacs00801Parse57Field.java
...ce/swift/mt2mx/pacs008001/impl/Pacs00801Parse57Field.java
+0
-0
Pacs00801Parse59Field.java
...ce/swift/mt2mx/pacs008001/impl/Pacs00801Parse59Field.java
+143
-0
Pacs00801Parse70Field.java
...ce/swift/mt2mx/pacs008001/impl/Pacs00801Parse70Field.java
+49
-0
Pacs00801Parse71Field.java
...ce/swift/mt2mx/pacs008001/impl/Pacs00801Parse71Field.java
+105
-0
Pacs00801Parse72Field.java
...ce/swift/mt2mx/pacs008001/impl/Pacs00801Parse72Field.java
+24
-0
Pacs00801Parse77BField.java
...e/swift/mt2mx/pacs008001/impl/Pacs00801Parse77BField.java
+89
-0
Pacs00801ParseSetlAcctField.java
...ft/mt2mx/pacs008001/impl/Pacs00801ParseSetlAcctField.java
+89
-0
Pacs00801ParseSetlMtdField.java
...ift/mt2mx/pacs008001/impl/Pacs00801ParseSetlMtdField.java
+29
-0
AbstractSettlementMethodAnalyzer.java
...swift/mt2mx/setlmtd/AbstractSettlementMethodAnalyzer.java
+40
-0
SettlementMethodAnalyzer.java
...lliance/swift/mt2mx/setlmtd/SettlementMethodAnalyzer.java
+11
-0
SettlementMethodAnalyzerFactory.java
.../swift/mt2mx/setlmtd/SettlementMethodAnalyzerFactory.java
+109
-0
Field53A54AAnalyzer.java
...lliance/swift/mt2mx/setlmtd/impl/Field53A54AAnalyzer.java
+47
-0
Field53A54BAnalyzer.java
...lliance/swift/mt2mx/setlmtd/impl/Field53A54BAnalyzer.java
+41
-0
Field53A54DAnalyzer.java
...lliance/swift/mt2mx/setlmtd/impl/Field53A54DAnalyzer.java
+41
-0
Field53B54aAnalyzer.java
...lliance/swift/mt2mx/setlmtd/impl/Field53B54aAnalyzer.java
+33
-0
Field53D54aAnalyzer.java
...lliance/swift/mt2mx/setlmtd/impl/Field53D54aAnalyzer.java
+36
-0
FieldNone5354Analyzer.java
...iance/swift/mt2mx/setlmtd/impl/FieldNone5354Analyzer.java
+13
-0
FieldOnly53AAnalyzer.java
...liance/swift/mt2mx/setlmtd/impl/FieldOnly53AAnalyzer.java
+45
-0
FieldOnly53BAnalyzer.java
...liance/swift/mt2mx/setlmtd/impl/FieldOnly53BAnalyzer.java
+33
-0
FieldOnly53DAnalyzer.java
...liance/swift/mt2mx/setlmtd/impl/FieldOnly53DAnalyzer.java
+33
-0
FieldOnly54AAnalyzer.java
...liance/swift/mt2mx/setlmtd/impl/FieldOnly54AAnalyzer.java
+26
-0
FieldOnly54BAnalyzer.java
...liance/swift/mt2mx/setlmtd/impl/FieldOnly54BAnalyzer.java
+14
-0
FieldOnly54DAnalyzer.java
...liance/swift/mt2mx/setlmtd/impl/FieldOnly54DAnalyzer.java
+14
-0
AbstractMx2MtCreator.java
...java/com/brilliance/swift/mx2mt/AbstractMx2MtCreator.java
+21
-7
SwiftTransferUtil.java
...ain/java/com/brilliance/swift/util/SwiftTransferUtil.java
+74
-4
VoSettlementMethodHelper.java
...ava/com/brilliance/swift/vo/VoSettlementMethodHelper.java
+90
-0
ClearingSystemMemberCode.java
.../brilliance/swift/vo/common/ClearingSystemMemberCode.java
+10
-0
LocalInstrumentCode.java
...a/com/brilliance/swift/vo/common/LocalInstrumentCode.java
+120
-0
MT103.txt
swiftCore/src/main/resources/swiftTxt/MT103.txt
+33
-18
MxPacs00800109.xml
swiftCore/src/main/resources/swiftXml/MxPacs00800109.xml
+0
-16
Test.java
...e/src/test/java/com/brilliance/mt2mx/pacs008001/Test.java
+22
-0
Test.java
...ore/src/test/java/com/brilliance/mx2mtmap/mt103/Test.java
+33
-3
AbstractMX.java
...n/java/com/prowidesoftware/swift/model/mx/AbstractMX.java
+2
-0
AppHdrAdapter.java
...ava/com/prowidesoftware/swift/model/mx/AppHdrAdapter.java
+55
-0
No files found.
swiftCore/src/main/java/com/brilliance/swift/mt2mx/AbstractMt2MxCreator.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
;
import
com.alibaba.fastjson.JSONObject
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.common.MessagePriority
;
import
com.prowidesoftware.swift.model.SwiftBlock5
;
import
com.prowidesoftware.swift.model.SwiftBlock5Field
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mx.AbstractMX
;
import
java.util.HashMap
;
import
java.util.Map
;
public
abstract
class
AbstractMt2MxCreator
implements
Mt2MxCreator
{
protected
Mt2MxContext
context
;
public
Mt2MxContext
getContext
()
{
return
context
;
}
public
void
setContext
(
Mt2MxContext
context
)
{
this
.
context
=
context
;
}
protected
Map
<
String
,
Object
>
jsonMaps
=
new
HashMap
<>();
@Override
public
void
preProcess
()
{
context
.
set
(
Mt2MxContextIdentifier
.
MT_TO_MX_JSON_MAP
,
jsonMaps
);
Map
<
String
,
Object
>
appHdrMaps
=
new
HashMap
<>();
jsonMaps
.
put
(
"appHdr"
,
appHdrMaps
);
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
String
senderBic
=
abstractMT
.
getSender
();
senderBic
=
senderBic
.
substring
(
0
,
8
)
+
senderBic
.
substring
(
9
,
12
);
context
.
set
(
Mt2MxContextIdentifier
.
MT_SEND_BIC
,
senderBic
);
Map
<
String
,
Object
>
frMaps
=
new
HashMap
<>();
appHdrMaps
.
put
(
"fr"
,
frMaps
);
Map
<
String
,
Object
>
frFiIdMaps
=
new
HashMap
<>();
frMaps
.
put
(
"fiId"
,
frFiIdMaps
);
Map
<
String
,
Object
>
frFiIdFinInstnIdMaps
=
new
HashMap
<>();
frFiIdMaps
.
put
(
"finInstnId"
,
frFiIdFinInstnIdMaps
);
frFiIdFinInstnIdMaps
.
put
(
"bicfi"
,
senderBic
);
String
receiverBic
=
abstractMT
.
getReceiver
();
receiverBic
=
receiverBic
.
substring
(
0
,
8
)
+
receiverBic
.
substring
(
9
,
12
);
context
.
set
(
Mt2MxContextIdentifier
.
MT_RECEIVE_BIC
,
receiverBic
);
Map
<
String
,
Object
>
toMaps
=
new
HashMap
<>();
appHdrMaps
.
put
(
"to"
,
toMaps
);
Map
<
String
,
Object
>
toFiIdMaps
=
new
HashMap
<>();
toMaps
.
put
(
"fiId"
,
toFiIdMaps
);
Map
<
String
,
Object
>
toFiIdFinInstnIdMaps
=
new
HashMap
<>();
toFiIdMaps
.
put
(
"finInstnId"
,
toFiIdFinInstnIdMaps
);
toFiIdFinInstnIdMaps
.
put
(
"bicfi"
,
receiverBic
);
String
createDateStr
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
EXTERNAL_PARAMETERS_CREATION_DATE
,
true
);
if
(
StringUtil
.
isEmpty
(
createDateStr
))
{
createDateStr
=
"9999-12-31T00:00:00+00:00"
;
}
appHdrMaps
.
put
(
"creDt"
,
createDateStr
);
boolean
covFlag
=
abstractMT
.
getSwiftMessage
().
isCOV
();
if
(
covFlag
)
{
appHdrMaps
.
put
(
"bizSvc"
,
"swift.cbprplus.cov.02"
);
}
else
{
appHdrMaps
.
put
(
"bizSvc"
,
"swift.cbprplus.02"
);
}
String
priority
=
abstractMT
.
getMessagePriority
();
if
(
"U"
.
equals
(
priority
))
{
appHdrMaps
.
put
(
"prty"
,
MessagePriority
.
HIGH
.
value
());
}
else
{
// "N".equals(priority)
appHdrMaps
.
put
(
"prty"
,
MessagePriority
.
NORM
.
value
());
}
SwiftBlock5
block5
=
abstractMT
.
getSwiftMessage
().
getBlock5
();
if
(
block5
!=
null
&&
block5
.
containsTag
(
SwiftBlock5Field
.
PDE
.
name
()))
{
appHdrMaps
.
put
(
"pssblDplct"
,
Boolean
.
TRUE
);
}
else
{
appHdrMaps
.
put
(
"pssblDplct"
,
Boolean
.
FALSE
);
}
}
@Override
public
void
postProcess
()
{
String
swiftGsonStr
=
new
JSONObject
(
jsonMaps
).
toJSONString
();
AbstractMX
abstractMX
=
AbstractMX
.
fromJson
(
swiftGsonStr
);
String
xml
=
abstractMX
.
message
();
context
.
set
(
Mt2MxContextIdentifier
.
MT_TO_MX_XML
,
xml
);
}
/**
* 公共方法
*/
/**
* FinInstnId.BICFI = mtBicCode
* @param mtBicCode
* @param maps
*/
protected
void
mt_to_mxBICFI
(
String
mtBicCode
,
Map
<
String
,
Object
>
maps
)
{
if
(
StringUtil
.
isEmpty
(
mtBicCode
))
{
return
;
}
Map
<
String
,
Object
>
finInstnIdMaps
=
null
;
if
(
maps
.
containsKey
(
"finInstnId"
))
{
finInstnIdMaps
=
(
Map
<
String
,
Object
>)
maps
.
get
(
"finInstnId"
);
}
else
{
finInstnIdMaps
=
new
HashMap
<>();
maps
.
put
(
"finInstnId"
,
finInstnIdMaps
);
}
finInstnIdMaps
.
put
(
"bicfi"
,
mtBicCode
);
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/AbstractMt2MxParseField.java
0 → 100644
View file @
904a5834
This diff is collapsed.
Click to expand it.
swiftCore/src/main/java/com/brilliance/swift/mt2mx/Mt2MxContext.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
;
import
com.brilliance.swift.context.ContextImpl
;
public
class
Mt2MxContext
extends
ContextImpl
{
private
static
final
long
serialVersionUID
=
7846958949591485021L
;
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/Mt2MxContextIdentifier.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
;
public
class
Mt2MxContextIdentifier
{
public
static
final
String
MT_TO_MX_OUTPUT_FILE_PATH
=
"mt.to.mx.output.file.path"
;
public
static
final
String
MT_TO_MX_XML
=
"mt.to.mx.xml"
;
public
static
final
String
MT_TO_MX_JSON_MAP
=
"mt.to.mx.json.map"
;
public
static
final
String
MT_SEND_BIC
=
"mt.send.bic"
;
public
static
final
String
MT_RECEIVE_BIC
=
"mt.receive.bic"
;
public
static
final
String
MT_TO_MX_INSTRUCTION_FOR_NEXT_AGENT_FIN53
=
"mt.to.mx.instruction.for.next.agent.fin53"
;
/**
* 外部参数
*/
public
static
final
String
EXTERNAL_PARAMETERS_CREATION_DATE
=
"CreationDate"
;
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/Mt2MxCreator.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
;
import
java.util.List
;
public
interface
Mt2MxCreator
{
void
preProcess
();
List
<
Mt2MxParseField
>
getParseFieldList
();
void
postProcess
();
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/Mt2MxCreatorManager.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.pacs008001.Mt2MxPacs008001Creator
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.List
;
import
java.util.Map
;
public
class
Mt2MxCreatorManager
{
public
AbstractMT
abstractMT
=
null
;
public
void
init
(
String
mtStr
)
{
try
{
abstractMT
=
AbstractMT
.
parse
(
mtStr
);
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
public
String
mt2mx
(
String
mtStr
,
String
outPutFilePath
,
Map
<
String
,
Object
>
extraMap
)
throws
SwiftException
{
init
(
mtStr
);
AbstractMt2MxCreator
creator
=
getMt2MxCreator
();
Mt2MxContext
context
=
new
Mt2MxContext
();
context
.
set
(
AbstractMT
.
class
,
abstractMT
);
context
.
set
(
Mt2MxContextIdentifier
.
MT_TO_MX_OUTPUT_FILE_PATH
,
outPutFilePath
);
context
.
putAll
(
extraMap
);
creator
.
setContext
(
context
);
creator
.
preProcess
();
List
<
Mt2MxParseField
>
parseFields
=
creator
.
getParseFieldList
();
for
(
int
i
=
0
;
i
<
parseFields
.
size
();
i
++)
{
AbstractMt2MxParseField
parseField
=
(
AbstractMt2MxParseField
)
parseFields
.
get
(
i
);
parseField
.
setContext
(
context
).
initJsonMaps
();
parseField
.
parseField
();
}
creator
.
postProcess
();
return
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_TO_MX_XML
);
}
public
AbstractMt2MxCreator
getMt2MxCreator
()
throws
SwiftException
{
String
messageType
=
abstractMT
.
getMessageType
();
if
(
"103"
.
equals
(
messageType
))
{
return
new
Mt2MxPacs008001Creator
();
}
else
{
throw
new
SwiftException
(
"ERROR"
,
"Invalid message type"
);
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/Mt2MxParseField.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
;
public
interface
Mt2MxParseField
{
void
parseField
();
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/AbstractMt2MxPacs008001ParseField.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.mt2mx.AbstractMt2MxParseField
;
import
java.util.Map
;
public
abstract
class
AbstractMt2MxPacs008001ParseField
extends
AbstractMt2MxParseField
{
protected
Map
<
String
,
Object
>
appHdrMaps
=
null
;
protected
Map
<
String
,
Object
>
grpHdrMaps
=
null
;
protected
Map
<
String
,
Object
>
cdtTrfTxInfMaps
=
null
;
@Override
public
void
initJsonMaps
()
{
super
.
initJsonMaps
();
appHdrMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"appHdr"
);
Map
<
String
,
Object
>
fIToFICstmrCdtTrfMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"fiToFICstmrCdtTrf"
);
grpHdrMaps
=
(
Map
<
String
,
Object
>)
fIToFICstmrCdtTrfMaps
.
get
(
"grpHdr"
);
JSONArray
cdtTrfTxInfJsonArray
=
(
JSONArray
)
fIToFICstmrCdtTrfMaps
.
get
(
"cdtTrfTxInf"
);
cdtTrfTxInfMaps
=
(
Map
<
String
,
Object
>)
cdtTrfTxInfJsonArray
.
get
(
0
);
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/Mt2MxPacs008001Creator.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.mt2mx.AbstractMt2MxCreator
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.Mt2MxParseField
;
import
com.brilliance.swift.mt2mx.pacs008001.impl.*
;
import
com.brilliance.swift.util.StringUtil
;
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
Mt2MxPacs008001Creator
extends
AbstractMt2MxCreator
{
@Override
public
void
preProcess
()
{
super
.
preProcess
();
jsonMaps
.
put
(
"identifier"
,
"pacs.008.001.08"
);
Map
<
String
,
Object
>
appHdrMaps
=
(
Map
<
String
,
Object
>)
jsonMaps
.
get
(
"appHdr"
);
appHdrMaps
.
put
(
"msgDefIdr"
,
"pacs.008.001.08"
);
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
//初始化转换和不需要BLOCK4的转换
Map
<
String
,
Object
>
fiToFICstmrCdtTrfMaps
=
new
HashMap
<>();
jsonMaps
.
put
(
"fiToFICstmrCdtTrf"
,
fiToFICstmrCdtTrfMaps
);
Map
<
String
,
Object
>
grpHdrMaps
=
new
HashMap
<>();
fiToFICstmrCdtTrfMaps
.
put
(
"grpHdr"
,
grpHdrMaps
);
grpHdrMaps
.
put
(
"creDtTm"
,
"9999-12-31T00:00:00+00:00"
);
grpHdrMaps
.
put
(
"nbOfTxs"
,
"1"
);
Map
<
String
,
Object
>
cdtTrfTxInfMaps
=
new
HashMap
<>();
JSONArray
cdtTrfTxInfJsonArray
=
new
JSONArray
();
cdtTrfTxInfJsonArray
.
add
(
cdtTrfTxInfMaps
);
fiToFICstmrCdtTrfMaps
.
put
(
"cdtTrfTxInf"
,
cdtTrfTxInfJsonArray
);
//设置 Payment Identification
Map
<
String
,
Object
>
pmtIdMaps
=
new
HashMap
<>();
cdtTrfTxInfMaps
.
put
(
"pmtId"
,
pmtIdMaps
);
String
uetr
=
abstractMT
.
getSwiftMessage
().
getUETR
();
if
(
StringUtil
.
isNotEmpty
(
uetr
))
{
pmtIdMaps
.
put
(
"uetr"
,
uetr
);
}
//设置InstructingAgent InstructedAgent 取值从sendbic receivebic
String
sendBic
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_SEND_BIC
,
true
);
if
(
StringUtil
.
isNotEmpty
(
sendBic
))
{
Map
<
String
,
Object
>
instgAgtMaps
=
new
HashMap
<>();
cdtTrfTxInfMaps
.
put
(
"instgAgt"
,
instgAgtMaps
);
mt_to_mxBICFI
(
sendBic
,
instgAgtMaps
);
}
String
receiverBic
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_RECEIVE_BIC
,
true
);
if
(
StringUtil
.
isNotEmpty
(
receiverBic
))
{
Map
<
String
,
Object
>
instdAgtMaps
=
new
HashMap
<>();
cdtTrfTxInfMaps
.
put
(
"instdAgt"
,
instdAgtMaps
);
mt_to_mxBICFI
(
receiverBic
,
instdAgtMaps
);
}
//设置Service Level 取值从block3 {111:00[0-9]}
Tag
tag111
=
abstractMT
.
getSwiftMessage
().
getBlock3
().
getTagByName
(
"111"
);
if
(
tag111
!=
null
)
{
String
svcLvlCode
=
""
;
String
value
=
tag111
.
getValue
();
if
(
value
.
matches
(
"00[0-9]{1}"
))
{
svcLvlCode
=
value
;
}
if
(
StringUtil
.
isNotEmpty
(
svcLvlCode
))
{
Map
<
String
,
Object
>
pmtTpInfMaps
=
new
HashMap
<>();
cdtTrfTxInfMaps
.
put
(
"pmtTpInf"
,
pmtTpInfMaps
);
JSONArray
svcLvlJsonArray
=
new
JSONArray
();
pmtTpInfMaps
.
put
(
"svcLvl"
,
svcLvlJsonArray
);
Map
<
String
,
Object
>
svcLvlMaps
=
new
HashMap
<>();
svcLvlJsonArray
.
add
(
svcLvlMaps
);
svcLvlMaps
.
put
(
"cd"
,
"G"
+
svcLvlCode
);
}
}
}
@Override
public
List
<
Mt2MxParseField
>
getParseFieldList
()
{
List
<
Mt2MxParseField
>
list
=
new
ArrayList
<>();
list
.
add
(
new
Pacs00801Parse20Field
());
list
.
add
(
new
Pacs00801Parse13CField
());
list
.
add
(
new
Pacs00801Parse23BField
());
list
.
add
(
new
Pacs00801Parse23EField
());
list
.
add
(
new
Pacs00801Parse26TField
());
list
.
add
(
new
Pacs00801Parse32AField
());
list
.
add
(
new
Pacs00801Parse33BField
());
list
.
add
(
new
Pacs00801Parse36Field
());
list
.
add
(
new
Pacs00801Parse50Field
());
list
.
add
(
new
Pacs00801Parse52Field
());
list
.
add
(
new
Pacs00801ParseSetlMtdField
());
list
.
add
(
new
Pacs00801ParseSetlAcctField
());
list
.
add
(
new
Pacs00801Parse53Field
());
list
.
add
(
new
Pacs00801Parse54Field
());
list
.
add
(
new
Pacs00801Parse55Field
());
list
.
add
(
new
Pacs00801Parse56Field
());
list
.
add
(
new
Pacs00801Parse57Field
());
list
.
add
(
new
Pacs00801Parse59Field
());
list
.
add
(
new
Pacs00801Parse70Field
());
list
.
add
(
new
Pacs00801Parse71Field
());
list
.
add
(
new
Pacs00801Parse72Field
());
list
.
add
(
new
Pacs00801Parse77BField
());
return
list
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse13CField.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field13C
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
Pacs00801Parse13CField
extends
AbstractMt2MxPacs008001ParseField
{
private
static
final
String
NAME
=
"13C"
;
@Override
public
void
parseField
()
throws
SwiftException
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
[]
tags
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagsByName
(
NAME
);
if
(
tags
!=
null
&&
tags
.
length
>
0
)
{
Map
<
String
,
Object
>
sttlmTmIndctnMaps
=
null
;
if
(
cdtTrfTxInfMaps
.
containsKey
(
"sttlmTmIndctn"
))
{
sttlmTmIndctnMaps
=
(
Map
<
String
,
Object
>)
cdtTrfTxInfMaps
.
get
(
"sttlmTmIndctn"
);
}
else
{
sttlmTmIndctnMaps
=
new
HashMap
<>();
cdtTrfTxInfMaps
.
put
(
"sttlmTmIndctn"
,
sttlmTmIndctnMaps
);
}
Map
<
String
,
Object
>
sttlmTmReqMaps
=
null
;
if
(
cdtTrfTxInfMaps
.
containsKey
(
"sttlmTmReq"
))
{
sttlmTmReqMaps
=
(
Map
<
String
,
Object
>)
cdtTrfTxInfMaps
.
get
(
"sttlmTmReq"
);
}
else
{
sttlmTmReqMaps
=
new
HashMap
<>();
cdtTrfTxInfMaps
.
put
(
"sttlmTmReq"
,
sttlmTmReqMaps
);
}
for
(
int
i
=
0
;
i
<
tags
.
length
;
i
++)
{
Field13C
field13C
=
(
Field13C
)
tags
[
i
].
asField
();
String
dateTimeStr
=
"0001-01-01T"
+
field13C
.
getTime
().
substring
(
0
,
2
)
+
":"
+
field13C
.
getTime
().
substring
(
2
,
4
)
+
":00"
+
field13C
.
getSign
()
+
field13C
.
getOffset
().
substring
(
0
,
2
)
+
":"
+
field13C
.
getOffset
().
substring
(
2
,
4
);
String
timeStr
=
field13C
.
getTime
().
substring
(
0
,
2
)
+
":"
+
field13C
.
getTime
().
substring
(
2
,
4
)
+
":00"
+
field13C
.
getSign
()
+
field13C
.
getOffset
().
substring
(
0
,
2
)
+
":"
+
field13C
.
getOffset
().
substring
(
2
,
4
);
if
(
"SNDTIME"
.
equals
(
field13C
.
getCode
()))
{
sttlmTmIndctnMaps
.
put
(
"dbtDtTm"
,
dateTimeStr
);
}
else
if
(
"RNCTIME"
.
equals
(
field13C
.
getCode
()))
{
sttlmTmIndctnMaps
.
put
(
"cdtDtTm"
,
dateTimeStr
);
}
else
if
(
"CLSTIME"
.
equals
(
field13C
.
getCode
()))
{
sttlmTmReqMaps
.
put
(
"clsTm"
,
timeStr
);
}
else
if
(
"TILTIME"
.
equals
(
field13C
.
getCode
()))
{
sttlmTmReqMaps
.
put
(
"tillTm"
,
timeStr
);
}
else
if
(
"FROTIME"
.
equals
(
field13C
.
getCode
()))
{
sttlmTmReqMaps
.
put
(
"frTm"
,
timeStr
);
}
else
if
(
"REJTIME"
.
equals
(
field13C
.
getCode
()))
{
sttlmTmReqMaps
.
put
(
"rjctTm"
,
timeStr
);
}
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse20Field.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
Pacs00801Parse20Field
extends
AbstractMt2MxPacs008001ParseField
{
private
static
final
String
NAME
=
"20"
;
@Override
public
void
parseField
()
throws
SwiftException
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag20
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag20
!=
null
)
{
appHdrMaps
.
put
(
"bizMsgIdr"
,
tag20
.
getValue
());
grpHdrMaps
.
put
(
"msgId"
,
tag20
.
getValue
());
Map
<
String
,
Object
>
pmtIdMaps
=
null
;
if
(
cdtTrfTxInfMaps
.
containsKey
(
"pmtId"
))
{
pmtIdMaps
=
(
Map
<
String
,
Object
>)
cdtTrfTxInfMaps
.
get
(
"pmtId"
);
}
else
{
pmtIdMaps
=
new
HashMap
<>();
cdtTrfTxInfMaps
.
put
(
"pmtId"
,
pmtIdMaps
);
}
pmtIdMaps
.
put
(
"instrId"
,
tag20
.
getValue
());
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse23BField.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
public
class
Pacs00801Parse23BField
extends
AbstractMt2MxPacs008001ParseField
{
@Override
public
void
parseField
()
throws
SwiftException
{
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse23EField.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
import
com.brilliance.swift.vo.common.CategoryPurposeCode
;
import
com.brilliance.swift.vo.common.ExternalCreditorAgentInstructionCode
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field23E
;
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
Pacs00801Parse23EField
extends
AbstractMt2MxPacs008001ParseField
{
private
static
final
String
NAME_23E
=
"23E"
;
private
static
final
String
NAME_70
=
"70"
;
@Override
public
void
parseField
()
throws
SwiftException
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
[]
tags
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagsByName
(
NAME_23E
);
List
<
Field23E
>
field23EList
=
new
ArrayList
<>();
if
(
tags
!=
null
&&
tags
.
length
>
0
)
{
Map
<
String
,
Object
>
pmtTpInfMaps
=
null
;
if
(
cdtTrfTxInfMaps
.
containsKey
(
"pmtTpInf"
))
{
pmtTpInfMaps
=
(
Map
<
String
,
Object
>)
cdtTrfTxInfMaps
.
get
(
"pmtTpInf"
);
}
else
{
pmtTpInfMaps
=
new
HashMap
<>();
cdtTrfTxInfMaps
.
put
(
"pmtTpInf"
,
pmtTpInfMaps
);
}
JSONArray
svcLvlJsonArray
=
null
;
if
(
pmtTpInfMaps
.
containsKey
(
"svcLvl"
))
{
svcLvlJsonArray
=
(
JSONArray
)
pmtTpInfMaps
.
get
(
"svcLvl"
);
}
else
{
svcLvlJsonArray
=
new
JSONArray
();
pmtTpInfMaps
.
put
(
"svcLvl"
,
svcLvlJsonArray
);
}
Field23E
intcField23E
=
null
;
Field23E
cortField23E
=
null
;
for
(
int
i
=
0
;
i
<
tags
.
length
;
i
++)
{
Field23E
field23E
=
(
Field23E
)
tags
[
i
].
asField
();
if
(
ExternalCreditorAgentInstructionCode
.
HOLD
.
value
().
equals
(
field23E
.
getCode
())
||
ExternalCreditorAgentInstructionCode
.
PHOB
.
value
().
equals
(
field23E
.
getCode
())
||
ExternalCreditorAgentInstructionCode
.
CHQB
.
value
().
equals
(
field23E
.
getCode
())
||
ExternalCreditorAgentInstructionCode
.
TELB
.
value
().
equals
(
field23E
.
getCode
()))
{
field23EList
.
add
(
field23E
);
}
else
if
(
"SDVA"
.
equals
(
field23E
.
getCode
()))
{
Map
<
String
,
Object
>
svcLvlMaps
=
new
HashMap
<>();
svcLvlMaps
.
put
(
"cd"
,
field23E
.
getCode
());
svcLvlJsonArray
.
add
(
svcLvlMaps
);
}
else
if
(
CategoryPurposeCode
.
INTC
.
value
().
equals
(
field23E
.
getCode
()))
{
intcField23E
=
field23E
;
}
else
if
(
CategoryPurposeCode
.
CORT
.
value
().
equals
(
field23E
.
getCode
()))
{
cortField23E
=
field23E
;
}
}
Map
<
String
,
Object
>
ctgyPurpMaps
=
null
;
if
(
pmtTpInfMaps
.
containsKey
(
"ctgyPurp"
))
{
ctgyPurpMaps
=
(
Map
<
String
,
Object
>)
pmtTpInfMaps
.
get
(
"ctgyPurp"
);
}
else
{
ctgyPurpMaps
=
new
HashMap
<>();
pmtTpInfMaps
.
put
(
"ctgyPurp"
,
ctgyPurpMaps
);
}
if
(
intcField23E
!=
null
&&
cortField23E
!=
null
)
{
ctgyPurpMaps
.
put
(
"prtry"
,
CategoryPurposeCode
.
INTC
.
value
()
+
" "
+
CategoryPurposeCode
.
CORT
.
value
());
}
else
if
(
intcField23E
!=
null
)
{
ctgyPurpMaps
.
put
(
"cd"
,
CategoryPurposeCode
.
INTC
.
value
());
}
else
if
(
cortField23E
!=
null
)
{
ctgyPurpMaps
.
put
(
"cd"
,
CategoryPurposeCode
.
CORT
.
value
());
}
}
Tag
tag70
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_70
);
String
mt70
=
""
;
if
(
tag70
!=
null
)
{
mt70
=
tag70
.
getValue
();
}
mt_to_mxInstructionForCreditorAgent
(
field23EList
,
mt70
,
cdtTrfTxInfMaps
);
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse26TField.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
Pacs00801Parse26TField
extends
AbstractMt2MxPacs008001ParseField
{
private
static
final
String
NAME
=
"26T"
;
@Override
public
void
parseField
()
throws
SwiftException
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag26T
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag26T
!=
null
)
{
String
value
=
":26T:"
+
tag26T
.
getValue
();
Map
<
String
,
Object
>
purpMaps
=
null
;
if
(
cdtTrfTxInfMaps
.
containsKey
(
"purp"
))
{
purpMaps
=
(
Map
<
String
,
Object
>)
cdtTrfTxInfMaps
.
get
(
"purp"
);
}
else
{
purpMaps
=
new
HashMap
<>();
cdtTrfTxInfMaps
.
put
(
"purp"
,
purpMaps
);
}
purpMaps
.
put
(
"prtry"
,
value
);
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse32AField.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
import
com.brilliance.swift.util.DateUtil
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field32A
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
Pacs00801Parse32AField
extends
AbstractMt2MxPacs008001ParseField
{
private
static
final
String
NAME
=
"32A"
;
@Override
public
void
parseField
()
throws
SwiftException
{
try
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag
!=
null
)
{
Field32A
field32A
=
(
Field32A
)
tag
.
asField
();
Date
date
=
DateUtil
.
parseDate
(
"20"
+
field32A
.
getDate
(),
"yyyyMMdd"
);
String
dateStr
=
DateUtil
.
format
(
date
,
"yyyy-MM-dd"
);
cdtTrfTxInfMaps
.
put
(
"intrBkSttlmDt"
,
dateStr
);
Map
<
String
,
Object
>
intrBkSttlmAmtMaps
=
new
HashMap
<>();
intrBkSttlmAmtMaps
.
put
(
"value"
,
field32A
.
amount
());
intrBkSttlmAmtMaps
.
put
(
"ccy"
,
field32A
.
getCurrency
());
cdtTrfTxInfMaps
.
put
(
"intrBkSttlmAmt"
,
intrBkSttlmAmtMaps
);
}
}
catch
(
ParseException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse33BField.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field33B
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
Pacs00801Parse33BField
extends
AbstractMt2MxPacs008001ParseField
{
private
static
final
String
NAME
=
"33B"
;
@Override
public
void
parseField
()
throws
SwiftException
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag
!=
null
)
{
Field33B
field33B
=
(
Field33B
)
tag
.
asField
();
Map
<
String
,
Object
>
instdAmtMaps
=
new
HashMap
<>();
instdAmtMaps
.
put
(
"value"
,
field33B
.
amount
());
instdAmtMaps
.
put
(
"ccy"
,
field33B
.
getCurrency
());
cdtTrfTxInfMaps
.
put
(
"instdAmt"
,
instdAmtMaps
);
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse36Field.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field36
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.math.BigDecimal
;
public
class
Pacs00801Parse36Field
extends
AbstractMt2MxPacs008001ParseField
{
private
static
final
String
NAME
=
"36"
;
@Override
public
void
parseField
()
throws
SwiftException
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag
!=
null
)
{
Field36
field36
=
(
Field36
)
tag
.
asField
();
cdtTrfTxInfMaps
.
put
(
"xchgRate"
,
new
BigDecimal
(
field36
.
getRateAsNumber
().
toString
()));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse50Field.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.common.OrganisationIdentificationCode
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field50A
;
import
com.prowidesoftware.swift.model.field.Field50F
;
import
com.prowidesoftware.swift.model.field.Field50K
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
Pacs00801Parse50Field
extends
AbstractMt2MxPacs008001ParseField
{
private
static
final
String
NAME_A
=
"50A"
;
private
static
final
String
NAME_F
=
"50F"
;
private
static
final
String
NAME_K
=
"50K"
;
@Override
public
void
parseField
()
throws
SwiftException
{
Field50A
field50A
=
null
;
Field50F
field50F
=
null
;
Field50K
field50K
=
null
;
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_A
);
if
(
tag
!=
null
)
{
field50A
=
(
Field50A
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_F
);
if
(
tag
!=
null
)
{
field50F
=
(
Field50F
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_K
);
if
(
tag
!=
null
)
{
field50K
=
(
Field50K
)
tag
.
asField
();
}
Map
<
String
,
Object
>
dbtrMaps
=
null
;
if
(
cdtTrfTxInfMaps
.
containsKey
(
"dbtr"
))
{
dbtrMaps
=
(
Map
<
String
,
Object
>)
cdtTrfTxInfMaps
.
get
(
"dbtr"
);
}
else
{
dbtrMaps
=
new
HashMap
<>();
}
Map
<
String
,
Object
>
dbtrAcctMaps
=
null
;
if
(
cdtTrfTxInfMaps
.
containsKey
(
"dbtrAcct"
))
{
dbtrAcctMaps
=
(
Map
<
String
,
Object
>)
cdtTrfTxInfMaps
.
get
(
"dbtrAcct"
);
}
else
{
dbtrAcctMaps
=
new
HashMap
<>();
}
String
account
=
""
;
if
(
field50A
!=
null
)
{
String
bicCode
=
field50A
.
getBIC
();
if
(
StringUtil
.
isNotEmpty
(
field50A
.
getComponent1
()))
{
account
+=
"/"
+
field50A
.
getComponent1
();
}
mt_to_mxAnyBIC
(
bicCode
,
dbtrMaps
);
if
(
StringUtil
.
isEmpty
(
account
))
{
buildDefaultValue
(
dbtrMaps
);
}
else
{
mt_to_mxPartyAccount
(
account
,
dbtrAcctMaps
);
}
}
if
(
field50F
!=
null
)
{
String
partyIdentifier
=
field50F
.
getPartyIdentifier
();
String
nameAddress
=
""
;
List
<
String
>
lines
=
field50F
.
getLines
();
for
(
int
i
=
0
;
i
<
lines
.
size
();
i
++)
{
if
(
i
==
0
)
{
continue
;
}
if
(
i
==
lines
.
size
()-
1
)
{
nameAddress
+=
lines
.
get
(
i
);
}
else
{
nameAddress
+=
lines
.
get
(
i
)
+
Mx2MtConstants
.
NEW_LINE
;
}
}
if
(
partyIdentifier
.
startsWith
(
"/"
))
{
mt_to_mxPartyAccount
(
partyIdentifier
.
substring
(
1
),
dbtrAcctMaps
);
}
else
{
Map
<
String
,
Object
>
idMaps
=
null
;
if
(
dbtrMaps
.
containsKey
(
"id"
))
{
idMaps
=
(
Map
<
String
,
Object
>)
dbtrMaps
.
get
(
"id"
);
}
else
{
idMaps
=
new
HashMap
<>();
dbtrMaps
.
put
(
"id"
,
idMaps
);
}
mt_to_mxFATFIdentification
(
partyIdentifier
,
nameAddress
,
idMaps
);
}
mt_to_mxFATFNameAndAddress
(
partyIdentifier
,
nameAddress
,
dbtrMaps
);
}
if
(
field50K
!=
null
)
{
String
nameAddress
=
field50K
.
getNameAndAddress
();
if
(
StringUtil
.
isNotEmpty
(
field50K
.
getComponent1
()))
{
account
+=
"/"
+
field50K
.
getComponent1
();
}
mt_to_mxPartyNameAndAddress
(
nameAddress
,
dbtrMaps
);
if
(
StringUtil
.
isEmpty
(
account
))
{
buildDefaultValue
(
dbtrMaps
);
}
else
{
mt_to_mxPartyAccount
(
account
,
dbtrAcctMaps
);
}
}
if
(
dbtrMaps
.
size
()
>
0
)
{
cdtTrfTxInfMaps
.
put
(
"dbtr"
,
dbtrMaps
);
}
if
(
dbtrAcctMaps
.
size
()
>
0
)
{
cdtTrfTxInfMaps
.
put
(
"dbtrAcct"
,
dbtrAcctMaps
);
}
}
/**
* IF 50A/Account 50K/Account IsAbsent
* THEN Copy "NOTPROVIDED" to Debtor/Id/OrgID/Other/ID
* and "TXID" to SchemeName/Code
* @param dbtrMaps
*/
private
void
buildDefaultValue
(
Map
<
String
,
Object
>
dbtrMaps
)
{
Map
<
String
,
Object
>
idMaps
=
null
;
if
(
dbtrMaps
.
containsKey
(
"id"
))
{
idMaps
=
(
Map
<
String
,
Object
>)
dbtrMaps
.
get
(
"id"
);
}
else
{
idMaps
=
new
HashMap
<>();
dbtrMaps
.
put
(
"id"
,
idMaps
);
}
Map
<
String
,
Object
>
idOrgMaps
=
null
;
if
(
idMaps
.
containsKey
(
"orgId"
))
{
idOrgMaps
=
(
Map
<
String
,
Object
>)
idMaps
.
get
(
"orgId"
);
}
else
{
idOrgMaps
=
new
HashMap
<>();
idMaps
.
put
(
"orgId"
,
idOrgMaps
);
}
JSONArray
othrJsonArray
=
null
;
if
(
idOrgMaps
.
containsKey
(
"othr"
))
{
othrJsonArray
=
(
JSONArray
)
idOrgMaps
.
get
(
"othr"
);
}
else
{
othrJsonArray
=
new
JSONArray
();
idOrgMaps
.
put
(
"othr"
,
othrJsonArray
);
}
Map
<
String
,
Object
>
othrMaps
=
new
HashMap
<>();
othrJsonArray
.
add
(
othrMaps
);
othrMaps
.
put
(
"id"
,
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
);
Map
<
String
,
Object
>
schmeNmMaps
=
null
;
if
(
othrMaps
.
containsKey
(
"schmeNm"
))
{
schmeNmMaps
=
(
Map
<
String
,
Object
>)
othrMaps
.
get
(
"schmeNm"
);
}
else
{
schmeNmMaps
=
new
HashMap
<>();
othrMaps
.
put
(
"schmeNm"
,
schmeNmMaps
);
}
schmeNmMaps
.
put
(
"cd"
,
OrganisationIdentificationCode
.
TXID
.
value
());
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse52Field.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field52A
;
import
com.prowidesoftware.swift.model.field.Field52D
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
Pacs00801Parse52Field
extends
AbstractMt2MxPacs008001ParseField
{
private
static
final
String
NAME_A
=
"52A"
;
private
static
final
String
NAME_D
=
"52D"
;
@Override
public
void
parseField
()
throws
SwiftException
{
Field52A
field52A
=
null
;
Field52D
field52D
=
null
;
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_A
);
if
(
tag
!=
null
)
{
field52A
=
(
Field52A
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_D
);
if
(
tag
!=
null
)
{
field52D
=
(
Field52D
)
tag
.
asField
();
}
Map
<
String
,
Object
>
dbtrAgtMaps
=
null
;
if
(
cdtTrfTxInfMaps
.
containsKey
(
"dbtrAgt"
))
{
dbtrAgtMaps
=
(
Map
<
String
,
Object
>)
cdtTrfTxInfMaps
.
get
(
"dbtrAgt"
);
}
else
{
dbtrAgtMaps
=
new
HashMap
<>();
}
Map
<
String
,
Object
>
dbtrAgtAcctMaps
=
null
;
if
(
cdtTrfTxInfMaps
.
containsKey
(
"dbtrAgtAcct"
))
{
dbtrAgtAcctMaps
=
(
Map
<
String
,
Object
>)
cdtTrfTxInfMaps
.
get
(
"dbtrAgtAcct"
);
}
else
{
dbtrAgtAcctMaps
=
new
HashMap
<>();
}
String
account
=
""
;
if
(
field52A
!=
null
)
{
String
bicCode
=
field52A
.
getBIC
();
mt_to_mxBICFI
(
bicCode
,
dbtrAgtMaps
);
if
(
StringUtil
.
isNotEmpty
(
field52A
.
getComponent1
()))
{
account
=
"/"
+
field52A
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field52A
.
getComponent2
()))
{
account
=
"/"
+
field52A
.
getComponent2
();
}
}
else
if
(
field52D
!=
null
)
{
if
(
StringUtil
.
isNotEmpty
(
field52D
.
getComponent1
()))
{
account
=
"/"
+
field52D
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field52D
.
getComponent2
()))
{
account
=
"/"
+
field52D
.
getComponent2
();
}
String
nameAddress
=
field52D
.
getNameAndAddress
();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress
(
nameAddress
,
dbtrAgtMaps
);
}
else
{
String
sendBic
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_SEND_BIC
,
true
);
mt_to_mxBICFI
(
sendBic
,
dbtrAgtMaps
);
}
if
(
StringUtil
.
isNotEmpty
(
account
))
{
if
(
account
.
startsWith
(
"//"
)
&&
!
account
.
startsWith
(
"//CH"
)
&&
!
account
.
startsWith
(
"//FW"
))
{
Map
<
String
,
Object
>
finInstnIdMaps
=
null
;
if
(
dbtrAgtMaps
.
containsKey
(
"finInstnId"
))
{
finInstnIdMaps
=
(
Map
<
String
,
Object
>)
dbtrAgtMaps
.
get
(
"finInstnId"
);
}
else
{
finInstnIdMaps
=
new
HashMap
<>();
dbtrAgtMaps
.
put
(
"finInstnId"
,
finInstnIdMaps
);
}
Map
<
String
,
Object
>
clrSysMmbIdMaps
=
null
;
if
(
finInstnIdMaps
.
containsKey
(
"clrSysMmbId"
))
{
clrSysMmbIdMaps
=
(
Map
<
String
,
Object
>)
finInstnIdMaps
.
get
(
"clrSysMmbId"
);
}
else
{
clrSysMmbIdMaps
=
new
HashMap
<>();
finInstnIdMaps
.
put
(
"clrSysMmbId"
,
clrSysMmbIdMaps
);
}
mt_to_mxClearingIdentifier
(
account
,
clrSysMmbIdMaps
);
}
else
if
(!
account
.
startsWith
(
"//"
)
||
account
.
startsWith
(
"//CH"
))
{
mt_to_mxFinancialInstitutionAccount
(
account
,
dbtrAgtAcctMaps
);
}
}
if
(
dbtrAgtMaps
.
size
()
>
0
)
{
cdtTrfTxInfMaps
.
put
(
"dbtrAgt"
,
dbtrAgtMaps
);
}
if
(
dbtrAgtAcctMaps
.
size
()
>
0
)
{
cdtTrfTxInfMaps
.
put
(
"dbtrAgtAcct"
,
dbtrAgtAcctMaps
);
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse53Field.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.VoSettlementMethodHelper
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field53A
;
import
com.prowidesoftware.swift.model.field.Field53D
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
Pacs00801Parse53Field
extends
AbstractMt2MxPacs008001ParseField
{
private
static
final
String
NAME_A
=
"53A"
;
//private static final String NAME_B = "53B";
private
static
final
String
NAME_D
=
"53D"
;
@Override
public
void
parseField
()
throws
SwiftException
{
VoSettlementMethodHelper
setlMtdHelper
=
context
.
get
(
VoSettlementMethodHelper
.
class
);
if
(
setlMtdHelper
.
isTranslate53Flag
())
{
//53B 只能翻译成 Group Header -> Settlement Information -> Settlement Account/Settlement Method
Field53A
field53A
=
null
;
Field53D
field53D
=
null
;
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_A
);
if
(
tag
!=
null
)
{
field53A
=
(
Field53A
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_D
);
if
(
tag
!=
null
)
{
field53D
=
(
Field53D
)
tag
.
asField
();
}
Map
<
String
,
Object
>
sttlmInfMaps
=
null
;
if
(
grpHdrMaps
.
containsKey
(
"sttlmInf"
))
{
sttlmInfMaps
=
(
Map
<
String
,
Object
>)
grpHdrMaps
.
get
(
"sttlmInf"
);
}
else
{
sttlmInfMaps
=
new
HashMap
<>();
grpHdrMaps
.
put
(
"sttlmInf"
,
sttlmInfMaps
);
}
Map
<
String
,
Object
>
instgRmbrsmntAgtMaps
=
null
;
if
(
sttlmInfMaps
.
containsKey
(
"instgRmbrsmntAgt"
))
{
instgRmbrsmntAgtMaps
=
(
Map
<
String
,
Object
>)
sttlmInfMaps
.
get
(
"instgRmbrsmntAgt"
);
}
else
{
instgRmbrsmntAgtMaps
=
new
HashMap
<>();
sttlmInfMaps
.
put
(
"instgRmbrsmntAgt"
,
instgRmbrsmntAgtMaps
);
}
String
account
=
""
;
if
(
field53A
!=
null
)
{
String
bicCode
=
field53A
.
getBIC
();
mt_to_mxBICFI
(
bicCode
,
instgRmbrsmntAgtMaps
);
if
(
StringUtil
.
isNotEmpty
(
field53A
.
getComponent1
()))
{
account
+=
"/"
+
field53A
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field53A
.
getComponent2
()))
{
account
+=
"/"
+
field53A
.
getComponent2
();
}
}
else
if
(
field53D
!=
null
)
{
String
nameAddress
=
field53D
.
getNameAndAddress
();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress
(
nameAddress
,
instgRmbrsmntAgtMaps
);
if
(
StringUtil
.
isNotEmpty
(
field53D
.
getComponent1
()))
{
account
+=
"/"
+
field53D
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field53D
.
getComponent2
()))
{
account
+=
"/"
+
field53D
.
getComponent2
();
}
}
if
(
StringUtil
.
isNotEmpty
(
account
))
{
Map
<
String
,
Object
>
instgRmbrsmntAgtAcctMaps
=
null
;
if
(
sttlmInfMaps
.
containsKey
(
"instgRmbrsmntAgtAcct"
))
{
instgRmbrsmntAgtAcctMaps
=
(
Map
<
String
,
Object
>)
sttlmInfMaps
.
get
(
"instgRmbrsmntAgtAcct"
);
}
else
{
instgRmbrsmntAgtAcctMaps
=
new
HashMap
<>();
sttlmInfMaps
.
put
(
"instgRmbrsmntAgtAcct"
,
instgRmbrsmntAgtAcctMaps
);
}
if
(
account
.
startsWith
(
"//"
)
&&
!
account
.
startsWith
(
"//CH"
))
{
Map
<
String
,
Object
>
finInstnIdMaps
=
null
;
if
(
instgRmbrsmntAgtMaps
.
containsKey
(
"finInstnId"
))
{
finInstnIdMaps
=
(
Map
<
String
,
Object
>)
instgRmbrsmntAgtMaps
.
get
(
"finInstnId"
);
}
else
{
finInstnIdMaps
=
new
HashMap
<>();
instgRmbrsmntAgtMaps
.
put
(
"finInstnId"
,
finInstnIdMaps
);
}
Map
<
String
,
Object
>
clrSysMmbIdMaps
=
null
;
if
(
finInstnIdMaps
.
containsKey
(
"clrSysMmbId"
))
{
clrSysMmbIdMaps
=
(
Map
<
String
,
Object
>)
finInstnIdMaps
.
get
(
"clrSysMmbId"
);
}
else
{
clrSysMmbIdMaps
=
new
HashMap
<>();
finInstnIdMaps
.
put
(
"clrSysMmbId"
,
clrSysMmbIdMaps
);
}
mt_to_mxClearingIdentifier
(
account
,
clrSysMmbIdMaps
);
}
else
{
mt_to_mxFinancialInstitutionAccount
(
account
,
instgRmbrsmntAgtAcctMaps
);
}
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse54Field.java
0 → 100644
View file @
904a5834
This diff is collapsed.
Click to expand it.
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse55Field.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.VoSettlementMethodHelper
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.*
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 如果55存在,那么53 54必须同时存在
*/
public
class
Pacs00801Parse55Field
extends
AbstractMt2MxPacs008001ParseField
{
private
static
final
String
NAME_A
=
"55A"
;
private
static
final
String
NAME_B
=
"55B"
;
private
static
final
String
NAME_D
=
"55D"
;
@Override
public
void
parseField
()
throws
SwiftException
{
VoSettlementMethodHelper
setlMtdHelper
=
context
.
get
(
VoSettlementMethodHelper
.
class
);
if
(
setlMtdHelper
.
isTranslate55Flag
())
{
Field55A
field55A
=
null
;
Field55B
field55B
=
null
;
Field55D
field55D
=
null
;
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_A
);
if
(
tag
!=
null
)
{
field55A
=
(
Field55A
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_B
);
if
(
tag
!=
null
)
{
field55B
=
(
Field55B
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_D
);
if
(
tag
!=
null
)
{
field55D
=
(
Field55D
)
tag
.
asField
();
}
Map
<
String
,
Object
>
sttlmInfMaps
=
null
;
if
(
grpHdrMaps
.
containsKey
(
"sttlmInf"
))
{
sttlmInfMaps
=
(
Map
<
String
,
Object
>)
grpHdrMaps
.
get
(
"sttlmInf"
);
}
else
{
sttlmInfMaps
=
new
HashMap
<>();
grpHdrMaps
.
put
(
"sttlmInf"
,
sttlmInfMaps
);
}
Map
<
String
,
Object
>
thrdRmbrsmntAgtMaps
=
null
;
if
(
sttlmInfMaps
.
containsKey
(
"thrdRmbrsmntAgt"
))
{
thrdRmbrsmntAgtMaps
=
(
Map
<
String
,
Object
>)
sttlmInfMaps
.
get
(
"thrdRmbrsmntAgt"
);
}
else
{
thrdRmbrsmntAgtMaps
=
new
HashMap
<>();
}
Map
<
String
,
Object
>
thrdRmbrsmntAgtAcctMaps
=
null
;
if
(
sttlmInfMaps
.
containsKey
(
"thrdRmbrsmntAgtAcct"
))
{
thrdRmbrsmntAgtAcctMaps
=
(
Map
<
String
,
Object
>)
sttlmInfMaps
.
get
(
"thrdRmbrsmntAgtAcct"
);
}
else
{
thrdRmbrsmntAgtAcctMaps
=
new
HashMap
<>();
}
String
account
=
""
;
if
(
field55A
!=
null
)
{
String
bicCode
=
field55A
.
getBIC
();
mt_to_mxBICFI
(
bicCode
,
thrdRmbrsmntAgtMaps
);
if
(
StringUtil
.
isNotEmpty
(
field55A
.
getComponent1
()))
{
account
=
"/"
+
field55A
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field55A
.
getComponent2
()))
{
account
=
"/"
+
field55A
.
getComponent2
();
}
if
(
account
.
startsWith
(
"//"
)
&&
!
account
.
startsWith
(
"//CH"
))
{
Map
<
String
,
Object
>
finInstnIdMaps
=
null
;
if
(
thrdRmbrsmntAgtMaps
.
containsKey
(
"finInstnId"
))
{
finInstnIdMaps
=
(
Map
<
String
,
Object
>)
thrdRmbrsmntAgtMaps
.
get
(
"finInstnId"
);
}
else
{
finInstnIdMaps
=
new
HashMap
<>();
thrdRmbrsmntAgtMaps
.
put
(
"finInstnId"
,
finInstnIdMaps
);
}
Map
<
String
,
Object
>
clrSysMmbIdMaps
=
null
;
if
(
finInstnIdMaps
.
containsKey
(
"clrSysMmbId"
))
{
clrSysMmbIdMaps
=
(
Map
<
String
,
Object
>)
finInstnIdMaps
.
get
(
"clrSysMmbId"
);
}
else
{
clrSysMmbIdMaps
=
new
HashMap
<>();
finInstnIdMaps
.
put
(
"clrSysMmbId"
,
clrSysMmbIdMaps
);
}
mt_to_mxClearingIdentifier
(
account
,
clrSysMmbIdMaps
);
}
else
if
(!
account
.
startsWith
(
"//"
)
||
account
.
startsWith
(
"//CH"
))
{
mt_to_mxFinancialInstitutionAccount
(
account
,
thrdRmbrsmntAgtAcctMaps
);
}
}
else
if
(
field55B
!=
null
)
{
if
(
StringUtil
.
isNotEmpty
(
field55B
.
getComponent1
()))
{
account
=
"/"
+
field55B
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field55B
.
getComponent2
()))
{
account
=
"/"
+
field55B
.
getComponent2
();
}
String
location
=
field55B
.
getLocation
();
Map
<
String
,
Object
>
finInstnIdMaps
=
null
;
if
(
thrdRmbrsmntAgtMaps
.
containsKey
(
"finInstnId"
))
{
finInstnIdMaps
=
(
Map
<
String
,
Object
>)
thrdRmbrsmntAgtMaps
.
get
(
"finInstnId"
);
}
else
{
finInstnIdMaps
=
new
HashMap
<>();
thrdRmbrsmntAgtMaps
.
put
(
"finInstnId"
,
finInstnIdMaps
);
}
if
(
account
.
startsWith
(
"//"
)
&&
!
account
.
startsWith
(
"//CH"
))
{
if
(
isMTClearingSystemCodeInList
(
account
))
{
Map
<
String
,
Object
>
clrSysMmbIdMaps
=
null
;
if
(
finInstnIdMaps
.
containsKey
(
"clrSysMmbId"
))
{
clrSysMmbIdMaps
=
(
Map
<
String
,
Object
>)
finInstnIdMaps
.
get
(
"clrSysMmbId"
);
}
else
{
clrSysMmbIdMaps
=
new
HashMap
<>();
finInstnIdMaps
.
put
(
"clrSysMmbId"
,
clrSysMmbIdMaps
);
}
mt_to_mxClearingIdentifier
(
account
,
clrSysMmbIdMaps
);
//name address 设置NOTPROVIDED
finInstnIdMaps
.
put
(
"nm"
,
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
);
Map
<
String
,
Object
>
pstlAdrMaps
=
null
;
if
(
finInstnIdMaps
.
containsKey
(
"pstlAdr"
))
{
pstlAdrMaps
=
(
Map
<
String
,
Object
>)
finInstnIdMaps
.
get
(
"pstlAdr"
);
}
else
{
pstlAdrMaps
=
new
HashMap
<>();
finInstnIdMaps
.
put
(
"pstlAdr"
,
pstlAdrMaps
);
}
List
<
String
>
adrLineList
=
new
ArrayList
<>();
adrLineList
.
add
(
StringUtil
.
isEmpty
(
location
)?
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
:
location
);
pstlAdrMaps
.
put
(
"adrLine"
,
adrLineList
);
}
else
{
mt_to_mxClearingSystemToNameAndAddressLine
(
account
,
location
,
finInstnIdMaps
);
}
}
else
if
(!
account
.
startsWith
(
"//"
)
||
account
.
startsWith
(
"//CH"
))
{
mt_to_mxFinancialInstitutionAccount
(
account
,
thrdRmbrsmntAgtAcctMaps
);
//name address 设置NOTPROVIDED
finInstnIdMaps
.
put
(
"nm"
,
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
);
Map
<
String
,
Object
>
pstlAdrMaps
=
null
;
if
(
finInstnIdMaps
.
containsKey
(
"pstlAdr"
))
{
pstlAdrMaps
=
(
Map
<
String
,
Object
>)
finInstnIdMaps
.
get
(
"pstlAdr"
);
}
else
{
pstlAdrMaps
=
new
HashMap
<>();
finInstnIdMaps
.
put
(
"pstlAdr"
,
pstlAdrMaps
);
}
List
<
String
>
adrLineList
=
new
ArrayList
<>();
adrLineList
.
add
(
StringUtil
.
isEmpty
(
location
)?
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
:
location
);
pstlAdrMaps
.
put
(
"adrLine"
,
adrLineList
);
}
}
else
if
(
field55D
!=
null
)
{
if
(
StringUtil
.
isNotEmpty
(
field55D
.
getComponent1
()))
{
account
=
"/"
+
field55D
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field55D
.
getComponent2
()))
{
account
=
"/"
+
field55D
.
getComponent2
();
}
String
nameAddress
=
field55D
.
getNameAndAddress
();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress
(
nameAddress
,
thrdRmbrsmntAgtMaps
);
if
(
account
.
startsWith
(
"//"
)
&&
!
account
.
startsWith
(
"//CH"
))
{
Map
<
String
,
Object
>
finInstnIdMaps
=
null
;
if
(
thrdRmbrsmntAgtMaps
.
containsKey
(
"finInstnId"
))
{
finInstnIdMaps
=
(
Map
<
String
,
Object
>)
thrdRmbrsmntAgtMaps
.
get
(
"finInstnId"
);
}
else
{
finInstnIdMaps
=
new
HashMap
<>();
thrdRmbrsmntAgtMaps
.
put
(
"finInstnId"
,
finInstnIdMaps
);
}
Map
<
String
,
Object
>
clrSysMmbIdMaps
=
null
;
if
(
finInstnIdMaps
.
containsKey
(
"clrSysMmbId"
))
{
clrSysMmbIdMaps
=
(
Map
<
String
,
Object
>)
finInstnIdMaps
.
get
(
"clrSysMmbId"
);
}
else
{
clrSysMmbIdMaps
=
new
HashMap
<>();
finInstnIdMaps
.
put
(
"clrSysMmbId"
,
clrSysMmbIdMaps
);
}
mt_to_mxClearingIdentifier
(
account
,
clrSysMmbIdMaps
);
}
else
if
(!
account
.
startsWith
(
"//"
)
||
account
.
startsWith
(
"//CH"
))
{
mt_to_mxFinancialInstitutionAccount
(
account
,
thrdRmbrsmntAgtAcctMaps
);
}
}
if
(
thrdRmbrsmntAgtMaps
.
size
()
>
0
)
{
sttlmInfMaps
.
put
(
"thrdRmbrsmntAgt"
,
thrdRmbrsmntAgtMaps
);
}
if
(
thrdRmbrsmntAgtAcctMaps
.
size
()
>
0
)
{
sttlmInfMaps
.
put
(
"thrdRmbrsmntAgtAcct"
,
thrdRmbrsmntAgtAcctMaps
);
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse56Field.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
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.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
Pacs00801Parse56Field
extends
AbstractMt2MxPacs008001ParseField
{
private
static
final
String
NAME_A
=
"56A"
;
private
static
final
String
NAME_C
=
"56C"
;
private
static
final
String
NAME_D
=
"56D"
;
@Override
public
void
parseField
()
throws
SwiftException
{
Field56A
field56A
=
null
;
Field56C
field56C
=
null
;
Field56D
field56D
=
null
;
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_A
);
if
(
tag
!=
null
)
{
field56A
=
(
Field56A
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_C
);
if
(
tag
!=
null
)
{
field56C
=
(
Field56C
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_D
);
if
(
tag
!=
null
)
{
field56D
=
(
Field56D
)
tag
.
asField
();
}
Map
<
String
,
Object
>
intrmyAgt1Maps
=
null
;
if
(
cdtTrfTxInfMaps
.
containsKey
(
"intrmyAgt1"
))
{
intrmyAgt1Maps
=
(
Map
<
String
,
Object
>)
cdtTrfTxInfMaps
.
get
(
"intrmyAgt1"
);
}
else
{
intrmyAgt1Maps
=
new
HashMap
<>();
}
Map
<
String
,
Object
>
intrmyAgt1AcctMaps
=
null
;
if
(
cdtTrfTxInfMaps
.
containsKey
(
"intrmyAgt1Acct"
))
{
intrmyAgt1AcctMaps
=
(
Map
<
String
,
Object
>)
cdtTrfTxInfMaps
.
get
(
"intrmyAgt1Acct"
);
}
else
{
intrmyAgt1AcctMaps
=
new
HashMap
<>();
}
boolean
clearingChannelRTGSFlag
=
false
;
String
account
=
""
;
if
(
field56A
!=
null
)
{
String
bicCode
=
field56A
.
getBIC
();
mt_to_mxBICFI
(
bicCode
,
intrmyAgt1Maps
);
if
(
StringUtil
.
isNotEmpty
(
field56A
.
getComponent1
()))
{
account
=
"/"
+
field56A
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field56A
.
getComponent2
()))
{
account
=
"/"
+
field56A
.
getComponent2
();
}
if
(
account
.
startsWith
(
"//RT"
)
||
account
.
startsWith
(
"//FW"
))
{
clearingChannelRTGSFlag
=
true
;
}
if
(
account
.
startsWith
(
"//"
)
&&
!
account
.
startsWith
(
"//CH"
)
&&
!
account
.
startsWith
(
"//FW"
)
&&
!
account
.
startsWith
(
"//RT"
))
{
Map
<
String
,
Object
>
finInstnIdMaps
=
null
;
if
(
intrmyAgt1Maps
.
containsKey
(
"finInstnId"
))
{
finInstnIdMaps
=
(
Map
<
String
,
Object
>)
intrmyAgt1Maps
.
get
(
"finInstnId"
);
}
else
{
finInstnIdMaps
=
new
HashMap
<>();
intrmyAgt1Maps
.
put
(
"finInstnId"
,
finInstnIdMaps
);
}
Map
<
String
,
Object
>
clrSysMmbIdMaps
=
null
;
if
(
finInstnIdMaps
.
containsKey
(
"clrSysMmbId"
))
{
clrSysMmbIdMaps
=
(
Map
<
String
,
Object
>)
finInstnIdMaps
.
get
(
"clrSysMmbId"
);
}
else
{
clrSysMmbIdMaps
=
new
HashMap
<>();
finInstnIdMaps
.
put
(
"clrSysMmbId"
,
clrSysMmbIdMaps
);
}
mt_to_mxClearingIdentifier
(
account
,
clrSysMmbIdMaps
);
}
else
if
(!
account
.
startsWith
(
"//"
)
||
account
.
startsWith
(
"//CH"
))
{
mt_to_mxFinancialInstitutionAccount
(
account
,
intrmyAgt1AcctMaps
);
}
}
else
if
(
field56C
!=
null
)
{
account
=
field56C
.
getValue
();
if
(
account
.
startsWith
(
"//RT"
))
{
clearingChannelRTGSFlag
=
true
;
}
Map
<
String
,
Object
>
finInstnIdMaps
=
null
;
if
(
intrmyAgt1Maps
.
containsKey
(
"finInstnId"
))
{
finInstnIdMaps
=
(
Map
<
String
,
Object
>)
intrmyAgt1Maps
.
get
(
"finInstnId"
);
}
else
{
finInstnIdMaps
=
new
HashMap
<>();
intrmyAgt1Maps
.
put
(
"finInstnId"
,
finInstnIdMaps
);
}
if
(
account
.
startsWith
(
"//"
)
&&
!
account
.
startsWith
(
"//CH"
)
&&
!
account
.
startsWith
(
"//FW"
))
{
if
(
isMTClearingSystemCodeInList
(
account
))
{
Map
<
String
,
Object
>
clrSysMmbIdMaps
=
null
;
if
(
finInstnIdMaps
.
containsKey
(
"clrSysMmbId"
))
{
clrSysMmbIdMaps
=
(
Map
<
String
,
Object
>)
finInstnIdMaps
.
get
(
"clrSysMmbId"
);
}
else
{
clrSysMmbIdMaps
=
new
HashMap
<>();
finInstnIdMaps
.
put
(
"clrSysMmbId"
,
clrSysMmbIdMaps
);
}
mt_to_mxClearingIdentifier
(
account
,
clrSysMmbIdMaps
);
//name address 设置NOTPROVIDED
finInstnIdMaps
.
put
(
"nm"
,
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
);
Map
<
String
,
Object
>
pstlAdrMaps
=
null
;
if
(
finInstnIdMaps
.
containsKey
(
"pstlAdr"
))
{
pstlAdrMaps
=
(
Map
<
String
,
Object
>)
finInstnIdMaps
.
get
(
"pstlAdr"
);
}
else
{
pstlAdrMaps
=
new
HashMap
<>();
finInstnIdMaps
.
put
(
"pstlAdr"
,
pstlAdrMaps
);
}
List
<
String
>
adrLineList
=
new
ArrayList
<>();
adrLineList
.
add
(
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
);
pstlAdrMaps
.
put
(
"adrLine"
,
adrLineList
);
}
else
{
mt_to_mxClearingSystemToNameAndAddressLine
(
account
,
null
,
finInstnIdMaps
);
}
}
else
if
(!
account
.
startsWith
(
"//"
)
||
account
.
startsWith
(
"//CH"
))
{
mt_to_mxFinancialInstitutionAccount
(
account
,
intrmyAgt1AcctMaps
);
//name address 设置NOTPROVIDED
finInstnIdMaps
.
put
(
"nm"
,
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
);
Map
<
String
,
Object
>
pstlAdrMaps
=
null
;
if
(
finInstnIdMaps
.
containsKey
(
"pstlAdr"
))
{
pstlAdrMaps
=
(
Map
<
String
,
Object
>)
finInstnIdMaps
.
get
(
"pstlAdr"
);
}
else
{
pstlAdrMaps
=
new
HashMap
<>();
finInstnIdMaps
.
put
(
"pstlAdr"
,
pstlAdrMaps
);
}
List
<
String
>
adrLineList
=
new
ArrayList
<>();
adrLineList
.
add
(
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
);
pstlAdrMaps
.
put
(
"adrLine"
,
adrLineList
);
}
}
else
if
(
field56D
!=
null
)
{
if
(
StringUtil
.
isNotEmpty
(
field56D
.
getComponent1
()))
{
account
=
"/"
+
field56D
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field56D
.
getComponent2
()))
{
account
=
"/"
+
field56D
.
getComponent2
();
}
if
(
account
.
startsWith
(
"//RT"
))
{
clearingChannelRTGSFlag
=
true
;
}
String
nameAddress
=
field56D
.
getNameAndAddress
();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress
(
nameAddress
,
intrmyAgt1Maps
);
if
(
account
.
startsWith
(
"//"
)
&&
!
account
.
startsWith
(
"//CH"
)
&&
!
account
.
startsWith
(
"//FW"
))
{
Map
<
String
,
Object
>
finInstnIdMaps
=
null
;
if
(
intrmyAgt1Maps
.
containsKey
(
"finInstnId"
))
{
finInstnIdMaps
=
(
Map
<
String
,
Object
>)
intrmyAgt1Maps
.
get
(
"finInstnId"
);
}
else
{
finInstnIdMaps
=
new
HashMap
<>();
intrmyAgt1Maps
.
put
(
"finInstnId"
,
finInstnIdMaps
);
}
Map
<
String
,
Object
>
clrSysMmbIdMaps
=
null
;
if
(
finInstnIdMaps
.
containsKey
(
"clrSysMmbId"
))
{
clrSysMmbIdMaps
=
(
Map
<
String
,
Object
>)
finInstnIdMaps
.
get
(
"clrSysMmbId"
);
}
else
{
clrSysMmbIdMaps
=
new
HashMap
<>();
finInstnIdMaps
.
put
(
"clrSysMmbId"
,
clrSysMmbIdMaps
);
}
mt_to_mxClearingIdentifier
(
account
,
clrSysMmbIdMaps
);
}
else
if
(!
account
.
startsWith
(
"//"
)
||
account
.
startsWith
(
"//CH"
))
{
mt_to_mxFinancialInstitutionAccount
(
account
,
intrmyAgt1AcctMaps
);
}
}
if
(
intrmyAgt1Maps
.
size
()
>
0
)
{
cdtTrfTxInfMaps
.
put
(
"intrmyAgt1"
,
intrmyAgt1Maps
);
}
if
(
intrmyAgt1AcctMaps
.
size
()
>
0
)
{
cdtTrfTxInfMaps
.
put
(
"intrmyAgt1Acct"
,
intrmyAgt1AcctMaps
);
}
if
(
clearingChannelRTGSFlag
)
{
Map
<
String
,
Object
>
pmtTpInfMaps
=
null
;
if
(
cdtTrfTxInfMaps
.
containsKey
(
"pmtTpInf"
))
{
pmtTpInfMaps
=
(
Map
<
String
,
Object
>)
cdtTrfTxInfMaps
.
get
(
"pmtTpInf"
);
}
else
{
pmtTpInfMaps
=
new
HashMap
<>();
cdtTrfTxInfMaps
.
put
(
"pmtTpInf"
,
pmtTpInfMaps
);
}
pmtTpInfMaps
.
put
(
"clrChanl"
,
"RTGS"
);
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse57Field.java
0 → 100644
View file @
904a5834
This diff is collapsed.
Click to expand it.
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse59Field.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field59
;
import
com.prowidesoftware.swift.model.field.Field59A
;
import
com.prowidesoftware.swift.model.field.Field59F
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
Pacs00801Parse59Field
extends
AbstractMt2MxPacs008001ParseField
{
private
static
final
String
NAME
=
"59"
;
private
static
final
String
NAME_A
=
"59A"
;
private
static
final
String
NAME_F
=
"59F"
;
@Override
public
void
parseField
()
throws
SwiftException
{
Field59
field59
=
null
;
Field59A
field59A
=
null
;
Field59F
field59F
=
null
;
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag
!=
null
)
{
field59
=
(
Field59
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_A
);
if
(
tag
!=
null
)
{
field59A
=
(
Field59A
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_F
);
if
(
tag
!=
null
)
{
field59F
=
(
Field59F
)
tag
.
asField
();
}
Map
<
String
,
Object
>
cdtrMaps
=
null
;
if
(
cdtTrfTxInfMaps
.
containsKey
(
"cdtr"
))
{
cdtrMaps
=
(
Map
<
String
,
Object
>)
cdtTrfTxInfMaps
.
get
(
"cdtr"
);
}
else
{
cdtrMaps
=
new
HashMap
<>();
}
Map
<
String
,
Object
>
cdtrAcctMaps
=
null
;
if
(
cdtTrfTxInfMaps
.
containsKey
(
"cdtrAcct"
))
{
cdtrAcctMaps
=
(
Map
<
String
,
Object
>)
cdtTrfTxInfMaps
.
get
(
"cdtrAcct"
);
}
else
{
cdtrAcctMaps
=
new
HashMap
<>();
}
String
account
=
""
;
if
(
field59A
!=
null
)
{
String
bicCode
=
field59A
.
getBIC
();
if
(
StringUtil
.
isNotEmpty
(
field59A
.
getComponent1
()))
{
account
+=
"/"
+
field59A
.
getComponent1
();
}
mt_to_mxAnyBIC
(
bicCode
,
cdtrMaps
);
if
(
StringUtil
.
isEmpty
(
account
))
{
buildDefaultValue
(
cdtrMaps
);
}
else
{
mt_to_mxPartyAccount
(
account
,
cdtrAcctMaps
);
}
}
if
(
field59F
!=
null
)
{
if
(
StringUtil
.
isNotEmpty
(
field59F
.
getComponent1
()))
{
account
+=
"/"
+
field59F
.
getComponent1
();
}
if
(
StringUtil
.
isEmpty
(
account
))
{
buildDefaultValue
(
cdtrMaps
);
}
else
{
mt_to_mxPartyAccount
(
account
,
cdtrAcctMaps
);
}
String
nameAddress
=
""
;
List
<
String
>
lines
=
field59F
.
getLines
();
for
(
int
i
=
0
;
i
<
lines
.
size
();
i
++)
{
if
(
i
==
0
&&
StringUtil
.
isNotEmpty
(
account
))
{
continue
;
}
if
(
i
==
lines
.
size
()-
1
)
{
nameAddress
+=
lines
.
get
(
i
);
}
else
{
nameAddress
+=
lines
.
get
(
i
)
+
Mx2MtConstants
.
NEW_LINE
;
}
}
mt_to_mxPartyNameAndStructuredAddress
(
nameAddress
,
cdtrMaps
);
}
if
(
field59
!=
null
)
{
String
nameAddress
=
field59
.
getNameAndAddress
(
Mx2MtConstants
.
NEW_LINE
);
if
(
StringUtil
.
isNotEmpty
(
field59
.
getComponent1
()))
{
account
+=
"/"
+
field59
.
getComponent1
();
}
mt_to_mxPartyNameAndAddress
(
nameAddress
,
cdtrMaps
);
if
(
StringUtil
.
isEmpty
(
account
))
{
buildDefaultValue
(
cdtrMaps
);
}
else
{
mt_to_mxPartyAccount
(
account
,
cdtrAcctMaps
);
}
}
if
(
cdtrMaps
.
size
()
>
0
)
{
cdtTrfTxInfMaps
.
put
(
"cdtr"
,
cdtrMaps
);
}
if
(
cdtrAcctMaps
.
size
()
>
0
)
{
cdtTrfTxInfMaps
.
put
(
"cdtrAcct"
,
cdtrAcctMaps
);
}
}
/**
* IF 59A/Account 59/Account IsAbsent
* THEN Copy "NOTPROVIDED" to Debtor/Id/OrgID/Other/ID
* and "TXID" to SchemeName/Code
* @param dbtrMaps
*/
private
void
buildDefaultValue
(
Map
<
String
,
Object
>
dbtrMaps
)
{
Map
<
String
,
Object
>
idMaps
=
null
;
if
(
dbtrMaps
.
containsKey
(
"id"
))
{
idMaps
=
(
Map
<
String
,
Object
>)
dbtrMaps
.
get
(
"id"
);
}
else
{
idMaps
=
new
HashMap
<>();
dbtrMaps
.
put
(
"id"
,
idMaps
);
}
Map
<
String
,
Object
>
idOrgMaps
=
null
;
if
(
idMaps
.
containsKey
(
"orgId"
))
{
idOrgMaps
=
(
Map
<
String
,
Object
>)
idMaps
.
get
(
"orgId"
);
}
else
{
idOrgMaps
=
new
HashMap
<>();
idMaps
.
put
(
"orgId"
,
idOrgMaps
);
}
JSONArray
othrJsonArray
=
null
;
if
(
idOrgMaps
.
containsKey
(
"othr"
))
{
othrJsonArray
=
(
JSONArray
)
idOrgMaps
.
get
(
"othr"
);
}
else
{
othrJsonArray
=
new
JSONArray
();
idOrgMaps
.
put
(
"othr"
,
othrJsonArray
);
}
Map
<
String
,
Object
>
othrMaps
=
new
HashMap
<>();
othrJsonArray
.
add
(
othrMaps
);
othrMaps
.
put
(
"id"
,
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
);
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse70Field.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field70
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
Pacs00801Parse70Field
extends
AbstractMt2MxPacs008001ParseField
{
private
static
final
String
NAME
=
"70"
;
@Override
public
void
parseField
()
throws
SwiftException
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag
!=
null
)
{
Field70
field70
=
(
Field70
)
tag
.
asField
();
String
mt70
=
field70
.
getValue
();
String
endToEndId
=
mt70roc_to_mx35Text
(
mt70
);;
if
(
StringUtil
.
isEmpty
(
endToEndId
))
{
endToEndId
=
Mx2MtConstants
.
MX_END_TO_END_ID_DEFAULT_VALUE
;
}
Map
<
String
,
Object
>
pmtIdMaps
=
null
;
if
(
cdtTrfTxInfMaps
.
containsKey
(
"pmtId"
))
{
pmtIdMaps
=
(
Map
<
String
,
Object
>)
cdtTrfTxInfMaps
.
get
(
"pmtId"
);
}
else
{
pmtIdMaps
=
new
HashMap
<>();
cdtTrfTxInfMaps
.
put
(
"pmtId"
,
pmtIdMaps
);
}
pmtIdMaps
.
put
(
"endToEndId"
,
endToEndId
);
Map
<
String
,
Object
>
rmtInfMaps
=
null
;
if
(
cdtTrfTxInfMaps
.
containsKey
(
"rmtInf"
))
{
rmtInfMaps
=
(
Map
<
String
,
Object
>)
cdtTrfTxInfMaps
.
get
(
"rmtInf"
);
}
else
{
rmtInfMaps
=
new
HashMap
<>();
}
mt_to_mxRemittanceInformation
(
mt70
,
rmtInfMaps
);
if
(
rmtInfMaps
.
size
()
>
0
)
{
cdtTrfTxInfMaps
.
put
(
"rmtInf"
,
rmtInfMaps
);
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse71Field.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.vo.common.ChargeForEnum
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field71A
;
import
com.prowidesoftware.swift.model.field.Field71F
;
import
com.prowidesoftware.swift.model.field.Field71G
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
Pacs00801Parse71Field
extends
AbstractMt2MxPacs008001ParseField
{
private
static
final
String
NAME_A
=
"71A"
;
private
static
final
String
NAME_F
=
"71F"
;
private
static
final
String
NAME_G
=
"71G"
;
@Override
public
void
parseField
()
throws
SwiftException
{
Field71A
field71A
=
null
;
Field71G
field71G
=
null
;
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_A
);
if
(
tag
!=
null
)
{
field71A
=
(
Field71A
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_G
);
if
(
tag
!=
null
)
{
field71G
=
(
Field71G
)
tag
.
asField
();
}
if
(
field71A
!=
null
)
{
ChargeForEnum
chargeForEnum
=
SwiftTransferUtil
.
getChargeForByDesc
(
field71A
.
getValue
());
if
(
chargeForEnum
!=
null
)
{
cdtTrfTxInfMaps
.
put
(
"chrgBr"
,
chargeForEnum
.
value
());
}
}
if
(
field71G
!=
null
)
{
String
ccy
=
field71G
.
getCurrency
();
BigDecimal
amt
=
field71G
.
amount
();
JSONArray
jsonArray
=
new
JSONArray
();
cdtTrfTxInfMaps
.
put
(
"chrgsInf"
,
jsonArray
);
Map
<
String
,
Object
>
chrgsInfMaps
=
new
HashMap
<>();
jsonArray
.
add
(
chrgsInfMaps
);
Map
<
String
,
Object
>
amtMaps
=
new
HashMap
<>();
amtMaps
.
put
(
"value"
,
amt
);
amtMaps
.
put
(
"ccy"
,
ccy
);
chrgsInfMaps
.
put
(
"amt"
,
amtMaps
);
Map
<
String
,
Object
>
agtMaps
=
new
HashMap
<>();
chrgsInfMaps
.
put
(
"agt"
,
agtMaps
);
String
receiverBic
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_RECEIVE_BIC
,
true
);
mt_to_mxBICFI
(
receiverBic
,
agtMaps
);
}
Tag
[]
tags
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagsByName
(
NAME_F
);
if
(
tag
!=
null
&&
tags
.
length
>
0
)
{
JSONArray
jsonArray
=
new
JSONArray
();
cdtTrfTxInfMaps
.
put
(
"chrgsInf"
,
jsonArray
);
for
(
int
i
=
0
;
i
<
tags
.
length
;
i
++)
{
Field71F
field71F
=
(
Field71F
)
tags
[
i
].
asField
();
String
ccy
=
field71F
.
getCurrency
();
BigDecimal
amt
=
field71F
.
amount
();
Map
<
String
,
Object
>
chrgsInfMaps
=
new
HashMap
<>();
jsonArray
.
add
(
chrgsInfMaps
);
Map
<
String
,
Object
>
amtMaps
=
new
HashMap
<>();
amtMaps
.
put
(
"value"
,
amt
);
amtMaps
.
put
(
"ccy"
,
ccy
);
chrgsInfMaps
.
put
(
"amt"
,
amtMaps
);
Map
<
String
,
Object
>
agtMaps
=
new
HashMap
<>();
chrgsInfMaps
.
put
(
"agt"
,
agtMaps
);
Map
<
String
,
Object
>
finInstnIdMaps
=
null
;
if
(
agtMaps
.
containsKey
(
"finInstnId"
))
{
finInstnIdMaps
=
(
Map
<
String
,
Object
>)
agtMaps
.
get
(
"finInstnId"
);
}
else
{
finInstnIdMaps
=
new
HashMap
<>();
agtMaps
.
put
(
"finInstnId"
,
finInstnIdMaps
);
}
//name address 设置NOTPROVIDED
finInstnIdMaps
.
put
(
"nm"
,
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
);
Map
<
String
,
Object
>
pstlAdrMaps
=
null
;
if
(
finInstnIdMaps
.
containsKey
(
"pstlAdr"
))
{
pstlAdrMaps
=
(
Map
<
String
,
Object
>)
finInstnIdMaps
.
get
(
"pstlAdr"
);
}
else
{
pstlAdrMaps
=
new
HashMap
<>();
finInstnIdMaps
.
put
(
"pstlAdr"
,
pstlAdrMaps
);
}
List
<
String
>
adrLineList
=
new
ArrayList
<>();
adrLineList
.
add
(
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
);
pstlAdrMaps
.
put
(
"adrLine"
,
adrLineList
);
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse72Field.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field72
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
public
class
Pacs00801Parse72Field
extends
AbstractMt2MxPacs008001ParseField
{
private
static
final
String
NAME
=
"72"
;
@Override
public
void
parseField
()
throws
SwiftException
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag
!=
null
)
{
Field72
field72
=
(
Field72
)
tag
.
asField
();
mt72ins_to_mxAgent
(
field72
.
getValue
(),
cdtTrfTxInfMaps
);
mt72_to_mxNextAgent
(
field72
.
getValue
(),
cdtTrfTxInfMaps
);
mt_to_mxField72NewCodeWords
(
field72
.
getValue
(),
cdtTrfTxInfMaps
);
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801Parse77BField.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field77B
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
public
class
Pacs00801Parse77BField
extends
AbstractMt2MxPacs008001ParseField
{
private
static
final
String
NAME
=
"77B"
;
@Override
public
void
parseField
()
throws
SwiftException
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME
);
if
(
tag
!=
null
)
{
String
creditorCountryCode
=
""
;
String
debtorCountryCode
=
""
;
Field77B
field77B
=
(
Field77B
)
tag
.
asField
();
List
<
String
>
lines
=
field77B
.
getLines
();
JSONArray
rgltryRptgJsonArray
=
null
;
if
(
cdtTrfTxInfMaps
.
containsKey
(
"rgltryRptg"
))
{
rgltryRptgJsonArray
=
(
JSONArray
)
cdtTrfTxInfMaps
.
get
(
"rgltryRptg"
);
}
else
{
rgltryRptgJsonArray
=
new
JSONArray
();
cdtTrfTxInfMaps
.
put
(
"rgltryRptg"
,
rgltryRptgJsonArray
);
}
Map
<
String
,
Object
>
rgltryRptgMaps
=
new
HashMap
<>();
rgltryRptgJsonArray
.
add
(
rgltryRptgMaps
);
JSONArray
dtlsJsonArray
=
null
;
if
(
rgltryRptgMaps
.
containsKey
(
"dtls"
))
{
dtlsJsonArray
=
(
JSONArray
)
rgltryRptgMaps
.
get
(
"dtls"
);
}
else
{
dtlsJsonArray
=
new
JSONArray
();
rgltryRptgMaps
.
put
(
"dtls"
,
dtlsJsonArray
);
}
Map
<
String
,
Object
>
dtlsMaps
=
new
HashMap
<>();
dtlsJsonArray
.
add
(
dtlsMaps
);
dtlsMaps
.
put
(
"inf"
,
lines
);
for
(
int
i
=
0
;
i
<
lines
.
size
();
i
++)
{
String
line
=
lines
.
get
(
i
);
String
regex
=
"/BENEFRES/([A-Z]{2})"
;
Pattern
p
=
Pattern
.
compile
(
regex
);
Matcher
m
=
p
.
matcher
(
line
);
if
(
m
.
find
())
{
creditorCountryCode
=
m
.
group
(
1
);
break
;
}
}
if
(
StringUtil
.
isNotEmpty
(
creditorCountryCode
))
{
Map
<
String
,
Object
>
cdtrMaps
=
null
;
if
(
cdtTrfTxInfMaps
.
containsKey
(
"cdtr"
))
{
cdtrMaps
=
(
Map
<
String
,
Object
>)
cdtTrfTxInfMaps
.
get
(
"cdtr"
);
}
else
{
cdtrMaps
=
new
HashMap
<>();
}
cdtrMaps
.
put
(
"ctryOfRes"
,
creditorCountryCode
);
}
for
(
int
i
=
0
;
i
<
lines
.
size
();
i
++)
{
String
line
=
lines
.
get
(
i
);
String
regex
=
"/ORDERRES/([A-Z]{2})"
;
Pattern
p
=
Pattern
.
compile
(
regex
);
Matcher
m
=
p
.
matcher
(
line
);
if
(
m
.
find
())
{
debtorCountryCode
=
m
.
group
(
1
);
break
;
}
}
if
(
StringUtil
.
isNotEmpty
(
debtorCountryCode
))
{
Map
<
String
,
Object
>
dbtrMaps
=
null
;
if
(
cdtTrfTxInfMaps
.
containsKey
(
"dbtr"
))
{
dbtrMaps
=
(
Map
<
String
,
Object
>)
cdtTrfTxInfMaps
.
get
(
"dbtr"
);
}
else
{
dbtrMaps
=
new
HashMap
<>();
}
dbtrMaps
.
put
(
"ctryOfRes"
,
debtorCountryCode
);
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801ParseSetlAcctField.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.VoSettlementMethodHelper
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field53A
;
import
com.prowidesoftware.swift.model.field.Field53B
;
import
com.prowidesoftware.swift.model.field.Field53D
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* Group Header -> Settlement Information -> Settlement Account
*/
public
class
Pacs00801ParseSetlAcctField
extends
AbstractMt2MxPacs008001ParseField
{
private
static
final
String
NAME_A
=
"53A"
;
private
static
final
String
NAME_B
=
"53B"
;
private
static
final
String
NAME_D
=
"53D"
;
@Override
public
void
parseField
()
throws
SwiftException
{
//值来源于 Pacs00801ParseSetlMtdField
VoSettlementMethodHelper
setlMtdHelper
=
context
.
get
(
VoSettlementMethodHelper
.
class
);
if
(
setlMtdHelper
.
isTranslateSetlAcctFlag
())
{
Field53A
field53A
=
null
;
Field53B
field53B
=
null
;
Field53D
field53D
=
null
;
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_A
);
if
(
tag
!=
null
)
{
field53A
=
(
Field53A
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_B
);
if
(
tag
!=
null
)
{
field53B
=
(
Field53B
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
NAME_D
);
if
(
tag
!=
null
)
{
field53D
=
(
Field53D
)
tag
.
asField
();
}
String
account
=
""
;
if
(
field53A
!=
null
)
{
if
(
StringUtil
.
isNotEmpty
(
field53A
.
getComponent1
()))
{
account
+=
"/"
+
field53A
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field53A
.
getComponent2
()))
{
account
+=
"/"
+
field53A
.
getComponent2
();
}
}
else
if
(
field53B
!=
null
)
{
if
(
StringUtil
.
isNotEmpty
(
field53B
.
getComponent1
()))
{
account
+=
"/"
+
field53B
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field53B
.
getComponent2
()))
{
account
+=
"/"
+
field53B
.
getComponent2
();
}
}
else
if
(
field53D
!=
null
)
{
if
(
StringUtil
.
isNotEmpty
(
field53D
.
getComponent1
()))
{
account
+=
"/"
+
field53D
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field53D
.
getComponent2
()))
{
account
+=
"/"
+
field53D
.
getComponent2
();
}
}
if
(
StringUtil
.
isEmpty
(
account
))
return
;
Map
<
String
,
Object
>
sttlmInfMaps
=
null
;
if
(
grpHdrMaps
.
containsKey
(
"sttlmInf"
))
{
sttlmInfMaps
=
(
Map
<
String
,
Object
>)
grpHdrMaps
.
get
(
"sttlmInf"
);
}
else
{
sttlmInfMaps
=
new
HashMap
<>();
grpHdrMaps
.
put
(
"sttlmInf"
,
sttlmInfMaps
);
}
Map
<
String
,
Object
>
sttlmAcctMaps
=
null
;
if
(
sttlmInfMaps
.
containsKey
(
"sttlmAcct"
))
{
sttlmAcctMaps
=
(
Map
<
String
,
Object
>)
sttlmInfMaps
.
get
(
"sttlmAcct"
);
}
else
{
sttlmAcctMaps
=
new
HashMap
<>();
sttlmInfMaps
.
put
(
"sttlmAcct"
,
sttlmAcctMaps
);
}
mt_to_mxFinancialInstitutionAccount
(
account
,
sttlmAcctMaps
);
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/pacs008001/impl/Pacs00801ParseSetlMtdField.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
pacs008001
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2mx.pacs008001.AbstractMt2MxPacs008001ParseField
;
import
com.brilliance.swift.mt2mx.setlmtd.SettlementMethodAnalyzerFactory
;
import
com.brilliance.swift.vo.VoSettlementMethodHelper
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* Group Header -> Settlement Information -> Settlement Method
*/
public
class
Pacs00801ParseSetlMtdField
extends
AbstractMt2MxPacs008001ParseField
{
@Override
public
void
parseField
()
throws
SwiftException
{
VoSettlementMethodHelper
setlMtdHelper
=
SettlementMethodAnalyzerFactory
.
find
(
context
).
analyse
();
String
settlementMethod
=
setlMtdHelper
.
getSettlementMethod
();
Map
<
String
,
Object
>
sttlmInfMaps
=
null
;
if
(
grpHdrMaps
.
containsKey
(
"sttlmInf"
))
{
sttlmInfMaps
=
(
Map
<
String
,
Object
>)
grpHdrMaps
.
get
(
"sttlmInf"
);
}
else
{
sttlmInfMaps
=
new
HashMap
<>();
grpHdrMaps
.
put
(
"sttlmInf"
,
sttlmInfMaps
);
}
sttlmInfMaps
.
put
(
"sttlmMtd"
,
settlementMethod
);
context
.
set
(
setlMtdHelper
);
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/setlmtd/AbstractSettlementMethodAnalyzer.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
setlmtd
;
import
com.brilliance.swift.mt2mx.Mt2MxContext
;
import
com.prowidesoftware.swift.model.field.Field
;
public
abstract
class
AbstractSettlementMethodAnalyzer
implements
SettlementMethodAnalyzer
{
protected
Mt2MxContext
context
;
public
Mt2MxContext
getContext
()
{
return
context
;
}
public
AbstractSettlementMethodAnalyzer
setContext
(
Mt2MxContext
context
)
{
this
.
context
=
context
;
return
this
;
}
protected
Field
field53
;
protected
Field
field54
;
public
Field
getField53
()
{
return
field53
;
}
public
AbstractSettlementMethodAnalyzer
setField53
(
Field
field53
)
{
this
.
field53
=
field53
;
return
this
;
}
public
Field
getField54
()
{
return
field54
;
}
public
AbstractSettlementMethodAnalyzer
setField54
(
Field
field54
)
{
this
.
field54
=
field54
;
return
this
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/setlmtd/SettlementMethodAnalyzer.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
setlmtd
;
import
com.brilliance.swift.vo.VoSettlementMethodHelper
;
/**
* 根据53 54 分析出settlement method 以及 53 54 55是否被翻译
*/
public
interface
SettlementMethodAnalyzer
{
VoSettlementMethodHelper
analyse
();
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/setlmtd/SettlementMethodAnalyzerFactory.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
setlmtd
;
import
com.brilliance.swift.mt2mx.Mt2MxContext
;
import
com.brilliance.swift.mt2mx.setlmtd.impl.*
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.*
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
public
class
SettlementMethodAnalyzerFactory
{
public
static
SettlementMethodAnalyzer
find
(
Mt2MxContext
context
)
{
SettlementMethodAnalyzer
analyzer
=
null
;
Field53A
field53A
=
null
;
Field53B
field53B
=
null
;
Field53D
field53D
=
null
;
Field54A
field54A
=
null
;
Field54B
field54B
=
null
;
Field54D
field54D
=
null
;
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
"53A"
);
if
(
tag
!=
null
)
{
field53A
=
(
Field53A
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
"53B"
);
if
(
tag
!=
null
)
{
field53B
=
(
Field53B
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
"53D"
);
if
(
tag
!=
null
)
{
field53D
=
(
Field53D
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
"54A"
);
if
(
tag
!=
null
)
{
field54A
=
(
Field54A
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
"54B"
);
if
(
tag
!=
null
)
{
field54B
=
(
Field54B
)
tag
.
asField
();
}
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
"54D"
);
if
(
tag
!=
null
)
{
field54D
=
(
Field54D
)
tag
.
asField
();
}
boolean
noneField53
=
false
;
if
(
field53A
==
null
&&
field53B
==
null
&&
field53D
==
null
)
{
noneField53
=
true
;
}
boolean
noneField54
=
false
;
if
(
field54A
==
null
&&
field54B
==
null
&&
field54D
==
null
)
{
noneField54
=
true
;
}
if
(
noneField53
&&
noneField54
)
{
analyzer
=
new
FieldNone5354Analyzer
().
setContext
(
context
);
}
else
if
(
field53A
!=
null
&&
noneField54
)
{
analyzer
=
new
FieldOnly53AAnalyzer
()
.
setContext
(
context
)
.
setField53
(
field53A
);
}
else
if
(
field53B
!=
null
&&
noneField54
)
{
analyzer
=
new
FieldOnly53BAnalyzer
()
.
setContext
(
context
)
.
setField53
(
field53B
);
}
else
if
(
field53D
!=
null
&&
noneField54
)
{
analyzer
=
new
FieldOnly53DAnalyzer
()
.
setContext
(
context
)
.
setField53
(
field53D
);
}
else
if
(
noneField53
&&
field54A
!=
null
)
{
analyzer
=
new
FieldOnly54AAnalyzer
()
.
setContext
(
context
)
.
setField54
(
field54A
);
}
else
if
(
noneField53
&&
field54B
!=
null
)
{
analyzer
=
new
FieldOnly54BAnalyzer
()
.
setContext
(
context
)
.
setField54
(
field54B
);
}
else
if
(
noneField53
&&
field54D
!=
null
)
{
analyzer
=
new
FieldOnly54DAnalyzer
()
.
setContext
(
context
)
.
setField54
(
field54D
);
}
else
if
(
field53A
!=
null
&&
field54A
!=
null
)
{
analyzer
=
new
Field53A54AAnalyzer
()
.
setContext
(
context
)
.
setField53
(
field53A
)
.
setField54
(
field54A
);
}
else
if
(
field53A
!=
null
&&
field54B
!=
null
)
{
analyzer
=
new
Field53A54BAnalyzer
()
.
setContext
(
context
)
.
setField53
(
field53A
)
.
setField54
(
field54B
);
}
else
if
(
field53A
!=
null
&&
field54D
!=
null
)
{
analyzer
=
new
Field53A54DAnalyzer
()
.
setContext
(
context
)
.
setField53
(
field53A
)
.
setField54
(
field54D
);
}
else
if
(
field53B
!=
null
&&
field54A
!=
null
)
{
analyzer
=
new
Field53B54aAnalyzer
()
.
setContext
(
context
)
.
setField53
(
field53B
)
.
setField54
(
field54A
);
}
else
if
(
field53B
!=
null
&&
!
noneField54
)
{
analyzer
=
new
Field53B54aAnalyzer
()
.
setContext
(
context
)
.
setField53
(
field53B
);
}
else
if
(
field53D
!=
null
&&
!
noneField54
)
{
analyzer
=
new
Field53D54aAnalyzer
()
.
setContext
(
context
)
.
setField53
(
field53D
);
}
return
analyzer
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/setlmtd/impl/Field53A54AAnalyzer.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
setlmtd
.
impl
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.vo.VoSettlementMethodHelper
;
import
com.prowidesoftware.swift.model.field.Field53A
;
import
com.prowidesoftware.swift.model.field.Field54A
;
public
class
Field53A54AAnalyzer
extends
AbstractSettlementMethodAnalyzer
{
@Override
public
VoSettlementMethodHelper
analyse
()
{
VoSettlementMethodHelper
seltMtdHelper
=
new
VoSettlementMethodHelper
();
Field53A
field53A
=
(
Field53A
)
field53
;
String
field53BicCode
=
field53A
.
getBIC
();
String
account
=
""
;
if
(
StringUtil
.
isNotEmpty
(
field53A
.
getComponent1
()))
{
account
+=
"/"
+
field53A
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field53A
.
getComponent2
()))
{
account
+=
"/"
+
field53A
.
getComponent2
();
}
Field54A
field54A
=
(
Field54A
)
field54
;
String
field54BicCode
=
field54A
.
getBIC
();
String
sendBic
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_SEND_BIC
,
true
);
String
receiveBic
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_RECEIVE_BIC
,
true
);
if
(
field53BicCode
.
equals
(
sendBic
)
&&
field54BicCode
.
equals
(
receiveBic
))
{
seltMtdHelper
.
setSettlementMethod
(
"INDA"
);
}
else
if
(
StringUtil
.
isNotEmpty
(
sendBic
)
&&
field53BicCode
.
substring
(
0
,
6
).
equals
(
sendBic
.
substring
(
0
,
6
))
&&
SwiftTransferUtil
.
isAccount
(
account
))
{
if
(
account
.
startsWith
(
"/C/"
))
{
seltMtdHelper
.
setSettlementMethod
(
"INGA"
);
}
else
{
seltMtdHelper
.
setSettlementMethod
(
"INDA"
);
}
seltMtdHelper
.
setTranslateSetlAcctFlag
(
true
);
}
else
{
seltMtdHelper
.
setSettlementMethod
(
"COVE"
);
seltMtdHelper
.
setTranslate53Flag
(
true
);
seltMtdHelper
.
setTranslate54Flag
(
true
);
seltMtdHelper
.
setTranslate55Flag
(
true
);
}
return
seltMtdHelper
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/setlmtd/impl/Field53A54BAnalyzer.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
setlmtd
.
impl
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.vo.VoSettlementMethodHelper
;
import
com.prowidesoftware.swift.model.field.Field53A
;
public
class
Field53A54BAnalyzer
extends
AbstractSettlementMethodAnalyzer
{
@Override
public
VoSettlementMethodHelper
analyse
()
{
VoSettlementMethodHelper
seltMtdHelper
=
new
VoSettlementMethodHelper
();
Field53A
field53A
=
(
Field53A
)
field53
;
String
field53BicCode
=
field53A
.
getBIC
();
String
account
=
""
;
if
(
StringUtil
.
isNotEmpty
(
field53A
.
getComponent1
()))
{
account
+=
"/"
+
field53A
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field53A
.
getComponent2
()))
{
account
+=
"/"
+
field53A
.
getComponent2
();
}
String
sendBic
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_SEND_BIC
,
true
);
if
(
StringUtil
.
isNotEmpty
(
sendBic
)
&&
field53BicCode
.
substring
(
0
,
6
).
equals
(
sendBic
.
substring
(
0
,
6
))
&&
SwiftTransferUtil
.
isAccount
(
account
))
{
if
(
account
.
startsWith
(
"/C/"
))
{
seltMtdHelper
.
setSettlementMethod
(
"INGA"
);
}
else
{
seltMtdHelper
.
setSettlementMethod
(
"INDA"
);
}
seltMtdHelper
.
setTranslateSetlAcctFlag
(
true
);
}
else
{
seltMtdHelper
.
setSettlementMethod
(
"COVE"
);
seltMtdHelper
.
setTranslate53Flag
(
true
);
seltMtdHelper
.
setTranslate54Flag
(
true
);
seltMtdHelper
.
setTranslate55Flag
(
true
);
}
return
seltMtdHelper
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/setlmtd/impl/Field53A54DAnalyzer.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
setlmtd
.
impl
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.vo.VoSettlementMethodHelper
;
import
com.prowidesoftware.swift.model.field.Field53A
;
public
class
Field53A54DAnalyzer
extends
AbstractSettlementMethodAnalyzer
{
@Override
public
VoSettlementMethodHelper
analyse
()
{
VoSettlementMethodHelper
seltMtdHelper
=
new
VoSettlementMethodHelper
();
Field53A
field53A
=
(
Field53A
)
field53
;
String
field53BicCode
=
field53A
.
getBIC
();
String
account
=
""
;
if
(
StringUtil
.
isNotEmpty
(
field53A
.
getComponent1
()))
{
account
+=
"/"
+
field53A
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field53A
.
getComponent2
()))
{
account
+=
"/"
+
field53A
.
getComponent2
();
}
String
sendBic
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_SEND_BIC
,
true
);
if
(
StringUtil
.
isNotEmpty
(
sendBic
)
&&
field53BicCode
.
substring
(
0
,
6
).
equals
(
sendBic
.
substring
(
0
,
6
))
&&
SwiftTransferUtil
.
isAccount
(
account
))
{
if
(
account
.
startsWith
(
"/C/"
))
{
seltMtdHelper
.
setSettlementMethod
(
"INGA"
);
}
else
{
seltMtdHelper
.
setSettlementMethod
(
"INDA"
);
}
seltMtdHelper
.
setTranslateSetlAcctFlag
(
true
);
}
else
{
seltMtdHelper
.
setSettlementMethod
(
"COVE"
);
seltMtdHelper
.
setTranslate53Flag
(
true
);
seltMtdHelper
.
setTranslate54Flag
(
true
);
seltMtdHelper
.
setTranslate55Flag
(
true
);
}
return
seltMtdHelper
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/setlmtd/impl/Field53B54aAnalyzer.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
setlmtd
.
impl
;
import
com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.vo.VoSettlementMethodHelper
;
import
com.prowidesoftware.swift.model.field.Field53B
;
public
class
Field53B54aAnalyzer
extends
AbstractSettlementMethodAnalyzer
{
@Override
public
VoSettlementMethodHelper
analyse
()
{
VoSettlementMethodHelper
seltMtdHelper
=
new
VoSettlementMethodHelper
();
Field53B
field53B
=
(
Field53B
)
field53
;
String
account
=
""
;
if
(
StringUtil
.
isNotEmpty
(
field53B
.
getComponent1
()))
{
account
+=
"/"
+
field53B
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field53B
.
getComponent2
()))
{
account
+=
"/"
+
field53B
.
getComponent2
();
}
if
(
SwiftTransferUtil
.
isAccount
(
account
))
{
if
(
account
.
startsWith
(
"/C/"
))
{
seltMtdHelper
.
setSettlementMethod
(
"INGA"
);
}
else
{
seltMtdHelper
.
setSettlementMethod
(
"INDA"
);
}
seltMtdHelper
.
setTranslateSetlAcctFlag
(
true
);
}
else
{
seltMtdHelper
.
setSettlementMethod
(
"INDA"
);
}
return
seltMtdHelper
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/setlmtd/impl/Field53D54aAnalyzer.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
setlmtd
.
impl
;
import
com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.vo.VoSettlementMethodHelper
;
import
com.prowidesoftware.swift.model.field.Field53D
;
public
class
Field53D54aAnalyzer
extends
AbstractSettlementMethodAnalyzer
{
@Override
public
VoSettlementMethodHelper
analyse
()
{
VoSettlementMethodHelper
seltMtdHelper
=
new
VoSettlementMethodHelper
();
Field53D
field53D
=
(
Field53D
)
field53
;
String
account
=
""
;
if
(
StringUtil
.
isNotEmpty
(
field53D
.
getComponent1
()))
{
account
+=
"/"
+
field53D
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field53D
.
getComponent2
()))
{
account
+=
"/"
+
field53D
.
getComponent2
();
}
if
(
SwiftTransferUtil
.
isAccount
(
account
))
{
if
(
account
.
startsWith
(
"/C/"
))
{
seltMtdHelper
.
setSettlementMethod
(
"INGA"
);
}
else
{
seltMtdHelper
.
setSettlementMethod
(
"INDA"
);
}
seltMtdHelper
.
setTranslateSetlAcctFlag
(
true
);
}
else
{
seltMtdHelper
.
setSettlementMethod
(
"COVE"
);
seltMtdHelper
.
setTranslate53Flag
(
true
);
seltMtdHelper
.
setTranslate54Flag
(
true
);
seltMtdHelper
.
setTranslate55Flag
(
true
);
}
return
seltMtdHelper
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/setlmtd/impl/FieldNone5354Analyzer.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
setlmtd
.
impl
;
import
com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer
;
import
com.brilliance.swift.vo.VoSettlementMethodHelper
;
public
class
FieldNone5354Analyzer
extends
AbstractSettlementMethodAnalyzer
{
@Override
public
VoSettlementMethodHelper
analyse
()
{
VoSettlementMethodHelper
seltMtdHelper
=
new
VoSettlementMethodHelper
();
seltMtdHelper
.
setSettlementMethod
(
"INDA"
);
return
seltMtdHelper
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/setlmtd/impl/FieldOnly53AAnalyzer.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
setlmtd
.
impl
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.vo.VoSettlementMethodHelper
;
import
com.prowidesoftware.swift.model.field.Field53A
;
public
class
FieldOnly53AAnalyzer
extends
AbstractSettlementMethodAnalyzer
{
@Override
public
VoSettlementMethodHelper
analyse
()
{
VoSettlementMethodHelper
seltMtdHelper
=
new
VoSettlementMethodHelper
();
Field53A
field53A
=
(
Field53A
)
field53
;
String
account
=
""
;
if
(
StringUtil
.
isNotEmpty
(
field53A
.
getComponent1
()))
{
account
+=
"/"
+
field53A
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field53A
.
getComponent2
()))
{
account
+=
"/"
+
field53A
.
getComponent2
();
}
String
bicCode
=
field53A
.
getBIC
();
if
(
SwiftTransferUtil
.
isAccount
(
account
))
{
if
(
account
.
startsWith
(
"/C/"
))
{
seltMtdHelper
.
setSettlementMethod
(
"INGA"
);
}
else
{
seltMtdHelper
.
setSettlementMethod
(
"INDA"
);
}
seltMtdHelper
.
setTranslateSetlAcctFlag
(
true
);
seltMtdHelper
.
setInstructionForNextAgent
(
"/FIN53/"
+
bicCode
);
}
else
{
String
sendBic
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_SEND_BIC
,
true
);
String
receiveBic
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_RECEIVE_BIC
,
true
);
if
((
StringUtil
.
isNotEmpty
(
sendBic
)
&&
bicCode
.
substring
(
0
,
6
).
equals
(
sendBic
.
substring
(
0
,
6
)))
||
(
StringUtil
.
isNotEmpty
(
receiveBic
)
&&
bicCode
.
substring
(
0
,
6
).
equals
(
receiveBic
.
substring
(
0
,
6
))))
{
seltMtdHelper
.
setSettlementMethod
(
"INDA"
);
seltMtdHelper
.
setInstructionForNextAgent
(
"/FIN53/"
+
bicCode
);
}
else
{
seltMtdHelper
.
setSettlementMethod
(
"COVE"
);
seltMtdHelper
.
setTranslate53Flag
(
true
);
}
}
return
seltMtdHelper
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/setlmtd/impl/FieldOnly53BAnalyzer.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
setlmtd
.
impl
;
import
com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.vo.VoSettlementMethodHelper
;
import
com.prowidesoftware.swift.model.field.Field53B
;
public
class
FieldOnly53BAnalyzer
extends
AbstractSettlementMethodAnalyzer
{
@Override
public
VoSettlementMethodHelper
analyse
()
{
VoSettlementMethodHelper
seltMtdHelper
=
new
VoSettlementMethodHelper
();
Field53B
field53B
=
(
Field53B
)
field53
;
String
account
=
""
;
if
(
StringUtil
.
isNotEmpty
(
field53B
.
getComponent1
()))
{
account
+=
"/"
+
field53B
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field53B
.
getComponent2
()))
{
account
+=
"/"
+
field53B
.
getComponent2
();
}
if
(
SwiftTransferUtil
.
isAccount
(
account
))
{
if
(
account
.
startsWith
(
"/C/"
))
{
seltMtdHelper
.
setSettlementMethod
(
"INGA"
);
}
else
{
seltMtdHelper
.
setSettlementMethod
(
"INDA"
);
}
seltMtdHelper
.
setTranslateSetlAcctFlag
(
true
);
}
else
{
seltMtdHelper
.
setSettlementMethod
(
"INDA"
);
}
return
seltMtdHelper
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/setlmtd/impl/FieldOnly53DAnalyzer.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
setlmtd
.
impl
;
import
com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.vo.VoSettlementMethodHelper
;
import
com.prowidesoftware.swift.model.field.Field53D
;
public
class
FieldOnly53DAnalyzer
extends
AbstractSettlementMethodAnalyzer
{
@Override
public
VoSettlementMethodHelper
analyse
()
{
VoSettlementMethodHelper
seltMtdHelper
=
new
VoSettlementMethodHelper
();
Field53D
field53D
=
(
Field53D
)
field53
;
String
account
=
""
;
if
(
StringUtil
.
isNotEmpty
(
field53D
.
getComponent1
()))
{
account
+=
"/"
+
field53D
.
getComponent1
();
}
if
(
StringUtil
.
isNotEmpty
(
field53D
.
getComponent2
()))
{
account
+=
"/"
+
field53D
.
getComponent2
();
}
if
(
SwiftTransferUtil
.
isAccount
(
account
))
{
if
(
account
.
startsWith
(
"/C/"
))
{
seltMtdHelper
.
setSettlementMethod
(
"INGA"
);
}
else
{
seltMtdHelper
.
setSettlementMethod
(
"INDA"
);
}
seltMtdHelper
.
setTranslateSetlAcctFlag
(
true
);
}
else
{
seltMtdHelper
.
setSettlementMethod
(
"INDA"
);
}
return
seltMtdHelper
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/setlmtd/impl/FieldOnly54AAnalyzer.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
setlmtd
.
impl
;
import
com.brilliance.swift.mt2mx.Mt2MxContextIdentifier
;
import
com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.VoSettlementMethodHelper
;
import
com.prowidesoftware.swift.model.field.Field54A
;
public
class
FieldOnly54AAnalyzer
extends
AbstractSettlementMethodAnalyzer
{
@Override
public
VoSettlementMethodHelper
analyse
()
{
VoSettlementMethodHelper
seltMtdHelper
=
new
VoSettlementMethodHelper
();
Field54A
field54A
=
(
Field54A
)
field54
;
String
bicCode
=
field54A
.
getBIC
();
String
sendBic
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_SEND_BIC
,
true
);
String
receiveBic
=
(
String
)
context
.
get
(
Mt2MxContextIdentifier
.
MT_RECEIVE_BIC
,
true
);
if
((
StringUtil
.
isNotEmpty
(
sendBic
)
&&
bicCode
.
substring
(
0
,
8
).
equals
(
sendBic
.
substring
(
0
,
8
)))
||
(
StringUtil
.
isNotEmpty
(
receiveBic
)
&&
bicCode
.
substring
(
0
,
8
).
equals
(
receiveBic
.
substring
(
0
,
8
))))
{
seltMtdHelper
.
setSettlementMethod
(
"INDA"
);
}
else
{
seltMtdHelper
.
setSettlementMethod
(
"COVE"
);
seltMtdHelper
.
setTranslate54Flag
(
true
);
}
return
seltMtdHelper
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/setlmtd/impl/FieldOnly54BAnalyzer.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
setlmtd
.
impl
;
import
com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer
;
import
com.brilliance.swift.vo.VoSettlementMethodHelper
;
public
class
FieldOnly54BAnalyzer
extends
AbstractSettlementMethodAnalyzer
{
@Override
public
VoSettlementMethodHelper
analyse
()
{
VoSettlementMethodHelper
seltMtdHelper
=
new
VoSettlementMethodHelper
();
seltMtdHelper
.
setSettlementMethod
(
"COVE"
);
seltMtdHelper
.
setTranslate54Flag
(
true
);
return
seltMtdHelper
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2mx/setlmtd/impl/FieldOnly54DAnalyzer.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
mt2mx
.
setlmtd
.
impl
;
import
com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer
;
import
com.brilliance.swift.vo.VoSettlementMethodHelper
;
public
class
FieldOnly54DAnalyzer
extends
AbstractSettlementMethodAnalyzer
{
@Override
public
VoSettlementMethodHelper
analyse
()
{
VoSettlementMethodHelper
seltMtdHelper
=
new
VoSettlementMethodHelper
();
seltMtdHelper
.
setSettlementMethod
(
"COVE"
);
seltMtdHelper
.
setTranslate54Flag
(
true
);
return
seltMtdHelper
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/AbstractMx2MtCreator.java
View file @
904a5834
...
...
@@ -18,6 +18,7 @@ import org.dom4j.Document;
import
java.io.File
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.text.ParseException
;
import
java.util.*
;
public
abstract
class
AbstractMx2MtCreator
implements
Mx2MtCreator
{
...
...
@@ -32,13 +33,18 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
this
.
context
=
context
;
}
//TODO
protected
String
getRandomNumber
(
int
length
)
{
String
randomNumber
=
""
;
/*
String randomNumber = "";
Random random = new Random();
for (int i=0; i<length; i++) {
randomNumber += random.nextInt(9);
}
return randomNumber;*/
String
randomNumber
=
""
;
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
randomNumber
+=
"0"
;
}
return
randomNumber
;
}
...
...
@@ -46,9 +52,11 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
String
processedBicCode
=
""
;
if
(!
StringUtil
.
isEmpty
(
bicCode
))
{
if
(
bicCode
.
length
()
==
8
)
{
processedBicCode
=
bicCode
+
Mx2MtConstants
.
BICSUFFIX
;
//processedBicCode = bicCode + Mx2MtConstants.BICSUFFIX;
processedBicCode
=
bicCode
+
"XXXX"
;
}
else
if
(
bicCode
.
length
()
==
11
)
{
processedBicCode
=
bicCode
.
substring
(
0
,
8
)
+
Mx2MtConstants
.
BICMIDDLE
+
bicCode
.
substring
(
8
);
//processedBicCode = bicCode.substring(0, 8) + Mx2MtConstants.BICMIDDLE + bicCode.substring(8);
processedBicCode
=
bicCode
.
substring
(
0
,
8
)
+
"X"
+
bicCode
.
substring
(
8
);
}
else
{
throw
new
SwiftException
(
"ERROR"
,
"BicCode length is invalid."
);
}
...
...
@@ -129,14 +137,20 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
}
Date
outputDate
=
(
Date
)
context
.
get
(
Mx2MtConstants
.
OUTPUT_DATE
,
true
);
if
(
outputDate
==
null
)
{
outputDate
=
new
Date
();
try
{
outputDate
=
DateUtil
.
parseDate
(
"9999-12-31"
,
"yyyy-MM-dd"
);
}
catch
(
ParseException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
String
applicationMode
=
(
String
)
context
.
get
(
Mx2MtConstants
.
APPLICATION_MODE
,
true
);
if
(
"O"
.
equalsIgnoreCase
(
applicationMode
))
{
SwiftBlock2Output
block2
=
new
SwiftBlock2Output
();
block2
.
setMessageType
(
getMtType
());
block2
.
setSenderInputTime
(
DateUtil
.
format
(
inputDate
,
"HHmm"
));
block2
.
setMIRDate
(
DateUtil
.
format
(
inputDate
,
"yyMMdd"
));
//block2.setSenderInputTime(DateUtil.format(inputDate, "HHmm"));
//block2.setMIRDate(DateUtil.format(inputDate, "yyMMdd"));
block2
.
setSenderInputTime
(
"0000"
);
block2
.
setMIRDate
(
"991231"
);
block2
.
setMIRLogicalTerminal
(
processBicCode
(
senderBic
));
block2
.
setMIRSessionNumber
(
getRandomNumber
(
4
));
block2
.
setMIRSequenceNumber
(
getRandomNumber
(
6
));
...
...
swiftCore/src/main/java/com/brilliance/swift/util/SwiftTransferUtil.java
View file @
904a5834
...
...
@@ -4,9 +4,7 @@ import cn.hutool.poi.excel.ExcelReader;
import
cn.hutool.poi.excel.ExcelUtil
;
import
com.brilliance.swift.vo.MxMtReasonCodeInfo
;
import
com.brilliance.swift.vo.SwiftTransferErrorInfo
;
import
com.brilliance.swift.vo.common.ClearingSystemMemberCode
;
import
com.brilliance.swift.vo.common.OrganisationIdentificationCode
;
import
com.brilliance.swift.vo.common.PersonIdentificationCode
;
import
com.brilliance.swift.vo.common.*
;
import
javax.xml.datatype.DatatypeConfigurationException
;
import
javax.xml.datatype.DatatypeFactory
;
...
...
@@ -16,8 +14,8 @@ import java.math.BigDecimal;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
public
class
SwiftTransferUtil
{
public
class
SwiftTransferUtil
{
private
static
Properties
properties
=
null
;
public
static
XMLGregorianCalendar
getXMLGregorianCalendarNow
()
{
...
...
@@ -558,6 +556,69 @@ public class SwiftTransferUtil {
return
false
;
}
public
static
CategoryPurposeCode
getCategoryPurposeByValue
(
String
value
)
{
CategoryPurposeCode
code
=
null
;
CategoryPurposeCode
[]
values
=
CategoryPurposeCode
.
values
();
for
(
CategoryPurposeCode
tmpCode
:
values
)
{
if
(
tmpCode
.
value
().
equals
(
value
))
{
code
=
tmpCode
;
break
;
}
}
return
code
;
}
public
static
LocalInstrumentCode
getLocalInstrumentByValue
(
String
value
)
{
LocalInstrumentCode
code
=
null
;
LocalInstrumentCode
[]
values
=
LocalInstrumentCode
.
values
();
for
(
LocalInstrumentCode
tmpCode
:
values
)
{
if
(
value
.
matches
(
"^[0-9]*$"
))
{
value
=
"_"
+
value
;
//如果value是纯数字,则前缀加上下划线
}
if
(
tmpCode
.
value
().
equals
(
value
))
{
code
=
tmpCode
;
break
;
}
}
return
code
;
}
public
static
ServiceLevelCode
getServiceLevelByValue
(
String
value
)
{
ServiceLevelCode
code
=
null
;
ServiceLevelCode
[]
values
=
ServiceLevelCode
.
values
();
for
(
ServiceLevelCode
tmpCode
:
values
)
{
if
(
tmpCode
.
value
().
equals
(
value
))
{
code
=
tmpCode
;
break
;
}
}
return
code
;
}
public
static
ChargeForEnum
getChargeForByDesc
(
String
desc
)
{
ChargeForEnum
code
=
null
;
ChargeForEnum
[]
values
=
ChargeForEnum
.
values
();
for
(
ChargeForEnum
tmpCode
:
values
)
{
if
(
tmpCode
.
desc
().
equals
(
desc
))
{
code
=
tmpCode
;
break
;
}
}
return
code
;
}
public
static
ClearingSystemMemberCode
getClsSysMemberByDesc
(
String
desc
)
{
ClearingSystemMemberCode
code
=
null
;
ClearingSystemMemberCode
[]
values
=
ClearingSystemMemberCode
.
values
();
for
(
ClearingSystemMemberCode
tmpCode
:
values
)
{
if
(
tmpCode
.
desc
().
equals
(
desc
))
{
code
=
tmpCode
;
break
;
}
}
return
code
;
}
/**
* 根据字符串取到清算系统代码
* ClearingSystemMemberCode对象包含了
...
...
@@ -675,4 +736,13 @@ public class SwiftTransferUtil {
}
return
list
;
}
public
static
boolean
isAccount
(
String
account
)
{
boolean
flag
=
false
;
if
(
StringUtil
.
isEmpty
(
account
))
return
flag
;
if
(
account
.
startsWith
(
"//CH"
)
||
!
account
.
startsWith
(
"//"
))
{
flag
=
true
;
}
return
flag
;
}
}
swiftCore/src/main/java/com/brilliance/swift/vo/VoSettlementMethodHelper.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
vo
;
import
java.io.Serializable
;
public
class
VoSettlementMethodHelper
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
4632575473568055560L
;
/**
* 结算方式,对应MX Group Header->Settlement Information->Settlement Method
*/
private
String
settlementMethod
;
/**
* mt -> mx
* false 表示不转换53域
* true 表示转换53域
*/
private
boolean
translate53Flag
=
false
;
/**
* mt -> mx
* false 表示不转换54域
* true 表示转换54域
*/
private
boolean
translate54Flag
=
false
;
/**
* mt -> mx
* false 表示不转换55域
* true 表示转换55域
*/
private
boolean
translate55Flag
=
false
;
/**
* mt -> mx
* false 表示不转换 Group Header -> Settlement Information -> Settlement Account
* true 表示转换 Group Header -> Settlement Information -> Settlement Account
*/
private
boolean
translateSetlAcctFlag
=
false
;
private
String
instructionForNextAgent
;
public
String
getSettlementMethod
()
{
return
settlementMethod
;
}
public
void
setSettlementMethod
(
String
settlementMethod
)
{
this
.
settlementMethod
=
settlementMethod
;
}
public
boolean
isTranslate53Flag
()
{
return
translate53Flag
;
}
public
void
setTranslate53Flag
(
boolean
translate53Flag
)
{
this
.
translate53Flag
=
translate53Flag
;
}
public
boolean
isTranslate54Flag
()
{
return
translate54Flag
;
}
public
void
setTranslate54Flag
(
boolean
translate54Flag
)
{
this
.
translate54Flag
=
translate54Flag
;
}
public
boolean
isTranslate55Flag
()
{
return
translate55Flag
;
}
public
void
setTranslate55Flag
(
boolean
translate55Flag
)
{
this
.
translate55Flag
=
translate55Flag
;
}
public
String
getInstructionForNextAgent
()
{
return
instructionForNextAgent
;
}
public
void
setInstructionForNextAgent
(
String
instructionForNextAgent
)
{
this
.
instructionForNextAgent
=
instructionForNextAgent
;
}
public
boolean
isTranslateSetlAcctFlag
()
{
return
translateSetlAcctFlag
;
}
public
void
setTranslateSetlAcctFlag
(
boolean
translateSetlAcctFlag
)
{
this
.
translateSetlAcctFlag
=
translateSetlAcctFlag
;
}
}
swiftCore/src/main/java/com/brilliance/swift/vo/common/ClearingSystemMemberCode.java
View file @
904a5834
...
...
@@ -28,6 +28,8 @@ public enum ClearingSystemMemberCode {
CACPA
(
"CC"
),
CNAPS
(
"CN"
),
DEBLZ
(
"BL"
),
GRBIC
(
"GR"
),
...
...
@@ -40,6 +42,8 @@ public enum ClearingSystemMemberCode {
ITNCC
(
"IT"
),
JPZGN
(
"JP"
),
NZNCC
(
"NZ"
),
PLKNR
(
"PL"
),
...
...
@@ -52,6 +56,12 @@ public enum ClearingSystemMemberCode {
ESNCC
(
"ES"
),
CHBCC
(
"SW"
),
CHSIC
(
"SW"
),
TWNCC
(
"TW"
),
GBDSC
(
"SC"
),
USPID
(
"CP"
),
...
...
swiftCore/src/main/java/com/brilliance/swift/vo/common/LocalInstrumentCode.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
swift
.
vo
.
common
;
public
enum
LocalInstrumentCode
{
DDMC
(
"DirectDebitConfirmedElectronicMandate"
),
DDMP
(
"DirectDebitPaperMandateWithPaperAuthorization"
),
DDMU
(
"DirectDebitUnconfirmedElectronicMandate"
),
BPA
(
"BatchPaymentsAruba"
),
IPA
(
"InstantPaymentsAruba"
),
TRF
(
"CreditTransfers"
),
_82
(
"NonPreauthorisedDirectDebitAT"
),
_83
(
"PreauthorisedDirectDebitAT"
),
CPP
(
"CashPerPost"
),
RTR
(
"ReturnedCreditTransfers"
),
GST
(
"TruncatedCreditTransfers"
),
DDT
(
"DirectDebits"
),
RDD
(
"ReturnedDirectDebits"
),
CHN
(
"TruncatedChecks"
),
STR
(
"RevokedCreditTransfers"
),
SDD
(
"RevokedDirectDebits"
),
SRT
(
"RevokedReturnedCreditTransfers"
),
SRD
(
"RevokedReturnedDirectDebits"
),
SCN
(
"RevokedTruncatedChecks"
),
SGT
(
"RevokedTruncatedCreditTransfers"
),
CARD
(
"CardClearing"
),
_05
(
"NonPreauthorisedDirectDebitDE"
),
_04
(
"PreauthorisedDirectDebitDE"
),
ISE
(
"ImageBasedChequeCollection"
),
BSE
(
"PaperlessChequeCollection"
),
_58
(
"BusinessToBusinessDirectDebit"
),
_19
(
"BusinessToCustomerDirectDebit"
),
ASTI
(
"AncillarySystemTransferInitiation"
),
BACP
(
"BackupPayment"
),
MANP
(
"MandatedPayment"
),
SBTI
(
"SettlementBankTransferInitiation"
),
_85
(
"PreauthorisedDirectDebitAccéléréAcceleratedClearing2DayOrdinaireNormalClearing4Day"
),
_08
(
"PreauthorisedDirectDebitOrdinaireNormalClearing4Day"
),
_89
(
"PreauthorisedDirectDebitVérifiéVerifiedClearing"
),
_60
(
"RecoveredBillofExchangeorPromissoryNote"
),
RIBA
(
"NonPreauthorisedDirectDebitRIBA"
),
RIDO
(
"PreauthorisedRevocableDirectDebit"
),
RIDV
(
"PreauthorisedRevocableUrgentDirectDebit"
),
IDEAL
(
"PaymentsViaInternetOwnedByCurrence"
),
INSTNT01
(
"InstantCreditTransferNotTimeCritical"
),
INSTTC01
(
"InstantCreditTransferTimeCritical"
),
INSTIDEAL
(
"PaymentsViaInternetOwnedByCurrenceUsingInstantCreditTransfer"
),
INSTNT01IDEAL
(
"PaymentsViaInternetOwnedByCurrenceUsingInstantCreditTransferNotTimeCritical"
),
INSTTC01IDEAL
(
"PaymentsViaInternetOwnedByCurrenceUsingInstantCreditTransferTimeCritical"
),
NLDO
(
"DutchDomesticBulkPayment"
),
NLUP
(
"DutchUrgentPayment"
),
SDN
(
"PaymentsViaStandaardDigitaleNota"
),
ACCEPT
(
"PaymentViaAcceptgiroOwnedByCurrence"
),
ICMC
(
"IncidentManagementCorrection"
),
NLGOV
(
"DirectDebitInitiatedByTheGovernmentWithSpecialConditions"
),
_0090
(
"MassPaymentBeneficiary"
),
_0091
(
"MassPaymentOurs"
),
_0092
(
"MassPaymentShared"
),
_0002
(
"StandingOrder"
),
_0221
(
"OneOffAuthorisation"
),
_0224
(
"OneOffAuthorisationCharities"
),
_0226
(
"OneOffAuthorisationConstructionIndustry"
),
_0225
(
"OneOffAuthorisationTuitionFees"
),
_0222
(
"StandingAuthorisationCompanies"
),
_0227
(
"StandingAuthorisationCompaniesWithoutDebtorRevocationRight"
),
_0220
(
"StandingAuthorisationGeneral"
),
_0223
(
"StandingAuthorisationLotteries"
),
_0001
(
"ConvertedBankPayment"
),
_0000
(
"BusinessPayment"
),
IN
(
"CrossBorderCustomerCreditTransfer"
),
ONCL
(
"Overnight"
),
PERI
(
"PaymentWithERI"
),
SDCL
(
"SameDayClearedPayments"
),
DDNR
(
"CoreNoRefund"
),
DDFA
(
"DirectDebitFixedAmount"
),
CORE
(
"SEPADirectDebitCore"
),
B2BAMIPM
(
"SEPAB2BDirectDebitAMI"
),
B2B
(
"SEPABusinessToBusinessDirectDebit"
),
CR1AMIPM
(
"SEPACoreD1DirectDebitAMI"
),
CORAMIPM
(
"SEPACoreDirectDebitAMI"
),
COR1
(
"SEPADirectDebit1DaySettlement"
),
FADAMIPM
(
"SEPAFADirectDebitAMI"
),
CLSCCPERX
(
"CLSClearedFXForEurex"
),
CLSCCPLCH
(
"CLSClearedFXForLCH"
),
INST
(
"InstantCreditTransfer"
),
ADD
(
"AuthenticatedDirectDebit"
),
UDD
(
"UnauthenticatedDirectDebit"
),
CCI
(
"CashConcentrationIntragroup"
),
BTR
(
"BankTransfer"
),
CKS
(
"CheckSameDaySettlementWire"
),
CTR
(
"CustomerTransfer"
),
CTP
(
"CustomerTransferPlus"
),
DEP
(
"DepositToSendersAccount"
),
FFR
(
"FedFundsReturned"
),
FFS
(
"FedFundsSold"
),
SVC
(
"NonValueServiceMessage"
),
DRW
(
"DrawdownResponseValueToHonorADrawdownRequest"
),
DRB
(
"BankToBankDrawdownRequestOrResponseNonvalue"
),
DRC
(
"CustomerOrCorporateDrawdownRequestOrResponseNonvalue"
),
IAT
(
"InternationalACH"
),
CCD
(
"CashConcentrationOrDisbursementCorporateCounterparty"
),
CTX
(
"CorporateTradeExchange"
),
PPD
(
"PrearrangedPaymentOrDepositConsumerCounterparty"
),
CIE
(
"CustomerInitiatedEntry"
),
RCK
(
"RepresentedCheckEntry"
),
ARC
(
"AccountsReceivableCheck"
),
WEB
(
"InternetInitiatedEntry"
),
POP
(
"PointOfPurchase"
),
POS
(
"PointOfSale"
),
TEL
(
"TelephoneInitiatedEntry"
),
ITP
(
"InstantCreditTransferPreferred"
);
//CTP("CreditTransferPreferred");
LocalInstrumentCode
(
String
s
)
{}
public
String
value
()
{
return
name
();
}
}
swiftCore/src/main/resources/swiftTxt/MT103.txt
View file @
904a5834
{1:F01FOOBARC0AXXX4402221388}{2:O1031010200908BANKANC0AXXX50363658012204281624U}{3:{1
08:220428162427085
1}{121:8a562c67-ca16-48ba-b074-65581be6f001}}{4:
{1:F01FOOBARC0AXXX4402221388}{2:O1031010200908BANKANC0AXXX50363658012204281624U}{3:{1
11:00
1}{121:8a562c67-ca16-48ba-b074-65581be6f001}}{4:
:20:TBEXO12345
:13C:/SNDTIME/2124+0
8
00
:13C:/SNDTIME/2124+0
7
00
:13C:/RNCTIME/2330+0800
:13C:/CLSTIME/2221+0800
:13C:/CLSTIME/2221+0600
:13C:/TILTIME/2321+0800
:13C:/FROTIME/2021+0900
:13C:/REJTIME/2121+0800
:23B:CRED
:23E:HOLD/81939316763
:23E:SDVA
:23E:CASH
:23E:TELB/789556
:23E:INTC
:23E:TELB
:23E:PHOB
:23E:CHQB
:26T:GCY
:32A:220313USD23453,13
:33B:EUR1345,12
:36:17,4357135422
:50A:/01111001759234567890
GCYXXXXXX12
:52A:FOOBARC0
:53A:FOOBARC1
:54A:FOOBARC3
:55A:FOOBARC4
:36:17,435713542
:50F:ARNU/BE/12598766233
1/Name
6/BE/FvW/ABC1234567
7/BE/1256ABC12345678976543213854847
8/54689
:52A://AUqwert123456
FOOBARC0
:53B:/C/we1234
bobjack
:56A:FOOBARC6
:57A:BANKANC7
:59:/00013500510020179998
TEST CORP
Nellis ABC, NV
:70:gechengyang
:57C:/Q1234433
:59F://CH3234232
1/Vanmusten Ilya
2/Brugmannlaan 415
3/BE/Brussels
:70:/ROC/CUST123456789///INV/123 dated
03/04/2006
:71A:OUR
:71G:USD12,43
:72:/INS/FOOBARC7
/ACC/789556
/REC/chengzhuoshendsdsdsdsddsd
/INTA/BANKERUN
/LOCINS/DDMC
/CATPURP/DVPM
/SVCLVL/PRPT
:77B:/ORDERRES/BE//MEILAAN 1, 9000 GENT
//JIANGXIAQU
//WENHUADADAO
...
...
swiftCore/src/main/resources/swiftXml/MxPacs00800109.xml
View file @
904a5834
...
...
@@ -44,13 +44,6 @@ Change Log
</SttlmInf>
</GrpHdr>
<CdtTrfTxInf>
<SttlmTmIndctn>
<DbtDtTm>
2022-03-13T20:24:42.112+07:00
</DbtDtTm>
<CdtDtTm>
2022-03-13T22:30:42.112+07:00
</CdtDtTm>
</SttlmTmIndctn>
<SttlmTmReq>
<CLSTm>
21:21:42.112+07:00
</CLSTm>
</SttlmTmReq>
<PmtId>
<InstrId>
pacs8bizmsgidr01
</InstrId>
<EndToEndId>
pacs008EndToEndId-001
</EndToEndId>
...
...
@@ -93,17 +86,8 @@ Change Log
<StrtNm>
Rue Saint Exupery
</StrtNm>
<TwnNm>
17/13 4460 GRACE-HOLLOGNE
</TwnNm>
<Ctry>
BG
</Ctry>
<AdrLine>
HuBei
</AdrLine>
<AdrLine>
WuHan
</AdrLine>
</PstlAdr>
</Cdtr>
<CdtrAcct>
<Id>
<Othr>
<Id>
123456
</Id>
</Othr>
</Id>
</CdtrAcct>
<RmtInf>
<Ustrd>
SWEEP 454-9663
</Ustrd>
</RmtInf>
...
...
swiftCore/src/test/java/com/brilliance/mt2mx/pacs008001/Test.java
0 → 100644
View file @
904a5834
package
com
.
brilliance
.
mt2mx
.
pacs008001
;
import
com.brilliance.swift.mt2mx.Mt2MxCreatorManager
;
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
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftTxt\\Mt103.txt"
);
String
mtStr
=
FileUtils
.
readFileToString
(
file
);
String
mxXml
=
new
Mt2MxCreatorManager
().
mt2mx
(
mtStr
,
null
,
null
);
System
.
out
.
println
(
mxXml
);
/*AbstractMT abstractMT = AbstractMT.parse(mtStr);
MT103 mt103 = (MT103)abstractMT;
Field53A field53A = mt103.getField53A();
System.out.println(field53A.getComponent(1) + field53A.getComponent2());
System.out.println(field53A.getBIC());*/
}
}
swiftCore/src/test/java/com/brilliance/mx2mtmap/mt103/Test.java
View file @
904a5834
package
com
.
brilliance
.
mx2mtmap
.
mt103
;
import
com.brilliance.swift.SwiftTransfer
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.prowidesoftware.swift.model.mx.AbstractMX
;
import
org.apache.commons.io.FileUtils
;
import
java.io.File
;
...
...
@@ -22,8 +24,36 @@ public class Test {
//String gsonStr = SwiftTransfer.mx2Gson(xmlStr);
//System.out.println(gson);
Map
<
String
,
String
>
maps
=
SwiftTransfer
.
mx2Map
(
xmlStr
);
maps
.
forEach
((
k
,
v
)
->
System
.
out
.
println
(
k
+
"="
+
v
));
//Map<String, String> maps = SwiftTransfer.mx2Map(xmlStr);
//maps.forEach((k, v) -> System.out.println(k + "=" + v));
//String json = SwiftTransfer.mx2Gson(xmlStr);
//System.out.println(json);
AbstractMX
abstractMX
=
AbstractMX
.
parse
(
xmlStr
);
String
gsonStr
=
abstractMX
.
toJson
();
System
.
out
.
println
(
gsonStr
);
AbstractMX
abstractMX1
=
AbstractMX
.
fromJson
(
gsonStr
);
System
.
out
.
println
(
abstractMX1
.
message
());
Map
<
String
,
Object
>
mxGsonMaps
=
JSON
.
parseObject
(
gsonStr
);
//String swiftGsonStr = new JSONObject(mxGsonMaps).toJSONString();
//AbstractMX abstractMX1 = AbstractMX.fromJson(swiftGsonStr);
// System.out.println(abstractMX1.toString());
Map
<
String
,
Object
>
maps
=
(
Map
<
String
,
Object
>)
mxGsonMaps
.
get
(
"fiToFICstmrCdtTrf"
);
JSONArray
jsonArrays
=
(
JSONArray
)
maps
.
get
(
"cdtTrfTxInf"
);
int
size
=
jsonArrays
.
size
();
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
Map
<
String
,
Object
>
tmpMaps
=
(
Map
<
String
,
Object
>)
jsonArrays
.
get
(
i
);
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
tmpMaps
.
get
(
"cdtr"
);
maps1
=
(
Map
<
String
,
Object
>)
maps1
.
get
(
"pstlAdr"
);
JSONArray
objs
=
(
JSONArray
)
maps1
.
get
(
"adrLine"
);
int
objSize
=
objs
.
size
();
for
(
int
j
=
0
;
j
<
objSize
;
j
++)
{
System
.
out
.
println
(
objs
.
get
(
j
).
getClass
());
}
}
//System.out.println(mxGsonMaps);
}
}
swiftMx/src/main/java/com/prowidesoftware/swift/model/mx/AbstractMX.java
View file @
904a5834
...
...
@@ -188,6 +188,7 @@ public abstract class AbstractMX extends AbstractMessage implements JsonSerializ
final
Gson
gson
=
new
GsonBuilder
()
.
registerTypeAdapter
(
AbstractMX
.
class
,
new
AbstractMXAdapter
())
.
registerTypeAdapter
(
XMLGregorianCalendar
.
class
,
new
XMLGregorianCalendarAdapter
())
.
registerTypeAdapter
(
AppHdr
.
class
,
new
AppHdrAdapter
())
.
create
();
return
gson
.
fromJson
(
json
,
classOfT
);
}
...
...
@@ -203,6 +204,7 @@ public abstract class AbstractMX extends AbstractMessage implements JsonSerializ
final
Gson
gson
=
new
GsonBuilder
()
.
registerTypeAdapter
(
AbstractMX
.
class
,
new
AbstractMXAdapter
())
.
registerTypeAdapter
(
XMLGregorianCalendar
.
class
,
new
XMLGregorianCalendarAdapter
())
.
registerTypeAdapter
(
AppHdr
.
class
,
new
AppHdrAdapter
())
.
create
();
return
gson
.
fromJson
(
json
,
AbstractMX
.
class
);
}
...
...
swiftMx/src/main/java/com/prowidesoftware/swift/model/mx/AppHdrAdapter.java
0 → 100644
View file @
904a5834
/*
* Copyright 2006-2021 Prowide
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
prowidesoftware
.
swift
.
model
.
mx
;
import
com.google.gson.*
;
import
java.lang.reflect.Type
;
/**
* {@link AbstractMX} JSON serialization and deserialization implementation based on Gson.
* <p>
* The implementation relieas on the default object serialization that will fill the JSON structure
* with all content from the subclasses model (MX model in Integrator). On top of the default subclass
* data, this serializer will add the namespace and identifier (needed to clearly identify the message
* type in the generic deserialization)
*
* @since 7.10.3
*/
class
AppHdrAdapter
implements
JsonSerializer
<
AppHdr
>,
JsonDeserializer
<
AppHdr
>
{
private
static
final
String
IDENTIFIER
=
"identifier"
;
@Override
public
JsonElement
serialize
(
final
AppHdr
appHdr
,
Type
type
,
final
JsonSerializationContext
context
)
{
JsonObject
object
=
context
.
serialize
(
appHdr
).
getAsJsonObject
();
return
object
;
}
@Override
public
AppHdr
deserialize
(
JsonElement
json
,
Type
typeOfT
,
JsonDeserializationContext
context
)
throws
JsonParseException
{
Class
<?>
klass
=
null
;
try
{
String
className
=
"com.prowidesoftware.swift.model.mx.BusinessAppHdrV02"
;
klass
=
Class
.
forName
(
className
);
}
catch
(
ClassNotFoundException
e
)
{
throw
new
JsonParseException
(
"Cannot find AppHdr implementation for "
+
e
.
getMessage
());
}
return
context
.
deserialize
(
json
,
klass
);
}
}
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