Commit 7e61cde32bad637874e531c9a262752f38150c4e

Authored by liwei2917
1 parent 8ce38b1c

图文导出优化

src/main/java/com/cnlive/shenhe/controller/ContentController.java
... ... @@ -75,7 +75,7 @@ public class ContentController {
75 75 * @return
76 76 */
77 77 @GetMapping("/page")
78   - public String getPage(Model model, String title,String contentId,
  78 + public String getPage(Model model, String title,String contentId, String content_tag,
79 79 String start_date, String end_date, Integer receive_status, String sp_desc,
80 80 Integer page, Integer pageSize, String orderByClause, HttpSession session) {
81 81 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
... ... @@ -111,7 +111,7 @@ public class ContentController {
111 111 } catch (Exception e) {
112 112 }
113 113 }
114   - PageInfo<ShyContent> contentPage = contentService.getPage( title,contentId, sDate, eDate, receive_status, null, page, pageSize, orderByClause, spid, userId);
  114 + PageInfo<ShyContent> contentPage = contentService.getPage( title,content_tag,contentId, sDate, eDate, receive_status, null, page, pageSize, orderByClause, spid, userId);
115 115 List<ShyContent> list = contentPage.getList();
116 116 if (!list.isEmpty()) {
117 117 for (ShyContent content : list) {
... ... @@ -232,7 +232,7 @@ public class ContentController {
232 232 * 根据条件导出excel
233 233 */
234 234 @GetMapping("excel")
235   - public void getExcel( String title,String contentId,
  235 + public void getExcel( String title,String contentId, String content_tag,
236 236 String start_date, String end_date, Integer receive_status, String sp_desc,
237 237 Integer page, Integer pageSize, String orderByClause, HttpSession session,HttpServletResponse response) {
238 238 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
... ... @@ -261,7 +261,7 @@ public class ContentController {
261 261 } catch (Exception e) {
262 262 }
263 263 }
264   - List<ShyContent> contentList = contentService.findByCondition(title,contentId, sDate, eDate, receive_status, page, pageSize, orderByClause, spid);
  264 + List<ShyContent> contentList = contentService.findByCondition(title,content_tag,contentId, sDate, eDate, receive_status, page, pageSize, orderByClause, spid);
265 265  
266 266 String fileName = "图文数据";
267 267  
... ... @@ -277,7 +277,7 @@ public class ContentController {
277 277 cell = row.createCell(1);//列
278 278 cell.setCellValue("sp昵称");
279 279 cell = row.createCell(2);//列
280   - cell.setCellValue("发布云id");
  280 + cell.setCellValue("图文id");
281 281 cell = row.createCell(3);//列
282 282 cell.setCellValue("内容标题");
283 283 cell = row.createCell(4);//列
... ... @@ -297,9 +297,9 @@ public class ContentController {
297 297 cell = row.createCell(11);//列
298 298 cell.setCellValue("审核意见");
299 299 cell = row.createCell(12);//列
300   - cell.setCellValue("来源");
  300 + cell.setCellValue("来源(昵称)");
301 301 cell = row.createCell(13);//列
302   - cell.setCellValue("作者");
  302 + cell.setCellValue("作者(sid)");
303 303 cell = row.createCell(14);//列
304 304 cell.setCellValue("图文url");
305 305  
... ... @@ -313,8 +313,15 @@ public class ContentController {
313 313 cell.setCellValue(contentList.get(i).getContent_id());
314 314 cell = row.createCell(3);//列
315 315 cell.setCellValue(contentList.get(i).getTitle());
  316 + /*状态需要处理成用户可读*/
  317 + String contentTag = "";//图文标签 content:图文发布,moment:朋友圈
  318 + if (contentList.get(i).getContent_tag().equals("content") ) {
  319 + contentTag = "图文发布";
  320 + } else if (contentList.get(i).getContent_tag().equals("moment")) {
  321 + contentTag = "朋友圈";
  322 + }
316 323 cell = row.createCell(4);//列
317   - cell.setCellValue(contentList.get(i).getContent_tag());
  324 + cell.setCellValue(contentTag);
318 325  
319 326 /*状态需要处理成用户可读*/
320 327 String shenheType = "";//审核类型,1:免审,2:机审,3:人工审
... ... @@ -343,9 +350,9 @@ public class ContentController {
343 350 cell = row.createCell(6);//列
344 351 cell.setCellValue(contentStatus);
345 352 cell = row.createCell(7);//列
346   - cell.setCellValue(CommonUtils.formatDate(contentList.get(i).getContent_time(), "yyyy-MM-dd HH:mm:ss"));
  353 + cell.setCellValue(contentList.get(i).getContent_time()==null?"":CommonUtils.formatDate(contentList.get(i).getContent_time(), "yyyy-MM-dd HH:mm:ss"));
347 354 cell = row.createCell(8);//列
348   - cell.setCellValue(CommonUtils.formatDate(contentList.get(i).getCreate_date(), "yyyy-MM-dd HH:mm:ss"));
  355 + cell.setCellValue(contentList.get(i).getCreate_date()==null?"":CommonUtils.formatDate(contentList.get(i).getCreate_date(), "yyyy-MM-dd HH:mm:ss"));
349 356  
350 357 /*状态需要处理成用户可读*/
351 358 String receiveStatus = "";//领取状态。0:未领取;1:已领取,2:已审核
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/ContentServiceImpl.java
... ... @@ -91,7 +91,7 @@ public class ContentServiceImpl {
91 91 return shyCommentsMapper.updateByPrimaryKeySelective(shyComments);
92 92 }
93 93  
94   - public PageInfo<ShyContent> getPage( String title,String contentId, Date start_date, Date end_date, Integer receive_status, String updater, Integer page, Integer pageSize, String orderByClause, Integer spid, String userId) {
  94 + public PageInfo<ShyContent> getPage( String title,String content_tag,String contentId, Date start_date, Date end_date, Integer receive_status, String updater, Integer page, Integer pageSize, String orderByClause, Integer spid, String userId) {
95 95 Example example = new Example(ShyContent.class);
96 96 Example.Criteria criteria = example.createCriteria();
97 97 if (CommonUtils.isNotEmpty(orderByClause)) {
... ... @@ -111,6 +111,9 @@ public class ContentServiceImpl {
111 111 if (CommonUtils.isNotEmpty(updater)) {
112 112 criteria.andEqualTo("updater", updater);
113 113 }
  114 + if (CommonUtils.isNotEmpty(content_tag)) {
  115 + criteria.andEqualTo("content_tag", content_tag);
  116 + }
114 117 if (CommonUtils.isNotNull(spid)) {
115 118 criteria.andEqualTo("sp_id", spid);
116 119 }
... ... @@ -134,7 +137,7 @@ public class ContentServiceImpl {
134 137 * 根据条件导出数据excel
135 138 * @return
136 139 */
137   - public List<ShyContent> findByCondition(String title,String contentId, Date start_date,
  140 + public List<ShyContent> findByCondition(String title,String content_tag,String contentId, Date start_date,
138 141 Date end_date,Integer receive_status, Integer page,
139 142 Integer pageSize, String orderByClause, Integer spid) {
140 143  
... ... @@ -160,6 +163,9 @@ public class ContentServiceImpl {
160 163 if (CommonUtils.isNotEmpty(contentId)) {
161 164 criteria.andEqualTo("content_id", contentId);
162 165 }
  166 + if (CommonUtils.isNotEmpty(content_tag)) {
  167 + criteria.andEqualTo("content_tag", content_tag);
  168 + }
163 169 if (CommonUtils.isNotNull(receive_status)) {
164 170 criteria.andEqualTo("receive_status", receive_status);
165 171 }
... ...
src/main/resources/templates/page/content.html
... ... @@ -85,22 +85,22 @@
85 85 </div>
86 86 </div>
87 87  
88   -<!-- <div class="btn-group margin-bottom col-md-6" style="padding: 0;width: 10%;float: left;"> -->
89   -<!-- <div class="col-md-5" style="padding: 0;width: 100%;"> -->
90   -<!-- <label for="video_priority" class="control-label cb-toolbar">热点:</label> -->
91   -<!-- <div class="col-sm-8" style="padding: 0;"> -->
92   -<!-- <select class="form-control" id="video_priority" name="video_priority"> -->
93   -<!-- <option value="">全部</option> -->
94   -<!-- <option value="1">是</option> -->
95   -<!-- <option value="0">否</option> -->
96   -<!-- </select> -->
97   -<!-- <input class="form-control" name="video_priority" type="text" id="video_priority"> -->
98   -<!-- </div> -->
99   -<!-- </div> -->
100   -<!-- </div> -->
  88 + <div class="btn-group margin-bottom col-md-6" style="padding: 0;width: 10%;float: left;">
  89 + <div class="col-md-5" style="padding: 0;width: 100%;">
  90 + <label for="content_tag" class="control-label cb-toolbar">标签:</label>
  91 + <div class="col-sm-8" style="padding: 0;">
  92 + <select class="form-control" id="content_tag" name="content_tag">
  93 + <option value="">全部</option>
  94 + <option value="content">图文发布</option>
  95 + <option value="moment">朋友圈</option>
  96 + </select>
  97 +<!-- <input class="form-control" name="content_tag" type="text" id="content_tag"> -->
  98 + </div>
  99 + </div>
  100 + </div>
101 101  
102 102 <div class="btn-group margin-bottom col-md-6 pull-right"
103   - style="position: relative;width: 85%;float: left !important;">
  103 + style="position: relative;width: 75%;float: left !important;">
104 104 <div class="col-md-18" style="width: 100%;padding: 0;">
105 105 <div class="col-md-10" style="padding: 0;width: 20%;">
106 106 <label for="start_date" class="control-label cb-toolbar">时间:</label>
... ... @@ -380,6 +380,7 @@
380 380 var sp_desc ="";
381 381 var count = "";
382 382 var contentId = "";
  383 + var content_tag = "";
383 384  
384 385 function updateValue(){
385 386 title = $("#video_titleID").val();
... ... @@ -390,6 +391,7 @@
390 391 sp_desc = $("#sp_desc").val();
391 392 count = $("#count").val();
392 393 contentId = $("#contentId").val();
  394 + content_tag = $("#content_tag").val();
393 395 }
394 396 }
395 397  
... ... @@ -398,54 +400,32 @@
398 400 function quanbu() {
399 401 updateValue();
400 402  
401   -// window.location.href = "/videos/page?video_title=&start_date=&end_date=&state=&receive=&video_priority=";
402   - window.location.href = "/content/page?title=" + title + "&start_date=" + start_date + "&end_date=" + end_date + "&sp_desc=" + sp_desc+"&pageSize="+count+"&contentId="+contentId;
  403 + window.location.href = "/content/page?title=" + title + "&start_date=" + start_date + "&end_date=" + end_date + "&sp_desc=" + sp_desc+"&pageSize="+count+"&contentId="+contentId+"&content_tag="+content_tag;
403 404 }
404 405  
405 406 //全部待领
406 407 $('#daishen').click(function () {
407 408 updateValue();
408 409 var receive_status = 0;
409   -// var title = $("#video_titleID").val();
410   -// var start_date = $("#start_date").val();
411   -// var end_date = $("#end_date").val();
412   -// var sp_desc = $("#sp_desc").val();
413   -// var count = $("#count").val();
414   - window.location.href = "/content/page?title=" + title + "&start_date=" + start_date + "&end_date=" + end_date + "&receive_status=" + receive_status + "&sp_desc=" + sp_desc+"&pageSize="+count+"&contentId="+contentId;
  410 + window.location.href = "/content/page?title=" + title + "&start_date=" + start_date + "&end_date=" + end_date + "&receive_status=" + receive_status + "&sp_desc=" + sp_desc+"&pageSize="+count+"&contentId="+contentId+"&content_tag="+content_tag;
415 411 });
416 412 //我的待审核
417 413 $('#Mydaishen').click(function () {
418 414 updateValue();
419 415 var receive_status = 1;
420   -// var title = $("#video_titleID").val();
421   -// var start_date = $("#start_date").val();
422   -// var end_date = $("#end_date").val();
423   -// var sp_desc = $("#sp_desc").val();
424   -// var count = $("#count").val();
425   - window.location.href = "/content/page?title=" + title + "&start_date=" + start_date + "&end_date=" + end_date + "&receive_status=" + receive_status + "&sp_desc=" + sp_desc+"&pageSize="+count+"&contentId="+contentId;
  416 + window.location.href = "/content/page?title=" + title + "&start_date=" + start_date + "&end_date=" + end_date + "&receive_status=" + receive_status + "&sp_desc=" + sp_desc+"&pageSize="+count+"&contentId="+contentId+"&content_tag="+content_tag;
426 417 });
427 418 //我的已审核
428 419 $('#yishen').click(function () {
429 420 updateValue();
430 421 var receive_status = 2;
431   -// var title = $("#video_titleID").val();
432   -// var start_date = $("#start_date").val();
433   -// var end_date = $("#end_date").val();
434   -// var sp_desc = $("#sp_desc").val();
435   -// var count = $("#count").val();
436   - window.location.href = "/content/page?title=" + title + "&start_date=" + start_date + "&end_date=" + end_date + "&receive_status=" + receive_status + "&sp_desc=" + sp_desc+"&pageSize="+count+"&contentId="+contentId;
  422 + window.location.href = "/content/page?title=" + title + "&start_date=" + start_date + "&end_date=" + end_date + "&receive_status=" + receive_status + "&sp_desc=" + sp_desc+"&pageSize="+count+"&contentId="+contentId+"&content_tag="+content_tag;
437 423 });
438 424  
439 425  
440 426 //查询
441 427 $('#videos_query').click(function () {
442   -// var video_priority = $("#video_priority").val();
443   -// var title = $("#video_titleID").val();
444   -// var start_date = $("#start_date").val();
445   -// var end_date = $("#end_date").val();
446   -// var sp_desc = $("#sp_desc").val();
447   -// var count = $("#count").val();
448   - window.location.href = "/content/page?title=" + title + "&start_date=" + start_date + "&end_date=" + end_date + "&receive_status=" + "&sp_desc=" + sp_desc+"&pageSize="+count+"&contentId="+contentId;
  428 + window.location.href = "/content/page?title=" + title + "&start_date=" + start_date + "&end_date=" + end_date + "&receive_status=" + "&sp_desc=" + sp_desc+"&pageSize="+count+"&contentId="+contentId+"&content_tag="+content_tag;
449 429 });
450 430 /*全选的操作*/
451 431 $('#select_all').click(function () {
... ...