| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528 |
- package com.izouma.yags.service;
- import com.alibaba.fastjson.JSONArray;
- import com.alibaba.fastjson.JSONObject;
- import com.izouma.yags.config.Constants;
- import com.izouma.yags.domain.*;
- import com.izouma.yags.dto.PageQuery;
- import com.izouma.yags.dto.RecognitionResult;
- import com.izouma.yags.dto.RoomDetail;
- import com.izouma.yags.enums.JoinRoomStatus;
- import com.izouma.yags.enums.RoomStatus;
- import com.izouma.yags.enums.RoomType;
- import com.izouma.yags.exception.BusinessException;
- import com.izouma.yags.repo.*;
- import com.izouma.yags.utils.JpaUtils;
- import com.izouma.yags.utils.RecognizeUtil;
- import lombok.AllArgsConstructor;
- import org.apache.commons.collections.CollectionUtils;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.BeanUtils;
- import org.springframework.data.domain.Page;
- import org.springframework.data.domain.PageImpl;
- import org.springframework.data.domain.Pageable;
- import org.springframework.data.jpa.domain.Specification;
- import org.springframework.stereotype.Service;
- import org.springframework.web.multipart.MultipartFile;
- import javax.imageio.ImageIO;
- import javax.persistence.criteria.Predicate;
- import java.io.ByteArrayOutputStream;
- import java.io.IOException;
- import java.math.BigDecimal;
- import java.net.URL;
- import java.time.LocalDateTime;
- import java.util.*;
- import java.util.regex.Pattern;
- import java.util.stream.Collectors;
- @Service
- @AllArgsConstructor
- public class RoomService {
- private RoomRepo roomRepo;
- private GameRepo gameRepo;
- private GameModeRepo gameModeRepo;
- private GameMapRepo gameMapRepo;
- private UserTicketRepo userTicketRepo;
- private JoinRoomRepo joinRoomRepo;
- private UserRepo userRepo;
- private UserBalanceService userBalanceService;
- private BindGameRepo bindGameRepo;
- private TicketConfigRepo ticketConfigRepo;
- public Page<Room> all(PageQuery pageQuery) {
- return roomRepo.findAll(JpaUtils.toSpecification(pageQuery, Room.class), JpaUtils.toPageRequest(pageQuery));
- }
- public Room createRoom(Long userId, Long gameId, Long modeId, Long mapId, Long ticketId, String url, String password, String zone) {
- if (StringUtils.isBlank(password)) {
- password = null;
- }
- UserTicket ticket = userTicketRepo.findById(ticketId).orElseThrow(new BusinessException("通行证无记录"));
- if (ticket.getExpireAt().isBefore(LocalDateTime.now())) {
- throw new BusinessException("通行证已过期");
- }
- if (ticket.isUsed()) {
- throw new BusinessException("通行证已使用");
- }
- TicketConfig ticketConfig = ticketConfigRepo.findByType(ticket.getType()).orElseThrow(new BusinessException("无记录"));
- Game game = gameRepo.findById(gameId).orElseThrow(new BusinessException("游戏无记录"));
- GameMode mode = gameModeRepo.findById(modeId).orElseThrow(new BusinessException("模式无记录"));
- GameMap map = gameMapRepo.findById(mapId).orElseThrow(new BusinessException("地图无记录"));
- BindGame bindGame = bindGameRepo.findByUserIdAndGameIdAndZoneAndActive(userId, gameId, zone, true)
- .orElseThrow(new BusinessException("请先绑定游戏"));
- Room room = Room.builder()
- .name(mode.getName() + " " + map.getName())
- .status(RoomStatus.WAITING)
- .userId(userId)
- .gameId(gameId)
- .gameModeId(modeId)
- .gameMapId(mapId)
- .type(RoomType.USER)
- .requireTicket(ticket.getType())
- .minPlayerNum(Optional.ofNullable(map.getMinPlayerNum()).orElse(mode.getMinPlayerNum()))
- .maxPlayerNum(Optional.ofNullable(map.getMaxPlayerNum()).orElse(mode.getMaxPlayerNum()))
- .bonus(ticketConfig.getBonus())
- .url(url)
- .password(password)
- .zone(zone)
- .needAudit(mode.isNeedAudit())
- .build();
- room = roomRepo.save(room);
- JoinRoom joinRoom = joinRoomRepo.save(JoinRoom.builder()
- .userId(userId)
- .roomId(room.getId())
- .gameId(gameId)
- .modeId(modeId)
- .mapId(mapId)
- .ticketId(ticketId)
- .host(true)
- .joinAt(LocalDateTime.now())
- .status(JoinRoomStatus.WAITING)
- .team("host")
- // .gameNickname(Optional.ofNullable(bindGame).map(BindGame::getNickname).orElse(null))
- .build());
- ticket.setUsed(true);
- ticket.setUsedAt(LocalDateTime.now());
- ticket.setRoomId(room.getId());
- userTicketRepo.save(ticket);
- return room;
- }
- public void changeUrl(Long userId, Long roomId, String url) {
- Room room = roomRepo.findById(roomId).orElseThrow(new BusinessException("房间无记录"));
- if (!room.getUserId().equals(userId)) {
- throw new BusinessException("无权限");
- }
- room.setUrl(url);
- roomRepo.save(room);
- }
- public JoinRoom joinRoom(Long userId, Long roomId, Long ticketId, String password) {
- Room room = roomRepo.findById(roomId).orElseThrow(new BusinessException("房间无记录"));
- UserTicket ticket = userTicketRepo.findById(ticketId).orElseThrow(new BusinessException("通行证无记录"));
- if (room.getStatus() != RoomStatus.WAITING) {
- throw new BusinessException("报名已结束");
- }
- if (StringUtils.isNotBlank(room.getPassword()) && !room.getPassword().equals(password)) {
- throw new BusinessException("密码错误");
- }
- if (!ticket.getUserId().equals(userId)) {
- throw new BusinessException("通行证无效");
- }
- if (ticket.getExpireAt().isBefore(LocalDateTime.now())) {
- throw new BusinessException("通行证已过期");
- }
- if (ticket.isUsed()) {
- throw new BusinessException("通行证已使用");
- }
- if (room.getRequireTicket() != ticket.getType()) {
- throw new BusinessException("通行证类型不符");
- }
- List<JoinRoom> joinRoomList = joinRoomRepo.findByRoomIdAndStatus(roomId, JoinRoomStatus.WAITING);
- if (joinRoomList.size() >= room.getMaxPlayerNum()) {
- throw new BusinessException("人数已满");
- }
- if (joinRoomList.stream().anyMatch(j -> j.getUserId().equals(userId))) {
- throw new BusinessException("请勿重加入");
- }
- Map<String, Long> teamCounting = joinRoomList.stream()
- .collect(Collectors.groupingBy(JoinRoom::getTeam, Collectors.counting()));
- teamCounting.putIfAbsent("guest", 0L);
- String team = teamCounting.entrySet().stream().min(Comparator.comparingLong(Map.Entry::getValue))
- .map(Map.Entry::getKey).orElse("host");
- JoinRoom joinRoom = joinRoomRepo.save(JoinRoom.builder()
- .userId(userId)
- .roomId(roomId)
- .gameId(room.getGameId())
- .modeId(room.getGameModeId())
- .mapId(room.getGameMapId())
- .ticketId(ticketId)
- .host(false)
- .joinAt(LocalDateTime.now())
- .status(JoinRoomStatus.WAITING)
- .team(team)
- .build());
- ticket.setUsed(true);
- ticket.setUsedAt(LocalDateTime.now());
- ticket.setRoomId(roomId);
- userTicketRepo.save(ticket);
- return joinRoom;
- }
- public void startGame(Long userId, Long roomId) {
- Room room = roomRepo.findById(roomId).orElseThrow(new BusinessException("房间无记录"));
- if (!room.getUserId().equals(userId)) {
- throw new BusinessException("无权限");
- }
- if (room.getStatus() != RoomStatus.WAITING) {
- throw new BusinessException("游戏已开始");
- }
- List<JoinRoom> joinRoomList = joinRoomRepo.findByRoomIdAndStatus(roomId, JoinRoomStatus.WAITING);
- if (room.getMinPlayerNum() > joinRoomList.size()) {
- throw new BusinessException("人数不足");
- }
- Map<String, Long> teamCounting = joinRoomList.stream()
- .collect(Collectors.groupingBy(JoinRoom::getTeam, Collectors.counting()));
- if (teamCounting.values().stream().distinct().count() != 1) {
- throw new BusinessException("团队人数不一致");
- }
- room.setStatus(RoomStatus.GAMING);
- room.setStartAt(LocalDateTime.now());
- roomRepo.save(room);
- joinRoomList.parallelStream().forEach(j -> {
- j.setStatus(JoinRoomStatus.GAMING);
- joinRoomRepo.save(j);
- });
- }
- public void quit(Long userId, Long roomId) {
- JoinRoom joinRoom = joinRoomRepo.findFirstByRoomIdAndUserId(roomId, userId)
- .orElseThrow(new BusinessException("没有报名"));
- if (joinRoom.getStatus() != JoinRoomStatus.WAITING) {
- throw new BusinessException("当前状态无法退出");
- }
- joinRoomRepo.delete(joinRoom);
- }
- public void changeTeam(Long userId, Long roomId, String team) {
- JoinRoom joinRoom = joinRoomRepo.findFirstByRoomIdAndUserId(roomId, userId)
- .orElseThrow(new BusinessException("没有报名"));
- if (joinRoom.getStatus() != JoinRoomStatus.WAITING) {
- throw new BusinessException("当前状态无法更改团队");
- }
- if (joinRoom.getTeam().equals(team)) {
- return;
- }
- List<JoinRoom> joinRoomList = joinRoomRepo.findByRoomIdAndStatus(roomId, JoinRoomStatus.WAITING);
- Room room = roomRepo.findById(roomId).orElseThrow(new BusinessException("房间无记录"));
- if (room.getMaxPlayerNum() / 2 >= joinRoomList.size()) {
- throw new BusinessException("人数已满");
- }
- joinRoom.setTeam(team);
- joinRoomRepo.save(joinRoom);
- }
- public void cancel(Long userId, Long roomId) {
- Room room = roomRepo.findById(roomId).orElseThrow(new BusinessException("房间无记录"));
- if (!room.getUserId().equals(userId)) {
- throw new BusinessException("无权限");
- }
- if (room.getStatus() != RoomStatus.WAITING) {
- throw new BusinessException("游戏已开始");
- }
- List<JoinRoom> joinRoomList = joinRoomRepo.findByRoomIdAndStatus(roomId, JoinRoomStatus.WAITING);
- joinRoomList.forEach(j -> {
- j.setStatus(JoinRoomStatus.CANCELLED);
- joinRoomRepo.save(j);
- userTicketRepo.findById(j.getTicketId()).ifPresent(t -> {
- t.setUsed(false);
- t.setUsedAt(null);
- t.setRoomId(null);
- userTicketRepo.save(t);
- });
- });
- room.setStatus(RoomStatus.CANCELLED);
- room.setCancelAt(LocalDateTime.now());
- roomRepo.save(room);
- }
- public void uploadResult(Long userId, Long roomId, String screenShot, MultipartFile file) throws IOException {
- Room room = roomRepo.findById(roomId).orElseThrow(new BusinessException("房间无记录"));
- if (LocalDateTime.now().isBefore(room.getStartAt().plusMinutes(10))) {
- throw new BusinessException("比赛时间过短:10分钟");
- }
- if (room.isNeedAudit()) {
- if (!(room.getStatus() == RoomStatus.GAMING || room.getStatus() == RoomStatus.AUDIT)) {
- throw new BusinessException("当前房间状态无法上传截图");
- }
- JoinRoom joinRoom = joinRoomRepo.findFirstByRoomIdAndUserId(roomId, userId).orElseThrow(new BusinessException("无记录"));
- joinRoom.setScreenShot(screenShot);
- joinRoomRepo.save(joinRoom);
- room.setStatus(RoomStatus.AUDIT);
- roomRepo.save(room);
- } else {
- GameMode gameMode = gameModeRepo.findById(room.getGameModeId()).orElseThrow(new BusinessException("游戏模式无记录"));
- if (room.getStatus() != RoomStatus.GAMING) {
- throw new BusinessException("当前房间状态无法上传截图");
- }
- boolean win = false;
- String mode = null;
- String format;
- if (Pattern.matches(".*\\.(jpg|jpeg)", screenShot.toLowerCase())) {
- format = "jpg";
- } else if (Pattern.matches(".*\\.png", screenShot.toLowerCase())) {
- format = "png";
- } else if (Pattern.matches(".*\\.bmp", screenShot.toLowerCase())) {
- format = "bmp";
- } else {
- throw new BusinessException("截图格式不正确");
- }
- JSONObject res;
- try {
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- ImageIO.write(ImageIO.read(new URL(screenShot)), format, os);
- res = RecognizeUtil.recognize1(os.toByteArray());
- } catch (Exception e) {
- e.printStackTrace();
- throw new BusinessException("图片识别失败");
- }
- JSONArray results = res.getJSONArray("results");
- for (int i = 0; i < results.size(); i++) {
- JSONObject json = results.getJSONObject(i);
- String name = json.getString("label");
- double score = json.getDouble("confidence");
- if ("胜利".equals(name) && score > 0.8) {
- win = true;
- }
- if (score > 0.8 && ("1v1".equals(name) || "2v2".equals(name) || "3v3".equals(name) || "5v5".equals(name))) {
- mode = name;
- }
- }
- if (!win) {
- JoinRoom j = joinRoomRepo.findFirstByRoomIdAndUserId(roomId, userId).orElseThrow(new BusinessException("无记录"));
- j.setScreenShot(screenShot);
- joinRoomRepo.save(j);
- return;
- // throw new BusinessException("失败方无需上传截图");
- }
- if (!gameMode.getName().equals(mode)) {
- throw new BusinessException("游戏模式不一致");
- }
- List<JoinRoom> joinRoomList = joinRoomRepo.findByRoomIdAndStatus(roomId, JoinRoomStatus.GAMING);
- JoinRoom joinRoom = (JoinRoom) CollectionUtils.find(joinRoomList, j -> ((JoinRoom) j).getUserId().equals(userId));
- if (joinRoom == null) {
- throw new BusinessException("数据错误");
- }
- joinRoom.setScreenShot(screenShot);
- joinRoomList.forEach(j -> {
- j.setStatus(j.getTeam().equals(joinRoom.getTeam()) ? JoinRoomStatus.WIN : JoinRoomStatus.LOSE);
- j.setFinishAt(LocalDateTime.now());
- joinRoomRepo.save(j);
- if (j.getTeam().equals(joinRoom.getTeam())) {
- userBalanceService.modifyBalance(j.getUserId(), room.getBonus(), Constants.BalanceDesc.BONUS);
- }
- });
- room.setWinTeam(joinRoom.getTeam());
- room.setStatus(RoomStatus.FINISH);
- room.setFinishAt(LocalDateTime.now());
- room.setWinner(joinRoomList.stream().filter(j -> j.getTeam().equals(joinRoom.getTeam()))
- .map(JoinRoom::getUserId).collect(Collectors.toList()));
- roomRepo.save(room);
- }
- }
- public void uploadResultNew(Long userId, Long roomId, String screenShot) throws Exception {
- Room room = roomRepo.findById(roomId).orElseThrow(new BusinessException("房间无记录"));
- if (LocalDateTime.now().isBefore(room.getStartAt().plusMinutes(10))) {
- throw new BusinessException("比赛时间过短:10分钟");
- }
- JoinRoom joinRoom = joinRoomRepo.findFirstByRoomIdAndUserId(roomId, userId).orElseThrow(new BusinessException("无记录"));
- if (!(room.getStatus() == RoomStatus.GAMING || room.getStatus() == RoomStatus.AUDIT)) {
- throw new BusinessException("当前房间状态无法上传截图");
- }
- String format;
- if (Pattern.matches(".*\\.(jpg|jpeg)", screenShot.toLowerCase())) {
- format = "jpg";
- } else if (Pattern.matches(".*\\.png", screenShot.toLowerCase())) {
- format = "png";
- } else if (Pattern.matches(".*\\.bmp", screenShot.toLowerCase())) {
- format = "bmp";
- } else {
- throw new BusinessException("截图格式不正确");
- }
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- ImageIO.write(ImageIO.read(new URL(screenShot)), format, os);
- RecognitionResult recognitionResult = RecognizeUtil.recognize2(os.toByteArray());
- joinRoom.setScreenShot(screenShot);
- joinRoom.setRecognitionResult(recognitionResult);
- joinRoomRepo.save(joinRoom);
- room.setStatus(RoomStatus.AUDIT);
- if (room.getEndAt() == null) {
- room.setEndAt(LocalDateTime.now());
- }
- roomRepo.save(room);
- }
- public RoomDetail detail(Long id, boolean players) {
- Room room = roomRepo.findById(id).orElseThrow(new BusinessException("房间无记录"));
- return detail(room, players);
- }
- public RoomDetail detail(Room room, boolean players) {
- List<JoinRoom> joinRoomList = joinRoomRepo.findByRoomIdAndStatusNotIn(room.getId(),
- Arrays.asList(JoinRoomStatus.KICKED_OUT, JoinRoomStatus.QUIT));
- RoomDetail detail = new RoomDetail();
- BeanUtils.copyProperties(room, detail);
- Arrays.asList(1, 2, 3).parallelStream().forEach(i -> {
- switch (i) {
- case 1:
- detail.setGame(gameRepo.findById(room.getGameId()).orElse(null));
- break;
- case 2:
- detail.setGameMap(gameMapRepo.findById(room.getGameMapId()).orElse(null));
- break;
- case 3:
- detail.setGameMode(gameModeRepo.findById(room.getGameModeId()).orElse(null));
- break;
- }
- });
- detail.setHost(userRepo.findById(room.getUserId()).map(user -> {
- RoomDetail.Player player = new RoomDetail.Player();
- player.setUserId(user.getId());
- player.setNickname(user.getNickname());
- player.setAvatar(user.getAvatar());
- player.setHost(true);
- return player;
- }).orElse(null));
- if (players) {
- detail.setPlayers(userRepo.findAllById(joinRoomList.stream()
- .map(JoinRoom::getUserId).collect(Collectors.toList()))
- .stream().map(user -> {
- RoomDetail.Player player = new RoomDetail.Player();
- player.setUserId(user.getId());
- player.setNickname(user.getNickname());
- player.setAvatar(user.getAvatar());
- player.setHost(user.getId().equals(room.getUserId()));
- JoinRoom joinRoom = (JoinRoom) (CollectionUtils.find(joinRoomList,
- j -> ((JoinRoom) j).getUserId().equals(user.getId())));
- player.setTeam(joinRoom.getTeam());
- player.setScreenShot(joinRoom.getScreenShot());
- return player;
- }).collect(Collectors.toList()));
- }
- return detail;
- }
- public Page<RoomDetail> roomList(Long id, Long gameId, Long modeId, Long mapId, List<RoomStatus> status, String zone, Pageable pageable) {
- Page<Room> page = roomRepo.findAll((Specification<Room>) (root, query, criteriaBuilder) -> {
- List<Predicate> and = new ArrayList<>();
- if (id != null) {
- and.add(criteriaBuilder.equal(root.get("id"), id));
- }
- if (gameId != null) {
- and.add(criteriaBuilder.equal(root.get("gameId"), gameId));
- }
- if (modeId != null) {
- and.add(criteriaBuilder.equal(root.get("gameModeId"), modeId));
- }
- if (mapId != null) {
- and.add(criteriaBuilder.equal(root.get("gameMapId"), mapId));
- }
- if (status != null && !status.isEmpty()) {
- and.add(root.get("status").in(status));
- }
- if (zone != null) {
- and.add(criteriaBuilder.equal(root.get("zone"), zone));
- }
- return criteriaBuilder.and(and.toArray(new Predicate[0]));
- }, pageable);
- return new PageImpl<>(page.stream().parallel()
- .map(room -> detail(room, true))
- .collect(Collectors.toList()),
- page.getPageable(), page.getTotalElements());
- }
- public Page<Room> my(Long userId, Pageable pageable) {
- return joinRoomRepo.findByUserId(userId, pageable).map(j -> {
- Room room = roomRepo.findById(j.getRoomId()).orElse(null);
- if (room == null) {
- return null;
- }
- return detail(room, true);
- });
- }
- public void judge(Long roomId, String team) {
- Room room = roomRepo.findById(roomId).orElseThrow(new BusinessException("房间无记录"));
- if (room.getStatus() != RoomStatus.AUDIT) {
- throw new BusinessException("房间状态不正确");
- }
- List<JoinRoom> joinRoomList = joinRoomRepo.findByRoomIdAndStatusNotIn(room.getId(),
- Arrays.asList(JoinRoomStatus.KICKED_OUT, JoinRoomStatus.QUIT));
- for (JoinRoom j : joinRoomList) {
- j.setFinishAt(LocalDateTime.now());
- if (j.getTeam().equals(team)) {
- j.setStatus(JoinRoomStatus.WIN);
- userBalanceService.modifyBalance(j.getUserId(), room.getBonus(), Constants.BalanceDesc.BONUS);
- } else {
- j.setStatus(JoinRoomStatus.LOSE);
- }
- joinRoomRepo.save(j);
- }
- room.setWinTeam(team);
- room.setStatus(RoomStatus.FINISH);
- room.setFinishAt(LocalDateTime.now());
- room.setWinner(joinRoomList.stream().filter(j -> j.getTeam().equals(team))
- .map(JoinRoom::getUserId).collect(Collectors.toList()));
- roomRepo.save(room);
- }
- public void changeJudge(Long roomId, String team) {
- Room room = roomRepo.findById(roomId).orElseThrow(new BusinessException("房间无记录"));
- if (room.getStatus() != RoomStatus.FINISH) {
- throw new BusinessException("房间状态不正确");
- }
- List<JoinRoom> joinRoomList = joinRoomRepo.findByRoomIdAndStatusNotIn(room.getId(),
- Arrays.asList(JoinRoomStatus.KICKED_OUT, JoinRoomStatus.QUIT));
- String currentWinTeam = joinRoomList.stream().filter(j -> j.getStatus() == JoinRoomStatus.WIN)
- .findAny().map(JoinRoom::getTeam).orElseThrow(new BusinessException("没有胜利的队伍"));
- if (currentWinTeam.equals(team)) {
- throw new BusinessException("当前队伍已经是胜利的队伍");
- }
- for (JoinRoom j : joinRoomList) {
- j.setFinishAt(LocalDateTime.now());
- if (j.getTeam().equals(team)) {
- j.setStatus(JoinRoomStatus.WIN);
- userBalanceService.modifyBalance(j.getUserId(), room.getBonus(), Constants.BalanceDesc.BONUS);
- // userBalanceService.modifyBalance(j.getUserId(), room.getBonus().multiply(new BigDecimal("0.25")),
- // Constants.BalanceDesc.COMPENSATION);
- } else {
- j.setStatus(JoinRoomStatus.LOSE);
- userBalanceService.modifyBalance(j.getUserId(), room.getBonus().negate(), Constants.BalanceDesc.RETURN);
- userBalanceService.modifyBalance(j.getUserId(), room.getBonus().multiply(new BigDecimal("0.25")).negate(),
- Constants.BalanceDesc.PUNISH);
- }
- joinRoomRepo.save(j);
- }
- room.setStatus(RoomStatus.FINISH);
- room.setFinishAt(LocalDateTime.now());
- room.setWinner(joinRoomList.stream().filter(j -> j.getTeam().equals(team))
- .map(JoinRoom::getUserId).collect(Collectors.toList()));
- roomRepo.save(room);
- }
- }
|