Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
9de94ac9
Commit
9de94ac9
authored
May 17, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据看板
parent
57df15ba
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
13 deletions
+46
-13
ch-admin-api/src/main/java/com/wwdz/ch/admin/config/ShiroConfig.java
...i/src/main/java/com/wwdz/ch/admin/config/ShiroConfig.java
+1
-0
ch-admin-api/src/main/java/com/wwdz/ch/admin/controller/AdminDashbordController.java
...com/wwdz/ch/admin/controller/AdminDashbordController.java
+3
-0
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/AdminDashbordServiceImpl.java
...java/com/wwdz/ch/admin/impl/AdminDashbordServiceImpl.java
+42
-13
No files found.
ch-admin-api/src/main/java/com/wwdz/ch/admin/config/ShiroConfig.java
View file @
9de94ac9
...
@@ -124,6 +124,7 @@ public class ShiroConfig {
...
@@ -124,6 +124,7 @@ public class ShiroConfig {
filterChainDefinitionMap
.
put
(
"/admin/sysDistributionOrder/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/admin/sysDistributionOrder/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/admin/imageCatelog/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/admin/imageCatelog/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/admin/identifyOrder/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/admin/identifyOrder/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/admin/dashboard/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/admin/invitationCode/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/admin/invitationCode/**"
,
"anon"
);
...
...
ch-admin-api/src/main/java/com/wwdz/ch/admin/controller/AdminDashbordController.java
View file @
9de94ac9
...
@@ -145,6 +145,9 @@ public class AdminDashbordController {
...
@@ -145,6 +145,9 @@ public class AdminDashbordController {
@PostMapping
(
"/dataPanel"
)
@PostMapping
(
"/dataPanel"
)
public
Result
dataPanel
(
@RequestBody
DataPanelRequestDto
dto
)
{
public
Result
dataPanel
(
@RequestBody
DataPanelRequestDto
dto
)
{
if
(
dto
.
getType
()
==
null
)
{
return
Result
.
failed
(
"时间范围为空"
);
}
return
adminDashbordService
.
dataPanel
(
dto
);
return
adminDashbordService
.
dataPanel
(
dto
);
}
}
...
...
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/AdminDashbordServiceImpl.java
View file @
9de94ac9
...
@@ -6,8 +6,11 @@ import com.wwdz.ch.admin.entity.request.DataPanelRequestDto;
...
@@ -6,8 +6,11 @@ import com.wwdz.ch.admin.entity.request.DataPanelRequestDto;
import
com.wwdz.ch.admin.entity.vo.DataPanelVo
;
import
com.wwdz.ch.admin.entity.vo.DataPanelVo
;
import
com.wwdz.ch.admin.service.AdminDashbordService
;
import
com.wwdz.ch.admin.service.AdminDashbordService
;
import
com.wwdz.ch.core.api.WxAppletApi
;
import
com.wwdz.ch.core.api.WxAppletApi
;
import
com.wwdz.ch.core.consts.DashbordEnum
;
import
com.wwdz.ch.core.consts.DistributionEnum
;
import
com.wwdz.ch.core.consts.DistributionEnum
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.PriceUtil
;
import
com.wwdz.ch.core.util.TimeUtil
;
import
com.wwdz.ch.db.bean.OrderDataStat
;
import
com.wwdz.ch.db.bean.OrderDataStat
;
import
com.wwdz.ch.db.dao.ItemDao
;
import
com.wwdz.ch.db.dao.ItemDao
;
import
com.wwdz.ch.db.dao.distribution.DistributionOrderDao
;
import
com.wwdz.ch.db.dao.distribution.DistributionOrderDao
;
...
@@ -20,6 +23,7 @@ import com.wwdz.ch.db.dto.request.distribution.DistributorProfitRequestDto;
...
@@ -20,6 +23,7 @@ import com.wwdz.ch.db.dto.request.distribution.DistributorProfitRequestDto;
import
com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto
;
import
com.xxdxxs.utils.DateUtils
;
import
com.xxdxxs.utils.DateUtils
;
import
io.swagger.models.auth.In
;
import
io.swagger.models.auth.In
;
import
javafx.util.Pair
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -72,12 +76,21 @@ public class AdminDashbordServiceImpl implements AdminDashbordService {
...
@@ -72,12 +76,21 @@ public class AdminDashbordServiceImpl implements AdminDashbordService {
@Override
@Override
public
Result
dataPanel
(
DataPanelRequestDto
dto
)
{
public
Result
dataPanel
(
DataPanelRequestDto
dto
)
{
try
{
try
{
LocalDate
localDate
=
LocalDate
.
parse
(
dto
.
getStartTime
());
Pair
<
String
,
String
>
pair
=
TimeUtil
.
getAccessDate
(
dto
.
getType
());
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyyMMdd"
);
String
startTimeStr
=
pair
.
getKey
();
String
formattedDate
=
localDate
.
format
(
formatter
);
String
endTimeStr
=
pair
.
getValue
();
logger
.
info
(
"数据面板查询的时间范围 : {} - {}"
,
startTimeStr
,
endTimeStr
);
DataPanelVo
dataPanelVo
=
new
DataPanelVo
();
DataPanelVo
dataPanelVo
=
new
DataPanelVo
();
//查询小程序访问数据
//查询小程序访问数据
Result
result
=
wxAppletApi
.
getAccessData
(
formattedDate
,
formattedDate
,
null
);
String
key
;
if
(
dto
.
getType
()
==
DashbordEnum
.
TypeEnum
.
YESTERDAY
.
getCode
())
{
key
=
"day"
;
}
else
if
(
dto
.
getType
()
==
DashbordEnum
.
TypeEnum
.
CURRENT_WEEK
.
getCode
()
||
dto
.
getType
()
==
DashbordEnum
.
TypeEnum
.
LAST_WEEK
.
getCode
())
{
key
=
"week"
;
}
else
{
key
=
"month"
;
}
Result
result
=
wxAppletApi
.
getAccessData
(
pair
.
getKey
(),
pair
.
getKey
(),
key
);
if
(
result
.
getSuccess
())
{
if
(
result
.
getSuccess
())
{
Map
<
String
,
Integer
>
map
=
(
Map
<
String
,
Integer
>)
result
.
getData
();
Map
<
String
,
Integer
>
map
=
(
Map
<
String
,
Integer
>)
result
.
getData
();
dataPanelVo
.
setVisitNum
(
map
.
get
(
"visitUv"
));
dataPanelVo
.
setVisitNum
(
map
.
get
(
"visitUv"
));
...
@@ -86,8 +99,9 @@ public class AdminDashbordServiceImpl implements AdminDashbordService {
...
@@ -86,8 +99,9 @@ public class AdminDashbordServiceImpl implements AdminDashbordService {
}
}
//查询新增藏品数量
//查询新增藏品数量
SupplierItemRequestDto
supplierItemRequestDto
=
new
SupplierItemRequestDto
();
SupplierItemRequestDto
supplierItemRequestDto
=
new
SupplierItemRequestDto
();
Date
startTime
=
DateUtils
.
parseString
(
dto
.
getStartTime
());
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
Date
endTime
=
DateUtil
.
endOfDay
(
startTime
);
Date
startTime
=
DateUtil
.
beginOfDay
(
format
.
parse
(
startTimeStr
));
Date
endTime
=
DateUtil
.
endOfDay
(
format
.
parse
(
endTimeStr
));
supplierItemRequestDto
.
setStartCreateTime
(
startTime
);
supplierItemRequestDto
.
setStartCreateTime
(
startTime
);
supplierItemRequestDto
.
setEndCreateTime
(
endTime
);
supplierItemRequestDto
.
setEndCreateTime
(
endTime
);
long
count
=
supplierItemDao
.
countNewItem
(
supplierItemRequestDto
);
long
count
=
supplierItemDao
.
countNewItem
(
supplierItemRequestDto
);
...
@@ -98,6 +112,12 @@ public class AdminDashbordServiceImpl implements AdminDashbordService {
...
@@ -98,6 +112,12 @@ public class AdminDashbordServiceImpl implements AdminDashbordService {
collectOrderDto
.
setStartCreateTime
(
startTime
);
collectOrderDto
.
setStartCreateTime
(
startTime
);
collectOrderDto
.
setEndCreateTime
(
endTime
);
collectOrderDto
.
setEndCreateTime
(
endTime
);
OrderDataStat
collectOrderDataStat
=
distributorProfitDao
.
countOrderData
(
collectOrderDto
);
OrderDataStat
collectOrderDataStat
=
distributorProfitDao
.
countOrderData
(
collectOrderDto
);
Map
<
String
,
Object
>
collectOrderData
=
new
HashMap
<>();
collectOrderData
.
put
(
"totalAmount"
,
PriceUtil
.
convertPriceFenToYuan
(
collectOrderDataStat
.
getTotalAmount
()));
collectOrderData
.
put
(
"totalOrderNum"
,
collectOrderDataStat
.
getTotalOrderNum
());
double
channelTotalProfit
=
collectOrderDataStat
.
getTotalAmount
().
doubleValue
()
*
0.05
;
collectOrderData
.
put
(
"totalProfit"
,
PriceUtil
.
convertPriceFromStr
(
PriceUtil
.
convertDoubleToString
(
channelTotalProfit
)));
dataPanelVo
.
setCollectOrderData
(
collectOrderData
);
//统计分销订单数据
//统计分销订单数据
DistributorProfitRequestDto
distirbutionOrderDto
=
new
DistributorProfitRequestDto
();
DistributorProfitRequestDto
distirbutionOrderDto
=
new
DistributorProfitRequestDto
();
...
@@ -105,6 +125,15 @@ public class AdminDashbordServiceImpl implements AdminDashbordService {
...
@@ -105,6 +125,15 @@ public class AdminDashbordServiceImpl implements AdminDashbordService {
distirbutionOrderDto
.
setStartCreateTime
(
startTime
);
distirbutionOrderDto
.
setStartCreateTime
(
startTime
);
distirbutionOrderDto
.
setEndCreateTime
(
endTime
);
distirbutionOrderDto
.
setEndCreateTime
(
endTime
);
OrderDataStat
distirbutionOrderDataStat
=
distributorProfitDao
.
countOrderData
(
distirbutionOrderDto
);
OrderDataStat
distirbutionOrderDataStat
=
distributorProfitDao
.
countOrderData
(
distirbutionOrderDto
);
Map
<
String
,
Object
>
distributionOrderData
=
new
HashMap
<>();
collectOrderData
.
put
(
"totalAmount"
,
PriceUtil
.
convertPriceFenToYuan
(
distirbutionOrderDataStat
.
getTotalAmount
()));
collectOrderData
.
put
(
"totalOrderNum"
,
distirbutionOrderDataStat
.
getTotalOrderNum
());
double
distributorProfit
=
distirbutionOrderDataStat
.
getTotalAmount
().
doubleValue
()
*
0.03
;
double
channelDistributionProfit
=
distirbutionOrderDataStat
.
getTotalAmount
().
doubleValue
()
-
distributorProfit
;
collectOrderData
.
put
(
"totalProfit"
,
PriceUtil
.
convertPriceFromStr
(
PriceUtil
.
convertDoubleToString
(
channelDistributionProfit
)));
dataPanelVo
.
setDistributionOrderData
(
distributionOrderData
);
return
Result
.
success
(
dataPanelVo
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询数据看板 error:{}"
,
e
);
logger
.
error
(
"查询数据看板 error:{}"
,
e
);
}
}
...
@@ -112,12 +141,12 @@ public class AdminDashbordServiceImpl implements AdminDashbordService {
...
@@ -112,12 +141,12 @@ public class AdminDashbordServiceImpl implements AdminDashbordService {
}
}
public
static
void
main
(
String
[]
args
)
throws
ParseException
{
public
static
void
main
(
String
[]
args
)
throws
ParseException
{
Date
date
=
DateUtils
.
parseString
(
"2024-05-07
"
);
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyyMMdd
"
);
S
ystem
.
out
.
println
(
date
)
;
S
tring
startTimeStr
=
"20240507"
;
S
ystem
.
out
.
println
(
DateUtil
.
endOfDay
(
date
))
;
S
tring
endTimeStr
=
"20240507"
;
LocalDate
localDate
=
LocalDate
.
parse
(
"2024-05-07"
);
Date
startTime
=
DateUtil
.
beginOfDay
(
format
.
parse
(
startTimeStr
)
);
Date
TimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyyMMdd"
);
Date
endTime
=
DateUtil
.
endOfDay
(
format
.
parse
(
endTimeStr
)
);
S
tring
formattedDate
=
localDate
.
format
(
formatter
);
S
ystem
.
out
.
println
(
startTime
);
System
.
out
.
println
(
formattedDat
e
);
System
.
out
.
println
(
endTim
e
);
}
}
}
}
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