Forráskód Böngészése

3.4.4 update-20250210优化评卷管理查询

xiaofei 4 hónapja
szülő
commit
ffd9697e0a

+ 0 - 285
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/BasicExamStudentDto.java

@@ -1,285 +0,0 @@
-package com.qmth.distributed.print.business.bean.dto;
-
-import com.qmth.boot.tools.excel.annotation.ExcelColumn;
-import com.qmth.teachcloud.common.annotation.ExcelError;
-import com.qmth.teachcloud.common.annotation.ExcelNote;
-import com.qmth.teachcloud.common.annotation.ExcelProperty;
-import io.swagger.annotations.ApiModelProperty;
-
-import javax.validation.constraints.NotNull;
-import java.util.Date;
-
-/**
- * @Description: 考生字典数据导入导出dto
- * @Author: CaoZixuan
- * @Date: 2024-02-26
- */
-public class BasicExamStudentDto {
-
-    @ApiModelProperty("课程名称")
-    @ExcelProperty(name = "课程名称", width = 10, index = 1)
-    @ExcelNote(value = "课程名称")
-    @ExcelColumn(name = "课程名称",index = 0,nullable = true)
-    @NotNull
-    private String courseName;
-
-    @ApiModelProperty("课程代码")
-    @ExcelProperty(name = "课程代码", width = 10, index = 2)
-    @ExcelNote(value = "课程代码")
-    @ExcelColumn(name = "课程代码",index = 1,nullable = true)
-    @NotNull
-    private String courseCode;
-
-    @ApiModelProperty("姓名")
-    @ExcelProperty(name = "姓名", width = 10, index = 3)
-    @ExcelNote(value = "姓名")
-    @ExcelColumn(name = "姓名",index = 2,nullable = true)
-    @NotNull
-    private String studentName;
-
-    @ApiModelProperty("学号")
-    @ExcelProperty(name = "学号", width = 10, index = 4)
-    @ExcelNote(value = "学号")
-    @ExcelColumn(name = "学号",index = 3,nullable = true)
-    @NotNull
-    private String studentCode;
-
-    @ApiModelProperty("学院")
-    @ExcelProperty(name = "学院", width = 10, index = 5)
-    @ExcelNote(value = "学院")
-    @ExcelColumn(name = "学院",index = 4)
-    private String collegeName;
-
-    @ApiModelProperty("专业")
-    @ExcelProperty(name = "专业", width = 10, index = 6)
-    @ExcelNote(value = "专业")
-    @ExcelColumn(name = "专业",index = 5)
-    private String majorName;
-
-    @ApiModelProperty("教学班")
-    @ExcelProperty(name = "教学班", width = 10, index = 7)
-    @ExcelNote(value = "教学班")
-    @ExcelColumn(name = "教学班",index = 6,nullable = true)
-    private String teachClassName;
-    @ApiModelProperty("行政班")
-    @ExcelProperty(name = "行政班", width = 10, index = 8)
-    @ExcelNote(value = "行政班")
-    @ExcelColumn(name = "行政班",index = 7,nullable = true)
-    private String className;
-
-    @ApiModelProperty("试卷编号")
-    @ExcelProperty(name = "试卷编号", width = 10, index = 9)
-    @ExcelNote(value = "试卷编号")
-    @ExcelColumn(name = "试卷编号",index = 8)
-    private String paperNumber;
-
-    @ApiModelProperty("卷型")
-    @ExcelProperty(name = "卷型", width = 10, index = 10)
-    @ExcelNote(value = "卷型")
-    @ExcelColumn(name = "卷型",index = 9)
-    private String paperType;
-
-    @ApiModelProperty("任课老师")
-    @ExcelProperty(name = "任课老师", width = 10, index = 11)
-    @ExcelNote(value = "任课老师")
-    @ExcelColumn(name = "任课老师",index = 10)
-    private String teacherName;
-
-    @ApiModelProperty("任课老师工号")
-    @ExcelProperty(name = "任课老师工号", width = 10, index = 12)
-    @ExcelNote(value = "任课老师工号")
-    @ExcelColumn(name = "任课老师工号",index = 11)
-    private String teacherCode;
-
-    @ApiModelProperty("考试日期")
-    @ExcelProperty(name = "考试日期", width = 10, index = 13)
-    @ExcelNote(value = "考试日期")
-    @ExcelColumn(name = "考试日期",index = 12)
-    private String examDate;
-
-    @ApiModelProperty("考试时间")
-    @ExcelProperty(name = "考试时间", width = 10, index = 14)
-    @ExcelNote(value = "考试时间")
-    @ExcelColumn(name = "考试时间",index = 13)
-    private String examTime;
-
-    @ApiModelProperty("考点(校区)")
-    @ExcelProperty(name = "考点(校区)", width = 10, index = 15)
-    @ExcelNote(value = "考点(校区)")
-    @ExcelColumn(name = "考点(校区)",index = 14)
-    private String examPlace;
-
-    @ApiModelProperty("考场(考试教室)")
-    @ExcelProperty(name = "考场(考试教室)", width = 10, index = 16)
-    @ExcelNote(value = "考场(考试教室)")
-    @ExcelColumn(name = "考场(考试教室)",index = 15)
-    private String examRoom;
-
-    @ApiModelProperty("开课学院")
-    @ExcelProperty(name = "开课学院", width = 10, index = 17)
-    @ExcelNote(value = "开课学院")
-    @ExcelColumn(name = "开课学院",index = 16)
-    private String teachingRoomName;
-
-    @ApiModelProperty("状态")
-    @ExcelProperty(name = "状态", width = 10, index = 18)
-    @ExcelNote(value = "状态")
-    @ExcelColumn(name = "状态",index = 17)
-    private String statusDisplay;
-
-    @ApiModelProperty("异常信息")
-    @ExcelError
-    private String errorMsg;
-
-    public String getCourseName() {
-        return courseName;
-    }
-
-    public void setCourseName(String courseName) {
-        this.courseName = courseName;
-    }
-
-    public String getCourseCode() {
-        return courseCode;
-    }
-
-    public void setCourseCode(String courseCode) {
-        this.courseCode = courseCode;
-    }
-
-    public String getStudentName() {
-        return studentName;
-    }
-
-    public void setStudentName(String studentName) {
-        this.studentName = studentName;
-    }
-
-    public String getStudentCode() {
-        return studentCode;
-    }
-
-    public void setStudentCode(String studentCode) {
-        this.studentCode = studentCode;
-    }
-
-    public String getCollegeName() {
-        return collegeName;
-    }
-
-    public void setCollegeName(String collegeName) {
-        this.collegeName = collegeName;
-    }
-
-    public String getMajorName() {
-        return majorName;
-    }
-
-    public void setMajorName(String majorName) {
-        this.majorName = majorName;
-    }
-
-    public String getTeachClassName() {
-        return teachClassName;
-    }
-
-    public void setTeachClassName(String teachClassName) {
-        this.teachClassName = teachClassName;
-    }
-
-    public String getClassName() {
-        return className;
-    }
-
-    public void setClassName(String className) {
-        this.className = className;
-    }
-
-    public String getPaperNumber() {
-        return paperNumber;
-    }
-
-    public void setPaperNumber(String paperNumber) {
-        this.paperNumber = paperNumber;
-    }
-
-    public String getPaperType() {
-        return paperType;
-    }
-
-    public void setPaperType(String paperType) {
-        this.paperType = paperType;
-    }
-
-    public String getTeacherName() {
-        return teacherName;
-    }
-
-    public void setTeacherName(String teacherName) {
-        this.teacherName = teacherName;
-    }
-
-    public String getTeacherCode() {
-        return teacherCode;
-    }
-
-    public void setTeacherCode(String teacherCode) {
-        this.teacherCode = teacherCode;
-    }
-
-    public String getExamDate() {
-        return examDate;
-    }
-
-    public void setExamDate(String examDate) {
-        this.examDate = examDate;
-    }
-
-    public String getExamTime() {
-        return examTime;
-    }
-
-    public void setExamTime(String examTime) {
-        this.examTime = examTime;
-    }
-
-    public String getExamPlace() {
-        return examPlace;
-    }
-
-    public void setExamPlace(String examPlace) {
-        this.examPlace = examPlace;
-    }
-
-    public String getExamRoom() {
-        return examRoom;
-    }
-
-    public void setExamRoom(String examRoom) {
-        this.examRoom = examRoom;
-    }
-
-    public String getTeachingRoomName() {
-        return teachingRoomName;
-    }
-
-    public void setTeachingRoomName(String teachingRoomName) {
-        this.teachingRoomName = teachingRoomName;
-    }
-
-    public String getStatusDisplay() {
-        return statusDisplay;
-    }
-
-    public void setStatusDisplay(String statusDisplay) {
-        this.statusDisplay = statusDisplay;
-    }
-
-    public String getErrorMsg() {
-        return errorMsg;
-    }
-
-    public void setErrorMsg(String errorMsg) {
-        this.errorMsg = errorMsg;
-    }
-}

