From 5807fc22aba974b4ca85a8049ecd983673b0ca28 Mon Sep 17 00:00:00 2001
From: skyouc <958836976@qq.com>
Date: 星期一, 20 十月 2025 16:59:34 +0800
Subject: [PATCH] 1. 添加大屏接口 2. 任务站点确认修改
---
rsf-server/src/main/Test/ChineseMD5Util.java | 112 +++++++++++++++++++++++++++----------------------------
1 files changed, 55 insertions(+), 57 deletions(-)
diff --git a/rsf-server/src/main/Test/ChineseMD5Util.java b/rsf-server/src/main/Test/ChineseMD5Util.java
index 963e6de..0c71353 100644
--- a/rsf-server/src/main/Test/ChineseMD5Util.java
+++ b/rsf-server/src/main/Test/ChineseMD5Util.java
@@ -1,70 +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 {
- /**
- * 瀵规眽瀛楀瓧绗︿覆杩涜MD5鍔犲瘑
- * @param input 瑕佸姞瀵嗙殑姹夊瓧瀛楃涓�
- * @return 32浣嶅皬鍐橫D5鍝堝笇鍊�
- * @throws NoSuchAlgorithmException
- */
- public static String md5Chinese(String input) throws NoSuchAlgorithmException {
- if (input == null) {
- return null;
- }
+// 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
+//
+// }
- // 缁熶竴浣跨敤UTF-8缂栫爜
- byte[] inputBytes = input.getBytes(StandardCharsets.UTF_8);
- MessageDigest md = MessageDigest.getInstance("MD5");
- byte[] digest = md.digest(inputBytes);
-
- // 灏嗗瓧鑺傛暟缁勮浆鎹负16杩涘埗瀛楃涓�
- StringBuilder sb = new StringBuilder();
- for (byte b : digest) {
- sb.append(String.format("%02x", b));
- }
-
- return sb.toString();
- }
-
- /**
- * 楠岃瘉姹夊瓧瀛楃涓蹭笌MD5鍝堝笇鏄惁鍖归厤
- * @param input 瑕侀獙璇佺殑姹夊瓧瀛楃涓�
- * @param md5Hash 瀛樺偍鐨凪D5鍝堝笇鍊�
- * @return 濡傛灉鍖归厤杩斿洖true锛屽惁鍒檉alse
- */
- public static boolean verifyChinese(String input, String md5Hash) {
- try {
- String computedHash = md5Chinese(input);
- return computedHash.equals(md5Hash.toLowerCase());
- } catch (NoSuchAlgorithmException e) {
- // 鐞嗚涓婁笉浼氬彂鐢燂紝鍥犱负MD5鏄疛ava鏍囧噯搴撴敮鎸佺殑
- return false;
- }
+ 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) {
- try {
- String chineseText = "浣犲ソ锛屼笘鐣岋紒";
-
- // 鍔犲瘑
- String md5Hash = md5Chinese(chineseText);
- System.out.println("鍘熸枃: " + chineseText);
- System.out.println("MD5鍝堝笇: " + md5Hash);
-
- // 楠岃瘉
- boolean isValid = verifyChinese(chineseText, md5Hash);
- System.out.println("楠岃瘉缁撴灉: " + (isValid ? "鍖归厤" : "涓嶅尮閰�"));
-
- // 閿欒楠岃瘉绀轰緥
- boolean isWrongValid = verifyChinese("浣犲ソ锛屼笘鐣岋紒", md5Hash);
- System.out.println("閿欒鏂囨湰楠岃瘉: " + (isWrongValid ? "鍖归厤" : "涓嶅尮閰�"));
-
- } catch (NoSuchAlgorithmException e) {
- e.printStackTrace();
- }
+ List<String> formattedDates = getFormattedDatesOfPreviousMonth("yyyy-MM-dd");
+ formattedDates.forEach(System.out::println);
}
+
}
\ No newline at end of file
--
Gitblit v1.9.1