Bläddra i källkod

网页端提交试卷

tags/正式版本
王宁 2 år sedan
förälder
incheckning
43fe2ef771

+ 62
- 53
sexam/src/main/java/com/xhkjedu/sexam/service/paperstudent/EPaperStudentService.java Visa fil

@@ -231,79 +231,88 @@ public class EPaperStudentService {
231 231
                 if(N_Utils.isListEmpty(stuanswers) && N_Utils.isEmpty(psq.getStuanswertxt())
232 232
                         && N_Utils.isEmpty(psq.getStuanswertxt())){
233 233
                     psq.setStuscore(stuscore);
234
-                    psq.setChecked(1);
234
+                    psq.setChecked(2);
235 235
                     psq.setChecktime(timestamp);
236 236
                     psq.setAnswered(0);
237 237
                 }else{
238 238
                     int ctype = answerVo.getCtype();
239
-                    if(N_Utils.isObjectiveQuestion(ctype)){
240
-                        //客观题进行批阅
241
-                        if(ctype == 1 || ctype == 4 || ctype == 5 || ctype == 6){
242
-                            //单选、判断
243
-                            if(stuanswer.equalsIgnoreCase(qanswer)) {
244
-                                stuscore = answerVo.getScore();
245
-                            }
246
-                        }else if(ctype == 2){//多选
247
-                            //多选、选错不得分
248
-                            if(stuanswers.get(0).length() <= qanswer.length()){
249
-                                String[] qanswerList = qanswers.get(0).split("");
250
-                                String[] stuanswerList = stuanswers.get(0).split("");
251
-                                int rightNum = 0;//选对个数
252
-                                for(String sa : stuanswerList){
253
-                                    int right = 0;
254
-                                    for(String qa : qanswerList){
255
-                                        if(qa.equals(sa)){
256
-                                            right = 1;
257
-                                            rightNum ++;
239
+                    if(psq.getAnswertype() == 1){
240
+                        if(N_Utils.isObjectiveQuestion(ctype)){
241
+                            //客观题进行批阅
242
+                            if(ctype == 1 || ctype == 4 || ctype == 5 || ctype == 6){
243
+                                //单选、判断
244
+                                if(stuanswer.equalsIgnoreCase(qanswer)) {
245
+                                    stuscore = answerVo.getScore();
246
+                                }
247
+                            }else if(ctype == 2){//多选
248
+                                //多选、选错不得分
249
+                                if(stuanswers.get(0).length() <= qanswer.length()){
250
+                                    String[] qanswerList = qanswers.get(0).split("");
251
+                                    String[] stuanswerList = stuanswers.get(0).split("");
252
+                                    int rightNum = 0;//选对个数
253
+                                    for(String sa : stuanswerList){
254
+                                        int right = 0;
255
+                                        for(String qa : qanswerList){
256
+                                            if(qa.equals(sa)){
257
+                                                right = 1;
258
+                                                rightNum ++;
259
+                                            }
260
+                                        }
261
+                                        if(right == 0){//说明选错
262
+                                            rightNum = 0;
263
+                                            break;
258 264
                                         }
259 265
                                     }
260
-                                    if(right == 0){//说明选错
261
-                                        rightNum = 0;
262
-                                        break;
266
+                                    if(rightNum>0){
267
+                                        if(qanswerList.length == rightNum){
268
+                                            //全选对
269
+                                            stuscore = answerVo.getScore();
270
+                                        }else if (qanswerList.length > rightNum){
271
+                                            //少选得半分
272
+                                            stuscore = ExamUtil.div(answerVo.getScore(),2,1);
273
+                                        }
263 274
                                     }
264 275
                                 }
265
-                                if(rightNum>0){
266
-                                    if(qanswerList.length == rightNum){
267
-                                        //全选对
268
-                                        stuscore = answerVo.getScore();
269
-                                    }else if (qanswerList.length > rightNum){
270
-                                        //少选得半分
271
-                                        stuscore = ExamUtil.div(answerVo.getScore(),2,1);
276
+                            }else if(ctype == 7 || ctype == 8 || ctype == 10){
277
+                                //完形填空、阅读理解、任务型阅读
278
+                                Double qscore = ExamUtil.div(answerVo.getScore(),qanswers.size());
279
+                                Double stuScoreDouble = 0d;
280
+                                for(int i=0;i<qanswers.size();i++){
281
+                                    if(qanswers.get(i).equalsIgnoreCase(stuanswers.get(i))){
282
+                                        stuScoreDouble = ExamUtil.add(stuScoreDouble,qscore);
272 283
                                     }
273 284
                                 }
285
+                                stuscore = ExamUtil.round(stuScoreDouble,1);
274 286
                             }
275
-                        }else if(ctype == 7 || ctype == 8 || ctype == 10){
276
-                            //完形填空、阅读理解、任务型阅读
277
-                            Double qscore = ExamUtil.div(answerVo.getScore(),qanswers.size());
278
-                            Double stuScoreDouble = 0d;
279
-                            for(int i=0;i<qanswers.size();i++){
280
-                                if(qanswers.get(i).equalsIgnoreCase(stuanswers.get(i))){
281
-                                    stuScoreDouble = ExamUtil.add(stuScoreDouble,qscore);
282
-                                }
287
+                            if(stuscore.compareTo(answerVo.getScore()) == 1){
288
+                                stuscore = answerVo.getScore();
283 289
                             }
284
-                            stuscore = ExamUtil.round(stuScoreDouble,1);
285
-                        }
286
-                        if(stuscore.compareTo(answerVo.getScore()) == 1){
287
-                            stuscore = answerVo.getScore();
288
-                        }
289
-                        psq.setStuscore(stuscore);
290
-                        psq.setChecked(2);
291
-                        psq.setChecktime(timestamp);
292
-                    }else{
293
-                        if(stuanswers.size() > 0){
294
-                            coverted = 0;//上传的多张图片设为0未转换
290
+
291
+                            psq.setChecked(2);
292
+                            psq.setChecktime(timestamp);
293
+                        }else{
294
+                            if(stuanswers.size() > 1){
295
+                                coverted = 0;//上传的多张图片设为0未转换
296
+                            }
297
+                            psq.setChecked(0);
295 298
                         }
296 299
                     }
297
-                    psq.setAnswered(1);
300
+                    psq.setAnswered(0);
301
+                    psq.setChecked(0);
298 302
                 }
299 303
             }
300 304
         }
301
-
305
+        psq.setStuscore(stuscore);
302 306
         Integer costtime = answerVo.getCosttime();
303 307
         if(costtime == null){
304 308
             costtime = 0;
305 309
         }
306
-        psq.setCosttime(psq.getCosttime() + costtime);
310
+        if(psq.getCosttime() == null){
311
+            psq.setCosttime(costtime);
312
+        }else{
313
+            psq.setCosttime(psq.getCosttime());
314
+        }
315
+
307 316
         psq.setConverted(coverted);
308 317
     }
309 318
 
@@ -372,7 +381,7 @@ public class EPaperStudentService {
372 381
         for(EPaperStudentQuestion q : sqlist){
373 382
 
374 383
             //获取该试题正确答案
375
-            PsqAnswerVo anvo = anvolist.stream().filter(a -> a.getEptqid().equals(q.getEptqid())).findFirst().orElse(null);
384
+            PsqAnswerVo anvo = anvolist.stream().filter(a -> a.getEpsqid().equals(q.getEpsqid())).findFirst().orElse(null);
376 385
 
377 386
             setCommitQuestion(q,anvo);
378 387
             if(q.getChecked() == 2){

+ 1
- 1
sexam/src/main/resources/mapper/system/UserMapper.xml Visa fil

@@ -18,7 +18,7 @@
18 18
     <!--获取考试班级任教老师-->
19 19
     <select id="listTeacherByClassIds" resultType="com.xhkjedu.sexam.vo.system.UserVo">
20 20
         select u.userid,u.userphone
21
-        from t_class_teacher ct left join t_user u on ct.studentid = u.userid
21
+        from t_class_teacher ct left join t_user u on ct.teacherid = u.userid
22 22
         where ct.classid in(${classids}) and u.userstate=1
23 23
         group by u.userid
24 24
     </select>

Laddar…
Avbryt
Spara