Browse Source

3.4.0 update

xiaofei 11 months ago
parent
commit
504e27cf95
20 changed files with 269 additions and 440 deletions
  1. 95 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/DeleteBasicExamStudentStatusDto.java
  2. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/BasicExamStudentMapper.java
  3. 6 8
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/BasicExamStudentService.java
  4. 2 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamDetailService.java
  5. 67 44
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicExamStudentServiceImpl.java
  6. 12 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java
  7. 2 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java
  8. 6 16
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/AsyncBasicExamStudentImportService.java
  9. 0 293
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/AsyncExaminationImportTemplateService.java
  10. 0 8
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/ImportLogicService.java
  11. 22 27
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/ImportLogicServiceImpl.java
  12. 5 2
      distributed-print-business/src/main/resources/mapper/BasicExamStudentMapper.xml
  13. 4 0
      distributed-print/install/mysql/upgrade/3.4.0.sql
  14. 9 2
      distributed-print/src/main/java/com/qmth/distributed/print/api/BasicExamStudentController.java
  15. 1 1
      distributed-print/src/main/java/com/qmth/distributed/print/api/mark/MarkArchiveController.java
  16. 5 3
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/ConvertUtil.java
  17. 1 1
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkPaperService.java
  18. 17 20
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkPaperServiceImpl.java
  19. 1 1
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkServiceImpl.java
  20. 13 10
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java

+ 95 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/DeleteBasicExamStudentStatusDto.java

@@ -0,0 +1,95 @@
+package com.qmth.distributed.print.business.bean.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 考生扫描阅卷状态
+ */
+public class DeleteBasicExamStudentStatusDto {
+
+    @ApiModelProperty(value = "姓名")
+    private String studentName;
+
+    @ApiModelProperty(value = "学号")
+    private String studentCode;
+
+    @ApiModelProperty(value = "课程代码")
+    private String courseCode;
+    @ApiModelProperty(value = "课程名称")
+    private String courseName;
+    @ApiModelProperty(value = "开课学院")
+    private String openCollege;
+
+    @ApiModelProperty(value = "是否已扫描上传")
+    private Boolean scanStatus = false;
+
+    @ApiModelProperty(value = "是否有阅卷任务")
+    private Boolean markTaskStatus = false;
+
+    public DeleteBasicExamStudentStatusDto() {
+    }
+
+    public DeleteBasicExamStudentStatusDto(String studentName, String studentCode, String courseCode, String courseName, String openCollege) {
+        this.studentName = studentName;
+        this.studentCode = studentCode;
+        this.courseCode = courseCode;
+        this.courseName = courseName;
+        this.openCollege = openCollege;
+    }
+
+    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 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 getOpenCollege() {
+        return openCollege;
+    }
+
+    public void setOpenCollege(String openCollege) {
+        this.openCollege = openCollege;
+    }
+
+    public Boolean getScanStatus() {
+        return scanStatus;
+    }
+
+    public void setScanStatus(Boolean scanStatus) {
+        this.scanStatus = scanStatus;
+    }
+
+    public Boolean getMarkTaskStatus() {
+        return markTaskStatus;
+    }
+
+    public void setMarkTaskStatus(Boolean markTaskStatus) {
+        this.markTaskStatus = markTaskStatus;
+    }
+}

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/BasicExamStudentMapper.java

@@ -24,7 +24,7 @@ public interface BasicExamStudentMapper extends BaseMapper<BasicExamStudent> {
     IPage<BasicExamStudentResult> findBasicExamStudentPage(@Param("iPage") Page<BasicExamStudentResult> iPage,
     IPage<BasicExamStudentResult> findBasicExamStudentPage(@Param("iPage") Page<BasicExamStudentResult> iPage,
                                                            @Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId,
                                                            @Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId,
                                                            @Param("courseId") Long courseId, @Param("teacher") String teacher, @Param("college") String college,
                                                            @Param("courseId") Long courseId, @Param("teacher") String teacher, @Param("college") String college,
-                                                           @Param("major") String major, @Param("teachClazz") String teachClazz,
+                                                           @Param("major") String major, @Param("teachClassName") String teachClassName,@Param("className") String className,
                                                            @Param("examStudentInfo") String examStudentInfo, @Param("dpr") DataPermissionRule dpr);
                                                            @Param("examStudentInfo") String examStudentInfo, @Param("dpr") DataPermissionRule dpr);
 
 
     /**
     /**

+ 6 - 8
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/BasicExamStudentService.java

@@ -3,6 +3,7 @@ package com.qmth.distributed.print.business.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.distributed.print.business.bean.BasicExamStudentQuery;
 import com.qmth.distributed.print.business.bean.BasicExamStudentQuery;
+import com.qmth.distributed.print.business.bean.dto.DeleteBasicExamStudentStatusDto;
 import com.qmth.distributed.print.business.bean.params.BasicExamStudentParam;
 import com.qmth.distributed.print.business.bean.params.BasicExamStudentParam;
 import com.qmth.distributed.print.business.bean.result.BasicExamStudentResult;
 import com.qmth.distributed.print.business.bean.result.BasicExamStudentResult;
 import com.qmth.distributed.print.business.entity.ExamStudent;
 import com.qmth.distributed.print.business.entity.ExamStudent;
@@ -27,7 +28,7 @@ import java.util.Map;
 public interface BasicExamStudentService extends IService<BasicExamStudent> {
 public interface BasicExamStudentService extends IService<BasicExamStudent> {
 
 
     IPage<BasicExamStudentResult> page(Long semesterId, Long examId, Long courseId, String teacher,
     IPage<BasicExamStudentResult> page(Long semesterId, Long examId, Long courseId, String teacher,
-                                       String college, String major, String teachClazz, String examStudentInfo, int pageNumber, int pageSize);
+                                       String college, String major, String teachClassName, String className, String examStudentInfo, int pageNumber, int pageSize);
 
 
     /**
     /**
      * 列表查询
      * 列表查询
@@ -44,13 +45,6 @@ public interface BasicExamStudentService extends IService<BasicExamStudent> {
      */
      */
     Long save(BasicExamStudentParam basicExamStudentParam, SysUser requestUser);
     Long save(BasicExamStudentParam basicExamStudentParam, SysUser requestUser);
 
 
-    /**
-     * 导入
-     *
-     * @param map 参数集
-     */
-    void buildImportObjects(Map<String, Object> map) throws IOException, NoSuchFieldException;
-
     /**
     /**
      * 导出
      * 导出
      */
      */
@@ -82,4 +76,8 @@ public interface BasicExamStudentService extends IService<BasicExamStudent> {
     void updateTeacherIdById(List<BasicExamStudent> basicExamStudentList);
     void updateTeacherIdById(List<BasicExamStudent> basicExamStudentList);
 
 
     void updatePaperNumberAndPaperTypeById(List<ExamStudent> examStudentList);
     void updatePaperNumberAndPaperTypeById(List<ExamStudent> examStudentList);
+
+    void updateMarkData(Long examId, List<BasicExamStudent> basicExamStudentList, List<String> oldPaperNumberList, Long createId);
+
+    List<DeleteBasicExamStudentStatusDto> getStudentMarkStatus(List<Long> idList);
 }
 }

+ 2 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamDetailService.java

@@ -200,4 +200,6 @@ public interface ExamDetailService extends IService<ExamDetail> {
     List<ExamDetail> listExamDetailByExamIdAndCourseIdAndPaperNumber(Long examId, Long courseId, String paperNumber);
     List<ExamDetail> listExamDetailByExamIdAndCourseIdAndPaperNumber(Long examId, Long courseId, String paperNumber);
 
 
     List<Long> saveImportExamStudent(ExamPrintPlan examPrintPlan, List<BasicExamStudent> basicExamStudentList, Long createId);
     List<Long> saveImportExamStudent(ExamPrintPlan examPrintPlan, List<BasicExamStudent> basicExamStudentList, Long createId);
+
+    int countByPrintPlanId(String printPlanId);
 }
 }

+ 67 - 44
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicExamStudentServiceImpl.java

@@ -8,8 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.distributed.print.business.bean.BasicExamStudentQuery;
 import com.qmth.distributed.print.business.bean.BasicExamStudentQuery;
 import com.qmth.distributed.print.business.bean.dto.BasicExamStudentDto;
 import com.qmth.distributed.print.business.bean.dto.BasicExamStudentDto;
+import com.qmth.distributed.print.business.bean.dto.DeleteBasicExamStudentStatusDto;
 import com.qmth.distributed.print.business.bean.params.BasicExamStudentParam;
 import com.qmth.distributed.print.business.bean.params.BasicExamStudentParam;
-import com.qmth.distributed.print.business.bean.params.TeachCourseSelectParam;
 import com.qmth.distributed.print.business.bean.result.BasicExamStudentResult;
 import com.qmth.distributed.print.business.bean.result.BasicExamStudentResult;
 import com.qmth.distributed.print.business.entity.BasicExamRule;
 import com.qmth.distributed.print.business.entity.BasicExamRule;
 import com.qmth.distributed.print.business.entity.ExamStudent;
 import com.qmth.distributed.print.business.entity.ExamStudent;
@@ -29,7 +29,6 @@ import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.service.*;
 import com.qmth.teachcloud.common.service.*;
 import com.qmth.teachcloud.common.util.ConvertUtil;
 import com.qmth.teachcloud.common.util.ConvertUtil;
 import com.qmth.teachcloud.common.util.ExcelUtil;
 import com.qmth.teachcloud.common.util.ExcelUtil;
-import com.qmth.teachcloud.common.util.RegexUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.mark.entity.MarkPaper;
 import com.qmth.teachcloud.mark.entity.MarkPaper;
 import com.qmth.teachcloud.mark.entity.MarkStudent;
 import com.qmth.teachcloud.mark.entity.MarkStudent;
