From c87e3e3c2850c3b07f64c330758c04e02492d982 Mon Sep 17 00:00:00 2001 From: hyeon-z Date: Mon, 21 Aug 2023 01:40:44 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=20eventType=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EB=B0=8F=20api=EB=AA=85=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=EC=A7=80=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/packman/service/AlarmService.java | 2 +- src/main/java/packman/service/HelpService.java | 2 +- src/main/java/packman/service/ListService.java | 4 ++-- src/main/java/packman/service/PackService.java | 14 +++++++------- src/main/java/packman/service/TemplateService.java | 4 ++-- src/main/java/packman/service/UserService.java | 4 ++-- .../aloneList/AloneListCategoryService.java | 6 +++--- .../service/aloneList/AloneListService.java | 4 ++-- .../togetherList/TogetherListCategoryService.java | 6 +++--- .../service/togetherList/TogetherListService.java | 6 +++--- src/main/java/packman/util/LogMessage.java | 8 ++++---- 11 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/main/java/packman/service/AlarmService.java b/src/main/java/packman/service/AlarmService.java index c7334d80..68bdb14f 100644 --- a/src/main/java/packman/service/AlarmService.java +++ b/src/main/java/packman/service/AlarmService.java @@ -17,6 +17,6 @@ public class AlarmService { public void getAlarm(Long userId) { validateUserId(userRepository, userId); - LogMessage.setNonDataLog("알림 조회", userId); + LogMessage.setNonDataLog("알림 조회", userId, "click"); } } diff --git a/src/main/java/packman/service/HelpService.java b/src/main/java/packman/service/HelpService.java index bab20f16..3ff0a8dc 100644 --- a/src/main/java/packman/service/HelpService.java +++ b/src/main/java/packman/service/HelpService.java @@ -15,6 +15,6 @@ public class HelpService { public void getHelp(Long userId) { validateUserId(userRepository, userId); - LogMessage.setNonDataLog("엿보기 조회", userId); + LogMessage.setNonDataLog("엿보기 조회", userId, "click"); } } diff --git a/src/main/java/packman/service/ListService.java b/src/main/java/packman/service/ListService.java index 57e30cea..13195429 100644 --- a/src/main/java/packman/service/ListService.java +++ b/src/main/java/packman/service/ListService.java @@ -86,7 +86,7 @@ public ListTitleResponseDto updateTitle(ListTitleRequestDto listTitleRequestDto, .title(title) .build(); - LogMessage.setNonDataLog("패킹리스트 수정", userId); + LogMessage.setNonDataLog("패킹리스트 제목 수정", userId, "click"); return listTitleResponseDto; } @@ -123,7 +123,7 @@ public DepartureDateResponseDto updateDepartureDate(DepartureDateRequestDto depa .departureDate(departureDateRequestDto.getDepartureDate()) .build(); - LogMessage.setNonDataLog("패킹리스트 수정", userId); + LogMessage.setNonDataLog("패킹리스트 출발 날짜 수정", userId, "click"); return departureDateResponseDto; } diff --git a/src/main/java/packman/service/PackService.java b/src/main/java/packman/service/PackService.java index cbf52f0a..b7998192 100644 --- a/src/main/java/packman/service/PackService.java +++ b/src/main/java/packman/service/PackService.java @@ -40,7 +40,7 @@ public ListResponseMapping createAlonePack(PackCreateDto packCreateDto, Long use ListResponseMapping listResponseMapping = packingListRepository.findByIdAndTitle(aloneListId, packingList.getTitle()); - LogMessage.setNonDataLog("패킹리스트 수정", userId); + LogMessage.setNonDataLog("혼자 패킹리스트 짐 생성", userId, "click"); return listResponseMapping; } @@ -54,7 +54,7 @@ public ListResponseMapping createTogetherPack(PackCreateDto packCreateDto, Long ListResponseMapping listResponseMapping = packingListRepository.findByIdAndTitle(togetherListId, packingList.getTitle()); - LogMessage.setNonDataLog("패킹리스트 수정", userId); + LogMessage.setNonDataLog("함께 패킹리스트 짐 생성", userId, "click"); return listResponseMapping; } @@ -81,7 +81,7 @@ public ListResponseMapping updateAlonePack(PackUpdateDto packUpdateDto, Long use ListResponseMapping listResponseMapping = packingListRepository.findByIdAndTitle(aloneListId, packingList.getTitle()); - LogMessage.setNonDataLog("패킹리스트 수정", userId); + LogMessage.setNonDataLog("혼자 패킹리스트 짐 수정", userId, "click"); return listResponseMapping; } @@ -95,7 +95,7 @@ public ListResponseMapping updateTogetherPack(PackUpdateDto packUpdateDto, Long ListResponseMapping listResponseMapping = packingListRepository.findByIdAndTitle(togetherListId, packingList.getTitle()); - LogMessage.setNonDataLog("패킹리스트 수정", userId); + LogMessage.setNonDataLog("함께 패킹리스트 짐 수정", userId, "click"); return listResponseMapping; } @@ -117,7 +117,7 @@ public void deleteAlonePack(Long listId, Long categoryId, Long packId, Long user packRepository.delete(validateListCategoryPack(packingList, categoryId, packId, categoryRepository, packRepository)); - LogMessage.setNonDataLog("패킹리스트 수정", userId); + LogMessage.setNonDataLog("혼자 패킹리스트 짐 삭제", userId, "click"); } public void deleteTogetherPack(Long listId, Long categoryId, Long packId, Long userId) { @@ -125,6 +125,6 @@ public void deleteTogetherPack(Long listId, Long categoryId, Long packId, Long u packRepository.delete(validateListCategoryPack(packingList, categoryId, packId, categoryRepository, packRepository)); - LogMessage.setNonDataLog("패킹리스트 수정", userId); + LogMessage.setNonDataLog("함께 패킹리스트 짐 삭제", userId, "click"); } -} \ No newline at end of file +} diff --git a/src/main/java/packman/service/TemplateService.java b/src/main/java/packman/service/TemplateService.java index e74305c2..25235c80 100644 --- a/src/main/java/packman/service/TemplateService.java +++ b/src/main/java/packman/service/TemplateService.java @@ -32,7 +32,7 @@ public TemplateListResponseDto getAloneTemplateList(Long userId) { .basicTemplate(basicTemplateRepository.findByUserIdAndIsAlonedAndIsDeletedOrderByCreatedAt(null, true, false)) .myTemplate(templateRepository.findByUserIdAndIsAlonedAndIsDeletedOrderByCreatedAt(userId, true, false)).build(); - LogMessage.setNonDataLog("혼자 패킹 템플릿 리스트 조회", userId); + LogMessage.setNonDataLog("혼자 패킹 템플릿 리스트 조회", userId, "screen"); return templateListResponseDto; } @@ -43,7 +43,7 @@ public TemplateListResponseDto getTogetherTemplateList(Long userId) { .basicTemplate(basicTemplateRepository.findByUserIdAndIsAlonedAndIsDeletedOrderByCreatedAt(null, false, false)) .myTemplate(templateRepository.findByUserIdAndIsAlonedAndIsDeletedOrderByCreatedAt(userId, false, false)).build(); - LogMessage.setNonDataLog("함께 패킹 템플릿 리스트 조회", userId); + LogMessage.setNonDataLog("함께 패킹 템플릿 리스트 조회", userId, "screen"); return templateListResponseDto; } diff --git a/src/main/java/packman/service/UserService.java b/src/main/java/packman/service/UserService.java index ad7b8260..558cf4c4 100644 --- a/src/main/java/packman/service/UserService.java +++ b/src/main/java/packman/service/UserService.java @@ -59,7 +59,7 @@ public UserResponseDto createUser(UserCreateDto userCreateDto) { .path(userCreateDto.getPath()) .build(); - LogMessage.setDataLog("닉네임/프로필 등록", userLogDto, createdUser.getId()); + LogMessage.setDataLog("닉네임/프로필 등록", userLogDto, createdUser.getId(), "click"); return UserResponseDto.builder() .isAlreadyUser(true) @@ -93,7 +93,7 @@ public void deleteUser(Long userId) { userRepository.setUserIsDeletedByUserId(userId); - LogMessage.setNonDataLog("유저 탈퇴", userId); + LogMessage.setNonDataLog("유저 탈퇴", userId, "click"); } diff --git a/src/main/java/packman/service/aloneList/AloneListCategoryService.java b/src/main/java/packman/service/aloneList/AloneListCategoryService.java index fbd61bcb..14529a0d 100644 --- a/src/main/java/packman/service/aloneList/AloneListCategoryService.java +++ b/src/main/java/packman/service/aloneList/AloneListCategoryService.java @@ -47,7 +47,7 @@ public ListResponseMapping createCategory(CategoryCreateDto categoryCreateDto, L // response ListResponseMapping listResponseMapping = packingListRepository.findByIdAndTitle(Long.parseLong(categoryCreateDto.getListId()), packingList.getTitle()); - LogMessage.setNonDataLog("패킹리스트 수정", userId); + LogMessage.setNonDataLog("혼자 패킹리스트 카테고리 생성", userId, "click"); return listResponseMapping; } @@ -76,7 +76,7 @@ public ListResponseMapping updateCategory(CategoryUpdateDto categoryUpdateDto, L // response ListResponseMapping categoryResponseDto = packingListRepository.findByIdAndTitle(Long.parseLong(categoryUpdateDto.getListId()), packingList.getTitle()); - LogMessage.setNonDataLog("패킹리스트 수정", userId); + LogMessage.setNonDataLog("혼자 패킹리스트 카테고리 수정", userId, "click"); return categoryResponseDto; } @@ -99,6 +99,6 @@ public void deleteCategory(Long listId, Long categoryId, Long userId) { // delete categoryRepository.delete(category); - LogMessage.setNonDataLog("패킹리스트 수정", userId); + LogMessage.setNonDataLog("혼자 패킹리스트 카테고리 삭제", userId, "click"); } } diff --git a/src/main/java/packman/service/aloneList/AloneListService.java b/src/main/java/packman/service/aloneList/AloneListService.java index 99a71830..e1772fef 100644 --- a/src/main/java/packman/service/aloneList/AloneListService.java +++ b/src/main/java/packman/service/aloneList/AloneListService.java @@ -125,7 +125,7 @@ public AloneListResponseDto createAloneList(ListCreateDto listCreateDto, Long us .category(savedCategories.getCategory()) .build(); - LogMessage.setDataLog("혼자 패킹리스트 생성", aloneListLogDto, userId); + LogMessage.setDataLog("혼자 패킹리스트 생성", aloneListLogDto, userId, "click"); return AloneListResponseDto.builder() .id(Long.toString(savedList.getId())) @@ -202,7 +202,7 @@ public InviteAloneListResponseDto getInviteAloneList(Long userId, String inviteC .IsOwner(isOwner) .build(); - LogMessage.setDataLog("혼자 패킹리스트 초대", inviteAloneListResponseDto, userId); + LogMessage.setDataLog("혼자 패킹리스트 초대", inviteAloneListResponseDto, userId, "screen"); return inviteAloneListResponseDto; } diff --git a/src/main/java/packman/service/togetherList/TogetherListCategoryService.java b/src/main/java/packman/service/togetherList/TogetherListCategoryService.java index 0a84400f..c3b0f9cd 100644 --- a/src/main/java/packman/service/togetherList/TogetherListCategoryService.java +++ b/src/main/java/packman/service/togetherList/TogetherListCategoryService.java @@ -56,7 +56,7 @@ public ListResponseMapping createCategory(CategoryCreateDto categoryCreateDto, L // response ListResponseMapping categoryResponseDto = packingListRepository.findByIdAndTitle(Long.parseLong(categoryCreateDto.getListId()), packingList.getTitle()); - LogMessage.setNonDataLog("패킹리스트 수정", userId); + LogMessage.setNonDataLog("함께 패킹리스트 카테고리 생성", userId, "click"); return categoryResponseDto; } @@ -91,7 +91,7 @@ public ListResponseMapping updateCategory(CategoryUpdateDto categoryUpdateDto, L // response ListResponseMapping categoryResponseDto = packingListRepository.findByIdAndTitle(Long.parseLong(categoryUpdateDto.getListId()), packingList.getTitle()); - LogMessage.setNonDataLog("패킹리스트 수정", userId); + LogMessage.setNonDataLog("함께 패킹리스트 카테고리 수정", userId, "click"); return categoryResponseDto; } @@ -115,7 +115,7 @@ public void deleteCategory(Long listId, Long categoryId, Long userId) { // delete categoryRepository.delete(category); - LogMessage.setNonDataLog("패킹리스트 수정", userId); + LogMessage.setNonDataLog("함께 패킹리스트 카테고리 삭제", userId, "click"); } } diff --git a/src/main/java/packman/service/togetherList/TogetherListService.java b/src/main/java/packman/service/togetherList/TogetherListService.java index d1b355ff..b570fb31 100644 --- a/src/main/java/packman/service/togetherList/TogetherListService.java +++ b/src/main/java/packman/service/togetherList/TogetherListService.java @@ -176,7 +176,7 @@ public TogetherListResponseDto createTogetherList(ListCreateDto listCreateDto, L .category(savedTogetherCategories.getCategory()) .build(); - LogMessage.setDataLog("함께 패킹리스트 생성", togetherListLogDto, userId); + LogMessage.setDataLog("함께 패킹리스트 생성", togetherListLogDto, userId, "click"); return togetherListResponseDto; } @@ -318,7 +318,7 @@ public ListResponseMapping updatePacker(PackerUpdateDto packerUpdateDto, Long us ListResponseMapping listResponseMapping = packingListRepository.findProjectionById(togetherPackingList.getId()); - LogMessage.setNonDataLog("패킹리스트 수정", userId); + LogMessage.setNonDataLog("함께 패킹리스트 담당자 배정", userId, "click"); return listResponseMapping; } @@ -369,7 +369,7 @@ public MemberAddResponseDto addMember(MemberAddDto memberAddDto, Long userId) { MemberAddResponseDto memberAddResponseDto = MemberAddResponseDto.builder().listId(newTogetherAlonePackingList.getId().toString()).build(); - LogMessage.setDataLog("함께 패킹리스트 초대 - 그룹원 추가", memberAddResponseDto, userId); + LogMessage.setDataLog("함께 패킹리스트 초대 - 그룹원 추가", memberAddResponseDto, userId, "screen"); return memberAddResponseDto; } diff --git a/src/main/java/packman/util/LogMessage.java b/src/main/java/packman/util/LogMessage.java index 237f40b7..0d839485 100644 --- a/src/main/java/packman/util/LogMessage.java +++ b/src/main/java/packman/util/LogMessage.java @@ -8,7 +8,7 @@ public class LogMessage { private static final Logger logger = LoggerFactory.getLogger(LogMessage.class); - public static void setDataLog(String apiName, Object data, Long userId) { + public static void setDataLog(String apiName, Object data, Long userId, String eventType) { ObjectMapper objectMapper = new ObjectMapper(); String json = ""; @@ -17,10 +17,10 @@ public static void setDataLog(String apiName, Object data, Long userId) { } catch (JsonProcessingException e) { e.printStackTrace(); } - logger.info("PACKMAN, " + apiName + ", userId: " + userId + ", data: " + json); + logger.info("PACKMAN, " + apiName + ", userId: " + userId + ", data: " + json + ", eventType: " + eventType); } - public static void setNonDataLog(String apiName, Long userId) { - logger.info("PACKMAN, " + apiName + ", userId: " + userId); + public static void setNonDataLog(String apiName, Long userId, String eventType) { + logger.info("PACKMAN, " + apiName + ", userId: " + userId + ", eventType: " + eventType); } }