JSON解析调整

This commit is contained in:
ys.git 2025-12-25 10:43:10 +08:00
parent dd0ac17165
commit 1757997373

View File

@ -86,15 +86,22 @@ public class TodoTaskServiceImpl implements TodoTaskService {
String currentProcessor = todoTaskPojo.getCurrentProcessor();
BeanUtils.copyProperties(todoTaskPojo, todoTaskPojo1);
List<String> strings = JSON.parseArray(currentProcessor).toList(String.class).stream()
.map(x -> {
XdapUsers xdapUsers = xdapDeptUsersService.selectUserByID(x);
if (ObjectUtils.isNotEmpty(xdapUsers)) {
return xdapUsers.getUsername();
} else {
return "未知用户名:" + x;
}
}).collect(Collectors.toList());
List<String> strings = new ArrayList<>();
if (ObjectUtils.isNotEmpty(currentProcessor)) {
try {
strings = JSON.parseArray(currentProcessor).toList(String.class).stream()
.map(x -> {
XdapUsers xdapUsers = xdapDeptUsersService.selectUserByID(x);
if (ObjectUtils.isNotEmpty(xdapUsers)) {
return xdapUsers.getUsername();
} else {
return "未知用户名:" + x;
}
}).collect(Collectors.toList());
} catch (Exception e) {
strings = Arrays.asList(currentProcessor);
}
}
todoTaskPojo1.setCurrentProcessor(String.join(",", strings));
tods.add(todoTaskPojo1);
}
@ -153,19 +160,21 @@ public class TodoTaskServiceImpl implements TodoTaskService {
String currentProcessor = todoTaskPojo.getCurrentProcessor();
BeanUtils.copyProperties(todoTaskPojo, todoTaskPojo1);
List<String> strings = null;
try {
strings = JSON.parseArray(currentProcessor).toList(String.class).stream()
.map(x -> {
XdapUsers xdapUsers = xdapDeptUsersService.selectUserByID(x);
if (ObjectUtils.isNotEmpty(xdapUsers)) {
return xdapUsers.getUsername();
} else {
return "未知用户名:" + x;
}
}).collect(Collectors.toList());
} catch (Exception e) {
strings = Arrays.asList("解析失败 未知用户名:" + currentProcessor);
List<String> strings = new ArrayList<>();
if (ObjectUtils.isNotEmpty(currentProcessor)) {
try {
strings = JSON.parseArray(currentProcessor).toList(String.class).stream()
.map(x -> {
XdapUsers xdapUsers = xdapDeptUsersService.selectUserByID(x);
if (ObjectUtils.isNotEmpty(xdapUsers)) {
return xdapUsers.getUsername();
} else {
return "未知用户名:" + x;
}
}).collect(Collectors.toList());
} catch (Exception e) {
strings = Arrays.asList(currentProcessor);
}
}
todoTaskPojo1.setCurrentProcessor(String.join(",", strings));
tods.add(todoTaskPojo1);