package com.gci.boot.modules.dataview.controller;

import com.gci.boot.common.log.annotation.AddSysLog;
import com.gci.boot.common.vo.Result;
import com.gci.boot.modules.dataview.service.SafetyDataStatisticsService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
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.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * 安全中心
 * @author lyz
 * @date 2023/9/23 16:17
 */

@Api(tags = "数据看板统计")
@Slf4j
@RestController
@RequestMapping("/dataview/safetyData")
public class SafetyDataCenterController {

    @Autowired
    private SafetyDataStatisticsService safetyDataStatisticsService;

    /**
     * 告警统计
     *
     * @param startDate
     * @param endDate
     * @param req
     * @return
     */
	@AddSysLog(value = "数据看板统计-告警统计")
    @GetMapping(value = "/alarmQuantity")
    public Result<?> alarmQuantity(String startDate, String endDate,
                                   HttpServletRequest req) {
        Map map = safetyDataStatisticsService.alarmQuantity();
        return Result.ok(map);
    }

    /**
     * 告警趋势分析
     *
     * @param startDate
     * @param endDate
     * @param req
     * @return
     */
	@AddSysLog(value = "数据看板统计-告警趋势分析")
    @GetMapping(value = "/alarmTrend")
    public Result<?> alarmTrend(String startDate, String endDate,
                                HttpServletRequest req) {
        Map map = safetyDataStatisticsService.alarmTrend();
        return Result.ok(map);
    }


	/**
	 * 司机考勤情况
	 * @return
	 */
	@AddSysLog(value = "数据看板统计-司机考勤情况")
	@GetMapping("/getDriverSignInCount")
	public Result<?> getDriverSignInCount() {
		return Result.ok(safetyDataStatisticsService.getDriverSignInCount());
	}

	/**
	 * 项目考勤情况
	 * @return
	 */
	@AddSysLog(value = "数据看板统计-项目考勤情况")
	@GetMapping("/getSignInCount")
	public Result<?> getSignInCount() {
		return Result.ok(safetyDataStatisticsService.getSignInCount());
	}





}
