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
b416ba21
Commit
b416ba21
authored
Jun 11, 2021
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
465c1aa3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
65 deletions
+77
-65
StatisticsModule.cs
Mall.Module.MarketingCenter/StatisticsModule.cs
+77
-65
No files found.
Mall.Module.MarketingCenter/StatisticsModule.cs
View file @
b416ba21
...
...
@@ -470,27 +470,27 @@ namespace Mall.Module.MarketingCenter
TenantId
=
dmodel
.
TenantId
},
minDate
,
maxDate
);
}
dmodel
.
RepurchaseNum
=
0
;
dmodel
.
UserIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
UserIds
));
var
allOrderList
=
orderRepository
.
GetOrderByUserIds
(
dmodel
);
foreach
(
var
item
in
list
)
{
item
.
LoginEmpActive
=
loginUserList
?.
Where
(
qitem
=>
Convert
.
ToDateTime
(
qitem
.
CreateDate
).
ToString
(
"yyyy-MM-dd"
)
==
item
.
CreateDate
&&
qitem
.
PostId
==
0
&&
qitem
.
SuperiorId
>
0
&&
qitem
.
SuperiorId
<
20
)?.
Count
()
??
0
;
item
.
LoginEmpActive
=
loginUserList
?.
Where
(
qitem
=>
Convert
.
ToDateTime
(
qitem
.
CreateDate
).
ToString
(
"yyyy-MM-dd"
)
==
item
.
CreateDate
&&
qitem
.
PostId
==
0
&&
qitem
.
SuperiorId
>
0
&&
qitem
.
SuperiorId
<
20
)?.
Count
()
??
0
;
item
.
LoginLeaderActive
=
loginUserList
?.
Where
(
qitem
=>
Convert
.
ToDateTime
(
qitem
.
CreateDate
).
ToString
(
"yyyy-MM-dd"
)
==
item
.
CreateDate
&&
qitem
.
PostId
==
1
)?.
Count
()
??
0
;
item
.
OrderEmpActive
=
orderUserList
?.
Where
(
qitem
=>
Convert
.
ToDateTime
(
qitem
.
CreateDate
).
ToString
(
"yyyy-MM-dd"
)
==
item
.
CreateDate
&&
qitem
.
PostId
==
0
&&
qitem
.
SuperiorId
>
0
&&
qitem
.
SuperiorId
<
20
)?.
Count
()
??
0
;
item
.
OrderEmpActive
=
orderUserList
?.
Where
(
qitem
=>
Convert
.
ToDateTime
(
qitem
.
CreateDate
).
ToString
(
"yyyy-MM-dd"
)
==
item
.
CreateDate
&&
qitem
.
PostId
==
0
&&
qitem
.
SuperiorId
>
0
&&
qitem
.
SuperiorId
<
20
)?.
Count
()
??
0
;
item
.
OrderLeaderActice
=
orderUserList
?.
Where
(
qitem
=>
Convert
.
ToDateTime
(
qitem
.
CreateDate
).
ToString
(
"yyyy-MM-dd"
)
==
item
.
CreateDate
&&
qitem
.
PostId
==
1
)?.
Count
()
??
0
;
if
(!
string
.
IsNullOrWhiteSpace
(
item
.
UserIds
))
{
try
{
DateTime
nowTime
=
Convert
.
ToDateTime
(
item
.
CreateDate
+
"
23:59:59
"
);
DateTime
nowTime
=
Convert
.
ToDateTime
(
item
.
CreateDate
+
"
00:00:00
"
);
var
userIdList
=
item
.
UserIds
.
Split
(
","
).
Distinct
().
ToArray
();
foreach
(
var
itemUserId
in
userIdList
)
{
int
orderNum
=
allOrderList
.
Where
(
x
=>
x
.
UserId
.
ToString
()
==
itemUserId
&&
x
.
CreateDate
<
=
nowTime
).
Count
();
int
orderNum
=
allOrderList
.
Where
(
x
=>
x
.
UserId
.
ToString
()
==
itemUserId
&&
x
.
CreateDate
<
nowTime
).
Count
();
if
(
orderNum
>
1
)
{
item
.
RepurchaseNum
+=
1
;
...
...
@@ -829,26 +829,26 @@ namespace Mall.Module.MarketingCenter
{
#
region
本月
decimal
CancelOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
CancelOrderNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
PeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
PeopleNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
OrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
OrderNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
PayMoney
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
PayMoney
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
BuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
BuyNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
AvgOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
AvgOrderNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
AvgBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
AvgBuyNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
AvgUnitPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
AvgUnitPrice
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
AvgBuyPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
AvgBuyPrice
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
MemberNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
MemberNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
PaymentNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
PaymentNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
MOrderRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
MOrderRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
ReBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
ReBuyNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
ReBuyRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
ReBuyRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
NewPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
NewPeopleNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
PXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
PXNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
VipNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
VipNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
YXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
YXNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
JXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
JXNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
Profit
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
Profit
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
ProfitRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
ProfitRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
PeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
PeopleNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
OrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
OrderNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
PayMoney
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
PayMoney
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
BuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
BuyNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
AvgOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
AvgOrderNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
AvgBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
AvgBuyNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
AvgUnitPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
AvgUnitPrice
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
AvgBuyPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
AvgBuyPrice
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
MemberNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
MemberNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
PaymentNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
PaymentNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
MOrderRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
MOrderRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
ReBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
ReBuyNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
ReBuyRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
ReBuyRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
NewPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
NewPeopleNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
PXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
PXNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
VipNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
VipNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
YXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
YXNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
JXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
JXNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
Profit
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
Profit
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
ProfitRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
ProfitRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
#
endregion
#
region
平均
RList
.
Add
(
new
...
...
@@ -952,30 +952,31 @@ namespace Mall.Module.MarketingCenter
sProfitRate
=
ProfitRate
;
#
endregion
}
else
if
(
Convert
.
ToDateTime
(
SDate
).
Day
==
MaxDay
)
{
else
if
(
Convert
.
ToDateTime
(
SDate
).
Day
==
MaxDay
)
{
int
NowDay
=
MaxDay
-
20
;
#
region
本月
decimal
CancelOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
CancelOrderNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
PeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PeopleNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
OrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
OrderNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
PayMoney
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PayMoney
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
BuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
BuyNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
AvgOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgOrderNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
AvgBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgBuyNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
AvgUnitPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgUnitPrice
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
AvgBuyPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgBuyPrice
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
MemberNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
MemberNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
PaymentNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PaymentNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
MOrderRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
MOrderRate
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
ReBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ReBuyNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
ReBuyRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ReBuyRate
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
NewPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
NewPeopleNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
PXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PXNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
VipNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
VipNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
YXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
YXNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
JXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
JXNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
Profit
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
Profit
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
ProfitRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ProfitRate
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
PeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PeopleNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
OrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
OrderNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
PayMoney
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PayMoney
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
BuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
BuyNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
AvgOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgOrderNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
AvgBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgBuyNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
AvgUnitPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgUnitPrice
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
AvgBuyPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgBuyPrice
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
MemberNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
MemberNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
PaymentNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PaymentNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
MOrderRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
MOrderRate
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
ReBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ReBuyNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
ReBuyRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ReBuyRate
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
NewPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
NewPeopleNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
PXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PXNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
VipNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
VipNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
YXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
YXNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
JXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
JXNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
Profit
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
Profit
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
ProfitRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ProfitRate
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
#
endregion
#
region
平均
RList
.
Add
(
new
...
...
@@ -1949,7 +1950,8 @@ namespace Mall.Module.MarketingCenter
//根据月份遍历
string
SMonth
=
Convert
.
ToDateTime
(
StartDate
).
ToString
(
"yyyy-MM"
);
int
TotalMonthNum
=
0
;
while
(
true
)
{
while
(
true
)
{
TotalMonthNum
++;
User_Statistics_Query
mmodel
=
new
User_Statistics_Query
()
{
Date
=
SMonth
};
//查询当月数据
...
...
@@ -1965,10 +1967,10 @@ namespace Mall.Module.MarketingCenter
//int TotalVIPNum = mlist.Any() ? mlist.Max(x => x.VipLJNum) : 0;
//int TotalYXNum = mlist.Any() ? mlist.Max(x => x.YXLJNum) : 0;
//int TotalJXNum = mlist.Any() ? mlist.Max(x => x.JXLJNum) : 0;
mmodel
.
PXNum
=
mlist
.
Sum
(
x
=>
x
.
PXNum
);
mmodel
.
VipNum
=
mlist
.
Sum
(
x
=>
x
.
VipNum
);
mmodel
.
YXNum
=
mlist
.
Sum
(
x
=>
x
.
YXNum
);
mmodel
.
JXNum
=
mlist
.
Sum
(
x
=>
x
.
JXNum
);
mmodel
.
PXNum
=
mlist
.
Sum
(
x
=>
x
.
PXNum
);
mmodel
.
VipNum
=
mlist
.
Sum
(
x
=>
x
.
VipNum
);
mmodel
.
YXNum
=
mlist
.
Sum
(
x
=>
x
.
YXNum
);
mmodel
.
JXNum
=
mlist
.
Sum
(
x
=>
x
.
JXNum
);
mmodel
.
TotalMNum
=
mmodel
.
PXNum
+
mmodel
.
VipNum
+
mmodel
.
YXNum
+
mmodel
.
JXNum
;
#
region
求月平均
...
...
@@ -2172,7 +2174,8 @@ namespace Mall.Module.MarketingCenter
#
endregion
MonthSList
.
Add
(
mmodel
);
if
(
SMonth
==
endTime
)
{
if
(
SMonth
==
endTime
)
{
break
;
}
SMonth
=
Convert
.
ToDateTime
(
SMonth
+
"-01"
).
AddMonths
(
1
).
ToString
(
"yyyy-MM"
);
...
...
@@ -2191,7 +2194,7 @@ namespace Mall.Module.MarketingCenter
PayMoney
=
MonthSList2
.
Sum
(
x
=>
x
.
PayMoney
),
BuyNum
=
MonthSList2
.
Sum
(
x
=>
x
.
BuyNum
),
Profit
=
MonthSList2
.
Sum
(
x
=>
x
.
Profit
),
TotalPayPeople
=
MonthSList2
.
Any
()?
MonthSList2
.
Max
(
x
=>
x
.
TotalPayPeople
)
:
0
,
TotalPayPeople
=
MonthSList2
.
Any
()
?
MonthSList2
.
Max
(
x
=>
x
.
TotalPayPeople
)
:
0
,
PXNum
=
MonthSList2
.
Sum
(
x
=>
x
.
PXNum
),
VipNum
=
MonthSList2
.
Sum
(
x
=>
x
.
VipNum
),
YXNum
=
MonthSList2
.
Sum
(
x
=>
x
.
YXNum
),
...
...
@@ -2220,7 +2223,8 @@ namespace Mall.Module.MarketingCenter
List
<
User_Statistics_Rate_Query
>
ReRateList
=
new
List
<
User_Statistics_Rate_Query
>();
//概率数据
string
SRateMonth
=
startTime
;
//这个要从查询第一个月开始
while
(
true
)
{
while
(
true
)
{
//求当月的所有比例 (当月-上月)/上月
var
NowMmodel
=
MonthSList
.
Where
(
x
=>
x
.
Date
==
SRateMonth
).
FirstOrDefault
();
var
PreMmodel
=
MonthSList
.
Where
(
x
=>
x
.
Date
==
Convert
.
ToDateTime
(
SRateMonth
+
"-01"
).
AddMonths
(-
1
).
ToString
(
"yyyy-MM"
)).
FirstOrDefault
();
...
...
@@ -2648,7 +2652,8 @@ namespace Mall.Module.MarketingCenter
#
region
组装
excel
数据
List
<
ExcelDataSource
>
DataList
=
new
List
<
ExcelDataSource
>();
//第一部分数据
foreach
(
var
item
in
MonthSList
)
{
foreach
(
var
item
in
MonthSList
)
{
ExcelDataSource
datarow
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
23
)
{
...
...
@@ -2736,7 +2741,8 @@ namespace Mall.Module.MarketingCenter
},
ColumnHight
=
30
};
foreach
(
var
item
in
ReRateList
)
{
foreach
(
var
item
in
ReRateList
)
{
header3
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
Date
)
{
});
}
DataList
.
Add
(
header3
);
...
...
@@ -2760,7 +2766,8 @@ namespace Mall.Module.MarketingCenter
"PAvgJXNum|金象會員成長率"
,
"PAvgTotalMNum|會員總成長率"
};
foreach
(
var
item
in
RateRowList
)
{
foreach
(
var
item
in
RateRowList
)
{
var
fileNameArr
=
item
.
Split
(
'|'
);
ExcelDataSource
datarow2
=
new
ExcelDataSource
()
{
...
...
@@ -2769,8 +2776,9 @@ namespace Mall.Module.MarketingCenter
},
ColumnHight
=
30
};
foreach
(
var
qitem
in
ReRateList
)
{
foreach
(
var
qitem
in
ReRateList
)
{
JObject
parms
=
JObject
.
Parse
(
JsonHelper
.
Serialize
(
qitem
));
string
mvalue
=
parms
.
GetStringValue
(
fileNameArr
[
0
]);
datarow2
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
mvalue
+
"%"
)
{
});
...
...
@@ -2801,7 +2809,8 @@ namespace Mall.Module.MarketingCenter
List
<
User_Statistics_Query
>
YearAvgSList
=
new
List
<
User_Statistics_Query
>();
//年平均统计数据
List
<
User_Statistics_Rate_Query
>
YearRateSList
=
new
List
<
User_Statistics_Rate_Query
>();
//年成长率统计数据
int
SYear
=
startYear
;
while
(
true
)
{
while
(
true
)
{
var
ylist
=
list
.
Where
(
x
=>
x
.
DateYear
==
SYear
).
ToList
();
#
region
1
表统计
User_Statistics_Query_V2
ymodel
=
new
User_Statistics_Query_V2
()
{
Date
=
SYear
.
ToString
()
};
...
...
@@ -2873,7 +2882,7 @@ namespace Mall.Module.MarketingCenter
string
SDate
=
SMonth
+
"-01"
;
string
EDate
=
Convert
.
ToDateTime
(
SMonth
+
"-01"
).
AddMonths
(
1
).
AddDays
(-
1
).
ToString
(
"yyyy-MM-dd"
);
int
MaxDay
=
Convert
.
ToDateTime
(
EDate
).
Day
;
//分三段求 每期的平均
if
(
true
)
{
...
...
@@ -3020,7 +3029,7 @@ namespace Mall.Module.MarketingCenter
yProfitRate
+=
ProfitRate
;
#
endregion
}
#
region
月平均赋值
mmodel
.
MAvgPeopleNum
=
Math
.
Round
(
yPeopleNum
/
3
,
2
,
MidpointRounding
.
AwayFromZero
);
...
...
@@ -3136,7 +3145,8 @@ namespace Mall.Module.MarketingCenter
}
#
endregion
if
(
SYear
==
endYear
)
{
if
(
SYear
==
endYear
)
{
break
;
}
SYear
=
Convert
.
ToDateTime
(
SYear
+
"-01-01"
).
AddYears
(
1
).
Year
;
...
...
@@ -3147,9 +3157,11 @@ namespace Mall.Module.MarketingCenter
List
<
User_Statistics_Query
>
YearAvgSCList
=
new
List
<
User_Statistics_Query
>();
//年平均统计数据 成长率
List
<
User_Statistics_Rate_Query
>
YearRateSCList
=
new
List
<
User_Statistics_Rate_Query
>();
//年成长率统计数据 成长率
#
region
第一表
foreach
(
var
item
in
YearSList
)
{
foreach
(
var
item
in
YearSList
)
{
//第一年没有 从第二年开始
if
(
item
.
Date
!=
startYear
.
ToString
())
{
if
(
item
.
Date
!=
startYear
.
ToString
())
{
int
PreYear
=
Convert
.
ToInt32
(
item
.
Date
)
-
1
;
var
PreModel
=
YearSList
.
Where
(
x
=>
x
.
Date
==
PreYear
.
ToString
()).
FirstOrDefault
();
User_Statistics_Query_V2
cmodel
=
new
User_Statistics_Query_V2
()
{
Date
=
item
.
Date
+
"成長率"
};
...
...
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