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
e3a03f7e
Commit
e3a03f7e
authored
Jul 23, 2020
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
观云台小程序
parent
b7a4bb00
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
251 additions
and
2 deletions
+251
-2
StoreSearchUtils.java
...n/java/com/gic/cloud/web/controller/StoreSearchUtils.java
+154
-0
StoreWidgetController.java
...a/com/gic/cloud/web/controller/StoreWidgetController.java
+2
-2
StoreSearchQo.java
...app/src/main/java/com/gic/cloud/web/qo/StoreSearchQo.java
+94
-0
dubbo-gic-data-cloud-wxapp.xml
...d-wxapp/src/main/resources/dubbo-gic-data-cloud-wxapp.xml
+1
-0
No files found.
gic-data-cloud-wxapp/src/main/java/com/gic/cloud/web/controller/StoreSearchUtils.java
0 → 100644
View file @
e3a03f7e
package
com
.
gic
.
cloud
.
web
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.cloud.dto.AttentionStoreDTO
;
import
com.gic.cloud.dto.TempStoreConditionDTO
;
import
com.gic.cloud.service.StoreAttentionApiService
;
import
com.gic.cloud.service.TempStoreConditionApiService
;
import
com.gic.cloud.web.auth.DataAuthUtils
;
import
com.gic.cloud.web.auth.OnLineAuth
;
import
com.gic.cloud.web.auth.OnLineStore
;
import
com.gic.cloud.web.auth.StoreAuth
;
import
com.gic.cloud.web.constant.StoreChannelEnum
;
import
com.gic.cloud.web.qo.StoreSearchQo
;
import
com.gic.store.dto.StoreDTO
;
import
com.gic.store.dto.StoreGroupDTO
;
import
com.gic.store.dto.StoreSearchDTO
;
import
com.gic.store.service.StoreApiService
;
import
com.gic.store.service.StoreGroupApiService
;
import
com.gic.store.service.StoreWidgetApiService
;
import
com.google.inject.internal.cglib.core.
$ClassEmitter
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.reflections.Store
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Component
public
class
StoreSearchUtils
{
@Autowired
private
DataAuthUtils
dataAuthUtils
;
@Autowired
private
StoreAttentionApiService
storeAttentionApiService
;
@Autowired
private
TempStoreConditionApiService
tempStoreConditionApiService
;
@Autowired
private
StoreWidgetApiService
storeWidgetApiService
;
@Autowired
private
StoreApiService
storeApiService
;
@Autowired
private
StoreGroupApiService
storeGroupApiService
;
public
List
<
Integer
>
storeSearch
(
Integer
userId
,
Integer
enterpriseId
,
String
searchJson
){
StoreAuth
storeAuth
=
this
.
dataAuthUtils
.
getStoreAuth
(
userId
,
enterpriseId
);
if
(!
storeAuth
.
isHasAuth
()){
ArrayList
<
Integer
>
list
=
new
ArrayList
<>();
list
.
add
(
0
);
return
list
;
}
if
(
StringUtils
.
isNotBlank
(
searchJson
)){
JSONObject
json
=
JSON
.
parseObject
(
searchJson
);
StoreSearchQo
storeSearchQo
=
json
.
getObject
(
StoreChannelEnum
.
OFFLINE
.
getChannel
().
toString
(),
StoreSearchQo
.
class
);
if
(
storeSearchQo
.
getAll
()
==
1
){
return
storeAuth
.
getStoreInfoIdList
();
}
else
{
StoreSearchDTO
storeSearchDTO
=
new
StoreSearchDTO
();
storeSearchDTO
.
setEnterpriseId
(
enterpriseId
);
storeSearchDTO
.
setStoreInfoIds
(
storeSearchQo
.
getStoreIds
());
storeSearchDTO
.
setStoreGroupIds
(
storeSearchQo
.
getStoreGroupIds
());
storeSearchDTO
.
setRegionIds
(
storeSearchQo
.
getRegion
());
storeSearchDTO
.
setStoreTypes
(
storeSearchQo
.
getStoreType
());
storeSearchDTO
.
setStoreStatuss
(
storeSearchQo
.
getStoreStatus
());
storeSearchDTO
.
setErpStatuss
(
storeSearchQo
.
getErpStatus
());
storeSearchDTO
.
setStoreTags
(
storeSearchQo
.
getStoreTag
());
if
(
storeSearchQo
.
getAttentionStore
()
==
1
){
List
<
AttentionStoreDTO
>
result
=
this
.
storeAttentionApiService
.
pageStoreAttention
(
userId
,
enterpriseId
,
1
,
Integer
.
MAX_VALUE
).
getResult
().
getResult
();
List
<
Integer
>
list
=
result
.
stream
().
map
(
t
->
t
.
getStoreId
()).
collect
(
Collectors
.
toList
());
String
storeInfoIds
=
StringUtils
.
join
(
list
,
","
);
storeSearchDTO
.
setStoreInfoIds
(
storeSearchDTO
.
getStoreInfoIds
()+
","
+
storeInfoIds
);
}
if
(
storeSearchQo
.
getTmpStore
()
==
0
){
TempStoreConditionDTO
result
=
this
.
tempStoreConditionApiService
.
getTempStoreCondition
(
enterpriseId
).
getResult
();
if
(
result
!=
null
){
Integer
tempStoreId
=
result
.
getStoreWidgetId
();
List
<
Integer
>
tempStoreIdList
=
this
.
storeWidgetApiService
.
listStoreInfoIdByStoreWidgetId
(
enterpriseId
,
tempStoreId
).
getResult
();
storeSearchDTO
.
setStoreIdsOfNot
(
StringUtils
.
join
(
tempStoreIdList
,
","
));
}
}
List
<
StoreDTO
>
storeDTOList
=
this
.
storeApiService
.
listStore
(
storeSearchDTO
,
1
,
20000
).
getResult
().
getResult
();
List
<
Integer
>
storeInfoIdList
=
storeDTOList
.
stream
().
map
(
storeDTO
->
storeDTO
.
getStoreInfoId
()).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
storeAuth
.
getStoreInfoIdList
())){
return
storeInfoIdList
.
stream
().
filter
(
s
->
{
for
(
Integer
storeInfoId
:
storeAuth
.
getStoreInfoIdList
()){
if
(
s
.
intValue
()
==
storeInfoId
.
intValue
()){
return
true
;
}
}
return
false
;
}).
collect
(
Collectors
.
toList
());
}
else
{
return
storeInfoIdList
;
}
}
}
return
storeAuth
.
getStoreInfoIdList
();
}
public
List
<
String
>
onLineStoreSearch
(
Integer
userId
,
Integer
enterpriseId
,
String
searchJson
){
OnLineAuth
onlineStoreAuth
=
this
.
dataAuthUtils
.
getOnlineStore
(
userId
,
enterpriseId
);
List
<
String
>
list
=
new
ArrayList
<>();
if
(
onlineStoreAuth
.
isHasAuth
()){
this
.
getOnlineStoreIds
(
searchJson
,
onlineStoreAuth
,
list
,
StoreChannelEnum
.
GICMALL
.
getChannel
());
this
.
getOnlineStoreIds
(
searchJson
,
onlineStoreAuth
,
list
,
StoreChannelEnum
.
WMMALL
.
getChannel
());
this
.
getOnlineStoreIds
(
searchJson
,
onlineStoreAuth
,
list
,
StoreChannelEnum
.
TIANMAO
.
getChannel
());
}
else
{
list
.
add
(
"noauth"
);
}
return
list
;
}
public
Integer
getLevel
(
Integer
userId
,
Integer
enterpriseId
,
String
searchJson
){
List
<
Integer
>
list
=
this
.
storeSearch
(
userId
,
enterpriseId
,
searchJson
);
StoreSearchDTO
storeSearchDTO
=
new
StoreSearchDTO
();
storeSearchDTO
.
setEnterpriseId
(
enterpriseId
);
storeSearchDTO
.
setStoreInfoIds
(
StringUtils
.
join
(
list
,
","
));
List
<
StoreDTO
>
result
=
this
.
storeApiService
.
listStore
(
storeSearchDTO
,
1
,
20000
).
getResult
().
getResult
();
Map
<
Integer
,
Integer
>
map
=
new
HashMap
<>();
result
.
forEach
(
storeDTO
->
{
List
<
Integer
>
storeGroupIdList
=
storeDTO
.
getStoreGroupIdList
();
storeGroupIdList
.
forEach
(
storeGroupId
->{
map
.
put
(
storeGroupId
,
storeGroupId
);
});
});
List
<
StoreGroupDTO
>
allStoreGroupIdList
=
this
.
storeGroupApiService
.
listStoreGroupByIds
(
null
,
enterpriseId
).
getResult
();
Map
<
Integer
,
Integer
>
levelMap
=
new
HashMap
<>();
allStoreGroupIdList
.
forEach
(
storeGroupDTO
->
{
levelMap
.
put
(
storeGroupDTO
.
getGroupLevel
(),
levelMap
.
get
(
storeGroupDTO
.
getGroupLevel
())==
null
?
1
:
levelMap
.
get
(
storeGroupDTO
.
getGroupLevel
())+
1
);
});
int
start
=
0
;
while
(
true
){
if
(
levelMap
.
get
(
start
)
!=
null
&&
levelMap
.
get
(
start
).
intValue
()
>
1
){
return
start
;
}
start
++;
}
}
private
void
getOnlineStoreIds
(
String
searchJson
,
OnLineAuth
onlineStoreAuth
,
List
<
String
>
list
,
Integer
channel
){
StoreSearchQo
searchQo
=
JSON
.
parseObject
(
searchJson
).
getObject
(
channel
.
toString
(),
StoreSearchQo
.
class
);
if
(
searchQo
.
getAll
()
==
1
){
onlineStoreAuth
.
getList
().
stream
().
filter
(
s
->
{
if
(
s
.
getChannel
()
==
channel
){
list
.
addAll
(
s
.
getStoreIdList
());
}
return
false
;
});
}
else
{
list
.
addAll
(
Arrays
.
asList
(
searchQo
.
getStoreGroupIds
().
split
(
","
)));
}
}
}
gic-data-cloud-wxapp/src/main/java/com/gic/cloud/web/controller/StoreWidgetController.java
View file @
e3a03f7e
...
...
@@ -399,10 +399,10 @@ public class StoreWidgetController {
List
<
WmStoreDTO
>
result
=
wmStoreApiService
.
listWmStore
(
enterpriseId
).
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
result
)){
for
(
WmStoreDTO
wmStoreDTO
:
result
){
if
(
storeIdList
.
contains
(
wmStoreDTO
.
getWm
StoreId
())){
if
(
storeIdList
.
contains
(
wmStoreDTO
.
getWm
MallStoreId
().
toString
())){
OnLineStoreVo
onLineStoreVo
=
new
OnLineStoreVo
();
onLineStoreVo
.
setOnStoreId
(
wmStoreDTO
.
getWmStoreId
()+
""
);
onLineStoreVo
.
setOnStoreName
(
wmStoreDTO
.
getWm
MainAccount
());
onLineStoreVo
.
setOnStoreName
(
wmStoreDTO
.
getWm
PidName
());
list
.
add
(
onLineStoreVo
);
}
}
...
...
gic-data-cloud-wxapp/src/main/java/com/gic/cloud/web/qo/StoreSearchQo.java
0 → 100644
View file @
e3a03f7e
package
com
.
gic
.
cloud
.
web
.
qo
;
public
class
StoreSearchQo
{
private
Integer
all
=
0
;
private
String
region
;
private
String
storeType
;
private
String
storeStatus
;
private
String
erpStatus
;
private
String
storeTag
;
private
Integer
attentionStore
=
0
;
private
Integer
tmpStore
=
0
;
private
String
storeGroupIds
;
//和线上共享使用,当为线上门店时,该值对应店铺
private
String
storeIds
;
//和线上共享使用,当为线上门店时,该值对应店铺下门店id
public
Integer
getAll
()
{
return
all
;
}
public
void
setAll
(
Integer
all
)
{
this
.
all
=
all
;
}
public
String
getStoreGroupIds
()
{
return
storeGroupIds
;
}
public
void
setStoreGroupIds
(
String
storeGroupIds
)
{
this
.
storeGroupIds
=
storeGroupIds
;
}
public
String
getRegion
()
{
return
region
;
}
public
void
setRegion
(
String
region
)
{
this
.
region
=
region
;
}
public
String
getStoreType
()
{
return
storeType
;
}
public
void
setStoreType
(
String
storeType
)
{
this
.
storeType
=
storeType
;
}
public
String
getStoreStatus
()
{
return
storeStatus
;
}
public
void
setStoreStatus
(
String
storeStatus
)
{
this
.
storeStatus
=
storeStatus
;
}
public
String
getErpStatus
()
{
return
erpStatus
;
}
public
void
setErpStatus
(
String
erpStatus
)
{
this
.
erpStatus
=
erpStatus
;
}
public
String
getStoreTag
()
{
return
storeTag
;
}
public
void
setStoreTag
(
String
storeTag
)
{
this
.
storeTag
=
storeTag
;
}
public
Integer
getAttentionStore
()
{
return
attentionStore
;
}
public
void
setAttentionStore
(
Integer
attentionStore
)
{
this
.
attentionStore
=
attentionStore
;
}
public
Integer
getTmpStore
()
{
return
tmpStore
;
}
public
void
setTmpStore
(
Integer
tmpStore
)
{
this
.
tmpStore
=
tmpStore
;
}
public
String
getStoreIds
()
{
return
storeIds
;
}
public
void
setStoreIds
(
String
storeIds
)
{
this
.
storeIds
=
storeIds
;
}
}
gic-data-cloud-wxapp/src/main/resources/dubbo-gic-data-cloud-wxapp.xml
View file @
e3a03f7e
...
...
@@ -142,4 +142,5 @@
<dubbo:reference
interface=
"com.gic.marketing.process.api.service.sms.SmsSendApiService"
id=
"smsSendApiService"
timeout=
"6000"
retries=
"0"
/>
<dubbo:reference
interface=
"com.gic.store.service.StoreTagApiService"
id=
"storeTagApiService"
timeout=
"6000"
retries=
"0"
/>
<dubbo:reference
interface=
"com.gic.cloud.service.StoreAttentionApiService"
id=
"storeAttentionApiService"
timeout=
"6000"
retries=
"0"
/>
<dubbo:reference
interface=
"com.gic.cloud.service.TempStoreConditionApiService"
id=
"tempStoreConditionApiService"
timeout=
"6000"
retries=
"0"
/>
</beans>
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