11package com .haru .api .domain .meeting .service ;
22
3+ import com .haru .api .domain .lastOpened .entity .UserDocumentLastOpened ;
4+ import com .haru .api .domain .lastOpened .repository .UserDocumentLastOpenedRepository ;
35import com .haru .api .domain .lastOpened .service .UserDocumentLastOpenedService ;
46import com .haru .api .domain .meeting .converter .MeetingConverter ;
57import com .haru .api .domain .meeting .dto .MeetingRequestDTO ;
4244import java .util .List ;
4345import java .util .stream .Collectors ;
4446
47+ import static com .haru .api .domain .lastOpened .entity .enums .DocumentType .AI_MEETING_MANAGER ;
48+
4549@ Slf4j
4650@ Service
4751@ RequiredArgsConstructor
@@ -54,6 +58,7 @@ public class MeetingCommandServiceImpl implements MeetingCommandService {
5458 private final KeywordRepository keywordRepository ;
5559 private final ChatGPTClient chatGPTClient ;
5660 private final UserDocumentLastOpenedService userDocumentLastOpenedService ;
61+ private final UserDocumentLastOpenedRepository userDocumentLastOpenedRepository ;
5762 private final WebSocketSessionRegistry webSocketSessionRegistry ;
5863 private final SpeechSegmentRepository speechSegmentRepository ;
5964 private final MarkdownFileUploader markdownFileUploader ;
@@ -194,11 +199,12 @@ public void adjustProceeding(User user, Meeting meeting, MeetingRequestDTO.meeti
194199 // 썸네일 생성 및 업데이트
195200 String newThumbnailKey = markdownFileUploader .createOrUpdateThumbnail (pdfKey , "meeting" + meeting .getId (), meeting .getThumbnailKeyName ());
196201 log .info ("회의록 썸네일 생성/업데이트 완료. Key: {}" , newThumbnailKey );
197-
198202 // Meeting AI 회의록 수정 시 워크스페이스에 속해있는 모든 유저에 대해 썸네일 이미지 키 수정
199- foundMeeting .initProceedingPdfKeyName (newThumbnailKey );
200- List <User > usersInWorkspace = userWorkspaceRepository .findUsersByWorkspaceId (foundMeeting .getWorkspace ().getId ());
201- userDocumentLastOpenedService .updateRecordsThumbnailForWorkspaceUsers (usersInWorkspace , foundMeeting );
203+ List <UserDocumentLastOpened > foundLastOpenedList = userDocumentLastOpenedRepository .findByDocumentIdAndDocumentType (foundMeeting .getId (), AI_MEETING_MANAGER );
204+ foundLastOpenedList .forEach (userDocumentLastOpened -> {
205+ userDocumentLastOpened .updateThumbnailKeyName (newThumbnailKey );
206+ });
207+
202208 } catch (Exception e ) {
203209 log .error ("meetingId: {}의 PDF 또는 썸네일 생성/업로드 중 에러 발생" , meeting .getId (), e );
204210 throw new RuntimeException ("파일 갱신 중 오류가 발생했습니다." , e );
@@ -275,16 +281,23 @@ public void processAfterMeeting(AudioSessionBuffer sessionBuffer) {
275281 currentMeeting .initThumbnailKeyName (newThumbnailKey ); // Meeting 엔티티에 썸네일 키 저장
276282 log .info ("회의록 썸네일 생성/업데이트 완료. Key: {}" , newThumbnailKey );
277283
284+
285+ List <UserDocumentLastOpened > foundLastOpenedList = userDocumentLastOpenedRepository .findByDocumentIdAndDocumentType (currentMeeting .getId (), AI_MEETING_MANAGER );
286+ foundLastOpenedList .forEach (userDocumentLastOpened -> {
287+ userDocumentLastOpened .updateThumbnailKeyName (newThumbnailKey );
288+ });
289+
290+
291+
278292 } catch (Exception e ) {
279293 log .error ("meetingId: {}의 PDF 또는 썸네일 생성/업로드 중 에러 발생" , currentMeeting .getId (), e );
294+ throw new MeetingHandler (ErrorStatus .MEETING_FILE_UPLOAD_FAIL );
280295 }
281296 log .info ("meetingId: {}의 AI 회의록 생성 및 저장 완료." , currentMeeting .getId ());
282297 } else {
283298 log .warn ("meetingId: {}의 AI 분석 결과가 비어있습니다." , currentMeeting .getId ());
284299 }
285300
286-
287-
288301 } else {
289302 log .warn ("meetingId: {}에 처리할 오디오 데이터가 없습니다." , currentMeeting .getId ());
290303 }
0 commit comments