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
2005d44f
Commit
2005d44f
authored
Dec 13, 2023
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
0f6a7ce8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
110 additions
and
17 deletions
+110
-17
TeacherClassController.cs
Edu.WebApi/Controllers/Course/TeacherClassController.cs
+110
-17
No files found.
Edu.WebApi/Controllers/Course/TeacherClassController.cs
View file @
2005d44f
...
...
@@ -557,6 +557,7 @@ namespace Edu.WebApi.Controllers.Course
{
ExcelDataSource
headerTimeFrist
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
"第一节课:9:30~11:00"
){
Colspan
=
3
,
CellWidth
=
10
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
...
...
@@ -564,9 +565,7 @@ namespace Edu.WebApi.Controllers.Course
new
ExcelColumn
(
value
:
"第二节课:11:10~12:40"
){
Colspan
=
3
,
CellWidth
=
10
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
""
){
CellWidth
=
10
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"第三节课:13:30~15:00"
){
Colspan
=
3
,
CellWidth
=
10
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
""
){
CellWidth
=
10
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"伊贺 -富良野 -富本(大) -清元(大) -奈良(小)"
){
Colspan
=
10
,
CellWidth
=
10
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
""
){
Colspan
=(
9
+
TeacherList
.
Count
)>
12
?(
9
+
TeacherList
.
Count
-
12
):
0
,
CellWidth
=
10
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
}
}
};
slist
.
Add
(
headerTimeFrist
);
...
...
@@ -579,8 +578,7 @@ namespace Edu.WebApi.Controllers.Course
new
ExcelColumn
(
value
:
"第五节课:16:50~18:20"
){
Colspan
=
3
,
CellWidth
=
10
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
""
){
CellWidth
=
10
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"第六节课:19:00~20:30"
){
Colspan
=
3
,
CellWidth
=
10
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
""
){
CellWidth
=
10
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
""
){
Colspan
=
10
,
CellWidth
=
10
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
""
){
Colspan
=(
9
+
TeacherList
.
Count
)>
12
?(
9
+
TeacherList
.
Count
-
12
):
0
,
CellWidth
=
10
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
}
}
};
slist
.
Add
(
headerTimeLast
);
...
...
@@ -599,20 +597,21 @@ namespace Edu.WebApi.Controllers.Course
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
ClassDate
.
ToString
(
"MM月dd日"
)){
Colspan
=
2
,
CellWidth
=
1
0
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
ClassDate
.
ToString
(
"MM月dd日"
)){
Colspan
=
2
,
CellWidth
=
3
0
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
}
};
//日期老师名字
foreach
(
var
itemTeacher
in
TeacherList
)
{
classDs
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
itemTeacher
.
TeacherName
)
{
CellWidth
=
1
0
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
classDs
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
itemTeacher
.
TeacherName
)
{
CellWidth
=
2
0
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
}
classDs
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
""
)
{
Colspan
=
6
,
CellWidth
=
50
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
classDs
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
""
)
{
Colspan
=
6
,
CellWidth
=
50
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
slist
.
Add
(
classDs
);
for
(
int
iTime
=
0
;
iTime
<
6
;
iTime
++)
{
ExcelDataSource
classTime
=
new
ExcelDataSource
()
//星期几以及时间节点
{
ColumnHight
=
70
,
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
iTime
==
0
?
Common
.
ConvertHelper
.
GetWeekDay
(
ClassDate
):
""
){
Rowspan
=
iTime
==
0
?
6
:
0
,
CellWidth
=
10
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
...
...
@@ -621,32 +620,32 @@ namespace Edu.WebApi.Controllers.Course
string
startTime
=
"9:30"
;
if
(
iTime
==
0
)
{
classTime
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
"第一节课(2课时)"
)
{
CellWidth
=
3
0
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
classTime
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
"第一节课(2课时)"
)
{
CellWidth
=
2
0
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
}
else
if
(
iTime
==
1
)
{
startTime
=
"11:10"
;
classTime
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
"第二节课(2课时)"
)
{
CellWidth
=
3
0
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
classTime
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
"第二节课(2课时)"
)
{
CellWidth
=
2
0
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
}
else
if
(
iTime
==
2
)
{
startTime
=
"13:30"
;
classTime
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
"第三节课(2课时)"
)
{
CellWidth
=
3
0
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
classTime
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
"第三节课(2课时)"
)
{
CellWidth
=
2
0
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
}
else
if
(
iTime
==
3
)
{
startTime
=
"15:10"
;
classTime
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
"第四节课(2课时)"
)
{
CellWidth
=
3
0
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
classTime
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
"第四节课(2课时)"
)
{
CellWidth
=
2
0
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
}
else
if
(
iTime
==
4
)
{
startTime
=
"16:50"
;
classTime
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
"第五节课(2课时)"
)
{
CellWidth
=
3
0
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
classTime
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
"第五节课(2课时)"
)
{
CellWidth
=
2
0
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
}
else
if
(
iTime
==
5
)
{
startTime
=
"19:00"
;
classTime
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
"第六节课(2课时)"
)
{
CellWidth
=
3
0
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
classTime
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
"第六节课(2课时)"
)
{
CellWidth
=
2
0
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
}
string
guestClassInfo1
=
""
;
foreach
(
var
itemTime
in
TeacherList
)
...
...
@@ -743,13 +742,13 @@ namespace Edu.WebApi.Controllers.Course
{
timeClassInfo1
+=
"\r\n"
;
}
timeClassInfo1
+=
item
.
Key
.
CourseName
+
"-"
+
item
.
Key
.
ChapterNo
+
":"
+
STime
;
timeClassInfo1
+=
item
.
Key
.
CourseName
+
"-"
+
item
.
Key
.
ChapterNo
;
}
#
endregion
classTime
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
timeClassInfo1
)
{
CellWidth
=
1
0
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
classTime
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
timeClassInfo1
)
{
CellWidth
=
2
0
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
}
classTime
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
guestClassInfo1
)
{
Colspan
=
6
,
CellWidth
=
10
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
classTime
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
guestClassInfo1
)
{
Colspan
=
6
,
CellWidth
=
10
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
slist
.
Add
(
classTime
);
}
}
...
...
@@ -768,6 +767,100 @@ namespace Edu.WebApi.Controllers.Course
}
/// <summary>
/// 获取预约课计划
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
Obsolete
]
public
FileContentResult
GetAppointmentPlanStudentExcel
()
{
var
StartDate
=
base
.
ParmJObj
.
GetStringValue
(
"StartDate"
);
var
EndDate
=
base
.
ParmJObj
.
GetStringValue
(
"EndDate"
);
int
TeacherId
=
base
.
ParmJObj
.
GetInt
(
"TeacherId"
);
int
ClassRoomId
=
base
.
ParmJObj
.
GetInt
(
"ClassRoomId"
);
int
ClassType
=
base
.
ParmJObj
.
GetInt
(
"ClassType"
);
//课程类型(0-全部,1-正常,2-试听课)
int
AppointState
=
base
.
ParmJObj
.
GetInt
(
"AppointState"
,
0
);
//约课状态 1待确认 2已确认
List
<
ExcelDataSource
>
slist
=
new
List
<
ExcelDataSource
>();
string
ExcelName
=
"老师上课计划统计"
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)
+
".xls"
;
if
(
string
.
IsNullOrEmpty
(
StartDate
)
||
string
.
IsNullOrEmpty
(
EndDate
))
{
var
byteData1
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData1
,
"application/octet-stream"
,
ExcelName
);
}
//正常上课计划列表
var
list
=
new
List
<
RB_Class_Plan_ViewModel
>();
//试听课列表
var
reserveList
=
new
List
<
Model
.
ViewModel
.
Reserve
.
RB_Reserve_Class_Extend
>();
//约课列表
var
appointList
=
new
List
<
Model
.
ViewModel
.
Scroll
.
RB_Scroll_Appointment_ViewModel
>();
var
timeList
=
new
List
<
RB_Class_Time_ViewModel
>();
var
guestList
=
new
List
<
RB_Order_Guest_ViewModel
>();
var
tempGuestList
=
new
List
<
RB_Order_Guest_ViewModel
>();
//2021-07-20 Add By:W临时上课邀请
var
visitorList
=
new
List
<
Model
.
ViewModel
.
Reserve
.
RB_Visitor_Reserve_Extend
>();
var
chatperList
=
new
List
<
RB_Course_Chapter_ViewModel
>();
List
<
RB_Teacher_ViewModel
>
TeacherList
=
new
List
<
RB_Teacher_ViewModel
>();
TeacherList
=
classModule
.
GetAppointmentPlanStatExport
(
StartDate
,
EndDate
,
TeacherId
,
ClassRoomId
,
ClassType
,
AppointState
,
base
.
UserInfo
.
Group_Id
,
out
list
,
out
reserveList
,
out
appointList
,
out
timeList
,
out
guestList
,
out
tempGuestList
,
out
visitorList
,
out
chatperList
);
try
{
ExcelDataSource
headerTimeLast
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
"姓名"
){
CellWidth
=
24
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"日期"
){
CellWidth
=
24
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"星期"
){
CellWidth
=
24
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"时间"
){
CellWidth
=
24
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"课程"
){
CellWidth
=
50
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"上课地点"
){
CellWidth
=
24
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
}
};
slist
.
Add
(
headerTimeLast
);
foreach
(
var
item
in
appointList
.
GroupBy
(
x
=>
x
.
GuestId
))
{
var
guestAppointList
=
appointList
.
Where
(
x
=>
x
.
GuestId
==
item
.
Key
).
OrderBy
(
x
=>
x
.
Date
);
foreach
(
var
itemGuest
in
guestAppointList
)
{
ExcelDataSource
rowGuest
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
itemGuest
.
StuName
){
CellWidth
=
24
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
itemGuest
.
Date
.
ToString
(
"MM月dd日"
)){
CellWidth
=
24
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
Common
.
ConvertHelper
.
GetWeekDay
(
itemGuest
.
Date
)){
CellWidth
=
24
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:(
itemGuest
.
CourseSTime
??
""
)+
"-"
+(
itemGuest
.
CourseETime
??
""
)){
CellWidth
=
24
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
itemGuest
.
CourseName
+
"-"
+
itemGuest
.
ChapterNo
){
CellWidth
=
50
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
itemGuest
.
RoomName
){
CellWidth
=
24
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
}
};
slist
.
Add
(
rowGuest
);
}
ExcelDataSource
rowKGuest
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
""
){
CellWidth
=
24
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
""
){
CellWidth
=
24
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
""
){
CellWidth
=
24
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
""
){
CellWidth
=
24
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
""
){
CellWidth
=
50
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
""
){
CellWidth
=
24
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
}
};
slist
.
Add
(
rowKGuest
);
}
var
byteData
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData
,
"application/octet-stream"
,
ExcelName
);
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"GetAppointmentPlanStatExcel"
);
var
byteData1
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData1
,
"application/octet-stream"
,
ExcelName
);
}
}
...
...
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