|
@@ -212,77 +212,84 @@ public class EBaseService {
|
212
|
212
|
|
213
|
213
|
//发布考试
|
214
|
214
|
@Transactional(rollbackFor = Exception.class)
|
215
|
|
- public void updateExamStateStart(Integer examid, String examcomm, List<UserVo> students,Integer exammode) {
|
216
|
|
- //更改考试状态
|
217
|
|
- eBaseMapper.postExam(examid, examcomm);
|
218
|
|
- //发布考试,获取考试试卷题量和分值
|
219
|
|
- List<EPaper> papers = ePaperMapper.listNumAndScoreByExamId(examid);
|
220
|
|
- List<EPaperStudent> studentList = new ArrayList<>();
|
221
|
|
- int timestamp = N_Utils.getSecondTimestamp();
|
222
|
|
- for (EPaper paper : papers) {
|
223
|
|
- Integer esid = paper.getEsid();
|
224
|
|
- Integer epid = paper.getEpid();
|
225
|
|
- Integer pnum = paper.getPnum();
|
226
|
|
- Double pscore = paper.getPscore();
|
227
|
|
- String subjectid = paper.getSubjectid();
|
228
|
|
- for (UserVo student : students) {
|
229
|
|
- EPaperStudent es = new EPaperStudent();
|
230
|
|
- es.setExamid(examid);
|
231
|
|
- es.setEsid(esid);
|
232
|
|
- es.setEpid(epid);
|
233
|
|
- es.setSubjectid(subjectid);
|
234
|
|
- es.setClassid(student.getClassid());
|
235
|
|
- es.setStudentid(student.getUserid());
|
236
|
|
- es.setSstate(0);
|
237
|
|
- es.setChecked(0);
|
238
|
|
- es.setNum(pnum);
|
239
|
|
- es.setScore(pscore);
|
240
|
|
- es.setStuscore(0.0);
|
241
|
|
- es.setCosttime(0);
|
242
|
|
- es.setCreatetime(timestamp);
|
243
|
|
- es.setHasbad(0);
|
244
|
|
- studentList.add(es);
|
|
215
|
+ public Integer updateExamStateStart(Integer examid, String examcomm, List<UserVo> students,Integer exammode) {
|
|
216
|
+ try {
|
|
217
|
+ //更改考试状态
|
|
218
|
+ eBaseMapper.postExam(examid, examcomm);
|
|
219
|
+ //发布考试,获取考试试卷题量和分值
|
|
220
|
+ List<EPaper> papers = ePaperMapper.listNumAndScoreByExamId(examid);
|
|
221
|
+ List<EPaperStudent> studentList = new ArrayList<>();
|
|
222
|
+ int timestamp = N_Utils.getSecondTimestamp();
|
|
223
|
+ for (EPaper paper : papers) {
|
|
224
|
+ Integer esid = paper.getEsid();
|
|
225
|
+ Integer epid = paper.getEpid();
|
|
226
|
+ Integer pnum = paper.getPnum();
|
|
227
|
+ Double pscore = paper.getPscore();
|
|
228
|
+ String subjectid = paper.getSubjectid();
|
|
229
|
+ for (UserVo student : students) {
|
|
230
|
+ EPaperStudent es = new EPaperStudent();
|
|
231
|
+ es.setExamid(examid);
|
|
232
|
+ es.setEsid(esid);
|
|
233
|
+ es.setEpid(epid);
|
|
234
|
+ es.setSubjectid(subjectid);
|
|
235
|
+ es.setClassid(student.getClassid());
|
|
236
|
+ es.setStudentid(student.getUserid());
|
|
237
|
+ es.setSstate(0);
|
|
238
|
+ es.setChecked(0);
|
|
239
|
+ es.setNum(pnum);
|
|
240
|
+ es.setScore(pscore);
|
|
241
|
+ es.setStuscore(0.0);
|
|
242
|
+ es.setCosttime(0);
|
|
243
|
+ es.setCreatetime(timestamp);
|
|
244
|
+ es.setHasbad(0);
|
|
245
|
+ studentList.add(es);
|
|
246
|
+ }
|
245
|
247
|
}
|
246
|
|
- }
|
247
|
|
- ePaperStudentMapper.insertList(studentList);//保存考试学生信息
|
248
|
|
-
|
249
|
|
- //2022-09-26线上线下统计时均需要试题,发布考试时直接把学生和试题关联上
|
250
|
|
- //代表线下考试,生成学生和试题的关联关系
|
251
|
|
- List<EPaperStudentQuestion> stuqlist = new ArrayList<>();
|
252
|
|
- for (EPaper paper : papers) {
|
253
|
|
- Integer epid = paper.getEpid();
|
254
|
|
- //获取试卷中所有试题
|
255
|
|
- List<EPaperQtypeQuestion> queslist = ePaperQtypeQuestionMapper.listQuestionsByEpid(epid);
|
256
|
|
- //获取该还是卷下试题学生信息
|
257
|
|
- List<EPaperStudent> paperstulist = studentList.stream().filter(s -> s.getEpid().equals(epid)).collect(Collectors.toList());
|
258
|
|
- for (EPaperStudent ps : paperstulist) {
|
259
|
|
- for(EPaperQtypeQuestion q : queslist){
|
260
|
|
- EPaperStudentQuestion epsq = new EPaperStudentQuestion();
|
261
|
|
- epsq.setClassid(ps.getClassid());
|
262
|
|
- epsq.setStudentid(ps.getStudentid());
|
263
|
|
- epsq.setExamid(ps.getExamid());
|
264
|
|
- epsq.setSubjectid(ps.getSubjectid());
|
265
|
|
- epsq.setEpid(epid);
|
266
|
|
- epsq.setEpsid(ps.getId());
|
267
|
|
- epsq.setEptqid(q.getEptqid());
|
268
|
|
- epsq.setCtype(q.getCtype());
|
269
|
|
- epsq.setQuestionid(q.getQuestionid());
|
270
|
|
- epsq.setQn(q.getQn());
|
271
|
|
- epsq.setQorder(q.getQorder());
|
272
|
|
- epsq.setAnswered(0);
|
273
|
|
- epsq.setAnswertype(0);
|
274
|
|
- epsq.setConverted(0);
|
275
|
|
- epsq.setCosttime(0);
|
276
|
|
- epsq.setQscore(q.getScore());
|
277
|
|
- epsq.setStuscore(0.0);
|
278
|
|
- epsq.setChecked(0);
|
279
|
|
- epsq.setGood(0);
|
280
|
|
- epsq.setBad(0);
|
281
|
|
- stuqlist.add(epsq);
|
|
248
|
+ ePaperStudentMapper.insertList(studentList);//保存考试学生信息
|
|
249
|
+
|
|
250
|
+ //2022-09-26线上线下统计时均需要试题,发布考试时直接把学生和试题关联上
|
|
251
|
+ //代表线下考试,生成学生和试题的关联关系
|
|
252
|
+ List<EPaperStudentQuestion> stuqlist = new ArrayList<>();
|
|
253
|
+ for (EPaper paper : papers) {
|
|
254
|
+ Integer epid = paper.getEpid();
|
|
255
|
+ //获取试卷中所有试题
|
|
256
|
+ List<EPaperQtypeQuestion> queslist = ePaperQtypeQuestionMapper.listQuestionsByEpid(epid);
|
|
257
|
+ //获取该还是卷下试题学生信息
|
|
258
|
+ List<EPaperStudent> paperstulist = studentList.stream().filter(s -> s.getEpid().equals(epid)).collect(Collectors.toList());
|
|
259
|
+ for (EPaperStudent ps : paperstulist) {
|
|
260
|
+ for(EPaperQtypeQuestion q : queslist){
|
|
261
|
+ EPaperStudentQuestion epsq = new EPaperStudentQuestion();
|
|
262
|
+ epsq.setClassid(ps.getClassid());
|
|
263
|
+ epsq.setStudentid(ps.getStudentid());
|
|
264
|
+ epsq.setExamid(ps.getExamid());
|
|
265
|
+ epsq.setSubjectid(ps.getSubjectid());
|
|
266
|
+ epsq.setEpid(epid);
|
|
267
|
+ epsq.setEpsid(ps.getId());
|
|
268
|
+ epsq.setEptqid(q.getEptqid());
|
|
269
|
+ epsq.setCtype(q.getCtype());
|
|
270
|
+ epsq.setQuestionid(q.getQuestionid());
|
|
271
|
+ epsq.setQn(q.getQn());
|
|
272
|
+ epsq.setQorder(q.getQorder());
|
|
273
|
+ epsq.setAnswered(0);
|
|
274
|
+ epsq.setAnswertype(0);
|
|
275
|
+ epsq.setConverted(0);
|
|
276
|
+ epsq.setCosttime(0);
|
|
277
|
+ epsq.setQscore(q.getScore());
|
|
278
|
+ epsq.setStuscore(0.0);
|
|
279
|
+ epsq.setChecked(0);
|
|
280
|
+ epsq.setGood(0);
|
|
281
|
+ epsq.setBad(0);
|
|
282
|
+ stuqlist.add(epsq);
|
|
283
|
+ }
|
282
|
284
|
}
|
283
|
285
|
}
|
|
286
|
+ ePaperStudentQuestionMapper.insertList(stuqlist);
|
|
287
|
+ } catch (Exception e) {
|
|
288
|
+ log.error("发布考试失败:"+e.getMessage());
|
|
289
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
290
|
+ return 1;
|
284
|
291
|
}
|
285
|
|
- ePaperStudentQuestionMapper.insertList(stuqlist);
|
|
292
|
+ return 0;
|
286
|
293
|
}
|
287
|
294
|
|
288
|
295
|
//结束考试
|