package com.ningdatech.carapi.scheduler.service.impl;

import java.time.LocalDateTime;
import java.util.List;

import org.springframework.stereotype.Service;

import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.carapi.scheduler.mapper.OverSpeedGpsDataMapper;
import com.ningdatech.carapi.scheduler.model.dto.GpsSpeedDataDTO;
import com.ningdatech.carapi.scheduler.model.dto.OverSpeedGpsDataDTO;
import com.ningdatech.carapi.scheduler.service.OverSpeedGpsDataService;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * @return
 * @author CMM
 * @since 2023/05/29 16:04
 */
@Service
@RequiredArgsConstructor
@Slf4j
public class OverSpeedGpsDataServiceImpl implements OverSpeedGpsDataService {

    private final OverSpeedGpsDataMapper overSpeedGpsDataMapper;

    @Override
    public List<OverSpeedGpsDataDTO> getDataInGps(String date, Long startIndex, Long endIndex) {
        return overSpeedGpsDataMapper.getOverSpeedDataInGps(date, startIndex, endIndex);
    }

    @Override
    public List<GpsSpeedDataDTO> getDataInGps(String carPlate, LocalDateTime warnTime, Integer timeBucket) {
        return overSpeedGpsDataMapper.getDataInGps(carPlate,warnTime, NdDateUtils.format(LocalDateTime.now(),"yyyy_MM_dd"),timeBucket);
    }
}
