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
169ace6c
Commit
169ace6c
authored
May 26, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
499151f8
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
230 additions
and
22 deletions
+230
-22
ICommentRepository.cs
EduSpider.IRepository/ICommentRepository.cs
+19
-0
IStuHomeWorkRepository.cs
EduSpider.IRepository/IStuHomeWorkRepository.cs
+1
-1
RB_Comment.cs
EduSpider.Model/Entity/RB_Comment.cs
+37
-0
ExamWorkResult.cs
EduSpider.Model/Extend/ExamWorkResult.cs
+28
-0
CommentRepository.cs
EduSpider.Repository/CommentRepository.cs
+32
-0
StuHomeWorkRepository.cs
EduSpider.Repository/StuHomeWorkRepository.cs
+97
-3
CourseService.cs
EduSpider.Services/CourseService.cs
+9
-15
CourseController.cs
EduSpider.WebApi/Controllers/CourseController.cs
+1
-1
EduSpider.sln
EduSpider.sln
+6
-2
No files found.
EduSpider.IRepository/ICommentRepository.cs
0 → 100644
View file @
169ace6c
using
EduSpider.Model.Entity
;
using
VTX.FW.Config
;
using
VTX.FW.DB
;
namespace
EduSpider.IRepository
{
/// <summary>
/// 评语仓储层接口
/// </summary>
public
interface
ICommentRepository
:
IDBRepository
<
RB_Comment
>,
IDependency
{
/// <summary>
/// 根据查询条件获取评语
/// </summary>
/// <param name="Score"></param>
/// <returns></returns>
public
RB_Comment
GetComment
(
decimal
Score
);
}
}
EduSpider.IRepository/IStuHomeWorkRepository.cs
View file @
169ace6c
...
...
@@ -25,6 +25,6 @@ namespace EduSpider.IRepository
/// 获取学生作业列表
/// </summary>
/// <returns></returns>
public
List
<
RB_Stu_HomeWork_Extend
>
GetStuHomeWorkListRepository
(
CourseQuery
query
);
public
List
<
ExamWorkResult
>
GetStuHomeWorkListRepository
(
CourseQuery
query
);
}
}
EduSpider.Model/Entity/RB_Comment.cs
0 → 100644
View file @
169ace6c
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VTX.FW.Attr
;
namespace
EduSpider.Model.Entity
{
/// <summary>
/// 评语配置
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Comment
{
/// <summary>
/// 评语
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 开始值
/// </summary>
public
decimal
StartNum
{
get
;
set
;
}
/// <summary>
/// 结束值
/// </summary>
public
decimal
EndNum
{
get
;
set
;
}
/// <summary>
/// 评语
/// </summary>
public
string
Info
{
get
;
set
;
}
}
}
EduSpider.Model/Extend/ExamWorkResult.cs
View file @
169ace6c
...
...
@@ -11,6 +11,11 @@ namespace EduSpider.Model.Extend
/// </summary>
public
class
ExamWorkResult
{
/// <summary>
/// 行号
/// </summary>
public
int
RowNum
{
get
;
set
;
}
/// <summary>
/// 创建时间
/// </summary>
...
...
@@ -21,6 +26,29 @@ namespace EduSpider.Model.Extend
/// </summary>
public
int
ResultType
{
get
;
set
;
}
/// <summary>
/// 类型(1-作业,2-考试,3-评语)
/// </summary>
public
string
ResultTypeStr
{
get
{
string
str
=
""
;
switch
(
this
.
ResultType
)
{
case
1
:
str
=
"作业"
;
break
;
case
2
:
str
=
"考试"
;
break
;
case
3
:
str
=
"评语"
;
break
;
}
return
str
;
}
}
/// <summary>
/// 阶段评语
/// </summary>
public
string
Comment
{
get
;
set
;
}
/// <summary>
/// 标题
/// </summary>
...
...
EduSpider.Repository/CommentRepository.cs
0 → 100644
View file @
169ace6c
using
EduSpider.IRepository
;
using
EduSpider.Model.Entity
;
using
EduSpider.Repository.Base
;
using
System.Linq
;
using
System.Text
;
using
VTX.FW.DB.Dapper
;
namespace
EduSpider.Repository
{
/// <summary>
/// 课程仓储层
/// </summary>
public
class
CommentRepository
:
BaseRepository
<
RB_Comment
>,
ICommentRepository
{
/// <summary>
/// 获取评语
/// </summary>
/// <param name="Score"></param>
/// <returns></returns>
public
RB_Comment
GetComment
(
decimal
Score
)
{
StringBuilder
builder
=
new
();
builder
.
AppendFormat
(
@"
SELECT A.*
FROM RB_Comment AS A
WHERE 1=1
"
);
builder
.
AppendFormat
(
@" AND A.StartNum<{0} AND {0}<=A.EndNum "
,
Score
);
return
base
.
Get
<
RB_Comment
>(
builder
.
ToString
()).
ToList
().
FirstOrDefault
();
}
}
}
EduSpider.Repository/StuHomeWorkRepository.cs
View file @
169ace6c
...
...
@@ -14,6 +14,11 @@ namespace EduSpider.Repository
/// </summary>
public
class
StuHomeWorkRepository
:
BaseRepository
<
RB_Stu_HomeWork
>,
IStuHomeWorkRepository
{
/// <summary>
/// 评语配置仓储层对象
/// </summary>
private
readonly
CommentRepository
commentRepository
=
new
CommentRepository
();
/// <summary>
/// 批量添加学生家庭作业
/// </summary>
...
...
@@ -30,11 +35,12 @@ namespace EduSpider.Repository
/// 获取学生作业列表
/// </summary>
/// <returns></returns>
public
List
<
RB_Stu_HomeWork_Extend
>
GetStuHomeWorkListRepository
(
CourseQuery
query
)
public
List
<
ExamWorkResult
>
GetStuHomeWorkListRepository
(
CourseQuery
query
)
{
List
<
ExamWorkResult
>
list
=
new
List
<
ExamWorkResult
>();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.*,B.homework_title,B.score_
type,B.score_
value,C.courseName
SELECT A.*,B.homework_title,B.score_value,C.courseName
FROM RB_Stu_HomeWork AS A LEFT JOIN rb_homework AS B ON A.homework_id=B.homework_id
LEFT JOIN rb_course AS C ON A.course_id=C.courseId
WHERE 1=1
...
...
@@ -54,7 +60,95 @@ WHERE 1=1
builder
.
AppendFormat
(
" AND A.{0} IN({1}) "
,
nameof
(
RB_Stu_HomeWork_Extend
.
student_uid
),
query
.
StuIds
);
}
}
return
Get
<
RB_Stu_HomeWork_Extend
>(
builder
.
ToString
()).
ToList
();
var
dataList
=
Get
<
RB_Stu_HomeWork_Extend
>(
builder
.
ToString
()).
ToList
();
List
<
ExamWorkResult
>
homeWorkList
=
new
List
<
ExamWorkResult
>();
if
(
dataList
!=
null
&&
dataList
.
Count
>
0
)
{
int
RowNum
=
1
;
foreach
(
var
item
in
dataList
)
{
homeWorkList
.
Add
(
new
ExamWorkResult
()
{
RowNum
=
RowNum
,
CreateTime
=
item
.
add_time
,
ResultType
=
1
,
Title
=
item
.
homework_title
,
Score
=
item
.
score
,
Score_p
=
item
.
score_p
,
ScoreType
=
item
.
score_type
,
Score_Value
=
item
.
score_value
,
HomeWorkStatus
=
item
.
status
,
});
RowNum
++;
}
}
ExamWorkResult
firstComment
=
null
;
ExamWorkResult
secondComment
=
null
;
ExamWorkResult
thirdComment
=
null
;
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
()
{
CreateTime
=
firstList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
ResultType
=
3
,
Title
=
"第一阶段评语"
,
Comment
=
commentModel
?.
Info
};
}
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
()
{
CreateTime
=
secondList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
ResultType
=
3
,
Title
=
"第二阶段评语"
,
Comment
=
commentModel
?.
Info
};
}
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
()
{
CreateTime
=
thirdList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
ResultType
=
3
,
Title
=
"第三阶段评语"
,
Comment
=
commentModel
?.
Info
};
}
}
for
(
var
i
=
0
;
i
<
homeWorkList
.
Count
;
i
++)
{
var
item
=
homeWorkList
[
i
];
list
.
Add
(
item
);
if
(
i
==
4
&&
firstComment
!=
null
)
{
list
.
Add
(
firstComment
);
}
if
(
i
==
8
&&
secondComment
!=
null
)
{
list
.
Add
(
secondComment
);
}
if
(
i
==
12
&&
thirdComment
!=
null
)
{
list
.
Add
(
thirdComment
);
}
}
return
list
;
}
}
}
EduSpider.Services/CourseService.cs
View file @
169ace6c
...
...
@@ -31,6 +31,12 @@ namespace EduSpider.Services
[
Autowired
]
public
IStuHomeWorkRepository
StuHomeWorkRepository
{
get
;
set
;
}
/// <summary>
/// 评语仓储层接口
/// </summary>
[
Autowired
]
public
ICommentRepository
CommentRepository
{
get
;
set
;
}
/// <summary>
/// 获取学员课程列表
...
...
@@ -55,21 +61,7 @@ namespace EduSpider.Services
var
homeWorkList
=
StuHomeWorkRepository
.
GetStuHomeWorkListRepository
(
query
);
if
(
homeWorkList
!=
null
&&
homeWorkList
.
Count
>
0
)
{
foreach
(
var
item
in
homeWorkList
)
{
ExamWorkResult
model
=
new
ExamWorkResult
()
{
CreateTime
=
item
.
add_time
,
ResultType
=
1
,
Title
=
item
.
homework_title
,
Score
=
item
.
score
,
Score_p
=
item
.
score_p
,
ScoreType
=
item
.
score_type
,
Score_Value
=
item
.
score_value
,
HomeWorkStatus
=
item
.
status
,
};
dataList
.
Add
(
model
);
}
dataList
.
AddRange
(
homeWorkList
);
}
if
(
dataList
!=
null
&&
dataList
.
Count
>
0
)
{
...
...
@@ -78,6 +70,7 @@ namespace EduSpider.Services
list
.
Add
(
new
{
item
.
ResultType
,
item
.
ResultTypeStr
,
item
.
Title
,
CreateTime
=
VTX
.
FW
.
Helper
.
ConvertHelper
.
FormatTime
(
item
.
CreateTime
),
item
.
Score
,
...
...
@@ -87,6 +80,7 @@ namespace EduSpider.Services
item
.
Score_Value
,
item
.
HomeWorkStatus
,
item
.
HomeWorkStatusStr
,
item
.
Comment
,
});
}
}
...
...
EduSpider.WebApi/Controllers/CourseController.cs
View file @
169ace6c
...
...
@@ -30,7 +30,7 @@ namespace EduSpider.WebApi.Controllers
{
var
query
=
new
Model
.
Query
.
CourseQuery
()
{
StuIds
=
"1976394"
};
var
list
=
CourseService
.
GetStuCourseList
(
query
);
query
.
StuIds
=
"
1413751
0"
;
query
.
StuIds
=
"
2306708
0"
;
var
homeworkExamList
=
CourseService
.
GetStuWorkAndExamList
(
query
);
return
ApiResult
.
Success
(
data
:
homeworkExamList
,
message
:
"成功!"
);
}
...
...
EduSpider.sln
View file @
169ace6c
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 1
7
VisualStudioVersion = 1
7.1.32210.238
# Visual Studio Version 1
6
VisualStudioVersion = 1
6.0.31729.503
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EduSpider.Model", "EduSpider.Model\EduSpider.Model.csproj", "{58B2199B-FE72-4F48-972D-F7FE32A28A0F}"
EndProject
...
...
@@ -63,6 +63,10 @@ Global
{DAC5E8C6-98DF-4B33-9E2C-452DDE54A5FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DAC5E8C6-98DF-4B33-9E2C-452DDE54A5FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DAC5E8C6-98DF-4B33-9E2C-452DDE54A5FA}.Release|Any CPU.Build.0 = Release|Any CPU
{6D059BFB-A071-4856-A35D-38EB893FED74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D059BFB-A071-4856-A35D-38EB893FED74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D059BFB-A071-4856-A35D-38EB893FED74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D059BFB-A071-4856-A35D-38EB893FED74}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
...
...
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