Esempio n. 1
0
 /**
  * 获取试卷中大题号<=当前大题的大题的最后一个小题的小题号lastMTopic
  *
  * @param examId 试卷编号
  * @param orderNum 当前大题号
  * @return
  */
 public int getLastMTopic(int examId, int orderNum) {
   List<LStrMap<Object>> list = nwd.getLastMTopic(examId, orderNum);
   if (list.size() > 0 && list.get(0).get("m_topic") != null) {
     return Integer.parseInt(list.get(0).get("m_topic").toString());
   }
   return 0;
 }
Esempio n. 2
0
 public LStrMap<Object> getExamInfoByExamId(long examId) {
   List<LStrMap<Object>> list = nwd.getExamInfoByExamId(examId);
   if (list.size() > 0) {
     return list.get(0);
   }
   return null;
 }
Esempio n. 3
0
 /**
  * 返回试卷的预览设置信息,包括装订线的显示标记、保密标记的显示标记等
  *
  * @param examId 试卷编号
  * @return 返回试卷的预览设置信息
  */
 public LStrMap<Object> getExamPreviewSets(int examId) {
   List<LStrMap<Object>> list = nwd.getExamPreviewSets(examId);
   if (list.size() > 0) {
     return list.get(0);
   }
   return null;
 }
Esempio n. 4
0
 public LStrMap<Object> getGrade(long userId, int subjectId) {
   List<LStrMap<Object>> list = nwd.getGrade(userId, subjectId);
   if (list.size() > 0) {
     return list.get(0);
   }
   return null;
 }
Esempio n. 5
0
 /**
  * 获取试卷的所有小题的小题Id
  *
  * @param examId 试卷编号
  * @return
  */
 public List<Integer> getQuesIdsOfExam(int examId) {
   List<LStrMap<Object>> list = nwd.getQuesIdsOfExam(examId);
   if (list.size() > 0) {
     List<Integer> result = new ArrayList<Integer>();
     for (Iterator<LStrMap<Object>> iterator = list.iterator(); iterator.hasNext(); ) {
       result.add(Integer.parseInt(iterator.next().get("ques_id").toString()));
     }
     return result;
   }
   return null;
 }
Esempio n. 6
0
  /**
   * 得到试卷对象
   *
   * @param examId
   */
  public Exam getExam(int examId) {
    Map<String, Image> images = LStrMap.newInstance();
    Map<Integer, List<Option>> options = getOptionsOfExam(examId, images); // 得到选项
    Map<Integer, List<Question>> questions = getQuestionsOfExam(examId, images); // 得到小题
    List<BigQues> bigQuestions = getBigQuestionsOfExam(examId); // 得到大题
    fixQuestionsAndOptions(questions, options); // 封装小题和选项
    fixBigQuestionsAndQuestions(bigQuestions, questions); // 封装大题和小题

    Exam exam = nwd.getExam(examId);
    exam.setBigQues(bigQuestions); // 试卷设置大题
    exam.setImages(images);
    return exam;
  }
Esempio n. 7
0
  /**
   * 删除某篇文章下的所有小题及文章
   *
   * @param examId
   * @param quesIds
   */
  public void deleteArticleQuestions(long examId, String quesIds) {
    List<Integer> list = new ArrayList<Integer>();
    String[] quesIdArray = quesIds.split(",");
    for (int i = 0; i < quesIdArray.length; i++) {
      list.add(Integer.parseInt(quesIdArray[i]));
    }
    nwd.deleteArticleQuestions(examId, list);

    // 如果材料是未发布,则删除数据库中的材料及小题
    if (ead.getQuestionByQuesId(list.get(0)).getReleaseFlag() == 0) {
      ead.deleteQuestions(list);
      for (int i = 0, size = list.size(); i < size; i++) { // 删除选项
        ead.deleteOptionDao(list.get(i));
      }
    }
  }
