Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
80b39cf3
Commit
80b39cf3
authored
Apr 08, 2023
by
songyinghui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 数据接口
parent
16d27e12
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
19 deletions
+65
-19
MaterialDataStaticsController.java
...web/controller/content/MaterialDataStaticsController.java
+42
-12
MaterialDataAdaptor.java
...e/web/controller/content/adaptor/MaterialDataAdaptor.java
+12
-7
MaterialAreaUsedDataVO.java
...age/web/vo/content/statistics/MaterialAreaUsedDataVO.java
+11
-0
No files found.
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/content/MaterialDataStaticsController.java
View file @
80b39cf3
...
...
@@ -10,6 +10,8 @@ import com.gic.commons.webapi.reponse.RestResponse;
import
com.gic.content.api.dto.material.ContentMaterialFrontDTO
;
import
com.gic.content.api.qdto.material.ContentMaterialPageFrontQDTO
;
import
com.gic.content.api.service.ContentMaterialApiService
;
import
com.gic.enterprise.api.dto.StoreDTO
;
import
com.gic.enterprise.api.service.StoreService
;
import
com.gic.haoban.manage.web.controller.content.adaptor.ClerkStoreAdaptor
;
import
com.gic.haoban.manage.web.controller.content.adaptor.MaterialDataAdaptor
;
import
com.gic.haoban.manage.web.qo.content.ContentMaterialBaseQO
;
...
...
@@ -34,9 +36,14 @@ import org.springframework.web.bind.annotation.RestController;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.Set
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
* 素材-好办数据统计
...
...
@@ -53,6 +60,8 @@ public class MaterialDataStaticsController {
private
ContentMaterialApiService
contentMaterialApiService
;
@Autowired
private
ClerkService
clerkService
;
@Autowired
private
StoreService
storeService
;
/**
* 获取素材首页数据
...
...
@@ -265,8 +274,8 @@ public class MaterialDataStaticsController {
}
else
{
storeIds
.
add
(
materialReportQO
.
getStoreId
());
}
Material
StoreUsedDataVO
materialStore
UsedDataVO
=
materialDataAdaptor
.
queryMaterialAreaOverviewData
(
materialReportQO
.
getEnterpriseId
(),
materialReportQO
.
getClerkId
(),
materialReportQO
.
getReportType
(),
storeIds
);
return
RestResponse
.
successResult
();
Material
AreaUsedDataVO
materialArea
UsedDataVO
=
materialDataAdaptor
.
queryMaterialAreaOverviewData
(
materialReportQO
.
getEnterpriseId
(),
materialReportQO
.
getClerkId
(),
materialReportQO
.
getReportType
(),
storeIds
);
return
RestResponse
.
successResult
(
materialAreaUsedDataVO
);
}
...
...
@@ -292,14 +301,25 @@ public class MaterialDataStaticsController {
return
RestResponse
.
successResult
();
}
// 补充导购信息
ClerkDTO
clerkInfo
=
clerkService
.
getClerkByClerkId
(
materialReportQO
.
getClerkId
());
if
(
clerkInfo
!=
null
)
{
for
(
MaterialPersonalUsedDataVO
materialPersonalUsedDataVO
:
usedDataVOPage
.
getResult
())
{
Set
<
String
>
clerkIds
=
usedDataVOPage
.
getResult
()
.
stream
()
.
map
(
MaterialPersonalUsedDataVO:
:
getClerkId
)
.
collect
(
Collectors
.
toSet
());
List
<
ClerkDTO
>
clerkInfos
=
clerkService
.
getClerkByClerkIds
(
clerkIds
);
Map
<
String
,
ClerkDTO
>
clerkInfoMap
=
Collections
.
emptyMap
();
if
(
CollectionUtils
.
isNotEmpty
(
clerkInfos
))
{
clerkInfoMap
=
clerkInfos
.
stream
()
.
collect
(
Collectors
.
toMap
(
ClerkDTO:
:
getClerkId
,
Function
.
identity
(),
(
v1
,
v2
)
->
v1
));
}
for
(
MaterialPersonalUsedDataVO
materialPersonalUsedDataVO
:
usedDataVOPage
.
getResult
())
{
ClerkDTO
clerkInfo
=
clerkInfoMap
.
get
(
materialPersonalUsedDataVO
.
getClerkId
());
if
(
clerkInfo
!=
null
)
{
materialPersonalUsedDataVO
.
setClerkId
(
materialReportQO
.
getClerkId
());
materialPersonalUsedDataVO
.
setClerkName
(
clerkInfo
.
getClerkName
());
materialPersonalUsedDataVO
.
setImageUrl
(
clerkInfo
.
getImageUrl
());
}
}
return
RestResponse
.
successResult
(
usedDataVOPage
);
}
...
...
@@ -325,13 +345,23 @@ public class MaterialDataStaticsController {
if
(
usedDataVOPage
==
null
||
CollectionUtils
.
isEmpty
(
usedDataVOPage
.
getResult
()))
{
return
RestResponse
.
successResult
();
}
// 补充导购信息
ClerkDTO
clerkInfo
=
clerkService
.
getClerkByClerkId
(
materialReportQO
.
getClerkId
());
if
(
clerkInfo
!=
null
)
{
for
(
MaterialStoreUsedDataVO
materialStoreUsedDataVO
:
usedDataVOPage
.
getResult
())
{
materialStoreUsedDataVO
.
setClerkId
(
materialReportQO
.
getClerkId
());
materialStoreUsedDataVO
.
setClerkName
(
clerkInfo
.
getClerkName
());
materialStoreUsedDataVO
.
setImageUrl
(
clerkInfo
.
getImageUrl
());
// 补充门店信息
List
<
String
>
tempStoreIds
=
usedDataVOPage
.
getResult
()
.
stream
()
.
map
(
MaterialStoreUsedDataVO:
:
getStoreId
)
.
collect
(
Collectors
.
toList
());
List
<
StoreDTO
>
storeDTOS
=
storeService
.
queryStore
(
tempStoreIds
);
Map
<
String
,
StoreDTO
>
storeInfoMap
=
Collections
.
emptyMap
();
if
(
CollectionUtils
.
isNotEmpty
(
storeDTOS
))
{
storeInfoMap
=
storeDTOS
.
stream
()
.
collect
(
Collectors
.
toMap
(
StoreDTO:
:
getStoreId
,
Function
.
identity
(),
(
v1
,
v2
)
->
v1
));
}
for
(
MaterialStoreUsedDataVO
materialStoreUsedDataVO
:
usedDataVOPage
.
getResult
())
{
StoreDTO
storeDTO
=
storeInfoMap
.
get
(
materialStoreUsedDataVO
.
getStoreId
());
if
(
storeDTO
!=
null
)
{
materialStoreUsedDataVO
.
setStoreCode
(
storeDTO
.
getStoreCode
());
materialStoreUsedDataVO
.
setStoreName
(
storeDTO
.
getStoreName
());
}
}
return
RestResponse
.
successResult
(
usedDataVOPage
);
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/content/adaptor/MaterialDataAdaptor.java
View file @
80b39cf3
...
...
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSON;
import
com.gic.api.base.commons.Page
;
import
com.gic.haoban.manage.api.enums.content.MaterialReportType
;
import
com.gic.haoban.manage.web.utils.target.DataTargetHttpUtils
;
import
com.gic.haoban.manage.web.vo.content.statistics.MaterialAreaUsedDataVO
;
import
com.gic.haoban.manage.web.vo.content.statistics.MaterialClerkUsedDataVO
;
import
com.gic.haoban.manage.web.vo.content.statistics.MaterialDataOverviewVO
;
import
com.gic.haoban.manage.web.vo.content.statistics.MaterialStoreUsedDataVO
;
...
...
@@ -352,8 +353,8 @@ public class MaterialDataAdaptor {
*
* @return
*/
public
Material
Store
UsedDataVO
queryMaterialAreaOverviewData
(
String
enterpriseId
,
String
clerkId
,
Integer
reportType
,
List
<
String
>
storeIds
)
{
public
Material
Area
UsedDataVO
queryMaterialAreaOverviewData
(
String
enterpriseId
,
String
clerkId
,
Integer
reportType
,
List
<
String
>
storeIds
)
{
// 获取当前时间周期
DateTime
startTime
=
null
;
...
...
@@ -384,12 +385,16 @@ public class MaterialDataAdaptor {
}
Map
<
String
,
Object
>
result
=
this
.
doHttp
(
JSON
.
toJSONString
(
params
),
apolloKey
);
if
(
result
.
get
(
"data"
)
==
null
)
{
return
new
Material
Store
UsedDataVO
();
return
new
Material
Area
UsedDataVO
();
}
MaterialStoreUsedDataVO
materialStoreUsedDataVO
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
result
),
MaterialStoreUsedDataVO
.
class
);
materialStoreUsedDataVO
.
setStartTime
(
startTime
);
materialStoreUsedDataVO
.
setEndTime
(
endTime
);
return
materialStoreUsedDataVO
;
List
<
MaterialAreaUsedDataVO
>
areaUsedDataVOS
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
result
.
get
(
"data"
)),
MaterialAreaUsedDataVO
.
class
);
if
(
CollectionUtils
.
isEmpty
(
areaUsedDataVOS
))
{
return
new
MaterialAreaUsedDataVO
();
}
MaterialAreaUsedDataVO
materialAreaUsedDataVO
=
areaUsedDataVOS
.
get
(
0
);
materialAreaUsedDataVO
.
setStartTime
(
startTime
);
materialAreaUsedDataVO
.
setEndTime
(
endTime
);
return
materialAreaUsedDataVO
;
}
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/vo/content/statistics/MaterialAreaUsedDataVO.java
View file @
80b39cf3
...
...
@@ -4,6 +4,7 @@ import lombok.Data;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* @Author MUSI
...
...
@@ -85,4 +86,14 @@ public class MaterialAreaUsedDataVO implements Serializable {
* 门店名称
*/
private
String
storeName
;
/**
* 开始时间
*/
private
Date
startTime
;
/**
* 结束时间
*/
private
Date
endTime
;
}
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