Browse Source

3.4.2 update

xiaofei 8 months ago
parent
commit
f1282e1e3e

+ 3 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/RelatePaperDto.java

@@ -19,7 +19,7 @@ public class RelatePaperDto {
     private String courseCode;
     private String courseName;
     private String paperNumber;
-    private List<String> paperTypes;
+    private List<Integer> paperTypes;
 
     public Long getId() {
         return id;
@@ -69,11 +69,11 @@ public class RelatePaperDto {
         this.paperNumber = paperNumber;
     }
 
-    public List<String> getPaperTypes() {
+    public List<Integer> getPaperTypes() {
         return paperTypes;
     }
 
-    public void setPaperTypes(List<String> paperTypes) {
+    public void setPaperTypes(List<Integer> paperTypes) {
         this.paperTypes = paperTypes;
     }
 }

+ 97 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/ExamTaskApplyPram.java

@@ -0,0 +1,97 @@
+package com.qmth.distributed.print.business.bean.params;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.distributed.print.business.entity.ExamTaskDetail;
+import com.qmth.teachcloud.common.base.BaseEntity;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * <p>
+ * 命题任务
+ * </p>
+ *
+ * @author xf
+ */
+public class ExamTaskApplyPram extends BaseEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "命题任务ID")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long examTaskId;
+
+    @ApiModelProperty(value = "命题任务详情")
+    private List<ExamTaskDetail> examTaskDetailList;
+
+    /**
+     * 保存内容
+     */
+    private String examTaskContent;
+
+    @ApiModelProperty(value = "流程审批人列表")
+    @JsonSerialize(using = ToStringSerializer.class)
+    @TableField(exist = false)
+    private List<Long> approveUserIds;
+
+    @ApiModelProperty(value = "自定义流程id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    @TableField(exist = false)
+    private Long customFlowId;
+
+    @ApiModelProperty(value = "版本号")
+    @TableField(exist = false)
+    private Integer version;
+
+    public Long getExamTaskId() {
+        return examTaskId;
+    }
+
+    public void setExamTaskId(Long examTaskId) {
+        this.examTaskId = examTaskId;
+    }
+
+    public List<ExamTaskDetail> getExamTaskDetailList() {
+        return examTaskDetailList;
+    }
+
+    public void setExamTaskDetailList(List<ExamTaskDetail> examTaskDetailList) {
+        this.examTaskDetailList = examTaskDetailList;
+    }
+
+    public String getExamTaskContent() {
+        return examTaskContent;
+    }
+
+    public void setExamTaskContent(String examTaskContent) {
+        this.examTaskContent = examTaskContent;
+    }
+
+    public List<Long> getApproveUserIds() {
+        return approveUserIds;
+    }
+
+    public void setApproveUserIds(List<Long> approveUserIds) {
+        this.approveUserIds = approveUserIds;
+    }
+
+    public Long getCustomFlowId() {
+        return customFlowId;
+    }
+
+    public void setCustomFlowId(Long customFlowId) {
+        this.customFlowId = customFlowId;
+    }
+
+    public Integer getVersion() {
+        return version;
+    }
+
+    public void setVersion(Integer version) {
+        this.version = version;
+    }
+}

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

@@ -15,7 +15,7 @@ public interface ClientMapper {
     IPage<ClientExamTaskDto> pageTryTask(@Param("page") Page<ClientExamTaskDto> page, @Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("machineCode") String machineCode, @Param("orgId") Long orgId, @Param("printPlanId") Long printPlanId, @Param("courseId") Long courseId, @Param("paperNumber") String paperNumber, @Param("isTry") Boolean isTry, @Param("isPass") Boolean isPass, @Param("printPlanStatus") String printPlanStatus, @Param("examDetailStatus") String[] examDetailStatus);
     List<ClientExamTaskDto> pageTryTask(@Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("machineCode") String machineCode, @Param("orgId") Long orgId, @Param("printPlanId") Long printPlanId, @Param("courseId") Long courseId, @Param("paperNumber") String paperNumber, @Param("isTry") Boolean isTry, @Param("isPass") Boolean isPass, @Param("printPlanStatus") String printPlanStatus, @Param("examDetailStatus") String[] examDetailStatus);
 
-    IPage<ClientPrintTaskDto> listClientPrintTask(@Param("page") Page<ClientPrintTaskDto> page, @Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("machineCode") String machineCode, @Param("printPlanId") String printPlanId, @Param("status") String status, @Param("courseId") Long courseId, @Param("paperNumber") String paperNumber, @Param("examPlace") String examPlace, @Param("examRoom") String examRoom, @Param("examStartTime") Long examStartTime, @Param("examEndTime") Long examEndTime, @Param("isDownload") Boolean isDownload, @Param("validate") Boolean validate, @Param("orgId") Long orgId, @Param("examDetailStatus") String[] examDetailStatus);
+    IPage<ClientPrintTaskDto> listClientPrintTask(@Param("page") Page<ClientPrintTaskDto> page, @Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("machineCode") String machineCode, @Param("printPlanId") String printPlanId, @Param("status") String status, @Param("courseId") Long courseId, @Param("paperNumber") String paperNumber, @Param("examPlace") String examPlace, @Param("examRoom") String examRoom, @Param("examStartTime") Long examStartTime, @Param("examEndTime") Long examEndTime, @Param("isDownload") Boolean isDownload, @Param("validate") Boolean validate, @Param("orgId") Long orgId, @Param("examDetailStatus") String[] examDetailStatus, @Param("orderField") String orderField, @Param("orderType") String orderType);
     List<ClientPrintTaskDto> listClientPrintTask(@Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("machineCode") String machineCode, @Param("printPlanId") String printPlanId, @Param("status") String status, @Param("courseId") Long courseId, @Param("paperNumber") String paperNumber, @Param("examPlace") String examPlace, @Param("examRoom") String examRoom, @Param("examStartTime") Long examStartTime, @Param("examEndTime") Long examEndTime, @Param("isDownload") Boolean isDownload, @Param("validate") Boolean validate, @Param("orgId") Long orgId, @Param("examDetailStatus") String[] examDetailStatus);
 
     ClientPrintTaskTotalDto clientTaskTotalData(@Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("printPlanId") String printPlanId, @Param("status") String status, @Param("courseId") Long courseId, @Param("paperNumber") String paperNumber, @Param("examPlace") String examPlace, @Param("examRoom") String examRoom, @Param("examStartTime") Long examStartTime, @Param("examEndTime") Long examEndTime, @Param("isDownload") Boolean isDownload, @Param("validate") Boolean validate, @Param("machineCode") String machineCode, @Param("orgId") Long orgId, @Param("examDetailStatus") String[] examDetailStatus);

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

@@ -24,7 +24,7 @@ public interface ClientService {
 
     Map<String, Object> getReprintData(Long examDetailId, String studentCode, String type);
 
-    IPage<ClientPrintTaskDto> listClientPrintTask(String machineCode, Long orgId, Long semesterId, Long examId, String printPlanId, String status, Long courseId, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate, Integer pageNumber, Integer pageSize);
+    IPage<ClientPrintTaskDto> listClientPrintTask(String machineCode, Long orgId, Long semesterId, Long examId, String printPlanId, String status, Long courseId, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate, String orderField, String orderType, Integer pageNumber, Integer pageSize);
 
     List<Map<String, Object>> getPrintData(String examDetailId, String machineCode, Boolean isPrint, String printUser);
 

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

@@ -40,7 +40,6 @@ public interface ExamTaskDetailService extends IService<ExamTaskDetail> {
      */
     Map<String, Object> taskRestart(ExamTaskDetail examTaskDetail);
 
-    ExamTaskDetail getByExamTaskIdNotValid(Long examTaskId);
     /**
      * 根据examTaskId下载pdf
      *
@@ -67,4 +66,6 @@ public interface ExamTaskDetailService extends IService<ExamTaskDetail> {
     void updateExposedExamIdById(Long examId, Long id);
 
     ExamTaskDetail findByExamIdAndPaperNumberAndSerialNumber(Long examId, String paperNumber, Integer serialNumber);
+
+    void deleteByExamTaskId(Long examTaskId);
 }

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

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.distributed.print.business.bean.dto.*;
 import com.qmth.distributed.print.business.bean.dto.approvalForm.ExamTaskApprovalFormDto;
 import com.qmth.distributed.print.business.bean.dto.examObject.ExamObjectDto;
+import com.qmth.distributed.print.business.bean.params.ExamTaskApplyPram;
 import com.qmth.distributed.print.business.bean.params.ExamTaskReApplyParam;
 import com.qmth.distributed.print.business.bean.params.ExamTaskSubmitPram;
 import com.qmth.distributed.print.business.bean.params.MakeupExamTaskTotalParam;
@@ -70,7 +71,7 @@ public interface ExamTaskService extends IService<ExamTask> {
 
     List<RelatePaperDto> listPaperTypes(Long examTaskId, Long printPlanId, Long courseId);
 
-    Map<String, Object> saveExamTaskDetail(ExamTaskDetail examTaskDetail) throws IOException;
+    Map<String, Object> saveExamTaskDetail(ExamTaskApplyPram examTaskApplyPram) throws IOException;
 
     Map<String, Object> status(ExamTask examTask);
 

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

@@ -222,12 +222,12 @@ public class ClientServiceImpl implements ClientService {
     }
 
     @Override
-    public IPage<ClientPrintTaskDto> listClientPrintTask(String machineCode, Long orgId, Long semesterId, Long examId, String printPlanId, String status, Long courseId, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate, Integer pageNumber, Integer pageSize) {
+    public IPage<ClientPrintTaskDto> listClientPrintTask(String machineCode, Long orgId, Long semesterId, Long examId, String printPlanId, String status, Long courseId, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate, String orderField, String orderType, Integer pageNumber, Integer pageSize) {
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         Page<ClientPrintTaskDto> page = new Page<>(pageNumber, pageSize);
         // 以下状态考场状态不可查询
         String[] examDetailStatus = new String[]{ExamDetailStatusEnum.NEW.name(), ExamDetailStatusEnum.READY.name(), ExamDetailStatusEnum.CANCEL.name()};
-        IPage<ClientPrintTaskDto> clientPrintTaskDtoIPage = clientMapper.listClientPrintTask(page, schoolId, semesterId, examId, machineCode, printPlanId, status, courseId, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, orgId, examDetailStatus);
+        IPage<ClientPrintTaskDto> clientPrintTaskDtoIPage = clientMapper.listClientPrintTask(page, schoolId, semesterId, examId, machineCode, printPlanId, status, courseId, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, orgId, examDetailStatus, orderField, orderType);
         for (ClientPrintTaskDto record : clientPrintTaskDtoIPage.getRecords()) {
             // 试卷、题卡
             String printContent = record.getPrintContent();

+ 7 - 11
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskDetailServiceImpl.java

@@ -385,17 +385,6 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
         return mapVar;
     }
 
-    @Override
-    public ExamTaskDetail getByExamTaskIdNotValid(Long examTaskId) {
-        ExamTask examTask = examTaskService.getById(examTaskId);
-        if (examTask == null) {
-            throw ExceptionResultEnum.ERROR.exception("命题任务不存在");
-        }
-        QueryWrapper<ExamTaskDetail> queryWrapper = new QueryWrapper<>();
-        queryWrapper.lambda().eq(ExamTaskDetail::getExamTaskId, examTaskId);
-        return this.getOne(queryWrapper);
-    }
-
     /**
      * 根据examTaskId下载pdf
      *
@@ -602,4 +591,11 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
         List<ExamTaskDetail> examTaskDetailList = this.listByExamIdAndPaperNumber(examId, paperNumber);
         return examTaskDetailList.stream().filter(m -> m.getSerialNumber() != null && m.getSerialNumber().equals(serialNumber)).findFirst().orElse(null);
     }
+
+    @Override
+    public void deleteByExamTaskId(Long examTaskId) {
+        UpdateWrapper<ExamTaskDetail> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.lambda().eq(ExamTaskDetail::getExamTaskId, examTaskId);
+        this.remove(updateWrapper);
+    }
 }

+ 68 - 66
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -685,10 +685,10 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                 startTime, endTime, dpr, containsQuestionTeacher, sysUser.getId());
         for (ExamTaskDetailDto record : examTaskDetailDtoIPage.getRecords()) {
             List<ExamTaskDetail> examTaskDetailList = examTaskDetailService.listByExamTaskId(record.getId());
-            record.setPaperType(examTaskDetailList.stream().map(m->m.getSerialNumber().toString()).collect(Collectors.joining(",")));
-            record.setExposedPaperType(examTaskDetailList.stream().filter(ExamTaskDetail::getExposed).map(m->m.getSerialNumber().toString()).collect(Collectors.joining(",")));
+            record.setPaperType(examTaskDetailList.stream().map(m -> m.getSerialNumber().toString()).collect(Collectors.joining(",")));
+            record.setExposedPaperType(examTaskDetailList.stream().filter(ExamTaskDetail::getExposed).map(m -> m.getSerialNumber().toString()).collect(Collectors.joining(",")));
 //            record.setRelatePaperType(examTaskDetailList.stream().filter(m->m.getExposedExamId() != null).map(m->m.getSerialNumber().toString()).collect(Collectors.joining(",")));
-            record.setUnexposedPaperType(examTaskDetailList.stream().filter(m->!m.getExposed()).map(m->m.getSerialNumber().toString()).collect(Collectors.joining(",")));
+            record.setUnexposedPaperType(examTaskDetailList.stream().filter(m -> !m.getExposed()).map(m -> m.getSerialNumber().toString()).collect(Collectors.joining(",")));
         }
         return examTaskDetailDtoIPage;
     }
@@ -703,11 +703,10 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         relatePaperDto.setCourseId(examTask.getCourseId());
         relatePaperDto.setPaperNumber(examTask.getPaperNumber());
 
-        ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskIdNotValid(examTaskId);
-        if (examTaskDetail != null) {
+        List<ExamTaskDetail> examTaskDetailList = examTaskDetailService.listByExamTaskId(examTaskId);
+        if (CollectionUtils.isNotEmpty(examTaskDetailList)) {
             // 所有卷型
-            String paperType = examTaskDetail.getPaperType();
-            relatePaperDto.setPaperTypes(Arrays.asList(paperType.split(",")));
+            relatePaperDto.setPaperTypes(examTaskDetailList.stream().map(ExamTaskDetail::getSerialNumber).collect(Collectors.toList()));
         }
         list.add(relatePaperDto);
         return list;
@@ -715,30 +714,29 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
 
     @Transactional
     @Override
-    public Map<String, Object> saveExamTaskDetail(ExamTaskDetail examTaskDetail) {
+    public Map<String, Object> saveExamTaskDetail(ExamTaskApplyPram examTaskApplyPram) {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        Optional.ofNullable(examTaskDetail.getExamTaskId()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("命题任务ID不能为空"));
+        Optional.ofNullable(examTaskApplyPram.getExamTaskId()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("命题任务ID不能为空"));
         // 更新examTask状态status
-        ExamTask examTask = this.getById(examTaskDetail.getExamTaskId());
+        ExamTask examTask = this.getById(examTaskApplyPram.getExamTaskId());
         // 提交时,校验
         BasicPrintConfig basicPrintConfig = basicPrintConfigService.getByExamId(examTask.getExamId());
         if (basicPrintConfig == null) {
             throw ExceptionResultEnum.ERROR.exception("印品配置未设置");
         }
-        validSubmitParam(examTaskDetail, basicPrintConfig.getPrintContent(), examTask.getOpenAb());
 
         Map<String, Object> map = new HashMap<>();
 //        if (ExamStatusEnum.SUBMIT.name().equals(examTaskDetail.getOperateType()) && examTask.getReview()) {
-            // 审核一级
-            Task task = taskService.createTaskQuery().processInstanceId(String.valueOf(examTask.getFlowId())).singleResult();
-            if (Objects.nonNull(task)) {
-                map.computeIfAbsent(SystemConstant.FLOW_TASK_ID, v -> task.getId());
-                map.computeIfAbsent(SystemConstant.PAPAER_ATTACHMENT_IDS, v -> examTaskDetail.getPaperAttachmentIds());
-                map.computeIfAbsent(SystemConstant.APPROVE_OPERATION, v -> FlowApprovePassEnum.PASS);
-                map.computeIfAbsent(SystemConstant.APPROVE_USER_IDS, v -> examTaskDetail.getApproveUserIds());
-                map = activitiService.taskApprove(map);
-                map.put(SystemConstant.SEND_FLOW_MQ, true);
-            }
+        // 审核一级
+        Task task = taskService.createTaskQuery().processInstanceId(String.valueOf(examTask.getFlowId())).singleResult();
+        if (Objects.nonNull(task)) {
+            map.computeIfAbsent(SystemConstant.FLOW_TASK_ID, v -> task.getId());
+//                map.computeIfAbsent(SystemConstant.PAPAER_ATTACHMENT_IDS, v -> examTaskDetail.getPaperAttachmentIds());
+            map.computeIfAbsent(SystemConstant.APPROVE_OPERATION, v -> FlowApprovePassEnum.PASS);
+//                map.computeIfAbsent(SystemConstant.APPROVE_USER_IDS, v -> examTaskDetail.getApproveUserIds());
+            map = activitiService.taskApprove(map);
+            map.put(SystemConstant.SEND_FLOW_MQ, true);
+        }
 //        }
 
         UpdateWrapper<ExamTask> updateWrapper = new UpdateWrapper<>();
@@ -746,56 +744,60 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
 //                .set(ExamTask::getStatus, examTaskDetail.getOperateType())
                 .set(ExamTask::getUpdateId, sysUser.getId())
                 .set(ExamTask::getUpdateTime, System.currentTimeMillis())
-                .set(ExamTask::getReviewStatus, null)
-                .set(ExamTask::getFlowId, examTask.getFlowId())
-                .set(ExamTask::getExamTaskContent, examTaskDetail.getExamTaskContent())
+                .set(ExamTask::getExamTaskContent, examTaskApplyPram.getExamTaskContent())
                 .eq(ExamTask::getId, examTask.getId());
         this.update(updateWrapper);
 
-        ExamTaskDetail detail = examTaskDetailService.getByExamTaskIdNotValid(examTaskDetail.getExamTaskId());
-        if (detail != null) {
-            examTaskDetail.setId(detail.getId());
-            // 已曝光试卷和未曝光试卷赋值
-            examTaskDetail.setExposedPaperType(detail.getExposedPaperType());
-            if (StringUtils.isNotBlank(detail.getExposedPaperType())) {
-                List<String> paperTypeAll = new ArrayList<>(Arrays.asList(examTaskDetail.getPaperType().split(",")));
-                List<String> exposePaperTypes = Arrays.asList(detail.getExposedPaperType().split(","));
-                for (String exposePaperType : exposePaperTypes) {
-                    if (paperTypeAll.contains(exposePaperType)) {
-                        paperTypeAll.remove(exposePaperType);
-                    }
-                }
-                examTaskDetail.setUnexposedPaperType(String.join(",", paperTypeAll));
-            } else {
-                examTaskDetail.setUnexposedPaperType(examTaskDetail.getPaperType());
-            }
-        } else {
+        examTaskDetailService.deleteByExamTaskId(examTaskApplyPram.getExamTaskId());
+        // 新建试卷
+        List<ExamTaskDetail> examTaskDetailList = examTaskApplyPram.getExamTaskDetailList();
+        for (ExamTaskDetail examTaskDetail : examTaskDetailList) {
+            validSubmitParam(examTaskDetail, basicPrintConfig.getPrintContent(), examTask.getOpenAb());
             // 已曝光试卷和未曝光试卷赋值(新增时,已曝光试卷为null,未曝光试卷为paper_type)
+            examTaskDetail.setId(SystemConstant.getDbUuid());
             examTaskDetail.setUnexposedPaperType(examTaskDetail.getPaperType());
-        }
-        examTaskDetail.setUpdateId(sysUser.getId());
-        examTaskDetail.setUpdateTime(System.currentTimeMillis());
-
-        List<PaperInfoVo> filePathVoList = examTaskDetail.getPaperInfoVoList();
-        for (PaperInfoVo paperInfoVo : filePathVoList) {
-            BasicAttachment basicAttachment = basicAttachmentService.getById(paperInfoVo.getAttachmentId());
-            FilePathVo filePathVo = JSON.parseObject(basicAttachment.getPath(), FilePathVo.class);
-            InputStream inputStream = fileUploadService.downloadFile(filePathVo.getPath(), filePathVo.getUploadType(), filePathVo.getType());
-            List<ConvertJpgStorage> convertJpgStorageList = htmlToJpgUtil.convertPdfToJpg(Long.valueOf(paperInfoVo.getAttachmentId()), inputStream, sysUser.getId());
-            if (convertJpgStorageList.size() > 0) {
-                paperInfoVo.setJpgAttachmentId(JSON.toJSONString(convertJpgStorageList));
-            } else {
-                paperInfoVo.setJpgAttachmentId(null);
+            examTaskDetail.setExamTaskId(examTask.getId());
+            examTaskDetail.insertInfo(sysUser.getId());
+            List<PaperInfoVo> filePathVoList = examTaskDetail.getPaperInfoVoList();
+            for (PaperInfoVo paperInfoVo : filePathVoList) {
+                BasicAttachment basicAttachment = basicAttachmentService.getById(paperInfoVo.getAttachmentId());
+                FilePathVo filePathVo = JSON.parseObject(basicAttachment.getPath(), FilePathVo.class);
+                InputStream inputStream = fileUploadService.downloadFile(filePathVo.getPath(), filePathVo.getUploadType(), filePathVo.getType());
+                List<ConvertJpgStorage> convertJpgStorageList = htmlToJpgUtil.convertPdfToJpg(Long.valueOf(paperInfoVo.getAttachmentId()), inputStream, sysUser.getId());
+                if (convertJpgStorageList.size() > 0) {
+                    paperInfoVo.setJpgAttachmentId(JSON.toJSONString(convertJpgStorageList));
+                } else {
+                    paperInfoVo.setJpgAttachmentId(null);
+                }
             }
-        }
-        examTaskDetail.setPaperAttachmentIds(JSON.toJSONString(filePathVoList));
-        examTaskDetailService.saveOrUpdate(examTaskDetail);
+            examTaskDetail.setPaperAttachmentIds(JSON.toJSONString(filePathVoList));
+            examTaskDetailService.save(examTaskDetail);
 
-        // 将题卡更新为已绑定
-        List<PaperInfoVo> paperAttachmentList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
-        examCardService.updateUsedById(paperAttachmentList.stream().filter(m -> StringUtils.isNotBlank(m.getCardId())).map(m -> Long.parseLong(m.getCardId())).collect(Collectors.toList()));
-
-        ExamTaskSubmitContent examTaskSubmitContent = JSON.parseObject(examTaskDetail.getExamTaskContent(), ExamTaskSubmitContent.class);
+            String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
+            List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(paperAttachmentIds);
+            // 将题卡更新为已绑定
+            examCardService.updateUsedById(paperInfoVoList.stream().filter(m -> StringUtils.isNotBlank(m.getCardId())).map(m -> Long.parseLong(m.getCardId())).collect(Collectors.toList()));
+            // 更新题库试卷表
+            for (PaperInfoVo paperInfoVo : paperInfoVoList) {
+                if (StringUtils.isNotBlank(paperInfoVo.getUuid())) {
+                    UpdateWrapper<ExamTaskPaperData> updateWrapper1 = new UpdateWrapper<>();
+                    updateWrapper1.lambda().set(ExamTaskPaperData::getPaperNumber, examTask.getPaperNumber())
+                            .eq(ExamTaskPaperData::getExamId, examTask.getExamId())
+                            .eq(ExamTaskPaperData::getPaperNumber, paperInfoVo.getUuid())
+                            .eq(ExamTaskPaperData::getPaperId, paperInfoVo.getPaperId())
+                            .eq(ExamTaskPaperData::getUuid, paperInfoVo.getUuid());
+                    examTaskPaperDataService.update(updateWrapper1);
+
+                    // 删除临时数据
+                    QueryWrapper<ExamTaskPaperData> deleteWrapper = new QueryWrapper<>();
+                    deleteWrapper.lambda().eq(ExamTaskPaperData::getExamId, examTask.getExamId())
+                            .eq(ExamTaskPaperData::getPaperNumber, paperInfoVo.getUuid())
+                            .ne(ExamTaskPaperData::getPaperId, paperInfoVo.getPaperId());
+                    examTaskPaperDataService.remove(deleteWrapper);
+                }
+            }
+        }
+        ExamTaskSubmitContent examTaskSubmitContent = JSON.parseObject(examTaskApplyPram.getExamTaskContent(), ExamTaskSubmitContent.class);
         if (examTaskSubmitContent != null) {
             List<ExamDetailCourse> examDetailCourseList = examDetailCourseService.listByExamIdAndPaperNumber(examTask.getExamId(), examTask.getPaperNumber());
             if (CollectionUtils.isNotEmpty(examDetailCourseList)) {
@@ -1044,8 +1046,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
     @Transactional
     @Override
     public void removeByExamTaskId(Long examTaskId) {
-        ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskIdNotValid(examTaskId);
-        if (examTaskDetail != null) {
+        List<ExamTaskDetail> examTaskDetailList = examTaskDetailService.listByExamTaskId(examTaskId);
+        for (ExamTaskDetail examTaskDetail : examTaskDetailList) {
             examTaskDetailService.removeById(examTaskDetail.getId());
 
             // 题卡更新为未使用

+ 1 - 1
distributed-print-business/src/main/resources/db/log/xf.sql

@@ -56,4 +56,4 @@ CREATE TABLE `mark_question_answer` (
     COMMENT = '客观题信息';
 
 -- 2024-10-21
-ALTER TABLE `exam_task` ADD COLUMN `exam_task_detail_enable` TINYINT(1) NULL COMMENT '卷库启用禁用状态。是否启用,false:停用,true:启用' AFTER `enable`;
+ALTER TABLE `exam_task` ADD COLUMN `exam_task_detail_enable` TINYINT(1) NULL DEFAULT 0 COMMENT '卷库启用禁用状态。是否启用,false:停用,true:启用' AFTER `enable`;

+ 13 - 1
distributed-print-business/src/main/resources/mapper/ClientMapper.xml

@@ -224,7 +224,19 @@
                 </if>
             </if>
         </where>
-        ORDER BY a.id DESC , b.id DESC
+        <if test="orderType != null and orderType != '' and orderField != null and orderField != ''">
+            <choose>
+                <when test="orderField == 'examDate'">
+                    order by b.exam_start_time #{orderType}
+                </when>
+                <otherwise>
+                    order by #{orderField} #{orderType}
+                </otherwise>
+            </choose>
+        </if>
+        <if test="orderType == null or orderType == '' or orderField == null or orderField == ''">
+            ORDER BY a.id DESC , b.id DESC
+        </if>
     </select>
     <select id="clientTaskTotalData" resultType="com.qmth.distributed.print.business.bean.dto.ClientPrintTaskTotalDto">
         SELECT

+ 4 - 3
distributed-print/src/main/java/com/qmth/distributed/print/api/ExamTaskApplyController.java

@@ -3,6 +3,7 @@ package com.qmth.distributed.print.api;
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.distributed.print.business.bean.dto.ExamTaskDetailCardDto;
 import com.qmth.distributed.print.business.bean.params.ApproveFormParams;
+import com.qmth.distributed.print.business.bean.params.ExamTaskApplyPram;
 import com.qmth.distributed.print.business.bean.params.ExamTaskSubmitPram;
 import com.qmth.distributed.print.business.entity.ExamTask;
 import com.qmth.distributed.print.business.entity.ExamTaskDetail;
@@ -146,9 +147,9 @@ public class ExamTaskApplyController {
     @ApiOperation(value = "入库申请-暂存/提交")
     @RequestMapping(value = "/apply_save", method = RequestMethod.POST)
     @OperationLogDetail(operationType = OperationTypeEnum.SAVE, detail = "提交操作,命题任务ID:{{examTaskDetail.examTaskId}}")
-    public Result taskApplySave(@RequestBody ExamTaskDetail examTaskDetail) throws IOException {
-        Map<String, Object> map = examTaskService.saveExamTaskDetail(examTaskDetail);
-        ExamTask examTask = examTaskService.getById(examTaskDetail.getExamTaskId());
+    public Result taskApplySave(@RequestBody ExamTaskApplyPram examTaskApplyPram) throws IOException {
+        Map<String, Object> map = examTaskService.saveExamTaskDetail(examTaskApplyPram);
+        ExamTask examTask = examTaskService.getById(examTaskApplyPram.getExamTaskId());
         if ((Objects.nonNull(examTask.getReview()) && !examTask.getReview())) {
             // 校验是否可以提交打印状态
             printCommonService.checkExamDataAndCreatePdfTask(examTask.getSchoolId(), examTask.getExamId(), examTask.getCourseId(), examTask.getPaperNumber(), (SysUser) ServletUtil.getRequestUser());

+ 3 - 1
distributed-print/src/main/java/com/qmth/distributed/print/api/client/PrintController.java

@@ -125,9 +125,11 @@ public class PrintController {
                                 @ApiParam(value = "考试时间(结束)") @RequestParam(value = "examEndTime", required = false) Long examEndTime,
                                 @ApiParam(value = "是否缓存") @RequestParam(value = "isDownload", required = false) Boolean isDownload,
                                 @ApiParam(value = "是否校验") @RequestParam(value = "validate", required = false) Boolean validate,
+                                @ApiParam(value = "排序方式") @RequestParam(required = false) String orderType,
+                                @ApiParam(value = "排序字段") @RequestParam(required = false) String orderField,
                                 @ApiParam(value = "分页参数") @RequestParam Integer pageNumber,
                                 @ApiParam(value = "分页参数") @RequestParam Integer pageSize) {
-        IPage<ClientPrintTaskDto> printTaskDtoIPage = clientService.listClientPrintTask(machineCode, orgId, semesterId, examId, printPlanId, status, courseId, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, pageNumber, pageSize);
+        IPage<ClientPrintTaskDto> printTaskDtoIPage = clientService.listClientPrintTask(machineCode, orgId, semesterId, examId, printPlanId, status, courseId, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, orderField, orderType, pageNumber, pageSize);
         return ResultUtil.ok(printTaskDtoIPage);
     }