Drew 6 роки тому
батько
коміт
c6f92db396

+ 3 - 4
src/main/java/com/izouma/ticketExchange/service/TppService.java

@@ -120,7 +120,6 @@ public class TppService {
 
     public void syncLocationAndShow() {
         Set<Show> allShows = new HashSet<>();
-        List<Location> locationList = new ArrayList<>();
         getLocations().forEach(region -> {
             Location location = Location.builder()
                                         .id(region.getId())
@@ -160,10 +159,10 @@ public class TppService {
                 allShows.add(show);
             });
             location.setShows(new ArrayList<>(showSet));
-            locationList.add(location);
+
+            showRepo.saveAll(allShows);
+            locationRepo.save(location);
         });
-        showRepo.saveAll(allShows);
-        locationRepo.saveAll(locationList);
     }
 
     public List<FilmDataThirdPartyCinemasGetResponse.MtopCinema> getCinemas(Integer page) {