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
694e001b
Commit
694e001b
authored
Aug 29, 2024
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
签到处理
parent
0d6652db
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
144 additions
and
564 deletions
+144
-564
ScrollClassCommonModule.cs
Edu.Module.Course/ScrollClassCommonModule.cs
+1
-113
ScrollClassModule.cs
Edu.Module.Course/ScrollClassModule.cs
+5
-283
RB_Class_CheckRepository.cs
Edu.Repository/Grade/RB_Class_CheckRepository.cs
+138
-147
ScrollController.cs
Edu.WebApi/Controllers/Course/ScrollController.cs
+0
-21
No files found.
Edu.Module.Course/ScrollClassCommonModule.cs
View file @
694e001b
...
@@ -672,119 +672,7 @@ namespace Edu.Module.Course
...
@@ -672,119 +672,7 @@ namespace Edu.Module.Course
var
list
=
scroll_AppointmentRepository
.
GetList
(
new
RB_Scroll_Appointment_ViewModel
()
{
Group_Id
=
groupId
,
CourseEndTimeStr
=
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
State
=
Common
.
Enum
.
Course
.
CourseAppointStateEnum
.
WaitCourse
});
var
list
=
scroll_AppointmentRepository
.
GetList
(
new
RB_Scroll_Appointment_ViewModel
()
{
Group_Id
=
groupId
,
CourseEndTimeStr
=
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
State
=
Common
.
Enum
.
Course
.
CourseAppointStateEnum
.
WaitCourse
});
if
(
list
.
Any
())
if
(
list
.
Any
())
{
{
//查询所有的上课计划
class_CheckRepository
.
AppointStuCheckRepository
(
list
);
string
planIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
ClassPlanId
).
Distinct
());
//再查询上课时间
var
timeList
=
class_TimeRepository
.
GetClassTimeListRepository
(
new
RB_Class_Time_ViewModel
()
{
Group_Id
=
groupId
,
QClassPlanIds
=
planIds
});
string
Date
=
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
);
string
orderGuestIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
GuestId
).
Distinct
());
var
oldCheck
=
class_CheckRepository
.
GetClassCheckList
(
new
RB_Class_Check_ViewModel
()
{
Group_Id
=
groupId
,
StartDate
=
Date
,
EndDate
=
Date
,
QOrderGuestIds
=
orderGuestIds
});
foreach
(
var
item
in
list
)
{
//更新约课为已上课
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
>()
{
new
WhereHelper
()
{
FiledName
=
nameof
(
RB_Scroll_Appointment_ViewModel
.
Id
),
FiledValue
=
item
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
scroll_AppointmentRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag
)
{
var
clist
=
JsonHelper
.
DeserializeObject
<
List
<
CourseTimeModel
>>(
item
.
CourseTime
);
//更新 order_guest 表 上课章节 请假也暂时先算完成课时(请假应该是有补课的)
var
gmodel
=
order_GuestRepository
.
GetEntity
(
item
.
GuestId
);
if
(
gmodel
!=
null
)
{
//ld 2022-03-08 修改为学员上课最大课时
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>();
if
(
item
.
CreateTime
<=
new
DateTime
(
2022
,
7
,
8
))
{
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
{
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
>()
{
new
WhereHelper
()
{
FiledName
=
nameof
(
Model
.
ViewModel
.
Sell
.
RB_Order_Guest_ViewModel
.
Id
),
FiledValue
=
gmodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
if
(
keyValues1
!=
null
&&
keyValues1
.
Count
>
0
)
{
order_GuestRepository
.
Update
(
keyValues1
,
wheres1
);
}
}
if
(
item
.
AppointType
!=
3
)
{
//写入签到数据表 (非重复上课的 才写入签到数据)
var
tlist
=
timeList
.
Where
(
x
=>
x
.
ClassPlanId
==
item
.
ClassPlanId
).
ToList
();
foreach
(
var
qitem
in
tlist
)
{
var
ccModel
=
clist
.
Where
(
x
=>
x
.
StartTime
==
qitem
.
StartTime
).
FirstOrDefault
();
if
(
ccModel
!=
null
&&
!
oldCheck
.
Where
(
x
=>
x
.
OrderGuestId
==
item
.
GuestId
&&
x
.
ClassTimeId
==
qitem
.
ClassTimeId
).
Any
())
{
//没有数据的插入 (有数据情况 =》 请假数据)
class_CheckRepository
.
Insert
(
new
RB_Class_Check
()
{
ClassCheckId
=
0
,
ClassId
=
0
,
ClassDate
=
item
.
Date
,
Status
=
0
,
ClassRoomId
=
item
.
RoomId
,
Group_Id
=
item
.
Group_Id
,
School_Id
=
qitem
.
School_Id
,
TeacherId
=
item
.
TeacherId
,
OrderGuestId
=
item
.
GuestId
,
CheckStatus
=
0
,
CreateBy
=
0
,
CreateTime
=
DateTime
.
Now
,
StudyNum
=
ccModel
.
Minutes
,
MakeUpStatus
=
1
,
CurrentDeductionHours
=
ccModel
.
ClassHours
,
IsAbsentHours
=
0
,
ClassTimeId
=
qitem
.
ClassTimeId
});
}
}
}
}
}
}
}
}
}
#
endregion
#
endregion
...
...
Edu.Module.Course/ScrollClassModule.cs
View file @
694e001b
...
@@ -2851,72 +2851,13 @@ namespace Edu.Module.Course
...
@@ -2851,72 +2851,13 @@ namespace Edu.Module.Course
//验证都OK了 插入预约数据
//验证都OK了 插入预约数据
AppointId
=
scroll_AppointmentRepository
.
Insert
(
demodel
);
AppointId
=
scroll_AppointmentRepository
.
Insert
(
demodel
);
demodel
.
Id
=
AppointId
;
bool
flag
=
AppointId
>
0
;
bool
flag
=
AppointId
>
0
;
if
(
flag
)
if
(
flag
)
{
{
if
(
demodel
.
State
==
Common
.
Enum
.
Course
.
CourseAppointStateEnum
.
Coursed
)
List
<
RB_Scroll_Appointment_ViewModel
>
list
=
new
List
<
RB_Scroll_Appointment_ViewModel
>();
{
list
.
Add
(
demodel
);
//已上课 需更新课时 + 签到记录
class_CheckRepository
.
AppointStuCheckRepository
(
list
);
var
clist
=
JsonHelper
.
DeserializeObject
<
List
<
CourseTimeModel
>>(
demodel
.
CourseTime
);
//更新 order_guest 表 上课章节 请假也暂时先算完成课时(请假应该是有补课的)
var
gmodel
=
order_GuestRepository
.
GetEntity
(
demodel
.
GuestId
);
if
(
gmodel
!=
null
&&
gmodel
.
CourseChapterNo
<
demodel
.
ChapterNo
)
{
//ld 2022-03-08 修改为学员上课最大课时
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Order_Guest_ViewModel
.
CourseChapterNo
),
demodel
.
ChapterNo
},
{
nameof
(
RB_Order_Guest_ViewModel
.
CompleteHours
),
demodel
.
ChapterNo
*
clist
.
Sum
(
x
=>
x
.
ClassHours
)}
};
if
(
gmodel
.
TotalChapterNo
<=
demodel
.
ChapterNo
)
{
//章节已上完了 修改为 毕业
keyValues1
.
Add
(
nameof
(
Model
.
ViewModel
.
Sell
.
RB_Order_Guest_ViewModel
.
GuestState
),
Common
.
Enum
.
Course
.
GuestStateEnum
.
Graduate
);
}
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
Model
.
ViewModel
.
Sell
.
RB_Order_Guest_ViewModel
.
Id
),
FiledValue
=
gmodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
order_GuestRepository
.
Update
(
keyValues1
,
wheres1
);
}
if
(
demodel
.
AppointType
!=
3
)
{
//写入签到数据表 (非重复上课的 才写入签到数据)
var
tlist
=
class_TimeRepository
.
GetClassTimeListRepository
(
new
RB_Class_Time_ViewModel
()
{
Group_Id
=
demodel
.
Group_Id
,
ClassPlanId
=
demodel
.
ClassPlanId
});
foreach
(
var
qitem
in
tlist
)
{
var
ccModel
=
clist
.
Where
(
x
=>
x
.
StartTime
==
qitem
.
StartTime
).
FirstOrDefault
();
if
(
ccModel
!=
null
)
{
//没有数据的插入 (有数据情况 =》 请假数据)
class_CheckRepository
.
Insert
(
new
RB_Class_Check
()
{
ClassCheckId
=
0
,
ClassId
=
0
,
ClassDate
=
demodel
.
Date
,
Status
=
0
,
ClassRoomId
=
demodel
.
RoomId
,
Group_Id
=
demodel
.
Group_Id
,
School_Id
=
qitem
.
School_Id
,
TeacherId
=
demodel
.
TeacherId
,
OrderGuestId
=
demodel
.
GuestId
,
CheckStatus
=
0
,
CreateBy
=
0
,
CreateTime
=
DateTime
.
Now
,
StudyNum
=
ccModel
.
Minutes
,
MakeUpStatus
=
1
,
CurrentDeductionHours
=
ccModel
.
ClassHours
,
IsAbsentHours
=
0
,
ClassTimeId
=
qitem
.
ClassTimeId
});
}
}
}
}
}
}
return
flag
?
""
:
"出错了,请联系管理员"
;
return
flag
?
""
:
"出错了,请联系管理员"
;
#
endregion
#
endregion
...
@@ -3268,226 +3209,7 @@ namespace Edu.Module.Course
...
@@ -3268,226 +3209,7 @@ namespace Edu.Module.Course
}
}
#
endregion
#
endregion
#
region
初始化
public
string
InitializeAppointmentData
(
int
group_Id
)
{
string
rootBook
=
AppDomain
.
CurrentDomain
.
BaseDirectory
;
string
server_path
=
rootBook
+
"/upfile/temporary/"
+
"约课数据.xlsx"
;
var
list
=
Common
.
Data
.
AppointmentHelper
.
GetAppointmentData
(
server_path
);
list
=
list
.
Where
(
x
=>
!
string
.
IsNullOrEmpty
(
x
.
Date
)).
ToList
();
if
(
list
.
Any
())
{
//根据所有的学生
var
stuList
=
student_OrderGuestRepository
.
GetAppointmentStudyList
(
group_Id
);
//查询老师信息
var
teacherList
=
accountRepository
.
GetEmployeeListRepository
(
new
Employee_ViewModel
()
{
Group_Id
=
group_Id
,
AccountTypeStr
=
"2"
});
//查询教室信息
var
roomList
=
class_RoomRepository
.
GetClassRoomList
(
new
RB_Class_Room_ViewModel
()
{
Group_Id
=
group_Id
});
List
<
RB_Student_OrderGuest_ViewModel
>
ChapterNoList
=
new
List
<
RB_Student_OrderGuest_ViewModel
>();
//根据日期 教室 老师 学生分组
list
.
GroupBy
(
x
=>
new
{
x
.
Date
,
x
.
RoomName
,
x
.
TeacherName
,
x
.
StuNames
}).
ToList
().
ForEach
(
item
=>
{
DateTime
ClassDate
=
Convert
.
ToDateTime
(
"2022年"
+
item
.
Key
.
Date
);
var
roomModel
=
roomList
.
Where
(
x
=>
x
.
RoomName
==
item
.
Key
.
RoomName
).
FirstOrDefault
();
var
teacherModel
=
teacherList
.
Where
(
x
=>
x
.
EmployeeName
==
item
.
Key
.
TeacherName
).
FirstOrDefault
();
string
StuNames
=
item
.
Key
.
StuNames
.
Replace
(
"危薇"
,
"Camille薇薇"
);
List
<
string
>
StuNameList
=
StuNames
.
Split
(
","
).
ToList
();
//需排除 刘卡加,艾荻,吴浪
StuNameList
=
StuNameList
.
Where
(
x
=>
x
!=
"刘卡加"
&&
x
!=
"艾荻"
&&
x
!=
"吴浪"
).
ToList
();
if
(
StuNameList
.
Any
())
{
var
firstStuModel
=
stuList
.
Where
(
x
=>
x
.
GuestName
==
StuNameList
.
FirstOrDefault
()).
FirstOrDefault
();
//开始创建 上课计划
int
planId
=
class_PlanRepository
.
Insert
(
new
RB_Class_Plan
()
{
ClassPlanId
=
0
,
ClassId
=
0
,
ClassDate
=
ClassDate
,
Status
=
0
,
ClassRoomId
=
roomModel
.
RoomId
,
Group_Id
=
group_Id
,
School_Id
=
roomModel
.
School_Id
,
// 暂时 应该要赋值 订单上的预约校区
TeacherId
=
teacherModel
.
AccountId
,
BeiKeStatus
=
0
,
FanKuiStatus
=
0
,
ParentFanKuiStatus
=
0
,
RepeatPlanIds
=
""
,
PlanType
=
2
,
CourseId
=
firstStuModel
.
CourseId
});
if
(
planId
>
0
)
{
foreach
(
var
qitem
in
item
)
{
string
StartTime
=
Convert
.
ToDateTime
(
"2022-02-16 "
+
qitem
.
Times
.
Split
(
'~'
)[
0
]).
ToString
(
"HH:mm"
);
string
EndTime
=
qitem
.
Times
.
Split
(
'~'
)[
1
];
#
region
数据整理
List
<
CourseTimeModel
>
CTList
=
new
List
<
CourseTimeModel
>();
int
Sort
=
1
;
int
SHour
=
Convert
.
ToDateTime
(
"2022-02-16 "
+
StartTime
).
Hour
;
if
(
SHour
<
10
)
{
Sort
=
1
;
}
else
if
(
SHour
<
12
)
{
Sort
=
2
;
}
else
if
(
SHour
<
14
)
{
Sort
=
3
;
}
else
if
(
SHour
<
16
)
{
Sort
=
4
;
}
else
if
(
SHour
<
20
)
{
Sort
=
5
;
}
else
{
Sort
=
6
;
}
CTList
.
Add
(
new
CourseTimeModel
()
{
StartTime
=
StartTime
,
EndTime
=
EndTime
,
Minutes
=
90
,
ClassHours
=
2
,
Sort
=
Sort
});
#
endregion
//上课时间
int
timeId
=
class_TimeRepository
.
Insert
(
new
RB_Class_Time
()
{
ClassTimeId
=
0
,
ClassId
=
0
,
ClassPlanId
=
planId
,
StartTime
=
StartTime
,
EndTime
=
EndTime
,
Group_Id
=
group_Id
,
School_Id
=
roomModel
.
School_Id
,
//暂时 应该要赋值 订单上的预约校区
ClassStatus
=
0
,
SuiPai
=
""
,
VideoUrl
=
""
,
TimeHour
=
2
});
foreach
(
var
stuName
in
StuNameList
)
{
var
stuModel
=
stuList
.
Where
(
x
=>
x
.
GuestName
==
stuName
).
FirstOrDefault
();
if
(
DateTime
.
Now
>
ClassDate
)
{
//上课签到数据
class_CheckRepository
.
Insert
(
new
RB_Class_Check
()
{
ClassCheckId
=
0
,
ClassId
=
0
,
ClassDate
=
ClassDate
,
Status
=
0
,
ClassRoomId
=
roomModel
.
RoomId
,
Group_Id
=
group_Id
,
School_Id
=
roomModel
.
School_Id
,
TeacherId
=
teacherModel
.
AccountId
,
OrderGuestId
=
stuModel
.
GuestId
,
CheckStatus
=
0
,
CreateBy
=
0
,
CreateTime
=
DateTime
.
Now
,
StudyNum
=
90
,
MakeUpStatus
=
1
,
CurrentDeductionHours
=
2
,
IsAbsentHours
=
0
,
ClassTimeId
=
timeId
});
}
int
ChapterNo
=
ChapterNoList
.
Where
(
x
=>
x
.
GuestId
==
stuModel
.
GuestId
).
Count
()
+
1
;
//加上当前的
//约课数据
scroll_AppointmentRepository
.
Insert
(
new
Model
.
Entity
.
Scroll
.
RB_Scroll_Appointment
()
{
Id
=
0
,
Date
=
ClassDate
,
AccountId
=
teacherModel
.
Id
,
StuId
=
stuModel
.
Student_Id
,
CourseId
=
firstStuModel
.
CourseId
,
ChapterNo
=
ChapterNo
,
ShiftSort
=
string
.
Join
(
","
,
CTList
.
Select
(
x
=>
x
.
Sort
).
OrderBy
(
x
=>
x
)),
State
=
DateTime
.
Now
>
ClassDate
?
Common
.
Enum
.
Course
.
CourseAppointStateEnum
.
Coursed
:
Common
.
Enum
.
Course
.
CourseAppointStateEnum
.
WaitCourse
,
Status
=
0
,
Group_Id
=
group_Id
,
CreateBy
=
0
,
CreateTime
=
DateTime
.
Now
,
UpdateBy
=
0
,
UpdateTime
=
DateTime
.
Now
,
CourseEndTime
=
Convert
.
ToDateTime
(
ClassDate
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
CTList
.
Max
(
x
=>
x
.
EndTime
)),
RoomId
=
roomModel
.
RoomId
,
ClassPlanId
=
planId
,
CourseTime
=
JsonHelper
.
Serialize
(
CTList
),
GuestId
=
stuModel
.
GuestId
,
OrderId
=
stuModel
.
OrderId
,
CourseSTime
=
CTList
.
Min
(
x
=>
x
.
StartTime
),
CourseETime
=
CTList
.
Max
(
x
=>
x
.
EndTime
),
CourseGradeId
=
Common
.
Enum
.
Course
.
CourseRateEnum
.
N5
,
LearnCourseId
=
stuModel
.
CourseId
,
Remark
=
"初始化"
});
ChapterNoList
.
Add
(
new
RB_Student_OrderGuest_ViewModel
()
{
GuestId
=
stuModel
.
GuestId
,
RenewState
=
DateTime
.
Now
>
ClassDate
?
1
:
2
});
}
}
}
}
});
//最后 更新 order_guest 表 完成课时 + 上课章节
foreach
(
var
GuestId
in
ChapterNoList
.
Select
(
x
=>
x
.
GuestId
).
Distinct
())
{
int
CourseChapterNo
=
ChapterNoList
.
Where
(
x
=>
x
.
GuestId
==
GuestId
&&
x
.
RenewState
==
1
).
Count
();
//每节课2课时
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Order_Guest_ViewModel
.
CompleteHours
),
CourseChapterNo
*
2
},
{
nameof
(
RB_Order_Guest_ViewModel
.
CourseChapterNo
),
CourseChapterNo
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Order_Guest_ViewModel
.
Id
),
FiledValue
=
GuestId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
order_GuestRepository
.
Update
(
keyValues
,
wheres
);
}
}
return
""
;
}
/// <summary>
/// 初始化 跟班的上课记录
/// </summary>
/// <param name="group_Id"></param>
/// <returns></returns>
public
string
InitializeAppointDataForGB
(
int
group_Id
)
{
string
GuestIds
=
"77"
;
//艾荻、张笑三、吴浪、周杰、邓骏、刘卡加
var
glist
=
order_GuestRepository
.
GetSingleListRepository
(
new
RB_Order_Guest_ViewModel
()
{
Group_Id
=
group_Id
,
OrderGuestIds
=
GuestIds
});
if
(
glist
.
Any
())
{
}
return
""
;
}
#
endregion
#
region
学员跳课
#
region
学员跳课
/// <summary>
/// <summary>
...
...
Edu.Repository/Grade/RB_Class_CheckRepository.cs
View file @
694e001b
...
@@ -17,6 +17,9 @@ using Edu.Model.Entity.User;
...
@@ -17,6 +17,9 @@ using Edu.Model.Entity.User;
using
Edu.Model.ViewModel.User
;
using
Edu.Model.ViewModel.User
;
using
Org.BouncyCastle.Bcpg.OpenPgp
;
using
Org.BouncyCastle.Bcpg.OpenPgp
;
using
Castle.Core.Internal
;
using
Castle.Core.Internal
;
using
Edu.Model.ViewModel.Scroll
;
using
Edu.Common.Plugin
;
using
System.Text.RegularExpressions
;
namespace
Edu.Repository.Grade
namespace
Edu.Repository.Grade
{
{
...
@@ -944,7 +947,7 @@ WHERE 1=1 AND A.Status=0 {1} ", builderMakeUp.ToString(), builderWhere.ToString
...
@@ -944,7 +947,7 @@ WHERE 1=1 AND A.Status=0 {1} ", builderMakeUp.ToString(), builderWhere.ToString
#
endregion
#
endregion
/// <summary>
/// <summary>
/// 学员签到
///
班课
学员签到
/// </summary>
/// </summary>
/// <param name="list">学员信息</param>
/// <param name="list">学员信息</param>
/// <param name="CheckType">1-班课,2-约课</param>
/// <param name="CheckType">1-班课,2-约课</param>
...
@@ -986,7 +989,7 @@ WHERE 1=1 AND A.Status=0 {1} ", builderMakeUp.ToString(), builderWhere.ToString
...
@@ -986,7 +989,7 @@ WHERE 1=1 AND A.Status=0 {1} ", builderMakeUp.ToString(), builderWhere.ToString
string
classTimeIds
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
ClassTimeId
).
Distinct
());
string
classTimeIds
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
ClassTimeId
).
Distinct
());
if
(!
string
.
IsNullOrEmpty
(
classTimeIds
))
if
(!
string
.
IsNullOrEmpty
(
classTimeIds
))
{
{
classTimeList
=
GetClassTimeListRepository
(
classTimeIds
);
classTimeList
=
GetClassTimeListRepository
(
classTimeIds
,
""
);
}
}
string
classIds
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
ClassId
).
Distinct
());
string
classIds
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
ClassId
).
Distinct
());
if
(!
string
.
IsNullOrEmpty
(
classIds
))
if
(!
string
.
IsNullOrEmpty
(
classIds
))
...
@@ -1236,12 +1239,7 @@ WHERE 1=1 AND A.Status=0 {1} ", builderMakeUp.ToString(), builderWhere.ToString
...
@@ -1236,12 +1239,7 @@ WHERE 1=1 AND A.Status=0 {1} ", builderMakeUp.ToString(), builderWhere.ToString
SourceId
=
guestModel
.
Id
SourceId
=
guestModel
.
Id
});
});
}
}
//缺勤和请假
if
(
item
.
CheckStatus
==
1
||
item
.
CheckStatus
==
2
)
{
flag
=
CalcGuestHoursRepository
(
guestModel
,
item
);
}
#
region
B2B
同业推送
#
region
B2B
同业推送
if
(
orderModel
!=
null
&&
orderModel
.
CustomerId
>
0
)
if
(
orderModel
!=
null
&&
orderModel
.
CustomerId
>
0
)
{
{
...
@@ -1335,6 +1333,127 @@ WHERE 1=1 AND A.Status=0 {1} ", builderMakeUp.ToString(), builderWhere.ToString
...
@@ -1335,6 +1333,127 @@ WHERE 1=1 AND A.Status=0 {1} ", builderMakeUp.ToString(), builderWhere.ToString
return
flag
;
return
flag
;
}
}
/// <summary>
/// 约课学员签到
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
public
bool
AppointStuCheckRepository
(
List
<
RB_Scroll_Appointment_ViewModel
>
list
)
{
bool
flag
=
false
;
if
(
list
.
Any
())
{
//查询所有的上课计划
string
planIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
ClassPlanId
).
Distinct
());
//再查询上课时间
var
timeList
=
GetClassTimeListRepository
(
""
,
planIds
);
string
Date
=
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
);
string
orderGuestIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
GuestId
).
Distinct
());
var
guestList
=
GetOrderGuestListRepository
(
orderGuestIds
);
var
oldCheckList
=
GetClassCheckList
(
new
RB_Class_Check_ViewModel
()
{
QOrderGuestIds
=
orderGuestIds
});
foreach
(
var
item
in
list
)
{
//更新约课为已上课
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
>()
{
new
WhereHelper
()
{
FiledName
=
nameof
(
RB_Scroll_Appointment_ViewModel
.
Id
),
FiledValue
=
item
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
string
appointSql
=
string
.
Format
(
" UPDATE RB_Scroll_Appointment SET State={0} WHERE Id={1} "
,
(
int
)
Common
.
Enum
.
Course
.
CourseAppointStateEnum
.
Coursed
,
item
.
Id
);
flag
=
base
.
Execute
(
appointSql
)
>
0
;
if
(
flag
)
{
var
clist
=
JsonHelper
.
DeserializeObject
<
List
<
CourseTimeModel
>>(
item
.
CourseTime
);
//更新 order_guest 表 上课章节 请假也暂时先算完成课时(请假应该是有补课的)
var
gmodel
=
guestList
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
==
item
.
GuestId
);
var
tempClassTimeList
=
timeList
?.
Where
(
qitem
=>
qitem
.
ClassPlanId
==
item
.
ClassPlanId
)?.
ToList
()
??
new
List
<
RB_Class_Time_ViewModel
>();
var
guestOldCheckList
=
oldCheckList
?.
Where
(
qitem
=>
qitem
.
OrderGuestId
==
item
.
GuestId
&&
!
tempClassTimeList
.
Any
(
sItem
=>
sItem
.
ClassTimeId
==
qitem
.
ClassTimeId
))?.
ToList
()
??
new
List
<
RB_Class_Check_ViewModel
>();
decimal
guestOldFinishHours
=
0
;
if
(
guestOldCheckList
!=
null
&&
guestOldCheckList
.
Count
>
0
)
{
guestOldFinishHours
=
guestOldCheckList
.
Sum
(
qitem
=>
qitem
.
CurrentDeductionHours
);
}
if
(
gmodel
!=
null
)
{
//ld 2022-03-08 修改为学员上课最大课时
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>();
var
completeHours
=
guestOldFinishHours
+
clist
.
Sum
(
x
=>
x
.
ClassHours
);
keyValues1
.
Add
(
nameof
(
Model
.
ViewModel
.
Sell
.
RB_Order_Guest_ViewModel
.
CourseChapterNo
),
item
.
ChapterNo
);
keyValues1
.
Add
(
nameof
(
Model
.
ViewModel
.
Sell
.
RB_Order_Guest_ViewModel
.
CompleteHours
),
completeHours
);
if
(
gmodel
.
TotalHours
==
completeHours
)
{
keyValues1
.
Add
(
nameof
(
Model
.
ViewModel
.
Sell
.
RB_Order_Guest_ViewModel
.
GuestState
),
Common
.
Enum
.
Course
.
GuestStateEnum
.
Graduate
);
}
if
(
keyValues1
!=
null
&&
keyValues1
.
Count
>
0
)
{
DynamicParameters
guestParamters
=
new
DynamicParameters
();
string
guestSql
=
"UPDATE RB_Order_Guest SET "
;
int
guestIndex
=
0
;
foreach
(
var
gItem
in
keyValues1
)
{
if
(
guestIndex
>
0
)
{
guestSql
+=
","
;
}
guestSql
+=
string
.
Format
(
"{0}=@{0} "
,
gItem
.
Key
);
guestParamters
.
Add
(
string
.
Format
(
"@{0}"
,
gItem
.
Key
),
gItem
.
Value
);
guestIndex
++;
}
guestSql
+=
string
.
Format
(
" WHERE 1=1 AND Id=@Id "
);
guestParamters
.
Add
(
"@Id"
,
gmodel
.
Id
);
flag
=
base
.
Execute
(
guestSql
,
guestParamters
)
>
0
;
}
}
if
(
item
.
AppointType
!=
3
)
{
//写入签到数据表 (非重复上课的 才写入签到数据)
var
tlist
=
timeList
.
Where
(
x
=>
x
.
ClassPlanId
==
item
.
ClassPlanId
).
ToList
();
foreach
(
var
qitem
in
tlist
)
{
var
ccModel
=
clist
.
Where
(
x
=>
x
.
StartTime
==
qitem
.
StartTime
).
FirstOrDefault
();
if
(
ccModel
!=
null
&&
!
oldCheckList
.
Where
(
x
=>
x
.
OrderGuestId
==
item
.
GuestId
&&
x
.
ClassTimeId
==
qitem
.
ClassTimeId
).
Any
())
{
//没有数据的插入 (有数据情况 =》 请假数据)
base
.
Insert
(
new
RB_Class_Check
()
{
ClassCheckId
=
0
,
ClassId
=
0
,
ClassDate
=
item
.
Date
,
Status
=
0
,
ClassRoomId
=
item
.
RoomId
,
Group_Id
=
item
.
Group_Id
,
School_Id
=
qitem
.
School_Id
,
TeacherId
=
item
.
TeacherId
,
OrderGuestId
=
item
.
GuestId
,
CheckStatus
=
0
,
CreateBy
=
0
,
CreateTime
=
DateTime
.
Now
,
StudyNum
=
ccModel
.
Minutes
,
MakeUpStatus
=
1
,
CurrentDeductionHours
=
ccModel
.
ClassHours
,
IsAbsentHours
=
0
,
ClassTimeId
=
qitem
.
ClassTimeId
});
}
}
}
}
}
}
return
flag
;
}
/// <summary>
/// <summary>
/// 新增日志
/// 新增日志
/// </summary>
/// </summary>
...
@@ -1358,142 +1477,6 @@ WHERE 1=1 AND A.Status=0 {1} ", builderMakeUp.ToString(), builderWhere.ToString
...
@@ -1358,142 +1477,6 @@ WHERE 1=1 AND A.Status=0 {1} ", builderMakeUp.ToString(), builderWhere.ToString
}
}
/// <summary>
/// 计算学员缺课课时
/// </summary>
/// <param name="guestModel"></param>
/// <param name="checkModel"></param>
/// <returns></returns>
public
bool
CalcGuestHoursRepository
(
RB_Order_Guest
guestModel
,
RB_Class_Check_ViewModel
checkModel
)
{
bool
flag
=
true
;
//if (guestModel.GuestState == GuestStateEnum.Normal)
//{
// decimal NoFinishHours = 0;
// //获取以前所有签到列表【倒叙】
// var checkList = GetClassCheckListRepository(new RB_Class_Check_ViewModel()
// {
// ClassId = checkModel.ClassId,
// OrderGuestId = checkModel.OrderGuestId,
// EndDate = Common.ConvertHelper.FormatDate(checkModel.ClassDate)
// }).OrderByDescending(qitem => qitem.ClassDate).ToList();
// for (var i = 0; i < checkList.Count; i++)
// {
// if ((checkList[i].CheckStatus == 1) && (checkList[i].MakeUpStatus == 3 || checkList[i].MakeUpStatus == 4 || checkList[i].MakeUpStatus == 1))
// {
// NoFinishHours += checkList[i].CurrentDeductionHours;
// }
// else
// {
// break;
// }
// }
// Dictionary<string, object> fileds = new Dictionary<string, object>();
// Dictionary<string, object> checkFileds = new Dictionary<string, object>();
// //缺勤课时超过12课时更新学员状态为【停课】
// if (NoFinishHours >= Common.Config.AbsentHours)
// {
// fileds.Add(nameof(RB_Order_Guest_ViewModel.GuestState), (int)GuestStateEnum.StopClasses);
// checkFileds.Add(nameof(RB_Class_Check_ViewModel.IsAbsentHours), 1);
// checkFileds.Add(nameof(RB_Class_Check_ViewModel.MakeUpStatus), 4);
// var orderModel = orderRepository.GetEntity(guestModel.OrderId);
// var shengyuMoney = orderModel.PreferPrice - orderModel.Income + orderModel.Refund - orderModel.PlatformTax - orderModel.DiscountMoney - orderModel.LessPrice;
// var classModel = classRepository.GetEntity<RB_Class_ViewModel>(guestModel.ClassId);
// var sellerInfo = UserReidsCache.GetUserLoginInfo(orderModel.EnterID);
// #region 欠费提醒(销售)
// var queryTargetWorkId = accountRepository.GetWorkUserIdRepository(orderModel.EnterID);
// if (!string.IsNullOrEmpty(queryTargetWorkId))
// {
// // 学员名称(名称+电话),剩余课时,关联单号,待收金额,班级老师,班级名称
// var path = $"/sale/myOrder?OrderId={guestModel.OrderId}";
// path = HttpUtility.UrlEncode(path);
// string markdownContent = $"`停课通知` 学员欠费停课通知\n>**概要信息** \n>学员名称:{guestModel.GuestName}({guestModel.Mobile})\n>当前状态:<font color='warning'>停课</font>\n>关联单号:{guestModel.OrderId}\n>\n>待收金额:<font color='warning'>¥{shengyuMoney:0.00}</font>\n>停课理由:连续缺课超过{Config.AbsentHours}课时,系统自动停课\n>班级名称:<font>{classModel.ClassName}</font>\n>请点击:[查看详情]({Config.ErpUrl}/autologin?loginId={orderModel.EnterID}&target={path})";
// Common.Message.PushMessageModel modelWork = new Common.Message.PushMessageModel()
// {
// CategoryId = PushMessageCategoryEnum.SalePeople,
// Content = markdownContent,
// CoverImg = "",
// CreateByName = "系统",
// JumpUrl = "",
// WorkMsgType = "markdown",
// SendTime = DateTime.Now,
// SendType = 0,
// Title = "学员欠费停课通知",
// Platform = 5,
// ReceiveId = queryTargetWorkId
// };
// List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
// new Common.Message.MessageHelper().SendMessage(pushList);
// }
// #endregion
// #region 欠费提醒(管理者)
// var queryNotifyManager = GetWorkUserIdByDictRepository("Push_Arrears");
// if (queryNotifyManager != null && queryNotifyManager.Count > 0)
// {
// queryNotifyManager.ForEach(x =>
// {
// var path = $"/sale/orderStatistics?OrderId={guestModel.OrderId}";
// path = HttpUtility.UrlEncode(path);
// string markdownContent = $"`停课通知` 学员欠费停课通知\n>**概要信息** \n>学员名称:{guestModel.GuestName}({guestModel.Mobile})\n>当前状态:<font color='warning'>停课</font>\n>关联单号:{guestModel.OrderId}({sellerInfo.AccountName})\n>\n>待收金额:<font color='warning'>¥{shengyuMoney:0.00}</font>\n>停课理由:连续缺课超过{Common.Config.AbsentHours}课时,系统自动停课\n>班级名称:<font>{classModel.ClassName}</font>\n>请点击:[查看详情]({Common.Config.ErpUrl}/autologin?loginId={x.Id}&target={path})";
// Common.Message.PushMessageModel modelWork = new Common.Message.PushMessageModel()
// {
// CategoryId = PushMessageCategoryEnum.SalePeople,
// Content = markdownContent,
// CoverImg = "",
// CreateByName = "系统",
// JumpUrl = "",
// WorkMsgType = "markdown",
// SendTime = DateTime.Now,
// SendType = 0,
// Title = "学员欠费停课通知",
// Platform = 5,
// ReceiveId = x.WorkUserId
// };
// List<Common.Message.PushMessageModel> pushList = new List<Common.Message.PushMessageModel>() { modelWork };
// new Common.Message.MessageHelper().SendMessage(pushList);
// });
// }
// #endregion
// }
// if (fileds != null && fileds.Count > 0 && checkFileds != null && checkFileds.Count > 0)
// {
// List<WhereHelper> wheres = new List<WhereHelper>()
// {
// new WhereHelper (nameof(RB_Order_Guest_ViewModel.Id),guestModel.Id),
// };
// flag = order_GuestRepository.Update(fileds, wheres);
// List<WhereHelper> checkWheres = new List<WhereHelper>()
// {
// new WhereHelper (nameof(RB_Class_Check_ViewModel.ClassCheckId),checkModel.ClassCheckId),
// };
// flag = classCheckRepository.Update(checkFileds, checkWheres);
// }
// if (flag && checkModel.CheckStatus == 1 && checkModel.IsUpdateMakeUp != 1)
// {
// //请假的 因为不扣课时, 无法进补课
// flag = student_MakeupRepository.SetStudentMakeUpRepository(new RB_Student_Makeup()
// {
// Id = 0,
// ClassCheckId = checkModel.ClassCheckId,
// ClassDate = checkModel.ClassDate,
// ClassId = checkModel.ClassId,
// CreateBy = checkModel.CreateBy,
// CreateTime = checkModel.CreateTime,
// Group_Id = checkModel.Group_Id,
// MakeUpStatus = 1,
// OrderGuestId = checkModel.OrderGuestId
// });
// }
//}
return
flag
;
}
/// <summary>
/// <summary>
/// 根据订单编号获取订单列表
/// 根据订单编号获取订单列表
/// </summary>
/// </summary>
...
@@ -1532,14 +1515,22 @@ WHERE 1=1 AND A.Id IN({0})
...
@@ -1532,14 +1515,22 @@ WHERE 1=1 AND A.Id IN({0})
/// </summary>
/// </summary>
/// <param name="ClassTimeIds"></param>
/// <param name="ClassTimeIds"></param>
/// <returns></returns>
/// <returns></returns>
public
List
<
RB_Class_Time_ViewModel
>
GetClassTimeListRepository
(
string
ClassTimeIds
)
public
List
<
RB_Class_Time_ViewModel
>
GetClassTimeListRepository
(
string
ClassTimeIds
,
string
PlanIds
)
{
{
StringBuilder
builder
=
new
StringBuilder
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
builder
.
AppendFormat
(
@"
SELECT A.*
SELECT A.*
FROM RB_Class_Time AS A
FROM RB_Class_Time AS A
WHERE 1=1 AND A.ClassTimeId IN({0})
WHERE 1=1
"
,
ClassTimeIds
);
"
);
if
(!
string
.
IsNullOrEmpty
(
ClassTimeIds
))
{
builder
.
AppendFormat
(
" AND A.ClassTimeId IN({0}) "
,
ClassTimeIds
);
}
if
(!
string
.
IsNullOrEmpty
(
PlanIds
))
{
builder
.
AppendFormat
(
" AND A.ClassPlanId IN({0}) "
,
PlanIds
);
}
return
Get
<
RB_Class_Time_ViewModel
>(
builder
.
ToString
()).
ToList
();
return
Get
<
RB_Class_Time_ViewModel
>(
builder
.
ToString
()).
ToList
();
}
}
...
...
Edu.WebApi/Controllers/Course/ScrollController.cs
View file @
694e001b
...
@@ -1131,27 +1131,6 @@ namespace Edu.WebApi.Controllers.Course
...
@@ -1131,27 +1131,6 @@ namespace Edu.WebApi.Controllers.Course
#
endregion
#
endregion
#
region
初始化约课数据
/// <summary>
/// 初始化约课数据
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
InitializeAppointmentData
()
{
var
userInfo
=
base
.
UserInfo
;
string
msg
=
scrollClassModule
.
InitializeAppointmentData
(
userInfo
.
Group_Id
);
if
(
msg
==
""
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
(
msg
);
}
}
#
endregion
#
region
学员管理
#
region
学员管理
...
...
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