Пример #1
0
 @RequestMapping(method = RequestMethod.GET, value = "{prizeId}")
 public String prize(@PathVariable String prizeId, Model model) throws Exception {
   MPrize prize = prizeService.getPrize(prizeId);
   model.addAttribute("prize", prize);
   model.addAttribute("match", matchService.getMatches(new Match()));
   return "match/prize/prize";
 }
Пример #2
0
 @RequestMapping(method = RequestMethod.DELETE, value = "{prizeId}")
 public String delete(
     @PathVariable String prizeId, Model model, RedirectAttributes redirectAttributes)
     throws Exception {
   prizeService.delete(Arrays.asList(prizeId.split(",")));
   redirectAttributes.addFlashAttribute("success", getMessage("save.success"));
   return "redirect:/match/{matchId}/detail";
 }
Пример #3
0
  /**
   * 添加
   *
   * @param prize
   * @param model
   * @param redirectAttributes
   * @return
   * @throws Exception
   */
  @RequestMapping(method = RequestMethod.POST)
  public String save(MPrize prize, Model model, RedirectAttributes redirectAttributes) {
    try {
      prizeService.save(prize, null);
    } catch (Exception ex) {
      model.addAttribute("error", ex.getMessage());
      model.addAttribute("prize", prize);
      return "match/prize/prize";
    }

    redirectAttributes.addFlashAttribute("success", getMessage("save.success"));
    return "redirect:/match/{matchId}/detail";
  }
Пример #4
0
 @RequestMapping(method = RequestMethod.GET, value = "prizes")
 public String prizes(
     @PathVariable String matchId,
     @RequestParam(required = false, defaultValue = "1") int pageIndex,
     @RequestParam(required = false, defaultValue = "15") int pageSize,
     Model model)
     throws Exception {
   model.addAttribute(matchService.getMatch(matchId));
   MPrize prize = new MPrize();
   prize.setMatchId(matchId);
   PageList<MPrize> prizeList = prizeService.getPrizes(prize);
   model.addAttribute("list", prizeList);
   return "match/prize/prizes";
 }
Пример #5
0
  @RequestMapping(method = RequestMethod.PUT, value = "{prizeId}")
  public String update(
      @PathVariable String prizeId,
      MPrize prize,
      Model model,
      RedirectAttributes redirectAttributes)
      throws Exception {

    try {
      prizeService.save(prize, new String[] {"creator", "createTime"});
    } catch (Exception ex) {
      model.addAttribute("error", ex.getMessage());
      model.addAttribute("prize", prize);
      return "match/prize/prize";
    }
    redirectAttributes.addFlashAttribute("success", getMessage("save.success"));
    return "redirect:/match/{matchId}/detail";
  }
Пример #6
0
  @RequestMapping(method = RequestMethod.GET, value = "{prizeId}/applicantInfo")
  public String applicant(@PathVariable String prizeId) throws Exception {

    MPrize prize = prizeService.getPrize(prizeId);
    String forward = "";

    if (MPrize.PRIZE_TYPE_PERSON.equals(prize.getPrizeType())) {
      forward = "redirect:/personPrize";
    }

    if (MPrize.PRIZE_TYPE_TEAM.equals(prize.getPrizeType())) {
      forward = "redirect:/teamPrize";
    }

    if (MPrize.PRIZE_TYPE_PROJECT.equals(prize.getPrizeType())) {
      forward = "redirect:/projectPrize";
    }

    if (MPrize.PRIZE_TYPE_PROJECT_ACHIEVEMENT.equals(prize.getPrizeType())) {
      forward = "redirect:/projectAchievement";
    }

    return forward + "?prize.prizeId=" + prizeId + "&prize.matchId=" + prize.getMatchId();
  }