Browse Source

Merge remote-tracking branch 'origin/dev' into dev

wangliang 4 years ago
parent
commit
24996b9c91
24 changed files with 409 additions and 31 deletions
  1. 24 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ExaminationImportDto.java
  2. 116 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/ExamTaskPaperLog.java
  3. 1 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/CardRequiredFieldsEnum.java
  4. 1 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/RequiredFieldsEnum.java
  5. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamDetailCourseMapper.java
  6. 3 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamStudentMapper.java
  7. 16 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamTaskPaperLogMapper.java
  8. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ClientService.java
  9. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamDetailCourseService.java
  10. 5 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamStudentService.java
  11. 1 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamTaskDetailService.java
  12. 16 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamTaskPaperLogService.java
  13. 52 14
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ClientServiceImpl.java
  14. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailCourseServiceImpl.java
  15. 4 5
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java
  16. 28 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamStudentServiceImpl.java
  17. 56 4
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskDetailServiceImpl.java
  18. 20 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskPaperLogServiceImpl.java
  19. 5 1
      distributed-print-business/src/main/resources/mapper/ExamDetailCourseMapper.xml
  20. 23 0
      distributed-print-business/src/main/resources/mapper/ExamStudentMapper.xml
  21. 4 0
      distributed-print-business/src/main/resources/mapper/ExamTaskPaperLogMapper.xml
  22. 2 1
      distributed-print/src/main/java/com/qmth/distributed/print/api/ClientController.java
  23. 15 0
      distributed-print/src/main/java/com/qmth/distributed/print/api/ExamDetailController.java
  24. 13 2
      distributed-print/src/main/java/com/qmth/distributed/print/api/ExamTaskController.java

+ 24 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ExaminationImportDto.java

@@ -16,6 +16,14 @@ public class ExaminationImportDto {
     @ExcelDBFieldDesc(name = "学号",length = 10)
     private String studentCode;
 
+    @ApiModelProperty(value = "考号")
+    @ExcelDBFieldDesc(name = "考号",length = 15)
+    private String ticketNumber;
+
+    @ApiModelProperty(value = "座位号")
+    @ExcelDBFieldDesc(name = "座位号",length = 15)
+    private String siteNumber;
+
     @ApiModelProperty(value = "姓名")
     @ExcelDBFieldDesc(name = "姓名",length = 15)
     private String studentName;
@@ -77,6 +85,22 @@ public class ExaminationImportDto {
         this.studentCode = studentCode;
     }
 
+    public String getTicketNumber() {
+        return ticketNumber;
+    }
+
+    public void setTicketNumber(String ticketNumber) {
+        this.ticketNumber = ticketNumber;
+    }
+
+    public String getSiteNumber() {
+        return siteNumber;
+    }
+
+    public void setSiteNumber(String siteNumber) {
+        this.siteNumber = siteNumber;
+    }
+
     public String getStudentName() {
         return studentName;
     }

+ 116 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/ExamTaskPaperLog.java

@@ -0,0 +1,116 @@
+package com.qmth.distributed.print.business.entity;
+
+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;
+import com.qmth.distributed.print.business.base.BaseEntity;
+import com.qmth.distributed.print.business.enums.ReviewStatusEnum;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 卷库修改审核临时表
+ * </p>
+ *
+ * @author xf
+ * @since 2021-03-23
+ */
+@TableName("exam_task_detail")
+public class ExamTaskPaperLog extends BaseEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 命题任务ID
+     */
+    @JsonSerialize(using = ToStringSerializer.class)
+    @TableField("exam_task_id")
+    private Long examTaskId;
+    /**
+     * 试卷类型,多个以”/“分隔,如A/B/C/D
+     */
+    @TableField("paper_type")
+    private String paperType;
+    /**
+     * [
+     * {
+     * "type": "A",
+     * "attachmentId": 12,
+     * "totalPages": 3
+     * },
+     * {
+     * "type": "B",
+     * "attachmentId": 13,
+     * "totalPages": 2
+     * }
+     * ]
+     */
+    @TableField("paper_attachment_ids")
+    private String paperAttachmentIds;
+    /**
+     * 题卡ID
+     */
+    @JsonSerialize(using = ToStringSerializer.class)
+    @TableField("card_id")
+    private Long cardId;
+
+    /**
+     * 0-禁用,1-启用
+     */
+    private Boolean review;
+    /**
+     * 审核状态:PASS-审核通过,NOT_PASS-审核不通过,默认为空-未审核
+     */
+    @TableField("review_status")
+    private ReviewStatusEnum reviewStatus;
+
+    public Long getExamTaskId() {
+        return examTaskId;
+    }
+
+    public void setExamTaskId(Long examTaskId) {
+        this.examTaskId = examTaskId;
+    }
+
+    public String getPaperType() {
+        return paperType;
+    }
+
+    public void setPaperType(String paperType) {
+        this.paperType = paperType;
+    }
+
+    public String getPaperAttachmentIds() {
+        return paperAttachmentIds;
+    }
+
+    public void setPaperAttachmentIds(String paperAttachmentIds) {
+        this.paperAttachmentIds = paperAttachmentIds;
+    }
+
+    public Long getCardId() {
+        return cardId;
+    }
+
+    public void setCardId(Long cardId) {
+        this.cardId = cardId;
+    }
+
+    public Boolean getReview() {
+        return review;
+    }
+
+    public void setReview(Boolean review) {
+        this.review = review;
+    }
+
+    public ReviewStatusEnum getReviewStatus() {
+        return reviewStatus;
+    }
+
+    public void setReviewStatus(ReviewStatusEnum reviewStatus) {
+        this.reviewStatus = reviewStatus;
+    }
+}

