Skip to content

Commit

Permalink
Merge pull request #104 from FinalDoubleTen/BE-66-Refactor-STOMP
Browse files Browse the repository at this point in the history
Refactor : TripPlace 정렬 추가
  • Loading branch information
Kim-Dong-Jun99 authored Jan 18, 2024
2 parents 462a4c2 + c2d344a commit b127652
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void registerStompEndpoints(StompEndpointRegistry endpointRegistry) {
@Override
public void configureMessageBroker(MessageBrokerRegistry brokerRegistry) {
brokerRegistry.setApplicationDestinationPrefixes("/pub");
brokerRegistry.enableSimpleBroker("/sub").setHeartbeatValue(new long[]{1000, 1000}).setTaskScheduler(taskScheduler());
brokerRegistry.enableSimpleBroker("/sub").setHeartbeatValue(new long[]{10000, 10000}).setTaskScheduler(taskScheduler());

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ public record TripPlace(
Long price
) {
public static List<TripPlace> fromTripItems(List<TripItem> tripItems) {
return tripItems.stream().map(t -> new TripPlace(t.getId(), t.getSeqNum(), t.getTourItem().getLongitude(), t.getTourItem().getLatitude(), t.getPrice())).toList();
List<TripPlace> list = new java.util.ArrayList<>(tripItems.stream().map(t -> new TripPlace(t.getId(), t.getSeqNum(), t.getTourItem().getLongitude(), t.getTourItem().getLatitude(), t.getPrice())).toList());
list.sort((a, b) -> {
if (!a.seqNum().equals(b.seqNum())) {

return Integer.parseInt(Long.toString(a.seqNum() - b.seqNum()));
}
return Integer.parseInt(Long.toString(a.tripItemId() - b.tripItemId()));
});
return list;
}
}

0 comments on commit b127652

Please sign in to comment.