Esempio n. 8
0
  /**
   * 得到试卷所有小题,将同一大题的小题存到同一个list中,并且以大题Id为键名,将list存到map中
   *
   * @param examId 试卷编号
   */
  private Map<Integer, List<Question>> getQuestionsOfExam(int examId, Map<String, Image> images) {
    List<LStrMap<Object>> list = nwd.getQuestionsOfExam(examId);
    if (list.size() > 0) {
      Map<Integer, List<Question>> resultMap = new LinkedHashMap<Integer, List<Question>>();
      for (Iterator<LStrMap<Object>> iterator = list.iterator(); iterator.hasNext(); ) {
        LStrMap<Object> tempMap = iterator.next();
        // 组合小题信息到小题对象
        Question question = new Question();
        images.putAll(question.setContents(tempMap.get("ques_content").toString()));
        question.setDifficulty(Double.parseDouble(tempMap.get("difficulty").toString()));
        question.setIndexNo(tempMap.get("m_topic").toString());
        Object keyword = tempMap.get("keyword");
        images.putAll(question.setParses(keyword == null ? "" : keyword.toString()));
        question.setQuestionId(Integer.parseInt(tempMap.get("ques_id").toString()));
        question.setQuestionType(Integer.parseInt(tempMap.get("ques_type").toString()));
        question.setScore(Double.parseDouble(tempMap.get("score").toString()));
        question.setShareFlag(Integer.parseInt(tempMap.get("share_flag").toString()));
        Object quesRefer = tempMap.get("ques_refer");
        String answer = quesRefer == null ? "" : quesRefer.toString();
        if (question.getQuestionType() == 2) // 多选题要去除@@
        answer.replace("@@", "");
        else if (question.getQuestionType() == 4) // 填空题要去除选项号之前的##
        answer.replaceAll("##", "");
        Object referIds = tempMap.get("remark");
        if (referIds == null) question.setReferIds("");
        else question.setReferIds(referIds.toString());

        images.putAll(question.setAnswers(answer));

        int typeId = Integer.parseInt(tempMap.get("type_id").toString());
        if (resultMap.containsKey(typeId)) {
          resultMap.get(typeId).add(question);
        } else {
          ArrayList<Question> tempList = new ArrayList<Question>();
          tempList.add(question);
          resultMap.put(typeId, tempList);
        }
      }

      fixArtAndQuestions(resultMap); // 封装材料和材料下小题
      return resultMap;
    }
    return null;
  }
Esempio n. 9
0
  /**
   * 得到试卷的所有大题,将大题封装后存到一个list中
   *
   * @param examId 试卷编号
   */
  private List<BigQues> getBigQuestionsOfExam(int examId) {
    List<LStrMap<Object>> list = nwd.getBigQuestionsOfExam(examId);
    if (list.size() > 0) {
      List<BigQues> resultList = new ArrayList<BigQues>();
      for (Iterator<LStrMap<Object>> iterator = list.iterator(); iterator.hasNext(); ) {
        LStrMap<Object> tempMap = iterator.next();
        // 组合大题信息到大题对象
        BigQues bigQues = new BigQues();
        bigQues.setId(Integer.parseInt(tempMap.get("type_id").toString()));
        bigQues.setOrderNum(Integer.parseInt(tempMap.get("order_num").toString()));
        bigQues.setName(tempMap.get("type_name").toString());
        bigQues.setDetail(tempMap.get("type_detail").toString());
        bigQues.setIndexNo(tempMap.get("index_no").toString());
        bigQues.setQuesType(Integer.parseInt(tempMap.get("type").toString()));
        bigQues.setDefaultScore(Double.parseDouble(tempMap.get("default_score").toString()));
        resultList.add(bigQues);
      }

      return resultList;
    }
    return null;
  }
Esempio n. 10
0
  /**
   * 得到试卷的所有选项,将同一小题的选项存到同一个list中,并且以小题Id为键名,将list存到map中
   *
   * @param examId 试卷编号
   */
  private Map<Integer, List<Option>> getOptionsOfExam(int examId, Map<String, Image> images) {
    List<LStrMap<Object>> list = nwd.getOptionsOfExam(examId);
    if (list.size() > 0) {
      Map<Integer, List<Option>> resultMap = new LinkedHashMap<Integer, List<Option>>();
      for (Iterator<LStrMap<Object>> iterator = list.iterator(); iterator.hasNext(); ) {
        LStrMap<Object> lStrMap = iterator.next();
        Option option = new Option();
        option.setOptionId(Integer.parseInt(lStrMap.get("opt_id").toString()));
        option.setOptionNo(lStrMap.get("opt_no").toString());
        images.putAll(option.setContents(lStrMap.get("opt_content").toString()));

        int quesId = Integer.parseInt(lStrMap.get("ques_id").toString());
        if (resultMap.containsKey(quesId)) {
          resultMap.get(quesId).add(option);
        } else {
          ArrayList<Option> tempList = new ArrayList<Option>();
          tempList.add(option);
          resultMap.put(quesId, tempList);
        }
      }
      return resultMap;
    }
    return null;
  }
