Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
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
黄奎
mall.oytour.com
Commits
27e6dbe3
Commit
27e6dbe3
authored
Aug 14, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统计修改
parent
482452b2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
15 deletions
+20
-15
MallIndexStatistics.cs
Mall.Model/Extend/Statistics/MallIndexStatistics.cs
+5
-0
MiniProgramModule.cs
Mall.Module.User/MiniProgramModule.cs
+11
-11
MallStatisticsRepository.cs
Mall.Repository/User/MallStatisticsRepository.cs
+4
-4
No files found.
Mall.Model/Extend/Statistics/MallIndexStatistics.cs
View file @
27e6dbe3
...
...
@@ -92,6 +92,11 @@ namespace Mall.Model.Extend.Statistics
/// 购买商品件数
/// </summary>
public
int
GoodCount
{
get
;
set
;
}
/// <summary>
/// 用户编号
/// </summary>
public
int
UserId
{
get
;
set
;
}
}
/// <summary>
...
...
Mall.Module.User/MiniProgramModule.cs
View file @
27e6dbe3
...
...
@@ -2012,14 +2012,14 @@ namespace Mall.Module.User
{
for
(
var
i
=
0
;
i
<=
23
;
i
++)
{
var
subModel
=
list
?.
Where
(
qitem
=>
qitem
.
TimeStr
==
i
.
ToString
())?.
FirstOrDefaul
t
();
var
tempSubList
=
list
?.
Where
(
qitem
=>
qitem
.
TimeStr
==
i
.
ToString
())?.
ToLis
t
();
subList
.
Add
(
new
MallSalesStatistics
()
{
TimeStr
=
i
.
ToString
(),
GoodCount
=
subModel
?.
GoodCount
??
0
,
Income
=
subModel
?.
Income
??
0
,
OrderCount
=
subModel
?.
OrderCount
??
0
,
UserCount
=
subModel
?.
UserCount
??
0
,
GoodCount
=
tempSubList
?.
Sum
(
qitem
=>
qitem
.
GoodCount
)
??
0
,
Income
=
tempSubList
?.
Sum
(
qitem
=>
qitem
.
Income
)
??
0
,
OrderCount
=
tempSubList
?.
Sum
(
qitem
=>
qitem
.
OrderCount
)
??
0
,
UserCount
=
tempSubList
?.
GroupBy
(
qitem
=>
new
{
qitem
.
UserId
}).
Count
()
??
0
,
});
}
}
...
...
@@ -2028,14 +2028,14 @@ namespace Mall.Module.User
var
startDate
=
DateTime
.
Now
.
AddDays
(-
7
);
for
(
var
i
=
0
;
i
<=
7
;
i
++)
{
var
subModel
=
list
?.
Where
(
qitem
=>
qitem
.
TimeStr
==
startDate
.
AddDays
(
i
).
ToString
(
"yyyy-MM-dd"
))?.
FirstOrDefaul
t
();
var
tempSubList
=
list
?.
Where
(
qitem
=>
qitem
.
TimeStr
==
startDate
.
AddDays
(
i
).
ToString
(
"yyyy-MM-dd"
))?.
ToLis
t
();
subList
.
Add
(
new
MallSalesStatistics
()
{
TimeStr
=
startDate
.
AddDays
(
i
).
ToString
(
"yyyy-MM-dd"
),
GoodCount
=
subModel
?.
GoodCount
??
0
,
Income
=
subModel
?.
Income
??
0
,
OrderCount
=
subModel
?.
OrderCount
??
0
,
UserCount
=
subModel
?.
UserCount
??
0
,
GoodCount
=
tempSubList
?.
Sum
(
qitem
=>
qitem
.
GoodCount
)
??
0
,
Income
=
tempSubList
?.
Sum
(
qitem
=>
qitem
.
Income
)
??
0
,
OrderCount
=
tempSubList
?.
Sum
(
qitem
=>
qitem
.
OrderCount
)
??
0
,
UserCount
=
tempSubList
?.
GroupBy
(
qitem
=>
new
{
qitem
.
UserId
}).
Count
()
??
0
,
});
}
}
...
...
@@ -2047,7 +2047,7 @@ namespace Mall.Module.User
Income
=
list
?.
Sum
(
qitem
=>
qitem
.
Income
)
??
0
,
//支付人数
UserCount
=
list
?.
Sum
(
qitem
=>
qitem
.
UserCount
)
??
0
,
UserCount
=
list
?.
GroupBy
(
qitem
=>
new
{
qitem
.
UserId
}).
Count
(
)
??
0
,
//支付件数
GoodCount
=
list
?.
Sum
(
qitem
=>
qitem
.
GoodCount
)
??
0
,
subList
,
...
...
Mall.Repository/User/MallStatisticsRepository.cs
View file @
27e6dbe3
...
...
@@ -173,17 +173,17 @@ WHERE 1=1 AND A.ReOrderStatus IN(2,3,4) ");
if
(
query
.
SalesTimeType
==
1
||
query
.
SalesTimeType
==
0
)
{
selectFileds
=
" SUBSTR(DATE_FORMAT(CreateDate,'%Y%m%d%H'),9,2) AS TimeStr, "
;
groupFileds
=
" GROUP BY DATE_FORMAT(CreateDate,'%Y%m%d%H') "
;
groupFileds
=
" GROUP BY DATE_FORMAT(CreateDate,'%Y%m%d%H')
,A.UserId
"
;
}
else
{
selectFileds
=
" DATE_FORMAT(CreateDate,'%Y-%m-%d') AS TimeStr, "
;
groupFileds
=
" GROUP BY DATE_FORMAT(CreateDate,'%Y%m%d') "
;
groupFileds
=
" GROUP BY DATE_FORMAT(CreateDate,'%Y%m%d')
,A.UserId
"
;
}
builder
.
AppendFormat
(
@"
SELECT {0} COUNT(1) AS OrderCount,SUM(A.Income) AS Income,
COUNT(DISTINCT A.UserId) AS UserCount
,SUM(B.GoodCount) AS GoodCount
FROM
rb_goods_order A LEFT JOIN (SELECT OrderId,COUNT(1
) AS GoodCount FROM rb_goods_orderdetail GROUP BY OrderId) AS B ON A.OrderId=B.OrderId
SELECT {0} COUNT(1) AS OrderCount,SUM(A.Income) AS Income,
A.UserId
,SUM(B.GoodCount) AS GoodCount
FROM
rb_goods_order A LEFT JOIN (SELECT OrderId,SUM(Number
) AS GoodCount FROM rb_goods_orderdetail GROUP BY OrderId) AS B ON A.OrderId=B.OrderId
WHERE 1=1 AND OrderStatus>=2 AND OrderStatus<=5
"
,
selectFileds
);
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Goods_Order_Extend
.
TenantId
),
query
.
TenantId
);
...
...
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