xiaofei пре 9 месеци
родитељ
комит
85352dbd35

+ 192 - 169
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamCardServiceImpl.java

@@ -7,6 +7,8 @@ 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.boot.api.exception.ApiException;
+import com.qmth.boot.core.concurrent.service.ConcurrentService;
 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.*;
@@ -37,6 +39,7 @@ 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.enums.LockType;
 import com.qmth.teachcloud.mark.service.ScanAnswerCardService;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -88,6 +91,8 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
     private ScanAnswerCardService scanAnswerCardService;
     @Resource
     private BasicPrintConfigService basicPrintConfigService;
+    @Resource
+    private ConcurrentService concurrentService;
 
     @Transactional
     @Override
@@ -95,78 +100,86 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         SysUser user = (SysUser) ServletUtil.getRequestUser();
 
+        concurrentService.getReadWriteLock(LockType.CUSTOM_CARD_SAVE + "-" + examCardParams.getCourseId() + examCardParams.getTitle()).writeLock().lock();
         // 新增
         ExamCard examCard;
-        if (examCardParams.getTitle().getBytes().length > 80) {
-            throw ExceptionResultEnum.ERROR.exception("标题最长只能输入80个字符");
-        }
-        if (examCardParams.getId() == null) {
-            validateCardData(examCardParams);
+        try {
+            if (examCardParams.getTitle().getBytes().length > 80) {
+                throw ExceptionResultEnum.ERROR.exception("标题最长只能输入80个字符");
+            }
+            if (examCardParams.getId() == null) {
+                validateCardData(examCardParams);
+
+                String title = examCardParams.getPaperId() != null ? examCardParams.getTitle() + SystemConstant.generateRandomNumber(4) : examCardParams.getTitle();
+
+                QueryWrapper<ExamCard> queryWrapper = new QueryWrapper<>();
+                queryWrapper.lambda().eq(ExamCard::getSchoolId, schoolId)
+                        .eq(ExamCard::getCourseId, examCardParams.getCourseId())
+                        .eq(ExamCard::getTitle, title);
+                List<ExamCard> examCardList = this.list(queryWrapper);
+                if (!examCardList.isEmpty()) {
+                    throw ExceptionResultEnum.ERROR.exception("课程下已存在相同的题卡名称[" + title + "]");
+                }
 
-            String title = examCardParams.getPaperId() != null ? examCardParams.getTitle() + SystemConstant.generateRandomNumber(4) : examCardParams.getTitle();
+                examCard = new ExamCard();
+                examCard.setSchoolId(schoolId);
+                //            if (Objects.isNull(examCardParams.getTemplateId())) {
+                //                examCard.setOrgId(basicCourseService.getOrgIdBySchoolIdAndCourseCode(schoolId, examCardParams.getCourseCode()));
+                //            } else {
+                //                examCard.setOrgId(user.getOrgId());
+                //            }
+                examCard.setCourseId(examCardParams.getCourseId());
+                examCard.setTitle(title);
+                examCard.setMakeMethod(examCardParams.getMakeMethod());
+                examCard.setStatus(examCardParams.getStatus());
+                examCard.setType(examCardParams.getType());
+                examCard.setAttachmentId(examCardParams.getAttachmentId());
+                examCard.setCardRuleId(examCardParams.getCardRuleId());
+                examCard.setPaperId(examCardParams.getPaperId());
+                examCard.setPageSize(examCardParams.getPageSize());
+                examCard.insertInfo(user.getId());
+            }
+            // 修改
+            else {
+                String title = examCardParams.getTitle();
+                QueryWrapper<ExamCard> queryWrapper = new QueryWrapper<>();
+                queryWrapper.lambda().eq(ExamCard::getSchoolId, schoolId)
+                        .eq(ExamCard::getCourseId, examCardParams.getCourseId())
+                        .eq(ExamCard::getTitle, title)
+                        .ne(ExamCard::getId, examCardParams.getId());
+                List<ExamCard> examCardList = this.list(queryWrapper);
+                if (!examCardList.isEmpty()) {
+                    throw ExceptionResultEnum.ERROR.exception("题卡名称已存在");
+                }
 
-            QueryWrapper<ExamCard> queryWrapper = new QueryWrapper<>();
-            queryWrapper.lambda().eq(ExamCard::getSchoolId, schoolId)
-                    .eq(ExamCard::getCourseId, examCardParams.getCourseId())
-                    .eq(ExamCard::getTitle, title);
-            List<ExamCard> examCardList = this.list(queryWrapper);
-            if (!examCardList.isEmpty()) {
-                throw ExceptionResultEnum.ERROR.exception("课程下已存在相同的题卡名称[" + title + "]");
+                examCard = this.getById(examCardParams.getId());
+                examCard.setTitle(title);
+                examCard.setStatus(examCardParams.getStatus());
+                examCard.setUpdateId(user.getId());
+                examCard.setUpdateTime(System.currentTimeMillis());
             }
 
-            examCard = new ExamCard();
-            examCard.setSchoolId(schoolId);
-//            if (Objects.isNull(examCardParams.getTemplateId())) {
-//                examCard.setOrgId(basicCourseService.getOrgIdBySchoolIdAndCourseCode(schoolId, examCardParams.getCourseCode()));
-//            } else {
-//                examCard.setOrgId(user.getOrgId());
-//            }
-            examCard.setCourseId(examCardParams.getCourseId());
-            examCard.setTitle(title);
-            examCard.setMakeMethod(examCardParams.getMakeMethod());
-            examCard.setStatus(examCardParams.getStatus());
-            examCard.setType(examCardParams.getType());
-            examCard.setAttachmentId(examCardParams.getAttachmentId());
-            examCard.setCardRuleId(examCardParams.getCardRuleId());
-            examCard.setPaperId(examCardParams.getPaperId());
-            examCard.setPageSize(examCardParams.getPageSize());
-            examCard.insertInfo(user.getId());
-        }
-        // 修改
-        else {
-            String title = examCardParams.getTitle();
-            QueryWrapper<ExamCard> queryWrapper = new QueryWrapper<>();
-            queryWrapper.lambda().eq(ExamCard::getSchoolId, schoolId)
-                    .eq(ExamCard::getCourseId, examCardParams.getCourseId())
-                    .eq(ExamCard::getTitle, title)
-                    .ne(ExamCard::getId, examCardParams.getId());
-            List<ExamCard> examCardList = this.list(queryWrapper);
-            if (!examCardList.isEmpty()) {
-                throw ExceptionResultEnum.ERROR.exception("题卡名称已存在");
+            // 自动保存
+            if (ExamCardStatusEnum.SUBMIT.equals(examCardParams.getStatus())) {
+                examCard.setContent(examCardParams.getContent());
+                examCard.setStageContent(null);
+                examCard.setHtmlContent(examCardParams.getHtmlContent());
+                createJpgImage(examCard);
+            } else {
+                examCard.setStageContent(examCardParams.getContent());
             }
+            this.saveOrUpdate(examCard);
 
-            examCard = this.getById(examCardParams.getId());
-            examCard.setTitle(title);
-            examCard.setStatus(examCardParams.getStatus());
-            examCard.setUpdateId(user.getId());
-            examCard.setUpdateTime(System.currentTimeMillis());
-        }
 
-        // 自动保存
-        if (ExamCardStatusEnum.SUBMIT.equals(examCardParams.getStatus())) {
-            examCard.setContent(examCardParams.getContent());
-            examCard.setStageContent(null);
-            examCard.setHtmlContent(examCardParams.getHtmlContent());
-            createJpgImage(examCard);
-        } else {
-            examCard.setStageContent(examCardParams.getContent());
+            Map<String, String> map = new HashMap<>();
+            map.put("id", String.valueOf(examCard.getId()));
+            map.put("title", examCard.getTitle());
+            return map;
+        } catch (ApiException e) {
+            throw new RuntimeException(e);
+        } finally {
+            concurrentService.getReadWriteLock(LockType.CUSTOM_CARD_SAVE + "-" + examCardParams.getCourseId() + examCardParams.getTitle()).writeLock().unlock();
         }
-        this.saveOrUpdate(examCard);
-
-        Map<String, String> map = new HashMap<>();
-        map.put("id", String.valueOf(examCard.getId()));
-        map.put("title", examCard.getTitle());
-        return map;
     }
 
     @Override
@@ -233,125 +246,135 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
 
-        QueryWrapper<ExamCard> checkTitleQueryWrapper = new QueryWrapper<>();
-        checkTitleQueryWrapper.lambda().eq(ExamCard::getSchoolId, schoolId)
-                .eq(ExamCard::getType, CardTypeEnum.GENERIC)
-                .eq(ExamCard::getTitle, params.getTitle().trim());
-        ExamCard checkTitleExamCardList = this.getOne(checkTitleQueryWrapper);
-
-        ExamCard examCard = new ExamCard();
-        // 新增
-        if (Objects.isNull(params.getId())) {
-            if (checkTitleExamCardList != null) {
-                throw ExceptionResultEnum.ERROR.exception("题卡名称已使用");
-            }
-            // 保存题卡
-            examCard.setId(SystemConstant.getDbUuid());
-            examCard.setSchoolId(schoolId);
-            examCard.setOrgId(sysUser.getOrgId());
-
-            examCard.setTitle(params.getTitle());
-            examCard.setMakeMethod(MakeMethodEnum.SELECT); // 默认值
-            // 上传题卡,状态为提交
-            examCard.setStatus(CardCreateMethodEnum.UPLOAD.equals(params.getCreateMethod()) ? ExamCardStatusEnum.SUBMIT : ExamCardStatusEnum.valueOf(params.getStatus()));
-            examCard.setType(CardTypeEnum.GENERIC); // 默认值
-            examCard.setCreateMethod(params.getCreateMethod());
-            examCard.setAttachmentId(params.getAttachmentId());
-            examCard.setEnable(true); // 默认值
-            examCard.setCardRuleId(params.getCardRuleId());
-            examCard.setRemark(params.getRemark());
-            examCard.setPageSize(params.getPageSize());
-            examCard.setCreateId(sysUser.getId());
-            examCard.setCreateTime(System.currentTimeMillis());
-            this.save(examCard);
-
-            // 方式为上传
-            String htmlContent;
-            if (CardCreateMethodEnum.UPLOAD.equals(params.getCreateMethod())) {
-                if (params.getAttachmentId() == null) {
-                    throw ExceptionResultEnum.ERROR.exception("请上传模板文件");
-                }
-                BasicAttachment attachment = basicAttachmentService.getById(params.getAttachmentId());
-                if (attachment == null) {
-                    throw ExceptionResultEnum.ERROR.exception("无模板文件记录,请重新上传");
-                }
-                if (!SystemConstant.HTML_PREFIX.equalsIgnoreCase(attachment.getType())) {
-                    throw ExceptionResultEnum.ERROR.exception("只能上传后缀为.html文件");
+        ExamCard examCard;
+        concurrentService.getReadWriteLock(LockType.CUSTOM_CARD_SAVE + "-" + schoolId + CardTypeEnum.GENERIC + params.getTitle()).writeLock().tryLock();
+        try {
+            QueryWrapper<ExamCard> checkTitleQueryWrapper = new QueryWrapper<>();
+            checkTitleQueryWrapper.lambda().eq(ExamCard::getSchoolId, schoolId)
+                    .eq(ExamCard::getType, CardTypeEnum.GENERIC)
+                    .eq(ExamCard::getTitle, params.getTitle().trim());
+            ExamCard checkTitleExamCardList = this.getOne(checkTitleQueryWrapper);
+
+            // 新增
+            if (Objects.isNull(params.getId())) {
+                if (checkTitleExamCardList != null) {
+                    throw ExceptionResultEnum.ERROR.exception("题卡名称已使用");
                 }
-                htmlContent = teachcloudCommonService.readFileContent(attachment.getPath());
-                examCard.setHtmlContent(htmlContent);
-            }
-            // 方式为自定义
-            else if (CardCreateMethodEnum.STANDARD.equals(params.getCreateMethod())
-                    || CardCreateMethodEnum.FREE.equals(params.getCreateMethod())) {
-                if (ExamCardStatusEnum.SUBMIT.name().equals(params.getStatus())) {
-                    examCard.setContent(params.getContent());
-                    examCard.setStageContent(null);
-                    htmlContent = params.getHtmlContent();
+                examCard = new ExamCard();
+                // 保存题卡
+                examCard.setId(SystemConstant.getDbUuid());
+                examCard.setSchoolId(schoolId);
+                examCard.setOrgId(sysUser.getOrgId());
+
+                examCard.setTitle(params.getTitle());
+                examCard.setMakeMethod(MakeMethodEnum.SELECT); // 默认值
+                // 上传题卡,状态为提交
+                examCard.setStatus(CardCreateMethodEnum.UPLOAD.equals(params.getCreateMethod()) ? ExamCardStatusEnum.SUBMIT : ExamCardStatusEnum.valueOf(params.getStatus()));
+                examCard.setType(CardTypeEnum.GENERIC); // 默认值
+                examCard.setCreateMethod(params.getCreateMethod());
+                examCard.setAttachmentId(params.getAttachmentId());
+                examCard.setEnable(true); // 默认值
+                examCard.setCardRuleId(params.getCardRuleId());
+                examCard.setRemark(params.getRemark());
+                examCard.setPageSize(params.getPageSize());
+                examCard.setCreateId(sysUser.getId());
+                examCard.setCreateTime(System.currentTimeMillis());
+                this.save(examCard);
+
+                // 方式为上传
+                String htmlContent;
+                if (CardCreateMethodEnum.UPLOAD.equals(params.getCreateMethod())) {
+                    if (params.getAttachmentId() == null) {
+                        throw ExceptionResultEnum.ERROR.exception("请上传模板文件");
+                    }
+                    BasicAttachment attachment = basicAttachmentService.getById(params.getAttachmentId());
+                    if (attachment == null) {
+                        throw ExceptionResultEnum.ERROR.exception("无模板文件记录,请重新上传");
+                    }
+                    if (!SystemConstant.HTML_PREFIX.equalsIgnoreCase(attachment.getType())) {
+                        throw ExceptionResultEnum.ERROR.exception("只能上传后缀为.html文件");
+                    }
+                    htmlContent = teachcloudCommonService.readFileContent(attachment.getPath());
                     examCard.setHtmlContent(htmlContent);
+                }
+                // 方式为自定义
+                else if (CardCreateMethodEnum.STANDARD.equals(params.getCreateMethod())
+                        || CardCreateMethodEnum.FREE.equals(params.getCreateMethod())) {
+                    if (ExamCardStatusEnum.SUBMIT.name().equals(params.getStatus())) {
+                        examCard.setContent(params.getContent());
+                        examCard.setStageContent(null);
+                        htmlContent = params.getHtmlContent();
+                        examCard.setHtmlContent(htmlContent);
+                    } else {
+                        examCard.setStageContent(params.getContent());
+                    }
                 } else {
-                    examCard.setStageContent(params.getContent());
+                    throw ExceptionResultEnum.ERROR.exception("不存在的题卡创建方式");
                 }
-            } else {
-                throw ExceptionResultEnum.ERROR.exception("不存在的题卡创建方式");
-            }
-        }
-        // 修改
-        else {
-            examCard = this.getById(params.getId());
-            if (checkTitleExamCardList != null && !Objects.equals(params.getId(), examCard.getId())) {
-                throw ExceptionResultEnum.ERROR.exception("题卡名称重复");
             }
-            examCard.setTitle(params.getTitle());
-            examCard.setAttachmentId(params.getAttachmentId());
-            examCard.setCardRuleId(params.getCardRuleId());
-            // 上传题卡,状态为提交
-            examCard.setStatus(CardCreateMethodEnum.UPLOAD.equals(params.getCreateMethod()) ? ExamCardStatusEnum.SUBMIT : ExamCardStatusEnum.valueOf(params.getStatus()));
-            examCard.setRemark(params.getRemark());
-            examCard.setUpdateId(sysUser.getId());
-            examCard.setUpdateTime(System.currentTimeMillis());
-
-            String htmlContent;
-            // 方式为上传
-            if (CardCreateMethodEnum.UPLOAD.equals(params.getCreateMethod())) {
-                if (params.getAttachmentId() == null) {
-                    throw ExceptionResultEnum.ERROR.exception("请上传模板文件");
-                }
-                BasicAttachment attachment = basicAttachmentService.getById(params.getAttachmentId());
-                if (attachment == null) {
-                    throw ExceptionResultEnum.ERROR.exception("无模板文件记录,请重新上传");
-                }
-                if (!SystemConstant.HTML_PREFIX.equalsIgnoreCase(attachment.getType())) {
-                    throw ExceptionResultEnum.ERROR.exception("只能上传后缀为.html文件");
+            // 修改
+            else {
+                examCard = this.getById(params.getId());
+                if (checkTitleExamCardList != null && !Objects.equals(params.getId(), examCard.getId())) {
+                    throw ExceptionResultEnum.ERROR.exception("题卡名称重复");
                 }
-                htmlContent = teachcloudCommonService.readFileContent(attachment.getPath());
-                examCard.setHtmlContent(htmlContent);
+                examCard.setTitle(params.getTitle());
+                examCard.setAttachmentId(params.getAttachmentId());
+                examCard.setCardRuleId(params.getCardRuleId());
                 // 上传题卡,状态为提交
-                examCard.setStatus(ExamCardStatusEnum.SUBMIT);
-            }
-            // 方式为自定义
-            else if (CardCreateMethodEnum.STANDARD.equals(params.getCreateMethod()) || CardCreateMethodEnum.FREE.equals(params.getCreateMethod())) {
-                if (ExamCardStatusEnum.SUBMIT.name().equals(params.getStatus())) {
-                    examCard.setContent(params.getContent());
-                    examCard.setStageContent(null);
-                    htmlContent = params.getHtmlContent();
+                examCard.setStatus(CardCreateMethodEnum.UPLOAD.equals(params.getCreateMethod()) ? ExamCardStatusEnum.SUBMIT : ExamCardStatusEnum.valueOf(params.getStatus()));
+                examCard.setRemark(params.getRemark());
+                examCard.setUpdateId(sysUser.getId());
+                examCard.setUpdateTime(System.currentTimeMillis());
+
+                String htmlContent;
+                // 方式为上传
+                if (CardCreateMethodEnum.UPLOAD.equals(params.getCreateMethod())) {
+                    if (params.getAttachmentId() == null) {
+                        throw ExceptionResultEnum.ERROR.exception("请上传模板文件");
+                    }
+                    BasicAttachment attachment = basicAttachmentService.getById(params.getAttachmentId());
+                    if (attachment == null) {
+                        throw ExceptionResultEnum.ERROR.exception("无模板文件记录,请重新上传");
+                    }
+                    if (!SystemConstant.HTML_PREFIX.equalsIgnoreCase(attachment.getType())) {
+                        throw ExceptionResultEnum.ERROR.exception("只能上传后缀为.html文件");
+                    }
+                    htmlContent = teachcloudCommonService.readFileContent(attachment.getPath());
                     examCard.setHtmlContent(htmlContent);
+                    // 上传题卡,状态为提交
+                    examCard.setStatus(ExamCardStatusEnum.SUBMIT);
+                }
+                // 方式为自定义
+                else if (CardCreateMethodEnum.STANDARD.equals(params.getCreateMethod()) || CardCreateMethodEnum.FREE.equals(params.getCreateMethod())) {
+                    if (ExamCardStatusEnum.SUBMIT.name().equals(params.getStatus())) {
+                        examCard.setContent(params.getContent());
+                        examCard.setStageContent(null);
+                        htmlContent = params.getHtmlContent();
+                        examCard.setHtmlContent(htmlContent);
+                    } else {
+                        examCard.setStageContent(params.getContent());
+                    }
                 } else {
-                    examCard.setStageContent(params.getContent());
+                    throw ExceptionResultEnum.ERROR.exception("不存在的题卡创建方式");
                 }
-            } else {
-                throw ExceptionResultEnum.ERROR.exception("不存在的题卡创建方式");
             }
+            if (ExamCardStatusEnum.SUBMIT.name().equals(params.getStatus())) {
+                // 生成题卡图片
+                createJpgImage(examCard);
+            }
+            this.saveOrUpdate(examCard);
+            Map<String, String> map = new HashMap<>();
+            map.put("id", String.valueOf(examCard.getId()));
+            map.put("title", examCard.getTitle());
+            return map;
+        } catch (ApiException e) {
+            throw new RuntimeException(e);
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);
+        } finally {
+            concurrentService.getReadWriteLock(LockType.CUSTOM_CARD_SAVE + "-" + schoolId + CardTypeEnum.GENERIC + params.getTitle()).writeLock().unlock();
         }
-        if (ExamCardStatusEnum.SUBMIT.name().equals(params.getStatus())) {
-            // 生成题卡图片
-            createJpgImage(examCard);
-        }
-        this.saveOrUpdate(examCard);
-        Map<String, String> map = new HashMap<>();
-        map.put("id", String.valueOf(examCard.getId()));
-        map.put("title", examCard.getTitle());
-        return map;
     }
 
     @Override

+ 15 - 3
distributed-print/src/main/java/com/qmth/distributed/print/api/mark/MarkTrackController.java

@@ -3,6 +3,8 @@ package com.qmth.distributed.print.api.mark;
 
 import javax.annotation.Resource;
 
+import com.qmth.teachcloud.mark.enums.CardSource;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -27,6 +29,8 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 
+import java.util.List;
+
 /**
  * <p>
  * 轨迹给分表 前端控制器
@@ -69,9 +73,17 @@ public class MarkTrackController {
                 if (StringUtils.isNotBlank(scanAnswerCard.getContent())) {
                     ExamCard examCard = new ExamCard();
                     examCard.setContent(scanAnswerCard.getContent());
-                } else if (scanAnswerCard.getCardId() != null) {
-                    ExamCard examCard = examCardService.getById(scanAnswerCard.getCardId());
-                    return ResultUtil.ok(examCard);
+                } else {
+                    // 自定义卡格式,取电子卡格式的cardId
+                    if (scanAnswerCard.getCardId() == null) {
+                        List<ScanAnswerCard> scanAnswerCardList = scanAnswerCardService.listByExamIdAndCoursePaperIdAndPaperTypeAndSource(scanAnswerCard.getExamId(), scanAnswerCard.getCoursePaperId(), scanAnswerCard.getPaperType(), CardSource.WEB);
+                        if (CollectionUtils.isNotEmpty(scanAnswerCardList)) {
+                            return ResultUtil.ok(examCardService.getById(scanAnswerCardList.get(0).getCardId()));
+                        }
+                    } else {
+                        return ResultUtil.ok(examCardService.getById(scanAnswerCard.getCardId()));
+                    }
+
                 }
             }
         }

+ 1 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/enums/LockType.java

@@ -21,6 +21,7 @@ public enum LockType {
 	INIT_MARK_DATA("init_mark_data"),
     CREATE_PDF("create_pdf"),
     EXAM_TASK_WHOLE("exam_task_whole"),
+    CUSTOM_CARD_SAVE("custom_card_save"),
 	;
 
 	private String name;

+ 3 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/ScanAnswerCardService.java

@@ -8,6 +8,7 @@ import com.qmth.teachcloud.mark.entity.ScanAnswerCard;
 
 import java.util.List;
 
+import com.qmth.teachcloud.mark.enums.CardSource;
 import org.springframework.web.multipart.MultipartFile;
 
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -44,4 +45,6 @@ public interface ScanAnswerCardService extends IService<ScanAnswerCard> {
     void deleteByExamIdAndPaperNumber(Long examId, String paperNumber);
 
     List<CardJpgResult> listPageImage(Long examId, String paperNumber, String paperType);
+
+    List<ScanAnswerCard> listByExamIdAndCoursePaperIdAndPaperTypeAndSource(Long examId, String coursePaperId, String paperType, CardSource source);
 }

+ 10 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/ScanAnswerCardServiceImpl.java

@@ -312,4 +312,14 @@ public class ScanAnswerCardServiceImpl extends ServiceImpl<ScanAnswerCardMapper,
         return cardJpgResultList;
     }
 
+    @Override
+    public List<ScanAnswerCard> listByExamIdAndCoursePaperIdAndPaperTypeAndSource(Long examId, String coursePaperId, String paperType, CardSource source) {
+        QueryWrapper<ScanAnswerCard> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(ScanAnswerCard::getExamId, examId)
+                .eq(ScanAnswerCard::getCoursePaperId, coursePaperId)
+                .eq(ScanAnswerCard::getPaperType, paperType)
+                .eq(ScanAnswerCard::getSource, source);
+        return this.list(queryWrapper);
+    }
+
 }

+ 2 - 1
teachcloud-obe/src/main/java/com/qmth/teachcloud/obe/mapper/ObeCourseRequirementReportMapper.java

@@ -23,10 +23,11 @@ public interface ObeCourseRequirementReportMapper extends BaseMapper<ObeCourseRe
      * 查找课程毕业达成度报表列表
      *
      * @param iPage
+     * @param schoolId
      * @param professionalId
      * @param cultureProgramName
      * @param dpr
      * @return
      */
-    public IPage<ObeCourseRequirementListResult> obeCourseRequirementReportList(IPage<Map> iPage, @Param("professionalId") Long professionalId, @Param("cultureProgramName") String cultureProgramName, @Param("dpr") DataPermissionRule dpr);
+    IPage<ObeCourseRequirementListResult> obeCourseRequirementReportList(IPage<Map> iPage, @Param("schoolId") Long schoolId, @Param("professionalId") Long professionalId, @Param("cultureProgramName") String cultureProgramName, @Param("dpr") DataPermissionRule dpr);
 }

+ 1 - 1
teachcloud-obe/src/main/java/com/qmth/teachcloud/obe/service/impl/ObeCourseOutlineServiceImpl.java

@@ -95,7 +95,7 @@ public class ObeCourseOutlineServiceImpl extends ServiceImpl<ObeCourseOutlineMap
         BasicCourse basicCourse = basicCourseService.getById(obeCourseOutlineParams.getCourseId());
         Objects.requireNonNull(basicCourse, "未找到课程信息");
 
-        obeCourseOutlineParams.setCourseOutlineName(obeCultureProgram.getName() + "-" + basicCourse.getName());
+        obeCourseOutlineParams.setCourseOutlineName(obeCultureProgram.getName() + "-" + basicCourse.getName() + "课程大纲");
         String courseOutlineName = obeCourseOutlineParams.getCourseOutlineName();
         Long semesterId = obeCourseOutlineParams.getSemesterId();
         Long courseId = obeCourseOutlineParams.getCourseId();

+ 1 - 1
teachcloud-obe/src/main/java/com/qmth/teachcloud/obe/service/impl/ObeCourseRequirementReportServiceImpl.java

@@ -334,7 +334,7 @@ public class ObeCourseRequirementReportServiceImpl extends ServiceImpl<ObeCourse
     public IPage<ObeCourseRequirementListResult> obeCourseRequirementReportList(IPage<Map> iPage, Long professionalId, String cultureProgramName) {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(sysUser.getSchoolId(), sysUser.getId(), ServletUtil.getRequest().getServletPath());
-        return this.baseMapper.obeCourseRequirementReportList(iPage, professionalId, cultureProgramName, dpr);
+        return this.baseMapper.obeCourseRequirementReportList(iPage, sysUser.getSchoolId(), professionalId, cultureProgramName, dpr);
     }
 
     /**

+ 1 - 1
teachcloud-obe/src/main/java/com/qmth/teachcloud/obe/service/impl/ObeCultureProgramServiceImpl.java

@@ -71,7 +71,7 @@ public class ObeCultureProgramServiceImpl extends ServiceImpl<ObeCultureProgramM
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         BasicProfessional basicProfessional = basicProfessionalService.getById(obeCultureProgram.getProfessionalId());
         Objects.requireNonNull(basicProfessional, "未找到专业信息");
-        obeCultureProgram.setName(basicProfessional.getName() + "-" + obeCultureProgram.getGrade());
+        obeCultureProgram.setName(basicProfessional.getName() + obeCultureProgram.getGrade() + "人才培养方案");
         ObeCultureProgram checkObeCultureProgram = this.getBySchoolIdAndName(sysUser.getSchoolId(), obeCultureProgram.getName());
         if (obeCultureProgram.getId() == null) {
             if (checkObeCultureProgram != null) {

+ 1 - 0
teachcloud-obe/src/main/resources/mapper/ObeCourseRequirementReportMapper.xml

@@ -13,6 +13,7 @@
         left join basic_professional bp on bp.id = ocp.professional_id
         left join sys_user su on ocp.create_id = su.id
         <where>
+            ocp.school_id = #{schoolId}
             <if test="professionalId != null and professionalId != ''">
                 and ocp.professional_id = #{professionalId}
             </if>