| | |
| | | package com.yeshi.buwan.controller.api; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.yeshi.buwan.domain.video.VideoWatchHistory; |
| | | import com.yeshi.buwan.pptv.PPTVApiUtil; |
| | | import com.yeshi.buwan.pptv.entity.PPTVProgram; |
| | | import com.yeshi.buwan.pptv.entity.PPTVSeries; |
| | | import com.yeshi.buwan.pptv.entity.PPTVSeriesProgramMap; |
| | | import com.yeshi.buwan.pptv.entity.VideoPPTVMap; |
| | | import com.yeshi.buwan.service.inter.juhe.PPTVService; |
| | | import com.yeshi.buwan.service.inter.push.PushDeviceTokenService; |
| | | import com.yeshi.buwan.service.inter.video.VideoWatchHistoryService; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.vo.video.PPTVVideoActivityInfoVO; |
| | | import com.yeshi.buwan.vo.video.PPTVWatchVIPVideoActivityWay; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Controller |
| | | @RequestMapping("api/v2/video/play") |
| | |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取pptv的活动 |
| | | * |
| | | * @param acceptData |
| | | * @param loginUid |
| | | * @param cid |
| | | * @param vid |
| | | * @return |
| | | */ |
| | | @RequestMapping("getPPTVVIPVideoActivity") |
| | | @ResponseBody |
| | | public String getPPTVVIPVideoActivity(AcceptData acceptData, String loginUid, String cid, String vid) { |
| | | //查询cid与vid的名字 |
| | | PPTVSeries pptvSeries = pptvService.selectSeriesBySeriesCode(cid); |
| | | if (pptvSeries == null) { |
| | | try { |
| | | pptvSeries = PPTVApiUtil.getDetail(cid); |
| | | }catch(Exception e){ |
| | | |
| | | } |
| | | } |
| | | |
| | | PPTVVideoActivityInfoVO vo = new PPTVVideoActivityInfoVO(); |
| | | if (pptvSeries != null) { |
| | | vo.setVideoName("《" + pptvSeries.getName() + "》"); |
| | | } else { |
| | | vo.setVideoName("《未知视频》"); |
| | | } |
| | | |
| | | List<PPTVWatchVIPVideoActivityWay> wayList = new ArrayList<>(); |
| | | PPTVWatchVIPVideoActivityWay way = new PPTVWatchVIPVideoActivityWay(); |
| | | way.setEndBgColor("#E9CE93"); |
| | | way.setStartBgColor("#F7EDD7"); |
| | | way.setEndPrice(new BigDecimal("99")); |
| | | way.setIcon("http://192.168.3.122:8848/BuWanWeb/icon_test1.png"); |
| | | way.setStartPrice(new BigDecimal("6")); |
| | | way.setSubTitle("包月、季、年卡"); |
| | | way.setTitle("VIP看高清 免广告"); |
| | | way.setTextColor("#885E24"); |
| | | way.setType("vip"); |
| | | wayList.add(way); |
| | | vo.setWayList(wayList); |
| | | return JsonUtil.loadTrueJson(new Gson().toJson(vo)); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | adConfig = null; |
| | | adNew.put("pptvNoAdReward", gson.toJson(adConfig)); |
| | | |
| | | //热启动开屏 |
| | | adConfig = getAdShowType("ad_splash_hot_start", acceptData.getChannel(), acceptData.getVersion(), map); |
| | | if (hiddenAll) |
| | | adConfig = null; |
| | | adNew.put("splashHotStart", gson.toJson(adConfig)); |
| | | |
| | | |
| | | |
| | | data.put("ad", ad); |
| | | data.put("adNew", adNew); |
| | | //PPTV免广告权益时长,暂时设置为3小时 |
| | |
| | | |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion()); |
| | | //查询大图 |
| | | List<HomeVideo> bigPictureVideos = homeTypeService.getHomeVideoList(homeTypeId, resourceList, true, page, homeType.getNumber()); |
| | | List<HomeVideo> bigPictureVideos = homeTypeService.getHomeVideoList(homeTypeId, resourceList, true, 1, homeType.getNumber()); |
| | | |
| | | |
| | | //大图需要每次都返回 |
| | |
| | | list.addAll(bigPictureVideos); |
| | | list.addAll(list1); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("count", count); |
| | | object.put("count", count); |
| | | JSONArray array = new JSONArray(); |
| | | for (int i = 0; i < list.size(); i++) |
| | | array.add(StringUtil.outPutResultJson(list.get(i))); |
| | |
| | | if (page >= totalPage) { |
| | | page = 0; |
| | | } |
| | | data.put("page", page); |
| | | object.put("page", page); |
| | | out.print(JsonUtil.loadTrueJson(object.toString())); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | ((VideoInfo) list.get(i)) |
| | | .setPicture(VideoPictureUtil.getShowPicture((VideoInfo) list.get(i), acceptData.getPlatform(), acceptData.getVersion() + "")); |
| | | array.add(StringUtil.outPutResultJson(list.get(i))); |
| | | } |
| | | object.put("data", array); |
| | | |
| | | if (pageIndex == 1) {//返回导航栏 |
| | | List<VideoType> typeList = new ArrayList<>(); |
| | | VideoType vt = new VideoType(); |
| | |
| | | object.put("typeList", array1); |
| | | } |
| | | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | ((VideoInfo) list.get(i)) |
| | | .setPicture(VideoPictureUtil.getShowPicture((VideoInfo) list.get(i), acceptData.getPlatform(), acceptData.getVersion() + "")); |
| | | array.add(StringUtil.outPutResultJson(list.get(i))); |
| | | } |
| | | object.put("data", array); |
| | | |
| | | out.print(JsonUtil.loadTrueJson(object.toString())); |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | public static class VideoAlbumMoreInfo { |
| | | @Expose |
| | | private String name; |
| | | @Expose |
| | | private int jumpPosition; |
| | | |
| | | public VideoAlbumMoreInfo(String name, int jumpPosition) { |
| | |
| | | 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,need_ad,big_picture 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,big_picture,refresh_position,more_tag 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.special_data_key='" |
| | | + dataKey + "' AND (" + resourceWhere |
| | | + " ) AND bv.`videoid` IS NULL ) GROUP BY (hv.`id`) ORDER BY hv.big_picture desc, hv.`orderby` desc,v.createtime DESC ) hvideo LEFT JOIN `wk_video_super_hometype` sht ON sht.`hometypeid`=hvideo.hometype LEFT JOIN `wk_video_hometype` ht ON sht.`hometypeid` =ht.`id` LEFT JOIN wk_video_video v ON v.`id`=hvideo.videoid WHERE sht.`detailsystemid` =" + detailSystem + " ORDER BY hvideo.`orderby` DESC,v.orderby desc,v.updatetime desc") |
| | | + " ) AND bv.`videoid` IS NULL ) GROUP BY (hv.`id`) ORDER BY hv.`orderby` desc,v.createtime DESC ) hvideo LEFT JOIN `wk_video_super_hometype` sht ON sht.`hometypeid`=hvideo.hometype LEFT JOIN `wk_video_hometype` ht ON sht.`hometypeid` =ht.`id` LEFT JOIN wk_video_video v ON v.`id`=hvideo.videoid WHERE sht.`detailsystemid` =" + detailSystem + " ORDER BY hvideo.big_picture desc, hvideo.`orderby` DESC,v.orderby desc,v.updatetime desc") |
| | | .list(); |
| | | List<HomeType> homeTypeList = new ArrayList<>(); |
| | | Map<String, Integer> homeTypeVideoCountMap = new HashMap<>(); |
| | |
| | | ht.setParams(obj[5] + ""); |
| | | ht.setIosControl(obj[6] + ""); |
| | | ht.setNumber(Integer.parseInt(obj[7] + "")); |
| | | ht.setRefreshPosition(Integer.parseInt(obj[25] + "")); |
| | | ht.setMoreTag(obj[26]+""); |
| | | |
| | | |
| | | ht.setOrderby(obj[21] + ""); |
| | |
| | | hv.setId(obj[8] + ""); |
| | | hv.setPicture(obj[10] + ""); |
| | | hv.setTag(obj[11] + ""); |
| | | hv.setBigPicture(Boolean.parseBoolean(obj[24] + "")); |
| | | hv.setBigPicture(Integer.parseInt(obj[24] + "")>0); |
| | | |
| | | VideoInfo video = new VideoInfo(); |
| | | video.setId(obj[12] + ""); |
| | |
| | | //计算已有大图数量 |
| | | int bigCount = 0; |
| | | for (HomeVideo hv1 : eHomeType.getHomeVideoList()) { |
| | | if (hv.getBigPicture()) { |
| | | if (hv1.getBigPicture()) { |
| | | bigCount++; |
| | | } |
| | | } |
| | |
| | | if (bigPicture != null) { |
| | | sql += " and hv.big_picture=" + (bigPicture ? 1 : 0); |
| | | } |
| | | sql += "GROUP BY hv.id ORDER BY hv.big_picture desc,hv.`orderby` DESC,hv.`createtime` DESC"; |
| | | sql += " GROUP BY hv.id ORDER BY hv.big_picture desc,hv.`orderby` DESC,hv.`createtime` DESC"; |
| | | |
| | | return session.createSQLQuery(sql).addEntity(HomeVideo.class).setFirstResult((page - 1) * pageSize).setMaxResults(pageSize).list(); |
| | | } |
| | |
| | | import com.yeshi.buwan.service.imp.VideoTypeService; |
| | | import com.yeshi.buwan.service.inter.juhe.PPTVService; |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | CMQManager.getInstance().addPPTVSeriesUpdateMsg(new PPTVMQMsg(series.getInfoID(), PPTVMQMsg.TYPE_ADD_OR_UPDATE)); |
| | | } |
| | | |
| | | System.out.println("addorupdate:"+series.getName()); |
| | | System.out.println("addorupdate:" + series.getName()); |
| | | |
| | | break; |
| | | //删除 |
| | | case "del": |
| | | System.out.println("delete:"+series.getName()); |
| | | System.out.println("delete:" + series.getName()); |
| | | deleteSeries(series); |
| | | infoIds.add(series.getInfoID()); |
| | | break; |
| | |
| | | return videoPPTVMapDao.selectByInfoId(infoId); |
| | | } |
| | | |
| | | @Override |
| | | public PPTVSeries selectSeriesBySeriesCode(String cid) { |
| | | Query query = new Query(); |
| | | query.addCriteria(new Criteria().where("seriesCode").is(cid)); |
| | | return pptvSeriesDao.findOne(query); |
| | | } |
| | | |
| | | /** |
| | | * 删除剧集 |
| | | * |
| | |
| | | */ |
| | | public VideoPPTVMap selectVideoPPTVMapByInfoId(String infoId); |
| | | |
| | | |
| | | public PPTVSeries selectSeriesBySeriesCode(String cid); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.vo.video; |
| | | |
| | | import java.util.List; |
| | | |
| | | public class PPTVVideoActivityInfoVO { |
| | | private List<PPTVWatchVIPVideoActivityWay> wayList; |
| | | private String videoName; |
| | | |
| | | |
| | | public List<PPTVWatchVIPVideoActivityWay> getWayList() { |
| | | return wayList; |
| | | } |
| | | |
| | | public void setWayList(List<PPTVWatchVIPVideoActivityWay> wayList) { |
| | | this.wayList = wayList; |
| | | } |
| | | |
| | | public String getVideoName() { |
| | | return videoName; |
| | | } |
| | | |
| | | public void setVideoName(String videoName) { |
| | | this.videoName = videoName; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.vo.video; |
| | | |
| | | import com.yeshi.buwan.domain.jump.JumpDetail; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 观看VIP视频的活动 |
| | | */ |
| | | public class PPTVWatchVIPVideoActivityWay { |
| | | private String title; |
| | | private String subTitle; |
| | | private String icon; |
| | | private String textColor; |
| | | private String startBgColor; |
| | | private String endBgColor; |
| | | private BigDecimal startPrice; |
| | | private BigDecimal endPrice; |
| | | |
| | | //跳转相关参数 |
| | | private JumpDetail jumpDetail; |
| | | private String params; |
| | | |
| | | //类型名称 vip |
| | | private String type; |
| | | |
| | | |
| | | public JumpDetail getJumpDetail() { |
| | | return jumpDetail; |
| | | } |
| | | |
| | | public void setJumpDetail(JumpDetail jumpDetail) { |
| | | this.jumpDetail = jumpDetail; |
| | | } |
| | | |
| | | public String getParams() { |
| | | return params; |
| | | } |
| | | |
| | | public void setParams(String params) { |
| | | this.params = params; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public String getSubTitle() { |
| | | return subTitle; |
| | | } |
| | | |
| | | public void setSubTitle(String subTitle) { |
| | | this.subTitle = subTitle; |
| | | } |
| | | |
| | | public String getIcon() { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) { |
| | | this.icon = icon; |
| | | } |
| | | |
| | | public String getTextColor() { |
| | | return textColor; |
| | | } |
| | | |
| | | public void setTextColor(String textColor) { |
| | | this.textColor = textColor; |
| | | } |
| | | |
| | | public String getStartBgColor() { |
| | | return startBgColor; |
| | | } |
| | | |
| | | public void setStartBgColor(String startBgColor) { |
| | | this.startBgColor = startBgColor; |
| | | } |
| | | |
| | | public String getEndBgColor() { |
| | | return endBgColor; |
| | | } |
| | | |
| | | public void setEndBgColor(String endBgColor) { |
| | | this.endBgColor = endBgColor; |
| | | } |
| | | |
| | | public BigDecimal getStartPrice() { |
| | | return startPrice; |
| | | } |
| | | |
| | | public void setStartPrice(BigDecimal startPrice) { |
| | | this.startPrice = startPrice; |
| | | } |
| | | |
| | | public BigDecimal getEndPrice() { |
| | | return endPrice; |
| | | } |
| | | |
| | | public void setEndPrice(BigDecimal endPrice) { |
| | | this.endPrice = endPrice; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | } |