wangliang 1 жил өмнө
parent
commit
0a142a8bc5

+ 25 - 0
server/src/main/java/com/qmth/jkserver/constant/SystemConstant.java

@@ -382,4 +382,29 @@ public class SystemConstant {
             return null;
         }
     }
+
+    /**
+     * 获取文件的层级数
+     *
+     * @param file
+     * @param map
+     * @return
+     */
+    public static Map<String, Object> getFileDirectoryCount(File file, Map<String, Object> map) {
+        if (Objects.nonNull(file) && file.exists() && file.isDirectory()) {
+            File[] f = file.listFiles();
+            int fileDirectoryCount = 0;
+            if (map.containsKey("fileDirectoryCount")) {
+                fileDirectoryCount = (int) map.get("fileDirectoryCount");
+            }
+            fileDirectoryCount++;
+            log.info("目录名:{},路径:{}", file.getName(), file.getAbsolutePath());
+            map.put(fileDirectoryCount + "", file.getAbsolutePath());
+            map.put("fileDirectoryCount", fileDirectoryCount);
+            if (f.length > 0) {
+                map = getFileDirectoryCount(f[0], map);//递归
+            }
+        }
+        return map;
+    }
 }

+ 1 - 1
server/src/main/java/com/qmth/jkserver/core/ow/Utest2OWExportBackUp.java

@@ -51,7 +51,7 @@ public class Utest2OWExportBackUp implements IOW2Export {
         ExamStudentService examStudentService = SpringContextHolder.getBean(ExamStudentService.class);
         //缓存答案信息
         Map<String, ExamStudentAnswer> ANSWER_CAHCE = new HashMap<String, ExamStudentAnswer>();
-        List<ExamStudentAnswer> allAnswers = examStudentAnswerService.findByExamCode(examCode);
+        List<ExamStudentAnswer> allAnswers = examStudentAnswerService.findByExamCode(examCode, null);
         //缓存每一个科目的最大客观题体量
         Map<String, Integer> QUESTION_CACHE = new HashMap<>();
         for (ExamStudentAnswer answer : allAnswers) {

+ 18 - 18
server/src/main/java/com/qmth/jkserver/dao/ExamStudentAnswerDao.java

@@ -42,7 +42,7 @@ public interface ExamStudentAnswerDao extends BaseMapper<ExamStudentAnswer> {
 
     public void deleteById(@Param("id") Long id);
 
-    public List<ExamStudentAnswer> findByExamCode(@Param("examCode") String examCode);
+    public List<ExamStudentAnswer> findByExamCode(@Param("examCode") String examCode, @Param("courseCode") String courseCode);
 
     public List<ExamStudentAnswer> findByExamCodeAndIsAbort(@Param("examCode") String examCode, @Param("isAbort") Boolean isAbort);
 
@@ -53,25 +53,25 @@ public interface ExamStudentAnswerDao extends BaseMapper<ExamStudentAnswer> {
     public Long findByExamCodeAndPlaceCodeAndRoomCodeCount(@Param("examCode") String examCode, @Param("placeCode") String placeCode, @Param("roomCode") String roomCode);
 
     public Long findByExamCodeAndStageIdAndBatchIdAndPlaceCodeAndRoomCodeAndAbsentAndCheatAndAbortAndPlaceNameCount(@Param("examCode") String examCode,
-                                                                                                        @Param("stageId") String stageId,
-                                                                                                        @Param("batchId") String batchId,
-                                                                                                        @Param("placeCodeSet") Set<String> placeCodeSet,
-                                                                                                        @Param("roomCode") String roomCode,
-                                                                                                        @Param("absent") Boolean absent,
-                                                                                                        @Param("cheat") Boolean cheat,
-                                                                                                        @Param("abort") Boolean abort,
-                                                                                                        @Param("placeName") String placeName);
+                                                                                                                    @Param("stageId") String stageId,
+                                                                                                                    @Param("batchId") String batchId,
+                                                                                                                    @Param("placeCodeSet") Set<String> placeCodeSet,
+                                                                                                                    @Param("roomCode") String roomCode,
+                                                                                                                    @Param("absent") Boolean absent,
+                                                                                                                    @Param("cheat") Boolean cheat,
+                                                                                                                    @Param("abort") Boolean abort,
+                                                                                                                    @Param("placeName") String placeName);
 
     public IPage<Map> findByExamCodeAndStageIdAndBatchIdAndPlaceCodeAndRoomCodeAndAbsentAndCheatAndAbortAndPlaceNameByIpage(IPage<Map> iPage,
-                                                                                                                @Param("examCode") String examCode,
-                                                                                                                @Param("stageId") String stageId,
-                                                                                                                @Param("batchId") String batchId,
-                                                                                                                @Param("placeCodeSet") Set<String> placeCodeSet,
-                                                                                                                @Param("roomCode") String roomCode,
-                                                                                                                @Param("absent") Boolean absent,
-                                                                                                                @Param("cheat") Boolean cheat,
-                                                                                                                @Param("abort") Boolean abort,
-                                                                                                                @Param("placeName") String placeName);
+                                                                                                                            @Param("examCode") String examCode,
+                                                                                                                            @Param("stageId") String stageId,
+                                                                                                                            @Param("batchId") String batchId,
+                                                                                                                            @Param("placeCodeSet") Set<String> placeCodeSet,
+                                                                                                                            @Param("roomCode") String roomCode,
+                                                                                                                            @Param("absent") Boolean absent,
+                                                                                                                            @Param("cheat") Boolean cheat,
+                                                                                                                            @Param("abort") Boolean abort,
+                                                                                                                            @Param("placeName") String placeName);
 
     public List<ExamStudentAnswer> findByExamCodeByTicketNo(@Param("examCode") String examCode);
 

+ 14 - 0
server/src/main/java/com/qmth/jkserver/model/Attachment.java

@@ -274,6 +274,7 @@ package com.qmth.jkserver.model;
 //	}
 //}
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@@ -281,6 +282,7 @@ import com.qmth.jkserver.enums.AttachmentType;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.io.File;
 import java.io.Serializable;
 
 /**
@@ -338,6 +340,18 @@ public class Attachment implements Serializable {
     @ApiModelProperty(value = "类型,FILE:文件,FOLDER:文件夹")
     private AttachmentType type;
 
+    @ApiModelProperty(value = "文件")
+    @TableField(exist = false)
+    private File fileJson;
+
+    public File getFileJson() {
+        return fileJson;
+    }
+
+    public void setFileJson(File fileJson) {
+        this.fileJson = fileJson;
+    }
+
     public Long getId() {
         return id;
     }

+ 3 - 1
server/src/main/java/com/qmth/jkserver/service/ExamPaperTempService.java

@@ -2,6 +2,7 @@ package com.qmth.jkserver.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.jkserver.dto.FileDto;
+import com.qmth.jkserver.model.Attachment;
 import com.qmth.jkserver.model.ExamPaperTemp;
 import com.qmth.jkserver.model.ExamPaperUncoiling;
 import com.qmth.jkserver.model.ExamStudentAnswer;
@@ -53,7 +54,8 @@ public interface ExamPaperTempService extends IService<ExamPaperTemp> {
      *
      * @param examCode
      * @param examStudentAnswerList
+     * @param attachmentMap
      * @return
      */
-    public FileDto getExamStudentAnswerJsonFile(String examCode, List<ExamStudentAnswer> examStudentAnswerList) throws IOException;
+    public FileDto getExamStudentAnswerJsonFile(String examCode, List<ExamStudentAnswer> examStudentAnswerList,Map<Long, Attachment> attachmentMap) throws IOException;
 }

+ 1 - 1
server/src/main/java/com/qmth/jkserver/service/ExamStudentAnswerService.java

@@ -32,7 +32,7 @@ public interface ExamStudentAnswerService extends IService<ExamStudentAnswer> {
 
     public List<ExamStudentAnswer> findByExamCodeAndCourseCode(String examCode, String courseCode);
 
-    public List<ExamStudentAnswer> findByExamCode(String examCode);
+    public List<ExamStudentAnswer> findByExamCode(String examCode,String courseCode);
 
     public void deleteById(String id);
 

+ 66 - 30
server/src/main/java/com/qmth/jkserver/service/impl/ExamPaperTempServiceImpl.java

@@ -16,7 +16,9 @@ import com.qmth.jkserver.service.ExamPaperTempService;
 import com.qmth.jkserver.service.ExamStudentService;
 import com.qmth.jkserver.service.KWService;
 import com.qmth.jkserver.util.FileStoreUtil;
+import com.qmth.jkserver.util.JacksonUtil;
 import net.lingala.zip4j.core.ZipFile;
+import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.io.IOUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -24,6 +26,7 @@ import org.springframework.context.annotation.Lazy;
 import org.springframework.context.annotation.Scope;
 import org.springframework.context.annotation.ScopedProxyMode;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 import org.springframework.util.LinkedMultiValueMap;
 
 import javax.annotation.Resource;
@@ -114,6 +117,22 @@ public class ExamPaperTempServiceImpl extends ServiceImpl<ExamPaperTempDao, Exam
         UnZipUtils.doUnZip(paperAnswerTarget, answerDir, paperAnswerTarget.getParent());
         deletePaths.add(answerDir.getAbsolutePath());
 
+        Map<String, Object> map = new LinkedHashMap<>();
+        map = SystemConstant.getFileDirectoryCount(answerDir, map);
+
+        File finalAnswerDir = null;
+        if (!CollectionUtils.isEmpty(map)) {
+            log.info("fileDirectoryCount:{}", JacksonUtil.parseJson(map));
+            int fileDirectoryCount = (int) map.get("fileDirectoryCount");
+            if (fileDirectoryCount == 3) {
+                finalAnswerDir = new File((String) map.get("1"));
+            } else if (fileDirectoryCount == 4) {
+                finalAnswerDir = new File((String) map.get("2"));
+            }
+        } else {
+            finalAnswerDir = answerDir;
+        }
+
         //获取开卷密码
         List<ExamPaperUncoiling> examPaperUncoilingList = kwService.queryExamPaperUncoiling(new ExamPaperUncoilingParams(examCode));
         Map<String, File> mapFile = new HashMap<>();
@@ -126,8 +145,9 @@ public class ExamPaperTempServiceImpl extends ServiceImpl<ExamPaperTempDao, Exam
             Map<String, File> finalMapFile = mapFile;
             paperAnswerFile = Objects.isNull(paperAnswerFile) ? new ArrayList<>() : paperAnswerFile;
             List<File> finalPaperAnswerFile = paperAnswerFile;
+            File finalAnswerDir1 = finalAnswerDir;
             paperCourseCodeTempMap.forEach((k, v) -> {
-                finalPaperAnswerFile.add(createPaperAnswerFile(k, finalMapFile, answerDir));
+                finalPaperAnswerFile.add(createPaperAnswerFile(k, finalMapFile, finalAnswerDir1));
             });
         }
         FileDto fileDto = new FileDto(paperAnswerFile);
@@ -265,11 +285,12 @@ public class ExamPaperTempServiceImpl extends ServiceImpl<ExamPaperTempDao, Exam
      *
      * @param examCode
      * @param examStudentAnswerList
+     * @param attachmentMap
      * @return
      * @throws IOException
      */
     @Override
-    public FileDto getExamStudentAnswerJsonFile(String examCode, List<ExamStudentAnswer> examStudentAnswerList) throws IOException {
+    public FileDto getExamStudentAnswerJsonFile(String examCode, List<ExamStudentAnswer> examStudentAnswerList,Map<Long, Attachment> attachmentMap) throws IOException {
         FileStoreUtil fileStoreConfig = SpringContextHolder.getBean(FileStoreUtil.class);
 //        Query jkExamStudentAnswerQuery = new Query();
 //        jkExamStudentAnswerQuery.addCriteria(Criteria.where("examCode").is(examCode));
@@ -280,43 +301,57 @@ public class ExamPaperTempServiceImpl extends ServiceImpl<ExamPaperTempDao, Exam
 //            throw new JkServerException("考生考试记录为空");
 //        }
         //Map<String, ExamStudentAnswer> examStudentAnswerMap = examStudentAnswerList.stream().collect(Collectors.toMap(e -> e.getDecodeFile().getAccessUri(), Function.identity(), (dto1, dto2) -> dto1));
-        Map<String, ExamStudentAnswer> examStudentAnswerMap = new LinkedHashMap<>();
+        Map<String, List<ExamStudentAnswer>> examStudentAnswerMap = new LinkedHashMap<>();
         for (ExamStudentAnswer examStudentAnswer : examStudentAnswerList) {
             Attachment attachment = attachmentService.getById(examStudentAnswer.getDecodeFileId());
-            examStudentAnswerMap.put(attachment.getAccessUri(), examStudentAnswer);
+            if (!examStudentAnswerMap.containsKey(attachment.getAccessUri())) {
+                examStudentAnswerMap.put(attachment.getAccessUri(), new ArrayList<>(Arrays.asList(examStudentAnswer)));
+            } else {
+                List<ExamStudentAnswer> examStudentAnswers = examStudentAnswerMap.get(attachment.getAccessUri());
+                examStudentAnswers.add(examStudentAnswer);
+                examStudentAnswerMap.put(attachment.getAccessUri(), examStudentAnswers);
+            }
         }
         List<String> deletePaths = new ArrayList<>();
         List<LinkedMultiValueMap<String, File[]>> linkedMultiValueMapList = new ArrayList<>();
         examStudentAnswerMap.forEach((k, v) -> {
             LinkedMultiValueMap<String, File[]> linkedMultiValueMap = new LinkedMultiValueMap<>();
-            Attachment attachment = attachmentService.getById(v.getDecodeFileId());
-//            File target = SystemConstant.getAttachmentFile(v.getDecodeFile());
-            File target = null;
-            try {
-                target = SystemConstant.getAttachmentFile(attachment);
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-            if (fileStoreConfig.workIsOss()) {
-                deletePaths.add(target.getParentFile().getAbsolutePath());
-            }
-            File explodeTempDir = new File(target.getParentFile() + File.separator + SystemConstant.getNanoId());
-            try {
-                UnZipUtils.doUnZip(target, explodeTempDir, target.getParent());
-            } catch (IOException e) {
-                e.printStackTrace();
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
+            for (ExamStudentAnswer es : v) {
+                Attachment attachment = null;
+                if (!attachmentMap.containsKey(es.getDecodeFileId())) {
+                    attachment = attachmentService.getById(es.getDecodeFileId());
+                    File target = null;
+                    try {
+                        target = SystemConstant.getAttachmentFile(attachment);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    if (fileStoreConfig.workIsOss()) {
+                        deletePaths.add(target.getParentFile().getAbsolutePath());
+                    }
+                    File explodeTempDir = new File(target.getParentFile() + File.separator + SystemConstant.getNanoId());
+                    try {
+                        UnZipUtils.doUnZip(target, explodeTempDir, target.getParent());
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
 
-            File fileJson = new File(explodeTempDir.getAbsolutePath() + File.separator + "json");
-            if (!fileJson.exists()) {
-                throw new JkServerException(JkServerException.SYSTEM_EXCEPTION.getCode(), "考生作答文件在服务器上不存在");
+                    File fileJson = new File(explodeTempDir.getAbsolutePath() + File.separator + "json");
+                    if (!fileJson.exists()) {
+                        throw new JkServerException(JkServerException.SYSTEM_EXCEPTION.getCode(), "考生作答文件在服务器上不存在");
+                    }
+                    attachment.setFileJson(fileJson);
+                    attachmentMap.put(es.getDecodeFileId(), attachment);
+                } else {
+                    attachment = attachmentMap.get(es.getDecodeFileId());
+                }
+                ExamStudent examStudent = examStudentService.getById(es.getStudentId());
+                if (!linkedMultiValueMap.containsKey(examStudent.getBatchId())) {
+                    linkedMultiValueMap.add(examStudent.getBatchId(), attachment.getFileJson().listFiles());
+                }
             }
-
-            ExamStudent examStudent = examStudentService.getById(v.getStudentId());
-//            linkedMultiValueMap.add(v.getStudent().getBatchId(), fileJson.listFiles());
-            linkedMultiValueMap.add(examStudent.getBatchId(), fileJson.listFiles());
             linkedMultiValueMapList.add(linkedMultiValueMap);
         });
         return new FileDto(linkedMultiValueMapList, deletePaths);
@@ -360,6 +395,7 @@ public class ExamPaperTempServiceImpl extends ServiceImpl<ExamPaperTempDao, Exam
             in = new FileInputStream(answerFiles[0]);
             ou = new ByteArrayOutputStream();
             IOUtils.copy(in, ou);
+            log.info("ext:{},path{}", FilenameUtils.getExtension(file.getPath()), file.getAbsolutePath());
             JSONObject answerJson = JSONObject.parseObject(new String(ou.toByteArray(), StandardCharsets.UTF_8));
 //            log.info("answerJson:{}", answerJson.toJSONString());
             JSONArray answerDetails = answerJson.getJSONArray("details");

+ 2 - 2
server/src/main/java/com/qmth/jkserver/service/impl/ExamStudentAnswerServiceImpl.java

@@ -174,8 +174,8 @@ public class ExamStudentAnswerServiceImpl extends ServiceImpl<ExamStudentAnswerD
     }
 
     @Override
-    public List<ExamStudentAnswer> findByExamCode(String examCode) {
-        return examStudentAnswerDao.findByExamCode(examCode);
+    public List<ExamStudentAnswer> findByExamCode(String examCode, String courseCode) {
+        return examStudentAnswerDao.findByExamCode(examCode, courseCode);
     }
 
     @Override

+ 37 - 33
server/src/main/java/com/qmth/jkserver/service/impl/JointFlowSimulationServiceImpl.java

@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 /**
@@ -107,28 +108,31 @@ public class JointFlowSimulationServiceImpl implements JointFlowSimulationServic
         List<ExamPaperTemp> examPaperTempList = examPaperTempService.findExamCourseAllByTask(jkExamCode)
                 .stream().filter(e -> e.getTaskSyncResult() == null || !e.getTaskSyncResult()).collect(Collectors.toList());
 
-        List<ExamStudentAnswer> examStudentAnswerDatasource = examStudentAnswerService.findByExamCode(jkExamCode);
-
         FileDto paperFileDto = examPaperTempService.getPaperAnswerJsonFile(jkExamCode);
-        List<ExamStudentAnswer> examStudentAnswers = (List<ExamStudentAnswer>) map.get("examStudentAnswerList");
-        FileDto studentAnswerFileDto = examPaperTempService.getExamStudentAnswerJsonFile(jkExamCode, examStudentAnswers);
+        Map<Long, Attachment> attachmentMap = new HashMap<>();
+        // 作答考生正常处理
+        for (ExamPaperTemp examPaperTemp : examPaperTempList) {
+            List<ExamStudentAnswer> examStudentAnswerDatasource = examStudentAnswerService.findByExamCode(jkExamCode, examPaperTemp.getCourseCode());
+            Map<Long, ExamStudentAnswer> answerMap = examStudentAnswerDatasource.stream().collect(Collectors.toMap(k -> k.getId(), Function.identity(), (dto1, dto2) -> dto1));
 
-        List<String> willDeletePath = new ArrayList<>();
-        // 组装待删除的文件路径集合
-        if (Objects.nonNull(paperFileDto) && Objects.nonNull(paperFileDto.getDeletePaths())) {
-            willDeletePath.addAll(paperFileDto.getDeletePaths());
-        }
-        if (Objects.nonNull(studentAnswerFileDto) && Objects.nonNull(studentAnswerFileDto.getDeletePaths())) {
-            willDeletePath.addAll(studentAnswerFileDto.getDeletePaths());
-        }
-        map.put(SystemConstant.WILL_DELETE_PATH, willDeletePath);
+            List<ExamStudentAnswer> examStudentAnswers = (List<ExamStudentAnswer>) map.get("examStudentAnswerList");
+            examStudentAnswers = examStudentAnswerDatasource.stream().filter(s -> answerMap.containsKey(s.getId())).collect(Collectors.toList());
+            FileDto studentAnswerFileDto = examPaperTempService.getExamStudentAnswerJsonFile(jkExamCode, examStudentAnswers, attachmentMap);
+
+            List<String> willDeletePath = new ArrayList<>();
+            // 组装待删除的文件路径集合
+            if (Objects.nonNull(paperFileDto) && Objects.nonNull(paperFileDto.getDeletePaths())) {
+                willDeletePath.addAll(paperFileDto.getDeletePaths());
+            }
+            if (Objects.nonNull(studentAnswerFileDto) && Objects.nonNull(studentAnswerFileDto.getDeletePaths())) {
+                willDeletePath.addAll(studentAnswerFileDto.getDeletePaths());
+            }
+            map.put(SystemConstant.WILL_DELETE_PATH, willDeletePath);
 
-        // 获取考试下的试卷结构、试卷标准答案、考生作答信息资源
-        List<File> paperAndAnswerFileDatasource = paperFileDto.getFileList();
+            // 获取考试下的试卷结构、试卷标准答案、考生作答信息资源
+            List<File> paperAndAnswerFileDatasource = paperFileDto.getFileList();
 //        List<File> studentAnswerFileDatasource = studentAnswerFileDto.getFileList();
 
-        // 作答考生正常处理
-        for (ExamPaperTemp examPaperTemp : examPaperTempList) {
             // 循环试卷
             String courseCode = examPaperTemp.getCourseCode();
             String courseName = this.findCourseNameByCourseCode(jkExamCode, courseCode);
@@ -167,7 +171,7 @@ public class JointFlowSimulationServiceImpl implements JointFlowSimulationServic
                                 .filter(e -> {
                                     ExamStudent examStudent = examStudentService.getById(e.getStudentId());
                                     if (courseCode.equals(examStudent.getCourseCode()) &&
-                                            courseName.equals(examStudent.getCourseName()) &&
+//                                            courseName.equals(examStudent.getCourseName()) &&
                                             !e.getIsAbsent() &&
                                             paperId.equals(e.getPaperId()) &&
                                             Objects.equals(examStudent.getBatchId(), key) &&
@@ -197,20 +201,20 @@ public class JointFlowSimulationServiceImpl implements JointFlowSimulationServic
                 // 单纯创建科目失败
                 throw new JkServerException("试卷创建失败");
             }
-        }
-        // 未作答考生处理
-        // 未同步的缺考考生数据集
-        List<ExamStudentAnswer> examStudentAnswerList = examStudentAnswerDatasource.stream()
-                .filter(e -> e.getIsAbsent() && (e.getTaskSyncResult() == null || !e.getTaskSyncResult())).collect(Collectors.toList());
-
-        // 处理因为缺考学生太多,进度的‘无效显示’问题
-        for (int skip = 0; skip < examStudentAnswerList.size(); skip = skip + SystemConstant.SYNC_DATA_LIMIT) {
-            List<ExamStudentAnswer> cellList = examStudentAnswerList.stream().skip(skip).limit(SystemConstant.SYNC_DATA_LIMIT).collect(Collectors.toList());
-            map = this.saveYunExamStudent(map, yunExamId, cellList, null);
-            examTask = (ExamTask) map.get(SystemConstant.TASK);
-            completeProgress = new AtomicInteger(examTask.getCompleteProgress());
-            examTask.setProgress(this.calculateProgress(completeProgress, totalProgress));
-            examTaskService.updateExamTask(examTask, user);
+            // 未作答考生处理
+            // 未同步的缺考考生数据集
+            List<ExamStudentAnswer> examStudentAnswerList = examStudentAnswerDatasource.stream()
+                    .filter(e -> e.getIsAbsent() && (e.getTaskSyncResult() == null || !e.getTaskSyncResult())).collect(Collectors.toList());
+
+            // 处理因为缺考学生太多,进度的‘无效显示’问题
+            for (int skip = 0; skip < examStudentAnswerList.size(); skip = skip + SystemConstant.SYNC_DATA_LIMIT) {
+                List<ExamStudentAnswer> cellList = examStudentAnswerList.stream().skip(skip).limit(SystemConstant.SYNC_DATA_LIMIT).collect(Collectors.toList());
+                map = this.saveYunExamStudent(map, yunExamId, cellList, null);
+                examTask = (ExamTask) map.get(SystemConstant.TASK);
+                completeProgress = new AtomicInteger(examTask.getCompleteProgress());
+                examTask.setProgress(this.calculateProgress(completeProgress, totalProgress));
+                examTaskService.updateExamTask(examTask, user);
+            }
         }
         return map;
     }
@@ -355,7 +359,7 @@ public class JointFlowSimulationServiceImpl implements JointFlowSimulationServic
         examTaskService.remove(examTaskQueryWrapper);
 
         // 2.更新学生作答同步记录
-        List<ExamStudentAnswer> examStudentAnswerList = examStudentAnswerService.findByExamCode(examCode);
+        List<ExamStudentAnswer> examStudentAnswerList = examStudentAnswerService.findByExamCode(examCode, null);
         for (ExamStudentAnswer examStudentAnswer : examStudentAnswerList) {
             examStudentAnswer.setTaskSyncResult(false);
 //            examStudentAnswer.setExamTask(null);

+ 1 - 1
server/src/main/java/com/qmth/jkserver/templete/service/impl/TaskLogicServiceImpl.java

@@ -62,7 +62,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
         // 试卷总数
         List<ExamPaperTemp> examPaperTempList = examPaperTempService.findExamCourseAllByTask(jkExamCode);
         // 考生总数
-        List<ExamStudentAnswer> examStudentAnswerDatasource = examStudentAnswerService.findByExamCode(jkExamCode);
+        List<ExamStudentAnswer> examStudentAnswerDatasource = examStudentAnswerService.findByExamCode(jkExamCode, null);
 
         BigDecimal totalProgress = new BigDecimal(examPaperTempList.size())
                 .multiply(new BigDecimal(2))

+ 6 - 0
server/src/main/resources/mapper/JkExamStudentAnswerMapper.xml

@@ -13,10 +13,16 @@
 
     <select id="findByExamCode" resultType="com.qmth.jkserver.model.ExamStudentAnswer">
         select * from jk_exam_student_answer t
+        <if test="courseCode != null and courseCode != ''">
+            join jk_exam_student jes on t.student_id = jes.id
+        </if>
         <where>
             <if test="examCode != null and examCode != ''">
                 and t.exam_code = #{examCode}
             </if>
+            <if test="courseCode != null and courseCode != ''">
+                and jes.course_code = #{courseCode}
+            </if>
         </where>
     </select>