+ 1 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/CardRequiredFieldsEnum.java

@@ -13,6 +13,7 @@ import java.util.List;
 public enum CardRequiredFieldsEnum {
 
     TICKET_NUMBER("ticketNumber", "考号"),
+    SITE_NUMBER("siteNumber", "座位号"),
     STUDENT_NAME("studentName","姓名"),
     COURSE_NAME("courseName","课程名称");
 

+ 1 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/RequiredFieldsEnum.java

@@ -13,6 +13,7 @@ public enum RequiredFieldsEnum {
 
     STUDENT_CODE("studentCode", "学号"),
     TICKET_NUMBER("ticketNumber", "考号"),
+    SITE_NUMBER("siteNumber", "座位号"),
     STUDENT_NAME("studentName","姓名"),
     COURSE_CODE("courseCode","课程代码"),
     COURSE_NAME("courseName","课程名称"),

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

@@ -17,7 +17,7 @@ import java.util.Map;
  */
 public interface ExamDetailCourseMapper extends BaseMapper<ExamDetailCourse> {
 
-    List<Map<String, String>> listByExamDetailId(@Param("examDetailId") Long examDetailId, @Param("status") String status);
+    List<Map<String, Object>> listByExamDetailId(@Param("examDetailId") Long examDetailId, @Param("status") String status);
 
     List<ExamDetailCourse> listByExamDetailIdAndStatus(@Param("examDetailId") Long examDetailId, @Param("status") String status);
 }

+ 3 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamStudentMapper.java

@@ -3,6 +3,8 @@ package com.qmth.distributed.print.business.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.qmth.distributed.print.business.entity.ExamStudent;
 
+import java.util.Map;
+
 /**
  * <p>
  * 考生 Mapper 接口
@@ -13,4 +15,5 @@ import com.qmth.distributed.print.business.entity.ExamStudent;
  */
 public interface ExamStudentMapper extends BaseMapper<ExamStudent> {
 
+    Map<String, Object> getStudentDetail(Long id);
 }

+ 16 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamTaskPaperLogMapper.java

@@ -0,0 +1,16 @@
+package com.qmth.distributed.print.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.qmth.distributed.print.business.entity.ExamTaskPaperLog;
+
+/**
+ * <p>
+ * 卷库修改审核临时表 Mapper 接口
+ * </p>
+ *
+ * @author xf
+ * @since 2021-03-23
+ */
+public interface ExamTaskPaperLogMapper extends BaseMapper<ExamTaskPaperLog> {
+
+}

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ClientService.java

@@ -27,7 +27,7 @@ public interface ClientService {
 
     IPage<ClientPrintTaskDto> listClientPrintTask(Long schoolId, Long machineCode, String orgId, String printPlanId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate, Integer pageNumber, Integer pageSize);
 
-    Map<String, Object> getPrintData(Long schoolId, Long examDetailId, String machineCode, String printUser);
+    Map<String, Object> getPrintData(Long schoolId, Long examDetailId, String machineCode, Boolean isPrint, String printUser);
 
     List<Map<String, Object>> getPrintDataBatch(Long schoolId, Long machineCode, String orgId, String printPlanId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate);
 

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamDetailCourseService.java

@@ -23,7 +23,7 @@ public interface ExamDetailCourseService extends IService<ExamDetailCourse> {
      */
     double calculatePackagesByDetailId(Long examDetailId);
 
-    List<Map<String, String>> listByExamDetailId(Long examDetailId);
+    List<Map<String, Object>> listByExamDetailId(Long examDetailId);
 
     List<ExamDetailCourse> listDetailCourseByCourseCodeAndPaperNumber(Long schoolId, String courseCode, String paperNumber);
 

+ 5 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamStudentService.java

@@ -5,6 +5,7 @@ import com.qmth.distributed.print.business.entity.ExamDetailCourse;
 import com.qmth.distributed.print.business.entity.ExamStudent;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -17,4 +18,8 @@ import java.util.List;
 public interface ExamStudentService extends IService<ExamStudent> {
 
     void updatePaperType(List<ExamDetailCourse> examDetailCourses, String relatePaperType);
+
+    List<String> listByExamDetailCourseId(String examDetailCourseId);
+
+    Map<String, Object> getStudentDetail(Long id);
 }

+ 1 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamTaskDetailService.java

@@ -36,4 +36,5 @@ public interface ExamTaskDetailService extends IService<ExamTaskDetail> {
 
     Map<String, String>  getUrl(Long schoolId, Long examTaskId);
 
+    boolean paperUpdate(ExamTaskDetail examTaskDetail);
 }

+ 16 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamTaskPaperLogService.java

@@ -0,0 +1,16 @@
+package com.qmth.distributed.print.business.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.distributed.print.business.entity.ExamTaskPaperLog;
+
+/**
+ * <p>
+ * 卷库修改审核临时表 服务类
+ * </p>
+ *
+ * @author xf
+ * @since 2021-03-23
+ */
+public interface ExamTaskPaperLogService extends IService<ExamTaskPaperLog> {
+
+}

+ 52 - 14
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ClientServiceImpl.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.distributed.print.business.bean.dto.*;
 import com.qmth.distributed.print.business.entity.*;
+import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
 import com.qmth.distributed.print.business.service.*;
 import com.qmth.distributed.print.business.util.ExcelUtil;
 import com.qmth.distributed.print.common.contant.SystemConstant;
@@ -14,6 +15,7 @@ import com.qmth.distributed.print.common.enums.ExceptionResultEnum;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.*;
@@ -52,6 +54,9 @@ public class ClientServiceImpl implements ClientService {
     @Autowired
     private ExamCardDetailService examCardDetailService;
 
+    @Autowired
+    private ExamStudentService examStudentService;
+
     @Override
     public IPage<ClientExamTaskDto> listTryTask(Long schoolId, String machineCode, Long orgId, Long printPlanId, String courseCode, String paperNumber, Boolean isTry, Boolean isPass, Integer pageNumber, Integer pageSize) {
         return examTaskService.listTryTask(schoolId, machineCode, orgId, printPlanId, courseCode, paperNumber, isTry, isPass, pageNumber, pageSize);
@@ -82,7 +87,7 @@ public class ClientServiceImpl implements ClientService {
     public Map<String, Object> getReprintData(Long schoolId, Long examDetailId, String ticketNumber, String type) {
         Map<String, Object> finalMap = new HashMap<>();
         // 取试卷
-        List<Map<String, String>> examDetailCourses = examDetailCourseService.listByExamDetailId(examDetailId);
+        List<Map<String, Object>> examDetailCourses = examDetailCourseService.listByExamDetailId(examDetailId);
         Map<String, Map<String, String>> map = mapCourseUrl(examDetailCourses);
         // 取考生
         List<Map> studentList = examDetailService.listStudentByExamDetailId(schoolId, examDetailId, ticketNumber, type);
@@ -125,9 +130,10 @@ public class ClientServiceImpl implements ClientService {
         return pirntTaskDtoIPage;
     }
 
+    @Transactional
     @Override
-    public Map<String, Object> getPrintData(Long schoolId, Long examDetailId, String machineCode, String printUser) {
-        List<Map<String, String>> examDetailCourses = examDetailCourseService.listByExamDetailId(examDetailId);
+    public Map<String, Object> getPrintData(Long schoolId, Long examDetailId, String machineCode, Boolean isPrint, String printUser) {
+        List<Map<String, Object>> examDetailCourses = examDetailCourseService.listByExamDetailId(examDetailId);
         Map<String, Object> finalMap = new HashMap<>();
         // 2.取生成的完整的pdf
         ExamDetail examDetail = examDetailService.getById(examDetailId);
@@ -193,15 +199,15 @@ public class ClientServiceImpl implements ClientService {
 
         // 备用题卡
         List<ClientPrintBackupDataDto> cardBackupList = new ArrayList<>();
-        for (Map<String, String> examDetailCours : examDetailCourses) {
-            String attachmentIds = examDetailCours.get("attachmentIds");
+        for (Map<String, Object> examDetailCours : examDetailCourses) {
+            String attachmentIds = examDetailCours.get("attachmentIds").toString();
             JSONObject jsonObject = JSONObject.parseObject(attachmentIds);
             List<Map> backupCards = JSONObject.parseArray(JSONObject.toJSONString(jsonObject.get("card")), Map.class);
             for (Map backupCard : backupCards) {
                 ClientPrintBackupDataDto clientPrintBackupDataDto = new ClientPrintBackupDataDto();
-                clientPrintBackupDataDto.setCourseCode(examDetailCours.get("courseCode"));
-                clientPrintBackupDataDto.setCourseName(examDetailCours.get("courseName"));
-                clientPrintBackupDataDto.setPaperNumber(examDetailCours.get("paperNumber"));
+                clientPrintBackupDataDto.setCourseCode(examDetailCours.get("courseCode").toString());
+                clientPrintBackupDataDto.setCourseName(examDetailCours.get("courseName").toString());
+                clientPrintBackupDataDto.setPaperNumber(examDetailCours.get("paperNumber").toString());
                 clientPrintBackupDataDto.setPaperType(backupCard.get("name").toString());
                 Map<String, String> urlMap = commonService.filePreviewByAttachmentId(Long.valueOf(backupCard.get("attachmentId").toString()), false);
                 clientPrintBackupDataDto.setMd5(urlMap.get("md5"));
@@ -242,6 +248,38 @@ public class ClientServiceImpl implements ClientService {
             }
         }
         finalMap.put("other", otherList);
+
+        // 更新印刷中状态,更新曝光卷型、未曝光卷型
+        if (isPrint) {
+            // 更新exam_detail状态为印刷中
+            UpdateWrapper<ExamDetail> examDetailUpdateWrapper = new UpdateWrapper<>();
+            examDetailUpdateWrapper.lambda().set(ExamDetail::getStatus, ExamDetailStatusEnum.PRINTING).eq(ExamDetail::getId, examDetailId);
+            examDetailService.update(examDetailUpdateWrapper);
+
+            // 更新曝光卷型、未曝光卷型
+            for (Map<String, Object> examDetailCours : examDetailCourses) {
+                String examDetailCourseId = examDetailCours.get("examDetailCourseId").toString();
+                // 考生使用卷型
+                List<String> studentPaperTypes = examStudentService.listByExamDetailCourseId(examDetailCourseId);
+                Object exposedPaperType = examDetailCours.get("exposedPaperType");
+                Set<String> exposedPaperSet = Objects.isNull(exposedPaperType) ? new HashSet<>() : new HashSet<>(Arrays.asList(exposedPaperType.toString().split(",")));
+                Object unexposedPaperType = examDetailCours.get("unexposedPaperType").toString();
+                Set<String> unexposedPaperSet = Objects.isNull(unexposedPaperType) ? new HashSet<>() : new HashSet<>(Arrays.asList(unexposedPaperType.toString().split(",")));
+                if (!studentPaperTypes.isEmpty()) {
+                    for (String studentPaperType : studentPaperTypes) {
+                        exposedPaperSet.add(studentPaperType);
+                        unexposedPaperSet.remove(studentPaperType);
+                    }
+                }
+                String examTaskId = examDetailCours.get("examTaskId").toString();
+                UpdateWrapper<ExamTaskDetail> examTaskDetailUpdateWrapper = new UpdateWrapper<>();
+                examTaskDetailUpdateWrapper.lambda()
+                        .set(ExamTaskDetail::getExposedPaperType, String.join(",", exposedPaperSet))
+                        .set(ExamTaskDetail::getUnexposedPaperType, String.join(",", unexposedPaperSet))
+                        .eq(ExamTaskDetail::getExamTaskId, examTaskId);
+                examTaskDetailService.update(examTaskDetailUpdateWrapper);
+            }
+        }
         return finalMap;
     }
 
@@ -251,7 +289,7 @@ public class ClientServiceImpl implements ClientService {
         List<ClientPrintTaskDto> pirntTaskDtoList = examPrintPlanService.listClientPrintTask(schoolId, machineCode, printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, orgIds);
         List<Map<String, Object>> finalList = new ArrayList<>();
         for (ClientPrintTaskDto clientPrintTaskDto : pirntTaskDtoList) {
-            Map<String, Object> map = getPrintData(schoolId, Long.valueOf(clientPrintTaskDto.getExamDetailId()), null, null);
+            Map<String, Object> map = getPrintData(schoolId, Long.valueOf(clientPrintTaskDto.getExamDetailId()), null, false, null);
             map.put("examDetailId", clientPrintTaskDto.getExamDetailId());
             finalList.add(map);
         }
@@ -387,12 +425,12 @@ public class ClientServiceImpl implements ClientService {
      *
      * @return
      */
-    public Map<String, Map<String, String>> mapCourseUrl(List<Map<String, String>> mapList) {
+    public Map<String, Map<String, String>> mapCourseUrl(List<Map<String, Object>> mapList) {
         Map<String, Map<String, String>> map = new HashMap<>();
-        for (Map<String, String> taskDetail : mapList) {
-            String courseCode = taskDetail.get("courseCode");
-            String paperNumber = taskDetail.get("paperNumber");
-            String paperAttachmentIds = taskDetail.get("paperAttachmentIds");
+        for (Map<String, Object> taskDetail : mapList) {
+            String courseCode = taskDetail.get("courseCode").toString();
+            String paperNumber = taskDetail.get("paperNumber").toString();
+            String paperAttachmentIds = taskDetail.get("paperAttachmentIds").toString();
             List<Map> attachementIds = JSONObject.parseArray(paperAttachmentIds, Map.class);
             for (Map attaMap : attachementIds) {
                 String name = attaMap.get("name").toString();

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

@@ -33,7 +33,7 @@ public class ExamDetailCourseServiceImpl extends ServiceImpl<ExamDetailCourseMap
     }
 
     @Override
-    public List<Map<String, String>> listByExamDetailId(Long examDetailId) {
+    public List<Map<String, Object>> listByExamDetailId(Long examDetailId) {
         return this.baseMapper.listByExamDetailId(examDetailId, ExamDetailStatusEnum.FINISH.name());
     }
 

+ 4 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java

@@ -503,6 +503,8 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
             String paperNumber = examinationImportDto.getPaperNumber();
             String studentName = examinationImportDto.getStudentName();
             String studentCode = examinationImportDto.getStudentCode();
+            String ticketNumber = examinationImportDto.getTicketNumber();
+            String siteNumber = examinationImportDto.getSiteNumber();
 
             List<FieldsDto> fieldsDtoList = examinationImportDto.getSecondaryFieldList();
             List<ExtendFieldsDto> extendFieldsDtoList = this.getExtendFieldsByFields(fieldsDtoList);
@@ -532,9 +534,9 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
             examStudent.setExamDetailCourseId(examDetailCourseId);
             examStudent.setStudentName(studentName);
             examStudent.setStudentCode(studentCode);
-            examStudent.setTicketNumber(studentCode);
+            examStudent.setTicketNumber(ticketNumber);
             examStudent.setExtendFields(JSON.toJSONString(extendFieldsDtoList));
-            examStudent.setSiteNumber("");
+            examStudent.setSiteNumber(siteNumber);
             examStudent.setCreateId(userId);
             examStudent.setUpdateId(userId);
             examStudentList.add(examStudent);
@@ -624,15 +626,12 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
         return examinationExportDtoList;
     }
 
-    //    @Transactional
     @Override
     public Boolean updatePrintProgress(Long schoolId, Long examDetailId, Integer printProgress) {
         // 更新考场进度、状态
         UpdateWrapper<ExamDetail> updateWrapper = new UpdateWrapper<>();
         updateWrapper.lambda().set(ExamDetail::getPrintProgress, printProgress).set(ExamDetail::getStatus, ExamDetailStatusEnum.FINISH).eq(ExamDetail::getId, examDetailId);
         return this.update(updateWrapper);
-        // todo 更新考生(是否需要这个字段,待定)
-
     }
 
     @Override

+ 28 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamStudentServiceImpl.java

@@ -1,14 +1,19 @@
 package com.qmth.distributed.print.business.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.distributed.print.business.entity.ExamDetailCourse;
 import com.qmth.distributed.print.business.entity.ExamStudent;
 import com.qmth.distributed.print.business.mapper.ExamStudentMapper;
 import com.qmth.distributed.print.business.service.ExamStudentService;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 /**
@@ -29,4 +34,27 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
         updateWrapper.lambda().set(ExamStudent::getPaperType, relatePaperType).in(ExamStudent::getExamDetailCourseId, examDetailCourseIds);
         this.update(updateWrapper);
     }
+
+    @Override
+    public List<String> listByExamDetailCourseId(String examDetailCourseId) {
+        QueryWrapper<ExamStudent> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(ExamStudent::getExamDetailCourseId, examDetailCourseId);
+        List<ExamStudent> examStudents = this.list(queryWrapper);
+        if(!examStudents.isEmpty()){
+            List<String> strings = examStudents.stream().filter(m-> StringUtils.isNotBlank(m.getPaperType())).map(m->m.getPaperType()).distinct().collect(Collectors.toList());
+            return strings;
+        }
+        return null;
+    }
+
+    @Override
+    public Map<String, Object> getStudentDetail(Long id) {
+        Map<String, Object> map = this.baseMapper.getStudentDetail(id);
+        Object extendFields = map.get("extendFields");
+        if(Objects.nonNull(extendFields)){
+            List<Map> list = JSONObject.parseArray(extendFields.toString(), Map.class);
+            map.put("extendFields", list);
+        }
+        return map;
+    }
 }

+ 56 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskDetailServiceImpl.java

@@ -145,19 +145,19 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
         QueryWrapper<ExamTaskDetail> examTaskDetailQueryWrapper = new QueryWrapper<>();
         examTaskDetailQueryWrapper.lambda().eq(ExamTaskDetail::getExamTaskId, examTaskId);
         ExamTaskDetail examTaskDetail = this.getOne(examTaskDetailQueryWrapper);
-        if(examTaskDetail != null){
+        if (examTaskDetail != null) {
             String relatePaperType = examTaskDetail.getRelatePaperType();
-            if(StringUtils.isNotBlank(relatePaperType)){
+            if (StringUtils.isNotBlank(relatePaperType)) {
                 String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
                 List<Map> list = JSONObject.parseArray(paperAttachmentIds, Map.class);
                 String attachmentId = null;
                 for (Map map : list) {
                     String name = map.get("name").toString();
-                    if(relatePaperType.equals(name)){
+                    if (relatePaperType.equals(name)) {
                         attachmentId = map.get("attachmentId").toString();
                     }
                 }
-                if(StringUtils.isNotBlank(attachmentId)){
+                if (StringUtils.isNotBlank(attachmentId)) {
                     return commonService.filePreviewByAttachmentId(Long.valueOf(attachmentId), false);
                 }
             }
@@ -165,4 +165,56 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
         return null;
     }
 
+    @Override
+    public boolean paperUpdate(ExamTaskDetail examTaskDetail) {
+        // todo 前置校验条件,如打印中不能修改
+        QueryWrapper<ExamTaskDetail> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(ExamTaskDetail::getExamTaskId, examTaskDetail.getExamTaskId());
+        ExamTaskDetail examTaskDetailTemp = this.getOne(queryWrapper);
+        if (examTaskDetailTemp == null) {
+            throw ExceptionResultEnum.ERROR.exception("命题任务数据异常");
+        }
+        // 已曝光试卷不能修改
+        String exposedPaperType = examTaskDetailTemp.getExposedPaperType();
+        if (StringUtils.isNotBlank(exposedPaperType)) {
+            List<Map> oldPaperAttachmentIdsList = JSONObject.parseArray(examTaskDetailTemp.getPaperAttachmentIds(), Map.class);
+            Map<String, String> oldPaperAttachmentIdMap = oldPaperAttachmentIdsList.stream().collect(Collectors.toMap(m -> m.get("name").toString(), m -> m.get("attachmentId").toString()));
+            String[] exposedPaperTypes = exposedPaperType.split(",");
+            String newPaperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
+            if (StringUtils.isBlank(newPaperAttachmentIds)) {
+                throw ExceptionResultEnum.ERROR.exception("已曝光试卷不能删除");
+            } else {
+                List<Map> newPaperAttachmentIdsList = JSONObject.parseArray(newPaperAttachmentIds, Map.class);
+                Map<String, String> newPaperAttachmentIdMap = newPaperAttachmentIdsList.stream().collect(Collectors.toMap(m -> m.get("name").toString(), m -> m.get("attachmentId").toString()));
+                for (String paperType : exposedPaperTypes) {
+                    if(!newPaperAttachmentIdMap.containsKey(paperType)){
+                        throw ExceptionResultEnum.ERROR.exception("已曝光试卷不能删除");
+                    } else {
+                        if(!oldPaperAttachmentIdMap.containsKey(paperType)){
+                            throw ExceptionResultEnum.ERROR.exception("原试卷卷型有误");
+                        }
+                        String newAttachmentId = newPaperAttachmentIdMap.get(paperType);
+                        String oldAttachmentId = oldPaperAttachmentIdMap.get(paperType);
+                        if(!newAttachmentId.equals(oldAttachmentId)){
+                            throw ExceptionResultEnum.ERROR.exception("已曝光试卷不能修改");
+                        }
+                    }
+                }
+
+            }
+
+        }
+
+        // 不需要审核,直接更新
+        ExamTask examTask = examTaskService.getById(examTaskDetail.getExamTaskId());
+        if(examTask.getReview()){
+            // todo 加入临时审核表
+        } else {
+            UpdateWrapper<ExamTaskDetail> updateWrapper = new UpdateWrapper<>();
+            updateWrapper.lambda().set(ExamTaskDetail::getPaperAttachmentIds, examTaskDetail.getPaperAttachmentIds()).eq(ExamTaskDetail::getExamTaskId, examTaskDetail.getExamTaskId());
+            this.update(updateWrapper);
+        }
+        return false;
+    }
+
 }

+ 20 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskPaperLogServiceImpl.java

@@ -0,0 +1,20 @@
+package com.qmth.distributed.print.business.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.distributed.print.business.entity.ExamTaskPaperLog;
+import com.qmth.distributed.print.business.mapper.ExamTaskPaperLogMapper;
+import com.qmth.distributed.print.business.service.ExamTaskPaperLogService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 卷库修改审核临时表 服务实现类
+ * </p>
+ *
+ * @author xf
+ * @since 2021-03-23
+ */
+@Service
+public class ExamTaskPaperLogServiceImpl extends ServiceImpl<ExamTaskPaperLogMapper, ExamTaskPaperLog> implements ExamTaskPaperLogService {
+
+}

+ 5 - 1
distributed-print-business/src/main/resources/mapper/ExamDetailCourseMapper.xml

@@ -19,11 +19,15 @@
     </sql>
     <select id="listByExamDetailId" resultType="java.util.Map">
         SELECT
+            a.id examDetailCourseId,
             a.course_code courseCode,
             a.course_name courseName,
             a.paper_number paperNumber,
             c.paper_attachment_ids paperAttachmentIds,
-            d.attachment_id attachmentIds
+            d.attachment_id attachmentIds,
+            b.id examTaskId,
+            c.exposed_paper_type exposedPaperType,
+            c.unexposed_paper_type unexposedPaperType
         FROM
             exam_detail_course a
                 LEFT JOIN

+ 23 - 0
distributed-print-business/src/main/resources/mapper/ExamStudentMapper.xml

@@ -22,5 +22,28 @@
         id,
         school_id, exam_detail_course_id, student_name, student_code, ticket_number, site_number, print_paper, print_card, extend_fields, paper_type
     </sql>
+    <select id="getStudentDetail" resultType="java.util.Map">
+        SELECT
+            a.student_name studentName,
+            a.student_code studentCode,
+            a.ticket_number ticketNumber,
+            a.site_number siteNumber,
+            a.extend_fields extendFields,
+            b.course_code courseCode,
+            b.course_name courseName,
+            b.paper_number paperNumber,
+            c.exam_start_time examStartTime,
+            c.exam_end_time examEndTime,
+            c.exam_place examPlace,
+            c.exam_room examRoom
+        FROM
+            exam_student a
+                LEFT JOIN
+            exam_detail_course b ON a.exam_detail_course_id = b.id
+                LEFT JOIN
+            exam_detail c ON b.exam_detail_id = c.id
+        WHERE
+            a.id = #{id}
+    </select>
 
 </mapper>

+ 4 - 0
distributed-print-business/src/main/resources/mapper/ExamTaskPaperLogMapper.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.qmth.distributed.print.business.mapper.ExamTaskPaperLogMapper">
+</mapper>

+ 2 - 1
distributed-print/src/main/java/com/qmth/distributed/print/api/ClientController.java

@@ -333,8 +333,9 @@ public class ClientController {
     public Result printGetPrintData(@RequestParam("schoolId") Long schoolId,
                                     @RequestParam("examDetailId") Long examDetailId,
                                     @RequestParam("machineCode") String machineCode,
+                                    @RequestParam("isPrint") Boolean isPrint,
                                     @RequestParam(value = "printUser", required = false) String printUser) {
-        Map<String, Object> map = clientService.getPrintData(schoolId, examDetailId, machineCode, printUser);
+        Map<String, Object> map = clientService.getPrintData(schoolId, examDetailId, machineCode, isPrint, printUser);
         return ResultUtil.ok(map);
     }
 

+ 15 - 0
distributed-print/src/main/java/com/qmth/distributed/print/api/ExamDetailController.java

@@ -9,6 +9,7 @@ import com.qmth.distributed.print.business.entity.TBTask;
 import com.qmth.distributed.print.business.enums.TaskTypeEnum;
 import com.qmth.distributed.print.business.service.CommonService;
 import com.qmth.distributed.print.business.service.ExamDetailService;
+import com.qmth.distributed.print.business.service.ExamStudentService;
 import com.qmth.distributed.print.business.service.TBTaskService;
 import com.qmth.distributed.print.business.templete.execute.AsyncExaminationExportTemplateService;
 import com.qmth.distributed.print.business.templete.execute.AsyncExaminationImportTemplateService;
@@ -17,6 +18,7 @@ import com.qmth.distributed.print.common.contant.SystemConstant;
 import com.qmth.distributed.print.common.util.Result;
 import com.qmth.distributed.print.common.util.ResultUtil;
 import io.swagger.annotations.*;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -25,6 +27,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import java.io.IOException;
+import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
@@ -53,6 +56,9 @@ public class ExamDetailController {
     @Resource
     private CommonService commonService;
 
+    @Autowired
+    private ExamStudentService examStudentService;
+
     @ApiOperation(value = "异步考务数据批量导入接口")
     @RequestMapping(value = "/data_import", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = EditResult.class)})
@@ -115,6 +121,15 @@ public class ExamDetailController {
                 courseCode, paperNumber, examPlace, examRoom, studentParams, pageNumber, pageSize));
     }
 
+    @ApiOperation(value = "查看考生明细")
+    @RequestMapping(value = "/get_student_detail", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
+    public Result getStudentDetail(@ApiParam(value = "考生表主键") @RequestParam(required = false) Long id) {
+        Map<String, Object> map = examStudentService.getStudentDetail(id);
+        return ResultUtil.ok(map);
+    }
+
+
     @ApiOperation(value = "考务数据导入-查看明细弹窗")
     @RequestMapping(value = "/data_detail_list", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})

+ 13 - 2
distributed-print/src/main/java/com/qmth/distributed/print/api/ExamTaskController.java

@@ -426,15 +426,26 @@ public class ExamTaskController {
     /**
      * 启用/禁用
      *
-     * @param request
      * @param examTaskDetail
      * @return
      */
     @ApiOperation(value = "启用/禁用")
     @RequestMapping(value = "/paper_enable", method = RequestMethod.POST)
-    public Result taskPaperEnable(HttpServletRequest request, @RequestBody ExamTaskDetail examTaskDetail) {
+    public Result taskPaperEnable(@RequestBody ExamTaskDetail examTaskDetail) {
         boolean isSuccess = examTaskDetailService.enable(examTaskDetail);
         return ResultUtil.ok(isSuccess);
     }
+
+    /**
+     * 卷库修改
+     * @param examTaskDetail
+     * @return
+     */
+    @ApiOperation(value = "卷库修改")
+    @RequestMapping(value = "/paper_update", method = RequestMethod.POST)
+    public Result taskPaperUpdate(@RequestBody ExamTaskDetail examTaskDetail) {
+        boolean isSuccess = examTaskDetailService.paperUpdate(examTaskDetail);
+        return ResultUtil.ok(isSuccess);
+    }
 }