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

学员端-考试中心-列表

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