package com.yuanchu.mom; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; import com.yuanchu.mom.service.PerformanceShiftService; import com.yuanchu.mom.utils.StyleYearUtils; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import java.util.Collection; import java.util.List; import java.util.Map; @SpringBootTest class SystemRunApplicationTest { @Autowired private PerformanceShiftService performanceShiftService; private static String fileName = "D:\\" + System.currentTimeMillis() + ".xlsx"; @Test void contextLoads() throws Exception { Map data = performanceShiftService.exportToYearExcel("2024-05-01 00:00:00", null, null); // 设置单元格样式 HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(StyleYearUtils.getHeadStyle(), StyleYearUtils.getContentStyle()); EasyExcel.write(fileName) .head((List>) data.get("header")) .registerWriteHandler(horizontalCellStyleStrategy) .sheet("月度") .doWrite((Collection) data.get("data")); // String url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?corpid=wwa423654b975441ac&corpsecret=J3fbMJoTn3LmrWDobvS5JpU8N0TvEbGkVl8OhvIsol0"; // String s = HttpUtil.get(url); // System.out.println(s); // Map unmarshal = JSONObject.parseObject(s, Map.class); // String checkInRecords = "https://qyapi.weixin.qq.com/cgi-bin/checkin/getcheckindata?access_token=" + unmarshal.get("access_token"); // String body = HttpRequest.post(checkInRecords).execute().body(); // System.out.println(body); } }