Browse Source

3.3.0 PaperInfoVo

xiaofei 1 year ago
parent
commit
12e3e3ccbd
16 changed files with 189 additions and 364 deletions
  1. 0 101
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ExamPaperInfoDto.java
  2. 0 60
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/Original.java
  3. 0 26
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/ExamTaskDetail.java
  4. 8 8
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ActivitiServiceImpl.java
  5. 11 9
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/DownloadServiceImpl.java
  6. 5 5
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java
  7. 13 17
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamPaperStructureServiceImpl.java
  8. 19 21
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskDetailServiceImpl.java
  9. 32 35
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java
  10. 32 34
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java
  11. 14 12
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePdfUtil.java
  12. 1 1
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/vo/OriginalVo.java
  13. 4 4
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/vo/PaperInfoVo.java
  14. 0 28
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/ConvertUtil.java
  15. 47 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/ExamTaskUtil.java
  16. 3 3
      teachcloud-task/src/main/java/com/qmth/teachcloud/task/service/impl/PrintFinishServiceImpl.java

+ 0 - 101
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ExamPaperInfoDto.java

@@ -1,101 +0,0 @@
-package com.qmth.distributed.print.business.bean.dto;
-
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModelProperty;
-
-/**
- * @Description: 考试试卷题卡信息对象
- * @Author: CaoZixuan
- * @Date: 2022-09-01
- */
-public class ExamPaperInfoDto {
-
-    @ApiModelProperty("卷型")
-    private String name;
-
-    @ApiModelProperty("附件id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    private Long attachmentId;
-
-    @ApiModelProperty("试卷文件名称")
-    private String filename;
-
-    @ApiModelProperty("试卷页数")
-    private Integer pages;
-
-    private Boolean canDelete;
-
-    private Boolean isExposed;
-
-    @ApiModelProperty("题卡主键")
-    @JsonSerialize(using = ToStringSerializer.class)
-    private Long cardId;
-
-    @ApiModelProperty("原卷")
-    private Original original;
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public Long getAttachmentId() {
-        return attachmentId;
-    }
-
-    public void setAttachmentId(Long attachmentId) {
-        this.attachmentId = attachmentId;
-    }
-
-    public String getFilename() {
-        return filename;
-    }
-
-    public void setFilename(String filename) {
-        this.filename = filename;
-    }
-
-    public Integer getPages() {
-        return pages;
-    }
-
-    public void setPages(Integer pages) {
-        this.pages = pages;
-    }
-
-    public Boolean getCanDelete() {
-        return canDelete;
-    }
-
-    public void setCanDelete(Boolean canDelete) {
-        this.canDelete = canDelete;
-    }
-
-    public Boolean getExposed() {
-        return isExposed;
-    }
-
-    public void setExposed(Boolean exposed) {
-        isExposed = exposed;
-    }
-
-    public Long getCardId() {
-        return cardId;
-    }
-
-    public void setCardId(Long cardId) {
-        this.cardId = cardId;
-    }
-
-    public Original getOriginal() {
-        return original;
-    }
-
-    public void setOriginal(Original original) {
-        this.original = original;
-    }
-}

+ 0 - 60
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/Original.java

@@ -1,60 +0,0 @@
-package com.qmth.distributed.print.business.bean.dto;
-
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import com.qmth.teachcloud.common.enums.PageSizeEnum;
-import io.swagger.annotations.ApiModelProperty;
-
-/**
- * @Description: 试卷转换前记录
- * @Author: CaoZixuan
- * @Date: 2022-09-01
- */
-public class Original {
-    @JsonSerialize(using = ToStringSerializer.class)
-    @ApiModelProperty("原始卷附件id")
-    private Long id;
-
-    @JsonSerialize(using = ToStringSerializer.class)
-    @ApiModelProperty("更新时间")
-    private Long updateTime;
-
-    @ApiModelProperty("页数")
-    private Integer pages;
-
-    @ApiModelProperty("试卷纸张类型")
-    private PageSizeEnum pageSize;
-
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public Long getUpdateTime() {
-        return updateTime;
-    }
-
-    public void setUpdateTime(Long updateTime) {
-        this.updateTime = updateTime;
-    }
-
-    public Integer getPages() {
-        return pages;
-    }
-
-    public void setPages(Integer pages) {
-        this.pages = pages;
-    }
-
-    public PageSizeEnum getPageSize() {
-        return pageSize;
-    }
-
-    public void setPageSize(PageSizeEnum pageSize) {
-        this.pageSize = pageSize;
-    }
-}

+ 0 - 26
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/ExamTaskDetail.java

@@ -1,21 +1,15 @@
 package com.qmth.distributed.print.business.entity;
 package com.qmth.distributed.print.business.entity;
 
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.annotation.FieldStrategy;
 import com.baomidou.mybatisplus.annotation.FieldStrategy;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import com.qmth.distributed.print.business.bean.vo.PaperInfoVo;
 import com.qmth.teachcloud.common.base.BaseEntity;
 import com.qmth.teachcloud.common.base.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
-import org.apache.commons.lang3.StringUtils;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 import java.util.List;
-import java.util.stream.Collectors;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -199,24 +193,4 @@ public class ExamTaskDetail extends BaseEntity implements Serializable {
     public void setOperateType(String operateType) {
     public void setOperateType(String operateType) {
         this.operateType = operateType;
         this.operateType = operateType;
     }
     }
-
-    /**
-     * 解析试卷数据,指定了paperTypes,则返回对应卷型对象,为空,返回所有卷型对象
-     *
-     * @param path       试卷json
-     * @param paperTypes 指定卷型(可为空)
-     */
-    public static List<PaperInfoVo> parsePaperAttachmentPath(String path, String paperTypes) {
-        List<PaperInfoVo> paperInfoVos = new ArrayList<>();
-        if (StringUtils.isNotBlank(path)) {
-            paperInfoVos = JSON.parseArray(path, PaperInfoVo.class);
-            if (StringUtils.isBlank(paperTypes)) {
-                return paperInfoVos;
-            } else {
-                List<String> paperTypeList = Arrays.asList(paperTypes.split(","));
-                paperInfoVos = paperInfoVos.stream().filter(m -> paperTypeList.contains(m.getName())).collect(Collectors.toList());
-            }
-        }
-        return paperInfoVos;
-    }
 }
 }

+ 8 - 8
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ActivitiServiceImpl.java

@@ -1,7 +1,6 @@
 package com.qmth.distributed.print.business.service.impl;
 package com.qmth.distributed.print.business.service.impl;
 
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.google.gson.Gson;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 import com.google.gson.reflect.TypeToken;
@@ -16,6 +15,7 @@ import com.qmth.distributed.print.business.bean.flow.dto.StandardFlowWorkMsg;
 import com.qmth.distributed.print.business.bean.flow.link.FlowTaskLink;
 import com.qmth.distributed.print.business.bean.flow.link.FlowTaskLink;
 import com.qmth.distributed.print.business.bean.flow.link.FlowTaskNode;
 import com.qmth.distributed.print.business.bean.flow.link.FlowTaskNode;
 import com.qmth.distributed.print.business.bean.result.*;
 import com.qmth.distributed.print.business.bean.result.*;
+import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.*;
 import com.qmth.distributed.print.business.enums.*;
 import com.qmth.distributed.print.business.service.*;
 import com.qmth.distributed.print.business.service.*;
