¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yssh.controller; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import com.yssh.service.WarningAnalyseService; |
| | | import com.yssh.utils.Result; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | |
| | | @Api(tags = "åè¦åæ") |
| | | @RequestMapping("/warning") |
| | | @RestController |
| | | @SuppressWarnings("rawtypes") |
| | | public class WarningAnalyseController { |
| | | @Resource |
| | | private WarningAnalyseService warningService; |
| | | |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "è·å宿¶æ¥è¦", notes = "è·å宿¶æ¥è¦åææ°æ®") |
| | | @GetMapping("/runAlarm") |
| | | public Result alarmAnalyse() { |
| | | return Result.OK(warningService.getRunTimeAlarmAnalyse()); |
| | | } |
| | | |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "è·å宿¶é¢è¦", notes = "è·å宿¶é¢è¦åææ°æ®") |
| | | @GetMapping("/runWarning") |
| | | public Result warningAnalyse() { |
| | | return Result.OK(warningService.getRunTimeWarningAnalyse()); |
| | | } |
| | | |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "æ¬æé¢è¦æ¥è¦ç»è®¡", notes = "æ¬æé¢è¦æ¥è¦ç»è®¡ï¼è¿ååæ°alarmNumber对åºå¼ä¸ºæ¬ææ¥è¦æ°æ®éï¼åæ°warningNumber对åºå¼ä¸ºæ¬æé¢è¦æ°æ®é") |
| | | @GetMapping("/monthCount") |
| | | public Result thisMonthCount(@RequestParam(value = "end", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) { |
| | | return Result.OK(warningService.monthCount(null == date ? new Date() : date)); |
| | | } |
| | | |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "ä¸å¨é¢è¦æ¥è¦æ°éååè¶å¿", notes = "ä¸å¨é¢è¦æ¥è¦æ°éååè¶å¿ï¼è¿ååæ°alarmDayCount为ä¸å¨æ¯æ¥æ¥è¦ç»è®¡æ°éå表ï¼åæ°warningDayCount为ä¸å¨æ¯æ¥é¢è¦ç»è®¡æ°éå表") |
| | | @GetMapping("/everydayCount") |
| | | public Result everydayCount(@RequestParam(value = "end", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) { |
| | | Date endDate = null == date ? new Date() : date; |
| | | return Result.OK(warningService.everydayCount(endDate)); |
| | | } |
| | | |
| | | @ApiOperationSupport(order = 4) |
| | | @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) { |
| | | Date endDate = null == date ? new Date() : date; |
| | | return Result.OK(warningService.select3Hours(endDate)); |
| | | } |
| | | |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "è·åæ¬æçæµå¤§æ°æ®ç«ç¹æå¤§å¼TOP10", notes = "è·åæ¬æçæµå¤§æ°æ®ç«ç¹æå¤§å¼TOP10æ°éå表") |
| | | @GetMapping("/monthTop10") |
| | | public Result monthTop10() { |
| | | return Result.ok(warningService.selectMonthTop10()); |
| | | } |
| | | |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "æ ¹æ®æ¶é´è·åæ¥è¦åé¢è¦ä¿¡æ¯", notes = "æ ¹æ®æ¶é´è·åæ¥è¦åé¢è¦ä¿¡æ¯") |
| | | @GetMapping("/getAlarmAndWarnByTime") |
| | | public Result getAlarmAndWarnByTime( |
| | | @RequestParam(value = "begin") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date begin, |
| | | @RequestParam(value = "end") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date end) { |
| | | if (null == begin || null == end) { |
| | | return Result.error(null); |
| | | } |
| | | if (begin.getTime() > end.getTime()) { |
| | | Date tmp = begin; |
| | | begin = end; |
| | | end = tmp; |
| | | } |
| | | |
| | | return Result.OK(warningService.getAlarmAndWarnByTime(begin, end)); |
| | | } |
| | | } |