@@ -114,6 +114,33 @@ public Mono<AIReportResponseDto> matchExperienceAsync(MatchExperienceCommandDto
114114 }));
115115 }
116116
117+ @ Transactional
118+ public AIReportResponseDto matchExperienceWebclient (MatchExperienceCommandDto command ) {
119+ Company company = companyRepository .findById (command .companyId ())
120+ .orElseThrow (() -> BaseException .type (CompanyErrorCode .COMPANY_NOT_FOUND ));
121+
122+ Experience experience = experienceRepository .findByIdAndUserId (command .experienceId (), command .userId ())
123+ .orElseThrow (() -> new BaseException (ExperienceErrorCode .NOT_FOUND_EXPERIENCE ));
124+
125+ List <CompanyIssue > companyIssueList = companyIssueRepository .findByCompanyId (command .companyId ());
126+
127+ log .info ("WebClient API 호출 시작 - companyId: {}, experienceId: {}" , company .getId (), experience .getId ());
128+ long startTime = System .currentTimeMillis ();
129+
130+ CreateReportAiResponseDto response = aiWebClient
131+ .createReport (CreateReportAiRequestDto
132+ .from (AIReportPromptBuilder
133+ .build (company , experience , command .jobDescription (), companyIssueList )))
134+ .block (); // 여기서 동기로 대기
135+
136+ long duration = System .currentTimeMillis () - startTime ;
137+ log .info ("WebClient API 호출 완료 - duration: {}ms" , duration );
138+
139+ AIReport aiReport = parseAndSave (response .getContent (), experience , company , command .jobDescription ());
140+
141+ return AIReportResponseDto .from (aiReport );
142+ }
143+
117144
118145 @ Transactional (readOnly = true )
119146 public PageDto <GetReportSummaryResponseDto > getReportList (Long userId , Pageable pageable , String keyword ) {
0 commit comments