| | |
| | | package com.yssh.controller; |
| | | |
| | | import com.yssh.entity.Report; |
| | | import com.yssh.utils.CacheUtils; |
| | | import com.yssh.utils.DateUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Api(tags = "告警分析") |
| | | @RequestMapping("/warning") |
| | |
| | | return Result.OK(warningService.everydayCount(null == date ? new Date() : date)); |
| | | } |
| | | |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "三小时监测站点数据变化趋势", notes = "返回值为三小时监测站点监测数据,返回值为map集合,其中key为站点名称,value为list集合,保存每天监测数值数据") |
| | | @GetMapping("/locationDataChange") |
| | | public Result locationDataChange(@RequestParam(value = "end", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) { |
| | | return Result.OK(warningService.select3Hours(null == date ? new Date() : date)); |
| | | } |
| | | |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "获取本月监测大数据站点最大值TOP10", notes = "获取本月监测大数据站点最大值TOP10数量列表") |
| | | @GetMapping("/monthTop10") |
| | | public Result monthTop10() { |
| | | return Result.OK(warningService.selectMonthTop10()); |
| | | } |
| | | |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "根据时间获取报警和预警信息", notes = "根据时间获取报警和预警信息") |
| | | @GetMapping("/getAlarmAndWarnByTime") |
| | | public Result getAlarmAndWarnByTime( |
| | |
| | | end = tmp; |
| | | } |
| | | |
| | | return Result.OK(warningService.getAlarmAndWarnByTime(begin, end)); |
| | | //List<Report> list = warningService.getAlarmAndWarnByTime(begin, end); |
| | | String key = "getAlarmAndWarnByTime." + DateUtils.getYyyyMmDdHh(begin) + "." + DateUtils.getYyyyMmDdHh(end); |
| | | List<Report> list = CacheUtils.getListByKey(key); |
| | | if (null == list) { |
| | | list = warningService.getAlarmAndWarnByTime(begin, end); |
| | | CacheUtils.putListByKey(key, list); |
| | | } |
| | | |
| | | return Result.OK(list); |
| | | } |
| | | |
| | | @ApiOperationSupport(order = 7) |
| | | @ApiOperation(value = "获取本月监测站点最大值Top10", notes = "获取本月监测站点最大值Top10数量列表") |
| | | @GetMapping("/monthTop10") |
| | | public Result monthTop10() { |
| | | return Result.OK(warningService.selectMonthTop10()); |
| | | } |
| | | |
| | | @ApiOperationSupport(order = 8) |
| | | @ApiOperation(value = "获取本周监测站点最大值Top10", notes = "获取本周监测站点最大值Top10") |
| | | @GetMapping("/weekTop10") |
| | | public Result weekTop10() { |
| | | return Result.OK(warningService.selectWeekTop10()); |
| | | } |
| | | |
| | | @ApiOperationSupport(order = 9) |
| | | @ApiOperation(value = "获取本日监测站点最大值Top10", notes = "获取本日监测站点最大值Top10") |
| | | @GetMapping("/dayTop10") |
| | | public Result dayTop10() { |
| | | return Result.OK(warningService.selectDayTop10()); |
| | | } |
| | | } |