package com.gyee.runeconomy.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gyee.runeconomy.dto.R;
import com.gyee.runeconomy.dto.ResultMsg;
import com.gyee.runeconomy.model.auto.ProEconEquipmentInfoDayTop;
import com.gyee.runeconomy.service.auto.IProEconEquipmentInfoDayTopService;
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;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 风机日信息表排行 前端控制器
 * </p>
 *
 * @author wang
 * @since 2022-11-25
 */
@RestController
@RequestMapping("//pro-econ-equipment-info-day-top")
@Api(value = "风机信息表排行", tags = "风机信息表排行")
public class ProEconEquipmentInfoDayTopController {


    @Autowired
    private IProEconEquipmentInfoDayTopService proEconEquipmentInfoDayTopService;


    /**
     * 风机信息量化评级管理
     *
     * @param companyId
     * @param types
     * @param staType
     * @return
     */
    @GetMapping(value = "/equipmentinfo-day-list")
    @ApiOperation(value = "风机信息量化评级管理列表", notes = "风机信息量化评级管理列表")
    public R getEquipmentInfoDayTopList(
            @RequestParam(value = "companyId", required = false) String companyId,
            @RequestParam(value = "windpowerstationId", required = false) String windpowerstationId,
            @RequestParam(value = "types", required = true) Integer types,
            @RequestParam(value = "staType", required = true) String staType,
            @RequestParam(value = "date", required = true) String date,
            @RequestParam(value = "pageNum", required = true) Integer pageNum,
            @RequestParam(value = "pageSize", required = true) Integer pageSize) {

        IPage<ProEconEquipmentInfoDayTop> list = proEconEquipmentInfoDayTopService.getEquipmentInfoDayTopList(companyId, windpowerstationId, types, staType, date, pageNum, pageSize);
        if (null != list) {
            return R.data(ResultMsg.ok(list));
        } else {
            return R.data(ResultMsg.error());
        }
    }

    /**
     * 风机信息量化评级管理单机历史记录
     *
     * @param windturbineId
     * @param types
     * @param beginDate
     * @param endDate
     * @return
     */
    @GetMapping(value = "/equipmentinfo-day-history-list")
    @ApiOperation(value = "风机信息量化评级管理历史记录", notes = "风机信息量化评级管理历史记录")
    public R getEquipmentInfoDayTopHistoryList(
            @RequestParam(value = "windturbineId", required = false) String windturbineId,
            @RequestParam(value = "types", required = true) Integer types,
            @RequestParam(value = "beginDate", required = true) String beginDate,
            @RequestParam(value = "endDate", required = true) String endDate) {

        List<ProEconEquipmentInfoDayTop> list = proEconEquipmentInfoDayTopService.getEquipmentInfoDayTopHistoryList(windturbineId, types, beginDate, endDate);
        if (null != list) {
            return R.data(ResultMsg.ok(list));
        } else {
            return R.data(ResultMsg.error());
        }
    }


    /**
     * 风机信息量化评级比较
     *
     * @param ids
     * @return
     */
    @GetMapping(value = "/equipmentinfo-day-compare-list")
    @ApiOperation(value = "风机信息量化评级比较", notes = "风机信息量化评级比较")
    public R getEquipmentInfoDayTopCompareList(
            @RequestParam(value = "ids", required = true) List<Long> ids,
            @RequestParam(value = "types", required = true) Integer types) {

        Map<String, Object> map = proEconEquipmentInfoDayTopService.getEquipmentInfoDayTopCompareList(ids, types);
        if (null != map) {
            return R.data(ResultMsg.ok(map));
        } else {
            return R.data(ResultMsg.error());
        }
    }


}
