package com.yeejoin.amos.boot.module.jxiop.biz.controller;

import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;

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

/**
 * @author system_generator
 * @date 2023-08-11
 */
@RestController
@Api(tags = "智能分析")
@RequestMapping(value = "/analyse")
public class AnalyseController extends BaseController {

    @Autowired
    CommonServiceImpl commonServiceImpl;

    @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
    @ApiOperation(httpMethod = "GET", value = "工况测点区间划分-风机", notes = "工况测点区间划分-风机")
    @GetMapping(value = "/getFanConditionVariablesByTime")
    public void getFanConditionVariablesByTime(@RequestParam String startTime, @RequestParam String endTime) {
        commonServiceImpl.getFanConditionVariablesByTime(startTime, endTime);
    }
    @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
    @ApiOperation(httpMethod = "GET", value = "工况测点区间划分-光伏", notes = "工况测点区间划分-光伏")
    @GetMapping(value = "/getPvConditionVariablesByTime")
    public void getPvConditionVariablesByTime(@RequestParam String startTime, @RequestParam String endTime) {
        commonServiceImpl.getPvConditionVariablesByTime(startTime, endTime);
    }
    @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
    @ApiOperation(httpMethod = "GET", value = "相关性分析-风机", notes = "相关性分析-风机")
    @GetMapping(value = "/getFanConditionVariablesByTimeAnalyse")
    public void getFanConditionVariablesByTimeAnalyse(@RequestParam String startTime, @RequestParam String endTime) {
        commonServiceImpl.getFanConditionVariablesByTimeAnalyse(startTime, endTime);
    }
    @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
    @ApiOperation(httpMethod = "GET", value = "相关性分析-风机", notes = "相关性分析-风机")
    @GetMapping(value = "/getPvConditionVariablesByTimeAnalyse")
    public void getPvConditionVariablesByTimeAnalyse(@RequestParam String startTime, @RequestParam String endTime) {
        commonServiceImpl.getPvConditionVariablesByTimeAnalyse(startTime, endTime);
    }
    @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
    @ApiOperation(httpMethod = "GET", value = "中心值计算-风机", notes = "中心值计算-风机")
    @GetMapping(value = "/getFanConditionVariablesByTimeAnalyse1")
    public void getFanConditionVariablesByTimeAnalyse1(@RequestParam String startTime, @RequestParam String endTime) {
        commonServiceImpl.getFanConditionVariablesByTimeAnalyse1(startTime, endTime);
    }
    @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
    @ApiOperation(httpMethod = "GET", value = "中心值计算-光伏", notes = "中心值计算-光伏")
    @GetMapping(value = "/getPvConditionVariablesByTimeAnalyse1")
    public void getPvConditionVariablesByTimeAnalyse1(@RequestParam String startTime, @RequestParam String endTime) {
        commonServiceImpl.getPvConditionVariablesByTimeAnalyse1(startTime, endTime);
    }

    @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
    @ApiOperation(httpMethod = "GET", value = "获取influxdb数据", notes = "获取influxdb数据")
    @GetMapping(value = "/getInfluxdbDataByConditon")
    public ResponseModel<Map<String, Object>> getInfluxdbDataByConditon(@RequestParam String stationType, @RequestParam String pointId, @RequestParam String startTime, @RequestParam String endTime) {
       return ResponseHelper.buildResponse(commonServiceImpl.getInfluxdbDataByConditon(stationType,pointId,startTime, endTime)) ;
    }
}
