Commit 87ed3d97 authored by 吴春's avatar 吴春

提交代码

parent e1c6451e
...@@ -96,6 +96,18 @@ namespace Edu.Model.ViewModel.Course ...@@ -96,6 +96,18 @@ namespace Edu.Model.ViewModel.Course
/// 上课时间 /// 上课时间
/// </summary> /// </summary>
public string DayTime { get; set; } public string DayTime { get; set; }
/// <summary>
/// 上课结束时间
/// </summary>
public string ClassEndTime { get; set; }
/// <summary>
/// 是否可以更新课后总结
/// </summary>
public int IsEditSummary { get; set; }
#endregion #endregion
......
...@@ -17,5 +17,10 @@ namespace Edu.Model.ViewModel.Course ...@@ -17,5 +17,10 @@ namespace Edu.Model.ViewModel.Course
/// 创建人 /// 创建人
/// </summary> /// </summary>
public string CreateByName { get; set; } public string CreateByName { get; set; }
/// <summary>
/// 老师id
/// </summary>
public int TeacherId { get; set; }
} }
} }
...@@ -43,6 +43,10 @@ namespace Edu.Repository.Course ...@@ -43,6 +43,10 @@ namespace Edu.Repository.Course
{ {
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonComment_ViewModel.LessonPlanId), query.LessonPlanId); builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonComment_ViewModel.LessonPlanId), query.LessonPlanId);
} }
if (query.CreateBy > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonComment_ViewModel.CreateBy), query.CreateBy);
}
} }
builder.Append(" ORDER BY CreateTime DESC "); builder.Append(" ORDER BY CreateTime DESC ");
return Get<RB_Class_LessonComment_ViewModel>(builder.ToString()).ToList(); return Get<RB_Class_LessonComment_ViewModel>(builder.ToString()).ToList();
......
...@@ -332,9 +332,9 @@ WHERE 1=1 ...@@ -332,9 +332,9 @@ WHERE 1=1
{ {
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Plan_ViewModel.School_Id), query.School_Id); builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Plan_ViewModel.School_Id), query.School_Id);
} }
if (query.Teacher_Id > 0) if (query.TeacherId > 0)
{ {
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Plan_ViewModel.Teacher_Id), query.Teacher_Id); builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Plan_ViewModel.TeacherId), query.TeacherId);
} }
if (!string.IsNullOrEmpty(query.QClassIds)) if (!string.IsNullOrEmpty(query.QClassIds))
{ {
......
...@@ -541,7 +541,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -541,7 +541,7 @@ namespace Edu.WebApi.Controllers.Course
data.RoomName, data.RoomName,
TotalHour = Convert.ToInt32(totalMinutes / 60), TotalHour = Convert.ToInt32(totalMinutes / 60),
ClassNum = Convert.ToInt32(totalMinutes / 45), ClassNum = Convert.ToInt32(totalMinutes / 45),
DefaultMinutes= totalMinutes, DefaultMinutes = totalMinutes,
ClassDate = data.ClassDate.ToString("yyyy-MM-dd"), ClassDate = data.ClassDate.ToString("yyyy-MM-dd"),
GuestList = guestList GuestList = guestList
}); });
...@@ -631,10 +631,10 @@ namespace Edu.WebApi.Controllers.Course ...@@ -631,10 +631,10 @@ namespace Edu.WebApi.Controllers.Course
MonthStr = item.ClassDate.ToString("MM"), MonthStr = item.ClassDate.ToString("MM"),
DayStr = item.ClassDate.ToString("dd"), DayStr = item.ClassDate.ToString("dd"),
YearStr = item.ClassDate.ToString("yyyy"), YearStr = item.ClassDate.ToString("yyyy"),
CheckNum= checkList.Count(), CheckNum = checkList.Count(),
CheckList= checkList.Select(qitem => new { qitem.GuestName}), CheckList = checkList.Select(qitem => new { qitem.GuestName }),
NoCheckNum= noCheckList.Count(), NoCheckNum = noCheckList.Count(),
NoCheckList= noCheckList.Select(qitem => new { qitem.GuestName}), NoCheckList = noCheckList.Select(qitem => new { qitem.GuestName }),
ColorType = item.TeacherId != item.Teacher_Id ? 1 : (totalNum == noCheckList.Count() ? 2 : 3), ColorType = item.TeacherId != item.Teacher_Id ? 1 : (totalNum == noCheckList.Count() ? 2 : 3),
}; };
resultList.Add(planCheckObj); resultList.Add(planCheckObj);
...@@ -856,6 +856,31 @@ namespace Edu.WebApi.Controllers.Course ...@@ -856,6 +856,31 @@ namespace Edu.WebApi.Controllers.Course
query.UpdateTime = System.DateTime.Now; query.UpdateTime = System.DateTime.Now;
query.CreateTime = System.DateTime.Now; query.CreateTime = System.DateTime.Now;
if (!string.IsNullOrWhiteSpace(query.ClassEndTime))
{
if (Convert.ToDateTime(query.ClassEndTime) > System.DateTime.Now)
{
return ApiResult.Failed("当前还未下课不能填写课后总结");
}
}
if (query.LessonPlanList != null && query.LessonPlanList.Any())
{
int totalInfo = 0;
foreach (var item in query.LessonPlanList)
{
totalInfo += item.LessonPlanDetailsList.Where(x => !string.IsNullOrWhiteSpace(x.Summary)).Count();
}
if (totalInfo == 0)
{
return ApiResult.Failed("课后总结请至少填写一项");
}
}
else
{
return ApiResult.Failed("老师教案信息为空必须更新");
}
bool flag = classModule.UpdateClassLessPlan(query); bool flag = classModule.UpdateClassLessPlan(query);
return flag ? ApiResult.Success() : ApiResult.Failed(); return flag ? ApiResult.Success() : ApiResult.Failed();
} }
...@@ -896,6 +921,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -896,6 +921,7 @@ namespace Edu.WebApi.Controllers.Course
model.RestTime = endTime.Subtract(startTime).TotalMilliseconds.ToString(); model.RestTime = endTime.Subtract(startTime).TotalMilliseconds.ToString();
planTiemList.ForEach(x => x.NewPlanDateTime = planDate.ClassDate.ToString("yyyy-MM-dd") + " " + x.EndTime); planTiemList.ForEach(x => x.NewPlanDateTime = planDate.ClassDate.ToString("yyyy-MM-dd") + " " + x.EndTime);
model.DayTime = model.DayTime + "~" + planTiemList.Max(x => Convert.ToDateTime(x.NewPlanDateTime)).ToString("HH:mm"); model.DayTime = model.DayTime + "~" + planTiemList.Max(x => Convert.ToDateTime(x.NewPlanDateTime)).ToString("HH:mm");
model.ClassEndTime = planTiemList.Max(x => Convert.ToDateTime(x.NewPlanDateTime)).ToString("yyyy-MM-dd HH:mm:00");
} }
var lessonPlanList = classModule.GetLessonPlanListRepository(extModel); var lessonPlanList = classModule.GetLessonPlanListRepository(extModel);
model.ClassId = extModel.ClassId; model.ClassId = extModel.ClassId;
...@@ -936,6 +962,9 @@ namespace Edu.WebApi.Controllers.Course ...@@ -936,6 +962,9 @@ namespace Edu.WebApi.Controllers.Course
} }
item.LessonPlanProjectsList = projectList.Where(x => x.LessonPlanId == item.LessonPlanId).ToList(); item.LessonPlanProjectsList = projectList.Where(x => x.LessonPlanId == item.LessonPlanId).ToList();
// item.LessonPlanProjectsList.ForEach(x => x.ProjectContentList = (string.IsNullOrWhiteSpace(x.ProjectContent) ? new List<string>() : Common.Plugin.JsonHelper.DeserializeObject<List<string>>(x.ProjectContent))); // item.LessonPlanProjectsList.ForEach(x => x.ProjectContentList = (string.IsNullOrWhiteSpace(x.ProjectContent) ? new List<string>() : Common.Plugin.JsonHelper.DeserializeObject<List<string>>(x.ProjectContent)));
model.IsEditSummary += item.LessonPlanDetailsList.Where(x => !string.IsNullOrWhiteSpace(x.Summary)).Count();
} }
} }
else else
...@@ -1132,9 +1161,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -1132,9 +1161,7 @@ namespace Edu.WebApi.Controllers.Course
var query = Common.Plugin.JsonHelper.DeserializeObject<RB_Class_LessonComment_ViewModel>(RequestParm.Msg.ToString()); var query = Common.Plugin.JsonHelper.DeserializeObject<RB_Class_LessonComment_ViewModel>(RequestParm.Msg.ToString());
query.Group_Id = base.UserInfo.Group_Id; query.Group_Id = base.UserInfo.Group_Id;
query.CreateBy = base.UserInfo.Id; query.CreateBy = base.UserInfo.Id;
query.CreateTime = System.DateTime.Now; query.CreateTime = System.DateTime.Now;
if (query.Score == 0) if (query.Score == 0)
{ {
return ApiResult.Failed("请选择评分"); return ApiResult.Failed("请选择评分");
...@@ -1145,8 +1172,52 @@ namespace Edu.WebApi.Controllers.Course ...@@ -1145,8 +1172,52 @@ namespace Edu.WebApi.Controllers.Course
} }
bool flag = classModule.SetLessonComment(query); bool flag = classModule.SetLessonComment(query);
if (flag)
{
Common.Message.PushMessageModel model = new Common.Message.PushMessageModel()
{
CategoryId = 0,
Content = query.Comment,
CoverImg = "",
CreateByName = base.UserInfo.AccountName,
JumpUrl = $"/course/prepareclassDetails?ClassId={query.ClassId}&ClassPlanId={query.ClassPlanId}",
SendTime = DateTime.Now,
SendType = 0,
Title = "教案评论",
Platform = 2,
ReceiveId = query.TeacherId.ToString(),
};
Common.Message.MessageHelper.SendMessage(model);
}
return flag ? ApiResult.Success() : ApiResult.Failed(); return flag ? ApiResult.Success() : ApiResult.Failed();
} }
/// <summary>
/// 判断当前用户是否已评论当前教案
/// </summary>
/// <returns></returns>
public ApiResult GetNowUserLessonComment()
{
var query = new RB_Class_LessonComment_ViewModel()
{
ClassPlanId = base.ParmJObj.GetInt("ClassPlanId"),
ClassId = base.ParmJObj.GetInt("ClassId"),
};
query.Group_Id = base.UserInfo.Group_Id;
query.CreateBy = base.UserInfo.Id;
var list = classModule.GetLessonCommentList(query);
if (list != null && list.Any())
{
return ApiResult.Success("", data: new { Score = -1 });
}
else
{
return ApiResult.Success("", data: new { Score = 5 });
}
}
#endregion #endregion
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment