Browse Source

完善主观题款选完成生成学生试卷

ywx
王宁 1 month ago
parent
commit
b7230b5784

+ 2
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/stupaper/MsPaperStudentBlockMapper.java View File

30
 
30
 
31
     //清空教师未阅卷任务
31
     //清空教师未阅卷任务
32
     void updateByMpsbidsAndTeacherid(@Param("mpsbids") String mpsbids,@Param("teacherid") Integer teacherid);
32
     void updateByMpsbidsAndTeacherid(@Param("mpsbids") String mpsbids,@Param("teacherid") Integer teacherid);
33
+    //批量保存学生题块
34
+    void insertBatchStudentBlock(@Param("list") List<MsPaperStudentBlock> list);
33
 }
35
 }

+ 2
- 2
smarking/src/main/java/com/xhkjedu/smarking/mapper/stupaper/MsPaperStudentQuestionMapper.java View File

62
 
62
 
63
     //定时任务-获取学生答案待合并试题
63
     //定时任务-获取学生答案待合并试题
64
     List<MsPaperStudentQuestion> listNoMergeStupic();
64
     List<MsPaperStudentQuestion> listNoMergeStupic();
65
-
66
-
65
+    //批量保存学生试题
66
+    void saveBatchStuPaperQuestion(@Param("list") List<MsPaperStudentQuestion> list);
67
 }
67
 }

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/system/UserMapper.java View File

12
 
12
 
13
     //获取考生-保存学生试卷用
13
     //获取考生-保存学生试卷用
14
     List<UserVo> listStuForExamByExamId(@Param("examid") Integer examid);
14
     List<UserVo> listStuForExamByExamId(@Param("examid") Integer examid);
15
+
16
+    //获取考生-线下保存学生单科试卷用
17
+    List<Integer> listStuForExamByExamIdAndSubjectid(@Param("examid") Integer examid, @Param("subjectid") String subjectid);
15
     //获取考生-保存通知用
18
     //获取考生-保存通知用
16
     List<UserVo> listStuForNoticeByExamId(@Param("examid") Integer examid);
19
     List<UserVo> listStuForNoticeByExamId(@Param("examid") Integer examid);
17
 
20
 

+ 7
- 13
smarking/src/main/java/com/xhkjedu/smarking/service/paper/MsTemplateService.java View File

16
 import com.xhkjedu.smarking.vo.paper.MsPaperParams;
16
 import com.xhkjedu.smarking.vo.paper.MsPaperParams;
17
 import com.xhkjedu.smarking.vo.system.SchoolCloudVo;
17
 import com.xhkjedu.smarking.vo.system.SchoolCloudVo;
18
 import com.xhkjedu.utils.N_Utils;
18
 import com.xhkjedu.utils.N_Utils;
19
-import com.xhkjedu.vo.system.UserVo;
20
 import lombok.extern.slf4j.Slf4j;
19
 import lombok.extern.slf4j.Slf4j;
21
 import org.springframework.stereotype.Service;
20
 import org.springframework.stereotype.Service;
22
 import org.springframework.transaction.annotation.Transactional;
21
 import org.springframework.transaction.annotation.Transactional;
278
         Integer examid = paper.getExamid();
277
         Integer examid = paper.getExamid();
279
         String subjectid = paper.getSubjectid();
278
         String subjectid = paper.getSubjectid();
280
         //获取试卷中所有学生信息
279
         //获取试卷中所有学生信息
281
-        List<UserVo> students = userMapper.listStuForExamByExamId(examid);
280
+        List<Integer> students = userMapper.listStuForExamByExamIdAndSubjectid(examid,subjectid);
282
         Integer timestamp = N_Utils.getSecondTimestamp();
281
         Integer timestamp = N_Utils.getSecondTimestamp();
283
         List<MsPaperStudent> savePaperStudents = new ArrayList<>();
282
         List<MsPaperStudent> savePaperStudents = new ArrayList<>();
284
-        for(UserVo student : students) {
283
+        for(Integer stuid : students) {
285
             MsPaperStudent es = new MsPaperStudent();
284
             MsPaperStudent es = new MsPaperStudent();
286
             es.setExamid(examid);
285
             es.setExamid(examid);
287
             es.setMsid(paper.getMsid());
286
             es.setMsid(paper.getMsid());
288
             es.setMpid(mpid);
287
             es.setMpid(mpid);
289
             es.setSubjectid(subjectid);
288
             es.setSubjectid(subjectid);
290
-            es.setStudentid(student.getUserid());
289
+            es.setStudentid(stuid);
291
             es.setSstate(0);
290
             es.setSstate(0);
292
             es.setChecked(0);
291
             es.setChecked(0);
293
             es.setPnum(paper.getPnum());
292
             es.setPnum(paper.getPnum());
297
             es.setCreatetime(timestamp);
296
             es.setCreatetime(timestamp);
298
             es.setHasbad(0);
297
             es.setHasbad(0);
299
             es.setStuscoretype(0);
298
             es.setStuscoretype(0);
299
+            es.setPagenum(0);
300
+            es.setSubmittype(0);
300
             savePaperStudents.add(es);
301
             savePaperStudents.add(es);
301
         }
302
         }
302
         msPaperStudentMapper.insertList(savePaperStudents);//保存试卷学生信息
303
         msPaperStudentMapper.insertList(savePaperStudents);//保存试卷学生信息
321
                 psblock.setStudentid(studentid);
322
                 psblock.setStudentid(studentid);
322
                 psblock.setMblockid(mblockid);
323
                 psblock.setMblockid(mblockid);
323
                 psblock.setMpsid(mpsid);
324
                 psblock.setMpsid(mpsid);
324
-                psblock.setConverted(0);
325
-                psblock.setChecked(0);
326
                 psblock.setCreatetime(timestamp);
325
                 psblock.setCreatetime(timestamp);
327
                 savePaperStudentBlocks.add(psblock);
326
                 savePaperStudentBlocks.add(psblock);
328
 
327
 
360
                 psquestion.setQn(q.getQn());
359
                 psquestion.setQn(q.getQn());
361
                 psquestion.setQorder(q.getQorder());
360
                 psquestion.setQorder(q.getQorder());
362
                 psquestion.setQscore(q.getQscore());
361
                 psquestion.setQscore(q.getQscore());
363
-                psquestion.setStuscore(0.0);
364
-                psquestion.setAnswered(0);
365
-                psquestion.setAnswertype(0);
366
-                psquestion.setConverted(0);
367
-                psquestion.setChecked(0);
368
 
362
 
369
                 savePaperStudentQuestions.add(psquestion);
363
                 savePaperStudentQuestions.add(psquestion);
370
             }
364
             }
371
         }
365
         }
372
-        msPaperStudentBlockMapper.insertList(savePaperStudentBlocks);//保存试卷学生题块信息
373
-        msPaperStudentQuestionMapper.insertList(savePaperStudentQuestions);//保存试卷学生试题信息
366
+        msPaperStudentBlockMapper.insertBatchStudentBlock(savePaperStudentBlocks);//保存试卷学生题块信息
367
+        msPaperStudentQuestionMapper.saveBatchStuPaperQuestion(savePaperStudentQuestions);//保存试卷学生试题信息
374
 
368
 
375
     }
369
     }
376
 
370
 

+ 1
- 1
smarking/src/main/resources/mapper/paper/MsPaperBlockMapper.xml View File

46
     </delete>
46
     </delete>
47
 
47
 
48
     <!--获取试卷中所有主观题题块ID-->
48
     <!--获取试卷中所有主观题题块ID-->
49
-    <select id="listSubjectiveBlockidsByMpid" resultType="java.util.List">
49
+    <select id="listSubjectiveBlockidsByMpid" resultType="java.lang.Integer">
50
         select mblockid from ms_paper_block where mpid = #{mpid} and blocktype = 2 order by mblockid
50
         select mblockid from ms_paper_block where mpid = #{mpid} and blocktype = 2 order by mblockid
51
     </select>
51
     </select>
52
 
52
 

+ 9
- 0
smarking/src/main/resources/mapper/stupaper/MsPaperStudentBlockMapper.xml View File

