计划任务编辑详情前后端适配

This commit is contained in:
2026-02-05 13:45:39 +08:00
parent b0093ccccb
commit 8f6c9af00f
37 changed files with 2145 additions and 517 deletions

View File

@@ -0,0 +1,28 @@
package quant.rich.emoney.util;
import java.util.*;
public class ChunkRandomIter {
final static Random RANDOM = new Random();
public static <T> List<T> splitShuffleAndFlatten(List<T> list, int n) {
int size = list.size();
if (n <= 0) throw new IllegalArgumentException("n must be > 0");
n = Math.min(n, size == 0 ? 1 : size);
List<T> parts = new ArrayList<>(n);
int base = size / n; // 每份至少 base 个
int extra = size % n; // 前 extra 份多一个
int idx = 0;
for (int i = 0; i < n; i++) {
int partSize = base + (i < extra ? 1 : 0);
List<T> part = new ArrayList<>(list.subList(idx, idx + partSize));
Collections.shuffle(part, RANDOM);
parts.addAll(part);
idx += partSize;
}
return parts;
}
}