package com.energy.manage.service.controller.homepage;

import com.energy.manage.common.reponse.ResultResp;
import com.energy.manage.service.config.annotations.UserLoginToken;
import com.energy.manage.service.controller.base.BaseServiceController;
import com.energy.manage.service.domain.vo.homepage.WaitTaskVo;
import com.energy.manage.service.service.homepage.HomePageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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;

/**
 * @author chy
 * @date 2024/6/13 13:52
 * @desc
 */
@Api(value = "HomePageController",tags = "首页查询")
@RestController
@RequestMapping("/homePage")
public class HomePageController extends BaseServiceController {

    @Autowired
    private HomePageService homePageService;

    @ApiOperation("驾驶舱首页查询")
    @UserLoginToken
    @GetMapping("/queryStatistics")
    public ResultResp queryStatistics(@RequestParam("codeNumber") String codeNumber,
                            @RequestParam("codeType") String codeType,
                            @RequestParam("startTime") String startTime,
                            @RequestParam("endTime") String endTime){
        return success(homePageService.queryStatistics(getRoleId(), codeNumber, codeType,startTime,endTime));
    }


    @ApiOperation("驾驶舱首页查询操作记录")
    @UserLoginToken
    @GetMapping("/queryOptionRecords")
    public ResultResp queryOptionRecords(@RequestParam("codeNumber") String codeNumber,
                            @RequestParam("codeType") String codeType,
                            @RequestParam(value = "startTime",required = false) String startTime,
                            @RequestParam(value = "endTime",required = false) String endTime){
        return success(homePageService.queryOptionRecords(getRoleId(), codeNumber, codeType,startTime,endTime));
    }

    @ApiOperation("风机悬浮窗信息")
    @UserLoginToken
    @GetMapping("/queryFloatingWindowInfo")
    public ResultResp queryFloatingWindowInfo(@RequestParam(value = "batchCode", required = false) String batchCode,
                                              @RequestParam("fieldCode") String fieldCode){
        return success(homePageService.queryFloatingWindowInfo(batchCode,fieldCode));
    }


    @ApiOperation("待办任务")
    @UserLoginToken
    @GetMapping("/queryWaitTask")
    public ResultResp<WaitTaskVo> queryWaitTask(){
        return success(homePageService.getWaitTask(getRoleId()));
    }


    @ApiOperation("未关联数据集合")
    @UserLoginToken
    @GetMapping("/getAnalysisResultStateList")
    @Deprecated
    public ResultResp getAnalysisResultStateList(){
        return success(homePageService.getAnalysisResultStateList(getRoleId()));
    }

    @ApiOperation("分析异常数集合")
    @UserLoginToken
    @GetMapping("/getAnalysisResultErrStateList")
    @Deprecated
    public ResultResp getAnalysisResultErrStateList(){
        return success(homePageService.getAnalysisResultErrStateList(getRoleId()));
    }










}
