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
3449bf12
Commit
3449bf12
authored
May 27, 2022
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
6d0347e0
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
125 additions
and
9 deletions
+125
-9
IExamService.cs
EduSpider.IServices/IExamService.cs
+3
-1
RB_Exam.cs
EduSpider.Model/Entity/RB_Exam.cs
+10
-0
ExamRepository.cs
EduSpider.Repository/ExamRepository.cs
+1
-1
Exam_ScoreRepository.cs
EduSpider.Repository/Exam_ScoreRepository.cs
+12
-1
ExamService.cs
EduSpider.Services/ExamService.cs
+41
-1
ExamController.cs
EduSpider.WebApi/Controllers/Student/ExamController.cs
+49
-4
UploadController.cs
EduSpider.WebApi/Controllers/Upload/UploadController.cs
+9
-1
No files found.
EduSpider.IServices/IExamService.cs
View file @
3449bf12
...
...
@@ -15,6 +15,8 @@ namespace EduSpider.IServices
{
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
);
object
GetExamStuScoreInfo
(
int
examId
,
int
stuId
,
int
stuUId
);
List
<
RB_Exam_Score_Extend
>
GetExamStuList
(
RB_Exam_Score_Extend
demodel
);
string
DelExamInfo
(
int
examId
,
int
baseUserId
);
}
}
EduSpider.Model/Entity/RB_Exam.cs
View file @
3449bf12
...
...
@@ -43,5 +43,15 @@ namespace EduSpider.Model.Entity
/// 创建时间
/// </summary>
public
DateTime
CreateTime
{
get
;
set
;
}
/// <summary>
/// 更新人
/// </summary>
public
int
UpdateBy
{
get
;
set
;
}
/// <summary>
/// 更新时间
/// </summary>
public
DateTime
UpdateTime
{
get
;
set
;
}
}
}
EduSpider.Repository/ExamRepository.cs
View file @
3449bf12
...
...
@@ -45,7 +45,7 @@ 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
();
return
GetPage
<
RB_Exam_Extend
>(
pageIndex
,
pageSize
,
out
count
,
sql
,
parameters
).
ToList
();
}
}
}
EduSpider.Repository/Exam_ScoreRepository.cs
View file @
3449bf12
...
...
@@ -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
{
...
...
@@ -16,6 +17,7 @@ namespace EduSpider.Repository
{
public
List
<
RB_Exam_Score_Extend
>
GetList
(
RB_Exam_Score_Extend
dmodel
)
{
var
parameters
=
new
DynamicParameters
();
string
where
=
" 1=1"
;
if
(
dmodel
.
ExamId
>
0
)
{
...
...
@@ -25,8 +27,17 @@ namespace EduSpider.Repository
{
where
+=
$" and
{
nameof
(
RB_Exam_Score_Extend
.
StuId
)}
=
{
dmodel
.
StuId
}
"
;
}
if
(
dmodel
.
StuUId
>
0
)
{
where
+=
$" and
{
nameof
(
RB_Exam_Score_Extend
.
StuUId
)}
=
{
dmodel
.
StuUId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
StuName
))
{
where
+=
$" and
{
nameof
(
RB_Exam_Score_Extend
.
StuName
)}
like @StuName"
;
parameters
.
Add
(
"StuName"
,
"%"
+
dmodel
.
StuName
.
Trim
()
+
"%"
);
}
string
sql
=
$"select * from RB_Exam_Score where
{
where
}
"
;
return
Get
<
RB_Exam_Score_Extend
>(
sql
).
ToList
();
return
Get
<
RB_Exam_Score_Extend
>(
sql
,
parameters
).
ToList
();
}
}
}
EduSpider.Services/ExamService.cs
View file @
3449bf12
...
...
@@ -10,6 +10,7 @@ using System.Linq;
using
System.Text
;
using
System.Threading.Tasks
;
using
VTX.FW.Attr
;
using
VTX.FW.DB
;
using
VTX.FW.Helper
;
namespace
EduSpider.Services
...
...
@@ -58,14 +59,30 @@ namespace EduSpider.Services
return
examRepository
.
GetExamPageList
(
pageIndex
,
pageSize
,
out
count
,
demodel
);
}
/// <summary>
/// 获取考试学生列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Exam_Score_Extend
>
GetExamStuList
(
RB_Exam_Score_Extend
demodel
)
{
return
exam_ScoreRepository
.
GetList
(
demodel
);
}
/// <summary>
/// 获取学生考试详情
/// </summary>
/// <param name="examId"></param>
/// <param name="stuId"></param>
/// <param name="stuUId"></param>
/// <returns></returns>
public
object
GetExamStuScoreInfo
(
int
examId
,
int
stuId
)
public
object
GetExamStuScoreInfo
(
int
examId
,
int
stuId
,
int
stuUId
)
{
if
(
stuUId
>
0
)
{
var
accountModel
=
accountRepository
.
GetAccountList
(
new
RB_Account_Extend
()
{
Id
=
stuUId
,
AccountType
=
Utility
.
Enum
.
AccountTypeEnum
.
Student
}).
FirstOrDefault
();
if
(
accountModel
==
null
)
{
return
""
;
}
stuId
=
accountModel
.
AccountId
;
}
var
stuModel
=
studentRepository
.
GetEntity
(
stuId
);
if
(
stuModel
==
null
)
{
return
""
;
}
var
examModel
=
examRepository
.
GetEntity
(
examId
);
...
...
@@ -128,6 +145,29 @@ namespace EduSpider.Services
};
}
/// <summary>
/// 删除考试
/// </summary>
/// <param name="examId"></param>
/// <param name="baseUserId"></param>
/// <returns></returns>
public
string
DelExamInfo
(
int
examId
,
int
baseUserId
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Exam_Extend
.
Status
),
1
},
{
nameof
(
RB_Exam_Extend
.
UpdateBy
),
baseUserId
},
{
nameof
(
RB_Exam_Extend
.
UpdateTime
),
DateTime
.
Now
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Exam_Extend
.
ExamId
),
FiledValue
=
examId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
examRepository
.
Update
(
keyValues
,
wheres
);
return
flag
?
""
:
"出错了,请联系管理员"
;
}
/// <summary>
/// 导入考试成绩
...
...
EduSpider.WebApi/Controllers/Student/ExamController.cs
View file @
3449bf12
...
...
@@ -52,8 +52,25 @@ namespace EduSpider.WebApi.Controllers
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetExamStuList
()
{
return
ApiResult
.
Success
();
RB_Exam_Score_Extend
demodel
=
JsonHelper
.
Deserialize
<
RB_Exam_Score_Extend
>(
RequestParm
.
Msg
.
ToString
());
if
(
demodel
.
ExamId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
var
list
=
examService
.
GetExamStuList
(
demodel
);
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
ExamId
,
x
.
StuId
,
x
.
StuUId
,
x
.
StuName
,
x
.
TScore
,
x
.
ExamScore
,
ScoreRate
=
Math
.
Round
(
x
.
TScore
/
x
.
ExamScore
,
2
,
MidpointRounding
.
AwayFromZero
),
x
.
Rank
,
x
.
RankRate
}));
}
/// <summary>
...
...
@@ -64,14 +81,42 @@ namespace EduSpider.WebApi.Controllers
public
ApiResult
GetExamStuScoreInfo
()
{
int
ExamId
=
ReqParameters
.
GetInt
(
"ExamId"
);
//考试ID
int
StuId
=
ReqParameters
.
GetInt
(
"StuId"
);
//学生id
int
StuUId
=
ReqParameters
.
GetInt
(
"StuUId"
);
//学生Uid
if
(
ExamId
<=
0
||
StuId
<=
0
)
{
if
(
ExamId
<=
0
||
StuId
<=
0
||
StuUId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
var
robj
=
examService
.
GetExamStuScoreInfo
(
ExamId
,
StuId
);
var
robj
=
examService
.
GetExamStuScoreInfo
(
ExamId
,
StuId
,
StuUId
);
return
ApiResult
.
Success
(
""
,
robj
);
}
/// <summary>
/// 删除考试
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
DelExamInfo
()
{
int
ExamId
=
ReqParameters
.
GetInt
(
"ExamId"
);
//考试ID
if
(
ExamId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递考试ID"
);
}
if
(
UserInfo
.
AccountType
!=
Utility
.
Enum
.
AccountTypeEnum
.
Teacher
)
{
return
ApiResult
.
ParamIsNull
(
"非老师账户,无法操作"
);
}
string
rmsg
=
examService
.
DelExamInfo
(
ExamId
,
base
.
BaseUserId
);
if
(
rmsg
==
""
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
(
rmsg
);
}
}
}
}
EduSpider.WebApi/Controllers/Upload/UploadController.cs
View file @
3449bf12
...
...
@@ -78,7 +78,7 @@ namespace EduSpider.WebApi.Controllers
string
dateStr
=
DateTime
.
Now
.
ToString
(
"yyyyMMdd"
);
string
tempPath
=
basepath
+
"upfile\\temporary\\"
+
dateStr
+
"\\"
;
string
path_server
=
tempPath
+
path
;
string
httpPath
=
"/upfile/temporary/"
+
dateStr
+
"/"
+
path
;
//
string httpPath = "/upfile/temporary/" + dateStr + "/" + path;
if
(!
Directory
.
Exists
(
tempPath
))
{
Directory
.
CreateDirectory
(
tempPath
);
...
...
@@ -92,6 +92,14 @@ namespace EduSpider.WebApi.Controllers
string
rmsg
=
examService
.
ImportExcelForStuExamScore
(
path_server
,
CourseId
,
ExamName
,
UserId
);
if
(
rmsg
==
""
)
{
try
{
System
.
IO
.
File
.
Delete
(
path_server
);
//删除原文件
}
catch
(
Exception
)
{
LogHelper
.
WriteError
(
"UploadStuExamScore"
,
"删除原文件失败"
);
}
return
ApiResult
.
Success
();
}
else
...
...
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