Commit d4154d2f authored by liudong1993's avatar liudong1993

学生出勤

parent b923c037
......@@ -53,6 +53,11 @@ namespace Edu.Model.ViewModel.Course
/// </summary>
public int CheckNum { get; set; }
/// <summary>
/// 上课时间段
/// </summary>
public string TimeBucket { get; set; }
/// <summary>
/// 合同课时单价
/// </summary>
......
......@@ -16,6 +16,11 @@ namespace Edu.Model.ViewModel.Course
/// </summary>
public string GuestName { get; set; }
/// <summary>
/// 合同编号
/// </summary>
public string ContractNo { get; set; }
/// <summary>
/// 校区名称
/// </summary>
......
......@@ -43,5 +43,15 @@ namespace Edu.Model.ViewModel.Duty
/// 预约班级编号
/// </summary>
public string QReserveClassIds { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public string StartTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public string EndTime { get; set; }
}
}
......@@ -1469,7 +1469,15 @@ namespace Edu.Module.Course
if (flag)
{
//更新学员完成课时
var completeHours = (oldModel?.FinishClassHours ?? 0) + item.CurrentDeductionHours;
decimal completeHours = 0;
if (item.CheckStatus == 2)
{
//请假不扣课时
completeHours = (oldModel?.FinishClassHours ?? 0);
}
else {
completeHours = (oldModel?.FinishClassHours ?? 0) + item.CurrentDeductionHours;
}
Dictionary<string, object> orderFileds = new Dictionary<string, object>()
{
......
......@@ -222,7 +222,6 @@ namespace Edu.Module.Course
return msg;
}
/// <summary>
/// 获取续费课程列表
/// </summary>
......@@ -283,5 +282,40 @@ namespace Edu.Module.Course
}
return list;
}
#region 出勤管理
/// <summary>
/// 获取学生的当日出勤情况
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public object GetStudentAttendanceDayStatistics(RB_Class_Check_ViewModel demodel)
{
//获取当日签到数据
var list = class_CheckRepository.GetStudentAttendanceDayStatistics(demodel);
//根据班级 课次分组
var RList = list.GroupBy(x => new { x.ClassId, x.ClassName, x.CouseId, x.CourseName,x.ClassRoomId,x.RoomName, x.TeacherId, x.TeacherName, x.ClassDate, x.TimeBucket }).Select(x => new
{
x.Key.ClassId,
x.Key.ClassName,
x.Key.CouseId,
x.Key.CourseName,
x.Key.ClassRoomId,
x.Key.RoomName,
x.Key.TeacherId,
x.Key.TeacherName,
ClassDate = x.Key.ClassDate.ToString("yyyy-MM-dd"),
x.Key.TimeBucket,
GuestList = x.Select(z=>new {
z.OrderGuestId,
z.GuestName,
z.CurrentDeductionHours,
z.CheckStatus
})
});
return RList;
}
#endregion
}
}
......@@ -1477,6 +1477,27 @@ namespace Edu.Module.Duty
return visitorRepository.GetVisitorPageRepository(pageIndex, pageSize, out rowsCount, query);
}
/// <summary>
/// 获取访客记录列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Visitor_ViewModel> GetVisitorAllPageList(int pageIndex, int pageSize, out long rowsCount, RB_Visitor_ViewModel query)
{
var list = visitorRepository.GetVisitorPageRepository(pageIndex, pageSize, out rowsCount, query);
if (list.Any()) {
string userIds = string.Join(",", list.Select(x => x.CreateBy).Distinct());
var ulist = accountRepository.GetEmployeeListRepository(new Employee_ViewModel() { Group_Id = query.Group_Id, QIds = userIds });
foreach (var item in list) {
item.CreateByName = ulist.Where(x => x.Id == item.CreateBy).FirstOrDefault()?.EmployeeName ?? "";
}
}
return list;
}
/// <summary>
/// 新增修改访客
/// </summary>
......
......@@ -155,7 +155,7 @@ WHERE 1=1 AND `Status` =0 and CheckStatus =0 ");
builder.AppendFormat(@"
SELECT A.OrderGuestId AS GuestId,SUM(A.StudyNum) AS FinishMinutes,SUM(A.CurrentDeductionHours) AS FinishClassHours
FROM rb_class_check AS A
WHERE A.`Status`=0 ");
WHERE A.`Status`=0 AND A.CheckStatus <>2 ");
if (!string.IsNullOrEmpty(guestIds))
{
builder.AppendFormat(" AND A.OrderGuestId IN({0})", guestIds);
......@@ -318,6 +318,69 @@ group by g.OrderId,DATE_FORMAT(c.ClassDate,'%Y-%m');";
return Get<RB_Class_Check_ViewModel>(sql).ToList();
}
#region 学生出勤管理
/// <summary>
/// 获取学生签到数据
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Class_Check_ViewModel> GetStudentAttendanceDayStatistics(RB_Class_Check_ViewModel query)
{
DynamicParameters parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,IFNULL(B.GuestName,'') AS GuestName,IFNULL(C.ClassName,'') AS ClassName,C.ClassNo,IFNULL(D.CourseName,'') AS CourseName,IFNULL(E.RoomName,'') AS RoomName
,IFNULL(F.TeacherName,'') AS TeacherName,CONCAT(ct.StartTime,'~',ct.EndTime) as TimeBucket
FROM RB_Class_Check AS A
left join rb_class_time ct on ct.ClassTimeId = A.ClassTimeId
LEFT JOIN rb_order_guest AS B ON A.OrderGuestId=B.Id
LEFT JOIN rb_class AS C ON A.ClassId=C.ClassId
LEFT JOIN rb_course AS D ON C.CouseId=D.CourseId
LEFT JOIN rb_class_room AS E ON A.ClassRoomId=E.RoomId
LEFT JOIN rb_teacher AS F ON A.TeacherId=F.TId
WHERE 1=1 AND A.Status=0 ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Check_ViewModel.Group_Id), query.Group_Id);
}
if (query.School_Id >= 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Check_ViewModel.School_Id), query.School_Id);
}
if (query.ClassId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Check_ViewModel.ClassId), query.ClassId);
}
if (query.CouseId > 0)
{
builder.AppendFormat(" AND C.{0}={1} ", nameof(RB_Class_Check_ViewModel.CouseId), query.CouseId);
}
if (!string.IsNullOrEmpty(query.Q_ClassIds))
{
builder.AppendFormat(" AND A.{0} in({1}) ", nameof(RB_Class_Check_ViewModel.ClassId), query.Q_ClassIds);
}
if (query.OrderGuestId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Check_ViewModel.OrderGuestId), query.OrderGuestId);
}
if (!string.IsNullOrEmpty(query.GuestName))
{
builder.AppendFormat(" AND B.GuestName like @GuestName ");
parameters.Add("GuestName", "%" + query.GuestName + "%");
}
if (!string.IsNullOrWhiteSpace(query.StartDate))
{
builder.AppendFormat(" AND A.{0} ='{1}' ", nameof(RB_Class_Check_ViewModel.ClassDate), query.StartDate);
}
}
return Get<RB_Class_Check_ViewModel>(builder.ToString(), parameters).ToList();
}
#endregion
#region 报表统计
/// <summary>
......
......@@ -43,9 +43,10 @@ namespace Edu.Repository.Course
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,IFNULL(B.GuestName,'') AS GuestName,IFNULL(C.SName,'') AS SchoolName,IFNULL(D.ClassName,'') AS ClassName,IFNULL(T.TeacherName,'') AS TeacherName
SELECT A.*,IFNULL(B.GuestName,'') AS GuestName,ec.ContractNo,IFNULL(C.SName,'') AS SchoolName,IFNULL(D.ClassName,'') AS ClassName,IFNULL(T.TeacherName,'') AS TeacherName
,IFNULL(E.EnterID,0) AS EnterID,IFNULL(F.CourseName,'') AS CourseName,D.ClassNo
FROM RB_Student_BackClass AS A LEFT JOIN rb_order_guest AS B ON A.GuestId=B.Id
left join rb_education_contract ec on B.Id = ec.GuestId and ec.Status <>4
LEFT JOIN rb_school AS C ON A.SchoolId=C.SId
LEFT JOIN rb_class AS D ON A.ClassId=D.ClassId
LEFT JOIN (SELECT account.Id,teac.TeacherName FROM rb_account AS account INNER JOIN rb_teacher AS teac ON account.AccountId=teac.TId AND account.AccountType=2)
......
......@@ -58,6 +58,14 @@ WHERE 1=1
{
builder.AppendFormat(@" AND A.Id IN(SELECT Visitor_Id FROM rb_visitor_reserve WHERE ReserveClassId IN({0}) )",query.QReserveClassIds);
}
if (!string.IsNullOrEmpty(query.StartTime))
{
builder.AppendFormat(@" AND A.{0} >='{1}' ", nameof(RB_Visitor_ViewModel.CreateTime), query.StartTime);
}
if (!string.IsNullOrEmpty(query.EndTime))
{
builder.AppendFormat(@" AND A.{0} <='{1} 23:59:59' ", nameof(RB_Visitor_ViewModel.CreateTime), query.EndTime);
}
}
return GetPage<RB_Visitor_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
......
......@@ -192,5 +192,24 @@ namespace Edu.WebApi.Controllers.Course
pageModel.PageData = obj;
return ApiResult.Success(data: pageModel);
}
#region 出勤管理
/// <summary>
/// 获取学生的当日出勤情况
/// </summary>
/// <returns></returns>
public ApiResult GetStudentAttendanceDayStatistics() {
var userInfo = base.UserInfo;
RB_Class_Check_ViewModel demodel = JsonHelper.DeserializeObject<RB_Class_Check_ViewModel>(RequestParm.Msg.ToString());
demodel.Group_Id = userInfo.Group_Id;
if (string.IsNullOrEmpty(demodel.StartDate)) {
return ApiResult.ParamIsNull("请传递日期");
}
var RObj = studentBillModule.GetStudentAttendanceDayStatistics(demodel);
return ApiResult.Success("", RObj);
}
#endregion
}
}
......@@ -502,7 +502,7 @@ namespace Edu.WebApi.Controllers.Duty
PlanId = base.ParmJObj.GetInt("PlanId"),
KeyWords = base.ParmJObj.GetStringValue("KeyWords"),
IsQueryAll = base.ParmJObj.GetInt("IsQueryAll"),//1-查看全部
QReserveClassIds = base.ParmJObj.GetStringValue("QReserveClassIds"),
QReserveClassIds = base.ParmJObj.GetStringValue("QReserveClassIds")
};
if (query.IsQueryAll != 1)
{
......@@ -541,6 +541,53 @@ namespace Edu.WebApi.Controllers.Duty
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 获取访客分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetVisitorAllPageList()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Visitor_ViewModel()
{
PlanId = base.ParmJObj.GetInt("PlanId"),
KeyWords = base.ParmJObj.GetStringValue("KeyWords"),
IsQueryAll = base.ParmJObj.GetInt("IsQueryAll"),//1-查看全部
QReserveClassIds = base.ParmJObj.GetStringValue("QReserveClassIds"),
CreateBy = base.ParmJObj.GetInt("CreateBy", 0),
StartTime = base.ParmJObj.GetStringValue("StartTime"),
EndTime = base.ParmJObj.GetStringValue("EndTime")
};
query.Group_Id = base.UserInfo.Group_Id;
List<object> result = new List<object>();
var list = dutyPlanModule.GetVisitorAllPageList(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
{
result.Add(new
{
item.Id,
item.Name,
item.Tel,
item.WeChatNum,
item.CourseName,
item.StudyTime,
item.LevelType,
item.CreateByName,
item.VisitorStatus,
item.VisitorStatusStr,
item.Evaluate,
item.VisitTimes,
item.Remark,
item.Age,
CreateTimeStr = Common.ConvertHelper.FormatDate(item.CreateTime)
});
}
pageModel.Count = rowsCount;
pageModel.PageData = result;
return ApiResult.Success(data: pageModel);
}
/// <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