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
5736a006
Commit
5736a006
authored
Apr 14, 2022
by
chengzhuoshen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.refactoring mx2mt 103
2.采用接口平台xmlFilter解析xml的方式,能实现多版本的支持。
parent
114e8633
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
1306 additions
and
1175 deletions
+1306
-1175
Mx2MtConstants.java
.../prowidesoftware/brilliance/constants/Mx2MtConstants.java
+8
-0
AbstractMx2MtCreator.java
...rowidesoftware/brilliance/mx2mt/AbstractMx2MtCreator.java
+43
-1
AbstractMx2MtFieldsGenerate.java
...oftware/brilliance/mx2mt/AbstractMx2MtFieldsGenerate.java
+18
-0
Mx2MtCreateManager.java
.../prowidesoftware/brilliance/mx2mt/Mx2MtCreateManager.java
+14
-10
Mx2MtCreator.java
...va/com/prowidesoftware/brilliance/mx2mt/Mx2MtCreator.java
+11
-1
Mx2Mt103Creator.java
...owidesoftware/brilliance/mx2mt/mt103/Mx2Mt103Creator.java
+33
-50
Field13CGenerate.java
...oftware/brilliance/mx2mt/mt103/impl/Field13CGenerate.java
+22
-36
Field20Generate.java
...software/brilliance/mx2mt/mt103/impl/Field20Generate.java
+6
-16
Field23BGenerate.java
...oftware/brilliance/mx2mt/mt103/impl/Field23BGenerate.java
+8
-29
Field23EGenerate.java
...oftware/brilliance/mx2mt/mt103/impl/Field23EGenerate.java
+22
-42
Field26TGenerate.java
...oftware/brilliance/mx2mt/mt103/impl/Field26TGenerate.java
+7
-24
Field32AGenerate.java
...oftware/brilliance/mx2mt/mt103/impl/Field32AGenerate.java
+18
-41
Field33BGenerate.java
...oftware/brilliance/mx2mt/mt103/impl/Field33BGenerate.java
+11
-24
Field36Generate.java
...software/brilliance/mx2mt/mt103/impl/Field36Generate.java
+10
-23
Field50AGenerate.java
...oftware/brilliance/mx2mt/mt103/impl/Field50AGenerate.java
+52
-45
Field51AGenerate.java
...oftware/brilliance/mx2mt/mt103/impl/Field51AGenerate.java
+14
-0
Field52AGenerate.java
...oftware/brilliance/mx2mt/mt103/impl/Field52AGenerate.java
+54
-48
Field53AGenerate.java
...oftware/brilliance/mx2mt/mt103/impl/Field53AGenerate.java
+78
-66
Field54AGenerate.java
...oftware/brilliance/mx2mt/mt103/impl/Field54AGenerate.java
+53
-38
Field55AGenerate.java
...oftware/brilliance/mx2mt/mt103/impl/Field55AGenerate.java
+54
-38
Field56AGenerate.java
...oftware/brilliance/mx2mt/mt103/impl/Field56AGenerate.java
+70
-76
Field57AGenerate.java
...oftware/brilliance/mx2mt/mt103/impl/Field57AGenerate.java
+70
-83
Field59Generate.java
...software/brilliance/mx2mt/mt103/impl/Field59Generate.java
+53
-53
Field70Generate.java
...software/brilliance/mx2mt/mt103/impl/Field70Generate.java
+10
-26
Field71AGenerate.java
...oftware/brilliance/mx2mt/mt103/impl/Field71AGenerate.java
+22
-49
Field72Generate.java
...software/brilliance/mx2mt/mt103/impl/Field72Generate.java
+34
-75
Field77BGenerate.java
...oftware/brilliance/mx2mt/mt103/impl/Field77BGenerate.java
+23
-38
Mx2Mt940950Creator.java
...oftware/brilliance/mx2mt/mt940950/Mx2Mt940950Creator.java
+4
-3
StringUtil.java
.../java/com/prowidesoftware/brilliance/util/StringUtil.java
+26
-4
XmlUtil.java
...ain/java/com/prowidesoftware/brilliance/util/XmlUtil.java
+207
-0
MxPacs00800102.xml
src/main/resources/swiftXml/MxPacs00800102.xml
+173
-100
swift_mt_103.vm
src/main/resources/template/swift_mt_103.vm
+78
-136
No files found.
src/main/java/com/prowidesoftware/brilliance/constants/Mx2MtConstants.java
View file @
5736a006
...
@@ -35,6 +35,8 @@ public class Mx2MtConstants {
...
@@ -35,6 +35,8 @@ public class Mx2MtConstants {
public
static
final
String
MX_OBJECT
=
"mxObj"
;
public
static
final
String
MX_OBJECT
=
"mxObj"
;
public
static
final
String
MX_XML_DOCUMENT
=
"xmlDocument"
;
public
static
final
String
MT_TYPE
=
"mtType"
;
public
static
final
String
MT_TYPE
=
"mtType"
;
public
static
final
String
MT_IO_TYPE
=
"mtIOType"
;
public
static
final
String
MT_IO_TYPE
=
"mtIOType"
;
...
@@ -76,4 +78,10 @@ public class Mx2MtConstants {
...
@@ -76,4 +78,10 @@ public class Mx2MtConstants {
public
static
final
String
PHONIBK
=
"/PHONIBK/"
;
public
static
final
String
PHONIBK
=
"/PHONIBK/"
;
public
static
final
String
HEAD3_MT202_COVER
=
"{119:COV}"
;
public
static
final
String
HEAD3_MT202_COVER
=
"{119:COV}"
;
public
static
final
String
GRPHDR_PARENT_ELEMENT_NAME
=
"grpHdrParentElementName"
;
public
static
final
String
MAINBODY_PARENT_ELEMENT_NAME
=
"mainBodyParentElementName"
;
public
static
final
String
MT_TEMPLATE_NAME
=
"mtTemplateName"
;
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/AbstractMx2MtCreator.java
View file @
5736a006
...
@@ -4,9 +4,14 @@ import com.prowidesoftware.brilliance.constants.Mx2MtConstants;
...
@@ -4,9 +4,14 @@ import com.prowidesoftware.brilliance.constants.Mx2MtConstants;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.util.DateUtil
;
import
com.prowidesoftware.brilliance.util.DateUtil
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.brilliance.util.TemplateUtil
;
import
com.prowidesoftware.brilliance.util.XmlUtil
;
import
com.prowidesoftware.swift.model.mx.*
;
import
com.prowidesoftware.swift.model.mx.*
;
import
com.prowidesoftware.swift.model.mx.dic.GroupHeader42
;
import
com.prowidesoftware.swift.model.mx.dic.GroupHeader42
;
import
com.prowidesoftware.swift.model.mx.dic.Priority2Code
;
import
com.prowidesoftware.swift.model.mx.dic.Priority2Code
;
import
org.dom4j.Document
;
import
org.dom4j.DocumentException
;
import
org.dom4j.DocumentHelper
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -20,9 +25,18 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
...
@@ -20,9 +25,18 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
protected
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
protected
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
protected
AbstractMx2MtCreator
withXmlDocument
(
String
xmlStr
)
{
try
{
Document
document
=
DocumentHelper
.
parseText
(
xmlStr
);
map
.
put
(
Mx2MtConstants
.
MX_XML_DOCUMENT
,
document
);
return
this
;
}
catch
(
DocumentException
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
protected
AbstractMx2MtCreator
withObj
(
Object
obj
)
{
protected
AbstractMx2MtCreator
withObj
(
Object
obj
)
{
map
.
put
(
Mx2MtConstants
.
MX_OBJECT
,
obj
);
map
.
put
(
Mx2MtConstants
.
MX_OBJECT
,
obj
);
map
.
put
(
Mx2MtConstants
.
MT_IO_TYPE
,
Mx2MtConstants
.
MT_IO_TYPE_OUTPUT
);
return
this
;
return
this
;
}
}
...
@@ -39,6 +53,9 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
...
@@ -39,6 +53,9 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
map
.
put
(
key
,
value
);
map
.
put
(
key
,
value
);
});
});
}
}
if
(!
map
.
containsKey
(
Mx2MtConstants
.
MT_IO_TYPE
))
{
map
.
put
(
Mx2MtConstants
.
MT_IO_TYPE
,
Mx2MtConstants
.
MT_IO_TYPE_OUTPUT
);
//default value is O
}
return
this
;
return
this
;
}
}
...
@@ -82,6 +99,14 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
...
@@ -82,6 +99,14 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
return
priority
;
return
priority
;
}
}
protected
String
getXmlNodeValue
(
String
type
,
Document
document
,
String
path
)
{
String
parentPath
=
(
String
)
map
.
get
(
type
);
if
(
StringUtil
.
isNotEmpty
(
parentPath
))
{
path
=
parentPath
+
"."
+
path
;
}
return
XmlUtil
.
getXmlNodeValue
(
document
,
path
);
}
protected
String
processBicCode
(
String
bicCode
)
{
protected
String
processBicCode
(
String
bicCode
)
{
String
processedBicCode
=
""
;
String
processedBicCode
=
""
;
if
(!
StringUtil
.
isEmpty
(
bicCode
))
{
if
(!
StringUtil
.
isEmpty
(
bicCode
))
{
...
@@ -97,6 +122,11 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
...
@@ -97,6 +122,11 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
}
}
protected
abstract
String
getMtType
();
protected
abstract
String
getMtType
();
@Override
public
void
preProcess
()
{
}
/**
/**
* process method
* process method
*/
*/
...
@@ -179,4 +209,16 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
...
@@ -179,4 +209,16 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
public
void
generateHead5
()
{
public
void
generateHead5
()
{
map
.
put
(
"head5"
,
""
);
map
.
put
(
"head5"
,
""
);
}
}
@Override
public
void
postProcess
()
{
}
public
String
generateMtMsg
()
{
String
outPutFilePath
=
(
String
)
map
.
get
(
Mx2MtConstants
.
OUT_PUT_FILE_PATH
);
String
mtTemplateName
=
(
String
)
map
.
get
(
Mx2MtConstants
.
MT_TEMPLATE_NAME
);
String
msg
=
TemplateUtil
.
makeFileByTemplate
(
mtTemplateName
,
map
,
outPutFilePath
,
"utf-8"
);
return
msg
;
}
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/AbstractMx2MtFieldsGenerate.java
View file @
5736a006
...
@@ -3,8 +3,10 @@ package com.prowidesoftware.brilliance.mx2mt;
...
@@ -3,8 +3,10 @@ package com.prowidesoftware.brilliance.mx2mt;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.brilliance.util.XmlUtil
;
import
com.prowidesoftware.swift.model.mx.dic.CashAccount16
;
import
com.prowidesoftware.swift.model.mx.dic.CashAccount16
;
import
com.prowidesoftware.swift.model.mx.dic.GenericAccountIdentification1
;
import
com.prowidesoftware.swift.model.mx.dic.GenericAccountIdentification1
;
import
org.dom4j.Document
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -16,6 +18,22 @@ public abstract class AbstractMx2MtFieldsGenerate implements Mx2MtFieldsGenerate
...
@@ -16,6 +18,22 @@ public abstract class AbstractMx2MtFieldsGenerate implements Mx2MtFieldsGenerate
map
=
targetMap
;
map
=
targetMap
;
}
}
protected
String
getXmlNodeValue
(
String
type
,
Document
document
,
String
path
)
{
String
parentPath
=
(
String
)
map
.
get
(
type
);
if
(
StringUtil
.
isNotEmpty
(
parentPath
))
{
path
=
parentPath
+
"."
+
path
;
}
return
XmlUtil
.
getXmlNodeValue
(
document
,
path
);
}
protected
int
getXmlNodeCounts
(
String
type
,
Document
document
,
String
path
)
{
String
parentPath
=
(
String
)
map
.
get
(
type
);
if
(
StringUtil
.
isNotEmpty
(
parentPath
))
{
path
=
parentPath
+
"."
+
path
;
}
return
XmlUtil
.
getChildrenCount
(
document
,
path
,
null
);
}
protected
String
getMtFormatAccount
(
CashAccount16
dbtrAcct
)
{
protected
String
getMtFormatAccount
(
CashAccount16
dbtrAcct
)
{
String
account
=
""
;
String
account
=
""
;
String
iban
=
""
;
String
iban
=
""
;
...
...
src/main/java/com/prowidesoftware/brilliance/mx2mt/Mx2MtCreateManager.java
View file @
5736a006
...
@@ -4,7 +4,7 @@ import com.prowidesoftware.brilliance.exception.SwiftException;
...
@@ -4,7 +4,7 @@ import com.prowidesoftware.brilliance.exception.SwiftException;
import
com.prowidesoftware.brilliance.mx2mt.mt103.Mx2Mt103Creator
;
import
com.prowidesoftware.brilliance.mx2mt.mt103.Mx2Mt103Creator
;
import
com.prowidesoftware.brilliance.mx2mt.mt202cov202.Mx2Mt202Creator
;
import
com.prowidesoftware.brilliance.mx2mt.mt202cov202.Mx2Mt202Creator
;
import
com.prowidesoftware.brilliance.mx2mt.mt900910.Mx2Mt900910Creator
;
import
com.prowidesoftware.brilliance.mx2mt.mt900910.Mx2Mt900910Creator
;
import
com.prowidesoftware.brilliance.mx2mt.mt940950.Mx2Mt950Creator
;
import
com.prowidesoftware.brilliance.mx2mt.mt940950.Mx2Mt9
409
50Creator
;
import
com.prowidesoftware.swift.model.mx.AbstractMX
;
import
com.prowidesoftware.swift.model.mx.AbstractMX
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.FileUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -13,7 +13,6 @@ import org.slf4j.LoggerFactory;
...
@@ -13,7 +13,6 @@ import org.slf4j.LoggerFactory;
import
java.io.File
;
import
java.io.File
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Random
;
public
class
Mx2MtCreateManager
{
public
class
Mx2MtCreateManager
{
...
@@ -23,6 +22,8 @@ public class Mx2MtCreateManager {
...
@@ -23,6 +22,8 @@ public class Mx2MtCreateManager {
private
Object
mxObj
=
null
;
private
Object
mxObj
=
null
;
private
String
xmlStr
=
""
;
public
String
getMsgType
()
{
public
String
getMsgType
()
{
return
msgType
;
return
msgType
;
}
}
...
@@ -43,11 +44,12 @@ public class Mx2MtCreateManager {
...
@@ -43,11 +44,12 @@ public class Mx2MtCreateManager {
AbstractMX
abstractMX
=
AbstractMX
.
parse
(
xmlStr
);
AbstractMX
abstractMX
=
AbstractMX
.
parse
(
xmlStr
);
msgType
=
(
abstractMX
.
getMxId
().
getBusinessProcess
().
name
()
msgType
=
(
abstractMX
.
getMxId
().
getBusinessProcess
().
name
()
+
abstractMX
.
getMxId
().
getFunctionality
()
+
abstractMX
.
getMxId
().
getFunctionality
()
+
abstractMX
.
getMxId
().
getVariant
()
+
abstractMX
.
getMxId
().
getVariant
()
)
+
abstractMX
.
getMxId
().
getVersion
())
//
+ abstractMX.getMxId().getVersion())
.
trim
()
.
trim
()
.
replace
(
"."
,
""
);
.
replace
(
"."
,
""
);
mxObj
=
abstractMX
;
mxObj
=
abstractMX
;
this
.
xmlStr
=
xmlStr
;
}
}
public
String
mx2mt
(
File
file
,
String
outPutFilePath
,
Map
<
String
,
Object
>
extraMap
)
throws
Exception
{
public
String
mx2mt
(
File
file
,
String
outPutFilePath
,
Map
<
String
,
Object
>
extraMap
)
throws
Exception
{
...
@@ -79,7 +81,8 @@ public class Mx2MtCreateManager {
...
@@ -79,7 +81,8 @@ public class Mx2MtCreateManager {
public
String
convert
(
String
outPutFilePath
,
Map
<
String
,
Object
>
extraMap
)
throws
SwiftException
{
public
String
convert
(
String
outPutFilePath
,
Map
<
String
,
Object
>
extraMap
)
throws
SwiftException
{
AbstractMx2MtCreator
creator
=
getMx2MtCreator
(
msgType
);
AbstractMx2MtCreator
creator
=
getMx2MtCreator
(
msgType
);
creator
.
withObj
(
mxObj
).
withOutPutFilePath
(
outPutFilePath
).
withExtraMap
(
extraMap
);
creator
.
withXmlDocument
(
xmlStr
).
withObj
(
mxObj
).
withOutPutFilePath
(
outPutFilePath
).
withExtraMap
(
extraMap
);
creator
.
preProcess
();
creator
.
generateHead1
();
creator
.
generateHead1
();
creator
.
generateHead2
();
creator
.
generateHead2
();
creator
.
generateHead3
();
creator
.
generateHead3
();
...
@@ -90,17 +93,18 @@ public class Mx2MtCreateManager {
...
@@ -90,17 +93,18 @@ public class Mx2MtCreateManager {
fieldsGenerate
.
fieldsGenerate
();
fieldsGenerate
.
fieldsGenerate
();
}
}
creator
.
generateHead5
();
creator
.
generateHead5
();
creator
.
postProcess
();
return
creator
.
generateMtMsg
();
return
creator
.
generateMtMsg
();
}
}
public
AbstractMx2MtCreator
getMx2MtCreator
(
String
msgType
)
throws
SwiftException
{
public
AbstractMx2MtCreator
getMx2MtCreator
(
String
msgType
)
throws
SwiftException
{
if
(
"pacs008001
02
"
.
equals
(
msgType
))
{
if
(
"pacs008001"
.
equals
(
msgType
))
{
return
new
Mx2Mt103Creator
();
return
new
Mx2Mt103Creator
();
}
else
if
(
"pacs009001
02
"
.
equals
(
msgType
)){
}
else
if
(
"pacs009001"
.
equals
(
msgType
)){
return
new
Mx2Mt202Creator
();
return
new
Mx2Mt202Creator
();
}
else
if
(
"camt05300102"
.
equals
(
msgType
))
{
}
else
if
(
"camt053001"
.
equals
(
msgType
))
{
return
new
Mx2Mt950Creator
();
return
new
Mx2Mt9
409
50Creator
();
}
else
if
(
"camt054001
02"
.
equals
(
msgType
))
{
}
else
if
(
"camt054001
"
.
equals
(
msgType
))
{
return
new
Mx2Mt900910Creator
();
return
new
Mx2Mt900910Creator
();
}
else
{
}
else
{
throw
new
SwiftException
(
"Invalid message type"
);
throw
new
SwiftException
(
"Invalid message type"
);
...
...
src/main/java/com/prowidesoftware/brilliance/mx2mt/Mx2MtCreator.java
View file @
5736a006
...
@@ -4,6 +4,11 @@ import java.util.List;
...
@@ -4,6 +4,11 @@ import java.util.List;
public
interface
Mx2MtCreator
{
public
interface
Mx2MtCreator
{
/**
/**
* prepare data
*/
public
void
preProcess
();
/**
* generate {1:}
* generate {1:}
*/
*/
public
void
generateHead1
();
public
void
generateHead1
();
...
@@ -28,5 +33,10 @@ public interface Mx2MtCreator {
...
@@ -28,5 +33,10 @@ public interface Mx2MtCreator {
*/
*/
public
void
generateHead5
();
public
void
generateHead5
();
public
String
generateMtMsg
();
/**
* Contains the following features
* validate
* special process
*/
public
void
postProcess
();
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/Mx2Mt103Creator.java
View file @
5736a006
package
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
;
package
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtCreator
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtCreator
;
import
com.prowidesoftware.brilliance.mx2mt.Mx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.Mx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.mt103.impl.*
;
import
com.prowidesoftware.brilliance.mx2mt.mt103.impl.*
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.brilliance.util.TemplateUtil
;
import
com.prowidesoftware.brilliance.util.TemplateUtil
;
import
com.prowidesoftware.brilliance.util.XmlUtil
;
import
org.dom4j.Document
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
public
class
Mx2Mt103Creator
extends
AbstractMx2MtCreator
{
public
class
Mx2Mt103Creator
extends
AbstractMx2MtCreator
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Mx2Mt103Creator
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Mx2Mt103Creator
.
class
);
/**
* Object MxPacs00800102
@Override
* receiverBic
public
void
preProcess
()
{
* senderBic
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
* field20
Map
<
String
,
String
>
parentElementMaps
=
XmlUtil
.
getParentElementMaps
(
document
);
* field13C
map
.
put
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
parentElementMaps
.
get
(
"GrpHdr"
));
* field23B
map
.
put
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
parentElementMaps
.
get
(
"CdtTrfTxInf"
));
* field23E
map
.
put
(
Mx2MtConstants
.
MT_TEMPLATE_NAME
,
"swift_mt_103.vm"
);
* field26T
}
* field32A
* field33B
@Override
* field36
public
void
generateHead3
()
{
* field50A
try
{
* field50F
String
head3
=
""
;
* field50K
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
* field51A
String
uetr
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.PmtId.UETR"
);
* field52A
if
(
StringUtil
.
isNotEmpty
(
uetr
))
{
* field52D
head3
+=
"{121:"
+
uetr
+
"}"
;
* field53A
}
* field53B
map
.
put
(
"head3"
,
head3
);
* field53D
}
catch
(
Exception
e
)
{
* field54A
throw
new
SwiftException
(
e
.
getMessage
());
* field54D
}
* field55A
}
* field55D
* field56A
* field56C
* field56D
* field57A
* field57C
* field57D
* field59
* field59A
* field70
* field71A
* field71F
* field71G
* field72
* field77B
* @return
*/
@Override
@Override
public
List
<
Mx2MtFieldsGenerate
>
getFieldsGenerateList
()
{
public
List
<
Mx2MtFieldsGenerate
>
getFieldsGenerateList
()
{
List
<
Mx2MtFieldsGenerate
>
fieldsGenerateList
=
new
ArrayList
<>();
List
<
Mx2MtFieldsGenerate
>
fieldsGenerateList
=
new
ArrayList
<>();
...
@@ -66,6 +55,7 @@ public class Mx2Mt103Creator extends AbstractMx2MtCreator {
...
@@ -66,6 +55,7 @@ public class Mx2Mt103Creator extends AbstractMx2MtCreator {
fieldsGenerateList
.
add
(
new
Field33BGenerate
());
fieldsGenerateList
.
add
(
new
Field33BGenerate
());
fieldsGenerateList
.
add
(
new
Field36Generate
());
fieldsGenerateList
.
add
(
new
Field36Generate
());
fieldsGenerateList
.
add
(
new
Field50AGenerate
());
fieldsGenerateList
.
add
(
new
Field50AGenerate
());
fieldsGenerateList
.
add
(
new
Field51AGenerate
());
fieldsGenerateList
.
add
(
new
Field52AGenerate
());
fieldsGenerateList
.
add
(
new
Field52AGenerate
());
fieldsGenerateList
.
add
(
new
Field53AGenerate
());
fieldsGenerateList
.
add
(
new
Field53AGenerate
());
fieldsGenerateList
.
add
(
new
Field54AGenerate
());
fieldsGenerateList
.
add
(
new
Field54AGenerate
());
...
@@ -81,15 +71,8 @@ public class Mx2Mt103Creator extends AbstractMx2MtCreator {
...
@@ -81,15 +71,8 @@ public class Mx2Mt103Creator extends AbstractMx2MtCreator {
}
}
@Override
@Override
public
String
generateMtMsg
()
{
public
void
postProcess
()
{
map
.
forEach
((
key
,
value
)->{
//TODO validate
if
(!
Mx2MtConstants
.
MX_OBJECT
.
equals
(
key
))
{
logger
.
info
(
key
+
"-"
+
value
);
}
});
String
outPutFilePath
=
(
String
)
map
.
get
(
Mx2MtConstants
.
OUT_PUT_FILE_PATH
);
String
msg
=
TemplateUtil
.
makeFileByTemplate
(
"swift_mt_103.vm"
,
map
,
outPutFilePath
,
"utf-8"
);
return
msg
;
}
}
@Override
@Override
...
...
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field13CGenerate.java
View file @
5736a006
...
@@ -5,12 +5,12 @@ import com.prowidesoftware.brilliance.constants.Mx2MtConstants;
...
@@ -5,12 +5,12 @@ import com.prowidesoftware.brilliance.constants.Mx2MtConstants;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.util.DateUtil
;
import
com.prowidesoftware.brilliance.util.DateUtil
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.swift.model.mx.dic.CreditTransferTransactionInformation11
;
import
org.dom4j.Document
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
javax.xml.datatype.DatatypeFactory
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -19,44 +19,30 @@ public class Field13CGenerate extends AbstractMx2MtFieldsGenerate {
...
@@ -19,44 +19,30 @@ public class Field13CGenerate extends AbstractMx2MtFieldsGenerate {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Field13CGenerate
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Field13CGenerate
.
class
);
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
logger
.
info
(
"Field13CGenerate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
return
;
}
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
List
<
CreditTransferTransactionInformation11
>
cdtTrfTxInf
=
fiToFICstmrCdtTrf
.
getCdtTrfTxInf
();
List
<
String
>
filed13cList
=
new
ArrayList
<>();
List
<
String
>
filed13cList
=
new
ArrayList
<>();
if
(
cdtTrfTxInf
!=
null
&&
cdtTrfTxInf
.
size
()
>
0
){
String
dbtDtTmStr
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.SttlmTmIndctn.DbtDtTm"
);
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
if
(
StringUtil
.
isNotEmpty
(
dbtDtTmStr
))
{
&&
cdtTrfTxInf
.
get
(
0
).
getSttlmTmIndctn
()
!=
null
){
XMLGregorianCalendar
dbtDtTm
=
DatatypeFactory
.
newInstance
().
newXMLGregorianCalendar
(
dbtDtTmStr
);
if
(
cdtTrfTxInf
.
get
(
0
).
getSttlmTmIndctn
().
getDbtDtTm
()
!=
null
){
String
hourTime
=
DateUtil
.
format
(
dbtDtTm
,
"HHmm"
);
XMLGregorianCalendar
dbtDtTm
=
cdtTrfTxInf
.
get
(
0
).
getSttlmTmIndctn
().
getDbtDtTm
();
filed13cList
.
add
(
"/SNDTIME/"
+
hourTime
+
"+0800"
);
String
hmm
=
DateUtil
.
format
(
dbtDtTm
,
"HHmm"
);
}
filed13cList
.
add
(
"/SNDTIME/"
+
hmm
+
"+0800"
);
String
cdtDtTmStr
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.SttlmTmIndctn.CdtDtTm"
);
}
if
(
StringUtil
.
isNotEmpty
(
cdtDtTmStr
))
{
if
(
cdtTrfTxInf
.
get
(
0
).
getSttlmTmIndctn
().
getCdtDtTm
()
!=
null
){
XMLGregorianCalendar
cdtDtTm
=
DatatypeFactory
.
newInstance
().
newXMLGregorianCalendar
(
cdtDtTmStr
);
XMLGregorianCalendar
dbtDtTm
=
cdtTrfTxInf
.
get
(
0
).
getSttlmTmIndctn
().
getCdtDtTm
();
String
hourTime
=
DateUtil
.
format
(
cdtDtTm
,
"HHmm"
);
String
hmm
=
DateUtil
.
format
(
dbtDtTm
,
"HHmm"
);
filed13cList
.
add
(
"/RNCTIME/"
+
hourTime
+
"+0800"
);
filed13cList
.
add
(
"/RNCTIME/"
+
hmm
+
"+0800"
);
}
if
(
cdtTrfTxInf
.
get
(
0
).
getSttlmTmReq
().
getCLSTm
()
!=
null
){
XMLGregorianCalendar
dbtDtTm
=
cdtTrfTxInf
.
get
(
0
).
getSttlmTmReq
().
getCLSTm
();
String
hmm
=
DateUtil
.
format
(
dbtDtTm
,
"HHmm"
);
filed13cList
.
add
(
"/CLSTIME/"
+
hmm
+
"+0800"
);
}
}
}
}
if
(
filed13cList
.
size
()
>
0
)
{
String
clsDtTmStr
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.SttlmTmReq.CLSTm"
);
filed13cList
.
forEach
(
filed13c
->
logger
.
info
(
":13c:"
+
filed13c
));
if
(
StringUtil
.
isNotEmpty
(
clsDtTmStr
))
{
map
.
put
(
"filed13CList"
,
filed13cList
);
XMLGregorianCalendar
clsDtTm
=
DatatypeFactory
.
newInstance
().
newXMLGregorianCalendar
(
clsDtTmStr
);
String
hourTime
=
DateUtil
.
format
(
clsDtTm
,
"HHmm"
);
filed13cList
.
add
(
"/CLSTIME/"
+
hourTime
+
"+0800"
);
}
}
map
.
put
(
"field13CList"
,
filed13cList
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
e
.
printStackTrace
();
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field13C error"
);
}
}
}
}
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field20Generate.java
View file @
5736a006
...
@@ -3,9 +3,7 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
...
@@ -3,9 +3,7 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
org.dom4j.Document
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
com.prowidesoftware.swift.model.mx.dic.GroupHeader33
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -17,20 +15,12 @@ public class Field20Generate extends AbstractMx2MtFieldsGenerate {
...
@@ -17,20 +15,12 @@ public class Field20Generate extends AbstractMx2MtFieldsGenerate {
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
logger
.
info
(
"Field20Generate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
String
msgId
=
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.MsgId"
);
return
;
map
.
put
(
"field20"
,
msgId
);
}
}
catch
(
Exception
e
)
{
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
GroupHeader33
grpHdr
=
fiToFICstmrCdtTrf
.
getGrpHdr
();
map
.
put
(
"field20"
,
grpHdr
.
getMsgId
());
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field20 error"
);
}
}
}
}
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field23BGenerate.java
View file @
5736a006
...
@@ -3,14 +3,10 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
...
@@ -3,14 +3,10 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
org.dom4j.Document
;
import
com.prowidesoftware.swift.model.mx.dic.CreditTransferTransactionInformation11
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.List
;
/**
/**
* 若<Cd>节点值为“SDVA”,则取默认值“CRED”,否则直接取<Prtry>节点作为23B的值
* 若<Cd>节点值为“SDVA”,则取默认值“CRED”,否则直接取<Prtry>节点作为23B的值
* <CdtTrfTxInf>[1]<PmtTpInf><SvcLvl><Cd>
* <CdtTrfTxInf>[1]<PmtTpInf><SvcLvl><Cd>
...
@@ -21,31 +17,14 @@ public class Field23BGenerate extends AbstractMx2MtFieldsGenerate {
...
@@ -21,31 +17,14 @@ public class Field23BGenerate extends AbstractMx2MtFieldsGenerate {
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
logger
.
info
(
"Field23BGenerate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
String
field23B
=
""
;
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
return
;
String
cd
=
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.PmtTpInf.SvcLvl.Cd"
);
}
field23B
=
"SDVA"
.
equals
(
cd
)
?
"CRED"
:
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.PmtTpInf.SvcLvl.Prtry"
);
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
map
.
put
(
"field23B"
,
field23B
);
List
<
CreditTransferTransactionInformation11
>
cdtTrfTxInf
=
fiToFICstmrCdtTrf
.
getCdtTrfTxInf
();
}
catch
(
Exception
e
)
{
if
(
cdtTrfTxInf
!=
null
&&
cdtTrfTxInf
.
size
()
>
0
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
&&
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getPmtTpInf
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getPmtTpInf
().
getSvcLvl
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getPmtTpInf
().
getSvcLvl
().
getCd
()
!=
null
)
{
String
field23B_cd
=
cdtTrfTxInf
.
get
(
0
).
getPmtTpInf
().
getSvcLvl
().
getCd
();
if
(
"SDVA"
.
equals
(
field23B_cd
))
{
map
.
put
(
"field23B"
,
"CRED"
);
}
else
if
(
cdtTrfTxInf
.
get
(
0
).
getPmtTpInf
().
getSvcLvl
().
getPrtry
()
!=
null
){
String
prtry
=
cdtTrfTxInf
.
get
(
0
).
getPmtTpInf
().
getSvcLvl
().
getPrtry
();
map
.
put
(
"field23B"
,
prtry
);
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field23B error"
);
}
}
}
}
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field23EGenerate.java
View file @
5736a006
...
@@ -3,9 +3,8 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
...
@@ -3,9 +3,8 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.swift.model.mx.dic.CreditTransferTransactionInformation11
;
import
org.dom4j.Document
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -27,50 +26,31 @@ public class Field23EGenerate extends AbstractMx2MtFieldsGenerate {
...
@@ -27,50 +26,31 @@ public class Field23EGenerate extends AbstractMx2MtFieldsGenerate {
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
logger
.
info
(
"Field23EGenerate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
List
<
String
>
field23EList
=
new
ArrayList
<>();
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
return
;
String
svclvlCd
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.PmtTpInf.SvcLvl.Cd"
);
if
(
"SDVA"
.
equals
(
svclvlCd
))
{
field23EList
.
add
(
svclvlCd
);
}
}
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
String
ctgyPurpCd
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.PmtTpInf.CtgyPurp.Cd"
);
List
<
CreditTransferTransactionInformation11
>
cdtTrfTxInf
=
fiToFICstmrCdtTrf
.
getCdtTrfTxInf
();
if
(
StringUtil
.
isNotEmpty
(
ctgyPurpCd
))
{
List
<
String
>
field23EList
=
new
ArrayList
<
String
>();
field23EList
.
add
(
ctgyPurpCd
);
if
(
cdtTrfTxInf
!=
null
&&
cdtTrfTxInf
.
size
()
>
0
){
}
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
String
instrForCdtrAgtCd
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.InstrForCdtrAgt.Cd"
);
&&
cdtTrfTxInf
.
get
(
0
).
getPmtTpInf
()
!=
null
if
(
StringUtil
.
isNotEmpty
(
instrForCdtrAgtCd
))
{
&&
cdtTrfTxInf
.
get
(
0
).
getPmtTpInf
().
getSvcLvl
()
!=
null
String
instrInf
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.InstrForCdtrAgt.InstrInf"
);
&&
cdtTrfTxInf
.
get
(
0
).
getPmtTpInf
().
getSvcLvl
().
getCd
()
!=
null
){
if
(
StringUtil
.
isNotEmpty
(
instrInf
))
{
String
field23E_cd
=
cdtTrfTxInf
.
get
(
0
).
getPmtTpInf
().
getSvcLvl
().
getCd
();
if
(
instrInf
.
length
()
>
30
)
{
if
(
"SDVA"
.
equals
(
field23E_cd
))
{
instrInf
=
instrInf
.
substring
(
0
,
30
);
field23EList
.
add
(
"SDVA"
);
}
if
(
cdtTrfTxInf
.
get
(
0
).
getPmtTpInf
().
getCtgyPurp
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getPmtTpInf
().
getCtgyPurp
().
getCd
()
!=
null
){
String
field23E
=
cdtTrfTxInf
.
get
(
0
).
getPmtTpInf
().
getCtgyPurp
().
getCd
();
field23EList
.
add
(
field23E
);
}
if
(
cdtTrfTxInf
.
get
(
0
).
getInstrForCdtrAgt
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getInstrForCdtrAgt
().
size
()
>
0
&&
cdtTrfTxInf
.
get
(
0
).
getInstrForCdtrAgt
().
get
(
0
)
!=
null
)
{
if
(
cdtTrfTxInf
.
get
(
0
).
getInstrForCdtrAgt
().
get
(
0
).
getCd
()
!=
null
)
{
String
field23E
=
cdtTrfTxInf
.
get
(
0
).
getInstrForCdtrAgt
().
get
(
0
).
getCd
().
value
();
field23EList
.
add
(
field23E
);
}
if
(
cdtTrfTxInf
.
get
(
0
).
getInstrForCdtrAgt
().
get
(
0
).
getInstrInf
()
!=
null
)
{
String
field23E
=
cdtTrfTxInf
.
get
(
0
).
getInstrForCdtrAgt
().
get
(
0
).
getInstrInf
();
field23EList
.
add
(
field23E
);
}
}
}
instrForCdtrAgtCd
+=
"/"
+
instrInf
;
}
}
field23EList
.
add
(
instrForCdtrAgtCd
);
}
}
if
(
field23EList
.
size
()
>
0
)
{
map
.
put
(
"field23EList"
,
field23EList
);
field23EList
.
forEach
(
field23E
->
logger
.
info
(
":23E:"
+
field23E
));
}
catch
(
Exception
e
)
{
map
.
put
(
"field23EList"
,
field23EList
);
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field23E error"
);
}
}
}
}
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field26TGenerate.java
View file @
5736a006
...
@@ -3,14 +3,10 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
...
@@ -3,14 +3,10 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
org.dom4j.Document
;
import
com.prowidesoftware.swift.model.mx.dic.CreditTransferTransactionInformation11
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.List
;
/**
/**
* <CdtTrfTxInf>[1]<Purp><Prtry>
* <CdtTrfTxInf>[1]<Purp><Prtry>
...
@@ -20,26 +16,13 @@ public class Field26TGenerate extends AbstractMx2MtFieldsGenerate {
...
@@ -20,26 +16,13 @@ public class Field26TGenerate extends AbstractMx2MtFieldsGenerate {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
.
impl
.
Field26TGenerate
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
.
impl
.
Field26TGenerate
.
class
);
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
logger
.
info
(
"Field26TGenerate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
String
field26T
=
""
;
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
return
;
field26T
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.Purp.Prtry"
);
}
map
.
put
(
"field26T"
,
field26T
);
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
}
catch
(
Exception
e
)
{
List
<
CreditTransferTransactionInformation11
>
cdtTrfTxInf
=
fiToFICstmrCdtTrf
.
getCdtTrfTxInf
();
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
if
(
cdtTrfTxInf
!=
null
&&
cdtTrfTxInf
.
size
()
>
0
){
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getPurp
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getPurp
().
getPrtry
()
!=
null
){
String
field26T
=
cdtTrfTxInf
.
get
(
0
).
getPurp
().
getPrtry
();
map
.
put
(
"field26T"
,
field26T
);
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field26T error"
);
}
}
}
}
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field32AGenerate.java
View file @
5736a006
...
@@ -6,15 +6,13 @@ import com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate;
...
@@ -6,15 +6,13 @@ import com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate;
import
com.prowidesoftware.brilliance.util.DateUtil
;
import
com.prowidesoftware.brilliance.util.DateUtil
;
import
com.prowidesoftware.brilliance.util.NumberUtil
;
import
com.prowidesoftware.brilliance.util.NumberUtil
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
org.dom4j.Document
;
import
com.prowidesoftware.swift.model.mx.dic.CreditTransferTransactionInformation11
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
javax.xml.datatype.DatatypeFactory
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.List
;
public
class
Field32AGenerate
extends
AbstractMx2MtFieldsGenerate
{
public
class
Field32AGenerate
extends
AbstractMx2MtFieldsGenerate
{
...
@@ -22,47 +20,26 @@ public class Field32AGenerate extends AbstractMx2MtFieldsGenerate {
...
@@ -22,47 +20,26 @@ public class Field32AGenerate extends AbstractMx2MtFieldsGenerate {
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
logger
.
info
(
"Field32AGenerate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
String
intrBkSttlmDtStr
=
""
;
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
String
intrBkSttlmAmt
=
""
;
return
;
String
intrBkSttlmccy
=
""
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
String
intrBkSttlmDtValue
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.IntrBkSttlmDt"
);
if
(
StringUtil
.
isNotEmpty
(
intrBkSttlmDtValue
))
{
XMLGregorianCalendar
intrBkSttlmDt
=
DatatypeFactory
.
newInstance
().
newXMLGregorianCalendar
(
intrBkSttlmDtValue
);
intrBkSttlmDtStr
=
DateUtil
.
format
(
intrBkSttlmDt
,
"yyMMdd"
);
}
}
String
month
=
""
;
String
amt
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.IntrBkSttlmAmt"
);
String
day
=
""
;
String
ccy
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.IntrBkSttlmAmt@Ccy"
);
String
year
=
""
;
if
(
StringUtil
.
isNotEmpty
(
amt
)
&&
StringUtil
.
isNotEmpty
(
ccy
))
{
if
(
obj
.
getFIToFICstmrCdtTrf
().
getCdtTrfTxInf
()
!=
null
intrBkSttlmAmt
=
NumberUtil
.
formatAmt
(
new
BigDecimal
(
amt
),
ccy
);
&&
obj
.
getFIToFICstmrCdtTrf
().
getCdtTrfTxInf
().
size
()
>
0
intrBkSttlmccy
=
ccy
;
&&
obj
.
getFIToFICstmrCdtTrf
().
getCdtTrfTxInf
().
get
(
0
)
!=
null
&&
obj
.
getFIToFICstmrCdtTrf
().
getCdtTrfTxInf
().
get
(
0
).
getIntrBkSttlmDt
()
!=
null
){
month
=
String
.
valueOf
(
obj
.
getFIToFICstmrCdtTrf
().
getCdtTrfTxInf
().
get
(
0
).
getIntrBkSttlmDt
().
getMonth
());
day
=
String
.
valueOf
(
obj
.
getFIToFICstmrCdtTrf
().
getCdtTrfTxInf
().
get
(
0
).
getIntrBkSttlmDt
().
getDay
());
year
=
String
.
valueOf
(
obj
.
getFIToFICstmrCdtTrf
().
getCdtTrfTxInf
().
get
(
0
).
getIntrBkSttlmDt
().
getYear
())
+
StringUtil
.
fillWithChar
(
month
,
"0"
,
"left"
,
2
)
+
StringUtil
.
fillWithChar
(
day
,
"0"
,
"left"
,
2
);
}
}
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
map
.
put
(
"field32A"
,
intrBkSttlmDtStr
+
intrBkSttlmccy
+
intrBkSttlmAmt
);
List
<
CreditTransferTransactionInformation11
>
cdtTrfTxInf
=
fiToFICstmrCdtTrf
.
getCdtTrfTxInf
();
}
catch
(
Exception
e
)
{
if
(
cdtTrfTxInf
!=
null
&&
cdtTrfTxInf
.
size
()
>
0
){
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getIntrBkSttlmAmt
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getIntrBkSttlmAmt
().
getCcy
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getIntrBkSttlmAmt
().
getValue
()
!=
null
){
String
yymMdd
=
""
;
if
(
cdtTrfTxInf
.
get
(
0
).
getIntrBkSttlmDt
()
!=
null
){
XMLGregorianCalendar
dt
=
cdtTrfTxInf
.
get
(
0
).
getIntrBkSttlmDt
();
yymMdd
=
DateUtil
.
format
(
dt
,
"yyMMdd"
);
}
String
ccy
=
cdtTrfTxInf
.
get
(
0
).
getIntrBkSttlmAmt
().
getCcy
();
BigDecimal
amt
=
cdtTrfTxInf
.
get
(
0
).
getIntrBkSttlmAmt
().
getValue
();
String
amtStr
=
NumberUtil
.
formatAmt
(
amt
,
ccy
);
map
.
put
(
"field32A"
,
yymMdd
+
ccy
+
amtStr
);
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field32A error"
);
}
}
}
}
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field33BGenerate.java
View file @
5736a006
...
@@ -4,42 +4,29 @@ import com.prowidesoftware.brilliance.constants.Mx2MtConstants;
...
@@ -4,42 +4,29 @@ import com.prowidesoftware.brilliance.constants.Mx2MtConstants;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.util.NumberUtil
;
import
com.prowidesoftware.brilliance.util.NumberUtil
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.swift.model.mx.dic.CreditTransferTransactionInformation11
;
import
org.dom4j.Document
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.List
;
public
class
Field33BGenerate
extends
AbstractMx2MtFieldsGenerate
{
public
class
Field33BGenerate
extends
AbstractMx2MtFieldsGenerate
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Field33BGenerate
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Field33BGenerate
.
class
);
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
logger
.
info
(
"Field33BGenerate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
String
field33B
=
""
;
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
return
;
String
amt
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.InstdAmt"
);
String
ccy
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.InstdAmt@Ccy"
);
if
(
StringUtil
.
isNotEmpty
(
amt
)
&&
StringUtil
.
isNotEmpty
(
ccy
))
{
field33B
=
ccy
+
NumberUtil
.
formatAmt
(
new
BigDecimal
(
amt
),
ccy
);
}
}
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
map
.
put
(
"field33B"
,
field33B
);
List
<
CreditTransferTransactionInformation11
>
cdtTrfTxInf
=
fiToFICstmrCdtTrf
.
getCdtTrfTxInf
();
}
catch
(
Exception
e
)
{
if
(
cdtTrfTxInf
!=
null
&&
cdtTrfTxInf
.
size
()
>
0
){
throw
new
SwiftException
(
e
.
getMessage
());
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getIntrBkSttlmAmt
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getIntrBkSttlmAmt
().
getCcy
()
!=
null
){
String
ccy
=
cdtTrfTxInf
.
get
(
0
).
getIntrBkSttlmAmt
().
getCcy
();
BigDecimal
amt
=
cdtTrfTxInf
.
get
(
0
).
getIntrBkSttlmAmt
().
getValue
();
String
amtStr
=
NumberUtil
.
formatAmt
(
amt
,
ccy
);
map
.
put
(
"field33B"
,
ccy
+
amtStr
);
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field33B error"
);
}
}
}
}
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field36Generate.java
View file @
5736a006
...
@@ -3,38 +3,25 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
...
@@ -3,38 +3,25 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.swift.model.mx.dic.CreditTransferTransactionInformation11
;
import
org.dom4j.Document
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.math.BigDecimal
;
import
java.util.List
;
public
class
Field36Generate
extends
AbstractMx2MtFieldsGenerate
{
public
class
Field36Generate
extends
AbstractMx2MtFieldsGenerate
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Field36Generate
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Field36Generate
.
class
);
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
logger
.
info
(
"Field36Generate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
String
field36
=
""
;
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
return
;
String
exchangeRate
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.XchgRate"
);
}
if
(
StringUtil
.
isNotEmpty
(
exchangeRate
))
{
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
field36
=
exchangeRate
.
replace
(
"."
,
","
);
List
<
CreditTransferTransactionInformation11
>
cdtTrfTxInf
=
fiToFICstmrCdtTrf
.
getCdtTrfTxInf
();
if
(
cdtTrfTxInf
!=
null
&&
cdtTrfTxInf
.
size
()
>
0
){
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getXchgRate
()
!=
null
){
BigDecimal
field36
=
cdtTrfTxInf
.
get
(
0
).
getXchgRate
();
map
.
put
(
"field36"
,
field36
);
}
}
}
}
catch
(
Exception
e
)
{
map
.
put
(
"field36"
,
field36
);
logger
.
error
(
e
.
getMessage
());
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field36 error"
);
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
()
);
}
}
}
}
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field50AGenerate.java
View file @
5736a006
...
@@ -3,14 +3,11 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
...
@@ -3,14 +3,11 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.swift.model.mx.dic.CreditTransferTransactionInformation11
;
import
org.dom4j.Document
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.List
;
/**
/**
* 1,如果<AnyBIC>节点有值,则设置50 option为“A”,且BIC为此节点的值
* 1,如果<AnyBIC>节点有值,则设置50 option为“A”,且BIC为此节点的值
* 2,若节点<IBAN>有值,则在此节点值前面加上“/”后,作为50的账号;
* 2,若节点<IBAN>有值,则在此节点值前面加上“/”后,作为50的账号;
...
@@ -30,52 +27,62 @@ public class Field50AGenerate extends AbstractMx2MtFieldsGenerate {
...
@@ -30,52 +27,62 @@ public class Field50AGenerate extends AbstractMx2MtFieldsGenerate {
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
//TODO 为F条件待补充
//TODO 为F条件待补充
logger
.
info
(
"Field50AGenerate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
String
field50Option
=
""
;
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
String
field50
=
""
;
return
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
}
String
bicCode
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.Dbtr.Id.OrgId.AnyBIC"
);
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
String
account
=
getAccount
();
List
<
CreditTransferTransactionInformation11
>
cdtTrfTxInf
=
fiToFICstmrCdtTrf
.
getCdtTrfTxInf
();
String
name
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.Dbtr.Nm"
);
if
(
cdtTrfTxInf
!=
null
&&
cdtTrfTxInf
.
size
()
>
0
){
if
(
StringUtil
.
isNotEmpty
(
bicCode
))
{
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
field50Option
=
"A"
;
&&
cdtTrfTxInf
.
get
(
0
).
getDbtr
()
!=
null
if
(
StringUtil
.
isNotEmpty
(
account
))
{
&&
cdtTrfTxInf
.
get
(
0
).
getDbtr
().
getId
()
!=
null
field50
=
account
+
Mx2MtConstants
.
NEW_LINE
+
bicCode
;
&&
cdtTrfTxInf
.
get
(
0
).
getDbtr
().
getId
().
getOrgId
()
!=
null
}
else
{
&&
cdtTrfTxInf
.
get
(
0
).
getDbtr
().
getId
().
getOrgId
().
getBICOrBEI
()
!=
null
){
field50
=
bicCode
;
map
.
put
(
"field50Key"
,
"A"
);
map
.
put
(
"field50A"
,
cdtTrfTxInf
.
get
(
0
).
getDbtr
().
getId
().
getOrgId
().
getBICOrBEI
());
}
else
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getDbtr
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getDbtr
().
getNm
()
!=
null
){
map
.
put
(
"field50Key"
,
"K"
);
if
(
cdtTrfTxInf
.
get
(
0
).
getDbtr
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getDbtr
().
getPstlAdr
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getDbtr
().
getPstlAdr
().
getAdrLine
()
!=
null
){
List
<
String
>
adrList
=
cdtTrfTxInf
.
get
(
0
).
getDbtr
().
getPstlAdr
().
getAdrLine
();
String
adStr
=
""
;
for
(
int
i
=
0
;
i
<
adrList
.
size
();
i
++){
adStr
=
adStr
+
adrList
.
get
(
i
);
}
map
.
put
(
"field50Adr"
,
adStr
);
}
}
}
if
(
cdtTrfTxInf
.
get
(
0
).
getDbtrAcct
()
!=
null
}
else
if
(
StringUtil
.
isNotEmpty
(
name
)){
&&
cdtTrfTxInf
.
get
(
0
).
getDbtrAcct
().
getId
()
!=
null
){
field50Option
=
"K"
;
if
(
cdtTrfTxInf
.
get
(
0
).
getDbtrAcct
().
getId
().
getIBAN
()
!=
null
){
if
(
name
.
length
()
>
35
)
name
=
name
.
substring
(
0
,
35
);
map
.
put
(
"field50Account"
,
"/"
+
cdtTrfTxInf
.
get
(
0
).
getDbtrAcct
().
getId
().
getIBAN
());
if
(
StringUtil
.
isNotEmpty
(
account
))
{
}
field50
=
account
+
Mx2MtConstants
.
NEW_LINE
+
name
;
if
(
cdtTrfTxInf
.
get
(
0
).
getDbtrAcct
().
getId
().
getOthr
().
getId
()
!=
null
){
}
else
{
map
.
put
(
"field50Account"
,
"//CH"
+
cdtTrfTxInf
.
get
(
0
).
getDbtrAcct
().
getId
().
getOthr
().
getId
());
field50
=
name
;
}
int
addressCounts
=
getXmlNodeCounts
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.Dbtr.PstlAdr.AdrLine"
);
if
(
addressCounts
>
0
)
{
for
(
int
i
=
0
;
i
<
addressCounts
;
i
++)
{
if
(
i
==
3
)
break
;
String
address
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.Dbtr.PstlAdr.AdrLine("
+
i
+
")"
);
if
(
address
.
length
()
>
35
)
address
=
address
.
substring
(
0
,
35
);
field50
+=
Mx2MtConstants
.
NEW_LINE
+
address
;
}
}
}
}
}
}
}
catch
(
Exception
e
)
{
map
.
put
(
"field50Option"
,
field50Option
);
logger
.
error
(
e
.
getMessage
());
map
.
put
(
"field50"
,
field50
);
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field50A error"
);
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
private
String
getAccount
()
{
try
{
String
account
=
""
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
String
iban
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.DbtrAcct.IBAN"
);
String
otherId
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.DbtrAcct.Id.Othr.Id"
);
if
(
StringUtil
.
isNotEmpty
(
iban
))
{
account
=
"/"
+
iban
;
}
else
if
(
StringUtil
.
isNotEmpty
(
otherId
))
{
account
=
"//CH"
+
otherId
;
}
if
(
StringUtil
.
isNotEmpty
(
account
)
&&
account
.
length
()
>
35
)
{
account
=
account
.
substring
(
0
,
35
);
}
return
account
;
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field51AGenerate.java
0 → 100644
View file @
5736a006
package
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
.
impl
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
public
class
Field51AGenerate
extends
AbstractMx2MtFieldsGenerate
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Field51AGenerate
.
class
);
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
map
.
put
(
"field51"
,
""
);
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field52AGenerate.java
View file @
5736a006
...
@@ -3,14 +3,11 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
...
@@ -3,14 +3,11 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.swift.model.mx.dic.CreditTransferTransactionInformation11
;
import
org.dom4j.Document
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.List
;
/**
/**
* 1,若节点<BICFI>有值,则设置52 option为“A”,同时BIC取此栏位;
* 1,若节点<BICFI>有值,则设置52 option为“A”,同时BIC取此栏位;
* 2,若节点<IBAN>有值,则作为52的账号;
* 2,若节点<IBAN>有值,则作为52的账号;
...
@@ -28,55 +25,63 @@ public class Field52AGenerate extends AbstractMx2MtFieldsGenerate {
...
@@ -28,55 +25,63 @@ public class Field52AGenerate extends AbstractMx2MtFieldsGenerate {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Field52AGenerate
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Field52AGenerate
.
class
);
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
logger
.
info
(
"Field52AGenerate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
String
field52Option
=
""
;
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
String
field52
=
""
;
return
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
}
String
bicCode
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.DbtrAgt.FinInstnId.BICFI"
);
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
String
account
=
getAccount
();
List
<
CreditTransferTransactionInformation11
>
cdtTrfTxInf
=
fiToFICstmrCdtTrf
.
getCdtTrfTxInf
();
String
name
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.DbtrAgt.FinInstnId.Nm"
);
if
(
cdtTrfTxInf
!=
null
&&
cdtTrfTxInf
.
size
()
>
0
){
if
(
StringUtil
.
isNotEmpty
(
bicCode
))
{
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
field52Option
=
"A"
;
&&
cdtTrfTxInf
.
get
(
0
).
getDbtrAgt
()
!=
null
if
(
StringUtil
.
isNotEmpty
(
account
))
{
&&
cdtTrfTxInf
.
get
(
0
).
getDbtrAgt
().
getFinInstnId
()
!=
null
field52
=
account
+
Mx2MtConstants
.
NEW_LINE
+
bicCode
;
&&
cdtTrfTxInf
.
get
(
0
).
getDbtrAgt
().
getFinInstnId
().
getBIC
()
!=
null
){
}
else
{
map
.
put
(
"field52Key"
,
"A"
);
field52
=
bicCode
;
map
.
put
(
"field52A"
,
cdtTrfTxInf
.
get
(
0
).
getDbtrAgt
().
getFinInstnId
().
getBIC
());
}
else
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getDbtrAgt
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getDbtrAgt
().
getFinInstnId
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getDbtrAgt
().
getFinInstnId
().
getNm
()
!=
null
){
map
.
put
(
"field52Key"
,
"D"
);
List
<
String
>
adrList
=
cdtTrfTxInf
.
get
(
0
).
getDbtrAgt
().
getFinInstnId
().
getPstlAdr
().
getAdrLine
();
String
adStr
=
""
;
for
(
int
i
=
0
;
i
<
adrList
.
size
();
i
++){
adStr
=
adStr
+
adrList
.
get
(
i
);
}
map
.
put
(
"field52DAdr"
,
adStr
);
}
}
if
(
cdtTrfTxInf
.
get
(
0
).
getDbtrAgtAcct
()
!=
null
}
else
if
(
StringUtil
.
isNotEmpty
(
name
)){
&&
cdtTrfTxInf
.
get
(
0
).
getDbtrAgtAcct
().
getId
()
!=
null
){
field52Option
=
"D"
;
if
(
cdtTrfTxInf
.
get
(
0
).
getDbtrAgtAcct
().
getId
().
getIBAN
()
!=
null
){
if
(
name
.
length
()
>
35
)
name
=
name
.
substring
(
0
,
35
);
map
.
put
(
"field52Account"
,
cdtTrfTxInf
.
get
(
0
).
getDbtrAgtAcct
().
getId
().
getIBAN
());
if
(
StringUtil
.
isNotEmpty
(
account
))
{
}
field52
=
account
+
Mx2MtConstants
.
NEW_LINE
+
name
;
if
(
cdtTrfTxInf
.
get
(
0
).
getDbtrAgtAcct
().
getId
().
getOthr
()
!=
null
}
else
{
&&
cdtTrfTxInf
.
get
(
0
).
getDbtrAgtAcct
().
getId
().
getOthr
().
getSchmeNm
()
!=
null
field52
=
name
;
&&
cdtTrfTxInf
.
get
(
0
).
getDbtrAgtAcct
().
getId
().
getOthr
().
getSchmeNm
().
getCd
()
!=
null
){
}
if
(
cdtTrfTxInf
.
get
(
0
).
getDbtrAgtAcct
().
getId
().
getOthr
().
getId
()
!=
null
){
int
addressCounts
=
getXmlNodeCounts
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.DbtrAgt.FinInstnId.PstlAdr.AdrLine"
);
map
.
put
(
"field52Account"
,
"//CH"
+
cdtTrfTxInf
.
get
(
0
).
getDbtrAgtAcct
().
getId
().
getOthr
().
getId
());
if
(
addressCounts
>
0
)
{
}
for
(
int
i
=
0
;
i
<
addressCounts
;
i
++)
{
}
else
{
if
(
i
==
3
)
break
;
if
(
cdtTrfTxInf
.
get
(
0
).
getDbtrAgtAcct
().
getId
().
getOthr
().
getId
()
!=
null
){
String
address
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.DbtrAgt.FinInstnId.PstlAdr.AdrLine("
+
i
+
")"
);
map
.
put
(
"field52Account"
,
cdtTrfTxInf
.
get
(
0
).
getDbtrAgtAcct
().
getId
().
getOthr
().
getId
()
);
if
(
address
.
length
()
>
35
)
address
=
address
.
substring
(
0
,
35
);
}
field52
+=
Mx2MtConstants
.
NEW_LINE
+
address
;
}
}
}
}
}
}
}
catch
(
Exception
e
)
{
map
.
put
(
"field52Option"
,
field52Option
);
logger
.
error
(
e
.
getMessage
());
map
.
put
(
"field52"
,
field52
);
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field52A error"
);
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
private
String
getAccount
()
{
try
{
String
account
=
""
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
String
iban
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.DbtrAgtAcct.IBAN"
);
String
otherId
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.DbtrAgtAcct.Id.Othr.Id"
);
//String schmeNameCd = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "CdtTrfTxInf.DbtrAgtAcct.Id.SchmeNm.Cd");
if
(
StringUtil
.
isNotEmpty
(
iban
))
{
account
=
"/"
+
iban
;
}
else
if
(
StringUtil
.
isNotEmpty
(
otherId
))
{
account
=
"//CH"
+
otherId
;
}
if
(
StringUtil
.
isNotEmpty
(
account
)
&&
account
.
length
()
>
35
)
{
account
=
account
.
substring
(
0
,
35
);
}
return
account
;
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
}
}
\ No newline at end of file
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field53AGenerate.java
View file @
5736a006
...
@@ -3,14 +3,11 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
...
@@ -3,14 +3,11 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
org.dom4j.Document
;
import
com.prowidesoftware.swift.model.mx.dic.GroupHeader33
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.List
;
/**
/**
* 1,若节点<BICFI>有值,则设置53 option为“A”,同时BIC取此栏位;
* 1,若节点<BICFI>有值,则设置53 option为“A”,同时BIC取此栏位;
* 2,若节点<IBAN>有值,则作为53的账号;
* 2,若节点<IBAN>有值,则作为53的账号;
...
@@ -34,73 +31,88 @@ public class Field53AGenerate extends AbstractMx2MtFieldsGenerate {
...
@@ -34,73 +31,88 @@ public class Field53AGenerate extends AbstractMx2MtFieldsGenerate {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Field53AGenerate
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Field53AGenerate
.
class
);
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
logger
.
info
(
"Field53AGenerate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
String
field53Option
=
""
;
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
String
field53
=
""
;
return
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
}
String
bicCode
=
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.InstgRmbrsmntAgt.FinInstnId.BICFI"
);
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
String
account
=
getAccount
();
GroupHeader33
grpHdr
=
fiToFICstmrCdtTrf
.
getGrpHdr
();
String
sttlmAccount
=
getSttlmAccount
();
if
(
grpHdr
.
getSttlmInf
()
!=
null
){
String
name
=
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.InstgRmbrsmntAgt.FinInstnId.Nm"
);
if
(
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgt
()
!=
null
if
(
StringUtil
.
isNotEmpty
(
bicCode
))
{
&&
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgt
().
getFinInstnId
()
!=
null
field53Option
=
"A"
;
&&
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgt
().
getFinInstnId
().
getBIC
()
!=
null
){
if
(
StringUtil
.
isNotEmpty
(
account
))
{
map
.
put
(
"field53Key"
,
"A"
);
field53
=
account
+
Mx2MtConstants
.
NEW_LINE
+
bicCode
;
map
.
put
(
"field53"
,
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgt
().
getFinInstnId
().
getBIC
());
}
else
{
if
(
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
()
!=
null
field53
=
bicCode
;
&&
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
().
getId
()
!=
null
){
}
if
(
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
().
getId
().
getIBAN
()
!=
null
){
}
else
if
(
StringUtil
.
isNotEmpty
(
sttlmAccount
)){
map
.
put
(
"field53Account"
,
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
().
getId
().
getIBAN
());
field53Option
=
"B"
;
}
else
if
(
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
().
getId
().
getOthr
()
!=
null
field53
=
sttlmAccount
;
&&
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
().
getId
().
getOthr
().
getId
()
!=
null
){
}
else
if
(
StringUtil
.
isNotEmpty
(
name
)){
map
.
put
(
"field53Account"
,
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
().
getId
().
getOthr
().
getId
());
field53Option
=
"D"
;
}
if
(
name
.
length
()
>
35
)
name
=
name
.
substring
(
0
,
35
);
}
if
(
StringUtil
.
isNotEmpty
(
account
))
{
}
else
if
((
grpHdr
.
getSttlmInf
().
getSttlmAcct
()
!=
null
field53
=
account
+
Mx2MtConstants
.
NEW_LINE
+
name
;
&&
grpHdr
.
getSttlmInf
().
getSttlmAcct
().
getId
()
!=
null
}
else
{
&&
grpHdr
.
getSttlmInf
().
getSttlmAcct
().
getId
().
getIBAN
()
!=
null
)
field53
=
name
;
||
(
grpHdr
.
getSttlmInf
().
getSttlmAcct
()
!=
null
}
&&
grpHdr
.
getSttlmInf
().
getSttlmAcct
().
getId
()
!=
null
int
addressCounts
=
getXmlNodeCounts
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.InstgRmbrsmntAgt.FinInstnId.PstlAdr.AdrLine"
);
&&
grpHdr
.
getSttlmInf
().
getSttlmAcct
().
getId
().
getOthr
()
!=
null
if
(
addressCounts
>
0
)
{
&&
grpHdr
.
getSttlmInf
().
getSttlmAcct
().
getId
().
getOthr
().
getId
()
!=
null
)){
for
(
int
i
=
0
;
i
<
addressCounts
;
i
++)
{
map
.
put
(
"field53Key"
,
"B"
);
if
(
i
==
3
)
break
;
if
(
grpHdr
.
getSttlmInf
().
getSttlmAcct
()
!=
null
String
address
=
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.InstgRmbrsmntAgt.FinInstnId.PstlAdr.AdrLine("
+
i
+
")"
);
&&
grpHdr
.
getSttlmInf
().
getSttlmAcct
().
getId
()
!=
null
if
(
address
.
length
()
>
35
)
address
=
address
.
substring
(
0
,
35
);
&&
grpHdr
.
getSttlmInf
().
getSttlmAcct
().
getId
().
getIBAN
()
!=
null
){
field53
+=
Mx2MtConstants
.
NEW_LINE
+
address
;
map
.
put
(
"field53Account"
,
grpHdr
.
getSttlmInf
().
getSttlmAcct
().
getId
().
getIBAN
());
}
else
if
(
grpHdr
.
getSttlmInf
().
getSttlmAcct
()
!=
null
&&
grpHdr
.
getSttlmInf
().
getSttlmAcct
().
getId
()
!=
null
&&
grpHdr
.
getSttlmInf
().
getSttlmAcct
().
getId
().
getOthr
()
!=
null
&&
grpHdr
.
getSttlmInf
().
getSttlmAcct
().
getId
().
getOthr
().
getId
()
!=
null
){
map
.
put
(
"field53Account"
,
grpHdr
.
getSttlmInf
().
getSttlmAcct
().
getId
().
getOthr
().
getId
());
}
}
else
if
((
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgt
()
!=
null
&&
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgt
().
getFinInstnId
()
!=
null
&&
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgt
().
getFinInstnId
().
getNm
()
!=
null
)){
map
.
put
(
"field53Key"
,
"D"
);
List
<
String
>
adrList
=
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgt
().
getFinInstnId
().
getPstlAdr
().
getAdrLine
();
String
adStr
=
""
;
for
(
int
i
=
0
;
i
<
adrList
.
size
();
i
++){
adStr
=
adStr
+
adrList
.
get
(
i
);
}
map
.
put
(
"field53DAdr"
,
adStr
);
if
(
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
()
!=
null
&&
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
().
getId
()
!=
null
){
if
(
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
().
getId
().
getIBAN
()
!=
null
){
map
.
put
(
"field53Account"
,
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
().
getId
().
getIBAN
());
}
else
if
(
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
().
getId
().
getOthr
()
!=
null
&&
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
().
getId
().
getOthr
().
getId
()
!=
null
){
map
.
put
(
"field53Account"
,
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
().
getId
().
getOthr
().
getId
());
}
}
}
}
}
}
map
.
put
(
"field53Option"
,
field53Option
);
map
.
put
(
"field53"
,
field53
);
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
private
String
getAccount
()
{
try
{
String
account
=
""
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
String
iban
=
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.InstgRmbrsmntAgtAcct.Id.IBAN"
);
String
otherId
=
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.InstgRmbrsmntAgtAcct.Id.Othr.Id"
);
//String schmeNameCd = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "CdtTrfTxInf.DbtrAgtAcct.Id.SchmeNm.Cd");
if
(
StringUtil
.
isNotEmpty
(
iban
))
{
account
=
"/"
+
iban
;
}
else
if
(
StringUtil
.
isNotEmpty
(
otherId
))
{
account
=
"//CH"
+
otherId
;
}
}
}
catch
(
Exception
e
)
{
if
(
StringUtil
.
isNotEmpty
(
account
)
&&
account
.
length
()
>
35
)
{
logger
.
error
(
e
.
getMessage
());
account
=
account
.
substring
(
0
,
35
);
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field53A error"
);
}
return
account
;
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
private
String
getSttlmAccount
()
{
try
{
String
account
=
""
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
String
iban
=
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.SttlmAcct.Id.IBAN"
);
String
otherId
=
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.SttlmAcct.Id.Othr.Id"
);
//String schmeNameCd = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "CdtTrfTxInf.DbtrAgtAcct.Id.SchmeNm.Cd");
if
(
StringUtil
.
isNotEmpty
(
iban
))
{
account
=
"/"
+
iban
;
}
else
if
(
StringUtil
.
isNotEmpty
(
otherId
))
{
account
=
"//CH"
+
otherId
;
}
if
(
StringUtil
.
isNotEmpty
(
account
)
&&
account
.
length
()
>
35
)
{
account
=
account
.
substring
(
0
,
35
);
}
return
account
;
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field54AGenerate.java
View file @
5736a006
...
@@ -3,14 +3,11 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
...
@@ -3,14 +3,11 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
org.dom4j.Document
;
import
com.prowidesoftware.swift.model.mx.dic.GroupHeader33
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.List
;
/**
/**
* //1,若节点<BICFI>有值,则设置54 option为“A”,同时BIC取此栏位;
* //1,若节点<BICFI>有值,则设置54 option为“A”,同时BIC取此栏位;
* //2,若节点<IBAN>有值,则作为54的账号;
* //2,若节点<IBAN>有值,则作为54的账号;
...
@@ -27,46 +24,64 @@ public class Field54AGenerate extends AbstractMx2MtFieldsGenerate {
...
@@ -27,46 +24,64 @@ public class Field54AGenerate extends AbstractMx2MtFieldsGenerate {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Field54AGenerate
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Field54AGenerate
.
class
);
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
logger
.
info
(
"Field54AGenerate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
String
field54Option
=
""
;
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
String
field54
=
""
;
return
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
}
String
bicCode
=
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.InstdRmbrsmntAgt.FinInstnId.BICFI"
);
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
String
account
=
getAccount
();
GroupHeader33
grpHdr
=
fiToFICstmrCdtTrf
.
getGrpHdr
();
String
name
=
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.InstdRmbrsmntAgt.FinInstnId.Nm"
);
if
(
grpHdr
.
getSttlmInf
()
!=
null
){
if
(
StringUtil
.
isNotEmpty
(
bicCode
))
{
if
(
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgt
()
!=
null
field54Option
=
"A"
;
&&
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgt
().
getFinInstnId
()
!=
null
if
(
StringUtil
.
isNotEmpty
(
account
))
{
&&
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgt
().
getFinInstnId
().
getBIC
()
!=
null
){
field54
=
account
+
Mx2MtConstants
.
NEW_LINE
+
bicCode
;
map
.
put
(
"field54Key"
,
"A"
);
}
else
{
map
.
put
(
"field54"
,
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgt
().
getFinInstnId
().
getBIC
());
field54
=
bicCode
;
}
else
if
((
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgt
()
!=
null
&&
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgt
().
getFinInstnId
()
!=
null
&&
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgt
().
getFinInstnId
().
getNm
()
!=
null
)){
map
.
put
(
"field54Key"
,
"D"
);
List
<
String
>
adrList
=
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgt
().
getFinInstnId
().
getPstlAdr
().
getAdrLine
();
String
adStr
=
""
;
for
(
int
i
=
0
;
i
<
adrList
.
size
();
i
++){
adStr
=
adStr
+
adrList
.
get
(
i
);
}
map
.
put
(
"field54DAdr"
,
adStr
);
}
}
if
(
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
()
!=
null
}
else
if
(
StringUtil
.
isNotEmpty
(
name
)){
&&
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
().
getId
()
!=
null
){
field54Option
=
"D"
;
if
(
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
().
getId
().
getIBAN
()
!=
null
){
if
(
name
.
length
()
>
35
)
name
=
name
.
substring
(
0
,
35
);
map
.
put
(
"field53Account"
,
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
().
getId
().
getIBAN
());
if
(
StringUtil
.
isNotEmpty
(
account
))
{
}
else
if
(
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
().
getId
().
getOthr
()
!=
null
field54
=
account
+
Mx2MtConstants
.
NEW_LINE
+
name
;
&&
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
().
getId
().
getOthr
().
getId
()
!=
null
){
}
else
{
map
.
put
(
"field53Account"
,
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgtAcct
().
getId
().
getOthr
().
getId
());
field54
=
name
;
}
int
addressCounts
=
getXmlNodeCounts
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.InstdRmbrsmntAgt.FinInstnId.PstlAdr.AdrLine"
);
if
(
addressCounts
>
0
)
{
for
(
int
i
=
0
;
i
<
addressCounts
;
i
++)
{
if
(
i
==
3
)
break
;
String
address
=
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.InstdRmbrsmntAgt.FinInstnId.PstlAdr.AdrLine("
+
i
+
")"
);
if
(
address
.
length
()
>
35
)
address
=
address
.
substring
(
0
,
35
);
field54
+=
Mx2MtConstants
.
NEW_LINE
+
address
;
}
}
}
}
}
}
}
catch
(
Exception
e
)
{
map
.
put
(
"field54Option"
,
field54Option
);
logger
.
error
(
e
.
getMessage
());
map
.
put
(
"field54"
,
field54
);
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field54A error"
);
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
private
String
getAccount
()
{
try
{
String
account
=
""
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
String
iban
=
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.InstdRmbrsmntAgtAcct.Id.IBAN"
);
String
otherId
=
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.InstdRmbrsmntAgtAcct.Id.Othr.Id"
);
//String schmeNameCd = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "CdtTrfTxInf.DbtrAgtAcct.Id.SchmeNm.Cd");
if
(
StringUtil
.
isNotEmpty
(
iban
))
{
account
=
"/"
+
iban
;
}
else
if
(
StringUtil
.
isNotEmpty
(
otherId
))
{
account
=
"//CH"
+
otherId
;
}
if
(
StringUtil
.
isNotEmpty
(
account
)
&&
account
.
length
()
>
35
)
{
account
=
account
.
substring
(
0
,
35
);
}
return
account
;
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field55AGenerate.java
View file @
5736a006
...
@@ -3,14 +3,11 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
...
@@ -3,14 +3,11 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
org.dom4j.Document
;
import
com.prowidesoftware.swift.model.mx.dic.GroupHeader33
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.List
;
/**
/**
* //1,若节点<BICFI>有值,则设置55 option为“A”,同时BIC取此栏位
* //1,若节点<BICFI>有值,则设置55 option为“A”,同时BIC取此栏位
* //2,若节点<IBAN>有值,则作为55的账号;
* //2,若节点<IBAN>有值,则作为55的账号;
...
@@ -27,45 +24,64 @@ public class Field55AGenerate extends AbstractMx2MtFieldsGenerate {
...
@@ -27,45 +24,64 @@ public class Field55AGenerate extends AbstractMx2MtFieldsGenerate {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
.
impl
.
Field55AGenerate
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
.
impl
.
Field55AGenerate
.
class
);
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
logger
.
info
(
"Field55AGenerate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
String
field55Option
=
""
;
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
String
field55
=
""
;
return
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
}
String
bicCode
=
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.ThrdRmbrsmntAgt.FinInstnId.BICFI"
);
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
String
account
=
getAccount
();
GroupHeader33
grpHdr
=
fiToFICstmrCdtTrf
.
getGrpHdr
();
String
name
=
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.ThrdRmbrsmntAgt.FinInstnId.Nm"
);
if
(
grpHdr
.
getSttlmInf
()
!=
null
){
if
(
StringUtil
.
isNotEmpty
(
bicCode
))
{
if
(
grpHdr
.
getSttlmInf
().
getThrdRmbrsmntAgt
()
!=
null
field55Option
=
"A"
;
&&
grpHdr
.
getSttlmInf
().
getThrdRmbrsmntAgt
().
getFinInstnId
()
!=
null
if
(
StringUtil
.
isNotEmpty
(
account
))
{
&&
grpHdr
.
getSttlmInf
().
getThrdRmbrsmntAgt
().
getFinInstnId
().
getBIC
()
!=
null
){
field55
=
account
+
Mx2MtConstants
.
NEW_LINE
+
bicCode
;
map
.
put
(
"field55Key"
,
"A"
);
}
else
{
map
.
put
(
"field55"
,
grpHdr
.
getSttlmInf
().
getThrdRmbrsmntAgt
().
getFinInstnId
().
getBIC
());
field55
=
bicCode
;
}
else
if
((
grpHdr
.
getSttlmInf
().
getThrdRmbrsmntAgt
()
!=
null
&&
grpHdr
.
getSttlmInf
().
getThrdRmbrsmntAgt
().
getFinInstnId
()
!=
null
&&
grpHdr
.
getSttlmInf
().
getThrdRmbrsmntAgt
().
getFinInstnId
().
getNm
()
!=
null
)){
map
.
put
(
"field55Key"
,
"D"
);
List
<
String
>
adrList
=
grpHdr
.
getSttlmInf
().
getInstdRmbrsmntAgt
().
getFinInstnId
().
getPstlAdr
().
getAdrLine
();
String
adStr
=
""
;
for
(
int
i
=
0
;
i
<
adrList
.
size
();
i
++){
adStr
=
adStr
+
adrList
.
get
(
i
);
}
map
.
put
(
"field55DAdr"
,
adStr
);
}
}
if
(
grpHdr
.
getSttlmInf
().
getThrdRmbrsmntAgtAcct
()
!=
null
}
else
if
(
StringUtil
.
isNotEmpty
(
name
)){
&&
grpHdr
.
getSttlmInf
().
getThrdRmbrsmntAgtAcct
().
getId
()
!=
null
){
field55Option
=
"D"
;
if
(
grpHdr
.
getSttlmInf
().
getThrdRmbrsmntAgtAcct
().
getId
().
getIBAN
()
!=
null
){
if
(
name
.
length
()
>
35
)
name
=
name
.
substring
(
0
,
35
);
map
.
put
(
"field55Account"
,
grpHdr
.
getSttlmInf
().
getThrdRmbrsmntAgtAcct
().
getId
().
getIBAN
());
if
(
StringUtil
.
isNotEmpty
(
account
))
{
}
else
if
(
grpHdr
.
getSttlmInf
().
getThrdRmbrsmntAgtAcct
().
getId
().
getOthr
()
!=
null
field55
=
account
+
Mx2MtConstants
.
NEW_LINE
+
name
;
&&
grpHdr
.
getSttlmInf
().
getThrdRmbrsmntAgtAcct
().
getId
().
getOthr
().
getId
()
!=
null
){
}
else
{
map
.
put
(
"field55Account"
,
grpHdr
.
getSttlmInf
().
getThrdRmbrsmntAgtAcct
().
getId
().
getOthr
().
getId
());
field55
=
name
;
}
int
addressCounts
=
getXmlNodeCounts
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.ThrdRmbrsmntAgt.FinInstnId.PstlAdr.AdrLine"
);
if
(
addressCounts
>
0
)
{
for
(
int
i
=
0
;
i
<
addressCounts
;
i
++)
{
if
(
i
==
3
)
break
;
String
address
=
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.ThrdRmbrsmntAgt.FinInstnId.PstlAdr.AdrLine("
+
i
+
")"
);
if
(
address
.
length
()
>
35
)
address
=
address
.
substring
(
0
,
35
);
field55
+=
Mx2MtConstants
.
NEW_LINE
+
address
;
}
}
}
}
}
}
}
catch
(
Exception
e
)
{
map
.
put
(
"field55Option"
,
field55Option
);
logger
.
error
(
e
.
getMessage
());
map
.
put
(
"field55"
,
field55
);
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field55A error"
);
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
}
private
String
getAccount
()
{
try
{
String
account
=
""
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
String
iban
=
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.ThrdRmbrsmntAgtAcct.Id.IBAN"
);
String
otherId
=
getXmlNodeValue
(
Mx2MtConstants
.
GRPHDR_PARENT_ELEMENT_NAME
,
document
,
"GrpHdr.SttlmInf.ThrdRmbrsmntAgtAcct.Id.Othr.Id"
);
//String schmeNameCd = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "CdtTrfTxInf.DbtrAgtAcct.Id.SchmeNm.Cd");
if
(
StringUtil
.
isNotEmpty
(
iban
))
{
account
=
"/"
+
iban
;
}
else
if
(
StringUtil
.
isNotEmpty
(
otherId
))
{
account
=
"//CH"
+
otherId
;
}
if
(
StringUtil
.
isNotEmpty
(
account
)
&&
account
.
length
()
>
35
)
{
account
=
account
.
substring
(
0
,
35
);
}
return
account
;
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field56AGenerate.java
View file @
5736a006
...
@@ -3,14 +3,11 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
...
@@ -3,14 +3,11 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.swift.model.mx.dic.CreditTransferTransactionInformation11
;
import
org.dom4j.Document
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.List
;
/**
/**
* //1,若节点<BICFI>有值,则设置56 option为“A”,同时BIC取此栏位;
* //1,若节点<BICFI>有值,则设置56 option为“A”,同时BIC取此栏位;
* //2,若节点<IBAN>有值,则作为56A的账号;
* //2,若节点<IBAN>有值,则作为56A的账号;
...
@@ -35,82 +32,79 @@ public class Field56AGenerate extends AbstractMx2MtFieldsGenerate {
...
@@ -35,82 +32,79 @@ public class Field56AGenerate extends AbstractMx2MtFieldsGenerate {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
.
impl
.
Field56AGenerate
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
.
impl
.
Field56AGenerate
.
class
);
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
logger
.
info
(
"Field56AGenerate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
String
field56Option
=
""
;
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
String
field56
=
""
;
return
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
}
String
bicCode
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.IntrmyAgt1.FinInstnId.BICFI"
);
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
String
account
=
getAccount
();
List
<
CreditTransferTransactionInformation11
>
cdtTrfTxInf
=
fiToFICstmrCdtTrf
.
getCdtTrfTxInf
();
String
name
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.IntrmyAgt1.FinInstnId.Nm"
);
if
(
cdtTrfTxInf
!=
null
&&
cdtTrfTxInf
.
size
()
>
0
){
if
(
StringUtil
.
isNotEmpty
(
bicCode
))
{
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
field56Option
=
"A"
;
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1
()
!=
null
if
(
StringUtil
.
isNotEmpty
(
account
))
{
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1
().
getFinInstnId
()
!=
null
field56
=
account
+
Mx2MtConstants
.
NEW_LINE
+
bicCode
;
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1
().
getFinInstnId
().
getBIC
()
!=
null
){
}
else
{
map
.
put
(
"field56Key"
,
"A"
);
field56
=
bicCode
;
map
.
put
(
"field56A"
,
cdtTrfTxInf
.
get
(
0
).
getDbtrAgt
().
getFinInstnId
().
getBIC
());
}
if
(
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
()
!=
null
}
else
if
(
StringUtil
.
isNotEmpty
(
name
)){
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
()
!=
null
){
field56Option
=
"D"
;
if
(
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
().
getIBAN
()
!=
null
){
if
(
name
.
length
()
>
35
)
name
=
name
.
substring
(
0
,
35
);
map
.
put
(
"field56Account"
,
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
().
getIBAN
());
if
(
StringUtil
.
isNotEmpty
(
account
))
{
}
else
if
(
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
().
getOthr
()
!=
null
field56
=
account
+
Mx2MtConstants
.
NEW_LINE
+
name
;
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
().
getOthr
().
getId
()
!=
null
){
}
else
{
map
.
put
(
"field56Account"
,
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
().
getOthr
().
getId
());
field56
=
name
;
}
}
}
int
addressCounts
=
getXmlNodeCounts
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.IntrmyAgt1.FinInstnId.PstlAdr.AdrLine"
);
}
else
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
if
(
addressCounts
>
0
)
{
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1
()
!=
null
for
(
int
i
=
0
;
i
<
addressCounts
;
i
++)
{
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1
().
getFinInstnId
()
!=
null
){
if
(
i
==
3
)
break
;
if
(
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1
().
getFinInstnId
().
getBIC
()
==
null
String
address
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.IntrmyAgt1.FinInstnId.PstlAdr.AdrLine("
+
i
+
")"
);
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1
().
getFinInstnId
().
getNm
()
==
null
){
if
(
address
.
length
()
>
35
)
address
=
address
.
substring
(
0
,
35
);
if
((
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
()
!=
null
field56
+=
Mx2MtConstants
.
NEW_LINE
+
address
;
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
().
getIBAN
()
!=
null
)
||
(
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
().
getOthr
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
().
getOthr
().
getId
()
!=
null
)){
map
.
put
(
"field56Key"
,
"C"
);
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1
()
!=
null
){
if
(
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
().
getOthr
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
().
getOthr
().
getId
()
!=
null
)
{
map
.
put
(
"field56Account"
,
"//CH"
+
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
().
getOthr
().
getId
());
}
else
if
(
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1
().
getFinInstnId
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1
().
getFinInstnId
().
getClrSysMmbId
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1
().
getFinInstnId
().
getClrSysMmbId
().
getMmbId
()
!=
null
){
map
.
put
(
"field56Account"
,
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1
().
getFinInstnId
().
getClrSysMmbId
().
getMmbId
());
}
}
}
}
}
else
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1
().
getFinInstnId
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1
().
getFinInstnId
().
getNm
()
!=
null
){
map
.
put
(
"field56Key"
,
"D"
);
List
<
String
>
adrList
=
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1
().
getFinInstnId
().
getPstlAdr
().
getAdrLine
();
String
adStr
=
""
;
for
(
int
i
=
0
;
i
<
adrList
.
size
();
i
++){
adStr
=
adStr
+
adrList
.
get
(
i
);
}
map
.
put
(
"field56DAdr"
,
adStr
);
if
(
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
()
!=
null
){
if
(
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
().
getIBAN
()
!=
null
){
map
.
put
(
"field56Account"
,
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
().
getIBAN
());
}
else
if
(
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
().
getOthr
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
().
getOthr
().
getId
()
!=
null
){
map
.
put
(
"field56Account"
,
cdtTrfTxInf
.
get
(
0
).
getIntrmyAgt1Acct
().
getId
().
getOthr
().
getId
());
}
}
}
}
}
}
else
if
(
StringUtil
.
isNotEmpty
(
account
)){
field56Option
=
"C"
;
String
iban
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.IntrmyAgt1Acct.Id.IBAN"
);
String
otherId
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.IntrmyAgt1Acct.Id.Othr.Id"
);
String
mmbId
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.IntrmyAgt1.FinInstnId.ClrSysMmbId.MmbId"
);
//String schmeNameCd = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "CdtTrfTxInf.DbtrAgtAcct.Id.SchmeNm.Cd");
if
(
StringUtil
.
isNotEmpty
(
otherId
))
{
account
=
"//CH"
+
otherId
;
}
else
if
(
StringUtil
.
isNotEmpty
(
mmbId
))
{
account
=
"/"
+
mmbId
;
}
else
{
account
=
"/"
+
iban
;
}
if
(
StringUtil
.
isNotEmpty
(
account
)
&&
account
.
length
()
>
35
)
{
field56
=
account
.
substring
(
0
,
35
);
}
}
}
}
catch
(
Exception
e
)
{
map
.
put
(
"field56Option"
,
field56Option
);
logger
.
error
(
e
.
getMessage
());
map
.
put
(
"field56"
,
field56
);
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field56A error"
);
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
private
String
getAccount
()
{
try
{
String
account
=
""
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
String
iban
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.IntrmyAgt1Acct.Id.IBAN"
);
String
otherId
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.IntrmyAgt1Acct.Id.Othr.Id"
);
//String schmeNameCd = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "CdtTrfTxInf.DbtrAgtAcct.Id.SchmeNm.Cd");
if
(
StringUtil
.
isNotEmpty
(
iban
))
{
account
=
"/"
+
iban
;
}
else
if
(
StringUtil
.
isNotEmpty
(
otherId
))
{
account
=
"//CH"
+
otherId
;
}
if
(
StringUtil
.
isNotEmpty
(
account
)
&&
account
.
length
()
>
35
)
{
account
=
account
.
substring
(
0
,
35
);
}
return
account
;
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field57AGenerate.java
View file @
5736a006
...
@@ -3,14 +3,11 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
...
@@ -3,14 +3,11 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.swift.model.mx.dic.CreditTransferTransactionInformation11
;
import
org.dom4j.Document
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.List
;
/**
/**
* //1,若节点<BICFI>有值,则设置57 option为“A”,同时BIC取此栏位;
* //1,若节点<BICFI>有值,则设置57 option为“A”,同时BIC取此栏位;
* //2,若节点<IBAN>有值,则作为57A的账号;
* //2,若节点<IBAN>有值,则作为57A的账号;
...
@@ -35,89 +32,79 @@ public class Field57AGenerate extends AbstractMx2MtFieldsGenerate {
...
@@ -35,89 +32,79 @@ public class Field57AGenerate extends AbstractMx2MtFieldsGenerate {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
.
impl
.
Field57AGenerate
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
.
impl
.
Field57AGenerate
.
class
);
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
logger
.
info
(
"Field57AGenerate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
String
field57Option
=
""
;
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
String
field57
=
""
;
return
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
}
String
bicCode
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.CdtrAgt.FinInstnId.BICFI"
);
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
String
account
=
getAccount
();
List
<
CreditTransferTransactionInformation11
>
cdtTrfTxInf
=
fiToFICstmrCdtTrf
.
getCdtTrfTxInf
();
String
name
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.CdtrAgt.FinInstnId.Nm"
);
if
(
cdtTrfTxInf
!=
null
&&
cdtTrfTxInf
.
size
()
>
0
){
if
(
StringUtil
.
isNotEmpty
(
bicCode
))
{
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
field57Option
=
"A"
;
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgt
()
!=
null
if
(
StringUtil
.
isNotEmpty
(
account
))
{
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgt
().
getFinInstnId
()
!=
null
field57
=
account
+
Mx2MtConstants
.
NEW_LINE
+
bicCode
;
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgt
().
getFinInstnId
().
getBIC
()
!=
null
){
}
else
{
map
.
put
(
"field57Key"
,
"A"
);
field57
=
bicCode
;
map
.
put
(
"field57A"
,
cdtTrfTxInf
.
get
(
0
).
getCdtrAgt
().
getFinInstnId
().
getBIC
());
}
if
(
cdtTrfTxInf
.
get
(
0
).
getCdtrAgtAcct
()
!=
null
}
else
if
(
StringUtil
.
isNotEmpty
(
name
)){
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgtAcct
().
getId
()
!=
null
){
field57Option
=
"D"
;
if
(
cdtTrfTxInf
.
get
(
0
).
getCdtrAgtAcct
().
getId
().
getIBAN
()
!=
null
){
if
(
name
.
length
()
>
35
)
name
=
name
.
substring
(
0
,
35
);
map
.
put
(
"field57Account"
,
cdtTrfTxInf
.
get
(
0
).
getCdtrAgtAcct
().
getId
().
getIBAN
());
if
(
StringUtil
.
isNotEmpty
(
account
))
{
}
else
if
(
cdtTrfTxInf
.
get
(
0
).
getCdtrAgtAcct
().
getId
().
getOthr
()
!=
null
field57
=
account
+
Mx2MtConstants
.
NEW_LINE
+
name
;
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgtAcct
().
getId
().
getOthr
().
getId
()
!=
null
){
}
else
{
map
.
put
(
"field57Account"
,
cdtTrfTxInf
.
get
(
0
).
getCdtrAgtAcct
().
getId
().
getOthr
().
getId
());
field57
=
name
;
}
}
}
int
addressCounts
=
getXmlNodeCounts
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.CdtrAgt.FinInstnId.PstlAdr.AdrLine"
);
}
else
if
((
cdtTrfTxInf
.
get
(
0
)
!=
null
if
(
addressCounts
>
0
)
{
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgt
()
!=
null
for
(
int
i
=
0
;
i
<
addressCounts
;
i
++)
{
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgt
().
getFinInstnId
()
!=
null
if
(
i
==
3
)
break
;
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgt
().
getFinInstnId
().
getBIC
()
==
null
)
String
address
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.CdtrAgt.FinInstnId.PstlAdr.AdrLine("
+
i
+
")"
);
&&
(
cdtTrfTxInf
.
get
(
0
)
!=
null
if
(
address
.
length
()
>
35
)
address
=
address
.
substring
(
0
,
35
);
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgt
()
!=
null
field57
+=
Mx2MtConstants
.
NEW_LINE
+
address
;
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgt
().
getFinInstnId
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgt
().
getFinInstnId
().
getNm
()
==
null
)){
if
((
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getIBAN
()
!=
null
)
||
(
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getOthr
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getOthr
().
getId
()
!=
null
)){
map
.
put
(
"field57Key"
,
"C"
);
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getOthr
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getOthr
().
getId
()
!=
null
){
map
.
put
(
"field57Account"
,
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getOthr
().
getId
());
}
else
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgt
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgt
().
getFinInstnId
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgt
().
getFinInstnId
().
getClrSysMmbId
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgt
().
getFinInstnId
().
getClrSysMmbId
().
getMmbId
()
!=
null
){
map
.
put
(
"field57Account"
,
cdtTrfTxInf
.
get
(
0
).
getCdtrAgt
().
getFinInstnId
().
getClrSysMmbId
().
getMmbId
());
}
}
}
else
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgt
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgt
().
getFinInstnId
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgt
().
getFinInstnId
().
getNm
()
!=
null
){
map
.
put
(
"field57Key"
,
"D"
);
List
<
String
>
adrList
=
cdtTrfTxInf
.
get
(
0
).
getCdtrAgt
().
getFinInstnId
().
getPstlAdr
().
getAdrLine
();
String
adStr
=
""
;
for
(
int
i
=
0
;
i
<
adrList
.
size
();
i
++){
adStr
=
adStr
+
adrList
.
get
(
i
);
}
map
.
put
(
"field57DAdr"
,
adStr
);
if
(
cdtTrfTxInf
.
get
(
0
).
getCdtrAgtAcct
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgtAcct
().
getId
()
!=
null
){
if
(
cdtTrfTxInf
.
get
(
0
).
getCdtrAgtAcct
().
getId
().
getIBAN
()
!=
null
){
map
.
put
(
"field57Account"
,
cdtTrfTxInf
.
get
(
0
).
getCdtrAgtAcct
().
getId
().
getIBAN
());
}
if
(
cdtTrfTxInf
.
get
(
0
).
getCdtrAgtAcct
().
getId
().
getOthr
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAgtAcct
().
getId
().
getOthr
().
getId
()
!=
null
){
map
.
put
(
"field57Account"
,
cdtTrfTxInf
.
get
(
0
).
getCdtrAgtAcct
().
getId
().
getOthr
().
getId
());
}
}
}
}
}
}
else
if
(
StringUtil
.
isNotEmpty
(
account
)){
field57Option
=
"C"
;
String
iban
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.CdtrAgtAcct.Id.IBAN"
);
String
otherId
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.CdtrAgtAcct.Id.Othr.Id"
);
String
mmbId
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.CdtrAgt.FinInstnId.ClrSysMmbId.MmbId"
);
//String schmeNameCd = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "CdtTrfTxInf.DbtrAgtAcct.Id.SchmeNm.Cd");
if
(
StringUtil
.
isNotEmpty
(
otherId
))
{
account
=
"//CH"
+
otherId
;
}
else
if
(
StringUtil
.
isNotEmpty
(
mmbId
))
{
account
=
"/"
+
mmbId
;
}
else
{
account
=
"/"
+
iban
;
}
if
(
StringUtil
.
isNotEmpty
(
account
)
&&
account
.
length
()
>
35
)
{
field57
=
account
.
substring
(
0
,
35
);
}
}
}
}
catch
(
Exception
e
)
{
map
.
put
(
"field57Option"
,
field57Option
);
logger
.
error
(
e
.
getMessage
());
map
.
put
(
"field57"
,
field57
);
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field57A error"
);
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
private
String
getAccount
()
{
try
{
String
account
=
""
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
String
iban
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.CdtrAgtAcct.Id.IBAN"
);
String
otherId
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.CdtrAgtAcct.Id.Othr.Id"
);
//String schmeNameCd = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "CdtTrfTxInf.DbtrAgtAcct.Id.SchmeNm.Cd");
if
(
StringUtil
.
isNotEmpty
(
iban
))
{
account
=
"/"
+
iban
;
}
else
if
(
StringUtil
.
isNotEmpty
(
otherId
))
{
account
=
"//CH"
+
otherId
;
}
if
(
StringUtil
.
isNotEmpty
(
account
)
&&
account
.
length
()
>
35
)
{
account
=
account
.
substring
(
0
,
35
);
}
return
account
;
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field59Generate.java
View file @
5736a006
...
@@ -3,14 +3,11 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
...
@@ -3,14 +3,11 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.swift.model.mx.dic.CreditTransferTransactionInformation11
;
import
org.dom4j.Document
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.List
;
/**
/**
*
*
* "1,若节点<Nm>有值,则设置59 option为“”,且名称取自此节点,而地址需要合并截取???
* "1,若节点<Nm>有值,则设置59 option为“”,且名称取自此节点,而地址需要合并截取???
...
@@ -29,60 +26,63 @@ public class Field59Generate extends AbstractMx2MtFieldsGenerate {
...
@@ -29,60 +26,63 @@ public class Field59Generate extends AbstractMx2MtFieldsGenerate {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
.
impl
.
Field59Generate
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
.
impl
.
Field59Generate
.
class
);
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
logger
.
info
(
"Field59Generate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
String
field59Option
=
""
;
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
String
field59
=
""
;
return
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
}
String
bicCode
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.Cdtr.Id.OrgId.AnyBIC"
);
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
String
account
=
getAccount
();
List
<
CreditTransferTransactionInformation11
>
cdtTrfTxInf
=
fiToFICstmrCdtTrf
.
getCdtTrfTxInf
();
String
name
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.Cdtr.Nm"
);
if
(
cdtTrfTxInf
!=
null
&&
cdtTrfTxInf
.
size
()
>
0
){
if
(
StringUtil
.
isNotEmpty
(
name
)){
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
field59Option
=
"NOLETTER"
;
&&
cdtTrfTxInf
.
get
(
0
).
getCdtr
()
!=
null
if
(
name
.
length
()
>
35
)
name
=
name
.
substring
(
0
,
35
);
&&
cdtTrfTxInf
.
get
(
0
).
getCdtr
().
getNm
()
!=
null
){
if
(
StringUtil
.
isNotEmpty
(
account
))
{
map
.
put
(
"field59Key"
,
""
);
field59
=
account
+
Mx2MtConstants
.
NEW_LINE
+
name
;
List
<
String
>
adrList
=
cdtTrfTxInf
.
get
(
0
).
getCdtr
().
getPstlAdr
().
getAdrLine
();
}
else
{
String
adStr
=
""
;
field59
=
name
;
for
(
int
i
=
0
;
i
<
adrList
.
size
();
i
++){
adStr
=
adStr
+
adrList
.
get
(
i
);
}
map
.
put
(
"field59Adr"
,
adStr
);
}
else
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtr
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtr
().
getId
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtr
().
getId
().
getOrgId
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtr
().
getId
().
getOrgId
().
getBICOrBEI
()
!=
null
){
map
.
put
(
"field59AKey"
,
"A"
);
}
}
if
(
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
()
!=
null
int
addressCounts
=
getXmlNodeCounts
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.Cdtr.PstlAdr.AdrLine"
);
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
()
!=
null
){
if
(
addressCounts
>
0
)
{
if
(
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getIBAN
()
!=
null
){
for
(
int
i
=
0
;
i
<
addressCounts
;
i
++)
{
map
.
put
(
"field59Account"
,
"/"
+
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getIBAN
());
if
(
i
==
3
)
break
;
}
else
if
((
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getOthr
()
!=
null
String
address
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.Cdtr.PstlAdr.AdrLine("
+
i
+
")"
);
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getOthr
().
getId
()
!=
null
)
if
(
address
.
length
()
>
35
)
address
=
address
.
substring
(
0
,
35
);
&&
field59
+=
Mx2MtConstants
.
NEW_LINE
+
address
;
(
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getOthr
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getOthr
().
getSchmeNm
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getOthr
().
getSchmeNm
().
getCd
()
!=
null
)){
map
.
put
(
"field59Account"
,
"//CH"
+
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getOthr
().
getId
());
}
else
if
(
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
()
!=
null
){
if
((
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getOthr
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getOthr
().
getId
()
!=
null
)
&&
(
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getOthr
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getOthr
().
getSchmeNm
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getOthr
().
getSchmeNm
().
getCd
()
==
null
)){
map
.
put
(
"field59Account"
,
"/"
+
cdtTrfTxInf
.
get
(
0
).
getCdtrAcct
().
getId
().
getOthr
().
getId
());
}
}
}
}
}
}
else
if
(
StringUtil
.
isNotEmpty
(
bicCode
))
{
field59Option
=
"A"
;
if
(
StringUtil
.
isNotEmpty
(
account
))
{
field59
=
account
+
Mx2MtConstants
.
NEW_LINE
+
bicCode
;
}
else
{
field59
=
bicCode
;
}
}
}
}
catch
(
Exception
e
)
{
map
.
put
(
"field59Option"
,
field59Option
);
logger
.
error
(
e
.
getMessage
());
map
.
put
(
"field59"
,
field59
);
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field59 error"
);
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
private
String
getAccount
()
{
try
{
String
account
=
""
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
String
iban
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.CdtrAcct.Id.IBAN"
);
String
otherId
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.CdtrAcct.Id.Othr.Id"
);
//String schmeNameCd = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "CdtTrfTxInf.DbtrAgtAcct.Id.SchmeNm.Cd");
if
(
StringUtil
.
isNotEmpty
(
iban
))
{
account
=
"/"
+
iban
;
}
else
if
(
StringUtil
.
isNotEmpty
(
otherId
))
{
account
=
"//CH"
+
otherId
;
}
if
(
StringUtil
.
isNotEmpty
(
account
)
&&
account
.
length
()
>
35
)
{
account
=
account
.
substring
(
0
,
35
);
}
return
account
;
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field70Generate.java
View file @
5736a006
...
@@ -4,14 +4,10 @@ import com.prowidesoftware.brilliance.constants.Mx2MtConstants;
...
@@ -4,14 +4,10 @@ import com.prowidesoftware.brilliance.constants.Mx2MtConstants;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
org.dom4j.Document
;
import
com.prowidesoftware.swift.model.mx.dic.CreditTransferTransactionInformation11
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.List
;
/**
/**
* 取此节点按4*35的格式拆分,放入70栏位中
* 取此节点按4*35的格式拆分,放入70栏位中
* <CdtTrfTxInf>[1]<RmtInf><Ustrd>[1]
* <CdtTrfTxInf>[1]<RmtInf><Ustrd>[1]
...
@@ -20,28 +16,17 @@ public class Field70Generate extends AbstractMx2MtFieldsGenerate {
...
@@ -20,28 +16,17 @@ public class Field70Generate extends AbstractMx2MtFieldsGenerate {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
.
impl
.
Field70Generate
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
.
impl
.
Field70Generate
.
class
);
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
logger
.
info
(
"Field70Generate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
String
field70
=
""
;
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
return
;
int
ustrdCounts
=
getXmlNodeCounts
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.RmtInf.Ustrd"
);
}
if
(
ustrdCounts
>
0
)
{
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
String
ustrd
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.RmtInf.Ustrd(0)"
);
List
<
CreditTransferTransactionInformation11
>
cdtTrfTxInf
=
fiToFICstmrCdtTrf
.
getCdtTrfTxInf
();
field70
=
StringUtil
.
getStringByEnter
(
ustrd
,
35
,
4
);
if
(
cdtTrfTxInf
!=
null
&&
cdtTrfTxInf
.
size
()
>
0
){
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getRmtInf
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getRmtInf
().
getUstrd
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getRmtInf
().
getUstrd
().
get
(
0
)
!=
null
){
String
s
=
cdtTrfTxInf
.
get
(
0
).
getRmtInf
().
getUstrd
().
get
(
0
);
StringUtil
.
getStringByEnter
(
s
,
35
,
4
);
map
.
put
(
"field70"
,
s
);
}
}
}
}
catch
(
Exception
e
)
{
map
.
put
(
"field70"
,
field70
);
logger
.
error
(
e
.
getMessage
());
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field70 error"
);
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
()
);
}
}
}
}
}
}
\ No newline at end of file
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field71AGenerate.java
View file @
5736a006
...
@@ -4,9 +4,12 @@ import com.prowidesoftware.brilliance.constants.Mx2MtConstants;
...
@@ -4,9 +4,12 @@ import com.prowidesoftware.brilliance.constants.Mx2MtConstants;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.util.NumberUtil
;
import
com.prowidesoftware.brilliance.util.NumberUtil
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
com.prowidesoftware.swift.model.mx.dic.ChargeBearerType1Code
;
import
com.prowidesoftware.swift.model.mx.dic.CreditTransferTransactionInformation11
;
import
com.prowidesoftware.swift.model.mx.dic.CreditTransferTransactionInformation11
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
org.dom4j.Document
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -28,59 +31,29 @@ public class Field71AGenerate extends AbstractMx2MtFieldsGenerate {
...
@@ -28,59 +31,29 @@ public class Field71AGenerate extends AbstractMx2MtFieldsGenerate {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
.
impl
.
Field71AGenerate
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
.
impl
.
Field71AGenerate
.
class
);
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
logger
.
info
(
"Field71AGenerate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
String
field71Option
=
""
;
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
String
field71
=
""
;
return
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
}
String
chrgBr
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.ChrgBr"
);
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
if
(
StringUtil
.
isNotEmpty
(
chrgBr
))
{
List
<
CreditTransferTransactionInformation11
>
cdtTrfTxInf
=
fiToFICstmrCdtTrf
.
getCdtTrfTxInf
();
if
(
ChargeBearerType1Code
.
valueOf
(
chrgBr
).
equals
(
ChargeBearerType1Code
.
CRED
))
{
if
(
cdtTrfTxInf
!=
null
&&
cdtTrfTxInf
.
size
()
>
0
){
field71Option
=
"BEN"
;
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
}
else
if
(
ChargeBearerType1Code
.
valueOf
(
chrgBr
).
equals
(
ChargeBearerType1Code
.
DEBT
))
{
&&
cdtTrfTxInf
.
get
(
0
).
getChrgBr
()
!=
null
field71Option
=
"OUR"
;
&&
cdtTrfTxInf
.
get
(
0
).
getChrgBr
().
value
()
!=
null
)
{
}
else
if
(
ChargeBearerType1Code
.
valueOf
(
chrgBr
).
equals
(
ChargeBearerType1Code
.
SHAR
))
{
String
field71A_mx
=
cdtTrfTxInf
.
get
(
0
).
getChrgBr
().
value
();
field71Option
=
"SHA"
;
String
field71A
=
""
;
}
if
(
"CRED"
.
equals
(
field71A_mx
))
String
amt
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.ChrgsInf"
);
{
String
ccy
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.ChrgsInf@Ccy"
);
field71A
=
"BEN"
;
if
(
StringUtil
.
isNotEmpty
(
amt
)
&&
StringUtil
.
isNotEmpty
(
ccy
))
{
}
else
if
(
"DEBT"
.
equals
(
field71A_mx
))
{
field71
=
ccy
+
NumberUtil
.
formatAmt
(
new
BigDecimal
(
amt
),
ccy
);
field71A
=
"OUR"
;
}
else
if
(
"SHAR"
.
equals
(
field71A_mx
))
{
field71A
=
"SHA"
;
}
map
.
put
(
"field71A"
,
field71A
);
}
else
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getChrgsInf
().
size
()
>
0
&&
cdtTrfTxInf
.
get
(
0
).
getChrgsInf
().
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getChrgsInf
().
get
(
0
).
getAmt
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getChrgsInf
().
get
(
0
).
getAmt
().
getCcy
()
!=
null
)
{
if
(
"BEN"
.
equals
(
map
.
get
(
"field71A"
))
||
"SHA"
.
equals
(
map
.
get
(
"field71A"
))){
String
ccy
=
cdtTrfTxInf
.
get
(
0
).
getChrgsInf
().
get
(
0
).
getAmt
().
getCcy
();
BigDecimal
amt
=
cdtTrfTxInf
.
get
(
0
).
getChrgsInf
().
get
(
0
).
getAmt
().
getValue
();
String
amtStr
=
NumberUtil
.
formatAmt
(
amt
,
ccy
);
map
.
put
(
"field71F"
,
ccy
+
amtStr
);
}
}
else
if
(
cdtTrfTxInf
!=
null
&&
cdtTrfTxInf
.
size
()
>
0
){
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getChrgsInf
().
size
()
>
0
&&
cdtTrfTxInf
.
get
(
0
).
getChrgsInf
().
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getChrgsInf
().
get
(
0
).
getAmt
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getChrgsInf
().
get
(
0
).
getAmt
().
getCcy
()
!=
null
)
{
if
(
"OUR"
.
equals
(
map
.
get
(
"field71A"
))){
String
ccy
=
cdtTrfTxInf
.
get
(
0
).
getChrgsInf
().
get
(
0
).
getAmt
().
getCcy
();
BigDecimal
amt
=
cdtTrfTxInf
.
get
(
0
).
getChrgsInf
().
get
(
0
).
getAmt
().
getValue
();
String
amtStr
=
NumberUtil
.
formatAmt
(
amt
,
ccy
);
map
.
put
(
"field71G"
,
ccy
+
amtStr
);
}
}
}
}
}
}
map
.
put
(
"field71Option"
,
field71Option
);
map
.
put
(
"field71"
,
field71
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
throw
new
SwiftException
(
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field71A error"
);
}
}
}
}
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field72Generate.java
View file @
5736a006
...
@@ -3,12 +3,12 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
...
@@ -3,12 +3,12 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
com.prowidesoftware.brilliance.util.StringUtil
;
import
com.prowidesoftware.swift.model.mx.dic.CreditTransferTransactionInformation11
;
import
org.dom4j.Document
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -25,85 +25,44 @@ public class Field72Generate extends AbstractMx2MtFieldsGenerate {
...
@@ -25,85 +25,44 @@ public class Field72Generate extends AbstractMx2MtFieldsGenerate {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
.
impl
.
Field72Generate
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
.
impl
.
Field72Generate
.
class
);
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
logger
.
info
(
"Field72Generate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
List
<
String
>
field72List
=
new
ArrayList
<>();
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
List
<
String
>
field72TmpList
=
new
ArrayList
<>();
return
;
String
field72
=
""
;
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
String
bicCode
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.PrvsInstgAgt1.FinInstnId.BICFI"
);
String
name
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.PrvsInstgAgt1.FinInstnId.Nm"
);
if
(
StringUtil
.
isNotEmpty
(
bicCode
))
{
bicCode
=
Mx2MtConstants
.
INS
+
bicCode
;
field72TmpList
.
addAll
(
StringUtil
.
outStringList
(
bicCode
,
35
,
"//"
));
}
else
if
(
StringUtil
.
isNotEmpty
(
name
))
{
name
=
Mx2MtConstants
.
INS
+
name
;
field72TmpList
.
addAll
(
StringUtil
.
outStringList
(
name
,
35
,
"//"
));
}
}
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
String
cdtrAgtInstrInf
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.InstrForCdtrAgt.InstrInf"
);
List
<
CreditTransferTransactionInformation11
>
cdtTrfTxInf
=
fiToFICstmrCdtTrf
.
getCdtTrfTxInf
();
if
(
StringUtil
.
isNotEmpty
(
cdtrAgtInstrInf
))
{
if
(
cdtTrfTxInf
!=
null
&&
cdtTrfTxInf
.
size
()
>
0
){
cdtrAgtInstrInf
=
Mx2MtConstants
.
ACC
+
cdtrAgtInstrInf
;
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
field72TmpList
.
addAll
(
StringUtil
.
outStringList
(
cdtrAgtInstrInf
,
35
,
"//"
));
&&
cdtTrfTxInf
.
get
(
0
).
getPrvsInstgAgt
()
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getPrvsInstgAgt
().
getFinInstnId
()
!=
null
){
if
(
cdtTrfTxInf
.
get
(
0
).
getPrvsInstgAgt
().
getFinInstnId
().
getBIC
()
!=
null
)
{
map
.
put
(
"field72Adr1"
,
"/INS/"
+
cdtTrfTxInf
.
get
(
0
).
getPrvsInstgAgt
().
getFinInstnId
().
getBIC
());
}
if
(
cdtTrfTxInf
.
get
(
0
).
getPrvsInstgAgt
().
getFinInstnId
().
getNm
()
!=
null
){
String
str
=
cdtTrfTxInf
.
get
(
0
).
getPrvsInstgAgt
().
getFinInstnId
().
getNm
();
String
strs
=
cutForStr
(
str
,
35
);
map
.
put
(
"field72Adr2"
,
"/INS/"
+
strs
);
}
}
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getInstrForCdtrAgt
().
size
()
>
0
&&
cdtTrfTxInf
.
get
(
0
).
getInstrForCdtrAgt
().
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getInstrForCdtrAgt
().
get
(
0
).
getInstrInf
()
!=
null
){
String
str
=
cdtTrfTxInf
.
get
(
0
).
getInstrForCdtrAgt
().
get
(
0
).
getInstrInf
();
String
strs
=
cutForStr
(
str
,
35
);
map
.
put
(
"field72Adr3"
,
"/ACC/"
+
strs
);
}
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getInstrForNxtAgt
().
size
()
>
0
&&
cdtTrfTxInf
.
get
(
0
).
getInstrForNxtAgt
().
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getInstrForNxtAgt
().
get
(
0
).
getInstrInf
()
!=
null
){
String
str
=
cdtTrfTxInf
.
get
(
0
).
getInstrForNxtAgt
().
get
(
0
).
getInstrInf
();
String
strs
=
cutForStr
(
str
,
35
);
map
.
put
(
"field72Adr4"
,
"/REC/"
+
strs
);
}
}
}
}
catch
(
Exception
e
)
{
String
nxtAgtInstrInf
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.InstrForNxtAgt.InstrInf"
);
logger
.
error
(
e
.
getMessage
());
if
(
StringUtil
.
isNotEmpty
(
nxtAgtInstrInf
))
{
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field72 error"
);
nxtAgtInstrInf
=
Mx2MtConstants
.
REC
+
nxtAgtInstrInf
;
}
field72TmpList
.
addAll
(
StringUtil
.
outStringList
(
nxtAgtInstrInf
,
35
,
"//"
));
}
//循环截取多少位字节并以//隔开
public
String
cutForStr
(
String
str
,
int
n
){
String
line
=
""
;
byte
[]
b1
=
str
.
getBytes
();
for
(
int
i
=
0
;
i
<=
Math
.
ceil
(
b1
.
length
/
n
);
i
++){
int
b
=
str
.
getBytes
().
length
;
if
(
b
>
15
){
String
s
=
cutBeginStr
(
str
,
n
);
line
=
line
+
s
+
"//"
;
str
=
str
.
substring
(
s
.
length
());
}
else
{
line
=
line
+
str
;
}
}
}
int
maxSize
=
field72TmpList
.
size
()
>
6
?
6
:
field72TmpList
.
size
();
return
line
;
if
(
maxSize
>
0
)
{
}
for
(
int
i
=
0
;
i
<
maxSize
;
i
++)
{
if
(
i
==
0
)
{
//截取多少位字节
field72List
.
add
(
":72:"
+
field72TmpList
.
get
(
i
));
public
static
String
cutBeginStr
(
String
strs
,
int
length
){
}
else
{
int
sum
=
0
;
field72List
.
add
(
field72TmpList
.
get
(
i
));
String
finalStr
=
""
;
}
if
(
null
==
strs
||
strs
.
getBytes
().
length
<=
length
){
finalStr
=
(
strs
==
null
?
""
:
strs
);
}
else
{
for
(
int
i
=
0
;
i
<
strs
.
length
();
i
++){
String
str
=
strs
.
substring
(
i
,
i
+
1
);
//累加单个字符字节数
sum
+=
str
.
getBytes
().
length
;
if
(
sum
>
length
){
finalStr
=
strs
.
substring
(
0
,
i
);
break
;
}
}
}
}
map
.
put
(
"field72List"
,
field72List
);
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
return
finalStr
;
}
}
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt103/impl/Field77BGenerate.java
View file @
5736a006
...
@@ -3,14 +3,10 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
...
@@ -3,14 +3,10 @@ package com.prowidesoftware.brilliance.mx2mt.mt103.impl;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.constants.Mx2MtConstants
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.exception.SwiftException
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate
;
import
com.prowidesoftware.swift.model.mx.MxPacs00800102
;
import
org.dom4j.Document
;
import
com.prowidesoftware.swift.model.mx.dic.CreditTransferTransactionInformation11
;
import
com.prowidesoftware.swift.model.mx.dic.FIToFICustomerCreditTransferV02
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.List
;
/**
/**
* // 1,取<RgltryRptg>[1]<Dtls>[1]<Inf>[1]作为第一行信息
* // 1,取<RgltryRptg>[1]<Dtls>[1]<Inf>[1]作为第一行信息
* //2,取<RgltryRptg>[2]<Dtls>[1]<Inf>[1]作为第二行信息
* //2,取<RgltryRptg>[2]<Dtls>[1]<Inf>[1]作为第二行信息
...
@@ -21,44 +17,33 @@ public class Field77BGenerate extends AbstractMx2MtFieldsGenerate {
...
@@ -21,44 +17,33 @@ public class Field77BGenerate extends AbstractMx2MtFieldsGenerate {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
.
impl
.
Field77BGenerate
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
com
.
prowidesoftware
.
brilliance
.
mx2mt
.
mt103
.
impl
.
Field77BGenerate
.
class
);
@Override
@Override
public
void
fieldsGenerate
()
throws
SwiftException
{
public
void
fieldsGenerate
()
throws
SwiftException
{
logger
.
info
(
"Field77BGenerate start."
);
try
{
try
{
MxPacs00800102
obj
=
(
MxPacs00800102
)
map
.
get
(
Mx2MtConstants
.
MX_OBJECT
);
String
field77B
=
""
;
if
(
obj
==
null
||
obj
.
getFIToFICstmrCdtTrf
()
==
null
)
{
Document
document
=
(
Document
)
map
.
get
(
Mx2MtConstants
.
MX_XML_DOCUMENT
);
return
;
int
size
=
getXmlNodeCounts
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.RgltryRptg"
);
}
if
(
size
>
0
)
{
FIToFICustomerCreditTransferV02
fiToFICstmrCdtTrf
=
obj
.
getFIToFICstmrCdtTrf
();
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
List
<
CreditTransferTransactionInformation11
>
cdtTrfTxInf
=
fiToFICstmrCdtTrf
.
getCdtTrfTxInf
();
if
(
i
==
3
)
break
;
if
(
cdtTrfTxInf
!=
null
&&
cdtTrfTxInf
.
size
()
>
0
){
String
dtlsInf
=
getXmlNodeValue
(
Mx2MtConstants
.
MAINBODY_PARENT_ELEMENT_NAME
,
document
,
"CdtTrfTxInf.RgltryRptg("
+
i
+
").Dtls.Inf"
);
if
(
cdtTrfTxInf
.
get
(
0
)
!=
null
if
(
i
==
0
)
{
&&
cdtTrfTxInf
.
get
(
0
).
getRgltryRptg
().
size
()
>
0
){
dtlsInf
=
"/"
+
dtlsInf
;
if
(
cdtTrfTxInf
.
get
(
0
).
getRgltryRptg
().
get
(
0
)
!=
null
}
else
{
&&
cdtTrfTxInf
.
get
(
0
).
getRgltryRptg
().
get
(
0
).
getDtls
().
size
()
>
0
dtlsInf
=
"//"
+
dtlsInf
;
&&
cdtTrfTxInf
.
get
(
0
).
getRgltryRptg
().
get
(
0
).
getDtls
().
get
(
0
).
getInf
().
size
()
>
0
}
&&
cdtTrfTxInf
.
get
(
0
).
getRgltryRptg
().
get
(
0
).
getDtls
().
get
(
0
).
getInf
().
get
(
0
)
!=
null
)
{
if
(
dtlsInf
.
length
()
>
35
)
{
if
(
cdtTrfTxInf
.
get
(
0
).
getRgltryRptg
().
get
(
1
)
!=
null
dtlsInf
=
dtlsInf
.
substring
(
0
,
35
);
&&
cdtTrfTxInf
.
get
(
0
).
getRgltryRptg
().
get
(
1
).
getDtls
().
size
()
>
0
}
&&
cdtTrfTxInf
.
get
(
0
).
getRgltryRptg
().
get
(
1
).
getDtls
().
get
(
0
)
!=
null
if
(
i
==
0
)
{
&&
cdtTrfTxInf
.
get
(
0
).
getRgltryRptg
().
get
(
1
).
getDtls
().
get
(
0
).
getInf
().
size
()
>
0
field77B
+=
dtlsInf
;
&&
cdtTrfTxInf
.
get
(
0
).
getRgltryRptg
().
get
(
1
).
getDtls
().
get
(
0
).
getInf
().
get
(
0
)
!=
null
){
}
else
{
if
(
cdtTrfTxInf
.
get
(
0
).
getRgltryRptg
().
get
(
2
)
!=
null
field77B
+=
Mx2MtConstants
.
NEW_LINE
+
dtlsInf
;
&&
cdtTrfTxInf
.
get
(
0
).
getRgltryRptg
().
get
(
2
).
getDtls
().
size
()
>
0
&&
cdtTrfTxInf
.
get
(
0
).
getRgltryRptg
().
get
(
2
).
getDtls
().
get
(
0
)
!=
null
&&
cdtTrfTxInf
.
get
(
0
).
getRgltryRptg
().
get
(
2
).
getDtls
().
get
(
0
).
getInf
().
size
()
>
0
&&
cdtTrfTxInf
.
get
(
0
).
getRgltryRptg
().
get
(
2
).
getDtls
().
get
(
0
).
getInf
().
get
(
0
)
!=
null
){
map
.
put
(
"field77B"
,
cdtTrfTxInf
.
get
(
0
).
getRgltryRptg
().
get
(
0
).
getDtls
().
get
(
0
).
getInf
().
get
(
0
)
+
Mx2MtConstants
.
NEW_LINE
+
cdtTrfTxInf
.
get
(
0
).
getRgltryRptg
().
get
(
1
).
getDtls
().
get
(
0
).
getInf
().
get
(
0
)
+
Mx2MtConstants
.
NEW_LINE
+
cdtTrfTxInf
.
get
(
0
).
getRgltryRptg
().
get
(
2
).
getDtls
().
get
(
0
).
getInf
().
get
(
0
));
}
}
}
}
}
}
}
}
}
catch
(
Exception
e
)
{
map
.
put
(
"field77B"
,
field77B
);
logger
.
error
(
e
.
getMessage
());
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
"ERROR"
,
"Convert MT103 Field77B error"
);
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
()
);
}
}
}
}
}
}
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt940950/Mx2Mt950Creator.java
→
src/main/java/com/prowidesoftware/brilliance/mx2mt/mt940950/Mx2Mt9
409
50Creator.java
View file @
5736a006
...
@@ -15,9 +15,9 @@ import org.slf4j.LoggerFactory;
...
@@ -15,9 +15,9 @@ import org.slf4j.LoggerFactory;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
public
class
Mx2Mt950Creator
extends
AbstractMx2MtCreator
{
public
class
Mx2Mt9
409
50Creator
extends
AbstractMx2MtCreator
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Mx2Mt950Creator
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Mx2Mt9
409
50Creator
.
class
);
/**
/**
* Object MxCamt05300102
* Object MxCamt05300102
...
@@ -123,7 +123,8 @@ public class Mx2Mt950Creator extends AbstractMx2MtCreator {
...
@@ -123,7 +123,8 @@ public class Mx2Mt950Creator extends AbstractMx2MtCreator {
* set filed 65 = ""
* set filed 65 = ""
* set filed 86 = ""
* set filed 86 = ""
*/
*/
private
void
postProcess
()
{
@Override
public
void
postProcess
()
{
if
(
Mx2MtConstants
.
MT_TYPE_950
.
equals
(
getMtType
()))
{
if
(
Mx2MtConstants
.
MT_TYPE_950
.
equals
(
getMtType
()))
{
map
.
put
(
"field21"
,
""
);
map
.
put
(
"field21"
,
""
);
map
.
put
(
"field65"
,
""
);
map
.
put
(
"field65"
,
""
);
...
...
src/main/java/com/prowidesoftware/brilliance/util/StringUtil.java
View file @
5736a006
...
@@ -216,10 +216,6 @@ public abstract class StringUtil {
...
@@ -216,10 +216,6 @@ public abstract class StringUtil {
return
str
.
substring
(
2
);
return
str
.
substring
(
2
);
}
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
fillWithChar
(
"1"
,
"0"
,
"left"
,
2
));
}
/***
/***
* 字符串填充
* 字符串填充
*
*
...
@@ -390,4 +386,30 @@ public abstract class StringUtil {
...
@@ -390,4 +386,30 @@ public abstract class StringUtil {
return
String
.
valueOf
(
a
);
return
String
.
valueOf
(
a
);
}
}
/**
*
* @param str
* @param lineLength
* @param separatorChar
* @return
*/
public
static
List
<
String
>
outStringList
(
String
str
,
int
lineLength
,
String
separatorChar
)
{
if
(
isEmpty
(
str
))
{
return
null
;
}
List
<
String
>
list
=
new
ArrayList
<>();
while
(
str
.
length
()
>
lineLength
)
{
list
.
add
(
str
.
substring
(
0
,
lineLength
));
str
=
separatorChar
+
str
.
substring
(
lineLength
);
}
list
.
add
(
str
);
return
list
;
}
public
static
void
main
(
String
[]
args
)
{
String
str
=
"/INS/qwerqwertrewertdfgrfrhfsedfgyhokjoknksdnkqwerqwertrewertdfgrfrhfsedfgyhokjoknksdnk"
;
List
<
String
>
list
=
outStringList
(
str
,
35
,
"//"
);
list
.
forEach
(
str0
->
System
.
out
.
println
(
str0
));
}
}
}
src/main/java/com/prowidesoftware/brilliance/util/XmlUtil.java
0 → 100644
View file @
5736a006
package
com
.
prowidesoftware
.
brilliance
.
util
;
import
org.apache.commons.io.FileUtils
;
import
org.dom4j.*
;
import
org.dom4j.io.SAXReader
;
import
java.io.File
;
import
java.io.IOException
;
import
java.net.URL
;
import
java.util.*
;
public
class
XmlUtil
{
public
static
String
getRelativeName
(
File
f
,
String
s
)
{
String
MAIN
=
"cfg\\main"
;
if
(!
f
.
getPath
().
contains
(
s
)
&&
!
f
.
getPath
().
contains
(
MAIN
))
{
return
f
.
getName
();
}
String
path
=
f
.
getPath
();
int
index
=
path
.
indexOf
(
s
);
String
relativePath
=
null
;
if
(
index
==
-
1
)
{
index
=
path
.
indexOf
(
MAIN
);
}
relativePath
=
path
.
substring
(
index
);
relativePath
=
relativePath
.
replace
(
"\\"
,
"/"
);
relativePath
=
relativePath
.
substring
(
s
.
length
()
+
1
);
if
(
relativePath
.
endsWith
(
".xml"
))
relativePath
=
relativePath
.
substring
(
0
,
relativePath
.
length
()
-
4
);
return
relativePath
;
}
public
static
String
getXmlNode
(
String
xmlstr
,
String
path
)
throws
DocumentException
{
return
getXmlNodeValue
(
DocumentHelper
.
parseText
(
xmlstr
),
path
);
}
/**
* key = child element name
* value = parent element name
* @param doc
* @return
*/
public
static
Map
<
String
,
String
>
getParentElementMaps
(
Document
doc
)
{
Map
<
String
,
String
>
maps
=
new
HashMap
<>();
Element
rootElement
=
doc
.
getRootElement
();
String
rootElementName
=
rootElement
.
getName
();
processElementMaps
(
maps
,
rootElement
.
elements
(),
rootElementName
);
return
maps
;
}
public
static
void
processElementMaps
(
Map
maps
,
List
elements
,
String
parentElementName
)
{
if
(
elements
!=
null
&&
elements
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
elements
.
size
();
i
++)
{
Element
element
=
(
Element
)
elements
.
get
(
i
);
maps
.
put
(
element
.
getName
(),
parentElementName
);
processElementMaps
(
maps
,
element
.
elements
(),
parentElementName
+
"."
+
element
.
getName
());
}
}
}
/**
* 获取文档对象的指定路径的值
*
* @param doc
* @param path
* @return
*/
@SuppressWarnings
(
"unchecked"
)
public
static
String
getXmlNodeValue
(
Document
doc
,
String
path
)
{
String
[]
paths
=
path
.
split
(
"@"
);
String
[]
layers
=
paths
[
0
].
split
(
"\\."
);
Element
rootElement
=
doc
.
getRootElement
();
Element
curElement
=
rootElement
;
if
(
layers
[
0
].
equals
(
rootElement
.
getName
()))
{
for
(
int
i
=
1
;
i
<
layers
.
length
;
i
++)
{
int
startIndex
=
layers
[
i
].
indexOf
(
'('
);
if
(-
1
!=
startIndex
)
{
int
endIndex
=
layers
[
i
].
indexOf
(
')'
);
int
num
=
Integer
.
parseInt
(
layers
[
i
].
substring
(
startIndex
+
1
,
endIndex
));
layers
[
i
]
=
layers
[
i
].
substring
(
0
,
startIndex
);
List
<
Element
>
subElements
=
curElement
.
elements
(
layers
[
i
]);
Element
subElement
=
subElements
.
get
(
num
);
curElement
=
subElement
;
}
else
{
Element
subElement
=
curElement
.
element
(
layers
[
i
]);
if
(
subElement
==
null
)
{
return
null
;
}
curElement
=
subElement
;
}
}
if
(
paths
.
length
>
1
)
return
curElement
.
attributeValue
(
paths
[
paths
.
length
-
1
]);
return
curElement
.
getText
();
}
return
null
;
}
public
static
String
getXmlValue
(
String
xmlStr
,
String
etag
)
{
try
{
Document
document
=
DocumentHelper
.
parseText
(
xmlStr
);
return
getXmlNodeValue
(
document
,
etag
);
}
catch
(
DocumentException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
return
null
;
}
/**
* 获取配置文件Document对象
*
* @param url
* @return
*/
public
static
Document
getDocument
(
URL
url
)
{
SAXReader
saxReader
=
new
SAXReader
();
try
{
Document
doc
=
saxReader
.
read
(
url
);
return
doc
;
}
catch
(
DocumentException
e
)
{
throw
new
RuntimeException
(
"get document ["
+
url
+
"] error."
,
e
);
}
}
/**
* 由路径和文件名拼出资源路径
*
* @param path
* @param filename
* @return
*/
public
static
String
getPath
(
String
path
,
String
filename
)
{
if
(!
filename
.
endsWith
(
".xml"
))
{
filename
+=
".xml"
;
}
return
path
+
"/"
+
filename
;
}
public
static
boolean
isXpath
(
String
type
)
{
return
(!
StringUtil
.
isEmpty
(
type
)
&&
type
.
equalsIgnoreCase
(
"xpath"
))
?
true
:
false
;
}
public
static
int
getChildrenCount
(
Branch
document
,
String
path
,
String
type
)
{
if
(
isXpath
(
type
))
return
document
.
selectNodes
(
path
).
size
();
else
{
String
[]
paths
=
path
.
split
(
"@"
);
String
[]
layers
=
paths
[
0
].
split
(
"\\."
);
Element
rootElement
=
((
Document
)
document
).
getRootElement
();
Element
curElement
=
rootElement
;
if
(
layers
[
0
].
equals
(
rootElement
.
getName
()))
{
for
(
int
i
=
1
;
i
<
layers
.
length
-
1
;
i
++)
{
int
startIndex
=
layers
[
i
].
indexOf
(
'('
);
if
(-
1
!=
startIndex
)
{
int
endIndex
=
layers
[
i
].
indexOf
(
')'
);
int
num
=
Integer
.
parseInt
(
layers
[
i
].
substring
(
startIndex
+
1
,
endIndex
));
String
mutiLayer
=
layers
[
i
].
substring
(
0
,
startIndex
);
List
<
Element
>
subElements
=
curElement
.
elements
(
mutiLayer
);
Element
subElement
=
null
;
int
size
=
subElements
.
size
();
if
(
num
>=
size
)
{
subElement
=
curElement
.
addElement
(
mutiLayer
);
}
else
{
subElement
=
subElements
.
get
(
num
);
}
curElement
=
subElement
;
}
else
{
Element
subElement
=
null
;
if
(
layers
[
i
].
contains
(
":"
))
subElement
=
curElement
.
element
(
layers
[
i
].
substring
(
layers
[
i
].
indexOf
(
':'
)
+
1
));
else
subElement
=
curElement
.
element
(
layers
[
i
]);
if
(
subElement
==
null
)
{
subElement
=
curElement
.
addElement
(
layers
[
i
]);
}
curElement
=
subElement
;
}
}
}
return
curElement
.
elements
(
layers
[
layers
.
length
-
1
]).
size
();
}
}
public
static
void
main
(
String
[]
args
)
throws
IOException
,
DocumentException
{
// File file = new File(System.getProperty("user.dir") + "\\src\\main\\resources\\swiftXml\\MxPacs00900102.xml");
/* File file = new File("d:/test/test.xml");
String xmlStr = FileUtils.readFileToString(file);
Document document = DocumentHelper.parseText(xmlStr);
String value = getXmlNodeValue(document, "Document.BkToCstmrStmt.GrpHdr.MsgId");
System.out.println(value);*/
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)
+
"\\src\\main\\resources\\swiftXml\\MxPacs00800102.xml"
);
String
xmlStr
=
FileUtils
.
readFileToString
(
file
);
Document
document
=
DocumentHelper
.
parseText
(
xmlStr
);
String
value
=
getXmlNodeValue
(
document
,
"Document.FIToFICstmrCdtTrf.CdtTrfTxInf.SttlmTmIndctn.DbtDtTm"
);
System
.
out
.
println
(
value
);
/*File file = new File(System.getProperty("user.dir") + "\\src\\main\\resources\\swiftXml\\MxPacs00800102.xml");
String xmlStr = FileUtils.readFileToString(file);
Document document = DocumentHelper.parseText(xmlStr);
Map maps = getParentElementMaps(document);
maps.forEach((k,v) -> System.out.println(k + "=" + v));*/
}
}
src/main/resources/swiftXml/MxPacs00800102.xml
View file @
5736a006
<?xml version="1.0" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Doc:Document
xmlns:Doc=
"urn:iso:std:iso:20022:tech:xsd:pacs.008.001.02"
>
<Envelope
xmlns=
"urn:swift:xsd:envelope"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"urn:swift:xsd:envelope ../../../../Schemas/Translator_envelope.xsd"
>
<Doc:FIToFICstmrCdtTrf>
<AppHdr
xmlns=
"urn:iso:std:iso:20022:tech:xsd:head.001.001.02"
>
<Doc:GrpHdr>
<Fr>
<Doc:MsgId>
TBEXO12345
</Doc:MsgId>
<FIId>
<Doc:CreDtTm>
2022-03-13T20:24:42.112+08:00
</Doc:CreDtTm>
<FinInstnId>
<Doc:NbOfTxs>
1
</Doc:NbOfTxs>
<BICFI>
BANKANC0XXX
</BICFI>
<Doc:SttlmInf>
</FinInstnId>
<Doc:SttlmMtd>
INDA
</Doc:SttlmMtd>
</FIId>
<Doc:SttlmAcct>
</Fr>
<To>
<FIId>
<FinInstnId>
<BICFI>
FOOBARC0
</BICFI>
</FinInstnId>
</FIId>
</To>
<BizMsgIdr>
pacs8bizmsgidr02
</BizMsgIdr>
<MsgDefIdr>
pacs.008.001.09
</MsgDefIdr>
<BizSvc>
swift.cbprplus.02
</BizSvc>
<CreDt>
2020-09-08T10:10:47+08:00
</CreDt>
</AppHdr>
<Doc:Document
xmlns:Doc=
"urn:iso:std:iso:20022:tech:xsd:pacs.008.001.02"
>
<Doc:FIToFICstmrCdtTrf>
<Doc:GrpHdr>
<Doc:MsgId>
TBEXO12345
</Doc:MsgId>
<Doc:CreDtTm>
2022-03-13T20:24:42.112+08:00
</Doc:CreDtTm>
<Doc:NbOfTxs>
1
</Doc:NbOfTxs>
<Doc:SttlmInf>
<Doc:SttlmMtd>
INDA
</Doc:SttlmMtd>
<Doc:SttlmAcct>
<Doc:Id>
<Doc:Othr>
<Doc:Id>
00010013800002001234
</Doc:Id>
</Doc:Othr>
</Doc:Id>
</Doc:SttlmAcct>
<Doc:InstgRmbrsmntAgt>
<Doc:FinInstnId>
<Doc:BICFI>
FOOBARC1
</Doc:BICFI>
</Doc:FinInstnId>
</Doc:InstgRmbrsmntAgt>
<Doc:InstdRmbrsmntAgt>
<Doc:FinInstnId>
<Doc:BICFI>
FOOBARC3
</Doc:BICFI>
</Doc:FinInstnId>
</Doc:InstdRmbrsmntAgt>
<Doc:ThrdRmbrsmntAgt>
<Doc:FinInstnId>
<Doc:BICFI>
FOOBARC4
</Doc:BICFI>
</Doc:FinInstnId>
</Doc:ThrdRmbrsmntAgt>
</Doc:SttlmInf>
<Doc:InstgAgt>
<Doc:FinInstnId>
<Doc:BICFI>
FOOBARC0
</Doc:BICFI>
</Doc:FinInstnId>
</Doc:InstgAgt>
<Doc:InstdAgt>
<Doc:FinInstnId>
<Doc:BICFI>
BANKANC0XXX
</Doc:BICFI>
</Doc:FinInstnId>
</Doc:InstdAgt>
</Doc:GrpHdr>
<Doc:CdtTrfTxInf>
<Doc:SttlmTmIndctn>
<Doc:DbtDtTm>
2022-03-13T20:24:42.112+07:00
</Doc:DbtDtTm>
<Doc:CdtDtTm>
2022-03-13T22:30:42.112+07:00
</Doc:CdtDtTm>
</Doc:SttlmTmIndctn>
<Doc:SttlmTmReq>
<Doc:CLSTm>
2022-03-13T21:21:42.112+07:00
</Doc:CLSTm>
</Doc:SttlmTmReq>
<Doc:InstrForCdtrAgt>
<Doc:Cd>
GHJK
</Doc:Cd>
<Doc:InstrInf>
789556
</Doc:InstrInf>
</Doc:InstrForCdtrAgt>
<Doc:PmtTpInf>
<Doc:CtgyPurp>
<Doc:Cd>
BNKK
</Doc:Cd>
</Doc:CtgyPurp>
<Doc:SvcLvl>
<Doc:Cd>
SDVA
</Doc:Cd>
<Doc:Prtry>
1231234165
</Doc:Prtry>
</Doc:SvcLvl>
</Doc:PmtTpInf>
<Doc:Purp>
<Doc:Prtry>
GCY
</Doc:Prtry>
</Doc:Purp>
<Doc:PmtId>
<Doc:InstrId>
GTBEXO12345
</Doc:InstrId>
<Doc:EndToEndId>
GTBEXO12345
</Doc:EndToEndId>
<Doc:TxId>
GTBEXO12345
</Doc:TxId>
<Doc:UETR>
8a562c67-ca16-48ba-b074-65581be6f001
</Doc:UETR>
</Doc:PmtId>
<Doc:IntrBkSttlmAmt
Ccy=
"USD"
>
23453.127
</Doc:IntrBkSttlmAmt>
<Doc:IntrBkSttlmDt>
2022-03-13+08:00
</Doc:IntrBkSttlmDt>
<Doc:InstdAmt
Ccy=
"EUR"
>
1345.12
</Doc:InstdAmt>
<Doc:XchgRate>
17.4357135422
</Doc:XchgRate>
<Doc:ChrgBr>
DEBT
</Doc:ChrgBr>
<Doc:ChrgsInf
Ccy=
"USD"
>
12.43
</Doc:ChrgsInf>
<Doc:Dbtr>
<Doc:Nm>
JOE PurpDOE
</Doc:Nm>
<Doc:PstlAdr>
<Doc:AdrLine>
310 Field Road, NY
</Doc:AdrLine>
<Doc:AdrLine>
XXXX
</Doc:AdrLine>
<Doc:AdrLine>
PSBC
</Doc:AdrLine>
<Doc:AdrLine>
BJSH
</Doc:AdrLine>
</Doc:PstlAdr>
<Doc:Id>
<Doc:OrgId>
<Doc:AnyBIC>
GCYXXXXXX12
</Doc:AnyBIC>
</Doc:OrgId>
</Doc:Id>
</Doc:Dbtr>
<Doc:DbtrAcct>
<Doc:Id>
<Doc:Id>
<Doc:Othr>
<Doc:Othr>
<Doc:Id>
0
0010013800002001234
</Doc:Id>
<Doc:Id>
0
1111001759234567890
</Doc:Id>
</Doc:Othr>
</Doc:Othr>
</Doc:Id>
</Doc:Id>
</Doc:SttlmAcct>
</Doc:DbtrAcct>
</Doc:SttlmInf>
<Doc:DbtrAgt>
<Doc:InstgAgt>
<Doc:FinInstnId>
<Doc:FinInstnId>
<Doc:BICFI>
FOOBARC0
</Doc:BICFI>
<Doc:BIC>
FOOBARC0XXX
</Doc:BIC>
</Doc:FinInstnId>
</Doc:FinInstnId>
</Doc:DbtrAgt>
</Doc:InstgAgt>
<Doc:CdtrAgt>
<Doc:InstdAgt>
<Doc:FinInstnId>
<Doc:FinInstnId>
<Doc:BICFI>
BANKANC7
</Doc:BICFI>
<Doc:BIC>
BANKANC0XXX
</Doc:BIC>
</Doc:FinInstnId>
</Doc:FinInstnId>
</Doc:CdtrAgt>
</Doc:InstdAgt>
<Doc:Cdtr>
</Doc:GrpHdr>
<Doc:Nm>
TEST CORP
</Doc:Nm>
<Doc:CdtTrfTxInf>
<Doc:PstlAdr>
<Doc:SttlmTmIndctn>
<Doc:AdrLine>
Nellis ABC, NV
</Doc:AdrLine>
<Doc:DbtDtTm>
2022-03-13T20:24:42.112+08:00
</Doc:DbtDtTm>
</Doc:PstlAdr>
<Doc:CdtDtTm>
2022-03-13T22:30:42.112+08:00
</Doc:CdtDtTm>
</Doc:Cdtr>
</Doc:SttlmTmIndctn>
<Doc:CdtrAcct>
<Doc:SttlmTmReq>
<Doc:Id>
<Doc:CLSTm>
2022-03-13T21:21:42.112+08:00
</Doc:CLSTm>
<Doc:Othr>
</Doc:SttlmTmReq>
<Doc:Id>
00013500510020179998
</Doc:Id>
<Doc:InstrForCdtrAgt>
</Doc:Othr>
<Doc:Cd>
ghjk
</Doc:Cd>
</Doc:Id>
<Doc:InstrInf>
789556
</Doc:InstrInf>
</Doc:CdtrAcct>
</Doc:InstrForCdtrAgt>
<Doc:IntrmyAgt1>
<Doc:PmtTpInf>
<Doc:FinInstnId>
<Doc:CtgyPurp>
<Doc:BICFI>
FOOBARC6
</Doc:BICFI>
<Doc:Cd>
BNKKJJ
</Doc:Cd>
</Doc:FinInstnId>
</Doc:CtgyPurp>
</Doc:IntrmyAgt1>
<Doc:SvcLvl>
<Doc:RmtInf>
<Doc:Cd>
SDVA
</Doc:Cd>
<Doc:Ustrd>
gechengyang
</Doc:Ustrd>
<Doc:Prtry>
1231234165
</Doc:Prtry>
<Doc:Ustrd>
weicong
</Doc:Ustrd>
</Doc:SvcLvl>
</Doc:RmtInf>
</Doc:PmtTpInf>
<Doc:PrvsInstgAgt1>
<Doc:PmtId>
<Doc:FinInstnId>
<Doc:InstrId>
GTBEXO12345
</Doc:InstrId>
<Doc:BICFI>
FOOBARC7
</Doc:BICFI>
<Doc:EndToEndId>
GTBEXO12345
</Doc:EndToEndId>
</Doc:FinInstnId>
<Doc:TxId>
GTBEXO12345
</Doc:TxId>
</Doc:PrvsInstgAgt1>
</Doc:PmtId>
<Doc:RgltryRptg>
<Doc:IntrBkSttlmAmt
Ccy=
"USD"
>
23453
</Doc:IntrBkSttlmAmt>
<Doc:Dtls>
<Doc:IntrBkSttlmDt>
2022-03-13+08:00
</Doc:IntrBkSttlmDt>
<Doc:Inf>
WUBEISHENGWUHANSHI
</Doc:Inf>
<Doc:ChrgBr>
DEBT
</Doc:ChrgBr>
</Doc:Dtls>
<Doc:Dbtr>
</Doc:RgltryRptg>
<Doc:Nm>
JOE DOE
</Doc:Nm>
<Doc:RgltryRptg>
<Doc:PstlAdr>
<Doc:Dtls>
<Doc:AdrLine>
310 Field Road, NY
</Doc:AdrLine>
<Doc:Inf>
JIANGXIAQU
</Doc:Inf>
<Doc:AdrLine>
XXXX
</Doc:AdrLine>
</Doc:Dtls>
<Doc:AdrLine>
PSBC
</Doc:AdrLine>
</Doc:RgltryRptg>
<Doc:AdrLine>
BJSH
</Doc:AdrLine>
<Doc:RgltryRptg>
</Doc:PstlAdr>
<Doc:Dtls>
<Doc:Id>
<Doc:Inf>
WENHUADADAO
</Doc:Inf>
<Doc:OrgId>
</Doc:Dtls>
<Doc:BICOrBEI>
GCYXXXXXX12
</Doc:BICOrBEI>
</Doc:RgltryRptg>
</Doc:OrgId>
</Doc:CdtTrfTxInf>
</Doc:Id>
</Doc:FIToFICstmrCdtTrf>
</Doc:Dbtr>
</Doc:Document>
<Doc:DbtrAcct>
</Envelope>
<Doc:Id>
\ No newline at end of file
<Doc:Othr>
<Doc:Id>
01111001759234567890
</Doc:Id>
</Doc:Othr>
</Doc:Id>
</Doc:DbtrAcct>
<Doc:DbtrAgt>
<Doc:FinInstnId>
<Doc:BIC>
FOOBARC0XXX
</Doc:BIC>
</Doc:FinInstnId>
</Doc:DbtrAgt>
<Doc:CdtrAgt>
<Doc:FinInstnId>
<Doc:BIC>
BANKANC0XXX
</Doc:BIC>
</Doc:FinInstnId>
</Doc:CdtrAgt>
<Doc:Cdtr>
<Doc:Nm>
TEST CORP
</Doc:Nm>
<Doc:PstlAdr>
<Doc:AdrLine>
Nellis ABC, NV
</Doc:AdrLine>
</Doc:PstlAdr>
</Doc:Cdtr>
<Doc:CdtrAcct>
<Doc:Id>
<Doc:Othr>
<Doc:Id>
00013500510020179998
</Doc:Id>
</Doc:Othr>
</Doc:Id>
</Doc:CdtrAcct>
</Doc:CdtTrfTxInf>
</Doc:FIToFICstmrCdtTrf>
</Doc:Document>
\ No newline at end of file
src/main/resources/template/swift_mt_103.vm
View file @
5736a006
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
#if(!$null.isNull($vm.field20))
#if(!$null.isNull($vm.field20))
:20:$vm.field20
:20:$vm.field20
#end
#end
#if(!$null.isNull($vm.fi
led13CList) && $vm.file
d13CList.size()!=0)
#if(!$null.isNull($vm.fi
eld13CList) && $vm.fiel
d13CList.size()!=0)
#foreach($field13C in $vm.fi
le
d13CList)
#foreach($field13C in $vm.fi
el
d13CList)
:13C:$field13C
:13C:$field13C
#end
#end
#end
#end
...
@@ -27,140 +27,82 @@
...
@@ -27,140 +27,82 @@
#if(!$null.isNull($vm.field36) && $vm.field36.length() > 0)
#if(!$null.isNull($vm.field36) && $vm.field36.length() > 0)
:36:$vm.field36
:36:$vm.field36
#end
#end
#if($vm.field50Key=='A')
#if($vm.field50Option=='A')
#if($vm.field50A)
:50A:$vm.field50
$vm.field50A
#elseif($vm.field50Option=='F')
#end
:50F:$vm.field50
#if($vm.field50Account)
#elseif($vm.field50Option=='K')
:50A:$vm.field50Account
:50k:$vm.field50
#end
#end
#elseif($vm.field50Key=='F')
#if(!$null.isNull($vm.field51) && $vm.field51.length() > 0)
#if($vm.field50Account)
:51A:$vm.field51
:50F:$vm.field50Account
#end
#end
#if($vm.field52Option=='A')
#elseif($vm.field50Key=='K')
:52A:$vm.field52
#if($vm.field50Account)
#elseif($vm.field52Option=='D')
:50K:$vm.field50Account
:52D:$vm.field52
#if($vm.field50Adr)
#end
$vm.field50Adr
#if($vm.field53Option=='A')
#end
:53A:$vm.field53
#end
#elseif($vm.field53Option=='B')
#end
:53B:$vm.field53
#if($vm.field52Key=='A')
#elseif($vm.field53Option=='D')
#if($vm.field52Account)
:53D:$vm.field53
:52A:$vm.field52Account
#end
#end
#if($vm.field54Option=='A')
#elseif($vm.field52Key=='D')
:54A:$vm.field54
#if($vm.field52Account)
#elseif($vm.field54Option=='D')
:52D:$vm.field52Account
:54D:$vm.field54
#if($vm.field52DAdr)
#end
$vm.field52DAdr
#if($vm.field55Option=='A')
#end
:55A:$vm.field55
#end
#elseif($vm.field55Option=='D')
#end
:55D:$vm.field55
#if($vm.field53Key=='A')
#end
#if($vm.field53Account)
#if($vm.field56Option=='A')
:53A:$vm.field53Account
:56A:$vm.field56
#end
#elseif($vm.field56Option=='C')
#elseif($vm.field53Key=='B')
:56C:$vm.field56
#if($vm.field53Account)
#elseif($vm.field56Option=='D')
:53B:$vm.field53Account
:56D:$vm.field56
#end
#end
#elseif($vm.field53Key=='D')
#if($vm.field57Option=='A')
#if($vm.field53Account)
:57A:$vm.field57
:53D:$vm.field53Account
#elseif($vm.field57Option=='C')
#if($vm.field53DAdr)
:57C:$vm.field57
$vm.field53DAdr
#elseif($vm.field57Option=='D')
#end
:57D:$vm.field57
#end
#end
#end
#if($vm.field59Option=='A')
#if($vm.field54Key=='A')
:59A:$vm.field59
#if($vm.field54Account)
#elseif($vm.field59Option=='NOLETTER')
:54A:$vm.field54Account
:59:$vm.field59
#end
#end
#elseif($vm.field54Key=='D')
#if(!$null.isNull($vm.field70) && $vm.field70.length() > 0)
#if($vm.field54Account)
:70:$vm.field70
:54D:$vm.field54Account
#end
#if($vm.field54DAdr)
#if($vm.field71Option=='BEN')
$vm.field54DAdr
:71A:$vm.field71Option
#end
#if(!$null.isNull($vm.field71) && $vm.field71.length() > 0)
#end
:71F:$vm.field71
#end
#end
#if($vm.field55Key=='A')
#elseif($vm.field71Option=='OUR')
#if($vm.field55Account)
:71A:$vm.field71Option
:55A:$vm.field55Account
#if(!$null.isNull($vm.field71) && $vm.field71.length() > 0)
#end
:71G:$vm.field71
#elseif($vm.field55Key=='D')
#end
#if($vm.field55Account)
#elseif($vm.field71Option=='SHA')
:55D:$vm.field55Account
:71A:$vm.field71Option
#if($vm.field55DAdr)
#if(!$null.isNull($vm.field71) && $vm.field71.length() > 0)
$vm.field55DAdr
:71F:$vm.field71
#end
#end
#end
#end
#end
#if(!$null.isNull($vm.field72List) && $vm.field72List.size()!=0)
#if($vm.field56Key=='A')
#foreach($field72 in $vm.field72List)
#if($vm.field56Account)
$field72
:56A:$vm.field56Account
#end
#end
#end
#elseif($vm.field56Key=='C')
#if(!$null.isNull($vm.field77B) && $vm.field77B.length() > 0)
#if($vm.field56Account)
:56C:$vm.field56Account
#end
#elseif($vm.field56Key=='D')
#if($vm.field56Account)
:56D:$vm.field56Account
#if($vm.field56DAdr)
$vm.field56DAdr
#end
#end
#end
#if($vm.field57Key=='A')
#if($vm.field57Account)
:57A:$vm.field57Account
#end
#elseif($vm.field57Key=='C')
#if($vm.field57Account)
:57C:$vm.field57Account
#end
#elseif($vm.field57Key=='D')
:57D:$vm.field57Account
#if($vm.field57DAdr)
$vm.field57DAdr
#end
#end
#if($vm.field59Key=='')
#if($vm.field59Adr)
:59:$vm.field59Adr
#end
#if($vm.field59Account)
:59:$vm.field59Account
#end
#end
#if($vm.field59Key=='A')
#if($vm.field59Account)
:59A:$vm.field59Account
#end
#end
#if($vm.field70)
:70::$vm.field70
#end
:71A:$vm.field71A
#if($vm.field71F)
:71F:$vm.field71F
#end
#if($vm.field71G)
:71G:$vm.field71G
#end
#if(!$null.isNull($vm.field72Adr1) && $vm.field72Adr1.length() > 0)
:72:$vm.field72Adr1
#elseif(!$null.isNull($vm.field72Adr2) && $vm.field72Adr2.length() > 0)
:72:$vm.field72Adr2
#elseif(!$null.isNull($vm.field72Adr3) && $vm.field72Adr3.length() > 0)
:72:$vm.field72Adr3
#elseif(!$null.isNull($vm.field72Adr4) && $vm.field72Adr4.length() > 0)
:72:$vm.field72Adr4
#end
#if(($vm.field77B) && $vm.field77B.length() > 0)
:77B:$vm.field77B
:77B:$vm.field77B
#end
#end
-}#if(!$null.isNull($vm.head5) && $vm.head5.length()>0){5:$vm.head5}#end
-}#if(!$null.isNull($vm.head5) && $vm.head5.length()>0){5:$vm.head5}#end
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