Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-webapp-plug
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
base_platform_enterprise
gic-webapp-plug
Commits
14bc5ff1
Commit
14bc5ff1
authored
Feb 01, 2021
by
guojuxing
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
2a00277c
4680f423
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
121 additions
and
0 deletions
+121
-0
ScreeningController.java
...java/com/gic/plug/web/controller/ScreeningController.java
+32
-0
WidgetValuesNewVO.java
src/main/java/com/gic/plug/web/vo/WidgetValuesNewVO.java
+49
-0
WidgetValuesOldVO.java
src/main/java/com/gic/plug/web/vo/WidgetValuesOldVO.java
+40
-0
No files found.
src/main/java/com/gic/plug/web/controller/ScreeningController.java
View file @
14bc5ff1
package
com
.
gic
.
plug
.
web
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.constants.Constants
;
import
com.gic.enterprise.utils.UserDetailUtils
;
import
com.gic.goods.api.util.Constant
;
import
com.gic.plug.web.vo.WidgetValuesNewVO
;
import
com.gic.plug.web.vo.WidgetValuesOldVO
;
import
com.gic.widget.screening.api.dto.EsScreeningChainDetailDTO
;
import
com.gic.widget.screening.api.dto.EsScreeningEnterpriseCategorySceneInfoDTO
;
import
com.gic.widget.screening.api.dto.EsScreeningTemplateDTO
;
import
com.gic.widget.screening.api.service.EsScreeningInitService
;
import
com.gic.widget.screening.api.service.EsScreeningTemplateService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -21,6 +27,7 @@ import java.util.ArrayList;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -88,6 +95,12 @@ public class ScreeningController {
for
(
EsScreeningEnterpriseCategorySceneInfoDTO
dto
:
list
)
{
String
categoryId
=
dto
.
getSceneCategoryId
();
EsScreeningChainDetailDTO
item
=
this
.
esScreeningInitService
.
findRootChainByCategoryId
(
categoryId
);
String
widgetValues
=
item
.
getWidget
().
getWidgetValues
();
if
(
StringUtils
.
isNotBlank
(
widgetValues
))
{
List
<
WidgetValuesOldVO
>
oldVOS
=
JSONObject
.
parseArray
(
widgetValues
,
WidgetValuesOldVO
.
class
);
List
<
WidgetValuesNewVO
>
newVOList
=
oldVOS
.
stream
().
map
(
data
->
new
WidgetValuesNewVO
(
data
.
getKey
(),
data
.
getValue
(),
data
.
getName
())).
collect
(
Collectors
.
toList
());
item
.
getWidget
().
setWidgetValues
(
JSON
.
toJSONString
(
newVOList
));
}
all
.
add
(
item
);
}
return
RestResponse
.
success
(
all
);
...
...
@@ -98,6 +111,15 @@ public class ScreeningController {
public
RestResponse
getScreeningData
(
String
widgetChainId
)
{
List
<
EsScreeningChainDetailDTO
>
list
=
this
.
esScreeningInitService
.
queryEsScreeningByParentChainId
(
widgetChainId
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
list
=
list
.
stream
().
peek
(
item
->
{
if
(
StringUtils
.
isNotBlank
(
item
.
getWidget
().
getWidgetValues
()))
{
List
<
WidgetValuesOldVO
>
oldVOS
=
JSONObject
.
parseArray
(
item
.
getWidget
().
getWidgetValues
(),
WidgetValuesOldVO
.
class
);
List
<
WidgetValuesNewVO
>
newVOList
=
oldVOS
.
stream
().
map
(
data
->
new
WidgetValuesNewVO
(
data
.
getKey
(),
data
.
getValue
(),
data
.
getName
())).
collect
(
Collectors
.
toList
());
item
.
getWidget
().
setWidgetValues
(
JSON
.
toJSONString
(
newVOList
));
}
}).
collect
(
Collectors
.
toList
());
}
return
RestResponse
.
success
(
list
);
}
...
...
@@ -105,6 +127,11 @@ public class ScreeningController {
@ResponseBody
public
RestResponse
getScreeningChainDetail
(
String
parentChainId
,
String
widgetFieldKey
)
{
EsScreeningChainDetailDTO
dto
=
this
.
esScreeningInitService
.
findChainDetail
(
parentChainId
,
widgetFieldKey
);
if
(
dto
!=
null
&&
dto
.
getWidget
()
!=
null
&&
StringUtils
.
isNotBlank
(
dto
.
getWidget
().
getWidgetValues
()))
{
List
<
WidgetValuesOldVO
>
oldVOS
=
JSONObject
.
parseArray
(
dto
.
getWidget
().
getWidgetValues
(),
WidgetValuesOldVO
.
class
);
List
<
WidgetValuesNewVO
>
newVOList
=
oldVOS
.
stream
().
map
(
data
->
new
WidgetValuesNewVO
(
data
.
getKey
(),
data
.
getValue
(),
data
.
getName
())).
collect
(
Collectors
.
toList
());
dto
.
getWidget
().
setWidgetValues
(
JSON
.
toJSONString
(
newVOList
));
}
return
RestResponse
.
success
(
dto
);
}
...
...
@@ -113,6 +140,11 @@ public class ScreeningController {
@ResponseBody
public
Object
getScreeningWidgetDetail
(
String
widgetChainId
)
{
EsScreeningChainDetailDTO
dto
=
this
.
esScreeningInitService
.
findChainDetail
(
widgetChainId
);
if
(
dto
!=
null
&&
dto
.
getWidget
()
!=
null
&&
StringUtils
.
isNotBlank
(
dto
.
getWidget
().
getWidgetValues
()))
{
List
<
WidgetValuesOldVO
>
oldVOS
=
JSONObject
.
parseArray
(
dto
.
getWidget
().
getWidgetValues
(),
WidgetValuesOldVO
.
class
);
List
<
WidgetValuesNewVO
>
newVOList
=
oldVOS
.
stream
().
map
(
data
->
new
WidgetValuesNewVO
(
data
.
getKey
(),
data
.
getValue
(),
data
.
getName
())).
collect
(
Collectors
.
toList
());
dto
.
getWidget
().
setWidgetValues
(
JSON
.
toJSONString
(
newVOList
));
}
return
RestResponse
.
success
(
dto
);
}
}
src/main/java/com/gic/plug/web/vo/WidgetValuesNewVO.java
0 → 100644
View file @
14bc5ff1
package
com
.
gic
.
plug
.
web
.
vo
;
import
java.io.Serializable
;
/**
*
* @Description:
* @author zhiwj
* @date 2021-01-28 9:55
*/
public
class
WidgetValuesNewVO
implements
Serializable
{
private
String
key
;
private
String
label
;
private
String
value
;
public
WidgetValuesNewVO
()
{
}
public
WidgetValuesNewVO
(
String
key
,
String
label
,
String
value
)
{
this
.
key
=
key
;
this
.
label
=
label
;
this
.
value
=
value
;
}
public
String
getKey
()
{
return
key
;
}
public
void
setKey
(
String
key
)
{
this
.
key
=
key
;
}
public
String
getLabel
()
{
return
label
;
}
public
void
setLabel
(
String
label
)
{
this
.
label
=
label
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
}
src/main/java/com/gic/plug/web/vo/WidgetValuesOldVO.java
0 → 100644
View file @
14bc5ff1
package
com
.
gic
.
plug
.
web
.
vo
;
import
java.io.Serializable
;
/**
*
* @Description:
* @author zhiwj
* @date 2021-01-28 9:55
*/
public
class
WidgetValuesOldVO
implements
Serializable
{
private
String
key
;
private
String
value
;
private
String
name
;
public
String
getKey
()
{
return
key
;
}
public
void
setKey
(
String
key
)
{
this
.
key
=
key
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
}
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