+ 0 - 62
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/DownloadLogicServiceImpl.java

@@ -11,7 +11,6 @@ import com.qmth.boot.tools.excel.ExcelWriter;
 import com.qmth.boot.tools.excel.enums.ExcelType;
 import com.qmth.boot.tools.excel.model.CellValue;
 import com.qmth.distributed.print.business.bean.dto.*;
-import com.qmth.distributed.print.business.bean.dto.pdf.ExamStudentInfo;
 import com.qmth.distributed.print.business.bean.params.DownloadPaperFileParam;
 import com.qmth.distributed.print.business.bean.query.BasicExamStudentPageQuery;
 import com.qmth.distributed.print.business.bean.result.BasicExamStudentResult;
@@ -25,7 +24,6 @@ import com.qmth.distributed.print.business.templete.service.DownloadLogicService
 import com.qmth.distributed.print.business.util.CreatePdfUtil;
 import com.qmth.distributed.print.business.util.ExamTaskUtil;
 import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
-import com.qmth.teachcloud.common.bean.examRule.CodeNameEnableDisabledValue;
 import com.qmth.teachcloud.common.bean.params.ArraysParams;
 import com.qmth.teachcloud.common.bean.result.DictionaryResult;
 import com.qmth.teachcloud.common.bean.vo.FilePathVo;
