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
211d1d75
Commit
211d1d75
authored
Jul 30, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
9e293249
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
695 additions
and
219 deletions
+695
-219
ClassModule.cs
Edu.Module.Course/ClassModule.cs
+1
-205
ChangeClassPlanModule.cs
Edu.Module.EduTask/ChangeClassPlanModule.cs
+417
-2
RB_Class_PlanRepository.cs
Edu.Repository/Course/RB_Class_PlanRepository.cs
+227
-1
RB_Class_RoomRepository.cs
Edu.Repository/Course/RB_Class_RoomRepository.cs
+4
-4
ChangePlanController.cs
Edu.WebApi/Controllers/EduTask/ChangePlanController.cs
+46
-7
No files found.
Edu.Module.Course/ClassModule.cs
View file @
211d1d75
...
@@ -1024,214 +1024,10 @@ namespace Edu.Module.Course
...
@@ -1024,214 +1024,10 @@ namespace Edu.Module.Course
});
});
//已经完成的上课计划
//已经完成的上课计划
var
finishClassHours
=
oldPlanList
?.
Sum
(
qitem
=>
qitem
.
TimeHour
)
??
0
;
var
finishClassHours
=
oldPlanList
?.
Sum
(
qitem
=>
qitem
.
TimeHour
)
??
0
;
List
<
RB_Class_Plan_ViewModel
>
classPlanList
=
new
List
<
RB_Class_Plan_ViewModel
>();
List
<
RB_Class_Plan_ViewModel
>
classPlanList
=
class_PlanRepository
.
CreateClassPlanRepository
(
model
,
defaultPlanTimeList
,
finishClassHours
,
BasicMinutes
);
if
(
model
.
ClassHours
>
0
&&
defaultPlanTimeList
!=
null
&&
defaultPlanTimeList
.
Count
>
0
)
{
var
srartDate
=
model
.
OpenTime
;
if
(
model
.
OpenTime
<
DateTime
.
Now
)
{
srartDate
=
DateTime
.
Now
;
}
//按周排课和按月排课
if
(
model
.
ClassStyle
==
ClassStyleEnum
.
Week
||
model
.
ClassStyle
==
ClassStyleEnum
.
Month
)
{
int
i
=
0
;
double
totalHours
=
Convert
.
ToDouble
(
finishClassHours
);
while
(
model
.
ClassHours
>
totalHours
)
{
var
newDate
=
srartDate
.
AddDays
(
i
);
foreach
(
var
item
in
model
.
WeekDayList
)
{
var
planModel
=
new
RB_Class_Plan_ViewModel
()
{
ClassId
=
model
.
ClassId
,
ClassPlanId
=
0
,
ClassRoomId
=
model
.
ClassRoomId
,
Group_Id
=
model
.
Group_Id
,
School_Id
=
model
.
School_Id
,
PlanTimeList
=
new
List
<
RB_Class_Time_ViewModel
>(),
TeacherId
=
model
.
Teacher_Id
,
ClassDate
=
newDate
};
if
(
model
.
ClassStyle
==
ClassStyleEnum
.
Week
)
{
switch
(
item
)
{
case
"1"
:
if
(
newDate
.
DayOfWeek
==
DayOfWeek
.
Monday
)
{
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
}
break
;
case
"2"
:
if
(
newDate
.
DayOfWeek
==
DayOfWeek
.
Tuesday
)
{
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
}
break
;
case
"3"
:
if
(
newDate
.
DayOfWeek
==
DayOfWeek
.
Wednesday
)
{
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
}
break
;
case
"4"
:
if
(
newDate
.
DayOfWeek
==
DayOfWeek
.
Thursday
)
{
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
}
break
;
case
"5"
:
if
(
newDate
.
DayOfWeek
==
DayOfWeek
.
Friday
)
{
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
}
break
;
case
"6"
:
if
(
newDate
.
DayOfWeek
==
DayOfWeek
.
Saturday
)
{
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
}
break
;
case
"7"
:
if
(
newDate
.
DayOfWeek
==
DayOfWeek
.
Sunday
)
{
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
}
break
;
}
}
else
if
(
model
.
ClassStyle
==
ClassStyleEnum
.
Month
)
{
if
(
newDate
.
Day
==
Convert
.
ToInt32
(
item
))
{
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
}
}
}
i
++;
}
}
//固定日期
else
if
(
model
.
ClassStyle
==
ClassStyleEnum
.
FixedDate
)
{
foreach
(
var
item
in
model
.
WeekDayList
)
{
var
planModel
=
new
RB_Class_Plan_ViewModel
()
{
ClassId
=
model
.
ClassId
,
ClassPlanId
=
0
,
ClassRoomId
=
model
.
ClassRoomId
,
Group_Id
=
model
.
Group_Id
,
School_Id
=
model
.
School_Id
,
PlanTimeList
=
new
List
<
RB_Class_Time_ViewModel
>(),
TeacherId
=
model
.
Teacher_Id
,
ClassDate
=
Convert
.
ToDateTime
(
item
)
};
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
CalcDayClassHoursModule
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
classPlanList
.
Add
(
planModel
);
}
}
}
//约课
else
{
}
}
return
classPlanList
;
return
classPlanList
;
}
}
/// <summary>
/// 计算每天课时
/// </summary>
/// <param name="timeList"></param>
/// <param name="classTimeList"></param>
/// <param name="model"></param>
/// <returns></returns>
private
double
CalcDayClassHoursModule
(
List
<
TimeItem
>
timeList
,
List
<
RB_Class_Time_ViewModel
>
classTimeList
,
RB_Class_ViewModel
model
,
int
BasicMinutes
)
{
double
dayClassHours
=
0
;
double
dayMinutes
=
0
;
foreach
(
var
sItem
in
timeList
)
{
var
timeModel
=
new
RB_Class_Time_ViewModel
()
{
StartTime
=
sItem
.
StartTime
,
EndTime
=
sItem
.
EndTime
,
TimeHour
=
sItem
.
TimeHour
,
};
classTimeList
.
Add
(
timeModel
);
var
startDate
=
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
sItem
.
StartTime
+
":00"
);
var
endDate
=
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
sItem
.
EndTime
+
":00"
);
TimeSpan
span
=
endDate
.
Subtract
(
startDate
);
if
(
span
.
TotalMinutes
>
0
)
{
dayMinutes
+=
span
.
TotalMinutes
;
}
}
if
(
model
.
ClassHourMinute
>
0
)
{
dayClassHours
=
dayMinutes
/
model
.
ClassHourMinute
;
}
else
{
dayClassHours
=
dayMinutes
/
BasicMinutes
;
}
return
dayClassHours
;
}
/// <summary>
/// <summary>
/// 根据班级编号获取班级详细信息
/// 根据班级编号获取班级详细信息
/// </summary>
/// </summary>
...
...
Edu.Module.EduTask/ChangeClassPlanModule.cs
View file @
211d1d75
using
Edu.Model.Entity.EduTask
;
using
Edu.Model.CacheModel
;
using
Edu.Model.Entity.EduTask
;
using
Edu.Model.ViewModel.Course
;
using
Edu.Model.ViewModel.Course
;
using
Edu.Model.ViewModel.EduTask
;
using
Edu.Model.ViewModel.EduTask
;
using
Edu.Model.ViewModel.User
;
using
Edu.Repository.Course
;
using
Edu.Repository.Course
;
using
Edu.Repository.EduTask
;
using
Edu.Repository.EduTask
;
using
Edu.Repository.User
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
VT.FW.AOP.CustomerAttribute
;
using
VT.FW.AOP.CustomerAttribute
;
using
VT.FW.DB
;
using
VT.FW.DB
;
...
@@ -29,6 +33,417 @@ namespace Edu.Module.EduTask
...
@@ -29,6 +33,417 @@ namespace Edu.Module.EduTask
/// </summary>
/// </summary>
private
readonly
RB_Class_PlanRepository
class_PlanRepository
=
new
RB_Class_PlanRepository
();
private
readonly
RB_Class_PlanRepository
class_PlanRepository
=
new
RB_Class_PlanRepository
();
/// <summary>
/// 班级上课计划上课时间仓储层对象
/// </summary>
private
readonly
RB_Class_TimeRepository
class_TimeRepository
=
new
RB_Class_TimeRepository
();
/// <summary>
/// 教室仓储层对象
/// </summary>
private
readonly
RB_Class_RoomRepository
class_RoomRepository
=
new
RB_Class_RoomRepository
();
/// <summary>
/// 老师仓储层对象
/// </summary>
private
readonly
RB_TeacherRepository
teacherRepository
=
new
RB_TeacherRepository
();
/// <summary>
/// 课程基础配置
/// </summary>
private
readonly
RB_Class_ConfigRepository
class_ConfigRepository
=
new
RB_Class_ConfigRepository
();
/// <summary>
/// 班级仓储层对象
/// </summary>
private
readonly
RB_ClassRepository
classRepository
=
new
RB_ClassRepository
();
/// <summary>
/// 检查是否重复【固定日期】
/// </summary>
/// <param name="ClassId"></param>
/// <param name="changeList"></param>
/// <param name="timeList"></param>
/// <returns></returns>
public
List
<
object
>
GetRepeatListModule
(
int
ClassId
,
List
<
ChangePlanItem
>
changeList
,
List
<
TimeItem
>
timeList
)
{
List
<
object
>
list
=
new
List
<
object
>();
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
repeatList
=
CheckClassPlanModule
(
ClassId
,
timeList
);
if
(
repeatList
!=
null
&&
repeatList
.
Count
>
0
)
{
List
<
RB_Class_Room_ViewModel
>
roomList
=
new
List
<
RB_Class_Room_ViewModel
>();
List
<
RB_Teacher_ViewModel
>
teacherList
=
new
List
<
RB_Teacher_ViewModel
>();
string
roomIds
=
string
.
Join
(
","
,
changeList
.
Where
(
qitem
=>
qitem
.
ClassRoomId
>
0
).
Select
(
qitem
=>
qitem
.
ClassRoomId
));
string
teacherIds
=
string
.
Join
(
","
,
changeList
.
Where
(
qitem
=>
qitem
.
TeacherId
>
0
).
Select
(
qitem
=>
qitem
.
TeacherId
));
//冲突的上课计划编号
List
<
int
>
ids
=
new
List
<
int
>();
foreach
(
var
item
in
changeList
)
{
var
tempRepeatList
=
repeatList
?.
Where
(
qitem
=>
qitem
.
ClassDate
==
item
.
ClassDate
)?.
ToList
();
if
(
tempRepeatList
!=
null
&&
tempRepeatList
.
Count
>
0
)
{
if
(
item
.
TeacherId
>
0
)
{
var
tempTeacherList
=
tempRepeatList
?.
Where
(
qitem
=>
qitem
.
TeacherId
==
item
.
TeacherId
)?.
ToList
();
if
(
tempTeacherList
!=
null
&&
tempTeacherList
.
Count
>
0
)
{
var
tempIds
=
Common
.
ConvertHelper
.
StringToList
(
string
.
Join
(
","
,
tempTeacherList
.
GroupBy
(
qitem
=>
qitem
.
ClassPlanId
).
Select
(
qitem
=>
qitem
.
Key
)));
if
(
tempIds
!=
null
&&
tempIds
.
Count
>
0
)
{
ids
.
AddRange
(
tempIds
);
}
}
}
if
(
item
.
ClassRoomId
>
0
)
{
var
classroomList
=
tempRepeatList
?.
Where
(
qitem
=>
qitem
.
ClassRoomId
==
item
.
ClassRoomId
)?.
ToList
();
if
(
classroomList
!=
null
&&
classroomList
.
Count
>
0
)
{
var
tempIds
=
Common
.
ConvertHelper
.
StringToList
(
string
.
Join
(
","
,
classroomList
.
GroupBy
(
qitem
=>
qitem
.
ClassPlanId
).
Select
(
qitem
=>
qitem
.
Key
)));
if
(
tempIds
!=
null
&&
tempIds
.
Count
>
0
)
{
ids
.
AddRange
(
tempIds
);
}
}
}
}
}
var
planList
=
new
List
<
RB_Class_Plan_ViewModel
>();
var
classTimeList
=
new
List
<
RB_Class_Time_ViewModel
>();
if
(
ids
!=
null
&&
ids
.
Count
>
0
)
{
if
(!
string
.
IsNullOrEmpty
(
roomIds
))
{
roomList
=
class_RoomRepository
.
GetClassRoomListRepository
(
new
RB_Class_Room_ViewModel
()
{
QRoomIds
=
roomIds
});
}
if
(!
string
.
IsNullOrEmpty
(
teacherIds
))
{
teacherList
=
teacherRepository
.
GetTeacherListRepository
(
new
Model
.
ViewModel
.
User
.
RB_Teacher_ViewModel
()
{
QTIds
=
teacherIds
});
}
planList
=
class_PlanRepository
.
GetClassPlanListRepository
(
new
RB_Class_Plan_ViewModel
()
{
QClassPlanIds
=
string
.
Join
(
","
,
ids
)
});
classTimeList
=
class_TimeRepository
.
GetClassTimeListRepository
(
new
RB_Class_Time_ViewModel
()
{
QClassPlanIds
=
string
.
Join
(
","
,
ids
)
});
foreach
(
var
item
in
changeList
)
{
List
<
object
>
PlanRepeatList
=
new
List
<
object
>();
var
tempRepeatList
=
planList
?.
Where
(
qitem
=>
qitem
.
ClassDate
==
item
.
ClassDate
)?.
ToList
();
if
(
tempRepeatList
!=
null
&&
tempRepeatList
.
Count
>
0
)
{
foreach
(
var
subItem
in
tempRepeatList
)
{
var
tempObj
=
new
{
subItem
.
ClassPlanId
,
subItem
.
ClassId
,
subItem
.
ClassName
,
ClassDate
=
Common
.
ConvertHelper
.
FormatDate
(
subItem
.
ClassDate
),
subItem
.
TeacherId
,
subItem
.
TeacherName
,
subItem
.
ClassRoomId
,
subItem
.
RoomName
,
PlanTimeList
=
classTimeList
.
Where
(
qitem
=>
qitem
.
ClassPlanId
==
subItem
.
ClassPlanId
).
Select
(
qitem
=>
new
{
qitem
.
StartTime
,
qitem
.
EndTime
,
qitem
.
TimeHour
}),
};
PlanRepeatList
.
Add
(
tempObj
);
}
}
var
obj
=
new
{
item
.
ClassPlanId
,
ClassDate
=
Common
.
ConvertHelper
.
FormatDate
(
item
.
ClassDate
),
item
.
TeacherId
,
TeacherName
=
teacherList
?.
Where
(
qitem
=>
qitem
.
TId
==
item
.
TeacherId
)?.
FirstOrDefault
()?.
TeacherName
??
""
,
item
.
ClassRoomId
,
RoomName
=
roomList
?.
Where
(
qitem
=>
qitem
.
RoomId
==
item
.
ClassRoomId
)?.
FirstOrDefault
()?.
RoomName
??
""
,
PlanTimeList
=
item
.
PlanTimeList
.
Select
(
qitem
=>
new
{
qitem
.
StartTime
,
qitem
.
EndTime
,
}),
PlanRepeatList
};
list
.
Add
(
obj
);
}
}
}
}
return
list
;
}
/// <summary>
/// 全局老师、教室调整
/// </summary>
/// <param name="ClassId"></param>
/// <param name="changeList"></param>
/// <param name="timeList"></param>
/// <returns></returns>
public
List
<
object
>
GetAllRepeatListModule
(
int
ClassId
,
string
TakeEffectTime
,
int
TeacherId
=
0
,
int
ClassRoomId
=
0
)
{
List
<
object
>
list
=
new
List
<
object
>();
var
classPlanList
=
class_PlanRepository
.
GetClassPlanListRepository
(
new
RB_Class_Plan_ViewModel
()
{
ClassId
=
ClassId
,
StartTime
=
TakeEffectTime
,
});
list
=
GetRepeatDataModule
(
classPlanList
,
1
,
TeacherId
:
TeacherId
,
ClassRoomId
:
ClassRoomId
);
return
list
;
}
/// <summary>
/// 全局验证上课日期和时间
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
List
<
object
>
GetAllDateAndTimeRepeatListModule
(
int
ClassId
,
AllChangePlanItem
model
,
UserInfo
user
)
{
List
<
object
>
list
=
new
List
<
object
>();
var
oldClass
=
classRepository
.
GetEntity
(
ClassId
);
var
oldPlanList
=
class_PlanRepository
.
GetClassPlanListExtRepository
(
new
RB_Class_Plan_ViewModel
()
{
ClassId
=
ClassId
,
EndTime
=
Common
.
ConvertHelper
.
FormatDate
(
model
.
OpenTimeStr
)
});
//已经完成的上课计划
var
finishClassHours
=
oldPlanList
?.
Sum
(
qitem
=>
qitem
.
TimeHour
)
??
0
;
var
BasicMinutes
=
class_ConfigRepository
.
GetBasicMinutesRepository
(
user
.
Group_Id
);
RB_Class_ViewModel
classModel
=
new
RB_Class_ViewModel
()
{
ClassHours
=
oldClass
.
ClassHours
,
ClassStyle
=
model
.
ClassStyle
,
WeekDayList
=
new
List
<
string
>(),
Teacher_Id
=
model
.
TeacherId
,
ClassRoomId
=
model
.
ClassRoomId
,
};
if
(
model
.
DefaultTimeList
!=
null
&&
model
.
DefaultTimeList
.
Count
>
0
)
{
foreach
(
var
item
in
model
.
DefaultTimeList
)
{
if
(
item
.
DateList
!=
null
&&
item
.
DateList
.
Count
>
0
)
{
classModel
.
WeekDayList
.
AddRange
(
item
.
DateList
);
}
}
}
var
planList
=
class_PlanRepository
.
CreateClassPlanRepository
(
classModel
,
model
.
DefaultTimeList
,
finishClassHours
,
BasicMinutes
,
defaultOpenTime
:
model
.
OpenTimeStr
);
list
=
GetRepeatDataModule
(
planList
,
2
);
return
list
;
}
/// <summary>
/// 获取冲突的数据
/// </summary>
/// <param name="classPlanList">上课计划</param>
/// <param name="ChangeType">1-全局调整(教室或者老师),2-全局调整(上课计划)</param>
/// <param name="TeacherId">老师编号</param>
/// <param name="ClassRoomId">教室编号</param>
/// <returns></returns>
public
List
<
object
>
GetRepeatDataModule
(
List
<
RB_Class_Plan_ViewModel
>
classPlanList
,
int
ChangeType
,
int
TeacherId
=
0
,
int
ClassRoomId
=
0
)
{
List
<
object
>
list
=
new
List
<
object
>();
List
<
TimeItem
>
timeList
=
new
List
<
TimeItem
>();
//冲突的上课计划编号
List
<
int
>
ids
=
new
List
<
int
>();
if
(
classPlanList
!=
null
&&
classPlanList
.
Count
>
0
)
{
string
planIds
=
string
.
Join
(
","
,
classPlanList
.
Select
(
qitem
=>
qitem
.
ClassPlanId
));
var
classTimeList
=
class_TimeRepository
.
GetClassTimeListRepository
(
new
RB_Class_Time_ViewModel
()
{
QClassPlanIds
=
planIds
});
foreach
(
var
item
in
classPlanList
)
{
if
(
ChangeType
==
1
)
{
item
.
PlanTimeList
=
classTimeList
?.
Where
(
qitem
=>
qitem
.
ClassPlanId
==
item
.
ClassPlanId
)?.
ToList
()
??
new
List
<
RB_Class_Time_ViewModel
>();
}
if
(
item
.
PlanTimeList
!=
null
&&
item
.
PlanTimeList
.
Count
>
0
)
{
foreach
(
var
subItem
in
item
.
PlanTimeList
)
{
timeList
.
Add
(
new
TimeItem
{
StartTime
=
Common
.
ConvertHelper
.
FormatDate
(
item
.
ClassDate
)
+
" "
+
subItem
.
StartTime
+
":00"
,
EndTime
=
Common
.
ConvertHelper
.
FormatDate
(
item
.
ClassDate
)
+
" "
+
subItem
.
EndTime
+
":00"
,
});
}
}
}
var
repeatList
=
CheckClassPlanModule
(
classPlanList
[
0
].
ClassId
,
timeList
);
if
(
repeatList
!=
null
&&
repeatList
.
Count
>
0
)
{
foreach
(
var
item
in
classPlanList
)
{
var
tempRepeatList
=
repeatList
?.
Where
(
qitem
=>
qitem
.
ClassDate
==
item
.
ClassDate
)?.
ToList
();
if
(
tempRepeatList
!=
null
&&
tempRepeatList
.
Count
>
0
)
{
var
newTeacherId
=
0
;
var
newClassRoomId
=
0
;
if
(
ChangeType
==
1
)
{
newTeacherId
=
TeacherId
;
newClassRoomId
=
ClassRoomId
;
}
else
{
newTeacherId
=
item
.
TeacherId
;
newClassRoomId
=
item
.
ClassRoomId
;
}
if
(
newTeacherId
>
0
)
{
var
tempTeacherList
=
tempRepeatList
?.
Where
(
qitem
=>
qitem
.
TeacherId
==
newTeacherId
)?.
ToList
();
if
(
tempTeacherList
!=
null
&&
tempTeacherList
.
Count
>
0
)
{
var
tempIds
=
Common
.
ConvertHelper
.
StringToList
(
string
.
Join
(
","
,
tempTeacherList
.
GroupBy
(
qitem
=>
qitem
.
ClassPlanId
).
Select
(
qitem
=>
qitem
.
Key
)));
if
(
tempIds
!=
null
&&
tempIds
.
Count
>
0
)
{
ids
.
AddRange
(
tempIds
);
}
}
}
if
(
newClassRoomId
>
0
)
{
var
classroomList
=
tempRepeatList
?.
Where
(
qitem
=>
qitem
.
ClassRoomId
==
newClassRoomId
)?.
ToList
();
if
(
classroomList
!=
null
&&
classroomList
.
Count
>
0
)
{
var
tempIds
=
Common
.
ConvertHelper
.
StringToList
(
string
.
Join
(
","
,
classroomList
.
GroupBy
(
qitem
=>
qitem
.
ClassPlanId
).
Select
(
qitem
=>
qitem
.
Key
)));
if
(
tempIds
!=
null
&&
tempIds
.
Count
>
0
)
{
ids
.
AddRange
(
tempIds
);
}
}
}
}
}
}
}
if
(
ids
!=
null
&&
ids
.
Count
>
0
)
{
List
<
RB_Class_Room_ViewModel
>
roomList
=
new
List
<
RB_Class_Room_ViewModel
>();
List
<
RB_Teacher_ViewModel
>
teacherList
=
new
List
<
RB_Teacher_ViewModel
>();
List
<
int
>
roomIds
=
Common
.
ConvertHelper
.
StringToList
(
string
.
Join
(
","
,
classPlanList
.
Select
(
qitem
=>
qitem
.
ClassRoomId
)));
List
<
int
>
teacherIds
=
Common
.
ConvertHelper
.
StringToList
(
string
.
Join
(
","
,
classPlanList
.
Select
(
qitem
=>
qitem
.
TeacherId
)));
if
(
roomIds
!=
null
&&
roomIds
.
Count
>
0
)
{
roomIds
.
Add
(
ClassRoomId
);
}
if
(
teacherIds
!=
null
&&
teacherIds
.
Count
>
0
)
{
teacherIds
.
Add
(
TeacherId
);
}
if
(
roomIds
!=
null
&&
roomIds
.
Count
>
0
)
{
roomList
=
class_RoomRepository
.
GetClassRoomListRepository
(
new
RB_Class_Room_ViewModel
()
{
QRoomIds
=
string
.
Join
(
","
,
roomIds
)
});
}
if
(
teacherIds
!=
null
&&
teacherIds
.
Count
>
0
)
{
teacherList
=
teacherRepository
.
GetTeacherListRepository
(
new
RB_Teacher_ViewModel
()
{
QTIds
=
string
.
Join
(
","
,
teacherIds
)
});
}
//冲突的数据
var
planOtherList
=
class_PlanRepository
.
GetClassPlanListRepository
(
new
RB_Class_Plan_ViewModel
()
{
QClassPlanIds
=
string
.
Join
(
","
,
ids
)
});
var
classOtherTimeList
=
class_TimeRepository
.
GetClassTimeListRepository
(
new
RB_Class_Time_ViewModel
()
{
QClassPlanIds
=
string
.
Join
(
","
,
ids
)
});
foreach
(
var
item
in
classPlanList
)
{
List
<
object
>
PlanRepeatList
=
new
List
<
object
>();
var
tempRepeatList
=
planOtherList
?.
Where
(
qitem
=>
qitem
.
ClassDate
==
item
.
ClassDate
)?.
ToList
();
if
(
tempRepeatList
!=
null
&&
tempRepeatList
.
Count
>
0
)
{
foreach
(
var
subItem
in
tempRepeatList
)
{
var
tempObj
=
new
{
subItem
.
ClassPlanId
,
subItem
.
ClassId
,
subItem
.
ClassName
,
ClassDate
=
Common
.
ConvertHelper
.
FormatDate
(
subItem
.
ClassDate
),
subItem
.
TeacherId
,
subItem
.
TeacherName
,
subItem
.
ClassRoomId
,
subItem
.
RoomName
,
PlanTimeList
=
classOtherTimeList
.
Where
(
qitem
=>
qitem
.
ClassPlanId
==
subItem
.
ClassPlanId
).
Select
(
qitem
=>
new
{
qitem
.
StartTime
,
qitem
.
EndTime
,
qitem
.
TimeHour
}),
};
PlanRepeatList
.
Add
(
tempObj
);
}
string
TeacherName
=
""
;
string
RoomName
=
""
;
var
newTeacherId
=
0
;
var
newClassRoomId
=
0
;
//调整老师或者教室
if
(
ChangeType
==
1
)
{
newTeacherId
=
TeacherId
>
0
?
TeacherId
:
item
.
TeacherId
;
newClassRoomId
=
ClassRoomId
>
0
?
ClassRoomId
:
item
.
ClassRoomId
;
TeacherName
=
teacherList
?.
Where
(
qitem
=>
qitem
.
TId
==
newTeacherId
)?.
FirstOrDefault
()?.
TeacherName
??
""
;
RoomName
=
roomList
?.
Where
(
qitem
=>
qitem
.
RoomId
==
newClassRoomId
)?.
FirstOrDefault
()?.
RoomName
??
""
;
}
//调整上课日期或上课时间
else
{
newTeacherId
=
item
.
TeacherId
;
newClassRoomId
=
item
.
ClassRoomId
;
TeacherName
=
teacherList
?.
Where
(
qitem
=>
qitem
.
TId
==
item
.
TeacherId
)?.
FirstOrDefault
()?.
TeacherName
??
""
;
RoomName
=
roomList
?.
Where
(
qitem
=>
qitem
.
RoomId
==
item
.
ClassRoomId
)?.
FirstOrDefault
()?.
RoomName
??
""
;
}
var
obj
=
new
{
item
.
ClassPlanId
,
ClassDate
=
Common
.
ConvertHelper
.
FormatDate
(
item
.
ClassDate
),
TeacherId
=
newTeacherId
,
TeacherName
,
ClassRoomId
=
newClassRoomId
,
RoomName
,
PlanTimeList
=
item
.
PlanTimeList
.
Select
(
qitem
=>
new
{
qitem
.
StartTime
,
qitem
.
EndTime
,
}),
PlanRepeatList
};
list
.
Add
(
obj
);
}
}
}
return
list
;
}
/// <summary>
/// <summary>
/// 检查上课计划是否存在时间上的交集【HK2021-07-28新增】
/// 检查上课计划是否存在时间上的交集【HK2021-07-28新增】
...
@@ -36,7 +451,7 @@ namespace Edu.Module.EduTask
...
@@ -36,7 +451,7 @@ namespace Edu.Module.EduTask
/// <param name="classId"></param>
/// <param name="classId"></param>
/// <param name="timeList"></param>
/// <param name="timeList"></param>
/// <returns></returns>
/// <returns></returns>
public
List
<
RB_Class_Plan_ViewModel
>
CheckClassPlanModule
(
int
classId
,
List
<
Model
.
ViewModel
.
Course
.
TimeItem
>
timeList
)
public
List
<
RB_Class_Plan_ViewModel
>
CheckClassPlanModule
(
int
classId
,
List
<
TimeItem
>
timeList
)
{
{
return
class_PlanRepository
.
CheckClassPlanRepository
(
classId
,
timeList
);
return
class_PlanRepository
.
CheckClassPlanRepository
(
classId
,
timeList
);
}
}
...
...
Edu.Repository/Course/RB_Class_PlanRepository.cs
View file @
211d1d75
using
Edu.Common.Enum
;
using
Edu.Common.Enum
;
using
Edu.Common.Enum.Course
;
using
Edu.Model.Entity.Course
;
using
Edu.Model.Entity.Course
;
using
Edu.Model.ViewModel.Course
;
using
Edu.Model.ViewModel.Course
;
using
Edu.Model.ViewModel.Reserve
;
using
Edu.Model.ViewModel.Reserve
;
...
@@ -914,7 +915,232 @@ WHERE 1=1
...
@@ -914,7 +915,232 @@ WHERE 1=1
}
}
builder
.
AppendFormat
(
" WHERE ClassPlanId IN({0}) "
,
planIds
);
builder
.
AppendFormat
(
" WHERE ClassPlanId IN({0}) "
,
planIds
);
return
base
.
Execute
(
builder
.
ToString
())
>
0
;
return
base
.
Execute
(
builder
.
ToString
())
>
0
;
}
}
#
endregion
#
endregion
/// <summary>
/// 生成上课计划列表
/// </summary>
/// <param name="model"></param>
/// <param name="defaultPlanTimeList"></param>
/// <param name="finishClassHours"></param>
/// <param name="BasicMinutes"></param>
/// <returns></returns>
public
List
<
RB_Class_Plan_ViewModel
>
CreateClassPlanRepository
(
RB_Class_ViewModel
model
,
List
<
ClassTimeItem
>
defaultPlanTimeList
,
decimal
finishClassHours
,
int
BasicMinutes
,
string
defaultOpenTime
=
""
)
{
List
<
RB_Class_Plan_ViewModel
>
classPlanList
=
new
List
<
RB_Class_Plan_ViewModel
>();
if
(
model
.
ClassHours
>
0
&&
defaultPlanTimeList
!=
null
&&
defaultPlanTimeList
.
Count
>
0
)
{
var
srartDate
=
model
.
OpenTime
;
if
(
model
.
OpenTime
<
DateTime
.
Now
)
{
srartDate
=
DateTime
.
Now
;
}
if
(!
string
.
IsNullOrEmpty
(
defaultOpenTime
))
{
srartDate
=
Convert
.
ToDateTime
(
defaultOpenTime
);
}
//按周排课和按月排课
if
(
model
.
ClassStyle
==
ClassStyleEnum
.
Week
||
model
.
ClassStyle
==
ClassStyleEnum
.
Month
)
{
int
i
=
0
;
double
totalHours
=
Convert
.
ToDouble
(
finishClassHours
);
while
(
model
.
ClassHours
>
totalHours
)
{
var
newDate
=
srartDate
.
AddDays
(
i
);
foreach
(
var
item
in
model
.
WeekDayList
)
{
var
planModel
=
new
RB_Class_Plan_ViewModel
()
{
ClassId
=
model
.
ClassId
,
ClassPlanId
=
0
,
ClassRoomId
=
model
.
ClassRoomId
,
Group_Id
=
model
.
Group_Id
,
School_Id
=
model
.
School_Id
,
PlanTimeList
=
new
List
<
RB_Class_Time_ViewModel
>(),
TeacherId
=
model
.
Teacher_Id
,
ClassDate
=
newDate
};
if
(
model
.
ClassStyle
==
ClassStyleEnum
.
Week
)
{
switch
(
item
)
{
case
"1"
:
if
(
newDate
.
DayOfWeek
==
DayOfWeek
.
Monday
)
{
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursRepository
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
}
break
;
case
"2"
:
if
(
newDate
.
DayOfWeek
==
DayOfWeek
.
Tuesday
)
{
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursRepository
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
}
break
;
case
"3"
:
if
(
newDate
.
DayOfWeek
==
DayOfWeek
.
Wednesday
)
{
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursRepository
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
}
break
;
case
"4"
:
if
(
newDate
.
DayOfWeek
==
DayOfWeek
.
Thursday
)
{
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursRepository
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
}
break
;
case
"5"
:
if
(
newDate
.
DayOfWeek
==
DayOfWeek
.
Friday
)
{
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursRepository
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
}
break
;
case
"6"
:
if
(
newDate
.
DayOfWeek
==
DayOfWeek
.
Saturday
)
{
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursRepository
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
}
break
;
case
"7"
:
if
(
newDate
.
DayOfWeek
==
DayOfWeek
.
Sunday
)
{
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursRepository
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
}
break
;
}
}
else
if
(
model
.
ClassStyle
==
ClassStyleEnum
.
Month
)
{
if
(
newDate
.
Day
==
Convert
.
ToInt32
(
item
))
{
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
var
dayHours
=
CalcDayClassHoursRepository
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
totalHours
+=
dayHours
;
classPlanList
.
Add
(
planModel
);
}
}
}
}
i
++;
}
}
//固定日期
else
if
(
model
.
ClassStyle
==
ClassStyleEnum
.
FixedDate
)
{
foreach
(
var
item
in
model
.
WeekDayList
)
{
var
planModel
=
new
RB_Class_Plan_ViewModel
()
{
ClassId
=
model
.
ClassId
,
ClassPlanId
=
0
,
ClassRoomId
=
model
.
ClassRoomId
,
Group_Id
=
model
.
Group_Id
,
School_Id
=
model
.
School_Id
,
PlanTimeList
=
new
List
<
RB_Class_Time_ViewModel
>(),
TeacherId
=
model
.
Teacher_Id
,
ClassDate
=
Convert
.
ToDateTime
(
item
)
};
var
timeList
=
defaultPlanTimeList
.
Where
(
qitem
=>
qitem
.
DateList
.
Contains
(
item
))?.
FirstOrDefault
()?.
TimeList
;
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
CalcDayClassHoursRepository
(
timeList
,
planModel
.
PlanTimeList
,
model
,
BasicMinutes
);
classPlanList
.
Add
(
planModel
);
}
}
}
//约课
else
{
}
}
return
classPlanList
;
}
/// <summary>
/// 计算每天课时
/// </summary>
/// <param name="timeList"></param>
/// <param name="classTimeList"></param>
/// <param name="model"></param>
/// <returns></returns>
private
double
CalcDayClassHoursRepository
(
List
<
TimeItem
>
timeList
,
List
<
RB_Class_Time_ViewModel
>
classTimeList
,
RB_Class_ViewModel
model
,
int
BasicMinutes
)
{
double
dayClassHours
=
0
;
double
dayMinutes
=
0
;
foreach
(
var
sItem
in
timeList
)
{
var
timeModel
=
new
RB_Class_Time_ViewModel
()
{
StartTime
=
sItem
.
StartTime
,
EndTime
=
sItem
.
EndTime
,
TimeHour
=
sItem
.
TimeHour
,
};
classTimeList
.
Add
(
timeModel
);
var
startDate
=
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
sItem
.
StartTime
+
":00"
);
var
endDate
=
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
sItem
.
EndTime
+
":00"
);
TimeSpan
span
=
endDate
.
Subtract
(
startDate
);
if
(
span
.
TotalMinutes
>
0
)
{
dayMinutes
+=
span
.
TotalMinutes
;
}
}
if
(
model
.
ClassHourMinute
>
0
)
{
dayClassHours
=
dayMinutes
/
model
.
ClassHourMinute
;
}
else
{
dayClassHours
=
dayMinutes
/
BasicMinutes
;
}
return
dayClassHours
;
}
}
}
}
}
Edu.Repository/Course/RB_Class_RoomRepository.cs
View file @
211d1d75
...
@@ -76,10 +76,10 @@ WHERE 1=1
...
@@ -76,10 +76,10 @@ WHERE 1=1
{
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Class_Room_ViewModel
.
Group_Id
),
query
.
Group_Id
);
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Class_Room_ViewModel
.
Group_Id
),
query
.
Group_Id
);
}
}
if
(
query
.
School_Id
>
0
)
//
if (query.School_Id > 0)
{
//
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Class_Room_ViewModel
.
School_Id
),
query
.
School_Id
);
//
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Room_ViewModel.School_Id), query.School_Id);
}
//
}
if
(!
string
.
IsNullOrEmpty
(
query
.
RoomName
))
if
(!
string
.
IsNullOrEmpty
(
query
.
RoomName
))
{
{
builder
.
AppendFormat
(
" AND A.{0} LIKE @RoomName "
,
nameof
(
RB_Class_Room_ViewModel
.
RoomName
));
builder
.
AppendFormat
(
" AND A.{0} LIKE @RoomName "
,
nameof
(
RB_Class_Room_ViewModel
.
RoomName
));
...
...
Edu.WebApi/Controllers/EduTask/ChangePlanController.cs
View file @
211d1d75
...
@@ -49,7 +49,6 @@ namespace Edu.WebApi.Controllers.EduTask
...
@@ -49,7 +49,6 @@ namespace Edu.WebApi.Controllers.EduTask
MoveType
=
base
.
ParmJObj
.
GetInt
(
"MoveType"
),
MoveType
=
base
.
ParmJObj
.
GetInt
(
"MoveType"
),
Remarks
=
base
.
ParmJObj
.
GetStringValue
(
"Remarks"
)
Remarks
=
base
.
ParmJObj
.
GetStringValue
(
"Remarks"
)
};
};
if
(
model
.
ClassId
<=
0
)
if
(
model
.
ClassId
<=
0
)
{
{
return
ApiResult
.
ParamIsNull
(
message
:
"请选择要调整的班级!"
);
return
ApiResult
.
ParamIsNull
(
message
:
"请选择要调整的班级!"
);
...
@@ -58,7 +57,7 @@ namespace Edu.WebApi.Controllers.EduTask
...
@@ -58,7 +57,7 @@ namespace Edu.WebApi.Controllers.EduTask
string
receiptFile
=
string
.
Empty
;
string
receiptFile
=
string
.
Empty
;
try
try
{
{
List
<
string
>
receiptFileList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
string
>>(
base
.
ParmJObj
.
GetStringValue
(
"ReceiptFileList"
));
List
<
string
>
receiptFileList
=
JsonHelper
.
DeserializeObject
<
List
<
string
>>(
base
.
ParmJObj
.
GetStringValue
(
"ReceiptFileList"
));
if
(
receiptFileList
==
null
||
!
receiptFileList
.
Any
())
if
(
receiptFileList
==
null
||
!
receiptFileList
.
Any
())
{
{
receiptFile
=
""
;
receiptFile
=
""
;
...
@@ -69,8 +68,8 @@ namespace Edu.WebApi.Controllers.EduTask
...
@@ -69,8 +68,8 @@ namespace Edu.WebApi.Controllers.EduTask
}
}
if
(
model
.
MoveType
==
1
)
if
(
model
.
MoveType
==
1
)
{
{
model
.
OldChangePlanItemList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
ChangePlanItem
>>(
base
.
ParmJObj
.
GetStringValue
(
"OldChangePlanItemList"
));
model
.
OldChangePlanItemList
=
JsonHelper
.
DeserializeObject
<
List
<
ChangePlanItem
>>(
base
.
ParmJObj
.
GetStringValue
(
"OldChangePlanItemList"
));
model
.
NewChangePlanItemList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
ChangePlanItem
>>(
base
.
ParmJObj
.
GetStringValue
(
"NewChangePlanItemList"
));
model
.
NewChangePlanItemList
=
JsonHelper
.
DeserializeObject
<
List
<
ChangePlanItem
>>(
base
.
ParmJObj
.
GetStringValue
(
"NewChangePlanItemList"
));
}
}
else
else
{
{
...
@@ -83,7 +82,6 @@ namespace Edu.WebApi.Controllers.EduTask
...
@@ -83,7 +82,6 @@ namespace Edu.WebApi.Controllers.EduTask
}
}
model
.
TakeEffectTime
=
Convert
.
ToDateTime
(
takeEffectTime
);
model
.
TakeEffectTime
=
Convert
.
ToDateTime
(
takeEffectTime
);
}
}
model
.
AllChangePlanModel
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
AllChangePlanItem
>(
base
.
ParmJObj
.
GetStringValue
(
"AllChangePlanItem"
));
model
.
AllChangePlanModel
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
AllChangePlanItem
>(
base
.
ParmJObj
.
GetStringValue
(
"AllChangePlanItem"
));
}
}
}
}
...
@@ -91,7 +89,9 @@ namespace Edu.WebApi.Controllers.EduTask
...
@@ -91,7 +89,9 @@ namespace Edu.WebApi.Controllers.EduTask
{
{
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
"SetChangeClassPlan"
);
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
"SetChangeClassPlan"
);
}
}
if
(
model
.
MoveType
==
1
)
//固定日期
List
<
TimeItem
>
timeList
=
new
List
<
TimeItem
>();
//固定日期
if
(
model
.
MoveType
==
1
)
{
{
if
(
model
.
ChangeType
==
1
)
//调课
if
(
model
.
ChangeType
==
1
)
//调课
{
{
...
@@ -99,6 +99,7 @@ namespace Edu.WebApi.Controllers.EduTask
...
@@ -99,6 +99,7 @@ namespace Edu.WebApi.Controllers.EduTask
{
{
return
ApiResult
.
Failed
(
"排课原次数与现有次数不一致"
);
return
ApiResult
.
Failed
(
"排课原次数与现有次数不一致"
);
}
}
}
}
else
if
(
model
.
ChangeType
==
2
)
else
if
(
model
.
ChangeType
==
2
)
{
{
...
@@ -114,8 +115,31 @@ namespace Edu.WebApi.Controllers.EduTask
...
@@ -114,8 +115,31 @@ namespace Edu.WebApi.Controllers.EduTask
return
ApiResult
.
Failed
(
"请选择教室"
);
return
ApiResult
.
Failed
(
"请选择教室"
);
}
}
}
}
//固定日期上课计划验证冲突
timeList
=
new
List
<
TimeItem
>();
foreach
(
var
item
in
model
.
NewChangePlanItemList
)
{
foreach
(
var
subItem
in
item
.
PlanTimeList
)
{
timeList
.
Add
(
new
TimeItem
{
StartTime
=
Common
.
ConvertHelper
.
FormatDate
(
item
.
ClassDate
)
+
" "
+
subItem
.
StartTime
+
":00"
,
EndTime
=
Common
.
ConvertHelper
.
FormatDate
(
item
.
ClassDate
)
+
" "
+
subItem
.
EndTime
+
":00"
,
});
}
}
if
(
timeList
!=
null
&&
timeList
.
Count
>
0
)
{
//var objList = changeClassPlanModule.GetRepeatListModule(model.ClassId, model.NewChangePlanItemList, timeList);
//if (objList != null && objList.Count > 0)
//{
// return ApiResult.Failed("存在上课计划冲突的数据!", data: objList);
//}
}
}
}
else
//全局修改
//全局修改
else
{
{
if
(
model
.
ChangeType
==
1
)
if
(
model
.
ChangeType
==
1
)
{
{
...
@@ -201,6 +225,11 @@ namespace Edu.WebApi.Controllers.EduTask
...
@@ -201,6 +225,11 @@ namespace Edu.WebApi.Controllers.EduTask
{
{
return
ApiResult
.
Failed
(
"班级信息不存在"
);
return
ApiResult
.
Failed
(
"班级信息不存在"
);
}
}
//var dateList = changeClassPlanModule.GetAllDateAndTimeRepeatListModule(model.ClassId, model.AllChangePlanModel,base.UserInfo);
//if (dateList != null && dateList.Count > 0)
//{
// return ApiResult.Failed("存在上课计划冲突的数据!", data: dateList);
//}
}
}
else
if
(
model
.
ChangeType
==
2
)
else
if
(
model
.
ChangeType
==
2
)
{
{
...
@@ -208,6 +237,11 @@ namespace Edu.WebApi.Controllers.EduTask
...
@@ -208,6 +237,11 @@ namespace Edu.WebApi.Controllers.EduTask
{
{
return
ApiResult
.
Failed
(
"请选择老师"
);
return
ApiResult
.
Failed
(
"请选择老师"
);
}
}
//var teacherlist = changeClassPlanModule.GetAllRepeatListModule(model.ClassId, Common.ConvertHelper.FormatDate(model.TakeEffectTime), TeacherId: model.AllChangePlanModel.TeacherId);
//if (teacherlist != null && teacherlist.Count > 0)
//{
// return ApiResult.Failed("存在上课计划冲突的数据!", data: teacherlist);
//}
}
}
else
if
(
model
.
ChangeType
==
3
)
else
if
(
model
.
ChangeType
==
3
)
{
{
...
@@ -215,6 +249,11 @@ namespace Edu.WebApi.Controllers.EduTask
...
@@ -215,6 +249,11 @@ namespace Edu.WebApi.Controllers.EduTask
{
{
return
ApiResult
.
Failed
(
"请选择教室"
);
return
ApiResult
.
Failed
(
"请选择教室"
);
}
}
//var classroomlist = changeClassPlanModule.GetAllRepeatListModule(model.ClassId, Common.ConvertHelper.FormatDate(model.TakeEffectTime), ClassRoomId: model.AllChangePlanModel.ClassRoomId);
//if (classroomlist != null && classroomlist.Count > 0)
//{
// return ApiResult.Failed("存在上课计划冲突的数据!", data: classroomlist);
//}
}
}
}
}
if
(
model
.
OldChangePlanItemList
!=
null
&&
model
.
OldChangePlanItemList
.
Any
())
if
(
model
.
OldChangePlanItemList
!=
null
&&
model
.
OldChangePlanItemList
.
Any
())
...
...
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