Commit 28afb558 authored by wujipeng's avatar wujipeng
Browse files

优化项

parent 2af67ae4
...@@ -795,7 +795,7 @@ public class ClassAdminServiceImpl implements ClassAdminService { ...@@ -795,7 +795,7 @@ public class ClassAdminServiceImpl implements ClassAdminService {
private void enrichStudent(ClassAdminStudentVO student, String classStatus) { private void enrichStudent(ClassAdminStudentVO student, String classStatus) {
List<String> personTypes = parsePersonTypes(student); List<String> personTypes = parsePersonTypes(student);
student.setPersonTypes(personTypes); student.setPersonTypes(personTypes);
student.setPersonTypeName(personTypes.isEmpty() ? null : String.join("、", personTypes)); student.setPersonTypeName(resolveLegacyPersonTypeName(student));
String accountStatus = trimToNull(student.getAccountStatus()); String accountStatus = trimToNull(student.getAccountStatus());
if (accountStatus != null) { if (accountStatus != null) {
...@@ -873,6 +873,26 @@ public class ClassAdminServiceImpl implements ClassAdminService { ...@@ -873,6 +873,26 @@ public class ClassAdminServiceImpl implements ClassAdminService {
return new ArrayList<>(values); return new ArrayList<>(values);
} }
/**
* 按历史人员类别字段的勾选位置生成名单展示值。
*
* <p>{@code user_type1}和{@code user_type2}中保存的是“√”等勾选标记,
* 而不是需要直接展示的文本。因此只判断字段是否有值:类别1有值展示“1”,
* 类别2有值展示“2”。正常导入数据两者互斥;若历史异常数据同时勾选,
* 则完整展示为“1、2”,避免隐藏已保存的数据。两个字段都为空时返回{@code null},
* 前端表格单元格因此保持空白。</p>
*/
private String resolveLegacyPersonTypeName(ClassAdminStudentVO student) {
List<String> selectedTypes = new ArrayList<>(2);
if (trimToNull(student.getLegacyPersonType1()) != null) {
selectedTypes.add("1");
}
if (trimToNull(student.getLegacyPersonType2()) != null) {
selectedTypes.add("2");
}
return selectedTypes.isEmpty() ? null : String.join("、", selectedTypes);
}
private List<String> normalizePersonTypes(List<String> values) { private List<String> normalizePersonTypes(List<String> values) {
if (values == null || values.isEmpty()) { if (values == null || values.isEmpty()) {
return Collections.emptyList(); return Collections.emptyList();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment