Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
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
黄奎
Education
Commits
26422b2a
Commit
26422b2a
authored
Jan 26, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
c9327275
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
22 deletions
+100
-22
ConvertHelper.cs
Edu.Common/Plugin/ConvertHelper.cs
+67
-0
MarketConsultantModule.cs
Edu.Module.Customer/MarketConsultantModule.cs
+33
-22
No files found.
Edu.Common/Plugin/ConvertHelper.cs
View file @
26422b2a
...
...
@@ -531,5 +531,72 @@ namespace Edu.Common
int
result
=
rd
.
Next
(
1
,
100
);
return
result
%
4
;
}
/// <summary>
/// 一年中的第几周
/// </summary>
/// <param name="dt"></param>
/// <returns></returns>
public
static
int
WeekOfYear
(
DateTime
dt
)
{
int
days
=
DaysInFirstweekInYear
(
dt
);
int
dayofyear
=
dt
.
DayOfYear
;
if
(
dayofyear
<
days
)
return
1
;
else
{
int
week2
=
(
int
)
Math
.
Ceiling
((
double
)(
dayofyear
-
days
)
/
(
double
)
7
);
return
week2
+
1
;
}
}
/// <summary>
/// 计算某年第一周的天数
/// </summary>
/// <param name="dt">某年中的一个时间</param>
/// <returns></returns>
public
static
int
DaysInFirstweekInYear
(
DateTime
dt
)
{
DateTime
FirstDate
=
Convert
.
ToDateTime
(
string
.
Format
(
"{0}-1-1"
,
dt
.
Year
));
int
DayOfWeekInYear
=
DayOfWeek
(
FirstDate
);
int
DaysInFirstWeek
=
8
-
DayOfWeekInYear
;
return
DaysInFirstWeek
;
}
/// <summary>
/// 计算星期几,转换为数字
/// </summary>
/// <param name="dt">某天的日期</param>
/// <returns></returns>
public
static
int
DayOfWeek
(
DateTime
dt
)
{
string
strDayOfWeek
=
dt
.
DayOfWeek
.
ToString
().
ToLower
();
int
intDayOfWeek
=
0
;
switch
(
strDayOfWeek
)
{
case
"monday"
:
intDayOfWeek
=
1
;
break
;
case
"tuesday"
:
intDayOfWeek
=
2
;
break
;
case
"wednesday"
:
intDayOfWeek
=
3
;
break
;
case
"thursday"
:
intDayOfWeek
=
4
;
break
;
case
"friday"
:
intDayOfWeek
=
5
;
break
;
case
"saturday"
:
intDayOfWeek
=
6
;
break
;
case
"sunday"
:
intDayOfWeek
=
7
;
break
;
}
return
intDayOfWeek
;
}
}
}
\ No newline at end of file
Edu.Module.Customer/MarketConsultantModule.cs
View file @
26422b2a
...
...
@@ -616,6 +616,12 @@ namespace Edu.Module.Customer
dayList
.
Add
(
tempObj
);
}
var
yesDataList
=
lastList
?.
Where
(
qitem
=>
qitem
.
Date
.
Year
==
end
.
AddDays
(-
1
).
Year
&&
qitem
.
Date
.
Month
==
end
.
AddDays
(-
1
).
Month
)?.
ToList
();
//当前周
var
curWeekList
=
lastList
?.
Where
(
qitem
=>
Common
.
ConvertHelper
.
WeekOfYear
(
qitem
.
Date
)
==
Common
.
ConvertHelper
.
WeekOfYear
(
end
.
AddDays
(-
1
)))?.
ToList
();
//上一周
var
lastWeekList
=
lastList
?.
Where
(
qitem
=>
Common
.
ConvertHelper
.
WeekOfYear
(
qitem
.
Date
)
==
Common
.
ConvertHelper
.
WeekOfYear
(
end
.
AddDays
(-
1
))-
1
)?.
ToList
();
var
tempDataList
=
lastList
?.
Where
(
qitem
=>
Common
.
ConvertHelper
.
FormatDate
(
qitem
.
Date
)
==
Common
.
ConvertHelper
.
FormatDate
(
end
.
AddDays
(-
1
)))?.
ToList
();
obj
=
new
{
...
...
@@ -627,36 +633,36 @@ namespace Edu.Module.Customer
ClueCount
=
yesDataList
?.
Sum
(
qitem
=>
qitem
.
ClueCount
)
??
0
,
YestodayClue
=
yesDataList
?.
Sum
(
qitem
=>
qitem
.
YestodayClue
)
??
0
,
CurWeekClue
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekClue
)
??
0
,
LastWeekClue
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekClue
)
??
0
,
CurWeekClue
=
curWeek
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekClue
)
??
0
,
LastWeekClue
=
lastWeek
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekClue
)
??
0
,
CurMonthClue
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
CurMonthClue
)
??
0
,
LastMonthClue
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
LastMonthClue
)
??
0
,
FollowCount
=
yesDataList
?.
Sum
(
qitem
=>
qitem
.
FollowCount
)
??
0
,
YestodayFollow
=
yesDataList
?.
Sum
(
qitem
=>
qitem
.
YestodayFollow
)
??
0
,
CurWeekFollow
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekFollow
)
??
0
,
LastWeekFollow
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekFollow
)
??
0
,
CurWeekFollow
=
curWeek
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekFollow
)
??
0
,
LastWeekFollow
=
lastWeek
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekFollow
)
??
0
,
CurMonthFollow
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
CurMonthFollow
)
??
0
,
LastMonthFollow
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
LastMonthFollow
)
??
0
,
VisitCount
=
yesDataList
?.
Sum
(
qitem
=>
qitem
.
VisitCount
)
??
0
,
YestodayVisit
=
yesDataList
?.
Sum
(
qitem
=>
qitem
.
YestodayVisit
)
??
0
,
CurWeekVisit
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekVisit
)
??
0
,
LastWeekVisit
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekVisit
)
??
0
,
CurWeekVisit
=
curWeek
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekVisit
)
??
0
,
LastWeekVisit
=
lastWeek
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekVisit
)
??
0
,
CurMonthVisit
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
CurMonthVisit
)
??
0
,
LastMonthVisit
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
LastMonthVisit
)
??
0
,
TrialLessonCount
=
yesDataList
?.
Sum
(
qitem
=>
qitem
.
TrialLessonCount
)
??
0
,
YestodayTrialLesson
=
yesDataList
?.
Sum
(
qitem
=>
qitem
.
YestodayTrialLesson
)
??
0
,
CurWeekTrialLesson
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekTrialLesson
)
??
0
,
LastWeekTrialLesson
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekTrialLesson
)
??
0
,
CurWeekTrialLesson
=
curWeek
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekTrialLesson
)
??
0
,
LastWeekTrialLesson
=
lastWeek
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekTrialLesson
)
??
0
,
CurMonthTrialLesson
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
CurMonthTrialLesson
)
??
0
,
LastMonthTrialLesson
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
LastMonthTrialLesson
)
??
0
,
SaleMoney
=
yesDataList
?.
Sum
(
qitem
=>
qitem
.
SaleMoney
)
??
0
,
YestodaySale
=
yesDataList
?.
Sum
(
qitem
=>
qitem
.
YestodaySale
)
??
0
,
CurWeekSale
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekSale
)
??
0
,
LastWeekSale
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekSale
)
??
0
,
CurWeekSale
=
curWeek
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekSale
)
??
0
,
LastWeekSale
=
lastWeek
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekSale
)
??
0
,
CurMonrhSale
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
CurMonrhSale
)
??
0
,
LastMonthSale
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
LastMonthSale
)
??
0
,
}
...
...
@@ -682,6 +688,11 @@ namespace Edu.Module.Customer
});
var
consultantGoal
=
GetConsultantGoalListModule
(
new
RB_Consultant_Goal_Extend
()
{
Group_Id
=
100000
,
Dept_Id
=
13
,
YearStr
=
end
.
Year
,
MonthStr
=
end
.
Month
})?.
FirstOrDefault
();
var
yesDataList
=
lastList
?.
Where
(
qitem
=>
qitem
.
Date
.
Year
==
end
.
AddDays
(-
1
).
Year
&&
qitem
.
Date
.
Month
==
end
.
AddDays
(-
1
).
Month
)?.
ToList
();
//当前周
var
curWeekList
=
lastList
?.
Where
(
qitem
=>
Common
.
ConvertHelper
.
WeekOfYear
(
qitem
.
Date
)
==
Common
.
ConvertHelper
.
WeekOfYear
(
end
.
AddDays
(-
1
)))?.
ToList
();
//上一周
var
lastWeekList
=
lastList
?.
Where
(
qitem
=>
Common
.
ConvertHelper
.
WeekOfYear
(
qitem
.
Date
)
==
Common
.
ConvertHelper
.
WeekOfYear
(
end
.
AddDays
(-
1
))
-
1
)?.
ToList
();
var
tempDataList
=
lastList
?.
Where
(
qitem
=>
Common
.
ConvertHelper
.
FormatDate
(
qitem
.
Date
)
==
Common
.
ConvertHelper
.
FormatDate
(
end
.
AddDays
(-
1
)))?.
ToList
();
obj
=
new
{
...
...
@@ -689,41 +700,41 @@ namespace Edu.Module.Customer
WeekStr
=
Common
.
Plugin
.
StringHelper
.
GetWeek
(
end
.
AddDays
(-
1
)),
TrialLessonCount
=
yesDataList
?.
Sum
(
qitem
=>
qitem
.
TrialLessonCount
)
??
0
,
YestodayTrialLesson
=
yesDataList
?.
Sum
(
qitem
=>
qitem
.
YestodayTrialLesson
)
??
0
,
CurWeekTrialLesson
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekTrialLesson
)
??
0
,
LastWeekTrialLesson
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekTrialLesson
)
??
0
,
CurWeekTrialLesson
=
curWeek
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekTrialLesson
)
??
0
,
LastWeekTrialLesson
=
lastWeek
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekTrialLesson
)
??
0
,
CurMonthTrialLesson
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
CurMonthTrialLesson
)
??
0
,
LastMonthTrialLesson
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
LastMonthTrialLesson
)
??
0
,
VisitCount
=
yesDataList
?.
Sum
(
qitem
=>
qitem
.
VisitCount
)
??
0
,
YestodayVisit
=
yesDataList
?.
Sum
(
qitem
=>
qitem
.
YestodayVisit
)
??
0
,
CurWeekVisit
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekVisit
)
??
0
,
LastWeekVisit
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekVisit
)
??
0
,
CurWeekVisit
=
curWeek
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekVisit
)
??
0
,
LastWeekVisit
=
lastWeek
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekVisit
)
??
0
,
CurMonthVisit
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
CurMonthVisit
)
??
0
,
LastMonthVisit
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
LastMonthVisit
)
??
0
,
Rates
=
yesDataList
?.
Sum
(
qitem
=>
qitem
.
Rates
)
??
0
,
YestodayRates
=
yesDataList
?.
Sum
(
qitem
=>
qitem
.
YestodayRates
)
??
0
,
CurWeekRates
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekRates
)
??
0
,
LastWeekRates
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekRates
)
??
0
,
CurWeekRates
=
curWeek
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekRates
)
??
0
,
LastWeekRates
=
lastWeek
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekRates
)
??
0
,
CurMonthRates
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
CurMonthRates
)
??
0
,
LastMonthRates
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
LastMonthRates
)
??
0
,
FollowCount
=
yesDataList
?.
Sum
(
qitem
=>
qitem
.
FollowCount
)
??
0
,
YestodayFollow
=
yesDataList
?.
Sum
(
qitem
=>
qitem
.
YestodayFollow
)
??
0
,
CurWeekFollow
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekFollow
)
??
0
,
LastWeekFollow
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekFollow
)
??
0
,
CurWeekFollow
=
curWeek
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekFollow
)
??
0
,
LastWeekFollow
=
lastWeek
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekFollow
)
??
0
,
CurMonthFollow
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
CurMonthFollow
)
??
0
,
LastMonthFollow
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
LastMonthFollow
)
??
0
,
AgFollow
=
Math
.
Round
(
yesDataList
?.
Average
(
qitem
=>
qitem
.
AgFollow
)
??
0
,
2
),
YestodayAgFollow
=
Math
.
Round
(
yesDataList
?.
Average
(
qitem
=>
qitem
.
YestodayAgFollow
)
??
0
,
2
),
CurWeekAgFollow
=
Math
.
Round
(
tempData
List
?.
Average
(
qitem
=>
qitem
.
CurWeekAgFollow
)
??
0
,
2
),
LastWeekAgFollow
=
Math
.
Round
(
tempData
List
?.
Average
(
qitem
=>
qitem
.
LastWeekAgFollow
)
??
0
,
2
),
CurWeekAgFollow
=
Math
.
Round
(
curWeek
List
?.
Average
(
qitem
=>
qitem
.
CurWeekAgFollow
)
??
0
,
2
),
LastWeekAgFollow
=
Math
.
Round
(
lastWeek
List
?.
Average
(
qitem
=>
qitem
.
LastWeekAgFollow
)
??
0
,
2
),
CurMonthAgFollow
=
Math
.
Round
(
tempDataList
?.
Average
(
qitem
=>
qitem
.
CurMonthAgFollow
)
??
0
,
2
),
LastMonthAgFollow
=
Math
.
Round
(
tempDataList
?.
Average
(
qitem
=>
qitem
.
LastMonthAgFollow
)
??
0
,
2
),
CurWeekOrderNum
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekOrderNum
)
??
0
,
LastWeekOrderNum
=
tempData
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekOrderNum
)
??
0
,
CurWeekOrderNum
=
curWeek
List
?.
Sum
(
qitem
=>
qitem
.
CurWeekOrderNum
)
??
0
,
LastWeekOrderNum
=
lastWeek
List
?.
Sum
(
qitem
=>
qitem
.
LastWeekOrderNum
)
??
0
,
CurWeekOrderSale
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
CurWeekOrderSale
)
??
0
,
LastWeekOrderSale
=
tempDataList
?.
Sum
(
qitem
=>
qitem
.
LastWeekOrderSale
)
??
0
,
...
...
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