97
           ,secondcid = (if(secondcid=#{secondcid},null,secondcid))
97
           ,secondcid = (if(secondcid=#{secondcid},null,secondcid))
98
         where mpsbid in (${mpsbids})
98
         where mpsbid in (${mpsbids})
99
     </update>
99
     </update>
100
+
101
+    <!--批量保存学生题块-->
102
+    <insert id="insertBatchStudentBlock">
103
+        insert into ms_paper_student_block(examid,mpid,subjectid,mblockid,studentid,mpsid,createtime) values
104
+        <foreach collection="list" item="b" separator=",">
105
+            (#{b.examid},#{b.mpid},#{b.subjectid},#{b.mblockid},#{b.studentid},#{b.mpsid},#{b.createtime})
106
+        </foreach>
107
+    </insert>
108
+
100
 </mapper>
109
 </mapper>

+ 8
- 0
smarking/src/main/resources/mapper/stupaper/MsPaperStudentQuestionMapper.xml View File

320
         select mpsqid,stuanswer,examid from ms_paper_student_question
320
         select mpsqid,stuanswer,examid from ms_paper_student_question
321
         where answered=1 and answertype=2 and converted=1 order by mpsqid
321
         where answered=1 and answertype=2 and converted=1 order by mpsqid
322
     </select>
322
     </select>
323
+
324
+    <!--批量保存学生试题-->
325
+    <insert id="saveBatchStuPaperQuestion">
326
+        insert into ms_paper_student_question(studentid,examid,subjectid,mpid,mpsid,mptqid,mblockid,ctype,questionid,qorder,qn,qscore) values
327
+        <foreach collection="list" item="q" separator=",">
328
+            (#{q.studentid},#{q.examid},#{q.subjectid},#{q.mpid},#{q.mpsid},#{q.mptqid},#{q.mblockid},#{q.ctype},#{q.questionid},#{q.qorder},#{q.qn},#{q.qscore})
329
+        </foreach>
330
+    </insert>
323
 </mapper>
331
 </mapper>

+ 2
- 2
smarking/src/main/resources/mapper/system/SchoolMapper.xml View File

13
 
13
 
14
     <!--获取考试对应区域码和学校id-->
14
     <!--获取考试对应区域码和学校id-->
15
     <select id="getSchoolCloudcode" resultType="com.xhkjedu.smarking.vo.system.SchoolCloudVo">
15
     <select id="getSchoolCloudcode" resultType="com.xhkjedu.smarking.vo.system.SchoolCloudVo">
16
-        select e.schoolid,(select cloudcode from t_cloud order by cloudid limit 1) cloudcode from ms_paper p left join ms_exam e on p.examid=p.examid
17
-        where p.mpid=#{mpid}
16
+        select distinct e.schoolid,(select cloudcode from t_cloud order by cloudid limit 1) cloudcode from ms_paper p
17
+        left join ms_exam e on p.examid=e.examid where p.mpid=#{mpid}
18
     </select>
18
     </select>
19
 </mapper>
19
 </mapper>

+ 6
- 0
smarking/src/main/resources/mapper/system/UserMapper.xml View File

15
         where cs.examid=#{examid}
15
         where cs.examid=#{examid}
16
         group by cs.studentid,cs.subjectid
16
         group by cs.studentid,cs.subjectid
17
     </select>
17
     </select>
18
+    <!--获取考生-线下保存学生单科试卷用-->
19
+    <select id="listStuForExamByExamIdAndSubjectid" resultType="java.lang.Integer">
20
+        select cs.studentid from ms_class_student cs
21
+        where cs.examid=#{examid} and cs.subjectid=#{subjectid}
22
+        group by cs.studentid
23
+    </select>
18
     <select id="listStuForNoticeByExamId" resultType="com.xhkjedu.vo.system.UserVo">
24
     <select id="listStuForNoticeByExamId" resultType="com.xhkjedu.vo.system.UserVo">
19
         select cs.studentid as userid,cs.classid
25
         select cs.studentid as userid,cs.classid
20
         from ms_class_student cs
26
         from ms_class_student cs

Loading…
Cancel
Save