123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- package com.huimv.env.controller;
- import com.alibaba.fastjson.JSON;
- import com.alibaba.fastjson.JSONArray;
- import com.alibaba.fastjson.JSONObject;
- import com.huimv.common.utils.Result;
- import com.huimv.env.service.IAlarm;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.text.ParseException;
- /**
- * @Project : huimv.shiwan
- * @Package : com.huimv.biosafety.uface.controller
- * @Description : TODO
- * @Version : 1.0
- * @Author : ZhuoNing
- * @Create : 2020-12-25
- **/
- @RestController
- @RequestMapping("/alarm")
- @Slf4j
- public class AlarmController {
- @Autowired
- private IAlarm iAlarm;
- @RequestMapping(value = "/getAlarm",method = RequestMethod.GET)
- public Result getAlarmByFarmIdAndDate(@RequestParam(value = "farmId",required = true) Integer farmId,
- @RequestParam(value="alarmType",required=false) Integer alarmType,
- @RequestParam(value = "alarmDate",required=false) String alarmDate,
- @RequestParam(value = "pageSize",required=true) Integer pageSize,
- @RequestParam(value = "pageNo",required=true) Integer pageNo) throws ParseException {
- log.info("farmId>>"+farmId);
- log.info("alarmType>>"+alarmType);
- log.info("alarmDate>>"+alarmDate);
- log.info("pageNo>>"+pageNo);
- log.info("pageSize>>"+pageSize);
- //
- return iAlarm.getAlarm(farmId,alarmType,alarmDate,pageNo,pageSize);
- }
- @RequestMapping(value = "/getManyAlarm",method = RequestMethod.GET)
- public Result getManyAlarmByFarmIdAndDate(@RequestParam(value = "farmId",required = true) Integer farmId,
- @RequestParam(value="alarmType",required=false) Integer alarmType,
- @RequestParam(value = "alarmDate",required=false) String alarmDate,
- @RequestParam(value = "quantity",required=true) Integer quantity ) throws ParseException {
- log.info("farmId>>"+farmId);
- log.info("alarmType>>"+alarmType);
- log.info("alarmDate>>"+alarmDate);
- log.info("quantity>>"+quantity);
- //
- // return iAlarm.getAlarm(farmId,alarmType,alarmDate,pageNo,pageSize);
- return iAlarm.getAlarm(farmId,alarmType,alarmDate,quantity);
- }
- //查询今天的警报列表
- @RequestMapping(value = "/getTodayAlarm",method = RequestMethod.GET)
- public Result getTodayAlarmByFarmId(@RequestParam(value = "farmId",required = true) Integer farmId,
- @RequestParam(value = "quantity",required=true) Integer quantity ) throws ParseException {
- log.info("farmId>>"+farmId);
- log.info("quantity>>"+quantity);
- //
- return iAlarm.getAlarm(farmId,quantity);
- }
- //查询今日各类警报占比
- @RequestMapping(value = "/getTodayAlarmRate",method = RequestMethod.GET)
- public Result getTodayAlarmRate(@RequestParam(value = "farmId",required = true) Integer farmId) throws ParseException {
- log.info("farmId>>"+farmId);
- //
- return iAlarm.getAlarmRate(farmId);
- }
- //查询报警分布(一周数据)
- @RequestMapping(value = "/getOneWeekAlarm",method = RequestMethod.GET)
- public Result getOneWeekAlarm(@RequestParam(value = "farmId",required = true) Integer farmId) throws ParseException {
- log.info("farmId>>"+farmId);
- //
- return iAlarm.getOneWeekAlarm(farmId);
- }
- }
|