package com.gyee.runeconomy.controller.specific;/*
@author   谢生杰
@date   2022/11/23-21:39
*/

import com.gyee.common.model.StringUtils;
import com.gyee.common.vo.specific.SpecificCenterVo;
import com.gyee.common.vo.specific.SpecificTarget;
import com.gyee.common.vo.specific.SpecificTopVo;
import com.gyee.runeconomy.dto.R;
import com.gyee.runeconomy.dto.ResultMsg;
import com.gyee.runeconomy.service.specific.SpecificService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.text.ParseException;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("//specific")
@Api(value = "专题分析", tags = "专题分析")
public class SpecificController {

    @Resource
    private SpecificService specificService;


    /**
     * 查询专题分析列表上
     *
     * @return
     */
    @GetMapping("/maintoplist")
    @ResponseBody
    @ApiOperation(value = "综合分析1", notes = "综合分析1")
    public R maintoplist(@RequestParam(value = "companys", required = true) String companys,
                         @RequestParam(value = "type", required = true) String type,
                         @RequestParam(value = "month", required = true) String month) throws ParseException {

        List<SpecificTopVo> resultList = specificService.maintoplist(companys, type, month);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }

    }

    /**
     * 查询专题分析列表下
     *
     * @return
     */
    @GetMapping("/maincenterlist2")
    @ResponseBody
    @ApiOperation(value = "综合分析2", notes = "综合分析2")
    public R maincenterlist2(@RequestParam(value = "companys", required = true) String companys,
                            @RequestParam(value = "type", required = true) String type,
                            @RequestParam(value = "month", required = true) String month) throws ParseException {

        Map<String, List<SpecificCenterVo>> resultMap = specificService.maincenterlist2(companys, type, month);
        if (StringUtils.isNotNull(resultMap)) {
            return R.data(ResultMsg.ok(resultMap));
        } else {
            return R.error(ResultMsg.error());
        }
    }


    @GetMapping("/maincenterlist")
    @ResponseBody
    @ApiOperation(value = "综合分析2", notes = "综合分析2")
    public R maincenterlist(@RequestParam(value = "companys") String companys,
                            @RequestParam(value = "type") String type,
                            @RequestParam(value = "month") String month) throws ParseException {

        Map<String, List<SpecificCenterVo>> resultMap = specificService.maincenterlist(companys, type, month);
        if (StringUtils.isNotNull(resultMap)) {
            return R.data(ResultMsg.ok(resultMap));
        } else {
            return R.error(ResultMsg.error());
        }
    }


    /**
     * 查询风能利用率功能
     *
     * @return
     */
    @GetMapping("/fnlylList2")
    @ResponseBody
    @ApiOperation(value = "专题分析-风能利用率", notes = "专题分析-风能利用率")
    public R fnlylList2(@RequestParam(value = "companys") String companys,
                       @RequestParam(value = "type") String type,
                       @RequestParam(value = "year") String year) throws ParseException {
        List<SpecificTarget> resultList = specificService.fnlylList2(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }


    /**
     * 查询风能利用率功能
     *
     * @return
     */
    @GetMapping("/fnlylList")
    @ResponseBody
    @ApiOperation(value = "专题分析-风能利用率", notes = "专题分析-风能利用率")
    public R fnlylList(@RequestParam(value = "companys") String companys,
                       @RequestParam(value = "type") String type,
                       @RequestParam(value = "year") String year) throws ParseException {
        List<SpecificTarget> resultList = specificService.fnlylList(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }

    /**
     * 查询发电量
     *
     * @return
     */
    @GetMapping("/fdlList2")
    @ResponseBody
    @ApiOperation(value = "专题分析-发电量", notes = "专题分析-发电量")
    public R fdlList2(@RequestParam(value = "companys") String companys,
                     @RequestParam(value = "type") String type,
                     @RequestParam(value = "year") String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.fdlList2(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }

    @GetMapping("/fdlList")
    @ResponseBody
    @ApiOperation(value = "专题分析-发电量", notes = "专题分析-发电量")
    public R fdlList(@RequestParam(value = "companys") String companys,
                     @RequestParam(value = "type") String type,
                     @RequestParam(value = "year") String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.fdlList(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }


    /**
     * 查询综合厂用电量
     *
     * @return
     */
    @GetMapping("/zhcydlList2")
    @ResponseBody
    @ApiOperation(value = "专题分析-综合厂用电量", notes = "专题分析-综合厂用电量")
    public R zhcydlList2(@RequestParam(value = "companys") String companys,
                        @RequestParam(value = "type") String type,
                        @RequestParam(value = "year") String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.zhcydlList2(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }

    @GetMapping("/zhcydlList")
    @ResponseBody
    @ApiOperation(value = "专题分析-综合厂用电量", notes = "专题分析-综合厂用电量")
    public R zhcydlList(@RequestParam(value = "companys") String companys,
                        @RequestParam(value = "type") String type,
                        @RequestParam(value = "year") String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.zhcydlList(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }

    /**
     * 查询购网电量
     *
     * @return
     */
    @GetMapping("/gwdlList2")
    @ResponseBody
    @ApiOperation(value = "专题分析-购网电量", notes = "专题分析-购网电量")
    public R gwdldlList2(@RequestParam(value = "companys") String companys,
                        @RequestParam(value = "type") String type,
                        @RequestParam(value = "year") String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.gwdlList2(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }

    @GetMapping("/gwdlList")
    @ResponseBody
    @ApiOperation(value = "专题分析-购网电量", notes = "专题分析-购网电量")
    public R gwdldlList(@RequestParam(value = "companys") String companys,
                        @RequestParam(value = "type") String type,
                        @RequestParam(value = "year") String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.gwdlList(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }


    /**
     * 查询上网电量
     *
     * @return
     */
    @GetMapping("/swdlList2")
    @ResponseBody
    @ApiOperation(value = "专题分析-购网电量", notes = "专题分析-购网电量")
    public R swdldlList2(@RequestParam(value = "companys") String companys,
                        @RequestParam(value = "type") String type,
                        @RequestParam(value = "year") String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.swdlList2(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }

    @GetMapping("/swdlList")
    @ResponseBody
    @ApiOperation(value = "专题分析-购网电量", notes = "专题分析-购网电量")
    public R swdldlList(@RequestParam(value = "companys") String companys,
                        @RequestParam(value = "type") String type,
                        @RequestParam(value = "year") String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.swdlList(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }


    /**
     * 计算利用小时
     *
     * @return
     */
    @GetMapping("/lyxsList2")
    @ResponseBody
    @ApiOperation(value = "专题分析-利用小时", notes = "专题分析-利用小时")
    public R lyxsList2(@RequestParam(value = "companys") String companys,
                      @RequestParam(value = "type") String type,
                      @RequestParam(value = "year") String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.lyxsList2(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }


    @GetMapping("/lyxsList")
    @ResponseBody
    @ApiOperation(value = "专题分析-利用小时", notes = "专题分析-利用小时")
    public R lyxsList(@RequestParam(value = "companys") String companys,
                      @RequestParam(value = "type") String type,
                      @RequestParam(value = "year") String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.lyxsList(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }

    /**
     * 查询故障损失率
     *
     * @return
     */
    @GetMapping("/gzsslList2")
    @ResponseBody
    @ApiOperation(value = "专题分析-故障损失率", notes = "专题分析-故障损失率")
    public R gzsslList2(@RequestParam(value = "companys") String companys,
                       @RequestParam(value = "type") String type,
                       @RequestParam(value = "year") String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.gzsslList2(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }


    @GetMapping("/gzsslList")
    @ResponseBody
    @ApiOperation(value = "专题分析-故障损失率", notes = "专题分析-故障损失率")
    public R gzsslList(@RequestParam(value = "companys") String companys,
                       @RequestParam(value = "type") String type,
                       @RequestParam(value = "year") String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.gzsslList(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }


    /**
     * 查询维护损失率
     *
     * @return
     */
    @GetMapping("/whsslList2")
    @ResponseBody
    @ApiOperation(value = "专题分析-维护损失率", notes = "专题分析-维护损失率")
    public R whsslList2(@RequestParam(value = "companys") String companys,
                       @RequestParam(value = "type") String type,
                       @RequestParam(value = "year") String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.whsslList2(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }


    @GetMapping("/whsslList")
    @ResponseBody
    @ApiOperation(value = "专题分析-维护损失率", notes = "专题分析-维护损失率")
    public R whsslList(@RequestParam(value = "companys") String companys,
                       @RequestParam(value = "type") String type,
                       @RequestParam(value = "year") String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.whsslList(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }


    /**
     * 查询限电损失率
     *
     * @return
     */
    @GetMapping("/xdsslList2")
    @ResponseBody
    @ApiOperation(value = "专题分析-限电损失率", notes = "专题分析-限电损失率")
    public R xdsslList2(@RequestParam(value = "companys", required = true) String companys,
                       @RequestParam(value = "type", required = true) String type,
                       @RequestParam(value = "year", required = true) String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.xdsslList2(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }


    @GetMapping("/xdsslList")
    @ResponseBody
    @ApiOperation(value = "专题分析-限电损失率", notes = "专题分析-限电损失率")
    public R xdsslList(@RequestParam(value = "companys", required = true) String companys,
                       @RequestParam(value = "type", required = true) String type,
                       @RequestParam(value = "year", required = true) String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.xdsslList(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }


    /**
     * 查询性能损失率
     *
     * @return
     */
    @GetMapping("/xnsslList2")
    @ResponseBody
    @ApiOperation(value = "专题分析-性能损失率", notes = "专题分析-性能损失率")
    public R xnsslList2(@RequestParam(value = "companys", required = true) String companys,
                       @RequestParam(value = "type", required = true) String type,
                       @RequestParam(value = "year", required = true) String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.xnsslList2(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }

    @GetMapping("/xnsslList")
    @ResponseBody
    @ApiOperation(value = "专题分析-性能损失率", notes = "专题分析-性能损失率")
    public R xnsslList(@RequestParam(value = "companys", required = true) String companys,
                       @RequestParam(value = "type", required = true) String type,
                       @RequestParam(value = "year", required = true) String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.xnsslList(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }

    /**
     * 查询受累损失率
     *
     * @return
     */
    @GetMapping("/slsslList2")
    @ResponseBody
    @ApiOperation(value = "专题分析-受累损失率", notes = "专题分析-受累损失率")
    public R slsslList2(@RequestParam(value = "companys", required = true) String companys,
                       @RequestParam(value = "type", required = true) String type,
                       @RequestParam(value = "year", required = true) String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.slsslList2(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }

    @GetMapping("/slsslList")
    @ResponseBody
    @ApiOperation(value = "专题分析-受累损失率", notes = "专题分析-受累损失率")
    public R slsslList(@RequestParam(value = "companys") String companys,
                       @RequestParam(value = "type") String type,
                       @RequestParam(value = "year") String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.slsslList(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }


    /**
     * 查询复位及时率
     *
     * @return
     */
    @GetMapping("/fwjslList")
    @ResponseBody
    @ApiOperation(value = "专题分析-复位及时率", notes = "专题分析-复位及时率")
    public R fwjslList(@RequestParam(value = "companys", required = true) String companys,
                       @RequestParam(value = "type", required = true) String type,
                       @RequestParam(value = "year", required = true) String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.fwjslList(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }

    /**
     * 查询状态转换率
     *
     * @return
     */
    @GetMapping("/ztzhlList")
    @ResponseBody
    @ApiOperation(value = "专题分析-状态转换率", notes = "专题分析-状态转换率")
    public R ztzhlList(@RequestParam(value = "companys", required = true) String companys,
                       @RequestParam(value = "type", required = true) String type,
                       @RequestParam(value = "year", required = true) String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.ztzhlList(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }

    /**
     * 查询消缺及时率
     *
     * @return
     */
    @GetMapping("/xqjslList")
    @ResponseBody
    @ApiOperation(value = "专题分析-消缺及时率", notes = "专题分析-消缺及时率")
    public R xqjslList(@RequestParam(value = "companys", required = true) String companys,
                       @RequestParam(value = "type", required = true) String type,
                       @RequestParam(value = "year", required = true) String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.xqjslList(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }

    /**
     * 查询系统效率
     *
     * @return
     */
    @GetMapping("/xtxlList")
    @ResponseBody
    @ApiOperation(value = "专题分析-系统效率", notes = "专题分析-系统效率")
    public R xtxlList(@RequestParam(value = "companys", required = true) String companys,
                      @RequestParam(value = "type", required = true) String type,
                      @RequestParam(value = "year", required = true) String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.xtxlList(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }

    /**
     * 查询离散率
     *
     * @return
     */
    @GetMapping("/lslList")
    @ResponseBody
    @ApiOperation(value = "专题分析-离散率", notes = "专题分析-离散率")
    public R lslList(@RequestParam(value = "companys", required = true) String companys,
                     @RequestParam(value = "type", required = true) String type,
                     @RequestParam(value = "year", required = true) String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.lslList(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }

    /**
     * 查询转换效率
     *
     * @return
     */
    @GetMapping("/zhxlList")
    @ResponseBody
    @ApiOperation(value = "专题分析-转换效率", notes = "专题分析-转换效率")
    public R zhxlList(@RequestParam(value = "companys", required = true) String companys,
                      @RequestParam(value = "type", required = true) String type,
                      @RequestParam(value = "year", required = true) String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.zhxlList(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }

    /**
     * 查询MTBF
     *
     * @return
     */
    @GetMapping("/mtbfList")
    @ResponseBody
    @ApiOperation(value = "专题分析-MTBF分析", notes = "专题分析-MTBF分析")
    public R mtbfList(@RequestParam(value = "companys") String companys,
                      @RequestParam(value = "type") String type,
                      @RequestParam(value = "year") String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.mtbfList(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }

    /**
     * 查询MTTR
     *
     * @return
     */
    @GetMapping("/mttrList")
    @ResponseBody
    @ApiOperation(value = "专题分析-MTTR分析", notes = "专题分析-MTTR分析")
    public R mttrList(@RequestParam(value = "companys", required = true) String companys,
                      @RequestParam(value = "type", required = true) String type,
                      @RequestParam(value = "year", required = true) String year) throws ParseException {

        List<SpecificTarget> resultList = specificService.mttrList(companys, type, year);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }
}