@@ -87,7 +86,7 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
 
 
     @Override
     @Override
     public IPage<BasicExamStudentResult> page(Long semesterId, Long examId, Long courseId,
     public IPage<BasicExamStudentResult> page(Long semesterId, Long examId, Long courseId,
-                                              String teacher, String college, String major, String teachClazz, String examStudentInfo, int pageNumber,
+                                              String teacher, String college, String major, String teachClassName, String className, String examStudentInfo, int pageNumber,
                                               int pageSize) {
                                               int pageSize) {
         SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
         SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
 
 
@@ -95,12 +94,13 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
         college = SystemConstant.translateSpecificSign(college);
         college = SystemConstant.translateSpecificSign(college);
         major = SystemConstant.translateSpecificSign(major);
         major = SystemConstant.translateSpecificSign(major);
         examStudentInfo = SystemConstant.translateSpecificSign(examStudentInfo);
         examStudentInfo = SystemConstant.translateSpecificSign(examStudentInfo);
-        teachClazz = SystemConstant.translateSpecificSign(teachClazz);
+        teachClassName = SystemConstant.translateSpecificSign(teachClassName);
+        className = SystemConstant.translateSpecificSign(className);
 
 
         DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(requestUser.getSchoolId(), requestUser.getId(),
         DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(requestUser.getSchoolId(), requestUser.getId(),
                 ServletUtil.getRequest().getServletPath());
                 ServletUtil.getRequest().getServletPath());
         IPage<BasicExamStudentResult> page = this.baseMapper.findBasicExamStudentPage(new Page<>(pageNumber, pageSize),
         IPage<BasicExamStudentResult> page = this.baseMapper.findBasicExamStudentPage(new Page<>(pageNumber, pageSize),
-                requestUser.getSchoolId(), semesterId, examId, courseId, teacher, college, major, teachClazz, examStudentInfo, dpr);
+                requestUser.getSchoolId(), semesterId, examId, courseId, teacher, college, major, teachClassName, className, examStudentInfo, dpr);
         for (BasicExamStudentResult record : page.getRecords()) {
         for (BasicExamStudentResult record : page.getRecords()) {
             Long examStartTime = record.getExamStartTime();
             Long examStartTime = record.getExamStartTime();
             Long examEndTime = record.getExamEndTime();
             Long examEndTime = record.getExamEndTime();
@@ -152,46 +152,13 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
         List<String> oldPaperNumberList = new ArrayList<>();
         List<String> oldPaperNumberList = new ArrayList<>();
         BasicExamStudent basicExamStudent = this.editEntityHelp(basicExamStudentParam, basicExam, oldPaperNumberList, requestUser);
         BasicExamStudent basicExamStudent = this.editEntityHelp(basicExamStudentParam, basicExam, oldPaperNumberList, requestUser);
         this.saveOrUpdate(basicExamStudent);
         this.saveOrUpdate(basicExamStudent);
-        MarkPaper markPaper = null;
-        if (ExamModelEnum.MODEL4.equals(basicExam.getExamModel())) {
-            if (StringUtils.isBlank(basicExamStudent.getPaperNumber())) {
-                throw ExceptionResultEnum.ERROR.exception("试卷编号不能为空");
-            }
-            markPaper = markPaperService.getByExamIdAndPaperNumber(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber());
-            if (markPaper == null) {
-                // 模式4,不存在试卷,则创建
-                markPaper = new MarkPaper(basicExamStudent.getExamId(), basicExamStudent.getCourseId(), basicExamStudent.getPaperNumber(), String.valueOf(System.currentTimeMillis()), requestUser.getId(), SystemConstant.DEFAULT_PAPER_TYPE_A);
-                markPaperService.save(markPaper);
-            }
-        } else {
-            if (StringUtils.isNotBlank(basicExamStudent.getPaperNumber())) {
-                markPaper = markPaperService.getByExamIdAndPaperNumber(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber());
-            }
-        }
-        if (markPaper != null) {
-            // 同步更新扫描阅卷考生表
-            markStudentService.updateByBasicExamStudent(basicExamStudent, markPaper, new HashSet<>());
-            markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber(), SystemConstant.DEFAULT_PAPER_TYPE_A);
-            if (basicExamStudentOld != null) {
-                markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(basicExamStudent.getExamId(), basicExamStudentOld.getPaperNumber(), SystemConstant.DEFAULT_PAPER_TYPE_A);
-            }
-        }
-
-        if (ExamModelEnum.MODEL4.equals(basicExam.getExamModel()) && basicExamStudentOld != null) {
-            markPaperService.deleteByExamIdAndPaperNumber(basicExamStudent.getExamId(), basicExamStudentOld.getPaperNumber(), true);
-        }
-
+        // 更新扫描阅卷数据
+        this.updateMarkData(basicExam.getId(), Arrays.asList(basicExamStudent), Arrays.asList(basicExamStudentOld.getPaperNumber()), requestUser.getId());
         // 自动创建课程管理数据
         // 自动创建课程管理数据
         teachCourseService.batchCreateTeachCourse(basicExamStudent.getSchoolId(), basicExamStudent.getExamId(), Arrays.asList(basicExamStudent));
         teachCourseService.batchCreateTeachCourse(basicExamStudent.getSchoolId(), basicExamStudent.getExamId(), Arrays.asList(basicExamStudent));
         return basicExamStudent.getId();
         return basicExamStudent.getId();
     }
     }
 
 
-    @Transactional
-    @Override
-    public void buildImportObjects(Map<String, Object> map) {
-
-    }
-
     @Override
     @Override
     public void exportLogic(HttpServletResponse response, Long semesterId, Long examId, Long courseId, String teacher, String college, String major, String teachClazz, String examStudentInfo)
     public void exportLogic(HttpServletResponse response, Long semesterId, Long examId, Long courseId, String teacher, String college, String major, String teachClazz, String examStudentInfo)
             throws Exception {
             throws Exception {
@@ -228,9 +195,12 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
                     }
                     }
                 }
                 }
                 markStudentService.deleteByExamIdAndPaperNumberAndStudentCode(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber(), basicExamStudent.getStudentCode());
                 markStudentService.deleteByExamIdAndPaperNumberAndStudentCode(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber(), basicExamStudent.getStudentCode());
-                BasicExam basicExam = basicExamService.getById(basicExamStudent.getExamId());
-                if (ExamModelEnum.MODEL4.equals(basicExam.getExamModel())) {
-                    markPaperService.deleteByExamIdAndPaperNumber(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber(), true);
+                // 更新扫描数据
+                long count = markStudentService.countByExamIdAndPaperNumber(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber(), null);
+                if (count == 0) {
+                    markPaperService.deleteByExamIdAndPaperNumber(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber());
+                } else {
+                    markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber(), null);
                 }
                 }
             }
             }
             this.removeByIds(idList);
             this.removeByIds(idList);
@@ -288,7 +258,7 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
         }
         }
 
 
         // 校验试卷编号和卷型
         // 校验试卷编号和卷型
-        if (StringUtils.isNoneBlank(basicExamStudentParam.getPaperNumber(), basicExamStudentParam.getPaperType())) {
+        if (!ExamModelEnum.MODEL4.equals(basicExam.getExamModel()) && StringUtils.isNoneBlank(basicExamStudentParam.getPaperNumber(), basicExamStudentParam.getPaperType())) {
             // 不传课程ID
             // 不传课程ID
             ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamIdAndCourseIdAndPaperNumber(basicExamStudentParam.getExamId(), null, basicExamStudentParam.getPaperNumber());
             ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamIdAndCourseIdAndPaperNumber(basicExamStudentParam.getExamId(), null, basicExamStudentParam.getPaperNumber());
             if (examTaskDetail != null) {
             if (examTaskDetail != null) {
@@ -445,4 +415,57 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
                     .eq(BasicExamStudent::getId, examStudent.getBasicStudentId()));
                     .eq(BasicExamStudent::getId, examStudent.getBasicStudentId()));
         }
         }
     }
     }
+
+    @Override
+    public void updateMarkData(Long examId, List<BasicExamStudent> basicExamStudentList, List<String> oldPaperNumberList, Long createId) {
+        BasicExam basicExam = basicExamService.getById(examId);
+        Map<String, List<BasicExamStudent>> stringMap = basicExamStudentList.stream().filter(m -> StringUtils.isNotBlank(m.getPaperNumber())).collect(Collectors.groupingBy(BasicExamStudent::getPaperNumber));
+        for (Map.Entry<String, List<BasicExamStudent>> entry : stringMap.entrySet()) {
+            BasicExamStudent basicExamStudent = entry.getValue().get(0);
+            MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumberAndPaperType(examId, entry.getKey(), null);
+            if (markPaper == null && ExamModelEnum.MODEL4.equals(basicExam.getExamModel())) {
+                String paperType = SystemConstant.DEFAULT_PAPER_TYPE_A;
+                markPaper = new MarkPaper(examId, basicExamStudent.getCourseId(), entry.getKey(), String.valueOf(System.currentTimeMillis()), createId, paperType);
+                markPaperService.save(markPaper);
+            }
+            if (markPaper != null) {
+                Set<String> secretNumberSet = new HashSet<>();
+                MarkPaper finalMarkPaper = markPaper;
+                entry.getValue().forEach(m -> markStudentService.updateByBasicExamStudent(m, finalMarkPaper, secretNumberSet));
+                markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(examId, entry.getKey(), markPaper.getPaperType());
+            }
+        }
+
+        // 更新历史数据试卷编号
+        if (CollectionUtils.isNotEmpty(oldPaperNumberList)) {
+            for (String paperNumber : oldPaperNumberList) {
+                long studentCount = markStudentService.countByExamIdAndPaperNumber(examId, paperNumber, null);
+                if (studentCount > 0) {
+                    markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
+                } else {
+                    markPaperService.deleteByExamIdAndPaperNumber(examId, paperNumber);
+                }
+            }
+        }
+    }
+
+    @Override
+    public List<DeleteBasicExamStudentStatusDto> getStudentMarkStatus(List<Long> idList) {
+        List<BasicExamStudent> basicExamStudentList = this.listByIds(idList);
+        List<DeleteBasicExamStudentStatusDto> list = new ArrayList<>();
+        for (BasicExamStudent basicExamStudent : basicExamStudentList) {
+            BasicCourse basicCourse = basicCourseService.getById(basicExamStudent.getCourseId());
+            SysOrg sysOrg = sysOrgService.getById(basicCourse != null ? basicCourse.getTeachingRoomId() : null);
+            List<MarkStudent> markStudentList = markStudentService.listByStudentId(basicExamStudent.getId());
+            if (CollectionUtils.isNotEmpty(markStudentList)) {
+                for (MarkStudent markStudent : markStudentList) {
+                    DeleteBasicExamStudentStatusDto deleteBasicExamStudentStatusDto = new DeleteBasicExamStudentStatusDto(basicExamStudent.getStudentName(), basicExamStudent.getStudentCode(), basicCourse != null ? basicCourse.getCode() : null, basicCourse != null ? basicCourse.getName() : null, sysOrg != null ? sysOrg.getName() : null);
+                    deleteBasicExamStudentStatusDto.setScanStatus(markStudent.getUpload() != null ? markStudent.getUpload() : false);
+                    deleteBasicExamStudentStatusDto.setMarkTaskStatus(markTaskService.countByStudentId(markStudent.getId()) > 0);
+                    list.add(deleteBasicExamStudentStatusDto);
+                }
+            }
+        }
+        return list;
+    }
 }
 }

