Ejemplo n.º 1
0
  @RequestMapping(value = "admin/exam/delete-hist/{histId}", method = RequestMethod.GET)
  public @ResponseBody Message deleteUserExamHist(@PathVariable("histId") int histId) {

    Message msg = new Message();
    try {
      examService.deleteUserExamHist(histId);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      msg.setResult(e.getMessage());
    }
    return msg;
  }
Ejemplo n.º 2
0
  /**
   * 将用户组中的用户添加到考试中
   *
   * @param groupIdList
   * @param examId
   * @return
   */
  @RequestMapping(value = "admin/exam/add-exam-group/{examId}", method = RequestMethod.POST)
  public @ResponseBody Message addExamGroup(
      @RequestBody List<Integer> groupIdList, @PathVariable("examId") int examId) {

    Message msg = new Message();
    try {
      examService.addGroupUser2Exam(groupIdList, examId);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      msg.setResult(e.getClass().getName());
    }
    return msg;
  }
Ejemplo n.º 3
0
  /**
   * 改变考试的审核状态
   *
   * @param examId
   * @param mark
   * @return
   */
  @RequestMapping(value = "admin/exam/mark-exam/{examId}/{mark}", method = RequestMethod.GET)
  public @ResponseBody Message markExam(
      @PathVariable("examId") int examId, @PathVariable("mark") int mark) {

    Message msg = new Message();
    try {
      examService.changeExamStatus(examId, mark);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      msg.setResult(e.getMessage());
    }
    return msg;
  }
Ejemplo n.º 4
0
  /**
   * 将用户添加到考试中
   *
   * @param userNameStr
   * @param examId
   * @return
   */
  @RequestMapping(value = "admin/exam/add-exam-user/{examId}", method = RequestMethod.POST)
  public @ResponseBody Message addExamUser(
      @RequestBody String userNameStr, @PathVariable("examId") int examId) {

    UserInfo userInfo =
        (UserInfo) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    userNameStr = userNameStr.replace("\"", "");
    Message msg = new Message();
    try {

      examService.addExamUser(examId, userNameStr, userInfo.getRoleMap());
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      msg.setResult(e.getClass().getName());
    }
    return msg;
  }
Ejemplo n.º 5
0
  /**
   * 添加考试
   *
   * @param exam
   * @return
   */
  @RequestMapping(value = "admin/exam/add-exam", method = RequestMethod.POST)
  public @ResponseBody Message addExam(@RequestBody Exam exam) {

    UserInfo userInfo =
        (UserInfo) SecurityContextHolder.getContext().getAuthentication().getPrincipal();

    Message msg = new Message();
    try {
      exam.setCreator(userInfo.getUserid());
      exam.setCreatorId(userInfo.getUsername());
      exam.setApproved(1);
      examService.addExam(exam);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      msg.setResult(e.getClass().getName());
    }
    return msg;
  }
Ejemplo n.º 6
0
  /**
   * 添加模拟考试
   *
   * @param exam
   * @return
   */
  @RequestMapping(value = "admin/exam/add-model-test", method = RequestMethod.POST)
  public @ResponseBody Message addModelTest(@RequestBody Exam exam) {

    UserInfo userInfo =
        (UserInfo) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    Message msg = new Message();
    try {
      Calendar c = Calendar.getInstance();
      c.add(Calendar.YEAR, 10);
      exam.setCreator(userInfo.getUserid());
      exam.setApproved(1);
      exam.setEffTime(new Date());
      exam.setExpTime(c.getTime());
      examService.addExam(exam);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      msg.setResult(e.getClass().getName());
    }
    return msg;
  }