package com.its.web.controller.view; import com.its.web.service.common.CommonService; import com.its.web.service.notice.NoticeService; import com.its.web.service.statistics.StatisticsService; import com.its.web.service.traffic.TrafficService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import javax.annotation.Nullable; @Slf4j @RequiredArgsConstructor @Controller @Api(tags = "99.화면 이동") public class ViewController { private final TrafficService trafficService; private final StatisticsService statisticsService; private final CommonService commonService; private final NoticeService noticeService; @ApiOperation(value = "01.메인화면") @GetMapping("/") public String main(Model model) { model.addAttribute("selected", ""); model.addAttribute("incident", this.trafficService.findMainIncident()); model.addAttribute("notice", this.noticeService.findMainNotice()); return "main/main"; } @ApiOperation(value = "02.교통정보 - 01.CCTV") @GetMapping("/trafficMap/cctvMap") public String trafficCctv(Model model) { model.addAttribute("selected", "traffic"); model.addAttribute("mobile", "cctv"); model.addAttribute("listTitle", "CCTV 목록"); return "traffic/cctv"; } @ApiOperation(value = "02.교통정보 - 02.스마트교차로") @GetMapping("/trafficMap/intersections") public String trafficIntersection(Model model) { model.addAttribute("selected", "traffic"); model.addAttribute("mobile", "intersection"); model.addAttribute("listTitle", "스마트교차로 목록"); return "traffic/intersection"; } @ApiOperation(value = "02.교통정보 - 03.VMS") @GetMapping("/trafficMap/vms") public String trafficVms(Model model) { model.addAttribute("selected", "traffic"); model.addAttribute("mobile", "vms"); model.addAttribute("listTitle", "도로전광판 목록"); return "traffic/vms"; } @ApiOperation(value = "02.교통정보 - 04.돌발") @GetMapping(value= {"/trafficMap/incidents/{incidentId}", "/trafficMap/incidents"}) public String trafficIncident(Model model, @Nullable @PathVariable ("incidentId") String incidentId) { model.addAttribute("selected", "traffic"); model.addAttribute("mobile", "incident"); model.addAttribute("listTitle", "돌발 목록"); model.addAttribute("incidentId", incidentId); return "traffic/incident"; } @ApiOperation(value = "02.교통정보 - 05.실시간 교통정보") @GetMapping("/trafficMap/realtimetraffic") public String trafficRealTimeTraffic(Model model) { model.addAttribute("selected", "traffic"); model.addAttribute("mobile", "traffic"); model.addAttribute("listTitle", "도로 목록"); return "traffic/realtimetraffic"; } @ApiOperation(value = "03.교통통계 - 01.교통량 통계") @GetMapping("/statistics/traffic01") public String trafficStatisticsAmount(Model model) { model.addAttribute("selected", "statistics"); model.addAttribute("active", "traffic01"); model.addAttribute("road", statisticsService.findIntersectionAtrdName()); return "statistics/tfvl-stat-amount"; } @ApiOperation(value = "03.교통통계 - 02.소통 통계") @GetMapping("/statistics/traffic02") public String trafficStatisticsSpeed(Model model) { model.addAttribute("selected", "statistics"); model.addAttribute("active", "traffic02"); model.addAttribute("road", trafficService.findAtrdNameList()); return "statistics/tfvl-stat-speed"; } @ApiOperation(value = "03.교통통계 - 03.정체 통계") @GetMapping("/statistics/congestion") public String trafficCongestStatistics(Model model) { model.addAttribute("selected", "statistics"); model.addAttribute("active", "congest"); model.addAttribute("list", commonService.findDayList()); return "statistics/congest-stat"; } @ApiOperation(value = "04.교통정보센터 - 01.센터 소개") @GetMapping("/center/center") public String center(Model model) { model.addAttribute("selected", "center"); model.addAttribute("active", "center"); return "center/center"; } @ApiOperation(value = "04.교통정보센터 - 02.오시는 길") @GetMapping("/center/way") public String way(Model model) { model.addAttribute("selected", "center"); model.addAttribute("active", "way"); return "center/way"; } @ApiOperation(value = "05.공지사항 - 01.공지사항 목록") @GetMapping("/notice/list") public String noticeList(Model model, @Nullable @Param("page") String page, @Nullable @Param("searchType") String searchType, @Nullable @Param("searchText")String searchText) { model.addAttribute("list", this.noticeService.findAllList(page, searchType, searchText)); return "notice/list"; } @ApiOperation(value = "05.공지사항 - 02.공지사항 상세보기") @GetMapping("/notice/view/{boardNo}" ) public String noticeView(Model model, @PathVariable("boardNo")String boardNo) { model.addAttribute("notice", this.noticeService.findNotice(boardNo)); return "notice/view"; } @ApiOperation(value = "06.운영자 - 01.로그인") @GetMapping("/phits") public String login(Model model, @Nullable @Param("LoginFail") String loginFail) { model.addAttribute("loginFail", loginFail); return "admin/login"; } }