+ 12 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java

@@ -925,7 +925,8 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
                     } else {
                     } else {
                         // 删除扫描数据
                         // 删除扫描数据
                         markStudentService.removeByIds(examStudentIds);
                         markStudentService.removeByIds(examStudentIds);
-                        if (markPaperService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber(), true)) {
+                        if (markStudentService.countByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber(), null) == 0) {
+                            markPaperService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
                             markPaperPackageService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
                             markPaperPackageService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
                             markQuestionService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
                             markQuestionService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
                             scanAnswerCardService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
                             scanAnswerCardService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
@@ -1004,12 +1005,14 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
 
 
     @Override
     @Override
     public TBTask importData(String printPlanId, MultipartFile file) {
     public TBTask importData(String printPlanId, MultipartFile file) {
+        if (this.countByPrintPlanId(printPlanId) > 0) {
+            throw ExceptionResultEnum.ERROR.exception("计划下已导入考务数据,不允许多次导入");
+        }
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         try {
         try {
             Map<String, Object> map = printCommonService.saveTask(SystemConstant.convertIdToLong(printPlanId), file, TaskTypeEnum.EXAMINATION_IMPORT);
             Map<String, Object> map = printCommonService.saveTask(SystemConstant.convertIdToLong(printPlanId), file, TaskTypeEnum.EXAMINATION_IMPORT);
             boolean lock = redisUtil.lock(SystemConstant.REDIS_LOCK_IMPORT_EXAM_DATA + schoolId, SystemConstant.REDIS_LOCK_IMPORT_EXAM_DATA_TIME_OUT);
             boolean lock = redisUtil.lock(SystemConstant.REDIS_LOCK_IMPORT_EXAM_DATA + schoolId, SystemConstant.REDIS_LOCK_IMPORT_EXAM_DATA_TIME_OUT);
             if (lock) {
             if (lock) {
-//                asyncExaminationImportTemplateService.importTask(map);
                 asyncExamStudentImportService.importTask(map);
                 asyncExamStudentImportService.importTask(map);
             }
             }
             TBTask tbTask = Objects.nonNull(map.get(SystemConstant.TASK)) ? (TBTask) map.get(SystemConstant.TASK) : null;
             TBTask tbTask = Objects.nonNull(map.get(SystemConstant.TASK)) ? (TBTask) map.get(SystemConstant.TASK) : null;
@@ -1286,4 +1289,11 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
         examStudentService.saveBatch(examStudentList);
         examStudentService.saveBatch(examStudentList);
         return examDetailList.stream().map(ExamDetail::getId).collect(Collectors.toList());
         return examDetailList.stream().map(ExamDetail::getId).collect(Collectors.toList());
     }
     }
+
+    @Override
+    public int countByPrintPlanId(String printPlanId) {
+        QueryWrapper<ExamDetail> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(ExamDetail::getPrintPlanId, printPlanId);
+        return this.count(queryWrapper);
+    }
 }
 }

+ 2 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -1149,10 +1149,11 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                 ExamPrintPlan examPrintPlan = new ExamPrintPlan();
                 ExamPrintPlan examPrintPlan = new ExamPrintPlan();
                 examPrintPlan.insertInfo(sysUser.getId());
                 examPrintPlan.insertInfo(sysUser.getId());
                 examPrintPlan.setSchoolId(schoolId);
                 examPrintPlan.setSchoolId(schoolId);
+                examPrintPlan.setCategory(ExamCategoryEnum.FORMAL);
                 examPrintPlan.setExamId(examTask.getExamId());
                 examPrintPlan.setExamId(examTask.getExamId());
                 examPrintPlan.setOrgId(sysUser.getOrgId());
                 examPrintPlan.setOrgId(sysUser.getOrgId());
                 BasicCourse basicCourse = basicCourseService.getById(examTask.getCourseId());
                 BasicCourse basicCourse = basicCourseService.getById(examTask.getCourseId());
-                examPrintPlan.setName(basicCourse != null ? basicCourse.getName() : "" + examTask.getPaperNumber());
+                examPrintPlan.setName((basicCourse != null ? basicCourse.getName() : "") + examTask.getPaperNumber());
                 if (!ExamCategoryEnum.REBUILD.equals(basicExam.getCategory())) {
                 if (!ExamCategoryEnum.REBUILD.equals(basicExam.getCategory())) {
 //                    ConvertUtil.analyzeAndCompareDateAndTime(examDetailParams.getExamStartTime(), examDetailParams.getExamEndTime());
 //                    ConvertUtil.analyzeAndCompareDateAndTime(examDetailParams.getExamStartTime(), examDetailParams.getExamEndTime());
 //                    examPrintPlan.setExamStartTime(examDetailParams.getExamStartTime());
 //                    examPrintPlan.setExamStartTime(examDetailParams.getExamStartTime());

+ 6 - 16
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/AsyncBasicExamStudentImportService.java

@@ -112,25 +112,15 @@ public class AsyncBasicExamStudentImportService extends AsyncImportTaskTemplete
                     SystemConstant.addSummary(stringJoinerSummary, "错误文件生成失败," + e.getMessage());
                     SystemConstant.addSummary(stringJoinerSummary, "错误文件生成失败," + e.getMessage());
                 }
                 }
             } else {
             } else {
-                SystemConstant.addSummary(stringJoinerSummary, "数据校验通过,开始写入数据库");
+                SystemConstant.addSummary(stringJoinerSummary, "数据校验通过,开始写入考生管理数据库");
                 List<BasicExamStudent> basicExamStudentList = JSON.parseArray(JSON.toJSONString(result.get(SystemConstant.DATASOURCE)), BasicExamStudent.class);
                 List<BasicExamStudent> basicExamStudentList = JSON.parseArray(JSON.toJSONString(result.get(SystemConstant.DATASOURCE)), BasicExamStudent.class);
                 basicExamStudentService.saveOrUpdateBatch(basicExamStudentList);
                 basicExamStudentService.saveOrUpdateBatch(basicExamStudentList);
-                SystemConstant.addSummary(stringJoinerSummary, "写入数据库完成");
-                // 模式4,直接进扫描阅卷库
-                BasicExam basicExam = basicExamService.getById(tbTask.getExamId());
-                if (ExamModelEnum.MODEL4.equals(basicExam.getExamModel())) {
-                    importLogicService.saveMarkStudent(tbTask.getExamId(), basicExamStudentList, tbTask.getCreateId());
-
-                    // 重新统计试卷下考生数量
-                    basicExamStudentList.stream().map(BasicExamStudent::getPaperNumber).distinct().forEach(m -> markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(tbTask.getExamId(), m, SystemConstant.DEFAULT_PAPER_TYPE_A));
-
-                    // 更改过试卷编号后,该试卷编号下没有考生则删除该试卷
-                    List<String> oldPaperNumberList = JSON.parseArray(JSON.toJSONString(result.get("oldPaperNumberList")), String.class);
-                    for (String paperNumber : oldPaperNumberList) {
-                        markPaperService.deleteByExamIdAndPaperNumber(tbTask.getExamId(), paperNumber, true);
-                    }
-                }
+                SystemConstant.addSummary(stringJoinerSummary, "写入考生管理数据库完成");
 
 
+                // 更改过试卷编号后,该试卷编号下没有考生则删除该试卷
+                List<String> oldPaperNumberList = JSON.parseArray(JSON.toJSONString(result.get("oldPaperNumberList")), String.class);
+                // 更新扫描阅卷数据
+                basicExamStudentService.updateMarkData(tbTask.getExamId(), basicExamStudentList, oldPaperNumberList, tbTask.getCreateId());
                 // 自动创建课程管理数据
                 // 自动创建课程管理数据
                 teachCourseService.batchCreateTeachCourse(tbTask.getSchoolId(), tbTask.getExamId(), basicExamStudentList);
                 teachCourseService.batchCreateTeachCourse(tbTask.getSchoolId(), tbTask.getExamId(), basicExamStudentList);
                 tbTask.setResult(TaskResultEnum.SUCCESS);
                 tbTask.setResult(TaskResultEnum.SUCCESS);

+ 0 - 293
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/AsyncExaminationImportTemplateService.java

@@ -1,293 +0,0 @@
-package com.qmth.distributed.print.business.templete.execute;
-
-import cn.hutool.core.date.DateUtil;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.qmth.boot.api.exception.ApiException;
-import com.qmth.distributed.print.business.bean.dto.ExaminationImportDto;
-import com.qmth.teachcloud.common.bean.examRule.FieldsDto;
-import com.qmth.distributed.print.business.service.ExamDetailService;
-import com.qmth.distributed.print.business.service.ExamTaskService;
-import com.qmth.distributed.print.business.templete.importData.AsyncImportTaskTemplete;
-import com.qmth.distributed.print.business.templete.service.TaskLogicService;
-import com.qmth.teachcloud.common.config.DictionaryConfig;
-import com.qmth.teachcloud.common.contant.SpringContextHolder;
-import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.entity.SysUser;
-import com.qmth.teachcloud.common.entity.TBTask;
-import com.qmth.teachcloud.common.enums.*;
-import com.qmth.teachcloud.common.service.TBTaskService;
-import com.qmth.teachcloud.common.util.FileStoreUtil;
-import com.qmth.teachcloud.common.util.Result;
-import com.qmth.teachcloud.common.util.ResultUtil;
-import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.ss.usermodel.FillPatternType;
-import org.apache.poi.ss.usermodel.Font;
-import org.apache.poi.ss.usermodel.HorizontalAlignment;
-import org.apache.poi.ss.usermodel.IndexedColors;
-import org.apache.poi.ss.util.CellRangeAddress;
-import org.apache.poi.xssf.usermodel.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.text.MessageFormat;
-import java.util.*;
-
-/**
- * @Description: 考务数据导入模板
- * @Author: CaoZixuan
- * @Date: 2021-04-07
- */
-@Service
-public class AsyncExaminationImportTemplateService extends AsyncImportTaskTemplete {
-    @Resource
-    private ExamTaskService examTaskService;
-
-    @Resource
-    private ExamDetailService examDetailService;
-
-    private final static Logger log = LoggerFactory.getLogger(AsyncExaminationImportTemplateService.class);
-
-    public static final String OBJ_TITLE = "考务数据";
-
-    @Override
-    public Result importTask(Map<String, Object> map) throws Exception {
-        TBTask tbTask = (TBTask) map.get(SystemConstant.TASK);
-        InputStream inputStream = super.getUploadFileInputStream(tbTask);
-        map.put("inputStream", inputStream);
-
-        StringJoiner stringJoinerSummary = new StringJoiner("\n")
-                .add(MessageFormat.format("{0}{1}{2}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), BEGIN_TITLE, OBJ_TITLE));
-        tbTask.setStatus(TaskStatusEnum.RUNNING);
-        TBTaskService tbTaskService = SpringContextHolder.getBean(TBTaskService.class);
-        tbTaskService.updateById(tbTask);
-        List<Long> examDetailIdList = null;
-        try {
-            TaskLogicService taskLogicService = SpringContextHolder.getBean(TaskLogicService.class);
-
-            // 执行导入考务数据
-            Map<String, Object> result = taskLogicService.executeImportExaminationLogic(map);
-
-            // 如果excel独立行数据校验有问题则生成excel
-            if (result.containsKey(SystemConstant.ERROR_DATA_LIST)) {
-                tbTask.setResult(TaskResultEnum.ERROR);
-                List<ExaminationImportDto> examinationImportDtoList = JSON.parseArray(JSON.toJSONString(result.get(SystemConstant.ERROR_DATA_LIST)), ExaminationImportDto.class);
-                List<FieldsDto> fieldsDtoList = JSON.parseArray(JSON.toJSONString(result.get("fieldsDtoList")), FieldsDto.class);
-
-                if (CollectionUtils.isNotEmpty(examinationImportDtoList) && CollectionUtils.isNotEmpty(fieldsDtoList)) {
-                    // 生成excel
-                    this.createLocalErrorExcel(examinationImportDtoList, fieldsDtoList, tbTask);
-                }
-
-                // 错误信息抛出去
-                List<String> errorList = (List<String>) result.get("errorList");
-                if (!CollectionUtils.isEmpty(errorList)) {
-                    throw ExceptionResultEnum.ERROR.exception(String.join(";\r\n", errorList));
-                }
-            } else {
-                tbTask.setResult(TaskResultEnum.SUCCESS);
-            }
-
-            // 检测是否去生成pdf
-            if (Objects.isNull(map.get("examDetailIdList"))) {
-                throw ExceptionResultEnum.ERROR.exception("导入考务数据失败,数据未正确保存");
-            }
-            examDetailIdList = (List<Long>) map.get("examDetailIdList");
-            // 按照考场检验命题任务是否全部完成,完成生成pdf
-            SysUser user = (SysUser) map.get(SystemConstant.USER);
-
-            examTaskService.checkDataByExamination(tbTask.getPrintPlanId(), examDetailIdList, user);
-
-            stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}{3}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), FINISH_TITLE, Long.valueOf(String.valueOf(result.get("dataCount"))), FINISH_ERROR_SIZE));
-        } catch (Exception e) {
-            log.error(SystemConstant.LOG_ERROR, e);
-            stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}{3}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), EXCEPTION_TITLE, EXCEPTION_DATA, e.getMessage()));
-            tbTask.setResult(TaskResultEnum.ERROR);
-
-            // 有异常,删除考务数据 (2023-07-21和产品商量后不再删除数据)
-            examDetailService.deleteExaminationDataByExamDetailIds(examDetailIdList);
-
-            if (e instanceof ApiException) {
-                ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
-            } else {
-                ResultUtil.error(e.getMessage());
-            }
-
-        } finally {//生成txt文件
-            tbTask.setSummary(stringJoinerSummary.toString());
-            tbTask.setStatus(TaskStatusEnum.FINISH);
-            tbTaskService.updateById(tbTask);
-
-        }
-        return ResultUtil.ok(map);
-    }
-
-    /**
-     * 生成本地的excel错误信息文件
-     *
-     * @param examinationImportDtoList 包含错误信息的考务数据
-     * @param fieldsDtoList            属性字段集合
-     */
-    private void createLocalErrorExcel(List<ExaminationImportDto> examinationImportDtoList, List<FieldsDto> fieldsDtoList, TBTask tbTask) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
-        log.debug("导出Excel开始...");
-        XSSFWorkbook wb = new XSSFWorkbook();
-        XSSFSheet sheet = wb.createSheet("考务数据模板");
-
-        Font defaultFont = wb.createFont();
-        defaultFont.setFontHeightInPoints((short) 12);
-        defaultFont.setFontName("宋体");
-
-
-        int cellCount = fieldsDtoList.size() + 1;
-        // 说明
-        XSSFCellStyle describeStyle = wb.createCellStyle();
-        describeStyle.setAlignment(HorizontalAlignment.LEFT);
-        Font describeFont = wb.createFont();
-        describeFont.setFontHeightInPoints((short) 12);
-        describeFont.setFontName("宋体");
-        describeFont.setColor(IndexedColors.RED.getIndex());
-        describeStyle.setFont(describeFont);
-        String describe = SystemConstant.EXAMINATION_DESCRIBE;
-        describe = describe.trim();
-        XSSFRow rowDescribe = sheet.createRow(0);
-        rowDescribe.setHeightInPoints(195); //行高设置成195px
-        for (int i = 0; i < cellCount; i++) {
-            XSSFCell cell = rowDescribe.createCell(i);
-            if (i == 0) {
-                cell.setCellValue(describe);
-                cell.setCellStyle(describeStyle);
-            }
-        }
-        CellRangeAddress region = new CellRangeAddress(0, 0, 0, cellCount - 1);
-        sheet.addMergedRegion(region);
-
-        // 表头行
-        XSSFCellStyle headerStyle = wb.createCellStyle();
-        headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
-        headerStyle.setAlignment(HorizontalAlignment.CENTER);
-        headerStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
-        headerStyle.setFont(defaultFont);
-        XSSFRow rowHead = sheet.createRow(1);
-        for (int i = 0; i < fieldsDtoList.size(); i++) {
-            XSSFCell cell = rowHead.createCell(i);
-            cell.setCellValue(fieldsDtoList.get(i).getName());
-            cell.setCellStyle(headerStyle);
-        }
-        XSSFCell lastCell = rowHead.createCell(cellCount - 1);
-        lastCell.setCellValue("错误信息");
-        lastCell.setCellStyle(headerStyle);
-
-
-        // 内容行
-        XSSFCellStyle exampleStyle = wb.createCellStyle();
-        exampleStyle.setAlignment(HorizontalAlignment.LEFT);
-        exampleStyle.setFont(defaultFont);
-        List<Field> fields = Arrays.asList(ExaminationImportDto.class.getDeclaredFields());
-        for (int i = 0; i < examinationImportDtoList.size(); i++) {
-            ExaminationImportDto examinationImportDto = examinationImportDtoList.get(i);
-            XSSFRow row = sheet.createRow(i + 2);
-            for (int j = 0; j < fieldsDtoList.size(); j++) {
-                XSSFCell cell = row.createCell(j);
-                FieldsDto head = fieldsDtoList.get(j);
-                String code = head.getCode();
-                String value = "";
-
-                if (fields.stream().anyMatch(e -> code.equals(e.getName()))) {
-                    // 如果表头属性在数据中存在(则该属性属于基础字段)
-                    String methodName = "get" + SystemConstant.initCap(code);
-                    Method getMethod = examinationImportDto.getClass().getDeclaredMethod(methodName);
-                    value = String.valueOf(getMethod.invoke(examinationImportDto));
-                } else {
-                    // 有可能是扩展字段或者无法匹配的字段 -> 为扩展字段列赋值
-                    // 扩展字段
-                    List<FieldsDto> extendsField = examinationImportDto.getSecondaryFieldList();
-                    for (FieldsDto fieldsDto : extendsField) {
-                        if (code.equals(fieldsDto.getCode())) {
-                            value = fieldsDto.getValue();
-                        }
-                    }
-                }
-                cell.setCellValue(value);
-                cell.setCellStyle(exampleStyle);
-            }
-            // 补充错误信息
-            String errorMessage = examinationImportDto.getErrorMessage();
-            if (SystemConstant.strNotNull(errorMessage)) {
-                XSSFCell cell = row.createCell(cellCount - 1);
-                cell.setCellValue(errorMessage);
-                cell.setCellStyle(exampleStyle);
-            }
-        }
-        for (int i = 0; i < cellCount; i++) {
-            sheet.autoSizeColumn(i);
-            int width = sheet.getColumnWidth(i)  * 17 / 10;
-            sheet.setColumnWidth(i, Math.min(width, 255 * 256));
-        }
-
-        File excelFileTemp = null;
-        try {
-            FileStoreUtil fileStoreUtil = SpringContextHolder.getBean(FileStoreUtil.class);
-            DictionaryConfig dictionaryConfig = SpringContextHolder.getBean(DictionaryConfig.class);
-            boolean oss = dictionaryConfig.sysDomain().isOss();
-            String ossStr = null;
-            StringJoiner stringJoiner = new StringJoiner("");
-            if (!oss && Objects.nonNull(dictionaryConfig.fssPublicDomain()) && !StringUtils.isBlank(dictionaryConfig.fssPublicDomain().getConfig()) && !dictionaryConfig.fssPublicDomain().getConfig().startsWith(SystemConstant.START_PARENT)) {
-                stringJoiner.add(dictionaryConfig.fssPublicDomain().getConfig()).add(File.separator);
-            }
-            SystemConstant.getDirName(stringJoiner, UploadFileEnum.FILE, true);
-            stringJoiner.add(SystemConstant.getNanoId()).add(SystemConstant.EXCEL_PREFIX);
-
-            String txtDirName = stringJoiner.toString();
-            excelFileTemp = SystemConstant.getFileTempVar(SystemConstant.EXCEL_PREFIX);
-            FileOutputStream outputStream = new FileOutputStream(excelFileTemp);
-            wb.write(outputStream);
-            outputStream.flush();
-            outputStream.close();
-            log.debug("导出Excel结束...");
-
-            String txtFileMd5 = DigestUtils.md5Hex(new FileInputStream(excelFileTemp));
-            if (oss || dictionaryConfig.fssPrivateDomain().getConfig().startsWith(SystemConstant.START_PARENT)) {
-                ossStr = oss ? SystemConstant.OSS : SystemConstant.LOCAL;
-                fileStoreUtil.ossUpload(txtDirName, excelFileTemp, txtFileMd5, fileStoreUtil.getUploadEnumByPath(txtDirName).getFssType());
-            } else {
-                ossStr = SystemConstant.LOCAL;
-                fileStoreUtil.localUpload(txtDirName, new FileInputStream(excelFileTemp), txtFileMd5, LocalCatalogEnum.LOCAL_FILE);
-            }
-            JSONObject json = new JSONObject();
-            json.put(SystemConstant.PATH, stringJoiner.toString());
-            json.put(SystemConstant.TYPE, ossStr);
-            json.put(SystemConstant.UPLOAD_TYPE, UploadFileEnum.FILE);
-            tbTask.setErrorFilePath(json.toJSONString());
-        } catch (Exception e) {
-            StringJoiner stringJoinerSummary = new StringJoiner("").add(tbTask.getSummary()).add("\n");
-            stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}{3}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), EXCEPTION_CREATE_TXT_TITLE, EXCEPTION_DATA, e.getMessage()));
-
-            String summary = stringJoinerSummary.toString();
-            tbTask.setSummary(summary);
-            tbTask.setResult(TaskResultEnum.ERROR);
-            if (e instanceof ApiException) {
-                ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
-            } else {
-                ResultUtil.error(e.getMessage());
-            }
-        } finally {
-            if (Objects.nonNull(excelFileTemp)) {
-                excelFileTemp.delete();
-            }
-            TBTaskService tbTaskService = SpringContextHolder.getBean(TBTaskService.class);
-            tbTask.setStatus(TaskStatusEnum.FINISH);
-            tbTaskService.updateById(tbTask);
-        }
-    }
-}

