Commit 6763feec12b6e06cb57248a26c2218e0f9531088

Authored by 徐近程
1 parent 78a59fa7

举报投诉直播内容查询

src/main/java/com/cnlive/shenhe/controller/LiveController.java
1 1 package com.cnlive.shenhe.controller;
2 2  
  3 +import com.cnlive.shenhe.utils.HttpClientUtils;
3 4 import org.apache.poi.xssf.usermodel.XSSFCell;
4 5 import org.apache.poi.xssf.usermodel.XSSFRow;
5 6 import org.apache.poi.xssf.usermodel.XSSFSheet;
... ... @@ -36,7 +37,9 @@ import javax.servlet.ServletOutputStream;
36 37 import javax.servlet.http.HttpServletResponse;
37 38 import javax.servlet.http.HttpSession;
38 39 import java.io.*;
  40 +import java.util.HashMap;
39 41 import java.util.List;
  42 +import java.util.Map;
40 43  
41 44 @Controller
42 45 @RequestMapping("/live")
... ... @@ -59,6 +62,9 @@ public class LiveController extends BaseController {
59 62 @Value("${ks_domain}")
60 63 String ks_domain;
61 64  
  65 + @Value("${cms_getVideoAndLiveId}")
  66 + String cms_getVideoAndLiveId;
  67 +
62 68 /**
63 69 * 审核信息返回接口
64 70 *
... ... @@ -106,20 +112,25 @@ public class LiveController extends BaseController {
106 112 /**
107 113 * 内容分页列表接口
108 114 *
109   - * @param video_title
  115 + * @param model
  116 + * @param activity_id
110 117 * @param start_date
111 118 * @param end_date
112   - * @param state
  119 + * @param activity_name
  120 + * @param activity_status
113 121 * @param page
114 122 * @param pageSize
115   - * @param orderByClause
  123 + * @param shenhe_state
  124 + * @param sp_desc
  125 + * @param contentId
  126 + * @param session
116 127 * @return
117 128 */
118 129 @GetMapping("/page")
119   - public Object getListVideos(Model model,String activity_id,String start_date,String end_date,
120   - String activity_name, Integer activity_status, Integer page,Integer pageSize,
121   - Integer shenhe_state, String sp_desc, HttpSession session) {
122   - System.out.println("进入直播内容页");
  130 + public Object getListVideos(Model model, String activity_id, String start_date, String end_date,
  131 + String activity_name, Integer activity_status, Integer page, Integer pageSize,
  132 + Integer shenhe_state, String sp_desc, Integer contentId, HttpSession session) {
  133 + System.out.println("进入直播内容页");
123 134 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
124 135 // if(CommonUtils.isNull(sessionUser)){
125 136 // return "redirect:/users/login";
... ... @@ -129,38 +140,53 @@ public class LiveController extends BaseController {
129 140 if (CommonUtils.isNull(page)) page = 1;
130 141 if (CommonUtils.isNull(pageSize)) pageSize = 20;
131 142 if (CommonUtils.isNotEmpty(sp_desc) && spid == 0) {
132   - ShySites shySite=sitesService.findspidBySpdesc(sp_desc);
133   - if(CommonUtils.isNotNull(shySite)){
134   - spid = shySite.getSpid();
135   - }else{
136   - setmodel_site(model);
137   - return "error.html";
138   - }
  143 + ShySites shySite = sitesService.findspidBySpdesc(sp_desc);
  144 + if (CommonUtils.isNotNull(shySite)) {
  145 + spid = shySite.getSpid();
  146 + } else {
  147 + setmodel_site(model);
  148 + return "error.html";
  149 + }
139 150 } else if (CommonUtils.isEmpty(sp_desc) && spid == 0) {
140 151 spid = null;
141 152 }
142   - String orderByClause="";
143   - if(shenhe_state!=null&&shenhe_state==0){//审核状态:全部待领
144   - orderByClause="pre_start_time ";
145   - }else if(shenhe_state!=null&&shenhe_state==1){//审核状态:待审核
146   - orderByClause="pre_start_time ";
147   - }else if(shenhe_state!=null&&shenhe_state==2){//审核状态:已审核
148   - orderByClause="pre_start_time desc";
149   - }else{//审核状态:全部
150   - orderByClause="is_hot desc, pre_start_time ";
151   - if(activity_status!=null &&(activity_status==0 ||activity_status==2 || activity_status==4)){//直播状态:结束、撤销、下线
152   - orderByClause="is_hot desc, pre_start_time desc";
153   - }
  153 + String orderByClause = "";
  154 + if (shenhe_state != null && shenhe_state == 0) {//审核状态:全部待领
  155 + orderByClause = "pre_start_time ";
  156 + } else if (shenhe_state != null && shenhe_state == 1) {//审核状态:待审核
  157 + orderByClause = "pre_start_time ";
  158 + } else if (shenhe_state != null && shenhe_state == 2) {//审核状态:已审核
  159 + orderByClause = "pre_start_time desc";
  160 + } else {//审核状态:全部
  161 + orderByClause = "is_hot desc, pre_start_time ";
  162 + if (activity_status != null && (activity_status == 0 || activity_status == 2 || activity_status == 4)) {//直播状态:结束、撤销、下线
  163 + orderByClause = "is_hot desc, pre_start_time desc";
  164 + }
  165 + }
  166 +
  167 + if (CommonUtils.isNotNull(contentId)) {
  168 + Map<String, String> map = new HashMap<>(1);
  169 + map.put("id", contentId.toString());
  170 + String post = HttpClientUtils.get(cms_getVideoAndLiveId, map);
  171 + JSONObject jsonObject = JSONObject.parseObject(post);
  172 + JSONObject data = jsonObject.getJSONObject("data");
  173 + if (data != null) {
  174 + String pid = data.getString("pid");
  175 + activity_id = pid;
  176 + } else {
  177 + activity_id = contentId.toString();
  178 + }
154 179 }
155   - PageInfo<ShyLive> livePage = liveService.getListContent(activity_name, start_date,end_date,
156   - activity_id, activity_status, page, pageSize, shenhe_state, orderByClause, spid, userId);
  180 +
  181 + PageInfo<ShyLive> livePage = liveService.getListContent(activity_name, start_date, end_date,
  182 + activity_id, activity_status, page, pageSize, shenhe_state, orderByClause, spid, userId);
157 183 List<ShyLive> list = livePage.getList();
158 184 if (!list.isEmpty()) {
159 185 for (ShyLive live : list) {
160 186 //显示spid简称
161 187 ShySites shySites = sitesService.findspidDescByspid(live.getSp_id());
162 188 if (CommonUtils.isNotNull(shySites)) {
163   - live.setSpid_desc(shySites.getName());
  189 + live.setSpid_desc(shySites.getName());
164 190 }
165 191 }
166 192 }
... ...
src/main/resources/application.properties
... ... @@ -104,4 +104,5 @@ ks_domain=http://test.wideo.cnlive.com
104 104  
105 105 #\u56fe\u7247\u5b58\u653e\u6839\u8def\u5f84
106 106 desdir=shen
107   -yiDun_audio_callback=http://test.shen.cnlive.com/api/audio/callbackAudio
108 107 \ No newline at end of file
  108 +yiDun_audio_callback=http://test.shen.cnlive.com/api/audio/callbackAudio
  109 +cms_getVideoAndLiveId=http://cmstest.cnlive.com:8768/contentApi/getBeanById
... ...
src/main/resources/templates/page/live.html
... ... @@ -93,6 +93,14 @@
93 93 </div>
94 94 </div>
95 95  
  96 + <div class="col-md-3" style="padding: 0" th:if="${session.sessionUser.spid==0}">
  97 + <label for="contentId" class="control-label cb-toolbar">内容id:</label>
  98 + <div class="col-sm-7" style="padding: 0;">
  99 + <input class="form-control" name="contentId" type="text"
  100 + id="contentId">
  101 + </div>
  102 + </div>
  103 +
96 104 <!-- <div class="col-md-3" style="padding: 0"> -->
97 105 <!-- <label for="is_hot" class="control-label cb-toolbar">是否热点:</label> -->
98 106 <!-- <div class="col-sm-6" style="padding: 0;"> -->
... ... @@ -442,7 +450,8 @@
442 450 var sp_desc = "";
443 451 var count = "";
444 452 var shenhe_state ="";//审核状态
445   -
  453 + var contentId ="";//审核状态
  454 +
446 455 function query(){
447 456 activity_id = $("#activity_id").val();
448 457 activity_name = $("#activity_name").val();
... ... @@ -453,8 +462,9 @@
453 462 var spId=[[${session.sessionUser.spid}]];
454 463 if(spId==0){
455 464 sp_desc = $("#sp_desc").val();
  465 + contentId = $("#contentId").val();
456 466 }
457   - window.location.href = "/live/page?activity_status="+activity_status+"&activity_id=" + activity_id + "&start_date=" + start_date + "&end_date=" + end_date + "&activity_name=" + activity_name + "&sp_desc=" + sp_desc+"&pageSize="+count+"&shenhe_state="+shenhe_state;
  467 + window.location.href = "/live/page?activity_status="+activity_status+"&activity_id=" + activity_id + "&start_date=" + start_date + "&end_date=" + end_date + "&activity_name=" + activity_name + "&sp_desc=" + sp_desc+"&pageSize="+count+"&shenhe_state="+shenhe_state+"&contentId="+contentId;
458 468 }
459 469  
460 470 //全部
... ...