@@ -45,7 +43,6 @@ import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.BeanUtils;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -57,7 +54,6 @@ import java.lang.reflect.Field;
 import java.nio.charset.StandardCharsets;
 import java.util.*;
 import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 /**
  * @Description: 任务处理逻辑impl
@@ -683,64 +679,6 @@ public class DownloadLogicServiceImpl implements DownloadLogicService {
         return map;
     }
 
-    /*@Override
-    public void executeExportBasicExamStudentLogic(Map<String, Object> map) {
-        TBTask tbTask = (TBTask) map.get(SystemConstant.TASK);
-        SysUser sysUser = (SysUser) map.get(SystemConstant.USER);
-        Long privilegeId = (Long) map.get("privilegeId");
-        File file = null;
-        FileOutputStream outputStream = null;
-        try {
-            BasicExamStudentPageQuery query = (BasicExamStudentPageQuery) map.get("query");
-            List<BasicExamStudentResult> list = basicExamStudentService.exportList(query, sysUser, privilegeId);
-            List<BasicExamStudentDto> examStudentDtoList = list.stream().flatMap(e -> {
-                BasicExamStudentDto basicExamStudentDto = new BasicExamStudentDto();
-                BeanUtils.copyProperties(e, basicExamStudentDto);
-                return Stream.of(basicExamStudentDto);
-            }).collect(Collectors.toList());
-
-            file = SystemConstant.getFileTempDirVar(SystemConstant.EXCEL_PREFIX);
-            // 生成excel文件
-            outputStream = new FileOutputStream(file);
-            ExcelWriter writer = ExcelWriter.create(ExcelType.XLSX);
-
-            List<BasicExamStudentDto> collection = new ArrayList();
-            int sheetCount = 1;
-            for (BasicExamStudentDto s : examStudentDtoList) {
-                collection.add(s);
-                if (collection.size() == ExcelUtil.DEFAULT_SHEET_COUNT) {
-                    writer.writeObjects("sheet" + sheetCount, null, BasicExamStudentDto.class, collection.listIterator());
-                    collection.clear();
-                    sheetCount++;
-                }
-            }
-            if (collection.size() > 0) {
-                writer.writeObjects("sheet" + sheetCount, null, BasicExamStudentDto.class, collection.listIterator());
-                collection.clear();
-            }
-            writer.output(outputStream);
-
-            String fileName = SystemConstant.getNanoId() + SystemConstant.EXCEL_PREFIX;
-            FilePathVo filePathVo = fileUploadService.uploadFile(file, UploadFileEnum.FILE, fileName);
-            tbTask.setResultFilePath(JSON.toJSONString(filePathVo));
-            map.put(SystemConstant.DATA_COUNT, examStudentDtoList.size());
-        } catch (Exception e) {
-            throw ExceptionResultEnum.ERROR.exception(e.getMessage());
-        } finally {
-            if (Objects.nonNull(file)) {
-                file.delete();
-            }
-            if (outputStream != null) {
-                try {
-                    outputStream.flush();
-                    outputStream.close();
-                } catch (IOException e) {
-                    throw new RuntimeException(e);
-                }
-            }
-        }
-    }*/
-
     @Override
     public void executeExportBasicExamStudentLogic(Map<String, Object> map) {
         TBTask tbTask = (TBTask) map.get(SystemConstant.TASK);

+ 2 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/mapper/MarkTaskMapper.java

@@ -44,4 +44,6 @@ public interface MarkTaskMapper extends BaseMapper<MarkTask> {
     int countByExamIdAndPaperNumberAndGroupNumberAndUserIdAndAndClassNameStatusIn(@Param("examId") Long examId, @Param("paperNumber") String paperNumber, @Param("groupNumber") Integer groupNumber, @Param("userId") Long userId, @Param("classNames") List<String> classNames, @Param("statusList") MarkTaskStatus[] statusList);
 
     IPage<MarkTaskDto> pageMarkTask(@Param("page") Page<Object> page, @Param("examId") Long examId, @Param("paperNumber") String paperNumber, @Param("groupNumber") Integer groupNumber, @Param("loginName") String loginName, @Param("status") MarkTaskStatus status, @Param("studentCode") String studentCode, @Param("secretNumber") String secretNumber, @Param("teachClassName") String teachClassName, @Param("subScore") Double subScore);
+
+    MarkManageDto selectMarkedCountAndTotalCount(@Param("examId") Long examId, @Param("paperNumber") String paperNumber);
 }

+ 2 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkTaskService.java

@@ -89,4 +89,6 @@ public interface MarkTaskService extends IService<MarkTask> {
     void rejectMarkTask(Long id, String rejectReason);
 
     Task getMarkTrack(Long id);
+
+    MarkManageDto selectMarkedCountAndTotalCount(Long examId, String paperNumber);
 }

+ 4 - 4
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkPaperServiceImpl.java

@@ -277,10 +277,10 @@ public class MarkPaperServiceImpl extends ServiceImpl<MarkPaperMapper, MarkPaper
                 }
 
                 // 结束评卷时,客观题统分
