Просмотр исходного кода

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

ywx
王宁 1 месяц назад
Родитель
Сommit
b7230b5784

+ 2
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/stupaper/MsPaperStudentBlockMapper.java Просмотреть файл

@@ -30,4 +30,6 @@ public interface MsPaperStudentBlockMapper extends TkMapper<MsPaperStudentBlock>
30 30
 
31 31
     //清空教师未阅卷任务
32 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 Просмотреть файл

@@ -62,6 +62,6 @@ public interface MsPaperStudentQuestionMapper extends TkMapper<MsPaperStudentQue
62 62
 
63 63
     //定时任务-获取学生答案待合并试题
64 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 Просмотреть файл

@@ -12,6 +12,9 @@ public interface UserMapper {
12 12
 
13 13
     //获取考生-保存学生试卷用
14 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 19
     List<UserVo> listStuForNoticeByExamId(@Param("examid") Integer examid);
17 20
 

+ 7
- 13
smarking/src/main/java/com/xhkjedu/smarking/service/paper/MsTemplateService.java Просмотреть файл

@@ -16,7 +16,6 @@ import com.xhkjedu.smarking.utils.MarkingUtil;
16 16
 import com.xhkjedu.smarking.vo.paper.MsPaperParams;
17 17
 import com.xhkjedu.smarking.vo.system.SchoolCloudVo;
18 18
 import com.xhkjedu.utils.N_Utils;
19
-import com.xhkjedu.vo.system.UserVo;
20 19
 import lombok.extern.slf4j.Slf4j;
21 20
 import org.springframework.stereotype.Service;
22 21
 import org.springframework.transaction.annotation.Transactional;
@@ -278,16 +277,16 @@ public class MsTemplateService {
278 277
         Integer examid = paper.getExamid();
279 278
         String subjectid = paper.getSubjectid();
280 279
         //获取试卷中所有学生信息
281
-        List<UserVo> students = userMapper.listStuForExamByExamId(examid);
280
+        List<Integer> students = userMapper.listStuForExamByExamIdAndSubjectid(examid,subjectid);
282 281
         Integer timestamp = N_Utils.getSecondTimestamp();
283 282
         List<MsPaperStudent> savePaperStudents = new ArrayList<>();
284
-        for(UserVo student : students) {
283
+        for(Integer stuid : students) {
285 284
             MsPaperStudent es = new MsPaperStudent();
286 285
             es.setExamid(examid);
287 286
             es.setMsid(paper.getMsid());
288 287
             es.setMpid(mpid);
289 288
             es.setSubjectid(subjectid);
290
-            es.setStudentid(student.getUserid());
289
+            es.setStudentid(stuid);
291 290
             es.setSstate(0);
292 291
             es.setChecked(0);
293 292
             es.setPnum(paper.getPnum());
@@ -297,6 +296,8 @@ public class MsTemplateService {
297 296
             es.setCreatetime(timestamp);
298 297
             es.setHasbad(0);
299 298
             es.setStuscoretype(0);
299
+            es.setPagenum(0);
300
+            es.setSubmittype(0);
300 301
             savePaperStudents.add(es);
301 302
         }
302 303
         msPaperStudentMapper.insertList(savePaperStudents);//保存试卷学生信息
@@ -321,8 +322,6 @@ public class MsTemplateService {
321 322
                 psblock.setStudentid(studentid);
322 323
                 psblock.setMblockid(mblockid);
323 324
                 psblock.setMpsid(mpsid);
324
-                psblock.setConverted(0);
325
-                psblock.setChecked(0);
326 325
                 psblock.setCreatetime(timestamp);
327 326
                 savePaperStudentBlocks.add(psblock);
328 327
 
@@ -360,17 +359,12 @@ public class MsTemplateService {
360 359
                 psquestion.setQn(q.getQn());
361 360
                 psquestion.setQorder(q.getQorder());
362 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 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 Просмотреть файл

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

+ 9
- 0
smarking/src/main/resources/mapper/stupaper/MsPaperStudentBlockMapper.xml Просмотреть файл

@@ -97,4 +97,13 @@
97 97
           ,secondcid = (if(secondcid=#{secondcid},null,secondcid))
98 98
         where mpsbid in (${mpsbids})
99 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 109
 </mapper>

+ 8
- 0
smarking/src/main/resources/mapper/stupaper/MsPaperStudentQuestionMapper.xml Просмотреть файл

@@ -320,4 +320,12 @@
320 320
         select mpsqid,stuanswer,examid from ms_paper_student_question
321 321
         where answered=1 and answertype=2 and converted=1 order by mpsqid
322 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 331
 </mapper>

+ 2
- 2
smarking/src/main/resources/mapper/system/SchoolMapper.xml Просмотреть файл

@@ -13,7 +13,7 @@
13 13
 
14 14
     <!--获取考试对应区域码和学校id-->
15 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 18
     </select>
19 19
 </mapper>

+ 6
- 0
smarking/src/main/resources/mapper/system/UserMapper.xml Просмотреть файл

@@ -15,6 +15,12 @@
15 15
         where cs.examid=#{examid}
16 16
         group by cs.studentid,cs.subjectid
17 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 24
     <select id="listStuForNoticeByExamId" resultType="com.xhkjedu.vo.system.UserVo">
19 25
         select cs.studentid as userid,cs.classid
20 26
         from ms_class_student cs

Загрузка…
Отмена
Сохранить