wangliang 4 лет назад
Родитель
Сommit
471844467d
19 измененных файлов с 845 добавлено и 195 удалено
  1. 89 36
      themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamStudentController.java
  2. 1 1
      themis-backend/src/main/java/com/qmth/themis/backend/start/StartRunning.java
  3. 24 0
      themis-business/src/main/java/com/qmth/themis/business/dao/TEExamStudentMapper.java
  4. 192 0
      themis-business/src/main/java/com/qmth/themis/business/dto/MarkResultSimpleExportDto.java
  5. 3 1
      themis-business/src/main/java/com/qmth/themis/business/enums/MqTagEnum.java
  6. 5 1
      themis-business/src/main/java/com/qmth/themis/business/enums/TaskTypeEnum.java
  7. 1 1
      themis-business/src/main/java/com/qmth/themis/business/enums/VerifyExceptionEnum.java
  8. 13 0
      themis-business/src/main/java/com/qmth/themis/business/service/TEExamStudentService.java
  9. 16 0
      themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamStudentServiceImpl.java
  10. 2 10
      themis-business/src/main/java/com/qmth/themis/business/service/impl/WarningServiceImpl.java
  11. 36 47
      themis-business/src/main/java/com/qmth/themis/business/templete/impl/TaskExamStudentExportTemplete.java
  12. 157 0
      themis-business/src/main/java/com/qmth/themis/business/templete/impl/TaskMarkResultSimpleExportTemplete.java
  13. 158 0
      themis-business/src/main/java/com/qmth/themis/business/templete/impl/TaskMarkResultStandardExportTemplete.java
  14. 16 1
      themis-business/src/main/java/com/qmth/themis/business/templete/service/TempleteLogicService.java
  15. 60 37
      themis-business/src/main/java/com/qmth/themis/business/templete/service/impl/TempleteLogicServiceImpl.java
  16. 66 58
      themis-business/src/main/resources/mapper/TEExamStudentMapper.xml
  17. 1 1
      themis-exam/src/main/java/com/qmth/themis/exam/start/StartRunning.java
  18. 4 0
      themis-mq/src/main/java/com/qmth/themis/mq/service/impl/MqLogicServiceImpl.java
  19. 1 1
      themis-task/src/main/java/com/qmth/themis/task/start/StartRunning.java

+ 89 - 36
themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamStudentController.java

