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
915882ea
Commit
915882ea
authored
2 years ago
by
yuanliang
Committed by
chengzhuoshen
2 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mx2ElementCamt053001取消子类实现,提到父类实现
parent
cad27096
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
11 deletions
+43
-11
AbstractMx2ElementCreator.java
...rilliance/swift/mx2element/AbstractMx2ElementCreator.java
+41
-9
Mx2ElementCamt053001Creator.java
...ft/mx2element/camt053001/Mx2ElementCamt053001Creator.java
+2
-2
No files found.
swiftCore/src/main/java/com/brilliance/swift/mx2element/AbstractMx2ElementCreator.java
View file @
915882ea
...
...
@@ -10,12 +10,12 @@ import com.prowidesoftware.swift.model.mx.AbstractMX;
import
java.io.InputStream
;
import
java.lang.reflect.Method
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
public
abstract
class
AbstractMx2ElementCreator
implements
Mx2ElementCreator
{
private
static
final
Pattern
PATTERN_CURVE
=
Pattern
.
compile
(
"\\(([\\.\\:-]?\\w+)+\\)"
);
protected
AbstractMX
abstractMX
;
...
...
@@ -93,36 +93,68 @@ public abstract class AbstractMx2ElementCreator implements Mx2ElementCreator{
type
=
path
.
substring
(
path
.
indexOf
(
"&"
)+
1
);
path
=
path
.
substring
(
0
,
path
.
indexOf
(
"&"
));
}
//处理括号
StringBuffer
sb
=
new
StringBuffer
();
Matcher
matcher
=
PATTERN_CURVE
.
matcher
(
path
);
while
(
matcher
.
find
())
{
String
replace
=
matcher
.
group
().
replaceAll
(
"\\."
,
"-"
);
matcher
.
appendReplacement
(
sb
,
replace
);
}
path
=
matcher
.
appendTail
(
sb
).
toString
();
//需要用. split,然后循环遍历json获取值
String
[]
paths
=
path
.
split
(
"\\."
);
Map
<
String
,
Object
>
tmpMaps
=
jsonMaps
;
for
(
int
i
=
0
;
i
<
paths
.
length
;
i
++)
{
String
p
=
paths
[
i
];
String
subPropName
=
""
;
String
[]
condition
=
null
;
if
(
p
.
indexOf
(
"#"
)
>
-
1
)
{
//判断是否存在子配置文件的引用
int
symbolIndex
=
p
.
indexOf
(
"#"
);
subPropName
=
p
.
substring
(
symbolIndex
+
1
);
p
=
p
.
substring
(
0
,
symbolIndex
);
}
Matcher
pMatch
=
PATTERN_CURVE
.
matcher
(
p
);
if
(
pMatch
.
find
())
{
//判断是否含有括号过滤表达式
condition
=
p
.
substring
(
pMatch
.
start
()
+
1
,
pMatch
.
end
()
-
1
).
split
(
":"
);
p
=
p
.
substring
(
0
,
pMatch
.
start
());
}
Object
obj
=
tmpMaps
.
get
(
p
);
if
(
obj
==
null
)
return
null
;
if
(
StringUtil
.
isNotEmpty
(
subPropName
))
{
return
readSubProp
(
obj
,
subPropName
);
}
else
{
if
(
obj
instanceof
JSONArray
)
{
JSONArray
jsonArray
=
(
JSONArray
)
obj
;
if
(
i
==
paths
.
length
-
1
)
{
JSONArray
jsonArray
=
(
JSONArray
)
obj
;
if
(
i
==
paths
.
length
-
1
)
{
return
jsonArray
;
}
else
{
//不是最后一层
obj
=
jsonArray
.
get
(
0
);
if
(
Objects
.
nonNull
(
condition
))
{
for
(
int
j
=
0
;
j
<
jsonArray
.
size
();
j
++)
{
Object
xmlValue
=
getXmlValue
((
Map
<
String
,
Object
>)
jsonArray
.
get
(
j
),
condition
[
0
].
replaceAll
(
"-"
,
"."
));
if
(
Objects
.
equals
(
condition
[
1
],
xmlValue
))
{
obj
=
jsonArray
.
get
(
j
);
break
;
}
if
(
j
==
jsonArray
.
size
()
-
1
)
{
return
null
;
}
}
}
else
{
obj
=
jsonArray
.
get
(
0
);
}
if
(
obj
instanceof
JSONObject
)
{
tmpMaps
=
(
Map
<
String
,
Object
>)
obj
;
tmpMaps
=
(
Map
<
String
,
Object
>)
obj
;
}
else
{
return
jsonArray
;
}
}
}
else
if
(
obj
instanceof
JSONObject
)
{
tmpMaps
=
(
Map
<
String
,
Object
>)
obj
;
if
(
Objects
.
nonNull
(
condition
))
{
Object
xmlValue
=
getXmlValue
((
Map
<
String
,
Object
>)
obj
,
condition
[
0
].
replaceAll
(
"-"
,
"."
));
if
(!
Objects
.
equals
(
condition
[
1
],
xmlValue
))
{
return
null
;
}
}
tmpMaps
=
(
Map
<
String
,
Object
>)
obj
;
}
else
{
if
(
"bigdecimal"
.
equals
(
type
))
{
value
=
new
BigDecimal
(
String
.
valueOf
(
obj
));
...
...
This diff is collapsed.
Click to expand it.
swiftCore/src/main/java/com/brilliance/swift/mx2element/camt053001/Mx2ElementCamt053001Creator.java
View file @
915882ea
...
...
@@ -18,7 +18,7 @@ import java.math.BigDecimal;
import
java.util.*
;
public
class
Mx2ElementCamt053001Creator
extends
AbstractMx2ElementCreator
{
@Override
/*
@Override
public Map<String, Object> buildElement() {
String messageType = abstractMX.getMxId().getBusinessProcess().name()
+ abstractMX.getMxId().getFunctionality()
...
...
@@ -54,7 +54,7 @@ public class Mx2ElementCamt053001Creator extends AbstractMx2ElementCreator {
}
}
return maps;
}
}
*/
private
Object
invokeHere
(
String
methodName
,
Object
where
)
{
try
{
Method
method
=
getClass
().
getMethod
(
methodName
);
...
...
This diff is collapsed.
Click to expand it.
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