Esempio n. 11
0
 public List<LStrMap<Object>> getTestsByExamId(long user_id, int examId) {
   return nwd.getTestsExamId(user_id, examId);
 }
Esempio n. 12
0
 public List<LStrMap<Object>> getTestsByUser(long user_id) {
   return nwd.getTestsByUser(user_id);
 }
Esempio n. 13
0
 public List<LStrMap<Object>> getTeacherAllNewWork(long user_id) {
   return nwd.getTeacherAllNewWork(user_id);
 }
Esempio n. 14
0
 public List<LStrMap<Object>> getKnowledgePointsBySubjectId(int subjectId) {
   return nwd.getKnowledgePointsBySubjectId(subjectId);
 }
Esempio n. 15
0
 public List<LStrMap<Object>> getstudentByuserId(long user_id) {
   return nwd.getstudentByuserId(user_id);
 }
Esempio n. 16
0
 public int saveTestExamDao(ETestEexam ete) {
   return nwd.saveTestExamDao(ete);
 }
Esempio n. 17
0
 /**
  * 得到符合条件的随机小题
  *
  * @param tsId 题型编号
  * @param kpList 考点列表
  * @param quesNum 小题数量
  * @param usedQues 已用过小题列表
  * @param diff 难度
  * @return
  */
 public List<LStrMap<Object>> getRandomQues(
     int tsId, List<String> kpList, int quesNum, List<Integer> usedQues, float diff) {
   return nwd.getRandomques(tsId, kpList, quesNum, usedQues, diff);
 }
Esempio n. 18
0
 /**
  * 更新试卷的小题数
  *
  * @param examId 试卷编号
  */
 public void updateExamMTopicNum(int examId) {
   nwd.updateExamMTopicNum(examId);
 }
Esempio n. 19
0
 /**
  * 更新一个试卷的设置信息
  *
  * @param eps 设置信息
  */
 public void updateExamPreviewSets(ExamPreviewSets eps) {
   nwd.updateExamPreviewSets(eps);
 }
Esempio n. 20
0
 /**
  * 插入一个试卷预览设置记录
  *
  * @param examId 试卷编号
  */
 public void saveExamPreviewSets(int examId) {
   nwd.saveExamPreviewSets(examId);
 }
Esempio n. 21
0
 /**
  * 获得某科目的所有题目类型
  *
  * @param subjectId 科目编号
  * @return 包含该科目的所有题目类型的List
  */
 public List<LStrMap<Object>> getTypeSubjects(int subjectId) {
   return nwd.getTypeSubjects(subjectId);
 }
Esempio n. 22
0
 /**
  * 批量插入试卷小题关系
  *
  * @param paramList 参数列表
  */
 public void batchInsertExamQuestionRelation(List<UStrMap<Object>> paramList) {
   nwd.batchInsertExamQuestionRelation(paramList);
 }
Esempio n. 23
0
 public int insertTest(ETest eTest) {
   int testiId = seq_testId.nextIntValue();
   eTest.setTestId(testiId);
   return nwd.insertTest(eTest);
 }
Esempio n. 24
0
 public List<LStrMap<Object>> getTestTypes(String code_cate) {
   return nwd.getTestTypes(code_cate);
 }
Esempio n. 25
0
 public int saveExamService(EExam eExam) {
   int examId = seq_examId.nextIntValue();
   eExam.setExamId(examId);
   nwd.saveExamDao(eExam);
   return examId;
 }
Esempio n. 26
0
 public int saveQuesType(int examId, int subjectId, int tsId, int orderNum) {
   int typeId = seq_typeId.nextIntValue();
   nwd.saveQuesType(examId, subjectId, typeId, tsId, orderNum);
   return typeId;
 }
Esempio n. 27
0
 public List<LStrMap<Object>> getGradeByTeacher(long user_id) {
   return nwd.getGrades(user_id);
 }
Esempio n. 28
0
 public List<LStrMap<Object>> getUserFromTeaAndStu(long user_id) {
   return nwd.getUserFromTeaAndStu(user_id);
 }
Esempio n. 29
0
 public List<LStrMap<Object>> getTeachsOfTeacher(long user_id) {
   return nwd.getTeachsOfTeacher(user_id);
 }
Esempio n. 30
0
 public void updateNextQuestionsMTopic(int examId, int quesId, int moveNum) {
   nwd.updateNextQuestionsMTopic(examId, quesId, moveNum);
 }