-                List<MarkStudent> markStudentList = markStudentService.listByExamIdAndCoursePaperId(examId, markPaper.getCoursePaperId());
-                for (MarkStudent markStudent : markStudentList) {
-                    markStudentService.calculateObjectiveScore(markStudent);
-                }
+//                List<MarkStudent> markStudentList = markStudentService.listByExamIdAndCoursePaperId(examId, markPaper.getCoursePaperId());
+//                for (MarkStudent markStudent : markStudentList) {
+//                    markStudentService.calculateObjectiveScore(markStudent);
+//                }
 
                 // 结束评卷时,文档进行归档
                 markDocumentService.initMarkDocument(basicExam, markPaper);

+ 15 - 1
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkTaskServiceImpl.java

@@ -66,7 +66,16 @@ public class MarkTaskServiceImpl extends ServiceImpl<MarkTaskMapper, MarkTask> i
                 paperNumber, progressStatus, dpr);
         for (MarkManageDto record : markManageDtoIPage.getRecords()) {
             record.setStatusDisplay(record.getStatus() == null ? null : record.getStatus().getName());
-            record.setPercent(Calculator.divide2String(Calculator.multiply(record.getMarkedCount(), 100), Double.valueOf(record.getTotalCount()), 2));
+            MarkManageDto markManageDto = this.selectMarkedCountAndTotalCount(record.getExamId(), record.getPaperNumber());
+            if(markManageDto != null) {
+                record.setMarkedCount(markManageDto.getMarkedCount());
+                record.setTotalCount(markManageDto.getTotalCount());
+                record.setPercent(Calculator.divide2String(Calculator.multiply(markManageDto.getMarkedCount(), 100), Double.valueOf(markManageDto.getTotalCount()), 2));
+            } else {
+                record.setMarkedCount(0);
+                record.setTotalCount(0);
+                record.setPercent("0");
+            }
             // 问题卷数量
             record.setProblemCount(markProblemHistoryService.countByExamIdAndPaperNumberAndStatus(examId, record.getPaperNumber(), MarkProblemStatus.WAITING));
             // 正在评卷数量
@@ -396,4 +405,9 @@ public class MarkTaskServiceImpl extends ServiceImpl<MarkTaskMapper, MarkTask> i
         dto.setPrevious(true);
         return dto;
     }
