Exemplo n.º 1
0
  @Override
  public Question getQuestion(String id) throws Exception {

    // TODO Auto-generated method stub
    if (!ValidateUtil.isPassSqlFilter(id)) {
      myLogger.error("要查询的实例,questionId通过验证!--->questionId:" + id);
      return null;
    }
    return myQuestionDao.selectQuestion(id);
  }
Exemplo n.º 2
0
 @Override
 public int deleteQuestion(String id) throws Exception {
   // TODO Auto-generated method stub
   if (!ValidateUtil.isPassSqlFilter(id)) {
     myLogger.error("要增添的实例,questionId通过验证!");
     return 1;
   }
   int deleteResult = myQuestionDao.deleteQuestion(id);
   if (deleteResult != 0) {
     myLogger.error("删除实例信息时出现错误!--->questionId:" + id);
   }
   return 0;
 }
Exemplo n.º 3
0
 @Override
 public int addQuestion(Question question) throws Exception {
   // TODO Auto-generated method stub
   if (ValidateUtil.validateQuestionId(question) != 0) {
     myLogger.error("要增添的实例,questionId通过验证!");
     return 1;
   }
   if (myQuestionDao.insertQuestion(question) != 0) {
     myLogger.error("增添question实例操作出现错误!-->questionInfo:" + question.toString());
     return 2;
   }
   ;
   return 0;
 }
Exemplo n.º 4
0
  @Override
  public Question getFirstQuestionByType(String type) throws Exception {

    Question question = new Question();

    if (!ValidateUtil.isPassSqlFilter(type)) {
      myLogger.error("要查询的实例,questionType通过验证!--->questionType:" + type);
      return null;
    }

    question =
        myQuestionDao.selectFirstQuestionByType(changeQuestionTypeToChinese(type)); // 正常跳转下一部分

    return question;
  }
Exemplo n.º 5
0
  @Override
  public Question getQuestionByType(String id, String type) throws Exception {
    System.out.println("getQuestionByType:" + id + "--" + type);
    Question question = new Question();

    if (!ValidateUtil.isPassSqlFilter(id)) {
      myLogger.error("要查询的实例,questionId通过验证!--->questionId:" + id);
      return null;
    }
    if (!ValidateUtil.isPassSqlFilter(type)) {
      myLogger.error("要查询的实例,questionType通过验证!--->questionType:" + type);
      return null;
    }

    if (id == null && type == null) {
      question = myQuestionDao.selectFirstQuestionByType("年龄"); // 开始答题

      while (question == null) {
        question =
            myQuestionDao.selectFirstQuestionByType(
                getNextQuestionType(changeQuestionTypeToChinese(type)));
      }

      return question;

    } else if ((id.equals("end") || id == null)
        && !type.equals(changeQuestionTypeToEnglish("守法诚信"))) {
      System.out.println(changeQuestionTypeToEnglish("守法诚信"));
      System.out.println(1);
      System.out.println(type);
      type = getNextQuestionType(changeQuestionTypeToChinese(type));
      System.out.println(type);
      question = myQuestionDao.selectFirstQuestionByType(type); // 正常跳转下一部分

      while (question == null) {
        System.out.println(2);
        System.out.println(type);
        if (!type.equals("守法诚信")) {
          type = getNextQuestionType(type);
        }
        System.out.println(type);

        question = myQuestionDao.selectFirstQuestionByType(type);
        if (type.equals("守法诚信") && question == null) {
          System.out.println(3);
          return null;
        }
      }

      return question;
    } else if ((id.equals("end") || id == null)
        && type.equals(changeQuestionTypeToEnglish("守法诚信"))) { // 答题结束
      System.out.println(4);
      return null;

    }
    // TODO Auto-generated method stub
    else {
      return myQuestionDao.selectQuestion(id); // 正常答题
    }
  }