Commit 8b5e03eb authored by 黄奎's avatar 黄奎

页面修改

parent 8d0dd8a0
...@@ -1057,10 +1057,24 @@ namespace Edu.Module.Course ...@@ -1057,10 +1057,24 @@ namespace Edu.Module.Course
/// <param name="DropOutRemark"></param> /// <param name="DropOutRemark"></param>
/// <returns></returns> /// <returns></returns>
[TransactionCallHandler] [TransactionCallHandler]
public bool AddClassCheckModule(List<RB_Class_Check_ViewModel> list) public virtual bool AddClassCheckModule(List<RB_Class_Check_ViewModel> list)
{ {
//写日志 //写日志
bool flag = classCheckRepository.InsertBatch(list); bool flag = true;
foreach (var item in list)
{
if (flag)
{
if (item.ClassCheckId > 0)
{
flag = classCheckRepository.Update(item);
}
else
{
flag = classCheckRepository.Insert(item) > 0;
}
}
}
return flag; return flag;
} }
......
...@@ -11,7 +11,7 @@ namespace Edu.Repository.Course ...@@ -11,7 +11,7 @@ namespace Edu.Repository.Course
public class RB_Class_CheckRepository : BaseRepository<RB_Class_Check> public class RB_Class_CheckRepository : BaseRepository<RB_Class_Check>
{ {
/// <summary> /// <summary>
/// 获取教室列表 /// 获取签到记录列表
/// </summary> /// </summary>
/// <param name="query"></param> /// <param name="query"></param>
/// <returns></returns> /// <returns></returns>
...@@ -39,11 +39,11 @@ namespace Edu.Repository.Course ...@@ -39,11 +39,11 @@ namespace Edu.Repository.Course
} }
if (!string.IsNullOrWhiteSpace(query.StartDate)) if (!string.IsNullOrWhiteSpace(query.StartDate))
{ {
builder.AppendFormat(" AND DATE_FORMAT(A.{0},'%Y-%m-%d')>=DATE_FORMAT('{1}','%Y-%m-%d') ", nameof(RB_Class_Check_ViewModel.CreateTime), query.StartDate); builder.AppendFormat(" AND DATE_FORMAT(A.{0},'%Y-%m-%d')>=DATE_FORMAT('{1}','%Y-%m-%d') ", nameof(RB_Class_Check_ViewModel.ClassDate), query.StartDate);
} }
if (!string.IsNullOrWhiteSpace(query.EndDate)) if (!string.IsNullOrWhiteSpace(query.EndDate))
{ {
builder.AppendFormat(" AND DATE_FORMAT(A.{0},'%Y-%m-%d')<=DATE_FORMAT('{1}','%Y-%m-%d') ", nameof(RB_Class_Check_ViewModel.CreateTime), query.EndDate); builder.AppendFormat(" AND DATE_FORMAT(A.{0},'%Y-%m-%d')<=DATE_FORMAT('{1}','%Y-%m-%d') ", nameof(RB_Class_Check_ViewModel.ClassDate), query.EndDate);
} }
} }
......
...@@ -633,16 +633,24 @@ namespace Edu.WebApi.Controllers.Course ...@@ -633,16 +633,24 @@ namespace Edu.WebApi.Controllers.Course
return ApiResult.Failed("今日无课程,无须签到"); return ApiResult.Failed("今日无课程,无须签到");
} }
//判断今天是否已签到 //判断当天是否有已签到数据
var checkLogList = classModule.GetClassCheckList(new RB_Class_Check_ViewModel { Group_Id = base.UserInfo.Group_Id, ClassId = list.FirstOrDefault().ClassId, StartDate = list.FirstOrDefault().ClassDate.ToString("yyyy-MM-dd HH:mm:ss"), EndDate = list.FirstOrDefault().ClassDate.ToString("yyyy-MM-dd HH:mm:ss") }); var checkLogList = classModule.GetClassCheckList(new RB_Class_Check_ViewModel { Group_Id = base.UserInfo.Group_Id, ClassId = list.FirstOrDefault().ClassId, StartDate = list.FirstOrDefault().ClassDate.ToString("yyyy-MM-dd HH:mm:ss"), EndDate = list.FirstOrDefault().ClassDate.ToString("yyyy-MM-dd HH:mm:ss") });
if (checkLogList != null && checkLogList.Any())
foreach (var item in list)
{ {
return ApiResult.Failed("今日已签到,请勿重复操作"); var signModel= checkLogList?.Where(qitem => qitem.ClassDate == item.ClassDate && qitem.ClassId == item.ClassId && qitem.OrderGuestId == item.OrderGuestId)?.FirstOrDefault();
if (signModel != null && signModel.ClassCheckId > 0)
{
item.ClassCheckId = signModel.ClassCheckId;
}
else
{
item.Group_Id = base.UserInfo.Group_Id;
item.CreateTime = System.DateTime.Now;
item.CreateBy = base.UserInfo.Id;
item.Status = 0;
}
} }
list.ForEach(x => x.Group_Id = base.UserInfo.Group_Id);
list.ForEach(x => x.CreateTime = System.DateTime.Now);
list.ForEach(x => x.CreateBy = base.UserInfo.Id);
list.ForEach(x => x.Status = 0);
bool result = classModule.AddClassCheckModule(list); bool result = classModule.AddClassCheckModule(list);
if (result) if (result)
{ {
......
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