src/main/java/com/yeshi/buwan/service/imp/HomeTypeService.java
@@ -6,8 +6,10 @@
import javax.annotation.Resource;
import com.yeshi.buwan.dao.*;
import com.yeshi.buwan.dao.system.DetailSystemDao;
import com.yeshi.buwan.domain.*;
import com.yeshi.buwan.service.inter.VideoResourceMapExtraInfoService;
import com.yeshi.buwan.domain.system.DetailSystem;
import com.yeshi.buwan.service.inter.video.VideoInfoExtraService;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.springframework.cache.annotation.Cacheable;
@@ -33,7 +35,7 @@
    private DetailSystemDao detailSystemDao;
    @Resource
    private VideoResourceMapExtraInfoService videoResourceMapExtraInfoService;
    private VideoInfoExtraService videoInfoExtraService;
    public List<HomeType> getHomeTypeDetailList() {
        List<HomeType> list = homeTypeDao.list("from HomeType h order by h.orderby desc");
@@ -97,7 +99,7 @@
                                video.setHpicture(obj[16] + "");
                                video.setLatestHpicture(obj[17] + "");
                                video.setWatchCount(obj[18] + "");
                                video.setCommentCount(Integer.parseInt(obj[19] + ""));
                                video.setCommentCount(obj[19] != null ? Integer.parseInt(obj[19] + "") : 0);
                                ht.setIcon(obj[20] + "");
                                hv.setVideo(video);
@@ -106,10 +108,15 @@
                                // hv.getVideo().getName());
                                // 更改图片显示
                                //如果为竖版
                                if (ht.getColumns() == 2) {
                                if (!StringUtil.isNullOrEmpty(hv.getVideo().getLatestHpicture()))
                                    hv.getVideo().setPicture(hv.getVideo().getLatestHpicture());
                                else
                                    hv.getVideo().setPicture(hv.getVideo().getHpicture());
                                } else {
//                                    hv.getVideo().setPicture(hv.getVideo().getVpicture());
                                }
                                if (StringUtil.isNullOrEmpty(hv.getPicture()))
                                    hv.setPicture(hv.getVideo().getPicture());
@@ -155,28 +162,16 @@
            }
        });
        List<String> videoIdList = new ArrayList<>();
        List<VideoInfo> videoInfoList = new ArrayList<>();
        for (HomeType ht : homeTypeList) {
            if (ht.getHomeVideoList() != null)
                for (HomeVideo hv : ht.getHomeVideoList()) {
                    if (hv.getVideo() != null)
                        videoIdList.add(hv.getVideo().getId());
                        videoInfoList.add(hv.getVideo());
                }
        }
        Map<String, VideoResourceMapExtraInfo> videoMap = videoResourceMapExtraInfoService.listMap(videoIdList, resourceIds);
        for (HomeType ht : homeTypeList) {
            if (ht.getHomeVideoList() != null)
                for (HomeVideo hv : ht.getHomeVideoList()) {
                    if (hv.getVideo() != null) {
                        hv.getVideo().setVideoResourceMapExtraInfo(videoMap.get(hv.getVideo().getId()));
                        if (hv.getVideo().getVideoResourceMapExtraInfo() != null)
                            hv.getVideo().setFree(hv.getVideo().getVideoResourceMapExtraInfo().getFree());
                    }
                }
        }
        videoInfoExtraService.batchExtra(videoInfoList, resourceIds);
        return homeTypeList;
    }