Commit aadcc7cc authored by liudong1993's avatar liudong1993

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

parents a3a5b121 36e07629
......@@ -2077,7 +2077,7 @@ namespace Edu.Module.Course
var sellerInfo = UserReidsCache.GetUserLoginInfo(orderModel.EnterID);
#region 欠费提醒(销售)
var queryTargetWorkId = accountRepository.GetWorkUserIdRepository(orderModel.EnterID);
if (!string.IsNullOrEmpty(queryTargetWorkId))
if (!string.IsNullOrEmpty(queryTargetWorkId)&& sellerInfo!=null )
{
// 学员名称(名称+电话),剩余课时,关联单号,待收金额,班级老师,班级名称
var path = $"/sale/myOrder?OrderId={guestModel.OrderId}";
......@@ -2135,10 +2135,11 @@ namespace Edu.Module.Course
{
var shengyuMoney = orderModel.PreferPrice - orderModel.Income + orderModel.Refund - orderModel.PlatformTax - orderModel.DiscountMoney - orderModel.LessPrice;
var classModel = classRepository.GetEntity<RB_Class_ViewModel>(guestModel.ClassId);
var sellerInfo = UserReidsCache.GetUserLoginInfo(orderModel.EnterID);
var sellerInfo = UserReidsCache.GetUserLoginInfo(orderModel.CreateBy);
#region 即将欠费提醒(销售)
var queryTargetWorkId = accountRepository.GetWorkUserIdRepository(orderModel.EnterID);
if (!string.IsNullOrEmpty(queryTargetWorkId))
var queryTargetWorkId = accountRepository.GetWorkUserIdRepository(orderModel.CreateBy);
if (!string.IsNullOrEmpty(queryTargetWorkId)&& sellerInfo!=null)
{
// 学员名称(名称+电话),剩余课时,关联单号,待收金额,班级老师,班级名称
var path = $"/sale/myOrder?OrderId={guestModel.OrderId}";
......@@ -2198,7 +2199,7 @@ namespace Edu.Module.Course
var sellerInfo = UserReidsCache.GetUserLoginInfo(orderModel.EnterID);
#region 即将结课提醒 (销售端)
var queryTargetWorkId = accountRepository.GetWorkUserIdRepository(orderModel.EnterID);
if (!string.IsNullOrEmpty(queryTargetWorkId))
if (!string.IsNullOrEmpty(queryTargetWorkId)&&sellerInfo!=null)
{
// 学员名称(名称+电话),剩余课时,关联单号,待收金额,班级老师,班级名称
var path = $"/sale/myOrder?OrderId={guestModel.OrderId}";
......@@ -2261,7 +2262,7 @@ namespace Edu.Module.Course
var sellerInfo = UserReidsCache.GetUserLoginInfo(orderModel.EnterID);
#region 即将结课提醒 (销售端)
var queryTargetWorkId = accountRepository.GetWorkUserIdRepository(orderModel.EnterID);
if (!string.IsNullOrEmpty(queryTargetWorkId))
if (!string.IsNullOrEmpty(queryTargetWorkId)&& sellerInfo!=null)
{
// 学员名称(名称+电话),剩余课时,关联单号,待收金额,班级老师,班级名称
var path = $"/sale/myOrder?OrderId={guestModel.OrderId}";
......@@ -5289,7 +5290,8 @@ namespace Edu.Module.Course
//约课
planModel = class_PlanRepository.GetToDayClassPlanForYK(stuId, courseId, groupId);
}
else {
else
{
planModel = class_PlanRepository.GetToDayClassPlan(classId, groupId);
}
if (planModel != null)
......@@ -5300,7 +5302,8 @@ namespace Edu.Module.Course
var ogModel = order_GuestRepository.GetEntity(guestId);
zj = ogModel.CourseChapterNo + 1;//这次课的章节
}
else {
else
{
zj = planModel.LessonPlanNum + 1;
}
if (planModel.ClassDate.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd"))
......@@ -5571,5 +5574,52 @@ namespace Edu.Module.Course
}
}
}
/// <summary>
/// 处理学生上课进度
/// </summary>
public void DealStudentCourseChapterNoModule()
{
string toDay = Common.ConvertHelper.FormatDate(DateTime.Now.AddDays(-1));
var planList = class_PlanRepository.GetClassPlanListExtRepository(new RB_Class_Plan_ViewModel() {
StartTime = toDay,
EndTime = toDay,
PlanType = 1
});
List<RB_Order_Guest_ViewModel> guestList = new List<RB_Order_Guest_ViewModel>();
if (planList != null && planList.Count > 0)
{
string classIds = string.Join(",", planList.Select(qitem => qitem.ClassId));
if (!string.IsNullOrEmpty(classIds))
{
guestList = order_GuestRepository.GetOrderGuestListRepository(new RB_Order_Guest_ViewModel()
{
ClassIds = classIds
});
}
}
if (guestList != null && guestList.Count > 0)
{
foreach (var item in guestList)
{
var tempPlanList = planList.Where(qitem => qitem.ClassId == item.ClassId)?.ToList();
decimal times = 0;
if (tempPlanList != null && tempPlanList.Count > 0)
{
times = tempPlanList.Sum(qitem => qitem.TimeHour) / 2;
}
if (times > 0)
{
var tempCourseChapterNo = item.CourseChapterNo + times;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Order_Guest_ViewModel.CourseChapterNo), tempCourseChapterNo}
};
order_GuestRepository.Update(fileds, new WhereHelper(nameof(RB_Order_Guest_ViewModel.Id), item.Id));
}
}
}
}
}
}
\ No newline at end of file
......@@ -830,10 +830,28 @@ namespace Edu.Module.Customer
var CurMonthFollow = tempDataList?.Sum(qitem => qitem.CurMonthFollow) ?? 0;
var LastMonthFollow = tempDataList?.Sum(qitem => qitem.LastMonthFollow) ?? 0;
var AgFollow = Math.Round(yesDataList?.Average(qitem => qitem.AgFollow) ?? 0, 2);
var YestodayAgFollow = Math.Round(yesDataList?.Average(qitem => qitem.YestodayAgFollow) ?? 0, 2);
var CurWeekAgFollow = Math.Round(curWeekList?.Average(qitem => qitem.CurWeekAgFollow) ?? 0, 2);
var LastWeekAgFollow = Math.Round(lastWeekList?.Average(qitem => qitem.LastWeekAgFollow) ?? 0, 2);
decimal AgFollow = 0;
if (yesDataList != null && yesDataList.Where(qitem=>qitem.AgFollow>0).Count() > 0)
{
AgFollow = Math.Round(yesDataList?.Average(qitem => qitem.AgFollow) ?? 0, 2);
}
decimal YestodayAgFollow = 0;
if (yesDataList != null && yesDataList.Where(qitem => qitem.YestodayAgFollow > 0).Count() > 0)
{
YestodayAgFollow= Math.Round(yesDataList?.Average(qitem => qitem.YestodayAgFollow) ?? 0, 2);
}
decimal CurWeekAgFollow = 0;
if (curWeekList != null && curWeekList.Where(qitem => qitem.CurWeekAgFollow > 0).Count() > 0)
{
CurWeekAgFollow= Math.Round(curWeekList?.Average(qitem => qitem.CurWeekAgFollow) ?? 0, 2);
}
decimal LastWeekAgFollow = 0;
Math.Round(lastWeekList?.Average(qitem => qitem.LastWeekAgFollow) ?? 0, 2);
decimal CurMonthAgFollow = 0;
decimal LastMonthAgFollow = 0;
if (tempDataList != null && tempDataList.Count > 0)
......
......@@ -181,9 +181,11 @@ namespace Edu.Module.User
accountList = accountModule.GetAccountListExtModule(new RB_Account_ViewModel() { QIds = string.Join(",", empIdList) });
}
//学员到访统计
var visitList = student_VisitRepository.GetStudentVisitStaticRepository(new RB_Student_Visit_Extend()
var visitList = student_VisitRepository.GetStudentVisitStatic_V2Repository(new RB_Student_Visit_Extend()
{
QStuIds = stuIds
QStuIds = stuIds,
StartDate=query.StartTime,
EndDate=query.EndTime,
});
//学员试听统计
var stuReserveList = visitor_ReserveRepository.GetStuReserveStaticsListRepository(new Model.ViewModel.Reserve.RB_Visitor_Reserve_Extend()
......
......@@ -134,6 +134,56 @@ WHERE 1=1
return Get<RB_Student_Visit_Extend>(builder.ToString()).ToList();
}
/// <summary>
/// 获取到访列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Student_Visit_Extend> GetStudentVisitStatic_V2Repository(RB_Student_Visit_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.StuId,Count(1) AS VisitCount
FROM RB_Student_Visit AS A INNER JOIN rb_student AS B ON A.StuId=B.StuId
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Visit_Extend.Status), (int)DateStateEnum.Normal);
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Visit_Extend.Group_Id), query.Group_Id);
}
if (query.StuId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Visit_Extend.StuId), query.StuId);
}
if (!string.IsNullOrEmpty(query.QStuIds))
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Student_Visit_Extend.StuId), query.QStuIds);
}
if (query.CreateBy > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Visit_Extend.CreateBy), query.CreateBy);
}
if (!string.IsNullOrEmpty(query.QCreateByIds))
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Student_Visit_Extend.CreateBy), query.QCreateByIds);
}
if (!string.IsNullOrEmpty(query.StartDate))
{
builder.AppendFormat(" AND A.{0}>='{1}' ", nameof(RB_Student_Visit_Extend.CreateTime), Common.ConvertHelper.FormatDate(query.StartDate));
}
if (!string.IsNullOrEmpty(query.EndDate))
{
builder.AppendFormat(" AND A.{0}<='{1} 23:59:59' ", nameof(RB_Student_Visit_Extend.CreateTime), Common.ConvertHelper.FormatDate(query.EndDate));
}
}
builder.AppendFormat(" GROUP BY A.StuId ");
builder.AppendFormat(" ORDER BY A.StuId ");
return Get<RB_Student_Visit_Extend>(builder.ToString()).ToList();
}
/// <summary>
/// 市场、课程顾问学员到访统计
/// </summary>
......
......@@ -75,6 +75,10 @@ WHERE 1=1
{
builder.AppendFormat(" AND IFNULL(A.{0},'')<>'' ", nameof(RB_Class_Plan_ViewModel.RepeatPlanIds));
}
if (query.PlanType > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Plan_ViewModel.PlanType), query.PlanType);
}
}
return Get<RB_Class_Plan_ViewModel>(builder.ToString()).ToList();
}
......@@ -123,10 +127,6 @@ WHERE 1=1 AND C.`Status`=0 AND C.ClassStatus<>3
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Plan_ViewModel.TeacherId), query.TeacherId);
}
//if (query.School_Id > 0)
//{
// builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Plan_ViewModel.School_Id), query.School_Id);
//}
if (query.ClassTimeId > 0)
{
builder.AppendFormat(" AND time.{0}={1} ", nameof(RB_Class_Plan_ViewModel.ClassTimeId), query.ClassTimeId);
......@@ -151,6 +151,10 @@ WHERE 1=1 AND C.`Status`=0 AND C.ClassStatus<>3
{
builder.AppendFormat(" AND DATE_FORMAT(A.{0},'%y/%m/%d')= DATE_FORMAT('{1}','%y/%m/%d') ", nameof(RB_Class_Plan_ViewModel.ClassDate), query.QClassDateStr);
}
if (query.PlanType > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Plan_ViewModel.PlanType), query.PlanType);
}
}
return Get<RB_Class_Plan_ViewModel>(builder.ToString()).ToList();
}
......
......@@ -175,10 +175,7 @@ WHERE 1=1 AND A.Status=0
{
builder.AppendFormat($@" AND A.{nameof(RB_Order_Guest_ViewModel.Group_Id)} ={demodel.Group_Id}");
}
//if (demodel.School_Id > 0)
//{
// builder.AppendFormat($@" AND A.{nameof(RB_Order_Guest_ViewModel.School_Id)} ={demodel.School_Id}");
//}
if (demodel.OrderId > 0)
{
builder.AppendFormat($@" AND A.{nameof(RB_Order_Guest_ViewModel.OrderId)} ={demodel.OrderId}");
......
......@@ -422,6 +422,14 @@ WHERE 1=1
{
builder.AppendFormat(" AND t.{0}={1} ", nameof(RB_Student_ViewModel.StuChannel), query.StuChannel);
}
if (query.CreateType > 0 && query.StuSourceId > 0)
{
builder.AppendFormat(" AND t.{0}={1} AND t.{2}={3} ",
nameof(RB_Student_ViewModel.CreateType),
(int)query.CreateType,
nameof(RB_Student_ViewModel.StuSourceId),
query.StuSourceId);
}
}
builder.AppendFormat(" ORDER BY t.{0} DESC ", nameof(RB_Student_ViewModel.StuId));
return GetPage<RB_Student_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
......
......@@ -65,7 +65,7 @@ namespace Edu.WebApi.Controllers.Applet
/// <summary>
/// 课程单词学习、测试处理类对象
/// </summary>
private readonly CourseExamModule courseExamModule = new CourseExamModule();
private readonly CourseExamModule courseExamModule = new CourseExamModule();
/// <summary>
/// 订单仓处理类对象
......@@ -158,7 +158,7 @@ namespace Edu.WebApi.Controllers.Applet
#region 获取最新一条上课反馈记录
List<RB_Class_FeedBack_ViewModel> feedBackList = classModule.GetClassFeedBackPageListRepository(1, 1, out long count, new RB_Class_FeedBack_ViewModel { StuId = appletUserInfo.AccountId, Group_Id = appletUserInfo.Group_Id });
if (feedBackList != null && feedBackList.Any())
{
......@@ -212,7 +212,8 @@ namespace Edu.WebApi.Controllers.Applet
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetIndexInfo_V2() {
public ApiResult GetIndexInfo_V2()
{
var appletUserInfo = base.AppletUserInfo;
//判断学员是否退学
var studentList = studentModule.GetStudentInfo(appletUserInfo.AccountId, appletUserInfo.Group_Id);
......@@ -236,7 +237,8 @@ namespace Edu.WebApi.Controllers.Applet
//查询下一节课(要查询正在学习中)
var ClassNext = new object();
if ((studentModel.ClassId > 0 && studentModel.ClassStatus != 3)|| studentModel.ClassScrollType == 2) {
if ((studentModel.ClassId > 0 && studentModel.ClassStatus != 3) || studentModel.ClassScrollType == 2)
{
List<RB_Class_Time_Extend> classTimeList = new List<RB_Class_Time_Extend>();
if (studentModel.ClassScrollType == 2)
{
......@@ -271,7 +273,8 @@ namespace Edu.WebApi.Controllers.Applet
classModel.ClassName
};
}
else {
else
{
ClassNext = new
{
ClassPlanState = 3//暂无下一节课
......@@ -281,7 +284,8 @@ namespace Edu.WebApi.Controllers.Applet
//查询学习园地
var LearningGardenList = new List<object>();
var enumlist = EnumHelper.EnumToList(typeof(Common.Enum.Course.LearningGardenTypeEnum));
foreach (var item in enumlist) {
foreach (var item in enumlist)
{
var query = new RB_LearningGarden_ViewModel()
{
Group_Id = base.AppletUserInfo.Group_Id,
......@@ -302,7 +306,7 @@ namespace Edu.WebApi.Controllers.Applet
qitem.Id,
qitem.Title,
qitem.Content,
qitem.Img,
qitem.Img,
qitem.Digest,
qitem.LinkUrl,
CreateByName,
......@@ -324,20 +328,21 @@ namespace Edu.WebApi.Controllers.Applet
{
Words = classModule.GetIndexWords(studentModel.ClassId, studentModel.CourseId, studentModel.GuestId, studentModel.ClassScrollType, studentModel.StuId, appletUserInfo.Group_Id);
}
else
else
{
Words = new
{
NextWord = 0,
ReviewWord = 0,
NextCourseNo=0,
ReviewCourseNo=0,
CourseId=0,
ClassId=0,
NextCourseNo = 0,
ReviewCourseNo = 0,
CourseId = 0,
ClassId = 0,
};
}
return ApiResult.Success("", new {
return ApiResult.Success("", new
{
studentModel.GuestId,
studentModel.SName,//学区
studentModel.SurplusHours,//剩余课时
......@@ -359,7 +364,8 @@ namespace Edu.WebApi.Controllers.Applet
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetStudyCourse() {
public ApiResult GetStudyCourse()
{
var appletUserInfo = base.AppletUserInfo;
//判断学员是否退学
var studentList = studentModule.GetStudentInfo(appletUserInfo.AccountId, appletUserInfo.Group_Id);
......@@ -380,7 +386,6 @@ namespace Edu.WebApi.Controllers.Applet
studentModel = studentList.Where(x => x.ClassStatus == 3).FirstOrDefault();
}
}
var result = new
{
studentModel.GuestId,
......@@ -403,7 +408,8 @@ namespace Edu.WebApi.Controllers.Applet
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetMyStudyCourseList() {
public ApiResult GetMyStudyCourseList()
{
var appletUserInfo = base.AppletUserInfo;
//获取学生所有的课程
var studentList = studentModule.GetStudentInfo(appletUserInfo.AccountId, appletUserInfo.Group_Id);
......@@ -433,7 +439,7 @@ namespace Edu.WebApi.Controllers.Applet
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetMyStudyCourseInfo()
public ApiResult GetMyStudyCourseInfo()
{
var appletUserInfo = base.AppletUserInfo;
JObject parms = JObject.Parse(base.RequestParm.Msg.ToString());
......@@ -442,11 +448,11 @@ namespace Edu.WebApi.Controllers.Applet
int GuestId = parms.GetInt("GuestId", 0);//订单GuestId
int ClassScrollType = parms.GetInt("ClassScrollType", 0);//学习类型 1跟班 2约课
int StuId = parms.GetInt("StuId", 0);//学生ID
if (ClassId <= 0)
if (ClassId <= 0)
{
return ApiResult.ParamIsNull("请传递班级ID");
}
if (ClassScrollType == 2 )
if (ClassScrollType == 2)
{
StuId = appletUserInfo.AccountId;
}
......@@ -502,9 +508,9 @@ namespace Edu.WebApi.Controllers.Applet
Words = new
{
NextWord = 0,
NextCourseNo=0,
NextCourseNo = 0,
ReviewWord = 0,
ReviewCourseNo=0,
ReviewCourseNo = 0,
CourseId,
ClassId,
};
......@@ -552,7 +558,7 @@ namespace Edu.WebApi.Controllers.Applet
{
return ApiResult.ParamIsNull("请传递班级ID");
}
if (CourseId <= 0)
if (CourseId <= 0)
{
return ApiResult.ParamIsNull("请传递课程ID");
}
......@@ -563,7 +569,7 @@ namespace Edu.WebApi.Controllers.Applet
var MaxChapterNo = planList.Any() ? planList.Max(x => x.LessonPlanNum) : 0;
//查询所有的章节
var chapterTreeList = courseModule.GetChapterTreeListModule_V2(new Model.ViewModel.Course.RB_Course_Chapter_ViewModel() { Group_Id = appletUserInfo.Group_Id, CourseId = CourseId });
var ctList = chapterTreeList.Where(x => Convert.ToInt32(x.ChapterNo) <= MaxChapterNo).OrderByDescending(qitem=> Convert.ToInt32(qitem.ChapterNo)).ToList();
var ctList = chapterTreeList.Where(x => Convert.ToInt32(x.ChapterNo) <= MaxChapterNo).OrderByDescending(qitem => Convert.ToInt32(qitem.ChapterNo)).ToList();
//章节单词得分
var prepWordsList = courseExamModule.GetStuWordsPrepListModule(new RB_StuWords_Prep_Extend()
{
......@@ -575,8 +581,8 @@ namespace Edu.WebApi.Controllers.Applet
var wordsExamList = courseExamModule.GetStuWordsExamListModule(new RB_StuWords_Exam_Extend()
{
ClassId = ClassId,
CourseId=CourseId,
Stu_Account_Id= appletUserInfo.Id
CourseId = CourseId,
Stu_Account_Id = appletUserInfo.Id
});
//组装数据
var RList = new List<object>();
......@@ -591,7 +597,7 @@ namespace Edu.WebApi.Controllers.Applet
StudyProgress = (int)(Convert.ToDecimal(tempPrepWords.StudyNum) / Convert.ToDecimal(tempPrepWords.TotalNum) * 100);
}
int Num = 1;
decimal Score = 0;//单词测试得分
if (wordsExamList != null && wordsExamList.Count > 0)
{
......@@ -763,7 +769,6 @@ namespace Edu.WebApi.Controllers.Applet
#endregion
#region 我的课程
/// <summary>
/// 获取章节树形列表
......@@ -786,7 +791,6 @@ namespace Edu.WebApi.Controllers.Applet
}
#endregion
#region 我的合同
public ApiResult GetContractList()
{
......@@ -922,7 +926,6 @@ namespace Edu.WebApi.Controllers.Applet
}
#endregion
#region 我的请假列表
/// <summary>
/// 获取请假单据分页列表
......@@ -985,7 +988,6 @@ namespace Edu.WebApi.Controllers.Applet
}
#endregion
#region 我的考卷列表
/// <summary>
/// 获取考卷列表分页列表
......@@ -1207,7 +1209,6 @@ namespace Edu.WebApi.Controllers.Applet
#endregion
#region 学习园地
/// <summary>
......@@ -1289,7 +1290,6 @@ namespace Edu.WebApi.Controllers.Applet
}
#endregion
#region 上课反馈记录
/// <summary>
/// 获取学习园地分页
......@@ -1348,7 +1348,7 @@ namespace Edu.WebApi.Controllers.Applet
var query = new RB_Student_OrderGuest_ViewModel()
{
Account_Id = base.AppletUserInfo.Id,
OrderType=(OrderTypeEnum)base.ParmJObj.GetInt("OrderType")
OrderType = (OrderTypeEnum)base.ParmJObj.GetInt("OrderType")
};
var data = customerStudentModule.GetStuOrderGuestPageModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
List<object> list = new List<object>();
......@@ -1365,7 +1365,7 @@ namespace Edu.WebApi.Controllers.Applet
item.GuestName,
item.CourseName,
item.OrderState,
OrderStateName=item.OrderState.ToName(),
OrderStateName = item.OrderState.ToName(),
item.ClassScrollType
});
}
......@@ -1376,4 +1376,4 @@ namespace Edu.WebApi.Controllers.Applet
#endregion
}
}
}
\ No newline at end of file
......@@ -690,7 +690,8 @@ namespace Edu.WebApi.Controllers.User
QStudentStatus=base.ParmJObj.GetInt("QStudentStatus"),
AdvisorStatus=base.ParmJObj.GetInt("AdvisorStatus"),
StuChannel=base.ParmJObj.GetInt("StuChannel"),
CreateType=(StuCreateTypeEnum) base.ParmJObj.GetInt("CreateType"),
StuSourceId=base.ParmJObj.GetInt("StuSourceId"),
};
if (query.IsQueryMyStu == 1)
{
......
......@@ -41,6 +41,11 @@ namespace Edu.WebApi.Timers
/// </summary>
private static readonly PaperModule paperModule = new PaperModule();
/// <summary>
/// 班级处理类对象
/// </summary>
private static readonly ClassModule classModule = new ClassModule();
/// <summary>
/// 使用redis第几号库
/// </summary>
......@@ -48,6 +53,7 @@ namespace Edu.WebApi.Timers
static readonly RedisHelper redis = new RedisHelper(REDIS_DB3);
/// <summary>
/// 课程顾问部和市场部数据统计
/// </summary>
......@@ -69,11 +75,13 @@ namespace Edu.WebApi.Timers
static System.Timers.Timer marketTimer;//处理市场部和课程顾问部数据统计
static System.Timers.Timer dealStudentProgressTimer;//处理学员上课进度
public static void RunTimer()
{
timer1 = new System.Timers.Timer
{
Interval = (1000 * 60) * (60 * 3) //3销售
Interval = (1000 * 60) * (60 * 3) //3小时执行一次
};
timer1.Elapsed += new System.Timers.ElapsedEventHandler(ClearFile);
timer1.Enabled = true;
......@@ -123,10 +131,17 @@ namespace Edu.WebApi.Timers
marketTimer = new System.Timers.Timer()
{
Interval = (1000 * 60) * (1) //1小时检查一次
Interval = (1000 * 60) * (60 * 1) //1小时
};
marketTimer.Elapsed += new System.Timers.ElapsedEventHandler(DealMarketConsultantData);
marketTimer.Enabled = true;
dealStudentProgressTimer = new System.Timers.Timer()
{
Interval = (1000 * 60) * (60 * 1) //1小时检查一次
};
dealStudentProgressTimer.Elapsed += new System.Timers.ElapsedEventHandler(DealStudentProgressModule);
dealStudentProgressTimer.Enabled = true;
}
public static void RunStop()
......@@ -139,6 +154,7 @@ namespace Edu.WebApi.Timers
examTimer.Enabled = false;
finishGuest.Enabled = false;
marketTimer.Enabled = false;
dealStudentProgressTimer.Enabled = false;
}
/// <summary>
......@@ -152,9 +168,38 @@ namespace Edu.WebApi.Timers
private static int examPublish_Timer = 0;
private static int guestfinish_Timer = 0;
private static int marketconsultant_Timer = 0;
private static int dealstudentprogress_Timer = 0;
private static readonly string createMarkDataKey = "createMarkDataKey";
private static readonly string dealStudentProgress = "dealStudentProgress";
/// <summary>
/// 处理学员上课进度
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public static void DealStudentProgressModule(object sender, System.Timers.ElapsedEventArgs e)
{
if (Interlocked.Exchange(ref dealstudentprogress_Timer, 1) == 0)
{
var currentDate = DateTime.Now;
string cacheData = redis.Get(dealStudentProgress);
if (string.IsNullOrEmpty(cacheData))
{
redis.Set(dealStudentProgress, Common.ConvertHelper.FormatDate(currentDate));
cacheData = Common.ConvertHelper.FormatDate(currentDate);
}
if (!string.IsNullOrEmpty(cacheData) && cacheData != Common.ConvertHelper.FormatDate(currentDate))
{
redis.Set(dealStudentProgress, Common.ConvertHelper.FormatDate(currentDate));
classModule.DealStudentCourseChapterNoModule();
}
//处理学员进度
Interlocked.Exchange(ref dealstudentprogress_Timer, 0);
}
}
private static string createMarkDataKey = "createMarkDataKey";
/// <summary>
/// 定时生成市场部和课程顾问部数据统计
/// </summary>
......@@ -162,7 +207,7 @@ namespace Edu.WebApi.Timers
/// <param name="e"></param>
public static void DealMarketConsultantData(object sender, System.Timers.ElapsedEventArgs e)
{
if (Interlocked.Exchange(ref marketconsultant_Timer,1) == 0)
if (Interlocked.Exchange(ref marketconsultant_Timer, 1) == 0)
{
var currentDate = DateTime.Now;
string cacheData = redis.Get(createMarkDataKey);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment