Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EduSpider
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
viitto
EduSpider
Commits
0edafc5f
Commit
0edafc5f
authored
May 30, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
59e759f7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
193 additions
and
57 deletions
+193
-57
ExamWorkResult.cs
EduSpider.Model/Extend/ExamWorkResult.cs
+5
-0
CourseCommentRepository.cs
EduSpider.Repository/CourseCommentRepository.cs
+4
-0
StuHomeWorkRepository.cs
EduSpider.Repository/StuHomeWorkRepository.cs
+181
-56
TeacherController.cs
EduSpider.WebApi/Controllers/Student/TeacherController.cs
+3
-1
No files found.
EduSpider.Model/Extend/ExamWorkResult.cs
View file @
0edafc5f
...
...
@@ -16,6 +16,11 @@ namespace EduSpider.Model.Extend
/// </summary>
public
int
RowNum
{
get
;
set
;
}
/// <summary>
/// 作业编号
/// </summary>
public
int
Stu_HomeWork_Id
{
get
;
set
;
}
/// <summary>
/// 创建时间
/// </summary>
...
...
EduSpider.Repository/CourseCommentRepository.cs
View file @
0edafc5f
...
...
@@ -73,6 +73,10 @@ WHERE 1=1
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Course_Comment_Extend
.
CourseId
),
query
.
CourseId
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
QCourseIds
))
{
builder
.
AppendFormat
(
" AND A.{0} IN({1}) "
,
nameof
(
RB_Course_Comment_Extend
.
CourseId
),
query
.
QCourseIds
);
}
}
var
list
=
Get
<
RB_Course_Comment_Extend
>(
builder
.
ToString
()).
ToList
();
if
(
list
!=
null
&&
list
.
Count
>
0
)
...
...
EduSpider.Repository/StuHomeWorkRepository.cs
View file @
0edafc5f
...
...
@@ -25,6 +25,11 @@ namespace EduSpider.Repository
/// </summary>
private
readonly
StuCommentRepository
stuCommentRepository
=
new
();
/// <summary>
/// 课程评价配置仓储对象
/// </summary>
private
readonly
CourseCommentRepository
courseCommentRepository
=
new
();
/// <summary>
/// 批量添加学生家庭作业
/// </summary>
...
...
@@ -100,90 +105,196 @@ WHERE 1=1
Score_Value
=
item
.
Score_value
,
HomeWorkStatus
=
item
.
status
,
ThName
=
item
.
th_name
,
Stu_HomeWork_Id
=
item
.
stu_homework_id
,
});
RowNum
++;
}
}
var
commentList
=
stuCommentRepository
.
GetStuCommentListRepository
(
new
CourseQuery
()
{
CourseId
=
query
.
CourseId
,
StuIds
=
query
.
StuIds
});
//课程配置评论列表
var
courseCommentModel
=
courseCommentRepository
.
GetCourseCommentListRepository
(
new
CourseQuery
()
{
QCourseIds
=
query
.
CourseId
.
ToString
()
}).
FirstOrDefault
();
//学员评论列表
var
commentList
=
stuCommentRepository
.
GetStuCommentListRepository
(
new
CourseQuery
()
{
CourseId
=
query
.
CourseId
,
StuIds
=
query
.
StuIds
});
ExamWorkResult
firstComment
=
null
;
ExamWorkResult
secondComment
=
null
;
ExamWorkResult
thirdComment
=
null
;
string
info
;
if
(
homeWorkList
!=
null
&&
homeWorkList
.
Count
>
0
)
{
if
(
homeWorkList
.
Count
>=
5
)
{
var
firstList
=
homeWorkList
.
Where
(
qitem
=>
qitem
.
RowNum
<=
5
).
ToList
();
var
score
=
firstList
.
Average
(
qitem
=>
qitem
.
Score_p
)
*
100
;
var
commentModel
=
commentRepository
.
GetComment
(
score
);
firstComment
=
new
ExamWorkResult
()
var
firstScore
=
firstList
.
Average
(
qitem
=>
qitem
.
Score_p
)
*
100
;
info
=
""
;
var
commentModel
=
commentRepository
.
GetComment
(
firstScore
);
if
(
courseCommentModel
!=
null
&&
courseCommentModel
.
CommentDetails
!=
null
&&
courseCommentModel
.
CommentDetails
.
Count
()
>
0
)
{
CreateTime
=
firstList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
ResultType
=
3
,
Title
=
firstList
.
LastOrDefault
().
ThName
+
"老师的评语"
,
Comment
=
commentModel
?.
Info
};
stuCommentRepository
.
Insert
(
new
RB_Stu_Comment
()
var
tempModel
=
courseCommentModel
.
CommentDetails
.
Where
(
qitem
=>
qitem
.
StartNum
<=
firstScore
&&
firstScore
<
qitem
.
EndNum
)?.
FirstOrDefault
();
if
(
tempModel
!=
null
)
{
info
=
tempModel
?.
Info
??
""
;
}
else
{
info
=
commentModel
?.
Info
??
""
;
}
}
else
{
Id
=
0
,
CourseId
=
query
.
CourseId
,
StuUid
=
Convert
.
ToInt32
(
query
.
StuIds
),
Info
=
commentModel
?.
Info
,
CreateByName
=
firstList
.
LastOrDefault
().
ThName
,
CreateTime
=
firstList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
Times
=
1
});
info
=
commentModel
?.
Info
??
""
;
}
if
(
commentList
?.
Where
(
qitem
=>
qitem
.
CourseId
==
qitem
.
CourseId
&&
qitem
.
HomeWorkId
==
firstList
.
LastOrDefault
().
Stu_HomeWork_Id
&&
qitem
.
CreateType
==
1
).
Count
()
>
0
)
{
var
tempModel
=
commentList
.
Where
(
qitem
=>
qitem
.
CourseId
==
qitem
.
CourseId
&&
qitem
.
HomeWorkId
==
firstList
.
LastOrDefault
().
Stu_HomeWork_Id
&&
qitem
.
CreateType
==
1
).
FirstOrDefault
();
firstComment
=
new
ExamWorkResult
()
{
CreateTime
=
tempModel
.
CreateTime
,
ResultType
=
3
,
Title
=
firstList
.
LastOrDefault
().
ThName
+
"老师的评语"
,
Comment
=
tempModel
?.
Info
};
}
else
{
firstComment
=
new
ExamWorkResult
()
{
CreateTime
=
firstList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
ResultType
=
3
,
Title
=
firstList
.
LastOrDefault
().
ThName
+
"老师的评语"
,
Comment
=
info
};
stuCommentRepository
.
SetStuCommentRepository
(
new
RB_Stu_Comment
()
{
Id
=
0
,
HomeWorkId
=
firstList
.
LastOrDefault
().
Stu_HomeWork_Id
,
StuUid
=
Convert
.
ToInt32
(
query
.
StuIds
),
CourseId
=
query
.
CourseId
,
Times
=
1
,
Info
=
info
,
CreateType
=
1
,
CreateByName
=
firstList
.
LastOrDefault
().
ThName
,
CreateTime
=
firstList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
});
}
}
if
(
homeWorkList
.
Count
>=
9
)
{
var
secondList
=
homeWorkList
.
Where
(
qitem
=>
qitem
.
RowNum
>
5
&&
qitem
.
RowNum
<=
9
).
ToList
();
var
score
=
secondList
.
Average
(
qitem
=>
qitem
.
Score_p
)
*
100
;
var
commentModel
=
commentRepository
.
GetComment
(
score
);
secondComment
=
new
ExamWorkResult
()
var
secondScore
=
secondList
.
Average
(
qitem
=>
qitem
.
Score_p
)
*
100
;
info
=
""
;
var
commentModel
=
commentRepository
.
GetComment
(
secondScore
);
if
(
courseCommentModel
!=
null
&&
courseCommentModel
.
CommentDetails
!=
null
&&
courseCommentModel
.
CommentDetails
.
Count
()
>
0
)
{
CreateTime
=
secondList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
ResultType
=
3
,
Title
=
secondList
.
LastOrDefault
().
ThName
+
"老师的评语"
,
Comment
=
commentModel
?.
Info
};
stuCommentRepository
.
Insert
(
new
RB_Stu_Comment
()
var
tempModel
=
courseCommentModel
.
CommentDetails
.
Where
(
qitem
=>
qitem
.
StartNum
<=
secondScore
&&
secondScore
<
qitem
.
EndNum
)?.
FirstOrDefault
();
if
(
tempModel
!=
null
)
{
info
=
tempModel
?.
Info
??
""
;
}
else
{
info
=
commentModel
?.
Info
??
""
;
}
}
else
{
Id
=
0
,
CourseId
=
query
.
CourseId
,
StuUid
=
Convert
.
ToInt32
(
query
.
StuIds
),
Info
=
commentModel
?.
Info
,
CreateByName
=
secondList
.
LastOrDefault
().
ThName
,
CreateTime
=
secondList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
Times
=
2
});
info
=
commentModel
?.
Info
??
""
;
}
if
(
commentList
?.
Where
(
qitem
=>
qitem
.
CourseId
==
qitem
.
CourseId
&&
qitem
.
HomeWorkId
==
secondList
.
LastOrDefault
().
Stu_HomeWork_Id
&&
qitem
.
CreateType
==
1
).
Count
()
>
0
)
{
var
tempModel
=
commentList
.
Where
(
qitem
=>
qitem
.
CourseId
==
qitem
.
CourseId
&&
qitem
.
HomeWorkId
==
secondList
.
LastOrDefault
().
Stu_HomeWork_Id
&&
qitem
.
CreateType
==
1
).
FirstOrDefault
();
secondComment
=
new
ExamWorkResult
()
{
CreateTime
=
tempModel
.
CreateTime
,
ResultType
=
3
,
Title
=
secondList
.
LastOrDefault
().
ThName
+
"老师的评语"
,
Comment
=
tempModel
?.
Info
};
}
else
{
secondComment
=
new
ExamWorkResult
()
{
CreateTime
=
secondList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
ResultType
=
3
,
Title
=
secondList
.
LastOrDefault
().
ThName
+
"老师的评语"
,
Comment
=
info
,
};
stuCommentRepository
.
SetStuCommentRepository
(
new
RB_Stu_Comment
()
{
Id
=
0
,
HomeWorkId
=
secondList
.
LastOrDefault
().
Stu_HomeWork_Id
,
StuUid
=
Convert
.
ToInt32
(
query
.
StuIds
),
CourseId
=
query
.
CourseId
,
Times
=
2
,
Info
=
info
,
CreateType
=
1
,
CreateByName
=
secondList
.
LastOrDefault
().
ThName
,
CreateTime
=
secondList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
});
}
}
if
(
homeWorkList
.
Count
>=
13
)
{
var
thirdList
=
homeWorkList
.
Where
(
qitem
=>
qitem
.
RowNum
>
9
).
ToList
();
var
score
=
thirdList
.
Average
(
qitem
=>
qitem
.
Score_p
)
*
100
;
var
commentModel
=
commentRepository
.
GetComment
(
score
);
thirdComment
=
new
ExamWorkResult
()
var
thirdList
=
homeWorkList
.
Where
(
qitem
=>
qitem
.
RowNum
>
9
&&
qitem
.
RowNum
<=
13
).
ToList
();
var
thirdScore
=
thirdList
.
Average
(
qitem
=>
qitem
.
Score_p
)
*
100
;
info
=
""
;
var
commentModel
=
commentRepository
.
GetComment
(
thirdScore
);
if
(
courseCommentModel
!=
null
&&
courseCommentModel
.
CommentDetails
!=
null
&&
courseCommentModel
.
CommentDetails
.
Count
()
>
0
)
{
CreateTime
=
thirdList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
ResultType
=
3
,
Title
=
thirdList
.
LastOrDefault
().
ThName
+
"老师的评语"
,
Comment
=
commentModel
?.
Info
};
stuCommentRepository
.
Insert
(
new
RB_Stu_Comment
()
var
tempModel
=
courseCommentModel
.
CommentDetails
.
Where
(
qitem
=>
qitem
.
StartNum
<=
thirdScore
&&
thirdScore
<
qitem
.
EndNum
)?.
FirstOrDefault
();
if
(
tempModel
!=
null
)
{
info
=
tempModel
?.
Info
??
""
;
}
else
{
info
=
commentModel
?.
Info
??
""
;
}
}
else
{
Id
=
0
,
CourseId
=
query
.
CourseId
,
StuUid
=
Convert
.
ToInt32
(
query
.
StuIds
),
Info
=
commentModel
?.
Info
,
CreateByName
=
thirdList
.
LastOrDefault
().
ThName
,
CreateTime
=
thirdList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
Times
=
3
});
info
=
commentModel
?.
Info
??
""
;
}
if
(
commentList
?.
Where
(
qitem
=>
qitem
.
CourseId
==
qitem
.
CourseId
&&
qitem
.
HomeWorkId
==
thirdList
.
LastOrDefault
().
Stu_HomeWork_Id
&&
qitem
.
CreateType
==
1
).
Count
()
>
0
)
{
var
tempModel
=
commentList
.
Where
(
qitem
=>
qitem
.
CourseId
==
qitem
.
CourseId
&&
qitem
.
HomeWorkId
==
thirdList
.
LastOrDefault
().
Stu_HomeWork_Id
&&
qitem
.
CreateType
==
1
).
FirstOrDefault
();
thirdComment
=
new
ExamWorkResult
()
{
CreateTime
=
tempModel
.
CreateTime
,
ResultType
=
3
,
Title
=
thirdList
.
LastOrDefault
().
ThName
+
"老师的评语"
,
Comment
=
tempModel
?.
Info
};
}
else
{
thirdComment
=
new
ExamWorkResult
()
{
CreateTime
=
thirdList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
ResultType
=
3
,
Title
=
thirdList
.
LastOrDefault
().
ThName
+
"老师的评语"
,
Comment
=
info
,
};
stuCommentRepository
.
SetStuCommentRepository
(
new
RB_Stu_Comment
()
{
Id
=
0
,
HomeWorkId
=
thirdList
.
LastOrDefault
().
Stu_HomeWork_Id
,
StuUid
=
Convert
.
ToInt32
(
query
.
StuIds
),
CourseId
=
query
.
CourseId
,
Times
=
3
,
Info
=
info
,
CreateType
=
1
,
CreateByName
=
thirdList
.
LastOrDefault
().
ThName
,
CreateTime
=
thirdList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
});
}
}
}
//添加系统自动生成评语
for
(
var
i
=
0
;
i
<
homeWorkList
.
Count
;
i
++)
{
var
item
=
homeWorkList
[
i
];
...
...
@@ -202,6 +313,20 @@ WHERE 1=1
list
.
Add
(
thirdComment
);
}
}
//添加自定义评语
if
(
commentList
?.
Where
(
qitem
=>
qitem
.
CourseId
==
qitem
.
CourseId
&&
qitem
.
CreateType
==
2
).
Count
()
>
0
)
{
foreach
(
var
item
in
commentList
?.
Where
(
qitem
=>
qitem
.
CourseId
==
qitem
.
CourseId
&&
qitem
.
CreateType
==
2
))
{
list
.
Add
(
new
ExamWorkResult
()
{
CreateTime
=
item
.
CreateTime
,
ResultType
=
3
,
Title
=
item
.
CreateByName
+
"老师的评语"
,
Comment
=
item
?.
Info
});
}
}
return
list
;
}
}
...
...
EduSpider.WebApi/Controllers/Student/TeacherController.cs
View file @
0edafc5f
...
...
@@ -31,11 +31,13 @@ namespace EduSpider.WebApi.Controllers
[
HttpGet
]
public
ApiResult
GetTeacherCourse
()
{
var
userInfo
=
base
.
UserInfo
;
var
query
=
new
Model
.
Query
.
CourseQuery
()
{
TeacherIds
=
base
.
BaseUser
Id
.
ToString
(),
TeacherIds
=
userInfo
.
Account
Id
.
ToString
(),
KeyWords
=
base
.
ReqParameters
.
GetString
(
"KeyWords"
),
};
//全部课程
List
<
object
>
AllCourseList
=
new
();
//已结课
...
...
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