using Edu.Model.CacheModel; using Edu.Model.ViewModel.User; using Edu.Model.ViewModel.WeChat; using Edu.Repository.User; using System; using System.Collections.Generic; using System.Linq; namespace Edu.Module.User { /// <summary> /// 教师数据统计处理类 /// </summary> public class TeacherStaticModule { /// <summary> /// 教师教学行为统计表仓储层对象 /// </summary> private readonly RB_Teacher_StaticRepository teacher_StaticRepository = new RB_Teacher_StaticRepository(); /// <summary> /// 员工信息仓储层对象 /// </summary> private readonly RB_AccountRepository accountRepository = new RB_AccountRepository(); /// <summary> /// 教师行为数据数据每日统计 /// </summary> /// <param name="query"></param> /// <returns></returns> public List<object> GetTeacherStaticListModule(RB_Teacher_Static_Extend query) { var teacherList = new List<RB_Account_ViewModel>(); var queryTeacher = new RB_Account_ViewModel() { AccountType = Common.Enum.User.AccountTypeEnum.Teacher, IsSelectLevelNor = 1 }; if (query.DeptId > 0) { queryTeacher.Dept_Id = query.DeptId; teacherList = accountRepository.GetAccountListExtRepository(queryTeacher); query.QTeacherIds = string.Join(",", teacherList.Select(qitem => qitem.AccountId)); } else { teacherList = accountRepository.GetAccountListExtRepository(queryTeacher); query.QTeacherIds = ""; } int teacherCount = 1; if (teacherList != null && teacherList.Where(qitem => qitem.AccountId != 5 && qitem.AccountId != 10 && qitem.AccountId != 15 && qitem.AccountId != 20).ToList().Count > 0) { teacherCount = teacherList.Where(qitem => qitem.AccountId != 5 && qitem.AccountId != 10 && qitem.AccountId != 15 && qitem.AccountId != 20).Count(); } List<object> dataList = new List<object>(); var list = teacher_StaticRepository.GetTeacherStaticListRepository(query); if (list != null && list.Count > 0) { int index = 0; var firstModel = new RB_Teacher_Static_Extend(); foreach (var item in list) { string DateStr = Common.ConvertHelper.FormatMonthDay(item.Date); object subObj = new object(); if (string.IsNullOrEmpty(DateStr)) { if (index == 0) { DateStr = "上期总数"; } else { DateStr = "总数"; } if (index > 0) { decimal StudentCount = 0; if (firstModel.StudentCount > 0) { StudentCount = (item.StudentCount - firstModel.StudentCount) / firstModel.StudentCount * 100; } decimal AttendClassHour = 0; if (firstModel.AttendClassHour > 0) { AttendClassHour = (item.AttendClassHour - firstModel.AttendClassHour) / firstModel.AttendClassHour * 100; } decimal AttendClassHourScore = 0; if (firstModel.AttendClassHourScore > 0) { AttendClassHourScore = (item.AttendClassHourScore - firstModel.AttendClassHourScore) / firstModel.AttendClassHourScore * 100; } decimal OnLineInteractive = 0; if (firstModel.OnLineInteractive > 0) { OnLineInteractive = (item.OnLineInteractive - firstModel.OnLineInteractive) / firstModel.OnLineInteractive * 100; } decimal OnLineInteractiveScore = 0; if (firstModel.OnLineInteractiveScore > 0) { OnLineInteractiveScore = (item.OnLineInteractiveScore - firstModel.OnLineInteractiveScore) / firstModel.OnLineInteractiveScore * 100; } decimal Renew = 0; if (firstModel.Renew > 0) { Renew = (item.Renew - firstModel.Renew) / firstModel.Renew * 100; } decimal RenewScore = 0; if (firstModel.RenewScore > 0) { RenewScore = (item.RenewScore - firstModel.RenewScore) / firstModel.RenewScore * 100; } decimal Upgrade = 0; if (firstModel.Upgrade > 0) { Upgrade = (item.Upgrade - firstModel.Upgrade) / firstModel.Upgrade * 100; } decimal UpgradeScore = 0; if (firstModel.UpgradeScore > 0) { UpgradeScore = (item.UpgradeScore - firstModel.UpgradeScore) / firstModel.UpgradeScore * 100; } decimal Trans = 0; if (firstModel.Trans > 0) { Trans = (item.Trans - firstModel.Trans) / firstModel.Trans * 100; } decimal TransScore = 0; if (firstModel.TransScore > 0) { TransScore = (item.TransScore - firstModel.TransScore) / firstModel.TransScore * 100; } decimal TrialSpeak = 0; if (firstModel.TrialSpeak > 0) { TrialSpeak = (item.TrialSpeak - firstModel.TrialSpeak) / firstModel.TrialSpeak * 100; } decimal TrialSpeakScore = 0; if (firstModel.TrialSpeakScore > 0) { TrialSpeakScore = (item.TrialSpeakScore - firstModel.TrialSpeakScore) / firstModel.TrialSpeakScore * 100; } decimal Truancy = 0; if (firstModel.Truancy > 0) { Truancy = (item.Truancy - firstModel.Truancy) / firstModel.Truancy * 100; } decimal TruancyScore = 0; if (firstModel.TruancyScore > 0) { TruancyScore = (item.TruancyScore - firstModel.TruancyScore) / firstModel.TruancyScore * 100; } decimal Withdraws = 0; if (firstModel.Withdraws > 0) { Withdraws = (item.Withdraws - firstModel.Withdraws) / firstModel.Withdraws * 100; } decimal WithdrawsScore = 0; if (firstModel.WithdrawsScore > 0) { WithdrawsScore = (item.WithdrawsScore - firstModel.WithdrawsScore) / firstModel.WithdrawsScore * 100; } decimal Complaint = 0; if (firstModel.Complaint > 0) { Complaint = (item.Complaint - firstModel.Complaint) / firstModel.Complaint * 100; } decimal ComplaintScore = 0; if (firstModel.ComplaintScore > 0) { ComplaintScore = (item.ComplaintScore - firstModel.ComplaintScore) / firstModel.ComplaintScore * 100; } decimal TeacherBeLate = 0; if (firstModel.TeacherBeLate > 0) { TeacherBeLate = (item.TeacherBeLate - firstModel.TeacherBeLate) / firstModel.TeacherBeLate * 100; } decimal TeacherBeLateScore = 0; if (firstModel.TeacherBeLateScore > 0) { TeacherBeLateScore = (item.TeacherBeLateScore - firstModel.TeacherBeLateScore) / firstModel.TeacherBeLateScore * 100; } decimal N5ClassHours = 0; if (firstModel.N5ClassHours > 0) { N5ClassHours = (item.N5ClassHours - firstModel.N5ClassHours) / firstModel.N5ClassHours * 100; } decimal N5ClassHoursScore = 0; if (firstModel.N5ClassHoursScore > 0) { N5ClassHoursScore = (item.N5ClassHoursScore - firstModel.N5ClassHoursScore) / firstModel.N5ClassHoursScore * 100; } decimal N4ClassHours = 0; if (firstModel.N4ClassHours > 0) { N4ClassHours = (item.N4ClassHours - firstModel.N4ClassHours) / firstModel.N4ClassHours * 100; } decimal N4ClassHoursScore = 0; if (firstModel.N4ClassHoursScore > 0) { N4ClassHoursScore = (item.N4ClassHoursScore - firstModel.N4ClassHoursScore) / firstModel.N4ClassHoursScore * 100; } decimal N3ClassHours = 0; if (firstModel.N3ClassHours > 0) { N3ClassHours = (item.N3ClassHours - firstModel.N3ClassHours) / firstModel.N3ClassHours * 100; } decimal N3ClassHoursScore = 0; if (firstModel.N3ClassHoursScore > 0) { N3ClassHoursScore = (item.N3ClassHoursScore - firstModel.N3ClassHoursScore) / firstModel.N3ClassHoursScore * 100; } decimal N2ClassHours = 0; if (firstModel.N2ClassHours > 0) { N2ClassHours = (item.N2ClassHours - firstModel.N2ClassHours) / firstModel.N2ClassHours * 100; } decimal N2ClassHoursScore = 0; if (firstModel.N2ClassHoursScore > 0) { N2ClassHoursScore = (item.N2ClassHoursScore - firstModel.N2ClassHoursScore) / firstModel.N2ClassHoursScore * 100; } decimal N1ClassHours = 0; if (firstModel.N1ClassHours > 0) { N1ClassHours = (item.N1ClassHours - firstModel.N1ClassHours) / firstModel.N1ClassHours * 100; } decimal N1ClassHoursScore = 0; if (firstModel.N1ClassHoursScore > 0) { N1ClassHoursScore = (item.N1ClassHoursScore - firstModel.N1ClassHoursScore) / firstModel.N1ClassHoursScore * 100; } decimal MiniAppPractise = 0; if (firstModel.MiniAppPractise > 0) { MiniAppPractise = (item.MiniAppPractise - firstModel.MiniAppPractise) / firstModel.MiniAppPractise * 100; } decimal MiniAppPractiseScore = 0; if (firstModel.MiniAppPractiseScore > 0) { MiniAppPractiseScore = (item.MiniAppPractiseScore - firstModel.MiniAppPractiseScore) / firstModel.MiniAppPractiseScore * 100; } decimal MiniAppTime = 0; if (firstModel.MiniAppTime > 0) { MiniAppTime = (item.MiniAppTime - firstModel.MiniAppTime) / firstModel.MiniAppTime * 100; } decimal MiniAppTimeScore = 0; if (firstModel.MiniAppTimeScore > 0) { MiniAppTimeScore = (item.MiniAppTimeScore - firstModel.MiniAppTimeScore) / firstModel.MiniAppTimeScore * 100; } decimal ActivityNum = 0; if (firstModel.ActivityNum > 0) { ActivityNum = (item.ActivityNum - firstModel.ActivityNum) / firstModel.ActivityNum * 100; } decimal TotalScore = 0; if (firstModel.TotalScore > 0) { TotalScore = (item.TotalScore - firstModel.TotalScore) / firstModel.TotalScore * 100; } decimal AvgScore = 0; if (firstModel.AvgScore > 0) { AvgScore = (item.AvgScore - firstModel.AvgScore) / firstModel.AvgScore * 100; } decimal ScoreGap = 0; if (firstModel.ScoreGap > 0) { ScoreGap = (item.ScoreGap - firstModel.ScoreGap) / firstModel.ScoreGap * 100; } subObj = new { Id = 0, DateStr = "环比成长", StudentCount = Math.Round(StudentCount, 2) + "%", AttendClassHour = Math.Round(AttendClassHour, 2) + "%", AttendClassHourScore = Math.Round(AttendClassHourScore, 2) + "%", OnLineInteractive = Math.Round(OnLineInteractive, 2) + "%", OnLineInteractiveScore = Math.Round(OnLineInteractiveScore, 2) + "%", Renew = Math.Round(Renew, 2) + "%", RenewScore = Math.Round(RenewScore, 2) + "%", Upgrade = Math.Round(Upgrade, 2) + "%", UpgradeScore = Math.Round(UpgradeScore, 2) + "%", Trans = Math.Round(Trans, 2) + "%", TransScore = Math.Round(TransScore, 2) + "%", TrialSpeak = Math.Round(TrialSpeak, 2) + "%", TrialSpeakScore = Math.Round(TrialSpeakScore, 2) + "%", Truancy = Math.Round(Truancy, 2) + "%", TruancyScore = Math.Round(TruancyScore, 2) + "%", Withdraws = Math.Round(Withdraws, 2) + "%", WithdrawsScore = Math.Round(WithdrawsScore, 2) + "%", Complaint = Math.Round(Complaint, 2) + "%", ComplaintScore = Math.Round(ComplaintScore, 2) + "%", TeacherBeLate = Math.Round(TeacherBeLate, 2) + "%", TeacherBeLateScore = Math.Round(TeacherBeLateScore, 2) + "%", N5ClassHours = Math.Round(N5ClassHours, 2) + "%", N5ClassHoursScore = Math.Round(N5ClassHoursScore, 2) + "%", N4ClassHours = Math.Round(N4ClassHours, 2) + "%", N4ClassHoursScore = Math.Round(N4ClassHoursScore, 2) + "%", N3ClassHours = Math.Round(N3ClassHours, 2) + "%", N3ClassHoursScore = Math.Round(N3ClassHoursScore, 2) + "%", N2ClassHours = Math.Round(N2ClassHours, 2) + "%", N2ClassHoursScore = Math.Round(N2ClassHoursScore, 2) + "%", N1ClassHours = Math.Round(N1ClassHours, 2) + "%", N1ClassHoursScore = Math.Round(N1ClassHoursScore, 2) + "%", MiniAppPractise = Math.Round(MiniAppPractise, 2) + "%", MiniAppPractiseScore = Math.Round(MiniAppPractiseScore, 2) + "%", MiniAppTime = Math.Round(MiniAppTime, 2) + "%", MiniAppTimeScore = Math.Round(MiniAppTimeScore, 2) + "%", TotalScore = Math.Round(TotalScore, 2) + "%", AvgScore = Math.Round(AvgScore, 2) + "%", ScoreGap = Math.Round(ScoreGap, 2) + "%", ActivityNum = Math.Round(ActivityNum, 2) + "%", }; } firstModel = item; firstModel.TotalScore = (firstModel.StudentCount + firstModel.AttendClassHourScore + firstModel.OnLineInteractiveScore + firstModel.RenewScore + firstModel.UpgradeScore + firstModel.TransScore + firstModel.TrialSpeakScore - firstModel.TruancyScore - firstModel.WithdrawsScore - firstModel.ComplaintScore - firstModel.TeacherBeLateScore + firstModel.N5ClassHoursScore*1+firstModel.N4ClassHoursScore*2+firstModel.N3ClassHoursScore*3+ firstModel.N2ClassHoursScore*4 + firstModel.N1ClassHoursScore*5 + firstModel.MiniAppPractiseScore + firstModel.MiniAppTimeScore + firstModel.ActivityNum ); firstModel.AvgScore = Math.Round(firstModel.TotalScore / teacherCount, 2); firstModel.ScoreGap = firstModel.TotalScore - firstModel.AvgScore; index++; } item.TotalScore = (item.StudentCount + item.AttendClassHourScore + item.OnLineInteractiveScore + item.RenewScore + item.UpgradeScore + item.TransScore + item.TrialSpeakScore - item.TruancyScore - item.WithdrawsScore - item.ComplaintScore - item.TeacherBeLateScore + item.N5ClassHoursScore * 1 + item.N4ClassHoursScore * 2 + item.N3ClassHoursScore * 3 + item.N2ClassHoursScore * 4 + item.N1ClassHoursScore * 5 + item.MiniAppPractiseScore + item.MiniAppTimeScore + item.ActivityNum ); item.AvgScore = Math.Round(item.TotalScore / teacherCount, 2); item.ScoreGap = item.TotalScore - item.AvgScore; dataList.Add(new { item.Id, DateStr, item.StudentCount, item.AttendClassHour, item.AttendClassHourScore, item.OnLineInteractive, item.OnLineInteractiveScore, item.Renew, item.RenewScore, item.Upgrade, item.UpgradeScore, item.Trans, item.TransScore, item.TrialSpeak, item.TrialSpeakScore, item.Truancy, item.TruancyScore, item.Withdraws, item.WithdrawsScore, item.Complaint, item.ComplaintScore, item.TeacherBeLate, item.TeacherBeLateScore, item.N5ClassHours, item.N5ClassHoursScore, item.N4ClassHours, item.N4ClassHoursScore, item.N3ClassHours, item.N3ClassHoursScore, item.N2ClassHours, item.N2ClassHoursScore, item.N1ClassHours, item.N1ClassHoursScore, item.MiniAppPractise, item.MiniAppPractiseScore, item.MiniAppTime, item.MiniAppTimeScore, item.TotalScore, item.AvgScore, item.ScoreGap, item.ActivityNum, }); if (DateStr.Contains("总数") && index > 1) { dataList.Add(subObj); } } var tempList = list?.Where(qitem => !string.IsNullOrEmpty(Common.ConvertHelper.FormatDate(qitem.Date)))?.ToList(); dataList.Add(new { Id = 0, DateStr = "月总数", StudentCount = tempList?.Sum(qitem => qitem.StudentCount), AttendClassHour = tempList?.Sum(qitem => qitem.AttendClassHour), AttendClassHourScore = tempList?.Sum(qitem => qitem.AttendClassHourScore), OnLineInteractive = tempList?.Sum(qitem => qitem.OnLineInteractive), OnLineInteractiveScore = tempList?.Sum(qitem => qitem.OnLineInteractiveScore), Renew = tempList?.Sum(qitem => qitem.Renew), RenewScore = tempList?.Sum(qitem => qitem.RenewScore), Upgrade = tempList?.Sum(qitem => qitem.Upgrade), UpgradeScore = tempList?.Sum(qitem => qitem.UpgradeScore), Trans = tempList?.Sum(qitem => qitem.Trans), TransScore = tempList?.Sum(qitem => qitem.TransScore), TrialSpeak = tempList?.Sum(qitem => qitem.TrialSpeak), TrialSpeakScore = tempList?.Sum(qitem => qitem.TrialSpeakScore), Truancy = tempList?.Sum(qitem => qitem.Truancy), TruancyScore = tempList?.Sum(qitem => qitem.TruancyScore), Withdraws = tempList?.Sum(qitem => qitem.Withdraws), WithdrawsScore = tempList?.Sum(qitem => qitem.WithdrawsScore), Complaint = tempList?.Sum(qitem => qitem.Complaint), ComplaintScore = tempList?.Sum(qitem => qitem.ComplaintScore), TeacherBeLate = tempList?.Sum(qitem => qitem.TeacherBeLate), TeacherBeLateScore = tempList?.Sum(qitem => qitem.TeacherBeLateScore), N5ClassHours = tempList?.Sum(qitem => qitem.N5ClassHours), N5ClassHoursScore = tempList?.Sum(qitem => qitem.N5ClassHoursScore), N4ClassHours = tempList?.Sum(qitem => qitem.N4ClassHours), N4ClassHoursScore = tempList?.Sum(qitem => qitem.N4ClassHoursScore), N3ClassHours = tempList?.Sum(qitem => qitem.N3ClassHours), N3ClassHoursScore = tempList?.Sum(qitem => qitem.N3ClassHoursScore), N2ClassHours = tempList?.Sum(qitem => qitem.N2ClassHours), N2ClassHoursScore = tempList?.Sum(qitem => qitem.N2ClassHoursScore), N1ClassHours = tempList?.Sum(qitem => qitem.N1ClassHours), N1ClassHoursScore = tempList?.Sum(qitem => qitem.N1ClassHoursScore), MiniAppPractise = tempList?.Sum(qitem => qitem.MiniAppPractise), MiniAppPractiseScore = tempList?.Sum(qitem => qitem.MiniAppPractiseScore), MiniAppTime = tempList?.Sum(qitem => qitem.MiniAppTime), MiniAppTimeScore = tempList?.Sum(qitem => qitem.MiniAppTimeScore), TotalScore = tempList?.Sum(qitem => qitem.TotalScore), AvgScore = tempList?.Sum(qitem => qitem.AvgScore), ScoreGap = tempList?.Sum(qitem => qitem.ScoreGap), ActivityNum = tempList?.Sum(qitem => qitem.ActivityNum), }); } return dataList; } /// <summary> /// 教师行为月份统计 /// </summary> /// <param name="query"></param> /// <returns></returns> public List<object> GetTeacherStaticMonthExtListModule(RB_Teacher_Static_Extend query) { var teacherList = new List<RB_Account_ViewModel>(); var queryTeacher = new RB_Account_ViewModel() { AccountType = Common.Enum.User.AccountTypeEnum.Teacher, IsSelectLevelNor = 1 }; if (query.DeptId > 0) { queryTeacher.Dept_Id = query.DeptId; teacherList = accountRepository.GetAccountListExtRepository(queryTeacher); query.QTeacherIds = string.Join(",", teacherList.Select(qitem => qitem.AccountId)); } else { teacherList = accountRepository.GetAccountListExtRepository(queryTeacher); query.QTeacherIds = ""; } teacherList = teacherList.Where(qitem => qitem.AccountId != 5 && qitem.AccountId != 10 && qitem.AccountId != 15 && qitem.AccountId != 20).ToList(); List<object> dataList = new List<object>(); string qDate = ""; if (query.YearStr > 0) { qDate += query.YearStr + "-"; } else { qDate += DateTime.Now.Year + "-"; } if (query.MonthStr > 0) { qDate += query.MonthStr; } else { qDate += DateTime.Now.Month; } qDate += "-01"; //跟踪列表 var followList = teacher_StaticRepository.GetTeacherFollowByProcRepository(qDate); var list = teacher_StaticRepository.GetTeacherStaticMonthExtListRepository(query); if (list != null && list.Count > 0) { foreach (var item in list) { var tempFollow = followList.Where(qitem => qitem.TeacherId == item.TeacherId)?.FirstOrDefault(); item.TotalScore = (item.StudentCount + item.AttendClassHourScore + item.OnLineInteractiveScore + item.RenewScore + item.UpgradeScore + item.TransScore + item.TrialSpeakScore - item.TruancyScore - item.WithdrawsScore - item.ComplaintScore - item.TeacherBeLateScore + item.MiniAppPractiseScore + item.MiniAppTimeScore + item.N5ClassHoursScore * 1 + item.N4ClassHoursScore * 2 + item.N3ClassHoursScore * 3 + item.N2ClassHoursScore * 4 + item.N1ClassHoursScore * 5 + item.ActivityNum +(tempFollow?.FinishTimes ?? 0) ); } foreach (var item in list) { var tempFollow = followList.Where(qitem => qitem.TeacherId == item.TeacherId)?.FirstOrDefault(); int teacherCount = 1; var teacherModel = teacherList.FirstOrDefault(qitem => qitem.AccountId == item.TeacherId); string DateStr = ""; var tempDataList = new List<RB_Teacher_Static_Extend>(); if (teacherModel != null) { DateStr= teacherModel.AccountName; string teacherIds = string.Join(",", teacherList.Where(qitem => qitem.Dept_Id == teacherModel.Dept_Id).Select(qitem => qitem.AccountId)); teacherCount = list.Where(qitem => qitem.TotalScore>0 && teacherIds.Contains(item.TeacherId.ToString())).Count(); tempDataList = list.Where(qitem => teacherIds.Contains(item.TeacherId.ToString()))?.ToList(); } item.AvgScore = Math.Round((tempDataList?.Sum(qitem=>qitem.TotalScore)??0) / teacherCount, 2); item.ScoreGap = item.TotalScore - item.AvgScore; dataList.Add(new { item.Id, item.TeacherId, Dept_Id= teacherModel?.Dept_Id??0, DateStr, item.StudentCount, item.AttendClassHour, item.AttendClassHourScore, item.OnLineInteractive, item.OnLineInteractiveScore, item.Renew, item.RenewScore, item.Upgrade, item.UpgradeScore, item.Trans, item.TransScore, item.TrialSpeak, item.TrialSpeakScore, item.Truancy, item.TruancyScore, item.Withdraws, item.WithdrawsScore, item.Complaint, item.ComplaintScore, item.TeacherBeLate, item.TeacherBeLateScore, item.N5ClassHours, item.N5ClassHoursScore, item.N4ClassHours, item.N4ClassHoursScore, item.N3ClassHours, item.N3ClassHoursScore, item.N2ClassHours, item.N2ClassHoursScore, item.N1ClassHours, item.N1ClassHoursScore, item.MiniAppPractise, item.MiniAppPractiseScore, item.MiniAppTime, item.MiniAppTimeScore, item.TotalScore, item.AvgScore, item.ScoreGap, item.ActivityNum, FinishTimes= tempFollow?.FinishTimes??0, FollowCount = tempFollow?.FollowCount ?? 0, }); } var tempList = list?.Where(qitem => !string.IsNullOrEmpty(Common.ConvertHelper.FormatDate(qitem.Date)))?.ToList(); dataList.Add(new { Id = 0, TeacherId=0, Dept_Id=0, DateStr = "月总数", StudentCount = tempList?.Sum(qitem => qitem.StudentCount), AttendClassHour = tempList?.Sum(qitem => qitem.AttendClassHour), AttendClassHourScore = tempList?.Sum(qitem => qitem.AttendClassHourScore), OnLineInteractive = tempList?.Sum(qitem => qitem.OnLineInteractive), OnLineInteractiveScore = tempList?.Sum(qitem => qitem.OnLineInteractiveScore), Renew = tempList?.Sum(qitem => qitem.Renew), RenewScore = tempList?.Sum(qitem => qitem.RenewScore), Upgrade = tempList?.Sum(qitem => qitem.Upgrade), UpgradeScore = tempList?.Sum(qitem => qitem.UpgradeScore), Trans = tempList?.Sum(qitem => qitem.Trans), TransScore = tempList?.Sum(qitem => qitem.TransScore), TrialSpeak = tempList?.Sum(qitem => qitem.TrialSpeak), TrialSpeakScore = tempList?.Sum(qitem => qitem.TrialSpeakScore), Truancy = tempList?.Sum(qitem => qitem.Truancy), TruancyScore = tempList?.Sum(qitem => qitem.TruancyScore), Withdraws = tempList?.Sum(qitem => qitem.Withdraws), WithdrawsScore = tempList?.Sum(qitem => qitem.WithdrawsScore), Complaint = tempList?.Sum(qitem => qitem.Complaint), ComplaintScore = tempList?.Sum(qitem => qitem.ComplaintScore), TeacherBeLate = tempList?.Sum(qitem => qitem.TeacherBeLate), TeacherBeLateScore = tempList?.Sum(qitem => qitem.TeacherBeLateScore), N5ClassHours = tempList?.Sum(qitem => qitem.N5ClassHours), N5ClassHoursScore = tempList?.Sum(qitem => qitem.N5ClassHoursScore), N4ClassHours = tempList?.Sum(qitem => qitem.N4ClassHours), N4ClassHoursScore = tempList?.Sum(qitem => qitem.N4ClassHoursScore), N3ClassHours = tempList?.Sum(qitem => qitem.N3ClassHours), N3ClassHoursScore = tempList?.Sum(qitem => qitem.N3ClassHoursScore), N2ClassHours = tempList?.Sum(qitem => qitem.N2ClassHours), N2ClassHoursScore = tempList?.Sum(qitem => qitem.N2ClassHoursScore), N1ClassHours = tempList?.Sum(qitem => qitem.N1ClassHours), N1ClassHoursScore = tempList?.Sum(qitem => qitem.N1ClassHoursScore), MiniAppPractise = tempList?.Sum(qitem => qitem.MiniAppPractise), MiniAppPractiseScore = tempList?.Sum(qitem => qitem.MiniAppPractiseScore), MiniAppTime = tempList?.Sum(qitem => qitem.MiniAppTime), MiniAppTimeScore = tempList?.Sum(qitem => qitem.MiniAppTimeScore), TotalScore = tempList?.Sum(qitem => qitem.TotalScore), AvgScore = tempList?.Sum(qitem => qitem.AvgScore), ScoreGap = tempList?.Sum(qitem => qitem.ScoreGap), ActivityNum = tempList?.Sum(qitem => qitem.ActivityNum), FinishTimes = followList?.Sum(qitem => qitem.FinishTimes), FollowCount = followList?.Sum(qitem => qitem.FollowCount), }); } return dataList; } /// <summary> /// 教师行为数据月份统计 /// </summary> /// <param name="query"></param> /// <returns></returns> public List<object> GetTeacherStaticMonthModule(RB_Teacher_Static_Extend query) { List<object> dataList = new List<object>(); var list = teacher_StaticRepository.GetTeacherStaticMonthListRepository(query); List<RB_Teacher_Static_Extend> monthList = new List<RB_Teacher_Static_Extend>(); for (var i = 1; i <= 12; i++) { var tempData = list?.Where(qitem => qitem.Date.Month == i)?.FirstOrDefault(); var newData = new RB_Teacher_Static_Extend() { ShowMonthStr = i + "月", StudentCount = tempData?.StudentCount ?? 0, AttendClassHour = tempData?.AttendClassHour ?? 0, AttendClassHourScore = tempData?.AttendClassHourScore ?? 0, OnLineInteractive = tempData?.OnLineInteractive ?? 0, OnLineInteractiveScore = tempData?.OnLineInteractiveScore ?? 0, Renew = tempData?.Renew ?? 0, RenewScore = tempData?.RenewScore ?? 0, Upgrade = tempData?.Upgrade ?? 0, UpgradeScore = tempData?.UpgradeScore ?? 0, Trans = tempData?.Trans ?? 0, TransScore = tempData?.TransScore ?? 0, TrialSpeak = tempData?.TrialSpeak ?? 0, TrialSpeakScore = tempData?.TrialSpeakScore ?? 0, Truancy = tempData?.Truancy ?? 0, TruancyScore = tempData?.TruancyScore ?? 0, Withdraws = tempData?.Withdraws ?? 0, WithdrawsScore = tempData?.WithdrawsScore ?? 0, Complaint = tempData?.Complaint ?? 0, ComplaintScore = tempData?.ComplaintScore ?? 0, TeacherBeLate = tempData?.TeacherBeLate ?? 0, TeacherBeLateScore = tempData?.TeacherBeLateScore ?? 0, N5ClassHours = tempData?.N5ClassHours ?? 0, N5ClassHoursScore = tempData?.N5ClassHoursScore ?? 0, N4ClassHours = tempData?.N4ClassHours ?? 0, N4ClassHoursScore = tempData?.N4ClassHoursScore ?? 0, N3ClassHours = tempData?.N3ClassHours ?? 0, N3ClassHoursScore = tempData?.N3ClassHoursScore ?? 0, N2ClassHours = tempData?.N2ClassHours ?? 0, N2ClassHoursScore = tempData?.N2ClassHoursScore ?? 0, N1ClassHours = tempData?.N1ClassHours ?? 0, N1ClassHoursScore = tempData?.N1ClassHoursScore ?? 0, MiniAppPractise = tempData?.MiniAppPractise ?? 0, MiniAppPractiseScore = tempData?.MiniAppPractiseScore ?? 0, MiniAppTime = tempData?.MiniAppTime ?? 0, MiniAppTimeScore = tempData?.MiniAppTimeScore ?? 0, TotalScore = tempData?.TotalScore ?? 0, AvgScore = tempData?.AvgScore ?? 0, ScoreGap = tempData?.ScoreGap ?? 0, ActivityNum = tempData?.ActivityNum ?? 0, }; monthList.Add(newData); } var avgModel = new RB_Teacher_Static_Extend() { ShowMonthStr = "平均", StudentCount = Math.Round(monthList?.Average(qitem => qitem.StudentCount) ?? 0, 2), AttendClassHour = Math.Round(monthList?.Average(qitem => qitem.AttendClassHour) ?? 0, 2), AttendClassHourScore = Math.Round(monthList?.Average(qitem => qitem.AttendClassHourScore) ?? 0, 2), OnLineInteractive = Math.Round(monthList?.Average(qitem => qitem.OnLineInteractive) ?? 0, 2), OnLineInteractiveScore = Math.Round(monthList?.Average(qitem => qitem.OnLineInteractiveScore) ?? 0, 2), Renew = Math.Round(monthList?.Average(qitem => qitem.Renew) ?? 0, 2), RenewScore = Math.Round(monthList?.Average(qitem => qitem.RenewScore) ?? 0, 2), Upgrade = Math.Round(monthList?.Average(qitem => qitem.Upgrade) ?? 0, 2), UpgradeScore = Math.Round(monthList?.Average(qitem => qitem.UpgradeScore) ?? 0, 2), Trans = Math.Round(monthList?.Average(qitem => qitem.Trans) ?? 0, 2), TransScore = Math.Round(monthList?.Average(qitem => qitem.TransScore) ?? 0, 2), TrialSpeak = Math.Round(monthList?.Average(qitem => qitem.TrialSpeak) ?? 0, 2), TrialSpeakScore = Math.Round(monthList?.Average(qitem => qitem.TrialSpeakScore) ?? 0, 2), Truancy = Math.Round(monthList?.Average(qitem => qitem.Truancy) ?? 0, 2), TruancyScore = Math.Round(monthList?.Average(qitem => qitem.TruancyScore) ?? 0, 2), Withdraws = Math.Round(monthList?.Average(qitem => qitem.Withdraws) ?? 0, 2), WithdrawsScore = Math.Round(monthList?.Average(qitem => qitem.WithdrawsScore) ?? 0, 2), Complaint = Math.Round(monthList?.Average(qitem => qitem.Complaint) ?? 0, 2), ComplaintScore = Math.Round(monthList?.Average(qitem => qitem.ComplaintScore) ?? 0, 2), TeacherBeLate = Math.Round(monthList?.Average(qitem => qitem.TeacherBeLate) ?? 0, 2), TeacherBeLateScore = Math.Round(monthList?.Average(qitem => qitem.TeacherBeLateScore) ?? 0, 2), N5ClassHours = Math.Round(monthList?.Average(qitem => qitem.N5ClassHours) ?? 0, 2), N5ClassHoursScore = Math.Round(monthList?.Average(qitem => qitem.N5ClassHoursScore) ?? 0, 2), N4ClassHours = Math.Round(monthList?.Average(qitem => qitem.N4ClassHours) ?? 0, 2), N4ClassHoursScore = Math.Round(monthList?.Average(qitem => qitem.N4ClassHoursScore) ?? 0, 2), N3ClassHours = Math.Round(monthList?.Average(qitem => qitem.N3ClassHours) ?? 0, 2), N3ClassHoursScore = Math.Round(monthList?.Average(qitem => qitem.N3ClassHoursScore) ?? 0, 2), N2ClassHours = Math.Round(monthList?.Average(qitem => qitem.N2ClassHours) ?? 0, 2), N2ClassHoursScore = Math.Round(monthList?.Average(qitem => qitem.N2ClassHoursScore) ?? 0, 2), N1ClassHours = Math.Round(monthList?.Average(qitem => qitem.N1ClassHours) ?? 0, 2), MiniAppPractise = Math.Round(monthList?.Average(qitem => qitem.MiniAppPractise) ?? 0, 2), MiniAppPractiseScore = Math.Round(monthList?.Average(qitem => qitem.MiniAppPractiseScore) ?? 0, 2), MiniAppTime = Math.Round(monthList?.Average(qitem => qitem.MiniAppTime) ?? 0, 2), MiniAppTimeScore = Math.Round(monthList?.Average(qitem => qitem.MiniAppTimeScore) ?? 0, 2), TotalScore = Math.Round(monthList?.Average(qitem => qitem.TotalScore) ?? 0, 2), AvgScore = Math.Round(monthList?.Average(qitem => qitem.AvgScore) ?? 0, 2), ScoreGap = Math.Round(monthList?.Average(qitem => qitem.ScoreGap) ?? 0, 2), ActivityNum = Math.Round(monthList?.Average(qitem => qitem.ActivityNum) ?? 0, 2), }; var sumModel = new RB_Teacher_Static_Extend() { ShowMonthStr = "总数", StudentCount = monthList?.Sum(qitem => qitem.StudentCount) ?? 0, AttendClassHour = monthList?.Sum(qitem => qitem.AttendClassHour) ?? 0, AttendClassHourScore = monthList?.Sum(qitem => qitem.AttendClassHourScore) ?? 0, OnLineInteractive = monthList?.Sum(qitem => qitem.OnLineInteractive) ?? 0, OnLineInteractiveScore = monthList?.Sum(qitem => qitem.OnLineInteractiveScore) ?? 0, Renew = monthList?.Sum(qitem => qitem.Renew) ?? 0, RenewScore = monthList?.Sum(qitem => qitem.RenewScore) ?? 0, Upgrade = monthList?.Sum(qitem => qitem.Upgrade) ?? 0, UpgradeScore = monthList?.Sum(qitem => qitem.UpgradeScore) ?? 0, Trans = monthList?.Sum(qitem => qitem.Trans) ?? 0, TransScore = monthList?.Sum(qitem => qitem.TransScore) ?? 0, TrialSpeak = monthList?.Sum(qitem => qitem.TrialSpeak) ?? 0, TrialSpeakScore = monthList?.Sum(qitem => qitem.TrialSpeakScore) ?? 0, Truancy = monthList?.Sum(qitem => qitem.Truancy) ?? 0, TruancyScore = monthList?.Sum(qitem => qitem.TruancyScore) ?? 0, Withdraws = monthList?.Sum(qitem => qitem.Withdraws) ?? 0, WithdrawsScore = monthList?.Sum(qitem => qitem.WithdrawsScore) ?? 0, Complaint = monthList?.Sum(qitem => qitem.Complaint) ?? 0, ComplaintScore = monthList?.Sum(qitem => qitem.ComplaintScore) ?? 0, TeacherBeLate = monthList?.Sum(qitem => qitem.TeacherBeLate) ?? 0, TeacherBeLateScore = monthList?.Sum(qitem => qitem.TeacherBeLateScore) ?? 0, N5ClassHours = monthList?.Sum(qitem => qitem.N5ClassHours) ?? 0, N5ClassHoursScore = monthList?.Sum(qitem => qitem.N5ClassHoursScore) ?? 0, N4ClassHours = monthList?.Sum(qitem => qitem.N4ClassHours) ?? 0, N4ClassHoursScore = monthList?.Sum(qitem => qitem.N4ClassHoursScore) ?? 0, N3ClassHours = monthList?.Sum(qitem => qitem.N3ClassHours) ?? 0, N3ClassHoursScore = monthList?.Sum(qitem => qitem.N3ClassHoursScore) ?? 0, N2ClassHours = monthList?.Sum(qitem => qitem.N2ClassHours) ?? 0, N2ClassHoursScore = monthList?.Sum(qitem => qitem.N2ClassHoursScore) ?? 0, N1ClassHours = monthList?.Sum(qitem => qitem.N1ClassHours) ?? 0, N1ClassHoursScore = monthList?.Sum(qitem => qitem.N1ClassHoursScore) ?? 0, MiniAppPractise = monthList?.Sum(qitem => qitem.MiniAppPractise) ?? 0, MiniAppPractiseScore = monthList?.Sum(qitem => qitem.MiniAppPractiseScore) ?? 0, MiniAppTime = monthList?.Sum(qitem => qitem.MiniAppTime) ?? 0, MiniAppTimeScore = monthList?.Sum(qitem => qitem.MiniAppTimeScore) ?? 0, TotalScore = monthList?.Sum(qitem => qitem.TotalScore) ?? 0, AvgScore = monthList?.Sum(qitem => qitem.AvgScore) ?? 0, ScoreGap = monthList?.Sum(qitem => qitem.ScoreGap) ?? 0, ActivityNum = monthList?.Sum(qitem => qitem.ActivityNum) ?? 0, }; monthList.Add(avgModel); monthList.Add(sumModel); foreach (var item in monthList) { dataList.Add(new { item.Id, DateStr = item.ShowMonthStr, item.StudentCount, item.AttendClassHour, item.AttendClassHourScore, item.OnLineInteractive, item.OnLineInteractiveScore, item.Renew, item.RenewScore, item.Upgrade, item.UpgradeScore, item.Trans, item.TransScore, item.TrialSpeak, item.TrialSpeakScore, item.Truancy, item.TruancyScore, item.Withdraws, item.WithdrawsScore, item.Complaint, item.ComplaintScore, item.TeacherBeLate, item.TeacherBeLateScore, item.N5ClassHours, item.N5ClassHoursScore, item.N4ClassHours, item.N4ClassHoursScore, item.N3ClassHours, item.N3ClassHoursScore, item.N2ClassHours, item.N2ClassHoursScore, item.N1ClassHours, item.N1ClassHoursScore, item.MiniAppPractise, item.MiniAppPractiseScore, item.MiniAppTime, item.MiniAppTimeScore, item.TotalScore, item.AvgScore, item.ScoreGap, item.ActivityNum }); } return dataList; } /// <summary> /// 教师行为数据月份统计 /// </summary> /// <param name="query"></param> /// <returns></returns> public List<RateMonthItem> GetTeacherStaticMonthRateModule(RB_Teacher_Static_Extend query) { List<RateMonthItem> monthList = new List<RateMonthItem>(); var list = teacher_StaticRepository.GetTeacherStaticMonthListRepository(query); List<RB_Teacher_Static_Extend> result = new List<RB_Teacher_Static_Extend>(); for (var i = 0; i < 12; i++) { var firstModel = new RB_Teacher_Static_Extend(); if (i > 0) { firstModel = i < list.Count ? list[i - 1] : new RB_Teacher_Static_Extend(); } var item = i < list.Count ? list[i] : new RB_Teacher_Static_Extend(); decimal StudentCount = 0; if (firstModel.StudentCount > 0 && i > 0) { StudentCount = (item.StudentCount - firstModel.StudentCount) / firstModel.StudentCount * 100; } decimal AttendClassHour = 0; if (firstModel.AttendClassHour > 0 && i > 0) { AttendClassHour = (item.AttendClassHour - firstModel.AttendClassHour) / firstModel.AttendClassHour * 100; } decimal AttendClassHourScore = 0; if (firstModel.AttendClassHourScore > 0 && i > 0) { AttendClassHourScore = (item.AttendClassHourScore - firstModel.AttendClassHourScore) / firstModel.AttendClassHourScore * 100; } decimal OnLineInteractive = 0; if (firstModel.OnLineInteractive > 0 && i > 0) { OnLineInteractive = (item.OnLineInteractive - firstModel.OnLineInteractive) / firstModel.OnLineInteractive * 100; } decimal OnLineInteractiveScore = 0; if (firstModel.OnLineInteractiveScore > 0 && i > 0) { OnLineInteractiveScore = (item.OnLineInteractiveScore - firstModel.OnLineInteractiveScore) / firstModel.OnLineInteractiveScore * 100; } decimal Renew = 0; if (firstModel.Renew > 0 && i > 0) { Renew = (item.Renew - firstModel.Renew) / firstModel.Renew * 100; } decimal RenewScore = 0; if (firstModel.RenewScore > 0 && i > 0) { RenewScore = (item.RenewScore - firstModel.RenewScore) / firstModel.RenewScore * 100; } decimal Upgrade = 0; if (firstModel.Upgrade > 0 && i > 0) { Upgrade = (item.Upgrade - firstModel.Upgrade) / firstModel.Upgrade * 100; } decimal UpgradeScore = 0; if (firstModel.UpgradeScore > 0 && i > 0) { UpgradeScore = (item.UpgradeScore - firstModel.UpgradeScore) / firstModel.UpgradeScore * 100; } decimal Trans = 0; if (firstModel.Trans > 0 && i > 0) { Trans = (item.Trans - firstModel.Trans) / firstModel.Trans * 100; } decimal TransScore = 0; if (firstModel.TransScore > 0 && i > 0) { TransScore = (item.TransScore - firstModel.TransScore) / firstModel.TransScore * 100; } decimal TrialSpeak = 0; if (firstModel.TrialSpeak > 0 && i > 0) { TrialSpeak = (item.TrialSpeak - firstModel.TrialSpeak) / firstModel.TrialSpeak * 100; } decimal TrialSpeakScore = 0; if (firstModel.TrialSpeakScore > 0 && i > 0) { TrialSpeakScore = (item.TrialSpeakScore - firstModel.TrialSpeakScore) / firstModel.TrialSpeakScore * 100; } decimal Truancy = 0; if (firstModel.Truancy > 0 && i > 0) { Truancy = (item.Truancy - firstModel.Truancy) / firstModel.Truancy * 100; } decimal TruancyScore = 0; if (firstModel.TruancyScore > 0 && i > 0) { TruancyScore = (item.TruancyScore - firstModel.TruancyScore) / firstModel.TruancyScore * 100; } decimal Withdraws = 0; if (firstModel.Withdraws > 0 && i > 0) { Withdraws = (item.Withdraws - firstModel.Withdraws) / firstModel.Withdraws * 100; } decimal WithdrawsScore = 0; if (firstModel.WithdrawsScore > 0 && i > 0) { WithdrawsScore = (item.WithdrawsScore - firstModel.WithdrawsScore) / firstModel.WithdrawsScore * 100; } decimal Complaint = 0; if (firstModel.Complaint > 0 && i > 0) { Complaint = (item.Complaint - firstModel.Complaint) / firstModel.Complaint * 100; } decimal ComplaintScore = 0; if (firstModel.ComplaintScore > 0 && i > 0) { ComplaintScore = (item.ComplaintScore - firstModel.ComplaintScore) / firstModel.ComplaintScore * 100; } decimal TeacherBeLate = 0; if (firstModel.TeacherBeLate > 0 && i > 0) { TeacherBeLate = (item.TeacherBeLate - firstModel.TeacherBeLate) / firstModel.TeacherBeLate * 100; } decimal TeacherBeLateScore = 0; if (firstModel.TeacherBeLateScore > 0 && i > 0) { TeacherBeLateScore = (item.TeacherBeLateScore - firstModel.TeacherBeLateScore) / firstModel.TeacherBeLateScore * 100; } decimal N5ClassHours = 0; if (firstModel.N5ClassHours > 0 && i > 0) { N5ClassHours = (item.N5ClassHours - firstModel.N5ClassHours) / firstModel.N5ClassHours * 100; } decimal N5ClassHoursScore = 0; if (firstModel.N5ClassHoursScore > 0 && i > 0) { N5ClassHoursScore = (item.N5ClassHoursScore - firstModel.N5ClassHoursScore) / firstModel.N5ClassHoursScore * 100; } decimal N4ClassHours = 0; if (firstModel.N4ClassHours > 0 && i > 0) { N4ClassHours = (item.N4ClassHours - firstModel.N4ClassHours) / firstModel.N4ClassHours * 100; } decimal N4ClassHoursScore = 0; if (firstModel.N4ClassHoursScore > 0 && i > 0) { N4ClassHoursScore = (item.N4ClassHoursScore - firstModel.N4ClassHoursScore) / firstModel.N4ClassHoursScore * 100; } decimal N3ClassHours = 0; if (firstModel.N3ClassHours > 0 && i > 0) { N3ClassHours = (item.N3ClassHours - firstModel.N3ClassHours) / firstModel.N3ClassHours * 100; } decimal N3ClassHoursScore = 0; if (firstModel.N3ClassHoursScore > 0 && i > 0) { N3ClassHoursScore = (item.N3ClassHoursScore - firstModel.N3ClassHoursScore) / firstModel.N3ClassHoursScore * 100; } decimal N2ClassHours = 0; if (firstModel.N2ClassHours > 0 && i > 0) { N2ClassHours = (item.N2ClassHours - firstModel.N2ClassHours) / firstModel.N2ClassHours * 100; } decimal N2ClassHoursScore = 0; if (firstModel.N2ClassHoursScore > 0 && i > 0) { N2ClassHoursScore = (item.N2ClassHoursScore - firstModel.N2ClassHoursScore) / firstModel.N2ClassHoursScore * 100; } decimal N1ClassHours = 0; if (firstModel.N1ClassHours > 0 && i > 0) { N1ClassHours = (item.N1ClassHours - firstModel.N1ClassHours) / firstModel.N1ClassHours * 100; } decimal N1ClassHoursScore = 0; if (firstModel.N1ClassHoursScore > 0 && i > 0) { N1ClassHoursScore = (item.N1ClassHoursScore - firstModel.N1ClassHoursScore) / firstModel.N1ClassHoursScore * 100; } decimal MiniAppPractise = 0; if (firstModel.MiniAppPractise > 0 && i > 0) { MiniAppPractise = (item.MiniAppPractise - firstModel.MiniAppPractise) / firstModel.MiniAppPractise * 100; } decimal MiniAppPractiseScore = 0; if (firstModel.MiniAppPractiseScore > 0 && i > 0) { MiniAppPractiseScore = (item.MiniAppPractiseScore - firstModel.MiniAppPractiseScore) / firstModel.MiniAppPractiseScore * 100; } decimal MiniAppTime = 0; if (firstModel.MiniAppTime > 0 && i > 0) { MiniAppTime = (item.MiniAppTime - firstModel.MiniAppTime) / firstModel.MiniAppTime * 100; } decimal MiniAppTimeScore = 0; if (firstModel.MiniAppTimeScore > 0 && i > 0) { MiniAppTimeScore = (item.MiniAppTimeScore - firstModel.MiniAppTimeScore) / firstModel.MiniAppTimeScore * 100; } decimal TotalScore = 0; if (firstModel.TotalScore > 0 && i > 0) { TotalScore = (item.TotalScore - firstModel.TotalScore) / firstModel.TotalScore * 100; } decimal AvgScore = 0; if (firstModel.AvgScore > 0 && i > 0) { AvgScore = (item.AvgScore - firstModel.AvgScore) / firstModel.AvgScore * 100; } decimal ScoreGap = 0; if (firstModel.ScoreGap > 0 && i > 0) { ScoreGap = (item.ScoreGap - firstModel.ScoreGap) / firstModel.ScoreGap * 100; } decimal ActivityNum = 0; if (firstModel.ActivityNum > 0 && i > 0) { ActivityNum = (item.ActivityNum - firstModel.ActivityNum) / firstModel.ActivityNum * 100; } var newModel = new RB_Teacher_Static_Extend() { MonthStr = i + 1, StudentCount = StudentCount, AttendClassHour = AttendClassHour, AttendClassHourScore = AttendClassHourScore, OnLineInteractive = OnLineInteractive, OnLineInteractiveScore = OnLineInteractiveScore, Renew = Renew, RenewScore = RenewScore, Upgrade = Upgrade, UpgradeScore = UpgradeScore, Trans = Trans, TransScore = TransScore, TrialSpeak = TrialSpeak, TrialSpeakScore = TrialSpeakScore, Truancy = Truancy, TruancyScore = TruancyScore, Withdraws = Withdraws, WithdrawsScore = WithdrawsScore, Complaint = Complaint, ComplaintScore = ComplaintScore, TeacherBeLate = TeacherBeLate, TeacherBeLateScore = TeacherBeLateScore, N5ClassHours = N5ClassHours, N5ClassHoursScore = N5ClassHoursScore, N4ClassHours = N4ClassHours, N4ClassHoursScore = N4ClassHoursScore, N3ClassHours = N3ClassHours, N3ClassHoursScore = N3ClassHoursScore, N2ClassHours = N2ClassHours, N2ClassHoursScore = N2ClassHoursScore, N1ClassHours = N1ClassHours, N1ClassHoursScore = N1ClassHoursScore, MiniAppPractise = MiniAppPractise, MiniAppPractiseScore = MiniAppPractiseScore, MiniAppTime = MiniAppTime, MiniAppTimeScore = MiniAppTimeScore, TotalScore = TotalScore, AvgScore = AvgScore, ScoreGap = ScoreGap, ActivityNum = ActivityNum, }; result.Add(newModel); } monthList.Add(new RateMonthItem() { ItemName = "学生人数成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).StudentCount, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).StudentCount, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).StudentCount, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).StudentCount, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).StudentCount, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).StudentCount, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).StudentCount, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).StudentCount, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).StudentCount, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).StudentCount, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).StudentCount, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).StudentCount, 2), AvgRate = Math.Round(result.Average(qitem => qitem.StudentCount), 2), }); monthList.Add(new RateMonthItem() { ItemName = "上课时数成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).AttendClassHourScore, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).AttendClassHourScore, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).AttendClassHourScore, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).AttendClassHourScore, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).AttendClassHourScore, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).AttendClassHourScore, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).AttendClassHourScore, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).AttendClassHourScore, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).AttendClassHourScore, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).AttendClassHourScore, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).AttendClassHourScore, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).AttendClassHourScore, 2), AvgRate = Math.Round(result.Average(qitem => qitem.AttendClassHourScore), 2), }); monthList.Add(new RateMonthItem() { ItemName = "线上与学生互动数成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).OnLineInteractiveScore, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).OnLineInteractiveScore, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).OnLineInteractiveScore, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).OnLineInteractiveScore, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).OnLineInteractiveScore, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).OnLineInteractiveScore, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).OnLineInteractiveScore, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).OnLineInteractiveScore, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).OnLineInteractiveScore, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).OnLineInteractiveScore, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).OnLineInteractiveScore, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).OnLineInteractiveScore, 2), AvgRate = Math.Round(result.Average(qitem => qitem.OnLineInteractiveScore), 2), }); monthList.Add(new RateMonthItem() { ItemName = "续约成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).RenewScore, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).RenewScore, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).RenewScore, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).RenewScore, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).RenewScore, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).RenewScore, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).RenewScore, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).RenewScore, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).RenewScore, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).RenewScore, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).RenewScore, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).RenewScore, 2), AvgRate = Math.Round(result.Average(qitem => qitem.RenewScore), 2), }); monthList.Add(new RateMonthItem() { ItemName = "学生升级成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).UpgradeScore, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).UpgradeScore, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).UpgradeScore, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).UpgradeScore, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).UpgradeScore, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).UpgradeScore, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).UpgradeScore, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).UpgradeScore, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).UpgradeScore, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).UpgradeScore, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).UpgradeScore, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).UpgradeScore, 2), AvgRate = Math.Round(result.Average(qitem => qitem.UpgradeScore), 2), }); monthList.Add(new RateMonthItem() { ItemName = "转介绍成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).TransScore, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).TransScore, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).TransScore, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).TransScore, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).TransScore, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).TransScore, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).TransScore, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).TransScore, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).TransScore, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).TransScore, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).TransScore, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).TransScore, 2), AvgRate = Math.Round(result.Average(qitem => qitem.TransScore), 2), }); monthList.Add(new RateMonthItem() { ItemName = "试讲成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).TrialSpeakScore, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).TrialSpeakScore, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).TrialSpeakScore, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).TrialSpeakScore, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).TrialSpeakScore, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).TrialSpeakScore, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).TrialSpeakScore, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).TrialSpeakScore, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).TrialSpeakScore, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).TrialSpeakScore, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).TrialSpeakScore, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).TrialSpeakScore, 2), AvgRate = Math.Round(result.Average(qitem => qitem.TrialSpeakScore), 2), }); monthList.Add(new RateMonthItem() { ItemName = "学生旷课成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).TruancyScore, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).TruancyScore, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).TruancyScore, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).TruancyScore, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).TruancyScore, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).TruancyScore, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).TruancyScore, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).TruancyScore, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).TruancyScore, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).TruancyScore, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).TruancyScore, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).TruancyScore, 2), AvgRate = Math.Round(result.Average(qitem => qitem.TruancyScore), 2), }); monthList.Add(new RateMonthItem() { ItemName = "学生退课成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).WithdrawsScore, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).WithdrawsScore, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).WithdrawsScore, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).WithdrawsScore, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).WithdrawsScore, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).WithdrawsScore, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).WithdrawsScore, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).WithdrawsScore, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).WithdrawsScore, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).WithdrawsScore, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).WithdrawsScore, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).WithdrawsScore, 2), AvgRate = Math.Round(result.Average(qitem => qitem.WithdrawsScore), 2), }); monthList.Add(new RateMonthItem() { ItemName = "学生投诉成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).ComplaintScore, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).ComplaintScore, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).ComplaintScore, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).ComplaintScore, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).ComplaintScore, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).ComplaintScore, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).ComplaintScore, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).ComplaintScore, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).ComplaintScore, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).ComplaintScore, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).ComplaintScore, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).ComplaintScore, 2), AvgRate = Math.Round(result.Average(qitem => qitem.ComplaintScore), 2), }); monthList.Add(new RateMonthItem() { ItemName = "老师迟到早退成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).TeacherBeLateScore, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).TeacherBeLateScore, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).TeacherBeLateScore, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).TeacherBeLateScore, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).TeacherBeLateScore, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).TeacherBeLateScore, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).TeacherBeLateScore, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).TeacherBeLateScore, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).TeacherBeLateScore, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).TeacherBeLateScore, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).TeacherBeLateScore, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).TeacherBeLateScore, 2), AvgRate = Math.Round(result.Average(qitem => qitem.TeacherBeLateScore), 2), }); monthList.Add(new RateMonthItem() { ItemName = "N5课程时数成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).N5ClassHoursScore, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).N5ClassHoursScore, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).N5ClassHoursScore, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).N5ClassHoursScore, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).N5ClassHoursScore, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).N5ClassHoursScore, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).N5ClassHoursScore, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).N5ClassHoursScore, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).N5ClassHoursScore, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).N5ClassHoursScore, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).N5ClassHoursScore, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).N5ClassHoursScore, 2), AvgRate = Math.Round(result.Average(qitem => qitem.N5ClassHoursScore), 2), }); monthList.Add(new RateMonthItem() { ItemName = "N4课程时数成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).N4ClassHoursScore, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).N4ClassHoursScore, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).N4ClassHoursScore, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).N4ClassHoursScore, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).N4ClassHoursScore, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).N4ClassHoursScore, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).N4ClassHoursScore, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).N4ClassHoursScore, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).N4ClassHoursScore, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).N4ClassHoursScore, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).N4ClassHoursScore, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).N4ClassHoursScore, 2), AvgRate = Math.Round(result.Average(qitem => qitem.N4ClassHoursScore), 2), }); monthList.Add(new RateMonthItem() { ItemName = "N3课程时数成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).N3ClassHoursScore, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).N3ClassHoursScore, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).N3ClassHoursScore, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).N3ClassHoursScore, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).N3ClassHoursScore, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).N3ClassHoursScore, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).N3ClassHoursScore, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).N3ClassHoursScore, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).N3ClassHoursScore, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).N3ClassHoursScore, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).N3ClassHoursScore, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).N3ClassHoursScore, 2), AvgRate = Math.Round(result.Average(qitem => qitem.N3ClassHoursScore), 2), }); monthList.Add(new RateMonthItem() { ItemName = "N2课程时数成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).N2ClassHoursScore, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).N2ClassHoursScore, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).N2ClassHoursScore, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).N2ClassHoursScore, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).N2ClassHoursScore, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).N2ClassHoursScore, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).N2ClassHoursScore, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).N2ClassHoursScore, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).N2ClassHoursScore, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).N2ClassHoursScore, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).N2ClassHoursScore, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).N2ClassHoursScore, 2), AvgRate = Math.Round(result.Average(qitem => qitem.N2ClassHoursScore), 2), }); monthList.Add(new RateMonthItem() { ItemName = "N1课程时数成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).N1ClassHoursScore, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).N1ClassHoursScore, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).N1ClassHoursScore, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).N1ClassHoursScore, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).N1ClassHoursScore, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).N1ClassHoursScore, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).N1ClassHoursScore, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).N1ClassHoursScore, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).N1ClassHoursScore, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).N1ClassHoursScore, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).N1ClassHoursScore, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).N1ClassHoursScore, 2), AvgRate = Math.Round(result.Average(qitem => qitem.N1ClassHoursScore), 2), }); monthList.Add(new RateMonthItem() { ItemName = "小程序刷题次数成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).MiniAppPractiseScore, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).MiniAppPractiseScore, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).MiniAppPractiseScore, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).MiniAppPractiseScore, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).MiniAppPractiseScore, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).MiniAppPractiseScore, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).MiniAppPractiseScore, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).MiniAppPractiseScore, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).MiniAppPractiseScore, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).MiniAppPractiseScore, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).MiniAppPractiseScore, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).MiniAppPractiseScore, 2), AvgRate = Math.Round(result.Average(qitem => qitem.MiniAppPractiseScore), 2), }); monthList.Add(new RateMonthItem() { ItemName = "小程序刷题时间成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).MiniAppTimeScore, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).MiniAppTimeScore, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).MiniAppTimeScore, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).MiniAppTimeScore, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).MiniAppTimeScore, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).MiniAppTimeScore, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).MiniAppTimeScore, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).MiniAppTimeScore, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).MiniAppTimeScore, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).MiniAppTimeScore, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).MiniAppTimeScore, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).MiniAppTimeScore, 2), AvgRate = Math.Round(result.Average(qitem => qitem.MiniAppTimeScore), 2), }); monthList.Add(new RateMonthItem() { ItemName = "活动次数成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).ActivityNum, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).ActivityNum, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).ActivityNum, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).ActivityNum, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).ActivityNum, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).ActivityNum, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).ActivityNum, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).ActivityNum, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).ActivityNum, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).ActivityNum, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).ActivityNum, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).ActivityNum, 2), AvgRate = Math.Round(result.Average(qitem => qitem.ActivityNum), 2), }); monthList.Add(new RateMonthItem() { ItemName = "总分数成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).TotalScore, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).TotalScore, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).TotalScore, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).TotalScore, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).TotalScore, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).TotalScore, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).TotalScore, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).TotalScore, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).TotalScore, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).TotalScore, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).TotalScore, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).TotalScore, 2), AvgRate = Math.Round(result.Average(qitem => qitem.TotalScore), 2), }); monthList.Add(new RateMonthItem() { ItemName = "所有老师平均分数成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).AvgScore, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).AvgScore, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).AvgScore, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).AvgScore, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).AvgScore, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).AvgScore, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).AvgScore, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).AvgScore, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).AvgScore, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).AvgScore, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).AvgScore, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).AvgScore, 2), AvgRate = Math.Round(result.Average(qitem => qitem.AvgScore), 2), }); monthList.Add(new RateMonthItem() { ItemName = "分数差距成长率", JanuaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 1).ScoreGap, 2), FebruaryRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 2).ScoreGap, 2), MarchRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 3).ScoreGap, 2), AprilRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 4).ScoreGap, 2), MayRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 5).ScoreGap, 2), JuneRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 6).ScoreGap, 2), JulyRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 7).ScoreGap, 2), AugustRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 8).ScoreGap, 2), SeptemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 9).ScoreGap, 2), OctoberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 10).ScoreGap, 2), NovemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 11).ScoreGap, 2), DecemberRate = Math.Round(result.FirstOrDefault(qitem => qitem.MonthStr == 12).ScoreGap, 2), AvgRate = Math.Round(result.Average(qitem => qitem.ScoreGap), 2), }); return monthList; } /// <summary> /// 教师行为数据年份统计 /// </summary> /// <param name="query"></param> /// <returns></returns> public List<RateYearItem> GetTeacherStaticListYearModule(RB_Teacher_Static_Extend query) { List<RateYearItem> yearList = new List<RateYearItem>(); List<RB_Teacher_Static_Extend> rateList = new List<RB_Teacher_Static_Extend>(); var list = teacher_StaticRepository.GetTeacherStaticYearListRepository(query); if (list != null && list.Count > 0) { int minYear = list.Min(qitem => qitem.YearStr); int maxYear = list.Max(qitem => qitem.YearStr); var totalYear = maxYear - minYear; for (var i = 0; i <= totalYear; i++) { var firstModel = new RB_Teacher_Static_Extend(); if (i > 0) { firstModel = i < list.Count ? list[i - 1] : new RB_Teacher_Static_Extend(); } var item = i < list.Count ? list[i] : new RB_Teacher_Static_Extend(); decimal StudentCount = 0; if (firstModel.StudentCount > 0 && i > 0) { StudentCount = (item.StudentCount - firstModel.StudentCount) / firstModel.StudentCount * 100; } decimal AttendClassHour = 0; if (firstModel.AttendClassHour > 0 && i > 0) { AttendClassHour = (item.AttendClassHour - firstModel.AttendClassHour) / firstModel.AttendClassHour * 100; } decimal AttendClassHourScore = 0; if (firstModel.AttendClassHourScore > 0 && i > 0) { AttendClassHourScore = (item.AttendClassHourScore - firstModel.AttendClassHourScore) / firstModel.AttendClassHourScore * 100; } decimal OnLineInteractive = 0; if (firstModel.OnLineInteractive > 0 && i > 0) { OnLineInteractive = (item.OnLineInteractive - firstModel.OnLineInteractive) / firstModel.OnLineInteractive * 100; } decimal OnLineInteractiveScore = 0; if (firstModel.OnLineInteractiveScore > 0 && i > 0) { OnLineInteractiveScore = (item.OnLineInteractiveScore - firstModel.OnLineInteractiveScore) / firstModel.OnLineInteractiveScore * 100; } decimal Renew = 0; if (firstModel.Renew > 0 && i > 0) { Renew = (item.Renew - firstModel.Renew) / firstModel.Renew * 100; } decimal RenewScore = 0; if (firstModel.RenewScore > 0 && i > 0) { RenewScore = (item.RenewScore - firstModel.RenewScore) / firstModel.RenewScore * 100; } decimal Upgrade = 0; if (firstModel.Upgrade > 0 && i > 0) { Upgrade = (item.Upgrade - firstModel.Upgrade) / firstModel.Upgrade * 100; } decimal UpgradeScore = 0; if (firstModel.UpgradeScore > 0 && i > 0) { UpgradeScore = (item.UpgradeScore - firstModel.UpgradeScore) / firstModel.UpgradeScore * 100; } decimal Trans = 0; if (firstModel.Trans > 0 && i > 0) { Trans = (item.Trans - firstModel.Trans) / firstModel.Trans * 100; } decimal TransScore = 0; if (firstModel.TransScore > 0 && i > 0) { TransScore = (item.TransScore - firstModel.TransScore) / firstModel.TransScore * 100; } decimal TrialSpeak = 0; if (firstModel.TrialSpeak > 0 && i > 0) { TrialSpeak = (item.TrialSpeak - firstModel.TrialSpeak) / firstModel.TrialSpeak * 100; } decimal TrialSpeakScore = 0; if (firstModel.TrialSpeakScore > 0 && i > 0) { TrialSpeakScore = (item.TrialSpeakScore - firstModel.TrialSpeakScore) / firstModel.TrialSpeakScore * 100; } decimal Truancy = 0; if (firstModel.Truancy > 0 && i > 0) { Truancy = (item.Truancy - firstModel.Truancy) / firstModel.Truancy * 100; } decimal TruancyScore = 0; if (firstModel.TruancyScore > 0 && i > 0) { TruancyScore = (item.TruancyScore - firstModel.TruancyScore) / firstModel.TruancyScore * 100; } decimal Withdraws = 0; if (firstModel.Withdraws > 0 && i > 0) { Withdraws = (item.Withdraws - firstModel.Withdraws) / firstModel.Withdraws * 100; } decimal WithdrawsScore = 0; if (firstModel.WithdrawsScore > 0 && i > 0) { WithdrawsScore = (item.WithdrawsScore - firstModel.WithdrawsScore) / firstModel.WithdrawsScore * 100; } decimal Complaint = 0; if (firstModel.Complaint > 0 && i > 0) { Complaint = (item.Complaint - firstModel.Complaint) / firstModel.Complaint * 100; } decimal ComplaintScore = 0; if (firstModel.ComplaintScore > 0 && i > 0) { ComplaintScore = (item.ComplaintScore - firstModel.ComplaintScore) / firstModel.ComplaintScore * 100; } decimal TeacherBeLate = 0; if (firstModel.TeacherBeLate > 0 && i > 0) { TeacherBeLate = (item.TeacherBeLate - firstModel.TeacherBeLate) / firstModel.TeacherBeLate * 100; } decimal TeacherBeLateScore = 0; if (firstModel.TeacherBeLateScore > 0 && i > 0) { TeacherBeLateScore = (item.TeacherBeLateScore - firstModel.TeacherBeLateScore) / firstModel.TeacherBeLateScore * 100; } decimal N5ClassHours = 0; if (firstModel.N5ClassHours > 0 && i > 0) { N5ClassHours = (item.N5ClassHours - firstModel.N5ClassHours) / firstModel.N5ClassHours * 100; } decimal N5ClassHoursScore = 0; if (firstModel.N5ClassHoursScore > 0 && i > 0) { N5ClassHoursScore = (item.N5ClassHoursScore - firstModel.N5ClassHoursScore) / firstModel.N5ClassHoursScore * 100; } decimal N4ClassHours = 0; if (firstModel.N4ClassHours > 0 && i > 0) { N4ClassHours = (item.N4ClassHours - firstModel.N4ClassHours) / firstModel.N4ClassHours * 100; } decimal N4ClassHoursScore = 0; if (firstModel.N4ClassHoursScore > 0 && i > 0) { N4ClassHoursScore = (item.N4ClassHoursScore - firstModel.N4ClassHoursScore) / firstModel.N4ClassHoursScore * 100; } decimal N3ClassHours = 0; if (firstModel.N3ClassHours > 0 && i > 0) { N3ClassHours = (item.N3ClassHours - firstModel.N3ClassHours) / firstModel.N3ClassHours * 100; } decimal N3ClassHoursScore = 0; if (firstModel.N3ClassHoursScore > 0 && i > 0) { N3ClassHoursScore = (item.N3ClassHoursScore - firstModel.N3ClassHoursScore) / firstModel.N3ClassHoursScore * 100; } decimal N2ClassHours = 0; if (firstModel.N2ClassHours > 0 && i > 0) { N2ClassHours = (item.N2ClassHours - firstModel.N2ClassHours) / firstModel.N2ClassHours * 100; } decimal N2ClassHoursScore = 0; if (firstModel.N2ClassHoursScore > 0 && i > 0) { N2ClassHoursScore = (item.N2ClassHoursScore - firstModel.N2ClassHoursScore) / firstModel.N2ClassHoursScore * 100; } decimal N1ClassHours = 0; if (firstModel.N1ClassHours > 0 && i > 0) { N1ClassHours = (item.N1ClassHours - firstModel.N1ClassHours) / firstModel.N1ClassHours * 100; } decimal N1ClassHoursScore = 0; if (firstModel.N1ClassHoursScore > 0 && i > 0) { N1ClassHoursScore = (item.N1ClassHoursScore - firstModel.N1ClassHoursScore) / firstModel.N1ClassHoursScore * 100; } decimal MiniAppPractise = 0; if (firstModel.MiniAppPractise > 0 && i > 0) { MiniAppPractise = (item.MiniAppPractise - firstModel.MiniAppPractise) / firstModel.MiniAppPractise * 100; } decimal MiniAppPractiseScore = 0; if (firstModel.MiniAppPractiseScore > 0 && i > 0) { MiniAppPractiseScore = (item.MiniAppPractiseScore - firstModel.MiniAppPractiseScore) / firstModel.MiniAppPractiseScore * 100; } decimal MiniAppTime = 0; if (firstModel.MiniAppTime > 0 && i > 0) { MiniAppTime = (item.MiniAppTime - firstModel.MiniAppTime) / firstModel.MiniAppTime * 100; } decimal MiniAppTimeScore = 0; if (firstModel.MiniAppTimeScore > 0 && i > 0) { MiniAppTimeScore = (item.MiniAppTimeScore - firstModel.MiniAppTimeScore) / firstModel.MiniAppTimeScore * 100; } decimal TotalScore = 0; if (firstModel.TotalScore > 0 && i > 0) { TotalScore = (item.TotalScore - firstModel.TotalScore) / firstModel.TotalScore * 100; } decimal AvgScore = 0; if (firstModel.AvgScore > 0 && i > 0) { AvgScore = (item.AvgScore - firstModel.AvgScore) / firstModel.AvgScore * 100; } decimal ScoreGap = 0; if (firstModel.ScoreGap > 0 && i > 0) { ScoreGap = (item.ScoreGap - firstModel.ScoreGap) / firstModel.ScoreGap * 100; } decimal ActivityNum = 0; if (firstModel.ActivityNum > 0 && i > 0) { ActivityNum = (item.ActivityNum - firstModel.ActivityNum) / firstModel.ActivityNum * 100; } rateList.Add(new RB_Teacher_Static_Extend() { YearStr = minYear + i, StudentCount = StudentCount, AttendClassHour = AttendClassHour, AttendClassHourScore = AttendClassHourScore, OnLineInteractive = OnLineInteractive, OnLineInteractiveScore = OnLineInteractiveScore, Renew = Renew, RenewScore = RenewScore, Upgrade = Upgrade, UpgradeScore = UpgradeScore, Trans = Trans, TransScore = TransScore, TrialSpeak = TrialSpeak, TrialSpeakScore = TrialSpeakScore, Truancy = Truancy, TruancyScore = TruancyScore, Withdraws = Withdraws, WithdrawsScore = WithdrawsScore, Complaint = Complaint, ComplaintScore = ComplaintScore, TeacherBeLate = TeacherBeLate, TeacherBeLateScore = TeacherBeLateScore, N5ClassHours = N5ClassHours, N5ClassHoursScore = N5ClassHoursScore, N4ClassHours = N4ClassHours, N4ClassHoursScore = N4ClassHoursScore, N3ClassHours = N3ClassHours, N3ClassHoursScore = N3ClassHoursScore, N2ClassHours = N2ClassHours, N2ClassHoursScore = N2ClassHoursScore, N1ClassHours = N1ClassHours, N1ClassHoursScore = N1ClassHoursScore, MiniAppPractise = MiniAppPractise, MiniAppPractiseScore = MiniAppPractiseScore, MiniAppTime = MiniAppTime, MiniAppTimeScore = MiniAppTimeScore, TotalScore = TotalScore, AvgScore = AvgScore, ScoreGap = ScoreGap, ActivityNum = ActivityNum, }); } yearList.Add(new RateYearItem() { ItemName = "学生人数", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).StudentCount, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).StudentCount, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).StudentCount, 2), }); yearList.Add(new RateYearItem() { ItemName = "上课时数", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).AttendClassHourScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).AttendClassHourScore, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).AttendClassHourScore, 2), }); yearList.Add(new RateYearItem() { ItemName = "线上与学生互动数", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).OnLineInteractiveScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).OnLineInteractiveScore, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).OnLineInteractiveScore, 2), }); yearList.Add(new RateYearItem() { ItemName = "续约(含留学)", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).RenewScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).RenewScore, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).RenewScore, 2), }); yearList.Add(new RateYearItem() { ItemName = "学生升级", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).UpgradeScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).UpgradeScore, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).UpgradeScore, 2), }); yearList.Add(new RateYearItem() { ItemName = "转介绍", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).TransScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).TransScore, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).TransScore, 2), }); yearList.Add(new RateYearItem() { ItemName = "试讲", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).TrialSpeakScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).TrialSpeakScore, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).TrialSpeakScore, 2), }); yearList.Add(new RateYearItem() { ItemName = "学生旷课", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).TruancyScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).TruancyScore, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).TruancyScore, 2), }); yearList.Add(new RateYearItem() { ItemName = "学生退课", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).WithdrawsScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).WithdrawsScore, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).WithdrawsScore, 2), }); yearList.Add(new RateYearItem() { ItemName = "学生投诉", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).ComplaintScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).ComplaintScore, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).ComplaintScore, 2), }); yearList.Add(new RateYearItem() { ItemName = "老师迟到早退", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).TeacherBeLateScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).TeacherBeLateScore, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).TeacherBeLateScore, 2), }); yearList.Add(new RateYearItem() { ItemName = "N5课程时数", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).N5ClassHoursScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).N5ClassHoursScore, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).N5ClassHoursScore, 2), }); yearList.Add(new RateYearItem() { ItemName = "N4课程时数", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).N4ClassHoursScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).N4ClassHoursScore, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).N4ClassHoursScore, 2), }); yearList.Add(new RateYearItem() { ItemName = "N3课程时数", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).N3ClassHoursScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).N3ClassHoursScore, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).N3ClassHoursScore, 2), }); yearList.Add(new RateYearItem() { ItemName = "N2课程时数", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).N2ClassHoursScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).N2ClassHoursScore, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).N2ClassHoursScore, 2), }); yearList.Add(new RateYearItem() { ItemName = "N1课程时数", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).N1ClassHoursScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).N1ClassHoursScore, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).N1ClassHoursScore, 2), }); yearList.Add(new RateYearItem() { ItemName = "小程序刷题次数", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).MiniAppPractiseScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).MiniAppPractiseScore, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).MiniAppPractiseScore, 2), }); yearList.Add(new RateYearItem() { ItemName = "小程序刷题时间", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).MiniAppTimeScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).MiniAppTimeScore, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).MiniAppTimeScore, 2), }); yearList.Add(new RateYearItem() { ItemName = "活动次数", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).ActivityNum, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).ActivityNum, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).ActivityNum, 2), }); yearList.Add(new RateYearItem() { ItemName = "总分数", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).TotalScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).TotalScore, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).TotalScore, 2), }); yearList.Add(new RateYearItem() { ItemName = "所有老师平均分数", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).AvgScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).AvgScore, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).AvgScore, 2), }); yearList.Add(new RateYearItem() { ItemName = "分数差距", FirstYearStr = minYear, FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).ScoreGap, 2), SecondYearStr = maxYear, SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).ScoreGap, 2), YearRate = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).ScoreGap, 2), }); } return yearList; } /// <summary> /// 教师行为数据年份成长率统计 /// </summary> /// <param name="query"></param> /// <returns></returns> public List<RateYearItem> GetTeacherStaticYearRateModule(RB_Teacher_Static_Extend query) { List<RateYearItem> yearList = new List<RateYearItem>(); var dataList = teacher_StaticRepository.GetTeacherStaticMonthListRepository(query, isYear: true); if (dataList != null && dataList.Count > 0) { List<RB_Teacher_Static_Extend> result = new List<RB_Teacher_Static_Extend>(); int minYear = dataList.Min(qitem => qitem.YearStr); int maxYear = dataList.Max(qitem => qitem.YearStr); var totalYear = maxYear - minYear; for (var y = 0; y <= totalYear; y++) { var list = dataList.Where(qitem => qitem.YearStr == minYear + y).ToList(); for (var i = 0; i < 12; i++) { var firstModel = new RB_Teacher_Static_Extend(); if (i > 0) { firstModel = i < list.Count ? list[i - 1] : new RB_Teacher_Static_Extend(); } var item = i < list.Count ? list[i] : new RB_Teacher_Static_Extend(); decimal StudentCount = 0; if (firstModel.StudentCount > 0 && i > 0) { StudentCount = (item.StudentCount - firstModel.StudentCount) / firstModel.StudentCount * 100; } decimal AttendClassHour = 0; if (firstModel.AttendClassHour > 0 && i > 0) { AttendClassHour = (item.AttendClassHour - firstModel.AttendClassHour) / firstModel.AttendClassHour * 100; } decimal AttendClassHourScore = 0; if (firstModel.AttendClassHourScore > 0 && i > 0) { AttendClassHourScore = (item.AttendClassHourScore - firstModel.AttendClassHourScore) / firstModel.AttendClassHourScore * 100; } decimal OnLineInteractive = 0; if (firstModel.OnLineInteractive > 0 && i > 0) { OnLineInteractive = (item.OnLineInteractive - firstModel.OnLineInteractive) / firstModel.OnLineInteractive * 100; } decimal OnLineInteractiveScore = 0; if (firstModel.OnLineInteractiveScore > 0 && i > 0) { OnLineInteractiveScore = (item.OnLineInteractiveScore - firstModel.OnLineInteractiveScore) / firstModel.OnLineInteractiveScore * 100; } decimal Renew = 0; if (firstModel.Renew > 0 && i > 0) { Renew = (item.Renew - firstModel.Renew) / firstModel.Renew * 100; } decimal RenewScore = 0; if (firstModel.RenewScore > 0 && i > 0) { RenewScore = (item.RenewScore - firstModel.RenewScore) / firstModel.RenewScore * 100; } decimal Upgrade = 0; if (firstModel.Upgrade > 0 && i > 0) { Upgrade = (item.Upgrade - firstModel.Upgrade) / firstModel.Upgrade * 100; } decimal UpgradeScore = 0; if (firstModel.UpgradeScore > 0 && i > 0) { UpgradeScore = (item.UpgradeScore - firstModel.UpgradeScore) / firstModel.UpgradeScore * 100; } decimal Trans = 0; if (firstModel.Trans > 0 && i > 0) { Trans = (item.Trans - firstModel.Trans) / firstModel.Trans * 100; } decimal TransScore = 0; if (firstModel.TransScore > 0 && i > 0) { TransScore = (item.TransScore - firstModel.TransScore) / firstModel.TransScore * 100; } decimal TrialSpeak = 0; if (firstModel.TrialSpeak > 0 && i > 0) { TrialSpeak = (item.TrialSpeak - firstModel.TrialSpeak) / firstModel.TrialSpeak * 100; } decimal TrialSpeakScore = 0; if (firstModel.TrialSpeakScore > 0 && i > 0) { TrialSpeakScore = (item.TrialSpeakScore - firstModel.TrialSpeakScore) / firstModel.TrialSpeakScore * 100; } decimal Truancy = 0; if (firstModel.Truancy > 0 && i > 0) { Truancy = (item.Truancy - firstModel.Truancy) / firstModel.Truancy * 100; } decimal TruancyScore = 0; if (firstModel.TruancyScore > 0 && i > 0) { TruancyScore = (item.TruancyScore - firstModel.TruancyScore) / firstModel.TruancyScore * 100; } decimal Withdraws = 0; if (firstModel.Withdraws > 0 && i > 0) { Withdraws = (item.Withdraws - firstModel.Withdraws) / firstModel.Withdraws * 100; } decimal WithdrawsScore = 0; if (firstModel.WithdrawsScore > 0 && i > 0) { WithdrawsScore = (item.WithdrawsScore - firstModel.WithdrawsScore) / firstModel.WithdrawsScore * 100; } decimal Complaint = 0; if (firstModel.Complaint > 0 && i > 0) { Complaint = (item.Complaint - firstModel.Complaint) / firstModel.Complaint * 100; } decimal ComplaintScore = 0; if (firstModel.ComplaintScore > 0 && i > 0) { ComplaintScore = (item.ComplaintScore - firstModel.ComplaintScore) / firstModel.ComplaintScore * 100; } decimal TeacherBeLate = 0; if (firstModel.TeacherBeLate > 0 && i > 0) { TeacherBeLate = (item.TeacherBeLate - firstModel.TeacherBeLate) / firstModel.TeacherBeLate * 100; } decimal TeacherBeLateScore = 0; if (firstModel.TeacherBeLateScore > 0 && i > 0) { TeacherBeLateScore = (item.TeacherBeLateScore - firstModel.TeacherBeLateScore) / firstModel.TeacherBeLateScore * 100; } decimal N5ClassHours = 0; if (firstModel.N5ClassHours > 0 && i > 0) { N5ClassHours = (item.N5ClassHours - firstModel.N5ClassHours) / firstModel.N5ClassHours * 100; } decimal N5ClassHoursScore = 0; if (firstModel.N5ClassHoursScore > 0 && i > 0) { N5ClassHoursScore = (item.N5ClassHoursScore - firstModel.N5ClassHoursScore) / firstModel.N5ClassHoursScore * 100; } decimal N4ClassHours = 0; if (firstModel.N4ClassHours > 0 && i > 0) { N4ClassHours = (item.N4ClassHours - firstModel.N4ClassHours) / firstModel.N4ClassHours * 100; } decimal N4ClassHoursScore = 0; if (firstModel.N4ClassHoursScore > 0 && i > 0) { N4ClassHoursScore = (item.N4ClassHoursScore - firstModel.N4ClassHoursScore) / firstModel.N4ClassHoursScore * 100; } decimal N3ClassHours = 0; if (firstModel.N3ClassHours > 0 && i > 0) { N3ClassHours = (item.N3ClassHours - firstModel.N3ClassHours) / firstModel.N3ClassHours * 100; } decimal N3ClassHoursScore = 0; if (firstModel.N3ClassHoursScore > 0 && i > 0) { N3ClassHoursScore = (item.N3ClassHoursScore - firstModel.N3ClassHoursScore) / firstModel.N3ClassHoursScore * 100; } decimal N2ClassHours = 0; if (firstModel.N2ClassHours > 0 && i > 0) { N2ClassHours = (item.N2ClassHours - firstModel.N2ClassHours) / firstModel.N2ClassHours * 100; } decimal N2ClassHoursScore = 0; if (firstModel.N2ClassHoursScore > 0 && i > 0) { N2ClassHoursScore = (item.N2ClassHoursScore - firstModel.N2ClassHoursScore) / firstModel.N2ClassHoursScore * 100; } decimal N1ClassHours = 0; if (firstModel.N1ClassHours > 0 && i > 0) { N1ClassHours = (item.N1ClassHours - firstModel.N1ClassHours) / firstModel.N1ClassHours * 100; } decimal N1ClassHoursScore = 0; if (firstModel.N1ClassHoursScore > 0 && i > 0) { N1ClassHoursScore = (item.N1ClassHoursScore - firstModel.N1ClassHoursScore) / firstModel.N1ClassHoursScore * 100; } decimal MiniAppPractise = 0; if (firstModel.MiniAppPractise > 0 && i > 0) { MiniAppPractise = (item.MiniAppPractise - firstModel.MiniAppPractise) / firstModel.MiniAppPractise * 100; } decimal MiniAppPractiseScore = 0; if (firstModel.MiniAppPractiseScore > 0 && i > 0) { MiniAppPractiseScore = (item.MiniAppPractiseScore - firstModel.MiniAppPractiseScore) / firstModel.MiniAppPractiseScore * 100; } decimal MiniAppTime = 0; if (firstModel.MiniAppTime > 0 && i > 0) { MiniAppTime = (item.MiniAppTime - firstModel.MiniAppTime) / firstModel.MiniAppTime * 100; } decimal MiniAppTimeScore = 0; if (firstModel.MiniAppTimeScore > 0 && i > 0) { MiniAppTimeScore = (item.MiniAppTimeScore - firstModel.MiniAppTimeScore) / firstModel.MiniAppTimeScore * 100; } decimal TotalScore = 0; if (firstModel.TotalScore > 0 && i > 0) { TotalScore = (item.TotalScore - firstModel.TotalScore) / firstModel.TotalScore * 100; } decimal AvgScore = 0; if (firstModel.AvgScore > 0 && i > 0) { AvgScore = (item.AvgScore - firstModel.AvgScore) / firstModel.AvgScore * 100; } decimal ScoreGap = 0; if (firstModel.ScoreGap > 0 && i > 0) { ScoreGap = (item.ScoreGap - firstModel.ScoreGap) / firstModel.ScoreGap * 100; } decimal ActivityNum = 0; if (firstModel.ActivityNum > 0 && i > 0) { ActivityNum = (item.ActivityNum - firstModel.ActivityNum) / firstModel.ActivityNum * 100; } var newModel = new RB_Teacher_Static_Extend() { YearStr = minYear + y, MonthStr = i + 1, StudentCount = StudentCount, AttendClassHour = AttendClassHour, AttendClassHourScore = AttendClassHourScore, OnLineInteractive = OnLineInteractive, OnLineInteractiveScore = OnLineInteractiveScore, Renew = Renew, RenewScore = RenewScore, Upgrade = Upgrade, UpgradeScore = UpgradeScore, Trans = Trans, TransScore = TransScore, TrialSpeak = TrialSpeak, TrialSpeakScore = TrialSpeakScore, Truancy = Truancy, TruancyScore = TruancyScore, Withdraws = Withdraws, WithdrawsScore = WithdrawsScore, Complaint = Complaint, ComplaintScore = ComplaintScore, TeacherBeLate = TeacherBeLate, TeacherBeLateScore = TeacherBeLateScore, N5ClassHours = N5ClassHours, N5ClassHoursScore = N5ClassHoursScore, N4ClassHours = N4ClassHours, N4ClassHoursScore = N4ClassHoursScore, N3ClassHours = N3ClassHours, N3ClassHoursScore = N3ClassHoursScore, N2ClassHours = N2ClassHours, N2ClassHoursScore = N2ClassHoursScore, N1ClassHours = N1ClassHours, N1ClassHoursScore = N1ClassHoursScore, MiniAppPractise = MiniAppPractise, MiniAppPractiseScore = MiniAppPractiseScore, MiniAppTime = MiniAppTime, MiniAppTimeScore = MiniAppTimeScore, TotalScore = TotalScore, AvgScore = AvgScore, ScoreGap = ScoreGap, ActivityNum = ActivityNum, }; result.Add(newModel); } } var lastStudentCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.StudentCount); var curStudentCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.StudentCount); decimal CStudentCount = 0; if (lastStudentCount > 0) { CStudentCount = (curStudentCount - lastStudentCount) / lastStudentCount * 100; } yearList.Add(new RateYearItem() { ItemName = "学生人数成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastStudentCount, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curStudentCount, 2), YearRate = Math.Round(CStudentCount, 2), }); var lastAttendClassHourScore = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.AttendClassHourScore); var curAttendClassHourScore = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.AttendClassHourScore); decimal CAttendClassHourScore = 0; if (lastAttendClassHourScore > 0) { CAttendClassHourScore = (curAttendClassHourScore - lastAttendClassHourScore) / lastAttendClassHourScore * 100; } yearList.Add(new RateYearItem() { ItemName = "上课时数成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastAttendClassHourScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curAttendClassHourScore, 2), YearRate = Math.Round(CAttendClassHourScore, 2), }); var lastOnLineInteractiveScore = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.OnLineInteractiveScore); var curOnLineInteractiveScore = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.OnLineInteractiveScore); decimal COnLineInteractiveScore = 0; if (lastOnLineInteractiveScore > 0) { COnLineInteractiveScore = (curOnLineInteractiveScore - lastOnLineInteractiveScore) / lastOnLineInteractiveScore * 100; } yearList.Add(new RateYearItem() { ItemName = "线上与学生互动数成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastOnLineInteractiveScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curOnLineInteractiveScore, 2), YearRate = Math.Round(COnLineInteractiveScore, 2), }); var lastRenewScore = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.RenewScore); var curRenewScore = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.RenewScore); decimal CRenewScore = 0; if (lastRenewScore > 0) { CRenewScore = (curRenewScore - lastRenewScore) / lastRenewScore * 100; } yearList.Add(new RateYearItem() { ItemName = "续约成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastRenewScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curRenewScore, 2), YearRate = Math.Round(CRenewScore, 2), }); var lastUpgradeScore = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.UpgradeScore); var curUpgradeScore = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.UpgradeScore); decimal CUpgradeScore = 0; if (lastUpgradeScore > 0) { CUpgradeScore = (curUpgradeScore - lastUpgradeScore) / lastUpgradeScore * 100; } yearList.Add(new RateYearItem() { ItemName = "学生升级成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastUpgradeScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curUpgradeScore, 2), YearRate = Math.Round(CUpgradeScore, 2), }); var lastTransScore = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.TransScore); var curTransScore = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.TransScore); decimal CTransScore = 0; if (lastTransScore > 0) { CTransScore = (curTransScore - lastTransScore) / lastTransScore * 100; } yearList.Add(new RateYearItem() { ItemName = "转介绍成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastTransScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curTransScore, 2), YearRate = Math.Round(CTransScore, 2), }); var lastTrialSpeakScore = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.TrialSpeakScore); var curTrialSpeakScore = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.TrialSpeakScore); decimal CTrialSpeakScore = 0; if (lastTrialSpeakScore > 0) { CTrialSpeakScore = (curTrialSpeakScore - lastTrialSpeakScore) / lastTrialSpeakScore * 100; } yearList.Add(new RateYearItem() { ItemName = "试讲成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastTrialSpeakScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curTrialSpeakScore, 2), YearRate = Math.Round(CTrialSpeakScore, 2), }); var lastTruancyScore = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.TruancyScore); var curTruancyScore = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.TruancyScore); decimal CTruancyScore = 0; if (lastTruancyScore > 0) { CTruancyScore = (curTruancyScore - lastTruancyScore) / lastTruancyScore * 100; } yearList.Add(new RateYearItem() { ItemName = "学生旷课成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastTruancyScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curTruancyScore, 2), YearRate = Math.Round(CTruancyScore, 2), }); var lastWithdrawsScore = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.WithdrawsScore); var curWithdrawsScore = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.WithdrawsScore); decimal CWithdrawsScore = 0; if (lastWithdrawsScore > 0) { CWithdrawsScore = (curWithdrawsScore - lastWithdrawsScore) / lastWithdrawsScore * 100; } yearList.Add(new RateYearItem() { ItemName = "学生退课成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastWithdrawsScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curWithdrawsScore, 2), YearRate = Math.Round(CWithdrawsScore, 2), }); var lastComplaintScore = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.ComplaintScore); var curComplaintScore = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.ComplaintScore); decimal CComplaintScore = 0; if (lastComplaintScore > 0) { CComplaintScore = (curComplaintScore - lastComplaintScore) / lastComplaintScore * 100; } yearList.Add(new RateYearItem() { ItemName = "学生投诉成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastComplaintScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curComplaintScore, 2), YearRate = Math.Round(CComplaintScore, 2), }); var lastTeacherBeLateScore = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.TeacherBeLateScore); var curTeacherBeLateScore = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.TeacherBeLateScore); decimal CTeacherBeLateScore = 0; if (lastTeacherBeLateScore > 0) { CTeacherBeLateScore = (curTeacherBeLateScore - lastTeacherBeLateScore) / lastTeacherBeLateScore * 100; } yearList.Add(new RateYearItem() { ItemName = "老师迟到早退成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastTeacherBeLateScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curTeacherBeLateScore, 2), YearRate = Math.Round(CTeacherBeLateScore, 2), }); var lastN5ClassHoursScore = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.N5ClassHoursScore); var curN5ClassHoursScore = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.N5ClassHoursScore); decimal CN5ClassHoursScore = 0; if (lastN5ClassHoursScore > 0) { CN5ClassHoursScore = (curN5ClassHoursScore - lastN5ClassHoursScore) / lastN5ClassHoursScore * 100; } yearList.Add(new RateYearItem() { ItemName = "N5课程时数成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastN5ClassHoursScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curN5ClassHoursScore, 2), YearRate = Math.Round(CN5ClassHoursScore, 2), }); var lastN4ClassHoursScore = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.N4ClassHoursScore); var curN4ClassHoursScore = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.N4ClassHoursScore); decimal CN4ClassHoursScore = 0; if (lastN4ClassHoursScore > 0) { CN4ClassHoursScore = (curN4ClassHoursScore - lastN4ClassHoursScore) / lastN4ClassHoursScore * 100; } yearList.Add(new RateYearItem() { ItemName = "N4课程时数成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastN4ClassHoursScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curN4ClassHoursScore, 2), YearRate = Math.Round(CN4ClassHoursScore, 2), }); var lastN3ClassHoursScore = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.N3ClassHoursScore); var curN3ClassHoursScore = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.N3ClassHoursScore); decimal CN3ClassHoursScore = 0; if (lastN3ClassHoursScore > 0) { CN3ClassHoursScore = (curN3ClassHoursScore - lastN3ClassHoursScore) / lastN3ClassHoursScore * 100; } yearList.Add(new RateYearItem() { ItemName = "N3课程时数成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastN3ClassHoursScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curN3ClassHoursScore, 2), YearRate = Math.Round(CN3ClassHoursScore, 2), }); var lastN2ClassHoursScore = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.N2ClassHoursScore); var curN2ClassHoursScore = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.N2ClassHoursScore); decimal CN2ClassHoursScore = 0; if (lastN2ClassHoursScore > 0) { CN2ClassHoursScore = (curN2ClassHoursScore - lastN2ClassHoursScore) / lastN2ClassHoursScore * 100; } yearList.Add(new RateYearItem() { ItemName = "N2课程时数成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastN2ClassHoursScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curN2ClassHoursScore, 2), YearRate = Math.Round(CN2ClassHoursScore, 2), }); var lastN1ClassHoursScore = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.N1ClassHoursScore); var curN1ClassHoursScore = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.N1ClassHoursScore); decimal CN1ClassHoursScore = 0; if (lastN1ClassHoursScore > 0) { CN1ClassHoursScore = (curN1ClassHoursScore - lastN1ClassHoursScore) / lastN1ClassHoursScore * 100; } yearList.Add(new RateYearItem() { ItemName = "N1课程时数成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastN1ClassHoursScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curN1ClassHoursScore, 2), YearRate = Math.Round(CN1ClassHoursScore, 2), }); var lastMiniAppPractiseScore = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.MiniAppPractiseScore); var curMiniAppPractiseScore = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.MiniAppPractiseScore); decimal CMiniAppPractiseScore = 0; if (lastMiniAppPractiseScore > 0) { CMiniAppPractiseScore = (curMiniAppPractiseScore - lastMiniAppPractiseScore) / lastMiniAppPractiseScore * 100; } yearList.Add(new RateYearItem() { ItemName = "小程序刷题次数成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastMiniAppPractiseScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curMiniAppPractiseScore, 2), YearRate = Math.Round(CMiniAppPractiseScore, 2), }); var lastMiniAppTimeScore = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.MiniAppTimeScore); var curMiniAppTimeScore = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.MiniAppTimeScore); decimal CMiniAppTimeScore = 0; if (lastMiniAppTimeScore > 0) { CMiniAppTimeScore = (curMiniAppTimeScore - lastMiniAppTimeScore) / lastMiniAppTimeScore * 100; } yearList.Add(new RateYearItem() { ItemName = "小程序刷题时间成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastMiniAppTimeScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curMiniAppTimeScore, 2), YearRate = Math.Round(CMiniAppTimeScore, 2), }); var lastActivityNum = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.ActivityNum); var curActivityNum = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.ActivityNum); decimal CActivityNum = 0; if (lastActivityNum > 0) { CActivityNum = (curActivityNum - lastActivityNum) / lastActivityNum * 100; } yearList.Add(new RateYearItem() { ItemName = "活动次数成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastActivityNum, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curActivityNum, 2), YearRate = Math.Round(CActivityNum, 2), }); var lastTotalScore = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.TotalScore); var curTotalScore = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.TotalScore); decimal CTotalScore = 0; if (lastTotalScore > 0) { CTotalScore = (curTotalScore - lastTotalScore) / lastTotalScore * 100; } yearList.Add(new RateYearItem() { ItemName = "总分数成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastTotalScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curTotalScore, 2), YearRate = Math.Round(CTotalScore, 2), }); var lastAvgScore = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.AvgScore); var curAvgScore = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.AvgScore); decimal CAvgScore = 0; if (lastAvgScore > 0) { CAvgScore = (curAvgScore - lastAvgScore) / lastAvgScore * 100; } yearList.Add(new RateYearItem() { ItemName = "所有老师平均分数成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastAvgScore, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curAvgScore, 2), YearRate = Math.Round(CAvgScore, 2), }); var lastScoreGap = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.ScoreGap); var curScoreGap = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.ScoreGap); decimal CScoreGap = 0; if (lastScoreGap > 0) { CScoreGap = (curScoreGap - lastScoreGap) / lastScoreGap * 100; } yearList.Add(new RateYearItem() { ItemName = "分数差距成长率", FirstYearStr = minYear, FirstYear = Math.Round(lastScoreGap, 2), SecondYearStr = maxYear, SecondYear = Math.Round(curScoreGap, 2), YearRate = Math.Round(CScoreGap, 2), }); } return yearList; } /// <summary> /// 生成教师行为每天数据 /// </summary> /// <param name="user">当前操作用户</param> /// <param name="StartTime">开始时间</param> /// <param name="EndTime">结束时间</param> /// <returns></returns> public bool CreateTeacherStaticModule(UserInfo user, string StartTime, string EndTime, bool isInit = true) { bool flag = true; //5,10,15,20 var teacherList = accountRepository.GetEmployeeListRepository(new Employee_ViewModel() { AccountTypeStr = "2", Group_Id = user.Group_Id, IsLeave = 1 })?.Where(qitem => qitem.AccountId != 5 && qitem.AccountId != 10 && qitem.AccountId != 15 && qitem.AccountId != 20).ToList(); int teacherCount = 1; List<WechatCheck_ViewModel> checkList = new List<WechatCheck_ViewModel>(); List<WechatCheck_ViewModel> messageList = new List<WechatCheck_ViewModel>(); if (isInit) { teacher_StaticRepository.DeleteTeacherStaticByProcRepository(); } var date = Convert.ToDateTime(StartTime); var endTime = Convert.ToDateTime(EndTime); string tempStr = string.Join(",", teacherList.Where(qitem => !string.IsNullOrEmpty(qitem.WorkUserId)).Select(qitem => qitem.WorkUserId)); List<string> workUserIds = Common.ConvertHelper.StringToFileList(tempStr); int Days = (endTime - date).Days; for (int i = 0; i < Days; i++) { var newDate = date.AddDays(i); //获取老师迟到早退信息 checkList = Edu.ThirdCore.QYWinXin.QYWeiXinHelper.GetWeChatCheckList(workUserIds, newDate); //获取老师与学员沟通次数 messageList = Edu.ThirdCore.QYWinXin.QYWeiXinHelper.GetWechatStudentStatic(workUserIds, newDate); int times = 1; int newDay = newDate.Day; //本月最后一天 var curMonthLastDay = new DateTime(newDate.Year, newDate.Month, 1).AddMonths(1).AddDays(-1); //单个老师 var procModelList = teacher_StaticRepository.GetTeacherStaticByProcRepository(Common.ConvertHelper.FormatDate(newDate)); foreach (var item in teacherList) { teacherCount = teacherList.Where(qitem => qitem.Dept_Id == item.Dept_Id)?.Count() ?? 1; var procModel = procModelList.Where(qitem => qitem.TeacherId == item.AccountId).FirstOrDefault(); var newModel = new RB_Teacher_Static_Extend() { Id = 0, Date = newDate, StudentCount = procModel?.StudentCount ?? 0, AttendClassHour = procModel?.AttendClassHour ?? 0, AttendClassHourScore = procModel?.AttendClassHourScore ?? 0, Renew = procModel?.Renew ?? 0, RenewScore = procModel?.RenewScore ?? 0, Upgrade = procModel?.Upgrade ?? 0, UpgradeScore = procModel?.UpgradeScore ?? 0, Trans = procModel?.Trans ?? 0, TransScore = procModel?.TransScore ?? 0, TrialSpeak = procModel?.TrialSpeak ?? 0, TrialSpeakScore = procModel?.TrialSpeakScore ?? 0, Truancy = procModel?.Truancy ?? 0, TruancyScore = procModel?.TruancyScore ?? 0, Withdraws = procModel?.Withdraws ?? 0, WithdrawsScore = procModel?.WithdrawsScore ?? 0, Complaint = procModel?.Complaint ?? 0, ComplaintScore = procModel?.ComplaintScore ?? 0, N5ClassHours = procModel?.N5ClassHours ?? 0, N5ClassHoursScore = procModel?.N5ClassHoursScore ?? 0, N4ClassHours = procModel?.N4ClassHours ?? 0, N4ClassHoursScore = procModel?.N4ClassHoursScore ?? 0, N3ClassHours = procModel?.N3ClassHours ?? 0, N3ClassHoursScore = procModel?.N3ClassHoursScore ?? 0, N2ClassHours = procModel?.N2ClassHours ?? 0, N2ClassHoursScore = procModel?.N2ClassHoursScore ?? 0, N1ClassHours = procModel?.N1ClassHours ?? 0, N1ClassHoursScore = procModel?.N1ClassHoursScore ?? 0, MiniAppPractise = procModel?.MiniAppPractise ?? 0, MiniAppPractiseScore = procModel?.MiniAppPractiseScore ?? 0, MiniAppTime = procModel?.MiniAppTime ?? 0, MiniAppTimeScore = procModel?.MiniAppTimeScore ?? 0, ActivityNum = procModel?.ActivityNum ?? 0, YearStr = newDate.Year, MonthStr = newDate.Month, TeacherId = item.AccountId, }; newModel.OnLineInteractive = messageList.Where(qitem => qitem.Acctid == item.WorkUserId)?.FirstOrDefault()?.MessageCount ?? 0; newModel.OnLineInteractiveScore = newModel.OnLineInteractive; newModel.TeacherBeLate = checkList.Where(qitem=>qitem.Acctid==item.WorkUserId)?.Where(qitem => qitem.ExceptionCount > 0)?.Count() ?? 0; newModel.TeacherBeLateScore = newModel.TeacherBeLate; newModel.TotalScore = (newModel.StudentCount + newModel.AttendClassHourScore + newModel.OnLineInteractiveScore + newModel.RenewScore + newModel.UpgradeScore + newModel.TransScore + newModel.TrialSpeakScore - newModel.TruancyScore - newModel.WithdrawsScore - newModel.ComplaintScore - newModel.TeacherBeLateScore + newModel.MiniAppPractiseScore + newModel.MiniAppTimeScore + newModel.ActivityNum + newModel.N5ClassHoursScore * 1 + newModel.N4ClassHoursScore * 2 + newModel.N3ClassHoursScore * 3 + newModel.N2ClassHoursScore * 4 + newModel.N1ClassHoursScore * 5 ); newModel.AvgScore = Math.Round(newModel.TotalScore / teacherCount, 2); newModel.ScoreGap = newModel.TotalScore - newModel.AvgScore; if (newDay >= 1 && newDay <= 10) { times = 1; //记录上月最后一个时段总数 if (newDay == 1) { var lastMonthDay = newDate.AddMonths(-1); var lastMonthLastTimeList = teacher_StaticRepository.GetTeacherStaticListRepository(new RB_Teacher_Static_Extend() { YearStr = lastMonthDay.Year, MonthStr = lastMonthDay.Month, Times = 3, TeacherId = item.AccountId })?.Where(qitem => !string.IsNullOrEmpty(Common.ConvertHelper.FormatDate(qitem.Date)))?.ToList(); var staticModel = new RB_Teacher_Static_Extend() { Id = 0, StudentCount = lastMonthLastTimeList?.Sum(qitem => qitem.StudentCount) ?? 0, AttendClassHour = lastMonthLastTimeList?.Sum(qitem => qitem.AttendClassHour) ?? 0, AttendClassHourScore = lastMonthLastTimeList?.Sum(qitem => qitem.AttendClassHourScore) ?? 0, OnLineInteractive = lastMonthLastTimeList?.Sum(qitem => qitem.OnLineInteractive) ?? 0, OnLineInteractiveScore = lastMonthLastTimeList?.Sum(qitem => qitem.OnLineInteractiveScore) ?? 0, Renew = lastMonthLastTimeList?.Sum(qitem => qitem.Renew) ?? 0, RenewScore = lastMonthLastTimeList?.Sum(qitem => qitem.RenewScore) ?? 0, Upgrade = lastMonthLastTimeList?.Sum(qitem => qitem.Upgrade) ?? 0, UpgradeScore = lastMonthLastTimeList?.Sum(qitem => qitem.UpgradeScore) ?? 0, Trans = lastMonthLastTimeList?.Sum(qitem => qitem.Trans) ?? 0, TransScore = lastMonthLastTimeList?.Sum(qitem => qitem.TransScore) ?? 0, TrialSpeak = lastMonthLastTimeList?.Sum(qitem => qitem.TrialSpeak) ?? 0, TrialSpeakScore = lastMonthLastTimeList?.Sum(qitem => qitem.TrialSpeakScore) ?? 0, Truancy = lastMonthLastTimeList?.Sum(qitem => qitem.Truancy) ?? 0, TruancyScore = lastMonthLastTimeList?.Sum(qitem => qitem.TruancyScore) ?? 0, Withdraws = lastMonthLastTimeList?.Sum(qitem => qitem.Withdraws) ?? 0, WithdrawsScore = lastMonthLastTimeList?.Sum(qitem => qitem.WithdrawsScore) ?? 0, Complaint = lastMonthLastTimeList?.Sum(qitem => qitem.Complaint) ?? 0, ComplaintScore = lastMonthLastTimeList?.Sum(qitem => qitem.ComplaintScore) ?? 0, TeacherBeLate = lastMonthLastTimeList?.Sum(qitem => qitem.TeacherBeLate) ?? 0, TeacherBeLateScore = lastMonthLastTimeList?.Sum(qitem => qitem.TeacherBeLateScore) ?? 0, N5ClassHours = lastMonthLastTimeList?.Sum(qitem => qitem.N5ClassHours) ?? 0, N5ClassHoursScore = lastMonthLastTimeList?.Sum(qitem => qitem.N5ClassHoursScore) ?? 0, N4ClassHours = lastMonthLastTimeList?.Sum(qitem => qitem.N4ClassHours) ?? 0, N4ClassHoursScore = lastMonthLastTimeList?.Sum(qitem => qitem.N4ClassHoursScore) ?? 0, N3ClassHours = lastMonthLastTimeList?.Sum(qitem => qitem.N3ClassHours) ?? 0, N3ClassHoursScore = lastMonthLastTimeList?.Sum(qitem => qitem.N3ClassHoursScore) ?? 0, N2ClassHours = lastMonthLastTimeList?.Sum(qitem => qitem.N2ClassHours) ?? 0, N2ClassHoursScore = lastMonthLastTimeList?.Sum(qitem => qitem.N2ClassHoursScore) ?? 0, N1ClassHours = lastMonthLastTimeList?.Sum(qitem => qitem.N1ClassHours) ?? 0, N1ClassHoursScore = lastMonthLastTimeList?.Sum(qitem => qitem.N1ClassHoursScore) ?? 0, MiniAppPractise = lastMonthLastTimeList?.Sum(qitem => qitem.MiniAppPractise) ?? 0, MiniAppPractiseScore = lastMonthLastTimeList?.Sum(qitem => qitem.MiniAppPractiseScore) ?? 0, MiniAppTime = lastMonthLastTimeList?.Sum(qitem => qitem.MiniAppTime) ?? 0, MiniAppTimeScore = lastMonthLastTimeList?.Sum(qitem => qitem.MiniAppTimeScore) ?? 0, TotalScore = lastMonthLastTimeList?.Sum(qitem => qitem.TotalScore) ?? 0, AvgScore = lastMonthLastTimeList?.Sum(qitem => qitem.AvgScore) ?? 0, ScoreGap = lastMonthLastTimeList?.Sum(qitem => qitem.ScoreGap) ?? 0, ActivityNum = lastMonthLastTimeList?.Sum(qitem => qitem.ActivityNum) ?? 0, YearStr = newDate.Year, MonthStr = newDate.Month, TeacherId = item.AccountId, }; staticModel.Times = 1; staticModel.Group_Id = user.Group_Id; staticModel.School_Id = user.School_Id; staticModel.CreateBy = user.Id; staticModel.CreateTime = DateTime.Now; teacher_StaticRepository.Insert(staticModel); } } else if (newDay >= 11 && newDay <= 20) { times = 2; //记录本月第一阶段总数 if (newDay == 11) { var curMonthFirstTimeList = teacher_StaticRepository.GetTeacherStaticListRepository(new RB_Teacher_Static_Extend() { YearStr = newDate.Year, MonthStr = newDate.Month, Times = 1, TeacherId = item.AccountId, })?.Where(qitem => !string.IsNullOrEmpty(Common.ConvertHelper.FormatDate(qitem.Date)))?.ToList(); var firstTimeStaticModel = new RB_Teacher_Static_Extend() { Id = 0, StudentCount = curMonthFirstTimeList?.Sum(qitem => qitem.StudentCount) ?? 0, AttendClassHour = curMonthFirstTimeList?.Sum(qitem => qitem.AttendClassHour) ?? 0, AttendClassHourScore = curMonthFirstTimeList?.Sum(qitem => qitem.AttendClassHourScore) ?? 0, OnLineInteractive = curMonthFirstTimeList?.Sum(qitem => qitem.OnLineInteractive) ?? 0, OnLineInteractiveScore = curMonthFirstTimeList?.Sum(qitem => qitem.OnLineInteractiveScore) ?? 0, Renew = curMonthFirstTimeList?.Sum(qitem => qitem.Renew) ?? 0, RenewScore = curMonthFirstTimeList?.Sum(qitem => qitem.RenewScore) ?? 0, Upgrade = curMonthFirstTimeList?.Sum(qitem => qitem.Upgrade) ?? 0, UpgradeScore = curMonthFirstTimeList?.Sum(qitem => qitem.UpgradeScore) ?? 0, Trans = curMonthFirstTimeList?.Sum(qitem => qitem.Trans) ?? 0, TransScore = curMonthFirstTimeList?.Sum(qitem => qitem.TransScore) ?? 0, TrialSpeak = curMonthFirstTimeList?.Sum(qitem => qitem.TrialSpeak) ?? 0, TrialSpeakScore = curMonthFirstTimeList?.Sum(qitem => qitem.TrialSpeakScore) ?? 0, Truancy = curMonthFirstTimeList?.Sum(qitem => qitem.Truancy) ?? 0, TruancyScore = curMonthFirstTimeList?.Sum(qitem => qitem.TruancyScore) ?? 0, Withdraws = curMonthFirstTimeList?.Sum(qitem => qitem.Withdraws) ?? 0, WithdrawsScore = curMonthFirstTimeList?.Sum(qitem => qitem.WithdrawsScore) ?? 0, Complaint = curMonthFirstTimeList?.Sum(qitem => qitem.Complaint) ?? 0, ComplaintScore = curMonthFirstTimeList?.Sum(qitem => qitem.ComplaintScore) ?? 0, TeacherBeLate = curMonthFirstTimeList?.Sum(qitem => qitem.TeacherBeLate) ?? 0, TeacherBeLateScore = curMonthFirstTimeList?.Sum(qitem => qitem.TeacherBeLateScore) ?? 0, N5ClassHours = curMonthFirstTimeList?.Sum(qitem => qitem.N5ClassHours) ?? 0, N5ClassHoursScore = curMonthFirstTimeList?.Sum(qitem => qitem.N5ClassHoursScore) ?? 0, N4ClassHours = curMonthFirstTimeList?.Sum(qitem => qitem.N4ClassHours) ?? 0, N4ClassHoursScore = curMonthFirstTimeList?.Sum(qitem => qitem.N4ClassHoursScore) ?? 0, N3ClassHours = curMonthFirstTimeList?.Sum(qitem => qitem.N3ClassHours) ?? 0, N3ClassHoursScore = curMonthFirstTimeList?.Sum(qitem => qitem.N3ClassHoursScore) ?? 0, N2ClassHours = curMonthFirstTimeList?.Sum(qitem => qitem.N2ClassHours) ?? 0, N2ClassHoursScore = curMonthFirstTimeList?.Sum(qitem => qitem.N2ClassHoursScore) ?? 0, N1ClassHours = curMonthFirstTimeList?.Sum(qitem => qitem.N1ClassHours) ?? 0, N1ClassHoursScore = curMonthFirstTimeList?.Sum(qitem => qitem.N1ClassHoursScore) ?? 0, MiniAppPractise = curMonthFirstTimeList?.Sum(qitem => qitem.MiniAppPractise) ?? 0, MiniAppPractiseScore = curMonthFirstTimeList?.Sum(qitem => qitem.MiniAppPractiseScore) ?? 0, MiniAppTime = curMonthFirstTimeList?.Sum(qitem => qitem.MiniAppTime) ?? 0, MiniAppTimeScore = curMonthFirstTimeList?.Sum(qitem => qitem.MiniAppTimeScore) ?? 0, TotalScore = curMonthFirstTimeList?.Sum(qitem => qitem.TotalScore) ?? 0, AvgScore = curMonthFirstTimeList?.Sum(qitem => qitem.AvgScore) ?? 0, ScoreGap = curMonthFirstTimeList?.Sum(qitem => qitem.ScoreGap) ?? 0, ActivityNum = curMonthFirstTimeList?.Sum(qitem => qitem.ActivityNum) ?? 0, YearStr = newDate.Year, MonthStr = newDate.Month, TeacherId = item.AccountId, }; firstTimeStaticModel.Times = 2; firstTimeStaticModel.Group_Id = user.Group_Id; firstTimeStaticModel.School_Id = user.School_Id; firstTimeStaticModel.CreateBy = user.Id; firstTimeStaticModel.CreateTime = DateTime.Now; teacher_StaticRepository.Insert(firstTimeStaticModel); } } else { times = 3; //记录本月第二阶段总数 if (newDay == 21) { var curMonthSecondTimeList = teacher_StaticRepository.GetTeacherStaticListRepository(new RB_Teacher_Static_Extend() { YearStr = newDate.Year, MonthStr = newDate.Month, Times = 2, TeacherId = item.AccountId, })?.Where(qitem => !string.IsNullOrEmpty(Common.ConvertHelper.FormatDate(qitem.Date)))?.ToList(); var secondTimeStaticModel = new RB_Teacher_Static_Extend() { Id = 0, StudentCount = curMonthSecondTimeList?.Sum(qitem => qitem.StudentCount) ?? 0, AttendClassHour = curMonthSecondTimeList?.Sum(qitem => qitem.AttendClassHour) ?? 0, AttendClassHourScore = curMonthSecondTimeList?.Sum(qitem => qitem.AttendClassHourScore) ?? 0, OnLineInteractive = curMonthSecondTimeList?.Sum(qitem => qitem.OnLineInteractive) ?? 0, OnLineInteractiveScore = curMonthSecondTimeList?.Sum(qitem => qitem.OnLineInteractiveScore) ?? 0, Renew = curMonthSecondTimeList?.Sum(qitem => qitem.Renew) ?? 0, RenewScore = curMonthSecondTimeList?.Sum(qitem => qitem.RenewScore) ?? 0, Upgrade = curMonthSecondTimeList?.Sum(qitem => qitem.Upgrade) ?? 0, UpgradeScore = curMonthSecondTimeList?.Sum(qitem => qitem.UpgradeScore) ?? 0, Trans = curMonthSecondTimeList?.Sum(qitem => qitem.Trans) ?? 0, TransScore = curMonthSecondTimeList?.Sum(qitem => qitem.TransScore) ?? 0, TrialSpeak = curMonthSecondTimeList?.Sum(qitem => qitem.TrialSpeak) ?? 0, TrialSpeakScore = curMonthSecondTimeList?.Sum(qitem => qitem.TrialSpeakScore) ?? 0, Truancy = curMonthSecondTimeList?.Sum(qitem => qitem.Truancy) ?? 0, TruancyScore = curMonthSecondTimeList?.Sum(qitem => qitem.TruancyScore) ?? 0, Withdraws = curMonthSecondTimeList?.Sum(qitem => qitem.Withdraws) ?? 0, WithdrawsScore = curMonthSecondTimeList?.Sum(qitem => qitem.WithdrawsScore) ?? 0, Complaint = curMonthSecondTimeList?.Sum(qitem => qitem.Complaint) ?? 0, ComplaintScore = curMonthSecondTimeList?.Sum(qitem => qitem.ComplaintScore) ?? 0, TeacherBeLate = curMonthSecondTimeList?.Sum(qitem => qitem.TeacherBeLate) ?? 0, TeacherBeLateScore = curMonthSecondTimeList?.Sum(qitem => qitem.TeacherBeLateScore) ?? 0, N5ClassHours = curMonthSecondTimeList?.Sum(qitem => qitem.N5ClassHours) ?? 0, N5ClassHoursScore = curMonthSecondTimeList?.Sum(qitem => qitem.N5ClassHoursScore) ?? 0, N4ClassHours = curMonthSecondTimeList?.Sum(qitem => qitem.N4ClassHours) ?? 0, N4ClassHoursScore = curMonthSecondTimeList?.Sum(qitem => qitem.N4ClassHoursScore) ?? 0, N3ClassHours = curMonthSecondTimeList?.Sum(qitem => qitem.N3ClassHours) ?? 0, N3ClassHoursScore = curMonthSecondTimeList?.Sum(qitem => qitem.N3ClassHoursScore) ?? 0, N2ClassHours = curMonthSecondTimeList?.Sum(qitem => qitem.N2ClassHours) ?? 0, N2ClassHoursScore = curMonthSecondTimeList?.Sum(qitem => qitem.N2ClassHoursScore) ?? 0, N1ClassHours = curMonthSecondTimeList?.Sum(qitem => qitem.N1ClassHours) ?? 0, N1ClassHoursScore = curMonthSecondTimeList?.Sum(qitem => qitem.N1ClassHoursScore) ?? 0, MiniAppPractise = curMonthSecondTimeList?.Sum(qitem => qitem.MiniAppPractise) ?? 0, MiniAppPractiseScore = curMonthSecondTimeList?.Sum(qitem => qitem.MiniAppPractiseScore) ?? 0, MiniAppTime = curMonthSecondTimeList?.Sum(qitem => qitem.MiniAppTime) ?? 0, MiniAppTimeScore = curMonthSecondTimeList?.Sum(qitem => qitem.MiniAppTimeScore) ?? 0, TotalScore = curMonthSecondTimeList?.Sum(qitem => qitem.TotalScore) ?? 0, AvgScore = curMonthSecondTimeList?.Sum(qitem => qitem.AvgScore) ?? 0, ScoreGap = curMonthSecondTimeList?.Sum(qitem => qitem.ScoreGap) ?? 0, ActivityNum = curMonthSecondTimeList?.Sum(qitem => qitem.ActivityNum) ?? 0, YearStr = newDate.Year, MonthStr = newDate.Month, TeacherId = item.AccountId, }; secondTimeStaticModel.Times = 3; secondTimeStaticModel.Group_Id = user.Group_Id; secondTimeStaticModel.School_Id = user.School_Id; secondTimeStaticModel.CreateBy = user.Id; secondTimeStaticModel.CreateTime = DateTime.Now; teacher_StaticRepository.Insert(secondTimeStaticModel); } } newModel.Times = times; newModel.Group_Id = user.Group_Id; newModel.School_Id = user.School_Id; newModel.CreateBy = user.Id; newModel.CreateTime = DateTime.Now; if (flag) { var newId = teacher_StaticRepository.Insert(newModel); newModel.Id = newId; flag = newId > 0; } //本月最后一天 if (newDay == curMonthLastDay.Day) { var curMonthThirdTimeList = teacher_StaticRepository.GetTeacherStaticListRepository(new RB_Teacher_Static_Extend() { YearStr = newDate.Year, MonthStr = newDate.Month, Times = 3, TeacherId = item.AccountId, })?.Where(qitem => !string.IsNullOrEmpty(Common.ConvertHelper.FormatDate(qitem.Date)))?.ToList(); var thirdTimeStaticModel = new RB_Teacher_Static_Extend() { Id = 0, StudentCount = curMonthThirdTimeList?.Sum(qitem => qitem.StudentCount) ?? 0, AttendClassHour = curMonthThirdTimeList?.Sum(qitem => qitem.AttendClassHour) ?? 0, AttendClassHourScore = curMonthThirdTimeList?.Sum(qitem => qitem.AttendClassHourScore) ?? 0, OnLineInteractive = curMonthThirdTimeList?.Sum(qitem => qitem.OnLineInteractive) ?? 0, OnLineInteractiveScore = curMonthThirdTimeList?.Sum(qitem => qitem.OnLineInteractiveScore) ?? 0, Renew = curMonthThirdTimeList?.Sum(qitem => qitem.Renew) ?? 0, RenewScore = curMonthThirdTimeList?.Sum(qitem => qitem.RenewScore) ?? 0, Upgrade = curMonthThirdTimeList?.Sum(qitem => qitem.Upgrade) ?? 0, UpgradeScore = curMonthThirdTimeList?.Sum(qitem => qitem.UpgradeScore) ?? 0, Trans = curMonthThirdTimeList?.Sum(qitem => qitem.Trans) ?? 0, TransScore = curMonthThirdTimeList?.Sum(qitem => qitem.TransScore) ?? 0, TrialSpeak = curMonthThirdTimeList?.Sum(qitem => qitem.TrialSpeak) ?? 0, TrialSpeakScore = curMonthThirdTimeList?.Sum(qitem => qitem.TrialSpeakScore) ?? 0, Truancy = curMonthThirdTimeList?.Sum(qitem => qitem.Truancy) ?? 0, TruancyScore = curMonthThirdTimeList?.Sum(qitem => qitem.TruancyScore) ?? 0, Withdraws = curMonthThirdTimeList?.Sum(qitem => qitem.Withdraws) ?? 0, WithdrawsScore = curMonthThirdTimeList?.Sum(qitem => qitem.WithdrawsScore) ?? 0, Complaint = curMonthThirdTimeList?.Sum(qitem => qitem.Complaint) ?? 0, ComplaintScore = curMonthThirdTimeList?.Sum(qitem => qitem.ComplaintScore) ?? 0, TeacherBeLate = curMonthThirdTimeList?.Sum(qitem => qitem.TeacherBeLate) ?? 0, TeacherBeLateScore = curMonthThirdTimeList?.Sum(qitem => qitem.TeacherBeLateScore) ?? 0, N5ClassHours = curMonthThirdTimeList?.Sum(qitem => qitem.N5ClassHours) ?? 0, N5ClassHoursScore = curMonthThirdTimeList?.Sum(qitem => qitem.N5ClassHoursScore) ?? 0, N4ClassHours = curMonthThirdTimeList?.Sum(qitem => qitem.N4ClassHours) ?? 0, N4ClassHoursScore = curMonthThirdTimeList?.Sum(qitem => qitem.N4ClassHoursScore) ?? 0, N3ClassHours = curMonthThirdTimeList?.Sum(qitem => qitem.N3ClassHours) ?? 0, N3ClassHoursScore = curMonthThirdTimeList?.Sum(qitem => qitem.N3ClassHoursScore) ?? 0, N2ClassHours = curMonthThirdTimeList?.Sum(qitem => qitem.N2ClassHours) ?? 0, N2ClassHoursScore = curMonthThirdTimeList?.Sum(qitem => qitem.N2ClassHoursScore) ?? 0, N1ClassHours = curMonthThirdTimeList?.Sum(qitem => qitem.N1ClassHours) ?? 0, N1ClassHoursScore = curMonthThirdTimeList?.Sum(qitem => qitem.N1ClassHoursScore) ?? 0, MiniAppPractise = curMonthThirdTimeList?.Sum(qitem => qitem.MiniAppPractise) ?? 0, MiniAppPractiseScore = curMonthThirdTimeList?.Sum(qitem => qitem.MiniAppPractiseScore) ?? 0, MiniAppTime = curMonthThirdTimeList?.Sum(qitem => qitem.MiniAppTime) ?? 0, MiniAppTimeScore = curMonthThirdTimeList?.Sum(qitem => qitem.MiniAppTimeScore) ?? 0, TotalScore = curMonthThirdTimeList?.Sum(qitem => qitem.TotalScore) ?? 0, AvgScore = curMonthThirdTimeList?.Sum(qitem => qitem.AvgScore) ?? 0, ScoreGap = curMonthThirdTimeList?.Sum(qitem => qitem.ScoreGap) ?? 0, ActivityNum = curMonthThirdTimeList?.Sum(qitem => qitem.ActivityNum) ?? 0, YearStr = newDate.Year, MonthStr = newDate.Month, TeacherId = item.AccountId, }; thirdTimeStaticModel.Times = 4; thirdTimeStaticModel.Group_Id = user.Group_Id; thirdTimeStaticModel.School_Id = user.School_Id; thirdTimeStaticModel.CreateBy = user.Id; thirdTimeStaticModel.CreateTime = DateTime.Now; teacher_StaticRepository.Insert(thirdTimeStaticModel); } } //合计 var newModel2 = new RB_Teacher_Static_Extend() { Id = 0, Date = newDate, StudentCount = procModelList?.Sum(qitem => qitem.StudentCount) ?? 0, AttendClassHour = procModelList?.Sum(qitem => qitem.AttendClassHour) ?? 0, AttendClassHourScore = procModelList?.Sum(qitem => qitem.AttendClassHourScore) ?? 0, Renew = procModelList?.Sum(qitem => qitem.Renew) ?? 0, RenewScore = procModelList?.Sum(qitem => qitem.RenewScore) ?? 0, Upgrade = procModelList?.Sum(qitem => qitem.Upgrade) ?? 0, UpgradeScore = procModelList?.Sum(qitem => qitem.UpgradeScore) ?? 0, Trans = procModelList?.Sum(qitem => qitem.Trans) ?? 0, TransScore = procModelList?.Sum(qitem => qitem.TransScore) ?? 0, TrialSpeak = procModelList?.Sum(qitem => qitem.TrialSpeak) ?? 0, TrialSpeakScore = procModelList?.Sum(qitem => qitem.TrialSpeakScore) ?? 0, Truancy = procModelList?.Sum(qitem => qitem.Truancy) ?? 0, TruancyScore = procModelList?.Sum(qitem => qitem.TruancyScore) ?? 0, Withdraws = procModelList?.Sum(qitem => qitem.Withdraws) ?? 0, WithdrawsScore = procModelList?.Sum(qitem => qitem.WithdrawsScore) ?? 0, Complaint = procModelList?.Sum(qitem => qitem.Complaint) ?? 0, ComplaintScore = procModelList?.Sum(qitem => qitem.ComplaintScore) ?? 0, N5ClassHours = procModelList?.Sum(qitem => qitem.N5ClassHours) ?? 0, N5ClassHoursScore = procModelList?.Sum(qitem => qitem.N5ClassHoursScore) ?? 0, N4ClassHours = procModelList?.Sum(qitem => qitem.N4ClassHours) ?? 0, N4ClassHoursScore = procModelList?.Sum(qitem => qitem.N4ClassHoursScore) ?? 0, N3ClassHours = procModelList?.Sum(qitem => qitem.N3ClassHours) ?? 0, N3ClassHoursScore = procModelList?.Sum(qitem => qitem.N3ClassHoursScore) ?? 0, N2ClassHours = procModelList?.Sum(qitem => qitem.N2ClassHours) ?? 0, N2ClassHoursScore = procModelList?.Sum(qitem => qitem.N2ClassHoursScore) ?? 0, N1ClassHours = procModelList?.Sum(qitem => qitem.N1ClassHours) ?? 0, N1ClassHoursScore = procModelList?.Sum(qitem => qitem.N1ClassHoursScore) ?? 0, MiniAppPractise = procModelList?.Sum(qitem => qitem.MiniAppPractise) ?? 0, MiniAppPractiseScore = procModelList?.Sum(qitem => qitem.MiniAppPractiseScore) ?? 0, MiniAppTime = procModelList?.Sum(qitem => qitem.MiniAppTime) ?? 0, MiniAppTimeScore = procModelList?.Sum(qitem => qitem.MiniAppTimeScore) ?? 0, ActivityNum = procModelList?.Sum(qitem => qitem.ActivityNum) ?? 0, YearStr = newDate.Year, MonthStr = newDate.Month, TeacherId = 0, }; newModel2.OnLineInteractive = messageList?.Sum(qitem => qitem.MessageCount) ?? 0; newModel2.OnLineInteractiveScore = newModel2.OnLineInteractive; newModel2.TeacherBeLate = checkList?.Where(qitem => qitem.ExceptionCount > 0)?.Count() ?? 0; newModel2.TeacherBeLateScore = newModel2.TeacherBeLate; newModel2.TotalScore = (newModel2.StudentCount + newModel2.AttendClassHourScore + newModel2.OnLineInteractiveScore + newModel2.RenewScore + newModel2.UpgradeScore + newModel2.TransScore + newModel2.TrialSpeakScore - newModel2.TruancyScore - newModel2.WithdrawsScore - newModel2.ComplaintScore - newModel2.TeacherBeLateScore + newModel2.MiniAppPractiseScore + newModel2.MiniAppTimeScore + newModel2.ActivityNum + newModel2.N5ClassHoursScore * 1 + newModel2.N4ClassHoursScore * 2 + newModel2.N3ClassHoursScore * 3 + newModel2.N2ClassHoursScore * 4 + newModel2.N1ClassHoursScore * 5 ); newModel2.AvgScore = Math.Round(newModel2.TotalScore / teacherCount, 2); newModel2.ScoreGap = newModel2.TotalScore - newModel2.AvgScore; if (newDay >= 1 && newDay <= 10) { times = 1; //记录上月最后一个时段总数 if (newDay == 1) { var lastMonthDay = newDate.AddMonths(-1); var lastMonthLastTimeList = teacher_StaticRepository.GetTeacherStaticListRepository(new RB_Teacher_Static_Extend() { YearStr = lastMonthDay.Year, MonthStr = lastMonthDay.Month, Times = 3, })?.Where(qitem => !string.IsNullOrEmpty(Common.ConvertHelper.FormatDate(qitem.Date)))?.ToList(); var staticModel = new RB_Teacher_Static_Extend() { Id = 0, StudentCount = lastMonthLastTimeList?.Sum(qitem => qitem.StudentCount) ?? 0, AttendClassHour = lastMonthLastTimeList?.Sum(qitem => qitem.AttendClassHour) ?? 0, AttendClassHourScore = lastMonthLastTimeList?.Sum(qitem => qitem.AttendClassHourScore) ?? 0, OnLineInteractive = lastMonthLastTimeList?.Sum(qitem => qitem.OnLineInteractive) ?? 0, OnLineInteractiveScore = lastMonthLastTimeList?.Sum(qitem => qitem.OnLineInteractiveScore) ?? 0, Renew = lastMonthLastTimeList?.Sum(qitem => qitem.Renew) ?? 0, RenewScore = lastMonthLastTimeList?.Sum(qitem => qitem.RenewScore) ?? 0, Upgrade = lastMonthLastTimeList?.Sum(qitem => qitem.Upgrade) ?? 0, UpgradeScore = lastMonthLastTimeList?.Sum(qitem => qitem.UpgradeScore) ?? 0, Trans = lastMonthLastTimeList?.Sum(qitem => qitem.Trans) ?? 0, TransScore = lastMonthLastTimeList?.Sum(qitem => qitem.TransScore) ?? 0, TrialSpeak = lastMonthLastTimeList?.Sum(qitem => qitem.TrialSpeak) ?? 0, TrialSpeakScore = lastMonthLastTimeList?.Sum(qitem => qitem.TrialSpeakScore) ?? 0, Truancy = lastMonthLastTimeList?.Sum(qitem => qitem.Truancy) ?? 0, TruancyScore = lastMonthLastTimeList?.Sum(qitem => qitem.TruancyScore) ?? 0, Withdraws = lastMonthLastTimeList?.Sum(qitem => qitem.Withdraws) ?? 0, WithdrawsScore = lastMonthLastTimeList?.Sum(qitem => qitem.WithdrawsScore) ?? 0, Complaint = lastMonthLastTimeList?.Sum(qitem => qitem.Complaint) ?? 0, ComplaintScore = lastMonthLastTimeList?.Sum(qitem => qitem.ComplaintScore) ?? 0, TeacherBeLate = lastMonthLastTimeList?.Sum(qitem => qitem.TeacherBeLate) ?? 0, TeacherBeLateScore = lastMonthLastTimeList?.Sum(qitem => qitem.TeacherBeLateScore) ?? 0, N5ClassHours = lastMonthLastTimeList?.Sum(qitem => qitem.N5ClassHours) ?? 0, N5ClassHoursScore = lastMonthLastTimeList?.Sum(qitem => qitem.N5ClassHoursScore) ?? 0, N4ClassHours = lastMonthLastTimeList?.Sum(qitem => qitem.N4ClassHours) ?? 0, N4ClassHoursScore = lastMonthLastTimeList?.Sum(qitem => qitem.N4ClassHoursScore) ?? 0, N3ClassHours = lastMonthLastTimeList?.Sum(qitem => qitem.N3ClassHours) ?? 0, N3ClassHoursScore = lastMonthLastTimeList?.Sum(qitem => qitem.N3ClassHoursScore) ?? 0, N2ClassHours = lastMonthLastTimeList?.Sum(qitem => qitem.N2ClassHours) ?? 0, N2ClassHoursScore = lastMonthLastTimeList?.Sum(qitem => qitem.N2ClassHoursScore) ?? 0, N1ClassHours = lastMonthLastTimeList?.Sum(qitem => qitem.N1ClassHours) ?? 0, N1ClassHoursScore = lastMonthLastTimeList?.Sum(qitem => qitem.N1ClassHoursScore) ?? 0, MiniAppPractise = lastMonthLastTimeList?.Sum(qitem => qitem.MiniAppPractise) ?? 0, MiniAppPractiseScore = lastMonthLastTimeList?.Sum(qitem => qitem.MiniAppPractiseScore) ?? 0, MiniAppTime = lastMonthLastTimeList?.Sum(qitem => qitem.MiniAppTime) ?? 0, MiniAppTimeScore = lastMonthLastTimeList?.Sum(qitem => qitem.MiniAppTimeScore) ?? 0, TotalScore = lastMonthLastTimeList?.Sum(qitem => qitem.TotalScore) ?? 0, AvgScore = lastMonthLastTimeList?.Sum(qitem => qitem.AvgScore) ?? 0, ScoreGap = lastMonthLastTimeList?.Sum(qitem => qitem.ScoreGap) ?? 0, ActivityNum = lastMonthLastTimeList?.Sum(qitem => qitem.ActivityNum) ?? 0, YearStr = newDate.Year, MonthStr = newDate.Month, TeacherId = 0, }; staticModel.Times = 1; staticModel.Group_Id = user.Group_Id; staticModel.School_Id = user.School_Id; staticModel.CreateBy = user.Id; staticModel.CreateTime = DateTime.Now; teacher_StaticRepository.Insert(staticModel); } } else if (newDay >= 11 && newDay <= 20) { times = 2; //记录本月第一阶段总数 if (newDay == 11) { var curMonthFirstTimeList = teacher_StaticRepository.GetTeacherStaticListRepository(new RB_Teacher_Static_Extend() { YearStr = newDate.Year, MonthStr = newDate.Month, Times = 1, })?.Where(qitem => !string.IsNullOrEmpty(Common.ConvertHelper.FormatDate(qitem.Date)))?.ToList(); var firstTimeStaticModel = new RB_Teacher_Static_Extend() { Id = 0, StudentCount = curMonthFirstTimeList?.Sum(qitem => qitem.StudentCount) ?? 0, AttendClassHour = curMonthFirstTimeList?.Sum(qitem => qitem.AttendClassHour) ?? 0, AttendClassHourScore = curMonthFirstTimeList?.Sum(qitem => qitem.AttendClassHourScore) ?? 0, OnLineInteractive = curMonthFirstTimeList?.Sum(qitem => qitem.OnLineInteractive) ?? 0, OnLineInteractiveScore = curMonthFirstTimeList?.Sum(qitem => qitem.OnLineInteractiveScore) ?? 0, Renew = curMonthFirstTimeList?.Sum(qitem => qitem.Renew) ?? 0, RenewScore = curMonthFirstTimeList?.Sum(qitem => qitem.RenewScore) ?? 0, Upgrade = curMonthFirstTimeList?.Sum(qitem => qitem.Upgrade) ?? 0, UpgradeScore = curMonthFirstTimeList?.Sum(qitem => qitem.UpgradeScore) ?? 0, Trans = curMonthFirstTimeList?.Sum(qitem => qitem.Trans) ?? 0, TransScore = curMonthFirstTimeList?.Sum(qitem => qitem.TransScore) ?? 0, TrialSpeak = curMonthFirstTimeList?.Sum(qitem => qitem.TrialSpeak) ?? 0, TrialSpeakScore = curMonthFirstTimeList?.Sum(qitem => qitem.TrialSpeakScore) ?? 0, Truancy = curMonthFirstTimeList?.Sum(qitem => qitem.Truancy) ?? 0, TruancyScore = curMonthFirstTimeList?.Sum(qitem => qitem.TruancyScore) ?? 0, Withdraws = curMonthFirstTimeList?.Sum(qitem => qitem.Withdraws) ?? 0, WithdrawsScore = curMonthFirstTimeList?.Sum(qitem => qitem.WithdrawsScore) ?? 0, Complaint = curMonthFirstTimeList?.Sum(qitem => qitem.Complaint) ?? 0, ComplaintScore = curMonthFirstTimeList?.Sum(qitem => qitem.ComplaintScore) ?? 0, TeacherBeLate = curMonthFirstTimeList?.Sum(qitem => qitem.TeacherBeLate) ?? 0, TeacherBeLateScore = curMonthFirstTimeList?.Sum(qitem => qitem.TeacherBeLateScore) ?? 0, N5ClassHours = curMonthFirstTimeList?.Sum(qitem => qitem.N5ClassHours) ?? 0, N5ClassHoursScore = curMonthFirstTimeList?.Sum(qitem => qitem.N5ClassHoursScore) ?? 0, N4ClassHours = curMonthFirstTimeList?.Sum(qitem => qitem.N4ClassHours) ?? 0, N4ClassHoursScore = curMonthFirstTimeList?.Sum(qitem => qitem.N4ClassHoursScore) ?? 0, N3ClassHours = curMonthFirstTimeList?.Sum(qitem => qitem.N3ClassHours) ?? 0, N3ClassHoursScore = curMonthFirstTimeList?.Sum(qitem => qitem.N3ClassHoursScore) ?? 0, N2ClassHours = curMonthFirstTimeList?.Sum(qitem => qitem.N2ClassHours) ?? 0, N2ClassHoursScore = curMonthFirstTimeList?.Sum(qitem => qitem.N2ClassHoursScore) ?? 0, N1ClassHours = curMonthFirstTimeList?.Sum(qitem => qitem.N1ClassHours) ?? 0, N1ClassHoursScore = curMonthFirstTimeList?.Sum(qitem => qitem.N1ClassHoursScore) ?? 0, MiniAppPractise = curMonthFirstTimeList?.Sum(qitem => qitem.MiniAppPractise) ?? 0, MiniAppPractiseScore = curMonthFirstTimeList?.Sum(qitem => qitem.MiniAppPractiseScore) ?? 0, MiniAppTime = curMonthFirstTimeList?.Sum(qitem => qitem.MiniAppTime) ?? 0, MiniAppTimeScore = curMonthFirstTimeList?.Sum(qitem => qitem.MiniAppTimeScore) ?? 0, TotalScore = curMonthFirstTimeList?.Sum(qitem => qitem.TotalScore) ?? 0, AvgScore = curMonthFirstTimeList?.Sum(qitem => qitem.AvgScore) ?? 0, ScoreGap = curMonthFirstTimeList?.Sum(qitem => qitem.ScoreGap) ?? 0, ActivityNum = curMonthFirstTimeList?.Sum(qitem => qitem.ActivityNum) ?? 0, YearStr = newDate.Year, MonthStr = newDate.Month, }; firstTimeStaticModel.Times = 2; firstTimeStaticModel.Group_Id = user.Group_Id; firstTimeStaticModel.School_Id = user.School_Id; firstTimeStaticModel.CreateBy = user.Id; firstTimeStaticModel.CreateTime = DateTime.Now; teacher_StaticRepository.Insert(firstTimeStaticModel); } } else { times = 3; //记录本月第二阶段总数 if (newDay == 21) { var curMonthSecondTimeList = teacher_StaticRepository.GetTeacherStaticListRepository(new RB_Teacher_Static_Extend() { YearStr = newDate.Year, MonthStr = newDate.Month, Times = 2, })?.Where(qitem => !string.IsNullOrEmpty(Common.ConvertHelper.FormatDate(qitem.Date)))?.ToList(); var secondTimeStaticModel = new RB_Teacher_Static_Extend() { Id = 0, StudentCount = curMonthSecondTimeList?.Sum(qitem => qitem.StudentCount) ?? 0, AttendClassHour = curMonthSecondTimeList?.Sum(qitem => qitem.AttendClassHour) ?? 0, AttendClassHourScore = curMonthSecondTimeList?.Sum(qitem => qitem.AttendClassHourScore) ?? 0, OnLineInteractive = curMonthSecondTimeList?.Sum(qitem => qitem.OnLineInteractive) ?? 0, OnLineInteractiveScore = curMonthSecondTimeList?.Sum(qitem => qitem.OnLineInteractiveScore) ?? 0, Renew = curMonthSecondTimeList?.Sum(qitem => qitem.Renew) ?? 0, RenewScore = curMonthSecondTimeList?.Sum(qitem => qitem.RenewScore) ?? 0, Upgrade = curMonthSecondTimeList?.Sum(qitem => qitem.Upgrade) ?? 0, UpgradeScore = curMonthSecondTimeList?.Sum(qitem => qitem.UpgradeScore) ?? 0, Trans = curMonthSecondTimeList?.Sum(qitem => qitem.Trans) ?? 0, TransScore = curMonthSecondTimeList?.Sum(qitem => qitem.TransScore) ?? 0, TrialSpeak = curMonthSecondTimeList?.Sum(qitem => qitem.TrialSpeak) ?? 0, TrialSpeakScore = curMonthSecondTimeList?.Sum(qitem => qitem.TrialSpeakScore) ?? 0, Truancy = curMonthSecondTimeList?.Sum(qitem => qitem.Truancy) ?? 0, TruancyScore = curMonthSecondTimeList?.Sum(qitem => qitem.TruancyScore) ?? 0, Withdraws = curMonthSecondTimeList?.Sum(qitem => qitem.Withdraws) ?? 0, WithdrawsScore = curMonthSecondTimeList?.Sum(qitem => qitem.WithdrawsScore) ?? 0, Complaint = curMonthSecondTimeList?.Sum(qitem => qitem.Complaint) ?? 0, ComplaintScore = curMonthSecondTimeList?.Sum(qitem => qitem.ComplaintScore) ?? 0, TeacherBeLate = curMonthSecondTimeList?.Sum(qitem => qitem.TeacherBeLate) ?? 0, TeacherBeLateScore = curMonthSecondTimeList?.Sum(qitem => qitem.TeacherBeLateScore) ?? 0, N5ClassHours = curMonthSecondTimeList?.Sum(qitem => qitem.N5ClassHours) ?? 0, N5ClassHoursScore = curMonthSecondTimeList?.Sum(qitem => qitem.N5ClassHoursScore) ?? 0, N4ClassHours = curMonthSecondTimeList?.Sum(qitem => qitem.N4ClassHours) ?? 0, N4ClassHoursScore = curMonthSecondTimeList?.Sum(qitem => qitem.N4ClassHoursScore) ?? 0, N3ClassHours = curMonthSecondTimeList?.Sum(qitem => qitem.N3ClassHours) ?? 0, N3ClassHoursScore = curMonthSecondTimeList?.Sum(qitem => qitem.N3ClassHoursScore) ?? 0, N2ClassHours = curMonthSecondTimeList?.Sum(qitem => qitem.N2ClassHours) ?? 0, N2ClassHoursScore = curMonthSecondTimeList?.Sum(qitem => qitem.N2ClassHoursScore) ?? 0, N1ClassHours = curMonthSecondTimeList?.Sum(qitem => qitem.N1ClassHours) ?? 0, N1ClassHoursScore = curMonthSecondTimeList?.Sum(qitem => qitem.N1ClassHoursScore) ?? 0, MiniAppPractise = curMonthSecondTimeList?.Sum(qitem => qitem.MiniAppPractise) ?? 0, MiniAppPractiseScore = curMonthSecondTimeList?.Sum(qitem => qitem.MiniAppPractiseScore) ?? 0, MiniAppTime = curMonthSecondTimeList?.Sum(qitem => qitem.MiniAppTime) ?? 0, MiniAppTimeScore = curMonthSecondTimeList?.Sum(qitem => qitem.MiniAppTimeScore) ?? 0, TotalScore = curMonthSecondTimeList?.Sum(qitem => qitem.TotalScore) ?? 0, AvgScore = curMonthSecondTimeList?.Sum(qitem => qitem.AvgScore) ?? 0, ScoreGap = curMonthSecondTimeList?.Sum(qitem => qitem.ScoreGap) ?? 0, ActivityNum = curMonthSecondTimeList?.Sum(qitem => qitem.ActivityNum) ?? 0, YearStr = newDate.Year, MonthStr = newDate.Month, }; secondTimeStaticModel.Times = 3; secondTimeStaticModel.Group_Id = user.Group_Id; secondTimeStaticModel.School_Id = user.School_Id; secondTimeStaticModel.CreateBy = user.Id; secondTimeStaticModel.CreateTime = DateTime.Now; teacher_StaticRepository.Insert(secondTimeStaticModel); } } newModel2.Times = times; newModel2.Group_Id = user.Group_Id; newModel2.School_Id = user.School_Id; newModel2.CreateBy = user.Id; newModel2.CreateTime = DateTime.Now; if (flag) { var newId = teacher_StaticRepository.Insert(newModel2); newModel2.Id = newId; flag = newId > 0; } //本月最后一天 if (newDay == curMonthLastDay.Day) { var curMonthThirdTimeList = teacher_StaticRepository.GetTeacherStaticListRepository(new RB_Teacher_Static_Extend() { YearStr = newDate.Year, MonthStr = newDate.Month, Times = 3, })?.Where(qitem => !string.IsNullOrEmpty(Common.ConvertHelper.FormatDate(qitem.Date)))?.ToList(); var thirdTimeStaticModel = new RB_Teacher_Static_Extend() { Id = 0, StudentCount = curMonthThirdTimeList?.Sum(qitem => qitem.StudentCount) ?? 0, AttendClassHour = curMonthThirdTimeList?.Sum(qitem => qitem.AttendClassHour) ?? 0, AttendClassHourScore = curMonthThirdTimeList?.Sum(qitem => qitem.AttendClassHourScore) ?? 0, OnLineInteractive = curMonthThirdTimeList?.Sum(qitem => qitem.OnLineInteractive) ?? 0, OnLineInteractiveScore = curMonthThirdTimeList?.Sum(qitem => qitem.OnLineInteractiveScore) ?? 0, Renew = curMonthThirdTimeList?.Sum(qitem => qitem.Renew) ?? 0, RenewScore = curMonthThirdTimeList?.Sum(qitem => qitem.RenewScore) ?? 0, Upgrade = curMonthThirdTimeList?.Sum(qitem => qitem.Upgrade) ?? 0, UpgradeScore = curMonthThirdTimeList?.Sum(qitem => qitem.UpgradeScore) ?? 0, Trans = curMonthThirdTimeList?.Sum(qitem => qitem.Trans) ?? 0, TransScore = curMonthThirdTimeList?.Sum(qitem => qitem.TransScore) ?? 0, TrialSpeak = curMonthThirdTimeList?.Sum(qitem => qitem.TrialSpeak) ?? 0, TrialSpeakScore = curMonthThirdTimeList?.Sum(qitem => qitem.TrialSpeakScore) ?? 0, Truancy = curMonthThirdTimeList?.Sum(qitem => qitem.Truancy) ?? 0, TruancyScore = curMonthThirdTimeList?.Sum(qitem => qitem.TruancyScore) ?? 0, Withdraws = curMonthThirdTimeList?.Sum(qitem => qitem.Withdraws) ?? 0, WithdrawsScore = curMonthThirdTimeList?.Sum(qitem => qitem.WithdrawsScore) ?? 0, Complaint = curMonthThirdTimeList?.Sum(qitem => qitem.Complaint) ?? 0, ComplaintScore = curMonthThirdTimeList?.Sum(qitem => qitem.ComplaintScore) ?? 0, TeacherBeLate = curMonthThirdTimeList?.Sum(qitem => qitem.TeacherBeLate) ?? 0, TeacherBeLateScore = curMonthThirdTimeList?.Sum(qitem => qitem.TeacherBeLateScore) ?? 0, N5ClassHours = curMonthThirdTimeList?.Sum(qitem => qitem.N5ClassHours) ?? 0, N5ClassHoursScore = curMonthThirdTimeList?.Sum(qitem => qitem.N5ClassHoursScore) ?? 0, N4ClassHours = curMonthThirdTimeList?.Sum(qitem => qitem.N4ClassHours) ?? 0, N4ClassHoursScore = curMonthThirdTimeList?.Sum(qitem => qitem.N4ClassHoursScore) ?? 0, N3ClassHours = curMonthThirdTimeList?.Sum(qitem => qitem.N3ClassHours) ?? 0, N3ClassHoursScore = curMonthThirdTimeList?.Sum(qitem => qitem.N3ClassHoursScore) ?? 0, N2ClassHours = curMonthThirdTimeList?.Sum(qitem => qitem.N2ClassHours) ?? 0, N2ClassHoursScore = curMonthThirdTimeList?.Sum(qitem => qitem.N2ClassHoursScore) ?? 0, N1ClassHours = curMonthThirdTimeList?.Sum(qitem => qitem.N1ClassHours) ?? 0, N1ClassHoursScore = curMonthThirdTimeList?.Sum(qitem => qitem.N1ClassHoursScore) ?? 0, MiniAppPractise = curMonthThirdTimeList?.Sum(qitem => qitem.MiniAppPractise) ?? 0, MiniAppPractiseScore = curMonthThirdTimeList?.Sum(qitem => qitem.MiniAppPractiseScore) ?? 0, MiniAppTime = curMonthThirdTimeList?.Sum(qitem => qitem.MiniAppTime) ?? 0, MiniAppTimeScore = curMonthThirdTimeList?.Sum(qitem => qitem.MiniAppTimeScore) ?? 0, TotalScore = curMonthThirdTimeList?.Sum(qitem => qitem.TotalScore) ?? 0, AvgScore = curMonthThirdTimeList?.Sum(qitem => qitem.AvgScore) ?? 0, ScoreGap = curMonthThirdTimeList?.Sum(qitem => qitem.ScoreGap) ?? 0, ActivityNum = curMonthThirdTimeList?.Sum(qitem => qitem.ActivityNum) ?? 0, YearStr = newDate.Year, MonthStr = newDate.Month, TeacherId = 0, }; thirdTimeStaticModel.Times = 4; thirdTimeStaticModel.Group_Id = user.Group_Id; thirdTimeStaticModel.School_Id = user.School_Id; thirdTimeStaticModel.CreateBy = user.Id; thirdTimeStaticModel.CreateTime = DateTime.Now; teacher_StaticRepository.Insert(thirdTimeStaticModel); } } return flag; } } }