Drew vor 6 Jahren
Ursprung
Commit
34e889effe
1 geänderte Dateien mit 2 neuen und 19 gelöschten Zeilen
  1. 2 19
      src/main/java/com/izouma/ticketExchange/service/TppService.java

+ 2 - 19
src/main/java/com/izouma/ticketExchange/service/TppService.java

@@ -100,7 +100,6 @@ public class TppService {
     }
 
     public List<FilmDataThirdPartyHotshowsGetResponse.Show> getHotShows(Long cityCode) {
-        Location location = locationRepo.findByCityCode(cityCode).orElseThrow(new BusinessException("无记录"));
         FilmDataThirdPartyHotshowsGetRequest req = new FilmDataThirdPartyHotshowsGetRequest();
         req.setUserId(tbUserId);
         req.setCityCode(cityCode);
@@ -110,22 +109,6 @@ public class TppService {
         try {
             rsp = client.execute(req);
             if (rsp.getResult() != null && rsp.getResult().getReturnCode().equals("0")) {
-                List<Show> showList = new ArrayList<>();
-                Gson gson = new Gson();
-                rsp.getResult().getReturnValue().getHotShows().forEach(hotShow -> {
-                    Show show = gson.fromJson(gson.toJson(hotShow), Show.class);
-                    if (StringUtils.isNotEmpty(hotShow.getBackgroundPicture())) {
-                        show.setBackground(imagePrefix + hotShow.getBackgroundPicture());
-                    }
-                    show.setPoster(imagePrefix + show.getPoster());
-                    if (show.getTrailerList() != null) {
-                        show.setTrailerList(show.getTrailerList().stream().map(s -> imagePrefix + s).collect(Collectors.toList()));
-                    }
-                    showList.add(show);
-                });
-                showRepo.saveAll(showList);
-                location.setShows(showList);
-                locationRepo.save(location);
                 return rsp.getResult().getReturnValue().getHotShows();
             }
             log.error("获取热映影片失败\n\t{}", rsp.getBody());
@@ -148,8 +131,8 @@ public class TppService {
                                         .pinYin(region.getPinYin())
                                         .hot(false)
                                         .build();
-            List<FilmDataThirdPartySoonshowsGetResponse.Show> soonShows = getSoonShows(location.getId());
-            List<FilmDataThirdPartyHotshowsGetResponse.Show> hotShows = getHotShows(location.getId());
+            List<FilmDataThirdPartySoonshowsGetResponse.Show> soonShows = getSoonShows(location.getCityCode());
+            List<FilmDataThirdPartyHotshowsGetResponse.Show> hotShows = getHotShows(location.getCityCode());
             Set<Show> showSet = new HashSet<>();
             Gson gson = new Gson();
             soonShows.forEach(soonShow -> {