Commit 76aca899 authored by liudong1993's avatar liudong1993

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

parents 6652f1c2 9bd4130f
using Edu.Common.Plugin;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Common.Enum.Course
{
/// <summary>
/// 日志类型枚举
/// </summary>
public enum ClassLogTypeEnum
{
/// <summary>
/// 新增学员
/// </summary>
[EnumField("新增学员")]
AddStudent = 1,
}
}
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Edu.Common
......@@ -187,5 +188,16 @@ namespace Edu.Common
}
return weekDay;
}
/// <summary>
/// 是否为时间型字符串
/// </summary>
/// <param name="source">时间字符串(15:00:00)</param>
/// <returns></returns>
public static bool IsTime(string StrSource)
{
return Regex.IsMatch(StrSource, @"^((20|21|22|23|[0-1]?\d):[0-5]?\d:[0-5]?\d)$");
}
}
}
\ No newline at end of file
......@@ -45,5 +45,10 @@ namespace Edu.Model.Entity.Course
/// 学校编号
/// </summary>
public int School_Id { get; set; }
/// <summary>
/// 教师编号
/// </summary>
public int TeacherId { get; set; }
}
}
\ No newline at end of file
using Edu.Common.Enum.Course;
using System;
using VT.FW.DB;
namespace Edu.Model.Entity.Log
{
/// <summary>
/// 班级日志实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Class_Log
{
/// <summary>
/// 日志编号
/// </summary>
public int CLogId { get; set; }
/// <summary>
/// 日志类型(1-新增学员)
/// </summary>
public ClassLogTypeEnum LogType { get; set; }
/// <summary>
/// 日志内容
/// </summary>
public string LogContent { get; set; }
/// <summary>
/// 班级编号
/// </summary>
public int ClassId { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 校区编号
/// </summary>
public int School_Id { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}
}
using Edu.Model.Entity.Log;
namespace Edu.Model.ViewModel.Course
{
/// <summary>
/// 班级日志视图实体类
/// </summary>
public class RB_Class_Log_ViewModel : RB_Class_Log
{
/// <summary>
/// 创建时间字符串
/// </summary>
public string CreateTimeStr { get { return Common.ConvertHelper.FormatTime(this.CreateTime); } }
/// <summary>
/// 创建人
/// </summary>
public string CreateByName { get; set; }
}
}
......@@ -19,8 +19,23 @@ namespace Edu.Model.ViewModel.Course
public List<RB_Class_Time_ViewModel> PlanTimeList { get; set; }
/// <summary>
/// 周几 /第几天
/// 查询月份
/// </summary>
public int WeekDay { get; set; }
public string QMonth { get; set; }
/// <summary>
/// 教室名称
/// </summary>
public string RoomName { get; set; }
/// <summary>
/// 讲师姓名
/// </summary>
public string TeacherName { get; set; }
/// <summary>
/// 周几
/// </summary>
public string WeekDay { get; set; }
}
}
......@@ -16,5 +16,10 @@ namespace Edu.Model.ViewModel.Course
/// 班级编号【查询使用,逗号分隔】
/// </summary>
public string QClassIds { get; set; }
/// <summary>
/// 上课时间【日期+开始时间】
/// </summary>
public string NewPlanDateTime { get; set; }
}
}
\ No newline at end of file
......@@ -105,5 +105,15 @@ namespace Edu.Model.ViewModel.Course
/// 默认上课时间
/// </summary>
public List<RB_Class_Time_ViewModel> DefaultPlanTimeList { get; set; }
/// <summary>
/// 月份
/// </summary>
public string QMonth { get; set; }
/// <summary>
/// 具体开课时间
/// </summary>
public string NewPlanDateTime { get; set; }
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -226,33 +226,33 @@ namespace Edu.Module.User
var list = managerModule.GetManagerListModule(new RB_Manager_ViewModel { Group_Id = extModel.Group_Id, MTel = extModel.EmployeeTel });
if (extModel.AccountId == 0)
{
flag = list.Count() > 0 ? true : false;
flag = list.Count() > 0;
}
else
{
flag = list.Where(x => x.MId != extModel.AccountId).Count() > 0 ? true : false;
flag = list.Where(x => x.MId != extModel.AccountId).Count() > 0;
}
break;
case Common.Enum.User.AccountTypeEnum.Teacher:
var teacherList = teacherModule.GetTeacherListModule(new RB_Teacher_ViewModel { Group_Id = extModel.Group_Id, TeacherTel = extModel.EmployeeTel });
if (extModel.AccountId == 0)
{
flag = teacherList.Count() > 0 ? true : false;
flag = teacherList.Count() > 0;
}
else
{
flag = teacherList.Where(x => x.TId != extModel.AccountId).Count() > 0 ? true : false;
flag = teacherList.Where(x => x.TId != extModel.AccountId).Count() > 0;
}
break;
case Common.Enum.User.AccountTypeEnum.Assist:
var assistList = assistModule.GetAssistListModule(new RB_Assist_ViewModel { Group_Id = extModel.Group_Id, AssistTel = extModel.EmployeeTel });
if (extModel.AccountId == 0)
{
flag = assistList.Count() > 0 ? true : false;
flag = assistList.Count() > 0;
}
else
{
flag = assistList.Where(x => x.AId != extModel.AccountId).Count() > 0 ? true : false;
flag = assistList.Where(x => x.AId != extModel.AccountId).Count() > 0;
}
break;
}
......
using Edu.Model.Entity.Course;
using Edu.Common.Enum;
using Edu.Model.Entity.Course;
using Edu.Model.ViewModel.Course;
using System.Collections.Generic;
using System.Linq;
......@@ -21,19 +22,25 @@ namespace Edu.Repository.Course
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM RB_Class_Plan
SELECT A.*,IFNULL(B.RoomName,'') AS RoomName,IFNULL(T.TeacherName,'') AS TeacherName
FROM RB_Class_Plan AS A LEFT JOIN rb_class_room AS B ON A.ClassRoomId=B.RoomId
LEFT JOIN rb_teacher AS T ON A.TeacherId=T.TId
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Plan_ViewModel.Status), (int)DateStateEnum.Normal);
if (query != null)
{
if (query.ClassId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_Plan_ViewModel.ClassId), query.ClassId);
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Plan_ViewModel.ClassId), query.ClassId);
}
if (!string.IsNullOrEmpty(query.QClassIds))
{
builder.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Class_Plan_ViewModel.ClassId), query.QClassIds);
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Class_Plan_ViewModel.ClassId), query.QClassIds);
}
if (!string.IsNullOrEmpty(query.QMonth))
{
builder.AppendFormat(" AND DATE_FORMAT(A.{0},'%y/%m')= DATE_FORMAT('{1}','%y/%m') ", nameof(RB_Class_Plan_ViewModel.ClassDate), query.QMonth);
}
}
return Get<RB_Class_Plan_ViewModel>(builder.ToString()).ToList();
......
......@@ -68,5 +68,30 @@ WHERE t.ClassId =1 GROUP BY t.ClassId,t.StartTime,t.EndTime";
return Get<RB_Class_Time_ViewModel>(sql).ToList();
}
/// <summary>
/// 获取班级上课时间
/// </summary>
/// <param name="classIds"></param>
/// <returns></returns>
public List<RB_Class_Time_ViewModel> GetClassTimeListRepository(string classIds)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.ClassId,DATE_FORMAT(MIN(A.NewPlanDateTime),'%Y-%m-%d %h:%i') AS NewPlanDateTime FROM
(
SELECT A.ClassPlanId,A.ClassId,A.ClassDate,A.`Status`,A.ClassRoomId,A.Group_Id,A.School_Id,A.TeacherId,B.ClassTimeId,B.StartTime,B.EndTime
,CONCAT( DATE_FORMAT(A.ClassDate,'%Y-%m-%d') ,' ',B.StartTime,':00') AS NewPlanDateTime
FROM rb_class_plan AS A INNER JOIN rb_class_time AS B ON A.ClassPlanId=B.ClassPlanId
) AS A
WHERE 1=1
");
if (!string.IsNullOrEmpty(classIds))
{
builder.AppendFormat(" AND A.ClassId IN({0}) ", classIds);
}
builder.AppendFormat(" GROUP BY A.ClassId ");
return Get<RB_Class_Time_ViewModel>(builder.ToString()).ToList();
}
}
}
using Edu.Common.Enum.Course;
using Edu.Model.Entity.Log;
using Edu.Model.ViewModel.Course;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Edu.Repository.Log
{
/// <summary>
/// 班级日志仓储层
/// </summary>
public class RB_Class_LogRepository : BaseRepository<RB_Class_Log>
{
/// <summary>
/// 获取班级日志分页列表
/// </summary>
/// <param name="pageIndex">当前页</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowsCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Class_Log_ViewModel> GetClassLogPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Class_Log_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM RB_Class_Log
WHERE 1=1
");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_Log_ViewModel.Group_Id), query.Group_Id);
}
if (query.School_Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_Log_ViewModel.School_Id), query.School_Id);
}
if (query.ClassId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_Log_ViewModel.ClassId), query.ClassId);
}
}
return GetPage<RB_Class_Log_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
/// <summary>
/// 新增班级日志
/// </summary>
/// <param name="logType">日志类型</param>
/// <param name="LogContent">日志内容</param>
/// <param name="ClassId">班级编号</param>
/// <param name="Group_Id">集团编号</param>
/// <param name="School_Id">校区编号</param>
/// <param name="CreateBy">创建人</param>
/// <returns></returns>
public bool AddClassLogRepository(ClassLogTypeEnum logType, string LogContent, int ClassId, int Group_Id, int School_Id, int CreateBy)
{
var model = new RB_Class_Log()
{
LogType = logType,
LogContent = LogContent,
ClassId = ClassId,
Group_Id = Group_Id,
School_Id = School_Id,
CreateBy = CreateBy
};
return base.Insert(model) > 0;
}
}
}
\ No newline at end of file
......@@ -67,6 +67,7 @@ namespace Edu.WebApi.Controllers.Course
OpenTime = Common.ConvertHelper.FormatDate(item.OpenTime),
item.CompleteProgress,
ClassStatusStr = item.ClassStatus.ToName(),
item.NewPlanDateTime,
});
}
pageModel.Count = rowsCount;
......@@ -161,6 +162,29 @@ namespace Edu.WebApi.Controllers.Course
{
Common.Plugin.LogHelper.Write(ex, "SetClass_DefaultPlanTimeList");
}
if (extModel.DefaultPlanTimeList != null && extModel.DefaultPlanTimeList.Count > 0)
{
foreach (var item in extModel.DefaultPlanTimeList)
{
string message = "";
if (!Common.ConvertHelper.IsTime(item.StartTime + ":00"))
{
message = "【" + item.StartTime + "】格式不正确!(参考格式为 00:00)";
}
if (!Common.ConvertHelper.IsTime(item.EndTime + ":00"))
{
if (!string.IsNullOrEmpty(message))
{
message += ",";
}
message += "【" + item.EndTime + "】格式不正确!(参考格式为 00:00)";
}
if (!string.IsNullOrEmpty(message))
{
return ApiResult.ParamIsNull(message: message);
}
}
}
bool flag = classModule.SetClassModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
......@@ -188,6 +212,104 @@ namespace Edu.WebApi.Controllers.Course
var flag = classModule.RemoveClassModule(ClassId);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
#region 上课计划
/// <summary>
/// 获取上课计划
/// </summary>
/// <returns></returns>
public ApiResult GetClassPlan()
{
var query = new RB_Class_ViewModel()
{
ClassId = base.ParmJObj.GetInt("ClassId"),
QMonth=base.ParmJObj.GetStringValue("QMonth"),
};
var data = classModule.GetClassPlanModule(query.ClassId, query.QMonth);
return ApiResult.Success(data: data);
}
/// <summary>
/// 删除上课计划
/// </summary>
/// <returns></returns>
public ApiResult RemoveClassPlan()
{
var ClassPlanId = base.ParmJObj.GetInt("ClassPlanId");
var flag = classModule.RemoveClassPlanModule(ClassPlanId);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 新增修改班级计划
/// </summary>
/// <returns></returns>
public ApiResult SetClassPlan()
{
var extModel = new RB_Class_Plan_ViewModel()
{
ClassPlanId=base.ParmJObj.GetInt("ClassPlanId"),
ClassId=base.ParmJObj.GetInt("ClassId"),
ClassDate=base.ParmJObj.GetDateTime("ClassDate"),
Status= Common.Enum.DateStateEnum.Normal,
ClassRoomId=base.ParmJObj.GetInt("ClassRoomId"),
TeacherId=base.ParmJObj.GetInt("TeacherId"),
Group_Id=base.UserInfo.Group_Id,
};
extModel.School_Id = classModule.GetClassModule(extModel.ClassId)?.School_Id ?? 0;
try
{
extModel.PlanTimeList = Common.Plugin.JsonHelper.DeserializeObject<List<RB_Class_Time_ViewModel>>(base.ParmJObj.GetStringValue("PlanTimeList"));
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "SetClassPlan_PlanTimeList");
}
if (extModel.PlanTimeList != null && extModel.PlanTimeList.Count > 0)
{
foreach (var item in extModel.PlanTimeList)
{
string message = "";
if (!Common.ConvertHelper.IsTime(item.StartTime + ":00"))
{
message = "【" + item.StartTime + "】格式不正确!(参考格式为 00:00)";
}
if (!Common.ConvertHelper.IsTime(item.EndTime + ":00"))
{
if (!string.IsNullOrEmpty(message))
{
message += ",";
}
message += "【" + item.EndTime + "】格式不正确!(参考格式为 00:00)";
}
if (!string.IsNullOrEmpty(message))
{
return ApiResult.ParamIsNull(message: message);
}
}
}
var flag = classModule.SetClassPlanModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
#region 学员列表
/// <summary>
/// 获取学员列表
/// </summary>
/// <returns></returns>
public ApiResult GetClassStudent()
{
var classId = base.ParmJObj.GetInt("ClassId");
var data = classModule.GetClassStudentListModule(classId);
return ApiResult.Success(data: data);
}
#endregion
#region 枚举相关列表
......
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