package com.njcn.service.configuration;


import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletResponse;

import com.njcn.pojo.commons.HistoryData;
import com.njcn.pojo.commons.SimpleValue;
import com.njcn.pojo.commons.area.Interval;
import com.njcn.pojo.commons.area.ReasonStatisc;
import com.njcn.pojo.commons.device.AnalyzeInfo;
import com.njcn.pojo.commons.device.Communication;
import com.njcn.pojo.commons.device.DeviceDetail;
import com.njcn.pojo.commons.device.DeviceGeneral;
import com.njcn.pojo.commons.device.DeviceInfo;
import com.njcn.pojo.commons.device.DeviceMapInfo;
import com.njcn.pojo.commons.device.DeviceOnline;
import com.njcn.pojo.commons.device.EventCause;
import com.njcn.pojo.commons.device.EventChance;
import com.njcn.pojo.commons.device.EventDataList;
import com.njcn.pojo.commons.device.EventDensity;
import com.njcn.pojo.commons.device.EventTypeList;
import com.njcn.pojo.commons.device.LineDetailInfo;
import com.njcn.pojo.commons.device.LineInfo;
import com.njcn.pojo.commons.device.SubInfo;
import com.njcn.pojo.commons.device.Tree;
import com.njcn.pojo.commons.device.ValueOfTargetanaly;
import com.njcn.pojo.commons.runmanage.IntegrityAnalysisData;
import com.njcn.pojo.commons.runmanage.IntergralityData;
import com.njcn.pojo.commons.runmanage.IntergralityTable;
import com.njcn.pojo.commons.runmanage.OnlineRateData;
import com.njcn.pojo.configuration.*;
import org.apache.ibatis.annotations.Param;


public interface DeviceService {

    //概览--》终端状态
    DeviceGeneral getDeviceData(String overview, Date startTime, Date endTime);

    //概览--》终端在线率
    DeviceGeneral getDeviceOnlineRate(Date startTime, Date endTime, String overview);

    //概览--》终端在线率--.》指定区域查询终端在线率
    List<SimpleValue> getCityOnlineRate(Date startTime, Date endTime, String gist);

    //概览---》终端在线率---》电压等级点击查询
    List<SimpleValue> getVoltageOnlineRate(Date startTime, Date endTime, String gist);

    //概览---》终端在线率---》终端厂家点击查询
    List<SimpleValue> getCompanyOnlineRate(Date startTime, Date endTime, String gist);

    //概览--》数据完整性
    DeviceGeneral getDataIntegrality(Date startTime, Date endTime, String overview);

    //概览---》数据完整性---》区域点击查询
    List<SimpleValue> getCityIntegrality(Date startTime, Date endTime, String gist);

    //概览---》数据完整性---》电压等级点击查询
    List<SimpleValue> getVoltageIntegrality(Date startTime, Date endTime, String gist);

    //概览---》数据完整性---》终端厂家点击查询
    List<SimpleValue> getCompanyIntegrality(Date startTime, Date endTime, String gist);

    //区域统计---》终端状态
    DeviceGeneral getDeviceData(String overview, String area, Date startTime, Date endTime);

    //区域统计---》终端状态(筛)
    DeviceGeneral getDeviceSiftData(String overview, String area, String scale, String manc, String loadtype, Integer monitorNature, Date startTime, Date endTime);

    //区域统计---》在线率
    DeviceGeneral getDeviceOnlineRate(Date startTime, Date endTime, String overview, String area);

    //区域统计---》数据完整性
    DeviceGeneral getDataIntegrality(Date startTime, Date endTime, String overview, String area,
                                     String scale, String manc, String loadtype, Integer monitorNature);

    //运行管理---》终端在线率数据查询展示
    List<OnlineRateData> getOnlineRate(Date startTime, Date endTime, String area);

    //运行管理--》监测点数据完整性
    IntergralityData getDataIntegralityTable(Date startTime, Date endTime, String area,Integer devflag,Integer powerId,Integer runFlag);

    String getDeviceOnline(Date startTime, Date endTime, Long lineIndex);

    List<DeviceOnline> getDeviceOnlineRate(Date startTime, Date endTime, Long lineIndex);

    List<Communication> getRunInfo(Long lineIndex, Date startTime, Date endTime) throws ParseException;

    ValueOfTargetanaly getSteady(Date startTime, Date endTime, Long lineIndex);

    List<ValueOfTargetanaly> getSteadyTB(Date startTime, Date endTime, Date laststartTime, Date lastendTime, Long lineIndex);

    List<HistoryData> getHistoryData(String startTime, String endTime, Long lineIndex, String start, String end, String type, String number,int flagday,int dataType);

    int updateDevice(Integer name, Integer devflag,String terminalDescribe);

    Device getDevflag(Long name);

    //终端异常
    List<List> getSbyc();

    String updateDeviceInfo(DeviceInfo device);

    String delDeviceInfo(Long devIndex);

    List<DicData> getdicdata(String dictypeName);

    List<DicData> getDicPro();

    DeviceInfo loadDevice(Long devIndex);

    List<NodeInformation> getNodeInfo();

    GDInformation loadGd(Long gdIndex);

    String delGd(Long gdIndex);

    SubInfo loadSub(Long subIndex);

