Commit e0eeb659 authored by 黄奎's avatar 黄奎

新增取消接口

parent cac1edbe
......@@ -27,6 +27,7 @@ namespace Edu.Common.Enum.Course
/// </summary>
[EnumField("已上课")]
Coursed = 3,
/// <summary>
/// 缺席
/// </summary>
......@@ -38,6 +39,11 @@ namespace Edu.Common.Enum.Course
/// </summary>
[EnumField("取消")]
Cancel = 5,
/// <summary>
/// 学员消课专用,不计算老师课时费,计算学员签到
/// </summary>
[EnumField("学员消课")]
StuCheck=6
}
}
......@@ -46,10 +46,10 @@ namespace Edu.Model.Entity.Scroll
/// </summary>
public string ShiftSort { get; set; }
/// <summary>
/// 状态 1待确认 2待上课 3已上课 4缺席 5取消
/// </summary>
public CourseAppointStateEnum State { get; set; }
/// <summary>
/// 状态 1待确认 2待上课 3已上课 4缺席 5取消 6学员消课专用,不计算老师课时费,计算学员签到
/// </summary>
public CourseAppointStateEnum State { get; set; }
/// <summary>
/// 删除
......@@ -145,5 +145,10 @@ namespace Edu.Model.Entity.Scroll
/// 课程等级 对应的章节 与CourseGradeId 组成唯一 【hk2022-07-07直接修改为rb_course_chapter 中的chapterNo 需要消课的章节】
/// </summary>
public int CourseGradeNo { get; set; }
}
/// <summary>
/// 是否扣除学员课时(1-扣除,0-不扣)
/// </summary>
public int IsCalcStuCheck { get; set; }
}
}
\ No newline at end of file
......@@ -186,6 +186,26 @@ namespace Edu.Model.ViewModel.Scroll
/// 上课结束时间
/// </summary>
public string EndTime { get; set; }
/// <summary>
/// 上课教师
/// </summary>
public int ClassRoomId { get; set; }
/// <summary>
/// 上课教室
/// </summary>
public string RoomName { get; set; }
/// <summary>
/// 预约编号
/// </summary>
public int AppointId { get; set; }
/// <summary>
/// 预约班次
/// </summary>
public string ShiftSort { get; set; }
}
......
using Edu.Model.Entity.Grade;
using Edu.Common.Plugin;
using Edu.Model.Entity.Grade;
using Edu.Model.Entity.Sell;
using Edu.Model.ViewModel.Course;
using Edu.Model.ViewModel.Grade;
using Edu.Model.ViewModel.Question;
using Edu.Model.ViewModel.Scroll;
using Edu.Model.ViewModel.Sell;
......@@ -32,6 +34,8 @@ namespace Edu.Module.Course
private RB_Order_GuestRepository guestRepository = new RB_Order_GuestRepository();
private RB_Class_CheckRepository checkRepository = new RB_Class_CheckRepository();
private RB_CourseRepository courseRepository = new RB_CourseRepository();
private RB_Class_RoomRepository class_RoomRepository = new RB_Class_RoomRepository();
private RB_Scroll_AppointmentRepository appointmentRepository = new RB_Scroll_AppointmentRepository();
/// <summary>
/// 排课计划表
......@@ -44,10 +48,16 @@ namespace Edu.Module.Course
if (list != null && list.Count > 0)
{
List<int> IdList = new List<int>();
List<int> roomIdList = new List<int>();
foreach (var item in list)
{
if (item.CourseItems != null && item.CourseItems.Count > 0)
{
var tempRoomArray = item.CourseItems.Select(qitem => qitem.ClassRoomId).Distinct();
if (tempRoomArray != null && tempRoomArray.Count() > 0)
{
roomIdList.AddRange(tempRoomArray);
}
var tempArray = item.CourseItems.Select(qitem => qitem.AccountId).Distinct();
if (tempArray != null && tempArray.Count() > 0)
{
......@@ -71,6 +81,15 @@ namespace Edu.Module.Course
string Ids = string.Join(",", IdList.Distinct());
empList= accountRepository.GetAccountListExtRepository(new Model.ViewModel.User.RB_Account_ViewModel() { QIds = Ids });
}
List<RB_Class_Room_ViewModel> roomList = new List<RB_Class_Room_ViewModel>();
if(roomIdList!=null && roomIdList.Count > 0)
{
string roomIds = string.Join(",", roomIdList.Distinct());
if (!string.IsNullOrEmpty(roomIds))
{
roomList= class_RoomRepository.GetClassRoomListExtRepository(roomIds);
}
}
foreach (var item in list)
{
......@@ -88,6 +107,10 @@ namespace Edu.Module.Course
foreach(var subItem in item.CourseItems)
{
subItem.TeacherName = empList?.FirstOrDefault(qitem => qitem.Id == subItem.AccountId)?.AccountName ?? "";
if (subItem.ClassRoomId > 0)
{
subItem.RoomName = roomList?.FirstOrDefault(qitem => qitem.RoomId == subItem.ClassRoomId)?.RoomName ?? "";
}
}
}
}
......@@ -121,7 +144,6 @@ namespace Edu.Module.Course
return flag;
}
/// <summary>
/// 修改学员,学管备注
/// </summary>
......@@ -169,7 +191,6 @@ namespace Edu.Module.Course
return flag;
}
/// <summary>
/// 修改学员上课方式
/// </summary>
......@@ -227,5 +248,46 @@ namespace Edu.Module.Course
}
return list;
}
/// <summary>
/// 获取预约详情
/// </summary>
/// <param name="Date"></param>
/// <param name="AccountId"></param>
/// <param name="ShiftSort"></param>
/// <returns></returns>
public object GetStuAppointPlanModule(string Date, int AccountId, string ShiftSort)
{
object obj = new object();
var tempList = appointmentRepository.GetList(new RB_Scroll_Appointment_ViewModel { StartTime = Date, EntTime = Date, AccountId = AccountId, ShiftSort = ShiftSort });
if (tempList != null && tempList.Count > 0)
{
var firstModel = tempList.FirstOrDefault();
obj = new
{
firstModel.CourseId,
firstModel.CourseGradeNo,
firstModel.Date,
firstModel.RoomId,
firstModel.ShiftSort,
firstModel.TeacherId,
firstModel.ChapterNo,
ChooseStuList = tempList.Select(qitem => new
{
qitem.LearnCourseId,
qitem.StuId,
qitem.CourseGradeId,
qitem.GuestId,
qitem.CourseGradeNo,
qitem.Id,
qitem.StuName,
qitem.IsCalcStuCheck,
qitem.State,
StateName=qitem.State.ToName()
}),
};
}
return obj;
}
}
}
......@@ -669,10 +669,15 @@ namespace Edu.Module.Course
public void CreateScrollChapter(int groupId = 100000)
{
//查询当前时间已结束的预约课
var list = scroll_AppointmentRepository.GetList(new RB_Scroll_Appointment_ViewModel() { Group_Id = groupId, CourseEndTimeStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), State = Common.Enum.Course.CourseAppointStateEnum.WaitCourse });
var list = scroll_AppointmentRepository.GetList(new RB_Scroll_Appointment_ViewModel() { Group_Id = groupId, CourseEndTimeStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
if (list.Any())
{
class_CheckRepository.AppointStuCheckRepository(list);
var tempList = list.Where(qitem => qitem.State == Common.Enum.Course.CourseAppointStateEnum.WaitCourse || qitem.State == Common.Enum.Course.CourseAppointStateEnum.StuCheck)?.ToList();
if(tempList.Any())
{
class_CheckRepository.AppointStuCheckRepository(tempList);
}
}
}
#endregion
......
This diff is collapsed.
......@@ -1345,30 +1345,22 @@ WHERE 1=1 AND A.Status=0 {1} ", builderMakeUp.ToString(), builderWhere.ToString
string orderGuestIds = string.Join(",", list.Select(x => x.GuestId).Distinct());
var guestList= GetOrderGuestListRepository(orderGuestIds);
var oldCheckList = GetClassCheckList(new RB_Class_Check_ViewModel() { QOrderGuestIds = orderGuestIds });
foreach (var item in list)
{
//更新约课为已上课
Dictionary<string, object> keyValues = new Dictionary<string, object>()
string tempSql = " UPDATE RB_Scroll_Appointment SET State={0} WHERE Id={1} ";
string newSql = "";
if (item.State == Common.Enum.Course.CourseAppointStateEnum.WaitSure)
{
{ nameof(RB_Scroll_Appointment_ViewModel.State), Common.Enum.Course.CourseAppointStateEnum.Coursed}
};
List<WhereHelper> wheres = new List<WhereHelper>()
newSql = string.Format(tempSql, (int)Common.Enum.Course.CourseAppointStateEnum.Coursed, item.Id);
}
else if (item.State == Common.Enum.Course.CourseAppointStateEnum.StuCheck)
{
new WhereHelper()
{
FiledName = nameof(RB_Scroll_Appointment_ViewModel.Id),
FiledValue = item.Id,
OperatorEnum =OperatorEnum.Equal
}
};
string appointSql = string.Format(" UPDATE RB_Scroll_Appointment SET State={0} WHERE Id={1} ", (int)Common.Enum.Course.CourseAppointStateEnum.Coursed, item.Id);
flag = base.Execute(appointSql) > 0;
newSql = string.Format(tempSql, (int)Common.Enum.Course.CourseAppointStateEnum.StuCheck, item.Id);
}
flag = base.Execute(newSql) > 0;
if (flag)
{
var clist = JsonHelper.DeserializeObject<List<CourseTimeModel>>(item.CourseTime);
//更新 order_guest 表 上课章节 请假也暂时先算完成课时(请假应该是有补课的)
var gmodel = guestList?.FirstOrDefault(qitem => qitem.Id == item.GuestId);
var tempClassTimeList = timeList?.Where(qitem => qitem.ClassPlanId == item.ClassPlanId)?.ToList() ?? new List<RB_Class_Time_ViewModel>();
var guestOldCheckList = oldCheckList?.Where(qitem => qitem.OrderGuestId == item.GuestId && !tempClassTimeList.Any(sItem => sItem.ClassTimeId == qitem.ClassTimeId))?.ToList() ?? new List<RB_Class_Check_ViewModel>();
......@@ -1417,8 +1409,7 @@ WHERE 1=1 AND A.Status=0 {1} ", builderMakeUp.ToString(), builderWhere.ToString
var ccModel = clist.Where(x => x.StartTime == qitem.StartTime).FirstOrDefault();
if (ccModel != null && !oldCheckList.Where(x => x.OrderGuestId == item.GuestId && x.ClassTimeId == qitem.ClassTimeId).Any())
{
//没有数据的插入 (有数据情况 =》 请假数据)
base.Insert(new RB_Class_Check()
var checkModel = new RB_Class_Check()
{
ClassCheckId = 0,
ClassId = 0,
......@@ -1437,8 +1428,14 @@ WHERE 1=1 AND A.Status=0 {1} ", builderMakeUp.ToString(), builderWhere.ToString
CurrentDeductionHours = ccModel.ClassHours,
IsAbsentHours = 0,
ClassTimeId = qitem.ClassTimeId,
IsCalcTeacFee=1,
});
IsCalcTeacFee = 1,
};
if (item.State == Common.Enum.Course.CourseAppointStateEnum.StuCheck)
{
checkModel.IsCalcTeacFee = 0;
}
//没有数据的插入 (有数据情况 =》 请假数据)
base.Insert(checkModel);
}
}
}
......
......@@ -4,6 +4,7 @@ using Edu.Model.Entity.Grade;
using Edu.Model.ViewModel.Course;
using Edu.Model.ViewModel.Grade;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -78,10 +79,6 @@ WHERE 1=1
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Room_ViewModel.Group_Id), query.Group_Id);
}
//if (query.School_Id > 0)
//{
// builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Room_ViewModel.School_Id), query.School_Id);
//}
if (!string.IsNullOrEmpty(query.RoomName))
{
builder.AppendFormat(" AND A.{0} LIKE @RoomName ", nameof(RB_Class_Room_ViewModel.RoomName));
......@@ -134,5 +131,24 @@ WHERE 1=1 ");
return Get<RB_Class_Room_ViewModel>(builder.ToString(), parameters).ToList();
}
/// <summary>
/// 根据教室编号获取教室列表
/// </summary>
/// <param name="RoomIds"></param>
/// <returns></returns>
public List<RB_Class_Room_ViewModel> GetClassRoomListExtRepository(string RoomIds)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,B.SName AS SchoolName
FROM RB_Class_Room AS A LEFT JOIN rb_school AS B ON A.School_Id=B.SId
WHERE 1=1 ");
if (!string.IsNullOrEmpty(RoomIds))
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Class_Room_ViewModel.RoomId), RoomIds);
}
return Get<RB_Class_Room_ViewModel>(builder.ToString()).ToList();
}
}
}
\ No newline at end of file
......@@ -92,7 +92,7 @@ WHERE 1=1 AND B.OrderState=1 AND B.OrderType=1 AND E.ClassScrollType=2
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,IFNULL(C.AttendanceMethod,0) AS AttendanceMethod,IFNULL(A.CourseSTime,'') AS StartTime
,IFNULL(A.CourseETime,'') AS EndTime
,IFNULL(A.CourseETime,'') AS EndTime,IFNULL(A.RoomId,0) AS ClassRoomId,A.Id AS AppointId,A.ShiftSort
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(1,2,3) AND A.AppointType IN(1,2)
......
......@@ -462,6 +462,7 @@ namespace Edu.WebApi.Controllers.Course
var ID = base.ParmJObj.GetInt("ContractId");
var CType = base.ParmJObj.GetInt("CType");
string curl = Common.Config.UploadSiteUrl + string.Format(@"/Home/EducationContractInfo?ID={0}&CType={1}", ID, CType);
Common.Plugin.LogHelper.WriteInfo("合同下载:" + curl);
var flag = new ToPdfHelper().HtmlWJtoPdf(tempPath, curl);
return ApiResult.Success("", path);
}
......
......@@ -6,6 +6,7 @@ using Edu.Module.Course;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Org.BouncyCastle.Bcpg.OpenPgp;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -49,7 +50,7 @@ namespace Edu.WebApi.Controllers.Course
List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
foreach (var item in dataList)
{
Dictionary<string,object> jobj =new Dictionary<string, object> ();
Dictionary<string, object> jobj = new Dictionary<string, object>();
jobj.Add("OrderId", item.OrderId);
jobj.Add("StuId", item.StuId);
jobj.Add("GuestId", item.GuestId);
......@@ -80,7 +81,12 @@ namespace Edu.WebApi.Controllers.Course
StartTime = !string.IsNullOrEmpty(qitem.StartTime) ? qitem.StartTime : "",
EndTime = !string.IsNullOrEmpty(qitem.EndTime) ? qitem.EndTime : "",
TeacherName = !string.IsNullOrEmpty(qitem.TeacherName) ? qitem.TeacherName : "",
RoomName = !string.IsNullOrEmpty(qitem.RoomName) ? qitem.RoomName : "",
qitem.AppointId,
qitem.AccountId,
qitem.ShiftSort,
}));
if (query.QCourseRate == Common.Enum.Course.CourseRateEnum.N5
|| query.QCourseRate == Common.Enum.Course.CourseRateEnum.N4
|| query.QCourseRate == Common.Enum.Course.CourseRateEnum.N3
......@@ -99,6 +105,20 @@ namespace Edu.WebApi.Controllers.Course
}
/// <summary>
/// 获取学员预约上课计划
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetStuAppointPlan()
{
string Date = base.ParmJObj.GetStringValue("Date");
int AccountId = base.ParmJObj.GetInt("AccountId");
string ShiftSort = base.ParmJObj.GetStringValue("ShiftSort");
var obj = scheduleCourse.GetStuAppointPlanModule(Date, AccountId, ShiftSort);
return ApiResult.Success(data: obj);
}
/// <summary>
/// 修改学员,排课状态
/// </summary>
......@@ -176,8 +196,8 @@ namespace Edu.WebApi.Controllers.Course
{
var pageModel = new ResultPageModel()
{
PageIndex=base.ParmJObj.GetInt("PageIndex"),
PageSize=base.ParmJObj.GetInt("PageSize"),
PageIndex = base.ParmJObj.GetInt("PageIndex"),
PageSize = base.ParmJObj.GetInt("PageSize"),
};
var query = new ScrollAppointmentQuery()
{
......
......@@ -874,6 +874,7 @@ namespace Edu.WebApi.Controllers.Course
newModel.UpdateTime = DateTime.Now;
newModel.Id = sObj.GetInt("AppointmentId");
newModel.StuName = sObj.GetStringValue("StuName");
newModel.IsCalcStuCheck = sObj.GetInt("IsCalcStuCheck");
list.Add(newModel);
}
}
......@@ -1003,7 +1004,7 @@ namespace Edu.WebApi.Controllers.Course
{
return ApiResult.ParamIsNull();
}
string msg = scrollClassModule.CancelSureAppointmentAsync(AppointIds, TeacherId, Date, ShiftSort, userInfo).Result;
string msg = scrollClassModule.CancelSureAppointmentModuleAsync(AppointIds, TeacherId, Date, ShiftSort, userInfo).Result;
if (msg == "")
{
return ApiResult.Success();
......@@ -1015,7 +1016,7 @@ namespace Edu.WebApi.Controllers.Course
}
/// <summary>
/// 取消预约
/// 取消预约(单个取消学生预约)
/// </summary>
/// <returns></returns>
[HttpPost]
......@@ -1029,8 +1030,7 @@ namespace Edu.WebApi.Controllers.Course
{
return ApiResult.ParamIsNull();
}
string msg = scrollClassModule.CancelAppointment(AppointIds, TeacherId, Date, userInfo);
string msg = scrollClassModule.CancelAppointmentModule(AppointIds, TeacherId, Date, userInfo);
if (msg == "")
{
return ApiResult.Success();
......@@ -1042,6 +1042,40 @@ namespace Edu.WebApi.Controllers.Course
}
/// <summary>
/// 取消学员上课 {HK New}
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult CancelStuAppointment()
{
var userInfo = base.UserInfo;
CancelAppointmentModel model = new CancelAppointmentModel()
{
AccountId= base.ParmJObj.GetInt("AccountId", 0),
Date = base.ParmJObj.GetStringValue("Date"),
ShiftSort = base.ParmJObj.GetStringValue("ShiftSort"),
StuList=new List<StuAppointItem>(),
};
string StuListStr = base.ParmJObj.GetStringValue("ChooseStuList");
if (!string.IsNullOrEmpty(StuListStr))
{
JArray jarray = JArray.Parse(StuListStr);
foreach (var jItem in jarray)
{
JObject jobj = JObject.Parse(Common.Plugin.JsonHelper.Serialize(jItem));
model.StuList.Add(new StuAppointItem() { AppointId = jobj.GetInt("AppointId"), IsCalcStuCheck = jobj.GetInt("IsCalcStuCheck") });
}
}
if (model.StuList.Count <= 0)
{
return ApiResult.ParamIsNull(message: "请选择要取消的学员!");
}
bool flag = scrollClassModule.CancelSureAppointmentNewModule(model, userInfo,out string message);
return flag ? ApiResult.Success() : ApiResult.Failed(message: message);
}
/// <summary>
/// 切换约课老师
/// </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