Pārlūkot izejas kodu

卷库查询BUG修改

wangliang 2 gadi atpakaļ
vecāks
revīzija
4214219bf4

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

@@ -5,12 +5,11 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 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.ExamTaskDetailPdfDownloadDto;
 import com.qmth.distributed.print.business.bean.params.RelatePaperParam;
+import com.qmth.distributed.print.business.cache.CreatePdfCacheUtil;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.CardTypeEnum;
 import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
@@ -36,7 +35,6 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
-import java.io.IOException;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -418,9 +416,12 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
         examTaskDetailUpdateWrapper.lambda().set(ExamTaskDetail::getPaperType, examTaskDetail.getPaperType())
                 .set(ExamTaskDetail::getPaperAttachmentIds, examTaskDetail.getPaperAttachmentIds())
                 .set(ExamTaskDetail::getUnexposedPaperType, unexposedPaperType)
+                .set(ExamTaskDetail::getRelatePaperType, null)
+                .set(ExamTaskDetail::getDrawCount, examTaskDetail.getDrawCount())
                 .eq(ExamTaskDetail::getExamTaskId, examTaskDetail.getExamTaskId());
         this.update(examTaskDetailUpdateWrapper);
 
+
         QueryWrapper<ExamTaskDetail> examTaskDetailQueryWrapper = new QueryWrapper<>();
         examTaskDetailQueryWrapper.lambda().eq(ExamTaskDetail::getExamTaskId, examTaskDetail.getExamTaskId());
         List<ExamTaskDetail> examTaskDetailList = this.list(examTaskDetailQueryWrapper);
@@ -435,6 +436,15 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
         ExamTask examTask = examTaskService.getById(examTaskDetail.getExamTaskId());
         List<ExamDetail> examDetails = examDetailService.listByCourseCodeAndPaperNumber(examTask.getSchoolId(), examTask.getCourseCode(), examTask.getPaperNumber());
         if (!CollectionUtils.isEmpty(examDetails)) {
+            StringJoiner stringJoiner = new StringJoiner("_");
+            stringJoiner.add(String.valueOf(examDetails.get(0).getSchoolId()))
+                    .add(String.valueOf(examDetails.get(0).getExamStartTime()))
+                    .add(String.valueOf(examDetails.get(0).getExamEndTime()))
+                    .add(examTask.getCourseCode())
+                    .add(examTask.getPaperNumber());
+            String key = stringJoiner.toString();
+            CreatePdfCacheUtil.deletePaperType(key);
+
             List<ExamDetail> examDetailList = examDetails.stream().filter(m -> m.getStatus().equals(ExamDetailStatusEnum.WAITING)).collect(Collectors.toList());
             for (ExamDetail examDetail : examDetailList) {
                 examDetail.setStatus(ExamDetailStatusEnum.NEW);
@@ -516,13 +526,13 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
         if (!examDetailDtoList.isEmpty()) {
             // 所有未曝光类型不为空的数据
             List<String> unposedPaperList = examDetailDtoList.stream().filter(m -> StringUtils.isNotBlank(m.getUnexposedPaperType())).map(m -> m.getUnexposedPaperType()).collect(Collectors.toList());
-            if(examDetailDtoList.size() == unposedPaperList.size()){
+            if (examDetailDtoList.size() == unposedPaperList.size()) {
                 // 取所有命题任务未曝光类型的交集
                 List<String> basePaperTypes = Arrays.asList(unposedPaperList.get(0).split(","));
                 for (String basePaperType : basePaperTypes) {
                     for (String s : unposedPaperList) {
                         List<String> particPaperTypes = Arrays.asList(s.split(","));
-                        if(!particPaperTypes.contains(basePaperType)){
+                        if (!particPaperTypes.contains(basePaperType)) {
                             break;
                         }
                     }
@@ -615,7 +625,7 @@ 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<Long> oldCardIds = oldPaperAttachmentIdsJson.stream().filter(m -> CardTypeEnum.CUSTOM.name().equals(m.getString("cardType"))).map(m -> m.getLong("cardId")).collect(Collectors.toList());
         for (Long cardId : oldCardIds) {
             UpdateWrapper<ExamCard> cardUpdateWrapper = new UpdateWrapper<>();
             cardUpdateWrapper.lambda().set(ExamCard::getUsed, false).eq(ExamCard::getId, cardId);
@@ -624,7 +634,7 @@ 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<Long> cardIds = newPaperAttachmentIdsJson.stream().filter(m -> CardTypeEnum.CUSTOM.name().equals(m.getString("cardType"))).map(m -> m.getLong("cardId")).collect(Collectors.toList());
         for (Long cardId : cardIds) {
             UpdateWrapper<ExamCard> cardUpdateWrapper = new UpdateWrapper<>();
             cardUpdateWrapper.lambda().set(ExamCard::getUsed, true).eq(ExamCard::getId, cardId);

+ 1 - 1
teachcloud-task/src/main/resources/application.properties

@@ -69,7 +69,7 @@ com.qmth.fss.private.config=../static/
 com.qmth.fss.private.server=/static/
 
 #\u7CFB\u7EDF\u914D\u7F6E
-sys.config.oss=false
+sys.config.oss=true
 sys.config.htmlToPdfUrl=/usr/local/bin/wkhtmltopdf
 sys.config.serverUpload=
 spring.resources.static-locations=file:${sys.config.serverUpload},classpath:/META-INF/resources/,classpath:/resources/