소스 검색

3.4.0 update

xiaofei 11 달 전
부모
커밋
1b07d6f282

+ 2 - 9
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamTaskDetailMapper.java

@@ -25,15 +25,6 @@ public interface ExamTaskDetailMapper extends BaseMapper<ExamTaskDetail> {
     List<ExamTaskDetailDto> listPage(@Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("relateType") String relateType, @Param("printPlanIdList") List<Long> printPlanIdList, @Param("courseId") Long courseId, @Param("paperNumber") String paperNumber, @Param("userName") String userName, @Param("dpr") DataPermissionRule dpr);
 
     List<String> listExamDetailCourse(@Param("schoolId") Long schoolId, @Param("paperType") String paperType, @Param("printPlanId") Long printPlanId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber);
-
-    /**
-     * 根据card查找json
-     *
-     * @param cardId
-     * @return
-     */
-    List<ExamTaskDetail> getExamTaskDetailByCardIdJson(@Param("cardId") Long cardId);
-
     /**
      * 根据examTaskId下载pdf
      *
@@ -41,4 +32,6 @@ public interface ExamTaskDetailMapper extends BaseMapper<ExamTaskDetail> {
      * @return
      */
     ExamTaskDetailPdfDownloadDto findPdfDownload(@Param("examTaskId") Long examTaskId);
+
+    int countByCardId(@Param("cardId") Long cardId);
 }

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

@@ -48,5 +48,5 @@ public interface ExamCardService extends IService<ExamCard> {
 
     boolean enable(Long id, Boolean enable);
 
-    void updateUsedById(Boolean used, List<Long> cardIds);
+    void updateUsedById(List<Long> cardIds);
 }

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

