Commit fd85c417 authored by 黄奎's avatar 黄奎

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents eddb9dc3 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>
/// 客户需求名称
......
......@@ -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;
}
}
}
......@@ -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);
}
}
......@@ -594,8 +595,8 @@ GROUP BY GuestId";
//内部介绍=>直接修改内部介绍人为学员创建人【HK2023-06-15调整为不改变原创建人员】
else if (model.CreateType == StuCreateTypeEnum.InternalIntroduction)
{
//创建人不变
// model.CreateBy = model.StuSourceId;
//创建人不变
// model.CreateBy = model.StuSourceId;
}
model.StuTel = Common.Plugin.StringHelper.ReplaceMobile(model.StuRealMobile);
......@@ -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
......@@ -36,7 +36,14 @@ namespace Edu.WebApi.Controllers.User
/// 学员统计
/// </summary>
private readonly StudentStatModule studentStatModule = new StudentStatModule();
/// <summary>
/// 学员统计
/// </summary>
private readonly StudentModule studentModule = new StudentModule();
/// <summary>
/// 员工处理类
/// </summary>
......@@ -88,7 +95,7 @@ namespace Edu.WebApi.Controllers.User
demodel.CreateIds = Common.Plugin.JsonHelper.DeserializeObject<List<int>>(CreateIds);
}
demodel.Group_Id = userInfo.Group_Id;
//市场部
if (demodel.QueryTpye == 3)
{
......@@ -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,11 +281,11 @@ 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 });
}
header.ExcelRows.Add(new ExcelColumn("学习目的") { CellWidth = 15, Rowspan = 2 });
if (QueryTpye != 2)
{
......@@ -314,7 +321,7 @@ namespace Edu.WebApi.Controllers.User
if (QueryTpye != 2)
{
subHeader.ExcelRows.Add(new ExcelColumn());
subHeader.ExcelRows.Add(new ExcelColumn());
subHeader.ExcelRows.Add(new ExcelColumn());
subHeader.ExcelRows.Add(new ExcelColumn());
subHeader.ExcelRows.Add(new ExcelColumn());
subHeader.ExcelRows.Add(new ExcelColumn());
......@@ -388,7 +395,7 @@ namespace Edu.WebApi.Controllers.User
columns.Add(new ExcelColumn(item.AdvisorExpectDate));
columns.Add(new ExcelColumn(item.AdvisorStatusName));
columns.Add(new ExcelColumn(item.AdvisorWinRate + "%"));
string tempStr = "";
if (item.AdvisorList != null && item.AdvisorList.Count > 0)
{
......@@ -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()
{
......@@ -1144,7 +1151,7 @@ namespace Edu.WebApi.Controllers.User
#endregion
#region 市场部客户数据统计
/// <summary>
/// 市场部客户数据每日统计
/// </summary>
......@@ -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()
{
......@@ -2164,8 +2171,181 @@ namespace Edu.WebApi.Controllers.User
{
studentStatModule.CalcStudentNotMoneyModule();
});
return ApiResult.Success();
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);
}
#endregion
/// <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
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment