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
c9a2f25d
Commit
c9a2f25d
authored
Jul 06, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
31423f8b
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
136 additions
and
106 deletions
+136
-106
RB_Class_Check.cs
Edu.Model/Entity/Course/RB_Class_Check.cs
+1
-1
RB_Class_Time.cs
Edu.Model/Entity/Course/RB_Class_Time.cs
+5
-0
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
+66
-28
OrderModule.cs
Edu.Module.Course/OrderModule.cs
+1
-1
RB_Class_CheckRepository.cs
Edu.Repository/Course/RB_Class_CheckRepository.cs
+2
-42
RB_Class_TimeRepository.cs
Edu.Repository/Course/RB_Class_TimeRepository.cs
+1
-1
ClassController.cs
Edu.WebApi/Controllers/Course/ClassController.cs
+48
-31
ClassRoomController.cs
Edu.WebApi/Controllers/Course/ClassRoomController.cs
+1
-1
OrderController.cs
Edu.WebApi/Controllers/Course/OrderController.cs
+1
-1
No files found.
Edu.Model/Entity/Course/RB_Class_Check.cs
View file @
c9a2f25d
...
@@ -64,7 +64,7 @@ namespace Edu.Model.Entity.Course
...
@@ -64,7 +64,7 @@ namespace Edu.Model.Entity.Course
/// <summary>
/// <summary>
/// 0-正常,1-缺席 签到状态
/// 0-正常,1-缺席
,2-请假
签到状态
/// </summary>
/// </summary>
public
int
CheckStatus
{
get
;
set
;
}
public
int
CheckStatus
{
get
;
set
;
}
...
...
Edu.Model/Entity/Course/RB_Class_Time.cs
View file @
c9a2f25d
...
@@ -69,5 +69,10 @@ namespace Edu.Model.Entity.Course
...
@@ -69,5 +69,10 @@ namespace Edu.Model.Entity.Course
/// 课堂视频
/// 课堂视频
/// </summary>
/// </summary>
public
string
VideoUrl
{
get
;
set
;
}
public
string
VideoUrl
{
get
;
set
;
}
/// <summary>
/// 消耗课时
/// </summary>
public
decimal
TimeHour
{
get
;
set
;
}
}
}
}
}
Edu.Model/ViewModel/Course/RB_Class_Time_ViewModel.cs
View file @
c9a2f25d
...
@@ -49,5 +49,10 @@ namespace Edu.Model.ViewModel.Course
...
@@ -49,5 +49,10 @@ namespace Edu.Model.ViewModel.Course
/// 教室id
/// 教室id
/// </summary>
/// </summary>
public
int
ClassRoomId
{
get
;
set
;
}
public
int
ClassRoomId
{
get
;
set
;
}
/// <summary>
/// 上课分钟数
/// </summary>
public
int
TimeMinute
{
get
;
set
;
}
}
}
}
}
\ No newline at end of file
Edu.Model/ViewModel/Course/RB_Class_ViewModel.cs
View file @
c9a2f25d
...
@@ -249,5 +249,10 @@ namespace Edu.Model.ViewModel.Course
...
@@ -249,5 +249,10 @@ namespace Edu.Model.ViewModel.Course
/// 结束时间
/// 结束时间
/// </summary>
/// </summary>
public
string
EndTime
{
get
;
set
;
}
public
string
EndTime
{
get
;
set
;
}
/// <summary>
/// 消耗课时
/// </summary>
public
decimal
TimeHour
{
get
;
set
;
}
}
}
}
}
\ No newline at end of file
Edu.Module.Course/ClassModule.cs
View file @
c9a2f25d
...
@@ -181,7 +181,7 @@ namespace Edu.Module.Course
...
@@ -181,7 +181,7 @@ namespace Edu.Module.Course
/// </summary>
/// </summary>
/// <param name="query"></param>
/// <param name="query"></param>
/// <returns></returns>
/// <returns></returns>
public
List
<
RB_Class_Time_ViewModel
>
GetClassTimeList
Repository
(
RB_Class_Time_ViewModel
query
)
public
List
<
RB_Class_Time_ViewModel
>
GetClassTimeList
Module
(
RB_Class_Time_ViewModel
query
)
{
{
return
class_TimeRepository
.
GetClassTimeListRepository
(
query
);
return
class_TimeRepository
.
GetClassTimeListRepository
(
query
);
}
}
...
@@ -470,6 +470,7 @@ namespace Edu.Module.Course
...
@@ -470,6 +470,7 @@ namespace Edu.Module.Course
#
region
班级计划
#
region
班级计划
//默认上课时间
//默认上课时间
var
defaultPlanTimeList
=
new
List
<
ClassTimeItem
>();
var
defaultPlanTimeList
=
new
List
<
ClassTimeItem
>();
var
BasicMinutes
=
class_ConfigRepository
.
GetBasicMinutesRepository
(
model
.
Group_Id
);
foreach
(
var
tItem
in
model
.
DefaultTimeList
)
foreach
(
var
tItem
in
model
.
DefaultTimeList
)
{
{
ClassTimeItem
tModel
=
new
ClassTimeItem
()
ClassTimeItem
tModel
=
new
ClassTimeItem
()
...
@@ -480,17 +481,26 @@ namespace Edu.Module.Course
...
@@ -480,17 +481,26 @@ namespace Edu.Module.Course
tModel
.
DateList
=
tItem
.
DateList
;
tModel
.
DateList
=
tItem
.
DateList
;
foreach
(
var
subItem
in
tItem
.
TimeList
)
foreach
(
var
subItem
in
tItem
.
TimeList
)
{
{
tModel
.
TimeList
.
Add
(
new
TimeItem
()
var
startDate
=
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
subItem
.
StartTime
+
":00"
);
var
endDate
=
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
subItem
.
EndTime
+
":00"
);
TimeSpan
span
=
endDate
.
Subtract
(
startDate
);
var
timeModel
=
new
TimeItem
()
{
{
StartTime
=
subItem
.
StartTime
,
StartTime
=
subItem
.
StartTime
,
EndTime
=
subItem
.
EndTime
EndTime
=
subItem
.
EndTime
,
});
TimeHour
=
subItem
.
TimeHour
,
};
if
(
timeModel
.
TimeHour
<=
0
)
{
timeModel
.
TimeHour
=
Convert
.
ToDecimal
(
span
.
TotalMinutes
/
BasicMinutes
);
}
tModel
.
TimeList
.
Add
(
timeModel
);
defaultPlanTimeList
.
Add
(
tModel
);
defaultPlanTimeList
.
Add
(
tModel
);
}
}
}
}
//班级上课计划列表
//班级上课计划列表
List
<
RB_Class_Plan_ViewModel
>
classPlanList
=
CreateClassPlanList
(
model
,
defaultPlanTimeList
);
List
<
RB_Class_Plan_ViewModel
>
classPlanList
=
CreateClassPlanList
(
model
,
defaultPlanTimeList
,
BasicMinutes
);
model
.
ClassPlanList
=
classPlanList
;
model
.
ClassPlanList
=
classPlanList
;
AddClassPlanModule
(
model
);
AddClassPlanModule
(
model
);
#
endregion
#
endregion
...
@@ -593,6 +603,17 @@ namespace Edu.Module.Course
...
@@ -593,6 +603,17 @@ namespace Edu.Module.Course
return
class_ConfigRepository
.
GetClassMinutesRepository
(
classId
);
return
class_ConfigRepository
.
GetClassMinutesRepository
(
classId
);
}
}
/// <summary>
/// 获取基础课时分钟数
/// </summary>
/// <param name="Group_Id"></param>
/// <returns></returns>
public
int
GetBasicMinutesModule
(
int
Group_Id
)
{
var
BasicMinutes
=
class_ConfigRepository
.
GetBasicMinutesRepository
(
Group_Id
);
return
BasicMinutes
;
}
/// <summary>
/// <summary>
/// 更新班级结课日期
/// 更新班级结课日期
/// </summary>
/// </summary>
...
@@ -607,8 +628,10 @@ namespace Edu.Module.Course
...
@@ -607,8 +628,10 @@ namespace Edu.Module.Course
/// 生成班级上课计划表
/// 生成班级上课计划表
/// </summary>
/// </summary>
/// <param name="model"></param>
/// <param name="model"></param>
/// <param name="defaultPlanTimeList"></param>
/// <param name="BasicMinutes"></param>
/// <returns></returns>
/// <returns></returns>
private
List
<
RB_Class_Plan_ViewModel
>
CreateClassPlanList
(
RB_Class_ViewModel
model
,
List
<
ClassTimeItem
>
defaultPlanTimeList
)
private
List
<
RB_Class_Plan_ViewModel
>
CreateClassPlanList
(
RB_Class_ViewModel
model
,
List
<
ClassTimeItem
>
defaultPlanTimeList
,
int
BasicMinutes
)
{
{
var
planList
=
class_PlanRepository
.
GetClassPlanListRepository
(
new
RB_Class_Plan_ViewModel
()
{
ClassId
=
model
.
ClassId
,
StartTime
=
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
});
var
planList
=
class_PlanRepository
.
GetClassPlanListRepository
(
new
RB_Class_Plan_ViewModel
()
{
ClassId
=
model
.
ClassId
,
StartTime
=
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
});
if
(
planList
!=
null
&&
planList
.
Count
>
0
)
if
(
planList
!=
null
&&
planList
.
Count
>
0
)
...
@@ -624,7 +647,7 @@ namespace Edu.Module.Course
...
@@ -624,7 +647,7 @@ namespace Edu.Module.Course
if
(
model
.
ClassHours
>
0
)
if
(
model
.
ClassHours
>
0
)
{
{
var
srartDate
=
model
.
OpenTime
;
var
srartDate
=
model
.
OpenTime
;
var
BasicMinutes
=
class_ConfigRepository
.
GetBasicMinutesRepository
(
model
.
Group_Id
);
//按周排课和按月排课
//按周排课和按月排课
if
(
model
.
ClassStyle
==
ClassStyleEnum
.
Week
||
model
.
ClassStyle
==
ClassStyleEnum
.
Month
)
if
(
model
.
ClassStyle
==
ClassStyleEnum
.
Week
||
model
.
ClassStyle
==
ClassStyleEnum
.
Month
)
{
{
...
@@ -799,11 +822,14 @@ namespace Edu.Module.Course
...
@@ -799,11 +822,14 @@ namespace Edu.Module.Course
double
dayMinutes
=
0
;
double
dayMinutes
=
0
;
foreach
(
var
sItem
in
timeList
)
foreach
(
var
sItem
in
timeList
)
{
{
classTimeList
.
Add
(
new
RB_Class_Time_ViewModel
()
var
timeModel
=
new
RB_Class_Time_ViewModel
()
{
{
StartTime
=
sItem
.
StartTime
,
StartTime
=
sItem
.
StartTime
,
EndTime
=
sItem
.
EndTime
EndTime
=
sItem
.
EndTime
,
});
TimeHour
=
sItem
.
TimeHour
,
};
classTimeList
.
Add
(
timeModel
);
var
startDate
=
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
sItem
.
StartTime
+
":00"
);
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"
);
var
endDate
=
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
sItem
.
EndTime
+
":00"
);
TimeSpan
span
=
endDate
.
Subtract
(
startDate
);
TimeSpan
span
=
endDate
.
Subtract
(
startDate
);
...
@@ -812,6 +838,7 @@ namespace Edu.Module.Course
...
@@ -812,6 +838,7 @@ namespace Edu.Module.Course
dayMinutes
+=
span
.
TotalMinutes
;
dayMinutes
+=
span
.
TotalMinutes
;
}
}
}
}
if
(
model
.
ClassHourMinute
>
0
)
if
(
model
.
ClassHourMinute
>
0
)
{
{
dayClassHours
=
dayMinutes
/
model
.
ClassHourMinute
;
dayClassHours
=
dayMinutes
/
model
.
ClassHourMinute
;
...
@@ -929,6 +956,7 @@ namespace Edu.Module.Course
...
@@ -929,6 +956,7 @@ namespace Edu.Module.Course
subItem
.
ClassTimeId
,
subItem
.
ClassTimeId
,
subItem
.
StartTime
,
subItem
.
StartTime
,
subItem
.
EndTime
,
subItem
.
EndTime
,
subItem
.
TimeHour
,
CheckNum
=
tempCheckList
?.
Where
(
qitem
=>
qitem
.
CheckStatus
==
0
)?.
Count
(),
CheckNum
=
tempCheckList
?.
Where
(
qitem
=>
qitem
.
CheckStatus
==
0
)?.
Count
(),
NoCheckNum
=
tempCheckList
?.
Where
(
qitem
=>
qitem
.
CheckStatus
==
1
)?.
Count
(),
NoCheckNum
=
tempCheckList
?.
Where
(
qitem
=>
qitem
.
CheckStatus
==
1
)?.
Count
(),
});
});
...
@@ -1348,12 +1376,10 @@ namespace Edu.Module.Course
...
@@ -1348,12 +1376,10 @@ namespace Edu.Module.Course
var
BasicMinutes
=
0
;
var
BasicMinutes
=
0
;
//BasicMinutes = class_ConfigRepository.GetBasicMinutesRepository(list[0].Group_Id);
//BasicMinutes = class_ConfigRepository.GetBasicMinutesRepository(list[0].Group_Id);
BasicMinutes
=
class_ConfigRepository
.
GetClassMinutesRepository
(
list
[
0
].
ClassId
);
BasicMinutes
=
class_ConfigRepository
.
GetClassMinutesRepository
(
list
[
0
].
ClassId
);
var
t
otalMinutes
=
classCheckRepository
.
CalcPlanMinutesRepository
(
new
RB_Class_Plan
_ViewModel
()
var
t
imeModel
=
class_TimeRepository
.
GetClassTimeListRepository
(
new
RB_Class_Time
_ViewModel
()
{
{
ClassId
=
list
[
0
].
ClassId
,
ClassDate
=
list
[
0
].
ClassDate
,
ClassTimeId
=
list
[
0
].
ClassTimeId
ClassTimeId
=
list
[
0
].
ClassTimeId
});
})
?.
FirstOrDefault
()
;
//写日志
//写日志
bool
flag
=
true
;
bool
flag
=
true
;
foreach
(
var
item
in
list
)
foreach
(
var
item
in
list
)
...
@@ -1361,7 +1387,7 @@ namespace Edu.Module.Course
...
@@ -1361,7 +1387,7 @@ namespace Edu.Module.Course
if
(
flag
)
if
(
flag
)
{
{
var
guestModel
=
order_GuestRepository
.
GetEntity
(
item
.
OrderGuestId
);
var
guestModel
=
order_GuestRepository
.
GetEntity
(
item
.
OrderGuestId
);
item
.
CurrentDeductionHours
=
t
otalMinutes
/
BasicMinutes
;
item
.
CurrentDeductionHours
=
t
imeModel
?.
TimeHour
??
0
;
if
(
item
.
ClassCheckId
>
0
)
if
(
item
.
ClassCheckId
>
0
)
{
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
...
@@ -1386,21 +1412,17 @@ namespace Edu.Module.Course
...
@@ -1386,21 +1412,17 @@ namespace Edu.Module.Course
var
oldModel
=
classCheckRepository
.
GetGuestFinishMinutesRepository
(
item
.
OrderGuestId
.
ToString
(),
ClassCheckId
:
item
.
ClassCheckId
)?.
FirstOrDefault
();
var
oldModel
=
classCheckRepository
.
GetGuestFinishMinutesRepository
(
item
.
OrderGuestId
.
ToString
(),
ClassCheckId
:
item
.
ClassCheckId
)?.
FirstOrDefault
();
if
(
flag
)
if
(
flag
)
{
{
//缺勤
//更新学员完成课时
if
(
item
.
CheckStatus
==
1
)
var
completeHours
=
(
oldModel
?.
FinishClassHours
??
0
)
+
item
.
CurrentDeductionHours
;
Dictionary
<
string
,
object
>
orderFileds
=
new
Dictionary
<
string
,
object
>()
{
{
flag
=
CalcGuestHoursModule
(
guestModel
,
item
);
{
nameof
(
RB_Order_Guest_ViewModel
.
CompleteHours
),
completeHours
}
}
};
//出勤
flag
=
order_GuestRepository
.
Update
(
orderFileds
,
new
WhereHelper
(
nameof
(
RB_Order_Guest_ViewModel
.
Id
),
item
.
OrderGuestId
));
else
//缺勤和请假
if
(
item
.
CheckStatus
==
1
||
item
.
CheckStatus
==
2
)
{
{
//更新学员完成课时
flag
=
CalcGuestHoursModule
(
guestModel
,
item
);
var
completeHours
=
(
oldModel
?.
FinishClassHours
??
0
)
+
item
.
CurrentDeductionHours
;
Dictionary
<
string
,
object
>
orderFileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Order_Guest_ViewModel
.
CompleteHours
),
completeHours
}
};
flag
=
order_GuestRepository
.
Update
(
orderFileds
,
new
WhereHelper
(
nameof
(
RB_Order_Guest_ViewModel
.
Id
),
item
.
OrderGuestId
));
}
}
}
}
}
}
...
@@ -2242,6 +2264,22 @@ namespace Edu.Module.Course
...
@@ -2242,6 +2264,22 @@ namespace Edu.Module.Course
return
flag
;
return
flag
;
}
}
/// <summary>
/// 更新上课计划中的课时数
/// </summary>
/// <param name="ClassTimeId"></param>
/// <param name="TimeHour"></param>
/// <returns></returns>
public
bool
UpdateClassPlanTimeModule
(
int
ClassTimeId
,
decimal
TimeHour
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Class_Time
.
TimeHour
),
TimeHour
},
};
var
flag
=
class_TimeRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Class_Time
.
ClassTimeId
),
ClassTimeId
));
return
flag
;
}
#
region
班级课程关联管理
#
region
班级课程关联管理
/// <summary>
/// <summary>
...
...
Edu.Module.Course/OrderModule.cs
View file @
c9a2f25d
...
@@ -231,7 +231,7 @@ namespace Edu.Module.Course
...
@@ -231,7 +231,7 @@ namespace Edu.Module.Course
/// <param name="classId">班级编号</param>
/// <param name="classId">班级编号</param>
/// <param name="Group_Id">集团编号</param>
/// <param name="Group_Id">集团编号</param>
/// <returns></returns>
/// <returns></returns>
public
Dictionary
<
string
,
object
>
GetClassCourseListModule
(
int
classId
,
int
Group_Id
)
public
Dictionary
<
string
,
object
>
GetClassCourseListModule
(
int
classId
)
{
{
List
<
object
>
newCourseList
=
new
List
<
object
>();
List
<
object
>
newCourseList
=
new
List
<
object
>();
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>();
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>();
...
...
Edu.Repository/Course/RB_Class_CheckRepository.cs
View file @
c9a2f25d
...
@@ -155,7 +155,7 @@ WHERE 1=1 AND `Status` =0 and CheckStatus =0 ");
...
@@ -155,7 +155,7 @@ WHERE 1=1 AND `Status` =0 and CheckStatus =0 ");
builder
.
AppendFormat
(
@"
builder
.
AppendFormat
(
@"
SELECT A.OrderGuestId AS GuestId,SUM(A.StudyNum) AS FinishMinutes,SUM(A.CurrentDeductionHours) AS FinishClassHours
SELECT A.OrderGuestId AS GuestId,SUM(A.StudyNum) AS FinishMinutes,SUM(A.CurrentDeductionHours) AS FinishClassHours
FROM rb_class_check AS A
FROM rb_class_check AS A
WHERE A.
CheckStatus=0
"
);
WHERE A.
`Status`=0
"
);
if
(!
string
.
IsNullOrEmpty
(
guestIds
))
if
(!
string
.
IsNullOrEmpty
(
guestIds
))
{
{
builder
.
AppendFormat
(
" AND A.OrderGuestId IN({0})"
,
guestIds
);
builder
.
AppendFormat
(
" AND A.OrderGuestId IN({0})"
,
guestIds
);
...
@@ -168,47 +168,7 @@ WHERE A.CheckStatus=0 ");
...
@@ -168,47 +168,7 @@ WHERE A.CheckStatus=0 ");
return
Get
<
GuestFinishMinute_ViewModel
>(
builder
.
ToString
()).
ToList
();
return
Get
<
GuestFinishMinute_ViewModel
>(
builder
.
ToString
()).
ToList
();
}
}
/// <summary>
/// <summary>
/// 计算上课计划分钟数
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
int
CalcPlanMinutesRepository
(
RB_Class_Plan_ViewModel
query
)
{
int
result
=
0
;
string
where
=
""
;
if
(
query
.
ClassId
>
0
)
{
where
+=
string
.
Format
(
" AND B.ClassId={0} "
,
query
.
ClassId
);
}
if
(
query
.
ClassDate
!=
null
)
{
where
+=
string
.
Format
(
" AND B.ClassDate='{0}' "
,
query
.
ClassDate
);
}
if
(
query
.
ClassTimeId
>
0
)
{
where
+=
string
.
Format
(
" AND C.ClassTimeId='{0}' "
,
query
.
ClassTimeId
);
}
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT SUM(FinishMinutes)
FROM
(
SELECT TIMESTAMPDIFF(MINUTE,(DATE_FORMAT(CONCAT('2021-01-01 ',C.StartTime,':00'),'%Y-%m-%d %H:%i')),(DATE_FORMAT(CONCAT('2021-01-01 ',C.EndTime,':00'), '%Y-%m-%d %H:%i'))) AS FinishMinutes
FROM rb_class_plan AS B INNER JOIN rb_class_time AS C ON B.ClassPlanId=C.ClassPlanId
WHERE 1=1 AND B.`Status`=0 {0}
) AS A
"
,
where
);
var
obj
=
base
.
ExecuteScalar
(
builder
.
ToString
());
if
(
obj
!=
null
)
{
Int32
.
TryParse
(
obj
.
ToString
(),
out
result
);
}
return
result
;
}
/// <summary>
/// 班级签到完成学习分钟数
/// 班级签到完成学习分钟数
/// </summary>
/// </summary>
/// <param name="classIds">班级编号</param>
/// <param name="classIds">班级编号</param>
...
...
Edu.Repository/Course/RB_Class_TimeRepository.cs
View file @
c9a2f25d
...
@@ -21,7 +21,7 @@ namespace Edu.Repository.Course
...
@@ -21,7 +21,7 @@ namespace Edu.Repository.Course
{
{
StringBuilder
builder
=
new
StringBuilder
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
builder
.
AppendFormat
(
@"
SELECT *
SELECT *
,TIMESTAMPDIFF(MINUTE,(DATE_FORMAT(CONCAT('2021-01-01 ',StartTime,':00'),'%Y-%m-%d %H:%i')),(DATE_FORMAT(CONCAT('2021-01-01 ',EndTime,':00'), '%Y-%m-%d %H:%i'))) AS TimeMinute
FROM RB_Class_Time
FROM RB_Class_Time
WHERE 1=1
WHERE 1=1
"
);
"
);
...
...
Edu.WebApi/Controllers/Course/ClassController.cs
View file @
c9a2f25d
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Edu.Cache.User
;
using
Edu.Cache.User
;
using
Edu.Common.API
;
using
Edu.Common.API
;
using
Edu.Common.Enum.Course
;
using
Edu.Common.Enum.Course
;
...
@@ -297,6 +298,13 @@ namespace Edu.WebApi.Controllers.Course
...
@@ -297,6 +298,13 @@ namespace Edu.WebApi.Controllers.Course
}
}
message
+=
"【"
+
item
.
EndTime
+
"】格式不正确!(参考格式为 00:00)"
;
message
+=
"【"
+
item
.
EndTime
+
"】格式不正确!(参考格式为 00:00)"
;
}
}
var
startDate
=
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
item
.
StartTime
+
":00"
);
var
endDate
=
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
item
.
EndTime
+
":00"
);
TimeSpan
span
=
endDate
.
Subtract
(
startDate
);
if
(
item
.
TimeHour
<=
0
)
{
item
.
TimeHour
=
Convert
.
ToDecimal
(
span
.
TotalMinutes
/
classModule
.
GetBasicMinutesModule
(
extModel
.
Group_Id
));
}
if
(!
string
.
IsNullOrEmpty
(
message
))
if
(!
string
.
IsNullOrEmpty
(
message
))
{
{
return
ApiResult
.
ParamIsNull
(
message
:
message
);
return
ApiResult
.
ParamIsNull
(
message
:
message
);
...
@@ -347,39 +355,53 @@ namespace Edu.WebApi.Controllers.Course
...
@@ -347,39 +355,53 @@ namespace Edu.WebApi.Controllers.Course
[
HttpPost
]
[
HttpPost
]
public
ApiResult
InitClassTime
()
public
ApiResult
InitClassTime
()
{
{
bool
flag
=
false
;
var
list
=
classModule
.
GetClassListModule
(
new
RB_Class_ViewModel
());
var
list
=
classModule
.
GetClassListModule
(
new
RB_Class_ViewModel
());
foreach
(
var
item
in
list
)
foreach
(
var
item
in
list
)
{
{
List
<
string
>
dateList
=
new
List
<
string
>();
List
<
ClassTimeItem
>
dateList
=
new
List
<
ClassTimeItem
>();
if
(!
string
.
IsNullOrEmpty
(
item
.
D
at
eJson
))
if
(!
string
.
IsNullOrEmpty
(
item
.
D
efaultTim
eJson
))
{
{
dateList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
string
>>(
item
.
Dat
eJson
);
dateList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
ClassTimeItem
>>(
item
.
DefaultTim
eJson
);
}
}
if
(
dateList
!=
null
&&
dateList
.
Count
>
0
&&
!
string
.
IsNullOrEmpty
(
item
.
DefaultTimeJson
)
)
foreach
(
var
jItem
in
dateList
)
{
{
ClassTimeItem
model
=
new
ClassTimeItem
()
if
(
jItem
.
TimeList
!=
null
&&
jItem
.
TimeList
.
Count
>
0
)
{
DateList
=
new
List
<
string
>(),
TimeList
=
new
List
<
TimeItem
>(),
};
model
.
DateList
=
dateList
;
JArray
jArray
=
JArray
.
Parse
(
item
.
DefaultTimeJson
);
foreach
(
var
jItem
in
jArray
)
{
{
JObject
jobj
=
JObject
.
Parse
(
jItem
.
ToString
());
foreach
(
var
sItem
in
jItem
.
TimeList
)
model
.
TimeList
.
Add
(
new
TimeItem
()
{
{
StartTime
=
jobj
[
"StartTime"
].
ToString
(),
var
startDate
=
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
sItem
.
StartTime
+
":00"
);
EndTime
=
jobj
[
"EndTime"
].
ToString
(),
var
endDate
=
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
sItem
.
EndTime
+
":00"
);
});
TimeSpan
span
=
endDate
.
Subtract
(
startDate
);
if
(
sItem
.
TimeHour
<=
0
)
{
sItem
.
TimeHour
=
Convert
.
ToDecimal
(
span
.
TotalMinutes
/
classModule
.
GetBasicMinutesModule
(
item
.
Group_Id
));
}
}
}
}
List
<
ClassTimeItem
>
slist
=
new
List
<
ClassTimeItem
>
{
model
};
bool
flag
=
classModule
.
UpdateClassTimeModule
(
item
.
ClassId
,
Common
.
Plugin
.
JsonHelper
.
Serialize
(
slist
));
}
}
flag
=
classModule
.
UpdateClassTimeModule
(
item
.
ClassId
,
Common
.
Plugin
.
JsonHelper
.
Serialize
(
dateList
));
}
}
var
classTimeList
=
classModule
.
GetClassTimeListModule
(
new
RB_Class_Time_ViewModel
());
int
basicMintues
=
classModule
.
GetBasicMinutesModule
(
classTimeList
[
0
].
Group_Id
);
Task
.
Run
(()
=>
{
foreach
(
var
item
in
classTimeList
)
{
var
startDate
=
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
item
.
StartTime
+
":00"
);
var
endDate
=
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
item
.
EndTime
+
":00"
);
TimeSpan
span
=
endDate
.
Subtract
(
startDate
);
if
(
span
.
TotalMinutes
%
basicMintues
==
0
)
{
item
.
TimeHour
=
Convert
.
ToDecimal
(
span
.
TotalMinutes
/
basicMintues
);
}
if
(
item
.
TimeHour
>
0
)
{
flag
=
classModule
.
UpdateClassPlanTimeModule
(
item
.
ClassTimeId
,
item
.
TimeHour
);
}
}
});
return
ApiResult
.
Success
();
return
ApiResult
.
Success
();
}
}
...
@@ -596,9 +618,6 @@ namespace Edu.WebApi.Controllers.Course
...
@@ -596,9 +618,6 @@ namespace Edu.WebApi.Controllers.Course
#
endregion
#
endregion
#
region
上课计划
#
region
上课计划
/// <summary>
/// <summary>
/// 获取上课计划
/// 获取上课计划
/// </summary>
/// </summary>
...
@@ -750,7 +769,7 @@ namespace Edu.WebApi.Controllers.Course
...
@@ -750,7 +769,7 @@ namespace Edu.WebApi.Controllers.Course
return
ApiResult
.
Failed
(
"数据不存在"
);
return
ApiResult
.
Failed
(
"数据不存在"
);
}
}
double
totalMinutes
=
0
;
double
totalMinutes
=
0
;
var
planTimeList
=
classModule
.
GetClassTimeList
Repository
(
new
RB_Class_Time_ViewModel
{
ClassId
=
classId
,
ClassPlanId
=
classPlanId
,
Group_Id
=
base
.
UserInfo
.
Group_Id
,
School_Id
=
schoolId
,
ClassTimeId
=
ClassTimeId
});
var
planTimeList
=
classModule
.
GetClassTimeList
Module
(
new
RB_Class_Time_ViewModel
{
ClassId
=
classId
,
ClassPlanId
=
classPlanId
,
Group_Id
=
base
.
UserInfo
.
Group_Id
,
School_Id
=
schoolId
,
ClassTimeId
=
ClassTimeId
});
if
(
planTimeList
!=
null
&&
planTimeList
.
Any
())
if
(
planTimeList
!=
null
&&
planTimeList
.
Any
())
{
{
foreach
(
var
item
in
planTimeList
)
foreach
(
var
item
in
planTimeList
)
...
@@ -1302,7 +1321,7 @@ namespace Edu.WebApi.Controllers.Course
...
@@ -1302,7 +1321,7 @@ namespace Edu.WebApi.Controllers.Course
{
{
return
ApiResult
.
Failed
(
"班级上课计划不存在"
);
return
ApiResult
.
Failed
(
"班级上课计划不存在"
);
}
}
var
planTiemList
=
classModule
.
GetClassTimeList
Repository
(
new
RB_Class_Time_ViewModel
{
Group_Id
=
base
.
UserInfo
.
Group_Id
,
ClassId
=
extModel
.
ClassId
,
ClassPlanId
=
extModel
.
ClassPlanId
});
var
planTiemList
=
classModule
.
GetClassTimeList
Module
(
new
RB_Class_Time_ViewModel
{
Group_Id
=
base
.
UserInfo
.
Group_Id
,
ClassId
=
extModel
.
ClassId
,
ClassPlanId
=
extModel
.
ClassPlanId
});
model
.
TeacherName
=
planDate
.
TeacherName
;
model
.
TeacherName
=
planDate
.
TeacherName
;
model
.
WorkDate
=
planDate
.
ClassDate
.
ToString
(
"yyyy年MM月dd日"
);
model
.
WorkDate
=
planDate
.
ClassDate
.
ToString
(
"yyyy年MM月dd日"
);
model
.
WeekStr
=
StringHelper
.
GetJapanWeekChar
(
planDate
.
ClassDate
);
model
.
WeekStr
=
StringHelper
.
GetJapanWeekChar
(
planDate
.
ClassDate
);
...
@@ -1480,11 +1499,9 @@ namespace Edu.WebApi.Controllers.Course
...
@@ -1480,11 +1499,9 @@ namespace Edu.WebApi.Controllers.Course
/// <returns></returns>
/// <returns></returns>
public
ApiResult
GetTeacherPlan
()
public
ApiResult
GetTeacherPlan
()
{
{
var
query
=
new
RB_Class_ViewModel
()
var
query
=
new
RB_Class_ViewModel
()
{
{
Group_Id
=
base
.
UserInfo
.
Group_Id
,
Group_Id
=
base
.
UserInfo
.
Group_Id
,
// School_Id = base.ParmJObj.GetInt("School_Id", 0),
Teacher_Id
=
base
.
ParmJObj
.
GetInt
(
"Teacher_Id"
,
0
),
Teacher_Id
=
base
.
ParmJObj
.
GetInt
(
"Teacher_Id"
,
0
),
StartTime
=
base
.
ParmJObj
.
GetStringValue
(
"StartTime"
),
StartTime
=
base
.
ParmJObj
.
GetStringValue
(
"StartTime"
),
EndTime
=
base
.
ParmJObj
.
GetStringValue
(
"EndTime"
),
EndTime
=
base
.
ParmJObj
.
GetStringValue
(
"EndTime"
),
...
@@ -1858,7 +1875,7 @@ namespace Edu.WebApi.Controllers.Course
...
@@ -1858,7 +1875,7 @@ namespace Edu.WebApi.Controllers.Course
{
{
return
ApiResult
.
Failed
(
"请传入上课时间Id"
);
return
ApiResult
.
Failed
(
"请传入上课时间Id"
);
}
}
var
oldModel
=
classModule
.
GetClassTimeList
Repository
(
new
RB_Class_Time_ViewModel
{
ClassTimeId
=
extModel
.
ClassTimeId
,
Group_Id
=
base
.
UserInfo
.
Group_Id
}).
FirstOrDefault
();
var
oldModel
=
classModule
.
GetClassTimeList
Module
(
new
RB_Class_Time_ViewModel
{
ClassTimeId
=
extModel
.
ClassTimeId
,
Group_Id
=
base
.
UserInfo
.
Group_Id
}).
FirstOrDefault
();
if
(
oldModel
==
null
||
oldModel
.
ClassTimeId
==
0
)
if
(
oldModel
==
null
||
oldModel
.
ClassTimeId
==
0
)
{
{
return
ApiResult
.
Failed
(
"上课计划不存在"
);
return
ApiResult
.
Failed
(
"上课计划不存在"
);
...
@@ -1885,7 +1902,7 @@ namespace Edu.WebApi.Controllers.Course
...
@@ -1885,7 +1902,7 @@ namespace Edu.WebApi.Controllers.Course
{
{
return
ApiResult
.
Failed
(
"请传入上课时间Id"
);
return
ApiResult
.
Failed
(
"请传入上课时间Id"
);
}
}
var
oldModel
=
classModule
.
GetClassTimeList
Repository
(
new
RB_Class_Time_ViewModel
{
ClassTimeId
=
extModel
.
ClassTimeId
,
}).
FirstOrDefault
();
var
oldModel
=
classModule
.
GetClassTimeList
Module
(
new
RB_Class_Time_ViewModel
{
ClassTimeId
=
extModel
.
ClassTimeId
,
}).
FirstOrDefault
();
if
(
oldModel
==
null
||
oldModel
.
ClassTimeId
==
0
)
if
(
oldModel
==
null
||
oldModel
.
ClassTimeId
==
0
)
{
{
return
ApiResult
.
Failed
(
"上课计划不存在"
);
return
ApiResult
.
Failed
(
"上课计划不存在"
);
...
...
Edu.WebApi/Controllers/Course/ClassRoomController.cs
View file @
c9a2f25d
...
@@ -295,7 +295,7 @@ namespace Edu.WebApi.Controllers.Course
...
@@ -295,7 +295,7 @@ namespace Edu.WebApi.Controllers.Course
string
roomIds
=
string
.
Join
(
","
,
roomList
.
Select
(
x
=>
x
.
ClassRoomId
));
string
roomIds
=
string
.
Join
(
","
,
roomList
.
Select
(
x
=>
x
.
ClassRoomId
));
roomUserLogList
=
classRoomModule
.
GetClassRoomUseLogListRepository
(
new
RB_Class_RoomUseLog_ViewModel
{
StartTime
=
StartTime
,
EndTime
=
EndTime
,
QRoomIds
=
roomIds
});
roomUserLogList
=
classRoomModule
.
GetClassRoomUseLogListRepository
(
new
RB_Class_RoomUseLog_ViewModel
{
StartTime
=
StartTime
,
EndTime
=
EndTime
,
QRoomIds
=
roomIds
});
string
pids
=
string
.
Join
(
","
,
roomList
.
Select
(
x
=>
x
.
ClassPlanId
));
string
pids
=
string
.
Join
(
","
,
roomList
.
Select
(
x
=>
x
.
ClassPlanId
));
timeList
=
classModule
.
GetClassTimeList
Repository
(
new
RB_Class_Time_ViewModel
()
{
Group_Id
=
base
.
UserInfo
.
Group_Id
,
QClassPlanIds
=
pids
});
timeList
=
classModule
.
GetClassTimeList
Module
(
new
RB_Class_Time_ViewModel
()
{
Group_Id
=
base
.
UserInfo
.
Group_Id
,
QClassPlanIds
=
pids
});
timeList
.
ForEach
(
x
=>
x
.
NewPlanDateTime
=
System
.
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd "
)
+
x
.
StartTime
);
timeList
.
ForEach
(
x
=>
x
.
NewPlanDateTime
=
System
.
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd "
)
+
x
.
StartTime
);
timeList
.
ForEach
(
x
=>
x
.
NewEndPlanDateTime
=
System
.
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd "
)
+
x
.
EndTime
);
timeList
.
ForEach
(
x
=>
x
.
NewEndPlanDateTime
=
System
.
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd "
)
+
x
.
EndTime
);
foreach
(
var
item
in
roomUserLogList
)
foreach
(
var
item
in
roomUserLogList
)
...
...
Edu.WebApi/Controllers/Course/OrderController.cs
View file @
c9a2f25d
...
@@ -1727,7 +1727,7 @@ namespace Edu.WebApi.Controllers.Course
...
@@ -1727,7 +1727,7 @@ namespace Edu.WebApi.Controllers.Course
public
ApiResult
GetChaClassInfo
()
public
ApiResult
GetChaClassInfo
()
{
{
var
ClassId
=
base
.
ParmJObj
.
GetInt
(
"ClassId"
);
var
ClassId
=
base
.
ParmJObj
.
GetInt
(
"ClassId"
);
var
otherClassList
=
orderModule
.
GetClassCourseListModule
(
ClassId
,
base
.
UserInfo
.
Group_Id
);
var
otherClassList
=
orderModule
.
GetClassCourseListModule
(
ClassId
);
return
ApiResult
.
Success
(
data
:
otherClassList
);
return
ApiResult
.
Success
(
data
:
otherClassList
);
}
}
...
...
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