Crunchy
2024-05-10 d74c28c6f826c9d9e61612b4bc589b0774feb82a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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<Object, Object> 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());
    }
 
 
}