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
a760a2ad
Commit
a760a2ad
authored
Aug 22, 2024
by
jianglong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ncbgjzf' of
http://114.115.138.98:8900/swift/swiftMtMx
into ncbgjzf
parents
914509b4
a9b1bffa
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
661 additions
and
8 deletions
+661
-8
Mx2Mt204Creator.java
...ava/com/brilliance/swift/mx2mt/mt204/Mx2Mt204Creator.java
+9
-2
SeqAField30Generate.java
...rilliance/swift/mx2mt/mt204/impl/SeqAField30Generate.java
+38
-0
SeqAField57aGenerate.java
...illiance/swift/mx2mt/mt204/impl/SeqAField57aGenerate.java
+107
-0
SeqAField58aGenerate.java
...illiance/swift/mx2mt/mt204/impl/SeqAField58aGenerate.java
+112
-0
SeqBField20Generate.java
...rilliance/swift/mx2mt/mt204/impl/SeqBField20Generate.java
+35
-0
SeqBField21Generate.java
...rilliance/swift/mx2mt/mt204/impl/SeqBField21Generate.java
+35
-0
SeqBField32BGenerate.java
...illiance/swift/mx2mt/mt204/impl/SeqBField32BGenerate.java
+42
-0
SeqBField53aGenerate.java
...illiance/swift/mx2mt/mt204/impl/SeqBField53aGenerate.java
+84
-0
SeqBField72Generate.java
...rilliance/swift/mx2mt/mt204/impl/SeqBField72Generate.java
+143
-0
Pacs00800108.xml
swiftCore/src/main/resources/swiftXml/Pacs00800108.xml
+1
-0
pacs.010.xml
swiftCore/src/main/resources/swiftXml/pacs.010.xml
+55
-6
No files found.
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt204/Mx2Mt204Creator.java
View file @
a760a2ad
...
@@ -4,8 +4,7 @@ import com.brilliance.swift.constants.Mx2MtConstants;
...
@@ -4,8 +4,7 @@ import com.brilliance.swift.constants.Mx2MtConstants;
import
com.brilliance.swift.mx2mt.AbstractMx2MtCreator
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtCreator
;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
import
com.brilliance.swift.mx2mt.Mx2MtTagsGenerate
;
import
com.brilliance.swift.mx2mt.Mx2MtTagsGenerate
;
import
com.brilliance.swift.mx2mt.mt204.impl.SeqAField19Generate
;
import
com.brilliance.swift.mx2mt.mt204.impl.*
;
import
com.brilliance.swift.mx2mt.mt204.impl.SeqAField20Generate
;
import
com.brilliance.swift.util.XmlUtil
;
import
com.brilliance.swift.util.XmlUtil
;
import
org.dom4j.Document
;
import
org.dom4j.Document
;
...
@@ -31,6 +30,14 @@ public class Mx2Mt204Creator extends AbstractMx2MtCreator {
...
@@ -31,6 +30,14 @@ public class Mx2Mt204Creator extends AbstractMx2MtCreator {
List
<
Mx2MtTagsGenerate
>
fieldsGenerateList
=
new
ArrayList
<>();
List
<
Mx2MtTagsGenerate
>
fieldsGenerateList
=
new
ArrayList
<>();
fieldsGenerateList
.
add
(
new
SeqAField20Generate
());
fieldsGenerateList
.
add
(
new
SeqAField20Generate
());
fieldsGenerateList
.
add
(
new
SeqAField19Generate
());
fieldsGenerateList
.
add
(
new
SeqAField19Generate
());
fieldsGenerateList
.
add
(
new
SeqAField30Generate
());
fieldsGenerateList
.
add
(
new
SeqAField57aGenerate
());
fieldsGenerateList
.
add
(
new
SeqAField58aGenerate
());
fieldsGenerateList
.
add
(
new
SeqBField20Generate
());
fieldsGenerateList
.
add
(
new
SeqBField21Generate
());
fieldsGenerateList
.
add
(
new
SeqBField32BGenerate
());
fieldsGenerateList
.
add
(
new
SeqBField53aGenerate
());
fieldsGenerateList
.
add
(
new
SeqBField72Generate
());
return
fieldsGenerateList
;
return
fieldsGenerateList
;
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt204/impl/SeqAField30Generate.java
0 → 100644
View file @
a760a2ad
package
com
.
brilliance
.
swift
.
mx2mt
.
mt204
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.util.DateUtil
;
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
javax.xml.datatype.DatatypeConfigurationException
;
import
javax.xml.datatype.DatatypeFactory
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
java.math.BigDecimal
;
import
java.util.List
;
public
class
SeqAField30Generate
extends
AbstractMx2MtTagsGenerate
{
private
static
final
String
NAME
=
"30"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
intrBkSttlmDtStr
=
""
;
String
intrBkSttlmDtValue
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtInstr.DrctDbtTxInf.IntrBkSttlmDt"
);
if
(
StringUtil
.
isNotEmpty
(
intrBkSttlmDtValue
))
{
try
{
XMLGregorianCalendar
intrBkSttlmDt
=
DatatypeFactory
.
newInstance
().
newXMLGregorianCalendar
(
intrBkSttlmDtValue
);
intrBkSttlmDtStr
=
DateUtil
.
format
(
intrBkSttlmDt
,
"yyMMdd"
);
tags
.
add
(
new
Tag
(
NAME
,
intrBkSttlmDtStr
));
}
catch
(
DatatypeConfigurationException
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt204/impl/SeqAField57aGenerate.java
0 → 100644
View file @
a760a2ad
package
com
.
brilliance
.
swift
.
mx2mt
.
mt204
.
impl
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field57A
;
import
com.prowidesoftware.swift.model.field.Field57B
;
import
com.prowidesoftware.swift.model.field.Field57D
;
import
java.util.List
;
/**
*/
public
class
SeqAField57aGenerate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name_A
=
"57A"
;
private
static
String
name_B
=
"57B"
;
private
static
String
name_D
=
"57D"
;
private
static
String
name
=
"57"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/57a"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
agentPath
=
bodyHdrParentElementName
+
".CdtInstr.CdtrAgt"
;
String
accountPath
=
bodyHdrParentElementName
+
".CdtInstr.CdtrAgtAcct"
;
// String clearingChannelPath = bodyHdrParentElementName + ".CdtInstr.PmtTpInf.ClrChanl";
String
clearingChannelPath
=
""
;
Tag
tag
=
mx_to_mtAgentGeneric
(
name
,
agentPath
,
accountPath
,
true
,
false
,
false
,
clearingChannelPath
);
if
(
tag
!=
null
)
{
if
(
name_D
.
equals
(
tag
.
getName
()))
{
String
value
=
mx_to_mtStartingLineCharacter
(
tag
.
getValue
(),
"Block4/:"
+
name_D
+
":"
);
tag
.
setValue
(
value
);
}
//mapping转换文档 Translation Post Conditions -> POSTC007
String
value
=
tag
.
getValue
();
String
tagName
=
tag
.
getName
();
boolean
flag
=
exist56aStartWithFWRT
(
tags
);
if
(
flag
&&
(
value
.
startsWith
(
"//FW"
)
||
value
.
startsWith
(
"//RT"
)))
{
String
tmp57aPartyIdentifier
=
mx_to_mtClearingIdentifier
(
agentPath
);
if
(
StringUtil
.
isEmpty
(
tmp57aPartyIdentifier
)
||
tmp57aPartyIdentifier
.
startsWith
(
"//FW"
))
{
if
(
tagName
.
equals
(
name_A
))
{
Field57A
field57A
=
(
Field57A
)
tag
.
asField
();
tag
=
new
Tag
(
name_A
,
field57A
.
getBIC
());
buildSTErrorInfo
(
105
,
"Block4/:"
+
tagName
+
":"
,
null
);
}
else
if
(
tagName
.
equals
(
name_D
))
{
Field57D
field57D
=
(
Field57D
)
tag
.
asField
();
if
(!
field57D
.
getNameAndAddress
().
startsWith
(
"//"
))
{
tag
=
new
Tag
(
name_D
,
field57D
.
getNameAndAddress
());
buildSTErrorInfo
(
105
,
"Block4/:"
+
tagName
+
":"
,
null
);
}
else
if
(
StringUtil
.
isNotEmpty
(
tmp57aPartyIdentifier
))
{
tag
=
new
Tag
(
name_D
,
tmp57aPartyIdentifier
+
Mx2MtConstants
.
NEW_LINE
+
field57D
.
getNameAndAddress
());
}
}
else
{
buildSTErrorInfo
(
106
,
"Block4/:"
+
tagName
+
":"
,
null
);
}
}
else
{
if
(
tagName
.
equals
(
name_A
))
{
Field57A
field57A
=
(
Field57A
)
tag
.
asField
();
tag
=
new
Tag
(
name_A
,
tmp57aPartyIdentifier
+
Mx2MtConstants
.
NEW_LINE
+
field57A
.
getBIC
());
}
else
if
(
tagName
.
equals
(
name_B
))
{
Field57B
field57B
=
(
Field57B
)
tag
.
asField
();
tag
=
new
Tag
(
name_B
,
tmp57aPartyIdentifier
+
Mx2MtConstants
.
NEW_LINE
+
field57B
.
getLocation
());
}
else
if
(
tagName
.
equals
(
name_D
))
{
Field57D
field57D
=
(
Field57D
)
tag
.
asField
();
tag
=
new
Tag
(
name_D
,
tmp57aPartyIdentifier
+
Mx2MtConstants
.
NEW_LINE
+
field57D
.
getNameAndAddress
());
}
else
{
tag
.
setValue
(
tmp57aPartyIdentifier
);
}
}
}
tags
.
add
(
tag
);
}
}
/**
* 56a 是否以 //FW or //RT 开始
* @param tags
* @return
*/
private
boolean
exist56aStartWithFWRT
(
List
<
Tag
>
tags
)
{
boolean
flag
=
false
;
if
(
tags
!=
null
&&
tags
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
tags
.
size
();
i
++)
{
Tag
tag
=
tags
.
get
(
i
);
if
(
tag
.
getName
().
matches
(
"56[ACD]"
))
{
String
value
=
tag
.
getValue
();
if
(
value
.
startsWith
(
"//FW"
)
||
value
.
startsWith
(
"//RT"
))
{
flag
=
true
;
break
;
}
}
}
}
return
flag
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt204/impl/SeqAField58aGenerate.java
0 → 100644
View file @
a760a2ad
package
com
.
brilliance
.
swift
.
mx2mt
.
mt204
.
impl
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
import
com.brilliance.swift.util.StringUtil
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field58A
;
import
com.prowidesoftware.swift.model.field.Field58D
;
import
java.util.List
;
/**
*/
public
class
SeqAField58aGenerate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name_A
=
"58A"
;
private
static
String
name_D
=
"58D"
;
private
static
String
name
=
"58"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/58a"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
agentPath
=
bodyHdrParentElementName
+
".CdtInstr.Cdtr"
;
String
accountPath
=
bodyHdrParentElementName
+
".CdtInstr.CdtrAcct"
;
// String clearingChannelPath = bodyHdrParentElementName + ".CdtInstr.PmtTpInf.ClrChanl";
String
clearingChannelPath
=
""
;
Tag
tag
=
mx_to_mtAgentGeneric
(
name
,
agentPath
,
accountPath
,
false
,
false
,
true
,
clearingChannelPath
);
if
(
tag
!=
null
)
{
if
(
name_D
.
equals
(
tag
.
getName
()))
{
String
value
=
mx_to_mtStartingLineCharacter
(
tag
.
getValue
(),
"Block4/:"
+
name_D
+
":"
);
tag
.
setValue
(
value
);
}
//mapping转换文档 Translation Post Conditions -> POSTC004 POSTC005
String
value
=
tag
.
getValue
();
String
tagName
=
tag
.
getName
();
boolean
flag
=
exist56a57aStartWithFWRT
(
tags
);
if
(
flag
&&
(
value
.
startsWith
(
"//FW"
)
||
value
.
startsWith
(
"//RT"
)))
{
String
tmp58aPartyIdentifier
=
mx_to_mtClearingIdentifier
(
agentPath
);
if
(
StringUtil
.
isEmpty
(
tmp58aPartyIdentifier
)
||
tmp58aPartyIdentifier
.
startsWith
(
"//FW"
))
{
if
(
tagName
.
equals
(
name_A
))
{
Field58A
field58A
=
(
Field58A
)
tag
.
asField
();
tag
=
new
Tag
(
name_A
,
field58A
.
getBIC
());
buildSTErrorInfo
(
105
,
"Block4/:"
+
tagName
+
":"
,
null
);
}
else
if
(
tagName
.
equals
(
name_D
))
{
Field58D
field58D
=
(
Field58D
)
tag
.
asField
();
if
(!
field58D
.
getNameAndAddress
().
startsWith
(
"//"
))
{
tag
=
new
Tag
(
name_D
,
field58D
.
getNameAndAddress
());
buildSTErrorInfo
(
105
,
"Block4/:"
+
tagName
+
":"
,
null
);
}
else
if
(
StringUtil
.
isNotEmpty
(
tmp58aPartyIdentifier
))
{
tag
=
new
Tag
(
name_D
,
tmp58aPartyIdentifier
+
Mx2MtConstants
.
NEW_LINE
+
field58D
.
getNameAndAddress
());
}
}
}
else
{
if
(
tagName
.
equals
(
name_A
))
{
Field58A
field58A
=
(
Field58A
)
tag
.
asField
();
tag
=
new
Tag
(
name_A
,
tmp58aPartyIdentifier
+
Mx2MtConstants
.
NEW_LINE
+
field58A
.
getBIC
());
}
else
if
(
tagName
.
equals
(
name_D
))
{
Field58D
field58D
=
(
Field58D
)
tag
.
asField
();
tag
=
new
Tag
(
name_D
,
tmp58aPartyIdentifier
+
Mx2MtConstants
.
NEW_LINE
+
field58D
.
getNameAndAddress
());
}
}
}
tags
.
add
(
tag
);
}
}
/**
* 56a 是否以 //FW or //RT 开始
* 否则 57a 是否以 //FW or //RT 开始
* @param tags
* @return
*/
private
boolean
exist56a57aStartWithFWRT
(
List
<
Tag
>
tags
)
{
boolean
flag
=
false
;
if
(
tags
!=
null
&&
tags
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
tags
.
size
();
i
++)
{
Tag
tag
=
tags
.
get
(
i
);
if
(
tag
.
getName
().
matches
(
"56[ACD]"
))
{
String
value
=
tag
.
getValue
();
if
(
value
.
startsWith
(
"//FW"
)
||
value
.
startsWith
(
"//RT"
))
{
flag
=
true
;
break
;
}
}
}
}
if
(!
flag
)
{
if
(
tags
!=
null
&&
tags
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
tags
.
size
();
i
++)
{
Tag
tag
=
tags
.
get
(
i
);
if
(
tag
.
getName
().
matches
(
"57[ABCD]"
))
{
String
value
=
tag
.
getValue
();
if
(
value
.
startsWith
(
"//FW"
)
||
value
.
startsWith
(
"//RT"
))
{
flag
=
true
;
break
;
}
}
}
}
}
return
flag
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt204/impl/SeqBField20Generate.java
0 → 100644
View file @
a760a2ad
package
com
.
brilliance
.
swift
.
mx2mt
.
mt204
.
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
SeqBField20Generate
extends
AbstractMx2MtTagsGenerate
{
private
static
final
String
NAME
=
"20"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
orgMessageId
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtInstr.DrctDbtTxInf.PmtId.InstrId"
);
String
messageId
=
orgMessageId
;
if
(
StringUtil
.
isNotEmpty
(
messageId
))
{
if
(
messageId
.
matches
(
"(/.*)|(.*/)|(.*//.*)"
)){
messageId
=
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
;
buildSTErrorInfo
(
42
,
"Block4/:20"
,
orgMessageId
);
}
if
(
messageId
.
length
()
>
16
)
{
buildSTErrorInfo
(
13
,
"Block4/:20:"
,
messageId
);
messageId
=
messageId
.
substring
(
0
,
15
)
+
"+"
;
}
tags
.
add
(
new
Tag
(
NAME
,
messageId
));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt204/impl/SeqBField21Generate.java
0 → 100644
View file @
a760a2ad
package
com
.
brilliance
.
swift
.
mx2mt
.
mt204
.
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
SeqBField21Generate
extends
AbstractMx2MtTagsGenerate
{
private
static
final
String
NAME
=
"21"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
orgEndToEndId
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtInstr.DrctDbtTxInf.PmtId.EndToEndId"
);
String
endToEndId
=
orgEndToEndId
;
if
(
StringUtil
.
isNotEmpty
(
endToEndId
))
{
if
(
endToEndId
.
matches
(
"(/.*)|(.*/)|(.*//.*)"
)){
endToEndId
=
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
;
buildSTErrorInfo
(
42
,
"Block4/:20"
,
orgEndToEndId
);
}
if
(
endToEndId
.
length
()
>
16
)
{
buildSTErrorInfo
(
13
,
"Block4/:20:"
,
endToEndId
);
endToEndId
=
endToEndId
.
substring
(
0
,
15
)
+
"+"
;
}
tags
.
add
(
new
Tag
(
NAME
,
endToEndId
));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt204/impl/SeqBField32BGenerate.java
0 → 100644
View file @
a760a2ad
package
com
.
brilliance
.
swift
.
mx2mt
.
mt204
.
impl
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.util.DateUtil
;
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
javax.xml.datatype.DatatypeConfigurationException
;
import
javax.xml.datatype.DatatypeFactory
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
java.math.BigDecimal
;
import
java.util.List
;
public
class
SeqBField32BGenerate
extends
AbstractMx2MtTagsGenerate
{
private
static
final
String
NAME
=
"32B"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
intrBkSttlmAmt
=
""
;
String
intrBkSttlmccy
=
""
;
String
amt
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtInstr.DrctDbtTxInf.IntrBkSttlmAmt"
);
String
ccy
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtInstr.DrctDbtTxInf.IntrBkSttlmAmt@Ccy"
);
if
(
"XAU"
.
equalsIgnoreCase
(
ccy
)
||
"XAG"
.
equalsIgnoreCase
(
ccy
)
||
"XPD"
.
equalsIgnoreCase
(
ccy
)
||
"XPT"
.
equalsIgnoreCase
(
ccy
))
{
buildSTErrorInfo
(
63
,
bodyHdrParentElementName
+
".CdtTrfTxInf.IntrBkSttlmAmt"
,
ccy
);
}
if
(
StringUtil
.
isNotEmpty
(
amt
)
&&
StringUtil
.
isNotEmpty
(
ccy
))
{
intrBkSttlmAmt
=
NumberUtil
.
formatAmt
(
new
BigDecimal
(
amt
),
ccy
);
intrBkSttlmccy
=
ccy
;
}
tags
.
add
(
new
Tag
(
NAME
,
intrBkSttlmccy
+
intrBkSttlmAmt
));
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt204/impl/SeqBField53aGenerate.java
0 → 100644
View file @
a760a2ad
package
com
.
brilliance
.
swift
.
mx2mt
.
mt204
.
impl
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
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
com.prowidesoftware.swift.model.field.Field57A
;
import
com.prowidesoftware.swift.model.field.Field57B
;
import
com.prowidesoftware.swift.model.field.Field57D
;
import
java.util.List
;
/**
*对于所有代理行,如果xml报文中有代理行的bic,并且账户和清算代码都存在,则MT账号取账户;
* * 如果代理行没有bic,MT账号优先取清算代码,没有的话再取账户。
*/
public
class
SeqBField53aGenerate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name_A
=
"53A"
;
private
static
String
name_B
=
"53B"
;
private
static
String
name_D
=
"53D"
;
private
static
String
name
=
"53"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/53a"
);
/* SwiftMessage swiftMessage = context.get(SwiftMessage.class);
List<Tag> tags = swiftMessage.getBlock4().getTags();
String settlementMethod = getXmlNodeValue(grpHdrParentElementName, document, "GrpHdr.SttlmInf.SttlmMtd");
String account = mx_to_mtSettlementAccount(settlementMethod, grpHdrParentElementName+".GrpHdr.SttlmInf.SttlmAcct");
if ((SettlementMethodCode.INGA.value().equals(settlementMethod)
|| SettlementMethodCode.INDA.value().equals(settlementMethod))
&& StringUtil.isNotEmpty(account)) {
String value = "";
String bicCode = mx_to_mt53A(bodyHdrParentElementName + ".CdtTrfTxInf.InstrForNxtAgt");
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(account)) {
value = account;
tags.add(new Tag(name_B, value));
}
}
} else {
String agentPath = grpHdrParentElementName + ".GrpHdr.SttlmInf.InstgRmbrsmntAgt";
String accountPath = grpHdrParentElementName + ".GrpHdr.SttlmInf.InstgRmbrsmntAgtAcct";
Tag tag = mx_to_mtAgentGeneric(name, agentPath, accountPath, true, false, false, null);
if (tag != null) {
if (name_D.equals(tag.getName())) {
String value = mx_to_mtStartingLineCharacter(tag.getValue(), "Block4/:"+name_D+":");
tag.setValue(value);
}
tags.add(tag);
}
}
}*/
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
agentPath
=
bodyHdrParentElementName
+
".CdtInstr.DrctDbtTxInf.Dbtr"
;
String
accountPath
=
bodyHdrParentElementName
+
".CdtInstr.DrctDbtTxInf.DbtrAcct"
;
String
clearingChannelPath
=
""
;
Tag
tag
=
mx_to_mtAgentGeneric
(
name
,
agentPath
,
accountPath
,
true
,
false
,
false
,
clearingChannelPath
);
if
(
tag
!=
null
)
{
if
(
name_D
.
equals
(
tag
.
getName
()))
{
String
value
=
mx_to_mtStartingLineCharacter
(
tag
.
getValue
(),
"Block4/:"
+
name_D
+
":"
);
tag
.
setValue
(
value
);
}
tags
.
add
(
tag
);
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt204/impl/SeqBField72Generate.java
0 → 100644
View file @
a760a2ad
package
com
.
brilliance
.
swift
.
mx2mt
.
mt204
.
impl
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
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.ArrayList
;
import
java.util.List
;
/**
* MX_To_MT72FullField
* 参数列表
* 参数1:CdtTrfTxInf.IntrmyAgt2/CdtTrfTxInf.IntrmyAgt3
* 参数2:CdtTrfTxInf.PmtTpInf.SvcLvl
* 参数3:CdtTrfTxInf.PmtTpInf.LclInstrm
* 参数4:CdtTrfTxInf.PmtTpInf.CtgyPurp
* 参数5:CdtTrfTxInf.InstrForCdtrAgt
* 参数6:CdtTrfTxInf.InstrForNxtAgt
* 参数7:CdtTrfTxInf.PrvsInstgAgt1/CdtTrfTxInf.PrvsInstgAgt2/CdtTrfTxInf.PrvsInstgAgt3
* 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/CHQB/PHOB/TELB,MT72=/ACC/+CdtTrfTxInf.InstrForCdtrAgt.InstrInf
* 6.如果传入参数6,CdtTrfTxInf.InstrForNxtAgt.InstrInf过滤掉“/FIN53/BIC” 结构,MT72=/REC/+CdtTrfTxInf.InstrForNxtAgt.InstrInf
* 7.如果传入参数7,
* ①如果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
*/
public
class
SeqBField72Generate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name
=
"72"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/:72:"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
List
<
String
>
mt72List
=
new
ArrayList
<>();
/* String mtIntrmyAgt = mx_to_mtAgent(bodyHdrParentElementName + ".CdtInstr.DrctDbtTxInf.IntrmyAgt2", 6);
if (StringUtil.isEmpty(mtIntrmyAgt)) {
mtIntrmyAgt = mx_to_mtAgent(bodyHdrParentElementName + ".CdtInstr.DrctDbtTxInf.IntrmyAgt3", 6);
}
if (StringUtil.isNotEmpty(mtIntrmyAgt)) {
mt72List.add("/INTA/" + mtIntrmyAgt);
}*/
int
svcLvlCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"CdtInstr.DrctDbtTxInf.PmtTpInf.SvcLvl"
);
if
(
svcLvlCount
>
0
)
{
for
(
int
i
=
0
;
i
<
svcLvlCount
;
i
++)
{
if
(
i
==
3
)
break
;
String
svcLvlCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtInstr.DrctDbtTxInf.PmtTpInf.SvcLvl("
+
i
+
").Cd"
);
String
svcLvlProprietary
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtInstr.DrctDbtTxInf.PmtTpInf.SvcLvl("
+
i
+
").Prtry"
);
if
(
StringUtil
.
isNotEmpty
(
svcLvlProprietary
))
{
mt72List
.
add
(
"/SVCLVL/"
+
svcLvlProprietary
);
}
else
{
if
(!
ServiceLevelCode
.
SDVA
.
value
().
equals
(
svcLvlCode
)
&&
svcLvlCode
.
indexOf
(
"G00"
)
==
-
1
)
{
mt72List
.
add
(
"/SVCLVL/"
+
svcLvlCode
);
}
}
}
}
String
ctgyPurpCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtInstr.DrctDbtTxInf.PmtTpInf.CtgyPurp.Cd"
);
String
ctgyPurpProprietary
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtInstr.DrctDbtTxInf.PmtTpInf.CtgyPurp.Prtry"
);
if
(
StringUtil
.
isNotEmpty
(
ctgyPurpProprietary
)
&&
!
"INTC CORT"
.
equalsIgnoreCase
(
ctgyPurpProprietary
)
&&
!
"INTC"
.
equalsIgnoreCase
(
ctgyPurpProprietary
)
&&
!
"CORT"
.
equalsIgnoreCase
(
ctgyPurpProprietary
))
{
mt72List
.
add
(
"/CATPURP/"
+
ctgyPurpProprietary
);
}
else
if
(
StringUtil
.
isNotEmpty
(
ctgyPurpCode
)
&&
!
CategoryPurposeCode
.
INTC
.
value
().
equalsIgnoreCase
(
ctgyPurpCode
)
&&
!
CategoryPurposeCode
.
CORT
.
value
().
equalsIgnoreCase
(
ctgyPurpCode
))
{
mt72List
.
add
(
"/CATPURP/"
+
ctgyPurpCode
);
}
String
localInstrumentCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtInstr.DrctDbtTxInf.PmtTpInf.LclInstrm.Cd"
);
String
localInstrumentProprietary
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtInstr.DrctDbtTxInf.PmtTpInf.LclInstrm.Prtry"
);
if
(
StringUtil
.
isNotEmpty
(
localInstrumentProprietary
)
&&
!
"CRED"
.
equalsIgnoreCase
(
localInstrumentProprietary
)
&&
!
"CRTS"
.
equalsIgnoreCase
(
localInstrumentProprietary
)
&&
!
"SPAY"
.
equalsIgnoreCase
(
localInstrumentProprietary
)
&&
!
"SPRI"
.
equalsIgnoreCase
(
localInstrumentProprietary
)
&&
!
"SSTD"
.
equalsIgnoreCase
(
localInstrumentProprietary
))
{
mt72List
.
add
(
"/LOCINS/"
+
localInstrumentProprietary
);
}
else
if
(
StringUtil
.
isNotEmpty
(
localInstrumentCode
))
{
mt72List
.
add
(
"/LOCINS/"
+
localInstrumentCode
);
}
String
mtDebtrorAgt
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtInstr.DrctDbtTxInf.InstrForDbtrAgt"
);
if
(
StringUtil
.
isNotEmpty
(
mtDebtrorAgt
))
{
mt72List
.
add
(
"/REC/"
+
mtDebtrorAgt
);
}
String
pmtTpInfPurpCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtInstr.DrctDbtTxInf.Purp.Cd"
);
String
pmtTpInfPurpPrtry
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtInstr.DrctDbtTxInf.Purp.Prtry"
);
String
rmtInfo
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtInstr.DrctDbtTxInf.RmtInf"
);
rmtInfo
=
(
StringUtil
.
isNotEmpty
(
rmtInfo
)
?
rmtInfo
:
""
);
String
bnfInfo
=
""
;
if
(
StringUtil
.
isNotEmpty
(
pmtTpInfPurpCode
))
{
bnfInfo
=
pmtTpInfPurpCode
+
rmtInfo
;
}
else
if
(
StringUtil
.
isNotEmpty
(
pmtTpInfPurpPrtry
))
{
bnfInfo
=
pmtTpInfPurpPrtry
+
rmtInfo
;
}
if
(
StringUtil
.
isNotEmpty
(
bnfInfo
))
{
mt72List
.
add
(
"/BNF/"
+
bnfInfo
);
}
if
(
mt72List
.
size
()
>
0
)
{
List
<
String
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
mt72List
.
size
();
i
++)
{
String
mt72FullField
=
mt72List
.
get
(
i
);
List
<
String
>
tmplist
=
StringUtil
.
outStringList
(
mt72FullField
,
35
,
"//"
);
list
.
addAll
(
tmplist
);
}
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
);
}
}
value
=
mx_to_mtStartingLineCharacter
(
value
,
"Block4/:72:"
);
tags
.
add
(
new
Tag
(
name
,
value
));
}
}
}
swiftCore/src/main/resources/swiftXml/Pacs00800108.xml
View file @
a760a2ad
...
@@ -88,6 +88,7 @@ Change Log
...
@@ -88,6 +88,7 @@ Change Log
<PmtTpInf>
<PmtTpInf>
<CtgyPurp>
<CtgyPurp>
<Cd>
XX
</Cd>
<Cd>
XX
</Cd>
<Prtry>
test123456789endtest123456789endABC
</Prtry>
</CtgyPurp>
</CtgyPurp>
<SvcLvl>
<SvcLvl>
<Cd>
G001
</Cd>
<Cd>
G001
</Cd>
...
...
swiftCore/src/main/resources/swiftXml/pacs.010.xml
View file @
a760a2ad
...
@@ -66,34 +66,75 @@
...
@@ -66,34 +66,75 @@
</InstdAgt>
</InstdAgt>
<CdtrAgt>
<CdtrAgt>
<FinInstnId>
<FinInstnId>
<BICFI>
HSBCHKHHUSI
</BICFI>
<!--<BICFI>HSBCHKHHUSI</BICFI>-->
<Nm>
NcbBank
</Nm>
<PstlAdr>
<AdrLine>
test1
</AdrLine>
<AdrLine>
test2
</AdrLine>
<AdrLine>
test3
</AdrLine>
</PstlAdr>
</FinInstnId>
</FinInstnId>
</CdtrAgt>
</CdtrAgt>
<CdtrAgtAcct>
<Id>
<Othr>
<Id>
123457890
</Id>
</Othr>
</Id>
</CdtrAgtAcct>
<Cdtr>
<Cdtr>
<FinInstnId>
<FinInstnId>
<BICFI>
HSBCHKHHUSI
</BICFI>
<!--<BICFI>HSBCHKHHUSI</BICFI>-->
<Nm>
wangwu
</Nm>
<PstlAdr>
<AdrLine>
hubei
</AdrLine>
<AdrLine>
wuhan
</AdrLine>
<AdrLine>
jiangxia
</AdrLine>
</PstlAdr>
<LEI>
20230116095446565000
</LEI>
<LEI>
20230116095446565000
</LEI>
</FinInstnId>
</FinInstnId>
</Cdtr>
</Cdtr>
<CdtrAcct>
<Id>
<Othr>
<Id>
987650001111
</Id>
</Othr>
</Id>
</CdtrAcct>
<DrctDbtTxInf>
<DrctDbtTxInf>
<PmtId>
<PmtId>
<InstrId>
2023020815114929
</InstrId>
<InstrId>
2023020815114929
</InstrId>
<EndToEndId>
2023020815114929
</EndToEndId>
<EndToEndId>
end2endId0001
</EndToEndId>
<UETR>
b72736c6-103e-4ce5-8853-5948916e0458
</UETR>
<UETR>
b72736c6-103e-4ce5-8853-5948916e0458
</UETR>
</PmtId>
</PmtId>
<PmtTpInf>
<PmtTpInf>
<LclInstrm>
<LclInstrm>
<Prtry>
SI Direct Debit or Credit
</Prtry>
<Prtry>
SI Direct Debit or Credit
1
</Prtry>
</LclInstrm>
</LclInstrm>
<CtgyPurp>
<CtgyPurp>
<Prtry>
SI Direct Debit or Credit
</Prtry>
<Prtry>
SI Direct Debit or Credit
2
</Prtry>
</CtgyPurp>
</CtgyPurp>
<SvcLvl>
<Cd>
G001
</Cd>
</SvcLvl>
<SvcLvl>
<Cd>
G002
</Cd>
</SvcLvl>
<SvcLvl>
<Cd>
SEPA
</Cd>
</SvcLvl>
</PmtTpInf>
</PmtTpInf>
<IntrBkSttlmAmt
Ccy=
"USD"
>
1000.78
</IntrBkSttlmAmt>
<IntrBkSttlmAmt
Ccy=
"USD"
>
1000.78
</IntrBkSttlmAmt>
<IntrBkSttlmDt>
2023-02-08
</IntrBkSttlmDt>
<IntrBkSttlmDt>
2023-02-08
</IntrBkSttlmDt>
<Dbtr>
<Dbtr>
<FinInstnId>
<FinInstnId>
<BICFI>
HSBCHKHHUSI
</BICFI>
<!-- <BICFI>HSBCHKHHUSI</BICFI>-->
<Nm>
hello
</Nm>
<PstlAdr>
<AdrLine>
hubei
</AdrLine>
<AdrLine>
wuhan
</AdrLine>
<AdrLine>
hongshan
</AdrLine>
</PstlAdr>
<ClrSysMmbId>
<ClrSysMmbId>
<ClrSysId>
<ClrSysId>
<Cd>
HKNCC
</Cd>
<Cd>
HKNCC
</Cd>
...
@@ -102,6 +143,13 @@
...
@@ -102,6 +143,13 @@
</ClrSysMmbId>
</ClrSysMmbId>
</FinInstnId>
</FinInstnId>
</Dbtr>
</Dbtr>
<DbtrAcct>
<Id>
<Othr>
<Id>
999999999
</Id>
</Othr>
</Id>
</DbtrAcct>
<DbtrAgt>
<DbtrAgt>
<FinInstnId>
<FinInstnId>
<BICFI>
HSBCHKHHUSI
</BICFI>
<BICFI>
HSBCHKHHUSI
</BICFI>
...
@@ -118,6 +166,7 @@
...
@@ -118,6 +166,7 @@
<RmtInf>
<RmtInf>
<Ustrd>
/DEPN/01
</Ustrd>
<Ustrd>
/DEPN/01
</Ustrd>
</RmtInf>
</RmtInf>
<InstrForDbtrAgt>
111InstrForDbtrAgt111222InstrForDbtrAgt222333InstrForDbtrAgt333
</InstrForDbtrAgt>
</DrctDbtTxInf>
</DrctDbtTxInf>
</CdtInstr>
</CdtInstr>
</FIDrctDbt>
</FIDrctDbt>
...
...
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