| | |
| | | package com.yeshi.buwan.service.imp; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | import com.yeshi.buwan.dao.CategoryContryDao; |
| | | import com.yeshi.buwan.domain.CategoryContry; |
| | | import com.yeshi.buwan.domain.DetailSystem; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | |
| | | @Service |
| | |
| | | private ClassService classService; |
| | | @Resource |
| | | private CategoryContryDao categoryContryDao; |
| | | |
| | | public CategoryContryDao getCategoryContryDao() { |
| | | return categoryContryDao; |
| | | } |
| | | |
| | | public void setCategoryContryDao(CategoryContryDao categoryContryDao) { |
| | | this.categoryContryDao = categoryContryDao; |
| | | } |
| | | |
| | | public ClassService getClassService() { |
| | | return classService; |
| | | } |
| | | |
| | | public void setClassService(ClassService classService) { |
| | | this.classService = classService; |
| | | } |
| | | |
| | | @Cacheable(value = "classCache", key = "'categoryContryList'+'-'+#cid") |
| | | public List<CategoryContry> categoryContryList(String cid) { |
| | |
| | | |
| | | List<VideoInfo> videoList = classService.getVideoInfoData( |
| | | session.createSQLQuery(sql).setFirstResult((page - 1) * pageCount) |
| | | .setMaxResults(pageCount).list()); |
| | | .setMaxResults(pageCount).list(),resourceList); |
| | | if (videoList != null) |
| | | for (int i = 0; i < videoList.size(); i++) { |
| | | if (!isContainsResource(resourceList, videoList.get(i).getResourceList())) { |
| | |
| | | } |
| | | } |
| | | System.out.println("列表数量:" + videoList.size()); |
| | | List<VideoInfo> newVideoList = new ArrayList<VideoInfo>(); |
| | | List<VideoInfo> newVideoList = new ArrayList<>(); |
| | | if (videoList.size() > 0) |
| | | newVideoList.addAll(videoList); |
| | | return newVideoList; |
| | |
| | | }); |
| | | } |
| | | |
| | | List<VideoInfo> list = new ArrayList<VideoInfo>(); |
| | | List<VideoInfo> list = new ArrayList<>(); |
| | | String sql = String.format( |
| | | "SELECT v.id,v.`name`,v.`tag`,v.`picture`,v.`hpicture`,v.`latest_hpicture`,v.watchcount,v.commentcount,temp.resources,v.`vpicture` FROM wk_video_video v LEFT JOIN wk_video_area_video_temp temp ON temp.`id`=v.`id` WHERE v.show=1 AND temp.`areas` LIKE '%s' AND temp.`typeid`=%s and v.id is not null %s", |
| | | "%" + areas + "%", type, orderby); |
| | | System.out.println(sql); |
| | | list = categoryContryDao.sqlList(sql, (page - 1) *pageCount, pageCount, null); |
| | | |
| | | List<VideoInfo> videoList = classService.getVideoInfoData(list); |
| | | List<VideoInfo> videoList = classService.getVideoInfoData(list,resourceList); |
| | | |
| | | if (videoList != null) |
| | | for (int i = 0; i < videoList.size(); i++) { |
| | |
| | | |
| | | System.out.println("列表数量:" + videoList.size()); |
| | | |
| | | List<VideoInfo> newVideoList = new ArrayList<VideoInfo>(); |
| | | List<VideoInfo> newVideoList = new ArrayList<>(); |
| | | if (videoList.size() > 0) |
| | | newVideoList.addAll(videoList); |
| | | return newVideoList; |
| | | } |
| | | |
| | | private boolean isContainsResource(List<Long> resourceList, List<VideoResource> relist) { |
| | | List<Long> targetList = new ArrayList<Long>(); |
| | | List<Long> targetList = new ArrayList<>(); |
| | | for (VideoResource vr : relist) |
| | | targetList.add(Long.parseLong(vr.getId())); |
| | | targetList.retainAll(resourceList); |