+ 0 - 8
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/ImportLogicService.java

@@ -28,14 +28,6 @@ public interface ImportLogicService {
      */
      */
     Map<String, Object> executeImportBasicExamStudentTeacherLogic(Map<String, Object> map, StringJoiner stringJoinerSummary);
     Map<String, Object> executeImportBasicExamStudentTeacherLogic(Map<String, Object> map, StringJoiner stringJoinerSummary);
 
 
-    /**
-     * 保存阅卷数据
-     *
-     * @param examId   考试id
-     * @param createId
-     */
-    void saveMarkStudent(Long examId, List<BasicExamStudent> basicExamStudentList, Long createId);
-
     /**
     /**
      * 处理客观题结构导入
      * 处理客观题结构导入
      *
      *

+ 22 - 27
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/ImportLogicServiceImpl.java

@@ -47,6 +47,7 @@ import java.io.InputStream;
 import java.lang.reflect.Field;
 import java.lang.reflect.Field;
 import java.util.*;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import java.util.stream.Stream;
 
 
@@ -109,6 +110,7 @@ public class ImportLogicServiceImpl implements ImportLogicService {
         SystemConstant.addSummary(stringJoinerSummary, "开始解析文件内容");
         SystemConstant.addSummary(stringJoinerSummary, "开始解析文件内容");
         BasicExamStudentParseDto basicExamStudentParseDto;
         BasicExamStudentParseDto basicExamStudentParseDto;
         try {
         try {
+            // 解析excel文件内容
             basicExamStudentParseDto = this.parseBasicExamStudent(schoolId, inputStream);
             basicExamStudentParseDto = this.parseBasicExamStudent(schoolId, inputStream);
         } catch (Exception e) {
         } catch (Exception e) {
             SystemConstant.addSummary(stringJoinerSummary, "解析文件内容结束,解析失败。" + e.getMessage());
             SystemConstant.addSummary(stringJoinerSummary, "解析文件内容结束,解析失败。" + e.getMessage());
@@ -124,14 +126,17 @@ public class ImportLogicServiceImpl implements ImportLogicService {
         List<BasicExamStudent> basicExamStudentList = basicExamStudentService.list(new QueryWrapper<BasicExamStudent>().lambda()
         List<BasicExamStudent> basicExamStudentList = basicExamStudentService.list(new QueryWrapper<BasicExamStudent>().lambda()
                 .select(BasicExamStudent::getId, BasicExamStudent::getCourseId, BasicExamStudent::getStudentCode, BasicExamStudent::getPaperNumber)
                 .select(BasicExamStudent::getId, BasicExamStudent::getCourseId, BasicExamStudent::getStudentCode, BasicExamStudent::getPaperNumber)
                 .eq(BasicExamStudent::getSchoolId, schoolId).eq(BasicExamStudent::getExamId, examId));
                 .eq(BasicExamStudent::getSchoolId, schoolId).eq(BasicExamStudent::getExamId, examId));
-        Map<String, Long> courseIdStudentCodeMap = basicExamStudentList.stream().collect(Collectors.toMap(k -> k.getCourseId() + SystemConstant.HYPHEN + k.getStudentCode(), BaseEntity::getId));
+        Map<String, BasicExamStudent> courseIdStudentCodeMap = basicExamStudentList.stream().collect(Collectors.toMap(k -> k.getCourseId() + SystemConstant.HYPHEN + k.getStudentCode(), Function.identity()));
 
 
         BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
         BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
+        // 学校设置强制校验卷型或者模式4
         boolean needPaperNumber = (basicSchool.getHasPaperNumber() != null && basicSchool.getHasPaperNumber()) || ExamModelEnum.MODEL4.equals(basicExam.getExamModel());
         boolean needPaperNumber = (basicSchool.getHasPaperNumber() != null && basicSchool.getHasPaperNumber()) || ExamModelEnum.MODEL4.equals(basicExam.getExamModel());
 
 
         Map<String, Long> basicCourseIdMap = new HashMap<>();
         Map<String, Long> basicCourseIdMap = new HashMap<>();
         // 课程学号唯一
         // 课程学号唯一
         List<String> courseCodeStudentCodeList = new ArrayList<>();
         List<String> courseCodeStudentCodeList = new ArrayList<>();
+        // 课程+考生在数据库中已存在的试卷编号和导入文件中不致的数据
+        List<String> oldPaperNumberList = new ArrayList<>();
         // 是否有错误提示
         // 是否有错误提示
         boolean hasError = false;
         boolean hasError = false;
 
 
@@ -148,6 +153,7 @@ public class ImportLogicServiceImpl implements ImportLogicService {
             StringJoiner stringJoiner = new StringJoiner(";");
             StringJoiner stringJoiner = new StringJoiner(";");
             // 校验excel内容
             // 校验excel内容
             basicExamStudentImport.getRequiredFieldList().forEach(m -> {
             basicExamStudentImport.getRequiredFieldList().forEach(m -> {
+                // 通用规则中基础字段默认不可取消的,必填
                 if (m.getDisabled() && StringUtils.isBlank(m.getValue())) {
                 if (m.getDisabled() && StringUtils.isBlank(m.getValue())) {
                     stringJoiner.add(m.getName() + "必填");
                     stringJoiner.add(m.getName() + "必填");
                 }
                 }
@@ -157,6 +163,7 @@ public class ImportLogicServiceImpl implements ImportLogicService {
                     }
                     }
                 }
                 }
             });
             });
+            // 任课老师和任课老师工号都有值或都没值
             if (StringUtils.isNotBlank(basicExamStudentImport.getTeacherCode()) && StringUtils.isBlank(basicExamStudentImport.getTeacherName())) {
             if (StringUtils.isNotBlank(basicExamStudentImport.getTeacherCode()) && StringUtils.isBlank(basicExamStudentImport.getTeacherName())) {
                 stringJoiner.add(RequiredFieldsEnum.TEACHER_NAME.getName() + "必填");
                 stringJoiner.add(RequiredFieldsEnum.TEACHER_NAME.getName() + "必填");
             }
             }
@@ -164,6 +171,7 @@ public class ImportLogicServiceImpl implements ImportLogicService {
                 stringJoiner.add(RequiredFieldsEnum.TEACHER_CODE.getName() + "必填");
                 stringJoiner.add(RequiredFieldsEnum.TEACHER_CODE.getName() + "必填");
             }
             }
 
 
+            // 解析考试日期和考试时间
             try {
             try {
                 Map<String, Object> timeMap = ConvertUtil.analyzeExamTime(basicExamStudentImport.getExamDate(), basicExamStudentImport.getExamTime());
                 Map<String, Object> timeMap = ConvertUtil.analyzeExamTime(basicExamStudentImport.getExamDate(), basicExamStudentImport.getExamTime());
                 basicExamStudent.setExamStartTime(Long.valueOf(String.valueOf(timeMap.get("startTime"))));
                 basicExamStudent.setExamStartTime(Long.valueOf(String.valueOf(timeMap.get("startTime"))));
@@ -172,7 +180,7 @@ public class ImportLogicServiceImpl implements ImportLogicService {
                 stringJoiner.add(e.getMessage());
                 stringJoiner.add(e.getMessage());
             }
             }
 
 
-            // 校验课程
+            // 校验课程开课学院和课程代码
             String key = basicExamStudentImport.getCourseCode() + SystemConstant.HYPHEN + basicExamStudentImport.getTeachingRoomName();
             String key = basicExamStudentImport.getCourseCode() + SystemConstant.HYPHEN + basicExamStudentImport.getTeachingRoomName();
             if (!basicCourseIdMap.containsKey(key)) {
             if (!basicCourseIdMap.containsKey(key)) {
                 List<SysOrg> sysOrgList = sysOrgService.getSecondOrg(schoolId, basicExamStudentImport.getTeachingRoomName());
                 List<SysOrg> sysOrgList = sysOrgService.getSecondOrg(schoolId, basicExamStudentImport.getTeachingRoomName());
@@ -195,7 +203,7 @@ public class ImportLogicServiceImpl implements ImportLogicService {
                 basicExamStudent.setCourseId(basicCourseIdMap.get(key));
                 basicExamStudent.setCourseId(basicCourseIdMap.get(key));
             }
             }
 
 
-            //校验任课老师
+            // 校验任课老师
             if (StringUtils.isNotBlank(basicExamStudentImport.getTeacherCode()) && StringUtils.isNotBlank(basicExamStudentImport.getTeacherName())) {
             if (StringUtils.isNotBlank(basicExamStudentImport.getTeacherCode()) && StringUtils.isNotBlank(basicExamStudentImport.getTeacherName())) {
                 SysUser sysUser = sysUserService.getByLoginName(schoolId, basicExamStudentImport.getTeacherCode());
                 SysUser sysUser = sysUserService.getByLoginName(schoolId, basicExamStudentImport.getTeacherCode());
                 if (sysUser == null) {
                 if (sysUser == null) {
@@ -211,7 +219,7 @@ public class ImportLogicServiceImpl implements ImportLogicService {
                 }
                 }
             }
             }
 
 
-            // 校验课程学号唯一
+            // 校验课程+学号唯一
             String courseCodeStudentCode = basicExamStudentImport.getCourseCode() + basicExamStudentImport.getStudentCode();
             String courseCodeStudentCode = basicExamStudentImport.getCourseCode() + basicExamStudentImport.getStudentCode();
             if (courseCodeStudentCodeList.contains(courseCodeStudentCode)) {
             if (courseCodeStudentCodeList.contains(courseCodeStudentCode)) {
                 stringJoiner.add("课程代码[" + basicExamStudentImport.getCourseCode() + "]已存在学号[" + basicExamStudentImport.getStudentCode() + "]的考生数据");
                 stringJoiner.add("课程代码[" + basicExamStudentImport.getCourseCode() + "]已存在学号[" + basicExamStudentImport.getStudentCode() + "]的考生数据");
@@ -221,7 +229,13 @@ public class ImportLogicServiceImpl implements ImportLogicService {
 
 
             if (basicExamStudent.getCourseId() != null) {
             if (basicExamStudent.getCourseId() != null) {
                 if (courseIdStudentCodeMap.containsKey(basicExamStudent.getCourseId() + SystemConstant.HYPHEN + basicExamStudent.getStudentCode())) {
                 if (courseIdStudentCodeMap.containsKey(basicExamStudent.getCourseId() + SystemConstant.HYPHEN + basicExamStudent.getStudentCode())) {
-                    basicExamStudent.setId(courseIdStudentCodeMap.get(basicExamStudent.getCourseId() + SystemConstant.HYPHEN + basicExamStudent.getStudentCode()));
+                    BasicExamStudent student = courseIdStudentCodeMap.get(basicExamStudent.getCourseId() + SystemConstant.HYPHEN + basicExamStudent.getStudentCode());
+                    basicExamStudent.setId(student.getId());
+
+                    // 被更改的试卷编号
+                    if (StringUtils.isNotBlank(basicExamStudent.getPaperNumber()) && StringUtils.isNotBlank(student.getPaperNumber()) && !basicExamStudent.getPaperNumber().equals(student.getPaperNumber())) {
+                        oldPaperNumberList.add(student.getPaperNumber());
+                    }
                 }
                 }
             }
             }
 
 
@@ -245,6 +259,7 @@ public class ImportLogicServiceImpl implements ImportLogicService {
         map.put(SystemConstant.ERROR_DATA_COUNT, basicExamStudentImportList.size() - basicExamStudents.size());
         map.put(SystemConstant.ERROR_DATA_COUNT, basicExamStudentImportList.size() - basicExamStudents.size());
         map.put(SystemConstant.HAS_ERROR_DATA, hasError);
         map.put(SystemConstant.HAS_ERROR_DATA, hasError);
         map.put(SystemConstant.COLUMN_NAMES, basicExamStudentParseDto.getColumnNames());
         map.put(SystemConstant.COLUMN_NAMES, basicExamStudentParseDto.getColumnNames());
+        map.put("oldPaperNumberList", oldPaperNumberList);
 
 
         return map;
         return map;
     }
     }
@@ -339,11 +354,11 @@ public class ImportLogicServiceImpl implements ImportLogicService {
             }
             }
 
 
             try {
             try {
-                Map<String, Object> timeMap = ConvertUtil.analyzeStartAndEndTime(basicExamStudentImport.getExamDate(), basicExamStudentImport.getExamTime());
+                Map<String, Object> timeMap = ConvertUtil.analyzeExamTime(basicExamStudentImport.getExamDate(), basicExamStudentImport.getExamTime());
                 basicExamStudent.setExamStartTime(Long.valueOf(String.valueOf(timeMap.get("startTime"))));
                 basicExamStudent.setExamStartTime(Long.valueOf(String.valueOf(timeMap.get("startTime"))));
                 basicExamStudent.setExamEndTime(Long.valueOf(String.valueOf(timeMap.get("endTime"))));
                 basicExamStudent.setExamEndTime(Long.valueOf(String.valueOf(timeMap.get("endTime"))));
             } catch (Exception e) {
             } catch (Exception e) {
-                stringJoiner.add("考试日期或考试时间格式错误");
+                stringJoiner.add(e.getMessage());
             }
             }
 
 
             // 校验课程
             // 校验课程
@@ -573,26 +588,6 @@ public class ImportLogicServiceImpl implements ImportLogicService {
         return basicExamStudentParseDto;
         return basicExamStudentParseDto;
     }
     }
 
 
-    @Transactional
-    @Override
-    public void saveMarkStudent(Long examId, List<BasicExamStudent> basicExamStudentList, Long createId) {
-
-        Map<String, List<BasicExamStudent>> stringMap = basicExamStudentList.stream().collect(Collectors.groupingBy(BasicExamStudent::getPaperNumber));
-
-        for (Map.Entry<String, List<BasicExamStudent>> entry : stringMap.entrySet()) {
-            BasicExamStudent basicExamStudent = entry.getValue().get(0);
-            MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, entry.getKey());
-            if (markPaper == null) {
-                markPaper = new MarkPaper(examId, basicExamStudent.getCourseId(), entry.getKey(), String.valueOf(System.currentTimeMillis()), createId, SystemConstant.DEFAULT_PAPER_TYPE_A);
-                markPaperService.save(markPaper);
-            }
-            Set<String> secretNumberSet = new HashSet<>();
-            MarkPaper finalMarkPaper = markPaper;
-            entry.getValue().forEach(m -> markStudentService.updateByBasicExamStudent(m, finalMarkPaper, secretNumberSet));
-            markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(examId, entry.getKey(), SystemConstant.DEFAULT_PAPER_TYPE_A);
-        }
-    }
-
     @Transactional
     @Transactional
     @Override
     @Override
     public Map<String, Object> executeImportObjectiveStructLogic(Map<String, Object> map) throws Exception {
     public Map<String, Object> executeImportObjectiveStructLogic(Map<String, Object> map) throws Exception {

+ 5 - 2
distributed-print-business/src/main/resources/mapper/BasicExamStudentMapper.xml

@@ -64,8 +64,11 @@
             <if test="major != null and major != ''">
             <if test="major != null and major != ''">
                 AND bes.major_name LIKE CONCAT('%',#{major},'%')
                 AND bes.major_name LIKE CONCAT('%',#{major},'%')
             </if>
             </if>
-            <if test="teachClazz != null and teachClazz != ''">
-                AND tbc.clazz_name LIKE CONCAT('%',#{teachClazz},'%')
+            <if test="teachClassName != null and teachClassName != ''">
+                AND tbc.teach_class_name LIKE CONCAT('%',#{teachClassName},'%')
+            </if>
+            <if test="className != null and className != ''">
+                AND tbc.class_name LIKE CONCAT('%',#{className},'%')
             </if>
             </if>
             <if test="examStudentInfo != null and examStudentInfo != ''">
             <if test="examStudentInfo != null and examStudentInfo != ''">
                 AND (bes.student_code LIKE CONCAT('%',#{examStudentInfo},'%') OR bes.student_name LIKE CONCAT('%',#{examStudentInfo},'%'))
                 AND (bes.student_code LIKE CONCAT('%',#{examStudentInfo},'%') OR bes.student_name LIKE CONCAT('%',#{examStudentInfo},'%'))

+ 4 - 0
distributed-print/install/mysql/upgrade/3.4.0.sql

@@ -192,6 +192,10 @@ ALTER TABLE `sys_user` ADD COLUMN `allow_course_scan` TINYINT(1) NULL DEFAULT 1
 ALTER TABLE `exam_student` ADD INDEX `idx_4` (`exam_id` ASC, `paper_number` ASC, `student_code` ASC);
 ALTER TABLE `exam_student` ADD INDEX `idx_4` (`exam_id` ASC, `paper_number` ASC, `student_code` ASC);
 ALTER TABLE `t_r_exam_student` ADD INDEX `idx_1` (`r_basic_info_id` ASC, `student_code` ASC);
 ALTER TABLE `t_r_exam_student` ADD INDEX `idx_1` (`r_basic_info_id` ASC, `student_code` ASC);
 
 
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1144', '删除考生时查询扫描阅卷状态', '/api/admin/basic/exam_student/mark_status', 'URL', '1100', '8', 'AUTH', '1', '1', '1');
+UPDATE `sys_privilege` SET `related` = '1105,1144' WHERE (`id` = '1113');
+UPDATE `sys_privilege` SET `related` = '1105,1144' WHERE (`id` = '1114');
+
 
 
 -- drop table if exists exam_detail_course_paper_type;
 -- drop table if exists exam_detail_course_paper_type;
 -- drop table if exists basic_template_org;
 -- drop table if exists basic_template_org;

+ 9 - 2
distributed-print/src/main/java/com/qmth/distributed/print/api/BasicExamStudentController.java

@@ -63,7 +63,8 @@ public class BasicExamStudentController {
                                            @ApiParam(value = "教师(工号/姓名)") @RequestParam(required = false) String teacher,
                                            @ApiParam(value = "教师(工号/姓名)") @RequestParam(required = false) String teacher,
                                            @ApiParam(value = "学院") @RequestParam(required = false) String college,
                                            @ApiParam(value = "学院") @RequestParam(required = false) String college,
                                            @ApiParam(value = "专业") @RequestParam(required = false) String major,
                                            @ApiParam(value = "专业") @RequestParam(required = false) String major,
-                                           @ApiParam(value = "教学班(模糊查询)") @RequestParam(required = false) String teachClazz,
+                                           @ApiParam(value = "教学班(模糊查询)") @RequestParam(required = false) String teachClassName,
+                                           @ApiParam(value = "行政班(模糊查询)") @RequestParam(required = false) String className,
                                            @ApiParam(value = "考生信息(姓名/学号)") @RequestParam(required = false) String examStudentInfo,
                                            @ApiParam(value = "考生信息(姓名/学号)") @RequestParam(required = false) String examStudentInfo,
                                            @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
                                            @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
                                            @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
                                            @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
@@ -74,7 +75,7 @@ public class BasicExamStudentController {
             throw ExceptionResultEnum.ERROR.exception("请选择考试");
             throw ExceptionResultEnum.ERROR.exception("请选择考试");
         }
         }
         return ResultUtil.ok(basicExamStudentService.page(SystemConstant.convertIdToLong(semesterId),
         return ResultUtil.ok(basicExamStudentService.page(SystemConstant.convertIdToLong(semesterId),
-                SystemConstant.convertIdToLong(examId), courseId, teacher, college, major, teachClazz,
+                SystemConstant.convertIdToLong(examId), courseId, teacher, college, major, teachClassName, className,
                 examStudentInfo, pageNumber, pageSize));
                 examStudentInfo, pageNumber, pageSize));
     }
     }
 
 
@@ -140,6 +141,12 @@ public class BasicExamStudentController {
                 examStudentInfo);
                 examStudentInfo);
     }
     }
 
 
+    @ApiOperation(value = "删除时查询考生扫描阅卷状态")
+    @RequestMapping(value = "/mark_status", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
+    public Result status(@ApiParam(value = "考生id集合", required = true) @RequestParam List<Long> idList) {
+        return ResultUtil.ok(basicExamStudentService.getStudentMarkStatus(idList));
+    }
     @ApiOperation(value = "删除")
     @ApiOperation(value = "删除")
     @RequestMapping(value = "/delete", method = RequestMethod.POST)
     @RequestMapping(value = "/delete", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "删除成功", response = Result.class)})
     @ApiResponses({@ApiResponse(code = 200, message = "删除成功", response = Result.class)})

+ 1 - 1
distributed-print/src/main/java/com/qmth/distributed/print/api/mark/MarkArchiveController.java

@@ -75,7 +75,7 @@ public class MarkArchiveController {
         markStudentService.scoreDownload(query, response);
         markStudentService.scoreDownload(query, response);
     }
     }
 
 
-    @ApiOperation(value = "成绩导出")
+    @ApiOperation(value = "成绩报告导出")
     @RequestMapping(value = "/score/report/download", method = RequestMethod.POST)
     @RequestMapping(value = "/score/report/download", method = RequestMethod.POST)
     public void scoreReportDownload(@RequestBody JSONObject jsonObject, HttpServletResponse response) {
     public void scoreReportDownload(@RequestBody JSONObject jsonObject, HttpServletResponse response) {
         markStudentService.scoreReportDownload(jsonObject, response);
         markStudentService.scoreReportDownload(jsonObject, response);

+ 5 - 3
teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/ConvertUtil.java

@@ -95,11 +95,13 @@ public class ConvertUtil {
         }
         }
         String startTimeStr = date + " " + arr[0];
         String startTimeStr = date + " " + arr[0];
         String endTimeStr = date + " " + arr[1];
         String endTimeStr = date + " " + arr[1];
-        if (Objects.isNull(DateDisposeUtils.parseExamDateTime(startTimeStr)) || Objects.isNull(DateDisposeUtils.parseExamDateTime(endTimeStr))) {
-            throw ExceptionResultEnum.ERROR.exception("考试日期正确格式为[2023-01-01或2023/09/01]");
-        }
+
         DateTime startDate = DateDisposeUtils.parseExamDateTime(startTimeStr);
         DateTime startDate = DateDisposeUtils.parseExamDateTime(startTimeStr);
         DateTime endDate = DateDisposeUtils.parseExamDateTime(endTimeStr);
         DateTime endDate = DateDisposeUtils.parseExamDateTime(endTimeStr);
+        if (Objects.isNull(startDate) || Objects.isNull(endDate)) {
+            throw ExceptionResultEnum.ERROR.exception("考试日期正确格式为[2023-01-01或2023/09/01]");
+        }
+
         Date start = new Date(startDate.getTime()), end = new Date(endDate.getTime());
         Date start = new Date(startDate.getTime()), end = new Date(endDate.getTime());
         if (!DateUtils.isSameDay(start, end)) {
         if (!DateUtils.isSameDay(start, end)) {
             throw ExceptionResultEnum.ERROR.exception("考试日期正确格式为[2023-01-01或2023/09/01],考试时间正确格式为[08:00-10:00]");
             throw ExceptionResultEnum.ERROR.exception("考试日期正确格式为[2023-01-01或2023/09/01],考试时间正确格式为[08:00-10:00]");

+ 1 - 1
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkPaperService.java

@@ -69,7 +69,7 @@ public interface MarkPaperService extends IService<MarkPaper> {
 
 
     IPage<ArchiveScoreVo> scoreList(ArchiveScoreQuery query);
     IPage<ArchiveScoreVo> scoreList(ArchiveScoreQuery query);
 
 
-    boolean deleteByExamIdAndPaperNumber(Long examId, String paperNumber, Boolean checkMarkStudent);
+    void deleteByExamIdAndPaperNumber(Long examId, String paperNumber);
 
 
     void updateAbsentCount(Long examId, String paperNumber, int absentCount);
     void updateAbsentCount(Long examId, String paperNumber, int absentCount);
 
 

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

@@ -1,5 +1,6 @@
 package com.qmth.teachcloud.mark.service.impl;
 package com.qmth.teachcloud.mark.service.impl;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -99,9 +100,12 @@ public class MarkPaperServiceImpl extends ServiceImpl<MarkPaperMapper, MarkPaper
     @Override
     @Override
     public MarkPaper getByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType) {
     public MarkPaper getByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType) {
         QueryWrapper<MarkPaper> queryWrapper = new QueryWrapper<>();
         QueryWrapper<MarkPaper> queryWrapper = new QueryWrapper<>();
-        queryWrapper.lambda().eq(MarkPaper::getExamId, examId)
-                .eq(MarkPaper::getPaperNumber, paperNumber)
-                .eq(MarkPaper::getPaperType, paperType);
+        LambdaQueryWrapper<MarkPaper> lambda = queryWrapper.lambda();
+        lambda.eq(MarkPaper::getExamId, examId)
+                .eq(MarkPaper::getPaperNumber, paperNumber);
+        if (StringUtils.isNotBlank(paperType)) {
+            lambda.eq(MarkPaper::getPaperType, paperType);
+        }
         return this.getOne(queryWrapper);
         return this.getOne(queryWrapper);
     }
     }
 
 
@@ -334,16 +338,15 @@ public class MarkPaperServiceImpl extends ServiceImpl<MarkPaperMapper, MarkPaper
     @Override
     @Override
     public void updateStudentCountByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType) {
     public void updateStudentCountByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType) {
         long count = markStudentService.countByExamIdAndPaperNumber(examId, paperNumber, paperType);
         long count = markStudentService.countByExamIdAndPaperNumber(examId, paperNumber, paperType);
-        if (count == 0) {
-            this.deleteByExamIdAndPaperNumber(examId, paperNumber, true);
-        } else {
-            UpdateWrapper<MarkPaper> updateWrapper = new UpdateWrapper<>();
-            updateWrapper.lambda().set(MarkPaper::getStudentCount, count)
-                    .eq(MarkPaper::getExamId, examId)
-                    .eq(MarkPaper::getPaperNumber, paperNumber)
-                    .eq(MarkPaper::getPaperType, paperType);
-            this.update(updateWrapper);
+        UpdateWrapper<MarkPaper> updateWrapper = new UpdateWrapper<>();
+        LambdaUpdateWrapper<MarkPaper> lambda = updateWrapper.lambda();
+        lambda.set(MarkPaper::getStudentCount, count)
+                .eq(MarkPaper::getExamId, examId)
+                .eq(MarkPaper::getPaperNumber, paperNumber);
+        if (StringUtils.isNotBlank(paperType)) {
+            lambda.eq(MarkPaper::getPaperType, paperType);
         }
         }
+        this.update(updateWrapper);
     }
     }
 
 
     @Override
     @Override
@@ -387,17 +390,11 @@ public class MarkPaperServiceImpl extends ServiceImpl<MarkPaperMapper, MarkPaper
     }
     }
 
 
     @Override
     @Override
-    public boolean deleteByExamIdAndPaperNumber(Long examId, String paperNumber, Boolean checkMarkStudent) {
-        if (checkMarkStudent) {
-            long count = markStudentService.countByExamIdAndPaperNumber(examId, paperNumber, null);
-            if (count > 0) {
-                return false;
-            }
-        }
+    public void deleteByExamIdAndPaperNumber(Long examId, String paperNumber) {
         UpdateWrapper<MarkPaper> updateWrapper = new UpdateWrapper<>();
         UpdateWrapper<MarkPaper> updateWrapper = new UpdateWrapper<>();
         updateWrapper.lambda().eq(MarkPaper::getExamId, examId)
         updateWrapper.lambda().eq(MarkPaper::getExamId, examId)
                 .eq(MarkPaper::getPaperNumber, paperNumber);
                 .eq(MarkPaper::getPaperNumber, paperNumber);
-        return this.remove(updateWrapper);
+        this.remove(updateWrapper);
     }
     }
 
 
     @Override
     @Override

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

@@ -1118,7 +1118,7 @@ public class MarkServiceImpl implements MarkService {
 
 
     @Override
     @Override
     public void deleteInitMarkData(Long examId, String paperNumber) {
     public void deleteInitMarkData(Long examId, String paperNumber) {
-        markPaperService.deleteByExamIdAndPaperNumber(examId, paperNumber, false);
+        markPaperService.deleteByExamIdAndPaperNumber(examId, paperNumber);
         markStudentService.deleteByExamIdAndPaperNumber(examId, paperNumber);
         markStudentService.deleteByExamIdAndPaperNumber(examId, paperNumber);
         scanAnswerCardService.deleteByExamIdAndPaperNumber(examId, paperNumber);
         scanAnswerCardService.deleteByExamIdAndPaperNumber(examId, paperNumber);
         markQuestionService.deleteByExamIdAndPaperNumber(examId, paperNumber);
         markQuestionService.deleteByExamIdAndPaperNumber(examId, paperNumber);

+ 13 - 10
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java

@@ -976,10 +976,9 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
 
 
     @Override
     @Override
     public void scoreExport(ArchiveStudentQuery query, HttpServletResponse response) {
     public void scoreExport(ArchiveStudentQuery query, HttpServletResponse response) {
-        Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         //生成表头
         //生成表头
-        String[] columnName = new String[]{"学生姓名", "学号", "学院", "班级", "课程代码", "课程名称", "状态", "客观分", "主观分",
-                "成绩"};
+        String[] columnName = new String[]{"学生姓名", "学号", "学院", "教学班", "行政班", "课程代码", "课程名称", "状态", "客观分", "主观分", "成绩"};
         List<MarkQuestion> oQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndGroupNumber(query.getExamId(), query.getPaperNumber(), null, true);
         List<MarkQuestion> oQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndGroupNumber(query.getExamId(), query.getPaperNumber(), null, true);
         List<MarkQuestion> sQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndGroupNumber(query.getExamId(), query.getPaperNumber(), null, false);
         List<MarkQuestion> sQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndGroupNumber(query.getExamId(), query.getPaperNumber(), null, false);
         List<String> columnNameList = new ArrayList<>(Arrays.asList(columnName));
         List<String> columnNameList = new ArrayList<>(Arrays.asList(columnName));
@@ -993,12 +992,15 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
         String[] columnNames = columnNameList.toArray(new String[0]);
         String[] columnNames = columnNameList.toArray(new String[0]);
         //生成动态内容
         //生成动态内容
         List<String[]> columnValues = new ArrayList<>();
         List<String[]> columnValues = new ArrayList<>();
-        List<ArchiveStudentVo> ret = baseMapper.studentList(schoolId, query, null);
+        // 使用成绩管理列表请求的数据权限
+        DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(sysUser.getSchoolId(), sysUser.getId(), "/api/admin/mark/archive/score/list");
+        List<ArchiveStudentVo> ret = baseMapper.studentList(sysUser.getSchoolId(), query, dpr);
         for (ArchiveStudentVo s : ret) {
         for (ArchiveStudentVo s : ret) {
             List<String> valueList = new ArrayList<>();
             List<String> valueList = new ArrayList<>();
             valueList.add(s.getStudentName());
             valueList.add(s.getStudentName());
             valueList.add(s.getStudentCode());
             valueList.add(s.getStudentCode());
             valueList.add(s.getCollegeName());
             valueList.add(s.getCollegeName());
+            valueList.add(s.getTeachClassName());
             valueList.add(s.getClassName());
             valueList.add(s.getClassName());
             valueList.add(s.getCourseCode());
             valueList.add(s.getCourseCode());
             valueList.add(s.getCourseName());
             valueList.add(s.getCourseName());
@@ -1579,9 +1581,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
     @Override
     @Override
     public void updateByBasicExamStudent(BasicExamStudent basicExamStudent, MarkPaper markPaper, Set<String> secretNumberSet) {
     public void updateByBasicExamStudent(BasicExamStudent basicExamStudent, MarkPaper markPaper, Set<String> secretNumberSet) {
         MarkStudent markStudent = this.findByExamIdAndPaperNumberAndStudentCode(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber(), basicExamStudent.getStudentCode());
         MarkStudent markStudent = this.findByExamIdAndPaperNumberAndStudentCode(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber(), basicExamStudent.getStudentCode());
-        SysUser sysUser = sysUserService.getById(basicExamStudent.getTeacherId());
         if (markStudent == null) {
         if (markStudent == null) {
-            markStudent = new MarkStudent(SystemConstant.getDbUuid(), basicExamStudent.getExamId(), basicExamStudent.getId(), basicExamStudent.getCourseId(), basicExamStudent.getPaperNumber(), markPaper.getCoursePaperId(), "A", basicExamStudent.getStudentCode(), "", basicExamStudent.getExamPlace(), basicExamStudent.getExamRoom(), basicExamStudent.getExamStartTime(), basicExamStudent.getExamEndTime(), markPaper.getUserId());
+            markStudent = new MarkStudent(SystemConstant.getDbUuid(), basicExamStudent.getExamId(), basicExamStudent.getId(), basicExamStudent.getCourseId(), basicExamStudent.getPaperNumber(), markPaper.getCoursePaperId(), markPaper.getPaperType(), basicExamStudent.getStudentCode(), "", basicExamStudent.getExamPlace(), basicExamStudent.getExamRoom(), basicExamStudent.getExamStartTime(), basicExamStudent.getExamEndTime(), markPaper.getUserId());
             if (markStudent.getSecretNumber() == null) {
             if (markStudent.getSecretNumber() == null) {
                 markStudent.randomSecretNumber();
                 markStudent.randomSecretNumber();
                 while (secretNumberSet.contains(markStudent.getSecretNumber())
                 while (secretNumberSet.contains(markStudent.getSecretNumber())
@@ -1589,8 +1590,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
                     markStudent.randomSecretNumber();
                     markStudent.randomSecretNumber();
                 }
                 }
             }
             }
+            this.saveOrUpdate(markStudent);
         }
         }
-        this.saveOrUpdate(markStudent);
     }
     }
 
 
     @Override
     @Override
@@ -1609,17 +1610,19 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
 
 
     @Override
     @Override
     public void scoreDownload(ArchiveStudentQuery query, HttpServletResponse response) {
     public void scoreDownload(ArchiveStudentQuery query, HttpServletResponse response) {
-        Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         //生成表头
         //生成表头
         String[] columnNames = new String[]{"序号", "班级", "学号", "姓名", "平时(必填)", "实验(必填)", "期末(必填)", "备注"};
         String[] columnNames = new String[]{"序号", "班级", "学号", "姓名", "平时(必填)", "实验(必填)", "期末(必填)", "备注"};
         //生成动态内容
         //生成动态内容
         List<String[]> columnValues = new ArrayList<>();
         List<String[]> columnValues = new ArrayList<>();
-        List<ArchiveStudentVo> ret = baseMapper.studentList(schoolId, query, null);
+        // 使用成绩管理列表请求的数据权限
+        DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(sysUser.getSchoolId(), sysUser.getId(), "/api/admin/mark/archive/score/list");
+        List<ArchiveStudentVo> ret = baseMapper.studentList(sysUser.getSchoolId(), query, dpr);
         for (int i = 0; i < ret.size(); i++) {
         for (int i = 0; i < ret.size(); i++) {
             ArchiveStudentVo s = ret.get(i);
             ArchiveStudentVo s = ret.get(i);
             List<String> valueList = new ArrayList<>();
             List<String> valueList = new ArrayList<>();
             valueList.add(String.valueOf(i + 1));
             valueList.add(String.valueOf(i + 1));
-            valueList.add(s.getClassName());
+            valueList.add(s.getTeachClassName());
             valueList.add(s.getStudentCode());
             valueList.add(s.getStudentCode());
             valueList.add(s.getStudentName());
             valueList.add(s.getStudentName());
             valueList.add("");
             valueList.add("");