From 9691382d22efb241056177f92cd22040e3224303 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期四, 14 八月 2025 11:21:45 +0800
Subject: [PATCH] no message

---
 rsf-server/src/main/Test/ChineseMD5Util.java |   78 +++++++++++++++++++++++++++------------
 1 files changed, 54 insertions(+), 24 deletions(-)

diff --git a/rsf-server/src/main/Test/ChineseMD5Util.java b/rsf-server/src/main/Test/ChineseMD5Util.java
index c73e2d3..0c71353 100644
--- a/rsf-server/src/main/Test/ChineseMD5Util.java
+++ b/rsf-server/src/main/Test/ChineseMD5Util.java
@@ -1,38 +1,68 @@
 import java.nio.charset.StandardCharsets;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
+import java.time.LocalDate;
+import java.time.YearMonth;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
 
 public class ChineseMD5Util {
 
-    public static List<Integer> getSelectedIndices(int[] arr) {
-        List<Integer> indices = new ArrayList<>();
-        int index = 0;
-        int step = 3;
-        while (index < arr.length) {
-            indices.add(index);
-            index += step;
-            step = (step == 3) ? 1 : 3;
-        }
-        return indices;
-    }
+//    public static List<Integer> getSelectedIndices(int[] arr) {
+//        List<Integer> indices = new ArrayList<>();
+//        int index = 0;
+//        int step = 3;
+//        while (index < arr.length) {
+//            indices.add(index);
+//            index += step;
+//            step = (step == 3) ? 1 : 3;
+//        }
+//        return indices;
+//    }
+//
+//    public static Integer getNextSelectedValue(int[] arr, int inputIndex) {
+//        List<Integer> selectedIndices = getSelectedIndices(arr);
+//        int currentPos = selectedIndices.indexOf(inputIndex);
+//        if (currentPos != -1 && currentPos + 1 < selectedIndices.size()) {
+//            return arr[selectedIndices.get(currentPos + 1)];
+//        }
+//        return null; // 鎴栨寜闇�澶勭悊
+//    }
+//
+//    public static void main(String[] args) {
+//        int[] arr = {2, 5, 8, 10, 15, 20, 25, 30, 35, 40, 45, 50, 15, 40, 32, 48};
+//        System.out.println("杈撳叆 0锛岃緭鍑�: " + getNextSelectedValue(arr, 0)); // 10
+//        System.out.println("杈撳叆 3锛岃緭鍑�: " + getNextSelectedValue(arr, 3)); // 15
+//        System.out.println("杈撳叆 4锛岃緭鍑�: " + getNextSelectedValue(arr, 4)); // 30
+//        System.out.println("杈撳叆 4锛岃緭鍑�: " + getNextSelectedValue(arr, 5)); // 30
+//
+//    }
 
-    public static Integer getNextSelectedValue(int[] arr, int inputIndex) {
-        List<Integer> selectedIndices = getSelectedIndices(arr);
-        int currentPos = selectedIndices.indexOf(inputIndex);
-        if (currentPos != -1 && currentPos + 1 < selectedIndices.size()) {
-            return arr[selectedIndices.get(currentPos + 1)];
-        }
-        return null; // 鎴栨寜闇�澶勭悊
+
+    public static List<String> getFormattedDatesOfPreviousMonth(String pattern) {
+//        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
+//        YearMonth previousMonth = YearMonth.now().minusMonths(1);
+//
+//        return IntStream.rangeClosed(1, previousMonth.lengthOfMonth())
+//                .mapToObj(day -> previousMonth.atDay(day).format(formatter))
+//                .collect(Collectors.toList());
+        LocalDate today = LocalDate.now().minusDays(1);
+        LocalDate oneMonthAgo = today.minusMonths(1);
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
+        return IntStream.iterate(0, i -> i + 1)
+                .limit(ChronoUnit.DAYS.between(oneMonthAgo, today) + 1)
+                .mapToObj(oneMonthAgo::plusDays)
+                .map(date -> date.format(formatter))
+                .collect(Collectors.toList());
     }
 
     public static void main(String[] args) {
-        int[] arr = {2, 5, 8, 10, 15, 20, 25, 30, 35, 40, 45, 50, 15, 40, 32, 48};
-        System.out.println("杈撳叆 0锛岃緭鍑�: " + getNextSelectedValue(arr, 0)); // 10
-        System.out.println("杈撳叆 3锛岃緭鍑�: " + getNextSelectedValue(arr, 3)); // 15
-        System.out.println("杈撳叆 4锛岃緭鍑�: " + getNextSelectedValue(arr, 4)); // 30
-        System.out.println("杈撳叆 4锛岃緭鍑�: " + getNextSelectedValue(arr, 5)); // 30
-
+        List<String> formattedDates = getFormattedDatesOfPreviousMonth("yyyy-MM-dd");
+        formattedDates.forEach(System.out::println);
     }
+
 }
\ No newline at end of file

--
Gitblit v1.9.1