Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
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
项目统一框架
amos-boot-biz
Commits
de1ad1a5
Commit
de1ad1a5
authored
Jul 19, 2024
by
邢磊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*)多选逻辑
parent
15ac1b7b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
88 deletions
+85
-88
DPSubServiceImpl.java
...s/boot/module/jyjc/biz/service/impl/DPSubServiceImpl.java
+85
-88
No files found.
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/service/impl/DPSubServiceImpl.java
View file @
de1ad1a5
...
@@ -47,13 +47,13 @@ public class DPSubServiceImpl {
...
@@ -47,13 +47,13 @@ public class DPSubServiceImpl {
@LoadBalanced
@LoadBalanced
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
;
public
JSONObject
commonQuery
(
String
template
,
@RequestBody
Map
<
String
,
Object
>
param
){
public
JSONObject
commonQuery
(
String
template
,
@RequestBody
Map
<
String
,
Object
>
param
)
{
JSONObject
result
=
new
JSONObject
();
JSONObject
result
=
new
JSONObject
();
String
templateJson
=
DpSubUtils
.
getFileContent
(
template
+
".json"
);
String
templateJson
=
DpSubUtils
.
getFileContent
(
template
+
".json"
);
//1、替换json中所有的变量
//1、替换json中所有的变量
if
(!
ValidationUtil
.
isEmpty
(
param
))
{
if
(!
ValidationUtil
.
isEmpty
(
param
))
{
for
(
Map
.
Entry
item
:
param
.
entrySet
())
{
for
(
Map
.
Entry
item
:
param
.
entrySet
())
{
templateJson
=
templateJson
.
replaceAll
(
"\\{"
+
item
.
getKey
()
+
"\\}"
,
item
.
getValue
().
toString
());
templateJson
=
templateJson
.
replaceAll
(
"\\{"
+
item
.
getKey
()
+
"\\}"
,
item
.
getValue
().
toString
());
}
}
}
}
...
@@ -67,7 +67,7 @@ public class DPSubServiceImpl {
...
@@ -67,7 +67,7 @@ public class DPSubServiceImpl {
return
result
;
return
result
;
}
}
public
void
buildContent
(
JSONObject
content
,
JSONObject
tab
){
public
void
buildContent
(
JSONObject
content
,
JSONObject
tab
)
{
Long
formSeq
=
tab
.
getLong
(
"formSeq"
);
Long
formSeq
=
tab
.
getLong
(
"formSeq"
);
Object
resultConvert
=
JsonValueUtils
.
getValueByKey
(
tab
,
"dataConfig"
,
"dataConfig.resultConvert"
);
Object
resultConvert
=
JsonValueUtils
.
getValueByKey
(
tab
,
"dataConfig"
,
"dataConfig.resultConvert"
);
Object
api
=
JsonValueUtils
.
getValueByKey
(
tab
,
"dataConfig"
,
"dataConfig.api"
);
Object
api
=
JsonValueUtils
.
getValueByKey
(
tab
,
"dataConfig"
,
"dataConfig.api"
);
...
@@ -76,17 +76,17 @@ public class DPSubServiceImpl {
...
@@ -76,17 +76,17 @@ public class DPSubServiceImpl {
JSONObject
map
=
content
.
getJSONObject
(
tab
.
getString
(
"key"
));
JSONObject
map
=
content
.
getJSONObject
(
tab
.
getString
(
"key"
));
JSONObject
apiResult
=
new
JSONObject
();
JSONObject
apiResult
=
new
JSONObject
();
if
(!
ValidationUtil
.
isEmpty
(
api
)){
if
(!
ValidationUtil
.
isEmpty
(
api
))
{
ResponseModel
responseModel
=
this
.
getApiResult
((
JSONObject
)
api
,
!
ValidationUtil
.
isEmpty
(
resultConvert
)
?
resultConvert
.
toString
()
:
null
);
ResponseModel
responseModel
=
this
.
getApiResult
((
JSONObject
)
api
,
!
ValidationUtil
.
isEmpty
(
resultConvert
)
?
resultConvert
.
toString
()
:
null
);
if
(!
ValidationUtil
.
isEmpty
(
responseModel
.
getResult
()))
{
if
(!
ValidationUtil
.
isEmpty
(
responseModel
.
getResult
()))
{
apiResult
=
JSONObject
.
parseObject
(
responseModel
.
getResult
().
toString
());
apiResult
=
JSONObject
.
parseObject
(
responseModel
.
getResult
().
toString
());
}
}
}
}
if
(!
ValidationUtil
.
isEmpty
(
formSeq
)){
if
(!
ValidationUtil
.
isEmpty
(
formSeq
))
{
FormSceneModel
formPage
=
Morphic
.
formSceneClient
.
seleteOne
(
formSeq
).
getResult
();
FormSceneModel
formPage
=
Morphic
.
formSceneClient
.
seleteOne
(
formSeq
).
getResult
();
// 1、排除表单隐藏字段
// 1、排除表单隐藏字段
JSONArray
children
=
(
JSONArray
)
JsonValueUtils
.
getValueByKey
(
JSONObject
.
parseObject
(
formPage
.
getContent
()),
"children"
,
"children"
);
JSONArray
children
=
(
JSONArray
)
JsonValueUtils
.
getValueByKey
(
JSONObject
.
parseObject
(
formPage
.
getContent
()),
"children"
,
"children"
);
Object
showHideRules
=
JsonValueUtils
.
getValueByKey
(
JSONObject
.
parseObject
(
formPage
.
getContent
()),
"formConfig"
,
"formConfig.showHideRules"
);
Object
showHideRules
=
JsonValueUtils
.
getValueByKey
(
JSONObject
.
parseObject
(
formPage
.
getContent
()),
"formConfig"
,
"formConfig.showHideRules"
);
// 处理显隐逻辑
// 处理显隐逻辑
...
@@ -99,20 +99,20 @@ public class DPSubServiceImpl {
...
@@ -99,20 +99,20 @@ public class DPSubServiceImpl {
if
(
"pageSection"
.
equals
(
yObj
.
get
(
"componentKey"
))
||
"columnsLayout"
.
equals
(
yObj
.
get
(
"componentKey"
)))
{
// 分组或者布局容器
if
(
"pageSection"
.
equals
(
yObj
.
get
(
"componentKey"
))
||
"columnsLayout"
.
equals
(
yObj
.
get
(
"componentKey"
)))
{
// 分组或者布局容器
List
<
Object
>
mergedArray
=
mergedList
(
yObj
.
getJSONArray
(
"children"
));
List
<
Object
>
mergedArray
=
mergedList
(
yObj
.
getJSONArray
(
"children"
));
// 第一组去除标题
// 第一组去除标题
if
(
i
==
0
||
ValidationUtil
.
isEmpty
(
map
.
get
(
"datas"
))){
if
(
i
==
0
||
ValidationUtil
.
isEmpty
(
map
.
get
(
"datas"
)))
{
this
.
buildContentData
(
map
,
mergedArray
,
apiResult
);
this
.
buildContentData
(
map
,
mergedArray
,
apiResult
);
}
else
{
}
else
{
this
.
buildSubContentData
(
map
,
i
,
yObj
,
mergedArray
,
apiResult
);
this
.
buildSubContentData
(
map
,
i
,
yObj
,
mergedArray
,
apiResult
);
}
}
}
else
if
(
"subForm"
.
equals
(
yObj
.
get
(
"componentKey"
)))
{
// 子表单
}
else
if
(
"subForm"
.
equals
(
yObj
.
get
(
"componentKey"
)))
{
// 子表单
this
.
buildSubFormData
(
map
,
i
,
yObj
,
apiResult
);
this
.
buildSubFormData
(
map
,
i
,
yObj
,
apiResult
);
}
else
if
(
"formTable"
.
equals
(
yObj
.
get
(
"componentKey"
)))
{
}
else
if
(
"formTable"
.
equals
(
yObj
.
get
(
"componentKey"
)))
{
map
=
new
JSONObject
();
map
=
new
JSONObject
();
JSONArray
columns
=
(
JSONArray
)
JsonValueUtils
.
getValueByKey
(
yObj
,
"visualParams"
,
"visualParams.modelTableColumns"
);
JSONArray
columns
=
(
JSONArray
)
JsonValueUtils
.
getValueByKey
(
yObj
,
"visualParams"
,
"visualParams.modelTableColumns"
);
JSONObject
columnWidthMap
=
(
JSONObject
)
columnWidth
;
JSONObject
columnWidthMap
=
(
JSONObject
)
columnWidth
;
columns
.
stream
().
forEach
(
x
->
{
columns
.
stream
().
forEach
(
x
->
{
JSONObject
xObj
=
(
JSONObject
)
x
;
JSONObject
xObj
=
(
JSONObject
)
x
;
if
(!
ValidationUtil
.
isEmpty
(
columnWidthMap
.
get
(
xObj
.
get
(
"dataIndex"
)))){
if
(!
ValidationUtil
.
isEmpty
(
columnWidthMap
.
get
(
xObj
.
get
(
"dataIndex"
))))
{
xObj
.
put
(
"width"
,
columnWidthMap
.
get
(
xObj
.
get
(
"dataIndex"
)));
xObj
.
put
(
"width"
,
columnWidthMap
.
get
(
xObj
.
get
(
"dataIndex"
)));
}
}
});
});
...
@@ -125,15 +125,15 @@ public class DPSubServiceImpl {
...
@@ -125,15 +125,15 @@ public class DPSubServiceImpl {
}
}
}
}
}
else
{
}
else
{
if
(
ValidationUtil
.
isEmpty
(
map
)){
if
(
ValidationUtil
.
isEmpty
(
map
))
{
content
.
put
(
tab
.
getString
(
"key"
),
apiResult
);
content
.
put
(
tab
.
getString
(
"key"
),
apiResult
);
}
}
}
}
}
}
private
JSONArray
processShowHideRules
(
JSONArray
children
,
Object
showHideRules
,
JSONObject
apiResult
)
{
private
JSONArray
processShowHideRules
(
JSONArray
children
,
Object
showHideRules
,
JSONObject
apiResult
)
{
if
(!
ValidationUtil
.
isEmpty
(
showHideRules
)){
if
(!
ValidationUtil
.
isEmpty
(
showHideRules
))
{
((
JSONArray
)
showHideRules
).
stream
().
forEach
(
x
->
{
((
JSONArray
)
showHideRules
).
stream
().
forEach
(
x
->
{
JSONObject
xObj
=
(
JSONObject
)
x
;
JSONObject
xObj
=
(
JSONObject
)
x
;
boolean
hide
=
true
;
boolean
hide
=
true
;
JSONArray
conditions
=
xObj
.
getJSONArray
(
"condition"
);
JSONArray
conditions
=
xObj
.
getJSONArray
(
"condition"
);
...
@@ -146,25 +146,25 @@ public class DPSubServiceImpl {
...
@@ -146,25 +146,25 @@ public class DPSubServiceImpl {
JSONObject
item
=
this
.
findByEid
(
children
,
JsonValueUtils
.
getValueByKey
(
conditionObj
,
"name"
,
"name.key"
).
toString
());
JSONObject
item
=
this
.
findByEid
(
children
,
JsonValueUtils
.
getValueByKey
(
conditionObj
,
"name"
,
"name.key"
).
toString
());
Object
fieldvalue
=
apiResult
.
get
(
JsonValueUtils
.
getValueByKey
(
item
,
"visualParams"
,
"visualParams.fieldKey"
));
Object
fieldvalue
=
apiResult
.
get
(
JsonValueUtils
.
getValueByKey
(
item
,
"visualParams"
,
"visualParams.fieldKey"
));
if
(
ValidationUtil
.
isEmpty
(
relation
)){
if
(
ValidationUtil
.
isEmpty
(
relation
))
{
if
(
condition
.
equals
(
"notUndefined"
)
&&
!
ValidationUtil
.
isEmpty
(
fieldvalue
)){
if
(
condition
.
equals
(
"notUndefined"
)
&&
!
ValidationUtil
.
isEmpty
(
fieldvalue
))
{
lastConditionResult
=
!
ValidationUtil
.
isEmpty
(
fieldvalue
);
lastConditionResult
=
!
ValidationUtil
.
isEmpty
(
fieldvalue
);
hide
=
false
;
hide
=
false
;
}
else
if
(
condition
.
equals
(
"unequal"
)
&&
!
ValidationUtil
.
isEmpty
(
fieldvalue
)
&&
!
fieldvalue
.
equals
(
value
)){
}
else
if
(
condition
.
equals
(
"unequal"
)
&&
!
ValidationUtil
.
isEmpty
(
fieldvalue
)
&&
!
fieldvalue
.
equals
(
value
))
{
lastConditionResult
=
!
fieldvalue
.
equals
(
value
);
lastConditionResult
=
!
fieldvalue
.
equals
(
value
);
hide
=
false
;
hide
=
false
;
}
else
if
(
condition
.
equals
(
"equal"
)
&&
!
ValidationUtil
.
isEmpty
(
fieldvalue
)
&&
fieldvalue
.
equals
(
value
)){
}
else
if
(
condition
.
equals
(
"equal"
)
&&
!
ValidationUtil
.
isEmpty
(
fieldvalue
)
&&
fieldvalue
.
equals
(
value
))
{
lastConditionResult
=
fieldvalue
.
equals
(
value
);
lastConditionResult
=
fieldvalue
.
equals
(
value
);
hide
=
false
;
hide
=
false
;
}
}
}
else
{
}
else
{
if
(
lastConditionResult
&&
condition
.
equals
(
"notUndefined"
)
&&
!
ValidationUtil
.
isEmpty
(
fieldvalue
)){
if
(
lastConditionResult
&&
condition
.
equals
(
"notUndefined"
)
&&
!
ValidationUtil
.
isEmpty
(
fieldvalue
))
{
lastConditionResult
=
!
ValidationUtil
.
isEmpty
(
fieldvalue
);
lastConditionResult
=
!
ValidationUtil
.
isEmpty
(
fieldvalue
);
hide
=
false
;
hide
=
false
;
}
else
if
(
lastConditionResult
&&
condition
.
equals
(
"unequal"
)
&&
!
ValidationUtil
.
isEmpty
(
fieldvalue
)
&&
!
fieldvalue
.
equals
(
value
)){
}
else
if
(
lastConditionResult
&&
condition
.
equals
(
"unequal"
)
&&
!
ValidationUtil
.
isEmpty
(
fieldvalue
)
&&
!
fieldvalue
.
equals
(
value
))
{
lastConditionResult
=
!
fieldvalue
.
equals
(
value
);
lastConditionResult
=
!
fieldvalue
.
equals
(
value
);
hide
=
false
;
hide
=
false
;
}
else
if
(
lastConditionResult
&&
condition
.
equals
(
"equal"
)
&&
!
ValidationUtil
.
isEmpty
(
fieldvalue
)
&&
fieldvalue
.
equals
(
value
))
{
}
else
if
(
lastConditionResult
&&
condition
.
equals
(
"equal"
)
&&
!
ValidationUtil
.
isEmpty
(
fieldvalue
)
&&
fieldvalue
.
equals
(
value
))
{
lastConditionResult
=
fieldvalue
.
equals
(
value
);
lastConditionResult
=
fieldvalue
.
equals
(
value
);
hide
=
false
;
hide
=
false
;
}
else
{
}
else
{
...
@@ -180,16 +180,20 @@ public class DPSubServiceImpl {
...
@@ -180,16 +180,20 @@ public class DPSubServiceImpl {
boolean
match
=
false
;
// 是否匹配标识
boolean
match
=
false
;
// 是否匹配标识
List
<
Object
>
collect
=
children
.
stream
().
filter
(
y
->
showColumn
.
equals
(
JsonValueUtils
.
getValueByKey
(
y
,
"eid"
,
"eid"
))).
collect
(
Collectors
.
toList
());
List
<
Object
>
collect
=
children
.
stream
().
filter
(
y
->
showColumn
.
equals
(
JsonValueUtils
.
getValueByKey
(
y
,
"eid"
,
"eid"
))).
collect
(
Collectors
.
toList
());
if
(
ValidationUtil
.
isEmpty
(
collect
)){
if
(
ValidationUtil
.
isEmpty
(
collect
))
{
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
if
(
match
){
break
;
}
if
(
match
)
{
break
;
}
JSONArray
subChildren
=
children
.
getJSONObject
(
i
).
getJSONArray
(
"children"
);
JSONArray
subChildren
=
children
.
getJSONObject
(
i
).
getJSONArray
(
"children"
);
for
(
int
j
=
0
;
j
<
subChildren
.
size
();
j
++)
{
for
(
int
j
=
0
;
j
<
subChildren
.
size
();
j
++)
{
if
(
match
){
break
;
}
if
(
match
)
{
break
;
}
Object
cchildren
=
JsonValueUtils
.
getValueByKey
(
subChildren
.
get
(
j
),
"children"
,
"children"
);
Object
cchildren
=
JsonValueUtils
.
getValueByKey
(
subChildren
.
get
(
j
),
"children"
,
"children"
);
if
(!
ValidationUtil
.
isEmpty
(
cchildren
)){
if
(!
ValidationUtil
.
isEmpty
(
cchildren
))
{
List
<
Object
>
ccollect
=
((
JSONArray
)
cchildren
).
stream
().
filter
(
y
->
showColumn
.
equals
(
JsonValueUtils
.
getValueByKey
(
y
,
"eid"
,
"eid"
))).
collect
(
Collectors
.
toList
());
List
<
Object
>
ccollect
=
((
JSONArray
)
cchildren
).
stream
().
filter
(
y
->
showColumn
.
equals
(
JsonValueUtils
.
getValueByKey
(
y
,
"eid"
,
"eid"
))).
collect
(
Collectors
.
toList
());
if
(!
ValidationUtil
.
isEmpty
(
ccollect
)){
if
(!
ValidationUtil
.
isEmpty
(
ccollect
))
{
JSONObject
groupObj
=
(
JSONObject
)
ccollect
.
get
(
0
);
JSONObject
groupObj
=
(
JSONObject
)
ccollect
.
get
(
0
);
JSONObject
visualParams
=
groupObj
.
getJSONObject
(
"visualParams"
);
JSONObject
visualParams
=
groupObj
.
getJSONObject
(
"visualParams"
);
visualParams
.
put
(
"behavior"
,
"hidden"
);
visualParams
.
put
(
"behavior"
,
"hidden"
);
...
@@ -213,20 +217,20 @@ public class DPSubServiceImpl {
...
@@ -213,20 +217,20 @@ public class DPSubServiceImpl {
private
JSONObject
findByEid
(
JSONArray
children
,
String
eid
)
{
private
JSONObject
findByEid
(
JSONArray
children
,
String
eid
)
{
List
<
Object
>
collect
=
children
.
stream
().
filter
(
x
->
eid
.
equals
(
JsonValueUtils
.
getValueByKey
(
x
,
"eid"
,
"eid"
))).
collect
(
Collectors
.
toList
());
List
<
Object
>
collect
=
children
.
stream
().
filter
(
x
->
eid
.
equals
(
JsonValueUtils
.
getValueByKey
(
x
,
"eid"
,
"eid"
))).
collect
(
Collectors
.
toList
());
if
(
ValidationUtil
.
isEmpty
(
collect
)){
if
(
ValidationUtil
.
isEmpty
(
collect
))
{
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
JSONArray
subChildren
=
children
.
getJSONObject
(
i
).
getJSONArray
(
"children"
);
JSONArray
subChildren
=
children
.
getJSONObject
(
i
).
getJSONArray
(
"children"
);
for
(
int
j
=
0
;
j
<
subChildren
.
size
();
j
++)
{
for
(
int
j
=
0
;
j
<
subChildren
.
size
();
j
++)
{
if
(
ValidationUtil
.
isEmpty
(
subChildren
.
getJSONObject
(
j
).
get
(
"children"
))){
if
(
ValidationUtil
.
isEmpty
(
subChildren
.
getJSONObject
(
j
).
get
(
"children"
)))
{
List
<
Object
>
ccollect
=
subChildren
.
stream
().
filter
(
y
->
eid
.
equals
(
JsonValueUtils
.
getValueByKey
(
y
,
"eid"
,
"eid"
))).
collect
(
Collectors
.
toList
());
List
<
Object
>
ccollect
=
subChildren
.
stream
().
filter
(
y
->
eid
.
equals
(
JsonValueUtils
.
getValueByKey
(
y
,
"eid"
,
"eid"
))).
collect
(
Collectors
.
toList
());
if
(!
ValidationUtil
.
isEmpty
(
ccollect
)){
if
(!
ValidationUtil
.
isEmpty
(
ccollect
))
{
return
(
JSONObject
)
ccollect
.
get
(
0
);
return
(
JSONObject
)
ccollect
.
get
(
0
);
}
}
}
else
{
}
else
{
Object
cchildren
=
JsonValueUtils
.
getValueByKey
(
subChildren
.
get
(
j
),
"children"
,
"children"
);
Object
cchildren
=
JsonValueUtils
.
getValueByKey
(
subChildren
.
get
(
j
),
"children"
,
"children"
);
if
(!
ValidationUtil
.
isEmpty
(
cchildren
)){
if
(!
ValidationUtil
.
isEmpty
(
cchildren
))
{
List
<
Object
>
ccollect
=
((
JSONArray
)
cchildren
).
stream
().
filter
(
y
->
eid
.
equals
(
JsonValueUtils
.
getValueByKey
(
y
,
"eid"
,
"eid"
))).
collect
(
Collectors
.
toList
());
List
<
Object
>
ccollect
=
((
JSONArray
)
cchildren
).
stream
().
filter
(
y
->
eid
.
equals
(
JsonValueUtils
.
getValueByKey
(
y
,
"eid"
,
"eid"
))).
collect
(
Collectors
.
toList
());
if
(!
ValidationUtil
.
isEmpty
(
ccollect
)){
if
(!
ValidationUtil
.
isEmpty
(
ccollect
))
{
return
(
JSONObject
)
ccollect
.
get
(
0
);
return
(
JSONObject
)
ccollect
.
get
(
0
);
}
}
}
}
...
@@ -237,19 +241,18 @@ public class DPSubServiceImpl {
...
@@ -237,19 +241,18 @@ public class DPSubServiceImpl {
return
(
JSONObject
)
collect
.
get
(
0
);
return
(
JSONObject
)
collect
.
get
(
0
);
}
}
/**
/**
* 合并分组组件下的所有组件
* 合并分组组件下的所有组件
*
* @param children
* @param children
* @return
* @return
*/
*/
private
List
<
Object
>
mergedList
(
JSONArray
children
){
private
List
<
Object
>
mergedList
(
JSONArray
children
)
{
JSONArray
mergedArray
=
new
JSONArray
();
JSONArray
mergedArray
=
new
JSONArray
();
int
maxSize
=
0
;
// 初始化为JSONArray的长度
int
maxSize
=
0
;
// 初始化为JSONArray的长度
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
JSONArray
cchildren
=
children
.
getJSONObject
(
i
).
getJSONArray
(
"children"
);
JSONArray
cchildren
=
children
.
getJSONObject
(
i
).
getJSONArray
(
"children"
);
if
(!
ValidationUtil
.
isEmpty
(
cchildren
)){
if
(!
ValidationUtil
.
isEmpty
(
cchildren
))
{
maxSize
=
Math
.
max
(
maxSize
,
cchildren
.
size
());
maxSize
=
Math
.
max
(
maxSize
,
cchildren
.
size
());
}
}
}
}
...
@@ -257,7 +260,7 @@ public class DPSubServiceImpl {
...
@@ -257,7 +260,7 @@ public class DPSubServiceImpl {
for
(
int
i
=
0
;
i
<
maxSize
;
i
++)
{
for
(
int
i
=
0
;
i
<
maxSize
;
i
++)
{
for
(
int
j
=
0
;
j
<
children
.
size
();
j
++)
{
for
(
int
j
=
0
;
j
<
children
.
size
();
j
++)
{
JSONArray
cchildren
=
children
.
getJSONObject
(
j
).
getJSONArray
(
"children"
);
JSONArray
cchildren
=
children
.
getJSONObject
(
j
).
getJSONArray
(
"children"
);
if
(!
ValidationUtil
.
isEmpty
(
cchildren
)){
if
(!
ValidationUtil
.
isEmpty
(
cchildren
))
{
List
<
Object
>
noHiddenMergedArray
=
cchildren
.
stream
().
filter
(
x
->
{
List
<
Object
>
noHiddenMergedArray
=
cchildren
.
stream
().
filter
(
x
->
{
JSONObject
xObj
=
(
JSONObject
)
x
;
JSONObject
xObj
=
(
JSONObject
)
x
;
return
!
"hidden"
.
equals
(
JsonValueUtils
.
getValueByKey
(
xObj
,
"visualParams"
,
"visualParams.behavior"
));
return
!
"hidden"
.
equals
(
JsonValueUtils
.
getValueByKey
(
xObj
,
"visualParams"
,
"visualParams.behavior"
));
...
@@ -272,7 +275,7 @@ public class DPSubServiceImpl {
...
@@ -272,7 +275,7 @@ public class DPSubServiceImpl {
return
mergedArray
;
return
mergedArray
;
}
}
public
JSONObject
buildContentData
(
JSONObject
map
,
List
<
Object
>
mergedArray
,
JSONObject
apiResult
){
public
JSONObject
buildContentData
(
JSONObject
map
,
List
<
Object
>
mergedArray
,
JSONObject
apiResult
)
{
JSONArray
datas
=
new
JSONArray
();
JSONArray
datas
=
new
JSONArray
();
// 处理二维码
// 处理二维码
mergedArray
.
stream
().
filter
(
x
->
"QRCode"
.
equals
(
JsonValueUtils
.
getValueByKey
(
x
,
"componentKey"
,
null
))).
findFirst
().
ifPresent
(
x
->
{
mergedArray
.
stream
().
filter
(
x
->
"QRCode"
.
equals
(
JsonValueUtils
.
getValueByKey
(
x
,
"componentKey"
,
null
))).
findFirst
().
ifPresent
(
x
->
{
...
@@ -280,7 +283,7 @@ public class DPSubServiceImpl {
...
@@ -280,7 +283,7 @@ public class DPSubServiceImpl {
String
problemTime
=
apiResult
.
getString
(
"problemTime"
);
String
problemTime
=
apiResult
.
getString
(
"problemTime"
);
String
problemStatus
=
apiResult
.
getString
(
"problemStatus"
);
String
problemStatus
=
apiResult
.
getString
(
"problemStatus"
);
String
color
=
null
;
String
color
=
null
;
if
(!
ValidationUtil
.
isEmpty
(
problemTime
)){
if
(!
ValidationUtil
.
isEmpty
(
problemTime
))
{
try
{
try
{
qrcode
.
put
(
"text"
,
DateUtil
.
formatDate
(
DateUtil
.
smartFormat
(
problemTime
),
"yyyy-MM-dd"
));
qrcode
.
put
(
"text"
,
DateUtil
.
formatDate
(
DateUtil
.
smartFormat
(
problemTime
),
"yyyy-MM-dd"
));
qrcode
.
put
(
"subtext"
,
DateUtil
.
formatDate
(
DateUtil
.
smartFormat
(
problemTime
),
"HH:mm:ss"
));
qrcode
.
put
(
"subtext"
,
DateUtil
.
formatDate
(
DateUtil
.
smartFormat
(
problemTime
),
"HH:mm:ss"
));
...
@@ -288,9 +291,9 @@ public class DPSubServiceImpl {
...
@@ -288,9 +291,9 @@ public class DPSubServiceImpl {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
if
(
"正常"
.
equals
(
problemStatus
)){
if
(
"正常"
.
equals
(
problemStatus
))
{
color
=
"green"
;
color
=
"green"
;
}
else
if
(
"异常"
.
equals
(
problemStatus
))
{
}
else
if
(
"异常"
.
equals
(
problemStatus
))
{
color
=
"red"
;
color
=
"red"
;
}
}
qrcode
.
put
(
"value"
,
!
ValidationUtil
.
isEmpty
(
apiResult
.
get
(
"useCode"
))
?
apiResult
.
get
(
"useCode"
)
:
apiResult
.
get
(
"USE_ORG_CODE"
));
qrcode
.
put
(
"value"
,
!
ValidationUtil
.
isEmpty
(
apiResult
.
get
(
"useCode"
))
?
apiResult
.
get
(
"useCode"
)
:
apiResult
.
get
(
"USE_ORG_CODE"
));
...
@@ -300,41 +303,16 @@ public class DPSubServiceImpl {
...
@@ -300,41 +303,16 @@ public class DPSubServiceImpl {
mergedArray
=
mergedArray
.
stream
().
filter
(
x
->
!
"QRCode"
.
equals
(
JsonValueUtils
.
getValueByKey
(
x
,
"componentKey"
,
null
))).
collect
(
Collectors
.
toList
());
mergedArray
=
mergedArray
.
stream
().
filter
(
x
->
!
"QRCode"
.
equals
(
JsonValueUtils
.
getValueByKey
(
x
,
"componentKey"
,
null
))).
collect
(
Collectors
.
toList
());
mergedArray
.
stream
().
forEach
(
x
->
{
mergedArray
.
stream
().
forEach
(
x
->
{
JSONObject
xObj
=
(
JSONObject
)
x
;
Object
fieldKey
=
JsonValueUtils
.
getValueByKey
(
x
,
"visualParams"
,
"visualParams.fieldKey"
);
JSONObject
visualParams
=
xObj
.
getJSONObject
(
"visualParams"
);
if
(!
ValidationUtil
.
isEmpty
(
fieldKey
))
{
this
.
processWidgets
(
datas
,
x
,
fieldKey
.
toString
(),
apiResult
);
String
fieldKey
=
visualParams
.
getString
(
"fieldKey"
);
if
(!
ValidationUtil
.
isEmpty
(
fieldKey
)){
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"label"
,
visualParams
.
getString
(
"label"
));
Object
value
=
apiResult
.
get
(
fieldKey
);
if
(
"upload"
.
equals
(
xObj
.
getString
(
"componentKey"
))){
jsonObject
.
put
(
"type"
,
"img"
);
if
(!
ValidationUtil
.
isEmpty
(
value
)){
jsonObject
.
put
(
"value"
,
((
JSONArray
)
value
).
getJSONObject
(
0
).
getString
(
"url"
));
}
}
else
if
(
"select"
.
equals
(
xObj
.
getString
(
"componentKey"
))){
jsonObject
.
put
(
"type"
,
"text"
);
ResponseModel
selectResult
=
this
.
getApiResult
(
visualParams
.
getJSONObject
(
"api"
),
null
);
if
(!
ValidationUtil
.
isEmpty
(
selectResult
)
&&
!
ValidationUtil
.
isEmpty
(
value
)){
((
JSONArray
)
selectResult
.
getResult
()).
stream
().
filter
(
y
->
value
.
equals
(
JsonValueUtils
.
getValueByKey
(
y
,
"valueKey"
,
"valueKey"
))).
findFirst
().
ifPresent
(
z
->
{
jsonObject
.
put
(
"value"
,
((
JSONObject
)
z
).
getString
(
"nameKey"
));
});
}
else
{
jsonObject
.
put
(
"value"
,
value
);
}
}
else
{
jsonObject
.
put
(
"type"
,
"text"
);
jsonObject
.
put
(
"value"
,
value
);
}
datas
.
add
(
jsonObject
);
}
}
});
});
map
.
put
(
"datas"
,
datas
);
map
.
put
(
"datas"
,
datas
);
return
map
;
return
map
;
}
}
public
JSONObject
buildSubContentData
(
JSONObject
map
,
int
i
,
JSONObject
yObj
,
List
<
Object
>
mergedArray
,
JSONObject
apiResult
){
public
JSONObject
buildSubContentData
(
JSONObject
map
,
int
i
,
JSONObject
yObj
,
List
<
Object
>
mergedArray
,
JSONObject
apiResult
)
{
JSONArray
subs
=
map
.
getJSONArray
(
"subs"
);
JSONArray
subs
=
map
.
getJSONArray
(
"subs"
);
JSONArray
children
=
yObj
.
getJSONArray
(
"children"
);
JSONArray
children
=
yObj
.
getJSONArray
(
"children"
);
List
<
Object
>
columnsArray
=
children
.
stream
().
filter
(
x
->
{
List
<
Object
>
columnsArray
=
children
.
stream
().
filter
(
x
->
{
...
@@ -350,25 +328,48 @@ public class DPSubServiceImpl {
...
@@ -350,25 +328,48 @@ public class DPSubServiceImpl {
JSONArray
datas
=
new
JSONArray
();
JSONArray
datas
=
new
JSONArray
();
mergedArray
.
stream
().
forEach
(
x
->
{
mergedArray
.
stream
().
forEach
(
x
->
{
JSONObject
xObj
=
(
JSONObject
)
x
;
Object
fieldKey
=
JsonValueUtils
.
getValueByKey
(
x
,
"visualParams"
,
"visualParams.fieldKey"
);
JSONObject
visualParams
=
xObj
.
getJSONObject
(
"visualParams"
);
if
(!
ValidationUtil
.
isEmpty
(
fieldKey
))
{
this
.
processWidgets
(
datas
,
x
,
fieldKey
.
toString
(),
apiResult
);
subObj
.
put
(
"datas"
,
datas
);
}
});
subs
.
add
(
subObj
);
return
map
;
}
String
fieldKey
=
visualParams
.
getString
(
"fieldKey"
);
/**
if
(!
ValidationUtil
.
isEmpty
(
fieldKey
)){
* 处理不同组件的展示
*
* @param datas
* @param x
* @param fieldKey
* @param apiResult
* @return
*/
public
JSONArray
processWidgets
(
JSONArray
datas
,
Object
x
,
String
fieldKey
,
JSONObject
apiResult
)
{
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
xObj
=
(
JSONObject
)
x
;
JSONObject
visualParams
=
xObj
.
getJSONObject
(
"visualParams"
);
jsonObject
.
put
(
"label"
,
visualParams
.
getString
(
"label"
));
jsonObject
.
put
(
"label"
,
visualParams
.
getString
(
"label"
));
Object
value
=
apiResult
.
get
(
fieldKey
);
Object
value
=
apiResult
.
get
(
fieldKey
);
if
(
"upload"
.
equals
(
xObj
.
getString
(
"componentKey"
)))
{
if
(
"upload"
.
equals
(
xObj
.
getString
(
"componentKey"
)))
{
jsonObject
.
put
(
"type"
,
"img"
);
jsonObject
.
put
(
"type"
,
"img"
);
if
(!
ValidationUtil
.
isEmpty
(
value
)){
if
(!
ValidationUtil
.
isEmpty
(
value
))
{
jsonObject
.
put
(
"value"
,
((
JSONArray
)
value
).
getJSONObject
(
0
).
getString
(
"url"
));
jsonObject
.
put
(
"value"
,
((
JSONArray
)
value
).
getJSONObject
(
0
).
getString
(
"url"
));
}
}
else
if
(
"checkbox"
.
equals
(
xObj
.
getString
(
"componentKey"
)))
{
jsonObject
.
put
(
"type"
,
"text"
);
if
(!
ValidationUtil
.
isEmpty
(
value
))
{
jsonObject
.
put
(
"value"
,
value
);
}
}
}
else
if
(
"select"
.
equals
(
xObj
.
getString
(
"componentKey"
)))
{
}
else
if
(
"select"
.
equals
(
xObj
.
getString
(
"componentKey"
)))
{
jsonObject
.
put
(
"type"
,
"text"
);
jsonObject
.
put
(
"type"
,
"text"
);
ResponseModel
selectResult
=
this
.
getApiResult
(
visualParams
.
getJSONObject
(
"api"
),
null
);
ResponseModel
selectResult
=
this
.
getApiResult
(
visualParams
.
getJSONObject
(
"api"
),
null
);
if
(!
ValidationUtil
.
isEmpty
(
selectResult
)
&&
selectResult
.
getStatus
()
==
200
&&
!
ValidationUtil
.
isEmpty
(
value
))
{
if
(!
ValidationUtil
.
isEmpty
(
selectResult
)
&&
selectResult
.
getStatus
()
==
200
&&
!
ValidationUtil
.
isEmpty
(
value
))
{
((
JSONArray
)
selectResult
.
getResult
()).
stream
().
filter
(
y
->
value
.
equals
(
JsonValueUtils
.
getValueByKey
(
y
,
"valueKey"
,
"valueKey"
))).
findFirst
().
ifPresent
(
z
->
{
((
JSONArray
)
selectResult
.
getResult
()).
stream
().
filter
(
y
->
value
.
equals
(
JsonValueUtils
.
getValueByKey
(
y
,
"valueKey"
,
"valueKey"
))).
findFirst
().
ifPresent
(
z
->
{
jsonObject
.
put
(
"value"
,
((
JSONObject
)
z
).
getString
(
"nameKey"
));
jsonObject
.
put
(
"value"
,
((
JSONObject
)
z
).
getString
(
"nameKey"
));
});
});
}
else
{
}
else
{
jsonObject
.
put
(
"value"
,
value
);
jsonObject
.
put
(
"value"
,
value
);
...
@@ -378,14 +379,10 @@ public class DPSubServiceImpl {
...
@@ -378,14 +379,10 @@ public class DPSubServiceImpl {
jsonObject
.
put
(
"value"
,
value
);
jsonObject
.
put
(
"value"
,
value
);
}
}
datas
.
add
(
jsonObject
);
datas
.
add
(
jsonObject
);
subObj
.
put
(
"datas"
,
datas
);
return
datas
;
}
});
subs
.
add
(
subObj
);
return
map
;
}
}
public
JSONObject
buildSubFormData
(
JSONObject
map
,
int
i
,
JSONObject
yObj
,
JSONObject
apiResult
){
public
JSONObject
buildSubFormData
(
JSONObject
map
,
int
i
,
JSONObject
yObj
,
JSONObject
apiResult
)
{
JSONArray
subs
=
map
.
getJSONArray
(
"subs"
);
JSONArray
subs
=
map
.
getJSONArray
(
"subs"
);
JSONArray
children
=
yObj
.
getJSONArray
(
"children"
);
JSONArray
children
=
yObj
.
getJSONArray
(
"children"
);
...
@@ -510,7 +507,7 @@ public class DPSubServiceImpl {
...
@@ -510,7 +507,7 @@ public class DPSubServiceImpl {
return
url
.
replace
(
"?&"
,
"?"
);
return
url
.
replace
(
"?&"
,
"?"
);
}
}
private
HttpHeaders
builderHeaders
(){
private
HttpHeaders
builderHeaders
()
{
HttpHeaders
httpheaders
=
new
HttpHeaders
();
HttpHeaders
httpheaders
=
new
HttpHeaders
();
httpheaders
.
add
(
"appKey"
,
RequestContext
.
getAppKey
());
httpheaders
.
add
(
"appKey"
,
RequestContext
.
getAppKey
());
httpheaders
.
add
(
"product"
,
RequestContext
.
getProduct
());
httpheaders
.
add
(
"product"
,
RequestContext
.
getProduct
());
...
...
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