Commit 81434059 authored by 吴春's avatar 吴春

提交代码

parent 9d2c0fee
......@@ -127,6 +127,12 @@ namespace Edu.Model.ViewModel.Course
/// <summary>
/// 第几次上课
/// </summary>
public object Ranks { get; set; }
public object Ranks { get; set; }
/// <summary>
/// 总的上课次数
/// </summary>
public int TotalPlanNum { get; set; }
}
}
......@@ -216,6 +216,16 @@ namespace Edu.Model.ViewModel.Course
/// </summary>
public int IsQuerySurplus { get; set; }
/// <summary>
/// 总的上课次数
/// </summary>
public int TotalPlanNum { get; set; }
/// <summary>
/// 已上课次数
/// </summary>
public int UsePlanNum { get; set; }
}
/// <summary>
......
This diff is collapsed.
......@@ -242,6 +242,10 @@ WHERE 1=1
{
builder.AppendFormat(" AND A.{0}<>{1} ", nameof(RB_Class_ViewModel.ClassId), query.OldClassId);
}
if (query.Teacher_Id > 0)
{
builder.AppendFormat(" AND D.{0}<>{1} ", nameof(RB_Teacher_ViewModel.TId), query.Teacher_Id);
}
}
return GetPage<RB_Class_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
......@@ -498,5 +502,89 @@ where a.`Status`=0 and a.IsSubscribe=1 and ClassStatus in(1,2)");
var obj = ExecuteScalar(sql);
return obj == null ? 0 : Convert.ToInt32(obj);
}
#region 教师-我的班级
/// <summary>
/// 获取班级分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Class_ViewModel> GetTeacherClassPageList(int pageIndex, int pageSize, out long rowsCount, RB_Class_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT plan.TotalPlanNum,ySplan.UsePlanNum,A.*,B.CourseName,C.AssistName,IFNULL(C.AssistIcon,'') AS AssistIcon,D.TeacherName,IFNULL(D.TeacherHead,'') AS TeacherHead
,E.SName AS SchoolName,IFNULL(F.RoomName,'') AS RoomName
FROM rb_class AS A LEFT JOIN rb_course AS B ON A.CouseId=B.CourseId
LEFT JOIN rb_assist AS C ON A.Assist_Id=C.AId
LEFT JOIN rb_teacher AS D ON A.Teacher_Id=D.TId
LEFT JOIN rb_school AS E ON A.School_Id=E.SId
LEFT JOIN rb_class_room AS F ON A.ClassRoomId=F.RoomId
LEFT JOIN ((SELECT ClassId,COUNT(*) as TotalPlanNum from rb_class_plan where `Status`=0 GROUP BY ClassId)) as plan on plan.ClassId=a.ClassId
LEFT JOIN ((SELECT ClassId,COUNT(*) as UsePlanNum from rb_class_plan where `Status`=0 and DATE_FORMAT(ClassDate,'%Y-%m-%d') <=DATE_FORMAT(NOW(),'%Y-%m-%d') GROUP BY ClassId)) as ySplan on ySplan.ClassId=a.ClassId
WHERE 1=1 ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_ViewModel.Group_Id), query.Group_Id);
}
if (query.School_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_ViewModel.School_Id), query.School_Id);
}
if (query.Status >= 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_ViewModel.Status), (int)query.Status);
}
if (query.ClassStatus > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_ViewModel.ClassStatus), (int)query.ClassStatus);
}
if (!string.IsNullOrWhiteSpace(query.ClassName))
{
builder.AppendFormat(" AND A.{0} LIKE @ClassName ", nameof(RB_Class_ViewModel.ClassName));
parameters.Add("ClassName", "%" + query.ClassName.Trim() + "%");
}
if (!string.IsNullOrWhiteSpace(query.CourseName))
{
builder.AppendFormat(" AND B.{0} LIKE @CourseName ", nameof(RB_Course_ViewModel.CourseName));
parameters.Add("CourseName", "%" + query.CourseName.Trim() + "%");
}
if (!string.IsNullOrWhiteSpace(query.AssistName))
{
builder.AppendFormat(" AND C.{0} LIKE @AssistName ", nameof(RB_Assist_ViewModel.AssistName));
parameters.Add("AssistName", "%" + query.AssistName.Trim() + "%");
}
if (!string.IsNullOrWhiteSpace(query.TeacherName))
{
builder.AppendFormat(" AND D.{0} LIKE @TeacherName ", nameof(RB_Teacher_ViewModel.TeacherName));
parameters.Add("TeacherName", "%" + query.TeacherName.Trim() + "%");
}
if (!string.IsNullOrEmpty(query.StartTime))
{
builder.AppendFormat(" AND A.{0}>='{1}' ", nameof(RB_Class_ViewModel.OpenTime), query.StartTime);
}
if (!string.IsNullOrEmpty(query.EndTime))
{
builder.AppendFormat(" AND A.{0}<='{1} 23:59:59' ", nameof(RB_Class_ViewModel.OpenTime), query.EndTime);
}
if (query.OldClassId > 0)
{
builder.AppendFormat(" AND A.{0}<>{1} ", nameof(RB_Class_ViewModel.ClassId), query.OldClassId);
}
if (query.Teacher_Id > 0)
{
builder.AppendFormat(" AND D.{0}<>{1} ", nameof(RB_Teacher_ViewModel.TId), query.Teacher_Id);
}
}
return GetPage<RB_Class_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
#endregion
}
}
\ No newline at end of file
......@@ -536,6 +536,10 @@ where sog.Account_Id={query.StuId} and c.ClassStatus in(1,2) and c.`Status`=0 an
{
where.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Plan_ViewModel.ClassRoomId), query.ClassRoomId);
}
if (query.School_Id > -1)
{
where.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Plan_ViewModel.School_Id), query.School_Id);
}
if (query.ClassId > 0)
{
where.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Plan_ViewModel.ClassId), query.ClassId);
......@@ -544,16 +548,18 @@ where sog.Account_Id={query.StuId} and c.ClassStatus in(1,2) and c.`Status`=0 an
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.ClassPlanId,A.ClassId,A.ClassDate,A.ClassRoomId,A.ClassName,A.CourseName,A.Teacher_Id,A.TeacherName,A.RoomName
,SUM(A.minNum) AS ClassMinutes,MIN(A.StartTime) AS StartTime,MAX(A.EndTime) AS EndTime,A.CompleteProgress
,SUM(A.minNum) AS ClassMinutes,MIN(A.StartTime) AS StartTime,MAX(A.EndTime) AS EndTime,A.CompleteProgress,a.TotalPlanNum,
(SELECT COUNT(*) from rb_class_plan where `Status`=0 and DATE_FORMAT(ClassDate,'%Y-%m-%d') <=DATE_FORMAT(a.ClassDate,'%Y-%m-%d') and ClassId=a.ClassId) as Ranks
FROM
(
SELECT A.ClassPlanId, A.ClassId,A.ClassDate,A.ClassRoomId,B.ClassName,C.CourseName,B.Teacher_Id,IFNULL(D.TeacherName,'') AS TeacherName,E.RoomName
,TIMESTAMPDIFF(MINUTE, CONCAT('2020-12-16',' ',F.StartTime), CONCAT('2020-12-16',' ',F.EndTime)) AS minNum,F.StartTime,F.EndTime,B.CompleteProgress
,TIMESTAMPDIFF(MINUTE, CONCAT('2020-12-16',' ',F.StartTime), CONCAT('2020-12-16',' ',F.EndTime)) AS minNum,F.StartTime,F.EndTime,B.CompleteProgress,plan.TotalPlanNum
FROM rb_class_plan AS A INNER JOIN rb_class AS B ON A.ClassId=B.ClassId
LEFT JOIN rb_course AS C ON B.CouseId=C.CourseId
LEFT JOIN rb_teacher AS D ON B.Teacher_Id=D.TId
LEFT JOIN rb_class_room AS E ON A.ClassRoomId=E.RoomId
LEFT JOIN rb_class_time F on A.ClassPlanId = F.ClassPlanId
LEFT JOIN ((SELECT ClassId,COUNT(*) as TotalPlanNum from rb_class_plan where `Status`=0 GROUP BY ClassId)) as plan on plan.ClassId=a.ClassId
WHERE 1=1 AND A.`Status`=0 {0}
) AS A
GROUP BY A.ClassPlanId,A.ClassId ,A.ClassDate,A.ClassRoomId,A.CompleteProgress
......
......@@ -98,6 +98,10 @@ WHERE 1=1
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Reserve_Class_Extend.ClassRoomId), query.ClassRoomId);
}
if (query.School_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Reserve_Class_Extend.School_Id), query.School_Id);
}
}
return Get<RB_Reserve_Class_Extend>(builder.ToString(),parameters).ToList();
}
......
......@@ -2149,6 +2149,7 @@ namespace Edu.WebApi.Controllers.Course
TeacherId = base.ParmJObj.GetInt("TeacherId"),
ClassRoomId = base.ParmJObj.GetInt("ClassRoomId"),
Group_Id = base.UserInfo.Group_Id,
School_Id = -1,
ClassId = base.ParmJObj.GetInt("ClassId"),
};
//课程类型(0-全部,1-正常,2-试听课)
......
......@@ -255,7 +255,7 @@ namespace Edu.WebApi.Controllers.Course
}
else
{
}
RB_Class_Plan_ViewModel query = new RB_Class_Plan_ViewModel()
{
......@@ -264,6 +264,7 @@ namespace Edu.WebApi.Controllers.Course
TeacherId = base.ParmJObj.GetInt("TeacherId"),
ClassRoomId = base.ParmJObj.GetInt("ClassRoomId"),
Group_Id = base.UserInfo.Group_Id,
School_Id = base.ParmJObj.GetInt("SchoolId", -1),
ClassId = base.ParmJObj.GetInt("ClassId"),
};
//课程类型(0-全部,1-正常,2-试听课)
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Edu.Cache.User;
using Edu.Common.API;
using Edu.Common.Enum.Course;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Course;
using Edu.Module.Course;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Edu.WebApi.Controllers.Course
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class TeacherClassController : BaseController
{
/// <summary>
/// 班级处理类对象
/// </summary>
private readonly ClassModule classModule = AOP.AOPHelper.CreateAOPObject<ClassModule>();
#region 班级管理
/// <summary>
/// 获取班级页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetClassPageList()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Class_ViewModel()
{
ClassName = base.ParmJObj.GetStringValue("ClassName"),
ClassStatus = (ClassStatusEnum)base.ParmJObj.GetInt("ClassStatus"),
Teacher_Id = base.ParmJObj.GetInt("Teacher_Id"),
CouseId = base.ParmJObj.GetInt("CouseId"),
School_Id = base.ParmJObj.GetInt("School_Id"),
TeacherName = base.ParmJObj.GetStringValue("TeacherName"),
CourseName = base.ParmJObj.GetStringValue("CourseName"),
};
query.Group_Id = base.UserInfo.Group_Id;
List<object> result = new List<object>();
var list = classModule.GetTeacherClassPageList(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
{
if (item.CreateBy > 0)
{
item.CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.AccountName ?? "";
}
if (item.UpdateBy > 0)
{
item.UpdateByName = UserReidsCache.GetUserLoginInfo(item.UpdateBy)?.AccountName ?? "";
}
result.Add(new
{
item.ClassId,
item.ClassName,
item.School_Id,
item.SchoolName,
item.CourseName,
item.Teacher_Id,
item.TeacherName,
item.ClassPersion,
item.TotalPlanNum,
item.UsePlanNum,
OpenTime = Common.ConvertHelper.FormatDate(item.OpenTime),
item.ClassStatusStr,
item.NewPlanDateTime,
item.ClassStatus,
item.Status,
item.OtherCourseList,
item.ClassNo
});
}
pageModel.Count = rowsCount;
pageModel.PageData = result;
return ApiResult.Success(data: pageModel);
}
#endregion
#region 我的课表
/// <summary>
/// 老师上课计划统计
/// </summary>
/// <returns></returns>
public ApiResult GetClassPlanStatistical()
{
var startDate = base.ParmJObj.GetStringValue("StartTime");
var endDate = base.ParmJObj.GetStringValue("EndTime");
DateTime now = DateTime.Now;
//获取当前月的第一天
DateTime d1 = new DateTime(now.Year, now.Month, 1);
//当月最后一天
DateTime d2 = d1.AddMonths(1).AddDays(-1);
if (string.IsNullOrEmpty(startDate))
{
startDate = Common.ConvertHelper.FormatDate(d1);
}
if (string.IsNullOrEmpty(endDate))
{
endDate = Common.ConvertHelper.FormatDate(d2);
}
else
{
//if (Convert.ToDateTime(endDate) > Convert.ToDateTime(Common.ConvertHelper.FormatDate(DateTime.Now)))
//{
// endDate = Common.ConvertHelper.FormatDate(DateTime.Now);
//}
}
RB_Class_Plan_ViewModel query = new RB_Class_Plan_ViewModel()
{
StartTime = startDate,
EndTime = endDate,
TeacherId = base.ParmJObj.GetInt("TeacherId"),
ClassRoomId = base.ParmJObj.GetInt("ClassRoomId"),
Group_Id = base.UserInfo.Group_Id,
School_Id = -1,
ClassId = base.ParmJObj.GetInt("ClassId"),
};
//课程类型(0-全部,1-正常,2-试听课)
int ClassType = base.ParmJObj.GetInt("ClassType");
var obj = classModule.GetTeacherPlanStatisticalModule(query, ClassType: ClassType);
return ApiResult.Success(data: obj);
}
#endregion
}
}
......@@ -259,8 +259,8 @@ namespace Edu.WebApi.Controllers.User
CommissionId = commissionId,
SureStatus = sureStatus,
TotalTCommiommission = totalTCommiommission,
CommissionTId = sureTStatus,
SureTStatus = commissionTId,
CommissionTId = commissionTId,
SureTStatus = sureTStatus,
});
}
......
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