This commit is contained in:
=
2026-03-05 16:04:44 +08:00
parent d3cd32fe5f
commit a811be52ee
@@ -172,14 +172,22 @@ public class TeacherCongressDelegateServiceImpl extends BaseServiceImpl<Teacher_
List<NutMap> delegateList = delegateAllList.stream() List<NutMap> delegateList = delegateAllList.stream()
.filter(delegate -> delegation.getString("id").equals(delegate.getString("delegationId"))) .filter(delegate -> delegation.getString("id").equals(delegate.getString("delegationId")))
.collect(Collectors.toList()); .collect(Collectors.toList());
Comparator<NutMap> comparator = Comparator.comparing(map -> { Comparator<NutMap> comparator = Comparator.comparing((NutMap map) -> {
String userName = map.getString("userName"); String userName = map.getString("userName");
if (StrUtil.isNotBlank(userName)) { if (userName == null || userName.isEmpty()) {
return getStrokeCount(String.valueOf(userName.charAt(0))); return 0;
}
// 获取第一个字的笔画数作为主排序键
return getStrokeCount(String.valueOf(userName.charAt(0)));
}).thenComparing(map -> {
String userName = map.getString("userName");
// 如果名字长度大于 1,获取第二个字的笔画数
if (userName != null && userName.length() > 1) {
return getStrokeCount(String.valueOf(userName.charAt(1)));
} }
return 0; return 0;
}); });
Collections.sort(delegateList, comparator); delegateList.sort(comparator);
//按5人平均分组 //按5人平均分组
List<List<NutMap>> delegateGroupList = ListUtil.split(delegateList, 5); List<List<NutMap>> delegateGroupList = ListUtil.split(delegateList, 5);