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
7f8c4718
Commit
7f8c4718
authored
May 26, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Plain Diff
111
parents
c0ffdac0
6d0347e0
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
324 additions
and
7 deletions
+324
-7
IExamRepository.cs
EduSpider.IRepository/IExamRepository.cs
+2
-1
IExam_QuestionsRepository.cs
EduSpider.IRepository/IExam_QuestionsRepository.cs
+2
-1
IExam_ScoreRepository.cs
EduSpider.IRepository/IExam_ScoreRepository.cs
+7
-0
IExamService.cs
EduSpider.IServices/IExamService.cs
+4
-1
RB_Exam_Score.cs
EduSpider.Model/Entity/RB_Exam_Score.cs
+10
-0
RB_Exam_Extend.cs
EduSpider.Model/Extend/RB_Exam_Extend.cs
+8
-0
RB_Exam_Score_Extend.cs
EduSpider.Model/Extend/RB_Exam_Score_Extend.cs
+43
-0
ExamRepository.cs
EduSpider.Repository/ExamRepository.cs
+33
-0
Exam_QuestionsRepository.cs
EduSpider.Repository/Exam_QuestionsRepository.cs
+16
-1
Exam_ScoreRepository.cs
EduSpider.Repository/Exam_ScoreRepository.cs
+19
-0
StudentRepository.cs
EduSpider.Repository/StudentRepository.cs
+1
-1
ExamService.cs
EduSpider.Services/ExamService.cs
+87
-0
BaseController.cs
EduSpider.WebApi/Controllers/Base/BaseController.cs
+14
-1
ExamController.cs
EduSpider.WebApi/Controllers/Student/ExamController.cs
+77
-0
UploadController.cs
EduSpider.WebApi/Controllers/Upload/UploadController.cs
+1
-1
No files found.
EduSpider.IRepository/IExamRepository.cs
View file @
7f8c4718
using
EduSpider.Model.Entity
;
using
EduSpider.Model.Entity
;
using
EduSpider.Model.Extend
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
...
@@ -14,6 +15,6 @@ namespace EduSpider.Repository
...
@@ -14,6 +15,6 @@ namespace EduSpider.Repository
/// </summary>
/// </summary>
public
interface
IExamRepository
:
IDBRepository
<
RB_Exam
>,
IDependency
public
interface
IExamRepository
:
IDBRepository
<
RB_Exam
>,
IDependency
{
{
List
<
RB_Exam_Extend
>
GetExamPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Exam_Extend
demodel
);
}
}
}
}
EduSpider.IRepository/IExam_QuestionsRepository.cs
View file @
7f8c4718
using
EduSpider.Model.Entity
;
using
EduSpider.Model.Entity
;
using
EduSpider.Model.Extend
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
...
@@ -14,6 +15,6 @@ namespace EduSpider.Repository
...
@@ -14,6 +15,6 @@ namespace EduSpider.Repository
/// </summary>
/// </summary>
public
interface
IExam_QuestionsRepository
:
IDBRepository
<
RB_Exam_Questions
>,
IDependency
public
interface
IExam_QuestionsRepository
:
IDBRepository
<
RB_Exam_Questions
>,
IDependency
{
{
List
<
RB_Exam_Questions_Extend
>
GetList
(
RB_Exam_Questions_Extend
rB_Exam_Questions_Extend
);
}
}
}
}
EduSpider.IRepository/IExam_ScoreRepository.cs
View file @
7f8c4718
using
EduSpider.Model.Entity
;
using
EduSpider.Model.Entity
;
using
EduSpider.Model.Extend
;
using
EduSpider.Model.Extend
;
<<<<<<<
.
merge_file_a14452
using
EduSpider.Model.Query
;
using
EduSpider.Model.Query
;
=======
>>>>>>>
.
merge_file_a12592
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
...
@@ -16,11 +19,15 @@ namespace EduSpider.Repository
...
@@ -16,11 +19,15 @@ namespace EduSpider.Repository
/// </summary>
/// </summary>
public
interface
IExam_ScoreRepository
:
IDBRepository
<
RB_Exam_Score
>,
IDependency
public
interface
IExam_ScoreRepository
:
IDBRepository
<
RB_Exam_Score
>,
IDependency
{
{
/// <summary>
/// <summary>
/// 学生考试查询
/// 学生考试查询
/// </summary>
/// </summary>
/// <param name="query"></param>
/// <param name="query"></param>
/// <returns></returns>
/// <returns></returns>
public
List
<
RB_Exam_Score_Extend
>
GetExamScoreListRepository
(
CourseQuery
query
);
public
List
<
RB_Exam_Score_Extend
>
GetExamScoreListRepository
(
CourseQuery
query
);
public
List
<
RB_Exam_Score_Extend
>
GetList
(
RB_Exam_Score_Extend
rB_Exam_Score_Extend
);
}
}
}
}
EduSpider.IServices/IExamService.cs
View file @
7f8c4718
using
System
;
using
EduSpider.Model.Extend
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
...
@@ -13,5 +14,7 @@ namespace EduSpider.IServices
...
@@ -13,5 +14,7 @@ namespace EduSpider.IServices
public
interface
IExamService
:
IDependency
public
interface
IExamService
:
IDependency
{
{
string
ImportExcelForStuExamScore
(
string
path_server
,
int
courseId
,
string
examName
,
int
userId
);
string
ImportExcelForStuExamScore
(
string
path_server
,
int
courseId
,
string
examName
,
int
userId
);
List
<
RB_Exam_Extend
>
GetExamPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Exam_Extend
demodel
);
object
GetExamStuScoreInfo
(
int
examId
,
int
stuId
);
}
}
}
}
EduSpider.Model/Entity/RB_Exam_Score.cs
View file @
7f8c4718
...
@@ -29,6 +29,11 @@ namespace EduSpider.Model.Entity
...
@@ -29,6 +29,11 @@ namespace EduSpider.Model.Entity
/// </summary>
/// </summary>
public
int
StuId
{
get
;
set
;
}
public
int
StuId
{
get
;
set
;
}
/// <summary>
/// 学生账户ID
/// </summary>
public
int
StuUId
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 导入的姓名
/// 导入的姓名
/// </summary>
/// </summary>
...
@@ -53,5 +58,10 @@ namespace EduSpider.Model.Entity
...
@@ -53,5 +58,10 @@ namespace EduSpider.Model.Entity
/// 百分比排名
/// 百分比排名
/// </summary>
/// </summary>
public
decimal
RankRate
{
get
;
set
;
}
public
decimal
RankRate
{
get
;
set
;
}
/// <summary>
/// 考试总分
/// </summary>
public
decimal
ExamScore
{
get
;
set
;
}
}
}
}
}
EduSpider.Model/Extend/RB_Exam_Extend.cs
View file @
7f8c4718
...
@@ -9,6 +9,14 @@ namespace EduSpider.Model.Extend
...
@@ -9,6 +9,14 @@ namespace EduSpider.Model.Extend
/// </summary>
/// </summary>
public
class
RB_Exam_Extend
:
RB_Exam
public
class
RB_Exam_Extend
:
RB_Exam
{
{
/// <summary>
/// 学生数量
/// </summary>
public
int
StuNum
{
get
;
set
;
}
/// <summary>
/// 总分数
/// </summary>
public
decimal
TScore
{
get
;
set
;
}
}
}
}
}
EduSpider.Model/Extend/RB_Exam_Score_Extend.cs
View file @
7f8c4718
using
EduSpider.Model.Entity
;
using
EduSpider.Model.Entity
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
VTX.FW.Attr
;
using
VTX.FW.Attr
;
namespace
EduSpider.Model.Extend
namespace
EduSpider.Model.Extend
...
@@ -9,14 +10,56 @@ namespace EduSpider.Model.Extend
...
@@ -9,14 +10,56 @@ namespace EduSpider.Model.Extend
/// </summary>
/// </summary>
public
class
RB_Exam_Score_Extend
:
RB_Exam_Score
public
class
RB_Exam_Score_Extend
:
RB_Exam_Score
{
{
<<<<<<<
HEAD
/// <summary>
/// <summary>
/// 考试名称
/// 考试名称
/// </summary>
/// </summary>
public
string
ExamName
{
get
;
set
;
}
public
string
ExamName
{
get
;
set
;
}
=======
public
List
<
ExamQScoreModel
>
ScoreList
{
get
;
set
;
}
>>>>>>>
6d0347
e0f3f9e8ee506c9ab8673669368baa27d7
/// <summary>
/// <summary>
/// 考试导入时间
/// 考试导入时间
/// </summary>
/// </summary>
public
DateTime
ExamCreateTime
{
get
;
set
;
}
public
DateTime
ExamCreateTime
{
get
;
set
;
}
}
}
/// <summary>
/// 学生单项分数
/// </summary>
public
class
ExamQScoreModel
{
/// <summary>
/// 题号
/// </summary>
public
int
Sort
{
get
;
set
;
}
/// <summary>
/// 得分
/// </summary>
public
decimal
Score
{
get
;
set
;
}
/// <summary>
/// 平均得分
/// </summary>
public
decimal
AvgScore
{
get
;
set
;
}
/// <summary>
/// 难度
/// </summary>
public
string
Difficulty
{
get
;
set
;
}
/// <summary>
/// 知识点
/// </summary>
public
string
KnowledgePoint
{
get
;
set
;
}
/// <summary>
/// 归属模块
/// </summary>
public
string
Module
{
get
;
set
;
}
/// <summary>
/// 题目分数
/// </summary>
public
decimal
QScore
{
get
;
set
;
}
}
}
}
EduSpider.Repository/ExamRepository.cs
View file @
7f8c4718
using
EduSpider.Model.Entity
;
using
EduSpider.Model.Entity
;
using
EduSpider.Model.Extend
;
using
EduSpider.Repository.Base
;
using
EduSpider.Repository.Base
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
VTX.FW.DB.Dapper
;
namespace
EduSpider.Repository
namespace
EduSpider.Repository
{
{
...
@@ -13,6 +15,37 @@ namespace EduSpider.Repository
...
@@ -13,6 +15,37 @@ namespace EduSpider.Repository
/// </summary>
/// </summary>
public
class
ExamRepository
:
BaseRepository
<
RB_Exam
>,
IExamRepository
public
class
ExamRepository
:
BaseRepository
<
RB_Exam
>,
IExamRepository
{
{
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Exam_Extend
>
GetExamPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Exam_Extend
demodel
)
{
var
parameters
=
new
DynamicParameters
();
string
where
=
" 1=1 and e.Status =0"
;
if
(
demodel
.
CourseId
>
0
)
{
where
+=
$@" and e.
{
nameof
(
RB_Exam_Extend
.
CourseId
)}
=
{
demodel
.
CourseId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
ExamName
))
{
where
+=
$@" and e.
{
nameof
(
RB_Exam_Extend
.
ExamName
)}
like @ExamName"
;
parameters
.
Add
(
"ExamName"
,
"%"
+
demodel
.
ExamName
.
Trim
()
+
"%"
);
}
if
(
demodel
.
CreateBy
>
0
)
{
where
+=
$@" and e.
{
nameof
(
RB_Exam_Extend
.
CreateBy
)}
=
{
demodel
.
CreateBy
}
"
;
}
string
sql
=
$@"select e.*,es.StuNum,es.TScore FROM rb_exam e
LEFT JOIN (
SELECT e.ExamId,COUNT(0) as StuNum,SUM(e.TScore) as TScore FROM rb_exam_score e GROUP BY e.ExamId
) es on e.ExamId = es.ExamId
where
{
where
}
order by e.EcamId desc"
;
return
GetPage
<
RB_Exam_Extend
>(
pageIndex
,
pageSize
,
out
count
,
sql
).
ToList
();
}
}
}
}
}
EduSpider.Repository/Exam_QuestionsRepository.cs
View file @
7f8c4718
using
EduSpider.Model.Entity
;
using
EduSpider.Model.Entity
;
using
EduSpider.Model.Extend
;
using
EduSpider.Repository.Base
;
using
EduSpider.Repository.Base
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
...
@@ -13,6 +14,20 @@ namespace EduSpider.Repository
...
@@ -13,6 +14,20 @@ namespace EduSpider.Repository
/// </summary>
/// </summary>
public
class
Exam_QuestionsRepository
:
BaseRepository
<
RB_Exam_Questions
>,
IExam_QuestionsRepository
public
class
Exam_QuestionsRepository
:
BaseRepository
<
RB_Exam_Questions
>,
IExam_QuestionsRepository
{
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="rB_Exam_Questions_Extend"></param>
/// <returns></returns>
public
List
<
RB_Exam_Questions_Extend
>
GetList
(
RB_Exam_Questions_Extend
dmodel
)
{
string
where
=
" 1=1"
;
if
(
dmodel
.
ExamId
>
0
)
{
where
+=
$" and
{
nameof
(
RB_Exam_Questions_Extend
.
ExamId
)}
=
{
dmodel
.
ExamId
}
"
;
}
string
sql
=
$"select * from RB_Exam_Questions where
{
where
}
"
;
return
Get
<
RB_Exam_Questions_Extend
>(
sql
).
ToList
();
}
}
}
}
}
EduSpider.Repository/Exam_ScoreRepository.cs
View file @
7f8c4718
using
EduSpider.Model.Entity
;
using
EduSpider.Model.Entity
;
using
EduSpider.Model.Extend
;
using
EduSpider.Model.Extend
;
<<<<<<<
HEAD
using
EduSpider.Model.Query
;
using
EduSpider.Model.Query
;
=======
>>>>>>>
6d0347
e0f3f9e8ee506c9ab8673669368baa27d7
using
EduSpider.Repository.Base
;
using
EduSpider.Repository.Base
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
...
@@ -15,6 +18,7 @@ namespace EduSpider.Repository
...
@@ -15,6 +18,7 @@ namespace EduSpider.Repository
/// </summary>
/// </summary>
public
class
Exam_ScoreRepository
:
BaseRepository
<
RB_Exam_Score
>,
IExam_ScoreRepository
public
class
Exam_ScoreRepository
:
BaseRepository
<
RB_Exam_Score
>,
IExam_ScoreRepository
{
{
/// <summary>
/// <summary>
/// 学生考试查询
/// 学生考试查询
/// </summary>
/// </summary>
...
@@ -42,5 +46,20 @@ WHERE 1=1
...
@@ -42,5 +46,20 @@ WHERE 1=1
return
Get
<
RB_Exam_Score_Extend
>(
builder
.
ToString
()).
ToList
();
return
Get
<
RB_Exam_Score_Extend
>(
builder
.
ToString
()).
ToList
();
}
}
public
List
<
RB_Exam_Score_Extend
>
GetList
(
RB_Exam_Score_Extend
dmodel
)
{
string
where
=
" 1=1"
;
if
(
dmodel
.
ExamId
>
0
)
{
where
+=
$" and
{
nameof
(
RB_Exam_Score_Extend
.
ExamId
)}
=
{
dmodel
.
ExamId
}
"
;
}
if
(
dmodel
.
StuId
>
0
)
{
where
+=
$" and
{
nameof
(
RB_Exam_Score_Extend
.
StuId
)}
=
{
dmodel
.
StuId
}
"
;
}
string
sql
=
$"select * from RB_Exam_Score where
{
where
}
"
;
return
Get
<
RB_Exam_Score_Extend
>(
sql
).
ToList
();
}
}
}
}
}
EduSpider.Repository/StudentRepository.cs
View file @
7f8c4718
...
@@ -22,7 +22,7 @@ namespace EduSpider.Repository
...
@@ -22,7 +22,7 @@ namespace EduSpider.Repository
/// <returns></returns>
/// <returns></returns>
public
List
<
RB_Student
>
GetListForStuName
(
string
stuNames
)
public
List
<
RB_Student
>
GetListForStuName
(
string
stuNames
)
{
{
string
sql
=
$"select StudId,StudentName from RB_Student where StudentName in(
{
stuNames
}
) order by StudId desc"
;
string
sql
=
$"select StudId,Student
Uid,Student
Name from RB_Student where StudentName in(
{
stuNames
}
) order by StudId desc"
;
return
Get
<
RB_Student
>(
sql
).
ToList
();
return
Get
<
RB_Student
>(
sql
).
ToList
();
}
}
}
}
...
...
EduSpider.Services/ExamService.cs
View file @
7f8c4718
using
EduSpider.IRepository
;
using
EduSpider.IRepository
;
using
EduSpider.IServices
;
using
EduSpider.IServices
;
using
EduSpider.Model.Extend
;
using
EduSpider.Repository
;
using
EduSpider.Repository
;
using
EduSpider.Utility.Data
;
using
EduSpider.Utility.Data
;
using
System
;
using
System
;
...
@@ -44,6 +45,89 @@ namespace EduSpider.Services
...
@@ -44,6 +45,89 @@ namespace EduSpider.Services
[
Autowired
]
[
Autowired
]
private
IStudentRepository
studentRepository
{
get
;
set
;
}
private
IStudentRepository
studentRepository
{
get
;
set
;
}
/// <summary>
/// 获取考试分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Exam_Extend
>
GetExamPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Exam_Extend
demodel
)
{
return
examRepository
.
GetExamPageList
(
pageIndex
,
pageSize
,
out
count
,
demodel
);
}
/// <summary>
/// 获取学生考试详情
/// </summary>
/// <param name="examId"></param>
/// <param name="stuId"></param>
/// <returns></returns>
public
object
GetExamStuScoreInfo
(
int
examId
,
int
stuId
)
{
var
stuModel
=
studentRepository
.
GetEntity
(
stuId
);
if
(
stuModel
==
null
)
{
return
""
;
}
var
examModel
=
examRepository
.
GetEntity
(
examId
);
if
(
examModel
==
null
)
{
return
""
;
}
//考试题目
var
qlist
=
exam_QuestionsRepository
.
GetList
(
new
RB_Exam_Questions_Extend
()
{
ExamId
=
examId
});
//考试成绩
var
sExamModel
=
exam_ScoreRepository
.
GetList
(
new
RB_Exam_Score_Extend
()
{
ExamId
=
examId
,
StuId
=
stuId
}).
FirstOrDefault
();
if
(
sExamModel
!=
null
)
{
sExamModel
.
ScoreList
=
JsonHelper
.
Deserialize
<
List
<
ExamQScoreModel
>>(
sExamModel
.
Content
);
foreach
(
var
qitem
in
sExamModel
.
ScoreList
)
{
qitem
.
Difficulty
=
qlist
.
Where
(
x
=>
x
.
Sort
==
qitem
.
Sort
).
FirstOrDefault
()?.
Difficulty
??
""
;
qitem
.
KnowledgePoint
=
qlist
.
Where
(
x
=>
x
.
Sort
==
qitem
.
Sort
).
FirstOrDefault
()?.
KnowledgePoint
??
""
;
qitem
.
Module
=
qlist
.
Where
(
x
=>
x
.
Sort
==
qitem
.
Sort
).
FirstOrDefault
()?.
Module
??
""
;
qitem
.
QScore
=
qlist
.
Where
(
x
=>
x
.
Sort
==
qitem
.
Sort
).
FirstOrDefault
()?.
Score
??
0
;
}
}
//开始组装数据
return
new
{
StuId
=
stuModel
.
StudId
,
StuName
=
stuModel
.
StudentName
,
ExamName
=
examModel
.
ExamName
,
sExamModel
?.
TScore
,
sExamModel
?.
Rank
,
sExamModel
?.
RankRate
,
ScoreRate
=
Math
.
Round
((
sExamModel
?.
TScore
??
0
)
/
(
sExamModel
?.
ExamScore
??
1
),
2
,
MidpointRounding
.
AwayFromZero
),
ScoreList
=
sExamModel
?.
ScoreList
.
Select
(
x
=>
new
{
x
.
Sort
,
x
.
Difficulty
,
x
.
KnowledgePoint
,
x
.
QScore
,
x
.
Score
,
ScoreRate
=
Math
.
Round
(
x
.
Score
/
x
.
QScore
,
2
,
MidpointRounding
.
AwayFromZero
),
x
.
AvgScore
,
AvgScoreRate
=
Math
.
Round
(
x
.
AvgScore
/
x
.
QScore
,
2
,
MidpointRounding
.
AwayFromZero
),
}),
ModuleList
=
sExamModel
?.
ScoreList
.
GroupBy
(
x
=>
new
{
x
.
Module
}).
Select
(
x
=>
new
{
x
.
Key
.
Module
,
Score
=
x
.
Sum
(
y
=>
y
.
QScore
),
ScoreRate
=
Math
.
Round
(
x
.
Sum
(
y
=>
y
.
Score
)
/
x
.
Sum
(
y
=>
y
.
QScore
),
2
,
MidpointRounding
.
AwayFromZero
),
AvgScoreRate
=
Math
.
Round
(
x
.
Sum
(
y
=>
y
.
AvgScore
)
/
x
.
Sum
(
y
=>
y
.
QScore
),
2
,
MidpointRounding
.
AwayFromZero
),
}),
DifficultyList
=
sExamModel
?.
ScoreList
.
GroupBy
(
x
=>
new
{
x
.
Difficulty
}).
Select
(
x
=>
new
{
x
.
Key
.
Difficulty
,
Count
=
x
.
Count
(),
Score
=
x
.
Sum
(
x
=>
x
.
QScore
)
}),
DifficultyRateList
=
sExamModel
?.
ScoreList
.
GroupBy
(
x
=>
new
{
x
.
Difficulty
}).
Select
(
x
=>
new
{
x
.
Key
.
Difficulty
,
ScoreRate
=
Math
.
Round
(
x
.
Sum
(
y
=>
y
.
Score
)
/
x
.
Sum
(
y
=>
y
.
QScore
),
2
,
MidpointRounding
.
AwayFromZero
),
AvgScoreRate
=
Math
.
Round
(
x
.
Sum
(
y
=>
y
.
AvgScore
)
/
x
.
Sum
(
y
=>
y
.
QScore
),
2
,
MidpointRounding
.
AwayFromZero
),
})
};
}
/// <summary>
/// <summary>
/// 导入考试成绩
/// 导入考试成绩
...
@@ -92,6 +176,7 @@ namespace EduSpider.Services
...
@@ -92,6 +176,7 @@ namespace EduSpider.Services
}
}
exam_QuestionsRepository
.
BatchInsert
(
InsertEQ
);
exam_QuestionsRepository
.
BatchInsert
(
InsertEQ
);
decimal
ExamScore
=
InsertEQ
.
Sum
(
x
=>
x
.
Score
);
List
<
Model
.
Entity
.
RB_Exam_Score
>
InsertScore
=
new
();
List
<
Model
.
Entity
.
RB_Exam_Score
>
InsertScore
=
new
();
foreach
(
var
Name
in
StuList
.
Select
(
x
=>
x
.
Name
).
Distinct
())
{
foreach
(
var
Name
in
StuList
.
Select
(
x
=>
x
.
Name
).
Distinct
())
{
var
clist
=
StuList
.
Where
(
x
=>
x
.
Name
==
Name
).
ToList
();
var
clist
=
StuList
.
Where
(
x
=>
x
.
Name
==
Name
).
ToList
();
...
@@ -101,6 +186,7 @@ namespace EduSpider.Services
...
@@ -101,6 +186,7 @@ namespace EduSpider.Services
Id
=
0
,
Id
=
0
,
ExamId
=
ExamId
,
ExamId
=
ExamId
,
StuId
=
stuModel
?.
StudId
??
0
,
//匹配学生失败 可能要在后台给与提示, 重新导入
StuId
=
stuModel
?.
StudId
??
0
,
//匹配学生失败 可能要在后台给与提示, 重新导入
StuUId
=
stuModel
?.
StudentUid
??
0
,
StuName
=
Name
,
StuName
=
Name
,
Content
=
JsonHelper
.
Serialize
(
clist
.
Where
(
x
=>
x
.
Id
>
0
).
Select
(
x
=>
new
Content
=
JsonHelper
.
Serialize
(
clist
.
Where
(
x
=>
x
.
Id
>
0
).
Select
(
x
=>
new
{
{
...
@@ -111,6 +197,7 @@ namespace EduSpider.Services
...
@@ -111,6 +197,7 @@ namespace EduSpider.Services
TScore
=
clist
.
Where
(
x
=>
x
.
Id
==
-
1
).
FirstOrDefault
()?.
Score
??
0
,
TScore
=
clist
.
Where
(
x
=>
x
.
Id
==
-
1
).
FirstOrDefault
()?.
Score
??
0
,
Rank
=
Convert
.
ToInt32
(
clist
.
Where
(
x
=>
x
.
Id
==
-
2
).
FirstOrDefault
()?.
Score
??
0
),
Rank
=
Convert
.
ToInt32
(
clist
.
Where
(
x
=>
x
.
Id
==
-
2
).
FirstOrDefault
()?.
Score
??
0
),
RankRate
=
clist
.
Where
(
x
=>
x
.
Id
==
-
3
).
FirstOrDefault
()?.
Score
??
0
,
RankRate
=
clist
.
Where
(
x
=>
x
.
Id
==
-
3
).
FirstOrDefault
()?.
Score
??
0
,
ExamScore
=
ExamScore
});
});
}
}
//InsertScore = InsertScore.Where(x => x.StuId > 0).ToList();//暂时只插入匹配到学生的
//InsertScore = InsertScore.Where(x => x.StuId > 0).ToList();//暂时只插入匹配到学生的
...
...
EduSpider.WebApi/Controllers/Base/BaseController.cs
View file @
7f8c4718
using
Microsoft.AspNetCore.Cors
;
using
EduSpider.Cache.User
;
using
EduSpider.Model.Cache
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.Mvc
;
using
System
;
using
System
;
using
VTX.FW.Helper
;
using
VTX.FW.Helper
;
...
@@ -30,5 +32,16 @@ namespace EduSpider.WebApi.Controllers.Base
...
@@ -30,5 +32,16 @@ namespace EduSpider.WebApi.Controllers.Base
return
UserId
;
return
UserId
;
}
}
}
}
/// <summary>
/// 获取登录信息
/// </summary>
public
UserInfo
UserInfo
{
get
{
return
UserReidsCache
.
GetUserLoginInfo
(
this
.
BaseUserId
);
}
}
}
}
}
}
EduSpider.WebApi/Controllers/Student/ExamController.cs
0 → 100644
View file @
7f8c4718
using
EduSpider.IServices
;
using
EduSpider.Model.Extend
;
using
EduSpider.WebApi.Controllers.Base
;
using
Microsoft.AspNetCore.Mvc
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
VTX.FW.Api
;
using
VTX.FW.Attr
;
using
VTX.FW.Helper
;
namespace
EduSpider.WebApi.Controllers
{
/// <summary>
/// 考试控制器
/// </summary>
public
class
ExamController
:
BaseController
{
/// <summary>
/// 考试
/// </summary>
[
Autowired
]
public
IExamService
examService
{
get
;
set
;
}
/// <summary>
/// 获取考试分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetExamPageList
()
{
ResultPageModel
pmodel
=
JsonHelper
.
Deserialize
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
RB_Exam_Extend
demodel
=
JsonHelper
.
Deserialize
<
RB_Exam_Extend
>(
RequestParm
.
Msg
.
ToString
());
var
list
=
examService
.
GetExamPageList
(
pmodel
.
PageIndex
,
pmodel
.
PageSize
,
out
long
count
,
demodel
);
pmodel
.
RowsCount
=
count
;
pmodel
.
PageData
=
list
.
Select
(
x
=>
new
{
x
.
ExamId
,
x
.
ExamName
,
x
.
StuNum
,
x
.
TScore
,
AvgScore
=
x
.
StuNum
>
0
?
Math
.
Round
(
x
.
TScore
/
x
.
StuNum
,
2
,
MidpointRounding
.
AwayFromZero
)
:
0
,
CreateTime
=
x
.
CreateTime
.
ToString
(
"yyyy-MM-dd HH:mm"
)
});
return
ApiResult
.
Success
(
""
,
pmodel
);
}
/// <summary>
/// 获取考试学生列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetExamStuList
()
{
return
ApiResult
.
Success
();
}
/// <summary>
/// 获取学生考试明细
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetExamStuScoreInfo
()
{
int
ExamId
=
ReqParameters
.
GetInt
(
"ExamId"
);
//考试ID
int
StuId
=
ReqParameters
.
GetInt
(
"StuId"
);
//学生id
if
(
ExamId
<=
0
||
StuId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
var
robj
=
examService
.
GetExamStuScoreInfo
(
ExamId
,
StuId
);
return
ApiResult
.
Success
(
""
,
robj
);
}
}
}
EduSpider.WebApi/Controllers/Upload/UploadController.cs
View file @
7f8c4718
...
@@ -121,7 +121,7 @@ namespace EduSpider.WebApi.Controllers
...
@@ -121,7 +121,7 @@ namespace EduSpider.WebApi.Controllers
string
path_server
=
"C:/Users/Administrator/Desktop/TempFile/化学成绩查询表.xlsx"
;
string
path_server
=
"C:/Users/Administrator/Desktop/TempFile/化学成绩查询表.xlsx"
;
#
region
解析文档数据并保存
#
region
解析文档数据并保存
string
rmsg
=
examService
.
ImportExcelForStuExamScore
(
path_server
,
44977497
,
"测试
一下化学
"
,
11759328
);
string
rmsg
=
examService
.
ImportExcelForStuExamScore
(
path_server
,
44977497
,
"测试
考试化学2
"
,
11759328
);
if
(
rmsg
==
""
)
if
(
rmsg
==
""
)
{
{
return
ApiResult
.
Success
();
return
ApiResult
.
Success
();
...
...
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