| | |
| | | }); |
| | | return true; |
| | | } |
| | | //内网数据同步 |
| | | try { |
| | | // arg.test01(arg.url+"/examSubjectChoices/saveSubjectChoicesAndOption",examSubjectChoices); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | }else { |
| | | //修改 |
| | | ExamSubjectChoices subjectChoices = new ExamSubjectChoices(); |
| | |
| | | examSubjectOptionService.save(examSubjectOption); |
| | | }); |
| | | return true; |
| | | } |
| | | //内网数据同步 |
| | | try { |
| | | // arg.test01(arg.url+"/examSubjectChoices/saveSubjectChoicesAndOption",examSubjectChoices); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return status; |
| | |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 判断当前题目的答题结果 |
| | | * @param preSubJectId 题目Id |
| | | * @param preResult 提交的结果 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer getAnswerResult(Long preSubJectId, String preResult) { |
| | | //查询题目信息 |
| | | ExamSubjectChoices choices = this.getById(preSubJectId); |
| | | //对比答案 |
| | | if (choices.getChoicesType() == 2 || choices.getChoicesType() == 3){ |
| | | //判断题逻辑 |
| | | if (preResult.equals(choices.getAnswer())) { |
| | | return 1; |
| | | }else { |
| | | return 2; |
| | | } |
| | | }else if(choices.getChoicesType() == 0 || choices.getChoicesType() == 1){ |
| | | //处理多选题的答案排序 |
| | | String[] split = preResult.split(","); |
| | | StringBuilder builder = new StringBuilder(); |
| | | for (String s : split) { |
| | | builder.append(s); |
| | | } |
| | | char[] arrayCh = builder.toString().toCharArray(); |
| | | //利用数组帮助类自动排序 |
| | | Arrays.sort(arrayCh); |
| | | String sub0 = Arrays.toString(arrayCh); |
| | | String sub = sub0.substring(1,sub0.length()-1).replaceAll(" ",""); |
| | | if (sub.equals(choices.getAnswer())) { |
| | | return 1; |
| | | }else { |
| | | return 2; |
| | | } |
| | | } |
| | | return 2; |
| | | } |
| | | } |