package com.izouma.nineth.service;

import com.alibaba.excel.EasyExcel;
import com.izouma.nineth.ApplicationTests;
import com.izouma.nineth.dto.AirDropExcelDTO;
import com.izouma.nineth.utils.excel.UploadDataListener;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

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

public class AirDropServiceTest extends ApplicationTests {
    @Autowired
    AirDropService airDropService;

    @Test
    public void drop() {
        airDropService.drop(4235490L, 4273750L, 498,
                LocalDateTime.of(2022, 4, 13, 23, 01));
    }

    @Test
    public void excel() {
        File file = new File("/Users/qiufangchao/Desktop/RaexDrop.xlsx");
        UploadDataListener<AirDropExcelDTO> listener = new UploadDataListener<>();
        List<AirDropExcelDTO> dtos = EasyExcel.read(file, AirDropExcelDTO.class, listener)
                .sheet()
                .doReadSync();
//        System.out.println(dtos);

        dtos.forEach(dto -> {

        });
    }
}