Commit 7a28bac0142b92740df0c358ea441dbcd4f78d11

Authored by 陈浩
1 parent a3c2f81d

点播视频页和点播视频详情页修改

src/main/java/com/cnlive/shenhe/controller/VideosController.java
1 1 package com.cnlive.shenhe.controller;
2 2  
  3 +import com.alibaba.fastjson.JSON;
3 4 import com.alibaba.fastjson.JSONObject;
4 5 import com.cnlive.shenhe.bean.ErrorEnum;
5 6 import com.cnlive.shenhe.bean.ResponseBean;
... ... @@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
18 19 import org.springframework.web.bind.annotation.ResponseBody;
19 20  
20 21 import javax.servlet.http.HttpSession;
  22 +import java.util.List;
21 23  
22 24 @Controller
23 25 @RequestMapping("/videos")
... ... @@ -86,7 +88,7 @@ public class VideosController {
86 88 * @return
87 89 */
88 90 @RequestMapping("/page")
89   - public Object getListVideos(Model model, String video_title, String start_date, String end_date, Integer state, Integer page, Integer pageSize, String orderByClause, HttpSession session) {
  91 + public Object getListVideos(Model model, String video_title, String start_date, String end_date, Integer state, Integer page, Integer pageSize, String video_priority, String orderByClause, HttpSession session) {
90 92 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
91 93 Integer spid = sessionUser.getSpid();
92 94 if (CommonUtils.isNull(page)) page = 1;
... ... @@ -94,7 +96,21 @@ public class VideosController {
94 96 if (CommonUtils.isNotNull(spid) && spid == 0) {
95 97 spid = 82;
96 98 }
97   - PageInfo<ShyVideos> videoPage = videosService.getListContent(video_title, start_date, end_date, state, page, pageSize, orderByClause, spid);
  99 + PageInfo<ShyVideos> videoPage = videosService.getListContent(video_title, start_date, end_date, state, page, pageSize, video_priority, orderByClause, spid);
  100 + List<ShyVideos> list = videoPage.getList();
  101 + if (!list.isEmpty()) {
  102 + for (ShyVideos videos : list) {
  103 + String auditor = "白名单";
  104 + String auditor_id = videos.getAuditor_id();
  105 + if (CommonUtils.isNotEmpty(auditor_id)) {
  106 + ShyUsers user = new ShyUsers();
  107 + user.setUser_id(auditor_id);
  108 + user = usersService.select(user);
  109 + if (CommonUtils.isNotNull(user)) auditor = user.getUsername() + user.getEmail();
  110 + }
  111 + videos.setAuditor(auditor);
  112 + }
  113 + }
98 114 model.addAttribute("videoPage", videoPage);
99 115 return "page/video.html";
100 116 }
... ... @@ -108,6 +124,8 @@ public class VideosController {
108 124 @RequestMapping("/details")
109 125 public Object getDetailsVideo(Model model,Integer id) {
110 126 ShyVideos detailsContent = videosService.getDetailsContent(id);
  127 + Object images = JSON.parse(detailsContent.getVideo_imgs());
  128 + model.addAttribute("images", images);
111 129 model.addAttribute("video", detailsContent);
112 130 return "page/videoDetail.html";
113 131 }
... ...
src/main/java/com/cnlive/shenhe/entity/ShyUsers.java
... ... @@ -63,6 +63,19 @@ public class ShyUsers {
63 63 private Long tm;
64 64  
65 65 private String user_logo;
  66 + /**
  67 + * 审核员
  68 + */
  69 + @Transient
  70 + private String auditor;
  71 +
  72 + public String getAuditor() {
  73 + return auditor;
  74 + }
  75 +
  76 + public void setAuditor(String auditor) {
  77 + this.auditor = auditor;
  78 + }
66 79  
67 80 /**
68 81 * @return id
... ...
src/main/java/com/cnlive/shenhe/entity/ShyVideos.java
... ... @@ -82,6 +82,19 @@ public class ShyVideos {
82 82 private Date created_at;
83 83  
84 84 private Date updated_at;
  85 + /**
  86 + * 审核员
  87 + */
  88 + @Transient
  89 + private String auditor;
  90 +
  91 + public String getAuditor() {
  92 + return auditor;
  93 + }
  94 +
  95 + public void setAuditor(String auditor) {
  96 + this.auditor = auditor;
  97 + }
85 98  
86 99 /**
87 100 * @return id
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
1 1 package com.cnlive.shenhe.serviceImpl;
2 2  
3 3 import com.cnlive.shenhe.entity.ShySites;
  4 +import com.cnlive.shenhe.entity.ShyUsers;
4 5 import com.cnlive.shenhe.entity.ShyVideos;
5 6 import com.cnlive.shenhe.mapper.ShySitesMapper;
  7 +import com.cnlive.shenhe.mapper.ShyUsersMapper;
6 8 import com.cnlive.shenhe.mapper.ShyVideosMapper;
7 9 import com.cnlive.shenhe.utils.CommonUtils;
8 10 import com.github.pagehelper.PageHelper;
... ... @@ -26,6 +28,8 @@ public class VideosServiceImpl {
26 28 ShyVideosMapper shyVideosMapper;
27 29 @Autowired
28 30 ShySitesMapper shySitesMapper;
  31 + @Autowired
  32 + ShyUsersMapper shyUsersMapper;
29 33  
30 34 public int impotVideo(ShyVideos shyVideos) {
31 35 int result = shyVideosMapper.insert(shyVideos);
... ... @@ -45,9 +49,10 @@ public class VideosServiceImpl {
45 49 return shyVideosMapper.updateByPrimaryKeySelective(shyVideos);
46 50 }
47 51  
48   - public PageInfo<ShyVideos> getListContent(String video_title, String start_date, String end_date, Integer state, Integer page, Integer pageSize, String orderByClause, Integer spid) {
  52 + public PageInfo<ShyVideos> getListContent(String video_title, String start_date, String end_date, Integer state, Integer page, Integer pageSize, String video_priority, String orderByClause, Integer spid) {
49 53 Example example = new Example(ShyVideos.class);
50 54 Example.Criteria criteria = example.createCriteria();
  55 + Example.Criteria criteria2 = example.createCriteria();
51 56 if (CommonUtils.isNotEmpty(orderByClause)) {
52 57 example.setOrderByClause(orderByClause);
53 58 }
... ... @@ -55,8 +60,8 @@ public class VideosServiceImpl {
55 60 Timestamp startdate = null;
56 61 Timestamp enddate = null;
57 62 try {
58   - startdate = CommonUtils.parseDate(start_date,"YYYY-MM-DD HH:mm");
59   - enddate = CommonUtils.parseDate(end_date, "YYYY-MM-DD HH:mm");
  63 + startdate = CommonUtils.parseDate(start_date,"YYYY-MM-DD HH:MM:SS");
  64 + enddate = CommonUtils.parseDate(end_date, "YYYY-MM-DD HH:MM:SS");
60 65 } catch (ParseException e) {
61 66 e.printStackTrace();
62 67 }
... ... @@ -66,8 +71,15 @@ public class VideosServiceImpl {
66 71 if (CommonUtils.isNotEmpty(video_title)) {
67 72 criteria.andLike("video_title", "%" + video_title + "%");
68 73 }
69   - if (CommonUtils.isNotNull(state)) {
  74 + if (CommonUtils.isNotNull(state) && state == 0) {
  75 + criteria.andEqualTo("state", state);
  76 + }else if (CommonUtils.isNotNull(state) && state == 1){
70 77 criteria.andEqualTo("state", state);
  78 + criteria2.andEqualTo("state",2);
  79 + example.or(criteria2);
  80 + }
  81 + if (CommonUtils.isNotNull(video_priority)) {
  82 + criteria.andEqualTo("video_priority", video_priority);
71 83 }
72 84 if (CommonUtils.isNotNull(spid)) {
73 85 criteria.andEqualTo("spid", spid);
... ... @@ -82,6 +94,15 @@ public class VideosServiceImpl {
82 94  
83 95 public ShyVideos getDetailsContent(Integer id) {
84 96 ShyVideos DetailsshyVideos = shyVideosMapper.selectByPrimaryKey(id);
  97 + String auditorName = "白名单";
  98 + String auditor_id = DetailsshyVideos.getAuditor_id();
  99 + if (CommonUtils.isNotEmpty(auditor_id)) {
  100 + ShyUsers user = new ShyUsers();
  101 + user.setUser_id(auditor_id);
  102 + user = shyUsersMapper.selectOne(user);
  103 + auditorName = user.getUsername() + user.getEmail();
  104 + }
  105 + DetailsshyVideos.setAuditor(auditorName);
85 106 return DetailsshyVideos;
86 107 }
87 108  
... ...
src/main/resources/templates/page/video.html
... ... @@ -20,9 +20,9 @@
20 20 全部
21 21 </button>
22 22 </button>
23   - <button type="button" class="btn btn-sm margin-r-5 filter " th:onclick="'javascript:daishen(0)'" value="0">待审
  23 + <button type="button" class="btn btn-sm margin-r-5 filter " id="daishen" onclick="javascript:daishen()" value="0">待审
24 24 </button>
25   - <button type="button" class="btn btn-sm margin-r-5 filter " th:onclick="'javascript:yishen(1)'" value="1">已审
  25 + <button type="button" class="btn btn-sm margin-r-5 filter " id="yishen" th:onclick="'javascript:yishen()'" value="1">已审
26 26 </button>
27 27 <button type="button" class="btn btn-primary btn-sm margin-r-5" id="query" onclick="openOrClose(&#39;forms&#39;)">查询
28 28 <span id="a_up">▼</span><span id="a_down" style="display: none;">▲</span>
... ... @@ -33,12 +33,24 @@
33 33 <div class="col-md-5" style="padding: 0">
34 34 <label for="video_title" class="control-label cb-toolbar">标题:</label>
35 35 <div class="col-sm-9" style="padding: 0;">
36   - <input class="form-control" name="video_title" type="text" id="video_title">
  36 + <input class="form-control" type="text" value="" id="video_titleID">
  37 + </div>
  38 + </div>
  39 + </div>
  40 + <div class="btn-group margin-bottom col-md-6" style="padding: 0;">
  41 + <div class="col-md-5" style="padding: 0">
  42 + <label for="video_title" class="control-label cb-toolbar">热点:</label>
  43 + <div class="col-sm-9" style="padding: 0;">
  44 + <select class="form-control" id="video_priority" name="video_priority" >
  45 + <option value ="1">是</option>
  46 + <option value ="0">否</option>
  47 + </select>
  48 + <!--<input class="form-control" name="video_priority" type="text" id="video_priority">-->
37 49 </div>
38 50 </div>
39 51 </div>
40 52  
41   - <div class="btn-group margin-bottom col-md-6 pull-right" style="padding: 0">
  53 + <div class="btn-group margin-bottom col-md-6 pull-right" style="position: relative;left: -27%;">
42 54 <div class="col-md-11" style="width: 88%;padding: 0;">
43 55 <div class="col-md-6" style="padding: 0">
44 56 <label for="start_date" class="control-label cb-toolbar">时间:</label>
... ... @@ -76,10 +88,9 @@
76 88 <!--<div class="th-inner "><input name="btSelectAll" type="checkbox"></div>-->
77 89 <!--<div class="fht-cell"></div>-->
78 90 <!--</th>-->
79   - <th style="text-align: center; width: 6%; " data-field="sp_id_brief" tabindex="0"><div class="th-inner ">sp简称</div><div class="fht-cell"></div></th>
  91 + <th style="text-align: center; width: 6%; " data-field="sp_id_brief" tabindex="0"><div class="th-inner ">spid</div><div class="fht-cell"></div></th>
80 92 <th style="text-align: center; width: 20%; " data-field="video_title" tabindex="0"><div class="th-inner ">标题</div><div class="fht-cell"></div></th>
81 93 <th style="text-align: center; width: 10%; " data-field="video_cover_img" tabindex="0"><div class="th-inner ">点播封面图</div><div class="fht-cell"></div></th>
82   - <th style="text-align: center; width: 3%; " data-field="mark_name" tabindex="0"><div class="th-inner ">白名单</div><div class="fht-cell"></div></th>
83 94 <th style="text-align: center; width: 6%; " data-field="auditor" tabindex="0"><div class="th-inner ">审核员</div><div class="fht-cell"></div></th>
84 95 <th style="text-align: center; width: 3%; " data-field="is_hot_name" tabindex="0"><div class="th-inner ">热点</div><div class="fht-cell"></div></th>
85 96 <th style="text-align: center; width: 3%; " data-field="state_name" tabindex="0"><div class="th-inner ">审核状态</div><div class="fht-cell"></div></th>
... ... @@ -90,17 +101,19 @@
90 101 <tbody>
91 102 <tr data-index="0" th:each="video : ${videoPage.list}">
92 103 <!--<td class="bs-checkbox "><input data-index="0" name="btSelectItem" type="checkbox"></td>-->
93   - <td style="text-align: center; width: 6%;" th:text="${video.id}"></td>
94   - <td style="text-align: center; width: 20%;" th:text="${video.video_title}">邓建国正面PK冯小刚 选喜剧演员饰演潘金莲</td>
  104 + <td style="text-align: center; width: 6%;" th:text="${video.spid}"></td>
  105 + <td style="text-align: center; width: 20%;" th:text="${video.video_title}">邓建国正面PK冯小刚 </td>
95 106 <td style="text-align: center; width: 10%;">
96 107 <div width="160px" height="90px"><img th:src="@{${video.video_poster}}" width="160px" alt="封面图"></div>
97 108 </td>
98   - <td style="text-align: center; width: 3%;" th:if="${video.auditor_id!=null}">否</td>
99   - <td style="text-align: center; width: 3%;" th:if="${video.auditor_id==null}">是</td>
100   - <td style="text-align: center; width: 6%;" th:text="${video.auditor_id}"></td>
101   - <td style="text-align: center; width: 3%;" th:text="${video.video_priority==1?'是':'否'}">是</td>
102   - <td style="text-align: center; width: 3%;"><span class="btn btn-sm btn-warning" th:text="${video.state}">待审</span></td>
103   - <td style="text-align: center; width: 10%;">2018-03-07 16:56:20</td>
  109 + <td style="text-align: center; width: 6%;" th:text="${video.auditor}">审核员</td>
  110 + <td style="text-align: center; width: 3%;" th:text="${video.video_priority=='1'?'是':'否'}">是</td>
  111 + <td style="text-align: center; width: 3%;">
  112 + <span class="btn btn-sm btn-warning" th:if="${video.state==0}">待审核</span>
  113 + <span class="btn btn-sm btn-warning" th:if="${video.state==1}">审核通过</span>
  114 + <span class="btn btn-sm btn-warning" th:if="${video.state==2}">审核拒绝</span>
  115 + </td>
  116 + <td style="text-align: center; width: 10%;" th:text="${#dates.format(video.video_upload_time, 'yyyy-MM-dd HH:mm:ss')}">2018-03-07 16:56:20</td>
104 117 <td style="text-align: center; width: 17%;">
105 118 <a class="detail" th:href="@{'/videos/details/?id='+${video.id}}">
106 119 <button class="btn btn-default btn-sm" >查看</button>
... ... @@ -140,23 +153,35 @@
140 153 </div>
141 154 </section>
142 155 </div>
143   - <script>
144   - //chenhao
145   - function daishen(state) {
146   - window.location.href = "page?video_title=&start_date=&end_date=&state="+state+"&page=&pageSize=&orderByClause=";
147   - }
148   - function yishen(state) {
149   - window.location.href = "page?video_title=&start_date=&end_date=&state="+state+"&page=&pageSize=&orderByClause=";
150   - }
  156 + <script th:inline="javascript">
  157 + //待审核
  158 + $('#daishen').click(function () {
  159 + var state = 0;
  160 + var video_priority = $("#video_priority").val();
  161 + var video_title = $("#video_titleID").val();
  162 + var start_date = $("#start_date").val();
  163 + var end_date = $("#end_date").val();
  164 + window.location.href = "page?video_title="+video_title+"&start_date="+start_date+"&end_date="+end_date+"&state="+state+"&video_priority="+video_priority;
  165 + });
  166 + //已审核
  167 + $('#yishen').click(function () {
  168 + var state = 1;
  169 + var video_priority = $("#video_priority").val();
  170 + var video_title = $("#video_titleID").val();
  171 + var start_date = $("#start_date").val();
  172 + var end_date = $("#end_date").val();
  173 + window.location.href = "page?video_title="+video_title+"&start_date="+start_date+"&end_date="+end_date+"&state="+state+"&video_priority="+video_priority;
  174 + });
151 175 function quanbu() {
152   - window.location.href = "page?video_title=&start_date=&end_date=&state=&page=&pageSize=&orderByClause=";
  176 + window.location.href = "page";
153 177 }
154 178 //查询
155 179 $('#videos_query').click(function () {
156   - var video_title = $("#video_title").val();
  180 + var video_priority = $("#video_priority").val();
  181 + var video_title = $("#video_titleID").val();
157 182 var start_date = $("#start_date").val();
158 183 var end_date = $("#end_date").val();
159   - window.location.href = "/videos/page?video_title="+video_title+"&start_date="+start_date+"&end_date="+end_date+"&state=&page=&pageSize=&orderByClause=";
  184 + window.location.href = "/videos/page?video_title="+video_title+"&start_date="+start_date+"&end_date="+end_date+"&state=&video_priority="+video_priority;
160 185 });
161 186 </script>
162 187 <!--保留之前的样式代码-->
... ... @@ -205,7 +230,7 @@
205 230  
206 231 /*时间插件*/
207 232 $('.date').datetimepicker({
208   - format: 'YYYY-MM-DD HH:mm',
  233 + format: 'YYYY-MM-DD HH:MM:SS',
209 234 locale: "zh-CN",
210 235 toolbarPlacement: 'bottom',
211 236 showClear: true,
... ...
src/main/resources/templates/page/videoDetail.html
... ... @@ -13,8 +13,8 @@
13 13 点播详情
14 14 </h1>
15 15 <ol class="breadcrumb">
16   - <li><a href="http://shenhe.cnlive.com/index"><i class="fa fa-dashboard"></i> 首页</a></li>
17   - <li class="active"><a href="http://shenhe.cnlive.com/videos/page">点播审核</a></li>
  16 + <li><a ><i class="fa fa-dashboard"></i> 首页</a></li>
  17 + <li class="active"><a >点播审核</a></li>
18 18 </ol>
19 19 </section>
20 20  
... ... @@ -46,10 +46,10 @@
46 46 <div class="col-sm-5">
47 47 <div class="form-group">
48 48 <label for="video_cover_img" class="control-label col-sm-4">封面图:</label>
49   - <div style="height:100px;" th:each="imgs : ${video.video_imgs}">
  49 + <div style="height:100px;" th:if="${imgsStat.index<4}" th:each="imgs :${images}">
50 50 <div class="col-sm-4 popover-options " style="float:left;" >
51 51 <a href="#">
52   - <img src="../../static/js/00002.jpg@base@tag=imgScale&amp;w=224&amp;h=126&amp;m=2&amp;c=1" width="120px" alt="封面图">
  52 + <img img th:src="@{${imgs.value}}" width="120px" alt="封面图">
53 53 </a>
54 54 </div>
55 55 </div>
... ... @@ -81,16 +81,23 @@
81 81 <hr>
82 82 <div class="form-group">
83 83 <div class="col-sm-12">
84   - <div class="modal-body" style="height:450px">
85   - <embed name="cnlive" width="100%" height="100%" id="cnlive" src="http://data.cnlive.com/export/UuidPlayerMain.swf" flashvars="hasBorder=false&amp;appid=82_irej0pbo53&amp;model=2&amp;videoURL=" th:text="${video.video_url}" type="application/x-shockwave-flash" wmode="window" quility="high" allowscriptaccess="always" allowfullscreen="true">
86   - <script>
87   - //给标签附上一个属性
88   - var url = ${video.video_url};
89   - var flashvars = "hasBorder=false&amp;appid=82_irej0pbo53&amp;model=2&amp;videoURL="+url;
90   - alert(flashvars)
91   - var cnlive =$("#cnlive");
92   - cnlive.attr("flashvars",flashvars);
  84 + <div class="modal-body" id="videoBox" style="height:450px">
  85 + <script type="text/javascript" src="//resweb.cnliveimg.com/sites/common/cnlive_video.min.js" ></script>
  86 + <script th:inline="javascript" >
  87 + var videoUrl =[[${video.video_url}]];
  88 + var cover =[[${video.video_poster}]];
  89 + cnliveVideo.init({
  90 + "eleId":"videoBox",
  91 + "width":800,//指定放入指定ID元素内
  92 + "height":450,
  93 + "model":3,
  94 + "autoplay":1,
  95 + "currRate":3,
  96 + "cover":cover,
  97 + "videoUrl_3":videoUrl
  98 + });
93 99 </script>
  100 +
94 101 </div>
95 102 </div>
96 103 </div>
... ... @@ -118,29 +125,29 @@
118 125 <div class="form-group ">
119 126 <label for="auditor_id" class="control-label col-sm-3">审核员:</label>
120 127 <div class="col-sm-9 ">
121   - <h5 id="auditor_id" th:text="${video.auditor_id}">系统审核 </h5>
  128 + <h5 id="auditor_id" th:text="${video.auditor}">系统审核 </h5>
122 129 </div>
123 130 </div>
124 131  
125 132  
126   - <div class="form-group file">
127   - <label class="control-label col-sm-3" for="attr_tags">常用审核意见:</label>
  133 + <!--<div class="form-group file">-->
  134 + <!--<label class="control-label col-sm-3" for="attr_tags">常用审核意见:</label>-->
128 135  
129   - <div class="col-sm-9">
130   - <select class="form-control select2 select2-hidden-accessible" onchange="change()" multiple="" data-placeholder="选择常用审核意见,可多选" name="attr_tags[]" id="attr_tags" style="width: 100%;" tabindex="-1" aria-hidden="true">
131   - <option value="其他" >其他</option>
132   - <option value="不符">不符</option>
133   - <option value="规范">规范</option>
134   - <option value="建议">建议</option>
135   - <option value="错字">错字</option>
136   - <option value="要求">要求</option>
137   - <option value="图片">图片</option>
138   - <option value="敏感">敏感</option>
139   - <option value="视频">视频</option>
140   - <option value="提交">提交</option>
141   - </select>
142   - </div>
143   - </div>
  136 + <!--<div class="col-sm-9">-->
  137 + <!--<select class="form-control select2 select2-hidden-accessible" onchange="change()" multiple="" data-placeholder="选择常用审核意见,可多选" name="attr_tags[]" id="attr_tags" style="width: 100%;" tabindex="-1" aria-hidden="true">-->
  138 + <!--<option value="其他" >其他</option>-->
  139 + <!--<option value="不符">不符</option>-->
  140 + <!--<option value="规范">规范</option>-->
  141 + <!--<option value="建议">建议</option>-->
  142 + <!--<option value="错字">错字</option>-->
  143 + <!--<option value="要求">要求</option>-->
  144 + <!--<option value="图片">图片</option>-->
  145 + <!--<option value="敏感">敏感</option>-->
  146 + <!--<option value="视频">视频</option>-->
  147 + <!--<option value="提交">提交</option>-->
  148 + <!--</select>-->
  149 + <!--</div>-->
  150 + <!--</div>-->
144 151 <div class="form-group">
145 152 <label for="msg" class="control-label col-sm-3">审核备注</label>
146 153 <div class="col-sm-9">
... ...