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
feba4b27
Commit
feba4b27
authored
Aug 11, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
7e2f4049
8f9ad6f4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
148 additions
and
15 deletions
+148
-15
ConsumeStructureController.java
.../gic/cloud/web/controller/ConsumeStructureController.java
+131
-4
StoreSearchUtils.java
...n/java/com/gic/cloud/web/controller/StoreSearchUtils.java
+3
-0
BaseSalesVo.java
...wxapp/src/main/java/com/gic/cloud/web/vo/BaseSalesVo.java
+10
-11
T.java
...ata-cloud-wxapp/src/main/java/com/gic/cloud/web/vo/T.java
+4
-0
No files found.
gic-data-cloud-wxapp/src/main/java/com/gic/cloud/web/controller/ConsumeStructureController.java
View file @
feba4b27
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.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.BaseSalesDTO
;
import
com.gic.data.api.dto.consumestructure.AgeConsumeAreaDTO
;
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.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -13,6 +27,8 @@ import com.gic.data.api.qo.consumestructure.*;
import
com.gic.data.api.service.consumestructure.ConsumeStructureApiService
;
import
com.gic.enterprise.utils.ResultControllerUtils
;
import
java.util.List
;
@RestController
public
class
ConsumeStructureController
{
private
static
final
Logger
log
=
LogManager
.
getLogger
(
ConsumeStructureController
.
class
);
...
...
@@ -22,6 +38,10 @@ public class ConsumeStructureController {
private
StoreSearchUtils
storeSearchUtils
;
@Autowired
private
DataAuthUtils
dataAuthUtils
;
@Autowired
private
ShopApiService
shopApiService
;
@Autowired
private
WmStoreApiService
wmStoreApiService
;
/**
* 年龄消费占比(订单人数/订单数/销售额)
...
...
@@ -56,14 +76,121 @@ public class ConsumeStructureController {
@RequestMapping
(
"get-age-consume-area"
)
public
RestResponse
queryAgeConsumeArea
(
AgeConsumeAreaQO
params
)
{
log
.
info
(
"消费构成-消费年龄-区域参数:{}"
,
JSON
.
toJSONString
(
params
));
BaseSalesVo
vo
=
new
BaseSalesVo
();
params
.
setOnlineStoreIdList
(
storeSearchUtils
.
onLineStoreSearch
(
params
.
getUserId
(),
params
.
getEnterpriseId
(),
params
.
getSearchJson
()));
params
.
setStoreInfoIdList
(
storeSearchUtils
.
storeSearch
(
params
.
getUserId
(),
params
.
getEnterpriseId
(),
params
.
getSearchJson
()));
if
(
params
.
getLevel
()
==
null
)
{
params
.
setLevel
(
storeSearchUtils
.
getLevel
(
params
.
getUserId
(),
params
.
getEnterpriseId
(),
params
.
getSearchJson
()).
getLevel
());
}
params
.
setGroupIdList
(
storeSearchUtils
.
getChildrenStoreGroupIdList
(
params
.
getParentId
()));
params
.
setMemberCardIdList
(
dataAuthUtils
.
getMbrAreaId
(
params
.
getUserId
(),
params
.
getEnterpriseId
()));
return
ResultControllerUtils
.
commonResult
(
consumeStructureApiService
.
pageAgeConsumeArea
(
params
));
Integer
maxLevel
=
0
;
/******线下渠道需要点击下钻,该值只会在线下时才会使用********/
LevelVo
levelVo
=
this
.
storeSearchUtils
.
getLevel
(
params
.
getUserId
(),
params
.
getEnterpriseId
(),
params
.
getSearchJson
());
maxLevel
=
levelVo
.
getMaxLevel
();
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
(
"店铺层级"
);
}
params
.
setCountType
(
1
);
ServiceResponse
<
Page
<
AgeConsumeAreaDTO
>>
pageServiceResponse
=
consumeStructureApiService
.
pageAgeConsumeArea
(
params
);
vo
.
setPage
(
this
.
parseAgeConsumeArea
(
pageServiceResponse
.
getResult
(),
params
.
getChannel
(),
params
.
getEnterpriseId
(),
params
.
getLevel
(),
maxLevel
));
params
.
setCountType
(
2
);
ServiceResponse
<
Page
<
AgeConsumeAreaDTO
>>
response1
=
consumeStructureApiService
.
pageAgeConsumeArea
(
params
);
if
(
response1
.
isSuccess
()
&&
response1
.
getResult
()
!=
null
&&
CollectionUtils
.
isNotEmpty
(
response1
.
getResult
().
getResult
())){
AgeConsumeAreaDTO
total
=
response1
.
getResult
().
getResult
().
get
(
0
);
if
(
total
!=
null
){
total
.
setAreaId
(
0
);
total
.
setAreaName
(
"合计"
);
vo
.
setTotal
(
total
);
}
}
if
(
params
.
getChannel
()
!=
null
&&
params
.
getChannel
()
==
1
&&
params
.
getLevel
()
==
levelVo
.
getLevel
()){
params
.
setCountType
(
3
);
//无归属
ServiceResponse
<
Page
<
AgeConsumeAreaDTO
>>
response2
=
consumeStructureApiService
.
pageAgeConsumeArea
(
params
);
if
(
response2
.
isSuccess
()
&&
response2
.
getResult
()
!=
null
&&
CollectionUtils
.
isNotEmpty
(
response2
.
getResult
().
getResult
())){
AgeConsumeAreaDTO
wgs
=
response2
.
getResult
().
getResult
().
get
(
0
);
if
(
wgs
!=
null
){
wgs
.
setAreaName
(
"无归属"
);
wgs
.
setAreaId
(-
1
);
vo
.
setWgs
(
wgs
);
}
}
}
return
RestResponse
.
success
(
vo
);
}
public
Page
<
AgeConsumeAreaDTO
>
parseAgeConsumeArea
(
Page
<
AgeConsumeAreaDTO
>
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
.
getAreaId
())){
baseSalesDTO
.
setAreaName
(
StoreChannelEnum
.
OFFLINE
.
getMessage
());
baseSalesDTO
.
setChannel
(
StoreChannelEnum
.
OFFLINE
.
getChannel
());
baseSalesDTO
.
setHasChildren
(
1
);
}
if
(
StoreChannelEnum
.
GICMALL
.
getChannel
()
==
Integer
.
valueOf
(
baseSalesDTO
.
getAreaId
())){
baseSalesDTO
.
setAreaName
(
StoreChannelEnum
.
GICMALL
.
getMessage
());
baseSalesDTO
.
setChannel
(
StoreChannelEnum
.
GICMALL
.
getChannel
());
baseSalesDTO
.
setHasChildren
(
1
);
}
if
(
StoreChannelEnum
.
WMMALL
.
getChannel
()
==
Integer
.
valueOf
(
baseSalesDTO
.
getAreaId
())){
baseSalesDTO
.
setAreaName
(
StoreChannelEnum
.
WMMALL
.
getMessage
());
baseSalesDTO
.
setChannel
(
StoreChannelEnum
.
WMMALL
.
getChannel
());
baseSalesDTO
.
setHasChildren
(
1
);
}
if
(
StoreChannelEnum
.
TIANMAO
.
getChannel
()
==
Integer
.
valueOf
(
baseSalesDTO
.
getAreaId
())){
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
(
baseSalesDTO
->
{
baseSalesDTO
.
setLevel
(
level
-
1
);
for
(
ShopDTO
shopDTO
:
result
){
if
(
baseSalesDTO
.
getId
().
equals
(
shopDTO
.
getId
())){
baseSalesDTO
.
setAreaName
(
shopDTO
.
getName
());
baseSalesDTO
.
setChannel
(
StoreChannelEnum
.
OFFLINE
.
getChannel
());
}
}
});
}
}
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
.
setAreaName
(
dto
.
getWmMainAccount
());
baseSalesDTO
.
setChannel
(
StoreChannelEnum
.
OFFLINE
.
getChannel
());
}
}
});
}
}
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
;
}
@RequestMapping
(
"get-grade-consume-trend"
)
...
...
gic-data-cloud-wxapp/src/main/java/com/gic/cloud/web/controller/StoreSearchUtils.java
View file @
feba4b27
...
...
@@ -158,6 +158,9 @@ public class StoreSearchUtils {
int
start
=
0
;
if
(!
levelMap
.
isEmpty
()){
while
(
true
){
if
(
start
>=
levelMap
.
size
()){
break
;
}
if
(
levelMap
.
get
(
start
)
!=
null
&&
levelMap
.
get
(
start
).
intValue
()
>
1
){
vo
.
setLevel
(
start
);
break
;
...
...
gic-data-cloud-wxapp/src/main/java/com/gic/cloud/web/vo/BaseSalesVo.java
View file @
feba4b27
package
com
.
gic
.
cloud
.
web
.
vo
;
import
com.gic.api.base.commons.Page
;
import
com.gic.data.api.dto.BaseSalesDTO
;
public
class
BaseSalesVo
{
private
Page
<
BaseSalesDTO
>
page
;
private
BaseSalesDTO
total
;
private
BaseSalesDTO
wgs
;
public
class
BaseSalesVo
<
T
>
{
private
Page
<
T
>
page
;
private
T
total
;
private
T
wgs
;
private
String
levelName
;
private
Integer
changeLevel
=
0
;
public
Page
<
BaseSalesDTO
>
getPage
()
{
public
Page
<
T
>
getPage
()
{
return
page
;
}
public
void
setPage
(
Page
<
BaseSalesDTO
>
page
)
{
public
void
setPage
(
Page
<
T
>
page
)
{
this
.
page
=
page
;
}
public
BaseSalesDTO
getTotal
()
{
public
T
getTotal
()
{
return
total
;
}
public
void
setTotal
(
BaseSalesDTO
total
)
{
public
void
setTotal
(
T
total
)
{
this
.
total
=
total
;
}
public
BaseSalesDTO
getWgs
()
{
public
T
getWgs
()
{
return
wgs
;
}
public
void
setWgs
(
BaseSalesDTO
wgs
)
{
public
void
setWgs
(
T
wgs
)
{
this
.
wgs
=
wgs
;
}
...
...
gic-data-cloud-wxapp/src/main/java/com/gic/cloud/web/vo/T.java
0 → 100644
View file @
feba4b27
package
com
.
gic
.
cloud
.
web
.
vo
;
public
class
T
extends
Object
{
}
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