// edit team by id @RequestMapping(value = "/edit/{id}", method = RequestMethod.GET) public String editTeamPageString(Map<String, Object> map, @PathVariable("id") int id) { String username = userService.getCurrentUserName(); Leader leader = leaderService.getLeaderByUserName(username); if (teamService.isTeamByLeaderId(leader.getId())) { Team teamByLeader = teamService.getTeamByLeader(leader); Team team = teamService.getTeamById(id); if (teamByLeader.getId() == team.getId()) { map.put("team", team); String birthDate = team.getLeader().getBirthday().toString(); if (birthDate.matches( "[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])( 00:00:00.0)")) { birthDate = birthDate.substring(0, 10); } map.put("birthDate", birthDate); map.put("username", username); return "team_edit"; } else { return "redirect:/error403/"; } } else { return "redirect:/add"; } }
// add team page @RequestMapping(value = "/add", method = RequestMethod.GET) public String addTeamPage(Map<String, Object> map) { Leader leader = leaderService.getLeaderByUserName(userService.getCurrentUserName()); if (teamService.isTeamByLeaderId(leader.getId()) == false) { map.put("username", userService.getCurrentUserName()); map.put("authority", userService.getCurrentAuthority()); return "team_add"; } return "index"; }