    String updateSub(Long gdIndex, Long subIndex, String name, Float longitude, Float latitude, String mapIndex);

    String delSub(Long subIndex);

    SubVoltage loadSubv(Long subvIndex);

    String updateSubv(String subvName, Long gdIndex, Long subIndex, Long devIndex, Long subvIndex, int subvnum, String scale, Long subvModel);

    String delSubv(Long subvIndex);

    String delLine(Long lineIndex);

    LineDetailInfo loadLine(Long lineIndex);

    String updateLine(Line line, LineDetail detail);

    List<NodeInformation> loadNodeInfo();

    String delNode(Long nodeIndex);

    String saveNode(String nodeName, String nodeDesc, String ip4, String ip3, String ip2, String ip1,Integer nodeGrade,Integer nodeDevNum);

    List<String> loadNode(Long nodeIndex);

    String updateNode(Long nodeIndex, String nodeName, String nodeDesc, String ip4, String ip3, String ip2, String ip1,Integer nodeGrade,Integer nodeDevNum,Integer nodeOrder);

    List<Tree> getDeviceTree();

    List<Tree> getDeviceMainTree();

    List<DeviceDetail> getDeviceDetails(String status, String devflag, String gdName, String
            manufacturer, String area, String type);

    List<DeviceDetail> getGdname();

    List<DeviceDetail> getManufacturers();

    List<DeviceDetail> queryDeviceDetailById(String lineIndex);

    List<DeviceDetail> getSelName(String name);

    Device selectDeviceByIndex(Long devIndex);

    Device devNameType(String devName);

    Device devIndexType(String devIndex);

    Device devIndexsType(String lineIndex);

    NodeInformation setIp(int nodeIdex);

    public List<DeviceDetail> selState(Integer devIndex);
    //概览--》获取终端状态滚动事件
    List<DeviceDetail> getTj();

    List<DeviceDetail> getDevtype();

    List<DeviceDetail> getManufacturer();

    List<DeviceDetail> getScale();

    List<DeviceDetail> getArea();

    List<EventDataList> getEventDataList(Date startTime, Date endTime, String lineIndex);

    List<Interval> getEventTime(Date startTime, Date endTime, String lineIndex);

    List<EventTypeList> getEventType(Date startTime, Date endTime, String lineIndex);

    List<EventDensity> getEventDensity(Date startTime, Date endTime, String lineIndex);

    List<List> getEventDisdip(Date startTime, Date endTime, String lineIndex);

    List<List> getIEC411(Date startTime, Date endTime, String lineIndex);

    List<List> getIEC28(Date startTime, Date endTime, String lineIndex);

    List<EventCause> getEventCause(Date startTime, Date endTime, String lineIndex);

    ReasonStatisc eventStatistic(Date startTime, Date endTime, String lineIndex);

    EventChance getEventChance(Date startTime, Date endTime, String lineIndex);

    List<AnalyzeInfo> queryanalyzeinfo(Date startTime, Date endTime, String lineIndex);

    LineInfo getDeviceInfo(Long Line_index);

    //获取离线设备树
    List<Tree> getOfflineDeviceTree();

    //所有系统的在线设备树
    List<Tree> getOnlineTreeAllSys();

    //根据装置索引，获取该装置的Ip
    String getIPByIndex(String deviceIndex);

    //根据事件索引获取装置IP
    String getIPByEventIndex(String s);

    //获取在线设备树
    List<Tree> getOnlineDeviceTree();

    String getZIPFileInfo(HttpServletResponse response, String eventIndex);

    void downZIPFileInfo(HttpServletResponse response, String eventIndex);

    int getRole(String url);

    DeviceMapInfo getMsgInfo(Date start, Date end);

    List<Tree> getGWDeviceTree();

    //查询当前监测点的接线方式
    int getConnect(Long lineIndex);

    /**
     * @Author chendaofei
     * @Description 9300预警告警策略专用
     * @Date 14:52 2020/6/19
     **/
    List<Tree> getStrategyTree(String name);

    /**
     * @Author chendaofei
     * @Description 仅仅获取终端设备（供电公司+变电+设备）
     * @Date 14:07 2020/7/24
     **/
    List<Tree> getTerminalDeviceTree();

    /**
     * @Author denghuajun
     * @Description 获取更改终端状态日志
     * @Date 10:52 2021/07/22
     **/
    List<List> getTerminalLogsDetail(String terminalType,Date startTime,Date endTime);


    /**
     * 根据装置id获取装置装置运行日志
     * @author cdf
     * @date 2022/6/17
     */
    List<TerminalLogs> getLogByDevId(String devId,Date startTime,Date endTime);

    /**
     * @Author denghuajun
     * @Description 获取暂降推送日志
     * @Date 10:52 2021/08/19
     **/
    List<EventPushLogsDetail> getEventPushDetail (Date startTime,Date endTime,int resultStatus);
    /**
     * @Author denghuajun
     * @Description 推送结果更新
     * @Date 10:52 2021/08/19
     **/

    int updatEventPushLog(String eventDetailIndex,Integer lineId);

    List<IntegrityAnalysisData> getStatisticalAnalysis(String startTime, String endTime, String area, Integer postType, Integer powerId);
}
