Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
邬吉朋
practical_train
Commits
4ff3e0e4
Commit
4ff3e0e4
authored
Aug 10, 2026
by
wujipeng
Browse files
考试中心-我的成绩-汇总
parent
18dbe93d
Changes
7
Hide whitespace changes
Inline
Side-by-side
practical-api/practical-business-api/src/main/java/com/platform/business/model/entity/TheoreticalPaperStudentDetailEntity.java
View file @
4ff3e0e4
...
@@ -76,6 +76,10 @@ public class TheoreticalPaperStudentDetailEntity {
...
@@ -76,6 +76,10 @@ public class TheoreticalPaperStudentDetailEntity {
@ApiModelProperty
(
"结果"
)
@ApiModelProperty
(
"结果"
)
private
Boolean
result
;
private
Boolean
result
;
@ApiModelProperty
(
"是否部分对"
)
@TableField
(
"is_partially_right"
)
private
Boolean
isPartiallyRight
;
@ApiModelProperty
(
"实际选择"
)
@ApiModelProperty
(
"实际选择"
)
@TableField
(
"actual_choice"
)
@TableField
(
"actual_choice"
)
private
String
actualChoice
;
private
String
actualChoice
;
...
...
practical-api/practical-business-api/src/main/java/com/platform/business/model/vo/ExamStudentVO.java
View file @
4ff3e0e4
...
@@ -47,4 +47,22 @@ public class ExamStudentVO extends ExamStudentEntity {
...
@@ -47,4 +47,22 @@ public class ExamStudentVO extends ExamStudentEntity {
private
Integer
finishNum
;
private
Integer
finishNum
;
private
String
lev
;
private
String
lev
;
@ApiModelProperty
(
value
=
"成绩标签"
)
private
String
scoreLabel
;
@ApiModelProperty
(
value
=
"班级人数"
)
private
Integer
classNum
;
@ApiModelProperty
(
value
=
"答对数量"
)
private
Integer
rightNum
;
@ApiModelProperty
(
value
=
"答错数量"
)
private
Integer
wrongNum
;
@ApiModelProperty
(
value
=
"部分对数量"
)
private
Integer
partiallyRightNum
;
@ApiModelProperty
(
value
=
"正确率"
)
private
String
correctRate
;
}
}
practical-business/src/main/java/com/platform/business/controller/ExamController.java
View file @
4ff3e0e4
...
@@ -119,4 +119,10 @@ public class ExamController extends BaseController {
...
@@ -119,4 +119,10 @@ public class ExamController extends BaseController {
public
Result
<
ExamStudentVO
>
gradesDetail
(
@PathVariable
(
name
=
"id"
)
String
id
)
{
public
Result
<
ExamStudentVO
>
gradesDetail
(
@PathVariable
(
name
=
"id"
)
String
id
)
{
return
Result
.
data
(
examService
.
gradesDetail
(
id
));
return
Result
.
data
(
examService
.
gradesDetail
(
id
));
}
}
@ApiOperation
(
value
=
"考试中心-我的成绩-汇总"
)
@GetMapping
(
"/grades/summary/{id}"
)
public
Result
<
ExamStudentVO
>
gradesSummary
(
@PathVariable
(
name
=
"id"
)
String
id
)
{
return
Result
.
data
(
examService
.
gradesSummary
(
id
));
}
}
}
practical-business/src/main/java/com/platform/business/mapper/ExamMapper.java
View file @
4ff3e0e4
...
@@ -32,4 +32,6 @@ public interface ExamMapper extends BaseMapper<ExamEntity> {
...
@@ -32,4 +32,6 @@ public interface ExamMapper extends BaseMapper<ExamEntity> {
TheoreticalPaperStudentDetailVO
same
(
@Param
(
"examId"
)
Integer
examId
,
@Param
(
"studentId"
)
String
studentId
,
@Param
(
"type"
)
String
type
);
TheoreticalPaperStudentDetailVO
same
(
@Param
(
"examId"
)
Integer
examId
,
@Param
(
"studentId"
)
String
studentId
,
@Param
(
"type"
)
String
type
);
ExamStudentVO
gradesSummary
(
@Param
(
"id"
)
String
id
);
}
}
practical-business/src/main/java/com/platform/business/service/ExamService.java
View file @
4ff3e0e4
...
@@ -46,4 +46,7 @@ public interface ExamService extends IService<ExamEntity> {
...
@@ -46,4 +46,7 @@ public interface ExamService extends IService<ExamEntity> {
TheoreticalPaperStudentDetailVO
gradesQuestionDetail
(
String
id
);
TheoreticalPaperStudentDetailVO
gradesQuestionDetail
(
String
id
);
ExamStudentVO
gradesDetail
(
String
id
);
ExamStudentVO
gradesDetail
(
String
id
);
ExamStudentVO
gradesSummary
(
String
id
);
}
}
practical-business/src/main/java/com/platform/business/service/impl/ExamServiceImpl.java
View file @
4ff3e0e4
...
@@ -16,6 +16,7 @@ import com.platform.business.service.*;
...
@@ -16,6 +16,7 @@ import com.platform.business.service.*;
import
com.platform.model.resp.Result
;
import
com.platform.model.resp.Result
;
import
com.platform.utils.DozerUtils
;
import
com.platform.utils.DozerUtils
;
import
com.platform.utils.StringUtils
;
import
com.platform.utils.StringUtils
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
...
@@ -357,4 +358,76 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, ExamEntity> impleme
...
@@ -357,4 +358,76 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, ExamEntity> impleme
public
ExamStudentVO
gradesDetail
(
String
id
)
{
public
ExamStudentVO
gradesDetail
(
String
id
)
{
return
baseMapper
.
gradesDetail
(
id
);
return
baseMapper
.
gradesDetail
(
id
);
}
}
@Override
public
ExamStudentVO
gradesSummary
(
String
id
)
{
//考试名称,考试类型,考试时间,班级名称,本次成绩,班级排名
ExamStudentVO
result
=
baseMapper
.
gradesSummary
(
id
);
//成绩标签
Double
score
=
result
.
getScore
();
if
(
score
!=
null
)
{
if
(
score
>=
90
)
{
result
.
setScoreLabel
(
"优秀"
);
}
else
if
(
score
>=
80
)
{
result
.
setScoreLabel
(
"良好"
);
}
else
if
(
score
>=
60
)
{
result
.
setScoreLabel
(
"及格"
);
}
else
{
result
.
setScoreLabel
(
"不合格"
);
}
}
//班级均分
List
<
ExamStudentEntity
>
examStudentList
=
examStudentService
.
list
(
new
LambdaQueryWrapper
<
ExamStudentEntity
>()
.
eq
(
ExamStudentEntity:
:
getExamId
,
result
.
getExamId
()));
double
totalScore
=
0
;
for
(
ExamStudentEntity
examStudentEntity
:
examStudentList
)
{
if
(
examStudentEntity
.
getScore
()
!=
null
)
{
totalScore
+=
examStudentEntity
.
getScore
();
}
}
result
.
setAvgScore
(
totalScore
/
examStudentList
.
size
());
//和班级均分比较
if
(
result
.
getAvgScore
()
!=
null
&&
score
!=
null
)
{
if
(
result
.
getScore
()
>
result
.
getAvgScore
())
{
result
.
setScoreLabel
(
"高于均分"
+
(
result
.
getScore
()
-
result
.
getAvgScore
()));
}
else
if
(
result
.
getScore
().
equals
(
result
.
getAvgScore
()))
{
result
.
setScoreLabel
(
"等于均分"
);
}
else
{
result
.
setScoreLabel
(
"低于均分"
+
(
result
.
getAvgScore
()
-
result
.
getScore
()));
}
}
//班级人数
result
.
setClassNum
(
examStudentList
.
size
());
int
rightNum
=
0
;
int
wrongNum
=
0
;
int
partiallyRightNum
=
0
;
int
totalNum
=
0
;
List
<
TheoreticalPaperStudentDetailEntity
>
list
=
theoreticalPaperStudentDetailService
.
list
(
new
LambdaQueryWrapper
<
TheoreticalPaperStudentDetailEntity
>()
.
eq
(
TheoreticalPaperStudentDetailEntity:
:
getExamId
,
result
.
getExamId
())
.
eq
(
TheoreticalPaperStudentDetailEntity:
:
getStudentId
,
result
.
getStudentId
()));
for
(
TheoreticalPaperStudentDetailEntity
theoreticalPaperStudentDetail
:
list
)
{
if
(!
"主观题"
.
equals
(
theoreticalPaperStudentDetail
.
getType
())){
if
(
theoreticalPaperStudentDetail
.
getIsPartiallyRight
())
{
partiallyRightNum
++;
}
else
{
if
(
theoreticalPaperStudentDetail
.
getResult
()){
rightNum
++;
}
else
{
wrongNum
++;
}
}
totalNum
++;
}
}
//答对题数
result
.
setRightNum
(
rightNum
);
//部分对题数
result
.
setPartiallyRightNum
(
partiallyRightNum
);
//答错题数
result
.
setWrongNum
(
wrongNum
);
//正确率
result
.
setCorrectRate
(
String
.
format
(
"%.2f%%"
,
(
double
)
rightNum
/
totalNum
*
100
));
return
result
;
}
}
}
practical-business/src/main/resources/com/platform/business/mapper/ExamMapper.xml
View file @
4ff3e0e4
...
@@ -196,4 +196,31 @@
...
@@ -196,4 +196,31 @@
and type = #{type}
and type = #{type}
and result = true
and result = true
</select>
</select>
<select
id=
"gradesSummary"
resultType=
"com.platform.business.model.vo.ExamStudentVO"
>
SELECT
e.name AS exam_name,
e.type AS exam_type,
e.exam_time,
c.name AS class_name,
es.score,
es.exam_id,
rank_table.score_rank AS rank,
es.student_id AS studentId
FROM
exam_student es
LEFT JOIN
exam e
ON
es.exam_id = e.id
LEFT JOIN
class c
ON
es.class_id = c.id
LEFT JOIN (SELECT exam_id,
student_id,
DENSE_RANK() OVER (PARTITION BY exam_id ORDER BY score DESC NULLS LAST) AS score_rank
FROM exam_student) rank_table
ON es.exam_id = rank_table.exam_id AND es.student_id = rank_table.student_id
WHERE es.student_id = #{id}
</select>
</mapper>
</mapper>
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