Ver código fonte

Merge branch 'dev'
1

wangliang 4 anos atrás
pai
commit
26f305ae23

+ 17 - 0
themis-business/src/main/java/com/qmth/themis/business/annotation/ExcelNotExport.java

@@ -0,0 +1,17 @@
+package com.qmth.themis.business.annotation;
+
+import java.lang.annotation.*;
+
+/**
+* @Description: excel字段不导出注释
+* @Param:
+* @return:
+* @Author: wangliang
+* @Date: 2020/7/20
+*/
+@Documented
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ExcelNotExport {
+
+}

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

@@ -1,18 +1,17 @@
 package com.qmth.themis.business.dto;
 
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.themis.business.annotation.ExcelNotExport;
 import com.qmth.themis.business.annotation.ExcelNote;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
 
 /**
- * @Description: 考场导出 dto
+ * @Description: 成绩简版导出 dto
  * @Param:
  * @return:
  * @Author: wangliang
- * @Date: 2020/7/20
+ * @Date: 2020/10/20
  */
 public class MarkResultSimpleExportDto implements Serializable {
 
@@ -75,6 +74,7 @@ public class MarkResultSimpleExportDto implements Serializable {
     private String sumScore;
 
     @ApiModelProperty(value = "试卷ID")
+    @ExcelNotExport
     private String paperId;
 
     public String getPaperId() {

+ 207 - 0
themis-business/src/main/java/com/qmth/themis/business/dto/MarkResultStandardExportDto.java

@@ -0,0 +1,207 @@
+package com.qmth.themis.business.dto;
+
+import com.qmth.themis.business.annotation.ExcelNotExport;
+import com.qmth.themis.business.annotation.ExcelNote;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 成绩标准版导出 dto
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/7/20
+ */
+public class MarkResultStandardExportDto implements Serializable{
+
+    @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 String examAbsent;
+
+    @ApiModelProperty(value = "违纪次数")
+    @ExcelNote(value = "违纪次数")
+    private String breachCount;
+
+    @ApiModelProperty(value = "考试次数")
+    @ExcelNote(value = "考试次数")
+    private String examCount;
+
+    @ApiModelProperty(value = "客观分")
+    @ExcelNote(value = "客观分")
+    private String objectiveScore;
+
+    @ApiModelProperty(value = "主观分")
+    @ExcelNote(value = "主观分")
+    private String subjectiveScore;
+
+    @ApiModelProperty(value = "总分")
+    @ExcelNote(value = "总分")
+    private String sumScore;
+
+    @ApiModelProperty(value = "试卷ID")
+    @ExcelNotExport
+    private String paperId;
+
+    public String getPaperId() {
+        return paperId;
+    }
+
+    public void setPaperId(String paperId) {
+        this.paperId = paperId;
+    }
+
+    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 String getExamAbsent() {
+        return examAbsent;
+    }
+
+    public void setExamAbsent(String examAbsent) {
+        this.examAbsent = examAbsent;
+    }
+
+    public String getBreachCount() {
+        return breachCount;
+    }
+
+    public void setBreachCount(String breachCount) {
+        this.breachCount = breachCount;
+    }
+
+    public String getExamCount() {
+        return examCount;
+    }
+
+    public void setExamCount(String examCount) {
+        this.examCount = examCount;
+    }
+
+    public String getObjectiveScore() {
+        return objectiveScore;
+    }
+
+    public void setObjectiveScore(String objectiveScore) {
+        this.objectiveScore = objectiveScore;
+    }
+
+    public String getSubjectiveScore() {
+        return subjectiveScore;
+    }
+
+    public void setSubjectiveScore(String subjectiveScore) {
+        this.subjectiveScore = subjectiveScore;
+    }
+
+    public String getSumScore() {
+        return sumScore;
+    }
+
+    public void setSumScore(String sumScore) {
+        this.sumScore = sumScore;
+    }
+}

+ 14 - 8
themis-business/src/main/java/com/qmth/themis/business/templete/impl/TaskMarkResultSimpleExportTemplete.java

@@ -1,11 +1,10 @@
 package com.qmth.themis.business.templete.impl;
 
 import cn.hutool.core.date.DateUtil;
+import com.qmth.themis.business.annotation.ExcelNotExport;
 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;
@@ -22,6 +21,7 @@ import javax.annotation.Resource;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
 import java.time.LocalDateTime;
 import java.util.*;
@@ -95,10 +95,13 @@ public class TaskMarkResultSimpleExportTemplete implements TaskExportTemplete {
             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);
+                Annotation annotation = field.getAnnotation(ExcelNotExport.class);
+                if (Objects.isNull(annotation)) {
+                    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) {
@@ -114,8 +117,11 @@ public class TaskMarkResultSimpleExportTemplete implements TaskExportTemplete {
                     Row sxssfRow = sheet.createRow(firstRow);
                     for (Field field : fields) {
                         field.setAccessible(true);
-                        taskExportCommon.createExcelCell(sxssfRow, cellIndex, field.get(markResultSimpleExportDto), style);
-                        cellIndex++;
+                        Annotation annotation = field.getAnnotation(ExcelNotExport.class);
+                        if (Objects.isNull(annotation)) {
+                            taskExportCommon.createExcelCell(sxssfRow, cellIndex, field.get(markResultSimpleExportDto), style);
+                            cellIndex++;
+                        }
                     }
                 }
                 map.put("max", max);

+ 24 - 13
themis-business/src/main/java/com/qmth/themis/business/templete/impl/TaskMarkResultStandardExportTemplete.java

@@ -1,11 +1,13 @@
 package com.qmth.themis.business.templete.impl;
 
 import cn.hutool.core.date.DateUtil;
+import com.google.common.reflect.TypeToken;
+import com.google.gson.Gson;
+import com.qmth.themis.business.annotation.ExcelNotExport;
 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.dto.MarkResultStandardExportDto;
 import com.qmth.themis.business.service.TEExamStudentService;
 import com.qmth.themis.business.templete.TaskExportCommon;
 import com.qmth.themis.business.templete.TaskExportTemplete;
@@ -22,6 +24,7 @@ import javax.annotation.Resource;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
 import java.time.LocalDateTime;
 import java.util.*;
@@ -70,7 +73,9 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
             String name = (String) map.get("name");
             String courseCode = (String) map.get("courseCode");
             List<MarkResultSimpleExportDto> markResultSimpleExportDtoList = teExamStudentService.markResultQueryExport(examId, activityId, identity, name, courseCode);
-
+            Gson gson = new Gson();
+            List<MarkResultStandardExportDto> markResultStandardExportDtoList = gson.fromJson(gson.toJson(markResultSimpleExportDtoList), new TypeToken<List<MarkResultStandardExportDto>>() {
+            }.getType());
             boolean oss = (boolean) taskExportCommon.getOssEnv().get(SystemConstant.OSS);
             StringJoiner stringJoiner = new StringJoiner("");
             if (!oss) {
@@ -92,32 +97,38 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
             style.setAlignment(HorizontalAlignment.CENTER); // 水平居中格式
             style.setVerticalAlignment(VerticalAlignment.CENTER); //垂直居中
             Row row = sheet.createRow(0);
-            Field[] fields = MarkResultSimpleExportDto.class.getDeclaredFields();
+            Field[] fields = MarkResultStandardExportDto.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);
+                Annotation annotation = field.getAnnotation(ExcelNotExport.class);
+                if (Objects.isNull(annotation)) {
+                    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();
+            int cellIndex = 0, max = SystemConstant.MAX_EXPORT_SIZE, size = markResultStandardExportDtoList.size();
             if (max >= size) {
                 max = size;
             }
             while (max <= size) {
-                List subList = markResultSimpleExportDtoList.subList(min, max);
+                List subList = markResultStandardExportDtoList.subList(min, max);
                 //绘制数据
                 for (; y < subList.size(); y++) {
-                    MarkResultSimpleExportDto markResultSimpleExportDto = (MarkResultSimpleExportDto) subList.get(y);
+                    MarkResultStandardExportDto markResultStandardExportDto = (MarkResultStandardExportDto) 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++;
+                        Annotation annotation = field.getAnnotation(ExcelNotExport.class);
+                        if (Objects.isNull(annotation)) {
+                            taskExportCommon.createExcelCell(sxssfRow, cellIndex, field.get(markResultStandardExportDto), style);
+                            cellIndex++;
+                        }
                     }
                 }
                 map.put("max", max);

+ 16 - 1
themis-mq/src/main/java/com/qmth/themis/mq/service/impl/MqLogicServiceImpl.java

@@ -780,7 +780,7 @@ public class MqLogicServiceImpl implements MqLogicService {
         tOeExamBreakHistoryService.saveOrUpdate(tOeExamBreakHistory);
         redisUtil.setForHash(RedisKeyHelper.examBreakCacheKey(tOeExamBreakHistory.getId()), SimpleBeanUtil.objectToMap(tOeExamBreakHistory));
 
-        Long clientLastSyncTime = ExamRecordCacheUtil.getClientLastSyncTime(recordId);
+//        Long clientLastSyncTime = ExamRecordCacheUtil.getClientLastSyncTime(recordId);
 //        Integer diff = 0;
 //        Long startTime = System.currentTimeMillis();
 //        if (Objects.nonNull(clientLastSyncTime)) {//大于等于当前时间,说明未重连或重登录
@@ -801,6 +801,21 @@ public class MqLogicServiceImpl implements MqLogicService {
         TEExamStudentLog teExamStudentLog = new TEExamStudentLog(SystemOperationEnum.BREAK_OFF.name(), SystemOperationEnum.BREAK_OFF.getCode(), SystemOperationEnum.BREAK_OFF.getCode(), examStudentCacheBean.getStudentId(), examStudentId, recordId, ExamRecordCacheUtil.getLastBreakId(recordId), SystemOperationEnum.BREAK_OFF.getTitle());
         teExamStudentLogService.save(teExamStudentLog);
 
+        //更新客户端摄像头推流状态为stop
+        MonitorStatusSourceEnum cameraStatusSourceEnum = ExamRecordCacheUtil.getMonitorStatus(recordId, MonitorVideoSourceEnum.CLIENT_CAMERA.name());
+        if (Objects.nonNull(cameraStatusSourceEnum)) {
+            ExamRecordCacheUtil.setMonitorStatus(recordId, cameraStatusSourceEnum.name(), MonitorStatusSourceEnum.STOP, true);
+        }
+        //更新客户端屏幕推流状态为stop
+        MonitorStatusSourceEnum screenStatusSourceEnum = ExamRecordCacheUtil.getMonitorStatus(recordId, MonitorVideoSourceEnum.CLIENT_SCREEN.name());
+        if (Objects.nonNull(screenStatusSourceEnum)) {
+            ExamRecordCacheUtil.setMonitorStatus(recordId, screenStatusSourceEnum.name(), MonitorStatusSourceEnum.STOP, true);
+        }
+        //发送移动端监考退出考试mq消息 start
+        MqDto mqDtoExamStop = new MqDto(MqTopicEnum.THEMIS_TOPIC.getCode(), MqTagEnum.EXAM_STOP.name(), recordId, MqTagEnum.EXAM_STOP, String.valueOf(recordId), String.valueOf(recordId));
+        mqDtoService.assembleSendOneWayMsg(mqDtoExamStop);
+        //发送移动端监考退出考试mq消息 end
+
         Gson gson = new Gson();
         mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);
         TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);