Commit d68dbe4c authored by 黄奎's avatar 黄奎

排课查询调整

parent 2ec48eb7
using Edu.Common.Plugin;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Common.Enum.User
{
......
......@@ -127,6 +127,16 @@ namespace Edu.Model.ViewModel.Scroll
/// </summary>
public int GuestId { get; set; }
/// <summary>
/// 上课老师ID
/// </summary>
public int AccountId { get; set; }
/// <summary>
/// 上课老师
/// </summary>
public string TeacherName { get; set; }
/// <summary>
/// 报名课程ID
/// </summary>
......@@ -161,6 +171,21 @@ namespace Edu.Model.ViewModel.Scroll
/// 每次课消耗课时
/// </summary>
public decimal CurrentDeductionHours { get; set; }
/// <summary>
/// 考勤方式
/// </summary>
public AttendanceMethodEnum AttendanceMethod { get; set; }
/// <summary>
/// 上课开始时间
/// </summary>
public string StartTime { get; set; }
/// <summary>
/// 上课结束时间
/// </summary>
public string EndTime { get; set; }
}
......
......@@ -3982,7 +3982,7 @@ namespace Edu.Module.Course
/// <param name="appointState"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public object GetAppointmentPlanStat(string StartDate, string EndDate, int teacherId, int classRoomId, int ClassType, int appointState, int group_Id)
public object GetAppointmentPlanStatModule(string StartDate, string EndDate, int teacherId, int classRoomId, int ClassType, int appointState, int group_Id)
{
var sDTime = Convert.ToDateTime(StartDate);
var eDTime = Convert.ToDateTime(EndDate);
......
......@@ -43,7 +43,19 @@ namespace Edu.Module.Course
var list = scheduleCourseRepository.GetScheduleCourseStuListRepository(query);
if (list != null && list.Count > 0)
{
List<int> IdList = new List<int>();
foreach (var item in list)
{
if (item.CourseItems != null && item.CourseItems.Count > 0)
{
var tempArray = item.CourseItems.Select(qitem => qitem.AccountId).Distinct();
if (tempArray != null && tempArray.Count() > 0)
{
IdList.AddRange(tempArray);
}
}
}
var tempHeadMaster = list.Select(qitem => qitem.HeadMasterId).Distinct();
if (tempHeadMaster != null && tempHeadMaster.Count() > 0)
{
......@@ -71,6 +83,14 @@ namespace Edu.Module.Course
{
item.EnterName = empList?.FirstOrDefault(qitem => qitem.Id == item.EnterID)?.AccountName ?? "";
}
if (item.CourseItems != null && item.CourseItems.Count > 0)
{
foreach(var subItem in item.CourseItems)
{
subItem.TeacherName = empList?.FirstOrDefault(qitem => qitem.Id == subItem.AccountId)?.AccountName ?? "";
}
}
}
}
return list;
......
......@@ -312,15 +312,7 @@ FROM RB_Scroll_Appointment AS sa
WHERE 1=1 {where}
GROUP BY StuId) as t on t.Date=sat.Date and t.StuId=sat.StuId
) AS A LEFT JOIN rb_course_chapter as cc ON A.LearnCourseId=cc.CourseId and CONCAT(A.CourseGradeNo,'')=cc.ChapterNo ";
// string sql = $@"
//SELECT A.*,cc.ChapterName
//FROM
//(
//SELECT StuId,LearnCourseId,MAX(CourseGradeNo) AS CourseGradeNo
//FROM RB_Scroll_Appointment AS sa
//WHERE 1=1 {where}
//GROUP BY StuId,LearnCourseId
//) AS A LEFT JOIN rb_course_chapter as cc ON A.LearnCourseId=cc.CourseId and CONCAT(A.CourseGradeNo,'')=cc.ChapterNo ";
return Get<RB_Scroll_Appointment_ViewModel>(sql, parameters).ToList();
}
......@@ -333,7 +325,7 @@ GROUP BY StuId) as t on t.Date=sat.Date and t.StuId=sat.StuId
/// <param name="groupId"></param>
public void UpdateAppointSkipCourse(int stuId, int guestId, int ChapterNum,int SChapterNo, int groupId)
{
//string sql = $@"UPDATE rb_scroll_appointment SET ChapterNo = ChapterNo +{ChapterNum} WHERE Group_Id ={groupId} and StuId ={stuId} and GuestId ={guestId} ";
string sql = $@"UPDATE rb_scroll_appointment a
SET a.ChapterNo = a.ChapterNo +{ChapterNum},a.CourseGradeId = (SELECT CourseRate FROM rb_course_chapter c WHERE c.Group_Id ={groupId} and c.CourseId =a.LearnCourseId and c.ChapterNo =a.ChapterNo)
,a.CourseGradeNo = (SELECT ChapterGradeNo FROM rb_course_chapter c WHERE c.Group_Id ={groupId} and c.CourseId =a.LearnCourseId and c.ChapterNo =a.ChapterNo)
......
......@@ -90,7 +90,9 @@ WHERE 1=1 AND B.OrderState=1 AND B.OrderType=1 AND E.ClassScrollType=2
StringBuilder appointBuilder = new StringBuilder();
appointBuilder.AppendFormat(@"
SELECT A.Date,A.AccountId,A.State,A.GuestId,A.LearnCourseId,A.CourseGradeId,A.CourseGradeNo,IFNULL(C.ClassCheckId,0) AS ClassCheckId,IFNULL(C.CurrentDeductionHours,0) AS CurrentDeductionHours
SELECT A.Date,A.AccountId,A.State,A.GuestId,A.LearnCourseId,A.CourseGradeId,A.CourseGradeNo,IFNULL(C.ClassCheckId,0) AS ClassCheckId
,IFNULL(C.CurrentDeductionHours,0) AS CurrentDeductionHours,IFNULL(C.AttendanceMethod,0) AS AttendanceMethod,IFNULL(A.CourseSTime,'') AS StartTime
,IFNULL(A.CourseETime,'') AS EndTime
FROM rb_scroll_appointment AS A LEFT JOIN rb_class_time AS B ON A.ClassPlanId=B.ClassPlanId
LEFT JOIN rb_class_check AS C ON B.ClassTimeId=C.ClassTimeId AND A.GuestId=C.OrderGuestId
WHERE 1=1 AND A.State IN(3) AND A.AppointType IN(1,2)
......
using Aliyun.Acs.Core.Retry.BackoffStrategy;
using Edu.Common.API;
using Edu.Common.API;
using Edu.Common.Enum.Course;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Scroll;
using Edu.Model.ViewModel.Sell;
using Edu.Model.ViewModel.User;
using Edu.Module.Course;
using Edu.Module.User;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -80,6 +75,11 @@ namespace Edu.WebApi.Controllers.Course
StateName = qitem.State.ToName(),
qitem.ClassCheckId,
ChapterId = qitem.CourseGradeNo,
qitem.AttendanceMethod,
AttendanceMethodName = qitem.AttendanceMethod.ToName(),
StartTime = !string.IsNullOrEmpty(qitem.StartTime) ? qitem.StartTime : "",
EndTime = !string.IsNullOrEmpty(qitem.EndTime) ? qitem.EndTime : "",
TeacherName = !string.IsNullOrEmpty(qitem.TeacherName) ? qitem.TeacherName : "",
}));
if (query.QCourseRate == Common.Enum.Course.CourseRateEnum.N5
|| query.QCourseRate == Common.Enum.Course.CourseRateEnum.N4
......@@ -141,7 +141,6 @@ namespace Edu.WebApi.Controllers.Course
}
/// <summary>
/// 取消学员签到
/// </summary>
......@@ -149,8 +148,9 @@ namespace Edu.WebApi.Controllers.Course
[HttpPost]
public ApiResult CancalGuestCheck()
{
return ApiResult.Failed();
int GuestId = base.ParmJObj.GetInt("GuestId");
bool flag = scheduleCourse.CancelGuestCheckModule(GuestId);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
......
......@@ -494,7 +494,7 @@ namespace Edu.WebApi.Controllers.Course
#region 预约课管理
/// <summary>
/// 获取预约课计划
/// 获取预约课中心接口
/// </summary>
/// <returns></returns>
[HttpPost]
......@@ -506,13 +506,11 @@ namespace Edu.WebApi.Controllers.Course
int ClassRoomId = base.ParmJObj.GetInt("ClassRoomId");
int ClassType = base.ParmJObj.GetInt("ClassType");//课程类型(0-全部,1-正常,2-试听课)
int AppointState = base.ParmJObj.GetInt("AppointState", 0);//约课状态 1待确认 2已确认
if (string.IsNullOrEmpty(StartDate) || string.IsNullOrEmpty(EndDate))
{
return ApiResult.ParamIsNull();
}
var obj = classModule.GetAppointmentPlanStat(StartDate, EndDate, TeacherId, ClassRoomId, ClassType, AppointState, base.UserInfo.Group_Id);
var obj = classModule.GetAppointmentPlanStatModule(StartDate, EndDate, TeacherId, ClassRoomId, ClassType, AppointState, base.UserInfo.Group_Id);
return ApiResult.Success(data: obj);
}
......
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