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
9bd4130f
Commit
9bd4130f
authored
Dec 07, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增验证
parent
ac578bf7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
6 deletions
+73
-6
RB_Class_Time_ViewModel.cs
Edu.Model/ViewModel/Course/RB_Class_Time_ViewModel.cs
+5
-0
RB_Class_ViewModel.cs
Edu.Model/ViewModel/Course/RB_Class_ViewModel.cs
+5
-0
ClassModule.cs
Edu.Module.Course/ClassModule.cs
+8
-4
RB_Class_TimeRepository.cs
Edu.Repository/Course/RB_Class_TimeRepository.cs
+25
-0
ClassController.cs
Edu.WebApi/Controllers/Course/ClassController.cs
+30
-2
No files found.
Edu.Model/ViewModel/Course/RB_Class_Time_ViewModel.cs
View file @
9bd4130f
...
...
@@ -16,5 +16,10 @@ namespace Edu.Model.ViewModel.Course
/// 班级编号【查询使用,逗号分隔】
/// </summary>
public
string
QClassIds
{
get
;
set
;
}
/// <summary>
/// 上课时间【日期+开始时间】
/// </summary>
public
string
NewPlanDateTime
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Model/ViewModel/Course/RB_Class_ViewModel.cs
View file @
9bd4130f
...
...
@@ -110,5 +110,10 @@ namespace Edu.Model.ViewModel.Course
/// 月份
/// </summary>
public
string
QMonth
{
get
;
set
;
}
/// <summary>
/// 具体开课时间
/// </summary>
public
string
NewPlanDateTime
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Module.Course/ClassModule.cs
View file @
9bd4130f
...
...
@@ -66,11 +66,15 @@ namespace Edu.Module.Course
var
list
=
classRepository
.
GetClassPageListRepository
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
);
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
string
ids
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
CouseId
));
var
classTimeList
=
new
List
<
RB_Class_Time_ViewModel
>();
string
ids
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
ClassId
));
if
(!
string
.
IsNullOrEmpty
(
ids
))
{
classTimeList
=
class_TimeRepository
.
GetClassTimeListRepository
(
ids
);
}
foreach
(
var
item
in
list
)
{
{
item
.
NewPlanDateTime
=
classTimeList
?.
Where
(
qitem
=>
qitem
.
ClassId
==
item
.
ClassId
)?.
FirstOrDefault
()?.
NewPlanDateTime
;
}
}
return
list
;
...
...
Edu.Repository/Course/RB_Class_TimeRepository.cs
View file @
9bd4130f
...
...
@@ -68,5 +68,30 @@ WHERE t.ClassId =1 GROUP BY t.ClassId,t.StartTime,t.EndTime";
return
Get
<
RB_Class_Time_ViewModel
>(
sql
).
ToList
();
}
/// <summary>
/// 获取班级上课时间
/// </summary>
/// <param name="classIds"></param>
/// <returns></returns>
public
List
<
RB_Class_Time_ViewModel
>
GetClassTimeListRepository
(
string
classIds
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.ClassId,DATE_FORMAT(MIN(A.NewPlanDateTime),'%Y-%m-%d %h:%i') AS NewPlanDateTime FROM
(
SELECT A.ClassPlanId,A.ClassId,A.ClassDate,A.`Status`,A.ClassRoomId,A.Group_Id,A.School_Id,A.TeacherId,B.ClassTimeId,B.StartTime,B.EndTime
,CONCAT( DATE_FORMAT(A.ClassDate,'%Y-%m-%d') ,' ',B.StartTime,':00') AS NewPlanDateTime
FROM rb_class_plan AS A INNER JOIN rb_class_time AS B ON A.ClassPlanId=B.ClassPlanId
) AS A
WHERE 1=1
"
);
if
(!
string
.
IsNullOrEmpty
(
classIds
))
{
builder
.
AppendFormat
(
" AND A.ClassId IN({0}) "
,
classIds
);
}
builder
.
AppendFormat
(
" GROUP BY A.ClassId "
);
return
Get
<
RB_Class_Time_ViewModel
>(
builder
.
ToString
()).
ToList
();
}
}
}
Edu.WebApi/Controllers/Course/ClassController.cs
View file @
9bd4130f
...
...
@@ -67,6 +67,7 @@ namespace Edu.WebApi.Controllers.Course
OpenTime
=
Common
.
ConvertHelper
.
FormatDate
(
item
.
OpenTime
),
item
.
CompleteProgress
,
ClassStatusStr
=
item
.
ClassStatus
.
ToName
(),
item
.
NewPlanDateTime
,
});
}
pageModel
.
Count
=
rowsCount
;
...
...
@@ -168,11 +169,15 @@ namespace Edu.WebApi.Controllers.Course
string
message
=
""
;
if
(!
Common
.
ConvertHelper
.
IsTime
(
item
.
StartTime
+
":00"
))
{
message
=
"【"
+
item
.
StartTime
+
"】格式不正确!(
格式参考 11:3
0)"
;
message
=
"【"
+
item
.
StartTime
+
"】格式不正确!(
参考格式为 00:0
0)"
;
}
if
(!
Common
.
ConvertHelper
.
IsTime
(
item
.
EndTime
+
":00"
))
{
message
+=
",【"
+
item
.
EndTime
+
"】格式不正确!(格式参考 08:10)"
;
if
(!
string
.
IsNullOrEmpty
(
message
))
{
message
+=
","
;
}
message
+=
"【"
+
item
.
EndTime
+
"】格式不正确!(参考格式为 00:00)"
;
}
if
(!
string
.
IsNullOrEmpty
(
message
))
{
...
...
@@ -263,6 +268,29 @@ namespace Edu.WebApi.Controllers.Course
{
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
"SetClassPlan_PlanTimeList"
);
}
if
(
extModel
.
PlanTimeList
!=
null
&&
extModel
.
PlanTimeList
.
Count
>
0
)
{
foreach
(
var
item
in
extModel
.
PlanTimeList
)
{
string
message
=
""
;
if
(!
Common
.
ConvertHelper
.
IsTime
(
item
.
StartTime
+
":00"
))
{
message
=
"【"
+
item
.
StartTime
+
"】格式不正确!(参考格式为 00:00)"
;
}
if
(!
Common
.
ConvertHelper
.
IsTime
(
item
.
EndTime
+
":00"
))
{
if
(!
string
.
IsNullOrEmpty
(
message
))
{
message
+=
","
;
}
message
+=
"【"
+
item
.
EndTime
+
"】格式不正确!(参考格式为 00:00)"
;
}
if
(!
string
.
IsNullOrEmpty
(
message
))
{
return
ApiResult
.
ParamIsNull
(
message
:
message
);
}
}
}
var
flag
=
classModule
.
SetClassPlanModule
(
extModel
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
...
...
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