2323import devkor .com .teamcback .domain .user .entity .User ;
2424import devkor .com .teamcback .domain .user .repository .UserRepository ;
2525import devkor .com .teamcback .global .exception .exception .GlobalException ;
26+ import devkor .com .teamcback .global .logging .service .LogUtil ;
2627import devkor .com .teamcback .global .response .CursorPageRes ;
2728import lombok .RequiredArgsConstructor ;
2829import lombok .extern .slf4j .Slf4j ;
@@ -55,6 +56,7 @@ public class SearchService {
5556 private final BookmarkRepository bookmarkRepository ;
5657 private final PlaceImageRepository placeImageRepository ;
5758 private final NodeRepository nodeRepository ;
59+ private final LogUtil logUtil ;
5860 private final FileUtil fileUtil ;
5961
6062 // 점수 계산을 위한 상수
@@ -73,10 +75,11 @@ public class SearchService {
7375
7476 // 통합 검색 결과에 표시하지 않을 편의시설 종류
7577 //TODO: 자전거보관소, 벤치 디자인 요청 후 List에서 제거
78+ // TODO: 리필로드 구현 완료되면 REUSABLE_CUP_RETURN 제거하기
7679 private static final List <String > excludedTypes = Arrays .asList (PlaceType .CLASSROOM .getName (), PlaceType .TOILET .getName (),
7780 PlaceType .MEN_TOILET .getName (), PlaceType .WOMEN_TOILET .getName (), PlaceType .MEN_HANDICAPPED_TOILET .getName (),
7881 PlaceType .WOMEN_HANDICAPPED_TOILET .getName (), PlaceType .LOCKER .getName (), PlaceType .TRASH_CAN .getName (),
79- PlaceType .BICYCLE_RACK .getName (), PlaceType .BENCH .getName ());
82+ PlaceType .BICYCLE_RACK .getName (), PlaceType .BENCH .getName (), PlaceType . REUSABLE_CUP_RETURN . getName () );
8083
8184 // 통합 검색 결과에서 "건물명 + 기본편의시설명"의 형태로 제공되어야 하는 편의시설 종류
8285 private static final List <PlaceType > outerTagTypes = Arrays .asList (PlaceType .CAFE , PlaceType .CAFETERIA , PlaceType .CONVENIENCE_STORE ,
@@ -134,6 +137,8 @@ public GlobalSearchListRes globalSearch(String word, Long userId) {
134137 scores .putAll (getScores (word , buildings , lastPlaceWord , lastBuildingWord , user ));
135138 }
136139 }
140+
141+ logUtil .logSearch (word );
137142 return new GlobalSearchListRes (orderSequence (scores ));
138143 }
139144
@@ -155,6 +160,7 @@ public SearchBuildingListRes searchBuildings(PlaceType type) {
155160 .map (Place ::getBuilding )
156161 .distinct ()
157162 .toList ();
163+ logUtil .logClick (null , null , null , type .toString ());
158164 }
159165
160166 List <SearchBuildingRes > resList = new ArrayList <>();
@@ -197,6 +203,7 @@ public SearchBuildingFacilityListRes searchBuildingFacilityByType(Long buildingI
197203
198204 res .setFacilities (map );
199205
206+ logUtil .logClick (building .getName (), null , null , placeType .toString ());
200207 return res ;
201208 }
202209
@@ -266,7 +273,7 @@ public SearchFacilityListRes searchFacilitiesWithType(PlaceType placeType) {
266273
267274 placeResList .add (new SearchPlaceRes (place , imageUrl ));
268275 }
269-
276+ logUtil . logClick ( null , null , null , placeType . toString ());
270277 return new SearchFacilityListRes (placeResList );
271278 }
272279
@@ -280,6 +287,7 @@ public SearchPlaceByMaskIndexRes searchPlaceByMaskIndex(Long buildingId, int flo
280287 if (place == null ) {
281288 throw new GlobalException (NOT_FOUND_PLACE );
282289 }
290+ logUtil .logClick (building .getName (), place .getName (), place .getFloor (), place .getType ().toString ());
283291 return new SearchPlaceByMaskIndexRes (place );
284292 }
285293
@@ -334,9 +342,13 @@ public SearchBuildingDetailRes searchBuildingDetail(Long userId, Long buildingId
334342 if (building .getFileUuid () != null ) {
335343 imageUrl = fileUtil .getThumbnail (building .getFileUuid ());
336344 }
345+ logUtil .logClick (building .getName (), null , null , null );
337346 return new SearchBuildingDetailRes (res , containPlaceTypes , building , imageUrl , bookmarked );
338347 }
339348
349+ /**
350+ * 건물 대표 편의시설 목록 조회
351+ */
340352 @ Transactional (readOnly = true )
341353 public CursorPageRes <SearchMainFacilityRes > searchBuildingMainFacilityList (Long buildingId , Long lastPlaceId , int size ) {
342354 Place lastPlace = (lastPlaceId == null ) ? null : findPlace (lastPlaceId );
@@ -393,7 +405,7 @@ public SearchPlaceDetailRes searchPlaceDetail(Long userId, Long placeId) {
393405 if (bookmarkRepository .existsByLocationIdAndLocationTypeAndCategoryBookmarkList_CategoryIn (place .getId (), LocationType .PLACE , categories )) {
394406 bookmarked = true ;
395407 }
396-
408+ logUtil . logClick ( place . getBuilding (). getName (), place . getName (), place . getFloor (), place . getType (). toString ());
397409 return new SearchPlaceDetailRes (place , imageUrl , bookmarked , placeImageList );
398410 }
399411
0 commit comments