package com.nantian.cloud.dbcapp.service;


import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nantian.cloud.dbcapp.vo.*;
import com.nantian.sc.cloud.common.core.util.R;
import com.nantian.sc.cloud.common.data.datascope.DataScope;
import org.apache.ibatis.annotations.Param;

import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* @Description: 综合能耗服务层
* @Param:
* @return:
* @Author: zfw
* @Date: 2020/12/22
* @Date: 20:16
*/
public interface EnergyService  {

    //获取综合能耗
    Float getTotal(String area, String industry, String time);

    //按照地区获取用能单位
    JSONArray getCompanyByArea(String area , String industry, String time);

    //能源消费结构
    JSONArray getConsumption(String area , String industry, String time) throws ParseException;

    //综合能耗预警
    List<Map<String,Object>> getEnergyWarning(String area, String industry, String time);

    //行业综合能耗
    Map<String,Object> getEnergyByIndustry(String area , String industry, String time);

    //地区综合能耗
    Map<String,Object> getEnergyByArea(String area , String industry, String time);

    //时间综合能耗
    Map<String,Object> getEnergyByDate(String area, String industry, String time);

    //查询煤消耗量
    Map<String,Object> getCoalConsumption(String area , String industry, String time) throws ParseException;

    //查询工业水消耗量
    Map<String,Object> getWaterConsumption(String area , String industry, String time);
    // 查询异常信息
    ExceptionIndexInfo getExceptionInfo(String area, String industry, String time,String cmpName,String type,Integer page,Integer size,String collectName,String state,String isForce);

    //查询企业首页异常数量总数
    String getExceptionTotal(String cmpName, String time);


    //查询异常指标信息
    ExceptionIndexInfo getExceptionIndex(String area, String industry, String time, String cmpName, String type, Integer page, Integer size, String collectItemName, String exceptionGov);

    //按地区查询总和能耗
    List<KeyValueVO> getTceByArea(String area, String time);

    //按行业查询综合能耗
    List<KeyValueVO> getTceByIndustry(String industry, String time);

    //查询区县名称
    List<KeyValueVO> getCountyName(String area);

    Integer getToolInfo(String area, String industry, String time);

    List<CompanyEnergyInfoVo> getCompanyListEnergyInfo(String area, String industry, String time, String cmpName);

    List<AreaAndIndustryVo> getEnergyByAreaList(String area, String industry, String time);

    List<AreaAndIndustryVo> getEnergyByIndustryList(String area, String industry, String time);

    List<CompanyListVo> getCompanyList(String cmpName,DataScope dataScope);

    CollectCompanyVo getCollectAndElectricityList(String area, String industry, String time, String cmpName);

    CollectCompanyVo getCollectEpcCount(String area, String industry, String time, String cmpName);

    List<ProcedureVO> getCmpCollectInfo(String enterpriseCode, String baseCode);
    // 按月分析异常数据
    List<CoalVo> getExceptionInfoList(String area, String industry, String time, String cmpName, String type);

    //异常种类排序
    R getExceptionOrder(String area, String industry, String time, String cmpName, String type);
    //按照地区查询异常总数并排序
    R getExceptionByAreaOrder(String area, String industry, String time, String cmpName, String type);
    //按照行业查询异常总数并排序
    R getExceptionByIndustryOrder(String area, String industry, String time, String cmpName, String type);

    // 异常公司排名
    R getExceptionEnterpriseOrder(String area, String industry, String time, String cmpName, String type, String orderFiled);
    // 按地区返回采集记录
    R getCollectByArea(String area, String industry, String time);
    // 按行业返回采集记录
    R getCollectByIndustry(String area, String industry, String time);
    // 按月返回
    R getCollectByMonth(String area, String industry, String time);
    // 按天查询明细
    R getCollectByDay(String area, String industry, String time);
    // 按地区返回上送国家情况
    R getUpCollectByArea(String area, String industry, String time);

    R getUpCollectByIndustry(String area, String industry, String time);

    R getUpCollectByMonth(String area, String industry, String time);

    R getUpCollectByMonthNew(String area, String industry, String time);

    R getUpCollectByDay(String area, String industry, String time);
    R getUpCollectByDayNew(String area, String industry, String time);
    List<String> companyList(String area, String industry, String time);

    HashMap<String, String> getAreaAndIndustryCode(String area, String industry);

    List<String> getCompanyList2020(String area, String industry, String time, String cmpName);

