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
d30d246c
Commit
d30d246c
authored
Jun 27, 2023
by
wuzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
camt10700101
parent
6df6ef3d
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
500 additions
and
1 deletions
+500
-1
Mx2MtConstants.java
...n/java/com/brilliance/swift/constants/Mx2MtConstants.java
+2
-0
Mx2MtCreatorManager.java
.../java/com/brilliance/swift/mx2mt/Mx2MtCreatorManager.java
+3
-1
Mx2Mt110Creator.java
...ava/com/brilliance/swift/mx2mt/mt110/Mx2Mt110Creator.java
+44
-0
Field20Generate.java
...om/brilliance/swift/mx2mt/mt110/impl/Field20Generate.java
+35
-0
Field21Generate.java
...om/brilliance/swift/mx2mt/mt110/impl/Field21Generate.java
+33
-0
Field30Generate.java
...om/brilliance/swift/mx2mt/mt110/impl/Field30Generate.java
+41
-0
Field32aGenerate.java
...m/brilliance/swift/mx2mt/mt110/impl/Field32aGenerate.java
+56
-0
Field50aGenerate.java
...m/brilliance/swift/mx2mt/mt110/impl/Field50aGenerate.java
+91
-0
Field52aGenerate.java
...m/brilliance/swift/mx2mt/mt110/impl/Field52aGenerate.java
+43
-0
Field53BGenerate.java
...m/brilliance/swift/mx2mt/mt110/impl/Field53BGenerate.java
+28
-0
Field59Generate.java
...om/brilliance/swift/mx2mt/mt110/impl/Field59Generate.java
+42
-0
camt10700101.xml
swiftCore/src/main/resources/swiftXml/camt10700101.xml
+77
-0
camt10700101.xsd
swiftCore/src/main/resources/xsd/camt10700101.xsd
+0
-0
Mx2MtTest.java
swiftCore/src/test/java/com/brilliance/Mx2MtTest.java
+5
-0
No files found.
swiftCore/src/main/java/com/brilliance/swift/constants/Mx2MtConstants.java
View file @
d30d246c
...
...
@@ -33,6 +33,8 @@ public class Mx2MtConstants {
public
static
final
String
MT_TYPE_103
=
"103"
;
public
static
final
String
MT_TYPE_110
=
"110"
;
public
static
final
String
MT_TYPE_202
=
"202"
;
public
static
final
String
MT_TYPE_205
=
"205"
;
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/Mx2MtCreatorManager.java
View file @
d30d246c
package
com
.
brilliance
.
swift
.
mx2mt
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.context.Context
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.mt103.Mx2Mt103Creator
;
import
com.brilliance.swift.mx2mt.mt103Retn.Mx2Mt103RetnCreator
;
import
com.brilliance.swift.mx2mt.mt110.Mx2Mt110Creator
;
import
com.brilliance.swift.mx2mt.mt192292.Mx2Mtn92Creator
;
import
com.brilliance.swift.mx2mt.mt196296.Mx2Mtn96Creator
;
import
com.brilliance.swift.mx2mt.mt202Retn.Mx2Mt202RetnCreator
;
...
...
@@ -122,6 +122,8 @@ public class Mx2MtCreatorManager {
return
new
Mx2Mt920Creator
();
}
else
if
(
"camt058001"
.
equals
(
messageType
)){
return
new
Mx2Mt292Creator
();
}
else
if
(
"camt107001"
.
equals
(
messageType
)){
return
new
Mx2Mt110Creator
();
}
else
{
throw
new
SwiftException
(
"Invalid message type"
);
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt110/Mx2Mt110Creator.java
0 → 100644
View file @
d30d246c
package
com
.
brilliance
.
swift
.
mx2mt
.
mt110
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtCreator
;
import
com.brilliance.swift.mx2mt.Mx2MtContextIdentifier
;
import
com.brilliance.swift.mx2mt.Mx2MtTagsGenerate
;
import
com.brilliance.swift.mx2mt.mt110.impl.*
;
import
com.brilliance.swift.util.XmlUtil
;
import
org.dom4j.Document
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
public
class
Mx2Mt110Creator
extends
AbstractMx2MtCreator
{
@Override
public
void
preProcess
()
{
super
.
preProcess
();
Document
document
=
(
Document
)
context
.
get
(
Mx2MtContextIdentifier
.
MX_XMl_DOCUMENT
,
true
);
Map
<
String
,
String
>
parentElementMaps
=
XmlUtil
.
getParentElementMaps
(
document
);
context
.
set
(
Mx2MtContextIdentifier
.
APPHDR_PARENT_ELEMENT_NAME
,
parentElementMaps
.
get
(
"AppHdr"
));
context
.
set
(
Mx2MtContextIdentifier
.
GRPHDR_PARENT_ELEMENT_NAME
,
parentElementMaps
.
get
(
"GrpHdr"
));
context
.
set
(
Mx2MtContextIdentifier
.
BODY_PARENT_ELEMENT_NAME
,
parentElementMaps
.
get
(
"Chq"
));
}
@Override
public
List
<
Mx2MtTagsGenerate
>
getGenerateTagList
()
{
List
<
Mx2MtTagsGenerate
>
fieldsGenerateList
=
new
ArrayList
<>();
fieldsGenerateList
.
add
(
new
Field20Generate
());
fieldsGenerateList
.
add
(
new
Field21Generate
());
fieldsGenerateList
.
add
(
new
Field30Generate
());
fieldsGenerateList
.
add
(
new
Field32aGenerate
());
fieldsGenerateList
.
add
(
new
Field50aGenerate
());
fieldsGenerateList
.
add
(
new
Field52aGenerate
());
fieldsGenerateList
.
add
(
new
Field53BGenerate
());
fieldsGenerateList
.
add
(
new
Field59Generate
());
return
fieldsGenerateList
;
}
@Override
protected
String
getMtType
()
{
return
Mx2MtConstants
.
MT_TYPE_110
;
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt110/impl/Field20Generate.java
0 → 100644
View file @
d30d246c
package
com
.
brilliance
.
swift
.
mx2mt
.
mt110
.
impl
;
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
;
/**
* GrpHdr.MsgId
* AppHdr.BizMsgIdr
*/
public
class
Field20Generate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name
=
"20"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
messageId
=
getXmlNodeValue
(
grpHdrParentElementName
,
document
,
"GrpHdr.MsgId"
);
if
(
StringUtil
.
isEmpty
(
messageId
))
{
messageId
=
getXmlNodeValue
(
appHdrParentElementName
,
document
,
"AppHdr.BizMsgIdr"
);
}
if
(
StringUtil
.
isNotEmpty
(
messageId
))
{
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/mt110/impl/Field21Generate.java
0 → 100644
View file @
d30d246c
package
com
.
brilliance
.
swift
.
mx2mt
.
mt110
.
impl
;
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
;
/**
* 取值逻辑:
* field21 = OrgnlNtfctn.OrgnlNtfctnRef.OrgnlItm.OrgnlItmId,如果长度大于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
chqNb
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Chq.ChqNb"
);
if
(
StringUtil
.
isNotEmpty
(
chqNb
))
{
if
(
chqNb
.
length
()
>
16
)
{
buildSTErrorInfo
(
13
,
"Block4/:21:"
,
chqNb
);
chqNb
=
chqNb
.
substring
(
0
,
15
)
+
"+"
;
}
tags
.
add
(
new
Tag
(
name
,
chqNb
));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt110/impl/Field30Generate.java
0 → 100644
View file @
d30d246c
package
com
.
brilliance
.
swift
.
mx2mt
.
mt110
.
impl
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate
;
import
com.brilliance.swift.util.DateUtil
;
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.util.List
;
/**
*
*/
public
class
Field30Generate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name
=
"30"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
boolean
flag30
=
false
;
String
mtIsseDtStr
=
""
;
String
isseDtStr
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Chq.IsseDt"
);
if
(
StringUtil
.
isNotEmpty
(
isseDtStr
))
{
try
{
XMLGregorianCalendar
valDt
=
DatatypeFactory
.
newInstance
().
newXMLGregorianCalendar
(
isseDtStr
);
mtIsseDtStr
=
DateUtil
.
format
(
valDt
,
"yyMMdd"
);
flag30
=
true
;
}
catch
(
DatatypeConfigurationException
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
if
(
flag30
){
tags
.
add
(
new
Tag
(
name
,
mtIsseDtStr
));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt110/impl/Field32aGenerate.java
0 → 100644
View file @
d30d246c
package
com
.
brilliance
.
swift
.
mx2mt
.
mt110
.
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
Field32aGenerate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name_32A
=
"32A"
;
private
static
String
name_32B
=
"32B"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
try
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
cheVaDt
=
""
;
String
cheAmt
=
""
;
String
cheAmtCcy
=
""
;
String
cheValDtValue
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Chq.ValDt.Dt"
);
String
amt
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Chq.Amt"
);
String
ccy
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Chq.Amt@Ccy"
);
if
(
"XAU"
.
equalsIgnoreCase
(
ccy
)
||
"XAG"
.
equalsIgnoreCase
(
ccy
)
||
"XPD"
.
equalsIgnoreCase
(
ccy
)
||
"XPT"
.
equalsIgnoreCase
(
ccy
))
{
buildSTErrorInfo
(
63
,
bodyHdrParentElementName
+
".Chq.Amt"
,
ccy
);
}
if
(
StringUtil
.
isNotEmpty
(
amt
)
&&
StringUtil
.
isNotEmpty
(
ccy
))
{
cheAmt
=
NumberUtil
.
formatAmt
(
new
BigDecimal
(
amt
),
ccy
);
cheAmtCcy
=
ccy
;
}
if
(
StringUtil
.
isNotEmpty
(
cheValDtValue
))
{
XMLGregorianCalendar
intrBkSttlmDt
=
DatatypeFactory
.
newInstance
().
newXMLGregorianCalendar
(
cheValDtValue
);
cheVaDt
=
DateUtil
.
format
(
intrBkSttlmDt
,
"yyMMdd"
);
tags
.
add
(
new
Tag
(
name_32A
,
cheVaDt
+
cheAmtCcy
+
cheAmt
));
}
else
{
tags
.
add
(
new
Tag
(
name_32B
,
cheAmtCcy
+
cheAmt
));
}
}
catch
(
DatatypeConfigurationException
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt110/impl/Field50aGenerate.java
0 → 100644
View file @
d30d246c
package
com
.
brilliance
.
swift
.
mx2mt
.
mt110
.
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
java.util.List
;
/**
*
*/
public
class
Field50aGenerate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name_50A
=
"50A"
;
private
static
String
name_50F
=
"50F"
;
private
static
String
name_50K
=
"50K"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/50a"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
cheBIC
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Chq.Pyer.Id.OrgId.AnyBIC"
);
String
chePyerAcct
=
bodyHdrParentElementName
+
".Chq.PyerAcct"
;
String
chePyerPstCtry
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Chq.Pyer.PstlAdr.Ctry"
);
String
payerPath
=
bodyHdrParentElementName
+
".Chq.Pyer"
;
String
orgidOthr
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Chq.Pyer.Id.OrgId.Othr"
);
String
prvtidOthr
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Chq.Pyer.Id.PrvtId.Othr"
);
int
addressLineCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"Chq.Pyer.PstlAdr.AdrLine"
);
String
pstladrAdrline
=
""
;
String
pyerNm
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Chq.Pyer.Nm"
);
String
account
=
""
;
String
nameAddress
=
""
;
if
(
addressLineCount
>
0
){
pstladrAdrline
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Chq.Pyer.PstlAdr.AdrLine(0)"
);
}
if
(
StringUtil
.
isNotEmpty
(
cheBIC
))
{
String
bicCode
=
mx_to_mtAnyBIC
(
payerPath
);
if
(
StringUtil
.
isNotEmpty
(
chePyerAcct
)){
account
=
mx_to_mtAccount
(
bodyHdrParentElementName
+
".Chq.PyerAcct"
);
}
tags
.
add
(
new
Tag
(
name_50A
,
account
+
Mx2MtConstants
.
NEW_LINE
+
bicCode
));
}
else
if
(
StringUtil
.
isNotEmpty
(
chePyerPstCtry
)){
nameAddress
=
mx_to_mtFATFNameAndAddress
(
payerPath
);
if
(
StringUtil
.
isNotEmpty
(
chePyerAcct
))
{
account
=
mx_to_mtAccount
(
bodyHdrParentElementName
+
".Chq.PyerAcct"
);
}
else
if
(
StringUtil
.
isNotEmpty
(
orgidOthr
)
||
StringUtil
.
isNotEmpty
(
prvtidOthr
)){
account
=
mx_to_mtFATFIdentification
(
payerPath
,
false
);
}
if
(
StringUtil
.
isNotEmpty
(
account
)
&&
account
.
length
()
>
35
)
{
account
=
account
.
substring
(
0
,
35
);
}
if
(
StringUtil
.
isEmpty
(
account
))
{
account
=
"/"
+
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
;
}
tags
.
add
(
new
Tag
(
name_50F
,
account
+
Mx2MtConstants
.
NEW_LINE
+
nameAddress
));
}
else
if
(
addressLineCount
>
0
&&
!
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
.
equals
(
pstladrAdrline
)){
boolean
structuredAddressIndicator
=
mx_to_mtAddressLineType
(
payerPath
);
if
(
structuredAddressIndicator
)
{
nameAddress
=
mx_to_mtFATFNameAndAddress2
(
payerPath
);
if
(
StringUtil
.
isNotEmpty
(
chePyerAcct
))
{
account
=
mx_to_mtAccount
(
bodyHdrParentElementName
+
".Chq.PyerAcct"
);
}
else
if
(
StringUtil
.
isNotEmpty
(
orgidOthr
)
||
StringUtil
.
isNotEmpty
(
prvtidOthr
)){
account
=
mx_to_mtFATFIdentification
(
payerPath
,
true
);
}
if
(
StringUtil
.
isNotEmpty
(
account
)
&&
account
.
length
()
>
35
)
{
account
=
account
.
substring
(
0
,
35
);
}
if
(
StringUtil
.
isEmpty
(
account
))
{
account
=
"/"
+
Mx2MtConstants
.
MX_TO_MT_DEFAULT_VALUE
;
}
tags
.
add
(
new
Tag
(
name_50F
,
account
+
Mx2MtConstants
.
NEW_LINE
+
nameAddress
));
}
else
{
nameAddress
=
mx_to_mtPartyNameAndUnstructuredAddress
(
payerPath
);
if
(
StringUtil
.
isNotEmpty
(
chePyerAcct
)){
account
=
mx_to_mtAccount
(
bodyHdrParentElementName
+
".Chq.PyerAcct"
);
}
tags
.
add
(
new
Tag
(
name_50K
,
account
+
Mx2MtConstants
.
NEW_LINE
+
nameAddress
));
}
}
else
if
(
StringUtil
.
isNotEmpty
(
pyerNm
)){
nameAddress
=
mx_to_mtPartyNameAndUnstructuredAddress
(
payerPath
);
if
(
StringUtil
.
isNotEmpty
(
chePyerAcct
)){
account
=
mx_to_mtAccount
(
bodyHdrParentElementName
+
".Chq.PyerAcct"
);
}
tags
.
add
(
new
Tag
(
name_50K
,
account
+
Mx2MtConstants
.
NEW_LINE
+
nameAddress
));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt110/impl/Field52aGenerate.java
0 → 100644
View file @
d30d246c
package
com
.
brilliance
.
swift
.
mx2mt
.
mt110
.
impl
;
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
java.util.List
;
/**
*
*/
public
class
Field52aGenerate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name_52A
=
"52A"
;
private
static
String
name_52B
=
"52B"
;
private
static
String
name_52D
=
"52D"
;
private
static
String
name
=
"52"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/52a"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
cheDrwrAgt
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Chq.DrwrAgt"
);
String
cheDrwrAgtAcct
=
bodyHdrParentElementName
+
".Chq.DrwrAgtAcct"
;
String
account
=
""
;
if
(
StringUtil
.
isEmpty
(
cheDrwrAgt
)){
account
=
mx_to_mtAccount
(
bodyHdrParentElementName
+
".Chq.DrwrAgtAcct"
);
tags
.
add
(
new
Tag
(
name_52B
,
account
));
}
else
{
Tag
tag
=
mx_to_mtAgentGeneric
(
name
,
cheDrwrAgt
,
cheDrwrAgtAcct
,
true
,
false
,
false
,
null
);
if
(
tag
!=
null
)
{
if
(
name_52D
.
equals
(
tag
.
getName
()))
{
String
value
=
mx_to_mtStartingLineCharacter
(
tag
.
getValue
(),
"Block4/:"
+
name_52D
+
":"
);
tag
.
setValue
(
value
);
}
tags
.
add
(
tag
);
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt110/impl/Field53BGenerate.java
0 → 100644
View file @
d30d246c
package
com
.
brilliance
.
swift
.
mx2mt
.
mt110
.
impl
;
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
java.util.List
;
/**
*
*/
public
class
Field53BGenerate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name_53B
=
"53B"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
accountPath
=
bodyHdrParentElementName
+
".Chq.DrwrAgtAcct"
;
String
account
=
mx_to_mtSettlementAccount
(
"INDA"
,
accountPath
);
if
(
StringUtil
.
isNotEmpty
(
account
))
{
tags
.
add
(
new
Tag
(
name_53B
,
account
));
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt110/impl/Field59Generate.java
0 → 100644
View file @
d30d246c
package
com
.
brilliance
.
swift
.
mx2mt
.
mt110
.
impl
;
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
java.util.List
;
/**
*
*/
public
class
Field59Generate
extends
AbstractMx2MtTagsGenerate
{
private
static
String
name
=
"59"
;
private
static
String
name_59F
=
"59F"
;
@Override
public
void
tagGenerate
()
throws
SwiftException
{
context
.
set
(
Mx2MtContextIdentifier
.
MX_TO_MT_ERROR_LOCATION
,
"Block4/59a"
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
String
ptsCtry
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Chq.Pyee.PstlAdr.Ctry"
);
int
chePyeePstLine
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"Chq.Pyee.PstlAdr.AdrLine"
);
String
partyPath
=
bodyHdrParentElementName
+
".Chq.Pyee"
;
if
(
StringUtil
.
isNotEmpty
(
ptsCtry
)){
String
nameAddress
=
mx_to_mtPartyNameAndAddressLEI1
(
partyPath
);
tags
.
add
(
new
Tag
(
name_59F
,
nameAddress
));
}
else
if
(
chePyeePstLine
>
0
)
{
boolean
structuredAddressIndicator
=
mx_to_mtAddressLineType
(
partyPath
);
if
(
structuredAddressIndicator
){
String
nameAddress
=
mx_to_mtPartyNameAndAddressLEI2
(
partyPath
,
"3/"
);
tags
.
add
(
new
Tag
(
name_59F
,
nameAddress
));
}
else
{
String
nameAddress
=
mx_to_mtPartyNameAndUnstructuredAddress
(
partyPath
);
tags
.
add
(
new
Tag
(
name
,
nameAddress
));
}
}
}
}
swiftCore/src/main/resources/swiftXml/camt10700101.xml
0 → 100644
View file @
d30d246c
<?xml version="1.0" encoding="UTF-8" ?>
<RequestPayload>
<AppHdr
xmlns=
"urn:iso:std:iso:20022:tech:xsd:head.001.001.02"
>
<Fr>
<FIId>
<FinInstnId>
<BICFI>
HELSFIHHXXX
</BICFI>
</FinInstnId>
</FIId>
</Fr>
<To>
<FIId>
<FinInstnId>
<BICFI>
NDEAFIHHXXX
</BICFI>
</FinInstnId>
</FIId>
</To>
<BizMsgIdr>
CNCL-ID001
</BizMsgIdr>
<MsgDefIdr>
camt.107.001.01
</MsgDefIdr>
<BizSvc>
swift.cbprplus.02
</BizSvc>
<CreDt>
2022-07-22T10:17:51.619+08:00
</CreDt>
<PssblDplct>
false
</PssblDplct>
<Prty>
NORM
</Prty>
</AppHdr>
<Document
xmlns=
"urn:iso:std:iso:20022:tech:xsd:camt.107.001.01"
>
<ChqPresntmntNtfctn>
<GrpHdr>
<MsgId>
CSE-001
</MsgId>
<CreDtTm>
2022-07-22T10:17:51.619+08:00
</CreDtTm>
<NbOfChqs>
1
</NbOfChqs>
</GrpHdr>
<Chq>
<InstrId>
CNCL-ID001
</InstrId>
<ChqNb>
EEE
</ChqNb>
<IsseDt>
2022-08-22T10:17:51.619+08:00
</IsseDt>
<Amt
Ccy=
"USD"
>
123
</Amt>
<!--32A-->
<ValDt>
<Dt>
2022-08-22T10:17:51.619+08:00
</Dt>
</ValDt>
<Pyer>
<Nm>
QWE
</Nm>
<!--50A-->
<Id>
<OrgId>
<AnyBIC>
ASD123123123123123123
</AnyBIC>
</OrgId>
</Id>
<!--50F-->
<!-- <PstlAdr>-->
<!-- <Ctry>WEQWE</Ctry>-->
<!-- </PstlAdr>-->
</Pyer>
<PyerAcct>
<Id>
<IBAN>
SSSS
</IBAN>
</Id>
</PyerAcct>
<DrwrAgtAcct>
<Id>
<!--52B-->
<IBAN>
OBHHIO
</IBAN>
</Id>
</DrwrAgtAcct>
<Pyee>
<Nm>
EWQ
</Nm>
<PstlAdr>
<Ctry>
OOOOO
</Ctry>
<AdrLine>
PPPPPP
</AdrLine>
</PstlAdr>
</Pyee>
</Chq>
</ChqPresntmntNtfctn>
</Document>
</RequestPayload>
\ No newline at end of file
swiftCore/src/main/resources/xsd/camt10700101.xsd
0 → 100644
View file @
d30d246c
This diff is collapsed.
Click to expand it.
swiftCore/src/test/java/com/brilliance/Mx2MtTest.java
View file @
d30d246c
...
...
@@ -144,6 +144,11 @@ public class Mx2MtTest {
}
@Test
public
void
test110
()
{
test
(
"/swiftXml/camt10700101.xml"
,
null
);
}
@Test
public
void
testXmlFilePath
()
{
SwiftTranslationReport
str
=
SwiftTransfer
.
mx2MtPlus
(
"d:/test/MxPacs00800108.xml"
,
true
,
null
,
null
);
System
.
out
.
println
(
str
.
getMessage
());
...
...
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