@@ -353,48 +353,102 @@ public class TEExamStudentController {
         if (Objects.isNull(examId) || Objects.equals(examId, "")) {
             throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
         }
-        ExamCacheBean examCacheBean = teExamService.getExamCacheBean(examId);
-        if (Objects.isNull(examCacheBean)) {
-            throw new BusinessException(ExceptionResultEnum.EXAM_NO);
-        }
-        InvigilateMonitorStatusEnum invigilateMonitorStatusEnum = examCacheBean.getMonitorStatus();//监考状态
-        if (Objects.nonNull(invigilateMonitorStatusEnum) && !Objects.equals(invigilateMonitorStatusEnum, InvigilateMonitorStatusEnum.FINISHED)) {
-            throw new BusinessException("当前批次监考未结束,请在结束后查询");
-        }
-        ScoreStatusEnum scoreStatusEnum = examCacheBean.getScoreStatus();//算分状态
-        if (Objects.nonNull(scoreStatusEnum) && (Objects.equals(scoreStatusEnum, ScoreStatusEnum.NEVER) || Objects.equals(scoreStatusEnum, ScoreStatusEnum.FINISH))) {
-            throw new BusinessException("当前批次算分未结束,请在结束后查询");
-        }
-        QueryWrapper<TEExamCourse> teExamCourseQueryWrapper = new QueryWrapper<>();
-        teExamCourseQueryWrapper.lambda().eq(TEExamCourse::getExamId, examId);
-        List<TEExamCourse> teExamCourseList = teExamCourseService.list(teExamCourseQueryWrapper);
-        Set answerList = null;
-        if (Objects.nonNull(teExamCourseList) && teExamCourseList.size() > 0) {
-            answerList = teExamCourseList.stream().filter(s -> {
-                if (Objects.nonNull(s.getHasAnswer()) && s.getHasAnswer().intValue() == 0) {
-                    return true;
-                } else {
-                    return false;
-                }
-            }).collect(Collectors.toSet());
+        commonMarkResult(examId);
+        return ResultUtil.ok(teExamStudentService.markResultQuery(new Page<>(pageNumber, pageSize), examId, activityId, identity, name, courseCode));
+    }
+
+    @ApiOperation(value = "成绩查询简版导出接口")
+    @RequestMapping(value = "/mark/result/simple/export", method = RequestMethod.POST)
+    @Transactional
+    @ApiResponses({@ApiResponse(code = 200, message = "{\"taskId\":0}", response = Result.class)})
+    public Result markResultSimpleExport(@ApiParam(value = "考试批次id", required = true) @RequestParam Long examId,
+                                         @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long activityId,
+                                         @ApiParam(value = "证件号", required = false) @RequestParam(required = false) String identity,
+                                         @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name,
+                                         @ApiParam(value = "科目代码", required = false) @RequestParam(required = false) String courseCode) {
+        if (Objects.isNull(examId) || Objects.equals(examId, "")) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
         }
-        if (Objects.nonNull(answerList) && answerList.size() > 0) {
-            throw new BusinessException("当前批次标答未补齐,请补齐后查询");
+        TBTaskHistory tbTaskHistory = null;
+        try {
+            commonMarkResult(examId);
+            Map transMap = new HashMap();
+            TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
+            //往任务表里插一条数据
+            tbTaskHistory = new TBTaskHistory(TaskTypeEnum.EXPORT_MARK_RESULT_SIMPLE, TaskStatusEnum.INIT, SystemConstant.EXPORT_INIT, 0d, tbUser.getId());
+            taskHistoryService.save(tbTaskHistory);
+            transMap.put("tbTaskHistory", tbTaskHistory);
+            transMap.put("createId", tbUser.getId());
+            transMap.put("orgId", tbUser.getOrgId());
+            transMap.put("examId", examId);
+            transMap.put("activityId", activityId);
+            transMap.put("identity", identity);
+            transMap.put("name", name);
+            transMap.put("courseCode", courseCode);
+            //mq发送消息start
+            MqDto mqDto = new MqDto(MqTopicEnum.THEMIS_TOPIC.getCode(), MqTagEnum.MARK_RESULT_SIMPLE_EXPORT.name(), transMap, MqTagEnum.MARK_RESULT_SIMPLE_EXPORT, String.valueOf(tbTaskHistory.getId()), tbUser.getName());
+            mqDtoService.assembleSendOneWayMsg(mqDto);
+            //mq发送消息end
+        } catch (Exception e) {
+            log.error("请求出错", e);
+            if (e instanceof BusinessException) {
+                throw new BusinessException(e.getMessage());
+            } else {
+                throw new RuntimeException(e);
+            }
         }
-        return ResultUtil.ok(teExamStudentService.markResultQuery(new Page<>(pageNumber, pageSize), examId, activityId, identity, name, courseCode));
+        return ResultUtil.ok(Collections.singletonMap(SystemConstant.TASK_ID, tbTaskHistory.getId()));
     }
 
-    @ApiOperation(value = "成绩查询导出接口")
-    @RequestMapping(value = "/mark/result/export", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "考试批次信息", response = MarkResultDto.class)})
-    public Result markResultExport(@ApiParam(value = "考试批次id", required = true) @RequestParam Long examId,
-                             @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long activityId,
-                             @ApiParam(value = "证件号", required = false) @RequestParam(required = false) String identity,
-                             @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name,
-                             @ApiParam(value = "科目代码", required = false) @RequestParam(required = false) String courseCode) {
+    @ApiOperation(value = "成绩查询标准版导出接口")
+    @RequestMapping(value = "/mark/result/standard/export", method = RequestMethod.POST)
+    @Transactional
+    @ApiResponses({@ApiResponse(code = 200, message = "{\"taskId\":0}", response = Result.class)})
+    public Result markResultStandardExport(@ApiParam(value = "考试批次id", required = true) @RequestParam Long examId,
+                                           @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long activityId,
+                                           @ApiParam(value = "证件号", required = false) @RequestParam(required = false) String identity,
+                                           @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name,
+                                           @ApiParam(value = "科目代码", required = false) @RequestParam(required = false) String courseCode) {
         if (Objects.isNull(examId) || Objects.equals(examId, "")) {
             throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
         }
+        TBTaskHistory tbTaskHistory = null;
+        try {
+            commonMarkResult(examId);
+            Map transMap = new HashMap();
+            TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
+            //往任务表里插一条数据
+            tbTaskHistory = new TBTaskHistory(TaskTypeEnum.EXPORT_MARK_RESULT_STANDARD, TaskStatusEnum.INIT, SystemConstant.EXPORT_INIT, 0d, tbUser.getId());
+            taskHistoryService.save(tbTaskHistory);
+            transMap.put("tbTaskHistory", tbTaskHistory);
+            transMap.put("createId", tbUser.getId());
+            transMap.put("orgId", tbUser.getOrgId());
+            transMap.put("examId", examId);
+            transMap.put("activityId", activityId);
+            transMap.put("identity", identity);
+            transMap.put("name", name);
+            transMap.put("courseCode", courseCode);
+            //mq发送消息start
+            MqDto mqDto = new MqDto(MqTopicEnum.THEMIS_TOPIC.getCode(), MqTagEnum.MARK_RESULT_STANDARD_EXPORT.name(), transMap, MqTagEnum.MARK_RESULT_STANDARD_EXPORT, String.valueOf(tbTaskHistory.getId()), tbUser.getName());
+            mqDtoService.assembleSendOneWayMsg(mqDto);
+            //mq发送消息end
+        } catch (Exception e) {
+            log.error("请求出错", e);
+            if (e instanceof BusinessException) {
+                throw new BusinessException(e.getMessage());
+            } else {
+                throw new RuntimeException(e);
+            }
+        }
+        return ResultUtil.ok(Collections.singletonMap(SystemConstant.TASK_ID, tbTaskHistory.getId()));
+    }
+
+    /**
+     * 成绩查询公用
+     *
+     * @param examId
+     */
+    private void commonMarkResult(Long examId) {
         ExamCacheBean examCacheBean = teExamService.getExamCacheBean(examId);
         if (Objects.isNull(examCacheBean)) {
             throw new BusinessException(ExceptionResultEnum.EXAM_NO);
@@ -423,6 +477,5 @@ public class TEExamStudentController {
         if (Objects.nonNull(answerList) && answerList.size() > 0) {
             throw new BusinessException("当前批次标答未补齐,请补齐后查询");
         }
-        return ResultUtil.ok(true);
     }
 }

+ 1 - 1
themis-backend/src/main/java/com/qmth/themis/backend/start/StartRunning.java

@@ -47,7 +47,7 @@ public class StartRunning implements CommandLineRunner {
         /**
          * task
          */
-        rocketMessageConsumer.setRocketMQConsumer(nameServer, MqGroupEnum.TASK_GROUP.getCode(), MqTopicEnum.THEMIS_TOPIC.getCode(), MqTagEnum.EXAM_STUDENT_IMPORT.name() + "||" + MqTagEnum.ROOM_CODE_IMPORT.name() + "||" + MqTagEnum.ROOM_CODE_EXPORT.name() + "||" + MqTagEnum.EXAM_PAPER_IMPORT.name() + "||" + MqTagEnum.EXAM_STUDENT_EXPORT.name(), MessageModel.CLUSTERING, SpringContextHolder.getBean(TaskConcurrentlyImpl.class));
+        rocketMessageConsumer.setRocketMQConsumer(nameServer, MqGroupEnum.TASK_GROUP.getCode(), MqTopicEnum.THEMIS_TOPIC.getCode(), MqTagEnum.EXAM_STUDENT_IMPORT.name() + "||" + MqTagEnum.ROOM_CODE_IMPORT.name() + "||" + MqTagEnum.ROOM_CODE_EXPORT.name() + "||" + MqTagEnum.EXAM_PAPER_IMPORT.name() + "||" + MqTagEnum.EXAM_STUDENT_EXPORT.name() + "||" + MqTagEnum.MARK_RESULT_SIMPLE_EXPORT.name() + "||" + MqTagEnum.MARK_RESULT_STANDARD_EXPORT.name(), MessageModel.CLUSTERING, SpringContextHolder.getBean(TaskConcurrentlyImpl.class));
         /**
          * log
          */

+ 24 - 0
themis-business/src/main/java/com/qmth/themis/business/dao/TEExamStudentMapper.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.qmth.themis.business.bean.backend.ExamDeficiencyListBean;
 import com.qmth.themis.business.bean.backend.ExamStudentLogListBean;
 import com.qmth.themis.business.bean.backend.ExamViewCountListBean;
+import com.qmth.themis.business.dto.MarkResultSimpleExportDto;
 import com.qmth.themis.business.dto.response.MarkResultDto;
 import com.qmth.themis.business.dto.response.RoomCodeQueryDto;
 import com.qmth.themis.business.dto.response.TEExamStudentDto;
@@ -81,5 +82,28 @@ public interface TEExamStudentMapper extends BaseMapper<TEExamStudent> {
 
     public void updateCurrentRecordId(@Param("examStudentId") Long examStudentId, @Param("currentRecordId") Long currentRecordId);
 
+    /**
+     * 查询学生成绩信息
+     *
+     * @param iPage
+     * @param examId
+     * @param activityId
+     * @param identity
+     * @param name
+     * @param courseCode
+     * @return
+     */
     public IPage<MarkResultDto> markResultQuery(IPage<Map> iPage, @Param("examId") Long examId, @Param("activityId") Long activityId, @Param("identity") String identity, @Param("name") String name, @Param("courseCode") String courseCode);
+
+    /**
+     * 查询学生成绩信息(导出用)
+     *
+     * @param examId
+     * @param activityId
+     * @param identity
+     * @param name
+     * @param courseCode
+     * @return
+     */
+    public List<MarkResultSimpleExportDto> markResultQueryExport(@Param("examId") Long examId, @Param("activityId") Long activityId, @Param("identity") String identity, @Param("name") String name, @Param("courseCode") String courseCode);
 }

+ 192 - 0
themis-business/src/main/java/com/qmth/themis/business/dto/MarkResultSimpleExportDto.java

@@ -0,0 +1,192 @@
+package com.qmth.themis.business.dto;
+
+import com.qmth.themis.business.annotation.ExcelNote;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Description: 考场导出 dto
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/7/20
+ */
+public class MarkResultSimpleExportDto {
+
+    @ApiModelProperty(value = "批次名称")
+    @ExcelNote(value = "批次名称")
+    private String examName;
+
+    @ExcelNote(value = "姓名")
+    @ApiModelProperty(name = "姓名")
+    private String name;
+
+    @ApiModelProperty(name = "证件号")
+    @ExcelNote(value = "证件号")
+    private String identity;
+
+    @ApiModelProperty(name = "科目代码")
+    @ExcelNote(value = "科目代码")
+    private String courseCode;
+
+    @ApiModelProperty(name = "科目名称")
+    @ExcelNote(value = "科目名称")
+    private String courseName;
+
+    @ExcelNote(value = "考场代码")
+    private String roomCode; //考场代码
+
+    @ExcelNote(value = "考场名称")
+    private String roomName; //考场名称
+
+    @ApiModelProperty(value = "年级")
+    @ExcelNote(value = "年级")
+    private String grade;
+
+    @ApiModelProperty(value = "教学班级")
+    @ExcelNote(value = "教学班级")
+    private String classNo;
+
+    @ApiModelProperty(value = "是否缺考")
+    @ExcelNote(value = "是否缺考")
+    private Boolean examAbsent;
+
+    @ApiModelProperty(value = "违纪次数")
+    @ExcelNote(value = "违纪次数")
+    private Integer breachCount;
+
+    @ApiModelProperty(value = "考试次数")
+    @ExcelNote(value = "examCount")
+    private Integer examCount;
+
+    @ApiModelProperty(value = "客观分")
+    @ExcelNote(value = "客观分")
+    private Double objectiveScore;
+
+    @ApiModelProperty(value = "主观分")
+    @ExcelNote(value = "主观分")
+    private Double subjectiveScore;
+
+    @ApiModelProperty(value = "总分")
+    @ExcelNote(value = "总分")
+    private Double sumScore;
+
+    public String getRoomCode() {
+        return roomCode;
+    }
+
+    public void setRoomCode(String roomCode) {
+        this.roomCode = roomCode;
+    }
+
+    public String getRoomName() {
+        return roomName;
+    }
+
+    public void setRoomName(String roomName) {
+        this.roomName = roomName;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getExamName() {
+        return examName;
+    }
+
+    public void setExamName(String examName) {
+        this.examName = examName;
+    }
+
+    public String getIdentity() {
+        return identity;
+    }
+
+    public void setIdentity(String identity) {
+        this.identity = identity;
+    }
+
+    public String getCourseCode() {
+        return courseCode;
+    }
+
+    public void setCourseCode(String courseCode) {
+        this.courseCode = courseCode;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public String getGrade() {
+        return grade;
+    }
+
+    public void setGrade(String grade) {
+        this.grade = grade;
+    }
+
+    public String getClassNo() {
+        return classNo;
+    }
+
+    public void setClassNo(String classNo) {
+        this.classNo = classNo;
+    }
+
+    public Boolean getExamAbsent() {
+        return examAbsent;
+    }
+
+    public void setExamAbsent(Boolean examAbsent) {
+        this.examAbsent = examAbsent;
+    }
+
+    public Integer getBreachCount() {
+        return breachCount;
+    }
+
+    public void setBreachCount(Integer breachCount) {
+        this.breachCount = breachCount;
+    }
+
+    public Integer getExamCount() {
+        return examCount;
+    }
+
+    public void setExamCount(Integer examCount) {
+        this.examCount = examCount;
+    }
+
+    public Double getObjectiveScore() {
+        return objectiveScore;
+    }
+
+    public void setObjectiveScore(Double objectiveScore) {
+        this.objectiveScore = objectiveScore;
+    }
+
+    public Double getSubjectiveScore() {
+        return subjectiveScore;
+    }
+
+    public void setSubjectiveScore(Double subjectiveScore) {
+        this.subjectiveScore = subjectiveScore;
+    }
+
+    public Double getSumScore() {
+        return sumScore;
+    }
+
+    public void setSumScore(Double sumScore) {
+        this.sumScore = sumScore;
+    }
+}

+ 3 - 1
themis-business/src/main/java/com/qmth/themis/business/enums/MqTagEnum.java

@@ -45,7 +45,9 @@ public enum MqTagEnum {
     EXAM_STOP("考试移动端监控退出标签", "考试移动端退出暂停", "normal", 33),
     EXAM_RECORD_UPDATE_COLUMNS("考试记录多字段数据更新标签", "考试记录多字段数据更新", "normal", 34),
     EXAM_STUDENT("考生一次性延时任务标签", "考生一次性延时任务", "normal", 35),
-    EXAM_STUDENT_EXPORT("考生导出任务标签", "考生导出任务", "normal", 36);
+    EXAM_STUDENT_EXPORT("考生导出任务标签", "考生导出任务", "normal", 36),
+    MARK_RESULT_SIMPLE_EXPORT("成绩查询简版导出任务标签", "成绩查询简版导出任务", "normal", 37),
+    MARK_RESULT_STANDARD_EXPORT("成绩查询标准版导出任务标签", "成绩查询标准版导出任务", "normal", 38);
 
     private MqTagEnum(String desc, String code, String type, int id) {
         this.desc = desc;

+ 5 - 1
themis-business/src/main/java/com/qmth/themis/business/enums/TaskTypeEnum.java

@@ -19,7 +19,11 @@ public enum TaskTypeEnum {
 
     EXPORT_INVIGILATE_USER("导出监考员"),
     
-    EXPORT_EXAM_STUDENT("导出考生");
+    EXPORT_EXAM_STUDENT("导出考生"),
+
+    EXPORT_MARK_RESULT_SIMPLE("导出成绩简版"),
+
+    EXPORT_MARK_RESULT_STANDARD("导出成绩标准版");
 
     private String code;
 

+ 1 - 1
themis-business/src/main/java/com/qmth/themis/business/enums/VerifyExceptionEnum.java

@@ -14,7 +14,7 @@ public enum VerifyExceptionEnum {
 
     FACE_COUNT_ERROR("人脸数量异常", Arrays.asList("D4", "D8"), "违纪预警"),
 
-    FACE_COMPARE_ERROR("人脸比对异常", Arrays.asList("D6", "D8"), "违纪预警"),
+    FACE_COMPARE_ERROR("人脸比对异常", Arrays.asList("D6"), "违纪预警"),
 
     EYE_CLOSE_ERROR("闭眼检测异常", Arrays.asList("D14"), "违纪预警"),
 

+ 13 - 0
themis-business/src/main/java/com/qmth/themis/business/service/TEExamStudentService.java

@@ -3,6 +3,7 @@ package com.qmth.themis.business.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
+import com.qmth.themis.business.dto.MarkResultSimpleExportDto;
 import com.qmth.themis.business.dto.response.MarkResultDto;
 import com.qmth.themis.business.dto.response.RoomCodeQueryDto;
 import com.qmth.themis.business.dto.response.TEExamStudentDto;
@@ -78,4 +79,16 @@ public interface TEExamStudentService extends IService<TEExamStudent> {
      * @return
      */
     public IPage<MarkResultDto> markResultQuery(IPage<Map> iPage, Long examId, Long activityId, String identity, String name, String courseCode);
+
+    /**
+     * 查询学生成绩信息(导出用)
+     *
+     * @param examId
+     * @param activityId
+     * @param identity
+     * @param name
+     * @param courseCode
+     * @return
+     */
+    public List<MarkResultSimpleExportDto> markResultQueryExport(Long examId, Long activityId, String identity, String name, String courseCode);
 }

+ 16 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamStudentServiceImpl.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
 import com.qmth.themis.business.dao.TEExamStudentMapper;
+import com.qmth.themis.business.dto.MarkResultSimpleExportDto;
 import com.qmth.themis.business.dto.response.MarkResultDto;
 import com.qmth.themis.business.dto.response.RoomCodeQueryDto;
 import com.qmth.themis.business.dto.response.TEExamStudentDto;
@@ -159,4 +160,19 @@ public class TEExamStudentServiceImpl extends ServiceImpl<TEExamStudentMapper, T
     public IPage<MarkResultDto> markResultQuery(IPage<Map> iPage, Long examId, Long activityId, String identity, String name, String courseCode) {
         return teExamStudentMapper.markResultQuery(iPage, examId, activityId, identity, name, courseCode);
     }
+
+    /**
+     * 查询学生成绩信息(导出用)
+     *
+     * @param examId
+     * @param activityId
+     * @param identity
+     * @param name
+     * @param courseCode
+     * @return
+     */
+    @Override
+    public List<MarkResultSimpleExportDto> markResultQueryExport(Long examId, Long activityId, String identity, String name, String courseCode) {
+        return teExamStudentMapper.markResultQueryExport(examId, activityId, identity, name, courseCode);
+    }
 }

+ 2 - 10
themis-business/src/main/java/com/qmth/themis/business/service/impl/WarningServiceImpl.java

@@ -1,14 +1,12 @@
 package com.qmth.themis.business.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.qmth.themis.business.cache.ExamRecordCacheUtil;
 import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
 import com.qmth.themis.business.dto.WarningDto;
 import com.qmth.themis.business.entity.TEConfig;
 import com.qmth.themis.business.entity.TEExamStudentLog;
 import com.qmth.themis.business.entity.TIeInvigilateWarnInfo;
-import com.qmth.themis.business.entity.TOeFaceVerifyHistory;
 import com.qmth.themis.business.enums.ExamTypeEnum;
 import com.qmth.themis.business.enums.VerifyExceptionEnum;
 import com.qmth.themis.business.enums.WarningLevelEnum;
@@ -111,12 +109,6 @@ public class WarningServiceImpl implements WarningService {
         if (Objects.nonNull(map) && map.size() > 0) {
             Integer count = Integer.parseInt(String.valueOf(map.get("tmpCount")));
             count = Objects.isNull(count) ? 0 : count;
-            if (count > teConfig.getMatchFaceCompareErrorCount()) {
-                TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(1), WarningLevelEnum.valueOf(warningEnum.getLevel().get(1)).getTitle(), warningEnum, photoUrl, Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1);
-                tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
-                this.setWarningCount(recordId);
-                this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId, teConfig.getMatchFaceCompareErrorCount());
-            }
             if (count > teConfig.getTotalFaceCompareErrorCount()) {
                 TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(0), WarningLevelEnum.valueOf(warningEnum.getLevel().get(0)).getTitle(), warningEnum, photoUrl, Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1);
                 tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
@@ -150,7 +142,7 @@ public class WarningServiceImpl implements WarningService {
                 TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(0), WarningLevelEnum.valueOf(warningEnum.getLevel().get(0)).getTitle(), warningEnum, photoUrl, Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1);
                 tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
                 this.setWarningCount(recordId);
-                this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId, teConfig.getTotalEyeCloseErrorCount());
+                this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId, 3);
             }
         }
     }
@@ -186,7 +178,7 @@ public class WarningServiceImpl implements WarningService {
             Integer count = Integer.parseInt(String.valueOf(map.get("tmpCount")));
             count = Objects.isNull(count) ? 0 : count;
             if (count > teConfig.getRealnessCount()) {
-                TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, WarningLevelEnum.D15.name(), WarningLevelEnum.D15.getTitle(), warningEnum, Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1);
+                TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, WarningLevelEnum.D15.name(), WarningLevelEnum.D15.getTitle(), warningEnum, photoUrl, Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1);
                 tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
                 this.setWarningCount(recordId);
                 this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId, teConfig.getRealnessCount());

+ 36 - 47
themis-business/src/main/java/com/qmth/themis/business/templete/impl/TaskExamStudentExportTemplete.java

@@ -1,23 +1,5 @@
 package com.qmth.themis.business.templete.impl;
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.time.LocalDateTime;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.StringJoiner;
-import java.util.UUID;
-
-import javax.annotation.Resource;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dto.response.TEExamStudentDto;
 import com.qmth.themis.business.enums.TaskStatusEnum;
@@ -27,6 +9,16 @@ import com.qmth.themis.business.templete.TaskExportCommon;
 import com.qmth.themis.business.templete.TaskExportTemplete;
 import com.qmth.themis.common.util.Result;
 import com.qmth.themis.common.util.ResultUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.time.LocalDateTime;
+import java.util.*;
 
 /**
  * @Description: 考场导出任务
@@ -39,16 +31,13 @@ import com.qmth.themis.common.util.ResultUtil;
 public class TaskExamStudentExportTemplete implements TaskExportTemplete {
     private final static Logger log = LoggerFactory.getLogger(TaskExamStudentExportTemplete.class);
 
-    @Resource
-    SystemConfig systemConfig;
-
     @Resource
     TEExamStudentService teExamStudentService;
 
     /**
      * 考生导出模版
      *
-     * @param map
+     * @param transMap
      * @return
      */
     @Override
@@ -58,9 +47,9 @@ public class TaskExamStudentExportTemplete implements TaskExportTemplete {
         TaskExportCommon taskExportCommon = new TaskExportCommon(transMap);
         taskExportCommon.init();
         FileOutputStream fos = null;
-        File mkdir=null;
+        File mkdir = null;
         File file = null;
-        
+
         boolean oss = (boolean) taskExportCommon.getOssEnv().get(SystemConstant.OSS);
         try {
             StringJoiner stringJoiner = new StringJoiner("");
@@ -76,22 +65,22 @@ public class TaskExamStudentExportTemplete implements TaskExportTemplete {
             if (!mkdir.exists()) {
                 mkdir.mkdirs();
             }
-            file=new File(mkdir.getPath()+"/"+uuid()+SystemConstant.EXCEL_PREFIX);
+            file = new File(mkdir.getPath() + "/" + uuid() + SystemConstant.EXCEL_PREFIX);
             file.createNewFile();
-        	fos = new FileOutputStream(file);
-            Long examId=(Long)transMap.get("examId");
-            Long activityId=(Long)transMap.get("activityId");
-            String identity=(String)transMap.get("identity");
-            String name=(String)transMap.get("name");
-            String roomCode=(String)transMap.get("roomCode");
-            String courseCode=(String)transMap.get("courseCode");
-            String grade=(String)transMap.get("grade");
-            Integer enable=(Integer)transMap.get("enable");
-            String classNo=(String)transMap.get("classNo");
-            Integer hasPhoto=(Integer)transMap.get("hasPhoto");
-    		List<TEExamStudentDto> list = teExamStudentService.examStudentList(examId, activityId, identity, name, roomCode, courseCode, grade,
-    				enable, classNo,hasPhoto);
-    		ExportUtils.makeExcel(TEExamStudentDto.class, list, fos);
+            fos = new FileOutputStream(file);
+            Long examId = (Long) transMap.get("examId");
+            Long activityId = (Long) transMap.get("activityId");
+            String identity = (String) transMap.get("identity");
+            String name = (String) transMap.get("name");
+            String roomCode = (String) transMap.get("roomCode");
+            String courseCode = (String) transMap.get("courseCode");
+            String grade = (String) transMap.get("grade");
+            Integer enable = (Integer) transMap.get("enable");
+            String classNo = (String) transMap.get("classNo");
+            Integer hasPhoto = (Integer) transMap.get("hasPhoto");
+            List<TEExamStudentDto> list = teExamStudentService.examStudentList(examId, activityId, identity, name, roomCode, courseCode, grade,
+                    enable, classNo, hasPhoto);
+            ExportUtils.makeExcel(TEExamStudentDto.class, list, fos);
             taskExportCommon.ossUpload(file);
             taskExportCommon.getTbTaskHistory().setSummary("处理成功");
             long end = System.currentTimeMillis();
@@ -99,15 +88,15 @@ public class TaskExamStudentExportTemplete implements TaskExportTemplete {
         } catch (Exception e) {
             log.error("导出报错", e);
             taskExportCommon.setException(true);
-			taskExportCommon.getTbTaskHistory().setSummary("处理出错");
+            taskExportCommon.getTbTaskHistory().setSummary("处理出错");
         } finally {
             if (Objects.nonNull(fos)) {
                 fos.flush();
                 fos.close();
             }
-            if (oss&&file != null) {
-				file.delete();
-			}
+            if (oss && file != null) {
+                file.delete();
+            }
             taskExportCommon.getTbTaskHistory().setFinishTime(System.currentTimeMillis());
             taskExportCommon.getTbTaskHistory().setStatus(TaskStatusEnum.FINISH);
             taskExportCommon.getTbTaskHistory().setProgress(100.0d);
@@ -116,8 +105,8 @@ public class TaskExamStudentExportTemplete implements TaskExportTemplete {
         }
         return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
     }
-    
-	private String uuid() {
-		return UUID.randomUUID().toString().replaceAll("-", "");
-	}
+
+    private String uuid() {
+        return UUID.randomUUID().toString().replaceAll("-", "");
+    }
 }

+ 157 - 0
themis-business/src/main/java/com/qmth/themis/business/templete/impl/TaskMarkResultSimpleExportTemplete.java

@@ -0,0 +1,157 @@
+package com.qmth.themis.business.templete.impl;
+
+import cn.hutool.core.date.DateUtil;
+import com.qmth.themis.business.annotation.ExcelNote;
+import com.qmth.themis.business.constant.SystemConstant;
+import com.qmth.themis.business.dto.MarkResultSimpleExportDto;
+import com.qmth.themis.business.dto.RoomCodeExportDto;
+import com.qmth.themis.business.service.TBExamInvigilateUserService;
+import com.qmth.themis.business.service.TEExamStudentService;
+import com.qmth.themis.business.templete.TaskExportCommon;
+import com.qmth.themis.business.templete.TaskExportTemplete;
+import com.qmth.themis.business.templete.service.TempleteLogicService;
+import com.qmth.themis.common.util.Result;
+import com.qmth.themis.common.util.ResultUtil;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.streaming.SXSSFWorkbook;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.time.LocalDateTime;
+import java.util.*;
+
+/**
+ * @Description: 成绩简版导出任务
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/10/20
+ */
+@Service
+public class TaskMarkResultSimpleExportTemplete implements TaskExportTemplete {
+    private final static Logger log = LoggerFactory.getLogger(TaskMarkResultSimpleExportTemplete.class);
+
+    @Resource
+    TEExamStudentService teExamStudentService;
+
+    @Resource
+    TempleteLogicService templeteLogicService;
+
+    /**
+     * 考场导出模版
+     *
+     * @param map
+     * @return
+     */
+    @Override
+    public Result exportTask(Map<String, Object> map) throws IOException {
+        log.info("开始导出考场数据");
+        long start = System.currentTimeMillis();
+        TaskExportCommon taskExportCommon = new TaskExportCommon(map);
+        taskExportCommon.init();
+        String timeFormat = taskExportCommon.getTimeFormat();
+        taskExportCommon.setTxtList(new ArrayList());
+        FileOutputStream fos = null;
+        SXSSFWorkbook wb = null;
+        File mkdir = null, file = null;
+        int y = 0, min = 0;
+        try {
+            taskExportCommon.getTxtList().add(DateUtil.format(new Date(), timeFormat) + "->开始准备处理导出的成绩简版数据");
+            Long examId = (Long) map.get("examId");
+            Long activityId = (Long) map.get("activityId");
+            String identity = (String) map.get("identity");
+            String name = (String) map.get("name");
+            String courseCode = (String) map.get("courseCode");
+            List<MarkResultSimpleExportDto> markResultSimpleExportDtoList = teExamStudentService.markResultQueryExport(examId, activityId, identity, name, courseCode);
+            boolean oss = (boolean) taskExportCommon.getOssEnv().get(SystemConstant.OSS);
+            StringJoiner stringJoiner = new StringJoiner("");
+            if (!oss) {
+                stringJoiner.add(SystemConstant.FILES_DIR).add(File.separator);
+            }
+            LocalDateTime nowTime = LocalDateTime.now();
+            String uploadType = String.valueOf(taskExportCommon.getOssEnv().get(SystemConstant.UPLOAD_TYPE));
+            stringJoiner.add(uploadType).add(File.separator).add(String.valueOf(nowTime.getYear()))
+                    .add(File.separator).add(String.valueOf(nowTime.getMonthValue()))
+                    .add(File.separator).add(String.valueOf(nowTime.getDayOfMonth()));
+            mkdir = new File(stringJoiner.toString());
+            if (!mkdir.exists()) {
+                mkdir.mkdirs();
+            }
+            //创建excel
+            wb = new SXSSFWorkbook();
+            Sheet sheet = wb.createSheet("成绩简版导出");
+            CellStyle style = wb.createCellStyle();
+            style.setAlignment(HorizontalAlignment.CENTER); // 水平居中格式
+            style.setVerticalAlignment(VerticalAlignment.CENTER); //垂直居中
+            Row row = sheet.createRow(0);
+            Field[] fields = MarkResultSimpleExportDto.class.getDeclaredFields();
+            //绘制表头
+            for (int i = 0; i < fields.length; i++) {
+                Field field = fields[i];
+                field.setAccessible(true);
+                Cell cell = row.createCell(i);
+                cell.setCellValue(field.getAnnotation(ExcelNote.class).value());
+                cell.setCellStyle(style);
+//                sheet.setColumnWidth(i, 15 * 256);
+            }
+            int cellIndex = 0, max = SystemConstant.MAX_EXPORT_SIZE, size = markResultSimpleExportDtoList.size();
+            if (max >= size) {
+                max = size;
+            }
+            while (max <= size) {
+                List subList = markResultSimpleExportDtoList.subList(min, max);
+                //绘制数据
+                for (; y < subList.size(); y++) {
+                    MarkResultSimpleExportDto markResultSimpleExportDto = (MarkResultSimpleExportDto) subList.get(y);
+                    int firstRow = y + 1;
+                    cellIndex = 0;
+                    Row sxssfRow = sheet.createRow(firstRow);
+                    for (Field field : fields) {
+                        field.setAccessible(true);
+                        taskExportCommon.createExcelCell(sxssfRow, cellIndex, field.get(markResultSimpleExportDto), style);
+                        cellIndex++;
+                    }
+                }
+                map.put("max", max);
+                map.put("min", min);
+                map.put("size", size);
+                map = templeteLogicService.execExportMarkResultSimpleLogic(map);
+                if (max == size) {
+                    break;
+                }
+                min = max;
+                max += SystemConstant.MAX_EXPORT_SIZE;
+                if (max >= size) {
+                    max = size;
+                }
+            }
+            file = taskExportCommon.createExcel(mkdir.getPath());
+            //写入excel并上传附件
+            fos = new FileOutputStream(file);
+            wb.write(fos);
+            taskExportCommon.ossUpload(file);
+            long end = System.currentTimeMillis();
+            log.info("导出成绩简版数据结束,============耗时============:{}秒", (end - start) / 1000);
+        } catch (Exception e) {
+            log.error("导出报错", e);
+            taskExportCommon.exception(min, y, e, taskExportCommon.getTxtList());
+        } finally {
+            if (Objects.nonNull(wb)) {
+                wb.dispose();
+            }
+            if (Objects.nonNull(fos)) {
+                fos.flush();
+                fos.close();
+            }
+            //这里写入txt文件
+            taskExportCommon.writeExportResultTxt(mkdir.getPath(), taskExportCommon.getTxtList().toString(), file);
+        }
+        return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
+    }
+}

+ 158 - 0
themis-business/src/main/java/com/qmth/themis/business/templete/impl/TaskMarkResultStandardExportTemplete.java

@@ -0,0 +1,158 @@
+package com.qmth.themis.business.templete.impl;
+
+import cn.hutool.core.date.DateUtil;
+import com.qmth.themis.business.annotation.ExcelNote;
+import com.qmth.themis.business.constant.SystemConstant;
+import com.qmth.themis.business.dto.MarkResultSimpleExportDto;
+import com.qmth.themis.business.dto.RoomCodeExportDto;
+import com.qmth.themis.business.service.TBExamInvigilateUserService;
+import com.qmth.themis.business.service.TEExamStudentService;
+import com.qmth.themis.business.templete.TaskExportCommon;
+import com.qmth.themis.business.templete.TaskExportTemplete;
+import com.qmth.themis.business.templete.service.TempleteLogicService;
+import com.qmth.themis.common.util.Result;
+import com.qmth.themis.common.util.ResultUtil;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.streaming.SXSSFWorkbook;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.time.LocalDateTime;
+import java.util.*;
+
+/**
+ * @Description: 成绩标准版导出任务
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/10/20
+ */
+@Service
+public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete {
+    private final static Logger log = LoggerFactory.getLogger(TaskMarkResultStandardExportTemplete.class);
+
+
+    @Resource
+    TEExamStudentService teExamStudentService;
+
+    @Resource
+    TempleteLogicService templeteLogicService;
+
+    /**
+     * 考场导出模版
+     *
+     * @param map
+     * @return
+     */
+    @Override
+    public Result exportTask(Map<String, Object> map) throws IOException {
+        log.info("开始导出考场数据");
+        long start = System.currentTimeMillis();
+        TaskExportCommon taskExportCommon = new TaskExportCommon(map);
+        taskExportCommon.init();
+        String timeFormat = taskExportCommon.getTimeFormat();
+        taskExportCommon.setTxtList(new ArrayList());
+        FileOutputStream fos = null;
+        SXSSFWorkbook wb = null;
+        File mkdir = null, file = null;
+        int y = 0, min = 0;
+        try {
+            taskExportCommon.getTxtList().add(DateUtil.format(new Date(), timeFormat) + "->开始准备处理导出的成绩标准版数据");
+            Long examId = (Long) map.get("examId");
+            Long activityId = (Long) map.get("activityId");
+            String identity = (String) map.get("identity");
+            String name = (String) map.get("name");
+            String courseCode = (String) map.get("courseCode");
+            List<MarkResultSimpleExportDto> markResultSimpleExportDtoList = teExamStudentService.markResultQueryExport(examId, activityId, identity, name, courseCode);
+            boolean oss = (boolean) taskExportCommon.getOssEnv().get(SystemConstant.OSS);
+            StringJoiner stringJoiner = new StringJoiner("");
+            if (!oss) {
+                stringJoiner.add(SystemConstant.FILES_DIR).add(File.separator);
+            }
+            LocalDateTime nowTime = LocalDateTime.now();
+            String uploadType = String.valueOf(taskExportCommon.getOssEnv().get(SystemConstant.UPLOAD_TYPE));
+            stringJoiner.add(uploadType).add(File.separator).add(String.valueOf(nowTime.getYear()))
+                    .add(File.separator).add(String.valueOf(nowTime.getMonthValue()))
+                    .add(File.separator).add(String.valueOf(nowTime.getDayOfMonth()));
+            mkdir = new File(stringJoiner.toString());
+            if (!mkdir.exists()) {
+                mkdir.mkdirs();
+            }
+            //创建excel
+            wb = new SXSSFWorkbook();
+            Sheet sheet = wb.createSheet("成绩标准版导出");
+            CellStyle style = wb.createCellStyle();
+            style.setAlignment(HorizontalAlignment.CENTER); // 水平居中格式
+            style.setVerticalAlignment(VerticalAlignment.CENTER); //垂直居中
+            Row row = sheet.createRow(0);
+            Field[] fields = MarkResultSimpleExportDto.class.getDeclaredFields();
+            //绘制表头
+            for (int i = 0; i < fields.length; i++) {
+                Field field = fields[i];
+                field.setAccessible(true);
+                Cell cell = row.createCell(i);
+                cell.setCellValue(field.getAnnotation(ExcelNote.class).value());
+                cell.setCellStyle(style);
+//                sheet.setColumnWidth(i, 15 * 256);
+            }
+            int cellIndex = 0, max = SystemConstant.MAX_EXPORT_SIZE, size = markResultSimpleExportDtoList.size();
+            if (max >= size) {
+                max = size;
+            }
+            while (max <= size) {
+                List subList = markResultSimpleExportDtoList.subList(min, max);
+                //绘制数据
+                for (; y < subList.size(); y++) {
+                    MarkResultSimpleExportDto markResultSimpleExportDto = (MarkResultSimpleExportDto) subList.get(y);
+                    int firstRow = y + 1;
+                    cellIndex = 0;
+                    Row sxssfRow = sheet.createRow(firstRow);
+                    for (Field field : fields) {
+                        field.setAccessible(true);
+                        taskExportCommon.createExcelCell(sxssfRow, cellIndex, field.get(markResultSimpleExportDto), style);
+                        cellIndex++;
+                    }
+                }
+                map.put("max", max);
+                map.put("min", min);
+                map.put("size", size);
+                map = templeteLogicService.execExportMarkResultSimpleLogic(map);
+                if (max == size) {
+                    break;
+                }
+                min = max;
+                max += SystemConstant.MAX_EXPORT_SIZE;
+                if (max >= size) {
+                    max = size;
+                }
+            }
+            file = taskExportCommon.createExcel(mkdir.getPath());
+            //写入excel并上传附件
+            fos = new FileOutputStream(file);
+            wb.write(fos);
+            taskExportCommon.ossUpload(file);
+            long end = System.currentTimeMillis();
+            log.info("导出成绩标准版数据结束,============耗时============:{}秒", (end - start) / 1000);
+        } catch (Exception e) {
+            log.error("导出报错", e);
+            taskExportCommon.exception(min, y, e, taskExportCommon.getTxtList());
+        } finally {
+            if (Objects.nonNull(wb)) {
+                wb.dispose();
+            }
+            if (Objects.nonNull(fos)) {
+                fos.flush();
+                fos.close();
+            }
+            //这里写入txt文件
+            taskExportCommon.writeExportResultTxt(mkdir.getPath(), taskExportCommon.getTxtList().toString(), file);
+        }
+        return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
+    }
+}

+ 16 - 1
themis-business/src/main/java/com/qmth/themis/business/templete/service/TempleteLogicService.java

@@ -1,6 +1,5 @@
 package com.qmth.themis.business.templete.service;
 
-import com.qmth.themis.business.dto.RoomCodeExportDto;
 import org.springframework.util.LinkedMultiValueMap;
 
 import java.util.List;
@@ -40,4 +39,20 @@ public interface TempleteLogicService {
      * @return
      */
     public Map<String, Object> execExportRoomCodeLogic(Map<String, Object> map);
+
+    /**
+     * 成绩简版导出逻辑
+     *
+     * @param map
+     * @return
+     */
+    public Map<String, Object> execExportMarkResultSimpleLogic(Map<String, Object> map);
+
+    /**
+     * 成绩标准版导出逻辑
+     *
+     * @param map
+     * @return
+     */
+    public Map<String, Object> execExportMarkResultStandardLogic(Map<String, Object> map);
 }

+ 60 - 37
themis-business/src/main/java/com/qmth/themis/business/templete/service/impl/TempleteLogicServiceImpl.java

@@ -15,7 +15,6 @@ import com.qmth.themis.business.enums.TaskStatusEnum;
 import com.qmth.themis.business.service.*;
 import com.qmth.themis.business.templete.service.TempleteLogicService;
 import com.qmth.themis.common.exception.BusinessException;
-
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.LinkedMultiValueMap;
@@ -179,8 +178,8 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
                     if (Objects.nonNull(examCourseCacheBean)) {
                         teExamStudent.setCourseName(examCourseCacheBean.getCourseName());
                     }
-                    if(teExamStudent.getAlreadyExamCount()==null) {
-                    	teExamStudent.setAlreadyExamCount(0);
+                    if (teExamStudent.getAlreadyExamCount() == null) {
+                        teExamStudent.setAlreadyExamCount(0);
                     }
                     teExamStudentService.saveOrUpdate(teExamStudent);
                     roomCodeAndNameSet.add(examId + ":" + teExamStudent.getRoomCode() + ":" + teExamStudent.getRoomName());
@@ -233,7 +232,7 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
         if (Objects.nonNull(map.get("orgId"))) {
             orgId = Long.parseLong(String.valueOf(map.get("orgId")));
         }
-        Long examId=Long.parseLong(String.valueOf(map.get("examId")));
+        Long examId = Long.parseLong(String.valueOf(map.get("examId")));
         Long createId = Long.parseLong(String.valueOf(map.get("createId")));
         List<String> txtList = (List<String>) map.get("txtList");
         TBTaskHistory tbTaskHistory = (TBTaskHistory) map.get("tbTaskHistory");
@@ -252,9 +251,9 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
                 List subList = examStudentDtoImportList.subList(min, max);
                 for (; y < subList.size(); y++) {
                     RoomCodeImportDto roomCodeImportDto = (RoomCodeImportDto) subList.get(y);
-                    dataVerify(examId,roomCodeImportDto.getTeacher1(), roomCodeImportDto.getRoomCode(), roomCodeImportDto.getRoomName(), orgId, createId);
-                    dataVerify(examId,roomCodeImportDto.getTeacher2(), roomCodeImportDto.getRoomCode(), roomCodeImportDto.getRoomName(), orgId, createId);
-                    dataVerify(examId,roomCodeImportDto.getTeacher3(), roomCodeImportDto.getRoomCode(), roomCodeImportDto.getRoomName(), orgId, createId);
+                    dataVerify(examId, roomCodeImportDto.getTeacher1(), roomCodeImportDto.getRoomCode(), roomCodeImportDto.getRoomName(), orgId, createId);
+                    dataVerify(examId, roomCodeImportDto.getTeacher2(), roomCodeImportDto.getRoomCode(), roomCodeImportDto.getRoomName(), orgId, createId);
+                    dataVerify(examId, roomCodeImportDto.getTeacher3(), roomCodeImportDto.getRoomCode(), roomCodeImportDto.getRoomName(), orgId, createId);
                 }
                 txtList = this.importProgress(max, min, size, txtList, tbTaskHistory, timeFormat);
                 if (max == size) {
@@ -279,17 +278,24 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
     @Override
     @Transactional
     public Map<String, Object> execExportRoomCodeLogic(Map<String, Object> map) {
-        List<String> txtList = (List<String>) map.get("txtList");
-        TBTaskHistory tbTaskHistory = (TBTaskHistory) map.get("tbTaskHistory");
-        Integer max = Integer.parseInt(String.valueOf(map.get("max")));
-        Integer min = Integer.parseInt(String.valueOf(map.get("min")));
-        Integer size = Integer.parseInt(String.valueOf(map.get("size")));
-        String timeFormat = String.valueOf(map.get("timeFormat"));
-        this.exportProgress(max, min, size, txtList, tbTaskHistory, timeFormat);
-        return map;
+        return commonExport(map);
+    }
+
+    @Override
+    @Transactional
+    public Map<String, Object> execExportMarkResultSimpleLogic(Map<String, Object> map) {
+        return commonExport(map);
     }
 
-    /**查询监考帐号是否存在
+    @Override
+    @Transactional
+    public Map<String, Object> execExportMarkResultStandardLogic(Map<String, Object> map) {
+        return commonExport(map);
+    }
+
+    /**
+     * 查询监考帐号是否存在
+     *
      * @param examId
      * @param userName
      * @param roomCode
@@ -297,10 +303,10 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
      * @param orgId
      * @param createId
      */
-    public void dataVerify(Long examId,String userName, String roomCode, String roomName, Long orgId, Long createId) {
-    	if(!checkRoomCodeExist(examId, roomCode, orgId)) {
-    		throw new BusinessException("考场代码 "+roomCode+" 不存在");
-    	}
+    public void dataVerify(Long examId, String userName, String roomCode, String roomName, Long orgId, Long createId) {
+        if (!checkRoomCodeExist(examId, roomCode, orgId)) {
+            throw new BusinessException("考场代码 " + roomCode + " 不存在");
+        }
         if (Objects.nonNull(userName)) {
             //先查询监考帐号是否存在
             QueryWrapper<TBUser> tbUserQueryWrapper = new QueryWrapper<>();
@@ -322,33 +328,33 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
                     .eq(TBExamInvigilateUser::getRoomName, roomName);
             TBExamInvigilateUser tbExamInvigilateUser = tbExamInvigilateUserService.getOne(tbExamInvigilateUserQueryWrapper);
             if (Objects.isNull(tbExamInvigilateUser)) {//新增考场
-            	 QueryWrapper<TBExamInvigilateUser> wrapper = new QueryWrapper<>();
-            	 wrapper.lambda().eq(TBExamInvigilateUser::getOrgId, orgId)
-                         .isNull(TBExamInvigilateUser::getUserId)
-                         .eq(TBExamInvigilateUser::getRoomCode, roomCode)
-                         .eq(TBExamInvigilateUser::getExamId, examId)
-                         .eq(TBExamInvigilateUser::getRoomName, roomName);
+                QueryWrapper<TBExamInvigilateUser> wrapper = new QueryWrapper<>();
+                wrapper.lambda().eq(TBExamInvigilateUser::getOrgId, orgId)
+                        .isNull(TBExamInvigilateUser::getUserId)
+                        .eq(TBExamInvigilateUser::getRoomCode, roomCode)
+                        .eq(TBExamInvigilateUser::getExamId, examId)
+                        .eq(TBExamInvigilateUser::getRoomName, roomName);
                 tbExamInvigilateUser = tbExamInvigilateUserService.getOne(wrapper);
-                if(tbExamInvigilateUser==null) {
-                	tbExamInvigilateUser = new TBExamInvigilateUser(examId,orgId, tbUser.getId(), roomCode, roomName);
-                }else {
-                	tbExamInvigilateUser.setUserId(tbUser.getId());
+                if (tbExamInvigilateUser == null) {
+                    tbExamInvigilateUser = new TBExamInvigilateUser(examId, orgId, tbUser.getId(), roomCode, roomName);
+                } else {
+                    tbExamInvigilateUser.setUserId(tbUser.getId());
                 }
                 tbExamInvigilateUserService.saveOrUpdate(tbExamInvigilateUser);
             }
         }
     }
-    
-    private boolean checkRoomCodeExist(Long examId,String roomCode,Long orgId) {
-    	QueryWrapper<TBExamInvigilateUser> tbExamInvigilateUserQueryWrapper = new QueryWrapper<>();
+
+    private boolean checkRoomCodeExist(Long examId, String roomCode, Long orgId) {
+        QueryWrapper<TBExamInvigilateUser> tbExamInvigilateUserQueryWrapper = new QueryWrapper<>();
         tbExamInvigilateUserQueryWrapper.lambda().eq(TBExamInvigilateUser::getOrgId, orgId)
                 .eq(TBExamInvigilateUser::getRoomCode, roomCode)
                 .eq(TBExamInvigilateUser::getExamId, examId);
         int c = tbExamInvigilateUserService.count(tbExamInvigilateUserQueryWrapper);
-        if(c==0) {
-        	return true;
-        }else {
-        	return false;
+        if (c == 0) {
+            return true;
+        } else {
+            return false;
         }
     }
 
@@ -407,4 +413,21 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
         tbTaskHistory.setProgress(progress.doubleValue());
         return txtList;
     }
+
+    /**
+     * 导入公用
+     *
+     * @param map
+     * @return
+     */
+    private Map<String, Object> commonExport(Map<String, Object> map) {
+        List<String> txtList = (List<String>) map.get("txtList");
+        TBTaskHistory tbTaskHistory = (TBTaskHistory) map.get("tbTaskHistory");
+        Integer max = Integer.parseInt(String.valueOf(map.get("max")));
+        Integer min = Integer.parseInt(String.valueOf(map.get("min")));
+        Integer size = Integer.parseInt(String.valueOf(map.get("size")));
+        String timeFormat = String.valueOf(map.get("timeFormat"));
+        this.exportProgress(max, min, size, txtList, tbTaskHistory, timeFormat);
+        return map;
+    }
 }

+ 66 - 58
themis-business/src/main/resources/mapper/TEExamStudentMapper.xml

@@ -280,64 +280,72 @@
 	update t_e_exam_student set current_record_id=#{currentRecordId} where id=#{examStudentId} and (current_record_id is null or current_record_id &lt; #{currentRecordId})
 	</update>
 
-	<select id="markResultQuery" resultType="com.qmth.themis.business.dto.response.MarkResultDto">
+	<sql id="markResultCommon">
 		select
-			t.examActivityCode,
-			t.name,
-			t.identity,
-			t.courseCode,
-			t.courseName,
-			t.roomCode,
-			t.roomName,
-			t.grade,
-			t.classNo,
-			if(t.examCount <![CDATA[ <= ]]> 0,true,false) as examAbsent,
-			t.examCount,
-			t.examName,
-			if(t.breachCount is null,0,t.breachCount) as breachCount,
-			ifnull(t.objectiveScore,0) as objectiveScore,
-			ifnull(t.objectiveScore,0) as sumScore,
-			t.examId,
-			t.examActivityId,
-			0 as subjectiveScore
-			from
-			(
-			select
-			tee.id as examId,tee.name as examName,teea.id as examActivityId, teea.code as examActivityCode, tes.name, tes.`identity`, tees.course_code as courseCode, tees.course_name as courseName, tees.room_code as roomCode, tees.room_name as roomName, tees.grade, tees.class_no as classNo, (
-			select
-			count(1)
-			from
-			t_oe_exam_record toer
-			where
-			toer.exam_student_id = tees.id) as examCount,
-			(select sum(toer.breach_status) from t_oe_exam_record toer
-			where toer.exam_student_id = tees.id and toer.breach_status = 0) as breachCount,
-			(select max(toer.objective_score) from t_oe_exam_record toer
-			where toer.exam_student_id = tees.id and (toer.breach_status = 1 or breach_status is null) and (toer.status = 'FINISHED' or toer.status = 'PERSISTED')) as objectiveScore
-			from
-			t_e_student tes
-			left join t_e_exam_student tees on
-			tees.student_id = tes.id
-			left join t_e_exam tee on
-			tee.id = tees.exam_id
-			left join t_e_exam_activity teea on
-			teea.id = tees.exam_activity_id
-			<where>
-				<if test="examId != null and examId != ''">
-					and tee.id = #{examId}
-				</if>
-				<if test="activityId != null and activityId != ''">
-					and teea.id = #{activityId}
-				</if>
-				<if test="identity != null and identity != ''">
-					and tes.identity like concat('%', #{identity}, '%')
-				</if>
-				<if test="name != null and name != ''">
-					and tes.name like concat('%', #{name}, '%')
-				</if>
-				<if test="courseCode != null and courseCode != ''">
-					and tees.course_code = #{courseCode}
-				</if>
-			</where> ) t
+		t.examActivityCode,
+		t.name,
+		t.identity,
+		t.courseCode,
+		t.courseName,
+		t.roomCode,
+		t.roomName,
+		t.grade,
+		t.classNo,
+		if(t.examCount <![CDATA[ <= ]]> 0,true,false) as examAbsent,
+		t.examCount,
+		t.examName,
+		if(t.breachCount is null,0,t.breachCount) as breachCount,
+		ifnull(t.objectiveScore,0) as objectiveScore,
+		ifnull(t.objectiveScore,0) as sumScore,
+		t.examId,
+		t.examActivityId,
+		0 as subjectiveScore
+		from
+		(
+		select
+		tee.id as examId,tee.name as examName,teea.id as examActivityId, teea.code as examActivityCode, tes.name, tes.`identity`, tees.course_code as courseCode, tees.course_name as courseName, tees.room_code as roomCode, tees.room_name as roomName, tees.grade, tees.class_no as classNo, (
+		select
+		count(1)
+		from
+		t_oe_exam_record toer
+		where
+		toer.exam_student_id = tees.id) as examCount,
+		(select sum(toer.breach_status) from t_oe_exam_record toer
+		where toer.exam_student_id = tees.id and toer.breach_status = 0) as breachCount,
+		(select max(toer.objective_score) from t_oe_exam_record toer
+		where toer.exam_student_id = tees.id and (toer.breach_status = 1 or breach_status is null) and (toer.status = 'FINISHED' or toer.status = 'PERSISTED')) as objectiveScore
+		from
+		t_e_student tes
+		left join t_e_exam_student tees on
+		tees.student_id = tes.id
+		left join t_e_exam tee on
+		tee.id = tees.exam_id
+		left join t_e_exam_activity teea on
+		teea.id = tees.exam_activity_id
+		<where>
+			<if test="examId != null and examId != ''">
+				and tee.id = #{examId}
+			</if>
+			<if test="activityId != null and activityId != ''">
+				and teea.id = #{activityId}
+			</if>
+			<if test="identity != null and identity != ''">
+				and tes.identity like concat('%', #{identity}, '%')
+			</if>
+			<if test="name != null and name != ''">
+				and tes.name like concat('%', #{name}, '%')
+			</if>
+			<if test="courseCode != null and courseCode != ''">
+				and tees.course_code = #{courseCode}
+			</if>
+		</where> ) t
+	</sql>
+
+	<select id="markResultQuery" resultType="com.qmth.themis.business.dto.response.MarkResultDto">
+		<include refid="markResultCommon" />
+	</select>
+
+	<select id="markResultQueryExport" resultType="com.qmth.themis.business.dto.MarkResultSimpleExportDto">
+		<include refid="markResultCommon" />
 	</select>
 </mapper>

+ 1 - 1
themis-exam/src/main/java/com/qmth/themis/exam/start/StartRunning.java

@@ -49,7 +49,7 @@ public class StartRunning implements CommandLineRunner {
         /**
          * task
          */
-        rocketMessageConsumer.setRocketMQConsumer(nameServer, MqGroupEnum.TASK_GROUP.getCode(), MqTopicEnum.THEMIS_TOPIC.getCode(), MqTagEnum.EXAM_STUDENT_IMPORT.name() + "||" + MqTagEnum.ROOM_CODE_IMPORT.name() + "||" + MqTagEnum.ROOM_CODE_EXPORT.name() + "||" + MqTagEnum.EXAM_PAPER_IMPORT.name() + "||" + MqTagEnum.EXAM_STUDENT_EXPORT.name(), MessageModel.CLUSTERING, SpringContextHolder.getBean(TaskConcurrentlyImpl.class));
+        rocketMessageConsumer.setRocketMQConsumer(nameServer, MqGroupEnum.TASK_GROUP.getCode(), MqTopicEnum.THEMIS_TOPIC.getCode(), MqTagEnum.EXAM_STUDENT_IMPORT.name() + "||" + MqTagEnum.ROOM_CODE_IMPORT.name() + "||" + MqTagEnum.ROOM_CODE_EXPORT.name() + "||" + MqTagEnum.EXAM_PAPER_IMPORT.name() + "||" + MqTagEnum.EXAM_STUDENT_EXPORT.name() + "||" + MqTagEnum.MARK_RESULT_SIMPLE_EXPORT.name() + "||" + MqTagEnum.MARK_RESULT_STANDARD_EXPORT.name(), MessageModel.CLUSTERING, SpringContextHolder.getBean(TaskConcurrentlyImpl.class));
         /**
          * log
          */

+ 4 - 0
themis-mq/src/main/java/com/qmth/themis/mq/service/impl/MqLogicServiceImpl.java

@@ -210,6 +210,10 @@ public class MqLogicServiceImpl implements MqLogicService {
                     taskExportTemplete = SpringContextHolder.getBean(TaskRoomCodeExportTemplete.class);
                 } else if (Objects.equals(MqTagEnum.EXAM_STUDENT_EXPORT.name(), tag)) {
                     taskExportTemplete = SpringContextHolder.getBean(TaskExamStudentExportTemplete.class);
+                } else if (Objects.equals(MqTagEnum.MARK_RESULT_SIMPLE_EXPORT.name(), tag)) {
+                    taskExportTemplete = SpringContextHolder.getBean(TaskMarkResultSimpleExportTemplete.class);
+                } else if (Objects.equals(MqTagEnum.MARK_RESULT_STANDARD_EXPORT.name(), tag)) {
+                    taskExportTemplete = SpringContextHolder.getBean(TaskMarkResultStandardExportTemplete.class);
                 }
                 try {
                     taskExportTemplete.exportTask(map);

+ 1 - 1
themis-task/src/main/java/com/qmth/themis/task/start/StartRunning.java

@@ -71,7 +71,7 @@ public class StartRunning implements CommandLineRunner {
         /**
          * task
          */
-        rocketMessageConsumer.setRocketMQConsumer(nameServer, MqGroupEnum.TASK_GROUP.getCode(), MqTopicEnum.THEMIS_TOPIC.getCode(), MqTagEnum.EXAM_STUDENT_IMPORT.name() + "||" + MqTagEnum.ROOM_CODE_IMPORT.name() + "||" + MqTagEnum.ROOM_CODE_EXPORT.name() + "||" + MqTagEnum.EXAM_PAPER_IMPORT.name() + "||" + MqTagEnum.EXAM_STUDENT_EXPORT.name(), MessageModel.CLUSTERING, SpringContextHolder.getBean(TaskConcurrentlyImpl.class));
+        rocketMessageConsumer.setRocketMQConsumer(nameServer, MqGroupEnum.TASK_GROUP.getCode(), MqTopicEnum.THEMIS_TOPIC.getCode(), MqTagEnum.EXAM_STUDENT_IMPORT.name() + "||" + MqTagEnum.ROOM_CODE_IMPORT.name() + "||" + MqTagEnum.ROOM_CODE_EXPORT.name() + "||" + MqTagEnum.EXAM_PAPER_IMPORT.name() + "||" + MqTagEnum.EXAM_STUDENT_EXPORT.name() + "||" + MqTagEnum.MARK_RESULT_SIMPLE_EXPORT.name() + "||" + MqTagEnum.MARK_RESULT_STANDARD_EXPORT.name(), MessageModel.CLUSTERING, SpringContextHolder.getBean(TaskConcurrentlyImpl.class));
         /**
          * log
          */