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
06393a03
Commit
06393a03
authored
Jul 21, 2022
by
zhanghou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了camt05300108的Mx2ElementCamt053001Creator方法,实现了通过配置文件实现循环节点取值
parent
bd2b93c8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
2 deletions
+77
-2
Mx2ElementCamt053001Creator.java
...ft/mx2element/camt053001/Mx2ElementCamt053001Creator.java
+58
-1
camt053001.properties
swiftCore/src/main/resources/template/camt053001.properties
+2
-1
ntry.properties
swiftCore/src/main/resources/template/ntry.properties
+17
-0
No files found.
swiftCore/src/main/java/com/brilliance/swift/mx2element/camt053001/Mx2ElementCamt053001Creator.java
View file @
06393a03
...
...
@@ -13,6 +13,7 @@ import org.dom4j.DocumentException;
import
org.dom4j.DocumentHelper
;
import
java.io.InputStream
;
import
java.lang.reflect.Method
;
import
java.math.BigDecimal
;
import
java.util.*
;
...
...
@@ -54,8 +55,21 @@ public class Mx2ElementCamt053001Creator extends AbstractMx2ElementCreator {
}
return
maps
;
}
private
Object
invokeHere
(
String
methodName
,
Object
where
)
{
try
{
Method
method
=
getClass
().
getMethod
(
methodName
);
return
method
.
invoke
(
where
);
}
catch
(
final
NoSuchMethodException
e
)
{
throw
new
SwiftException
(
"Method "
+
methodName
+
" does not exist in "
+
getClass
());
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
protected
Object
getXmlValue
(
Map
<
String
,
Object
>
jsonMaps
,
String
path
,
int
count
)
{
Object
value
=
null
;
if
(
path
.
startsWith
(
"@"
))
{
//如果以@开始 表示取值规则采用的函数
return
invokeHere
(
path
.
substring
(
1
),
this
);
}
if
(
path
.
indexOf
(
"?"
)
>
0
)
{
String
[]
childPaths
=
path
.
split
(
"\\?"
);
for
(
String
childPath
:
childPaths
)
{
...
...
@@ -65,6 +79,49 @@ public class Mx2ElementCamt053001Creator extends AbstractMx2ElementCreator {
}
}
}
if
(
path
.
lastIndexOf
(
"#"
)>
0
){
JSONArray
array
=
(
JSONArray
)
getXmlValue
(
jsonMaps
,
path
.
split
(
"#"
)[
0
],
0
);
String
key
=
path
.
substring
(
path
.
indexOf
(
"#"
)+
1
);
String
fileName
=
"/template/"
+
key
+
".properties"
;
InputStream
resourceAsStream
=
AbstractMx2ElementCreator
.
class
.
getResourceAsStream
(
fileName
);
List
<
String
>
properties
=
StringUtil
.
inputStreamToLines
(
resourceAsStream
);
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
List
<
String
>
keyList
=
new
ArrayList
<>();
List
<
String
>
valueList
=
new
ArrayList
<>();
if
(
properties
.
size
()
>
0
)
{
for
(
String
property
:
properties
)
{
if
(
property
.
startsWith
(
"#"
))
{
continue
;
//过滤注释
}
String
[]
strArr
=
property
.
split
(
"="
);
if
(
strArr
.
length
!=
2
)
{
continue
;
//过滤掉不符合规则的配置
}
String
key1
=
strArr
[
0
];
String
value1
=
strArr
[
1
];
if
(
StringUtil
.
isNotEmpty
(
key1
)&&
StringUtil
.
isNotEmpty
(
value1
)){
keyList
.
add
(
key1
);
valueList
.
add
(
value1
);
}
}
}
for
(
int
i
=
0
;
i
<
array
.
size
();
i
++)
{
Map
<
String
,
Object
>
entryMaps
=
new
LinkedHashMap
<>();
for
(
int
j
=
0
;
j
<
valueList
.
size
();
j
++)
{
Object
xmlValue
=
getXmlValue
((
Map
<
String
,
Object
>)
array
.
get
(
i
),
valueList
.
get
(
j
),
0
);
if
(
xmlValue
!=
null
){
entryMaps
.
put
(
keyList
.
get
(
j
),
xmlValue
);
}
}
list
.
add
(
entryMaps
);
}
if
(
list
.
size
()>
0
){
return
list
;
}
else
{
return
null
;
}
//清空ntry中的值将list存入ntry中
}
//获取数据类型,&分隔,默认是string
String
type
=
"string"
;
if
(
path
.
indexOf
(
"&"
)
>
-
1
)
{
...
...
@@ -82,7 +139,7 @@ public class Mx2ElementCamt053001Creator extends AbstractMx2ElementCreator {
for
(
int
i
=
0
;
i
<
paths
.
length
;
i
++)
{
int
j
=
0
;
String
p
=
paths
[
i
];
if
(
p
.
contains
(
"("
)){
if
(
p
.
contains
(
"("
)
&&
p
.
contains
(
")"
)
){
JSONArray
array
=
(
JSONArray
)
tmpMaps
.
get
(
p
.
substring
(
0
,
p
.
indexOf
(
"("
)));
String
[]
split
=
p
.
split
(
":"
);
String
path1
=
split
[
0
].
substring
(
p
.
indexOf
(
"("
)+
1
).
replace
(
"-"
,
"."
);
...
...
swiftCore/src/main/resources/template/camt053001.properties
View file @
06393a03
...
...
@@ -23,7 +23,8 @@ lastPgInd=bkToCstmrStmt.stmt.stmtPgntn.lastPgInd&boolean
#60
#opbdBal=@buildOpbdBalance
#61
ntry
=
@bulidNtry
#ntry=@bulidNtry
ntry
=
bkToCstmrStmt.stmt.ntry#ntry
#62
#clbdBal=@buildClbdBalance
#64
...
...
swiftCore/src/main/resources/template/ntry.properties
0 → 100644
View file @
06393a03
ntryRef
=
ntryRef
ntryAmt
=
amt.value&bigdecimal
ntryCcy
=
amt.ccy
ntryCdtDbtInd
=
cdtDbtInd
ntryRvslInd
=
rvslInd&boolean
ntrySts
=
sts.cd
ntryStsPrtry
=
sts.prtry
ntryBookgDt
=
bookgDt.dt
ntryValDt
=
valDt.dt
ntryAcctSvcrRef
=
acctSvcrRef
ntryBkTxCdDomnCd
=
bkTxCd.domn.cd
ntryBkTxCdFmlyCd
=
bkTxCd.domn.fmly.cd
ntryBkTxCdFmlySubFmlyCd
=
bkTxCd.domn.fmly.subFmlyCd
ntryBkTxCdPrtryCd
=
bkTxCd.prtry.cd
endToEndId
=
ntryDtls.txDtls.refs.endToEndId
addtlTxInf
=
ntryDtls.txDtls.addtlTxInf
\ No newline at end of file
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