package org.jeecg.modules.largeScreen.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.itdmDataNow.entity.ItdmAlarmNow;
import org.jeecg.modules.itdmDataNow.service.IItdmAlarmNowService;
import org.jeecg.modules.itdmDeviceStart.entity.ItdmDeviceStart;
import org.jeecg.modules.itdmDeviceStart.service.IItdmDeviceStartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags="单个关闭语音报警")
@Slf4j
@RestController
@RequestMapping("/itdm/voice")
public class ItdmVoiceController {

    @Autowired
    @SuppressWarnings("all")
    private IItdmAlarmNowService alarmNowService;
    @Autowired
    @SuppressWarnings("all")
    private IItdmDeviceStartService deviceStartService;

    @DeleteMapping("/delete")//"/delete/{deleteId}"
    @ApiOperation("单个关闭语音报警）")//@PathVariable("deleteId")
    public void deleteVoice(@RequestParam("deleteId") Integer deleteId, @RequestParam("alarmType")Integer alarmType){
        if(alarmType==1){//设备实验数据异常报警
            ItdmAlarmNow itdmAlarmNow = new ItdmAlarmNow();
            itdmAlarmNow.setId(deleteId);
            itdmAlarmNow.setVoiceStatus(0);
            alarmNowService.updateById(itdmAlarmNow);
        }else if(alarmType==3){
            ItdmDeviceStart start = new ItdmDeviceStart();
            start.setId(deleteId);
            start.setDataStatus(1);
            deviceStartService.updateById(start);
        }
    }

}
