package egovframework.controller; import egovframework.service.impl.CommonServiceImpl; import egovframework.utill.TrafficData; import egovframework.vo.*; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.List; @Slf4j @RequiredArgsConstructor @Controller public class CommonController { private final CommonServiceImpl commonService; @ResponseBody @RequestMapping(value = "/common/getWeatherInfo.do", method = {RequestMethod.POST, RequestMethod.GET}) public WeatherInfoVO getWeather() { return this.commonService.getWeatherInfo(); } @ResponseBody @RequestMapping(value = "/common/getLinkVertexArr.do", method = {RequestMethod.POST, RequestMethod.GET}) public List getLinkVertexArr(HttpServletRequest request) { if (TrafficData.getLinkVertexArr() != null) { return TrafficData.getLinkVertexArr(); } else { return this.commonService.getLinkVertexArr(); } } @ResponseBody @RequestMapping(value = "/common/getIfscVertexArr.do", method = {RequestMethod.POST, RequestMethod.GET}) public List getIfscVertexArr(HttpServletRequest request) { if (TrafficData.getIfscVertexArr() != null) { return TrafficData.getIfscVertexArr(); } else { return this.commonService.getIfscVertexArr(); } } @ResponseBody @RequestMapping(value = "/common/getRoadVertexArr.do", method = {RequestMethod.POST, RequestMethod.GET}) public List getRoadVertexArr(HttpServletRequest request) { if (TrafficData.getRoadVertexArr() != null) { return TrafficData.getRoadVertexArr(); } else { return this.commonService.getRoadVertexArr(); } } @ResponseBody @RequestMapping(value = "/common/getVmsCtlr.do", method = {RequestMethod.POST, RequestMethod.GET}) public List getVmsCtlr() { return this.commonService.getVmsCtlr(); } @ResponseBody @RequestMapping(value = "/common/getVmsPhaseImg.do", method = {RequestMethod.POST, RequestMethod.GET}) public List getVmsPhasImg(@RequestParam HashMap paramMap) { return this.commonService.getVmsImgTxt(paramMap.get("vmsCtlrNmbr")); } @ResponseBody @RequestMapping(value = "/common/getCctvCtlr.do", method = {RequestMethod.POST, RequestMethod.GET}) public List getCctvCtlr() { return this.commonService.getCctvCtlr(); } @ResponseBody @RequestMapping(value = "/common/getWcamCtlr.do", method = {RequestMethod.POST, RequestMethod.GET}) public List getWcamCtlr() { return this.commonService.getWcamCtlr(); } @ResponseBody @RequestMapping(value = "/common/getIncdOcrr.do", method = {RequestMethod.POST, RequestMethod.GET}) public List getIncdOcrr() { return this.commonService.getIncdOcrr(); } @ResponseBody @RequestMapping(value = "/common/getParkingInfo.do", method = {RequestMethod.POST, RequestMethod.GET}) public List getParkingInfo() { return this.commonService.getParkingInfo(); } @ResponseBody @RequestMapping(value = "/parking/parking2.do", method = {RequestMethod.POST, RequestMethod.GET}) public List rtParking() { return this.commonService.rtParking(); } @ResponseBody @RequestMapping(value = "/common/getNewParkingInfo.do", method = {RequestMethod.POST, RequestMethod.GET}) public NewParkinginfoVO getNewParkingInfo(@RequestParam HashMap paramMap) { return this.commonService.getNewParkingInfo(paramMap.get("parkId")); } @ResponseBody @RequestMapping(value = "/common/getNewParkingOcc.do", method = {RequestMethod.POST, RequestMethod.GET}) public List getNewParkingOcc(@RequestParam HashMap paramMap) { return this.commonService.getNewParkingOcc(paramMap.get("parkId")); } @ResponseBody @RequestMapping(value = "/common/getTaasInfo.do", method = {RequestMethod.POST, RequestMethod.GET}) public List getTaasInfo() { List tassList = this.commonService.getTaasInfo(); SimpleDateFormat transFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat format = new SimpleDateFormat("yyyy년 MM월 dd일"); for (TaasVO vo : tassList) { Date date; try { date = transFormat.parse(vo.getReport_date()); vo.setReport_date(format.format(date)); } catch (ParseException e) { throw new RuntimeException(); } } return tassList; } @ResponseBody @RequestMapping(value = "/common/getVisitCount.do", method = {RequestMethod.POST, RequestMethod.GET}) public VisitCountVO getVisitCount() { return this.commonService.getVisitCount(); } }