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
aa343331
Commit
aa343331
authored
Aug 12, 2020
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
观云台小程序
parent
5181747a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
178 additions
and
70 deletions
+178
-70
BaseSalesController.java
...ava/com/gic/cloud/web/controller/BaseSalesController.java
+2
-70
ConsumeStructureController.java
.../gic/cloud/web/controller/ConsumeStructureController.java
+0
-0
GoDownComponent.java
...in/java/com/gic/cloud/web/controller/GoDownComponent.java
+176
-0
No files found.
gic-data-cloud-wxapp/src/main/java/com/gic/cloud/web/controller/BaseSalesController.java
View file @
aa343331
...
@@ -37,9 +37,7 @@ public class BaseSalesController {
...
@@ -37,9 +37,7 @@ public class BaseSalesController {
@Autowired
@Autowired
private
BaseSalesApiService
baseSalesApiService
;
private
BaseSalesApiService
baseSalesApiService
;
@Autowired
@Autowired
private
ShopApiService
shopApiService
;
private
GoDownComponent
goDownComponent
;
@Autowired
private
WmStoreApiService
wmStoreApiService
;
@RequestMapping
(
"base-sales"
)
@RequestMapping
(
"base-sales"
)
public
RestResponse
baseSales
(
BaseSalesParamQo
qo
){
public
RestResponse
baseSales
(
BaseSalesParamQo
qo
){
...
@@ -88,7 +86,7 @@ public class BaseSalesController {
...
@@ -88,7 +86,7 @@ public class BaseSalesController {
dto
.
setPageNum
(
qo
.
getPageNum
());
dto
.
setPageNum
(
qo
.
getPageNum
());
dto
.
setPageSize
(
qo
.
getPageSize
());
dto
.
setPageSize
(
qo
.
getPageSize
());
ServiceResponse
<
Page
<
BaseSalesDTO
>>
response
=
this
.
baseSalesApiService
.
pageBaseSales
(
dto
);
ServiceResponse
<
Page
<
BaseSalesDTO
>>
response
=
this
.
baseSalesApiService
.
pageBaseSales
(
dto
);
vo
.
setPage
(
this
.
parseData
(
response
.
getResult
(),
qo
.
getChannel
(),
qo
.
getEnterpriseId
(),
qo
.
getLevel
(),
maxLevel
));
vo
.
setPage
(
this
.
goDownComponent
.
parseData
(
response
.
getResult
(),
qo
.
getChannel
(),
qo
.
getEnterpriseId
(),
qo
.
getLevel
(),
maxLevel
));
dto
.
setCountType
(
2
);
//合计
dto
.
setCountType
(
2
);
//合计
ServiceResponse
<
Page
<
BaseSalesDTO
>>
response1
=
this
.
baseSalesApiService
.
pageBaseSales
(
dto
);
ServiceResponse
<
Page
<
BaseSalesDTO
>>
response1
=
this
.
baseSalesApiService
.
pageBaseSales
(
dto
);
if
(
response1
.
isSuccess
()
&&
response1
.
getResult
()
!=
null
&&
CollectionUtils
.
isNotEmpty
(
response1
.
getResult
().
getResult
())){
if
(
response1
.
isSuccess
()
&&
response1
.
getResult
()
!=
null
&&
CollectionUtils
.
isNotEmpty
(
response1
.
getResult
().
getResult
())){
...
@@ -113,70 +111,4 @@ public class BaseSalesController {
...
@@ -113,70 +111,4 @@ public class BaseSalesController {
}
}
return
RestResponse
.
success
(
vo
);
return
RestResponse
.
success
(
vo
);
}
}
public
Page
<
BaseSalesDTO
>
parseData
(
Page
<
BaseSalesDTO
>
page
,
Integer
channel
,
Integer
enterpriseId
,
Integer
level
,
Integer
maxLevel
){
if
(
page
!=
null
&&
CollectionUtils
.
isNotEmpty
(
page
.
getResult
())){
if
(
channel
==
null
){
//全渠道
page
.
getResult
().
stream
().
forEach
(
baseSalesDTO
->
{
baseSalesDTO
.
setLevel
(
level
-
1
);
if
(
StoreChannelEnum
.
OFFLINE
.
getChannel
()
==
Integer
.
valueOf
(
baseSalesDTO
.
getId
())){
baseSalesDTO
.
setName
(
StoreChannelEnum
.
OFFLINE
.
getMessage
());
baseSalesDTO
.
setChannel
(
StoreChannelEnum
.
OFFLINE
.
getChannel
());
baseSalesDTO
.
setHasChildren
(
1
);
}
if
(
StoreChannelEnum
.
GICMALL
.
getChannel
()
==
Integer
.
valueOf
(
baseSalesDTO
.
getId
())){
baseSalesDTO
.
setName
(
StoreChannelEnum
.
GICMALL
.
getMessage
());
baseSalesDTO
.
setChannel
(
StoreChannelEnum
.
GICMALL
.
getChannel
());
baseSalesDTO
.
setHasChildren
(
1
);
}
if
(
StoreChannelEnum
.
WMMALL
.
getChannel
()
==
Integer
.
valueOf
(
baseSalesDTO
.
getId
())){
baseSalesDTO
.
setName
(
StoreChannelEnum
.
WMMALL
.
getMessage
());
baseSalesDTO
.
setChannel
(
StoreChannelEnum
.
WMMALL
.
getChannel
());
baseSalesDTO
.
setHasChildren
(
1
);
}
if
(
StoreChannelEnum
.
TIANMAO
.
getChannel
()
==
Integer
.
valueOf
(
baseSalesDTO
.
getId
())){
baseSalesDTO
.
setName
(
StoreChannelEnum
.
TIANMAO
.
getMessage
());
baseSalesDTO
.
setChannel
(
StoreChannelEnum
.
TIANMAO
.
getChannel
());
baseSalesDTO
.
setHasChildren
(
1
);
}
});
}
if
(
channel
==
StoreChannelEnum
.
GICMALL
.
getChannel
()){
List
<
ShopDTO
>
result
=
shopApiService
.
getAllShopByEnterpriseIdAndName
(
enterpriseId
,
null
,
ShopTypeEnum
.
MALL_SHOP
.
getCode
()).
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
result
)){
page
.
getResult
().
stream
().
forEach
(
baseSalesDTO
->
{
baseSalesDTO
.
setLevel
(
level
-
1
);
for
(
ShopDTO
shopDTO
:
result
){
if
(
baseSalesDTO
.
getId
().
equals
(
shopDTO
.
getId
()+
""
)){
baseSalesDTO
.
setName
(
shopDTO
.
getName
());
baseSalesDTO
.
setChannel
(
channel
);
}
}
});
}
}
if
(
channel
==
StoreChannelEnum
.
WMMALL
.
getChannel
()){
List
<
WmStoreDTO
>
result1
=
wmStoreApiService
.
listWmStore
(
enterpriseId
,
null
).
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
result1
)){
page
.
getResult
().
stream
().
forEach
(
baseSalesDTO
->
{
baseSalesDTO
.
setLevel
(
level
-
1
);
for
(
WmStoreDTO
dto
:
result1
){
if
(
baseSalesDTO
.
getId
().
equals
(
dto
.
getWmMallStoreId
()+
""
)){
baseSalesDTO
.
setName
(
dto
.
getWmMainAccount
());
baseSalesDTO
.
setChannel
(
channel
);
}
}
});
}
}
if
(
channel
==
StoreChannelEnum
.
OFFLINE
.
getChannel
()){
page
.
getResult
().
stream
().
forEach
(
baseSalesDTO
->
{
baseSalesDTO
.
setLevel
(
level
);
baseSalesDTO
.
setChannel
(
StoreChannelEnum
.
OFFLINE
.
getChannel
());
baseSalesDTO
.
setHasChildren
(
level
<
maxLevel
?
1
:
0
);
});
}
}
return
page
;
}
}
}
gic-data-cloud-wxapp/src/main/java/com/gic/cloud/web/controller/ConsumeStructureController.java
View file @
aa343331
This diff is collapsed.
Click to expand it.
gic-data-cloud-wxapp/src/main/java/com/gic/cloud/web/controller/GoDownComponent.java
0 → 100644
View file @
aa343331
package
com
.
gic
.
cloud
.
web
.
controller
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.cloud.web.auth.DataAuthUtils
;
import
com.gic.cloud.web.constant.StoreChannelEnum
;
import
com.gic.cloud.web.utils.LevelUtil
;
import
com.gic.cloud.web.vo.BaseSalesVo
;
import
com.gic.cloud.web.vo.LevelVo
;
import
com.gic.data.api.dto.BaseDTO
;
import
com.gic.data.api.dto.BaseSalesDTO
;
import
com.gic.data.api.qo.common.CommonQO
;
import
com.gic.enterprise.dto.WmStoreDTO
;
import
com.gic.enterprise.service.WmStoreApiService
;
import
com.gic.mall.share.api.dto.shop.ShopDTO
;
import
com.gic.mall.share.api.enums.ShopTypeEnum
;
import
com.gic.mall.share.api.service.ShopApiService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
@Component
public
class
GoDownComponent
{
@Autowired
private
ShopApiService
shopApiService
;
@Autowired
private
WmStoreApiService
wmStoreApiService
;
@Autowired
private
StoreSearchUtils
storeSearchUtils
;
@Autowired
private
DataAuthUtils
dataAuthUtils
;
public
void
parseTotal
(
ServiceResponse
<?>
response
,
BaseSalesVo
vo
){
if
(
response
.
isSuccess
()
&&
response
.
getResult
()
!=
null
){
Page
<
BaseDTO
>
page
=
(
Page
<
BaseDTO
>)
response
.
getResult
();
if
(
CollectionUtils
.
isEmpty
(
page
.
getResult
())){
return
;
}
BaseDTO
total
=
page
.
getResult
().
get
(
0
);
if
(
total
!=
null
){
total
.
setAreaId
(
"0"
);
total
.
setAreaName
(
"合计/均值"
);
vo
.
setTotal
(
total
);
}
}
}
public
void
parseWgs
(
ServiceResponse
<?>
response
,
BaseSalesVo
vo
){
if
(
response
.
isSuccess
()
&&
response
.
getResult
()
!=
null
){
Page
<
BaseDTO
>
page
=
(
Page
<
BaseDTO
>)
response
.
getResult
();
if
(
CollectionUtils
.
isEmpty
(
page
.
getResult
())){
return
;
}
BaseDTO
wgs
=
page
.
getResult
().
get
(
0
);
if
(
wgs
!=
null
){
wgs
.
setAreaName
(
"无归属"
);
wgs
.
setAreaId
(
"-1"
);
vo
.
setWgs
(
wgs
);
}
}
}
public
LevelVo
setValue
(
CommonQO
params
,
BaseSalesVo
vo
){
params
.
setOnlineStoreIdList
(
storeSearchUtils
.
onLineStoreSearch
(
params
.
getUserId
(),
params
.
getEnterpriseId
(),
params
.
getSearchJson
()));
params
.
setStoreInfoIdList
(
storeSearchUtils
.
storeSearch
(
params
.
getUserId
(),
params
.
getEnterpriseId
(),
params
.
getSearchJson
()));
params
.
setGroupIdList
(
storeSearchUtils
.
getChildrenStoreGroupIdList
(
params
.
getParentId
()));
params
.
setMemberCardIdList
(
dataAuthUtils
.
getMbrAreaId
(
params
.
getUserId
(),
params
.
getEnterpriseId
()));
/******线下渠道需要点击下钻,该值只会在线下时才会使用********/
LevelVo
levelVo
=
this
.
storeSearchUtils
.
getLevel
(
params
.
getUserId
(),
params
.
getEnterpriseId
(),
params
.
getSearchJson
());
if
(
params
.
getLevel
()
==
null
){
params
.
setLevel
(
levelVo
.
getLevel
());
}
/***********如果是线下的第一层级,需要展示切换层级按钮*************/
if
(
params
.
getChannel
()
==
StoreChannelEnum
.
OFFLINE
.
getChannel
()
&&
params
.
getLevel
()
==
levelVo
.
getLevel
()){
vo
.
setChangeLevel
(
1
);
}
if
(
params
.
getChannel
()
==
null
){
vo
.
setLevelName
(
"所有渠道"
);
}
else
if
(
params
.
getChannel
()
==
StoreChannelEnum
.
OFFLINE
.
getChannel
()){
vo
.
setLevelName
(
LevelUtil
.
getLevelName
(
params
.
getLevel
()));
}
else
{
vo
.
setLevelName
(
"店铺层级"
);
}
return
levelVo
;
}
public
Page
<?>
parseData
(
Page
<?>
page
,
Integer
channel
,
Integer
enterpriseId
,
Integer
level
,
Integer
maxLevel
){
if
(
page
!=
null
&&
CollectionUtils
.
isNotEmpty
(
page
.
getResult
())){
if
(
channel
==
null
){
//全渠道
page
.
getResult
().
stream
().
forEach
(
b
->
{
BaseDTO
baseSalesDTO
=
(
BaseDTO
)
b
;
baseSalesDTO
.
setLevel
(
level
-
1
);
if
(
StoreChannelEnum
.
OFFLINE
.
getChannel
()
==
Integer
.
valueOf
(
baseSalesDTO
.
getId
())){
baseSalesDTO
.
setAreaName
(
StoreChannelEnum
.
OFFLINE
.
getMessage
());
baseSalesDTO
.
setName
(
StoreChannelEnum
.
OFFLINE
.
getMessage
());
baseSalesDTO
.
setChannel
(
StoreChannelEnum
.
OFFLINE
.
getChannel
());
baseSalesDTO
.
setHasChildren
(
1
);
}
if
(
StoreChannelEnum
.
GICMALL
.
getChannel
()
==
Integer
.
valueOf
(
baseSalesDTO
.
getId
())){
baseSalesDTO
.
setName
(
StoreChannelEnum
.
GICMALL
.
getMessage
());
baseSalesDTO
.
setAreaName
(
StoreChannelEnum
.
GICMALL
.
getMessage
());
baseSalesDTO
.
setChannel
(
StoreChannelEnum
.
GICMALL
.
getChannel
());
baseSalesDTO
.
setHasChildren
(
1
);
}
if
(
StoreChannelEnum
.
WMMALL
.
getChannel
()
==
Integer
.
valueOf
(
baseSalesDTO
.
getId
())){
baseSalesDTO
.
setName
(
StoreChannelEnum
.
WMMALL
.
getMessage
());
baseSalesDTO
.
setAreaName
(
StoreChannelEnum
.
WMMALL
.
getMessage
());
baseSalesDTO
.
setChannel
(
StoreChannelEnum
.
WMMALL
.
getChannel
());
baseSalesDTO
.
setHasChildren
(
1
);
}
if
(
StoreChannelEnum
.
TIANMAO
.
getChannel
()
==
Integer
.
valueOf
(
baseSalesDTO
.
getId
())){
baseSalesDTO
.
setName
(
StoreChannelEnum
.
TIANMAO
.
getMessage
());
baseSalesDTO
.
setAreaName
(
StoreChannelEnum
.
TIANMAO
.
getMessage
());
baseSalesDTO
.
setChannel
(
StoreChannelEnum
.
TIANMAO
.
getChannel
());
baseSalesDTO
.
setHasChildren
(
1
);
}
});
}
if
(
channel
==
StoreChannelEnum
.
GICMALL
.
getChannel
()){
List
<
ShopDTO
>
result
=
shopApiService
.
getAllShopByEnterpriseIdAndName
(
enterpriseId
,
null
,
ShopTypeEnum
.
MALL_SHOP
.
getCode
()).
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
result
)){
page
.
getResult
().
stream
().
forEach
(
b
->
{
BaseDTO
baseSalesDTO
=
(
BaseDTO
)
b
;
baseSalesDTO
.
setLevel
(
level
-
1
);
for
(
ShopDTO
shopDTO
:
result
){
if
(
baseSalesDTO
instanceof
BaseSalesDTO
){
if
(
baseSalesDTO
.
getId
().
equals
(
shopDTO
.
getId
()+
""
)){
baseSalesDTO
.
setName
(
shopDTO
.
getName
());
baseSalesDTO
.
setChannel
(
channel
);
}
}
else
{
if
(
baseSalesDTO
.
getAreaId
().
equals
(
shopDTO
.
getId
()+
""
)){
baseSalesDTO
.
setAreaName
(
shopDTO
.
getName
());
baseSalesDTO
.
setChannel
(
channel
);
}
}
}
});
}
}
if
(
channel
==
StoreChannelEnum
.
WMMALL
.
getChannel
()){
List
<
WmStoreDTO
>
result1
=
wmStoreApiService
.
listWmStore
(
enterpriseId
,
null
).
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
result1
)){
page
.
getResult
().
stream
().
forEach
(
b
->
{
BaseDTO
baseSalesDTO
=
(
BaseDTO
)
b
;
baseSalesDTO
.
setLevel
(
level
-
1
);
for
(
WmStoreDTO
dto
:
result1
){
if
(
baseSalesDTO
instanceof
BaseSalesDTO
){
if
(
baseSalesDTO
.
getId
().
equals
(
dto
.
getWmMallStoreId
()+
""
)){
baseSalesDTO
.
setName
(
dto
.
getWmMainAccount
());
baseSalesDTO
.
setChannel
(
channel
);
}
}
else
{
if
(
baseSalesDTO
.
getAreaId
().
equals
(
dto
.
getWmMallStoreId
()+
""
)){
baseSalesDTO
.
setAreaName
(
dto
.
getWmMainAccount
());
baseSalesDTO
.
setChannel
(
channel
);
}
}
}
});
}
}
if
(
channel
==
StoreChannelEnum
.
OFFLINE
.
getChannel
()){
page
.
getResult
().
stream
().
forEach
(
b
->
{
BaseDTO
baseSalesDTO
=
(
BaseDTO
)
b
;
baseSalesDTO
.
setLevel
(
level
);
baseSalesDTO
.
setChannel
(
StoreChannelEnum
.
OFFLINE
.
getChannel
());
baseSalesDTO
.
setHasChildren
(
level
<
maxLevel
?
1
:
0
);
});
}
}
return
page
;
}
}
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