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
15e30bbe
Commit
15e30bbe
authored
Aug 03, 2020
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
观云台小程序
parent
25c552de
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
2 deletions
+80
-2
BaseSalesController.java
...ava/com/gic/cloud/web/controller/BaseSalesController.java
+80
-2
No files found.
gic-data-cloud-wxapp/src/main/java/com/gic/cloud/web/controller/BaseSalesController.java
View file @
15e30bbe
...
...
@@ -3,12 +3,21 @@ package com.gic.cloud.web.controller;
import
com.alibaba.fastjson.JSON
;
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.qo.DateTypeQo
;
import
com.gic.cloud.web.vo.BaseSalesVo
;
import
com.gic.cloud.web.vo.LevelVo
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.data.api.dto.BaseSalesDTO
;
import
com.gic.data.api.dto.BaseSalesParamsDTO
;
import
com.gic.data.api.service.BaseSalesApiService
;
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
com.google.inject.internal.asm.
$Handle
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -20,9 +29,15 @@ import java.util.List;
@RestController
public
class
BaseSalesController
{
@Autowired
private
DataAuthUtils
dataAuthUtils
;
@Autowired
private
StoreSearchUtils
storeSearchUtils
;
@Autowired
private
BaseSalesApiService
baseSalesApiService
;
@Autowired
private
ShopApiService
shopApiService
;
@Autowired
private
WmStoreApiService
wmStoreApiService
;
@RequestMapping
(
"base-sales"
)
public
RestResponse
baseSales
(
Integer
channel
,
Integer
userId
,
Integer
enterpriseId
,
String
searchJSON
,
...
...
@@ -31,6 +46,7 @@ public class BaseSalesController {
List
<
Integer
>
list
=
this
.
storeSearchUtils
.
storeSearch
(
userId
,
enterpriseId
,
searchJSON
);
List
<
String
>
onLine
=
this
.
storeSearchUtils
.
onLineStoreSearch
(
userId
,
enterpriseId
,
searchJSON
);
List
<
Integer
>
childrenStoreGroupIdList
=
this
.
storeSearchUtils
.
getChildrenStoreGroupIdList
(
parentId
);
List
<
Long
>
mbrAreaIdList
=
this
.
dataAuthUtils
.
getMbrAreaId
(
userId
,
enterpriseId
);
BaseSalesParamsDTO
dto
=
new
BaseSalesParamsDTO
();
dto
.
setChannel
(
channel
);
dto
.
setEnterpriseId
(
enterpriseId
);
...
...
@@ -44,20 +60,82 @@ public class BaseSalesController {
dto
.
setPageNum
(
pageNum
);
dto
.
setPageSize
(
pageSize
);
ServiceResponse
<
Page
<
BaseSalesDTO
>>
response
=
this
.
baseSalesApiService
.
pageBaseSales
(
dto
);
if
(
level
==
null
){
level
=
this
.
storeSearchUtils
.
getLevel
(
userId
,
enterpriseId
,
searchJSON
).
getLevel
();
}
BaseSalesVo
vo
=
new
BaseSalesVo
();
this
.
parseData
(
response
.
getResult
(),
StoreChannelEnum
.
OFFLINE
.
getChannel
(),
enterpriseId
,
level
);
vo
.
setPage
(
response
.
getResult
());
dto
.
setCountType
(
2
);
//合计
ServiceResponse
<
Page
<
BaseSalesDTO
>>
response1
=
this
.
baseSalesApiService
.
pageBaseSales
(
dto
);
if
(
response1
.
isSuccess
()
&&
response1
.
getResult
()
!=
null
&&
CollectionUtils
.
isNotEmpty
(
response1
.
getResult
().
getResult
())){
vo
.
setTotal
(
response1
.
getResult
().
getResult
().
get
(
0
));
BaseSalesDTO
total
=
response1
.
getResult
().
getResult
().
get
(
0
);
total
.
setId
(
"0"
);
total
.
setName
(
"合计"
);
vo
.
setTotal
(
total
);
}
if
(
channel
==
1
&&
parentId
==
null
){
dto
.
setCountType
(
3
);
//无归属
ServiceResponse
<
Page
<
BaseSalesDTO
>>
response2
=
this
.
baseSalesApiService
.
pageBaseSales
(
dto
);
if
(
response2
.
isSuccess
()
&&
response2
.
getResult
()
!=
null
&&
CollectionUtils
.
isNotEmpty
(
response2
.
getResult
().
getResult
())){
vo
.
setWgs
(
response2
.
getResult
().
getResult
().
get
(
0
));
BaseSalesDTO
wgs
=
response2
.
getResult
().
getResult
().
get
(
0
);
if
(
wgs
!=
null
){
wgs
.
setName
(
"无归属"
);
wgs
.
setId
(
"-1"
);
vo
.
setWgs
(
wgs
);
}
}
}
return
RestResponse
.
success
(
vo
);
}
public
void
parseData
(
Page
<
BaseSalesDTO
>
page
,
Integer
channel
,
Integer
enterpriseId
,
Integer
level
){
if
(
page
!=
null
&&
CollectionUtils
.
isNotEmpty
(
page
.
getResult
())){
if
(
channel
==
null
){
//全渠道
page
.
getResult
().
stream
().
forEach
(
baseSalesDTO
->
{
if
(
StoreChannelEnum
.
OFFLINE
.
getChannel
()
==
Integer
.
valueOf
(
baseSalesDTO
.
getId
())){
baseSalesDTO
.
setName
(
StoreChannelEnum
.
OFFLINE
.
getMessage
());
}
if
(
StoreChannelEnum
.
GICMALL
.
getChannel
()
==
Integer
.
valueOf
(
baseSalesDTO
.
getId
())){
baseSalesDTO
.
setName
(
StoreChannelEnum
.
GICMALL
.
getMessage
());
}
if
(
StoreChannelEnum
.
WMMALL
.
getChannel
()
==
Integer
.
valueOf
(
baseSalesDTO
.
getId
())){
baseSalesDTO
.
setName
(
StoreChannelEnum
.
WMMALL
.
getMessage
());
}
if
(
StoreChannelEnum
.
TIANMAO
.
getChannel
()
==
Integer
.
valueOf
(
baseSalesDTO
.
getId
())){
baseSalesDTO
.
setName
(
StoreChannelEnum
.
TIANMAO
.
getMessage
());
}
});
}
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
->
{
for
(
ShopDTO
shopDTO
:
result
){
if
(
baseSalesDTO
.
getId
().
equals
(
shopDTO
.
getId
())){
baseSalesDTO
.
setName
(
shopDTO
.
getName
());
}
}
});
}
}
if
(
channel
==
StoreChannelEnum
.
WMMALL
.
getChannel
()){
List
<
WmStoreDTO
>
result1
=
wmStoreApiService
.
listWmStore
(
enterpriseId
,
null
).
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
result1
)){
page
.
getResult
().
stream
().
forEach
(
baseSalesDTO
->
{
for
(
WmStoreDTO
dto
:
result1
){
if
(
baseSalesDTO
.
getId
().
equals
(
dto
.
getWmMallStoreId
()+
""
)){
baseSalesDTO
.
setName
(
dto
.
getWmMainAccount
());
}
}
});
}
}
if
(
channel
==
StoreChannelEnum
.
OFFLINE
.
getChannel
()){
page
.
getResult
().
stream
().
forEach
(
baseSalesDTO
->
{
baseSalesDTO
.
setLevel
(
level
);
});
}
}
}
}
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