From be3659167ebc85d3ad4bf0311ed2051c0da0281d Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期二, 23 七月 2024 10:31:36 +0800
Subject: [PATCH] 班次权限
---
system-run/src/test/java/com/yuanchu/mom/SystemRunApplicationTest.java | 49 ++++++++++++++++++++++++++++++-------------------
1 files changed, 30 insertions(+), 19 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..4e345ea 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,44 @@
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;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.temporal.TemporalAdjusters;
+import java.time.temporal.WeekFields;
+import java.util.Locale;
+
@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);
+ // 鑾峰彇褰撳墠鏃ユ湡
+ LocalDate today = LocalDate.now();
-// EasyExcel.write(fileName)
-// .head(header)
-// // 鍚堝苟绛栫暐锛氬悎骞剁浉鍚屾暟鎹殑琛屻�傜涓�涓弬鏁拌〃绀轰粠鍝竴琛屽紑濮嬭繘琛屽悎骞讹紝鐢变簬琛ㄥご鍗犱簡涓よ锛屽洜姝や粠绗�2琛屽紑濮嬶紙绱㈠紩浠�0寮�濮嬶級
-// // 绗簩涓弬鏁版槸鎸囧畾鍝簺鍒楄杩涜鍚堝苟
-//// .registerWriteHandler(new MergeSameRowsStrategy(2, new int[]{0, 1, 2, 3, 8, 9}))
-// // 娉ㄦ剰锛氶渶瑕佸厛璋冪敤registerWriteHandler()鍐嶈皟鐢╯heet()鏂规硶鎵嶈兘浣垮悎骞剁瓥鐣ョ敓鏁堬紒锛侊紒
-// .sheet("妯℃澘")
-// .doWrite(data());
+ // 鑾峰彇鏈湀鐨勭涓�澶╁拰鏈�鍚庝竴澶�
+ LocalDate firstDayOfMonth = today.with(TemporalAdjusters.firstDayOfMonth());
+ LocalDate lastDayOfMonth = today.with(TemporalAdjusters.lastDayOfMonth());
+
+ // 鑾峰彇鍛ㄥ瓧娈典俊鎭紙鏍规嵁鍖哄煙璁剧疆锛�
+ WeekFields weekFields = WeekFields.of(Locale.getDefault());
+
+ // 鑾峰彇鏈湀绗竴澶╃殑鍛ㄤ竴
+ LocalDate startOfWeek = firstDayOfMonth.with(TemporalAdjusters.previousOrSame(weekFields.getFirstDayOfWeek()));
+
+ // 閬嶅巻鏈湀鎵�鏈夊ぉ鏁帮紝鎵惧嚭姣忓懆鐨勭涓�澶╁拰鏈�鍚庝竴澶�
+ LocalDate endOfWeek;
+ while (startOfWeek.isBefore(firstDayOfMonth.plusMonths(1))) {
+ endOfWeek = startOfWeek.plusDays(6);
+ LocalDateTime startDateTime = LocalDateTime.of(startOfWeek, LocalTime.MIDNIGHT);
+ LocalDateTime endDateTime = LocalDateTime.of(endOfWeek, LocalTime.MIDNIGHT);
+
+ System.out.println("Week starts on " + startDateTime + " and ends on " + endDateTime);
+
+ startOfWeek = startOfWeek.plusWeeks(1);
+ }
}
-
-
}
--
Gitblit v1.9.3