Procházet zdrojové kódy

fix:主观题导入

caozixuan před 1 rokem
rodič
revize
5be10183c5

+ 2 - 11
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/CourseTargetService.java

@@ -51,21 +51,12 @@ public interface CourseTargetService extends IService<CourseTarget> {
      */
     void deleteCourseTarget(Long id);
 
-    /**
-     * 查询题库试卷结构(知识点)
-     *
-     * @param examId      考试id
-     * @param paperNumber 试卷编号
-     * @param userId      课程创建人id
-     * @return 试卷结构
-     */
-    List<PaperStructDimensionResult> findTikuPaperStruct(Long examId, String paperNumber, Long userId);
-
     /**
      * 查询题库试卷结构(知识点)
      *
      * @param teachCourseId 教学课程id
+     * @param paperNumber   试卷编号
      * @return 试卷结构
      */
-    List<PaperStructDimensionResult> findTikuPaperStruct(Long teachCourseId);
+    List<PaperStructDimensionResult> findTikuPaperStruct(Long teachCourseId, String paperNumber);
 }

+ 9 - 23
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/CourseTargetServiceImpl.java

@@ -53,9 +53,6 @@ public class CourseTargetServiceImpl extends ServiceImpl<CourseTargetMapper, Cou
     @Resource
     private ExamTaskPaperDataService examTaskPaperDataService;
 
-    @Resource
-    private ExamTaskService examTaskService;
-
     @Override
     public List<CourseTargetResult> findCourseTargetList(Long teachCourseId) {
         TeachCourse teachCourse = teachCourseService.getById(teachCourseId);
@@ -261,15 +258,13 @@ public class CourseTargetServiceImpl extends ServiceImpl<CourseTargetMapper, Cou
     }
 
     @Override
-    public List<PaperStructDimensionResult> findTikuPaperStruct(Long examId, String paperNumber, Long userId) {
-        List<PaperStructDimensionResult> result = new ArrayList<>();
-        ExamTask examTask = examTaskService.getOne(new QueryWrapper<ExamTask>().lambda().eq(ExamTask::getExamId, examId)
-                .eq(ExamTask::getPaperNumber, paperNumber).last(SystemConstant.LIMIT1));
-        if (Objects.isNull(examTask)) {
-            throw ExceptionResultEnum.ERROR.exception("命题任务不存在");
+    public List<PaperStructDimensionResult> findTikuPaperStruct(Long teachCourseId, String paperNumber) {
+        TeachCourse teachCourse = teachCourseService.getById(teachCourseId);
+        if (Objects.isNull(teachCourse)) {
+            throw ExceptionResultEnum.ERROR.exception("教学课程不存在");
         }
-        String courseCode = examTask.getCourseCode();
-        TeachCourse teachCourse = teachCourseService.findByExamIdCourseCodeAndUserId(examId, courseCode, userId);
+        List<PaperStructDimensionResult> result = new ArrayList<>();
+
         List<CourseTarget> courseTargetList = this.list(
                 new QueryWrapper<CourseTarget>().lambda().eq(CourseTarget::getTeachCourseId, teachCourse.getId()));
         List<CourseDimension> courseDimensionList = courseDimensionService.list(
@@ -279,7 +274,7 @@ public class CourseTargetServiceImpl extends ServiceImpl<CourseTargetMapper, Cou
                 .collect(Collectors.toMap(CourseDimension::getCode, e -> e));
 
         ExamTaskPaperData examTaskPaperData = examTaskPaperDataService.getOne(
-                new QueryWrapper<ExamTaskPaperData>().lambda().eq(ExamTaskPaperData::getExamId, examId)
+                new QueryWrapper<ExamTaskPaperData>().lambda().eq(ExamTaskPaperData::getExamId, teachCourse.getExamId())
                         .eq(ExamTaskPaperData::getPaperNumber, paperNumber).last(SystemConstant.LIMIT1));
         if (Objects.nonNull(examTaskPaperData)) {
             String paperStruct = examTaskPaperData.getPaperJson();
@@ -306,8 +301,8 @@ public class CourseTargetServiceImpl extends ServiceImpl<CourseTargetMapper, Cou
                                 Double score = subQuestion.getDouble("score");
                                 String property = subQuestion.getString("property");
                                 if (SystemConstant.strNotNull(property)) {
-                                    List<DimensionDto> dimensionList = JSON.parseArray(property,
-                                                    CourseDimensionDto.class).stream().filter(e -> courseDimensionMap.containsKey(e.getCode())).flatMap(e -> {
+                                    List<DimensionDto> dimensionList = JSON.parseArray(property, CourseDimensionDto.class).stream()
+                                            .filter(e -> courseDimensionMap.containsKey(e.getCode())).flatMap(e -> {
                                                 DimensionDto dimensionDto = new DimensionDto();
                                                 dimensionDto.setDimensionId(courseDimensionMap.get(e.getCode()).getId());
                                                 dimensionDto.setDimensionCode(e.getCode());
@@ -363,15 +358,6 @@ public class CourseTargetServiceImpl extends ServiceImpl<CourseTargetMapper, Cou
         return result;
     }
 
-    @Override
-    public List<PaperStructDimensionResult> findTikuPaperStruct(Long teachCourseId) {
-        TeachCourse teachCourse = teachCourseService.getById(teachCourseId);
-        if (Objects.isNull(teachCourse)){
-            throw ExceptionResultEnum.ERROR.exception("教学课程不存在");
-        }
-        return this.findTikuPaperStruct(teachCourse.getExamId(), teachCourse.getCourseCode(), teachCourse.getUserId());
-    }
-
     /**
      * 构建知识点占用情况对象
      *

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

@@ -209,7 +209,7 @@ public class TCPaperStructServiceImpl extends ServiceImpl<TCPaperStructMapper, T
             SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
             StringJoiner errorData = new StringJoiner("");
             StringJoiner successData = new StringJoiner("");
-            List<PaperStructDimensionResult> paperStructDimensionResultList = courseTargetService.findTikuPaperStruct(teachCourseId);
+            List<PaperStructDimensionResult> paperStructDimensionResultList = courseTargetService.findTikuPaperStruct(teachCourseId,paperNumber);
             if (!CollectionUtils.isEmpty(paperStructDimensionResultList)) {
                 List<String> paperStructList = new ArrayList<>(paperStructDimensionResultList.size()), paperStructDbList = new ArrayList<>(paperStructDimensionResultList.size());
                 for (PaperStructDimensionResult p : paperStructDimensionResultList) {

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

@@ -41,6 +41,7 @@ import com.qmth.teachcloud.common.service.*;
 import com.qmth.teachcloud.common.util.*;
 import com.qmth.teachcloud.common.util.excel.ExcelError;
 import com.qmth.teachcloud.mark.entity.MarkPaper;
+import com.qmth.teachcloud.mark.params.MarkQuestionParams;
 import com.qmth.teachcloud.mark.service.MarkGroupService;
 import com.qmth.teachcloud.mark.service.MarkPaperService;
 import com.qmth.teachcloud.mark.service.MarkQuestionService;
@@ -2597,6 +2598,11 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                     markQuestion.setIntervalScore(e.getIntervalScore());
                     return Stream.of(markQuestion);
                 }).collect(Collectors.toList());
+                MarkQuestionParams markQuestionParams = new MarkQuestionParams();
+                markQuestionParams.setQuestions(markQuestionList);
+                markQuestionParams.setExamId(examId);
+                markQuestionParams.setPaperNumber(paperNumber);
+                markQuestionService.saveQuestions(markQuestionParams);
 
 
                 // 试卷下分组集合