Commit 33868749 authored by 吴春's avatar 吴春

提交代码

parent f62bd774
......@@ -43,5 +43,10 @@ namespace Edu.Common.Enum.Finance
/// </summary>
[EnumField("订单分拆")]
OrderSplitClass = 6,
/// <summary>
/// 学生请假
/// </summary>
[EnumField("学生请假")]
LeaveClass = 7,
}
}
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.EduTask
{
/// <summary>
/// 学生请假申请实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Student_Leave
{
/// <summary>
/// 主键(请假编号)
/// </summary>
public int Id { get; set; }
/// <summary>
/// 请假类型 1-事假,2-病假
/// </summary>
public int LeaveType { get; set; }
/// <summary>
/// 班级编号
/// </summary>
public int ClassId { get; set; }
/// <summary>
/// 课程编号
/// </summary>
public int CourseId { get; set; }
/// <summary>
/// 计划时间id
/// </summary>
public string ClassTimeIds { get; set; }
/// <summary>
/// 学生id
/// </summary>
public int OrderGuestId { get; set; }
/// <summary>
/// 请假信息
/// </summary>
public string LeaveInfo { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 学校编号
/// </summary>
public int School_Id { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 修改人
/// </summary>
public int UpdateBy { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime UpdateTime { get; set; }
/// <summary>
/// 申请备注
/// </summary>
public string Remarks { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Model.Entity.EduTask;
using Edu.Model.ViewModel.Sell;
namespace Edu.Model.ViewModel.EduTask
{
/// <summary>
/// 学员请假申请实体扩展表
/// </summary>
public class RB_Student_Leave_ViewModel : RB_Student_Leave
{
/// <summary>
/// 请假时间信息
/// </summary>
public List<LeaveInfoModel> LeaveInfoList { get; set; }
/// <summary>
/// 班级名称
/// </summary>
public string ClassName { get; set; }
/// <summary>
/// 多个ids
/// </summary>
public string Q_Student_Leave_Ids { get; set; }
/// <summary>
/// 学员信息
/// </summary>
public RB_Order_Guest_ViewModel Order_Guest_ViewModel { get; set; }
}
public class LeaveInfoModel
{
/// <summary>
/// 计划id
/// </summary>
public int ClassPlanId { get; set; }
/// <summary>
/// 上课时间id
/// </summary>
public int ClassTimeId { get; set; }
/// <summary>
/// 上课日期
/// </summary>
public string ClassDate { get; set; }
/// <summary>
/// 上课开始时间
/// </summary>
public string StartTime { get; set; }
/// <summary>
/// 上课结束时间
/// </summary>
public string EndTime { get; set; }
/// <summary>
/// 上课课时
/// </summary>
public decimal TimeHour { get; set; }
/// <summary>
/// 老师名称
/// </summary>
public string TeacherName { get; set; }
/// <summary>
/// 教室名称
/// </summary>*
public string RoomName { get; set; }
}
}
......@@ -49,7 +49,10 @@ namespace Edu.Model.ViewModel.Grade
}
}
}
/// <summary>
/// ids
/// </summary>
public string Q_ClassTimeIds { get; set; }
/// <summary>
/// ids
/// </summary>
......
using Edu.Model.Entity.Course;
using Edu.Model.Entity.EduTask;
using Edu.Model.Entity.Sell;
using Edu.Model.ViewModel.EduTask;
using Edu.Model.ViewModel.Sell;
using Edu.Repository.Course;
using Edu.Repository.EduTask;
using Edu.Repository.Sell;
using System.Collections.Generic;
using System.Linq;
using VT.FW.AOP.CustomerAttribute;
using VT.FW.DB;
namespace Edu.Module.EduTask
{
/// <summary>
/// 调课计划处理类
/// </summary>
public class LeaveStudentModule
{
/// <summary>
/// 教务单据仓储层对象
/// </summary>
private readonly RB_Education_ReceiptRepository education_ReceiptRepository = new RB_Education_ReceiptRepository();
/// <summary>
/// 请假计划仓储层对象
/// </summary>
private readonly RB_Student_LeaveRepository RB_Student_LeaveRepository = new RB_Student_LeaveRepository();
/// <summary>
/// 订单学员仓储层对象
/// </summary>
private readonly RB_Order_GuestRepository order_GuestRepository = new RB_Order_GuestRepository();
/// <summary>
/// 获取请假列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Student_Leave_ViewModel> GetStudentLeaveListRepository(RB_Student_Leave_ViewModel query)
{
return RB_Student_LeaveRepository.GetStudentLeaveListRepository(query);
}
/// <summary>
/// 新增修改请假申请
/// </summary>
/// <returns></returns>
[TransactionCallHandler]
public virtual bool SetStudentLeaveModule(RB_Student_Leave_ViewModel extModel, string receiptFile)
{
bool flag = false;
if (extModel.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Student_Leave_ViewModel.OrderGuestId),extModel.OrderGuestId },
{nameof(RB_Student_Leave_ViewModel.ClassId),extModel.ClassId },
{nameof(RB_Student_Leave_ViewModel.CourseId),extModel.CourseId },
{nameof(RB_Student_Leave_ViewModel.LeaveInfo),extModel.LeaveInfo },
{nameof(RB_Student_Leave_ViewModel.UpdateBy),extModel.UpdateBy },
{nameof(RB_Student_Leave_ViewModel.UpdateTime),extModel.UpdateTime },
};
flag = RB_Student_LeaveRepository.Update(fileds, new WhereHelper(nameof(RB_Student_Leave_ViewModel.Id), extModel.Id));
}
else
{
var newId = RB_Student_LeaveRepository.Insert(extModel);
extModel.Id = newId;
flag = newId > 0;
if (flag)
{
var educationReceipt = new RB_Education_Receipt()
{
Id = 0,
Title = "学生请假申请",
ReceiptType = Common.Enum.Finance.ReceiptTypeEnum.LeaveClass,
RelationId = newId,
ClassId = extModel.ClassId,
Group_Id = extModel.Group_Id,
School_Id = extModel.School_Id,
CreateBy = extModel.CreateBy,
CreateTime = extModel.CreateTime,
UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime,
VerifyStatus = Common.Enum.EduTask.EduTaskRrocessStatus.NotAudit,
ReceiptFile = receiptFile
};
flag = education_ReceiptRepository.SetEducationReceiptRepository(educationReceipt, out string message);
}
}
return flag;
}
public bool UpdateChangeClassPlan(int id)
{
return RB_Student_LeaveRepository.UpdateStundetLeave(id,1);
}
}
}
......@@ -121,5 +121,9 @@ namespace Edu.Module.EduTask
}
return flag;
}
}
}
......@@ -277,6 +277,15 @@ WHERE 1=1
return false;
}
}
else if (model.ReceiptType == Common.Enum.Finance.ReceiptTypeEnum.LeaveClass)
{
flowModel = flowRepository.GetFlowRepository(Common.Config.OrderSplitClassFlowId);
if (flowModel == null)
{
message = "未配置学生请假流程!";
return false;
}
}
if (flowModel?.FlowNodeList?.Count == 0)
{
message = "未配置审核流程!";
......
This diff is collapsed.
......@@ -233,6 +233,12 @@ GROUP BY A.ClassId
{
builder.AppendFormat(" AND A.{0} in({1}) ", nameof(RB_Class_Check_ViewModel.ClassId), query.Q_ClassIds);
}
if (!string.IsNullOrEmpty(query.Q_ClassTimeIds))
{
builder.AppendFormat(" AND A.{0} in({1}) ", nameof(RB_Class_Check_ViewModel.ClassTimeId), query.Q_ClassTimeIds);
}
if (!string.IsNullOrWhiteSpace(query.StartDate))
{
builder.AppendFormat(" AND DATE_FORMAT(A.{0},'%Y-%m-%d')>=DATE_FORMAT('{1}','%Y-%m-%d') ", nameof(RB_Class_Check_ViewModel.ClassDate), query.StartDate);
......
......@@ -7,6 +7,7 @@ using Edu.Common.Plugin;
using Edu.Model.ViewModel.Grade;
using Edu.Model.ViewModel.User;
using Edu.Module.Course;
using Edu.Module.EduTask;
using Edu.Module.Public;
using Edu.Module.User;
using Edu.WebApi.Filter;
......@@ -51,6 +52,11 @@ namespace Edu.WebApi.Controllers.Applet
/// </summary>
private readonly CourseModule courseModule = AOP.AOPHelper.CreateAOPObject<CourseModule>();
/// <summary>
/// 教务单据处理类对象
/// </summary>
private readonly EducationReceiptModule educationReceiptModule = AOP.AOPHelper.CreateAOPObject<EducationReceiptModule>();
#region 小程序首页
/// <summary>
/// 小程序首页
......@@ -103,6 +109,7 @@ namespace Edu.WebApi.Controllers.Applet
studentModel.SurplusHours,//剩余时间
studentModel.TeacherName,//老师
studentModel.ClassId,
studentModel.ClassName,
studentModel.CourseId,
EnterPhone = Cache.User.UserReidsCache.GetUserLoginInfo(studentModel.EnterID).UserMobile,
ContractNum = (((contractList != null && contractList.Any()) ? contractList.Count() : 0) + ((backClassList != null && backClassList.Any()) ? backClassList.Count() : 0)),//合同数
......@@ -191,6 +198,7 @@ namespace Edu.WebApi.Controllers.Applet
}
planListResult.Add(new
{
itemGroup.Chapter,
DateYear = startTime.AddDays(i).ToString("yyyy"),
DateMonth = startTime.AddDays(i).ToString("MM"),
......@@ -198,13 +206,19 @@ namespace Edu.WebApi.Controllers.Applet
WeekStr = StringHelper.GetJapanWeekChar(startTime.AddDays(i)),
ClassDateStr = startTime.AddDays(i).ToString("yyyy-MM-dd"),
ClassName = plan.Where(x => x.ClassId == itemGroup.ClassId).FirstOrDefault()?.ClassName ?? "",
itemGroup.ClassId,
itemGroup.CourseId,
PlanTimeList = itemGroup.PlanTimeList.Select(x => new
{
x.StartTime,
x.EndTime,
x.ClassPlanId,
x.ClassTimeId,
x.TimeHour,
TeacherName = itemGroup.TeacherName ?? "",
UserIcon = itemGroup.UserIcon ?? "",
IsCheck = x.GuestList.Where(x => x.StudentId == base.AppletUserInfo.AccountId).FirstOrDefault()?.IsCheck,
OrderGuestId = x.GuestList.Where(x => x.StudentId == base.AppletUserInfo.AccountId).FirstOrDefault()?.Id,
IsLeave = Convert.ToDateTime(x.NewPlanDateTime) > DateTime.Now ? 1 : 0
})
});
......@@ -373,5 +387,68 @@ namespace Edu.WebApi.Controllers.Applet
return ApiResult.Success(data: planListResult);
}
#endregion
#region 我的请假列表
/// <summary>
/// 获取请假单据分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetEducationReceiptPage()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new Model.ViewModel.EduTask.EducationReceiptQuery()
{
Group_Id = base.AppletUserInfo.Group_Id,
StartTime = base.ParmJObj.GetStringValue("StartTime"),
EndTime = base.ParmJObj.GetStringValue("EndTime"),
Conditon = Common.Enum.Course.EduReceiptConditionEnum.Launch,
ReceiptType = 7,
Title = base.ParmJObj.GetStringValue("Title")
};
if (!string.IsNullOrEmpty(base.ParmJObj.GetStringValue("VerifyStatus")))
{
query.VerifyStatus = base.ParmJObj.GetInt("VerifyStatus", -1);
}
var id = base.ParmJObj.GetInt("Id");
if (id > 0)
{
query.QIds = id.ToString();
}
query.CreateBy = base.AppletUserInfo.Id;
var list = educationReceiptModule.GetEducationReceiptPageModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
pageModel.PageData = list;
pageModel.Count = rowsCount;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 获取教务单据类型
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetEduReceiptInfo()
{
var Id = base.ParmJObj.GetInt("Id");
var Info = educationReceiptModule.GetEducationReceiptInfoModule(Id);
return ApiResult.Success(data: Info);
}
/// <summary>
/// 教务单据作废
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult InvalidReceipt()
{
var Id = base.ParmJObj.GetInt("Id");
var flag = educationReceiptModule.InvalidReceiptModule(Id);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
}
}
using Edu.Common.API;
using Edu.Common.Enum.Course;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Course;
using Edu.Model.ViewModel.EduTask;
using Edu.Module.Course;
using Edu.Module.EduTask;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Edu.WebApi.Controllers.Applet
{
/// <summary>
/// 改变流程相关申请
/// </summary>
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class LeaveStudentController : AppletBaseController
{
/// <summary>
/// 学生请假处理类对象
/// </summary>
private readonly LeaveStudentModule leaveStudentModule = AOP.AOPHelper.CreateAOPObject<LeaveStudentModule>();
/// <summary>
/// 班级处理类对象
/// </summary>
private readonly ClassModule classModule = AOP.AOPHelper.CreateAOPObject<ClassModule>();
/// <summary>
/// 新增修改学生请假
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetStudentLeave()
{
var model = new RB_Student_Leave_ViewModel()
{
Id = base.ParmJObj.GetInt("Id"),
ClassId = base.ParmJObj.GetInt("ClassId"),
CourseId = base.ParmJObj.GetInt("CourseId"),
OrderGuestId = base.ParmJObj.GetInt("OrderGuestId"),
Remarks = base.ParmJObj.GetStringValue("Remarks"),
LeaveType = base.ParmJObj.GetInt("LeaveType")
};
var classModel = classModule.GetClassModule(model.ClassId);
string receiptFile = string.Empty;
try
{
List<LeaveInfoModel> LeaveInfoList = Common.Plugin.JsonHelper.DeserializeObject<List<LeaveInfoModel>>(base.ParmJObj.GetStringValue("LeaveInfoList"));
if (LeaveInfoList == null || !LeaveInfoList.Any())
{
return ApiResult.Failed("请选择请假时间");
}
else
{
model.LeaveInfo = JsonHelper.Serialize(LeaveInfoList);
model.ClassTimeIds = string.Join(",", LeaveInfoList.Select(x => x.ClassTimeId));
}
List<string> receiptFileList = Common.Plugin.JsonHelper.DeserializeObject<List<string>>(base.ParmJObj.GetStringValue("ReceiptFileList"));
if (receiptFileList == null || !receiptFileList.Any())
{
receiptFile = "";
// return ApiResult.Failed("附件必须上传");
}
else
{
receiptFile = JsonHelper.Serialize(receiptFileList);
}
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "SetStudentLeave");
}
if (model.Id == 0)
{
model.CreateBy = base.AppletUserInfo.Id;
model.CreateTime = DateTime.Now;
model.Group_Id = base.AppletUserInfo.Group_Id;
model.School_Id = classModel.School_Id;
}
model.UpdateBy = base.AppletUserInfo.Id;
model.UpdateTime = DateTime.Now;
bool flag = leaveStudentModule.SetStudentLeaveModule(model, receiptFile);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
public ApiResult TestUpdateClassPlan()
{
int id = base.ParmJObj.GetInt("Id");
var result = leaveStudentModule.UpdateChangeClassPlan(id);
return ApiResult.Success("");
}
}
}
......@@ -94,6 +94,8 @@
"OrderTransClassFlowId": 5,
//订单分拆流程编号
"OrderSplitClassFlowId": 6,
//学生请假流程编号
"StudentLeaveFlowId": 7,
"ErpUrl": "http://localhost:8181/#",
//是否开启调课数据验证
"IsOpenChangeClassVerify": 1,
......
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