| | |
| | | package com.moral.api.controller; |
| | | |
| | | import com.moral.api.service.RadarHourlySummaryService; |
| | | import com.moral.api.vo.ComparisonResponse; |
| | | import com.moral.api.vo.HourlyResponse; |
| | | import com.moral.constant.ResultMessage; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | */ |
| | | @GetMapping("/process") |
| | | public ResultMessage processHour() { |
| | | String startStr = "2026-05-31 23:00:00"; |
| | | String endStr = "2026-09-08 14:00:00"; |
| | | String startStr = "2026-09-08 14:00:00"; |
| | | String endStr = "2026-09-09 13:00:00"; |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | LocalDateTime startTime = LocalDateTime.parse(startStr, formatter); |
| | | LocalDateTime endTime = LocalDateTime.parse(endStr, formatter); |
| | |
| | | hourlySummaryService.processHour(startStr); |
| | | return new ResultMessage(); |
| | | } |
| | | |
| | | /** |
| | | * 获取边界层对比数据 |
| | | * GET /radar/comparison?location=苏州&time=2026-09-09 09:00:00 |
| | | * |
| | | * @param location 位置名称 |
| | | * @param time 请求时间,取前一整点作为 current |
| | | */ |
| | | @GetMapping("/comparison") |
| | | @ApiOperation("获取最近边界层数据") |
| | | public ResultMessage getComparison(@RequestParam @ApiParam(value = "location",name = "地名") String location, |
| | | @RequestParam @ApiParam(value = "time",name = "时间 yyyy-MM-dd HH:mm:ss") String time) { |
| | | if(!location.equals("苏州")){ |
| | | return ResultMessage.ok("目前只有苏州区域有"); |
| | | } |
| | | ComparisonResponse comparisonResponse = hourlySummaryService.getComparison(location, time); |
| | | |
| | | return ResultMessage.ok(comparisonResponse); |
| | | } |
| | | |
| | | /** |
| | | * 获取指定时间范围内每小时的雷达数据 |
| | | * GET /radar/hourly?location=苏州&startTime=2026-09-04 09:00:00&endTime=2026-09-09 09:00:00 |
| | | * |
| | | * @param location 位置名称 |
| | | * @param startTime 起始时间(包含) |
| | | * @param endTime 结束时间(不包含) |
| | | */ |
| | | @GetMapping("/hourly") |
| | | @ApiOperation("查询近5天逐小时边界层数据") |
| | | public ResultMessage getHourly5Days(@RequestParam @ApiParam(value = "location",name = "地名") String location, |
| | | @RequestParam @ApiParam(value = "startTime",name = "开始时间") String startTime, |
| | | @RequestParam @ApiParam(value = "endTime",name = "结束时间") String endTime) { |
| | | if(!location.equals("苏州")){ |
| | | return ResultMessage.ok("目前只有苏州区域有"); |
| | | } |
| | | |
| | | HourlyResponse getHourly5Days = hourlySummaryService.getHourly5Days(location, startTime, endTime); |
| | | |
| | | return ResultMessage.ok(getHourly5Days); |
| | | } |
| | | |
| | | } |