Skip to content

Commit

Permalink
Merge pull request #97 from EWHA-LUX/feature/#72
Browse files Browse the repository at this point in the history
[Feat] ํ‘ธ์‹œ ์•Œ๋ฆผ ํŽ˜์ด์ง€ ์ด๋™์„ ์œ„ํ•œ ์•Œ๋ฆผid์ถ”๊ฐ€ (#72)
  • Loading branch information
julia-heo authored May 25, 2024
2 parents 6013be1 + d625fda commit 9b4f03e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ public class AnnouncementRequestDto {
private String targetToken;
private String title;
private String body;
private String announceId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void cheeringBenefitGoalAnnounce() throws CustomException {
List<FCMToken> fcmTokens = fcmTokenRepository.findAllByUsers(users);
for ( FCMToken fcmToken : fcmTokens){
String token = fcmToken.getToken();
firebaseCloudMessageService.sendNotification(new AnnouncementRequestDto(token,"๋ชฉํ‘œ ์‘์› ์•Œ๋ฆผ",content));
firebaseCloudMessageService.sendNotification(new AnnouncementRequestDto(token,"๋ชฉํ‘œ ์‘์› ์•Œ๋ฆผ",content,announcement.getId().toString()));
}
}
}
Expand Down Expand Up @@ -112,7 +112,7 @@ public void cardPerformanceAnnounce() throws CustomException {
List<FCMToken> fcmTokens = fcmTokenRepository.findAllByUsers(users);
for ( FCMToken fcmToken : fcmTokens){
String token = fcmToken.getToken();
firebaseCloudMessageService.sendNotification(new AnnouncementRequestDto(token,currentDate+"์›” ์‹ค์  ์•Œ๋ฆผ",content));
firebaseCloudMessageService.sendNotification(new AnnouncementRequestDto(token,currentDate+"์›” ์‹ค์  ์•Œ๋ฆผ",content,announcement.getId().toString()));
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public void sendNotification (AnnouncementRequestDto requestDTO) throws CustomEx
Message message = Message.builder()
.setToken(requestDTO.getTargetToken())
.setNotification(notification)
.putData("announceId",requestDTO.getAnnounceId() )
.build();
try {
firebaseMessaging.send(message);
Expand Down
11 changes: 4 additions & 7 deletions src/main/java/ewha/lux/once/domain/home/service/HomeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.time.LocalDate;
Expand All @@ -45,7 +43,6 @@ public class HomeService {
private final FCMTokenRepository fcmTokenRepository;
private final FirebaseCloudMessageService firebaseCloudMessageService;
private final BeaconRepository beaconRepository;
private final CODEFAsyncService codefAsyncService;

// ์ฑ—๋ด‡ ์นด๋“œ ์ถ”์ฒœ
public ChatDto getHomeChat(Users nowUser, String keyword, int paymentAmount) throws CustomException {
Expand Down Expand Up @@ -337,7 +334,7 @@ public void postAnnounceFavorite(AnnounceFavoriteRequestDto dto, Users nowUser)
}

String contents = dto.getStoreName()+" ๊ทผ์ฒ˜์‹œ๊ตฐ์š”.\n"+card.getName()+" ์‚ฌ์šฉํ•ด ๋ณด์„ธ์š”!";
String title = dto.getStoreName()+" ๊ทผ์ฒ˜์‹œ๊ตฐ์š”";
String title = dto.getStoreName()+" ๊ทผ์ฒ˜์‹œ๊ตฐ์š”.";
String content = card.getName()+" ์‚ฌ์šฉํ•ด ๋ณด์„ธ์š”!";
String moreInfo = dto.getLatitude()+", "+dto.getLongitude();
Announcement announcement = Announcement.builder()
Expand All @@ -351,7 +348,7 @@ public void postAnnounceFavorite(AnnounceFavoriteRequestDto dto, Users nowUser)
for ( FCMToken fcmToken : fcmTokens){

String token = fcmToken.getToken();
firebaseCloudMessageService.sendNotification(new AnnouncementRequestDto(token,title,content));
firebaseCloudMessageService.sendNotification(new AnnouncementRequestDto(token,title,content,announcement.getId().toString()));
}
}
public void postBeaconAnnouncement(BeaconRequestDto dto, Users nowUser)throws CustomException {
Expand All @@ -378,7 +375,7 @@ public void postBeaconAnnouncement(BeaconRequestDto dto, Users nowUser)throws Cu
throw new CustomException(ResponseCode.FAILED_TO_OPENAI_RECOMMEND);
}

String title = beacon.getStore()+" ๊ทผ์ฒ˜์‹œ๊ตฐ์š”";
String title = beacon.getStore()+" ๊ทผ์ฒ˜์‹œ๊ตฐ์š”.";
String content = card.getName()+" ์‚ฌ์šฉํ•ด ๋ณด์„ธ์š”!";
String contents = beacon.getStore()+" ๊ทผ์ฒ˜์‹œ๊ตฐ์š”.\n"+card.getName()+" ์‚ฌ์šฉํ•ด ๋ณด์„ธ์š”!";

Expand All @@ -393,7 +390,7 @@ public void postBeaconAnnouncement(BeaconRequestDto dto, Users nowUser)throws Cu
announcementRepository.save(announcement);
for ( FCMToken fcmToken : fcmTokens){
String token = fcmToken.getToken();
firebaseCloudMessageService.sendNotification(new AnnouncementRequestDto(token,title,content));
firebaseCloudMessageService.sendNotification(new AnnouncementRequestDto(token,title,content,announcement.getId().toString()));
}

}
Expand Down

0 comments on commit 9b4f03e

Please sign in to comment.