Commit de57c078 authored by 黄奎's avatar 黄奎

111

parent f2fb3cb7
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.Scroll
{
/// <summary>
/// 学员预约主表实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Plan_Appointment
{
/// <summary>
/// 主键编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 预约日期
/// </summary>
public DateTime Date { get; set; }
/// <summary>
/// 开始时间(09:30)
/// </summary>
public string StartTime { get; set; }
/// <summary>
/// 结束时间(11:00)
/// </summary>
public string EndTime { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.Scroll
{
/// <summary>
/// 学员预约子表实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Plan_Appointment_Details
{
/// <summary>
/// 学生约课详情主键编号
/// </summary>
public int DetailsId { get; set; }
/// <summary>
/// 学生约课主表编号(rb_plan_appointment表Id字段)
/// </summary>
public int PlanAppointmentId { get; set; }
/// <summary>
/// 学员编号
/// </summary>
public int StuId { get; set; }
/// <summary>
/// 账号表编号(rb_account表Id字段)
/// </summary>
public int Account_Id { get; set; }
/// <summary>
/// 状态(0-正常,1-删除)
/// </summary>
public int Status { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}
}
\ No newline at end of file
using Edu.Model.Entity.Scroll;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.Scroll
{
/// <summary>
/// 学员预约子表扩展实体类
/// </summary>
public class RB_Plan_Appointment_Details_ViewModel : RB_Plan_Appointment_Details
{
/// <summary>
/// 学生约课主表编号(rb_plan_appointment表Id字段)【查询编号】
/// </summary>
public string QPlanAppointmentIds { get; set; }
/// <summary>
/// rb_student表编号【查询使用】
/// </summary>
public string QStuIds { get; set; }
}
}
using Edu.Model.Entity.Scroll;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.Scroll
{
/// <summary>
/// 学员预约主表扩展实体类
/// </summary>
public class RB_Plan_Appointment_ViewModel: RB_Plan_Appointment
{
/// <summary>
/// 学员预约详情列表
/// </summary>
public List<RB_Plan_Appointment_Details_ViewModel> DetailsList { get; set; }
/// <summary>
/// 查询某一天日期
/// </summary>
public string QDate { get; set; }
/// <summary>
/// 开始日期
/// </summary>
public string StartDate { get; set; }
/// <summary>
/// 结束日期
/// </summary>
public string EndDate { get; set; }
}
}
......@@ -4474,7 +4474,9 @@ namespace Edu.Module.Course
StartTime = item?.StartTime ?? "",
EndTime = item?.EndTime ?? "",
FeedBackStatus = feedBackStatus,
GuestList = tempTimeGuestList?.Select(qitem => new { qitem.GuestName })
GuestList = tempTimeGuestList?.Select(qitem => new { qitem.GuestName }),
subItem.ClassPlanId,
subItem.School_Id,
});
}
......@@ -4503,7 +4505,7 @@ namespace Edu.Module.Course
subItem.ReserveType,
subItem.ClassPlanId,
GuestList = visitorList?.Where(qitem => qitem.ReserveClassId == subItem.ReserveClassId)?.Select(qitem => new { GuestName = qitem.VisitorName }),
subItem.School_Id,
});
}
......@@ -4533,7 +4535,9 @@ namespace Edu.Module.Course
FeedBackStatus = 0,
GuestList = item.Select(qitem => new { GuestName = qitem.StuName, qitem.AppointType }),
AppointState = item.Where(x => x.State == CourseAppointStateEnum.WaitSure).Any() ? 1 : 2,
item.FirstOrDefault().ScrollMinNum
item.FirstOrDefault().ScrollMinNum,
item.FirstOrDefault()?.ClassPlanId,
School_Id=0,
});
});
......
using Edu.Model.ViewModel.Scroll;
using Edu.Model.ViewModel.User;
using Edu.Repository.Scroll;
using Edu.Repository.User;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB;
namespace Edu.Module.Course
{
/// <summary>
/// 学员预约处理类
/// </summary>
public class PlanAppoimentModule
{
/// <summary>
/// 学员预约仓储层
/// </summary>
private readonly RB_Plan_AppointmentRepository plan_AppointmentRepository = new RB_Plan_AppointmentRepository();
/// <summary>
/// 学员预约详情仓储层
/// </summary>
private readonly RB_Plan_Appointment_DetailsRepository plan_Appointment_DetailsRepository = new RB_Plan_Appointment_DetailsRepository();
/// <summary>
/// 字典仓储层对象
/// </summary>
private readonly Rb_dictvalueRepository dictvalueRepository = new Rb_dictvalueRepository();
/// <summary>
/// 学员约课截止日期Key
/// </summary>
private static string PlanAppointmentKey = "STUDENT_APPOINTMENT_Expiration_Date";
/// <summary>
/// 获取学员预约列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Plan_Appointment_ViewModel> GetPlanAppointmentListModule(RB_Plan_Appointment_ViewModel query)
{
return plan_AppointmentRepository.GetPlanAppointmentListRepository(query);
}
/// <summary>
/// 获取学员预约详情列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Plan_Appointment_Details_ViewModel> GetPlanAppointmentDetailsListModule(RB_Plan_Appointment_Details_ViewModel query)
{
return plan_Appointment_DetailsRepository.GetPlanAppointmentDetailsListRepository(query);
}
/// <summary>
/// 获取学员预约截止日期配置
/// </summary>
/// <param name="Group_Id"></param>
/// <returns></returns>
public RB_Dictvalue_Extend GetPlanAppointmentConfigModule(int Group_Id)
{
var model = dictvalueRepository.GetList(new RB_Dictvalue_Extend()
{
RB_Group_id = Group_Id,
DictKey = PlanAppointmentKey
})?.FirstOrDefault();
return model;
}
public bool SetPlanAppointmentConfigModule(int Group_Id, string WeekStr)
{
bool flag = false;
RB_Dictvalue_Extend model = new RB_Dictvalue_Extend()
{
};
if (model.ID > 0)
{
}
else
{
}
return flag;
}
/// <summary>
/// 新增修改学员预约
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetPlanAppointmentModule(RB_Plan_Appointment_ViewModel model)
{
bool flag = false;
var oldModel = GetPlanAppointmentListModule(new RB_Plan_Appointment_ViewModel()
{
QDate = Common.ConvertHelper.FormatDate(model.Date),
})?.Where(qitem => qitem.StartTime == qitem.StartTime && qitem.EndTime == qitem.EndTime)?.FirstOrDefault();
model.Id = oldModel?.Id ?? 0;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Plan_Appointment_ViewModel.Group_Id),model.Group_Id },
};
flag = plan_AppointmentRepository.Update(fileds, new WhereHelper(nameof(RB_Plan_Appointment_ViewModel.Id), model.Id));
}
else
{
var newId = plan_AppointmentRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
var oldList = GetPlanAppointmentDetailsListModule(new RB_Plan_Appointment_Details_ViewModel()
{
PlanAppointmentId=model.Id
});
if (model.DetailsList != null && model.DetailsList.Count > 0)
{
foreach (var item in model.DetailsList)
{
var oldDetailModel = oldList?.Where(qitem => qitem.Status == 0 && qitem.StuId == item.StuId)?.FirstOrDefault();
item.DetailsId = oldDetailModel?.DetailsId ?? 0;
if (item.DetailsId > 0)
{
plan_Appointment_DetailsRepository.Update(item);
}
else
{
plan_Appointment_DetailsRepository.Insert(item);
}
}
}
return flag;
}
}
}
using Edu.Model.Entity.Scroll;
using Edu.Model.ViewModel.Scroll;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Edu.Repository.Scroll
{
/// <summary>
/// 学员预约主表仓储层
/// </summary>
public class RB_Plan_AppointmentRepository : BaseRepository<RB_Plan_Appointment>
{
/// <summary>
/// 获取学员预约列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Plan_Appointment_ViewModel> GetPlanAppointmentListRepository(RB_Plan_Appointment_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_Plan_Appointment AS A
WHERE 1=1
");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Plan_Appointment_ViewModel.Group_Id), query.Group_Id);
}
if (!string.IsNullOrEmpty(query.QDate))
{
builder.AppendFormat(" AND DATE_FORMAT(A.{0},'%y/%m/%d')= DATE_FORMAT('{1}','%y/%m/%d') ", nameof(RB_Plan_Appointment_ViewModel.Date), query.QDate);
}
}
return Get<RB_Plan_Appointment_ViewModel>(builder.ToString()).ToList();
}
}
}
using Edu.Model.Entity.Scroll;
using Edu.Model.ViewModel.Scroll;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Edu.Repository.Scroll
{
/// <summary>
/// 学员预约子表仓储层
/// </summary>
public class RB_Plan_Appointment_DetailsRepository : BaseRepository<RB_Plan_Appointment_Details>
{
/// <summary>
/// 获取学员预约详情列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Plan_Appointment_Details_ViewModel> GetPlanAppointmentDetailsListRepository(RB_Plan_Appointment_Details_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_Plan_Appointment_Details AS A
WHERE 1=1
");
if (query != null)
{
if (query.PlanAppointmentId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Plan_Appointment_Details_ViewModel.PlanAppointmentId), query.PlanAppointmentId);
}
if (!string.IsNullOrEmpty(query.QPlanAppointmentIds))
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Plan_Appointment_Details_ViewModel.PlanAppointmentId), query.QPlanAppointmentIds);
}
if (query.StuId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Plan_Appointment_Details_ViewModel.StuId), query.StuId);
}
if (!string.IsNullOrEmpty(query.QStuIds))
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Plan_Appointment_Details_ViewModel.StuId), query.QStuIds);
}
}
return Get<RB_Plan_Appointment_Details_ViewModel>(builder.ToString()).ToList();
}
}
}
......@@ -70,9 +70,9 @@ namespace Edu.WebApi.Controllers.Applet
//获取学生信息
var stuModel = studentModule.GetStudentListModule(new RB_Student_ViewModel() { Group_Id = userInfo.Group_Id, StuId = userInfo.AccountId }).FirstOrDefault();
if (stuModel == null)
if (stuModel == null)
{
return ApiResult.Failed("账号不存在");
return ApiResult.Failed("账号不存在");
}
//获取协助人员
List<object> RAssistList = new List<object>();
......@@ -97,9 +97,9 @@ namespace Edu.WebApi.Controllers.Applet
{
item.AssistId,
AssistTypeName = item.AssistType.ToName(),
EmployeeName = empModel?.EmployeeName??"",
UserIcon = empModel?.UserIcon??"",
Mobile = empModel?.Account??""
EmployeeName = empModel?.EmployeeName ?? "",
UserIcon = empModel?.UserIcon ?? "",
Mobile = empModel?.Account ?? ""
});
}
//获取课程信息(正在学习中的)
......@@ -112,7 +112,8 @@ namespace Edu.WebApi.Controllers.Applet
//获取课时信息
var guestModel = orderModule.GetOrderGusetHoursInfo(LearningInfo.GuestId, LearningInfo.ClassId);
decimal CompleteHours = guestModel?.CompleteHours ?? 0;
if (LearningInfo.ClassScrollType == 2) {
if (LearningInfo.ClassScrollType == 2)
{
//约课 算下实时课耗
var gModel = studentModule.GetStudentClassNumber(LearningInfo.GuestId, userInfo.Group_Id);
CompleteHours = gModel?.CompleteHours ?? CompleteHours;
......@@ -122,7 +123,7 @@ namespace Edu.WebApi.Controllers.Applet
State = 1,
TotalHours = guestModel?.TotalHours ?? 0,
CompleteHours = CompleteHours,
MakeUpHours= guestModel?.MakeUpHours??0,
MakeUpHours = guestModel?.MakeUpHours ?? 0,
AbsenceNum = guestModel?.AbsenceNum ?? 0,
LeaveNum = guestModel?.LeaveNum ?? 0,
CourseId = courseModel?.CourseId ?? 0,
......@@ -136,7 +137,7 @@ namespace Edu.WebApi.Controllers.Applet
LearningInfo.ClassScrollType
};
}
else
else
{
CourseInfo = new
{
......@@ -172,9 +173,10 @@ namespace Edu.WebApi.Controllers.Applet
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetScrollAppointmentBaseInfo() {
public ApiResult GetScrollAppointmentBaseInfo()
{
var userInfo = base.AppletUserInfo;
var Robj = scrollClassModule.GetScrollAppointmentBaseInfo(userInfo, out string Rmsg);
//return ApiResult.Failed("此功能暂未开通使用");
if (Rmsg == "")
......@@ -192,11 +194,13 @@ namespace Edu.WebApi.Controllers.Applet
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetScrollAppointmentTeacherList() {
public ApiResult GetScrollAppointmentTeacherList()
{
var userInfo = base.AppletUserInfo;
string Date = ParmJObj.GetStringValue("Date");
int SchoolId = ParmJObj.GetInt("SchoolId", -1);
if (string.IsNullOrEmpty(Date)) {
if (string.IsNullOrEmpty(Date))
{
return ApiResult.ParamIsNull("请传递日期");
}
Date = Convert.ToDateTime(Date).ToString("yyyy-MM-dd");
......@@ -217,19 +221,24 @@ namespace Edu.WebApi.Controllers.Applet
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetScrollAppointment() {
public ApiResult SetScrollAppointment()
{
var userInfo = base.AppletUserInfo;
RB_Scroll_Appointment_ViewModel demodel = JsonHelper.DeserializeObject<RB_Scroll_Appointment_ViewModel>(base.RequestParm.Msg.ToString());
if (demodel.AccountId <= 0) {
if (demodel.AccountId <= 0)
{
return ApiResult.ParamIsNull("请传递老师账号ID");
}
if (demodel.TeacherId <= 0) {
if (demodel.TeacherId <= 0)
{
return ApiResult.ParamIsNull("请传递老师编号ID");
}
if (demodel.Date <= DateTime.Now) {
if (demodel.Date <= DateTime.Now)
{
return ApiResult.ParamIsNull("预约日期有误");
}
if (string.IsNullOrEmpty(demodel.ShiftSort)) {
if (string.IsNullOrEmpty(demodel.ShiftSort))
{
return ApiResult.ParamIsNull("请传递上课时段");
}
#region 验证是否连续的时段
......@@ -237,10 +246,12 @@ namespace Edu.WebApi.Controllers.Applet
List<int> SortList = JsonHelper.DeserializeObject<List<int>>("[" + demodel.ShiftSort + "]");
int MinSort = SortList.Min(x => x);
string ShiftSort = "";
for (var i = 0; i < SortList.Count(); i++) {
for (var i = 0; i < SortList.Count(); i++)
{
ShiftSort += (MinSort + i) + ",";
}
if (ShiftSort != demodel.ShiftSort + ",") {
if (ShiftSort != demodel.ShiftSort + ",")
{
return ApiResult.ParamIsNull("需预约连续的时段");
}
#endregion
......@@ -258,7 +269,8 @@ namespace Edu.WebApi.Controllers.Applet
{
return ApiResult.Success();
}
else {
else
{
return ApiResult.Failed(msg);
}
}
......@@ -268,7 +280,8 @@ namespace Edu.WebApi.Controllers.Applet
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult ValidateToDayAppointment() {
public ApiResult ValidateToDayAppointment()
{
var userInfo = base.AppletUserInfo;
RB_Scroll_Appointment_ViewModel demodel = JsonHelper.DeserializeObject<RB_Scroll_Appointment_ViewModel>(base.RequestParm.Msg.ToString());
if (demodel.AccountId <= 0)
......@@ -352,7 +365,8 @@ namespace Edu.WebApi.Controllers.Applet
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetMyAppointPageList() {
public ApiResult GetMyAppointPageList()
{
var userInfo = base.AppletUserInfo;
ResultPageModel pmodel = JsonHelper.DeserializeObject<ResultPageModel>(base.RequestParm.Msg.ToString());
RB_Scroll_Appointment_ViewModel demodel = JsonHelper.DeserializeObject<RB_Scroll_Appointment_ViewModel>(base.RequestParm.Msg.ToString());
......@@ -392,10 +406,12 @@ namespace Edu.WebApi.Controllers.Applet
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult CancelAppointment() {
public ApiResult CancelAppointment()
{
var userInfo = base.AppletUserInfo;
int AppointId = ParmJObj.GetInt("AppointId");
if (AppointId <= 0) {
if (AppointId <= 0)
{
return ApiResult.ParamIsNull("请传递预约Id");
}
......@@ -404,7 +420,8 @@ namespace Edu.WebApi.Controllers.Applet
{
return ApiResult.Success();
}
else {
else
{
return ApiResult.Failed(msg);
}
}
......
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