@@ -840,15 +840,15 @@ public class ActivitiServiceImpl implements ActivitiService {
             ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskId(examTask.getId());
             ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskId(examTask.getId());
             String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
             String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
             if (StringUtils.isNotBlank(paperAttachmentIds)) {
             if (StringUtils.isNotBlank(paperAttachmentIds)) {
-                List<JSONObject> objects = JSON.parseArray(paperAttachmentIds, JSONObject.class);
+                List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(paperAttachmentIds);
                 List<Long> cardIds = new ArrayList<>();
                 List<Long> cardIds = new ArrayList<>();
-                for (JSONObject object : objects) {
-                    cardIds.add(object.getLong("cardId"));
-                    object.put("cardId", "");
-                    object.put("cardType", "");
-                    object.put("cardTitle", "");
+                for (PaperInfoVo paperInfoVo : paperInfoVoList) {
+                    cardIds.add(paperInfoVo.getCardId());
+                    paperInfoVo.setCardId(null);
+                    paperInfoVo.setCardType(null);
+                    paperInfoVo.setCardTitle(null);
                 }
                 }
-                examTaskDetail.setPaperAttachmentIds(JSON.toJSONString(objects));
+                examTaskDetail.setPaperAttachmentIds(JSON.toJSONString(paperInfoVoList));
                 examTaskDetailService.updateById(examTaskDetail);
                 examTaskDetailService.updateById(examTaskDetail);
 
 
                 // 更新题卡为未使用
                 // 更新题卡为未使用

+ 11 - 9
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/DownloadServiceImpl.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.distributed.print.business.bean.dto.*;
 import com.qmth.distributed.print.business.bean.dto.*;
+import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.MakeMethodEnum;
 import com.qmth.distributed.print.business.enums.MakeMethodEnum;
 import com.qmth.distributed.print.business.mapper.ExamCardMapper;
 import com.qmth.distributed.print.business.mapper.ExamCardMapper;
@@ -26,6 +27,7 @@ import com.qmth.teachcloud.common.enums.PageSizeEnum;
 import com.qmth.teachcloud.common.mapper.BasicAttachmentMapper;
 import com.qmth.teachcloud.common.mapper.BasicAttachmentMapper;
 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.ExamTaskUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
@@ -106,7 +108,7 @@ public class DownloadServiceImpl implements DownloadService {
         if (StringUtils.isBlank(unexposedPaperType)) {
         if (StringUtils.isBlank(unexposedPaperType)) {
             throw ExceptionResultEnum.ERROR.exception("没有未曝光试卷,无法下载");
             throw ExceptionResultEnum.ERROR.exception("没有未曝光试卷,无法下载");
         }
         }
-        String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
+
 
 
         // 收集处理试卷和题卡
         // 收集处理试卷和题卡
         // 本地存储目录
         // 本地存储目录
@@ -117,12 +119,12 @@ public class DownloadServiceImpl implements DownloadService {
             rootPath = fileTemp.getParent() + File.separator + System.currentTimeMillis();
             rootPath = fileTemp.getParent() + File.separator + System.currentTimeMillis();
             List<File> fileList = new ArrayList<>();
             List<File> fileList = new ArrayList<>();
             List<String> unexposedPaperTypes = Arrays.asList(unexposedPaperType.split(","));
             List<String> unexposedPaperTypes = Arrays.asList(unexposedPaperType.split(","));
-            List<ExamPaperInfoDto> paperInfoDtoList = JSONObject.parseArray(paperAttachmentIds, ExamPaperInfoDto.class);
+            List<PaperInfoVo> paperInfoDtoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
             if (CollectionUtils.isEmpty(paperInfoDtoList)) {
             if (CollectionUtils.isEmpty(paperInfoDtoList)) {
                 throw ExceptionResultEnum.ERROR.exception("试卷信息不存在");
                 throw ExceptionResultEnum.ERROR.exception("试卷信息不存在");
             }
             }
 
 
-            for (ExamPaperInfoDto paperInfo : paperInfoDtoList) {
+            for (PaperInfoVo paperInfo : paperInfoDtoList) {
                 String paperType = paperInfo.getName();
                 String paperType = paperInfo.getName();
                 if (!unexposedPaperTypes.contains(paperType)) {
                 if (!unexposedPaperTypes.contains(paperType)) {
                     continue;
                     continue;
@@ -244,14 +246,14 @@ public class DownloadServiceImpl implements DownloadService {
                 List<String> exposedPaperTypeList = Arrays.asList(examTaskDetailDto.getExposedPaperType().split(","));
                 List<String> exposedPaperTypeList = Arrays.asList(examTaskDetailDto.getExposedPaperType().split(","));
                 List<String> unexposedPaperTypeList = Arrays.asList(examTaskDetailDto.getUnexposedPaperType().split(","));
                 List<String> unexposedPaperTypeList = Arrays.asList(examTaskDetailDto.getUnexposedPaperType().split(","));
 
 
-                List<ExamPaperInfoDto> paperInfo = JSONObject.parseArray(examTaskDetailDto.getPaperAttachmentIds(), ExamPaperInfoDto.class);
-                if (Objects.isNull(paperInfo)) {
+                List<PaperInfoVo> paperInfoVos = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetailDto.getPaperAttachmentIds());
+                if (CollectionUtils.isEmpty(paperInfoVos)) {
                     throw ExceptionResultEnum.ERROR.exception("试卷信息不存在");
                     throw ExceptionResultEnum.ERROR.exception("试卷信息不存在");
                 }
                 }
                 // 试卷信息
                 // 试卷信息
-                for (ExamPaperInfoDto paper : paperInfo) {
-                    Long cardId = paper.getCardId();
-                    Long attachmentId = paper.getAttachmentId();
+                for (PaperInfoVo paperInfoVo : paperInfoVos) {
+                    Long cardId = paperInfoVo.getCardId();
+                    Long attachmentId = paperInfoVo.getAttachmentId();
                     BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
                     BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
                     String paperName = null;
                     String paperName = null;
                     String paperSuffix = null;
                     String paperSuffix = null;
@@ -262,7 +264,7 @@ public class DownloadServiceImpl implements DownloadService {
                         JSONObject jsonObject = JSONObject.parseObject(basicAttachment.getPath());
                         JSONObject jsonObject = JSONObject.parseObject(basicAttachment.getPath());
                         paperPath = (String) jsonObject.get(SystemConstant.PATH);
                         paperPath = (String) jsonObject.get(SystemConstant.PATH);
                     }
                     }
-                    String paperType = paper.getName();
+                    String paperType = paperInfoVo.getName();
 
 
                     boolean exposureStatus;
                     boolean exposureStatus;
                     if (exposedPaperTypeList.contains(paperType)) {
                     if (exposedPaperTypeList.contains(paperType)) {

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

@@ -17,6 +17,7 @@ import com.qmth.distributed.print.business.bean.examRule.FieldsDto;
 import com.qmth.distributed.print.business.bean.result.ExaminationDetailResult;
 import com.qmth.distributed.print.business.bean.result.ExaminationDetailResult;
 import com.qmth.distributed.print.business.bean.result.ExaminationResult;
 import com.qmth.distributed.print.business.bean.result.ExaminationResult;
 import com.qmth.distributed.print.business.bean.result.SummarizedDataResult;
 import com.qmth.distributed.print.business.bean.result.SummarizedDataResult;
+import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.*;
 import com.qmth.distributed.print.business.enums.*;
 import com.qmth.distributed.print.business.mapper.ExamDetailMapper;
 import com.qmth.distributed.print.business.mapper.ExamDetailMapper;
@@ -378,11 +379,10 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
                     ExamTask examTask = examTaskService.getByCourseCodeAndPaperNumber(schoolId, examinationResult.getExamId(), examDetailCourse.getCourseCode(), examDetailCourse.getPaperNumber());
                     ExamTask examTask = examTaskService.getByCourseCodeAndPaperNumber(schoolId, examinationResult.getExamId(), examDetailCourse.getCourseCode(), examDetailCourse.getPaperNumber());
                     ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskId(examTask.getId());
                     ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskId(examTask.getId());
                     String paperType = examDetailCourse.getPaperType();
                     String paperType = examDetailCourse.getPaperType();
-                    List<String> paperTypes = Arrays.asList(paperType.split(","));
-                    List<JSONObject> paperAttachments = JSON.parseArray(examTaskDetail.getPaperAttachmentIds(), JSONObject.class).stream().filter(m -> paperTypes.contains(m.getString("name"))).collect(Collectors.toList());
-                    for (JSONObject jsonObject : paperAttachments) {
-                        String cardTypeString = jsonObject.getString("cardType");
-                        String createMethod = jsonObject.getString("createMethod");
+                    List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds(), paperType);
+                    for (PaperInfoVo paperInfoVo : paperInfoVoList) {
+                        String cardTypeString = paperInfoVo.getCardType();
+                        String createMethod = paperInfoVo.getCreateMethod();
                         if (cardTypeString.equals(CardTypeEnum.GENERIC.name()) && StringUtils.isNotBlank(createMethod) && createMethod.equals(CardCreateMethodEnum.UPLOAD.name())) {
                         if (cardTypeString.equals(CardTypeEnum.GENERIC.name()) && StringUtils.isNotBlank(createMethod) && createMethod.equals(CardCreateMethodEnum.UPLOAD.name())) {
                             stringSet.add(SyncCardTypeEnum.GENERIC.getDesc());
                             stringSet.add(SyncCardTypeEnum.GENERIC.getDesc());
                         } else {
                         } else {

+ 13 - 17
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamPaperStructureServiceImpl.java

@@ -1,7 +1,6 @@
 package com.qmth.distributed.print.business.service.impl;
 package com.qmth.distributed.print.business.service.impl;
 
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -15,6 +14,7 @@ import com.qmth.distributed.print.business.bean.dto.ExamPaperStructureDto;
 import com.qmth.distributed.print.business.bean.dto.ExamPaperStructurePageDto;
 import com.qmth.distributed.print.business.bean.dto.ExamPaperStructurePageDto;
 import com.qmth.distributed.print.business.bean.dto.ExamPaperSubjectiveStructureDto;
 import com.qmth.distributed.print.business.bean.dto.ExamPaperSubjectiveStructureDto;
 import com.qmth.distributed.print.business.bean.marking.*;
 import com.qmth.distributed.print.business.bean.marking.*;
+import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.ExamPaperStructureStatusTypeEnum;
 import com.qmth.distributed.print.business.enums.ExamPaperStructureStatusTypeEnum;
 import com.qmth.distributed.print.business.enums.ExamTaskSyncStatusEnum;
 import com.qmth.distributed.print.business.enums.ExamTaskSyncStatusEnum;
@@ -33,15 +33,16 @@ import com.qmth.teachcloud.common.enums.PushTypeEnum;
 import com.qmth.teachcloud.common.enums.QuestionType;
 import com.qmth.teachcloud.common.enums.QuestionType;
 import com.qmth.teachcloud.common.enums.UploadFileEnum;
 import com.qmth.teachcloud.common.enums.UploadFileEnum;
 import com.qmth.teachcloud.common.service.*;
 import com.qmth.teachcloud.common.service.*;
+import com.qmth.teachcloud.common.util.ExamTaskUtil;
 import com.qmth.teachcloud.common.util.ExcelUtil;
 import com.qmth.teachcloud.common.util.ExcelUtil;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.common.util.excel.ExcelError;
 import com.qmth.teachcloud.common.util.excel.ExcelError;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
 import org.springframework.util.DigestUtils;
 import org.springframework.util.DigestUtils;
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
@@ -135,10 +136,9 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
             ExamTaskDetail examTaskDetail = examTaskDetailService.getOne(new QueryWrapper<ExamTaskDetail>().lambda()
             ExamTaskDetail examTaskDetail = examTaskDetailService.getOne(new QueryWrapper<ExamTaskDetail>().lambda()
                     .eq(ExamTaskDetail::getExamTaskId, m.getExamTaskId()));
                     .eq(ExamTaskDetail::getExamTaskId, m.getExamTaskId()));
             if (examTaskDetail != null && StringUtils.isNotBlank(examTaskDetail.getPaperAttachmentIds())) {
             if (examTaskDetail != null && StringUtils.isNotBlank(examTaskDetail.getPaperAttachmentIds())) {
-                List<JSONObject> jsonObjectList = JSON.parseArray(examTaskDetail.getPaperAttachmentIds(), JSONObject.class);
-                Optional<JSONObject> objectOptional = jsonObjectList.stream().filter(t -> m.getPaperType().equals(t.getString("name"))).findFirst();
-                if (objectOptional.isPresent()) {
-                    m.setCardId(objectOptional.get().getString("cardId"));
+                List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds(), m.getPaperType());
+                if (CollectionUtils.isNotEmpty(paperInfoVoList)) {
+                    m.setCardId(String.valueOf(paperInfoVoList.get(0).getCardId()));
                 }
                 }
             }
             }
         });
         });
@@ -390,21 +390,18 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
                 .eq(ExamTask::getExamId, examId)
                 .eq(ExamTask::getExamId, examId)
                 .eq(ExamTask::getCourseCode, courseCode)
                 .eq(ExamTask::getCourseCode, courseCode)
                 .eq(ExamTask::getPaperNumber, paperNumber)).getId();
                 .eq(ExamTask::getPaperNumber, paperNumber)).getId();
-//        Long cardId = examTaskDetailService.getOne(new QueryWrapper<ExamTaskDetail>().lambda()
-//                .eq(ExamTaskDetail::getExamTaskId, examTaskId)).getCardId();
         ExamTaskDetail examTaskDetail = examTaskDetailService.getOne(new QueryWrapper<ExamTaskDetail>().lambda()
         ExamTaskDetail examTaskDetail = examTaskDetailService.getOne(new QueryWrapper<ExamTaskDetail>().lambda()
                 .eq(ExamTaskDetail::getExamTaskId, examTaskId));
                 .eq(ExamTaskDetail::getExamTaskId, examTaskId));
         List<CardJpgResult> cardJpgResultList = new ArrayList<>();
         List<CardJpgResult> cardJpgResultList = new ArrayList<>();
         if (Objects.nonNull(examTaskDetail) && Objects.nonNull(examTaskDetail.getPaperAttachmentIds())) {
         if (Objects.nonNull(examTaskDetail) && Objects.nonNull(examTaskDetail.getPaperAttachmentIds())) {
-            JSONArray jsonArrayPaper = JSONArray.parseArray(examTaskDetail.getPaperAttachmentIds());
-            for (int i = 0; i < jsonArrayPaper.size(); i++) {
-                JSONObject object = jsonArrayPaper.getJSONObject(i);
-                if (!paperType.equals(String.valueOf(object.get("name")))) {
+            List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
+            for (PaperInfoVo paperInfoVo : paperInfoVoList) {
+                if (!paperType.equals(paperInfoVo.getName())) {
                     // 试卷类型不匹配跳过
                     // 试卷类型不匹配跳过
                     continue;
                     continue;
                 }
                 }
                 String jpgAttachmentInfo = examCardService.getOne(new QueryWrapper<ExamCard>().lambda()
                 String jpgAttachmentInfo = examCardService.getOne(new QueryWrapper<ExamCard>().lambda()
-                        .eq(ExamCard::getId, Long.parseLong((String) object.get("cardId")))).getJpgAttachment();
+                        .eq(ExamCard::getId, paperInfoVo.getCardId())).getJpgAttachment();
                 if (StringUtils.isBlank(jpgAttachmentInfo)) {
                 if (StringUtils.isBlank(jpgAttachmentInfo)) {
                     return new ArrayList<>();
                     return new ArrayList<>();
                 }
                 }
@@ -578,13 +575,12 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
         examTaskDetailQueryWrapper.lambda().eq(ExamTaskDetail::getExamTaskId, examTask.getId());
         examTaskDetailQueryWrapper.lambda().eq(ExamTaskDetail::getExamTaskId, examTask.getId());
         ExamTaskDetail examTaskDetail = examTaskDetailService.getOne(examTaskDetailQueryWrapper);
         ExamTaskDetail examTaskDetail = examTaskDetailService.getOne(examTaskDetailQueryWrapper);
 
 
-        String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
-        List<Map> list = JSONObject.parseArray(paperAttachmentIds, Map.class);
-        if (CollectionUtils.isEmpty(list)) {
+        List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
+        if (CollectionUtils.isEmpty(paperInfoVoList)) {
             throw ExceptionResultEnum.ERROR.exception("未找到关联的试卷文件");
             throw ExceptionResultEnum.ERROR.exception("未找到关联的试卷文件");
         }
         }
 
 
-        return list.stream().collect(Collectors.toMap(m -> m.get("name").toString(), m -> m.get("attachmentId").toString()));
+        return paperInfoVoList.stream().collect(Collectors.toMap(m -> m.getName(), m -> String.valueOf(m.getAttachmentId())));
     }
     }
 
 
     /**
     /**

+ 19 - 21
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskDetailServiceImpl.java

@@ -1,14 +1,13 @@
 package com.qmth.distributed.print.business.service.impl;
 package com.qmth.distributed.print.business.service.impl;
 
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.distributed.print.business.bean.dto.ExamTaskDetailDto;
 import com.qmth.distributed.print.business.bean.dto.ExamTaskDetailDto;
 import com.qmth.distributed.print.business.bean.dto.ExamTaskDetailPdfDownloadDto;
 import com.qmth.distributed.print.business.bean.dto.ExamTaskDetailPdfDownloadDto;
 import com.qmth.distributed.print.business.bean.params.RelatePaperParam;
 import com.qmth.distributed.print.business.bean.params.RelatePaperParam;
+import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
 import com.qmth.distributed.print.business.cache.CreatePdfCacheUtil;
 import com.qmth.distributed.print.business.cache.CreatePdfCacheUtil;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.*;
 import com.qmth.distributed.print.business.enums.*;
@@ -23,6 +22,7 @@ import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.entity.TBTask;
 import com.qmth.teachcloud.common.entity.TBTask;
 import com.qmth.teachcloud.common.enums.*;
 import com.qmth.teachcloud.common.enums.*;
 import com.qmth.teachcloud.common.service.*;
 import com.qmth.teachcloud.common.service.*;
+import com.qmth.teachcloud.common.util.ExamTaskUtil;
 import com.qmth.teachcloud.common.util.RedisUtil;
 import com.qmth.teachcloud.common.util.RedisUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import org.activiti.engine.TaskService;
 import org.activiti.engine.TaskService;
@@ -307,12 +307,11 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
         if (!CollectionUtils.isEmpty(examTaskDetails)) {
         if (!CollectionUtils.isEmpty(examTaskDetails)) {
             for (ExamTaskDetail e : examTaskDetails) {
             for (ExamTaskDetail e : examTaskDetails) {
                 if (Objects.nonNull(e.getPaperAttachmentIds())) {
                 if (Objects.nonNull(e.getPaperAttachmentIds())) {
-                    JSONArray jsonArrayPaper = JSONArray.parseArray(e.getPaperAttachmentIds());
-                    for (int i = 0; i < jsonArrayPaper.size(); i++) {
-                        JSONObject object = jsonArrayPaper.getJSONObject(i);
-                        object.put("cardId", null);
+                    List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(e.getPaperAttachmentIds());
+                    for (PaperInfoVo paperInfoVo : paperInfoVoList) {
+                        paperInfoVo.setCardId(null);
                     }
                     }
-                    e.setPaperAttachmentIds(jsonArrayPaper.toJSONString());
+                    e.setPaperAttachmentIds(JSON.toJSONString(paperInfoVoList));
                 }
                 }
             }
             }
             this.updateBatchById(examTaskDetails);
             this.updateBatchById(examTaskDetails);
@@ -335,13 +334,12 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
             if (CollectionUtils.isEmpty(relatePaperTypes)) {
             if (CollectionUtils.isEmpty(relatePaperTypes)) {
                 throw ExceptionResultEnum.ERROR.exception("未找到关联的试卷卷型");
                 throw ExceptionResultEnum.ERROR.exception("未找到关联的试卷卷型");
             }
             }
-            String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
-            List<Map> list = JSONObject.parseArray(paperAttachmentIds, Map.class);
-            if (CollectionUtils.isEmpty(list)) {
+            List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
+            if (CollectionUtils.isEmpty(paperInfoVoList)) {
                 throw ExceptionResultEnum.ERROR.exception("未找到关联的试卷文件");
                 throw ExceptionResultEnum.ERROR.exception("未找到关联的试卷文件");
             }
             }
 
 
-            Map<String, String> paperMap = list.stream().collect(Collectors.toMap(m -> m.get("name").toString(), m -> m.get("attachmentId").toString()));
+            Map<String, String> paperMap = paperInfoVoList.stream().collect(Collectors.toMap(m -> m.getName(), m -> String.valueOf(m.getAttachmentId())));
             for (String relatePaperType : relatePaperTypes) {
             for (String relatePaperType : relatePaperTypes) {
                 String[] paperTypes = relatePaperType.split(",");
                 String[] paperTypes = relatePaperType.split(",");
                 for (String paperType : paperTypes) {
                 for (String paperType : paperTypes) {
@@ -728,12 +726,12 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
             throw ExceptionResultEnum.ERROR.exception("命题任务数据异常");
             throw ExceptionResultEnum.ERROR.exception("命题任务数据异常");
         }
         }
 
 
-        List<Map> oldPaperAttachmentIdsList = JSONObject.parseArray(examTaskDetailTemp.getPaperAttachmentIds(), Map.class);
-        List<Map> newPaperAttachmentIdsList = JSONObject.parseArray(examTaskDetail.getPaperAttachmentIds(), Map.class);
+        List<PaperInfoVo> oldPaperAttachmentIdsList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetailTemp.getPaperAttachmentIds());
+        List<PaperInfoVo> newPaperAttachmentIdsList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
         // 卷型、题卡没有变动,直接return
         // 卷型、题卡没有变动,直接return
         if (oldPaperAttachmentIdsList.size() == newPaperAttachmentIdsList.size()) {
         if (oldPaperAttachmentIdsList.size() == newPaperAttachmentIdsList.size()) {
-            String oldString = oldPaperAttachmentIdsList.stream().sorted(Comparator.comparing(m -> m.get("name").toString())).map(m -> m.get("name").toString() + m.get("attachmentId").toString()).collect(Collectors.joining());
-            String newString = newPaperAttachmentIdsList.stream().sorted(Comparator.comparing(m -> m.get("name").toString())).map(m -> m.get("name").toString() + m.get("attachmentId").toString()).collect(Collectors.joining());
+            String oldString = oldPaperAttachmentIdsList.stream().sorted(Comparator.comparing(m -> m.getName())).map(m -> m.getName() + m.getAttachmentId()).collect(Collectors.joining());
+            String newString = newPaperAttachmentIdsList.stream().sorted(Comparator.comparing(m -> m.getName())).map(m -> m.getName() + m.getAttachmentId()).collect(Collectors.joining());
             if (oldString.equals(newString) && examTaskDetailTemp.getPaperAttachmentIds().equals(examTaskDetail.getPaperAttachmentIds())) {
             if (oldString.equals(newString) && examTaskDetailTemp.getPaperAttachmentIds().equals(examTaskDetail.getPaperAttachmentIds())) {
                 return;
                 return;
             }
             }
@@ -767,13 +765,13 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
         // 已曝光试卷不能修改
         // 已曝光试卷不能修改
         String exposedPaperType = examTaskDetailTemp.getExposedPaperType();
         String exposedPaperType = examTaskDetailTemp.getExposedPaperType();
         if (StringUtils.isNotBlank(exposedPaperType)) {
         if (StringUtils.isNotBlank(exposedPaperType)) {
-            Map<String, String> oldPaperAttachmentIdMap = oldPaperAttachmentIdsList.stream().collect(Collectors.toMap(m -> m.get("name").toString(), m -> m.get("attachmentId").toString()));
+            Map<String, String> oldPaperAttachmentIdMap = oldPaperAttachmentIdsList.stream().collect(Collectors.toMap(m -> m.getName(), m -> String.valueOf(m.getAttachmentId())));
             String[] exposedPaperTypes = exposedPaperType.split(",");
             String[] exposedPaperTypes = exposedPaperType.split(",");
             String newPaperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
             String newPaperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
             if (StringUtils.isBlank(newPaperAttachmentIds)) {
             if (StringUtils.isBlank(newPaperAttachmentIds)) {
                 throw ExceptionResultEnum.ERROR.exception("已曝光试卷不能删除");
                 throw ExceptionResultEnum.ERROR.exception("已曝光试卷不能删除");
             } else {
             } else {
-                Map<String, String> newPaperAttachmentIdMap = newPaperAttachmentIdsList.stream().collect(Collectors.toMap(m -> m.get("name").toString(), m -> m.get("attachmentId").toString()));
+                Map<String, String> newPaperAttachmentIdMap = newPaperAttachmentIdsList.stream().collect(Collectors.toMap(m -> m.getName(), m -> String.valueOf(m.getAttachmentId())));
                 for (String paperType : exposedPaperTypes) {
                 for (String paperType : exposedPaperTypes) {
                     if (!oldPaperAttachmentIdMap.containsKey(paperType)) {
                     if (!oldPaperAttachmentIdMap.containsKey(paperType)) {
                         throw ExceptionResultEnum.ERROR.exception("原试卷卷型[" + paperType + "]不存在");
                         throw ExceptionResultEnum.ERROR.exception("原试卷卷型[" + paperType + "]不存在");
@@ -797,8 +795,8 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
         }
         }
 
 
         // 将旧题卡更新为未绑定
         // 将旧题卡更新为未绑定
-        List<JSONObject> oldPaperAttachmentIdsJson = JSON.parseArray(examTaskDetailTemp.getPaperAttachmentIds(), JSONObject.class);
-        List<Long> oldCardIds = oldPaperAttachmentIdsJson.stream().filter(m -> CardTypeEnum.CUSTOM.name().equals(m.getString("cardType"))).map(m -> m.getLong("cardId")).collect(Collectors.toList());
+        List<PaperInfoVo> oldPaperAttachmentIdsJson = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetailTemp.getPaperAttachmentIds());
+        List<Long> oldCardIds = oldPaperAttachmentIdsJson.stream().filter(m -> CardTypeEnum.CUSTOM.name().equals(m.getCardType())).map(m -> m.getCardId()).collect(Collectors.toList());
         for (Long cardId : oldCardIds) {
         for (Long cardId : oldCardIds) {
             UpdateWrapper<ExamCard> cardUpdateWrapper = new UpdateWrapper<>();
             UpdateWrapper<ExamCard> cardUpdateWrapper = new UpdateWrapper<>();
             cardUpdateWrapper.lambda().set(ExamCard::getUsed, false).eq(ExamCard::getId, cardId);
             cardUpdateWrapper.lambda().set(ExamCard::getUsed, false).eq(ExamCard::getId, cardId);
@@ -806,8 +804,8 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
         }
         }
 
 
         // 将新题卡更新为已绑定
         // 将新题卡更新为已绑定
-        List<JSONObject> newPaperAttachmentIdsJson = JSON.parseArray(examTaskDetail.getPaperAttachmentIds(), JSONObject.class);
-        List<Long> cardIds = newPaperAttachmentIdsJson.stream().filter(m -> CardTypeEnum.CUSTOM.name().equals(m.getString("cardType"))).map(m -> m.getLong("cardId")).collect(Collectors.toList());
+        List<PaperInfoVo> newPaperAttachmentIdsJson = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
+        List<Long> cardIds = newPaperAttachmentIdsJson.stream().filter(m -> CardTypeEnum.CUSTOM.name().equals(m.getCardType())).map(m -> m.getCardId()).collect(Collectors.toList());
         for (Long cardId : cardIds) {
         for (Long cardId : cardIds) {
             UpdateWrapper<ExamCard> cardUpdateWrapper = new UpdateWrapper<>();
             UpdateWrapper<ExamCard> cardUpdateWrapper = new UpdateWrapper<>();
             cardUpdateWrapper.lambda().set(ExamCard::getUsed, true).eq(ExamCard::getId, cardId);
             cardUpdateWrapper.lambda().set(ExamCard::getUsed, true).eq(ExamCard::getId, cardId);

+ 32 - 35
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -21,6 +21,7 @@ import com.qmth.distributed.print.business.bean.result.WorkResult;
 import com.qmth.distributed.print.business.bean.result.examTaskStudent.ExamTaskExamStudentImportResult;
 import com.qmth.distributed.print.business.bean.result.examTaskStudent.ExamTaskExamStudentImportResult;
 import com.qmth.distributed.print.business.bean.result.examTaskStudent.ExamTaskStudentObjectResult;
 import com.qmth.distributed.print.business.bean.result.examTaskStudent.ExamTaskStudentObjectResult;
 import com.qmth.distributed.print.business.bean.result.examTaskStudent.StudentInfo;
 import com.qmth.distributed.print.business.bean.result.examTaskStudent.StudentInfo;
+import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.*;
 import com.qmth.distributed.print.business.enums.*;
 import com.qmth.distributed.print.business.mapper.ExamTaskMapper;
 import com.qmth.distributed.print.business.mapper.ExamTaskMapper;
@@ -28,7 +29,6 @@ import com.qmth.distributed.print.business.service.*;
 import com.qmth.distributed.print.business.templete.execute.AsyncPaperReviewPdfExportService;
 import com.qmth.distributed.print.business.templete.execute.AsyncPaperReviewPdfExportService;
 import com.qmth.distributed.print.business.util.CreatePdfUtil;
 import com.qmth.distributed.print.business.util.CreatePdfUtil;
 import com.qmth.distributed.print.business.util.HtmlToPdfUtil;
 import com.qmth.distributed.print.business.util.HtmlToPdfUtil;
-import com.qmth.teachcloud.common.util.RedisCounterUtil;
 import com.qmth.teachcloud.common.bean.dto.AssignTeacherDto;
 import com.qmth.teachcloud.common.bean.dto.AssignTeacherDto;
 import com.qmth.teachcloud.common.bean.dto.BlurryUserDto;
 import com.qmth.teachcloud.common.bean.dto.BlurryUserDto;
 import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
 import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
@@ -858,9 +858,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         examTaskDetailService.saveOrUpdate(examTaskDetail);
         examTaskDetailService.saveOrUpdate(examTaskDetail);
 
 
         // 将题卡更新为已绑定
         // 将题卡更新为已绑定
-        String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
-        List<JSONObject> paperAttachmentIdsJson = JSON.parseArray(paperAttachmentIds, JSONObject.class);
-        List<Long> cardIds = paperAttachmentIdsJson.stream().filter(m -> CardTypeEnum.CUSTOM.name().equals(m.getString("cardType"))).map(m -> m.getLong("cardId")).collect(Collectors.toList());
+        List<PaperInfoVo> paperAttachmentIdsJson = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
+        List<Long> cardIds = paperAttachmentIdsJson.stream().filter(m -> CardTypeEnum.CUSTOM.name().equals(m.getCardType())).map(m -> m.getCardId()).collect(Collectors.toList());
         for (Long cardId : cardIds) {
         for (Long cardId : cardIds) {
             UpdateWrapper<ExamCard> cardUpdateWrapper = new UpdateWrapper<>();
             UpdateWrapper<ExamCard> cardUpdateWrapper = new UpdateWrapper<>();
             cardUpdateWrapper.lambda().set(ExamCard::getUsed, true).eq(ExamCard::getId, cardId);
             cardUpdateWrapper.lambda().set(ExamCard::getUsed, true).eq(ExamCard::getId, cardId);
@@ -901,15 +900,15 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskId(examTask.getId());
         ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskId(examTask.getId());
         String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
         String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
         if (StringUtils.isNotBlank(paperAttachmentIds)) {
         if (StringUtils.isNotBlank(paperAttachmentIds)) {
-            List<JSONObject> objects = JSON.parseArray(paperAttachmentIds, JSONObject.class);
+            List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(paperAttachmentIds);
             List<Long> cardIds = new ArrayList<>();
             List<Long> cardIds = new ArrayList<>();
-            for (JSONObject object : objects) {
-                cardIds.add(object.getLong("cardId"));
-                object.put("cardId", "");
-                object.put("cardType", "");
-                object.put("cardTitle", "");
+            for (PaperInfoVo paperInfoVo : paperInfoVoList) {
+                cardIds.add(paperInfoVo.getCardId());
+                paperInfoVo.setCardId(null);
+                paperInfoVo.setCardType(null);
+                paperInfoVo.setCardTitle(null);
             }
             }
-            examTaskDetail.setPaperAttachmentIds(JSON.toJSONString(objects));
+            examTaskDetail.setPaperAttachmentIds(JSON.toJSONString(paperInfoVoList));
             examTaskDetailService.updateById(examTaskDetail);
             examTaskDetailService.updateById(examTaskDetail);
 
 
             // 更新题卡为未使用
             // 更新题卡为未使用
@@ -940,8 +939,6 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         ExamTaskDetailPdfDownloadDto examTaskDetailPdfDownloadDto = examTaskDetailService.findPdfDownload(examTaskId);
         ExamTaskDetailPdfDownloadDto examTaskDetailPdfDownloadDto = examTaskDetailService.findPdfDownload(examTaskId);
         Optional.ofNullable(examTaskDetailPdfDownloadDto).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("数据异常"));
         Optional.ofNullable(examTaskDetailPdfDownloadDto).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("数据异常"));
 
 
-        String paperAttachmentIds = examTaskDetailPdfDownloadDto.getPaperAttachmentIds();
-        List<JSONObject> jsonObjectList = JSONObject.parseArray(paperAttachmentIds, JSONObject.class);
         File tempFile = null;
         File tempFile = null;
         String rootPath = null;
         String rootPath = null;
         try {
         try {
@@ -957,12 +954,13 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                     .add(examTaskDetailPdfDownloadDto.getCourseNameCode()).add(SystemConstant.HYPHEN)
                     .add(examTaskDetailPdfDownloadDto.getCourseNameCode()).add(SystemConstant.HYPHEN)
                     .add(examTaskDetailPdfDownloadDto.getPaperNumber()).add(SystemConstant.HYPHEN);
                     .add(examTaskDetailPdfDownloadDto.getPaperNumber()).add(SystemConstant.HYPHEN);
             List<File> fileList = new ArrayList<>();
             List<File> fileList = new ArrayList<>();
+            List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetailPdfDownloadDto.getPaperAttachmentIds());
             // 试卷
             // 试卷
-            for (JSONObject jsonObject : jsonObjectList) {
-                String id = jsonObject.get("attachmentId").toString();
-                String name = jsonObject.get("name").toString();
-                if (StringUtils.isNotBlank(id)) {
-                    BasicAttachment attachment = basicAttachmentService.getById(id);
+            for (PaperInfoVo paperInfoVo : paperInfoVoList) {
+                Long attachmentId = paperInfoVo.getAttachmentId();
+                String name = paperInfoVo.getName();
+                if (Objects.nonNull(attachmentId)) {
+                    BasicAttachment attachment = basicAttachmentService.getById(attachmentId);
                     Optional.ofNullable(attachment).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("附件数据异常"));
                     Optional.ofNullable(attachment).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("附件数据异常"));
                     StringJoiner paperPath = new StringJoiner("");
                     StringJoiner paperPath = new StringJoiner("");
                     paperPath = paperPath.add(rootPath).add(File.separator)
                     paperPath = paperPath.add(rootPath).add(File.separator)
@@ -978,12 +976,12 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                 }
                 }
 
 
                 // 题卡
                 // 题卡
-                Long cardId = Long.parseLong(jsonObject.getString("cardId"));
+                Long cardId = paperInfoVo.getCardId();
                 if (cardId != null) {
                 if (cardId != null) {
                     ExamCard examCard = examCardService.getById(cardId);
                     ExamCard examCard = examCardService.getById(cardId);
 
 
-                    String cardHtmlPath = dirPath.toString() + "题卡" + SystemConstant.HYPHEN + name + SystemConstant.HTML_PREFIX;
-                    String cardPdfPath = dirPath.toString() + "题卡" + SystemConstant.HYPHEN + name + SystemConstant.PDF_PREFIX;
+                    String cardHtmlPath = dirPath + "题卡" + SystemConstant.HYPHEN + name + SystemConstant.HTML_PREFIX;
+                    String cardPdfPath = dirPath + "题卡" + SystemConstant.HYPHEN + name + SystemConstant.PDF_PREFIX;
 
 
                     String htmlContent;
                     String htmlContent;
                     // 通用模板
                     // 通用模板
@@ -1213,9 +1211,9 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
             // 题卡更新为未使用
             // 题卡更新为未使用
             String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
             String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
             if (StringUtils.isNotBlank(paperAttachmentIds)) {
             if (StringUtils.isNotBlank(paperAttachmentIds)) {
-                List<JSONObject> jsonObjectList = JSON.parseArray(paperAttachmentIds, JSONObject.class);
-                for (JSONObject jsonObject : jsonObjectList) {
-                    Long cardId = jsonObject.getLong("cardId");
+                List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(paperAttachmentIds);
+                for (PaperInfoVo paperInfoVo : paperInfoVoList) {
+                    Long cardId = paperInfoVo.getCardId();
                     ExamCard examCard = examCardService.getById(cardId);
                     ExamCard examCard = examCardService.getById(cardId);
                     if (examCard.getType().equals(CardTypeEnum.CUSTOM) || (examCard.getType().equals(CardTypeEnum.GENERIC) && examCard.getCreateMethod().equals(CardCreateMethodEnum.STANDARD))) {
                     if (examCard.getType().equals(CardTypeEnum.CUSTOM) || (examCard.getType().equals(CardTypeEnum.GENERIC) && examCard.getCreateMethod().equals(CardCreateMethodEnum.STANDARD))) {
                         UpdateWrapper<ExamCard> updateWrapper = new UpdateWrapper<>();
                         UpdateWrapper<ExamCard> updateWrapper = new UpdateWrapper<>();
@@ -1350,8 +1348,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
 
 
             // 将题卡更新为已绑定
             // 将题卡更新为已绑定
             String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
             String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
-            List<JSONObject> paperAttachmentIdsJson = JSON.parseArray(paperAttachmentIds, JSONObject.class);
-            List<Long> cardIds = paperAttachmentIdsJson.stream().filter(m -> CardTypeEnum.CUSTOM.name().equals(m.getString("cardType"))).map(m -> m.getLong("cardId")).collect(Collectors.toList());
+            List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(paperAttachmentIds);
+            List<Long> cardIds = paperInfoVoList.stream().filter(m -> CardTypeEnum.CUSTOM.name().equals(m.getCardType())).map(m -> m.getCardId()).collect(Collectors.toList());
             for (Long cardId : cardIds) {
             for (Long cardId : cardIds) {
                 UpdateWrapper<ExamCard> updateWrapper = new UpdateWrapper<>();
                 UpdateWrapper<ExamCard> updateWrapper = new UpdateWrapper<>();
                 updateWrapper.lambda().set(ExamCard::getUsed, true).eq(ExamCard::getId, cardId);
                 updateWrapper.lambda().set(ExamCard::getUsed, true).eq(ExamCard::getId, cardId);
@@ -1373,8 +1371,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                 examPrintPlan.setExamEndTime(examDetailParams.getExamEndTime());
                 examPrintPlan.setExamEndTime(examDetailParams.getExamEndTime());
                 List<String> stringList = JSONObject.parseArray(basicPrintConfig.getPrintContent(), String.class);
                 List<String> stringList = JSONObject.parseArray(basicPrintConfig.getPrintContent(), String.class);
                 if (!stringList.contains("PAPER")) {
                 if (!stringList.contains("PAPER")) {
-                    List<Map> paperAttachmentIdsMap = JSONObject.parseArray(examTaskDetail.getPaperAttachmentIds(), Map.class);
-                    long count = paperAttachmentIdsMap.stream().filter(m -> StringUtils.isBlank(m.get("attachmentId").toString())).count();
+                    long count = paperInfoVoList.stream().filter(m -> Objects.isNull(m.getAttachmentId())).count();
                     if (count == 0) {
                     if (count == 0) {
                         stringList.add("PAPER");
                         stringList.add("PAPER");
                     }
                     }
@@ -2143,11 +2140,11 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
             throw ExceptionResultEnum.ERROR.exception("没有设置卷型");
             throw ExceptionResultEnum.ERROR.exception("没有设置卷型");
         }
         }
 
 
-        List<Map> paperAttachmentIds = JSONObject.parseArray(examTaskDetail.getPaperAttachmentIds(), Map.class);
-        for (Map paperAttachmentId : paperAttachmentIds) {
+        List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
+        for (PaperInfoVo paperInfoVo : paperInfoVoList) {
             // 校验试卷必须绑定题卡
             // 校验试卷必须绑定题卡
-            Long cardId = SystemConstant.convertIdToLong(String.valueOf(paperAttachmentId.get("cardId")));
-            if (!SystemConstant.longNotNull(cardId)) {
+            Long cardId = paperInfoVo.getCardId();
+            if (Objects.isNull(cardId)) {
                 throw ExceptionResultEnum.ERROR.exception("没有绑定题卡");
                 throw ExceptionResultEnum.ERROR.exception("没有绑定题卡");
             }
             }
             // 校验题卡是否提交
             // 校验题卡是否提交
@@ -2164,9 +2161,9 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
 
 
         // 是否强制包含试卷
         // 是否强制包含试卷
         // 未上传试卷的类型个数
         // 未上传试卷的类型个数
-        long count = paperAttachmentIds.stream().filter(m -> StringUtils.isBlank(m.get("attachmentId").toString())).count();
+        long count = paperInfoVoList.stream().filter(m -> Objects.isNull(m.getAttachmentId())).count();
         if (printContent.contains("PAPER")) {
         if (printContent.contains("PAPER")) {
-            if (CollectionUtils.isEmpty(paperAttachmentIds)) {
+            if (CollectionUtils.isEmpty(paperInfoVoList)) {
                 throw ExceptionResultEnum.ERROR.exception("没有设置卷型");
                 throw ExceptionResultEnum.ERROR.exception("没有设置卷型");
             }
             }
             if (count > 0) {
             if (count > 0) {
@@ -2174,7 +2171,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
             }
             }
         } else {
         } else {
             // count == 0为全部上传,paperAttachmentIds.size() == count 为全部未上传
             // count == 0为全部上传,paperAttachmentIds.size() == count 为全部未上传
-            if (count > 0 && paperAttachmentIds.size() != count) {
+            if (count > 0 && paperInfoVoList.size() != count) {
                 throw ExceptionResultEnum.ERROR.exception("所有卷型的试卷文件必须全部上传或全部不上传");
                 throw ExceptionResultEnum.ERROR.exception("所有卷型的试卷文件必须全部上传或全部不上传");
             }
             }
         }
         }

+ 32 - 34
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java

@@ -15,6 +15,7 @@ import com.qmth.distributed.print.business.bean.examRule.FieldsDto;
 import com.qmth.distributed.print.business.bean.params.DownloadPaperFileParam;
 import com.qmth.distributed.print.business.bean.params.DownloadPaperFileParam;
 import com.qmth.distributed.print.business.bean.result.DictionaryResult;
 import com.qmth.distributed.print.business.bean.result.DictionaryResult;
 import com.qmth.distributed.print.business.bean.result.TSyncExamStudentScoreResult;
 import com.qmth.distributed.print.business.bean.result.TSyncExamStudentScoreResult;
+import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
 import com.qmth.distributed.print.business.cache.CreatePdfCacheUtil;
 import com.qmth.distributed.print.business.cache.CreatePdfCacheUtil;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.*;
 import com.qmth.distributed.print.business.enums.*;
@@ -22,7 +23,6 @@ import com.qmth.distributed.print.business.service.*;
 import com.qmth.distributed.print.business.templete.service.TaskLogicService;
 import com.qmth.distributed.print.business.templete.service.TaskLogicService;
 import com.qmth.distributed.print.business.util.CreatePdfUtil;
 import com.qmth.distributed.print.business.util.CreatePdfUtil;
 import com.qmth.distributed.print.business.util.HtmlToPdfUtil;
 import com.qmth.distributed.print.business.util.HtmlToPdfUtil;
-import com.qmth.teachcloud.common.util.RedisCounterUtil;
 import com.qmth.teachcloud.common.annotation.ExcelDBFieldDesc;
 import com.qmth.teachcloud.common.annotation.ExcelDBFieldDesc;
 import com.qmth.teachcloud.common.base.BaseEntity;
 import com.qmth.teachcloud.common.base.BaseEntity;
 import com.qmth.teachcloud.common.bean.dto.excel.*;
 import com.qmth.teachcloud.common.bean.dto.excel.*;
@@ -37,6 +37,7 @@ import com.qmth.teachcloud.common.service.*;
 import com.qmth.teachcloud.common.util.*;
 import com.qmth.teachcloud.common.util.*;
 import com.qmth.teachcloud.common.util.excel.ExcelError;
 import com.qmth.teachcloud.common.util.excel.ExcelError;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@@ -54,7 +55,6 @@ import org.springframework.dao.DuplicateKeyException;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
 import org.springframework.util.FileCopyUtils;
 import org.springframework.util.FileCopyUtils;
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.LinkedMultiValueMap;
 
 
@@ -269,16 +269,16 @@ public class TaskLogicServiceImpl implements TaskLogicService {
             JSONArray jsonArray = new JSONArray();
             JSONArray jsonArray = new JSONArray();
             JSONArray stuJsonArray = new JSONArray();
             JSONArray stuJsonArray = new JSONArray();
             Map<String, ExamCard> examCardMap = new HashMap<>();
             Map<String, ExamCard> examCardMap = new HashMap<>();
-            JSONArray jsonArrayPaper = JSONArray.parseArray(examTaskDetail.getPaperAttachmentIds());
+            List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
             ExamCard examCard;
             ExamCard examCard;
-            for (int i = 0; i < jsonArrayPaper.size(); i++) {
-                JSONObject object = jsonArrayPaper.getJSONObject(i);
-                if (Objects.nonNull(object.get("cardId")) && !Objects.equals("", object.get("cardId"))) {
-                    examCard = examCardService.getById(Long.parseLong((String) object.get("cardId")));
+            for (PaperInfoVo paperInfoVo : paperInfoVoList) {
+                Long cardId = paperInfoVo.getCardId();
+                if (Objects.nonNull(cardId)) {
+                    examCard = examCardService.getById(cardId);
                     if (Objects.isNull(examCard)) {
                     if (Objects.isNull(examCard)) {
                         throw ExceptionResultEnum.EXAM_CARD_IS_NULL.exception();
                         throw ExceptionResultEnum.EXAM_CARD_IS_NULL.exception();
                     }
                     }
-                    examCardMap.put((String) object.get("name"), examCard);
+                    examCardMap.put(paperInfoVo.getName(), examCard);
                 }
                 }
             }
             }
 
 
@@ -296,11 +296,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 paperType = paperTypeParam;
                 paperType = paperTypeParam;
                 CreatePdfCacheUtil.setPaperType(key, paperType);
                 CreatePdfCacheUtil.setPaperType(key, paperType);
             } else {
             } else {
-//                if (StringUtils.isBlank(examDetailCourse.getPaperType())) {
                 paperType = createPdfUtil.getPaperType(examPrintPlan.getDrawRule(), examTaskDetail, key);
                 paperType = createPdfUtil.getPaperType(examPrintPlan.getDrawRule(), examTaskDetail, key);
-//                } else {
-//                    paperType = examDetailCourse.getPaperType();
-//                }
             }
             }
             //查询考生
             //查询考生
             QueryWrapper<ExamStudent> examStudentQueryWrapper = new QueryWrapper<>();
             QueryWrapper<ExamStudent> examStudentQueryWrapper = new QueryWrapper<>();
@@ -1175,18 +1171,19 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 }
                 }
 
 
                 // 收集处理试卷和题卡
                 // 收集处理试卷和题卡
-                List<ExamPaperInfoDto> paperInfoDtoList = JSONObject.parseArray(examTaskDetail.getPaperAttachmentIds(), ExamPaperInfoDto.class);
-                if (Objects.isNull(paperInfoDtoList)) {
+                List<PaperInfoVo> paperInfoVos = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
+                if (CollectionUtils.isEmpty(paperInfoVos)) {
                     throw ExceptionResultEnum.ERROR.exception(String.format("课程[%s(%s)],试卷编号[%s]的命题任务未上传试卷或题卡", examTask.getCourseName(), examTask.getCourseCode(), examTask.getPaperNumber()));
                     throw ExceptionResultEnum.ERROR.exception(String.format("课程[%s(%s)],试卷编号[%s]的命题任务未上传试卷或题卡", examTask.getCourseName(), examTask.getCourseCode(), examTask.getPaperNumber()));
                 }
                 }
 
 
-                for (ExamPaperInfoDto examPaperInfoDto : paperInfoDtoList) {
+                for (PaperInfoVo paperInfoVo : paperInfoVos) {
                     // 下载试卷
                     // 下载试卷
-                    if (examPaperInfoDto.getAttachmentId() != null) {
-                        BasicAttachment paperAttachment = basicAttachmentService.getById(examPaperInfoDto.getAttachmentId());
+                    Long attachmentId = paperInfoVo.getAttachmentId();
+                    if (Objects.nonNull(attachmentId)) {
+                        BasicAttachment paperAttachment = basicAttachmentService.getById(attachmentId);
                         JSONObject jsonObject = JSONObject.parseObject(paperAttachment.getPath());
                         JSONObject jsonObject = JSONObject.parseObject(paperAttachment.getPath());
                         UploadFileEnum uploadFileEnum = UploadFileEnum.valueOf((String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
                         UploadFileEnum uploadFileEnum = UploadFileEnum.valueOf((String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
-                        String paperPath = firstPath + File.separator + "试卷" + File.separator + examPaperInfoDto.getName() + "-" + paperAttachment.getName() + paperAttachment.getType();
+                        String paperPath = firstPath + File.separator + "试卷" + File.separator + paperInfoVo.getName() + "-" + paperAttachment.getName() + paperAttachment.getType();
                         if (oss || (!oss && dictionaryConfig.fssPrivateDomain().getConfig().startsWith(SystemConstant.START_PARENT))) {
                         if (oss || (!oss && dictionaryConfig.fssPrivateDomain().getConfig().startsWith(SystemConstant.START_PARENT))) {
                             fileStoreUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), paperPath, uploadFileEnum.getFssType());
                             fileStoreUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), paperPath, uploadFileEnum.getFssType());
                         } else {
                         } else {
@@ -1195,20 +1192,20 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                     }
                     }
 
 
                     // 下载题卡
                     // 下载题卡
-                    Long cardId = examPaperInfoDto.getCardId();
+                    Long cardId = paperInfoVo.getCardId();
                     if (cardId != null) {
                     if (cardId != null) {
-                        String paperType = examPaperInfoDto.getName();
+                        String paperType = paperInfoVo.getName();
                         ExamCard examCard = examCardService.getById(cardId);
                         ExamCard examCard = examCardService.getById(cardId);
                         if (Objects.isNull(examCard)) {
                         if (Objects.isNull(examCard)) {
                             throw ExceptionResultEnum.ERROR.exception(String.format("课程[%s(%s)],试卷编号[%s],卷型[%s]的题卡不存在", examTask.getCourseName(), examTask.getCourseCode(), examTask.getPaperNumber(), paperType));
                             throw ExceptionResultEnum.ERROR.exception(String.format("课程[%s(%s)],试卷编号[%s],卷型[%s]的题卡不存在", examTask.getCourseName(), examTask.getCourseCode(), examTask.getPaperNumber(), paperType));
                         }
                         }
                         MakeMethodEnum makeMethodEnum = examCard.getMakeMethod();
                         MakeMethodEnum makeMethodEnum = examCard.getMakeMethod();
                         if (MakeMethodEnum.SELECT.equals(makeMethodEnum) && CardCreateMethodEnum.UPLOAD.equals(examCard.getCreateMethod())) {
                         if (MakeMethodEnum.SELECT.equals(makeMethodEnum) && CardCreateMethodEnum.UPLOAD.equals(examCard.getCreateMethod())) {
-                            Long attachmentId = examCard.getAttachmentId();
-                            if (attachmentId == null || attachmentId == 0) {
+                            Long cardAttachmentId = examCard.getAttachmentId();
+                            if (cardAttachmentId == null) {
                                 throw ExceptionResultEnum.ERROR.exception(String.format("课程[%s(%s)],试卷编号[%s],卷型[%s]的题卡未上传", examTask.getCourseName(), examTask.getCourseCode(), examTask.getPaperNumber(), paperType));
                                 throw ExceptionResultEnum.ERROR.exception(String.format("课程[%s(%s)],试卷编号[%s],卷型[%s]的题卡未上传", examTask.getCourseName(), examTask.getCourseCode(), examTask.getPaperNumber(), paperType));
                             }
                             }
-                            BasicAttachment cardAttachment = basicAttachmentService.getById(attachmentId);
+                            BasicAttachment cardAttachment = basicAttachmentService.getById(cardAttachmentId);
                             if (Objects.isNull(cardAttachment)) {
                             if (Objects.isNull(cardAttachment)) {
                                 throw ExceptionResultEnum.ERROR.exception(String.format("课程[%s(%s)],试卷编号[%s],卷型[%s]的题卡未找到上传附件数据", examTask.getCourseName(), examTask.getCourseCode(), examTask.getPaperNumber(), paperType));
                                 throw ExceptionResultEnum.ERROR.exception(String.format("课程[%s(%s)],试卷编号[%s],卷型[%s]的题卡未找到上传附件数据", examTask.getCourseName(), examTask.getCourseCode(), examTask.getPaperNumber(), paperType));
                             }
                             }
@@ -1241,8 +1238,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                         if (Objects.isNull(confirmMap.get("attachmentId"))) {
                         if (Objects.isNull(confirmMap.get("attachmentId"))) {
                             throw ExceptionResultEnum.ERROR.exception(String.format("课程[%s(%s)],试卷编号[%s]的附件未上传", examTask.getCourseName(), examTask.getCourseCode(), examTask.getPaperNumber()));
                             throw ExceptionResultEnum.ERROR.exception(String.format("课程[%s(%s)],试卷编号[%s]的附件未上传", examTask.getCourseName(), examTask.getCourseCode(), examTask.getPaperNumber()));
                         }
                         }
-                        Long attachmentId = Long.valueOf(String.valueOf(confirmMap.get("attachmentId")));
-                        BasicAttachment confirmAttachment = basicAttachmentService.getById(attachmentId);
+                        Long confirmAttachmentId = Long.valueOf(String.valueOf(confirmMap.get("attachmentId")));
+                        BasicAttachment confirmAttachment = basicAttachmentService.getById(confirmAttachmentId);
                         if (confirmAttachment == null) {
                         if (confirmAttachment == null) {
                             throw ExceptionResultEnum.ERROR.exception(String.format("课程[%s(%s)],试卷编号[%s]的附件未找到上传数据", examTask.getCourseName(), examTask.getCourseCode(), examTask.getPaperNumber()));
                             throw ExceptionResultEnum.ERROR.exception(String.format("课程[%s(%s)],试卷编号[%s]的附件未找到上传数据", examTask.getCourseName(), examTask.getCourseCode(), examTask.getPaperNumber()));
                         }
                         }
@@ -1316,27 +1313,28 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 // 试卷
                 // 试卷
                 String paperAttachmentIds = examTaskDetailPdfDownloadDto.getPaperAttachmentIds();
                 String paperAttachmentIds = examTaskDetailPdfDownloadDto.getPaperAttachmentIds();
                 if (StringUtils.isNotBlank(paperAttachmentIds)) {
                 if (StringUtils.isNotBlank(paperAttachmentIds)) {
-                    List<Map> paperInfo = JSONObject.parseArray(paperAttachmentIds, Map.class);
-                    if (Objects.isNull(paperInfo)) {
+                    List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(paperAttachmentIds);
+                    if (CollectionUtils.isEmpty(paperInfoVoList)) {
                         throw ExceptionResultEnum.ERROR.exception("试卷信息不存在");
                         throw ExceptionResultEnum.ERROR.exception("试卷信息不存在");
                     }
                     }
-                    for (Map paperMap : paperInfo) {
-                        if (Objects.nonNull(paperMap.get("attachmentId")) && String.valueOf(paperMap.get("attachmentId")).length() > 0 && !String.valueOf(paperMap.get("attachmentId")).equals("null")) {
-                            String name = paperMap.get("name").toString();
-                            Long attachmentId = Long.valueOf(String.valueOf(paperMap.get("attachmentId")));
+                    for (PaperInfoVo paperInfoVo : paperInfoVoList) {
+                        Long attachmentId = paperInfoVo.getAttachmentId();
+                        String name = paperInfoVo.getName();
+                        if (Objects.nonNull(attachmentId)) {
                             BasicAttachment attachment = basicAttachmentService.getById(attachmentId);
                             BasicAttachment attachment = basicAttachmentService.getById(attachmentId);
                             if (Objects.nonNull(attachment)) {
                             if (Objects.nonNull(attachment)) {
                                 File paperFile = getAttachmentFile(attachment, dirPath.toString() + "试卷" + SystemConstant.HYPHEN + name + attachment.getType());
                                 File paperFile = getAttachmentFile(attachment, dirPath.toString() + "试卷" + SystemConstant.HYPHEN + name + attachment.getType());
                                 sourceFileList.add(paperFile);
                                 sourceFileList.add(paperFile);
                             }
                             }
                         }
                         }
-                        ExamCard examCard = examCardService.getById(Long.parseLong((String) paperMap.get("cardId")));
+                        Long cardId = paperInfoVo.getCardId();
+                        ExamCard examCard = examCardService.getById(cardId);
                         Optional.ofNullable(examCard).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("找不到答题卡"));
                         Optional.ofNullable(examCard).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("找不到答题卡"));
 
 
                         MakeMethodEnum makeMethodEnum = examCard.getMakeMethod();
                         MakeMethodEnum makeMethodEnum = examCard.getMakeMethod();
 
 
-                        String cardHtmlPath = dirPath.toString() + "题卡" + SystemConstant.HYPHEN + paperMap.get("name") + SystemConstant.HTML_PREFIX;
-                        String cardPdfPath = dirPath.toString() + "题卡" + SystemConstant.HYPHEN + paperMap.get("name") + SystemConstant.PDF_PREFIX;
+                        String cardHtmlPath = dirPath + "题卡" + SystemConstant.HYPHEN + name + SystemConstant.HTML_PREFIX;
+                        String cardPdfPath = dirPath + "题卡" + SystemConstant.HYPHEN + name + SystemConstant.PDF_PREFIX;
                         // 通用题卡
                         // 通用题卡
                         String htmlContent;
                         String htmlContent;
                         if (MakeMethodEnum.SELECT.equals(makeMethodEnum)) {
                         if (MakeMethodEnum.SELECT.equals(makeMethodEnum)) {

+ 14 - 12
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePdfUtil.java

@@ -7,6 +7,8 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.qmth.boot.tools.models.ByteArray;
 import com.qmth.boot.tools.models.ByteArray;
 import com.qmth.distributed.print.business.bean.dto.*;
 import com.qmth.distributed.print.business.bean.dto.*;
+import com.qmth.teachcloud.common.bean.vo.OriginalVo;
+import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
 import com.qmth.distributed.print.business.cache.CreatePdfCacheUtil;
 import com.qmth.distributed.print.business.cache.CreatePdfCacheUtil;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
 import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
@@ -21,6 +23,7 @@ import com.qmth.teachcloud.common.service.BasicClazzService;
 import com.qmth.teachcloud.common.service.BasicSemesterService;
 import com.qmth.teachcloud.common.service.BasicSemesterService;
 import com.qmth.teachcloud.common.service.TeachcloudCommonService;
 import com.qmth.teachcloud.common.service.TeachcloudCommonService;
 import com.qmth.teachcloud.common.util.ConvertUtil;
 import com.qmth.teachcloud.common.util.ConvertUtil;
+import com.qmth.teachcloud.common.util.ExamTaskUtil;
 import com.qmth.teachcloud.common.util.FileStoreUtil;
 import com.qmth.teachcloud.common.util.FileStoreUtil;
 import com.qmth.teachcloud.common.util.RedisUtil;
 import com.qmth.teachcloud.common.util.RedisUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -309,9 +312,9 @@ public class CreatePdfUtil {
         for (ExamDetailCourse detailCourse : examDetailCourseList) {
         for (ExamDetailCourse detailCourse : examDetailCourseList) {
             ExamTask examTask = examTaskService.getByCourseCodeAndPaperNumber(examDetail.getSchoolId(), examId, detailCourse.getCourseCode(), detailCourse.getPaperNumber());
             ExamTask examTask = examTaskService.getByCourseCodeAndPaperNumber(examDetail.getSchoolId(), examId, detailCourse.getCourseCode(), detailCourse.getPaperNumber());
             ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskId(examTask.getId());
             ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskId(examTask.getId());
-            List<JSONObject> objectList = JSON.parseArray(examTaskDetail.getPaperAttachmentIds(), JSONObject.class);
-            for (JSONObject jsonObject : objectList) {
-                int pages = jsonObject.getIntValue("pages");
+            List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
+            for (PaperInfoVo paperInfoVo : paperInfoVoList) {
+                int pages = paperInfoVo.getPages();
                 isTag = pages > 2;
                 isTag = pages > 2;
                 pdfPackageDto.setTag(isTag);
                 pdfPackageDto.setTag(isTag);
                 if (isTag) {
                 if (isTag) {
@@ -1051,23 +1054,22 @@ public class CreatePdfUtil {
         String[] paperTypes = paperType.split(",");
         String[] paperTypes = paperType.split(",");
         List<PaperPdfDto> paperPdfDtoList = new ArrayList<>();
         List<PaperPdfDto> paperPdfDtoList = new ArrayList<>();
         PaperPdfDto paperPdfDto;
         PaperPdfDto paperPdfDto;
-        JSONArray jsonArrayPaper = JSONArray.parseArray(examTaskDetail.getPaperAttachmentIds());
-        for (int i = 0; i < jsonArrayPaper.size(); i++) {
-            JSONObject object = jsonArrayPaper.getJSONObject(i);
-            if (Objects.nonNull(object.get("attachmentId")) && !Objects.equals("", object.get("attachmentId"))) {
-                Long attachmentId = Long.parseLong((String) (object.get("attachmentId")));
+        List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
+        for (PaperInfoVo paperInfoVo : paperInfoVoList) {
+            Long attachmentId = paperInfoVo.getAttachmentId();
+            if (Objects.nonNull(attachmentId)) {
                 BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
                 BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
                 Optional.ofNullable(basicAttachment).orElseThrow(() -> ExceptionResultEnum.ATTACHMENT_IS_NULL.exception("所在路径不存在"));
                 Optional.ofNullable(basicAttachment).orElseThrow(() -> ExceptionResultEnum.ATTACHMENT_IS_NULL.exception("所在路径不存在"));
 
 
-                String name = (String) object.get("name");
-                JSONObject jsonObject = (JSONObject) object.get("original");
+                String name = paperInfoVo.getName();
+                OriginalVo original = paperInfoVo.getOriginal();
                 // 返回抽中的试卷
                 // 返回抽中的试卷
                 for (String type : paperTypes) {
                 for (String type : paperTypes) {
                     if (Objects.equals(name.toUpperCase(), type.toUpperCase())) {
                     if (Objects.equals(name.toUpperCase(), type.toUpperCase())) {
                         File file = teachcloudCommonService.getFile(basicAttachment.getPath(), false, fileTempList);
                         File file = teachcloudCommonService.getFile(basicAttachment.getPath(), false, fileTempList);
-                        int pages = (int) object.get("pages");
+                        int pages = original.getPages();
 
 
-                        PageSizeEnum pageSizeEnum = PageSizeEnum.valueOf((String) jsonObject.get("pageSize"));
+                        PageSizeEnum pageSizeEnum = PageSizeEnum.valueOf(original.getPageSize());
                         Optional.ofNullable(pageSizeEnum).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未设置pdf格式"));
                         Optional.ofNullable(pageSizeEnum).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未设置pdf格式"));
 
 
                         paperPdfDto = new PaperPdfDto(type, file, pages, pageSizeEnum);
                         paperPdfDto = new PaperPdfDto(type, file, pages, pageSizeEnum);

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/vo/OriginalVo.java → teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/vo/OriginalVo.java

@@ -1,4 +1,4 @@
-package com.qmth.distributed.print.business.bean.vo;
+package com.qmth.teachcloud.common.bean.vo;
 
 
 public class OriginalVo {
 public class OriginalVo {
 
 

+ 4 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/vo/PaperInfoVo.java → teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/vo/PaperInfoVo.java

@@ -1,9 +1,9 @@
-package com.qmth.distributed.print.business.bean.vo;
+package com.qmth.teachcloud.common.bean.vo;
 
 
 public class PaperInfoVo {
 public class PaperInfoVo {
 
 
     private String name;
     private String name;
-    private String attachmentId;
+    private Long attachmentId;
     private Long cardId;
     private Long cardId;
     private String cardType;
     private String cardType;
     private String createMethod;
     private String createMethod;
@@ -23,11 +23,11 @@ public class PaperInfoVo {
         this.name = name;
         this.name = name;
     }
     }
 
 
-    public String getAttachmentId() {
+    public Long getAttachmentId() {
         return attachmentId;
         return attachmentId;
     }
     }
 
 
-    public void setAttachmentId(String attachmentId) {
+    public void setAttachmentId(Long attachmentId) {
         this.attachmentId = attachmentId;
         this.attachmentId = attachmentId;
     }
     }
 
 

+ 0 - 28
teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/ConvertUtil.java

@@ -3,17 +3,12 @@ package com.qmth.teachcloud.common.util;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.PDPageTree;
 import org.apache.pdfbox.pdmodel.PDPageTree;
 import org.apache.pdfbox.rendering.PDFRenderer;
 import org.apache.pdfbox.rendering.PDFRenderer;
-import org.apache.poi.hssf.usermodel.HSSFDateUtil;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.CellType;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.data.redis.support.atomic.RedisAtomicLong;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
@@ -22,7 +17,6 @@ import javax.servlet.http.HttpServletResponse;
 import java.awt.image.BufferedImage;
 import java.awt.image.BufferedImage;
 import java.io.*;
 import java.io.*;
 import java.net.URLEncoder;
 import java.net.URLEncoder;
-import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.*;
 
 
@@ -194,25 +188,6 @@ public class ConvertUtil {
         }
         }
     }
     }
 
 
-    /**
-     * 判断里面参数只要有一个为空 就是true 全部不为空时 false
-     *
-     * @param strArr 字符串组
-     * @return 全部有值 - false;任意一个为空 - true
-     */
-    public static boolean strAnyEmpty(String... strArr) {
-        if (strArr.length == 0) {
-            return true;
-        } else {
-            for (String str : strArr) {
-                if (!SystemConstant.strNotNull(str)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-
     public static void outputFile(HttpServletResponse response, InputStream inputStream, String fileName) {
     public static void outputFile(HttpServletResponse response, InputStream inputStream, String fileName) {
         try {
         try {
 //            byte[] buf = new byte[1024];
 //            byte[] buf = new byte[1024];
@@ -298,9 +273,6 @@ public class ConvertUtil {
             if (stream != null) {
             if (stream != null) {
                 stream.close();
                 stream.close();
             }
             }
-//            if (out != null) {
-//                out.close();
-//            }
         }
         }
         return fileList;
         return fileList;
     }
     }

+ 47 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/ExamTaskUtil.java

@@ -0,0 +1,47 @@
+package com.qmth.teachcloud.common.util;
+
+import com.alibaba.fastjson.JSON;
+import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 命题任务工具类
+ */
+
+@Component
+public class ExamTaskUtil {
+    private final static Logger log = LoggerFactory.getLogger(ExamTaskUtil.class);
+
+    /**
+     * 解析试卷数据,指定了paperTypes,则返回对应卷型对象,为空,返回所有卷型对象
+     *
+     * @param path       试卷json
+     * @param paperTypes 指定卷型(可为空)
+     */
+    public static List<PaperInfoVo> parsePaperAttachmentPath(String path, String paperTypes) {
+        List<PaperInfoVo> paperInfoVos = new ArrayList<>();
+        if (StringUtils.isNotBlank(path)) {
+            paperInfoVos = JSON.parseArray(path, PaperInfoVo.class);
+            if (StringUtils.isBlank(paperTypes)) {
+                return paperInfoVos;
+            } else {
+                List<String> paperTypeList = Arrays.asList(paperTypes.split(","));
+                paperInfoVos = paperInfoVos.stream().filter(m -> paperTypeList.contains(m.getName())).collect(Collectors.toList());
+            }
+        }
+        return paperInfoVos;
+    }
+
+    public static List<PaperInfoVo> parsePaperAttachmentPath(String path) {
+        return parsePaperAttachmentPath(path, null);
+    }
+
+}

+ 3 - 3
teachcloud-task/src/main/java/com/qmth/teachcloud/task/service/impl/PrintFinishServiceImpl.java

@@ -1,13 +1,13 @@
 package com.qmth.teachcloud.task.service.impl;
 package com.qmth.teachcloud.task.service.impl;
 
 
 import com.qmth.distributed.print.business.bean.dto.initMarkData.ExamDetailCourseInitMarkDto;
 import com.qmth.distributed.print.business.bean.dto.initMarkData.ExamDetailCourseInitMarkDto;
-import com.qmth.distributed.print.business.bean.vo.PaperInfoVo;
+import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
+import com.qmth.teachcloud.common.util.ExamTaskUtil;
 import com.qmth.teachcloud.mark.bean.vo.parseCard.Struct;
 import com.qmth.teachcloud.mark.bean.vo.parseCard.Struct;
 import com.qmth.distributed.print.business.entity.ExamCard;
 import com.qmth.distributed.print.business.entity.ExamCard;
 import com.qmth.distributed.print.business.entity.ExamStudent;
 import com.qmth.distributed.print.business.entity.ExamStudent;
 import com.qmth.distributed.print.business.entity.ExamTaskDetail;
 import com.qmth.distributed.print.business.entity.ExamTaskDetail;
 import com.qmth.distributed.print.business.service.ExamCardService;
 import com.qmth.distributed.print.business.service.ExamCardService;
-import com.qmth.distributed.print.business.service.ExamDetailCourseService;
 import com.qmth.distributed.print.business.service.ExamStudentService;
 import com.qmth.distributed.print.business.service.ExamStudentService;
 import com.qmth.distributed.print.business.service.ExamTaskDetailService;
 import com.qmth.distributed.print.business.service.ExamTaskDetailService;
 import com.qmth.teachcloud.mark.utils.CardParseUtils;
 import com.qmth.teachcloud.mark.utils.CardParseUtils;
@@ -102,7 +102,7 @@ public class PrintFinishServiceImpl implements PrintFinishService {
         String paperType = dto.getPaperType();
         String paperType = dto.getPaperType();
         if (StringUtils.isNotBlank(paperType)) {
         if (StringUtils.isNotBlank(paperType)) {
             ExamTaskDetail examTaskDetail = examTaskDetailService.findByExamIdAndCourseCodeAndPaperNumber(dto.getSchoolId(), dto.getExamId(), dto.getCourseCode(), dto.getPaperNumber());
             ExamTaskDetail examTaskDetail = examTaskDetailService.findByExamIdAndCourseCodeAndPaperNumber(dto.getSchoolId(), dto.getExamId(), dto.getCourseCode(), dto.getPaperNumber());
-            List<PaperInfoVo> paperInfoVoList = ExamTaskDetail.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds(), paperType);
+            List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds(), paperType);
             for (PaperInfoVo paperInfoVo : paperInfoVoList) {
             for (PaperInfoVo paperInfoVo : paperInfoVoList) {
                 ExamCard examCard = examCardService.getById(paperInfoVo.getCardId());
                 ExamCard examCard = examCardService.getById(paperInfoVo.getCardId());
                 if (examCard != null) {
                 if (examCard != null) {