From 9b3a08125703628390b9d661511f834d82d30045 Mon Sep 17 00:00:00 2001 From: minsu20 Date: Fri, 9 Aug 2024 13:38:18 +0900 Subject: [PATCH] =?UTF-8?q?MNG-28=20feat:=20=ED=91=B8=EC=8B=9C=20=EC=95=8C?= =?UTF-8?q?=EB=A6=BC=20=EB=B3=B4=EB=82=BC=20=EB=96=BC=20idInfo=EC=97=90=20?= =?UTF-8?q?type=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../board/application/service/SendBoardAlarmUseCase.java | 5 +++-- .../application/service/SendBoardCommentAlarmUseCase.java | 1 + .../fire/application/service/FireThrowAlarmUseCase.java | 5 +++-- .../application/service/SendMissionCreateAlarmUseCase.java | 5 +++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/moing/backend/domain/board/application/service/SendBoardAlarmUseCase.java b/src/main/java/com/moing/backend/domain/board/application/service/SendBoardAlarmUseCase.java index 3ed5f384..edb57a8c 100644 --- a/src/main/java/com/moing/backend/domain/board/application/service/SendBoardAlarmUseCase.java +++ b/src/main/java/com/moing/backend/domain/board/application/service/SendBoardAlarmUseCase.java @@ -4,7 +4,6 @@ import com.moing.backend.domain.history.application.dto.response.MemberIdAndToken; import com.moing.backend.domain.history.application.dto.response.NewUploadInfo; import com.moing.backend.domain.history.application.mapper.AlarmHistoryMapper; -import com.moing.backend.domain.history.domain.entity.AlarmType; import com.moing.backend.domain.history.domain.entity.PagePath; import com.moing.backend.domain.member.domain.entity.Member; import com.moing.backend.domain.team.domain.entity.Team; @@ -20,6 +19,7 @@ import java.util.List; import java.util.Optional; +import static com.moing.backend.domain.history.domain.entity.AlarmType.NEW_UPLOAD; import static com.moing.backend.global.config.fcm.constant.NewNoticeUploadMessage.NEW_NOTICE_UPLOAD_MESSAGE; @Service @@ -41,7 +41,7 @@ public void sendNewUploadAlarm(BaseServiceResponse baseServiceResponse, Board bo Optional> memberIdAndTokensByPush = AlarmHistoryMapper.getNewUploadPushInfo(newUploadInfos); Optional> memberIdAndTokensBySave = AlarmHistoryMapper.getNewUploadSaveInfo(newUploadInfos); // 알림 보내기 - eventPublisher.publishEvent(new MultiFcmEvent(title, body, memberIdAndTokensByPush, memberIdAndTokensBySave, createIdInfo(team.getTeamId(), board.getBoardId()), team.getName(), AlarmType.NEW_UPLOAD, PagePath.NOTICE_PATH.getValue())); + eventPublisher.publishEvent(new MultiFcmEvent(title, body, memberIdAndTokensByPush, memberIdAndTokensBySave, createIdInfo(team.getTeamId(), board.getBoardId()), team.getName(), NEW_UPLOAD, PagePath.NOTICE_PATH.getValue())); } } @@ -49,6 +49,7 @@ private String createIdInfo(Long teamId, Long boardId) { JSONObject jo = new JSONObject(); jo.put("teamId", teamId); jo.put("boardId", boardId); + jo.put("type", "NEW_UPLOAD_BOARD"); return jo.toJSONString(); } diff --git a/src/main/java/com/moing/backend/domain/boardComment/application/service/SendBoardCommentAlarmUseCase.java b/src/main/java/com/moing/backend/domain/boardComment/application/service/SendBoardCommentAlarmUseCase.java index 42db80ac..974060ed 100644 --- a/src/main/java/com/moing/backend/domain/boardComment/application/service/SendBoardCommentAlarmUseCase.java +++ b/src/main/java/com/moing/backend/domain/boardComment/application/service/SendBoardCommentAlarmUseCase.java @@ -65,6 +65,7 @@ private String createIdInfo(Long teamId, Long boardId) { JSONObject jo = new JSONObject(); jo.put("teamId", teamId); jo.put("boardId", boardId); + jo.put("type", "COMMENT"); return jo.toJSONString(); } diff --git a/src/main/java/com/moing/backend/domain/fire/application/service/FireThrowAlarmUseCase.java b/src/main/java/com/moing/backend/domain/fire/application/service/FireThrowAlarmUseCase.java index ba2c35c4..b2451d61 100644 --- a/src/main/java/com/moing/backend/domain/fire/application/service/FireThrowAlarmUseCase.java +++ b/src/main/java/com/moing/backend/domain/fire/application/service/FireThrowAlarmUseCase.java @@ -1,7 +1,6 @@ package com.moing.backend.domain.fire.application.service; import com.moing.backend.domain.fire.application.dto.req.FireThrowReq; -import com.moing.backend.domain.history.domain.entity.AlarmType; import com.moing.backend.domain.member.domain.entity.Member; import com.moing.backend.domain.mission.domain.entity.Mission; import com.moing.backend.domain.mission.domain.entity.constant.MissionType; @@ -15,6 +14,7 @@ import javax.transaction.Transactional; import java.util.Random; +import static com.moing.backend.domain.history.domain.entity.AlarmType.FIRE; import static com.moing.backend.domain.history.domain.entity.PagePath.MISSION_PATH; import static com.moing.backend.global.config.fcm.constant.FireThrowMessage.*; @@ -35,7 +35,7 @@ public void sendFireThrowAlarm(Member throwMember, Member receiveMember, Team te : getRandomMessage(throwMember.getNickName(), receiveMember.getNickName(), randomNum); String idInfo = createIdInfo(mission.getType() == MissionType.REPEAT, mission.getTeam().getTeamId(), mission.getId()); - eventPublisher.publishEvent(new SingleFcmEvent(receiveMember, title, message, idInfo, team.getName(), AlarmType.FIRE, MISSION_PATH.getValue(), receiveMember.isFirePush())); + eventPublisher.publishEvent(new SingleFcmEvent(receiveMember, title, message, idInfo, team.getName(), FIRE, MISSION_PATH.getValue(), receiveMember.isFirePush())); } public String getRandomMessage(String pusher, String receiver, int num) { @@ -65,6 +65,7 @@ private String createIdInfo(boolean isRepeated, Long teamId, Long missionId) { jo.put("isRepeated", isRepeated); jo.put("teamId", teamId); jo.put("missionId", missionId); + jo.put("type", "FIRE"); return jo.toJSONString(); } diff --git a/src/main/java/com/moing/backend/domain/mission/application/service/SendMissionCreateAlarmUseCase.java b/src/main/java/com/moing/backend/domain/mission/application/service/SendMissionCreateAlarmUseCase.java index aabe793f..029f5420 100644 --- a/src/main/java/com/moing/backend/domain/mission/application/service/SendMissionCreateAlarmUseCase.java +++ b/src/main/java/com/moing/backend/domain/mission/application/service/SendMissionCreateAlarmUseCase.java @@ -3,7 +3,6 @@ import com.moing.backend.domain.history.application.dto.response.MemberIdAndToken; import com.moing.backend.domain.history.application.dto.response.NewUploadInfo; import com.moing.backend.domain.history.application.mapper.AlarmHistoryMapper; -import com.moing.backend.domain.history.domain.entity.AlarmType; import com.moing.backend.domain.history.domain.entity.PagePath; import com.moing.backend.domain.member.domain.entity.Member; import com.moing.backend.domain.mission.domain.entity.Mission; @@ -21,6 +20,7 @@ import java.util.List; import java.util.Optional; +import static com.moing.backend.domain.history.domain.entity.AlarmType.NEW_UPLOAD; import static com.moing.backend.global.config.fcm.constant.NewMissionTitle.NEW_SINGLE_MISSION_COMING; @Service @@ -43,7 +43,7 @@ public void sendNewMissionUploadAlarm(Member member, Mission mission) { Optional> memberIdAndTokensByPush = AlarmHistoryMapper.getNewUploadPushInfo(newUploadInfos); Optional> memberIdAndTokensBySave = AlarmHistoryMapper.getNewUploadSaveInfo(newUploadInfos); // 알림 보내기 - eventPublisher.publishEvent(new MultiFcmEvent(title, message, memberIdAndTokensByPush, memberIdAndTokensBySave, createIdInfo(team.getTeamId(), mission.getId(),mission.getType(),mission.getStatus()), team.getName(), AlarmType.NEW_UPLOAD, PagePath.MISSION_PATH.getValue())); + eventPublisher.publishEvent(new MultiFcmEvent(title, message, memberIdAndTokensByPush, memberIdAndTokensBySave, createIdInfo(team.getTeamId(), mission.getId(),mission.getType(),mission.getStatus()), team.getName(), NEW_UPLOAD, PagePath.MISSION_PATH.getValue())); } private String createIdInfo(Long teamId, Long missionId,MissionType type, MissionStatus status) { @@ -52,6 +52,7 @@ private String createIdInfo(Long teamId, Long missionId,MissionType type, Missio jo.put("teamId", teamId); jo.put("missionId", missionId); jo.put("status", status.name()); + jo.put("type", "NEW_UPLOAD_MISSION"); return jo.toJSONString(); } }