@@ -86,12 +86,14 @@ public AILetterResponseDTO save(AILetterRequestDTO requestDTO, Long userId) {
8686 throw new AIException (AI_MAIL_FAIL );
8787 }
8888
89+ LocalDate targetDate = requestDTO .getTargetDate ();
90+
8991 Users user = usersRepository .findByIdAndUserStatus (userId )
9092 .orElseThrow (() -> new AIException (AI_MAIL_FAIL ));
9193
92- List <Diary > diaries = diaryRepository .findByCreatedAtAndUserId (userId , requestDTO . getTargetDate () );
94+ List <Diary > diaries = diaryRepository .findByCreatedAtAndUserId (userId , targetDate );
9395 if (diaries .isEmpty ()) {
94- log .info ("---[SimSimSchedule] 해당 날짜({})에 작성한 일기가 없는 회원 userId = {}" , requestDTO . getTargetDate () , user .getUserId ());
96+ log .info ("---[SimSimSchedule] 해당 날짜({})에 작성한 일기가 없는 회원 userId = {}" , targetDate , user .getUserId ());
9597 throw new AIException (NO_DIARIES );
9698 }
9799
@@ -104,7 +106,7 @@ public AILetterResponseDTO save(AILetterRequestDTO requestDTO, Long userId) {
104106 .anyMatch (diary -> "Y" .equals (diary .getIsSendAble ()));
105107
106108 List <DailyAiInfo > aiInfo =
107- dailyAiInfoRepository .findByCreatedAtAndUserId (userId , requestDTO . getTargetDate () );
109+ dailyAiInfoRepository .findByCreatedAtAndUserId (userId , targetDate );
108110
109111 log .warn ("---[SimSimINFO] AI 편지::기존 AI 데이터 개수 ={}, userId = {}" ,
110112 aiInfo .size (), user .getUserId ());
@@ -123,7 +125,7 @@ public AILetterResponseDTO save(AILetterRequestDTO requestDTO, Long userId) {
123125
124126 // AI 응답 새로 생성
125127 try {
126- AILetterResponseDTO responseDTO = aiService .requestToAI (user , requestDTO . getTargetDate () , diaries );
128+ AILetterResponseDTO responseDTO = aiService .requestToAI (user , targetDate , diaries );
127129 if (responseDTO == null ) {
128130 throw new AIException (AI_MAIL_FAIL );
129131 }
0 commit comments