package cn.wise.sc.energy.power.plant.business.service;

import cn.wise.sc.energy.power.plant.business.bean.DataPower;
import cn.wise.sc.energy.power.plant.business.bean.TimeModelQuery;
import cn.wise.sc.energy.power.plant.business.domain.CharacterParamInfo;
import cn.wise.sc.energy.power.plant.business.domain.vo.CharacterParamInfoVo;
import cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo;
import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
import net.opentsdb.client.api.query.response.QueryResponse;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @description: 测点特征服务层接口
 * @author: qh
 * @create: 2020-07-14 16:34
 **/
public interface ICharacterParamService extends IBaseService<String, CharacterParamInfo> {

    List<CharacterParamInfo> list(String plantid);

    Object count();

    /**
     * 根据部件号  获取当前部件所有测点特征
     *
     * @param unitNo 部件
     * @return List<EntityVo>
     */
    List<EntityVo> getUnitAllCharacterParams(String unitNo);

    /**
     * 获取3d组件测点数据
     *
     * @param deviceId 机组id
     * @param fileName 文件名  ","分割多个测点
     * @return 数据
     */
    BaseResponse<Map<String, Map<String, HashMap<Long, Number>>>> get3DCharacter(String deviceId, String fileName);

    /**
     * 根据部件id获取测点消息
     *
     * @param unitCodeIds 部件id
     * @return CharacterParamInfo
     */
    List<CharacterParamInfoVo> getCharactersByUnitCodeIds(List<String> unitCodeIds);

    /**
     * 根据机组id和测点名字获取kksCode
     *
     * @param deviceId  机组id
     * @param character 测点名
     * @return Map<String, String>
     */
    List<CharacterParamInfo> getKKsCodeByDeviceAndCharacterName(String deviceId, String character);

    /**
     * 根据kkscode获取实时数据
     *
     * @param kksCodes   kksCodes
     * @param start      开始时间
     * @param downSample
     * @return QueryResponse
     */
    Map<Long, Map<String, Number>> getRealTimeDataByKksCode(List<String> kksCodes, String start, String downSample);

    QueryResponse getRealTimeDataByKksCode(List<String> kksCodes, String start, String end, String downSample);

    /**
     * 根据kksCode获取功率实时数据  4小时一统计
     *
     * @param kksCodes kksCodes
     * @param start    开始时间
     * @return QueryResponse
     */
    Map<String, Number> getRealTimeDataPower(List<String> kksCodes, String start);

    /**
     * 根据名字获取测点信息
     *
     * @param characterNames 名字 like
     * @param plantCode      电厂id
     * @param deviceId       机组id
     * @return list
     */
    List<CharacterParamInfoVo> getCharacterByName(List<String> characterNames, String plantCode, String deviceId);

    /**
     * 获取趋势图
     *
     * @param keys           KksCode
     * @param timeModelQuery 时间端
     * @param status         统计方式
     * @return list
     */
    BaseResponse<DataPower> getTendency(List<String> keys, TimeModelQuery timeModelQuery, Integer status);

    /**
     * 感觉kkscode获取测点
     *
     * @param kksCodes kks
     * @return list
     */
    List<CharacterParamInfo> getByKksCodes(List<String> kksCodes);

    /**
     * 获取频谱图数据信息
     *
     * @param toJSONString 波形图JSON
     * @return list
     */
    String getFrequency(String toJSONString);

    /**
     * 获取波形图
     *
     * @param kksCodes kkscode
     */
    Map<String, String> getOscillogram(List<String> kksCodes) throws IOException;

    /**
     * 离线导入计算频谱
     *
     * @param file 离线数据file
     * @return String
     */
    String getFrequencyByUpload(MultipartFile file);
}
