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
92ec26dc
Commit
92ec26dc
authored
Feb 26, 2021
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
品牌添加共享标志
parent
9ec11082
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
5 deletions
+39
-5
StoreBrandController.java
...ava/com/gic/plug/web/controller/StoreBrandController.java
+39
-5
No files found.
src/main/java/com/gic/plug/web/controller/StoreBrandController.java
View file @
92ec26dc
package
com
.
gic
.
plug
.
web
.
controller
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
com.gic.plug.web.vo.widget.StoreWidgetInterfaceVO
;
import
com.gic.enterprise.dto.EnterpriseDTO
;
import
com.gic.enterprise.service.EnterpriseApiService
;
import
com.gic.plug.web.vo.widget.StoreWidgetInterfaceShareVO
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -31,6 +32,8 @@ public class StoreBrandController {
@Autowired
private
StoreBrandApiService
storeBrandApiService
;
@Autowired
private
EnterpriseApiService
enterpriseApiService
;
@RequestMapping
(
"/list-store-brand"
)
public
RestResponse
listStoreBrand
(
String
search
)
{
...
...
@@ -41,10 +44,41 @@ public class StoreBrandController {
serviceResponse
.
getResult
(),
StoreESFieldsEnum
.
STOREBRANDIDLIST
.
getField
());
List
<
StoreWidgetInterfaceVO
>
voList
=
new
ArrayList
<>();
List
<
StoreWidgetInterface
Share
VO
>
voList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
//共享类型
List
<
Integer
>
brandIdList
=
list
.
stream
().
filter
(
e
->
Objects
.
equals
(
e
.
getType
(),
2
))
.
mapToInt
(
e
->
e
.
getStoreBrandId
())
.
boxed
()
.
collect
(
Collectors
.
toList
());
Map
<
Integer
,
String
>
enterpriseMap
=
new
HashMap
<>();
ServiceResponse
<
List
<
StoreBrandDTO
>>
brandResponse
=
storeBrandApiService
.
listAllStoreBrandInfoByIds
(
brandIdList
);
if
(
brandResponse
.
isSuccess
()
&&
CollectionUtils
.
isNotEmpty
(
brandResponse
.
getResult
()))
{
List
<
StoreBrandDTO
>
brandList
=
brandResponse
.
getResult
();
List
<
Integer
>
enterpriseIdList
=
brandList
.
stream
()
.
filter
(
e
->
Objects
.
equals
(
e
.
getType
(),
1
))
.
mapToInt
(
e
->
e
.
getEnterpriseId
()).
boxed
()
.
collect
(
Collectors
.
toList
());
ServiceResponse
<
List
<
EnterpriseDTO
>>
enterpriseResponse
=
enterpriseApiService
.
listEnterpriseByIds
(
enterpriseIdList
);
if
(
enterpriseResponse
.
isSuccess
())
{
enterpriseMap
=
enterpriseResponse
.
getResult
().
stream
().
collect
(
Collectors
.
toMap
(
e
->
e
.
getEnterpriseId
(),
e
->
e
.
getEnterpriseName
()));
}
}
Map
<
Integer
,
String
>
finalEnterpriseMap
=
enterpriseMap
;
voList
=
list
.
stream
()
.
map
(
e
->
new
StoreWidgetInterfaceVO
().
setLabel
(
e
.
getStoreBrandName
()).
setValue
(
e
.
getStoreBrandId
().
toString
()))
.
map
(
e
->
{
StoreWidgetInterfaceShareVO
vo
=
new
StoreWidgetInterfaceShareVO
();
vo
.
setLabel
(
e
.
getStoreBrandName
());
vo
.
setValue
(
e
.
getStoreBrandId
().
toString
());
//共享类型
if
(
Objects
.
equals
(
e
.
getType
(),
2
))
{
vo
.
setEnterpriseName
(
finalEnterpriseMap
.
get
(
e
.
getEnterpriseId
()));
}
return
vo
;
})
.
collect
(
Collectors
.
toList
());
}
return
RestResponse
.
success
(
voList
);
...
...
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