Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-data-cloud
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-data-cloud
Commits
b02cd32f
Commit
b02cd32f
authored
Jun 11, 2021
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
字段调整
parent
f483941b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
35 deletions
+49
-35
StoreSearchUtils.java
...n/java/com/gic/cloud/web/controller/StoreSearchUtils.java
+49
-35
No files found.
gic-data-cloud-wxapp/src/main/java/com/gic/cloud/web/controller/StoreSearchUtils.java
View file @
b02cd32f
...
@@ -96,12 +96,14 @@ public class StoreSearchUtils {
...
@@ -96,12 +96,14 @@ public class StoreSearchUtils {
if
(
StringUtils
.
isNotBlank
(
searchJson
)){
if
(
StringUtils
.
isNotBlank
(
searchJson
)){
JSONObject
json
=
JSON
.
parseObject
(
searchJson
);
JSONObject
json
=
JSON
.
parseObject
(
searchJson
);
StoreSearchQo
storeSearchQo
=
json
.
getObject
(
StoreChannelEnum
.
OFFLINE
.
getChannel
().
toString
(),
StoreSearchQo
.
class
);
StoreSearchQo
storeSearchQo
=
json
.
getObject
(
StoreChannelEnum
.
OFFLINE
.
getChannel
().
toString
(),
StoreSearchQo
.
class
);
StoreSearchDTO
storeSearchDTO
=
new
StoreSearchDTO
();
if
(
storeSearchQo
.
getAll
()
==
1
){
if
(
storeSearchQo
.
getAll
()
==
1
){
resultList
=
storeAuth
.
getStoreInfoIdList
(
);
storeSearchDTO
.
setStoreInfoIds
(
StringUtils
.
join
(
storeAuth
.
getStoreInfoIdList
().
toArray
(),
" "
)
);
}
else
{
}
else
{
StoreSearchDTO
storeSearchDTO
=
new
StoreSearchDTO
();
if
(
StringUtils
.
isNotBlank
(
storeSearchQo
.
getStoreIds
())){
storeSearchDTO
.
setStoreInfoIds
(
storeSearchQo
.
getStoreIds
().
replaceAll
(
","
,
" "
));
}
storeSearchDTO
.
setEnterpriseId
(
enterpriseId
);
storeSearchDTO
.
setEnterpriseId
(
enterpriseId
);
storeSearchDTO
.
setStoreInfoIds
(
StringUtils
.
isBlank
(
storeSearchQo
.
getStoreIds
())
?
null
:
storeSearchQo
.
getStoreIds
().
replaceAll
(
","
,
" "
));
storeSearchDTO
.
setStoreGroupIds
(
StringUtils
.
isBlank
(
storeSearchQo
.
getStoreGroupIds
())
?
null
:
storeSearchQo
.
getStoreGroupIds
().
replaceAll
(
","
,
" "
));
storeSearchDTO
.
setStoreGroupIds
(
StringUtils
.
isBlank
(
storeSearchQo
.
getStoreGroupIds
())
?
null
:
storeSearchQo
.
getStoreGroupIds
().
replaceAll
(
","
,
" "
));
storeSearchDTO
.
setRegionIds
(
StringUtils
.
isBlank
(
storeSearchQo
.
getRegion
())
?
null
:
storeSearchQo
.
getRegion
().
replaceAll
(
","
,
" "
));
storeSearchDTO
.
setRegionIds
(
StringUtils
.
isBlank
(
storeSearchQo
.
getRegion
())
?
null
:
storeSearchQo
.
getRegion
().
replaceAll
(
","
,
" "
));
storeSearchDTO
.
setStoreTypes
(
StringUtils
.
isBlank
(
storeSearchQo
.
getStoreType
())
?
null
:
storeSearchQo
.
getStoreType
().
replaceAll
(
","
,
" "
));
storeSearchDTO
.
setStoreTypes
(
StringUtils
.
isBlank
(
storeSearchQo
.
getStoreType
())
?
null
:
storeSearchQo
.
getStoreType
().
replaceAll
(
","
,
" "
));
...
@@ -295,42 +297,21 @@ public class StoreSearchUtils {
...
@@ -295,42 +297,21 @@ public class StoreSearchUtils {
StoreSearchQo
searchQo
=
JSON
.
parseObject
(
searchJson
).
getObject
(
channel
.
toString
(),
StoreSearchQo
.
class
);
StoreSearchQo
searchQo
=
JSON
.
parseObject
(
searchJson
).
getObject
(
channel
.
toString
(),
StoreSearchQo
.
class
);
log
.
info
(
"getOnlineStoreIds:{},{}"
,
searchJson
,
JSON
.
toJSONString
(
searchQo
));
log
.
info
(
"getOnlineStoreIds:{},{}"
,
searchJson
,
JSON
.
toJSONString
(
searchQo
));
if
(
searchQo
!=
null
){
if
(
searchQo
!=
null
){
if
(
searchQo
.
getAll
()
!=
1
){
//
todo
if
(
searchQo
.
getAll
()
!=
1
){
//
不是所有线上门店
if
(
StringUtils
.
isNotBlank
(
searchQo
.
getStoreGroupIds
())){
if
(
StringUtils
.
isNotBlank
(
searchQo
.
getStoreGroupIds
())){
//资源类型
List
<
String
>
filter
=
filter
(
channel
,
searchQo
,
enterpriseId
,
key
,
Arrays
.
asList
(
searchQo
.
getStoreGroupIds
().
split
(
","
)));
//店招品牌
list
.
addAll
(
filter
);
List
<
String
>
onLineStoreList
=
new
ArrayList
<>();
}
if
(
StoreChannelEnum
.
WMMALL
.
getChannel
().
equals
(
channel
)){
}
else
{
List
<
WmStoreDTO
>
wmStoreDTOList
=
this
.
wmStoreApiService
.
listWmStore
(
Arrays
.
asList
(
searchQo
.
getStoreGroupIds
().
split
(
","
)),
null
).
getResult
();
onlineStoreAuth
.
getList
().
stream
().
forEach
(
s
->
{
onLineStoreList
=
wmStoreDTOList
.
stream
().
filter
(
wmStoreDTO
->
{
if
(
s
.
getChannel
()
!=
null
&&
s
.
getChannel
().
intValue
()
==
channel
.
intValue
()){
boolean
resourceFlag
=
true
;
if
(
CollectionUtils
.
isNotEmpty
(
s
.
getStoreIdList
())){
if
(
StringUtils
.
isNotBlank
(
searchQo
.
getResourceType
())){
if
(
"1"
.
equals
(
searchQo
.
getResourceType
())){
//自有资源
if
(
enterpriseId
.
equals
(
wmStoreDTO
.
getEnterpriseId
())){
resourceFlag
=
true
;
}
}
if
(
"2"
.
equals
(
searchQo
.
getStoreBrand
())){
//共享资源
if
(!
enterpriseId
.
equals
(
wmStoreDTO
.
getEnterpriseId
())){
resourceFlag
=
true
;
}
}
}
boolean
brandFlag
=
true
;
if
(
StringUtils
.
isNotBlank
(
searchQo
.
getStoreBrand
())){
List
<
String
>
strings
=
Arrays
.
asList
(
searchQo
.
getStoreBrand
().
split
(
","
));
if
(
strings
.
contains
(
wmStoreDTO
.
getStoreBrandId
().
toString
())){
brandFlag
=
true
;
}
}
return
resourceFlag
||
brandFlag
;
}).
map
(
wmStoreDTO
->
wmStoreDTO
.
getWmMallStoreId
().
toString
()).
collect
(
Collectors
.
toList
());
list
.
addAll
(
onLineStoreList
);
if
(
CollectionUtils
.
isNotEmpty
(
onLineStoreList
)){
RedisUtil
.
setCache
(
key
,
1
,
10L
,
TimeUnit
.
MINUTES
);
RedisUtil
.
setCache
(
key
,
1
,
10L
,
TimeUnit
.
MINUTES
);
List
<
String
>
filter
=
filter
(
channel
,
searchQo
,
enterpriseId
,
key
,
s
.
getStoreIdList
());
list
.
addAll
(
filter
);
}
}
}
}
}
}
);
}
}
}
}
}
else
{
}
else
{
...
@@ -347,4 +328,37 @@ public class StoreSearchUtils {
...
@@ -347,4 +328,37 @@ public class StoreSearchUtils {
}
}
}
}
private
List
<
String
>
filter
(
Integer
channel
,
StoreSearchQo
searchQo
,
Integer
enterpriseId
,
String
key
,
List
<
String
>
onLineStoreIdList
){
if
(
StoreChannelEnum
.
WMMALL
.
getChannel
().
equals
(
channel
)){
List
<
WmStoreDTO
>
wmStoreDTOList
=
this
.
wmStoreApiService
.
listWmStore
(
onLineStoreIdList
,
null
).
getResult
();
List
<
String
>
onLineStoreList
=
wmStoreDTOList
.
stream
().
filter
(
wmStoreDTO
->
{
boolean
resourceFlag
=
true
;
if
(
StringUtils
.
isNotBlank
(
searchQo
.
getResourceType
())){
if
(
"1"
.
equals
(
searchQo
.
getResourceType
())){
//自有资源
if
(
enterpriseId
.
equals
(
wmStoreDTO
.
getEnterpriseId
())){
resourceFlag
=
true
;
}
}
if
(
"2"
.
equals
(
searchQo
.
getStoreBrand
())){
//共享资源
if
(!
enterpriseId
.
equals
(
wmStoreDTO
.
getEnterpriseId
())){
resourceFlag
=
true
;
}
}
}
boolean
brandFlag
=
true
;
if
(
StringUtils
.
isNotBlank
(
searchQo
.
getStoreBrand
())){
List
<
String
>
strings
=
Arrays
.
asList
(
searchQo
.
getStoreBrand
().
split
(
","
));
if
(
strings
.
contains
(
wmStoreDTO
.
getStoreBrandId
().
toString
())){
brandFlag
=
true
;
}
}
return
resourceFlag
||
brandFlag
;
}).
map
(
wmStoreDTO
->
wmStoreDTO
.
getWmMallStoreId
().
toString
()).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
onLineStoreList
)){
RedisUtil
.
setCache
(
key
,
1
,
10L
,
TimeUnit
.
MINUTES
);
}
return
onLineStoreList
;
}
}
}
}
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