Commit 766e36eb authored by wujipeng's avatar wujipeng
Browse files

学员端-考试中心-列表

parent 913d157a
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -20,7 +21,9 @@ public class ExamEntity {
private String name;
private String examTime;
@ApiModelProperty(value = "考试时间")
@JsonFormat(pattern = "MM-dd HH:mm", timezone = "GMT+8")
private Date examTime;
@ApiModelProperty(value = "考试类型")
private String type;
......@@ -54,4 +57,11 @@ public class ExamEntity {
@ApiModelProperty(value = "试卷名称")
@TableField(exist = false)
private String paperName;
@ApiModelProperty(value = "考试地点")
private String location;
@ApiModelProperty(value = "考试状态")
@TableField(exist = false)
private Boolean status;
}
......@@ -3,6 +3,7 @@ package com.platform.business.model.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
import java.util.Set;
......@@ -18,7 +19,7 @@ public class ExamScoreDetailVO {
private Double resultScore;
@ApiModelProperty(value = "考试时间")
private String examTime;
private Date examTime;
@ApiModelProperty(value = "阅卷老师")
private String teacherName;
@ApiModelProperty(value = "答题人")
......
......@@ -17,4 +17,6 @@ public class ExamVO extends ExamEntity {
private int studentNum;
private List<ExamStudentVO> examStudentList;
private String score;
}
......@@ -59,10 +59,11 @@ public class ExamController extends BaseController {
return getDataTable(examService.classExamScore(examDTO));
}
@ApiOperation(value = "未完成考试列表")
@GetMapping("/unfinished/{id}")
public Result<List<ExamVO>> unfinished(@PathVariable(name = "id") String id) {
return Result.data(examService.unfinished(id));
@ApiOperation(value = "学员端-考试中心-列表")
@PostMapping("/student/list")
public Result<List<ExamVO>> unfinished(@RequestBody ExamDTO examDTO) {
startPage(examDTO.getPageNum(), examDTO.getPageSize());
return Result.data(examService.unfinished(examDTO));
}
@ApiOperation(value = "开始考试")
......
......@@ -22,7 +22,7 @@ public interface ExamMapper extends BaseMapper<ExamEntity> {
List<ExamVO> queryByClassId(Integer classId);
List<ExamVO> unfinished(@Param("id") String id);
List<ExamVO> unfinished(ExamDTO examDTO);
List<TheoreticalPaperStudentDetailVO> paperOverview(@Param("studentId") String studentId, @Param("examId") Integer examId, @Param("type") String type);
......
......@@ -27,7 +27,7 @@ public interface ExamService extends IService<ExamEntity> {
List<ExamVO> queryByClassId(Integer classId);
List<ExamVO> unfinished(String id);
List<ExamVO> unfinished(ExamDTO examDTO);
Result<Integer> startExam(ExamDTO examDTO);
......
......@@ -60,15 +60,11 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
ExamDetailVO examDetailVO = flatList.get(0);
//等级
resultVO.setLevel(examDetailVO.getLevel());
}
// 按secondTitle分组创建森林结构
Map<String, List<ExamDetailVO>> groupMap = flatList.stream()
.collect(Collectors.groupingBy(ExamDetailVO::getSecondTitle));
List<ExamDetailVO> forestStructure = new ArrayList<>();
for (Map.Entry<String, List<ExamDetailVO>> entry : groupMap.entrySet()) {
// 创建父节点(二级标题节点)
ExamDetailVO parentNode = new ExamDetailVO();
......@@ -84,7 +80,6 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
double resultScore = entry.getValue().stream()
.mapToDouble(ExamDetailVO::getResultScore)
.sum();
parentNode.setTotalScore(totalScore);
parentNode.setResultScore(resultScore);
// 累加得分
......@@ -93,7 +88,6 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
questionTotalScore += totalScore;
// 设置子节点列表
parentNode.setExamDetailVOS(entry.getValue());
forestStructure.add(parentNode);
}
// 设置森林结构(得分详情)
......@@ -101,7 +95,6 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
resultVO.setResultScore(resultTotalScore);
resultVO.setTotalScore(questionTotalScore);
resultVO.setReadTeachers(readTeachers);//阅卷老师
return resultVO;
}
......
......@@ -116,8 +116,8 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, ExamEntity> impleme
}
@Override
public List<ExamVO> unfinished(String id) {
return baseMapper.unfinished(id);
public List<ExamVO> unfinished(ExamDTO examDTO) {
return baseMapper.unfinished(examDTO);
}
@Override
......@@ -127,7 +127,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, ExamEntity> impleme
ExamEntity exam = this.getById(examDTO.getId());
//判断有没有到考试时间
long currentTimeMillis = System.currentTimeMillis();
if (currentTimeMillis < convertToTimestamp(exam.getExamTime().split("-")[0])) {
if (currentTimeMillis < exam.getExamTime().getTime()) {
return Result.fail("考试未开始");
}
//检查是否已经开始考试
......
......@@ -115,26 +115,29 @@
select
e.id,
e.name,
exam_time as examTime,
c.name className
e.type,
e.exam_time,
e.duration,
e.location,
es.submit as status,
es.score
from
exam e
left join
class c
exam_student es
on
e.class_id = c.id
left join
sys_level on c.level = sys_level.id
where
CONVERT_TZ(NOW(), 'UTC', '+08:00') &lt; STR_TO_DATE(SUBSTRING_INDEX(e.exam_time, '-', -1), '%Y.%m.%d %H:%i:%s')
and
e.id in (select exam_id
from
exam_student
where
student_id = #{id}
and
exam_student.submit = false)
e.id = es.exam_id
<where>
<if test="userId != null and userId != ''">
es.student_id = #{userId}
</if>
<if test="status != null and status != ''">
and es.submit = #{status}
</if>
<if test="name != null and name != ''">
and e.name like concat('%',#{name},'%')
</if>
</where>
</select>
<select id="paperOverview" resultType="com.platform.business.model.vo.TheoreticalPaperStudentDetailVO">
SELECT
......
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