| | |
| | | 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; |
| | |
| | | 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"); |
| | |
| | | return getHomeType(list); |
| | | } |
| | | |
| | | public List<HomeType> getHomeTypeList(String systemId){ |
| | | List<HomeType> list = homeTypeDao.list("from HomeType h where h.system.id=? order by h.orderby desc",systemId); |
| | | public List<HomeType> getHomeTypeList(String systemId) { |
| | | List<HomeType> list = homeTypeDao.list("from HomeType h where h.system.id=? order by h.orderby desc", systemId); |
| | | return list; |
| | | } |
| | | |
| | |
| | | resourceWhere = resourceWhere.substring(0, resourceWhere.length() - 2); |
| | | List resultList = session |
| | | .createSQLQuery( |
| | | "SELECT ht.`id` as htid,ht.`name` as htname,ht.`columns` as htcolumns ,ht.`hasmore`,ht.`activity` ,ht.`params` ,ht.`ioscontrol`,ht.number,hvideo.id as hvid,hvideo.`videoid` AS hvvideoid,hvideo.`picture`as hvpicture ,hvideo.`tag` as hvtag, v.`id` as vid ,v.`picture` as vpicture ,v.`name` as vname ,v.`tag` as vtag ,v.`hpicture` as vhpicture ,v.`latest_hpicture` as vlatest_hpicture ,v.`watchcount` as vwatchcount,v.commentcount,ht.icon as hicon,ht.orderby as htorder,hvideo.orderby as hvorder FROM (SELECT hv.* FROM `wk_resource_video` rv LEFT JOIN `wk_video_homevideo` hv ON rv.`videoid` =hv.`videoid` LEFT JOIN `wk_video_video` v ON v.`id` =hv.`videoid` LEFT JOIN `wk_video_banquan_video` bv ON bv.`videoid`=hv.`videoid` AND bv.`detailsystemid`=" |
| | | "SELECT ht.`id` as htid,ht.`name` as htname,ht.`columns` as htcolumns ,ht.`hasmore`,ht.`activity` ,ht.`params` ,ht.`ioscontrol`,ht.number,hvideo.id as hvid,hvideo.`videoid` AS hvvideoid,hvideo.`picture`as hvpicture ,hvideo.`tag` as hvtag, v.`id` as vid ,v.`picture` as vpicture ,v.`name` as vname ,v.`tag` as vtag ,v.`hpicture` as vhpicture ,v.`latest_hpicture` as vlatest_hpicture ,v.`watchcount` as vwatchcount,v.commentcount,ht.icon as hicon,ht.orderby as htorder,hvideo.orderby as hvorder,need_ad FROM (SELECT hv.* FROM `wk_resource_video` rv LEFT JOIN `wk_video_homevideo` hv ON rv.`videoid` =hv.`videoid` LEFT JOIN `wk_video_video` v ON v.`id` =hv.`videoid` LEFT JOIN `wk_video_banquan_video` bv ON bv.`videoid`=hv.`videoid` AND bv.`detailsystemid`=" |
| | | + detailSystem |
| | | + " AND bv.`show`=1 LEFT JOIN `wk_video_hometype` ht ON ht.id=hv.hometype WHERE (hv.`id`>0 AND v.`show` =1 AND ht.vtid='" |
| | | + vtid + "' AND (" + resourceWhere |
| | |
| | | ht.setNumber(Integer.parseInt(obj[7] + "")); |
| | | |
| | | ht.setOrderby(obj[21] + ""); |
| | | ht.setNeedAd(Boolean.parseBoolean(obj[23]+"")); |
| | | |
| | | HomeVideo hv = new HomeVideo(); |
| | | hv.setId(obj[8] + ""); |
| | |
| | | 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); |
| | |
| | | // hv.getVideo().getName()); |
| | | |
| | | // 更改图片显示 |
| | | if (!StringUtil.isNullOrEmpty(hv.getVideo().getLatestHpicture())) |
| | | hv.getVideo().setPicture(hv.getVideo().getLatestHpicture()); |
| | | else |
| | | hv.getVideo().setPicture(hv.getVideo().getHpicture()); |
| | | //如果为竖版 |
| | | 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()); |
| | |
| | | |
| | | } |
| | | }); |
| | | 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; |
| | | } |
| | | |
| | |
| | | for (HomeVideo sp : homeVideoList) |
| | | session.delete(sp); |
| | | |
| | | session.delete(session.get(HomeType.class,id)); |
| | | session.delete(session.get(HomeType.class, id)); |
| | | session.flush(); |
| | | session.getTransaction().commit(); |
| | | } catch (Exception e) { |
| | |
| | | |
| | | } |
| | | |
| | | public long getHomeTypeAdminCount(String key, String systemId,int detailSystem) { |
| | | public long getHomeTypeAdminCount(String key, String systemId, int detailSystem) { |
| | | String sql = ""; |
| | | if (detailSystem > 0) |
| | | sql = "select count(*) from (select count(*) from wk_video_super_hometype zb left join wk_video_hometype c on c.id=zb.hometypeid where zb.detailsystemid=" |
| | | + detailSystem + " and c.name like '%" + key + "%' group by zb.hometypeid) s"; |
| | | else |
| | | sql = "select count(*) from (select count(*) from wk_video_super_hometype zb left join wk_video_hometype c on c.id=zb.hometypeid where c.name like '%" |
| | | + key + "%' and c.system="+systemId+" group by zb.hometypeid) s"; |
| | | + key + "%' and c.system=" + systemId + " group by zb.hometypeid) s"; |
| | | |
| | | return homeTypeDao.getCountSQL(sql); |
| | | } |