package com.nantian.cloud.dbcapp.mapper.record;

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 org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.parameters.P;

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

/**
 *
 *
 * @author
 * @date 2018-09-27 15:20:44
 */
@Mapper
public interface EnterpriseMapper {
    Float getEnergyData(@Param("enterpriseCode") String enterpriseCode,
                                               @Param("quotaCode") String quotaCode,
                                               @Param("startTime") String startTime,
                                               @Param("endTime") String endTime);
    Float getTceTotal2019(@Param("enterpriseCode") String enterpriseCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
    //2019年综合能耗
    List<CoalVo> getZhnhByMonth2019(@Param("baseCode") String baseCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
    //2020
    Float getTceTotal2020(@Param("enterpriseCode") String enterpriseCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
    //电消耗量
    List<CoalVo> getElectricity(@Param("enterpriseCode") String enterpriseCode, @Param("startTime") String startTime, @Param("endTime") String endTime);

    Integer getCollection(@Param("entId") Integer entId, @Param("time") String time);

    Integer getInstrument(@Param("entId") Integer entId, @Param("time") String time);


    Integer getEntId(@Param("enterpriseCode") String enterpriseCode);

    //查询煤
    Double getTotalMcoal (@Param("enterpriseCode")String enterpriseCode, @Param("startTime")String startTime, @Param("endTime")String endTime);
    //查询焦
    Double getTotalCoke (@Param("enterpriseCode")String enterpriseCode,@Param("startTime")String startTime,@Param("endTime")String endTime);
    //查询电力
    Double getTotalPower (@Param("enterpriseCode")String enterpriseCode,@Param("startTime")String startTime,@Param("endTime")String endTime);
    //查询天然气
    Double getTotalNaturalGas (@Param("enterpriseCode")String enterpriseCode,@Param("startTime")String startTime,@Param("endTime")String endTime);
    //查询石油制品
    Double getTotalPetroleum (@Param("enterpriseCode")String enterpriseCode,@Param("startTime")String startTime,@Param("endTime")String endTime);
    //查询热力
    Double getTotalHeat (@Param("enterpriseCode")String enterpriseCode,@Param("startTime")String startTime,@Param("endTime")String endTime);
    //查询其他燃料
    Double getTotalOther (@Param("enterpriseCode")String enterpriseCode,@Param("startTime")String startTime,@Param("endTime")String endTime);

    //查询各种能耗的消耗值
    Double getTotalMaterial (@Param("entId")Integer entId, @Param("code")String code, @Param("startTime")String startTime, @Param("endTime")String endTime);

    //得到产品list
    List<ProductNameAndIdVO> getProductName(@Param("enterpriseCode")String enterpriseCode);

    //得到产品list
    List<ProductNameAndIdVO> getProductQuota(@Param("id") Integer id);

    List<String> getProductNameByEpc(@Param("enterpriseCode") String enterpriseCode);
    List<String> getOldProductNameByEpc(@Param("enterpriseCode") String enterpriseCode);

    List<ProductNameAndIdVO> getProductQuotaByEpc(@Param("enterpriseCode")String epc, @Param("productName") String productName, @Param("startDate") String startDate, @Param("endDate") String endDate);
    List<ProductNameAndIdVO> getOldProductQuotaByEpc(@Param("enterpriseCode")String epc, @Param("productName") String productName);


    List<KeyValueVO> getUnitConsumption(@Param("enterpriseCode")String enterpriseCode,@Param("quotaName")String quotaName,@Param("startTime")String startTime,@Param("endTime")String endTime);

    //企业单位产品能耗，用加权平均算法 取指标值不为0的月份的数据 指标*产量/总产量
    Float getUnitConsumptionWeightedMean(@Param("enterpriseCode") String enterpriseCode,@Param("quotaName") String quotaName,@Param("startTime") String startTime,@Param("endTime") String endTime, @Param("list") String[] shieldList);

    List<KeyValueVO> getUnitConsumption2019(@Param("unitId")Integer unitId,@Param("quotaName")String quotaName,@Param("startTime")String startTime,@Param("endTime")String endTime, @Param("enterpriseCode") String enterpriseCode);

    List<String> getCodeByProductId(@Param("enterpriseCode")String enterpriseCode,@Param("productId") Integer productId);

    List<CoalVo> getValueByProductCode(@Param("enterpriseCode") String enterpriseCode,@Param("list1") List<String> list1, @Param("startTime") String startTime, @Param("endTime") String endTime);

    List<ZbVo> getZbByenterpriseCode(@Param("enterpriseCode") String enterpriseCode);

    //2019年
    List<ZbVo> getZbByenterpriseCode2019(@Param("enterpriseCode") String enterpriseCode);

    List<DHVo> getDhByName(@Param("enterpriseCode") String enterpriseCode, @Param("productId") String productId, @Param("startTime") String startTime, @Param("endTime") String endTime);

    List<DHVo> getDhByName2019(@Param("enterpriseCode") String enterpriseCode, @Param("productId") String productId, @Param("zb") String zb, @Param("startTime") String startTime, @Param("endTime") String endTime);

    List<DHVo> getCpByproductId(@Param("enterpriseCode") String enterpriseCode, @Param("productId") String productId, @Param("startTime") String startTime, @Param("endTime") String endTime);

    List<DHVo> getCpByproductId2019(@Param("enterpriseCode") String enterpriseCode, @Param("productId") String productId, @Param("startTime") String startTime, @Param("endTime") String endTime);

    //按月统计综合能耗
    List<CoalVo> getZhnhByMonth(@Param("enterpriseCode") String enterpriseCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
    //2020
    List<CoalVo> getZhnhByMonth1(@Param("enterpriseCode") String enterpriseCode, @Param("startTime") String startTime, @Param("endTime") String endTime);

    //按月统计实物量的值
    List<CoalVo> getMaterialValue(@Param("baseCode") String baseCode,@Param("code") String code, @Param("startTime") String startTime, @Param("endTime") String endTime);

    List<CoalVo> getMaterialValue1(@Param("baseCode") String baseCode,@Param("code") String code, @Param("startTime") String startTime, @Param("endTime") String endTime);

    //得到企业实物量下拉框
    List<MaterialVo> getMaterial(@Param("entID") Integer entID,@Param("baseCode") String baseCode);


    //根据信用代码的到行业code
    String getHyCodeById(@Param("enterpriseCode") String enterpriseCode);

   List<ZhnhListVo> getZhnhListByMonth(@Param("enterpriseCode") String enterpriseCode, @Param("startTime") String startTime, @Param("endTime") String endTime,@Param("baseCode") String baseCode);


   List<ListValueVO> getListValue(@Param("enterpriseCode") String enterpriseCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
   //2019年以前
   List<ListValueVO> getListValue1(@Param("entID") Integer entID, @Param("baseCode") String baseCode, @Param("time") String time);

   List<NameValueVO> getAllGxByCode(@Param("enterpriseCode") String enterpriseCode);

    List<ProcedureVO> getValueByProcedure(@Param("enterpriseCode") String enterpriseCode,@Param("code") String code, @Param("startTime") String startTime, @Param("endTime") String endTime);
    List<ProcedureVO> getValueByNewProcedure(@Param("enterpriseCode") String enterpriseCode, @Param("startTime") String startTime, @Param("endTime") String endTime,
                                             @Param("energyType") String energyType, @Param("energyUseType")  String energyUseType, @Param("configureName") String configureName,@Param("configureCode") String configureCode);

    //2019
    List<ProcedureVO> getValueByProcedure1(@Param("entID") Integer entID, @Param("time") String time);

    //2019 采集点
    List<CollectValueVO> getCollectionValue1(@Param("entID") Integer entID,@Param("code") String code);
    //2020年采集点
    List<CollectValueVO> getCollectionValue(@Param("enterpriseCode") String enterpriseCode,@Param("code") String code);


    //查询企业端近三年单位产值综合能耗
    OutputValueVo getUnitEnergyConsumption(@Param("enterpriseCode") String enterpriseCode,@Param("year") Integer year);

    //查询企业端预警信息
    List<ExceptionInfoVo> getExceptionInfo(@Param("enterpriseCode") String enterpriseCode,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("exceptionType") String exceptionType);

    //查询企业信息
    EnterpriseInfoVO selectInfoBycode(@Param("enterpriseCode") String enterpriseCode);
    //老数据表
    EnterpriseInfoVO selectInfoBycode1(@Param("enterpriseCode") String enterpriseCode);
    //延期企业信息
    EnterpriseInfoVO selectInfoByAccess(@Param("enterpriseCode") String enterpriseCode);

    //指标排序 2020
    List<QuotaVO> getOrderByQuota(@Param("addressCode") String addressCode,@Param("quotaName")String quotaName,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("shieldList") List<QuotaShieldVo> newShieldList);
   //2019
    List<QuotaVO> getOrderByQuota1(@Param("addressCode") String addressCode,@Param("quotaName")String quotaName,@Param("startTime") String startTime,@Param("endTime") String endTime);

    ArrayList<EnterpriseProcessVo> getIndexName2020(String enterpriseCode);

    ArrayList<EnterpriseProcessVo> getIndexName2019(Integer entID);

    ArrayList<EnterpriseProcessVo> getIndexName2019(String enterpriseCode);

    Integer getCollection2020(String enterpriseCode);

    Integer getInstrument2020(String enterpriseCode);

    List<ZhnhListVo> getZhnhListByMonth2020(String enterpriseCode, String startTime, String endTime,String baseCode);

    List<ListValueVO> getListValue2020(String enterpriseCode, String startTime,  String baseCode);

    List<ListValueVO> getForMaterial(@Param("enterpriseCode") String enterpriseCode,@Param("time") String time,@Param("baseCode") String baseCode);

    List<CoalVo> getElectricity2020(@Param("enterpriseCode") String enterpriseCode, @Param("startTime")String startTime, @Param("endTime")String endTime);

    //获取能源实物量品种
    List<MaterialVo> getMaterial2020(@Param("enterpriseCode") String enterpriseCode,@Param("baseCode") String baseCode,@Param("startTime") String startTime,@Param("endTime") String endTime);

    //获取能源实物量数值
    List<CoalVo> getMaterialValue2020(@Param("enterpriseCode")String enterpriseCode, @Param("energyTypeCode") String code, @Param("startTime") String startTime, @Param("endTime")String endTime, @Param("baseCode")String baseCode);

    List<String> getCodeByProductId2020(@Param("enterpriseCode")String enterpriseCode,@Param("productId") Integer productId);

    List<CoalVo> getValueByProductCode2020(@Param("enterpriseCode")String enterpriseCode,@Param("list1") List<String> list1, @Param("startTime")String startTime, @Param("endTime")String endTime);

    Integer getunitIdByCode(@Param("enterpriseCode")String enterpriseCode,@Param("quotaName")String quotaName);

    List<CoalVo> selectEnergyKinds(@Param("enterpriseCode") String enterpriseCode, @Param("process") String process);

    //能源消费结构-历史数据
    List<KeyValueVO> selectEnergyValues2019(@Param("entId")Integer entId, @Param("startTime")String startTime,@Param("endTime") String endTime);

    Double selectEnergyValues(@Param("enterpriseCode")String enterpriseCode, @Param("kinds")String data, @Param("startTime")String startTime,@Param("endTime") String endTime);

    InstrumentVO getInstrumentById2019(@Param("id")String id);

    InstrumentVO getInstrumentById2020(@Param("id")String id);

    Float getTotalZhnh2019(@Param("baseCode")String baseCode,@Param("time")String time);

    String selectProductById(String enterpriseCode, String baseCode);
    List<String> selectProductByIds(@Param("enterpriseCode") String enterpriseCode);

    List<CoalVo> selectProductNum(String enterpriseCode,String productCode,String start,String end);
    List<StructureVo> selectProductNums(String enterpriseCode,String productCode,String start,String end);

    CoalVo selectProductInfo(String enterpriseCode, String baseCode);
    CoalVo selectProductInfos(@Param("enterpriseCode")String enterpriseCode);
    CoalVo getValueByProductCodeByYear(@Param("enterpriseCode") String enterpriseCode, @Param("list") List<String> list1, @Param("startTime") String s);

    CoalVo getValueByProductCodeByYear2020(@Param("enterpriseCode")String enterpriseCode,@Param("list") List<String> list1,@Param("startTime") String s);


    String getEndTime(String enterpriseCode);

    Integer getUnitIdByBaseCode(@Param("enterpriseCode") String enterpriseCode,@Param("baseCode") String baseCode);

    //查询限定值  先进值
    List<StandardVO> getStandardVO(@Param("code") String code,@Param("quotaName") String  quotaName);

    //查询行业标准
    StandardVO getStandardByType(@Param("code") String code,@Param("quotaName") String quotaName);

    List<CoalVo> selectDetailByDataCodeName(@Param("enterpriseCode")String enterpriseCode, @Param("dataCode")String dataCode, @Param("time")String time);

    String selectUnit(@Param("dataCode")String dataCode);

    List<CoalVo> selectDetailMonthByDataCodeName(@Param("enterpriseCode")String enterpriseCode, @Param("dataCode")String dataCode, @Param("time")String time);

    String selectUnitByProductName(@Param("productName")String productName);

    String selectUnitByProductId(Integer productId);

    String selectSubName(String energyType);

    String isSuper(@Param("enterpriseCode")String enterpriseCode);

    List<String> getSonEpcList(@Param("enterpriseCode")String enterpriseCode);

    Float superTotal(@Param("list")List<String> epcList, @Param("beginTime")String beginTime, @Param("endTime")String endTime);

    List<StringAndFolat> superEnergyKinds(@Param("list")List<String> superEpcList, @Param("beginTime")String beginTime, @Param("endTime")String endTime);

    List<StringAndFolat> superElectricConsume(@Param("list")List<String> superEpcList, @Param("beginTime")String beginTime, @Param("endTime")String endTime);

    List<StringAndFolat> superElectricConsumeCompany(@Param("list")List<String> superEpcList, @Param("beginTime")String beginTime, @Param("endTime")String endTime);

    Integer getCollectNum(@Param("list")List<String> superEpcList);

    Integer getToolNum(@Param("list")List<String> superEpcList);

    Integer exceptionNum(@Param("list")List<String> superEpcList, @Param("beginTime")String beginTime, @Param("endTime")String endTime);

    List<SuperProductInfoBo> selectSuperProductInfo(@Param("epc")String epc);

    Float selectProductValue(@Param("epc")String epc,@Param("dataCode") String dataCode,@Param("beginTime") String beginTime, @Param("endTime")String endTime);

    CoalVo superProductValueOut(@Param("list")List<String> superEpcList,@Param("year") String valueOf);

    List<CoalVo> selectTreeEpc(@Param("enterpriseCode")String enterpriseCode);
    IPage<ExceptionInfoVo> getSuperExceptionList (Page page, @Param("list")List<String> superEpcList, @Param("beginTime") String beginTime, @Param("endTime")String endTime,@Param("type")Integer type,@Param("collectName") String collectName,@Param("state")String state);

    Float selectUpdateTag(@Param("enterpriseCode")String enterpriseCode,@Param("time") String time, @Param("dataCode")String dataCode);

    int selectMonthUpdateTag(@Param("enterpriseCode")String enterpriseCode,@Param("time") String time, @Param("dataCode")String dataCode);

    List<CoalVo> selectElectricityDetail(@Param("enterpriseCode")String enterpriseCode, @Param("time")String time);

    List<CoalVo> selectMonthElectricityDetail(@Param("enterpriseCode")String enterpriseCode, @Param("time")String time);

    String getQuotaShield(@Param("enterpriseCode") String enterpriseCode);

    List<QuotaShieldVo> getQuotaShieldList(@Param("addressCode") String addressCode);

    List<CoalVo> getMaterialElectricOld(@Param("enterpriseCode")String enterpriseCode, @Param("energyTypeCode") String code, @Param("startTime") String startTime, @Param("endTime")String endTime, @Param("baseCode")String baseCode);

    List<CoalVo> getMaterialElectric(@Param("enterpriseCode")String enterpriseCode, @Param("energyTypeCode") String code, @Param("startTime") String startTime, @Param("endTime")String endTime, @Param("baseCode")String baseCode);

    Float selectUpdateTag1(@Param("enterpriseCode")String enterpriseCode,@Param("time") String time, @Param("dataCode")String dataCode);

    List<CoalVo> selectDetailByDataCodeName1(@Param("enterpriseCode")String enterpriseCode, @Param("dataCode")String dataCode, @Param("list") List<String> monthList);


    List<CoalVo> selectDetailByDataCodeName3(@Param("enterpriseCode")String enterpriseCode, @Param("dataCode")String dataCode,@Param("list") List<Map<String,String>> monthList);


    List<CoalVo> selectElectricityDetail1(@Param("enterpriseCode")String enterpriseCode, @Param("list") List<String> monthList);

    Float selectUpdateTag2(@Param("enterpriseCode")String enterpriseCode, @Param("dataCode")String dataCode);

    List<String> selectDetailByDataCodeName2(@Param("enterpriseCode")String enterpriseCode, @Param("dataCode")String dataCode);

    List<String> selectElectricityDetail2(@Param("enterpriseCode")String enterpriseCode);

    String selectProductName(@Param("enterpriseCode") String enterpriseCode,@Param("dataCode") String product);

    Float selectUpdateTagall(@Param("enterpriseCode")String enterpriseCode, @Param("dataCode")String dataCode);

    List<CoalVo> selectDetailByDataCodeNameall(@Param("enterpriseCode")String enterpriseCode, @Param("dataCode")String dataCode);

    List<CoalVo> selectElectricityDetailall(@Param("enterpriseCode")String enterpriseCode);

    String getstatType(@Param("enterpriseCode")String enterpriseCode, @Param("dataCode")String dataCode);

    //企业产品信息
    List<MaterialVo> selectMaterielProduct(@Param("enterpriseCode") String enterpriseCode);

    //产品产量编码（用途编码30、33）
    String getProductOutPutCode(@Param("enterpriseCode") String enterpriseCode, @Param("code") String code);

    //产品消耗量编码（用途编码 11>20>21>23，11与31同级）
    String getProductConsumptionCode(@Param("enterpriseCode") String enterpriseCode, @Param("code") String code);

    //非能源类产品产量
    List<StructureVo> selectMaterielProductValue(@Param("enterpriseCode") String enterpriseCode, @Param("outPut") String outPut, @Param("consumption") String consumption, @Param("unit") String unit, @Param("list") List<String> dateList);

    //能源类产品产量
    List<StructureVo> selectEnergyProductValue(@Param("enterpriseCode") String enterpriseCode, @Param("code") String code, @Param("unit") String unit, @Param("list") List<String> dateList);

    AccessTimeRangeVo getAccessEnergysTructure(String enterpriseCode);

    AccessTimeRangeVo getOld(String enterpriseCode);

    AccessTimeRangeVo getEnergyDateByCollect(String enterpriseCode);

    AccessTimeRangeVo getEnergyDateByMobile(String enterpriseCode);

    List<SuperEpcVo> getAllEpc(@Param("enterpriseCode")String[] enterpriseCode);

    List<String> getSuperEnterpriseList();

    AccessTimeRangeVo getFillingMethodByOld(String enterpriseCode);

    AccessTimeRangeVo getFillingMethod(String enterpriseCode);

    List<OldEnergyDataVo> getOldDataByEpc(@Param("enterpriseCode")String enterpriseCode,@Param("time")String time);

    List<String> getEpcById(String enterpriseCode);

    //停产中企业，判断是否恢复生产
    Map<String,String> getTceStatusChange(@Param("haltStartTime") String haltStartTime,@Param("enterpriseCode") String enterpriseCode);
    List<Map<String, String>> getEleStatusChange(@Param("haltStartTime") String haltStartTime,@Param("enterpriseCode") String enterpriseCode);
    List<Map<String, String>> getProductStatusChange(@Param("haltStartTime") String haltStartTime,@Param("enterpriseCode") String enterpriseCode);

    //正常生产企业，判断是否停产
    Map<String, String> getTceStatusChange2(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("enterpriseCode") String enterpriseCode);
    List<Map<String, String>> getEleStatusChange2(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("enterpriseCode") String enterpriseCode);
    List<Map<String, String>> getProductStatusChange2(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("enterpriseCode") String enterpriseCode);

    List<Map<String,String>> getEnergyTypeByProcedure(@Param("enterpriseCode") String enterpriseCode, @Param("startTime") String startTime, @Param("energyUseType")  String energyUseType, @Param("configureName") String configureName,@Param("configureCode") String configureCode);

    List<Map<String,String>> getEnergyTypeByProcedure1(@Param("entID") Integer entID, @Param("time") String time);


    int updateDianliFlag(@Param("dianliFlag") String dianliFlag,@Param("enterpriseCode") String enterpriseCode);


    List<CoalVo> selectDetailByDataCodeNameAndSettlementDataConfig(@Param("enterpriseCode")String enterpriseCode, @Param("dataCode")String dataCode, @Param("startTime") String startTime,@Param("entTime") String entTime);


}
