Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
Education
Commits
05dfdead
Commit
05dfdead
authored
Sep 06, 2024
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
7a323319
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
163 additions
and
44 deletions
+163
-44
ScrollClassModule.cs
Edu.Module.Course/ScrollClassModule.cs
+157
-27
ScrollController.cs
Edu.WebApi/Controllers/Course/ScrollController.cs
+4
-16
UserController.cs
Edu.WebApi/Controllers/User/UserController.cs
+2
-1
No files found.
Edu.Module.Course/ScrollClassModule.cs
View file @
05dfdead
...
...
@@ -1300,6 +1300,149 @@ namespace Edu.Module.Course
return
RList
;
}
/// <summary>
/// 获取老师可上课的时段[2024-09-05扩展]
/// </summary>
/// <param name="date"></param>
/// <param name="teacherId"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public
object
GetCanTeacherClassTimeListModule
(
string
date
,
int
teacherId
,
int
courseId
,
int
group_Id
)
{
//获取课程信息
var
courseModel
=
courseRepository
.
GetEntity
(
courseId
);
if
(
courseModel
==
null
||
(
courseModel
!=
null
&&
courseModel
.
CourseTimeId
<=
0
))
{
return
""
;
}
//查询课程使用的上课时段
var
ctModel
=
scroll_CourseTimeRepository
.
GetEntity
<
RB_Scroll_CourseTime_ViewModel
>(
courseModel
.
CourseTimeId
);
if
(!
string
.
IsNullOrEmpty
(
ctModel
.
Content
))
{
ctModel
.
TimeList
=
JsonHelper
.
DeserializeObject
<
List
<
CourseTimeModel
>>(
ctModel
.
Content
);
}
#
region
组装数据
//查询班次
var
shiftList
=
scroll_ShiftRepository
.
GetList
(
new
RB_Scroll_Shift_ViewModel
()
{
Group_Id
=
group_Id
});
//查询当天可上课的老师
var
planList
=
scroll_PlanRepository
.
GetTeacherPlanForDay
(
date
,
-
1
,
group_Id
,
teacherId
);
//再查询这些老师 正常排课 + 试听课安排 需要排除这些课程
var
pcList
=
class_PlanRepository
.
GetClassPlanModelRepository
(
new
RB_Class_Plan_ViewModel
()
{
Group_Id
=
group_Id
,
QClassDateStr
=
date
,
TeacherId
=
teacherId
});
if
(
pcList
.
Any
())
{
//查询计划的时间段
string
planids
=
string
.
Join
(
","
,
pcList
.
Select
(
x
=>
x
.
ClassPlanId
));
var
ctList
=
class_TimeRepository
.
GetClassTimeListRepository
(
new
RB_Class_Time_ViewModel
()
{
Group_Id
=
group_Id
,
QClassPlanIds
=
planids
});
foreach
(
var
item
in
pcList
)
{
item
.
PlanTimeList
=
ctList
.
Where
(
x
=>
x
.
ClassPlanId
==
item
.
ClassPlanId
).
ToList
();
}
}
var
rcList
=
reserve_ClassRepository
.
GetReserveClassListRepository
(
new
Model
.
ViewModel
.
Reserve
.
RB_Reserve_Class_Extend
()
{
Group_Id
=
group_Id
,
StartClassDate
=
date
,
EndClassDate
=
date
,
TeacherId
=
teacherId
});
//再查询当日已预约情况
var
appointList
=
scroll_AppointmentRepository
.
GetList
(
new
RB_Scroll_Appointment_ViewModel
()
{
Group_Id
=
group_Id
,
StartTime
=
date
,
EntTime
=
date
});
List
<
object
>
RList
=
new
List
<
object
>();
if
(
planList
!=
null
&&
planList
.
Count
>
0
)
{
//开始遍历老师了
foreach
(
var
item
in
planList
)
{
//查询班次
var
shiftModel
=
shiftList
.
Where
(
x
=>
x
.
Id
==
item
.
ShiftId
).
FirstOrDefault
();
item
.
CourseTimeList
=
ctModel
.
TimeList
.
Where
(
x
=>
Convert
.
ToDateTime
(
"2020-01-01 "
+
x
.
StartTime
)
>=
Convert
.
ToDateTime
(
"2020-01-01 "
+
shiftModel
.
StartTime
)
&&
Convert
.
ToDateTime
(
"2020-01-01 "
+
x
.
EndTime
)
<=
Convert
.
ToDateTime
(
"2020-01-01 "
+
shiftModel
.
EndTime
)).
RefMapperToList
<
CourseTimeExtend
>();
//查询该时段内 是否已有正常排课
var
pc2List
=
pcList
.
Where
(
x
=>
x
.
TeacherId
==
item
.
TeacherId
).
ToList
();
foreach
(
var
qitem
in
pc2List
)
{
foreach
(
var
citem
in
qitem
.
PlanTimeList
)
{
DateTime
CSDate
=
Convert
.
ToDateTime
(
"2022-01-01 "
+
citem
.
StartTime
);
DateTime
CEDate
=
Convert
.
ToDateTime
(
"2022-01-01 "
+
citem
.
EndTime
);
//开始验证重复数据
var
HList
=
item
.
CourseTimeList
.
Where
(
x
=>
(
x
.
SDate
<=
CSDate
&&
CSDate
<=
x
.
EDate
)
||
(
x
.
SDate
<=
CEDate
&&
CEDate
<=
x
.
EDate
)).
ToList
();
foreach
(
var
hitem
in
HList
)
{
hitem
.
State
=
2
;
//已有排课 不可预约
}
}
}
//查询该时段内 是否已有正常试听
var
rc2List
=
rcList
.
Where
(
x
=>
x
.
TeacherId
==
item
.
TeacherId
).
ToList
();
foreach
(
var
qitem
in
rc2List
)
{
DateTime
CSDate
=
Convert
.
ToDateTime
(
"2022-01-01 "
+
qitem
.
ClassTime
);
DateTime
CEDate
=
Convert
.
ToDateTime
(
"2022-01-01 "
+
qitem
.
EndTime
);
//开始验证重复数据
var
HList
=
item
.
CourseTimeList
.
Where
(
x
=>
(
x
.
SDate
<=
CSDate
&&
CSDate
<=
x
.
EDate
)
||
(
x
.
SDate
<=
CEDate
&&
CEDate
<=
x
.
EDate
)).
ToList
();
foreach
(
var
hitem
in
HList
)
{
hitem
.
State
=
2
;
//已有排课 不可预约
}
}
//查询已预约情况
var
aList
=
appointList
.
Where
(
x
=>
x
.
TeacherId
==
item
.
TeacherId
).
ToList
();
aList
.
GroupBy
(
x
=>
new
{
x
.
CourseId
,
x
.
CourseGradeNo
,
x
.
ShiftSort
}).
ToList
().
ForEach
(
x
=>
{
var
firstModel
=
x
.
FirstOrDefault
();
List
<
int
>
SortList
=
JsonHelper
.
DeserializeObject
<
List
<
int
>>(
"["
+
x
.
Key
.
ShiftSort
+
"]"
);
item
.
CourseTimeList
.
Where
(
y
=>
SortList
.
Contains
(
y
.
Sort
)).
ToList
().
ForEach
(
z
=>
{
z
.
MinPeopleNum
=
firstModel
.
ScrollMinNum
;
z
.
MaxPeopleNum
=
firstModel
.
ScrollMaxNum
;
z
.
State
=
2
;
//已预约了
z
.
CourseId
=
x
.
Key
.
CourseId
;
z
.
CourseName
=
firstModel
.
CourseName
;
z
.
CourseGradeNo
=
x
.
Key
.
CourseGradeNo
;
z
.
PeopleNum
=
x
.
Count
();
z
.
SortIdentify
=
x
.
Key
.
ShiftSort
;
z
.
Description
=
string
.
Join
(
","
,
x
.
Select
(
q
=>
q
.
StuName
));
});
});
item
.
CourseTimeList
=
item
.
CourseTimeList
.
Where
(
x
=>
x
.
State
!=
2
).
ToList
();
//排除不可预约的
RList
.
Add
(
new
{
item
.
AccountId
,
item
.
TeacherId
,
item
.
TeacherHead
,
item
.
TeacherName
,
item
.
TeacherIntro
,
item
.
RoomId
,
item
.
RoomName
,
item
.
SchoolName
,
item
.
CourseTimeList
,
shiftModel
.
StartTime
,
shiftModel
.
EndTime
});
}
}
else
{
RList
.
Add
(
new
{
AccountId
=
0
,
TeacherId
=
0
,
TeacherHead
=
""
,
TeacherName
=
""
,
TeacherIntro
=
""
,
RoomId
=
0
,
RoomName
=
""
,
SchoolName
=
""
,
CourseTimeList
=
ctModel
.
TimeList
,
StartTime
=
""
,
EndTime
=
""
});
}
#
endregion
return
RList
;
}
/// <summary>
/// 获取可约课的学生列表
/// </summary>
...
...
@@ -2546,22 +2689,10 @@ namespace Edu.Module.Course
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
string
SetAdminScrollAppointment
_
V2
(
RB_Scroll_Appointment_ViewModel
demodel
,
out
int
AppointId
)
public
string
SetAdminScrollAppointment
Module
V2
(
RB_Scroll_Appointment_ViewModel
demodel
,
out
int
AppointId
)
{
AppointId
=
0
;
#
region
初步验证
//提前天数 2022-03-17
//int AdvanceDay = Convert.ToInt32(dictvalueRepository.GetList(new Model.ViewModel.User.RB_Dictvalue_Extend() { RB_Group_id = demodel.Group_Id, DictKey = "Scroll_AdvanceDay" }).FirstOrDefault()?.Content ?? "1");
//if (demodel.Date < Convert.ToDateTime(DateTime.Now.AddDays(AdvanceDay).ToString("yyyy-MM-dd"))) { return "需要提前" + AdvanceDay + "天约课"; }
//if (AdvanceDay == 1 && demodel.Date.ToString("yyyy-MM-dd") == DateTime.Now.AddDays(1).ToString("yyyy-MM-dd"))
//{
// //可预约的时间 (提前1天时启用)
// string ScrollETime = dictvalueRepository.GetList(new Model.ViewModel.User.RB_Dictvalue_Extend() { RB_Group_id = demodel.Group_Id, DictKey = "Scroll_Time" }).FirstOrDefault()?.Content ?? "";
// if (DateTime.Now > Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " " + ScrollETime)) { return "需要在当日" + ScrollETime + "之前约课"; }
//}
#
endregion
#
region
学生的课程
//获取正在上课的课程
var
learnModel
=
student_OrderGuestRepository
.
GetStudentLearningCourse
(
demodel
.
StuId
,
demodel
.
Group_Id
,
demodel
.
GuestId
);
...
...
@@ -2596,23 +2727,24 @@ namespace Edu.Module.Course
//查询下一次课的耗时分钟数 前端需要根据这个分钟数
var
chapterModel
=
course_ChapterRepository
.
GetChapterListRepository
(
new
RB_Course_Chapter_ViewModel
()
{
Group_Id
=
demodel
.
Group_Id
,
CourseId
=
learnModel
.
CourseId
,
ChapterNo
=
demodel
.
CourseGradeNo
.
ToString
()
}).
FirstOrDefault
();
NextAppointMinutes
=
chapterModel
?.
StudyMinutes
??
0
;
//demodel.CourseGradeId = chapterModel?.CourseRate ?? 0;
//demodel.CourseGradeNo = chapterModel?.ChapterGradeNo ?? 0;
//HK 2022-07-06注释
//demodel.ChapterNo = Convert.ToInt32(chapterModel?.ChapterNo ?? "0");
}
#
endregion
#
region
组装排班
string
Date
=
demodel
.
Date
.
ToString
(
"yyyy-MM-dd"
);
demodel
.
AccountId
=
teacherRepository
.
GetTeacherByTId
(
demodel
.
TeacherId
,
demodel
.
Group_Id
).
FirstOrDefault
().
AccountId
;
var
teacherModel
=
teacherRepository
.
GetTeacherByTId
(
demodel
.
TeacherId
,
demodel
.
Group_Id
)?.
FirstOrDefault
();
demodel
.
AccountId
=
teacherModel
?.
AccountId
??
0
;
//验证当日老师的数据
var
planList
=
scroll_PlanRepository
.
GetList
(
new
RB_Scroll_Plan_ViewModel
()
{
Group_Id
=
demodel
.
Group_Id
,
AccountId
=
demodel
.
AccountId
,
STime
=
Date
,
ETime
=
Date
});
if
(!
planList
.
Any
())
{
return
"老师当日未查询到可预约课,请刷新后再试"
;
planList
=
new
List
<
RB_Scroll_Plan_ViewModel
>();
//没有排班就默认通班(HK2024-09-05添加)
planList
.
Add
(
new
RB_Scroll_Plan_ViewModel
()
{
ShiftId
=
9
});
}
//开始验证 此时段数据是否可以预约
var
pcList
=
class_PlanRepository
.
GetClassPlanModelRepository
(
new
RB_Class_Plan_ViewModel
()
{
Group_Id
=
demodel
.
Group_Id
,
QClassDateStr
=
Date
,
TeacherId
=
demodel
.
TeacherId
});
if
(
pcList
.
Any
())
...
...
@@ -2700,6 +2832,7 @@ namespace Edu.Module.Course
#
region
开始预约
var
planModel
=
planList
.
FirstOrDefault
();
var
timeList
=
planModel
.
CourseTimeList
.
Where
(
x
=>
(
","
+
demodel
.
ShiftSort
+
","
).
Contains
(
","
+
x
.
Sort
+
","
)).
ToList
();
if
(
timeList
.
Sum
(
x
=>
x
.
Minutes
)
!=
NextAppointMinutes
)
...
...
@@ -2712,20 +2845,17 @@ namespace Edu.Module.Course
}
foreach
(
var
item
in
timeList
.
Where
(
x
=>
x
.
State
==
3
))
{
//if (item.PeopleNum + 1 > item.MaxPeopleNum)
//{
// return "该时段已预约满,请预约其他时段";
//}
demodel
.
CourseId
=
item
.
CourseId
;
demodel
.
RoomId
=
item
.
RoomId
;
}
demodel
.
CourseEndTime
=
Convert
.
ToDateTime
(
Date
+
" "
+
timeList
.
Max
(
x
=>
x
.
EndTime
));
//上完课的时间
demodel
.
CourseTime
=
JsonHelper
.
Serialize
(
timeList
.
Select
(
x
=>
new
{
x
.
Sort
,
x
.
StartTime
,
x
.
EndTime
,
x
.
Minutes
,
x
.
ClassHours
}));
if
(
demodel
.
RoomId
<=
0
)
{
demodel
.
RoomId
=
planModel
.
RoomId
;
//上课教室
demodel
.
RoomId
=
planModel
?.
RoomId
??
0
;
//上课教室
}
demodel
.
GuestId
=
learnModel
.
GuestId
;
demodel
.
OrderId
=
learnModel
.
OrderId
;
...
...
@@ -2739,7 +2869,7 @@ namespace Edu.Module.Course
{
if
(
demodel
.
Id
<=
0
&&
appointList2
.
Where
(
x
=>
x
.
State
==
Common
.
Enum
.
Course
.
CourseAppointStateEnum
.
WaitSure
).
Any
())
{
return
"学员【"
+
demodel
.
StuName
+
"】预约的该次课已存在待确认的数据,无法再次预约"
;
//
return "学员【" + demodel.StuName + "】预约的该次课已存在待确认的数据,无法再次预约";
}
int
AgainNum
=
Convert
.
ToInt32
(
dictvalueRepository
.
GetList
(
new
RB_Dictvalue_Extend
()
{
RB_Group_id
=
demodel
.
Group_Id
,
DictKey
=
"Scroll_AgainCourse"
}).
FirstOrDefault
()?.
Content
??
"1"
);
if
(
demodel
.
Id
<=
0
&&
appointList2
.
Where
(
x
=>
x
.
AppointType
==
3
).
Count
()
>=
AgainNum
)
...
...
Edu.WebApi/Controllers/Course/ScrollController.cs
View file @
05dfdead
...
...
@@ -291,7 +291,7 @@ namespace Edu.WebApi.Controllers.Course
string
Date
=
base
.
ParmJObj
.
GetStringValue
(
"Date"
);
//日期
int
TeacherId
=
base
.
ParmJObj
.
GetInt
(
"TeacherId"
,
0
);
//老师ID
int
courseId
=
base
.
ParmJObj
.
GetInt
(
"CourseId"
,
0
);
//课程ID
var
robj
=
scrollClassModule
.
GetCanTeacherClassTimeList
(
Date
,
TeacherId
,
courseId
,
userInfo
.
Group_Id
);
var
robj
=
scrollClassModule
.
GetCanTeacherClassTimeList
Module
(
Date
,
TeacherId
,
courseId
,
userInfo
.
Group_Id
);
return
ApiResult
.
Success
(
""
,
robj
);
}
...
...
@@ -846,7 +846,7 @@ namespace Edu.WebApi.Controllers.Course
demodel
.
CreateTime
=
DateTime
.
Now
;
demodel
.
UpdateBy
=
userInfo
.
Id
;
demodel
.
UpdateTime
=
DateTime
.
Now
;
string
msg
=
scrollClassModule
.
SetAdminScrollAppointment
_
V2
(
demodel
,
out
int
AppointId
);
string
msg
=
scrollClassModule
.
SetAdminScrollAppointment
Module
V2
(
demodel
,
out
int
AppointId
);
if
(
msg
==
""
)
{
return
ApiResult
.
Success
(
""
,
AppointId
);
...
...
@@ -878,14 +878,10 @@ namespace Edu.WebApi.Controllers.Course
Status
=
0
,
Group_Id
=
userInfo
.
Group_Id
,
CreateBy
=
userInfo
.
Id
,
UpdateBy
=
userInfo
.
Id
};
string
chooseStuListStr
=
base
.
ParmJObj
.
GetStringValue
(
"ChooseStuList"
);
List
<
RB_Scroll_Appointment_ViewModel
>
list
=
new
List
<
RB_Scroll_Appointment_ViewModel
>();
if
(!
string
.
IsNullOrEmpty
(
chooseStuListStr
))
{
JArray
jArray
=
JArray
.
Parse
(
chooseStuListStr
);
...
...
@@ -912,10 +908,7 @@ namespace Edu.WebApi.Controllers.Course
{
return
ApiResult
.
ParamIsNull
(
message
:
"请选择学员"
);
}
if
(
demodel
.
TeacherId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递老师编号ID"
);
}
if
(
string
.
IsNullOrEmpty
(
demodel
.
ShiftSort
))
{
return
ApiResult
.
ParamIsNull
(
"请传递上课时段"
);
...
...
@@ -928,10 +921,6 @@ namespace Edu.WebApi.Controllers.Course
{
return
ApiResult
.
ParamIsNull
(
"请传递学生ID"
);
}
//if (demodel.CourseGradeId <= 0 && demodel.CourseGradeNo <= 0)
//{
// return ApiResult.ParamIsNull("请传递上课的等级");
//}
#
region
验证是否连续的时段
List
<
int
>
SortList
=
JsonHelper
.
DeserializeObject
<
List
<
int
>>(
"["
+
demodel
.
ShiftSort
+
"]"
);
...
...
@@ -947,11 +936,10 @@ namespace Edu.WebApi.Controllers.Course
}
#
endregion
string
msg
=
""
;
foreach
(
var
item
in
list
)
{
msg
+=
scrollClassModule
.
SetAdminScrollAppointment
_
V2
(
item
,
out
int
AppointId
);
msg
+=
scrollClassModule
.
SetAdminScrollAppointment
Module
V2
(
item
,
out
int
AppointId
);
}
if
(
msg
==
""
)
{
...
...
Edu.WebApi/Controllers/User/UserController.cs
View file @
05dfdead
...
...
@@ -2605,7 +2605,8 @@ namespace Edu.WebApi.Controllers.User
qitem
.
Dept_Id
,
qitem
.
DeptName
,
qitem
.
Post_Id
,
qitem
.
PostName
qitem
.
PostName
,
qitem
.
AccountId
,
}));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment