package com.usky.park.controller.web;


import com.usky.common.core.bean.ApiResult;
import com.usky.park.service.DataLgHistoryService;
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.Map;

/**
 * <p>
 * 照明系统历史数据 前端控制器
 * </p>
 *
 * @author zyj
 * @since 2023-04-03
 */
@RestController
@RequestMapping("/dataLgHistory")
public class DataLgHistoryController {
    @Autowired
    private DataLgHistoryService dataLgHistoryService;
    /**
     * 数据中心-照明系统单个设备状态为开的时长（分钟）汇总和照明系统所有设备状态为开的时长（分钟）汇总
     *
     * @param deviceId 设备Id
     * @param startDate 开始时间  格式 yyyy-MM-dd HH:mm:ss
     * @param endDate  结束时间  格式 yyyy-MM-dd HH:mm:ss
     * @return
     */
    @GetMapping("ElectricalStatistics")
    public ApiResult<Map<String,Object>> ElectricalStatistics(@RequestParam(value = "deviceId",required = false) String deviceId,
                                                       @RequestParam(value = "startDate") String startDate,
                                                       @RequestParam(value = "endDate") String endDate){
        return ApiResult.success(dataLgHistoryService.ElectricalStatistics(deviceId,startDate,endDate));
    }
}

