deason 6 yıl önce
ebeveyn
işleme
9a27626a19

+ 1 - 1
examcloud-core-print-dao/src/main/java/cn/com/qmth/examcloud/core/print/repository/ObjectiveQuestionStructureRepository.java

@@ -22,6 +22,6 @@ public interface ObjectiveQuestionStructureRepository extends JpaRepository<Obje
     @Transactional
     @Modifying
     @Query("DELETE FROM ObjectiveQuestionStructure WHERE examId=:examId AND paperId=:paperId")
-    int deleteByPaperId(@Param("examId") Long examId, @Param("paperId") String paperId);
+    int deleteByExamIdAndPaperId(@Param("examId") Long examId, @Param("paperId") String paperId);
 
 }

+ 1 - 1
examcloud-core-print-dao/src/main/java/cn/com/qmth/examcloud/core/print/repository/SubjectiveQuestionStructureRepository.java

@@ -22,6 +22,6 @@ public interface SubjectiveQuestionStructureRepository extends JpaRepository<Sub
     @Transactional
     @Modifying
     @Query("DELETE FROM SubjectiveQuestionStructure WHERE examId=:examId AND paperId=:paperId")
-    int deleteByPaperId(@Param("examId") Long examId, @Param("paperId") String paperId);
+    int deleteByExamIdAndPaperId(@Param("examId") Long examId, @Param("paperId") String paperId);
 
 }

+ 5 - 5
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/CommonService.java

@@ -80,16 +80,16 @@ public class CommonService {
         return this.getExamCourseList(orgId, examId, null, null);
     }
 
-    public PaperQuestionStructureInfo findStructureByPaperId(String paperId) {
+    public PaperQuestionStructureInfo findStructureByPaperId(Long examId, String paperId) {
         // just mock data todo
         PaperQuestionStructureInfo info = new PaperQuestionStructureInfo();
 
         ObjectiveQuestionStructure objective = new ObjectiveQuestionStructure();
-        objective.setExamId(1L);
+        objective.setExamId(examId);
+        objective.setPaperId(paperId);
         objective.setCourseId(1L);
         objective.setCourseCode("123456");
         objective.setCourseName("测试课程");
-        objective.setPaperId("abc");
         objective.setPaperName("测试试卷");
         objective.setPaperType("A");
         objective.setQuestionType(QuesStructType.SINGLE_ANSWER_QUESTION.name());
@@ -100,11 +100,11 @@ public class CommonService {
         info.addObjective(objective);
 
         SubjectiveQuestionStructure subjective = new SubjectiveQuestionStructure();
-        subjective.setExamId(1L);
+        subjective.setExamId(examId);
+        subjective.setPaperId(paperId);
         subjective.setCourseId(1L);
         subjective.setCourseCode("123456");
         subjective.setCourseName("测试课程");
-        subjective.setPaperId("abc");
         subjective.setPaperName("测试试卷");
         subjective.setPaperType("A");
         subjective.setSectionNum(1);

+ 0 - 1
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/CoursePaperServiceImpl.java

@@ -104,7 +104,6 @@ public class CoursePaperServiceImpl implements CoursePaperService {
         }
         //否则新增
         coursePaperRepository.save(coursePaper);
-
         //保存试卷试题结构
         questionStructureService.savePaperQuestionStructure(coursePaper.getExamId(), coursePaper.getPaperId());
 

+ 3 - 3
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/QuestionStructureServiceImpl.java

@@ -43,11 +43,11 @@ public class QuestionStructureServiceImpl implements QuestionStructureService {
         Check.isEmpty(paperId, "试卷ID不能为空!");
 
         //从题库端获取试卷的试题结构信息
-        PaperQuestionStructureInfo info = commonService.findStructureByPaperId(paperId);
+        PaperQuestionStructureInfo info = commonService.findStructureByPaperId(examId, paperId);
 
         //先清理旧数据
-        objectiveQuestionStructureRepository.deleteByPaperId(examId, paperId);
-        subjectiveQuestionStructureRepository.deleteByPaperId(examId, paperId);
+        objectiveQuestionStructureRepository.deleteByExamIdAndPaperId(examId, paperId);
+        subjectiveQuestionStructureRepository.deleteByExamIdAndPaperId(examId, paperId);
 
         //保存客观题数据
         List<ObjectiveQuestionStructure> objectives = info.getObjectives();

+ 1 - 0
examcloud-core-print-starter/src/main/resources/static/example.html

@@ -8,6 +8,7 @@
 <body>
 <form id="uploadForm" enctype="multipart/form-data">
     <input type="file" name="file"/>
+    <!--<input type="file" name="file" accept="image/jpeg,image/jpg,image/png"/>-->
     <input type="button" value="提交" onclick="doUpload()"/>
 </form>
 <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>