kaiyu
2021-07-15 ab676b53eaeb3779d0beaf9f525a63eb3d5e60d0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.moral.api.controller;
 
import com.moral.api.entity.Sensor;
import com.moral.api.pojo.vo.alarm.AlarmLevelVO;
import com.moral.api.service.OrganizationUnitAlarmService;
import com.moral.constant.ResponseCodeEnum;
import com.moral.constant.ResultMessage;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
 
/**
 * @ClassName AlarmController
 * @Description TODO
 * @Author 陈凯裕
 * @Date 2021/6/28 10:30
 * @Version TODO
 **/
@Slf4j
@Api(tags = {"报警数据"})
@RestController
@CrossOrigin(origins = "*", maxAge = 3600)
@RequestMapping("/deviceInfo")
public class DeviceController {
 
    @Autowired
    OrganizationUnitAlarmService organizationUnitAlarmService;
 
    @GetMapping("queryAlarmByMac")
    public ResultMessage queryAlarmByMac(String mac){
        List<Sensor> sensors = organizationUnitAlarmService.queryAlarmLevel(mac);
        AlarmLevelVO vo = AlarmLevelVO.convert(sensors);
        return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(), vo);
    }
 
    @GetMapping("queryFiveMinuteData")
    public ResultMessage queryFiveMinuteData(Integer regionCode,String sensorCode){
 
        return null;
    }
}