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
16c18ff8
Commit
16c18ff8
authored
Jul 08, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1111
parent
7e7f2916
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
26 deletions
+52
-26
ScrollClassCommonModule.cs
Edu.Module.Course/ScrollClassCommonModule.cs
+52
-26
No files found.
Edu.Module.Course/ScrollClassCommonModule.cs
View file @
16c18ff8
...
...
@@ -75,7 +75,7 @@ namespace Edu.Module.Course
/// <summary>
/// 创建当月开班数据
/// </summary>
public
void
CreateScrollClass
(
string
courseId
,
int
groupId
=
100000
)
public
void
CreateScrollClass
(
string
courseId
,
int
groupId
=
100000
)
{
string
time
=
DateTime
.
Now
.
ToString
(
"yyyy-MM"
);
DateTime
EndOrderTime
=
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM"
)
+
"-01 23:59:59"
).
AddMonths
(
1
).
AddDays
(-
1
);
...
...
@@ -83,13 +83,15 @@ namespace Edu.Module.Course
int
month
=
DateTime
.
Now
.
Month
;
var
clist
=
courseRepository
.
GetCourseListRepository
(
new
RB_Course_ViewModel
()
{
Group_Id
=
groupId
,
IsScrollClass
=
1
,
QCourseIds
=
courseId
});
//每个课程当月都会生成一个开班数据
foreach
(
var
item
in
clist
)
{
foreach
(
var
item
in
clist
)
{
//验证当月是否已创建班级数据
if
(
classRepository
.
GetClassListRepository
(
new
RB_Class_ViewModel
()
{
Group_Id
=
groupId
,
CouseId
=
item
.
CourseId
,
ClassScrollType
=
2
}).
Any
())
{
if
(
classRepository
.
GetClassListRepository
(
new
RB_Class_ViewModel
()
{
Group_Id
=
groupId
,
CouseId
=
item
.
CourseId
,
ClassScrollType
=
2
}).
Any
())
{
continue
;
}
#
region
生成班级号
string
ClassNo
=
"GDKB"
;
int
ClassLetterNum
=
0
;
string
ClassNo
=
"GDKB"
;
int
ClassLetterNum
=
0
;
////查询最大的字母
//int CNum = classRepository.GetMaxClassNoPrefix(time + "-01");
//if (CNum == 0)
...
...
@@ -189,7 +191,8 @@ namespace Edu.Module.Course
/// <summary>
/// 预约课程
/// </summary>
public
bool
CreateScrollAppointment
(
int
groupId
=
100000
)
{
public
bool
CreateScrollAppointment
(
int
groupId
=
100000
)
{
//提前时间
string
Scroll_Time
=
dictvalueRepository
.
GetList
(
new
Model
.
ViewModel
.
User
.
RB_Dictvalue_Extend
()
{
RB_Group_id
=
groupId
,
DictKey
=
"Scroll_Time"
}).
FirstOrDefault
()?.
Content
??
"00:00"
;
...
...
@@ -200,7 +203,7 @@ namespace Edu.Module.Course
int
AdvanceDay
=
Convert
.
ToInt32
(
dictvalueRepository
.
GetList
(
new
Model
.
ViewModel
.
User
.
RB_Dictvalue_Extend
()
{
RB_Group_id
=
groupId
,
DictKey
=
"Scroll_AdvanceDay"
}).
FirstOrDefault
()?.
Content
??
"1"
);
//看提前几天 这个日期之前的(包含此日期) 都算
string
SelectDate
=
DateTime
.
Now
.
AddDays
(
DateTime
.
Now
.
Hour
==
0
?
AdvanceDay
-
1
:
AdvanceDay
).
ToString
(
"yyyy-MM-dd"
);
var
AppointList
=
scroll_AppointmentRepository
.
GetAppointList
(
new
RB_Scroll_Appointment_ViewModel
()
{
Group_Id
=
groupId
,
State
=
Common
.
Enum
.
Course
.
CourseAppointStateEnum
.
WaitSure
,
EntTime
=
SelectDate
});
var
AppointList
=
scroll_AppointmentRepository
.
GetAppointList
(
new
RB_Scroll_Appointment_ViewModel
()
{
Group_Id
=
groupId
,
State
=
Common
.
Enum
.
Course
.
CourseAppointStateEnum
.
WaitSure
,
EntTime
=
SelectDate
});
if
(
AppointList
.
Any
())
{
...
...
@@ -226,13 +229,13 @@ namespace Edu.Module.Course
List
<
int
>
CancelStuId
=
new
List
<
int
>();
//以老师为单位 遍历
AppointList
.
GroupBy
(
x
=>
new
{
x
.
Date
,
x
.
AccountId
,
x
.
WorkUserId
,
x
.
TeacherId
,
x
.
TeacherName
,
x
.
CourseId
,
x
.
CourseName
,
x
.
CourseGradeId
,
x
.
CourseGradeNo
,
x
.
ShiftSort
,
x
.
CourseTimeId
,
x
.
RoomId
,
x
.
RoomName
,
x
.
RoomSchoolId
,
x
.
RoomSchoolName
,
x
.
ScrollMinNum
}).
OrderBy
(
x
=>
x
.
Key
.
Date
).
ThenBy
(
x
=>
x
.
Key
.
ShiftSort
).
ToList
().
ForEach
(
item
=>
AppointList
.
GroupBy
(
x
=>
new
{
x
.
Date
,
x
.
AccountId
,
x
.
WorkUserId
,
x
.
TeacherId
,
x
.
TeacherName
,
x
.
CourseId
,
x
.
CourseName
,
x
.
CourseGradeId
,
x
.
CourseGradeNo
,
x
.
ShiftSort
,
x
.
CourseTimeId
,
x
.
RoomId
,
x
.
RoomName
,
x
.
RoomSchoolId
,
x
.
RoomSchoolName
,
x
.
ScrollMinNum
}).
OrderBy
(
x
=>
x
.
Key
.
Date
).
ThenBy
(
x
=>
x
.
Key
.
ShiftSort
).
ToList
().
ForEach
(
item
=>
{
var
CourseTimeList
=
JsonHelper
.
DeserializeObject
<
List
<
CourseTimeModel
>>(
item
.
FirstOrDefault
().
CourseTime
);
string
CourseTime
=
CourseTimeList
.
Min
(
x
=>
x
.
StartTime
)
+
"~"
+
CourseTimeList
.
Max
(
x
=>
x
.
EndTime
);
string
StartTime
=
item
.
Key
.
Date
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
CourseTimeList
.
Min
(
x
=>
x
.
StartTime
);
//开始验证学生的数量是否达标
if
(
item
.
Where
(
x
=>
!
CancelStuId
.
Contains
(
x
.
StuId
)
&&
x
.
AppointType
!=
3
).
Count
()
<
item
.
Key
.
ScrollMinNum
)
if
(
item
.
Where
(
x
=>
!
CancelStuId
.
Contains
(
x
.
StuId
)
&&
x
.
AppointType
!=
3
).
Count
()
<
item
.
Key
.
ScrollMinNum
)
{
//人数未达标 取消课程
foreach
(
var
qitem
in
item
.
Where
(
x
=>
!
CancelStuId
.
Contains
(
x
.
StuId
)))
...
...
@@ -440,7 +443,7 @@ namespace Edu.Module.Course
}
}
#
endregion
//给老师推送课程 信息
if
(!
string
.
IsNullOrEmpty
(
item
.
Key
.
WorkUserId
))
...
...
@@ -470,7 +473,7 @@ namespace Edu.Module.Course
int
AdvanceHour
=
Convert
.
ToInt32
(
dictvalueRepository
.
GetList
(
new
Model
.
ViewModel
.
User
.
RB_Dictvalue_Extend
()
{
RB_Group_id
=
groupId
,
DictKey
=
"Scroll_NoticeAdvHour"
}).
FirstOrDefault
()?.
Content
??
"1"
);
//按照设置的时间来判定
if
(
DateTime
.
Now
.
AddHours
(
AdvanceHour
).
Hour
==
Convert
.
ToDateTime
(
"2022-01-25 "
+
Scroll_Time
).
Hour
||
DateTime
.
Now
.
AddHours
(
AdvanceHour
+
1
).
Hour
==
Convert
.
ToDateTime
(
"2022-01-25 "
+
Scroll_Time
).
Hour
)
if
(
DateTime
.
Now
.
AddHours
(
AdvanceHour
).
Hour
==
Convert
.
ToDateTime
(
"2022-01-25 "
+
Scroll_Time
).
Hour
||
DateTime
.
Now
.
AddHours
(
AdvanceHour
+
1
).
Hour
==
Convert
.
ToDateTime
(
"2022-01-25 "
+
Scroll_Time
).
Hour
)
{
string
Scroll_Notice
=
dictvalueRepository
.
GetList
(
new
Model
.
ViewModel
.
User
.
RB_Dictvalue_Extend
()
{
RB_Group_id
=
groupId
,
DictKey
=
"Scroll_Notice"
}).
FirstOrDefault
()?.
Content
??
""
;
if
(
string
.
IsNullOrEmpty
(
Scroll_Notice
))
{
return
false
;
}
...
...
@@ -493,7 +496,7 @@ namespace Edu.Module.Course
string
CourseTime
=
CourseTimeList
.
Min
(
x
=>
x
.
StartTime
)
+
"~"
+
CourseTimeList
.
Max
(
x
=>
x
.
EndTime
);
string
StartTime
=
item
.
Key
.
Date
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
CourseTimeList
.
Min
(
x
=>
x
.
StartTime
);
//开始验证学生的数量是否达标
if
(
item
.
Where
(
x
=>
x
.
AppointType
!=
3
).
Count
()
<
item
.
Key
.
ScrollMinNum
)
if
(
item
.
Where
(
x
=>
x
.
AppointType
!=
3
).
Count
()
<
item
.
Key
.
ScrollMinNum
)
{
foreach
(
var
empModel
in
empList
)
{
...
...
@@ -501,7 +504,7 @@ namespace Edu.Module.Course
if
(!
string
.
IsNullOrEmpty
(
empModel
.
WorkUserId
))
{
var
recipientPath
=
HttpUtility
.
UrlEncode
(
$"/stu/subscribe"
);
//地址需要后台功能做了之后吧
var
content
=
$"<font color='info'>课程即将取消通知</font>\n>**概要信息** \n>上课日期:<font color='warning'>
{
item
.
Key
.
Date
.
ToString
(
"yyyy-MM-dd"
)}
</font>\n>上课时段:<font color='warning'>
{
CourseTime
}
</font>\n>上课老师:<font color='warning'>
{
item
.
Key
.
TeacherName
}
</font>\n>取消原因:<font color='comment'>截止目前仅有
{
item
.
Where
(
x
=>
x
.
AppointType
!=
3
).
Count
()}
报名,预约人数未达到最低成班人数
{
item
.
Key
.
ScrollMinNum
}
人,即将取消</font>\n>请 点 击:[查看详情](
{
Config
.
ErpUrl
}
/autologin?loginId=
{
empModel
.
Id
}
&target=
{
recipientPath
}
)"
;
var
content
=
$"<font color='info'>课程即将取消通知</font>\n>**概要信息** \n>上课日期:<font color='warning'>
{
item
.
Key
.
Date
.
ToString
(
"yyyy-MM-dd"
)}
</font>\n>上课时段:<font color='warning'>
{
CourseTime
}
</font>\n>上课老师:<font color='warning'>
{
item
.
Key
.
TeacherName
}
</font>\n>取消原因:<font color='comment'>截止目前仅有
{
item
.
Where
(
x
=>
x
.
AppointType
!=
3
).
Count
()}
报名,预约人数未达到最低成班人数
{
item
.
Key
.
ScrollMinNum
}
人,即将取消</font>\n>请 点 击:[查看详情](
{
Config
.
ErpUrl
}
/autologin?loginId=
{
empModel
.
Id
}
&target=
{
recipientPath
}
)"
;
PushWorkChatHelper
.
PushToWorkChat
(
content
,
empModel
.
WorkUserId
,
"课程即将取消通知"
);
}
}
...
...
@@ -548,7 +551,7 @@ namespace Edu.Module.Course
},
thing10
=
new
{
value
=
demodel
.
RoomName
+
" ("
+
demodel
.
RoomSchoolName
+
")"
+
"(第"
+
demodel
.
ChapterNo
+
"次课)"
//上课地点
value
=
demodel
.
RoomName
+
" ("
+
demodel
.
RoomSchoolName
+
")"
+
"(第"
+
demodel
.
ChapterNo
+
"次课)"
//上课地点
},
thing5
=
new
{
...
...
@@ -657,11 +660,11 @@ namespace Edu.Module.Course
foreach
(
var
item
in
list
)
{
//更新约课为已上课
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Scroll_Appointment_ViewModel
.
State
),
Common
.
Enum
.
Course
.
CourseAppointStateEnum
.
Coursed
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
()
{
...
...
@@ -671,25 +674,44 @@ namespace Edu.Module.Course
}
};
bool
flag
=
scroll_AppointmentRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag
)
if
(
flag
)
{
var
clist
=
JsonHelper
.
DeserializeObject
<
List
<
CourseTimeModel
>>(
item
.
CourseTime
);
//更新 order_guest 表 上课章节 请假也暂时先算完成课时(请假应该是有补课的)
var
gmodel
=
order_GuestRepository
.
GetEntity
(
item
.
GuestId
);
if
(
gmodel
!=
null
&&
gmodel
.
CourseChapterNo
<
item
.
CourseGradeNo
)
if
(
gmodel
!=
null
)
{
//ld 2022-03-08 修改为学员上课最大课时
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>();
if
(
item
.
CreateTime
<=
new
DateTime
(
2022
,
7
,
8
))
{
{
nameof
(
Model
.
ViewModel
.
Sell
.
RB_Order_Guest_ViewModel
.
CourseChapterNo
),
item
.
CourseGradeNo
},
{
nameof
(
Model
.
ViewModel
.
Sell
.
RB_Order_Guest_ViewModel
.
CompleteHours
),
item
.
CourseGradeNo
*
clist
.
Sum
(
x
=>
x
.
ClassHours
)}
};
if
(
gmodel
.
TotalChapterNo
<=
item
.
CourseGradeNo
)
if
(
gmodel
.
CourseChapterNo
<
item
.
ChapterNo
)
{
keyValues1
.
Add
(
nameof
(
Model
.
ViewModel
.
Sell
.
RB_Order_Guest_ViewModel
.
CourseChapterNo
),
item
.
ChapterNo
);
keyValues1
.
Add
(
nameof
(
Model
.
ViewModel
.
Sell
.
RB_Order_Guest_ViewModel
.
CompleteHours
),
item
.
ChapterNo
*
clist
.
Sum
(
x
=>
x
.
ClassHours
));
if
(
gmodel
.
TotalChapterNo
<=
item
.
ChapterNo
)
{
//章节已上完了 修改为 毕业
keyValues1
.
Add
(
nameof
(
Model
.
ViewModel
.
Sell
.
RB_Order_Guest_ViewModel
.
GuestState
),
Common
.
Enum
.
Course
.
GuestStateEnum
.
Graduate
);
}
}
}
//HK 2022-07-08修改
else
{
//章节已上完了 修改为 毕业
keyValues1
.
Add
(
nameof
(
Model
.
ViewModel
.
Sell
.
RB_Order_Guest_ViewModel
.
GuestState
),
Common
.
Enum
.
Course
.
GuestStateEnum
.
Graduate
);
if
(
gmodel
.
CourseChapterNo
<
item
.
CourseGradeNo
)
{
keyValues1
.
Add
(
nameof
(
Model
.
ViewModel
.
Sell
.
RB_Order_Guest_ViewModel
.
CourseChapterNo
),
item
.
CourseGradeNo
);
keyValues1
.
Add
(
nameof
(
Model
.
ViewModel
.
Sell
.
RB_Order_Guest_ViewModel
.
CompleteHours
),
item
.
CourseGradeNo
*
clist
.
Sum
(
x
=>
x
.
ClassHours
));
if
(
gmodel
.
TotalChapterNo
<=
item
.
CourseGradeNo
)
{
//章节已上完了 修改为 毕业
keyValues1
.
Add
(
nameof
(
Model
.
ViewModel
.
Sell
.
RB_Order_Guest_ViewModel
.
GuestState
),
Common
.
Enum
.
Course
.
GuestStateEnum
.
Graduate
);
}
}
}
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
()
{
...
...
@@ -698,8 +720,12 @@ namespace Edu.Module.Course
OperatorEnum
=
OperatorEnum
.
Equal
}
};
order_GuestRepository
.
Update
(
keyValues1
,
wheres1
);
if
(
keyValues1
!=
null
&&
keyValues1
.
Count
>
0
)
{
order_GuestRepository
.
Update
(
keyValues1
,
wheres1
);
}
}
if
(
item
.
AppointType
!=
3
)
{
//写入签到数据表 (非重复上课的 才写入签到数据)
...
...
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