package com.casic.missiles.modular.system.service.impl;


import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.casic.missiles.core.application.context.AbstractPermissionContext;
import com.casic.missiles.core.application.service.AbstractDictService;
import com.casic.missiles.core.datascope.DataScope;
import com.casic.missiles.modular.system.dao.DeviceDataListMapper;
import com.casic.missiles.modular.system.dto.statistic.*;
import com.casic.missiles.modular.system.model.BusWellInfo;
import com.casic.missiles.modular.system.service.DeviceDataListService;
import com.casic.missiles.modular.system.service.IBusDeviceSupportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * 数据统计分析
 *
 * @author lwh
 */
@Slf4j
@Component
@DS("log")
public class DeviceDataListServiceImpl extends ServiceImpl<DeviceDataListMapper, BusWellInfo> implements DeviceDataListService {
    @Resource
    private AbstractDictService dictService;
    @Resource
    private IBusDeviceSupportService deviceSupportService;
    @Resource
    private AbstractPermissionContext permissionService;

    @Override
    public List<DataWellCover> selectWellDataScope(DataScope dataScope, String devcode, String beginTime, String endTime, String wellCode){
        return this.baseMapper.selectWellDataScope(dataScope, devcode, beginTime, endTime, wellCode);
    }

    @Override
    public List<DataDig> selectDigDataScope(DataScope dataScope, String devcode, String beginTime, String endTime, String wellCode) {
       return this.baseMapper.selectDigDataScope(dataScope, devcode, beginTime, endTime, wellCode);
    }


    @Override
    public List<DataLiquid> selectLiquidDataScope(DataScope dataScope, String devcode, String beginTime, String endTime, String wellCode) {
        return this.baseMapper.selectLiquidDataScope(dataScope, devcode, beginTime, endTime, wellCode);
    }


    @Override
    public List<DataGas> selectGasDataScope(DataScope dataScope, String devcode, String beginTime, String endTime, String wellCode) {
        return this.baseMapper.selectGasDataScope(dataScope, devcode, beginTime, endTime, wellCode);
    }


    @Override
    public List<DataNoise> selectNoiseDataScope(DataScope dataScope, String devcode, String beginTime, String endTime, String wellCode) {
        return this.baseMapper.selectNoiseDataScope(dataScope, devcode, beginTime, endTime, wellCode);
    }

    @Override
    public List<DataHarmfulGas> selectHarmfulDataScope(DataScope dataScope, String devcode, String beginTime, String endTime, String wellCode){
        return this.baseMapper.selectHarmfulDataScope(dataScope, devcode, beginTime, endTime, wellCode);
    }

    @Override
    public List<DataTempHum> selectTempDataScope(DataScope dataScope, String devcode, String beginTime, String endTime, String wellCode){
        return this.baseMapper.selectTempDataScope(dataScope, devcode, beginTime, endTime, wellCode);
    }

    @Override
    public List<DataWellCoverLoca> selectWellLocDataScope(DataScope dataScope, String devcode, String beginTime, String endTime, String wellCode) {
        List<DataWellCoverLoca> mapList = this.baseMapper.selectWellLocDataScope(dataScope, devcode, beginTime, endTime, wellCode);
        return mapList;
    }

    @Override
    public List<DataGasLiquid> selectGasLiquidDataScope(DataScope dataScope, String sensorType, String devcode, String beginTime, String endTime, String wellCode) {
        List<DataGasLiquid> dataGasLiquidList = new ArrayList<>();
        if ("liquid".equals(sensorType)) {
            dataGasLiquidList = this.baseMapper.selectGasLiquidDataLiquidScope(dataScope, devcode, beginTime, endTime, wellCode);
        }
        if ("gas".equals(sensorType)) {
            dataGasLiquidList = this.baseMapper.selectGasLiquidDataGasScope(dataScope, devcode, beginTime, endTime, wellCode);
        }
        System.out.println(dataGasLiquidList);
        return dataGasLiquidList;
    }

    @Override
    public List<DateTube> selectTubeDataScope(DataScope dataScope, String devcode, String beginTime, String endTime, String wellCode){
        List<DateTube> mapList = this.baseMapper.selectTubeDataScope(dataScope, devcode, beginTime, endTime, wellCode);
        return mapList;
    }

    @Override
    public List<DataHydrant> getHydrantlist(DataScope dataScope, String devcode, String beginTime, String endTime, String wellCode){
        List<DataHydrant> mapList = this.baseMapper.getHydrantlist(dataScope, devcode, beginTime, endTime, wellCode);
        return mapList;
    }

    @Override
    public List<DataH2s> getH2sDataScope(DataScope dataScope, String devcode, String beginTime, String endTime, String wellCode) {
        return this.baseMapper.selectH2sListDataScope(dataScope, devcode, beginTime, endTime, wellCode);
    }

    @Override
    public List<DataGasdector> getGasdectorList(DataScope dataScope, String devcode, String beginTime, String endTime, String wellCode){
        return this.baseMapper.getGasdectorList(dataScope, devcode, beginTime, endTime, wellCode);
    }

    @Override
    public List<DataPantilt> getPantiltList(DataScope dataScope, String devcode, String beginTime, String endTime, String wellCode){
        return this.baseMapper.getPantiltList(dataScope, devcode, beginTime, endTime, wellCode);
    }

}
