package com.yuanchu.mom; import com.yuanchu.mom.service.PerformanceShiftService; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import java.util.Map; @SpringBootTest class SystemRunApplicationTest { private static String fileName = "D:\\" + System.currentTimeMillis() + ".xlsx"; @Autowired private PerformanceShiftService performanceShiftService; @Test void contextLoads() { Map header = performanceShiftService.exportToExcel("2024-05-04 00:00:00", null, null); // EasyExcel.write(fileName) // .head(header) // // 合并策略:合并相同数据的行。第一个参数表示从哪一行开始进行合并,由于表头占了两行,因此从第2行开始(索引从0开始) // // 第二个参数是指定哪些列要进行合并 //// .registerWriteHandler(new MergeSameRowsStrategy(2, new int[]{0, 1, 2, 3, 8, 9})) // // 注意:需要先调用registerWriteHandler()再调用sheet()方法才能使合并策略生效!!! // .sheet("模板") // .doWrite(data()); } }