班历功能添加

This commit is contained in:
2026-09-16 17:13:57 +08:00
parent 2e151ea228
commit abf616a8ee
19 changed files with 526 additions and 73 deletions
@@ -104,6 +104,7 @@ public final class OperationLogUtil {
"教学场地历管理",
"教室输出课程表管理",
"学期校历管理",
"班历管理",
"教材管理",
"教材库存管理",
"其他"));
@@ -1178,6 +1179,9 @@ public final class OperationLogUtil {
if (normalizedUrl.contains("/xqxlb/")) {
return "学期校历管理";
}
if (normalizedUrl.contains("/class-calendar/")) {
return "班历管理";
}
if (normalizedUrl.contains("/teachingmaterial/")) {
return "教材管理";
}
@@ -0,0 +1,52 @@
package com.roomroot.jwgl.utils;
import java.util.ArrayList;
import java.util.List;
/**
* 历表「节次」标签解析。校历 / 班历 / 场地历的节次段(如 "1-2"、"3"、"1,3-4")
* 统一在这里展开为单节次号,供排课窗、冲突检测、历表读写共用。
*/
public final class PeriodUtil {
private PeriodUtil() {
}
/**
* 解析节次标签为节次号集合:"1-2"→[1,2],"3"→[3],"1,3-4"→[1,3,4];无法解析返回空。
*/
public static List<Integer> parsePeriods(String label) {
List<Integer> out = new ArrayList<>();
if (label == null) {
return out;
}
for (String token : label.split("[,,]")) {
String t = token.trim();
if (t.contains("-")) {
String[] parts = t.split("-");
try {
int a = Integer.parseInt(parts[0].trim());
int b = Integer.parseInt(parts[1].trim());
for (int i = Math.min(a, b); i <= Math.max(a, b); i++) {
out.add(i);
}
} catch (Exception ignored) {
}
} else {
try {
out.add(Integer.parseInt(t));
} catch (Exception ignored) {
}
}
}
return out;
}
/**
* 节次段的起始节次号(用于排序),无法解析返回 Integer.MAX_VALUE。
*/
public static int firstPeriod(String label) {
List<Integer> parsed = parsePeriods(label);
return parsed.isEmpty() ? Integer.MAX_VALUE : parsed.get(0);
}
}