fix(bugcollect): getIssueDetail 补全 events 列表,修复 Web 控制台事件列表为空
toIssueResponse 中 events 始终传 null,导致 GET /issues/{id} 返回的 events 字段为空。
getIssueDetail 现在主动查询最近 20 条 IssueEvent 并填充到响应中。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
这个提交包含在:
父节点
dcd429c52d
当前提交
696a50aae8
@ -187,7 +187,21 @@ public class LogService {
|
|||||||
public IssueResponse getIssueDetail(Long id) {
|
public IssueResponse getIssueDetail(Long id) {
|
||||||
LogIssueEntity issue = issueRepository.findById(id)
|
LogIssueEntity issue = issueRepository.findById(id)
|
||||||
.orElseThrow(() -> new IllegalArgumentException("Issue not found: " + id));
|
.orElseThrow(() -> new IllegalArgumentException("Issue not found: " + id));
|
||||||
return toIssueResponse(issue);
|
Pageable pageable = PageRequest.of(0, 20, Sort.by(Sort.Direction.DESC, "createdAt"));
|
||||||
|
List<IssueEventResponse> events = issueEventRepository
|
||||||
|
.findByIssueIdOrderByCreatedAtDesc(issue.getId(), pageable)
|
||||||
|
.getContent()
|
||||||
|
.stream()
|
||||||
|
.map(this::toIssueEventResponse)
|
||||||
|
.toList();
|
||||||
|
return new IssueResponse(
|
||||||
|
issue.getId(), issue.getAppKey(), issue.getFingerprint(),
|
||||||
|
issue.getLevel(),
|
||||||
|
issue.getStatus() != null ? issue.getStatus() : (issue.isResolved() ? "resolved" : "open"),
|
||||||
|
issue.getTitle(), issue.getFirstSeenAt(), issue.getLastSeenAt(),
|
||||||
|
issue.getCount(), issue.getAffectedUsers(), issue.isResolved(),
|
||||||
|
issue.getAssignee(), issue.getPlatform(), issue.getRelease(), events
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户