package com.securitycontrol.screen.service.impl;

import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.entity.screen.dto.AccessMgeDto;
import com.securitycontrol.entity.screen.vo.AccessMgeVo;
import com.securitycontrol.screen.mapper.AccessMgeMapper;
import com.securitycontrol.screen.service.AccessMgeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

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

/**
 * 出入管理
 * @author lsun
 */
@Slf4j
@Service(value = "AccessMgeService")
public class AccessMgeServiceImpl implements AccessMgeService {
    @Resource(name = "AccessMgeMapper")
    private AccessMgeMapper mapper;

    @Override
    public AjaxResult getVehicleStatistics(AccessMgeDto dto) {
        List<AccessMgeVo> list = new ArrayList<>();
        try {
            list = mapper.getVehicleStatistics(dto);
        } catch (Exception e) {
            log.error("今日、当月车辆出入场统计-查询失败", e);
        }
        return AjaxResult.success(list);
    }

    @Override
    public AjaxResult getVehicleStatisticsPhoto(AccessMgeDto dto) {
        List<AccessMgeVo> list = new ArrayList<>();
        try {
            list = mapper.getVehicleStatisticsPhoto(dto);
        } catch (Exception e) {
            log.error("今日、当月车辆出入场统计图片-查询失败", e);
        }
        return AjaxResult.success(list);
    }

    @Override
    public List<AccessMgeVo> getVehicleStatisticsList(AccessMgeDto dto) {
        List<AccessMgeVo> list = new ArrayList<>();
        try {
            list = mapper.getVehicleStatisticsList(dto);
        } catch (Exception e) {
            log.error("获取今日、当月车辆出入场统计列表",e);
        }
        return list;
    }

    @Override
    public AjaxResult getPerStatistics(AccessMgeDto dto) {
        List<AccessMgeVo> list = new ArrayList<>();
        try {
            list = mapper.getPerStatistics(dto);
        } catch (Exception e) {
            log.error("今日、当月人员出入场统计-查询失败", e);
        }
        return AjaxResult.success(list);
    }

    @Override
    public AjaxResult getPerStatisticsPhoto(AccessMgeDto dto) {
        List<AccessMgeVo> list = new ArrayList<>();
        try {
            list = mapper.getPerStatisticsPhoto(dto);
        } catch (Exception e) {
            log.error("今日、当月人员出入场统计图片-查询失败", e);
        }
        return AjaxResult.success(list);
    }

    @Override
    public List<AccessMgeVo> getPerStatisticsList(AccessMgeDto dto) {
        List<AccessMgeVo> list = new ArrayList<>();
        try {
            list = mapper.getPerStatisticsList(dto);
        } catch (Exception e) {
            log.error("获取今日、当月人员出入场统计列表",e);
        }
        return list;
    }
}
