Commit 23fb5ade authored by wujipeng's avatar wujipeng
Browse files

考试中心-我的成绩-考试统计

parent 9e0dacc7
...@@ -65,4 +65,7 @@ public class ExamStudentVO extends ExamStudentEntity { ...@@ -65,4 +65,7 @@ public class ExamStudentVO extends ExamStudentEntity {
@ApiModelProperty(value = "正确率") @ApiModelProperty(value = "正确率")
private String correctRate; private String correctRate;
@ApiModelProperty(value = "得分率")
private String scoreRate;
} }
...@@ -125,4 +125,16 @@ public class ExamController extends BaseController { ...@@ -125,4 +125,16 @@ public class ExamController extends BaseController {
public Result<ExamStudentVO> gradesSummary(@PathVariable(name = "id") String id) { public Result<ExamStudentVO> gradesSummary(@PathVariable(name = "id") String id) {
return Result.data(examService.gradesSummary(id)); return Result.data(examService.gradesSummary(id));
} }
@ApiOperation(value = "考试中心-我的成绩-成绩分析")
@GetMapping("/grades/analysis/{id}")
public Result<ExamStudentVO> gradesAnalysis(@PathVariable(name = "id") String id) {
return Result.data(examService.gradesAnalysis(id));
}
@ApiOperation(value = "考试中心-我的成绩-考试统计")
@GetMapping("/grades/statistics/{id}")
public Result<ExamStudentVO> gradesStatistics(@PathVariable(name = "id") String id) {
return Result.data(examService.gradesStatistics(id));
}
} }
...@@ -34,4 +34,6 @@ public interface ExamMapper extends BaseMapper<ExamEntity> { ...@@ -34,4 +34,6 @@ public interface ExamMapper extends BaseMapper<ExamEntity> {
ExamStudentVO gradesSummary(@Param("id") String id); ExamStudentVO gradesSummary(@Param("id") String id);
ExamStudentVO gradesStatistics(@Param("id") String id);
} }
...@@ -49,4 +49,8 @@ public interface ExamService extends IService<ExamEntity> { ...@@ -49,4 +49,8 @@ public interface ExamService extends IService<ExamEntity> {
ExamStudentVO gradesSummary(String id); ExamStudentVO gradesSummary(String id);
ExamStudentVO gradesAnalysis(String id);
ExamStudentVO gradesStatistics(String id);
} }
...@@ -16,7 +16,6 @@ import com.platform.business.service.*; ...@@ -16,7 +16,6 @@ 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;
...@@ -364,18 +363,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, ExamEntity> impleme ...@@ -364,18 +363,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, ExamEntity> impleme
//考试名称,考试类型,考试时间,班级名称,本次成绩,班级排名 //考试名称,考试类型,考试时间,班级名称,本次成绩,班级排名
ExamStudentVO result = baseMapper.gradesSummary(id); ExamStudentVO result = baseMapper.gradesSummary(id);
//成绩标签 //成绩标签
Double score = result.getScore(); Double score = judgeExamResult(result);
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>() List<ExamStudentEntity> examStudentList = examStudentService.list(new LambdaQueryWrapper<ExamStudentEntity>()
.eq(ExamStudentEntity::getExamId, result.getExamId())); .eq(ExamStudentEntity::getExamId, result.getExamId()));
...@@ -430,4 +418,35 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, ExamEntity> impleme ...@@ -430,4 +418,35 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, ExamEntity> impleme
result.setCorrectRate(String.format("%.2f%%", (double) rightNum / totalNum * 100)); result.setCorrectRate(String.format("%.2f%%", (double) rightNum / totalNum * 100));
return result; return result;
} }
@Override
public ExamStudentVO gradesAnalysis(String id) {
//个人
return null;
}
@Override
public ExamStudentVO gradesStatistics(String id) {
ExamStudentVO result = baseMapper.gradesStatistics(id);
//考试结果
judgeExamResult(result);
return result;
}
private static Double judgeExamResult(ExamStudentVO result) {
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("不合格");
}
}
return score;
}
} }
...@@ -223,4 +223,22 @@ ...@@ -223,4 +223,22 @@
ON es.exam_id = rank_table.exam_id AND es.student_id = rank_table.student_id ON es.exam_id = rank_table.exam_id AND es.student_id = rank_table.student_id
WHERE es.student_id = #{id} WHERE es.student_id = #{id}
</select> </select>
<select id="gradesStatistics" resultType="com.platform.business.model.vo.ExamStudentVO">
select
answer_time,
score,
tp.sum
from
exam_student es
left join
exam e
on
es.exam_id = e.id
left join
theoretical_paper tp
on
e.paper_id = tp.id
where
es.id = #{id}
</select>
</mapper> </mapper>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment