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
c3451283
Commit
c3451283
authored
Jun 16, 2021
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
门店控件查询
parent
35069117
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
12 deletions
+56
-12
StoreSearchUtils.java
...n/java/com/gic/cloud/web/controller/StoreSearchUtils.java
+47
-12
StoreSearchQo.java
...app/src/main/java/com/gic/cloud/web/qo/StoreSearchQo.java
+9
-0
No files found.
gic-data-cloud-wxapp/src/main/java/com/gic/cloud/web/controller/StoreSearchUtils.java
View file @
c3451283
...
...
@@ -82,8 +82,38 @@ public class StoreSearchUtils {
return
0
;
}
public
int
dealSearchJson
(
String
searchJson
){
/***线上和线下选项值都为空的时候--所有门店权限范围
* 线上或者线下有一个的选项值不为空时,则为单渠道权限范围*
* 线上和线下的json值为空的时候 -- 所有门店权限范围*/
if
(
StringUtils
.
isBlank
(
searchJson
)){
return
0
;
}
else
{
JSONObject
json
=
JSON
.
parseObject
(
searchJson
);
StoreSearchQo
offLineSearch
=
json
.
getObject
(
StoreChannelEnum
.
OFFLINE
.
getChannel
().
toString
(),
StoreSearchQo
.
class
);
StoreSearchQo
onLineSearch
=
JSON
.
parseObject
(
searchJson
).
getObject
(
StoreChannelEnum
.
WMMALL
.
getChannel
().
toString
(),
StoreSearchQo
.
class
);
boolean
off
=
offLineSearch
.
isEmpty
();
boolean
online
=
onLineSearch
.
isEmpty
();
if
(
off
&&
online
){
return
0
;
}
else
if
(!
off
&&
online
){
return
1
;
}
else
if
(
off
&&
!
online
){
return
2
;
}
else
{
return
0
;
}
}
}
public
List
<
Integer
>
storeSearch
(
Integer
userId
,
Integer
enterpriseId
,
String
searchJson
){
log
.
info
(
"storeSearchParams:{},{},{}"
,
userId
,
enterpriseId
,
searchJson
);
List
<
Integer
>
resultList
=
new
ArrayList
<>();
int
flag
=
dealSearchJson
(
searchJson
);
if
(
flag
==
2
){
resultList
.
add
(
0
);
return
resultList
;
}
String
key
=
"1:"
+
enterpriseId
+
":"
+
userId
+
":"
+
(
StringUtils
.
isNotBlank
(
searchJson
)
?
searchJson
.
hashCode
()
:
"searchJSON"
.
hashCode
());
StoreAuth
storeAuth
=
this
.
dataAuthUtils
.
getStoreAuth
(
userId
,
enterpriseId
);
log
.
info
(
"storeAuth:{}"
,
JSON
.
toJSONString
(
storeAuth
));
...
...
@@ -92,7 +122,6 @@ public class StoreSearchUtils {
list
.
add
(
0
);
return
list
;
}
List
<
Integer
>
resultList
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotBlank
(
searchJson
)){
JSONObject
json
=
JSON
.
parseObject
(
searchJson
);
StoreSearchQo
storeSearchQo
=
json
.
getObject
(
StoreChannelEnum
.
OFFLINE
.
getChannel
().
toString
(),
StoreSearchQo
.
class
);
...
...
@@ -175,9 +204,14 @@ public class StoreSearchUtils {
}
public
List
<
String
>
onLineStoreSearch
(
Integer
userId
,
Integer
enterpriseId
,
String
searchJson
){
List
<
String
>
list
=
new
ArrayList
<>();
int
flag
=
dealSearchJson
(
searchJson
);
if
(
flag
==
1
){
list
.
add
(
"0"
);
return
list
;
}
OnLineAuth
onlineStoreAuth
=
this
.
dataAuthUtils
.
getOnlineStore
(
userId
,
enterpriseId
);
log
.
info
(
"onlineStoreAuth:{}"
,
JSON
.
toJSONString
(
onlineStoreAuth
));
List
<
String
>
list
=
new
ArrayList
<>();
if
(
onlineStoreAuth
.
isHasAuth
()){
this
.
getOnlineStoreIds
(
searchJson
,
onlineStoreAuth
,
list
,
StoreChannelEnum
.
GICMALL
.
getChannel
(),
userId
,
enterpriseId
);
this
.
getOnlineStoreIds
(
searchJson
,
onlineStoreAuth
,
list
,
StoreChannelEnum
.
WMMALL
.
getChannel
(),
userId
,
enterpriseId
);
...
...
@@ -327,37 +361,38 @@ public class StoreSearchUtils {
}
}
private
List
<
String
>
filter
(
Integer
channel
,
StoreSearchQo
searchQo
,
Integer
enterpriseId
,
String
key
,
List
<
String
>
onLineStoreIdList
){
if
(
StoreChannelEnum
.
WMMALL
.
getChannel
().
equals
(
channel
))
{
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
()))
{
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
()))
{
if
(
"2"
.
equals
(
searchQo
.
getStoreBrand
()))
{
//共享资源
if
(!
enterpriseId
.
equals
(
wmStoreDTO
.
getEnterpriseId
()))
{
resourceFlag
=
true
;
}
}
}
boolean
brandFlag
=
true
;
if
(
StringUtils
.
isNotBlank
(
searchQo
.
getStoreBrand
()))
{
if
(
StringUtils
.
isNotBlank
(
searchQo
.
getStoreBrand
()))
{
List
<
String
>
strings
=
Arrays
.
asList
(
searchQo
.
getStoreBrand
().
split
(
","
));
if
(
strings
.
contains
(
wmStoreDTO
.
getStoreBrandId
().
toString
()))
{
if
(
strings
.
contains
(
wmStoreDTO
.
getStoreBrandId
().
toString
()))
{
brandFlag
=
true
;
}
}
return
resourceFlag
||
brandFlag
;
}).
map
(
wmStoreDTO
->
wmStoreDTO
.
getWmMallStoreId
().
toString
()).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
onLineStoreList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
onLineStoreList
))
{
RedisUtil
.
setCache
(
key
,
1
,
10L
,
TimeUnit
.
MINUTES
);
}
return
onLineStoreList
;
}
return
null
;
}
}
gic-data-cloud-wxapp/src/main/java/com/gic/cloud/web/qo/StoreSearchQo.java
View file @
c3451283
package
com
.
gic
.
cloud
.
web
.
qo
;
import
org.apache.commons.lang3.StringUtils
;
/**
* 门店查询
* @ClassName: StoreSearchQo
...
...
@@ -32,6 +35,11 @@ public class StoreSearchQo {
private
String
resourceType
;
public
boolean
isEmpty
(){
return
all
==
0
&&
StringUtils
.
isBlank
(
region
)
&&
StringUtils
.
isBlank
(
storeType
)
&&
StringUtils
.
isBlank
(
storeStatus
)
&&
StringUtils
.
isBlank
(
storeTag
)
&&
attentionStore
==
0
&&
StringUtils
.
isBlank
(
storeGroupIds
)
&&
StringUtils
.
isBlank
(
storeIds
)
&&
StringUtils
.
isBlank
(
storeBrand
)
&&
StringUtils
.
isBlank
(
resourceType
);
}
public
Integer
getAll
()
{
return
all
;
}
...
...
@@ -135,4 +143,5 @@ public class StoreSearchQo {
public
void
setResourceType
(
String
resourceType
)
{
this
.
resourceType
=
resourceType
;
}
}
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