+
+    @Override
+    public MarkManageDto selectMarkedCountAndTotalCount(Long examId, String paperNumber) {
+        return this.baseMapper.selectMarkedCountAndTotalCount(examId, paperNumber);
+    }
 }

+ 15 - 19
teachcloud-mark/src/main/resources/mapper/MarkTaskMapper.xml

@@ -33,26 +33,8 @@
             so.name openCollege,
             mp.paper_number paperNumber,
             mp.paper_type paperType,
-            mp.status,
-            ifnull(b.totalCount, 0) totalCount,
-            ifnull(b.markedCount, 0) markedCount
+            mp.status
         FROM mark_paper mp
-            left join
-            (select
-                 mt.exam_id,
-                 mt.paper_number ,
-                 count(1) totalCount,
-                 sum(case when mt.status in ('MARKED', 'ARBITRATED')  then 1 else 0 end) markedCount
-             from mark_task mt
-                where mt.exam_id = #{examId}
-                <if test="courseId != null">
-                    and mt.course_id = #{courseId}
-                </if>
-                <if test="paperNumber != null and paperNumber != ''">
-                    and mt.paper_number = #{paperNumber}
-                </if>
-                group by mt.exam_id, mt.paper_number) b
-                    on mp.exam_id = b.exam_id and mp.paper_number = b.paper_number
             left join basic_course bc on mp.course_id = bc.id
             left join sys_org so on bc.teaching_room_id = so.id
         <where>
@@ -350,4 +332,18 @@
             </if>
         </where>
     </select>
+    <select id="selectMarkedCountAndTotalCount"
+            resultType="com.qmth.teachcloud.mark.dto.mark.manage.MarkManageDto">
+        select
+            mt.exam_id,
+            mt.paper_number ,
+            count(1) totalCount,
+            sum(case when mt.status in ('MARKED', 'ARBITRATED')  then 1 else 0 end) markedCount
+        from mark_task mt
+        where mt.exam_id = #{examId}
+        <if test="paperNumber != null and paperNumber != ''">
+            and mt.paper_number = #{paperNumber}
+        </if>
+        group by mt.exam_id, mt.paper_number
+    </select>
 </mapper>