Commit ad79536a authored by liudong1993's avatar liudong1993

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

parents da24a2f3 b0c0fe81
...@@ -188,6 +188,24 @@ namespace Edu.Common ...@@ -188,6 +188,24 @@ namespace Edu.Common
return list; return list;
} }
/// <summary>
/// 时间集合转字符串用户SQL查询使用
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static string DateTimeListToString(List<DateTime> list)
{
string str = "";
if (list != null && list.Count > 0)
{
foreach (var item in list)
{
str += ",'" + FormatDate(item) + "'";
}
}
return str.TrimStart(',').TrimEnd(',');
}
/// <summary> /// <summary>
/// 根据日期获取星期几 /// 根据日期获取星期几
/// </summary> /// </summary>
...@@ -230,7 +248,7 @@ namespace Edu.Common ...@@ -230,7 +248,7 @@ namespace Edu.Common
public static int CalcMinutes(DateTime start, DateTime end) public static int CalcMinutes(DateTime start, DateTime end)
{ {
int minutes=Convert.ToInt32((end - start).TotalSeconds); int minutes=Convert.ToInt32((end - start).TotalSeconds);
minutes = minutes / 60; minutes /= 60;
return minutes; return minutes;
} }
......
...@@ -66,5 +66,10 @@ namespace Edu.Model.Entity.Course ...@@ -66,5 +66,10 @@ namespace Edu.Model.Entity.Course
/// 0-未反馈,1-已反馈 /// 0-未反馈,1-已反馈
/// </summary> /// </summary>
public int ParentFanKuiStatus { get; set; } public int ParentFanKuiStatus { get; set; }
/// <summary>
/// 上课计划重复的计划编号
/// </summary>
public string RepeatPlanIds { get; set; }
} }
} }
\ No newline at end of file
...@@ -103,6 +103,11 @@ namespace Edu.Model.ViewModel.Course ...@@ -103,6 +103,11 @@ namespace Edu.Model.ViewModel.Course
/// </summary> /// </summary>
public string QClassDateStr { get; set; } public string QClassDateStr { get; set; }
/// <summary>
/// 是否查询上课计划有重复的数据【1-是】
/// </summary>
public int IsQRepeat { get; set; }
/// <summary> /// <summary>
/// 老师备课次数>0已备课 /// 老师备课次数>0已备课
/// </summary> /// </summary>
......
This diff is collapsed.
...@@ -149,7 +149,7 @@ namespace Edu.Module.Course ...@@ -149,7 +149,7 @@ namespace Edu.Module.Course
} }
}; };
var classModel = classRepository.GetEntity(backModel.ClassId); var classModel = classRepository.GetEntity(backModel.ClassId);
string Remark = "【" + (classModel?.ClassName ?? "") + "】下,订单" + backModel.OrderId + " 客人退课"; string Remark = backModel.ApplyReason+ "【" + (classModel?.ClassName ?? "") + "】下,订单" + backModel.OrderId + " 客人退课";
var financeObj = new var financeObj = new
{ {
IsPublic, IsPublic,
......
...@@ -68,6 +68,10 @@ WHERE 1=1 ...@@ -68,6 +68,10 @@ WHERE 1=1
{ {
builder.AppendFormat(" AND A.{0}<='{1} 23:59:59' ", nameof(RB_Class_Plan_ViewModel.ClassDate), query.EndTime); builder.AppendFormat(" AND A.{0}<='{1} 23:59:59' ", nameof(RB_Class_Plan_ViewModel.ClassDate), query.EndTime);
} }
if (query.IsQRepeat == 1)
{
builder.AppendFormat(" AND IFNULL(A.{0},'')<>'' ", nameof(RB_Class_Plan_ViewModel.RepeatPlanIds));
}
} }
return Get<RB_Class_Plan_ViewModel>(builder.ToString()).ToList(); return Get<RB_Class_Plan_ViewModel>(builder.ToString()).ToList();
} }
...@@ -257,6 +261,23 @@ WHERE a.`Status`=0 "); ...@@ -257,6 +261,23 @@ WHERE a.`Status`=0 ");
return base.Exists(list); return base.Exists(list);
} }
/// <summary>
/// 批量验证同一班级的上课计划
/// </summary>
/// <param name="classId"></param>
/// <param name="qClassDate"></param>
/// <returns></returns>
public List<RB_Class_Plan_ViewModel> BatchCheckExistsRepository(int classId, string qClassDate)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM rb_class_plan AS A
WHERE A.`Status`=0 AND A.ClassId={0} AND A.ClassDate IN({1})
", classId, qClassDate);
return Get<RB_Class_Plan_ViewModel>(builder.ToString()).ToList();
}
/// <summary> /// <summary>
/// 老师改变则修改后面的代课老师为新的教师编号 /// 老师改变则修改后面的代课老师为新的教师编号
/// </summary> /// </summary>
...@@ -696,9 +717,10 @@ GROUP BY a.ClassType,A.ClassTimeId,A.ClassPlanId,A.ClassId ,A.ClassDate,A.ClassR ...@@ -696,9 +717,10 @@ GROUP BY a.ClassType,A.ClassTimeId,A.ClassPlanId,A.ClassId ,A.ClassDate,A.ClassR
/// <summary> /// <summary>
/// 检查上课计划是否存在时间上的交集【HK2021-07-28新增】 /// 检查上课计划是否存在时间上的交集【HK2021-07-28新增】
/// </summary> /// </summary>
/// <param name="query"></param> /// <param name="classId"></param>
/// <param name="timeList"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_Class_Plan_ViewModel> CheckClassPlanRepository(RB_Class_Plan_ViewModel query) public List<RB_Class_Plan_ViewModel> CheckClassPlanRepository(int classId,List<TimeItem> timeList)
{ {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" builder.AppendFormat(@"
...@@ -710,18 +732,89 @@ SELECT A.* FROM ...@@ -710,18 +732,89 @@ SELECT A.* FROM
WHERE A.`Status`=0 AND A.ClassDate>='{0}' AND C.ClassStatus IN(1,2) WHERE A.`Status`=0 AND A.ClassDate>='{0}' AND C.ClassStatus IN(1,2)
) AS A ) AS A
WHERE 1=1 WHERE 1=1
",Common.ConvertHelper.FormatDate(DateTime.Now)); ", Common.ConvertHelper.FormatDate(DateTime.Now));
if (query.ClassId > 0) if (classId > 0)
{ {
builder.AppendFormat(" AND A.{0}<>{1} ", nameof(RB_Class_Plan_ViewModel.ClassId), query.ClassId); builder.AppendFormat(" AND A.{0}<>{1} ", nameof(RB_Class_Plan_ViewModel.ClassId), classId);
} }
if (!string.IsNullOrEmpty(query.StartTime) && !string.IsNullOrEmpty(query.EndTime)) if (timeList != null && timeList.Count > 0)
{ {
builder.AppendFormat("AND (NOT (A.StartTime > '{0}' OR A.EndTime < '{1}') ) ",query.EndTime,query.StartTime); string tempStr = "";
int index = 0;
foreach (var item in timeList)
{
if (index == 0)
{
tempStr += string.Format(" (NOT (A.StartTime > '{0}' OR A.EndTime < '{1}')) ", item.EndTime, item.StartTime);
}
else
{
tempStr += string.Format(" OR (NOT (A.StartTime > '{0}' OR A.EndTime < '{1}')) ", item.EndTime, item.StartTime);
}
index++;
}
if (!string.IsNullOrEmpty(tempStr))
{
builder.AppendFormat(" AND ({0}) ", tempStr);
}
} }
return Get<RB_Class_Plan_ViewModel>(builder.ToString()).ToList(); return Get<RB_Class_Plan_ViewModel>(builder.ToString()).ToList();
} }
/// <summary>
/// 批量添加上课计划
/// </summary>
/// <param name="planList"></param>
/// <returns></returns>
public List<RB_Class_Plan_ViewModel> BatchInsertClassPlanRepository(List<RB_Class_Plan_ViewModel> planList)
{
List<RB_Class_Plan_ViewModel> newPlanList = new List<RB_Class_Plan_ViewModel>();
bool flag = true;
if (planList != null && planList.Count > 0)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(" INSERT INTO RB_Class_Plan(ClassId,ClassDate,Status,ClassRoomId,Group_Id,School_Id,TeacherId,BeiKeStatus,FanKuiStatus,ParentFanKuiStatus) ");
builder.AppendFormat(" VALUES ");
string tempStr = "";
foreach (var item in planList)
{
tempStr += $",({item.ClassId},'{Common.ConvertHelper.FormatDate(item.ClassDate)}',0,{item.ClassRoomId},{item.Group_Id},{item.School_Id},{item.TeacherId},0,0,0) ";
}
builder.Append(tempStr.TrimStart(','));
flag = base.Execute(builder.ToString()) > 0;
if (flag)
{
newPlanList = GetClassPlanListRepository(new RB_Class_Plan_ViewModel() { ClassId = planList[0].ClassId, StartTime = Common.ConvertHelper.FormatDate(DateTime.Now) });
}
}
return newPlanList;
}
/// <summary>
/// 批量更新上课计划冲突的计划编号
/// </summary>
/// <param name="planList"></param>
/// <returns></returns>
public bool BatchUpdateClassPlanRepository(List<RB_Class_Plan_ViewModel> planList)
{
bool flag = true;
if (planList != null && planList.Count > 0)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(" INSERT INTO RB_Class_Plan(ClassPlanId,RepeatPlanIds) ");
builder.AppendFormat(" VALUES ");
string tempStr = "";
foreach (var item in planList)
{
tempStr += $",({item.ClassPlanId},'{item.RepeatPlanIds}') ";
}
builder.Append(tempStr.TrimStart(','));
builder.Append(" ON DUPLICATE KEY UPDATE RepeatPlanIds =VALUES(RepeatPlanIds) ");
flag = base.Execute(builder.ToString()) > 0;
}
return flag;
}
#endregion #endregion
} }
} }
\ No newline at end of file
...@@ -203,7 +203,6 @@ where b.`Status`=0 and DATE_FORMAT(b.ClassDate,'%y/%m/%d')=DATE_FORMAT(NOW(),'%y ...@@ -203,7 +203,6 @@ where b.`Status`=0 and DATE_FORMAT(b.ClassDate,'%y/%m/%d')=DATE_FORMAT(NOW(),'%y
return Get<RB_Class_Time_ViewModel>(builder.ToString()).ToList(); return Get<RB_Class_Time_ViewModel>(builder.ToString()).ToList();
} }
#region 教师上课挂件查询 #region 教师上课挂件查询
/// <summary> /// <summary>
...@@ -267,7 +266,28 @@ where a.`Status`=0 and c.ClassStatus in(1,2) and a.TeacherId={TId} and c.`Sta ...@@ -267,7 +266,28 @@ where a.`Status`=0 and c.ClassStatus in(1,2) and a.TeacherId={TId} and c.`Sta
#endregion #endregion
/// <summary>
/// 批量添加上课计划时间
/// </summary>
/// <param name="timeList"></param>
/// <returns></returns>
public bool BatchInsertClassTimeRepository(List<RB_Class_Time> timeList)
{
bool flag = true;
if (timeList != null && timeList.Count > 0)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(" INSERT INTO RB_Class_Time(ClassId,ClassPlanId,StartTime,EndTime,Group_Id,School_Id,ClassStatus,TimeHour) ");
builder.AppendFormat(" VALUES ");
string tempStr = "";
foreach (var item in timeList)
{
tempStr += $",({item.ClassId},{item.ClassPlanId},'{item.StartTime}','{item.EndTime}',{item.Group_Id},{item.School_Id},0,{item.TimeHour} ) ";
}
builder.Append(tempStr.TrimStart(','));
flag = base.Execute(builder.ToString()) > 0;
}
return flag;
}
} }
} }
...@@ -700,11 +700,11 @@ WHERE 1=1 and A.Status=0 and class.Status=0 and class.ClassStatus <>4 and b.Or ...@@ -700,11 +700,11 @@ WHERE 1=1 and A.Status=0 and class.Status=0 and class.ClassStatus <>4 and b.Or
if (demodel.OrderTime.HasValue) if (demodel.OrderTime.HasValue)
{ {
builder.AppendFormat($@" AND DATE_FORMAT(B.CreateTime,'%y-%m-%d')>=DATE_FORMAT('{demodel.OrderTime.Value.ToString("yyyy-MM-dd")}','%y-%m-%d')"); builder.AppendFormat($@" AND DATE_FORMAT(B.CreateTime,'%y-%m-%d')>=DATE_FORMAT('{Common.ConvertHelper.FormatDate(demodel.OrderTime)}','%y-%m-%d')");
} }
if (demodel.EndOrderTime.HasValue) if (demodel.EndOrderTime.HasValue)
{ {
builder.AppendFormat($@" AND DATE_FORMAT(B.CreateTime,'%y-%m-%d')<=DATE_FORMAT('{demodel.EndOrderTime.Value.ToString("yyyy-MM-dd")}','%y-%m-%d')"); builder.AppendFormat($@" AND DATE_FORMAT(B.CreateTime,'%y-%m-%d')<=DATE_FORMAT('{Common.ConvertHelper.FormatDate(demodel.EndOrderTime)}','%y-%m-%d')");
} }
if (demodel.EffectStatus.HasValue) if (demodel.EffectStatus.HasValue)
{ {
......
...@@ -219,7 +219,8 @@ WHERE 1=1 ...@@ -219,7 +219,8 @@ WHERE 1=1
} }
} }
else else
{//全局修改 {
//全局修改
AllChangePlanItem allChangePlanModel = new AllChangePlanItem(); AllChangePlanItem allChangePlanModel = new AllChangePlanItem();
//目标数据 //目标数据
if (!string.IsNullOrWhiteSpace(model.TargetData)) if (!string.IsNullOrWhiteSpace(model.TargetData))
......
...@@ -368,11 +368,39 @@ namespace Edu.WebApi.Controllers.Course ...@@ -368,11 +368,39 @@ namespace Edu.WebApi.Controllers.Course
extModel.DefaultTimeJson = ""; extModel.DefaultTimeJson = "";
} }
bool flag = classModule.SetClassModule(extModel); bool flag = classModule.SetClassModule(extModel);
if (flag) //if (flag)
{ //{
classModule.UpdateClassEndDateModule(extModel.ClassId); // classModule.UpdateClassEndDateModule(extModel.ClassId);
} //}
return flag ? ApiResult.Success() : ApiResult.Failed(); return flag ? ApiResult.Success(data:extModel) : ApiResult.Failed();
}
/// <summary>
/// 批量添加上课计划
/// </summary>
/// <returns></returns>
public ApiResult BatchSetClassPlan()
{
var ClassId = base.ParmJObj.GetInt("ClassId");
var planList = Common.Plugin.JsonHelper.DeserializeObject<List<RB_Class_Plan_ViewModel>>(base.ParmJObj.GetStringValue("PlanList"));
List<RB_Class_Plan_ViewModel> result = new List<RB_Class_Plan_ViewModel>();
bool flag = false;
bool IsRepeat = false;
var t1 = new Task(() => { flag = classModule.AddClassPlanModule(ClassId, planList,out IsRepeat); });
t1.Start();
Task.WaitAll(t1);
return flag ? ApiResult.Success(data: IsRepeat) : ApiResult.Failed();
}
/// <summary>
/// 获取有冲突的上课计划
/// </summary>
/// <returns></returns>
public ApiResult GetRepeatClassPlan()
{
var ClassId = base.ParmJObj.GetInt("ClassId");
var obj = classModule.GetRepeatClassPlanModule(ClassId);
return ApiResult.Success(data: obj);
} }
/// <summary> /// <summary>
...@@ -919,8 +947,6 @@ namespace Edu.WebApi.Controllers.Course ...@@ -919,8 +947,6 @@ namespace Edu.WebApi.Controllers.Course
return result ? ApiResult.Success() : ApiResult.Failed(); return result ? ApiResult.Success() : ApiResult.Failed();
} }
/// <summary> /// <summary>
/// 邀请学生 /// 邀请学生
/// </summary> /// </summary>
...@@ -942,6 +968,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -942,6 +968,7 @@ namespace Edu.WebApi.Controllers.Course
bool result = classModule.AddClassStudentDropOutModule(model, base.UserInfo.AccountName); bool result = classModule.AddClassStudentDropOutModule(model, base.UserInfo.AccountName);
return result ? ApiResult.Success() : ApiResult.Failed(); return result ? ApiResult.Success() : ApiResult.Failed();
} }
/// <summary> /// <summary>
/// 获取教室页列表 /// 获取教室页列表
/// </summary> /// </summary>
...@@ -958,13 +985,11 @@ namespace Edu.WebApi.Controllers.Course ...@@ -958,13 +985,11 @@ namespace Edu.WebApi.Controllers.Course
TeacherId = base.ParmJObj.GetInt("TeacherId") TeacherId = base.ParmJObj.GetInt("TeacherId")
}; };
var list = classModule.GetClassPlanLogPageListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query); var list = classModule.GetClassPlanLogPageListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
pageModel.Count = rowsCount; pageModel.Count = rowsCount;
pageModel.PageData = list; pageModel.PageData = list;
return ApiResult.Success(data: pageModel); return ApiResult.Success(data: pageModel);
} }
/// <summary> /// <summary>
/// 多人签到【后台】 /// 多人签到【后台】
/// </summary> /// </summary>
...@@ -1153,7 +1178,6 @@ namespace Edu.WebApi.Controllers.Course ...@@ -1153,7 +1178,6 @@ namespace Edu.WebApi.Controllers.Course
} }
/// <summary> /// <summary>
/// 获取缺课分页列表 /// 获取缺课分页列表
/// </summary> /// </summary>
......
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