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
7d7472e9
Commit
7d7472e9
authored
May 27, 2022
by
chengzhuoshen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据官方mapping文档完成pacs009001转MT202。
parent
c5460253
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
1083 additions
and
176 deletions
+1083
-176
AbstractMx2MtTagsGenerate.java
...com/brilliance/swift/mx2mt/AbstractMx2MtTagsGenerate.java
+258
-2
Mx2MtCreatorManager.java
.../java/com/brilliance/swift/mx2mt/Mx2MtCreatorManager.java
+2
-1
Field72Generate.java
...om/brilliance/swift/mx2mt/mt103/impl/Field72Generate.java
+9
-2
Mx2Mt202Creator.java
...m/brilliance/swift/mx2mt/mt202cov202/Mx2Mt202Creator.java
+8
-9
Field13CGenerate.java
...liance/swift/mx2mt/mt202cov202/impl/Field13CGenerate.java
+1
-1
Field20Generate.java
...lliance/swift/mx2mt/mt202cov202/impl/Field20Generate.java
+1
-1
Field21Generate.java
...lliance/swift/mx2mt/mt202cov202/impl/Field21Generate.java
+25
-2
Field32AGenerate.java
...liance/swift/mx2mt/mt202cov202/impl/Field32AGenerate.java
+2
-4
Field52AGenerate.java
...liance/swift/mx2mt/mt202cov202/impl/Field52AGenerate.java
+55
-8
Field53AGenerate.java
...liance/swift/mx2mt/mt202cov202/impl/Field53AGenerate.java
+1
-1
Field54AGenerate.java
...liance/swift/mx2mt/mt202cov202/impl/Field54AGenerate.java
+1
-1
Field56AGenerate.java
...liance/swift/mx2mt/mt202cov202/impl/Field56AGenerate.java
+1
-1
Field57AGenerate.java
...liance/swift/mx2mt/mt202cov202/impl/Field57AGenerate.java
+1
-1
Field58AGenerate.java
...liance/swift/mx2mt/mt202cov202/impl/Field58AGenerate.java
+59
-1
Field72Generate.java
...lliance/swift/mx2mt/mt202cov202/impl/Field72Generate.java
+145
-0
Field33BGenerate.java
...ce/swift/mx2mt/mt202cov202/impl/cov/Field33BGenerate.java
+28
-0
Field50AGenerate.java
...ce/swift/mx2mt/mt202cov202/impl/cov/Field50AGenerate.java
+53
-3
Field52AGenerate.java
...ce/swift/mx2mt/mt202cov202/impl/cov/Field52AGenerate.java
+66
-0
Field56AGenerate.java
...ce/swift/mx2mt/mt202cov202/impl/cov/Field56AGenerate.java
+67
-0
Field57AGenerate.java
...ce/swift/mx2mt/mt202cov202/impl/cov/Field57AGenerate.java
+68
-0
Field59AGenerate.java
...ce/swift/mx2mt/mt202cov202/impl/cov/Field59AGenerate.java
+79
-0
Field70Generate.java
...nce/swift/mx2mt/mt202cov202/impl/cov/Field70Generate.java
+61
-0
Field72Generate.java
...nce/swift/mx2mt/mt202cov202/impl/cov/Field72Generate.java
+62
-0
FieldB33BGenerate.java
...e/swift/mx2mt/mt202cov202/impl/cov/FieldB33BGenerate.java
+0
-14
FieldB52AGenerate.java
...e/swift/mx2mt/mt202cov202/impl/cov/FieldB52AGenerate.java
+0
-13
FieldB56Generate.java
...ce/swift/mx2mt/mt202cov202/impl/cov/FieldB56Generate.java
+0
-14
FieldB57Generate.java
...ce/swift/mx2mt/mt202cov202/impl/cov/FieldB57Generate.java
+0
-15
FieldB59Generate.java
...ce/swift/mx2mt/mt202cov202/impl/cov/FieldB59Generate.java
+0
-16
FieldB70Generate.java
...ce/swift/mx2mt/mt202cov202/impl/cov/FieldB70Generate.java
+0
-12
FieldB72Generate.java
...ce/swift/mx2mt/mt202cov202/impl/cov/FieldB72Generate.java
+0
-12
MxPacs00900109.xml
swiftCore/src/main/resources/swiftXml/MxPacs00900109.xml
+5
-10
MxPacs00900109_COV.xml
swiftCore/src/main/resources/swiftXml/MxPacs00900109_COV.xml
+5
-10
TestMx2MtFor202.java
...test/java/com/brilliance/mx2mt/mt202/TestMx2MtFor202.java
+5
-4
TestMx2MtFor202COV.java
...t/java/com/brilliance/mx2mt/mt202/TestMx2MtFor202COV.java
+6
-5
Test.java
...ore/src/test/java/com/brilliance/mx2mtmap/mt103/Test.java
+9
-13
No files found.
swiftCore/src/main/java/com/brilliance/swift/mx2mt/AbstractMx2MtTagsGenerate.java
View file @
7d7472e9
...
...
@@ -1044,8 +1044,264 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate {
return
mtAgent
;
}
protected
String
SubfunctionInstructionForNextAgent
(
String
agentPath
)
{
return
null
;
/**
* subfunctionInstructionForNextAgent取值逻辑:
* 1.将所有存在的InstrInf值加起来,注意如果InstrInf不以/[A-Z0-9]{1,8}/开始并且上一条InstrInf长度小于35,那么中间需要加/TempREC/
* 2.如果结果1中存在/FIN53/BIC,则需要删掉/FIN53/BIC
* 3.将结果2中的/TempREC/xxx,全部拿出来组装在一起(mtNoCode),并删除掉/TempREC/xxx
* 4.如果InstrInf中包含/REC/,需要将mtNoCode放在REC后面;否则在InstrInf后面加/REC/mtNoCode
* @param agentPath
* @return
*/
protected
String
subFunctionInstructionForNextAgent
(
String
agentPath
,
String
settlementMethod
)
{
String
tmpRec
=
"/TempREC/"
;
String
mtInstrInf
=
""
;
int
instrCount
=
XmlUtil
.
getChildrenCount
(
document
,
agentPath
,
null
);
if
(
instrCount
>
0
)
{
String
mxInstrInf
=
""
;
for
(
int
i
=
0
;
i
<
instrCount
;
i
++)
{
String
instrInf
=
XmlUtil
.
getXmlNodeValue
(
document
,
agentPath
+
"("
+
i
+
").InstrInf"
);
if
(
StringUtil
.
isNotEmpty
(
instrInf
))
{
if
(
i
==
0
)
{
mxInstrInf
+=
instrInf
;
}
else
{
String
lastInstrInf
=
XmlUtil
.
getXmlNodeValue
(
document
,
agentPath
+
"("
+(
i
-
1
)+
").InstrInf"
);
if
(
StringUtil
.
isNotEmpty
(
lastInstrInf
)
&&
lastInstrInf
.
length
()
<
35
&&
!
instrInf
.
matches
(
"/[A-Z0-9]{1,8}/.*"
))
{
mxInstrInf
+=
tmpRec
+
instrInf
;
}
else
{
mxInstrInf
+=
instrInf
;
}
}
}
}
boolean
bicCodeFlag
=
false
;
String
bicCode
=
""
;
//找53的bicCode
String
regex
=
".*/FIN53/(.*)/[A-Z0-9]{1,8}/.*"
;
Pattern
p
=
Pattern
.
compile
(
regex
);
Matcher
m
=
p
.
matcher
(
mxInstrInf
);
if
(
m
.
find
())
{
/**
* group(0)就是指的整个串,group(1)指的是第一个括号里的东西,group(2)指的第二个括号里的东西
*/
bicCode
=
m
.
group
(
1
);
}
if
(
SwiftTransferUtil
.
isBIC
(
bicCode
)
&&
(
SettlementMethodCode
.
INGA
.
value
().
equals
(
settlementMethod
)
||
SettlementMethodCode
.
INDA
.
value
().
equals
(
settlementMethod
)))
{
String
acccount
=
mx_to_mtAccount
(
grpHdrParentElementName
+
".GrpHdr.SttlmInf.SttlmAcct"
);
if
(
StringUtil
.
isEmpty
(
acccount
))
{
String
senderBic
=
(
String
)
context
.
get
(
Mx2MtContextIdentifier
.
MX_SENDER_BIC
,
true
);
String
receiverBic
=
(
String
)
context
.
get
(
Mx2MtContextIdentifier
.
MX_RECEIVER_BIC
,
true
);
if
((
StringUtil
.
isNotEmpty
(
senderBic
)
&&
senderBic
.
substring
(
0
,
6
).
equals
(
bicCode
.
substring
(
0
,
6
)))
||
(
StringUtil
.
isNotEmpty
(
receiverBic
)
&&
receiverBic
.
substring
(
0
,
6
).
equals
(
bicCode
.
substring
(
0
,
6
))))
{
bicCodeFlag
=
true
;
}
}
else
{
bicCodeFlag
=
true
;
}
}
if
(
bicCodeFlag
)
{
//表示能够找到fin53的bicCode,然后删掉
mxInstrInf
=
mxInstrInf
.
replace
(
"/FIN53/"
+
bicCode
,
""
);
}
if
(!
mxInstrInf
.
matches
(
"/[A-Z0-9]{1,8}/.*"
))
{
mxInstrInf
=
tmpRec
+
mxInstrInf
;
}
String
totalNoCodeInstrInf
=
""
;
String
[]
tmpRecs
=
mxInstrInf
.
split
(
tmpRec
);
for
(
int
i
=
0
;
i
<
tmpRecs
.
length
;
i
++)
{
String
str
=
tmpRecs
[
i
];
if
(
StringUtil
.
isEmpty
(
str
))
continue
;
p
=
Pattern
.
compile
(
"(.*)/[A-Z0-9]{1,8}/.*"
);
m
=
p
.
matcher
(
str
);
String
noCodeInstrInf
=
""
;
if
(
m
.
find
())
{
/**
* group(0)就是指的整个串,group(1)指的是第一个括号里的东西,group(2)指的第二个括号里的东西
*/
noCodeInstrInf
=
m
.
group
(
1
);
}
else
{
noCodeInstrInf
=
str
;
}
totalNoCodeInstrInf
+=
noCodeInstrInf
;
mxInstrInf
=
mxInstrInf
.
replace
(
tmpRec
+
noCodeInstrInf
,
""
);
}
if
(
StringUtil
.
isNotEmpty
(
totalNoCodeInstrInf
))
{
//找到是否包含/REC/
if
(
mxInstrInf
.
indexOf
(
"/REC/"
)
>
-
1
)
{
p
=
Pattern
.
compile
(
".*/REC/(.*)/[A-Z0-9]{1,8}/.*"
);
m
=
p
.
matcher
(
mxInstrInf
);
if
(
m
.
find
())
{
/**
* group(0)就是指的整个串,group(1)指的是第一个括号里的东西,group(2)指的第二个括号里的东西
*/
String
recInstrInf
=
m
.
group
(
1
);
String
newRecInstrInf
=
recInstrInf
+
totalNoCodeInstrInf
;
mtInstrInf
=
mxInstrInf
.
replace
(
"/REC/"
+
recInstrInf
,
"/REC/"
+
newRecInstrInf
);
}
}
else
{
mtInstrInf
=
mxInstrInf
+
"/REC/"
+
totalNoCodeInstrInf
;
}
}
else
{
mtInstrInf
=
mxInstrInf
;
}
}
return
mtInstrInf
;
}
/**
* 提取PHOB,TELB,UDLC和无CODE的instrInfo
* @param agentPath
* @return
*/
protected
String
subFunctionInstructionForCreditorAgent
(
String
agentPath
)
{
int
creditorAgentCount
=
XmlUtil
.
getChildrenCount
(
document
,
agentPath
,
null
);
String
mtInstrInf
=
""
;
if
(
creditorAgentCount
>
0
)
{
//UDLC PHOB TELB
String
accInstrInf
=
"/ACC/"
;
String
phobInstrInf
=
"/PHONBEN/"
;
String
telbInstrInf
=
"/TELEBEN/"
;
for
(
int
i
=
0
;
i
<
creditorAgentCount
;
i
++)
{
if
(
i
==
2
)
break
;
String
code
=
XmlUtil
.
getXmlNodeValue
(
document
,
agentPath
+
"("
+
i
+
").Cd"
);
String
instrInf
=
XmlUtil
.
getXmlNodeValue
(
document
,
agentPath
+
"("
+
i
+
").InstrInf"
);
if
(
StringUtil
.
isEmpty
(
code
))
{
accInstrInf
+=
instrInf
;
}
if
(
ExternalCreditorAgentInstructionCode
.
PHOB
.
value
().
equals
(
code
))
{
phobInstrInf
+=
instrInf
;
}
if
(
ExternalCreditorAgentInstructionCode
.
TELB
.
value
().
equals
(
code
))
{
telbInstrInf
+=
instrInf
;
}
}
String
mxInstrInf
=
""
;
if
(
accInstrInf
.
length
()
>
5
)
{
//accInstrInf = /ACC/xxx
mxInstrInf
+=
accInstrInf
;
}
if
(
phobInstrInf
.
length
()
>
9
)
{
//phobInstrInf = /PHONBEN/xxx
mxInstrInf
+=
phobInstrInf
;
}
if
(
telbInstrInf
.
length
()
>
9
)
{
//telbInstrInf = /TELEBEN/xxx
mxInstrInf
+=
telbInstrInf
;
}
String
regex
=
".*/UDLC/(.*)/[A-Z0-9]{1,8}/.*"
;
Pattern
p
=
Pattern
.
compile
(
regex
);
Matcher
m
=
p
.
matcher
(
mxInstrInf
);
if
(
m
.
find
())
{
mtInstrInf
+=
"/UDLC/"
+
m
.
group
(
1
);
}
regex
=
".*/ACC/(.*)/[A-Z0-9]{1,8}/.*"
;
p
=
Pattern
.
compile
(
regex
);
m
=
p
.
matcher
(
mxInstrInf
);
if
(
m
.
find
())
{
mtInstrInf
+=
"/ACC/"
+
m
.
group
(
1
);
}
regex
=
".*/PHONBEN/(.*)/[A-Z0-9]{1,8}/.*"
;
p
=
Pattern
.
compile
(
regex
);
m
=
p
.
matcher
(
mxInstrInf
);
if
(
m
.
find
())
{
mtInstrInf
+=
"/PHONBEN/"
+
m
.
group
(
1
);
}
regex
=
".*/TELEBEN/(.*)/[A-Z0-9]{1,8}/.*"
;
p
=
Pattern
.
compile
(
regex
);
m
=
p
.
matcher
(
mxInstrInf
);
if
(
m
.
find
())
{
mtInstrInf
+=
"/TELEBEN/"
+
m
.
group
(
1
);
}
}
return
mtInstrInf
;
}
/**
* pacs008001转MT103 70域的第5个参数使用
* 提取CHQB 和无CODE的instrInfo
* @param agentPath
* @return
*/
protected
String
subFunctionInstructionForCreditorAgentAndJP
(
String
agentPath
)
{
int
creditorAgentCount
=
XmlUtil
.
getChildrenCount
(
document
,
agentPath
,
null
);
String
mtInstrInf
=
""
;
if
(
creditorAgentCount
>
0
)
{
//CHQB
String
accInstrInf
=
"/ACC/"
;
String
chqbInstrInf
=
"/CHQB/"
;
for
(
int
i
=
0
;
i
<
creditorAgentCount
;
i
++)
{
if
(
i
==
2
)
break
;
String
code
=
XmlUtil
.
getXmlNodeValue
(
document
,
agentPath
+
"("
+
i
+
").Cd"
);
String
instrInf
=
XmlUtil
.
getXmlNodeValue
(
document
,
agentPath
+
"("
+
i
+
").InstrInf"
);
if
(
StringUtil
.
isEmpty
(
code
))
{
accInstrInf
+=
instrInf
;
}
if
(
ExternalCreditorAgentInstructionCode
.
CHQB
.
value
().
equals
(
code
))
{
chqbInstrInf
+=
instrInf
;
}
}
String
mxInstrInf
=
""
;
if
(
accInstrInf
.
length
()
>
5
)
{
//accInstrInf = /ACC/xxx
mxInstrInf
+=
accInstrInf
;
}
if
(
chqbInstrInf
.
length
()
>
6
)
{
//chqbInstrInf = /CHQB/xxx
mxInstrInf
+=
chqbInstrInf
;
}
String
regex
=
".*/ACC/(.*)/[A-Z0-9]{1,8}/.*"
;
Pattern
p
=
Pattern
.
compile
(
regex
);
Matcher
m
=
p
.
matcher
(
mxInstrInf
);
if
(
m
.
find
())
{
mtInstrInf
+=
"/ACC/"
+
m
.
group
(
1
);
}
regex
=
".*/CHQB/(.*)/[A-Z0-9]{1,8}/.*"
;
p
=
Pattern
.
compile
(
regex
);
m
=
p
.
matcher
(
mxInstrInf
);
if
(
m
.
find
())
{
mtInstrInf
+=
"/CHQB/"
+
m
.
group
(
1
);
}
}
return
mtInstrInf
;
}
/**
* 取值逻辑:
* 1.mxRemitInfo = CdtTrfTxInf.RmtInf.Ustrd(0),取第一条记录
* 2.提取/BNF/xxxx,作为bnfInfo,并在mxRemitInfo删除掉对应的内容
* 3.提取/TSU/xxxx,作为tsuInfo,并在mxRemitInfo删除掉对应的内容
* 4.如果bnfInfo存在,那么直接在后面加上mxRemitInfo剩余的内容;否则bnfInfo = /BNF/ + mxRemitInfo剩余的内容
* 5.MT72 = bnfInfo + tsuInfo
* @param remittanceInfoPath
* @return
*/
protected
String
subFunctionRemittanceInformation
(
String
remittanceInfoPath
)
{
String
mtRemittanceInfo
=
""
;
int
remitInfoUstrdCount
=
XmlUtil
.
getChildrenCount
(
document
,
remittanceInfoPath
+
".Ustrd"
,
null
);
if
(
remitInfoUstrdCount
>
0
)
{
String
mxRemittanceInfo
=
XmlUtil
.
getXmlNodeValue
(
document
,
remittanceInfoPath
+
".Ustrd(0)"
);
String
bnfInfo
=
""
;
String
regex
=
".*/BNF/(.*)/TSU/.*"
;
Pattern
p
=
Pattern
.
compile
(
regex
);
Matcher
m
=
p
.
matcher
(
mxRemittanceInfo
);
if
(
m
.
find
())
{
bnfInfo
+=
"/BNF/"
+
m
.
group
(
1
);
mxRemittanceInfo
.
replace
(
bnfInfo
,
""
);
}
String
tsuInfo
=
""
;
regex
=
".*/TSU/(.*)/BNF/.*"
;
p
=
Pattern
.
compile
(
regex
);
m
=
p
.
matcher
(
mxRemittanceInfo
);
if
(
m
.
find
())
{
tsuInfo
+=
"/TSU/"
+
m
.
group
(
1
);
mxRemittanceInfo
.
replace
(
tsuInfo
,
""
);
}
if
(
StringUtil
.
isNotEmpty
(
bnfInfo
))
{
bnfInfo
+=
mxRemittanceInfo
;
}
else
{
bnfInfo
+=
"/BNF/"
+
mxRemittanceInfo
;
}
mtRemittanceInfo
=
bnfInfo
+
tsuInfo
;
}
return
mtRemittanceInfo
;
}
//转换函数方法区结束
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/Mx2MtCreatorManager.java
View file @
7d7472e9
...
...
@@ -3,6 +3,7 @@ package com.brilliance.swift.mx2mt;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.mt103.Mx2Mt103Creator
;
import
com.brilliance.swift.mx2mt.mt202cov202.Mx2Mt202Creator
;
import
com.brilliance.swift.mx2mt.mt900910.Mx2Mt900910Creator
;
import
com.brilliance.swift.mx2mt.mt940950.Mx2Mt940950Creator
;
import
com.brilliance.swift.util.StringUtil
;
...
...
@@ -64,7 +65,7 @@ public class Mx2MtCreatorManager {
if
(
"pacs.008.001"
.
equals
(
messageType
))
{
return
new
Mx2Mt103Creator
();
}
else
if
(
"pacs.009.001"
.
equals
(
messageType
))
{
return
new
Mx2Mt
103
Creator
();
return
new
Mx2Mt
202
Creator
();
}
else
if
(
"camt.054.001"
.
equals
(
messageType
)){
return
new
Mx2Mt900910Creator
();
}
else
if
(
"camt.053.001"
.
equals
(
messageType
)){
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt103/impl/Field72Generate.java
View file @
7d7472e9
...
...
@@ -90,8 +90,15 @@ public class Field72Generate extends AbstractMx2MtTagsGenerate {
&&
!
CategoryPurposeCode
.
CORT
.
value
().
equalsIgnoreCase
(
ctgyPurpCode
))
{
mt72FullField
+=
"/CATPURP/"
+
ctgyPurpCode
;
}
//TODO 参数5
//TODO 参数6
String
mtCreditorAgt
=
subFunctionInstructionForCreditorAgentAndJP
(
bodyHdrParentElementName
+
".CdtTrfTxInf.InstrForCdtrAgt"
);
if
(
StringUtil
.
isNotEmpty
(
mtCreditorAgt
))
{
mt72FullField
+=
mtCreditorAgt
;
}
String
settlementMethod
=
getXmlNodeValue
(
grpHdrParentElementName
,
document
,
"GrpHdr.SttlmInf.SttlmMtd"
);
String
mtNextAgt
=
subFunctionInstructionForNextAgent
(
bodyHdrParentElementName
+
".CdtTrfTxInf.InstrForNxtAgt"
,
settlementMethod
);
if
(
StringUtil
.
isNotEmpty
(
mtNextAgt
))
{
mt72FullField
+=
mtNextAgt
;
}
String
mtPrvsInstgAgt
=
mx_to_mtBICNameAgent
(
bodyHdrParentElementName
+
".CdtTrfTxInf.PrvsInstgAgt1"
,
210
);
if
(
StringUtil
.
isEmpty
(
mtPrvsInstgAgt
))
{
mtPrvsInstgAgt
=
mx_to_mtBICNameAgent
(
bodyHdrParentElementName
+
".CdtTrfTxInf.PrvsInstgAgt2"
,
210
);
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/Mx2Mt202Creator.java
View file @
7d7472e9
...
...
@@ -6,7 +6,6 @@ import com.brilliance.swift.mx2mt.AbstractMx2MtCreator;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
import
com.brilliance.swift.mx2mt.Mx2MtTagsGenerate
;
import
com.brilliance.swift.mx2mt.mt202cov202.impl.*
;
import
com.brilliance.swift.mx2mt.mt202cov202.impl.cov.*
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.XmlUtil
;
import
com.brilliance.swift.vo.common.ServiceLevelCode
;
...
...
@@ -74,14 +73,14 @@ public class Mx2Mt202Creator extends AbstractMx2MtCreator {
fieldsGenerateList
.
add
(
new
Field57AGenerate
());
fieldsGenerateList
.
add
(
new
Field58AGenerate
());
fieldsGenerateList
.
add
(
new
Field72Generate
());
fieldsGenerateList
.
add
(
new
Field50AGenerate
());
fieldsGenerateList
.
add
(
new
FieldB
52AGenerate
());
fieldsGenerateList
.
add
(
new
FieldB56
Generate
());
fieldsGenerateList
.
add
(
new
FieldB57
Generate
());
fieldsGenerateList
.
add
(
new
FieldB59
Generate
());
fieldsGenerateList
.
add
(
new
FieldB
70Generate
());
fieldsGenerateList
.
add
(
new
FieldB
72Generate
());
fieldsGenerateList
.
add
(
new
FieldB
33BGenerate
());
fieldsGenerateList
.
add
(
new
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
.
Field50AGenerate
());
fieldsGenerateList
.
add
(
new
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
.
Field
52AGenerate
());
fieldsGenerateList
.
add
(
new
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
.
Field56A
Generate
());
fieldsGenerateList
.
add
(
new
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
.
Field57A
Generate
());
fieldsGenerateList
.
add
(
new
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
.
Field59A
Generate
());
fieldsGenerateList
.
add
(
new
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
.
Field
70Generate
());
fieldsGenerateList
.
add
(
new
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
.
Field
72Generate
());
fieldsGenerateList
.
add
(
new
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
.
Field
33BGenerate
());
return
fieldsGenerateList
;
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/Field13CGenerate.java
View file @
7d7472e9
...
...
@@ -10,7 +10,7 @@ public class Field13CGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
new
com
.
brilliance
.
swift
.
mx2mt
.
mt103
.
impl
.
Field13CGenerate
().
setContext
(
context
).
tagGenerate
();
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/Field20Generate.java
View file @
7d7472e9
...
...
@@ -10,6 +10,6 @@ public class Field20Generate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
new
com
.
brilliance
.
swift
.
mx2mt
.
mt103
.
impl
.
Field20Generate
().
setContext
(
context
).
tagGenerate
();
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/Field21Generate.java
View file @
7d7472e9
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
java.util.List
;
/**
* <CdtTrfTxInf>[1]<PmtId><EndToEndId>
* 取值逻辑:
* field21 = CdtTrfTxInf.PmtId.EndToEndId,如果长度大于16,field21 = field21截取15位 + 最后一位用+代替
* 如果filed21 以/开始或者以/结束或者包含//,field21=NONREF
* 否则保持原值不变
*/
public
class
Field21Generate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name
=
"21"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
endToEndId
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.PmtId.EndToEndId"
);
if
(
StringUtil
.
isNotEmpty
(
endToEndId
))
{
String
value
=
""
;
if
(
endToEndId
.
length
()
>
16
)
{
value
=
endToEndId
.
substring
(
0
,
15
)
+
"+"
;
}
if
(
value
.
startsWith
(
"/"
)
||
value
.
endsWith
(
"/"
)
||
value
.
contains
(
"//"
))
{
value
=
Mx2MtConstants
.
MT_21_DEFAULT_VALUE
;
}
tags
.
add
(
new
Tag
(
name
,
value
));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/Field32AGenerate.java
View file @
7d7472e9
...
...
@@ -4,14 +4,12 @@ import com.brilliance.swift.exception.SwiftException;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
/**
* 直接取<IntrBkSttlmDt>节点作为32A的value date,Amt和Ccy看另一个节点,XXX是货币
* <CdtTrfTxInf>[1]<IntrBkSttlmDt>
* <CdtTrfTxInf>[1]<IntrBkSttlmAmt Ccy="XXX"'>
*
*/
public
class
Field32AGenerate
extends
AbstractMx2MtTagsGenerate
{
@Override
public
void
tagGenerate
()
throws
SwiftException
{
new
com
.
brilliance
.
swift
.
mx2mt
.
mt103
.
impl
.
Field32AGenerate
().
setContext
(
context
).
tagGenerate
();
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/Field52AGenerate.java
View file @
7d7472e9
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
java.util.List
;
/**
* 1,若节点<BICFI>有值,则设置52 option为“A”,同时BIC取此栏位
* 2,若节点<IBAN>有值,则作为52A的账号;
* 3,若节点<Othr><SchmeNm><Cd>有值,则取“//CH”+<Othr><Id>,则作为52A的账号;否则直接取<Othr><Id>,则作为52A的账号
* <CdtTrfTxInf>[1]<Dbtr><FinInstnId><BICFI>
* <CdtTrfTxInf>[1]<DbtrAcct><Id><IBAN>
* <CdtTrfTxInf>[1]<DbtrAcct><Id><Othr><Id>
* <CdtTrfTxInf>[1]<DbtrAcct><Id><Othr><SchmeNm><Cd>
*
*/
public
class
Field52AGenerate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name_A
=
"52A"
;
private
static
String
name_D
=
"52D"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
bicCode
=
mx_to_mtBICFI
(
bodyHdrParentElementName
+
".CdtTrfTxInf.Dbtr"
);
String
account
=
mx_to_mtAccount
(
bodyHdrParentElementName
+
".CdtTrfTxInf.DbtrAcct"
);
String
mtClearSystemId
=
mx_to_mtClearingIdentifier
(
bodyHdrParentElementName
+
".CdtTrfTxInf.Dbtr"
);
String
mtAccount
=
""
;
String
value
=
""
;
if
(
StringUtil
.
isNotEmpty
(
bicCode
))
{
if
(
StringUtil
.
isNotEmpty
(
account
))
{
mtAccount
=
account
;
}
else
{
mtAccount
=
mtClearSystemId
;
}
if
(
StringUtil
.
isNotEmpty
(
mtAccount
))
{
value
=
mtAccount
+
Mx2MtConstants
.
NEW_LINE
+
bicCode
;
}
else
{
value
=
bicCode
;
}
tags
.
add
(
new
Tag
(
name_A
,
value
));
}
else
{
String
name
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.Dbtr.FinInstnId.Nm"
);
String
countryCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.Dbtr.FinInstnId.PstlAdr.Ctry"
);
int
addressLineCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.Dbtr.FinInstnId.PstlAdr.AdrLine"
);
String
mtNameAddress
=
""
;
if
(
addressLineCount
>
0
)
{
mtNameAddress
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
bodyHdrParentElementName
+
".CdtTrfTxInf.Dbtr.FinInstnId"
);
}
else
if
(
StringUtil
.
isNotEmpty
(
countryCode
))
{
mtNameAddress
=
mx_to_mtFinancialInstitutionNameAndStructuredAddress
(
bodyHdrParentElementName
+
".CdtTrfTxInf.Dbtr.FinInstnId"
,
false
);
}
else
if
(
StringUtil
.
isNotEmpty
(
name
))
{
mtNameAddress
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
bodyHdrParentElementName
+
".CdtTrfTxInf.Dbtr.FinInstnId"
);
}
if
(
StringUtil
.
isEmpty
(
mtNameAddress
))
return
;
//如果name和地址不存在,返回。
if
(
StringUtil
.
isNotEmpty
(
mtClearSystemId
))
{
mtAccount
=
mtClearSystemId
;
}
else
{
mtAccount
=
account
;
}
if
(
StringUtil
.
isNotEmpty
(
mtAccount
))
{
value
=
mtAccount
+
Mx2MtConstants
.
NEW_LINE
+
mtNameAddress
;
}
else
{
value
=
mtNameAddress
;
}
tags
.
add
(
new
Tag
(
name_D
,
value
));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/Field53AGenerate.java
View file @
7d7472e9
...
...
@@ -10,7 +10,7 @@ public class Field53AGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
new
com
.
brilliance
.
swift
.
mx2mt
.
mt103
.
impl
.
Field53AGenerate
().
setContext
(
context
).
tagGenerate
();
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/Field54AGenerate.java
View file @
7d7472e9
...
...
@@ -10,6 +10,6 @@ public class Field54AGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
new
com
.
brilliance
.
swift
.
mx2mt
.
mt103
.
impl
.
Field54AGenerate
().
setContext
(
context
).
tagGenerate
();
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/Field56AGenerate.java
View file @
7d7472e9
...
...
@@ -9,7 +9,7 @@ public class Field56AGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
new
com
.
brilliance
.
swift
.
mx2mt
.
mt103
.
impl
.
Field56AGenerate
().
setContext
(
context
).
tagGenerate
();
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/Field57AGenerate.java
View file @
7d7472e9
...
...
@@ -9,6 +9,6 @@ public class Field57AGenerate extends AbstractMx2MtTagsGenerate {
@Override
public
void
tagGenerate
()
throws
SwiftException
{
new
com
.
brilliance
.
swift
.
mx2mt
.
mt103
.
impl
.
Field57AGenerate
().
setContext
(
context
).
tagGenerate
();
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/Field58AGenerate.java
View file @
7d7472e9
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
java.util.List
;
/**
*/
public
class
Field58AGenerate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name_A
=
"58A"
;
private
static
String
name_D
=
"58D"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
bicCode
=
mx_to_mtBICFI
(
bodyHdrParentElementName
+
".CdtTrfTxInf.Cdtr"
);
String
account
=
mx_to_mtAccount
(
bodyHdrParentElementName
+
".CdtTrfTxInf.CdtrAcct"
);
String
mtClearSystemId
=
mx_to_mtClearingIdentifier
(
bodyHdrParentElementName
+
".CdtTrfTxInf.Cdtr"
);
String
mtClearChannelId
=
mx_to_mtClearingIdentifierAndChannel
(
bodyHdrParentElementName
+
".CdtTrfTxInf.Cdtr"
);
String
mtAccount
=
""
;
String
value
=
""
;
if
(
StringUtil
.
isNotEmpty
(
bicCode
))
{
if
(
StringUtil
.
isNotEmpty
(
account
))
{
mtAccount
=
account
;
}
else
if
(
StringUtil
.
isNotEmpty
(
mtClearChannelId
)){
mtAccount
=
mtClearChannelId
;
}
else
{
mtAccount
=
mtClearSystemId
;
}
if
(
StringUtil
.
isNotEmpty
(
mtAccount
))
{
value
=
mtAccount
+
Mx2MtConstants
.
NEW_LINE
+
bicCode
;
}
else
{
value
=
bicCode
;
}
tags
.
add
(
new
Tag
(
name_A
,
value
));
}
else
{
String
name
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.Cdtr.FinInstnId.Nm"
);
String
countryCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.Cdtr.FinInstnId.PstlAdr.Ctry"
);
int
addressLineCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.Cdtr.FinInstnId.PstlAdr.AdrLine"
);
String
mtNameAddress
=
""
;
if
(
addressLineCount
>
0
)
{
mtNameAddress
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
bodyHdrParentElementName
+
".CdtTrfTxInf.Cdtr.FinInstnId"
);
}
else
if
(
StringUtil
.
isNotEmpty
(
countryCode
))
{
mtNameAddress
=
mx_to_mtFinancialInstitutionNameAndStructuredAddress
(
bodyHdrParentElementName
+
".CdtTrfTxInf.Cdtr.FinInstnId"
,
false
);
}
else
if
(
StringUtil
.
isNotEmpty
(
name
))
{
mtNameAddress
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
bodyHdrParentElementName
+
".CdtTrfTxInf.Cdtr.FinInstnId"
);
}
if
(
StringUtil
.
isEmpty
(
mtNameAddress
))
return
;
//如果name和地址不存在,返回。
if
(
StringUtil
.
isNotEmpty
(
mtClearChannelId
))
{
mtAccount
=
mtClearChannelId
;
}
else
if
(
StringUtil
.
isNotEmpty
(
mtClearSystemId
))
{
mtAccount
=
mtClearSystemId
;
}
else
{
mtAccount
=
account
;
}
if
(
StringUtil
.
isNotEmpty
(
mtAccount
))
{
value
=
mtAccount
+
Mx2MtConstants
.
NEW_LINE
+
mtNameAddress
;
}
else
{
value
=
mtNameAddress
;
}
tags
.
add
(
new
Tag
(
name_D
,
value
));
}
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/Field72Generate.java
View file @
7d7472e9
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.common.CategoryPurposeCode
;
import
com.brilliance.swift.vo.common.ServiceLevelCode
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
java.util.List
;
/**
* MX_To_MT72FullField2
* 参数列表
* 参数1:CdtTrfTxInf.IntrmyAgt2/CdtTrfTxInf.IntrmyAgt3
* 参数2:CdtTrfTxInf.PmtTpInf.SvcLvl
* 参数3:CdtTrfTxInf.PmtTpInf.LclInstrm
* 参数4:CdtTrfTxInf.PmtTpInf.CtgyPurp
* 参数5:CdtTrfTxInf.InstrForCdtrAgt
* 参数6:CdtTrfTxInf.Purp
* 参数7:CdtTrfTxInf.InstrForNxtAgt
* 参数8:CdtTrfTxInf.DbtrAgt
* 参数9:CdtTrfTxInf.PrvsInstgAgt1/CdtTrfTxInf.PrvsInstgAgt2/CdtTrfTxInf.PrvsInstgAgt3
* 参数10:CdtTrfTxInf.RmtInf
* MT72取值逻辑:
* 1.如果传入参数1,MT72=/INTA/MX_To_MTAgent(参数1)
* 2.如果传入参数2,并且CdtTrfTxInf.PmtTpInf.SvcLvl.Cd 不是SDVA也不是G00n(n代表0-9数字)或者CdtTrfTxInf.PmtTpInf.SvcLvl.Prtry有值,MT72=/SVCLVL/+CdtTrfTxInf.PmtTpInf.SvcLvl.Prtry或者/SVCLVL/+CdtTrfTxInf.PmtTpInf.SvcLvl.Cd,最多找前3条
* 3.如果传入参数3,并且CdtTrfTxInf.PmtTpInf.LclInstrm.Cd有值或者CdtTrfTxInf.PmtTpInf.LclInstrm.Prtry且不在{CRED,CRTS,SPAY,SPRI, SSTD}里面,MT72=/LOCINS/+CdtTrfTxInf.PmtTpInf.LclInstrm.Prtry或者CdtTrfTxInf.PmtTpInf.LclInstrm.Cd
* 4.如果传入参数4,并且CdtTrfTxInf.PmtTpInf.CtgyPurp.Cd不在{INTC, CORT}或者CdtTrfTxInf.PmtTpInf.CtgyPurp.Prtry不在{“INTC CORT”,INTC, CORT},MT72=/CATPURP/+CdtTrfTxInf.PmtTpInf.CtgyPurp.Prtry或者/CATPURP/+CdtTrfTxInf.PmtTpInf.CtgyPurp.Cd
* 5.如果传入参数5,CdtTrfTxInf.InstrForCdtrAgt.Cd过滤掉HOLD/PHOB/TELB,MT72=/ACC/+CdtTrfTxInf.InstrForCdtrAgt.InstrInf
* 6.如果传入参数6,MT72=/PURP/+CdtTrfTxInf.Purp.Prtry 或者/PURP/+CdtTrfTxInf.Purp.Cd
* 7.如果传入参数7,CdtTrfTxInf.InstrForNxtAgt.InstrInf过滤掉“/FIN53/BIC” 结构,MT72=/REC/+CdtTrfTxInf.InstrForNxtAgt.InstrInf
* 8.如果传入参数8,MT72= /INS/+MX_To_MTBICNameAgent(CdtTrfTxInf.DbtrAgt, 210)
* 9.如果传入参数9,
* ①如果CdtTrfTxInf.PrvsInstgAgt1存在,MT72=/INS/+MX_To_MTBICNameAgent(CdtTrfTxInf.PrvsInstgAgt1, 210)
* ②如果CdtTrfTxInf.PrvsInstgAgt2存在,MT72=/INS/+MX_To_MTBICNameAgent(CdtTrfTxInf.PrvsInstgAgt2, 210)
* ③如果CdtTrfTxInf.PrvsInstgAgt3存在,MT72=/INS/+MX_To_MTBICNameAgent(CdtTrfTxInf.PrvsInstgAgt3, 210)
* 组装MT72:根据优先级最多取到7条MT72,每条MT72每行取35字符,分行用//连接,最多取6*35
* 10.如果传入参数10,MT72 = SubfunctionRemittanceInformation(参数10)
*/
public
class
Field72Generate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name
=
"72"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
mt72FullField
=
""
;
//参数1
String
mtIntrmyAgt
=
mx_to_mtAgent
(
bodyHdrParentElementName
+
".CdtTrfTxInf.IntrmyAgt2"
,
6
);
if
(
StringUtil
.
isEmpty
(
mtIntrmyAgt
))
{
mtIntrmyAgt
=
mx_to_mtAgent
(
bodyHdrParentElementName
+
".CdtTrfTxInf.IntrmyAgt3"
,
6
);
}
if
(
StringUtil
.
isNotEmpty
(
mtIntrmyAgt
))
{
mt72FullField
+=
"/INTA/"
+
mtIntrmyAgt
;
}
//参数2
int
svcLvlCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.PmtTpInf.SvcLvl"
);
if
(
svcLvlCount
>
0
)
{
for
(
int
i
=
0
;
i
<
svcLvlCount
;
i
++)
{
if
(
i
==
3
)
break
;
String
svcLvlCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.PmtTpInf.SvcLvl("
+
i
+
").Cd"
);
String
svcLvlProprietary
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.PmtTpInf.SvcLvl("
+
i
+
").Prtry"
);
if
(
StringUtil
.
isNotEmpty
(
svcLvlProprietary
))
{
mt72FullField
+=
"/SVCLVL/"
+
svcLvlProprietary
;
}
else
{
if
(!
ServiceLevelCode
.
SDVA
.
value
().
equals
(
svcLvlCode
)
&&
svcLvlCode
.
indexOf
(
"G00"
)
==
-
1
)
{
mt72FullField
+=
"/SVCLVL/"
+
svcLvlCode
;
}
}
}
}
//参数3
String
localInstrumentCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.PmtTpInf.LclInstrm.Cd"
);
String
localInstrumentProprietary
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.PmtTpInf.LclInstrm.Prtry"
);
if
(
StringUtil
.
isNotEmpty
(
localInstrumentProprietary
)
&&
!
"CRED"
.
equalsIgnoreCase
(
localInstrumentProprietary
)
&&
!
"CRTS"
.
equalsIgnoreCase
(
localInstrumentProprietary
)
&&
!
"SPAY"
.
equalsIgnoreCase
(
localInstrumentProprietary
)
&&
!
"SPRI"
.
equalsIgnoreCase
(
localInstrumentProprietary
)
&&
!
"SSTD"
.
equalsIgnoreCase
(
localInstrumentProprietary
))
{
mt72FullField
+=
"/LOCINS/"
+
localInstrumentProprietary
;
}
else
if
(
StringUtil
.
isNotEmpty
(
localInstrumentCode
)){
mt72FullField
+=
"/LOCINS/"
+
localInstrumentCode
;
}
//参数4
String
ctgyPurpCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.PmtTpInf.CtgyPurp.Cd"
);
String
ctgyPurpProprietary
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.PmtTpInf.CtgyPurp.Prtry"
);
if
(
StringUtil
.
isNotEmpty
(
ctgyPurpProprietary
)
&&
!
"INTC CORT"
.
equalsIgnoreCase
(
ctgyPurpProprietary
)
&&
!
"INTC"
.
equalsIgnoreCase
(
ctgyPurpProprietary
)
&&
!
"CORT"
.
equalsIgnoreCase
(
ctgyPurpProprietary
))
{
mt72FullField
+=
"/CATPURP/"
+
ctgyPurpProprietary
;
}
else
if
(
StringUtil
.
isNotEmpty
(
ctgyPurpCode
)
&&
!
CategoryPurposeCode
.
INTC
.
value
().
equalsIgnoreCase
(
ctgyPurpCode
)
&&
!
CategoryPurposeCode
.
CORT
.
value
().
equalsIgnoreCase
(
ctgyPurpCode
))
{
mt72FullField
+=
"/CATPURP/"
+
ctgyPurpCode
;
}
//参数5
String
mtCreditorAgt
=
subFunctionInstructionForCreditorAgent
(
bodyHdrParentElementName
+
".CdtTrfTxInf.InstrForCdtrAgt"
);
if
(
StringUtil
.
isNotEmpty
(
mtCreditorAgt
))
{
mt72FullField
+=
mtCreditorAgt
;
}
//参数6
String
mxPurposeCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
".CdtTrfTxInf.Purp.Cd"
);
String
mxPurposeProprietary
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
".CdtTrfTxInf.Purp.Prtry"
);
if
(
StringUtil
.
isNotEmpty
(
mxPurposeProprietary
))
{
mt72FullField
+=
"/PURP/"
+
mxPurposeProprietary
;
}
else
if
(
StringUtil
.
isNotEmpty
(
mxPurposeCode
))
{
mt72FullField
+=
"/PURP/"
+
mxPurposeCode
;
}
//参数7
String
settlementMethod
=
getXmlNodeValue
(
grpHdrParentElementName
,
document
,
"GrpHdr.SttlmInf.SttlmMtd"
);
String
mtNextAgt
=
subFunctionInstructionForNextAgent
(
bodyHdrParentElementName
+
".CdtTrfTxInf.InstrForNxtAgt"
,
settlementMethod
);
if
(
StringUtil
.
isNotEmpty
(
mtNextAgt
))
{
mt72FullField
+=
mtNextAgt
;
}
//参数8
String
mtDbtrAgt
=
mx_to_mtBICNameAgent
(
bodyHdrParentElementName
+
".CdtTrfTxInf.DbtrAgt"
,
210
);
if
(
StringUtil
.
isNotEmpty
(
mtDbtrAgt
))
{
mt72FullField
+=
"/INS/"
+
mtDbtrAgt
;
}
//参数9
String
mtPrvsInstgAgt
=
mx_to_mtBICNameAgent
(
bodyHdrParentElementName
+
".CdtTrfTxInf.PrvsInstgAgt1"
,
210
);
if
(
StringUtil
.
isEmpty
(
mtPrvsInstgAgt
))
{
mtPrvsInstgAgt
=
mx_to_mtBICNameAgent
(
bodyHdrParentElementName
+
".CdtTrfTxInf.PrvsInstgAgt2"
,
210
);
}
if
(
StringUtil
.
isEmpty
(
mtPrvsInstgAgt
))
{
mtPrvsInstgAgt
=
mx_to_mtBICNameAgent
(
bodyHdrParentElementName
+
".CdtTrfTxInf.PrvsInstgAgt3"
,
210
);
}
if
(
StringUtil
.
isNotEmpty
(
mtPrvsInstgAgt
))
{
mt72FullField
+=
"/INS/"
+
mtPrvsInstgAgt
;
}
//参数10
String
mtRemittanceInfo
=
subFunctionRemittanceInformation
(
bodyHdrParentElementName
+
".RmtInf"
);
if
(
StringUtil
.
isNotEmpty
(
mtRemittanceInfo
))
{
mt72FullField
+=
mtRemittanceInfo
;
}
if
(
StringUtil
.
isNotEmpty
(
mt72FullField
))
{
List
<
String
>
list
=
StringUtil
.
outStringList
(
mt72FullField
,
35
,
"//"
);
String
value
=
""
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
if
(
i
==
6
)
break
;
if
(
i
==
0
)
{
value
=
list
.
get
(
i
);
}
else
{
value
+=
Mx2MtConstants
.
NEW_LINE
+
list
.
get
(
i
);
}
}
tags
.
add
(
new
Tag
(
name
,
value
));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/Field33BGenerate.java
0 → 100644
View file @
7d7472e9
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.util.NumberUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
java.math.BigDecimal
;
import
java.util.List
;
public
class
Field33BGenerate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name
=
"33B"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
amt
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.InstdAmt"
);
String
ccy
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.InstdAmt@Ccy"
);
if
(
StringUtil
.
isNotEmpty
(
amt
)
&&
StringUtil
.
isNotEmpty
(
ccy
))
{
tags
.
add
(
new
Tag
(
name
,
ccy
+
NumberUtil
.
formatAmt
(
new
BigDecimal
(
amt
),
ccy
)));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/Field50AGenerate.java
View file @
7d7472e9
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftBlock3
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
java.util.List
;
public
class
Field50AGenerate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name_A
=
"50A"
;
private
static
String
name_F
=
"50F"
;
private
static
String
name_K
=
"50K"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
// TODO 50F取值待补充
//TODO 为F条件待补充
boolean
covFlag
=
false
;
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
bicCode
=
mx_to_mtAnyBIC
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.Dbtr"
);
String
account
=
mx_to_mtAccount
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.DbtrAcct"
);
String
value
=
""
;
if
(
StringUtil
.
isNotEmpty
(
bicCode
))
{
if
(
StringUtil
.
isNotEmpty
(
account
))
{
value
=
account
+
Mx2MtConstants
.
NEW_LINE
+
bicCode
;
}
else
{
value
=
bicCode
;
}
tags
.
add
(
new
Tag
(
name_A
,
value
));
covFlag
=
true
;
}
else
{
String
name
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.Dbtr.Nm"
);
int
addressLineCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.Dbtr.PstlAdr.AdrLine"
);
if
(
addressLineCount
>
0
)
{
String
mtNameAddress
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.Dbtr"
);
if
(
StringUtil
.
isNotEmpty
(
account
))
{
value
=
account
+
Mx2MtConstants
.
NEW_LINE
+
mtNameAddress
;
}
else
{
value
=
mtNameAddress
;
}
tags
.
add
(
new
Tag
(
name_K
,
value
));
}
else
if
(
StringUtil
.
isNotEmpty
(
name
))
{
if
(
StringUtil
.
isNotEmpty
(
account
))
{
value
=
account
+
Mx2MtConstants
.
NEW_LINE
+
name
;
}
else
{
value
=
name
;
}
tags
.
add
(
new
Tag
(
name_K
,
value
));
covFlag
=
true
;
}
}
if
(
covFlag
)
{
SwiftBlock3
block3
=
context
.
get
(
SwiftMessage
.
class
).
getBlock3
();
block3
.
getTags
().
add
(
new
Tag
(
"119"
,
"COV"
));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/Field52AGenerate.java
0 → 100644
View file @
7d7472e9
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
java.util.List
;
public
class
Field52AGenerate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name_A
=
"52A"
;
private
static
String
name_D
=
"52D"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
bicCode
=
mx_to_mtBICFI
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.DbtrAgt"
);
String
account
=
mx_to_mtAccount
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.DbtrAgtAcct"
);
String
mtClearSystemId
=
mx_to_mtClearingIdentifier
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.DbtrAgt"
);
String
mtAccount
=
""
;
String
value
=
""
;
if
(
StringUtil
.
isNotEmpty
(
bicCode
))
{
if
(
StringUtil
.
isNotEmpty
(
account
))
{
mtAccount
=
account
;
}
else
{
mtAccount
=
mtClearSystemId
;
}
if
(
StringUtil
.
isNotEmpty
(
mtAccount
))
{
value
=
mtAccount
+
Mx2MtConstants
.
NEW_LINE
+
bicCode
;
}
else
{
value
=
bicCode
;
}
tags
.
add
(
new
Tag
(
name_A
,
value
));
}
else
{
String
name
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.DbtrAgt.FinInstnId.Nm"
);
String
countryCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.DbtrAgt.FinInstnId.PstlAdr.Ctry"
);
int
addressLineCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.DbtrAgt.FinInstnId.PstlAdr.AdrLine"
);
String
mtNameAddress
=
""
;
if
(
addressLineCount
>
0
)
{
mtNameAddress
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.DbtrAgt.FinInstnId"
);
}
else
if
(
StringUtil
.
isNotEmpty
(
countryCode
))
{
mtNameAddress
=
mx_to_mtFinancialInstitutionNameAndStructuredAddress
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.DbtrAgt.FinInstnId"
,
false
);
}
else
if
(
StringUtil
.
isNotEmpty
(
name
))
{
mtNameAddress
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.DbtrAgt.FinInstnId"
);
}
if
(
StringUtil
.
isEmpty
(
mtNameAddress
))
return
;
//如果name和地址不存在,返回。
if
(
StringUtil
.
isNotEmpty
(
mtClearSystemId
))
{
mtAccount
=
mtClearSystemId
;
}
else
{
mtAccount
=
account
;
}
if
(
StringUtil
.
isNotEmpty
(
mtAccount
))
{
value
=
mtAccount
+
Mx2MtConstants
.
NEW_LINE
+
mtNameAddress
;
}
else
{
value
=
mtNameAddress
;
}
tags
.
add
(
new
Tag
(
name_D
,
value
));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/Field56AGenerate.java
0 → 100644
View file @
7d7472e9
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
java.util.List
;
public
class
Field56AGenerate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name_A
=
"56A"
;
private
static
String
name_D
=
"56D"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
bicCode
=
mx_to_mtBICFI
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.IntrmyAgt1"
);
String
account
=
mx_to_mtAccount
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.IntrmyAgt1Acct"
);
String
mtClearSystemId
=
mx_to_mtClearingIdentifier
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.IntrmyAgt1"
);
String
mtAccount
=
""
;
String
value
=
""
;
if
(
StringUtil
.
isNotEmpty
(
bicCode
))
{
if
(
StringUtil
.
isNotEmpty
(
account
))
{
mtAccount
=
account
;
}
else
{
mtAccount
=
mtClearSystemId
;
}
if
(
StringUtil
.
isNotEmpty
(
mtAccount
))
{
value
=
mtAccount
+
Mx2MtConstants
.
NEW_LINE
+
bicCode
;
}
else
{
value
=
bicCode
;
}
tags
.
add
(
new
Tag
(
name_A
,
value
));
}
else
{
String
name
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.IntrmyAgt1.FinInstnId.Nm"
);
String
countryCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.IntrmyAgt1.FinInstnId.PstlAdr.Ctry"
);
int
addressLineCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.IntrmyAgt1.FinInstnId.PstlAdr.AdrLine"
);
String
mtNameAddress
=
""
;
if
(
addressLineCount
>
0
)
{
mtNameAddress
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.IntrmyAgt1.FinInstnId"
);
}
else
if
(
StringUtil
.
isNotEmpty
(
countryCode
))
{
mtNameAddress
=
mx_to_mtFinancialInstitutionNameAndStructuredAddress
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.IntrmyAgt1.FinInstnId"
,
false
);
}
else
if
(
StringUtil
.
isNotEmpty
(
name
))
{
mtNameAddress
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.IntrmyAgt1.FinInstnId"
);
}
if
(
StringUtil
.
isEmpty
(
mtNameAddress
))
return
;
//如果name和地址不存在,返回。
if
(
StringUtil
.
isNotEmpty
(
mtClearSystemId
))
{
mtAccount
=
mtClearSystemId
;
}
else
{
mtAccount
=
account
;
}
if
(
StringUtil
.
isNotEmpty
(
mtAccount
))
{
value
=
mtAccount
+
Mx2MtConstants
.
NEW_LINE
+
mtNameAddress
;
}
else
{
value
=
mtNameAddress
;
}
tags
.
add
(
new
Tag
(
name_D
,
value
));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/Field57AGenerate.java
0 → 100644
View file @
7d7472e9
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
java.util.List
;
public
class
Field57AGenerate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name_A
=
"57A"
;
private
static
String
name_D
=
"57D"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
bicCode
=
mx_to_mtBICFI
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.CdtrAgt"
);
String
account
=
mx_to_mtAccount
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.CdtrAgtAcct"
);
String
mtClearSystemId
=
mx_to_mtClearingIdentifier
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.CdtrAgt"
);
String
mtAccount
=
""
;
String
value
=
""
;
if
(
StringUtil
.
isNotEmpty
(
bicCode
))
{
if
(
StringUtil
.
isNotEmpty
(
account
))
{
mtAccount
=
account
;
}
else
{
mtAccount
=
mtClearSystemId
;
}
if
(
StringUtil
.
isNotEmpty
(
mtAccount
))
{
value
=
mtAccount
+
Mx2MtConstants
.
NEW_LINE
+
bicCode
;
}
else
{
value
=
bicCode
;
}
tags
.
add
(
new
Tag
(
name_A
,
value
));
}
else
{
String
name
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.CdtrAgt.FinInstnId.Nm"
);
String
countryCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.CdtrAgt.FinInstnId.PstlAdr.Ctry"
);
int
addressLineCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.CdtrAgt.FinInstnId.PstlAdr.AdrLine"
);
String
mtNameAddress
=
""
;
if
(
addressLineCount
>
0
)
{
mtNameAddress
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.CdtrAgt.FinInstnId"
);
}
else
if
(
StringUtil
.
isNotEmpty
(
countryCode
))
{
mtNameAddress
=
mx_to_mtFinancialInstitutionNameAndStructuredAddress
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.CdtrAgt.FinInstnId"
,
false
);
}
else
if
(
StringUtil
.
isNotEmpty
(
name
))
{
mtNameAddress
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.CdtrAgt.FinInstnId"
);
}
if
(
StringUtil
.
isEmpty
(
mtNameAddress
))
return
;
//如果name和地址不存在,返回。
if
(
StringUtil
.
isNotEmpty
(
mtClearSystemId
))
{
mtAccount
=
mtClearSystemId
;
}
else
{
mtAccount
=
account
;
}
if
(
StringUtil
.
isNotEmpty
(
mtAccount
))
{
value
=
mtAccount
+
Mx2MtConstants
.
NEW_LINE
+
mtNameAddress
;
}
else
{
value
=
mtNameAddress
;
}
tags
.
add
(
new
Tag
(
name_D
,
value
));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/Field59AGenerate.java
0 → 100644
View file @
7d7472e9
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
java.util.List
;
public
class
Field59AGenerate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name_A
=
"59A"
;
private
static
String
name_F
=
"59F"
;
private
static
String
name
=
"59"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
partyPath
=
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.Cdtr"
;
String
partyAcctPath
=
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.CdtrAcct"
;
String
bicCode
=
mx_to_mtAnyBIC
(
partyPath
);
String
account
=
mx_to_mtAccount
(
partyAcctPath
);
String
countryCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.Cdtr.PstlAdr.Ctry"
);
int
addressLineCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.Cdtr.PstlAdr.AdrLine"
);
String
partyName
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.Cdtr.Nm"
);
String
value
=
""
;
if
(
StringUtil
.
isNotEmpty
(
bicCode
))
{
if
(
StringUtil
.
isNotEmpty
(
account
))
{
value
=
account
+
Mx2MtConstants
.
NEW_LINE
+
bicCode
;
}
else
{
value
=
bicCode
;
}
tags
.
add
(
new
Tag
(
name_A
,
value
));
}
else
if
(
StringUtil
.
isNotEmpty
(
countryCode
)){
String
nameAddress
=
mx_to_mtPartyNameAndAddressLEI1
(
partyPath
);
if
(
StringUtil
.
isNotEmpty
(
account
))
{
value
=
account
+
Mx2MtConstants
.
NEW_LINE
+
nameAddress
;
}
else
{
value
=
nameAddress
;
}
tags
.
add
(
new
Tag
(
name_F
,
value
));
}
else
if
(
addressLineCount
>
0
){
boolean
structuredAddressIndicator
=
mx_to_mtAddressLineType
(
partyPath
);
if
(
structuredAddressIndicator
)
{
String
nameAddress
=
mx_to_mtPartyNameAndAddressLEI2
(
partyPath
);
if
(
StringUtil
.
isNotEmpty
(
account
))
{
value
=
account
+
Mx2MtConstants
.
NEW_LINE
+
nameAddress
;
}
else
{
value
=
nameAddress
;
}
tags
.
add
(
new
Tag
(
name_F
,
value
));
}
else
{
String
nameAddress
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
partyPath
);
if
(
StringUtil
.
isNotEmpty
(
account
))
{
value
=
account
+
Mx2MtConstants
.
NEW_LINE
+
nameAddress
;
}
else
{
value
=
nameAddress
;
}
tags
.
add
(
new
Tag
(
name
,
value
));
}
}
else
if
(
StringUtil
.
isNotEmpty
(
partyName
)){
String
nameAddress
=
mx_to_mtFinancialInstitutionNameAndUnstructuredAddress
(
partyPath
);
if
(
StringUtil
.
isNotEmpty
(
account
))
{
value
=
account
+
Mx2MtConstants
.
NEW_LINE
+
nameAddress
;
}
else
{
value
=
nameAddress
;
}
tags
.
add
(
new
Tag
(
name
,
value
));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/Field70Generate.java
0 → 100644
View file @
7d7472e9
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
java.util.List
;
public
class
Field70Generate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name
=
"70"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
mt70FullString
=
""
;
String
mtUltimateCreditor
=
mx_to_mtUltimateParty
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.UltmtCdtr"
);
if
(
StringUtil
.
isNotEmpty
(
mtUltimateCreditor
))
{
String
str
=
"/ULTB/"
+
mtUltimateCreditor
;
if
(
str
.
length
()
>
140
)
str
=
str
.
substring
(
0
,
139
)
+
"+"
;
if
(
StringUtil
.
isEmpty
(
mt70FullString
))
{
mt70FullString
+=
str
;
}
else
{
mt70FullString
+=
"//"
+
str
;
}
}
String
mtUltimateDebtor
=
mx_to_mtUltimateParty
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.UltmtDbtr"
);
if
(
StringUtil
.
isNotEmpty
(
mtUltimateDebtor
))
{
String
str
=
"/ULTD/"
+
mtUltimateDebtor
;
if
(
str
.
length
()
>
140
)
str
=
str
.
substring
(
0
,
139
)
+
"+"
;
if
(
StringUtil
.
isEmpty
(
mt70FullString
))
{
mt70FullString
+=
str
;
}
else
{
mt70FullString
+=
"//"
+
str
;
}
}
String
remittanceInfoUnstructured
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.RmtInf.Ustrd"
);
if
(
StringUtil
.
isNotEmpty
(
remittanceInfoUnstructured
))
{
if
(
StringUtil
.
isEmpty
(
mt70FullString
))
{
mt70FullString
+=
"/URI/"
+
remittanceInfoUnstructured
;
}
else
{
mt70FullString
+=
"///URI/"
+
remittanceInfoUnstructured
;
}
}
int
remittanceInfoStructuredCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.RmtInf.Strd"
);
if
(
remittanceInfoStructuredCount
>
0
)
{
if
(
StringUtil
.
isEmpty
(
mt70FullString
))
{
mt70FullString
+=
"/SRI/+"
;
}
else
{
mt70FullString
+=
"///SRI/+"
;
}
}
if
(
StringUtil
.
isNotEmpty
(
mt70FullString
))
{
String
value
=
StringUtil
.
getStringByEnter
(
mt70FullString
,
35
,
4
);
tags
.
add
(
new
Tag
(
name
,
value
));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/Field72Generate.java
0 → 100644
View file @
7d7472e9
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.common.SettlementMethodCode
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
java.util.List
;
public
class
Field72Generate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name
=
"72"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
mt72FullField
=
""
;
String
mtIntrmyAgt
=
mx_to_mtAgent
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.IntrmyAgt2"
,
6
);
if
(
StringUtil
.
isEmpty
(
mtIntrmyAgt
))
{
mtIntrmyAgt
=
mx_to_mtAgent
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.IntrmyAgt3"
,
6
);
}
if
(
StringUtil
.
isNotEmpty
(
mtIntrmyAgt
))
{
mt72FullField
+=
"/INTA/"
+
mtIntrmyAgt
;
}
String
mtCreditorAgt
=
subFunctionInstructionForCreditorAgentAndJP
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.InstrForCdtrAgt"
);
if
(
StringUtil
.
isNotEmpty
(
mtCreditorAgt
))
{
mt72FullField
+=
mtCreditorAgt
;
}
String
mtNextAgt
=
subFunctionInstructionForNextAgent
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.InstrForNxtAgt"
,
SettlementMethodCode
.
COVE
.
value
());
if
(
StringUtil
.
isNotEmpty
(
mtNextAgt
))
{
mt72FullField
+=
mtNextAgt
;
}
String
mtPrvsInstgAgt
=
mx_to_mtBICNameAgent
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.PrvsInstgAgt1"
,
210
);
if
(
StringUtil
.
isEmpty
(
mtPrvsInstgAgt
))
{
mtPrvsInstgAgt
=
mx_to_mtBICNameAgent
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.PrvsInstgAgt2"
,
210
);
}
if
(
StringUtil
.
isEmpty
(
mtPrvsInstgAgt
))
{
mtPrvsInstgAgt
=
mx_to_mtBICNameAgent
(
bodyHdrParentElementName
+
".CdtTrfTxInf.UndrlygCstmrCdtTrf.PrvsInstgAgt3"
,
210
);
}
if
(
StringUtil
.
isNotEmpty
(
mtPrvsInstgAgt
))
{
mt72FullField
+=
"/INS/"
+
mtPrvsInstgAgt
;
}
if
(
StringUtil
.
isNotEmpty
(
mt72FullField
))
{
List
<
String
>
list
=
StringUtil
.
outStringList
(
mt72FullField
,
35
,
"//"
);
String
value
=
""
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
if
(
i
==
6
)
break
;
if
(
i
==
0
)
{
value
=
list
.
get
(
i
);
}
else
{
value
+=
Mx2MtConstants
.
NEW_LINE
+
list
.
get
(
i
);
}
}
tags
.
add
(
new
Tag
(
name
,
value
));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/FieldB33BGenerate.java
deleted
100644 → 0
View file @
c5460253
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
public
class
FieldB33BGenerate
extends
AbstractMx2MtTagsGenerate
{
@Override
public
void
tagGenerate
()
throws
SwiftException
{
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/FieldB52AGenerate.java
deleted
100644 → 0
View file @
c5460253
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
public
class
FieldB52AGenerate
extends
AbstractMx2MtTagsGenerate
{
@Override
public
void
tagGenerate
()
throws
SwiftException
{
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/FieldB56Generate.java
deleted
100644 → 0
View file @
c5460253
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
public
class
FieldB56Generate
extends
AbstractMx2MtTagsGenerate
{
@Override
public
void
tagGenerate
()
throws
SwiftException
{
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/FieldB57Generate.java
deleted
100644 → 0
View file @
c5460253
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
public
class
FieldB57Generate
extends
AbstractMx2MtTagsGenerate
{
@Override
public
void
tagGenerate
()
throws
SwiftException
{
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/FieldB59Generate.java
deleted
100644 → 0
View file @
c5460253
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
public
class
FieldB59Generate
extends
AbstractMx2MtTagsGenerate
{
@Override
public
void
tagGenerate
()
throws
SwiftException
{
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/FieldB70Generate.java
deleted
100644 → 0
View file @
c5460253
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
public
class
FieldB70Generate
extends
AbstractMx2MtTagsGenerate
{
@Override
public
void
tagGenerate
()
throws
SwiftException
{
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt202cov202/impl/cov/FieldB72Generate.java
deleted
100644 → 0
View file @
c5460253
package
com
.
brilliance
.
swift
.
mx2mt
.
mt202cov202
.
impl
.
cov
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
public
class
FieldB72Generate
extends
AbstractMx2MtTagsGenerate
{
@Override
public
void
tagGenerate
()
throws
SwiftException
{
}
}
swiftCore/src/main/resources/swiftXml/MxPacs00900109.xml
View file @
7d7472e9
...
...
@@ -107,20 +107,15 @@
</PrvsInstgAgt>
<Cdtr>
<FinInstnId>
<BIC>
ZXCVDEWS
</BIC>
</FinInstnId>
<Nm>
33333333
</Nm>
<PstlAdr>
<BICFI>
ZXCVDEWS
</BICFI>
<Nm>
33333333
</Nm>
<PstlAdr>
<AdrLine>
11
</AdrLine>
<AdrLine>
22
</AdrLine>
<AdrLine>
33
</AdrLine>
<AdrLine>
44
</AdrLine>
</PstlAdr>
<Id>
<OrgId>
<AnyBIC>
anybic01
</AnyBIC>
</OrgId>
</Id>
</PstlAdr>
</FinInstnId>
</Cdtr>
<CdtrAgt>
<FinInstnId>
...
...
swiftCore/src/main/resources/swiftXml/MxPacs00900109_COV.xml
View file @
7d7472e9
...
...
@@ -228,20 +228,15 @@
</PrvsInstgAgt>
<Cdtr>
<FinInstnId>
<BIC>
ZXCDQWER
</BIC>
</FinInstnId>
<Nm>
33333333
</Nm>
<PstlAdr>
<BICFI>
ZXCVDEWS
</BICFI>
<Nm>
33333333
</Nm>
<PstlAdr>
<AdrLine>
11
</AdrLine>
<AdrLine>
22
</AdrLine>
<AdrLine>
33
</AdrLine>
<AdrLine>
44
</AdrLine>
</PstlAdr>
<Id>
<OrgId>
<AnyBIC>
anybic01
</AnyBIC>
</OrgId>
</Id>
</PstlAdr>
</FinInstnId>
</Cdtr>
<CdtrAgt>
<FinInstnId>
...
...
swiftCore/src/test/java/com/brilliance/mx2mt/mt202/TestMx2MtFor202.java
View file @
7d7472e9
package
com
.
brilliance
.
mx2mt
.
mt202
;
import
com.brilliance.swift.SwiftTransfer
;
import
com.brilliance.swift.mx2mt.Mx2MtCreatorManager
;
import
org.apache.commons.io.FileUtils
;
import
java.io.File
;
public
class
TestMx2MtFor202
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
mt202
=
SwiftTransfer
.
mx2Mt
(
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900109.xml"
),
"d:/test/MT202.txt"
,
null
);
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900109.xml"
);
String
xmlStr
=
FileUtils
.
readFileToString
(
file
);
String
mt202
=
new
Mx2MtCreatorManager
().
mx2Mt
(
xmlStr
,
null
,
null
);
System
.
out
.
println
(
mt202
);
}
}
swiftCore/src/test/java/com/brilliance/mx2mt/mt202/TestMx2MtFor202COV.java
View file @
7d7472e9
package
com
.
brilliance
.
mx2mt
.
mt202
;
import
com.brilliance.swift.SwiftTransfer
;
import
com.brilliance.swift.mx2mt.Mx2MtCreatorManager
;
import
org.apache.commons.io.FileUtils
;
import
java.io.File
;
public
class
TestMx2MtFor202COV
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
mt202Cov
=
SwiftTransfer
.
mx2Mt
(
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900109_COV.xml"
),
"d:/test/MT202Cov.txt"
,
null
);
System
.
out
.
println
(
mt202
Cov
);
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900109_COV.xml"
);
String
xmlStr
=
FileUtils
.
readFileToString
(
file
);
String
mt202
=
new
Mx2MtCreatorManager
().
mx2Mt
(
xmlStr
,
null
,
null
);
System
.
out
.
println
(
mt202
);
}
}
swiftCore/src/test/java/com/brilliance/mx2mtmap/mt103/Test.java
View file @
7d7472e9
package
com
.
brilliance
.
mx2mtmap
.
mt103
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.brilliance.swift.SwiftTransfer
;
import
com.brilliance.swift.util.StringUtil
;
import
com.google.gson.*
;
import
com.prowidesoftware.swift.model.mx.AbstractMX
;
import
com.google.gson.GsonBuilder
;
import
com.google.gson.reflect.TypeToken
;
import
org.apache.commons.io.FileUtils
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
public
class
Test
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
File
file
=
new
File
(
"D:\\test\\MxPacs0080010
2
.xml"
);
File
file
=
new
File
(
"D:\\test\\MxPacs0080010
9
.xml"
);
String
xmlStr
=
FileUtils
.
readFileToString
(
file
);
//String xmlStr = FileUtils.readFileToString(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt05400108_CREDIT.xml"));
//Map<String, Object> extraMap = new HashMap<>();
//extraMap.put("bnkBic", "BANKANC0XXX");//发报
// extraMap.put("bnkBic", "FOOBARC0");//收报
Map
<
String
,
String
>
maps
=
SwiftTransfer
.
mx2MtMap
(
xmlStr
,
null
);
maps
.
forEach
((
k
,
v
)
->
System
.
out
.
println
(
k
+
"="
+
v
));
//
Map<String, String> maps = SwiftTransfer.mx2MtMap(xmlStr, null);
//
maps.forEach((k, v) -> System.out.println(k + "=" + v));
//String gson
= SwiftTransfer.mx2Gson(xmlStr);
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));
//maps.forEach((k, v) -> System.out.println(k + "=" + v));
Map
<
String
,
Object
>
maps
=
new
GsonBuilder
().
create
().
fromJson
(
gsonStr
,
new
TypeToken
<
Map
<
String
,
String
>>()
{}.
getType
());
maps
.
forEach
((
k
,
v
)
->
System
.
out
.
println
(
k
+
"="
+
v
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment