|
@@ -1,10 +1,15 @@
|
|
|
package com.izouma.nineth.service;
|
|
package com.izouma.nineth.service;
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
import com.izouma.nineth.ApplicationTests;
|
|
import com.izouma.nineth.ApplicationTests;
|
|
|
|
|
+import com.izouma.nineth.dto.AirDropExcelDTO;
|
|
|
|
|
+import com.izouma.nineth.utils.excel.UploadDataListener;
|
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
|
|
import static org.junit.Assert.*;
|
|
import static org.junit.Assert.*;
|
|
|
|
|
|
|
@@ -18,4 +23,18 @@ public class AirDropServiceTest extends ApplicationTests {
|
|
|
airDropService.drop(4235490L, 4273750L, 498,
|
|
airDropService.drop(4235490L, 4273750L, 498,
|
|
|
LocalDateTime.of(2022, 3, 25, 17, 30));
|
|
LocalDateTime.of(2022, 3, 25, 17, 30));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @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->{
|
|
|
|
|
+
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|