package com.usky.fire.controller.web;


import com.usky.common.core.bean.ApiResult;
import com.usky.fire.service.BscEnterpriseScreenService;
import com.usky.fire.service.vo.DataVo;
import org.springframework.beans.factory.annotation.Autowired;
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 java.util.List;

/**
 * <p>
 * 企业大屏数据统计 前端控制器
 * </p>
 *
 * @author JCB
 * @since 2022-09-06
 */
@RestController
@RequestMapping("/bscEnterpriseScreen")
public class BscEnterpriseScreenController {

    @Autowired
    private BscEnterpriseScreenService bscEnterpriseScreenService;

    /**
     * 大屏数据查询
     *
     * @param dataType   数据类型
     * @param moduleType 模块类型
     * @return
     */
    @GetMapping("screenDataStatistic")
    public ApiResult<Object> screenDataStatistic(@RequestParam(value = "dataType") String dataType,
                                                 @RequestParam(value = "moduleType") String moduleType,
                                                 @RequestParam(value = "dataType1", required = false) String dataType1) {
        return ApiResult.success(bscEnterpriseScreenService.screenDataStatistic(dataType, moduleType, dataType1));
    }


    /**
     * 大屏定时任务（手动触发）
     *
     * @return
     */
    @GetMapping("dataSynchro")
    public ApiResult dataSynchro() {
        bscEnterpriseScreenService.dataSynchro();
        return ApiResult.success();
    }

    /**
     * 大屏实时消防告警推送
     *
     * @return
     */
    @GetMapping("Alarmlist")
    public ApiResult<List<DataVo>> Alarmlist() {
        return ApiResult.success(bscEnterpriseScreenService.Alarmlist());
    }

}

