CommonController.java 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. package egovframework.controller;
  2. import egovframework.service.impl.CommonServiceImpl;
  3. import egovframework.utill.TrafficData;
  4. import egovframework.vo.*;
  5. import lombok.RequiredArgsConstructor;
  6. import lombok.extern.slf4j.Slf4j;
  7. import org.springframework.stereotype.Controller;
  8. import org.springframework.web.bind.annotation.RequestMapping;
  9. import org.springframework.web.bind.annotation.RequestMethod;
  10. import org.springframework.web.bind.annotation.RequestParam;
  11. import org.springframework.web.bind.annotation.ResponseBody;
  12. import javax.servlet.http.HttpServletRequest;
  13. import java.text.ParseException;
  14. import java.text.SimpleDateFormat;
  15. import java.util.Date;
  16. import java.util.HashMap;
  17. import java.util.List;
  18. @Slf4j
  19. @RequiredArgsConstructor
  20. @Controller
  21. public class CommonController {
  22. private final CommonServiceImpl commonService;
  23. @ResponseBody
  24. @RequestMapping(value = "/common/getWeatherInfo.do", method = {RequestMethod.POST, RequestMethod.GET})
  25. public WeatherInfoVO getWeather() {
  26. return this.commonService.getWeatherInfo();
  27. }
  28. @ResponseBody
  29. @RequestMapping(value = "/common/getLinkVertexArr.do", method = {RequestMethod.POST, RequestMethod.GET})
  30. public List<RoadVertexArrVO> getLinkVertexArr(HttpServletRequest request) {
  31. if (TrafficData.getLinkVertexArr() != null) {
  32. return TrafficData.getLinkVertexArr();
  33. }
  34. else {
  35. return this.commonService.getLinkVertexArr();
  36. }
  37. }
  38. @ResponseBody
  39. @RequestMapping(value = "/common/getIfscVertexArr.do", method = {RequestMethod.POST, RequestMethod.GET})
  40. public List<RoadVertexArrVO> getIfscVertexArr(HttpServletRequest request) {
  41. if (TrafficData.getIfscVertexArr() != null) {
  42. return TrafficData.getIfscVertexArr();
  43. }
  44. else {
  45. return this.commonService.getIfscVertexArr();
  46. }
  47. }
  48. @ResponseBody
  49. @RequestMapping(value = "/common/getRoadVertexArr.do", method = {RequestMethod.POST, RequestMethod.GET})
  50. public List<RoadVertexArrVO> getRoadVertexArr(HttpServletRequest request) {
  51. if (TrafficData.getRoadVertexArr() != null) {
  52. return TrafficData.getRoadVertexArr();
  53. }
  54. else {
  55. return this.commonService.getRoadVertexArr();
  56. }
  57. }
  58. @ResponseBody
  59. @RequestMapping(value = "/common/getVmsCtlr.do", method = {RequestMethod.POST, RequestMethod.GET})
  60. public List<VmsCtlrVO> getVmsCtlr() {
  61. return this.commonService.getVmsCtlr();
  62. }
  63. @ResponseBody
  64. @RequestMapping(value = "/common/getVmsPhaseImg.do", method = {RequestMethod.POST, RequestMethod.GET})
  65. public List<VmsCtlrVO> getVmsPhasImg(@RequestParam HashMap<String, String> paramMap) {
  66. return this.commonService.getVmsImgTxt(paramMap.get("vmsCtlrNmbr"));
  67. }
  68. @ResponseBody
  69. @RequestMapping(value = "/common/getCctvCtlr.do", method = {RequestMethod.POST, RequestMethod.GET})
  70. public List<CctvCtlrVO> getCctvCtlr() {
  71. return this.commonService.getCctvCtlr();
  72. }
  73. @ResponseBody
  74. @RequestMapping(value = "/common/getWcamCtlr.do", method = {RequestMethod.POST, RequestMethod.GET})
  75. public List<WcamCtlrVO> getWcamCtlr() {
  76. return this.commonService.getWcamCtlr();
  77. }
  78. @ResponseBody
  79. @RequestMapping(value = "/common/getIncdOcrr.do", method = {RequestMethod.POST, RequestMethod.GET})
  80. public List<IncdVO> getIncdOcrr() {
  81. return this.commonService.getIncdOcrr();
  82. }
  83. @ResponseBody
  84. @RequestMapping(value = "/common/getParkingInfo.do", method = {RequestMethod.POST, RequestMethod.GET})
  85. public List<ParkingInfoVO> getParkingInfo() {
  86. return this.commonService.getParkingInfo();
  87. }
  88. @ResponseBody
  89. @RequestMapping(value = "/parking/parking2.do", method = {RequestMethod.POST, RequestMethod.GET})
  90. public List<ParkingInfoVO> rtParking() {
  91. return this.commonService.rtParking();
  92. }
  93. @ResponseBody
  94. @RequestMapping(value = "/common/getNewParkingInfo.do", method = {RequestMethod.POST, RequestMethod.GET})
  95. public NewParkinginfoVO getNewParkingInfo(@RequestParam HashMap<String, String> paramMap) {
  96. return this.commonService.getNewParkingInfo(paramMap.get("parkId"));
  97. }
  98. @ResponseBody
  99. @RequestMapping(value = "/common/getNewParkingOcc.do", method = {RequestMethod.POST, RequestMethod.GET})
  100. public List<NewParkingOccVO> getNewParkingOcc(@RequestParam HashMap<String, String> paramMap) {
  101. return this.commonService.getNewParkingOcc(paramMap.get("parkId"));
  102. }
  103. @ResponseBody
  104. @RequestMapping(value = "/common/getTaasInfo.do", method = {RequestMethod.POST, RequestMethod.GET})
  105. public List<TaasVO> getTaasInfo() {
  106. List<TaasVO> tassList = this.commonService.getTaasInfo();
  107. SimpleDateFormat transFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  108. SimpleDateFormat format = new SimpleDateFormat("yyyy년 MM월 dd일");
  109. for (TaasVO vo : tassList) {
  110. Date date;
  111. try {
  112. date = transFormat.parse(vo.getReport_date());
  113. vo.setReport_date(format.format(date));
  114. } catch (ParseException e) {
  115. throw new RuntimeException();
  116. }
  117. }
  118. return tassList;
  119. }
  120. @ResponseBody
  121. @RequestMapping(value = "/common/getVisitCount.do", method = {RequestMethod.POST, RequestMethod.GET})
  122. public VisitCountVO getVisitCount() {
  123. return this.commonService.getVisitCount();
  124. }
  125. }