【修复】 站内信详情中包含删除用户无法正常显示为“未知用户”

站内信收件人中包含已删除用户时,sysUserApi.getUserByIdWithException(devRelation.getTargetId())方法会抛出异常,直接抛到前端报错,这里捕获一下异常不做处理,可以让删除用户成功显示为未知用户或者在catch中做特殊处理

Signed-off-by: wxwx <4622811@163.com>
pull/230/head
wxwx 4 months ago committed by Gitee
parent 978ab81463
commit 8f7424b5e7
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -192,7 +192,13 @@ public class DevMessageServiceImpl extends ServiceImpl<DevMessageMapper, DevMess
List<DevMessageResult.DevReceiveInfo> receiveInfoList = devRelationService.getRelationListByObjectIdAndCategory(devMessage.getId(), List<DevMessageResult.DevReceiveInfo> receiveInfoList = devRelationService.getRelationListByObjectIdAndCategory(devMessage.getId(),
DevRelationCategoryEnum.MSG_TO_USER.getValue()).stream().map(devRelation -> { DevRelationCategoryEnum.MSG_TO_USER.getValue()).stream().map(devRelation -> {
DevMessageResult.DevReceiveInfo devReceiveInfo = new DevMessageResult.DevReceiveInfo(); DevMessageResult.DevReceiveInfo devReceiveInfo = new DevMessageResult.DevReceiveInfo();
JSONObject userObj = sysUserApi.getUserByIdWithException(devRelation.getTargetId()); JSONObject userObj = null;
try {
userObj = sysUserApi.getUserByIdWithException(devRelation.getTargetId());
}
catch (Exception e) {
// 收件人中包含删除用户 在此处做处理
}
String userName = "未知用户"; String userName = "未知用户";
if(ObjectUtil.isNotEmpty(userObj)) { if(ObjectUtil.isNotEmpty(userObj)) {
userName = userObj.getStr("name"); userName = userObj.getStr("name");

Loading…
Cancel
Save