From af499687591afe7c54b680914a5f9ea36970db53 Mon Sep 17 00:00:00 2001
From: Crunchy <3114200645@qq.com>
Date: 星期一, 13 五月 2024 17:37:00 +0800
Subject: [PATCH] 2024-5-10 绩效管理-班次-月度文件导出

---
 system-run/src/test/java/com/yuanchu/mom/SystemRunApplicationTest.java |   39 ++++++++++++++++++++++++---------------
 1 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/system-run/src/test/java/com/yuanchu/mom/SystemRunApplicationTest.java b/system-run/src/test/java/com/yuanchu/mom/SystemRunApplicationTest.java
index 1f22691..7ff4ee0 100644
--- a/system-run/src/test/java/com/yuanchu/mom/SystemRunApplicationTest.java
+++ b/system-run/src/test/java/com/yuanchu/mom/SystemRunApplicationTest.java
@@ -1,33 +1,42 @@
 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 {
 
-    private static String fileName = "D:\\" + System.currentTimeMillis() + ".xlsx";
-
     @Autowired
     private PerformanceShiftService performanceShiftService;
 
+    private static String fileName = "D:\\" + System.currentTimeMillis() + ".xlsx";
+
     @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()鍐嶈皟鐢╯heet()鏂规硶鎵嶈兘浣垮悎骞剁瓥鐣ョ敓鏁堬紒锛侊紒
-//                .sheet("妯℃澘")
-//                .doWrite(data());
+    void  contextLoads() throws Exception {
+        Map<Object, Object> data = performanceShiftService.exportToYearExcel("2024-05-01 00:00:00", null, null);
+        // 璁剧疆鍗曞厓鏍兼牱寮�
+        HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(StyleYearUtils.getHeadStyle(), StyleYearUtils.getContentStyle());
+        EasyExcel.write(fileName)
+                .head((List<List<String>>) 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<String, Object> 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);
     }
-
-
 }

--
Gitblit v1.9.3