| | |
| | | import com.yeshi.buwan.domain.ad.CommonAdPositionAd; |
| | | import com.yeshi.buwan.domain.recommend.CategoryRecommendVideo; |
| | | import com.yeshi.buwan.domain.special.Special; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.dto.search.SolrResultDTO; |
| | | import com.yeshi.buwan.dto.search.SolrVideoSearchFilter; |
| | | import com.yeshi.buwan.pptv.PPTVUtil; |
| | | import com.yeshi.buwan.service.imp.*; |
| | | import com.yeshi.buwan.service.imp.recommend.CategoryRecommendVideoService; |
| | | import com.yeshi.buwan.service.manager.SolrAlbumVideoDataManager; |
| | | import com.yeshi.buwan.service.manager.SolrCommonVideoDataManager; |
| | | import com.yeshi.buwan.util.*; |
| | | import com.yeshi.buwan.util.JuHe.VideoResourceUtil; |
| | | import com.yeshi.buwan.util.ad.CommonAdUtil; |
| | | import com.yeshi.buwan.util.annotation.RequireUid; |
| | | import com.yeshi.buwan.util.video.VideoConstant; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.vo.HomeClassVO; |
| | | import com.yeshi.buwan.vo.video.VideoListResultVO; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.PrintWriter; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | @Controller |
| | | public class ClassParser { |
| | |
| | | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | @Resource |
| | | private SolrAlbumVideoDataManager solrAlbumVideoDataManager; |
| | | |
| | | @Resource |
| | | private SearchService searchService; |
| | | |
| | | @RequireUid |
| | | public void getClass(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | |
| | | } |
| | | } |
| | | |
| | | // if (acceptData.getPlatform().equalsIgnoreCase("android")) { |
| | | // for (SuperVideoType type : list) { |
| | | // if (type.getType().getName().contains("资讯")) { |
| | | // type.getType().setName("主播"); |
| | | // type.getType().setId(1111); |
| | | // type.getType().setIcon("http://img.zcool.cn/community/017fdb57610d8a0000012e7e74b496.png"); |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | if ("android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() > 53 && !"qq".equalsIgnoreCase(acceptData.getChannel())) { |
| | | SuperVideoType sty = new SuperVideoType(); |
| | | sty.setCreatetime(0 + ""); |
| | | sty.setPicture(""); |
| | | VideoType vt = new VideoType(22222); |
| | | VideoType vt = new VideoType(Constant.VIDEO_TYPE_ZHIBO); |
| | | vt.setName("美女直播"); |
| | | vt.setShow("1"); |
| | | vt.setCategoryType("http://m.v.6.cn/event/porkvideo?src=9n8wc5medm&nologo=1&t=2"); |
| | |
| | | if (!isC) |
| | | list.add(sty); |
| | | } |
| | | |
| | | //Android平台3.8.7之后返回VIP |
| | | if ("android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() >= 105) { |
| | | |
| | | SuperVideoType sty = new SuperVideoType(); |
| | | sty.setCreatetime(0 + ""); |
| | | sty.setPicture(""); |
| | | VideoType vt = new VideoType(Constant.VIDEO_TYPE_VIP); |
| | | vt.setName("VIP"); |
| | | vt.setShow("1"); |
| | | vt.setIcon("https://hbimg.huabanimg.com/12834704bb4aa39342c2fb51e0c644181b13997b70eb-CqlE1I_fw658/format/webp"); |
| | | sty.setType(vt); |
| | | boolean isC = false; |
| | | for (SuperVideoType svt : list) { |
| | | if (svt.getType().getId() == vt.getId()) { |
| | | isC = true; |
| | | break; |
| | | } |
| | | } |
| | | list.add(sty); |
| | | } |
| | | |
| | | |
| | | List<VideoType> typelist = new ArrayList<VideoType>(); |
| | | for (SuperVideoType sv : list) { |
| | |
| | | /** |
| | | * 获取当前系统所有后台视频分类 |
| | | * |
| | | * @param uid |
| | | * @param acceptData |
| | | * @param request |
| | | * @param out |
| | | */ |
| | |
| | | return; |
| | | } |
| | | |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getPlatform(), acceptData.getVersion()); |
| | | |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); |
| | | |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(detailSystem, acceptData.getVersion()); |
| | | List<VideoInfo> list = starService.getStarVideo(detailSystem.getId(), starId, pageIndex, |
| | | CacheUtil.getMD5Long(resourceList)); |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getPlatform(), acceptData.getVersion()); |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); |
| | | DetailSystem detailSystem = acceptData.getDetailSystem(); |
| | | UserInfo user = userService.getUserInfo(acceptData.getUid()); |
| | | if (Utils.isTest(request, user, detailSystem.getId())) |
| | | detailSystem = systemService.getDetailSystemById(40 + ""); |
| | | |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion()); |
| | | |
| | | String resourceMD5 = CacheUtil.getMD5Long(resourceList); |
| | | |
| | |
| | | } |
| | | list.add(hv.getVideo()); |
| | | } |
| | | |
| | | count = (new StringBuilder(String.valueOf(homeTypeService.getVideoCountByTypes(homeType, pageIndex)))) |
| | | .toString(); |
| | | } else if (!StringUtil.isNullOrEmpty(videoType)) { |
| | | if (StringUtil.isNullOrEmpty(categoryType) || "genre".equalsIgnoreCase(categoryType)) {// 按分类检索数据 |
| | | |
| | | if (!StringUtil.isNullOrEmpty(order)) { |
| | | Long startTime = System.currentTimeMillis(); |
| | | List<VideoInfo> list1 = classService.getTypeVideoList(videoType, detailSystem, pageIndex, 20, |
| | | Integer.parseInt(order), resourceList, CacheUtil.getMD5Long(resourceList)); |
| | | list = new ArrayList<VideoInfo>(); |
| | | list = new ArrayList<>(); |
| | | if (list1 != null) |
| | | for (VideoInfo info : list1) |
| | | list.add(info); |
| | |
| | | } else { |
| | | List<VideoInfo> list1 = classService.getTypeVideoList(videoType, detailSystem, pageIndex, 20, 1, |
| | | resourceList, CacheUtil.getMD5Long(resourceList)); |
| | | list = new ArrayList<VideoInfo>(); |
| | | list = new ArrayList<>(); |
| | | if (list1 != null) |
| | | for (VideoInfo info : list1) |
| | | list.add(info); |
| | | } |
| | | count = 1200 + ""; |
| | | |
| | | |
| | | } else {// 按地区检索数据 |
| | | String areaId = videoType;// 国籍ID |
| | | CategoryContry cc = categoryAreaService.getCategoryArea(areaId); |
| | | String country = cc.getName(); |
| | | long typeid = cc.getParent().getCid(); |
| | | if (StringUtil.isNullOrEmpty(order)) |
| | | order = 1 + ""; |
| | | list = categoryAreaService.getVideoInfoByArea(typeid + "", detailSystem, pageIndex, 20, |
| | | Integer.parseInt(order), resourceList, country, |
| | | StringUtil.Md5(typeid + "-" + detailSystem + "-" + pageIndex + "-" + order + "-" + country |
| | | + "-" + CacheUtil.getMD5Long(resourceList))); |
| | | System.out.println("列表最终数量:" + list.size()); |
| | | count = 1000 + ""; |
| | | //非VIP分类 |
| | | List<Integer> vipTypes = Arrays.asList(Constant.vipTypes); |
| | | if (vipTypes.contains(Integer.parseInt(videoType))) { |
| | | //VIP分类 |
| | | SolrVideoSearchFilter filter = new SolrVideoSearchFilter(); |
| | | filter.setFreeType(1); |
| | | switch (Integer.parseInt(videoType)) { |
| | | case Constant.VIDEO_TYPE_VIP_MOVIE: |
| | | filter.setVideoType(VideoConstant.VIDEO_CATEGORY_DIANYING); |
| | | break; |
| | | case Constant.VIDEO_TYPE_VIP_TV: |
| | | filter.setVideoType(VideoConstant.VIDEO_CATEGORY_DIANSHIJU); |
| | | break; |
| | | case Constant.VIDEO_TYPE_VIP_CARTOON: |
| | | filter.setVideoType(VideoConstant.VIDEO_CATEGORY_DONGMAN); |
| | | break; |
| | | case Constant.VIDEO_TYPE_VIP_SHOW: |
| | | filter.setVideoType(VideoConstant.VIDEO_CATEGORY_ZONGYI); |
| | | break; |
| | | default: |
| | | } |
| | | filter.setResourceIds(new String[]{PPTVUtil.RESOURCE_ID + ""}); |
| | | |
| | | //更新时间 |
| | | if ("1".equalsIgnoreCase(order)) { |
| | | filter.setSortKey("updateTime"); |
| | | } else { |
| | | //观看次数 |
| | | filter.setSortKey("watchcount"); |
| | | } |
| | | SolrResultDTO resultDTO = solrAlbumVideoDataManager.find(filter, pageIndex, 20); |
| | | count = resultDTO.getTotalCount() + ""; |
| | | list = searchService.convertSolrAlbumResultToVideo(resultDTO.getVideoList(), resourceList); |
| | | } else { |
| | | String areaId = videoType;// 国籍ID |
| | | CategoryContry cc = categoryAreaService.getCategoryArea(areaId); |
| | | String country = cc.getName(); |
| | | long typeid = cc.getParent().getCid(); |
| | | if (StringUtil.isNullOrEmpty(order)) |
| | | order = 1 + ""; |
| | | list = categoryAreaService.getVideoInfoByArea(typeid + "", detailSystem, pageIndex, 20, |
| | | Integer.parseInt(order), resourceList, country, |
| | | StringUtil.Md5(typeid + "-" + detailSystem + "-" + pageIndex + "-" + order + "-" + country |
| | | + "-" + CacheUtil.getMD5Long(resourceList))); |
| | | System.out.println("列表最终数量:" + list.size()); |
| | | count = 1000 + ""; |
| | | } |
| | | } |
| | | } |
| | | list = banQuanService.getBanQuanVideo(list, detailSystem.getId(), CacheUtil.getMD5VideoInfo(list)); |
| | |
| | | list.add(vt); |
| | | } |
| | | |
| | | if (acceptData.getVersion() > 60) { // 20170915删除推荐 |
| | | list.remove(0); |
| | | } |
| | | |
| | | } else if ((Constant.VIDEO_TYPE_VIP + "").equalsIgnoreCase(parentId)) { |
| | | //VIP分类 |
| | | VideoType type = new VideoType(Constant.VIDEO_TYPE_VIP); |
| | | type.setName("全部"); |
| | | type.setShow("1"); |
| | | type.setCategoryType("area"); |
| | | list.add(type); |
| | | |
| | | |
| | | type = new VideoType(Constant.VIDEO_TYPE_VIP_MOVIE); |
| | | type.setName("电影"); |
| | | type.setShow("1"); |
| | | type.setCategoryType("area"); |
| | | list.add(type); |
| | | |
| | | type = new VideoType(Constant.VIDEO_TYPE_VIP_TV); |
| | | type.setName("电视剧"); |
| | | type.setShow("1"); |
| | | type.setCategoryType("area"); |
| | | list.add(type); |
| | | |
| | | |
| | | type = new VideoType(Constant.VIDEO_TYPE_VIP_CARTOON); |
| | | type.setName("动漫"); |
| | | type.setShow("1"); |
| | | type.setCategoryType("area"); |
| | | list.add(type); |
| | | |
| | | // type = new VideoType(Constant.VIDEO_TYPE_VIP_SHOW); |
| | | // type.setName("综艺"); |
| | | // type.setShow("1"); |
| | | // type.setCategoryType("area"); |
| | | // list.add(type); |
| | | |
| | | } else { |
| | | List<VideoType> clist = classService.getFirstTypeList(parentId); |
| | | list = new ArrayList<VideoType>(); |
| | | list = new ArrayList<>(); |
| | | if (clist != null) |
| | | for (VideoType vt : clist) |
| | | list.add(vt); |
| | |
| | | type.setShow("1"); |
| | | type.setCategoryType("genre"); |
| | | list.add(0, type); |
| | | if (acceptData.getVersion() > 60) { // 20170915删除推荐 |
| | | list.remove(0); |
| | | } |
| | | } |
| | | for (int i = 0; i < list.size(); i++) { |
| | | array.add(StringUtil.outPutResultJson(list.get(i))); |
| | | } |
| | | if (acceptData.getVersion() > 60) { // 20170915删除推荐 |
| | | array.remove(0); |
| | | } |
| | | |
| | | object.put("count", array.size()); |
| | | object.put("data", array); |
| | | out.print(JsonUtil.loadTrueJson(object.toString())); |
| | |
| | | public void getRecommendCategoryVideoList(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | String typeid = request.getParameter("Type"); |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); |
| | | // int count = |
| | | // categoryRecommendVideoService.getRankVideoNumber(Integer.parseInt(typeid)); |
| | | List<VideoInfo> rankList = categoryRecommendCacheVideoService.getVideoListByRank(Integer.parseInt(typeid), |
| | | detailSystem.getId()); |
| | | List<VideoInfo> list = new ArrayList<VideoInfo>(); |
| | | detailSystem.getId(), acceptData.getPlatform(), acceptData.getVersion()); |
| | | List<VideoInfo> list = new ArrayList<>(); |
| | | list.addAll(rankList); |
| | | // List<VideoInfo> list1 = |
| | | // recommendService.getCategoryRecommendVideoList(Integer.parseInt(typeid), |
| | | // count); |
| | | // int crvs = list1.size(); |
| | | // for (CategoryRecommendCacheVideo crcv : rankList) { |
| | | // int rank = crcv.getRank(); |
| | | // if(crvs > 0 && rank > 0 && rank <= crvs ){ |
| | | // list1.add(rank-1, crcv.getVideoInfo()); |
| | | // } |
| | | // } |
| | | // list.addAll(list1.subList(0, list1.size()>count?count:list1.size())); |
| | | // |
| | | // list = banQuanService.getBanQuanVideo(list, detailSystem.getId(), |
| | | // CacheUtil.getMD5VideoInfo(list)); |
| | | for (VideoInfo vi : list) {// 清除无用数据,防止浪费带宽,更改图片 |
| | | vi.setIntroduction(""); |
| | | vi.setMainActor(""); |