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
8a800efb
Commit
8a800efb
authored
Jun 06, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
2da263d4
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
130 additions
and
77 deletions
+130
-77
ICommentRepository.cs
EduSpider.IRepository/ICommentRepository.cs
+0
-7
ICourseService.cs
EduSpider.IServices/ICourseService.cs
+1
-1
RB_Stu_Comment.cs
EduSpider.Model/Entity/RB_Stu_Comment.cs
+5
-0
CommentDetailsRepository.cs
EduSpider.Repository/CommentDetailsRepository.cs
+1
-0
CommentRepository.cs
EduSpider.Repository/CommentRepository.cs
+7
-32
StuCommentRepository.cs
EduSpider.Repository/StuCommentRepository.cs
+0
-1
StuHomeWorkRepository.cs
EduSpider.Repository/StuHomeWorkRepository.cs
+32
-24
CourseService.cs
EduSpider.Services/CourseService.cs
+5
-6
TeacherController.cs
EduSpider.WebApi/Controllers/Student/TeacherController.cs
+79
-6
No files found.
EduSpider.IRepository/ICommentRepository.cs
View file @
8a800efb
...
...
@@ -18,13 +18,6 @@ namespace EduSpider.IRepository
/// <returns></returns>
public
bool
SetCommentRepository
(
RB_Comment_Extend
model
);
/// <summary>
/// 根据查询条件获取评语
/// </summary>
/// <param name="Score"></param>
/// <returns></returns>
public
RB_Comment_Extend
GetComment
(
decimal
Score
);
/// <summary>
/// 获取系统配置评价列表
/// </summary>
...
...
EduSpider.IServices/ICourseService.cs
View file @
8a800efb
...
...
@@ -143,6 +143,6 @@ namespace EduSpider.IServices
/// </summary>
/// <param name="CourseId">课程编号</param>
/// <returns></returns>
public
void
CreateHomeWorkComment
(
int
CourseId
);
public
List
<
ExamWorkResult
>
CreateHomeWorkComment
(
int
CourseId
);
}
}
EduSpider.Model/Entity/RB_Stu_Comment.cs
View file @
8a800efb
...
...
@@ -15,6 +15,11 @@ namespace EduSpider.Model.Entity
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 开始作业编号
/// </summary>
public
int
StartHomeWorkId
{
get
;
set
;
}
/// <summary>
/// 家庭作业编号
/// </summary>
...
...
EduSpider.Repository/CommentDetailsRepository.cs
View file @
8a800efb
...
...
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VTX.FW.DB.Dapper
;
namespace
EduSpider.Repository
{
...
...
EduSpider.Repository/CommentRepository.cs
View file @
8a800efb
...
...
@@ -53,31 +53,6 @@ namespace EduSpider.Repository
return
flag
;
}
/// <summary>
/// 获取评语
/// </summary>
/// <param name="Score"></param>
/// <returns></returns>
public
RB_Comment_Extend
GetComment
(
decimal
Score
)
{
StringBuilder
builder
=
new
();
builder
.
AppendFormat
(
@"
SELECT A.*
FROM RB_Comment AS A
WHERE 1=1
"
);
if
(
Score
>
0
)
{
builder
.
AppendFormat
(
@" AND A.StartNum<{0} AND {0}<=A.EndNum "
,
Score
);
}
else
{
builder
.
AppendFormat
(
@" AND A.StartNum<={0} AND {0}<=A.EndNum "
,
Score
);
}
return
base
.
Get
<
RB_Comment_Extend
>(
builder
.
ToString
()).
ToList
().
FirstOrDefault
();
}
/// <summary>
/// 获取系统配置评价列表
/// </summary>
...
...
@@ -93,32 +68,32 @@ WHERE 1=1
"
);
if
(!
string
.
IsNullOrEmpty
(
KeyWords
))
{
if
(
KeyWords
.
Contains
(
"高
中
"
))
if
(
KeyWords
.
Contains
(
"高"
))
{
builder
.
AppendFormat
(
" AND A.{0} LIKE @KeyWords1 "
,
nameof
(
RB_Comment_Extend
.
KeyWords
));
parameters
.
Add
(
"KeyWords1"
,
"
高中
"
);
parameters
.
Add
(
"KeyWords1"
,
"
%高%
"
);
}
if
(
KeyWords
.
Contains
(
"初
中
"
))
if
(
KeyWords
.
Contains
(
"初"
))
{
builder
.
AppendFormat
(
" AND A.{0} LIKE @KeyWords2 "
,
nameof
(
RB_Comment_Extend
.
KeyWords
));
parameters
.
Add
(
"KeyWords2"
,
"
初中
"
);
parameters
.
Add
(
"KeyWords2"
,
"
%初%
"
);
}
if
(
KeyWords
.
Contains
(
"化学"
))
{
builder
.
AppendFormat
(
" AND A.{0} LIKE @KeyWords3 "
,
nameof
(
RB_Comment_Extend
.
KeyWords
));
parameters
.
Add
(
"KeyWords3"
,
"
化学
"
);
parameters
.
Add
(
"KeyWords3"
,
"
%化学%
"
);
}
if
(
KeyWords
.
Contains
(
"数学"
))
{
builder
.
AppendFormat
(
" AND A.{0} LIKE @KeyWords4 "
,
nameof
(
RB_Comment_Extend
.
KeyWords
));
parameters
.
Add
(
"KeyWords4"
,
"
数学
"
);
parameters
.
Add
(
"KeyWords4"
,
"
%数学%
"
);
}
}
if
(
CommentTimes
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Comment_Extend
.
Times
),
CommentTimes
);
}
var
model
=
base
.
Get
<
RB_Comment_Extend
>(
builder
.
ToString
()).
ToList
().
FirstOrDefault
();
var
model
=
base
.
Get
<
RB_Comment_Extend
>(
builder
.
ToString
()
,
parameters
).
ToList
().
FirstOrDefault
();
if
(
model
!=
null
&&
model
.
Id
>
0
)
{
string
Ids
=
model
.
Id
.
ToString
();
...
...
EduSpider.Repository/StuCommentRepository.cs
View file @
8a800efb
...
...
@@ -87,7 +87,6 @@ WHERE 1=1
{
bool
flag
=
false
;
// 以前批量添加接口
// flag = base.BatchInsert(list);
foreach
(
var
item
in
list
)
{
var
defaultModel
=
GetStuCommentListRepository
(
new
CourseQuery
()
...
...
EduSpider.Repository/StuHomeWorkRepository.cs
View file @
8a800efb
...
...
@@ -18,7 +18,7 @@ namespace EduSpider.Repository
/// <summary>
/// 评语配置仓储层对象
/// </summary>
private
readonly
CommentRepository
commentRepository
=
new
();
private
readonly
ICommentRepository
commentRepository
=
new
CommentRepository
();
/// <summary>
/// 学员评论仓储层对象
...
...
@@ -89,14 +89,14 @@ WHERE 1=1
List
<
ExamWorkResult
>
list
=
new
();
var
dataList
=
GetStuHomeWorkDetailsListRepository
(
new
CourseQuery
()
{
CourseId
=
CourseId
});
var
courseList
=
dataList
.
GroupBy
(
qitem
=>
new
{
qitem
.
course_id
}).
Select
(
qitem
=>
new
{
qitem
.
Key
.
course_id
});
var
courseList
=
dataList
.
GroupBy
(
qitem
=>
new
{
qitem
.
course_id
,
qitem
.
CourseName
}).
Select
(
qitem
=>
new
{
qitem
.
Key
.
course_id
,
qitem
.
Key
.
CourseName
});
if
(
courseList
!=
null
&&
courseList
.
Any
())
{
foreach
(
var
cItem
in
courseList
)
{
var
stuList
=
dataList
.
Where
(
qitem
=>
qitem
.
course_id
==
cItem
.
course_id
).
GroupBy
(
qitem
=>
new
{
qitem
.
student_uid
}).
Select
(
qitem
=>
new
{
qitem
.
Key
.
student_uid
});
//课程配置评论列表
var
courseComment
Model
=
courseCommentRepository
.
GetCourseCommentListRepository
(
new
CourseQuery
()
{
QCourseIds
=
cItem
.
course_id
.
ToString
()
}).
FirstOrDefault
(
);
var
courseComment
List
=
courseCommentRepository
.
GetCourseCommentListRepository
(
new
CourseQuery
()
{
QCourseIds
=
cItem
.
course_id
.
ToString
()
}
);
foreach
(
var
sItem
in
stuList
)
{
...
...
@@ -140,7 +140,7 @@ WHERE 1=1
{
var
firstScore
=
firstList
.
Average
(
qitem
=>
qitem
.
Score_p
)
*
100
;
string
title
=
firstList
.
LastOrDefault
().
ThName
+
"老师的评语"
;
info
=
GetCommentInfo
(
courseComment
Model
,
firstScore
);
info
=
GetCommentInfo
(
courseComment
List
,
cItem
.
CourseName
,
1
,
firstScore
);
var
First_Stu_HomeWork_Id
=
firstList
.
LastOrDefault
().
Stu_HomeWork_Id
;
var
tempModel
=
GetSystemCreateComment
(
commentList
,
cItem
.
course_id
,
First_Stu_HomeWork_Id
);
var
firstNum
=
CreateRandomNum
();
...
...
@@ -161,6 +161,7 @@ WHERE 1=1
stuCommentRepository
.
SetStuCommentRepository
(
new
RB_Stu_Comment
()
{
Id
=
0
,
StartHomeWorkId
=
firstList
.
FirstOrDefault
().
Stu_HomeWork_Id
,
HomeWorkId
=
First_Stu_HomeWork_Id
,
StuUid
=
Convert
.
ToInt32
(
sItem
.
student_uid
),
CourseId
=
cItem
.
course_id
,
...
...
@@ -183,7 +184,7 @@ WHERE 1=1
if
(
secondList
.
Count
!=
secondSubmitCount
)
{
var
secondScore
=
secondList
.
Average
(
qitem
=>
qitem
.
Score_p
)
*
100
;
info
=
GetCommentInfo
(
courseComment
Model
,
secondScore
);
info
=
GetCommentInfo
(
courseComment
List
,
cItem
.
CourseName
,
2
,
secondScore
);
var
Second_Stu_HomeWork_Id
=
secondList
.
LastOrDefault
().
Stu_HomeWork_Id
;
var
secondModel
=
GetSystemCreateComment
(
commentList
,
cItem
.
course_id
,
Second_Stu_HomeWork_Id
);
var
secondNum
=
CreateRandomNum
();
...
...
@@ -204,6 +205,7 @@ WHERE 1=1
stuCommentRepository
.
SetStuCommentRepository
(
new
RB_Stu_Comment
()
{
Id
=
0
,
StartHomeWorkId
=
secondList
.
FirstOrDefault
().
Stu_HomeWork_Id
,
HomeWorkId
=
Second_Stu_HomeWork_Id
,
StuUid
=
Convert
.
ToInt32
(
sItem
.
student_uid
),
CourseId
=
cItem
.
course_id
,
...
...
@@ -226,7 +228,7 @@ WHERE 1=1
if
(
thirdList
.
Count
!=
thirdSubmitCount
)
{
var
thirdScore
=
thirdList
.
Average
(
qitem
=>
qitem
.
Score_p
)
*
100
;
info
=
GetCommentInfo
(
courseComment
Model
,
thirdScore
);
info
=
GetCommentInfo
(
courseComment
List
,
cItem
.
CourseName
,
3
,
thirdScore
);
var
Third_Stu_HomeWork_Id
=
thirdList
.
LastOrDefault
().
Stu_HomeWork_Id
;
var
thirdModel
=
GetSystemCreateComment
(
commentList
,
cItem
.
course_id
,
Third_Stu_HomeWork_Id
);
var
thirdNum
=
CreateRandomNum
();
...
...
@@ -246,6 +248,7 @@ WHERE 1=1
stuCommentRepository
.
SetStuCommentRepository
(
new
RB_Stu_Comment
()
{
Id
=
0
,
StartHomeWorkId
=
thirdList
.
FirstOrDefault
().
Stu_HomeWork_Id
,
HomeWorkId
=
Third_Stu_HomeWork_Id
,
StuUid
=
Convert
.
ToInt32
(
sItem
.
student_uid
),
CourseId
=
cItem
.
course_id
,
...
...
@@ -440,26 +443,31 @@ WHERE 1=1
/// <param name="courseCommentModel">课程评价配置</param>
/// <param name="Score">平均分数</param>
/// <returns></returns>
private
string
GetCommentInfo
(
RB_Course_Comment_Extend
courseCommentModel
,
decimal
Score
)
private
string
GetCommentInfo
(
List
<
RB_Course_Comment_Extend
>
courseCommentList
,
string
keyWords
,
int
Times
,
decimal
Score
)
{
string
info
=
""
;
//var commentModel = commentRepository.GetComment(Score);
//if (courseCommentModel != null && courseCommentModel.CommentDetails != null && courseCommentModel.CommentDetails.Count > 0)
//{
// var tempModel = courseCommentModel.CommentDetails.Where(qitem => qitem.StartNum <= Score && Score < qitem.EndNum)?.FirstOrDefault();
// if (tempModel != null)
// {
// info = tempModel?.Info ?? "";
// }
// else
// {
// info = commentModel?.Info ?? "";
// }
//}
//else
//{
// info = commentModel?.Info ?? "";
//}
var
courseCommentModel
=
courseCommentList
.
Where
(
qitem
=>
qitem
.
Times
==
Times
).
FirstOrDefault
();
if
(
courseCommentModel
!=
null
&&
courseCommentModel
.
CommentDetails
!=
null
&&
courseCommentModel
.
CommentDetails
.
Count
>
0
)
{
var
tempModel
=
courseCommentModel
.
CommentDetails
.
Where
(
qitem
=>
qitem
.
StartNum
<=
Score
&&
Score
<
qitem
.
EndNum
)?.
FirstOrDefault
();
if
(
tempModel
!=
null
)
{
info
=
tempModel
?.
Info
??
""
;
}
}
if
(
string
.
IsNullOrEmpty
(
info
))
{
var
commentModel
=
commentRepository
.
GetCommentListRepository
(
keyWords
,
Times
);
if
(
commentModel
!=
null
&&
commentModel
.
Details
!=
null
&&
commentModel
.
Details
.
Count
>
0
)
{
var
tempModel
=
commentModel
.
Details
.
Where
(
qitem
=>
qitem
.
StartNum
<=
Score
&&
Score
<
qitem
.
EndNum
)?.
FirstOrDefault
();
if
(
tempModel
!=
null
)
{
info
=
tempModel
?.
Info
??
""
;
}
}
}
return
info
;
}
}
...
...
EduSpider.Services/CourseService.cs
View file @
8a800efb
...
...
@@ -113,7 +113,7 @@ namespace EduSpider.Services
{
dataList
.
Add
(
new
ExamWorkResult
()
{
RowNum
=
item
.
RowNum
,
RowNum
=
item
.
RowNum
,
Stu_HomeWork_Id
=
item
.
Stu_HomeWork_Id
,
CreateTime
=
item
.
CreateTime
,
ResultType
=
item
.
ResultType
,
...
...
@@ -472,7 +472,7 @@ namespace EduSpider.Services
/// 获取系统评价配置
/// </summary>
/// <returns></returns>
public
RB_Comment_Extend
GetSysComment
(
string
KeyWords
,
int
CommentTimes
)
public
RB_Comment_Extend
GetSysComment
(
string
KeyWords
,
int
CommentTimes
)
{
var
model
=
CommentRepository
.
GetCommentListRepository
(
KeyWords
,
CommentTimes
);
return
model
;
...
...
@@ -483,10 +483,9 @@ namespace EduSpider.Services
/// </summary>
/// <param name="CourseId">课程编号</param>
/// <returns></returns>
public
void
CreateHomeWorkComment
(
int
CourseId
)
public
List
<
ExamWorkResult
>
CreateHomeWorkComment
(
int
CourseId
)
{
StuHomeWorkRepository
.
CreateHomeWorkCommentRepository
(
CourseId
);
return
StuHomeWorkRepository
.
CreateHomeWorkCommentRepository
(
CourseId
);
}
}
}
}
\ No newline at end of file
EduSpider.WebApi/Controllers/Student/TeacherController.cs
View file @
8a800efb
...
...
@@ -167,18 +167,90 @@ namespace EduSpider.WebApi.Controllers
else
{
var
sysModel
=
CourseService
.
GetSysComment
(
query
.
CourseName
,
query
.
CommentTimes
);
if
(
sysModel
!=
null
)
{
result
=
new
{
Id
=
0
,
Title
=
"系统默认配置"
,
query
.
CourseId
,
Times
=
query
.
CommentTimes
,
CommentDetails
=
sysModel
.
Details
,
};
}
else
{
result
=
new
{
Id
=
0
,
Title
=
"系统默认配置"
,
query
.
CourseId
,
Times
=
query
.
CommentTimes
,
CommentDetails
=
new
List
<
RB_Comment_Details
>()
};
}
}
return
ApiResult
.
Success
(
data
:
result
);
}
/// <summary>
/// 获取课程配置评价列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
HttpGet
]
public
ApiResult
GetCourseCommentList
()
{
var
query
=
new
Model
.
Query
.
CourseQuery
()
{
CourseId
=
base
.
ReqParameters
.
GetInt
(
"CourseId"
),
CourseName
=
base
.
ReqParameters
.
GetString
(
"CourseName"
),
};
var
courseRuleList
=
CourseService
.
GetCourseCommentList
(
query
);
object
result
=
new
object
();
if
(
courseRuleList
!=
null
)
{
result
=
new
{
Id
=
0
,
Title
=
"系统默认配置"
,
query
.
CourseId
,
Times
=
query
.
CommentTimes
,
CommentDetails
=
sysModel
.
Details
,
query
.
CourseName
,
CommentDetails
=
courseRuleList
,
};
}
else
{
var
sysModel
=
CourseService
.
GetSysComment
(
query
.
CourseName
,
query
.
CommentTimes
);
if
(
sysModel
!=
null
)
{
result
=
new
{
Id
=
0
,
Title
=
"系统默认配置"
,
query
.
CourseId
,
Times
=
query
.
CommentTimes
,
CommentDetails
=
sysModel
.
Details
,
};
}
else
{
result
=
new
{
Id
=
0
,
Title
=
"系统默认配置"
,
query
.
CourseId
,
Times
=
query
.
CommentTimes
,
CommentDetails
=
new
List
<
RB_Comment_Details
>()
};
}
}
return
ApiResult
.
Success
(
data
:
result
);
}
/// <summary>
/// 新增可以课程评语
/// </summary>
...
...
@@ -276,6 +348,7 @@ namespace EduSpider.WebApi.Controllers
var
model
=
new
RB_Stu_Comment
()
{
Id
=
base
.
ReqParameters
.
GetInt
(
"Id"
),
StartHomeWorkId
=
base
.
ReqParameters
.
GetInt
(
"StartHomeWorkId"
),
HomeWorkId
=
base
.
ReqParameters
.
GetInt
(
"HomeWorkId"
),
StuUid
=
stuObj
.
GetInt
(
"StuId"
),
CourseId
=
base
.
ReqParameters
.
GetInt
(
"CourseId"
),
...
...
@@ -500,8 +573,8 @@ namespace EduSpider.WebApi.Controllers
public
ApiResult
CreateCourseComment
()
{
int
CourseId
=
base
.
ReqParameters
.
GetInt
(
"CourseId"
);
CourseService
.
CreateHomeWorkComment
(
CourseId
);
return
ApiResult
.
Success
();
var
list
=
CourseService
.
CreateHomeWorkComment
(
CourseId
);
return
ApiResult
.
Success
(
data
:
list
);
}
}
}
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