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
2e2ae7e2
Commit
2e2ae7e2
authored
Jul 19, 2024
by
邢磊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*)增加图片附件
parent
e140c8c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
7 deletions
+27
-7
DPSubServiceImpl.java
...s/boot/module/jyjc/biz/service/impl/DPSubServiceImpl.java
+27
-7
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 @
2e2ae7e2
...
...
@@ -93,16 +93,22 @@ public class DPSubServiceImpl {
this
.
processShowHideRules
(
children
,
showHideRules
,
apiResult
);
List
<
Object
>
noHiddenChildren
=
children
.
stream
().
filter
(
x
->
!
"hidden"
.
equals
(
JsonValueUtils
.
getValueByKey
(
x
,
"visualParams"
,
"visualParams.behavior"
))).
collect
(
Collectors
.
toList
());
// 设置一个图片附件分组
JSONObject
matinfo
=
new
JSONObject
();
matinfo
.
put
(
"displayName"
,
"图片附件"
);
matinfo
.
put
(
"renderType"
,
"matui"
);
matinfo
.
put
(
"datas"
,
new
JSONArray
());
for
(
int
i
=
0
;
i
<
noHiddenChildren
.
size
();
i
++)
{
JSONObject
yObj
=
(
JSONObject
)
noHiddenChildren
.
get
(
i
);
if
(
"pageSection"
.
equals
(
yObj
.
get
(
"componentKey"
))
||
"columnsLayout"
.
equals
(
yObj
.
get
(
"componentKey"
)))
{
// 分组或者布局容器
List
<
Object
>
mergedArray
=
mergedList
(
yObj
.
getJSONArray
(
"children"
));
// 第一组去除标题
if
(
i
==
0
||
ValidationUtil
.
isEmpty
(
map
.
get
(
"datas"
)))
{
this
.
buildContentData
(
map
,
mergedArray
,
apiResult
);
this
.
buildContentData
(
map
,
mergedArray
,
apiResult
,
matinfo
);
}
else
{
this
.
buildSubContentData
(
map
,
i
,
yObj
,
mergedArray
,
apiResult
);
this
.
buildSubContentData
(
map
,
i
,
yObj
,
mergedArray
,
apiResult
,
matinfo
);
}
}
else
if
(
"subForm"
.
equals
(
yObj
.
get
(
"componentKey"
)))
{
// 子表单
this
.
buildSubFormData
(
map
,
i
,
yObj
,
apiResult
);
...
...
@@ -124,6 +130,11 @@ public class DPSubServiceImpl {
content
.
put
(
tab
.
getString
(
"key"
),
map
);
}
}
if
(!
ValidationUtil
.
isEmpty
(
matinfo
.
getJSONArray
(
"datas"
))){
matinfo
.
put
(
"columns"
,
map
.
getJSONObject
(
"basic"
).
getString
(
"columns"
));
map
.
getJSONArray
(
"subs"
).
add
(
matinfo
);
}
}
else
{
if
(
ValidationUtil
.
isEmpty
(
map
))
{
content
.
put
(
tab
.
getString
(
"key"
),
apiResult
);
...
...
@@ -275,7 +286,7 @@ public class DPSubServiceImpl {
return
mergedArray
;
}
public
JSONObject
buildContentData
(
JSONObject
map
,
List
<
Object
>
mergedArray
,
JSONObject
apiResult
)
{
public
JSONObject
buildContentData
(
JSONObject
map
,
List
<
Object
>
mergedArray
,
JSONObject
apiResult
,
JSONObject
matinfo
)
{
JSONArray
datas
=
new
JSONArray
();
// 处理二维码
mergedArray
.
stream
().
filter
(
x
->
"QRCode"
.
equals
(
JsonValueUtils
.
getValueByKey
(
x
,
"componentKey"
,
null
))).
findFirst
().
ifPresent
(
x
->
{
...
...
@@ -302,17 +313,18 @@ public class DPSubServiceImpl {
});
mergedArray
=
mergedArray
.
stream
().
filter
(
x
->
!
"QRCode"
.
equals
(
JsonValueUtils
.
getValueByKey
(
x
,
"componentKey"
,
null
))).
collect
(
Collectors
.
toList
());
mergedArray
.
stream
().
forEach
(
x
->
{
Object
fieldKey
=
JsonValueUtils
.
getValueByKey
(
x
,
"visualParams"
,
"visualParams.fieldKey"
);
if
(!
ValidationUtil
.
isEmpty
(
fieldKey
))
{
this
.
processWidgets
(
datas
,
x
,
fieldKey
.
toString
(),
apiResult
);
this
.
processWidgets
(
datas
,
x
,
fieldKey
.
toString
(),
apiResult
,
matinfo
);
}
});
map
.
put
(
"datas"
,
datas
);
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
,
JSONObject
matinfo
)
{
JSONArray
subs
=
map
.
getJSONArray
(
"subs"
);
JSONArray
children
=
yObj
.
getJSONArray
(
"children"
);
List
<
Object
>
columnsArray
=
children
.
stream
().
filter
(
x
->
{
...
...
@@ -330,7 +342,7 @@ public class DPSubServiceImpl {
mergedArray
.
stream
().
forEach
(
x
->
{
Object
fieldKey
=
JsonValueUtils
.
getValueByKey
(
x
,
"visualParams"
,
"visualParams.fieldKey"
);
if
(!
ValidationUtil
.
isEmpty
(
fieldKey
))
{
this
.
processWidgets
(
datas
,
x
,
fieldKey
.
toString
(),
apiResult
);
this
.
processWidgets
(
datas
,
x
,
fieldKey
.
toString
(),
apiResult
,
matinfo
);
subObj
.
put
(
"datas"
,
datas
);
}
});
...
...
@@ -347,18 +359,26 @@ public class DPSubServiceImpl {
* @param apiResult
* @return
*/
public
JSONArray
processWidgets
(
JSONArray
datas
,
Object
x
,
String
fieldKey
,
JSONObject
apiResult
)
{
public
JSONArray
processWidgets
(
JSONArray
datas
,
Object
x
,
String
fieldKey
,
JSONObject
apiResult
,
JSONObject
matinfo
)
{
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
xObj
=
(
JSONObject
)
x
;
JSONObject
visualParams
=
xObj
.
getJSONObject
(
"visualParams"
);
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
(
"attachmentUpload"
.
equals
(
xObj
.
getString
(
"componentKey"
)))
{
JSONArray
attachmentUploadDatas
=
matinfo
.
getJSONArray
(
"datas"
);
if
(!
ValidationUtil
.
isEmpty
(
value
))
{
JSONObject
attachmentUploadDatasObj
=
new
JSONObject
();
attachmentUploadDatasObj
.
put
(
"value"
,
value
);
attachmentUploadDatas
.
add
(
attachmentUploadDatasObj
);
}
}
else
if
(
"checkbox"
.
equals
(
xObj
.
getString
(
"componentKey"
)))
{
jsonObject
.
put
(
"type"
,
"text"
);
ResponseModel
checkboxResult
=
this
.
getApiResult
(
visualParams
.
getJSONObject
(
"api"
),
null
);
...
...
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