package com.securitycontrol.screen.service.impl;

import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.entity.screen.dto.TowerAssInspectDto;
import com.securitycontrol.entity.screen.vo.AlarmMgeVo;
import com.securitycontrol.entity.screen.vo.TowerAssInspectVo;
import com.securitycontrol.entity.system.TreeBuild;
import com.securitycontrol.entity.system.vo.TreeNode;
import com.securitycontrol.screen.mapper.TowerAssInspectMapper;
import com.securitycontrol.screen.service.TowerAssInspectService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;

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

/**
 * @author lsun
 * 组塔检测
 */
@Slf4j
@Service(value = "TowerAssInspectService")
public class TowerAssInspectServiceImpl implements TowerAssInspectService {
    @Resource(name = "TowerAssInspectMapper")
    private TowerAssInspectMapper mapper;

    /**
     * 设备列表
     * @param dto
     * @return
     */
    @Override
    public AjaxResult getDeviceList(TowerAssInspectDto dto) {
        List<TowerAssInspectVo> list = new ArrayList<>();
        try {
            list = mapper.getDeviceList(dto);
        } catch (Exception e) {
            log.error("设备列表-查询失败", e);
        }
        return AjaxResult.success(list);
    }

    @Override
    public AjaxResult getRealTimeDetection(TowerAssInspectDto dto) {
        List<TowerAssInspectVo> list = new ArrayList<>();
        try {
            list = mapper.getRealTimeDetection(dto);
        } catch (Exception e) {
            log.error("实时检测-查询失败", e);
        }
        return AjaxResult.success(list);
    }

    @Override
    public AjaxResult getTrend(TowerAssInspectDto dto) {
        List<TowerAssInspectVo> list = new ArrayList<>();
        try {
            list = mapper.getTrend(dto);
        } catch (Exception e) {
            log.error("当日检测变化趋势-查询失败", e);
        }
        return AjaxResult.success(list);
    }

    @Override
    public List<TowerAssInspectVo> getRealTimeAlarmList(TowerAssInspectDto dto) {
        List<TowerAssInspectVo> list = new ArrayList<>();
        try {
            list = mapper.getRealTimeAlarmList(dto);
        } catch (Exception e) {
            log.error("获取实时告警列表",e);
        }
        return list;
    }

    @Override
    public List<TowerAssInspectVo> getHistoryList(TowerAssInspectDto dto) {
        List<TowerAssInspectVo> list = new ArrayList<>();
        try {
            list = mapper.getHistoryList(dto);
        } catch (Exception e) {
            log.error("获取历史记录列表",e);
        }
        return list;
    }
}