@@ -44,14 +44,6 @@ public interface ExamTaskDetailService extends IService<ExamTaskDetail> {
     ExamTaskDetail getByExamTaskIdNotValid(Long examTaskId);
     ExamTaskDetail getByExamTaskId(Long examTaskId);
 
-    /**
-     * 根据card查找json
-     *
-     * @param cardId
-     * @return
-     */
-    List<ExamTaskDetail> getExamTaskDetailByCardIdJson(Long cardId);
-
     /**
      * 根据examTaskId下载pdf
      *
@@ -69,4 +61,6 @@ public interface ExamTaskDetailService extends IService<ExamTaskDetail> {
     ExamTaskDetail getByExamIdAndCourseIdAndPaperNumber(Long examId, Long courseId, String paperNumber);
 
     void updateExposePaperType(Long examId, List<ExamDetailCourse> listByExamDetailId);
+
+    int countByCardId(Long cardId);
 }

+ 23 - 13
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamCardServiceImpl.java

@@ -7,20 +7,20 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.qmth.teachcloud.common.bean.marking.CardJpgResult;
-import com.qmth.teachcloud.common.bean.marking.ConvertJpgStorage;
 import com.qmth.distributed.print.business.bean.params.ExamCardParams;
 import com.qmth.distributed.print.business.bean.params.GenericExamCardParams;
 import com.qmth.distributed.print.business.entity.*;
-import com.qmth.distributed.print.business.enums.ExamCardStatusEnum;
 import com.qmth.distributed.print.business.enums.CardTypeEnum;
+import com.qmth.distributed.print.business.enums.ExamCardStatusEnum;
 import com.qmth.distributed.print.business.enums.MakeMethodEnum;
 import com.qmth.distributed.print.business.mapper.ExamCardMapper;
 import com.qmth.distributed.print.business.service.*;
+import com.qmth.distributed.print.business.util.CreatePdfUtil;
 import com.qmth.distributed.print.business.util.HtmlToJpgUtil;
 import com.qmth.distributed.print.business.util.PdfUtil;
-import com.qmth.distributed.print.business.util.CreatePdfUtil;
 import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
+import com.qmth.teachcloud.common.bean.marking.CardJpgResult;
+import com.qmth.teachcloud.common.bean.marking.ConvertJpgStorage;
 import com.qmth.teachcloud.common.bean.vo.FilePathVo;
 import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
 import com.qmth.teachcloud.common.contant.SystemConstant;
@@ -33,15 +33,18 @@ import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.PageSizeEnum;
 import com.qmth.teachcloud.common.enums.UploadFileEnum;
 import com.qmth.teachcloud.common.service.*;
-import com.qmth.teachcloud.common.util.*;
+import com.qmth.teachcloud.common.util.ExamTaskUtil;
+import com.qmth.teachcloud.common.util.FileUtil;
+import com.qmth.teachcloud.common.util.HtmlToPdfUtil;
+import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.mark.service.ScanAnswerCardService;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
-import javax.print.attribute.standard.Severity;
 import javax.servlet.http.HttpServletResponse;
 import java.io.File;
 import java.util.*;
@@ -352,8 +355,7 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
     @Override
     public Boolean deleteGeneric(Long id) {
         // 校验题卡是否被绑定
-        List<ExamTaskDetail> examTaskDetails = examTaskDetailService.getExamTaskDetailByCardIdJson(id);
-        if (examTaskDetails != null && examTaskDetails.size() > 0) {
+        if (examTaskDetailService.countByCardId(id) > 0) {
             throw ExceptionResultEnum.ERROR.exception("题卡已绑定命题任务,不能删除");
         }
         return this.removeById(id);
@@ -635,10 +637,18 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
     }
 
     @Override
-    public void updateUsedById(Boolean used, List<Long> cardIds) {
-        this.update(new UpdateWrapper<ExamCard>()
-                .lambda()
-                .set(ExamCard::getUsed, used)
-                .in(ExamCard::getId, cardIds));
+    public void updateUsedById(List<Long> cardIds) {
+        if (CollectionUtils.isEmpty(cardIds)) {
+            return;
+        }
+        for (Long cardId : cardIds) {
+            ExamCard examCard = this.getById(cardId);
+            if (examCard != null && (examCard.getType().equals(CardTypeEnum.CUSTOM) || (examCard.getType().equals(CardTypeEnum.GENERIC) && examCard.getCreateMethod().equals(CardCreateMethodEnum.STANDARD)))) {
+                UpdateWrapper<ExamCard> updateWrapper = new UpdateWrapper<>();
+                updateWrapper.lambda().set(ExamCard::getUsed, examTaskDetailService.countByCardId(cardId) > 0)
+                        .eq(ExamCard::getId, cardId);
+                this.update(updateWrapper);
+            }
+        }
     }
 }

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

@@ -38,6 +38,7 @@ import com.qmth.teachcloud.common.service.TeachcloudCommonService;
 import com.qmth.teachcloud.common.util.*;
 import com.qmth.teachcloud.mark.entity.MarkStudent;
 import com.qmth.teachcloud.mark.service.*;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.ss.usermodel.FillPatternType;
 import org.apache.poi.ss.usermodel.Font;
@@ -51,7 +52,6 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
@@ -818,7 +818,7 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
         examDetailCourseQueryWrapper.lambda().eq(ExamDetailCourse::getExamDetailId, examDetailId);
         List<ExamDetailCourse> examDetailCourses = examDetailCourseService.list(examDetailCourseQueryWrapper);
 
-        if (!CollectionUtils.isEmpty(examDetailCourses)) {
+        if (CollectionUtils.isNotEmpty(examDetailCourses)) {
             List<Long> examDetailCourseIds = examDetailCourses.stream().map(ExamDetailCourse::getId).collect(Collectors.toList());
 
             QueryWrapper<ExamStudent> examStudentQueryWrapper = new QueryWrapper<>();
@@ -836,7 +836,7 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
     @Override
     public void deleteByExamIdAndPaperNumber(Long schoolId, Long examId, String paperNumber) {
         List<ExamDetailCourse> examDetailCourseList = examDetailCourseService.listExamDetailByExamIdAndPaperNumber(schoolId, examId, paperNumber);
-        if (!CollectionUtils.isEmpty(examDetailCourseList)) {
+        if (CollectionUtils.isNotEmpty(examDetailCourseList)) {
             for (ExamDetailCourse examDetailCourse : examDetailCourseList) {
                 // 删除考场
                 this.removeById(examDetailCourse.getExamDetailId());

+ 15 - 25
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskDetailServiceImpl.java

@@ -18,7 +18,9 @@ import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.SysOrg;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.*;
-import com.qmth.teachcloud.common.service.*;
+import com.qmth.teachcloud.common.service.BasicRoleDataPermissionService;
+import com.qmth.teachcloud.common.service.CommonCacheService;
+import com.qmth.teachcloud.common.service.SysUserService;
 import com.qmth.teachcloud.common.util.ExamTaskUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.mark.service.MarkService;
@@ -263,7 +265,7 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
             this.updateBatchById(examTaskDetails);
 
             // 更新题卡使用状态
-            examCardService.updateUsedById(false, cardIds);
+            examCardService.updateUsedById(cardIds);
         }
     }
 
@@ -394,7 +396,7 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
                 // 考场内任一课程有扫描数据,不允许打回
                 boolean isScanPaper = scanPaperService.isScanByExamIdAndPaperNumber(examTask.getExamId(), examDetailCourse.getPaperNumber());
                 if (isScanPaper) {
-                    throw ExceptionResultEnum.ERROR.exception("有课程已开始扫描,无法打回");
+                    throw ExceptionResultEnum.ERROR.exception("课程已开始扫描,不允许打回");
                 }
                 if (StringUtils.isNotBlank(examDetailCourse.getPaperType())) {
                     paperTypeSet.addAll(Arrays.asList(examDetailCourse.getPaperType().split(",")));
@@ -404,7 +406,7 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
             // 已打印任务,必须先作废,未打印任务,必须先撤回。才允许打回
             long count = examDetailList.stream().filter(m -> ExamDetailStatusEnum.FINISH.equals(m.getStatus()) || ExamDetailStatusEnum.WAITING.equals(m.getStatus())).count();
             if (count > 0) {
-                throw ExceptionResultEnum.ERROR.exception("印刷任务有已打印或待印刷数据,无法打回");
+                throw ExceptionResultEnum.ERROR.exception("印刷任务有已打印或待印刷数据,不允许打回");
             }
 
             // 修改已曝光和未曝光类型
@@ -525,17 +527,6 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
         return examTaskDetail;
     }
 
-    /**
-     * 根据card查找json
-     *
-     * @param cardId
-     * @return
-     */
-    @Override
-    public List<ExamTaskDetail> getExamTaskDetailByCardIdJson(Long cardId) {
-        return examTaskDetailMapper.getExamTaskDetailByCardIdJson(cardId);
-    }
-
     /**
      * 根据examTaskId下载pdf
      *
@@ -602,14 +593,14 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
                     // 考场内任一课程有扫描数据,不允许打回
                     boolean isScanPaper = scanPaperService.isScanByExamIdAndPaperNumber(examTask.getExamId(), examDetailCourse.getPaperNumber());
                     if (isScanPaper) {
-                        throw ExceptionResultEnum.ERROR.exception("有课程已开始扫描,无法打回");
+                        throw ExceptionResultEnum.ERROR.exception("课程已开始扫描,不允许作废");
                     }
                 }
 
                 // 已打印任务,必须先作废,未打印任务,必须先撤回。才允许打回
                 long count = examDetailList.stream().filter(m -> (ExamDetailStatusEnum.FINISH.equals(m.getStatus()) && m.getNormal()) || ExamDetailStatusEnum.WAITING.equals(m.getStatus())).count();
                 if (count > 0) {
-                    throw ExceptionResultEnum.ERROR.exception("印刷任务有已打印且未作废或者未撤回数据,无法打回");
+                    throw ExceptionResultEnum.ERROR.exception("印刷任务有已打印且未作废或者未撤回数据,不允许作废");
                 }
             }
 
@@ -709,6 +700,11 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
         }
     }
 
+    @Override
+    public int countByCardId(Long cardId) {
+        return examTaskDetailMapper.countByCardId(cardId);
+    }
+
     /**
      * 卷库校验
      *
@@ -791,16 +787,10 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
 
         // 将旧题卡更新为未绑定
         List<PaperInfoVo> oldPaperAttachmentIdsJson = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetailTemp.getPaperAttachmentIds());
-        List<Long> oldCardIds = oldPaperAttachmentIdsJson.stream().filter(m -> CardTypeEnum.CUSTOM.name().equals(m.getCardType())).map(m -> Long.parseLong(m.getCardId())).collect(Collectors.toList());
-        if (CollectionUtils.isNotEmpty(oldCardIds)) {
-            examCardService.updateUsedById(false, oldCardIds);
-        }
+        examCardService.updateUsedById(oldPaperAttachmentIdsJson.stream().filter(m -> StringUtils.isNotBlank(m.getCardId())).map(m -> Long.parseLong(m.getCardId())).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 -> Long.valueOf(m.getCardId())).collect(Collectors.toList());
-        if (CollectionUtils.isNotEmpty(cardIds)) {
-            examCardService.updateUsedById(true, cardIds);
-        }
+        examCardService.updateUsedById(newPaperAttachmentIdsJson.stream().filter(m -> StringUtils.isNotBlank(m.getCardId())).map(m -> Long.valueOf(m.getCardId())).collect(Collectors.toList()));
     }
 }

+ 4 - 20
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -758,11 +758,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         examTaskDetailService.saveOrUpdate(examTaskDetail);
 
         // 将题卡更新为已绑定
-        List<PaperInfoVo> paperAttachmentIdsJson = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
-        List<Long> cardIds = paperAttachmentIdsJson.stream().filter(m -> CardTypeEnum.CUSTOM.name().equals(m.getCardType())).map(m -> Long.valueOf(m.getCardId())).collect(Collectors.toList());
-        if (CollectionUtils.isNotEmpty(cardIds)) {
-            examCardService.updateUsedById(true, cardIds);
-        }
+        List<PaperInfoVo> paperAttachmentList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
+        examCardService.updateUsedById(paperAttachmentList.stream().filter(m -> StringUtils.isNotBlank(m.getCardId())).map(m -> Long.parseLong(m.getCardId())).collect(Collectors.toList()));
         return map;
     }
 
@@ -998,16 +995,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
             String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
             if (StringUtils.isNotBlank(paperAttachmentIds)) {
                 List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(paperAttachmentIds);
-                for (PaperInfoVo paperInfoVo : paperInfoVoList) {
-                    if (StringUtils.isBlank(paperInfoVo.getCardId())) {
-                        continue;
-                    }
-                    Long cardId = Long.valueOf(paperInfoVo.getCardId());
-                    ExamCard examCard = examCardService.getById(cardId);
-                    if (examCard.getType().equals(CardTypeEnum.CUSTOM) || (examCard.getType().equals(CardTypeEnum.GENERIC) && examCard.getCreateMethod().equals(CardCreateMethodEnum.STANDARD))) {
-                        examCardService.updateUsedById(false, Arrays.asList(new Long[]{cardId}));
-                    }
-                }
+                examCardService.updateUsedById(paperInfoVoList.stream().filter(m -> StringUtils.isNotBlank(m.getCardId())).map(m -> Long.parseLong(m.getCardId())).collect(Collectors.toList()));
             }
         }
         this.removeById(examTaskId);
@@ -1102,11 +1090,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
             String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
             List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(paperAttachmentIds);
             // 将题卡更新为已绑定
-            for (PaperInfoVo paperInfoVo : paperInfoVoList) {
-                if (CardTypeEnum.CUSTOM.name().equals(paperInfoVo.getCardType())) {
-                    examCardService.updateUsedById(true, Arrays.asList(new Long[]{Long.valueOf(paperInfoVo.getCardId())}));
-                }
-            }
+            examCardService.updateUsedById(paperInfoVoList.stream().filter(m -> StringUtils.isNotBlank(m.getCardId())).map(m -> Long.parseLong(m.getCardId())).collect(Collectors.toList()));
             // 更新题库试卷表
             for (PaperInfoVo paperInfoVo : paperInfoVoList) {
                 if (StringUtils.isNotBlank(paperInfoVo.getUuid())) {

+ 16 - 17
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskWholeServiceImpl.java

@@ -17,15 +17,12 @@ import com.qmth.teachcloud.common.bean.vo.FilePathVo;
 import com.qmth.teachcloud.common.bean.vo.PrintPathVo;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicAttachment;
-import com.qmth.teachcloud.common.enums.ClassifyEnum;
 import com.qmth.teachcloud.common.enums.CreatePdfTypeEnum;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.UploadFileEnum;
 import com.qmth.teachcloud.common.service.BasicAttachmentService;
 import com.qmth.teachcloud.common.service.FileUploadService;
 import com.qmth.teachcloud.common.util.FileUtil;
-import com.sun.mail.smtp.DigestMD5;
-import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
@@ -44,7 +41,7 @@ import static java.lang.String.valueOf;
 @Service
 public class ExamTaskWholeServiceImpl extends ServiceImpl<ExamTaskWholeMapper, ExamTaskWhole> implements ExamTaskWholeService {
 
-    private Map<String, String> map = new HashMap();
+    private List<String> examTaskWholeList = new ArrayList<>();
     @Resource
     private BasicAttachmentService basicAttachmentService;
     @Resource
@@ -56,14 +53,15 @@ public class ExamTaskWholeServiceImpl extends ServiceImpl<ExamTaskWholeMapper, E
 
     @Override
     public void checkAndCreateTask(Long examId, Long courseId, String paperNumber) {
-        boolean isAllPrintFinish = examDetailService.allExamDetailIsExist(examId, courseId, paperNumber);
-        ExamTaskWhole examTaskWhole = this.getByExamIdAndCourseIdAndPaperNumber(examId, courseId, paperNumber);
-        if (isAllPrintFinish) {
-            String key = examId + valueOf(courseId) + paperNumber;
-            if(map.containsKey(key)){
+        String key = examId + valueOf(courseId) + paperNumber;
+        try {
+            if (examTaskWholeList.contains(key)) {
                 return;
             }
-            try {
+            examTaskWholeList.add(key);
+            boolean isAllPrintFinish = examDetailService.allExamDetailIsExist(examId, courseId, paperNumber);
+            ExamTaskWhole examTaskWhole = this.getByExamIdAndCourseIdAndPaperNumber(examId, courseId, paperNumber);
+            if (isAllPrintFinish) {
                 if (examTaskWhole != null) {
                     if (ExamTaskWholeStatusEnum.RUNNING.equals(examTaskWhole.getStatus())) {
                         throw ExceptionResultEnum.ERROR.exception("文件生成中,请稍后再试");
@@ -83,14 +81,15 @@ public class ExamTaskWholeServiceImpl extends ServiceImpl<ExamTaskWholeMapper, E
                 }
                 // 开始生成
                 asyncCreateWholePdfTemplateService.createWholePdf(examTaskWhole);
-            } catch (ApiException e) {
-                throw new RuntimeException(e);
-            } finally {
-                map.remove(key);
+
+            } else {
+                this.removeById(examTaskWhole.getId());
+                throw ExceptionResultEnum.ERROR.exception("部分考场未生成PDF,无法合并文件");
             }
-        } else {
-            this.removeById(examTaskWhole.getId());
-            throw ExceptionResultEnum.ERROR.exception("部分考场未生成PDF,无法合并文件");
+        } catch (ApiException e) {
+            throw ExceptionResultEnum.ERROR.exception(e.getMessage());
+        } finally {
+            examTaskWholeList.remove(key);
         }
     }
 

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

@@ -105,8 +105,7 @@
                 AND a.course_id = #{courseId}
                 AND a.paper_number = #{paperNumber}
     </select>
-    <select id="listExamDetailByExamIdAndPaperNumber"
-            resultMap="BaseResultMap">
+    <select id="listExamDetailByExamIdAndPaperNumber" resultMap="BaseResultMap">
         SELECT
             *
         FROM

+ 11 - 19
distributed-print-business/src/main/resources/mapper/ExamTaskDetailMapper.xml

@@ -163,25 +163,6 @@
             </if>
         </where>
     </select>
-
-    <select id="getExamTaskDetailByCardIdJson" resultType="com.qmth.distributed.print.business.entity.ExamTaskDetail">
-        select
-            *
-        from
-            (
-                select
-                 REPLACE(substring_index(substring_index(CONVERT((etd.paper_attachment_ids ->>'$[*].cardId')
-                    USING utf8), ']', 1), '[',-1),'"','') as cardId,
-                    etd.*
-                from
-                    exam_task_detail etd) t
-        <where> 1 = 1
-            <if test="cardId != null and cardId != ''">
-                and FIND_IN_SET(#{cardId}, t.cardId)
-            </if>
-        </where>
-    </select>
-
     <select id="findPdfDownload" resultType="com.qmth.distributed.print.business.bean.dto.ExamTaskDetailPdfDownloadDto">
         select
             etd.*,
@@ -205,4 +186,15 @@
         GROUP BY
             etd.id
     </select>
+    <select id="countByCardId" resultType="java.lang.Integer">
+        select
+            count(1)
+        from
+            (select
+                 REPLACE(substring_index(substring_index(CONVERT((etd.paper_attachment_ids ->>'$[*].cardId')
+                                                                 USING utf8), ']', 1), '[',-1),'"','') as cardId
+             from
+                 exam_task_detail etd) t
+        where FIND_IN_SET(#{cardId}, t.cardId)
+    </select>
 </mapper>