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
1e506e3f
Commit
1e506e3f
authored
Sep 11, 2023
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
bc7ca74a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
571 additions
and
19 deletions
+571
-19
RB_Student_ViewModel.cs
Edu.Model/ViewModel/User/RB_Student_ViewModel.cs
+9
-2
StudentModule.cs
Edu.Module.User/StudentModule.cs
+261
-0
RB_StudentRepository.cs
Edu.Repository/User/RB_StudentRepository.cs
+107
-3
StudentStatController.cs
Edu.WebApi/Controllers/User/StudentStatController.cs
+194
-14
No files found.
Edu.Model/ViewModel/User/RB_Student_ViewModel.cs
View file @
1e506e3f
...
...
@@ -125,6 +125,7 @@ namespace Edu.Model.ViewModel.User
/// </summary>
public
int
EnterID
{
get
;
set
;
}
/// <summary>
/// 剩余课时
/// </summary>
...
...
@@ -150,6 +151,12 @@ namespace Edu.Model.ViewModel.User
/// </summary>
public
decimal
OrderIncome
{
get
;
set
;
}
/// <summary>
/// 订单退款
/// </summary>
public
decimal
Refund
{
get
;
set
;
}
/// <summary>
/// 续费订单数量
/// </summary>
...
...
@@ -232,7 +239,7 @@ namespace Edu.Model.ViewModel.User
/// <summary>
/// 试听次数
/// </summary>
public
int
TrialLessonCount
{
get
;
set
;
}
public
int
TrialLessonCount
{
get
;
set
;
}
/// <summary>
/// 同行
...
...
@@ -292,7 +299,7 @@ namespace Edu.Model.ViewModel.User
/// <summary>
/// 学习目的名称
/// </summary>
public
string
StuPurposeName
{
get
;
set
;}
public
string
StuPurposeName
{
get
;
set
;
}
/// <summary>
/// 客户需求名称
...
...
Edu.Module.User/StudentModule.cs
View file @
1e506e3f
...
...
@@ -2151,5 +2151,266 @@ namespace Edu.Module.User
}
return
result
;
}
/// <summary>
/// 获取学生分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Student_ViewModel
>
GetStudentMonthPageListModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Student_ViewModel
query
)
{
var
list
=
studentRepository
.
GetStudentMonthPageListRepository
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
);
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
//客户阶段列表
var
stageList
=
stageRepository
.
GetStageListRepostory
(
new
Model
.
Entity
.
System
.
RB_Stage
()
{
Group_Id
=
list
[
0
].
Group_Id
});
//学员类型列表
var
stuTypeList
=
student_TypeRepository
.
GetStudentTypeListRepository
(
new
RB_Student_Type_Extend
());
string
stuIds
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
StuId
));
//学员跟进
var
followList
=
followRepository
.
GetStudentFollowListRepository
(
new
RB_Student_Follow_Extend
()
{
QStuIds
=
stuIds
});
//内部介绍人
List
<
int
>
empIdList
=
Common
.
ConvertHelper
.
StringToList
(
string
.
Join
(
","
,
list
.
Where
(
qitem
=>
qitem
.
CreateType
==
StuCreateTypeEnum
.
InternalIntroduction
).
Select
(
qitem
=>
qitem
.
StuSourceId
)));
List
<
int
>
createBys
=
Common
.
ConvertHelper
.
StringToList
(
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
CreateBy
)));
List
<
RB_Account_ViewModel
>
accountList
=
new
List
<
RB_Account_ViewModel
>();
if
(
createBys
!=
null
&&
createBys
.
Count
>
0
)
{
empIdList
.
AddRange
(
createBys
);
}
if
(
empIdList
!=
null
&&
empIdList
.
Count
>
0
)
{
accountList
=
accountModule
.
GetAccountListExtModule
(
new
RB_Account_ViewModel
()
{
QIds
=
string
.
Join
(
","
,
empIdList
)
});
}
//同业录入列表
List
<
RB_Customer_Extend
>
customerList
=
new
List
<
RB_Customer_Extend
>();
List
<
int
>
customerIdList
=
Common
.
ConvertHelper
.
StringToList
(
string
.
Join
(
","
,
list
.
Where
(
qitem
=>
qitem
.
CreateType
==
StuCreateTypeEnum
.
CustomerInput
).
Select
(
qitem
=>
qitem
.
StuSourceId
)));
if
(
customerIdList
!=
null
&&
customerIdList
.
Count
>
0
)
{
customerList
=
customerRepository
.
GetCustomerListRepository
(
new
RB_Customer_Extend
()
{
CustomerIds
=
string
.
Join
(
","
,
customerIdList
)
});
}
List
<
RB_Student_ViewModel
>
transStudentList
=
new
List
<
RB_Student_ViewModel
>();
//转介人列表
List
<
int
>
transIdList
=
Common
.
ConvertHelper
.
StringToList
(
string
.
Join
(
","
,
list
.
Where
(
qitem
=>
qitem
.
CreateType
==
StuCreateTypeEnum
.
TransIntroduction
).
Select
(
qitem
=>
qitem
.
StuSourceId
)));
if
(
transIdList
!=
null
&&
transIdList
.
Count
>
0
)
{
transStudentList
=
studentRepository
.
GetStudentListRepository
(
new
RB_Student_ViewModel
()
{
StuIds
=
string
.
Join
(
","
,
transIdList
)
});
}
//学习目的
string
goalIds
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
StuPurpose
));
var
goalList
=
learningGoalsRepository
.
GetLearningGoalsListRepository
(
new
Model
.
ViewModel
.
System
.
RB_LearningGoals_Extend
()
{
QGoalIds
=
goalIds
});
string
channelIds
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
StuChannel
));
var
channelList
=
channelRepository
.
GetChannelListRepository
(
new
Model
.
ViewModel
.
System
.
RB_Channel_Extend
()
{
QChannelIds
=
channelIds
});
var
needIds
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
StuNeeds
));
var
needList
=
needsRepository
.
GetNeedsListRepository
(
new
Model
.
ViewModel
.
System
.
RB_Needs_Extend
()
{
QNeedsId
=
needIds
});
//课程顾问跟进信息
List
<
RB_Student_Advisor_Extend
>
advisorList
=
student_AdvisorRepository
.
GetStudentAdvisorListRepository
(
new
RB_Student_Advisor_Extend
()
{
QStuIds
=
stuIds
});
foreach
(
var
item
in
list
)
{
var
tempFollow
=
followList
?.
Where
(
qitem
=>
qitem
.
StuId
==
item
.
StuId
)?.
OrderByDescending
(
qitem
=>
qitem
.
Id
)?.
FirstOrDefault
();
item
.
followUpTime
=
Common
.
ConvertHelper
.
FormatTime
(
tempFollow
?.
CreateTime
);
if
(
item
.
CreateType
==
StuCreateTypeEnum
.
InternalIntroduction
)
{
item
.
StuSourceIdName
=
accountList
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
==
item
.
StuSourceId
)?.
AccountName
??
""
;
}
else
if
(
item
.
CreateType
==
StuCreateTypeEnum
.
CustomerInput
)
{
var
tempCustomer
=
customerList
?.
FirstOrDefault
(
qitem
=>
qitem
.
CustomerId
==
item
.
StuSourceId
);
item
.
StuSourceIdName
=
tempCustomer
?.
CustomerName
??
""
;
if
(
tempCustomer
!=
null
)
{
if
(
tempCustomer
.
CustomerType
==
Common
.
Enum
.
Customer
.
CatetoryTypeEnum
.
Other
)
{
item
.
EnterpriseName
=
tempCustomer
?.
EnterpriseName
??
""
;
}
else
{
item
.
EnterpriseName
=
tempCustomer
?.
CategoryName
??
""
;
}
}
else
{
item
.
EnterpriseName
=
""
;
}
}
else
if
(
item
.
CreateType
==
StuCreateTypeEnum
.
TransIntroduction
)
{
item
.
StuSourceIdName
=
transStudentList
?.
FirstOrDefault
(
qitem
=>
qitem
.
StuId
==
item
.
StuSourceId
)?.
StuName
??
""
;
}
item
.
StuStageName
=
stageList
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
==
item
.
StuStage
)?.
StageName
??
""
;
item
.
StuTypeName
=
stuTypeList
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
==
item
.
StuType
)?.
Name
??
""
;
item
.
StuChannelName
=
channelList
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
==
item
.
StuChannel
)?.
Name
??
""
;
item
.
StuPurposeName
=
goalList
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
==
item
.
StuPurpose
)?.
Name
??
""
;
item
.
StuNeedsName
=
needList
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
==
item
.
StuNeeds
)?.
Name
??
""
;
item
.
AdvisorList
=
advisorList
?.
Where
(
qitem
=>
qitem
.
StuId
==
item
.
StuId
)?.
ToList
()
??
new
List
<
RB_Student_Advisor_Extend
>();
item
.
CreateByName
=
accountList
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
==
item
.
CreateBy
)?.
AccountName
??
""
;
}
}
return
list
;
}
/// <summary>
/// 获取学生分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Student_ViewModel
>
GetStudentMonthListModule
(
RB_Student_ViewModel
query
)
{
var
list
=
studentRepository
.
GetStudentMonthListRepository
(
query
);
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
//客户阶段列表
var
stageList
=
stageRepository
.
GetStageListRepostory
(
new
Model
.
Entity
.
System
.
RB_Stage
()
{
Group_Id
=
list
[
0
].
Group_Id
});
//学员类型列表
var
stuTypeList
=
student_TypeRepository
.
GetStudentTypeListRepository
(
new
RB_Student_Type_Extend
());
string
stuIds
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
StuId
));
//学员跟进
var
followList
=
followRepository
.
GetStudentFollowListRepository
(
new
RB_Student_Follow_Extend
()
{
QStuIds
=
stuIds
});
//内部介绍人
List
<
int
>
empIdList
=
Common
.
ConvertHelper
.
StringToList
(
string
.
Join
(
","
,
list
.
Where
(
qitem
=>
qitem
.
CreateType
==
StuCreateTypeEnum
.
InternalIntroduction
).
Select
(
qitem
=>
qitem
.
StuSourceId
)));
List
<
int
>
createBys
=
Common
.
ConvertHelper
.
StringToList
(
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
CreateBy
)));
List
<
RB_Account_ViewModel
>
accountList
=
new
List
<
RB_Account_ViewModel
>();
if
(
createBys
!=
null
&&
createBys
.
Count
>
0
)
{
empIdList
.
AddRange
(
createBys
);
}
if
(
empIdList
!=
null
&&
empIdList
.
Count
>
0
)
{
accountList
=
accountModule
.
GetAccountListExtModule
(
new
RB_Account_ViewModel
()
{
QIds
=
string
.
Join
(
","
,
empIdList
)
});
}
//同业录入列表
List
<
RB_Customer_Extend
>
customerList
=
new
List
<
RB_Customer_Extend
>();
List
<
int
>
customerIdList
=
Common
.
ConvertHelper
.
StringToList
(
string
.
Join
(
","
,
list
.
Where
(
qitem
=>
qitem
.
CreateType
==
StuCreateTypeEnum
.
CustomerInput
).
Select
(
qitem
=>
qitem
.
StuSourceId
)));
if
(
customerIdList
!=
null
&&
customerIdList
.
Count
>
0
)
{
customerList
=
customerRepository
.
GetCustomerListRepository
(
new
RB_Customer_Extend
()
{
CustomerIds
=
string
.
Join
(
","
,
customerIdList
)
});
}
List
<
RB_Student_ViewModel
>
transStudentList
=
new
List
<
RB_Student_ViewModel
>();
//转介人列表
List
<
int
>
transIdList
=
Common
.
ConvertHelper
.
StringToList
(
string
.
Join
(
","
,
list
.
Where
(
qitem
=>
qitem
.
CreateType
==
StuCreateTypeEnum
.
TransIntroduction
).
Select
(
qitem
=>
qitem
.
StuSourceId
)));
if
(
transIdList
!=
null
&&
transIdList
.
Count
>
0
)
{
transStudentList
=
studentRepository
.
GetStudentListRepository
(
new
RB_Student_ViewModel
()
{
StuIds
=
string
.
Join
(
","
,
transIdList
)
});
}
//学习目的
string
goalIds
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
StuPurpose
));
var
goalList
=
learningGoalsRepository
.
GetLearningGoalsListRepository
(
new
Model
.
ViewModel
.
System
.
RB_LearningGoals_Extend
()
{
QGoalIds
=
goalIds
});
string
channelIds
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
StuChannel
));
var
channelList
=
channelRepository
.
GetChannelListRepository
(
new
Model
.
ViewModel
.
System
.
RB_Channel_Extend
()
{
QChannelIds
=
channelIds
});
var
needIds
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
StuNeeds
));
var
needList
=
needsRepository
.
GetNeedsListRepository
(
new
Model
.
ViewModel
.
System
.
RB_Needs_Extend
()
{
QNeedsId
=
needIds
});
//课程顾问跟进信息
List
<
RB_Student_Advisor_Extend
>
advisorList
=
student_AdvisorRepository
.
GetStudentAdvisorListRepository
(
new
RB_Student_Advisor_Extend
()
{
QStuIds
=
stuIds
});
foreach
(
var
item
in
list
)
{
var
tempFollow
=
followList
?.
Where
(
qitem
=>
qitem
.
StuId
==
item
.
StuId
)?.
OrderByDescending
(
qitem
=>
qitem
.
Id
)?.
FirstOrDefault
();
item
.
followUpTime
=
Common
.
ConvertHelper
.
FormatTime
(
tempFollow
?.
CreateTime
);
if
(
item
.
CreateType
==
StuCreateTypeEnum
.
InternalIntroduction
)
{
item
.
StuSourceIdName
=
accountList
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
==
item
.
StuSourceId
)?.
AccountName
??
""
;
}
else
if
(
item
.
CreateType
==
StuCreateTypeEnum
.
CustomerInput
)
{
var
tempCustomer
=
customerList
?.
FirstOrDefault
(
qitem
=>
qitem
.
CustomerId
==
item
.
StuSourceId
);
item
.
StuSourceIdName
=
tempCustomer
?.
CustomerName
??
""
;
if
(
tempCustomer
!=
null
)
{
if
(
tempCustomer
.
CustomerType
==
Common
.
Enum
.
Customer
.
CatetoryTypeEnum
.
Other
)
{
item
.
EnterpriseName
=
tempCustomer
?.
EnterpriseName
??
""
;
}
else
{
item
.
EnterpriseName
=
tempCustomer
?.
CategoryName
??
""
;
}
}
else
{
item
.
EnterpriseName
=
""
;
}
}
else
if
(
item
.
CreateType
==
StuCreateTypeEnum
.
TransIntroduction
)
{
item
.
StuSourceIdName
=
transStudentList
?.
FirstOrDefault
(
qitem
=>
qitem
.
StuId
==
item
.
StuSourceId
)?.
StuName
??
""
;
}
item
.
StuStageName
=
stageList
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
==
item
.
StuStage
)?.
StageName
??
""
;
item
.
StuTypeName
=
stuTypeList
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
==
item
.
StuType
)?.
Name
??
""
;
item
.
StuChannelName
=
channelList
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
==
item
.
StuChannel
)?.
Name
??
""
;
item
.
StuPurposeName
=
goalList
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
==
item
.
StuPurpose
)?.
Name
??
""
;
item
.
StuNeedsName
=
needList
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
==
item
.
StuNeeds
)?.
Name
??
""
;
item
.
AdvisorList
=
advisorList
?.
Where
(
qitem
=>
qitem
.
StuId
==
item
.
StuId
)?.
ToList
()
??
new
List
<
RB_Student_Advisor_Extend
>();
item
.
CreateByName
=
accountList
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
==
item
.
CreateBy
)?.
AccountName
??
""
;
}
}
return
list
;
}
}
}
Edu.Repository/User/RB_StudentRepository.cs
View file @
1e506e3f
...
...
@@ -462,7 +462,8 @@ WHERE 1=1
{
builder
.
AppendFormat
(
" AND t.{0}={1} "
,
nameof
(
RB_Student_ViewModel
.
IsSureConsultTime
),
1
);
}
else
{
else
{
builder
.
AppendFormat
(
" AND t.{0}<>{1} "
,
nameof
(
RB_Student_ViewModel
.
IsSureConsultTime
),
1
);
}
}
...
...
@@ -1253,5 +1254,108 @@ group by s.StuId";
WHERE Group_Id =
{
group_Id
}
and `Status` =0 and IsSureConsultTime =1 and CreateTime>='
{
sDate
}
' and CreateTime <='
{
eDate
}
23:59:59' GROUP BY CreateBy"
;
return
Get
<
RB_Student_ViewModel
>(
sql
).
ToList
();
}
/// <summary>
/// 获取学生分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Student_ViewModel
>
GetStudentMonthPageListRepository
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Student_ViewModel
query
)
{
var
parameters
=
new
DynamicParameters
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT t.StuId, t.StuName, t.StuTel, t.StuIcon, t.StuSex, t.StuBirth, t.Group_Id, t.School_Id, t.Status, t.CreateBy, t.IsDisable, t.StuStatus, t.Interest, t.JapanBaseInfo,t. CustomerId,t. StuProfession, t.StuEducation, t.StuPurpose, t.StuSource, t.StuAddress, t.StuContract, t.StuContractMobile, t.StuIDCard, t.StuIDCardAddress,t. CreateType, t.StuStage, t.StuChannel,t. PlatformName, t.StuSourceId,t. QQ, t.WeChatNo, t.StuType,t. StuNeeds, t.StuRealMobile, t.ConsultDate, t.PlanPrice, t.BaseCondition,t. DemandPoint, t.ResistPoint,t. ConsultingResults, t.FirstEnrollDate, t.AdvisorStatus, t.AdvisorWinRate,t. AdvisorExpectDate, t.FileVoucher, t.IsSureConsultTime,g.GroupName,s.SName,IFNULL(a.Account,'') AS StudentAccount ,c.CustomerName,IFNULL(B.Name,'') AS AdvisorStatusName,cou.CourseName,o.PreferPrice as OrderIncome,o.Refund,o.CreateTime
FROM rb_order as o LEFT JOIN rb_order_guest as og on og.OrderId=o.OrderId
left JOIN rb_student_orderguest as sog on og.Id=sog.GuestId
left JOIN rb_student AS t on t.StuId=sog.Student_Id
LEFT JOIN rb_group AS g ON t.Group_Id=g.GId
LEFT JOIN rb_school AS s ON t.School_Id=s.SId
LEFT JOIN rb_customer c on (c.CustomerId = t.StuSourceId AND t.CreateType=2)
LEFT JOIN rb_account as a ON (t.StuId=a.AccountId AND a.AccountType=4 )
LEFT JOIN rb_student_advisorconfig AS b ON t.AdvisorStatus=B.Id
LEFT JOIN rb_course as cou on o.CourseId=cou.CourseId where 1=1
"
);
if
(
query
!=
null
)
{
if
(
query
.
Group_Id
>
0
)
{
builder
.
AppendFormat
(
" AND t.{0}={1} "
,
nameof
(
RB_Student_ViewModel
.
Group_Id
),
query
.
Group_Id
);
}
if
(
query
.
School_Id
>
0
)
{
builder
.
AppendFormat
(
" AND t.{0}={1} "
,
nameof
(
RB_Student_ViewModel
.
School_Id
),
query
.
School_Id
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
StartTime
))
{
builder
.
AppendFormat
(
" AND o.CreateTime>='{0}' "
,
query
.
StartTime
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
EndTime
))
{
builder
.
AppendFormat
(
" AND o.CreateTime<='{0} 23:59:59' "
,
query
.
EndTime
);
}
}
builder
.
AppendFormat
(
" ORDER BY o.CreateTime asc "
);
return
GetPage
<
RB_Student_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
(),
parameters
).
ToList
();
}
/// <summary>
/// 获取学生分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Student_ViewModel
>
GetStudentMonthListRepository
(
RB_Student_ViewModel
query
)
{
var
parameters
=
new
DynamicParameters
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT t.StuId, t.StuName, t.StuTel, t.StuIcon, t.StuSex, t.StuBirth, t.Group_Id, t.School_Id, t.Status, t.CreateBy, t.IsDisable, t.StuStatus, t.Interest, t.JapanBaseInfo,t. CustomerId,t. StuProfession, t.StuEducation, t.StuPurpose, t.StuSource, t.StuAddress, t.StuContract, t.StuContractMobile, t.StuIDCard, t.StuIDCardAddress,t. CreateType, t.StuStage, t.StuChannel,t. PlatformName, t.StuSourceId,t. QQ, t.WeChatNo, t.StuType,t. StuNeeds, t.StuRealMobile, t.ConsultDate, t.PlanPrice, t.BaseCondition,t. DemandPoint, t.ResistPoint,t. ConsultingResults, t.FirstEnrollDate, t.AdvisorStatus, t.AdvisorWinRate,t. AdvisorExpectDate, t.FileVoucher, t.IsSureConsultTime,g.GroupName,s.SName,IFNULL(a.Account,'') AS StudentAccount ,c.CustomerName,IFNULL(B.Name,'') AS AdvisorStatusName,cou.CourseName,o.PreferPrice as OrderIncome,o.Refund,o.CreateTime
FROM rb_order as o LEFT JOIN rb_order_guest as og on og.OrderId=o.OrderId
left JOIN rb_student_orderguest as sog on og.Id=sog.GuestId
left JOIN rb_student AS t on t.StuId=sog.Student_Id
LEFT JOIN rb_group AS g ON t.Group_Id=g.GId
LEFT JOIN rb_school AS s ON t.School_Id=s.SId
LEFT JOIN rb_customer c on (c.CustomerId = t.StuSourceId AND t.CreateType=2)
LEFT JOIN rb_account as a ON (t.StuId=a.AccountId AND a.AccountType=4 )
LEFT JOIN rb_student_advisorconfig AS b ON t.AdvisorStatus=B.Id
LEFT JOIN rb_course as cou on o.CourseId=cou.CourseId where 1=1
"
);
if
(
query
!=
null
)
{
if
(
query
.
Group_Id
>
0
)
{
builder
.
AppendFormat
(
" AND t.{0}={1} "
,
nameof
(
RB_Student_ViewModel
.
Group_Id
),
query
.
Group_Id
);
}
if
(
query
.
School_Id
>
0
)
{
builder
.
AppendFormat
(
" AND t.{0}={1} "
,
nameof
(
RB_Student_ViewModel
.
School_Id
),
query
.
School_Id
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
StartTime
))
{
builder
.
AppendFormat
(
" AND o.CreateTime>='{0}' "
,
query
.
StartTime
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
EndTime
))
{
builder
.
AppendFormat
(
" AND o.CreateTime<='{0} 23:59:59' "
,
query
.
EndTime
);
}
}
builder
.
AppendFormat
(
" ORDER BY o.CreateTime asc "
);
return
Get
<
RB_Student_ViewModel
>(
builder
.
ToString
(),
parameters
).
ToList
();
}
}
}
\ No newline at end of file
Edu.WebApi/Controllers/User/StudentStatController.cs
View file @
1e506e3f
...
...
@@ -37,6 +37,13 @@ namespace Edu.WebApi.Controllers.User
/// </summary>
private
readonly
StudentStatModule
studentStatModule
=
new
StudentStatModule
();
/// <summary>
/// 学员统计
/// </summary>
private
readonly
StudentModule
studentModule
=
new
StudentModule
();
/// <summary>
/// 员工处理类
/// </summary>
...
...
@@ -145,7 +152,7 @@ namespace Edu.WebApi.Controllers.User
// demodel.HeadTeacherIds = teacherStr;
//}
}
var
list
=
studentStatModule
.
GetStudentFollowUpPageModule
(
pmodel
.
PageIndex
,
pmodel
.
PageSize
,
out
long
count
,
demodel
);
var
list
=
studentStatModule
.
GetStudentFollowUpPageModule
(
pmodel
.
PageIndex
,
pmodel
.
PageSize
,
out
long
count
,
demodel
);
pmodel
.
Count
=
count
;
pmodel
.
PageData
=
list
;
return
ApiResult
.
Success
(
""
,
pmodel
);
...
...
@@ -274,7 +281,7 @@ namespace Edu.WebApi.Controllers.User
header
.
ExcelRows
.
Add
(
new
ExcelColumn
(
"结课时间"
)
{
CellWidth
=
15
,
Rowspan
=
2
});
header
.
ExcelRows
.
Add
(
new
ExcelColumn
(
"当前级别"
)
{
CellWidth
=
15
,
Rowspan
=
2
});
header
.
ExcelRows
.
Add
(
new
ExcelColumn
(
"生日"
)
{
CellWidth
=
15
,
Rowspan
=
2
});
if
(
QueryTpye
!=
2
)
if
(
QueryTpye
!=
2
)
{
header
.
ExcelRows
.
Add
(
new
ExcelColumn
(
"客户来源"
)
{
CellWidth
=
15
,
Rowspan
=
2
});
}
...
...
@@ -1122,8 +1129,8 @@ namespace Edu.WebApi.Controllers.User
{
new
ExcelColumn
(
item
.
ItemName
)
};
columns
.
Add
(
new
ExcelColumn
(
item
.
FirstYear
.
ToString
()
+
"%"
));
columns
.
Add
(
new
ExcelColumn
(
item
.
SecondYear
.
ToString
()
+
"%"
));
columns
.
Add
(
new
ExcelColumn
(
item
.
FirstYear
.
ToString
()
+
"%"
));
columns
.
Add
(
new
ExcelColumn
(
item
.
SecondYear
.
ToString
()
+
"%"
));
columns
.
Add
(
new
ExcelColumn
(
item
.
YearRate
+
"%"
));
var
dataRow
=
new
ExcelDataSource
()
{
...
...
@@ -1600,8 +1607,8 @@ namespace Edu.WebApi.Controllers.User
{
new
ExcelColumn
(
item
.
ItemName
)
};
columns
.
Add
(
new
ExcelColumn
(
item
.
FirstYear
.
ToString
()
+
"%"
));
columns
.
Add
(
new
ExcelColumn
(
item
.
SecondYear
.
ToString
()
+
"%"
));
columns
.
Add
(
new
ExcelColumn
(
item
.
FirstYear
.
ToString
()
+
"%"
));
columns
.
Add
(
new
ExcelColumn
(
item
.
SecondYear
.
ToString
()
+
"%"
));
columns
.
Add
(
new
ExcelColumn
(
item
.
YearRate
+
"%"
));
var
dataRow
=
new
ExcelDataSource
()
{
...
...
@@ -2167,5 +2174,178 @@ namespace Edu.WebApi.Controllers.User
return
ApiResult
.
Success
();
}
#
endregion
#
region
已报名学员
/// <summary>
/// 获取学生分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetStudentMonthPageList
()
{
var
pageModel
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
query
=
new
RB_Student_ViewModel
()
{
StartTime
=
base
.
ParmJObj
.
GetStringValue
(
"StartTime"
),
EndTime
=
base
.
ParmJObj
.
GetStringValue
(
"EndTime"
),
};
query
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
var
data
=
studentModule
.
GetStudentMonthPageListModule
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
List
<
object
>
list
=
new
List
<
object
>();
foreach
(
var
item
in
data
)
{
if
(
item
.
CreateBy
>
0
)
{
item
.
CreateByName
=
UserReidsCache
.
GetUserLoginInfo
(
item
.
CreateBy
)?.
AccountName
??
""
;
}
list
.
Add
(
new
{
CreateTimeStr
=
Common
.
ConvertHelper
.
FormatTime
(
item
.
CreateTime
),
item
.
StuName
,
item
.
StuId
,
item
.
StuEducation
,
StuEducationName
=
item
.
StuEducation
.
ToName
(),
item
.
StuStage
,
item
.
StuStageName
,
item
.
StuProfession
,
//职业
item
.
StuPurpose
,
item
.
StuPurposeName
,
item
.
StuSourceId
,
item
.
StuSourceIdName
,
item
.
StuChannel
,
item
.
StuChannelName
,
item
.
PlatformName
,
item
.
CreateType
,
CreateTypeStr
=
item
.
CreateType
.
ToName
(),
item
.
CustomerId
,
item
.
CustomerName
,
item
.
JapanBaseInfo
,
JapanBaseInfoName
=
item
.
JapanBaseInfo
.
ToName
(),
item
.
StuType
,
item
.
StuTypeName
,
item
.
AdvisorStatus
,
item
.
AdvisorStatusName
,
item
.
OrderIncome
,
item
.
Refund
,
item
.
CourseName
,
//StuSexStr = item.StuSex == 0 ? "男" : "女",
//item.CreateBy,
//item.CreateByName,
//AssistList = item.AssistList.Select(qitem => new
//{
// qitem.Id,
// qitem.StuId,
// qitem.AssistId,
// qitem.AssistName,
// qitem.AssistType,
// AssistTypeName = qitem.AssistType.ToName()
//}),
//item.VisitCount,
//item.TrialLessonCount,
//item.QQ,
//item.WeChatNo,
//item.StuNeeds,
//item.StuNeedsName,
//item.StuRealMobile,
//item.OrderCount,
//item.RenewOrderCount,
//item.EnterpriseName,
//item.AdvisorExpectDate,
//
//item.AdvisorList,
//item.AdvisorWinRate,
//item.FileVoucher,
//item.IsSureConsultTime
});
}
pageModel
.
Count
=
rowsCount
;
pageModel
.
PageData
=
list
;
return
ApiResult
.
Success
(
data
:
pageModel
);
}
/// <summary>
/// 获取学生分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetStudentMonthList
()
{
var
query
=
new
RB_Student_ViewModel
()
{
StartTime
=
base
.
ParmJObj
.
GetStringValue
(
"StartTime"
),
EndTime
=
base
.
ParmJObj
.
GetStringValue
(
"EndTime"
),
};
query
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
var
data
=
studentModule
.
GetStudentMonthListModule
(
query
);
List
<
object
>
list
=
new
List
<
object
>();
foreach
(
var
item
in
data
)
{
if
(
item
.
CreateBy
>
0
)
{
item
.
CreateByName
=
UserReidsCache
.
GetUserLoginInfo
(
item
.
CreateBy
)?.
AccountName
??
""
;
}
list
.
Add
(
new
{
CreateTimeStr
=
Common
.
ConvertHelper
.
FormatTime
(
item
.
CreateTime
),
item
.
StuName
,
item
.
StuId
,
item
.
StuEducation
,
StuEducationName
=
item
.
StuEducation
.
ToName
(),
item
.
StuStage
,
item
.
StuStageName
,
item
.
StuProfession
,
//职业
item
.
StuPurpose
,
item
.
StuPurposeName
,
item
.
StuSourceId
,
item
.
StuSourceIdName
,
item
.
StuChannel
,
item
.
StuChannelName
,
item
.
PlatformName
,
item
.
CreateType
,
CreateTypeStr
=
item
.
CreateType
.
ToName
(),
item
.
CustomerId
,
item
.
CustomerName
,
item
.
JapanBaseInfo
,
JapanBaseInfoName
=
item
.
JapanBaseInfo
.
ToName
(),
item
.
StuType
,
item
.
StuTypeName
,
item
.
AdvisorStatus
,
item
.
AdvisorStatusName
,
item
.
OrderIncome
,
item
.
Refund
,
item
.
CourseName
,
});
}
var
statisticsInfo
=
new
object
();
decimal
totalPrice
=
data
.
Sum
(
x
=>
x
.
OrderIncome
-
x
.
Refund
);
decimal
totalPriceShang
=
data
.
Where
(
x
=>
x
.
CreateTime
.
Day
<=
10
).
Sum
(
x
=>
x
.
OrderIncome
-
x
.
Refund
);
decimal
totalPriceZhong
=
data
.
Where
(
x
=>
x
.
CreateTime
.
Day
>
10
&&
x
.
CreateTime
.
Day
<=
20
).
Sum
(
x
=>
x
.
OrderIncome
-
x
.
Refund
);
decimal
totalPriceXia
=
data
.
Where
(
x
=>
x
.
CreateTime
.
Day
>
20
).
Sum
(
x
=>
x
.
OrderIncome
-
x
.
Refund
);
var
sourceList
=
new
List
<
object
>();
foreach
(
var
item
in
data
.
GroupBy
(
x
=>
new
{
x
.
CreateType
,
x
.
StuSource
}))
{
var
nowData
=
data
.
Where
(
x
=>
x
.
StuSource
==
item
.
Key
.
StuSource
&&
x
.
CreateType
==
item
.
Key
.
CreateType
).
ToList
();
decimal
nowTotalPrice
=
nowData
.
Sum
(
x
=>
x
.
OrderIncome
-
x
.
Refund
);
sourceList
.
Add
(
new
{
OrderNum
=
nowData
.
Count
(),
TotalPrice
=
nowTotalPrice
,
PriceRate
=
Math
.
Round
((
nowTotalPrice
/
totalPrice
),
2
),
item
.
Key
.
CreateType
,
CreateTypeStr
=
item
.
Key
.
CreateType
.
ToName
(),
StuSourceStr
=
item
.
Key
.
StuSource
.
ToName
(),
item
.
Key
.
StuSource
});
}
return
ApiResult
.
Success
(
data
:
new
{
list
,
totalPrice
,
totalPriceShang
,
totalPriceZhong
,
totalPriceXia
,
sourceList
});
}
#
endregion
}
}
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