    List<CoalVo> getMonthAndValue(String startTime, String endTime, List<CoalVo> coalVos);

    List<Integer> getentIdByEnterpriseCode(List<String> companyList);


    List<OtherCompanyListVo> getCountyNameList(String area, String industry);

    //R updateException(List<ExceptionInfoVo> data);

    R waveExceptionList(String enterpriseCode, String dataCode,String time);

    R updateExceptionAll(ExceptionInfoVo data);



    Object updateDateCodeState(String enterpriseCode, String dataCode,Integer state);

    Object getEnergyTableEpc(String statDate);

    Object getEnergyTableEpcKinds(String statDate, String area, String industry);

    Object getEnergyTableEpcTotal(String statDate, String area, String industry);

    Object getEnergyTableOutput(String statDate, String area, String industry);

    Object getEnergyTableOutputOrder(String statDate, String area, String industry);

    Object getEnergyCalculateInfo(Page page, String enterpriseCode, String statDate, String state  );

    Object getEnergyCalculateAddInfo(Page page, String enterpriseCode, String statDate, String dataCode);

    R upDateEnterpriseRegionCode(String enterpriseCode, String regionCode);

    R getCollectEnterpriseInfo(String area, String industry,String cmpName);

    R getRegionTrees(String regionCode);

    R saveExceptionalLog(TExceptionHandlingLogVo tExceptionHandlingLogVo);

    Object getExceptionalLog(Page page, String epc);

    //获取在线监测月报告数据
    R getEnergyTableInfos(String statDate, String epcStr) throws ParseException;

    //获取在线监测月报告-异常企业信息
    R getEnergyExceptionInfos(String statDate, String epcStr) throws ParseException;

    //获取每月6号报给发改委的异常企业名单
    R getExceptionEnterpriseInfos(ExceptionEnterpriseInfos enterpriseInfos);

    //修改每月6号报给发改委的异常企业名单
    R upExceptionEnterpriseInfos(ExceptionEnterpriseInfos enterpriseInfos);

    //获取在线监测月报告-监测企业数
    R getEnergyEnterpriseCount(String statDate);

    //异常种类字典
    R getExceptionDict();

    IPage<QualityCalculateLogVo> getPageLogList(Page page, QualityCalculateLogVo calculateLogVo);

    IPage<QualityCalculateLogVo> getPageInfoList(Page page, QualityCalculateLogVo calculateLogVo);

    List<ExceptionInfoNumVo> getExceptionNum(String epc, String startDate, String endDate, String dataCode, String collectItemName);

    //获取有综合能耗的企业
    IPage<Map<String,String>> getEpcDetailByTce(Page page, String area, String industry, String time);

    //获取企业总体的异常情况
    Map<String,Integer> getExceptionClass(String cmpName,String time);

    //获取综合能耗异常明细
    IPage<ExceptionIndexVo> getComprehensiveExDetail(Page page, String epc, String time);
    //获取单位产品综合能耗异常明细
    IPage<ExceptionIndexVo> getUnitComprehensiveExDetail(Page page, String epc, String time);
    //获取电力数据异常明细
    IPage<ExceptionIndexVo> getElectricExDetail(Page page, String epc, String time);
    //获取采集数据波动异常
    IPage<ExceptionDataVo> getDataValueExDetail(Page page, String epc, String time,String dataCode);
    //获取采集数据传输异常
    IPage<ExceptionDataVo> getDataCollectExDetail(Page page, String epc, String time);

    //公式解析
    List<String> parseFormulToSimpleAndParamsMap(String area, String industry, String time, String startTime, String endTime, ArrayList<String> energyCodeList) throws ParseException;

    //根据公式反推各月能耗数据
    List<CoalVo> selectEnergyByFormul(List<String> dataCodeList, String startTime, String endTime, String ratio);

    //各企业各月各能源消耗量
    void renewEnergyConsumptionByForuml(List<String> dataCodeList, String startTime, String endTime);
    //自动结算
    IPage<QualityCalculateLogVo> getPageLogListA(Page page, QualityCalculateLogVo calculateLogVo);
    //补算
    IPage<QualityCalculateLogVo> getPageLogListB(Page page, QualityCalculateLogVo calculateLogVo);
    //接口结算
    IPage<QualityCalculateLogVo> getPageLogListC(Page page, QualityCalculateLogVo calculateLogVo);

}
