Newer
Older
smartwell_demos / src / main / java / com / casic / controller / AlarmController.java
chaizhuang on 24 Sep 2022 1 KB 硫化氢新增
package com.casic.controller;

import com.casic.model.AlarmConfigParam;
import com.casic.service.AlarmService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/alarm")
public class AlarmController {

    private final AlarmService alarmService;

    public AlarmController(AlarmService alarmService) {
        this.alarmService = alarmService;
    }

    @RequestMapping("/records")
    public Object getAlarmRecord(@RequestParam(value = "deviceType", required = true) String deviceType,
                                 @RequestParam(value = "currentIndex", required = true) Integer currentIndex,
                                 @RequestParam(value = "devcode",required =false) String devcode,
                                 @RequestParam(value = "pageSize", required = true) Integer pageSize) {
        return alarmService.getAlarmRecord(deviceType,currentIndex,pageSize,devcode);
    }

    @RequestMapping("/batch/cancel")
    public Object excuteAlramBatchCancel(@RequestParam(value = "deviceType", required = true) String deviceType,
                                          @RequestParam(value = "devcode",required =false) String devcode) {
        return alarmService.excuteAlramBatchCancel(deviceType,devcode);
    }

    @RequestMapping("/config/add")
    public Object addAlarmConfig(@RequestBody AlarmConfigParam alarmConfigParam) {
        return alarmService.addAlarmConfig(alarmConfigParam);
    }
}