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
7bea093f
Commit
7bea093f
authored
Feb 22, 2021
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
门店选择器自定义属性字段转换vo
parent
f2913d82
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
2 deletions
+55
-2
StoreFieldController.java
...ava/com/gic/plug/web/controller/StoreFieldController.java
+40
-2
StoreWidgetInterfaceVO.java
...va/com/gic/plug/web/vo/widget/StoreWidgetInterfaceVO.java
+15
-0
No files found.
src/main/java/com/gic/plug/web/controller/StoreFieldController.java
View file @
7bea093f
package
com
.
gic
.
plug
.
web
.
controller
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
com.gic.plug.web.utils.StoreRegionAuthUtil
;
import
com.gic.plug.web.utils.StoreResourceAuthUtils
;
import
com.gic.plug.web.utils.storeresourceauth.StoreResourceUtils
;
import
com.gic.plug.web.vo.widget.StoreWidgetInterfaceVO
;
import
com.gic.store.constant.StoreESFieldsEnum
;
import
com.gic.store.service.StoreWidgetApiService
;
import
com.gic.store.utils.StoreRedisKeyUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -100,7 +103,17 @@ public class StoreFieldController {
Integer
enterpriseId
=
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
();
ServiceResponse
<
List
<
StoreFieldDTO
>>
result
=
storeFieldApiService
.
listStoreField
(
enterpriseId
,
search
);
if
(
result
.
isSuccess
())
{
return
RestResponse
.
success
(
transferDtoToVo
(
result
.
getResult
(),
enterpriseId
));
List
<
StoreFieldRegionVO
>
dealResult
=
transferDtoToVo
(
result
.
getResult
(),
enterpriseId
);
List
<
StoreWidgetInterfaceVO
>
voList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
dealResult
))
{
voList
=
dealResult
.
stream
()
.
map
(
e
->
new
StoreWidgetInterfaceVO
()
.
setLabel
(
e
.
getStoreFieldName
())
.
setValue
(
e
.
getStoreFieldKey
().
toString
())
.
setKey
(
getFieldKeyByFieldType
(
e
.
getStoreFieldType
())))
.
collect
(
Collectors
.
toList
());
}
return
RestResponse
.
success
(
voList
);
}
else
{
return
RestResponse
.
failure
(
result
.
getCode
(),
result
.
getMessage
());
}
...
...
@@ -111,7 +124,14 @@ public class StoreFieldController {
ServiceResponse
<
List
<
StoreFieldSelectDTO
>>
result
=
storeFieldSelectApiService
.
listStoreFieldSelect
(
storeFieldId
,
search
);
if
(
result
.
isSuccess
())
{
return
RestResponse
.
success
(
EntityUtil
.
changeEntityListNew
(
StoreFieldSelectVO
.
class
,
result
.
getResult
()));
List
<
StoreFieldSelectDTO
>
list
=
result
.
getResult
();
List
<
StoreWidgetInterfaceVO
>
voList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
voList
=
list
.
stream
()
.
map
(
e
->
new
StoreWidgetInterfaceVO
().
setValue
(
e
.
getStoreFieldSelectId
().
toString
()).
setLabel
(
e
.
getStoreFieldSelectName
()))
.
collect
(
Collectors
.
toList
());
}
return
RestResponse
.
success
(
voList
);
}
else
{
return
RestResponse
.
failure
(
result
.
getCode
(),
result
.
getMessage
());
}
...
...
@@ -146,4 +166,22 @@ public class StoreFieldController {
}
return
voList
;
}
private
String
getFieldKeyByFieldType
(
Integer
fieldType
)
{
if
(
fieldType
==
null
)
{
return
null
;
}
StoreFieldTypeEnum
typeEnum
=
StoreFieldTypeEnum
.
getByCode
(
fieldType
);
switch
(
typeEnum
)
{
case
DATE:
return
"com006"
;
case
CHECK:
return
"com007"
;
case
RADIO:
return
"com009"
;
default
:
return
null
;
}
}
}
src/main/java/com/gic/plug/web/vo/widget/StoreWidgetInterfaceVO.java
View file @
7bea093f
...
...
@@ -21,6 +21,17 @@ public class StoreWidgetInterfaceVO implements Serializable{
*/
private
String
label
;
private
String
key
;
public
String
getKey
()
{
return
key
;
}
public
StoreWidgetInterfaceVO
setKey
(
String
key
)
{
this
.
key
=
key
;
return
this
;
}
public
String
getValue
()
{
return
value
;
}
...
...
@@ -38,4 +49,8 @@ public class StoreWidgetInterfaceVO implements Serializable{
this
.
label
=
label
;
return
this
;
}
public
static
long
getSerialVersionUID
()
{
return
serialVersionUID
;
}
}
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