Commit 265328592b43b965bb47b6ec4ed63448d41768bf

Authored by liwei2917
1 parent 7dfb2fb4

增加导出功能

src/main/java/com/cnlive/shenhe/controller/ContentController.java
... ... @@ -6,6 +6,7 @@ import com.cnlive.shenhe.bean.ResponseBean;
6 6 import com.cnlive.shenhe.bean.SessionUser;
7 7 import com.cnlive.shenhe.entity.ShyComments;
8 8 import com.cnlive.shenhe.entity.ShyContent;
  9 +import com.cnlive.shenhe.entity.ShyLive;
9 10 import com.cnlive.shenhe.entity.ShySites;
10 11 import com.cnlive.shenhe.entity.ShyUsers;
11 12 import com.cnlive.shenhe.entity.ShyVideos;
... ... @@ -17,6 +18,11 @@ import com.cnlive.shenhe.utils.AuditPass;
17 18 import com.cnlive.shenhe.utils.CommonConst;
18 19 import com.cnlive.shenhe.utils.CommonUtils;
19 20 import com.github.pagehelper.PageInfo;
  21 +
  22 +import org.apache.poi.xssf.usermodel.XSSFCell;
  23 +import org.apache.poi.xssf.usermodel.XSSFRow;
  24 +import org.apache.poi.xssf.usermodel.XSSFSheet;
  25 +import org.apache.poi.xssf.usermodel.XSSFWorkbook;
20 26 import org.slf4j.Logger;
21 27 import org.slf4j.LoggerFactory;
22 28 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -24,7 +30,15 @@ import org.springframework.stereotype.Controller;
24 30 import org.springframework.ui.Model;
25 31 import org.springframework.web.bind.annotation.*;
26 32  
  33 +import javax.servlet.ServletOutputStream;
  34 +import javax.servlet.http.HttpServletResponse;
27 35 import javax.servlet.http.HttpSession;
  36 +
  37 +import java.io.BufferedInputStream;
  38 +import java.io.BufferedOutputStream;
  39 +import java.io.ByteArrayInputStream;
  40 +import java.io.ByteArrayOutputStream;
  41 +import java.io.InputStream;
28 42 import java.util.Date;
29 43 import java.util.List;
30 44  
... ... @@ -206,5 +220,202 @@ public class ContentController {
206 220 return new ResponseBean(ErrorEnum.SUCCESS.getErrorCode(), "退领了" + n + "条内容");
207 221 }
208 222  
209   -
  223 + /**
  224 + * 根据条件导出excel
  225 + */
  226 + @GetMapping("excel")
  227 + public void getExcel( String title,String contentId,
  228 + String start_date, String end_date, Integer receive_status, String sp_desc,
  229 + Integer page, Integer pageSize, String orderByClause, HttpSession session,HttpServletResponse response) {
  230 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  231 + Integer spid = sessionUser.getSpid();
  232 + String userId = sessionUser.getUserId();
  233 + if (CommonUtils.isNotEmpty(sp_desc) && spid == 0) {
  234 + ShySites shySite=sitesService.findspidBySpdesc(sp_desc);
  235 + if(CommonUtils.isNotNull(shySite)){
  236 + spid = shySite.getSpid();
  237 + }
  238 + }else if (CommonUtils.isEmpty(sp_desc) && spid == 0) {
  239 + spid = null;
  240 + }
  241 + Date sDate = null;
  242 + Date eDate = null;
  243 +
  244 + if (CommonUtils.isNotEmpty(start_date)) {
  245 + try {
  246 + sDate = CommonUtils.parseDate(start_date, "yyyy-MM-dd");
  247 + } catch (Exception e) {
  248 + }
  249 + }
  250 + if (CommonUtils.isNotEmpty(end_date)) {
  251 + try {
  252 + eDate = CommonUtils.parseDate(end_date, "yyyy-MM-dd");
  253 + } catch (Exception e) {
  254 + }
  255 + }
  256 + List<ShyContent> contentList = contentService.findByCondition(title,contentId, sDate, eDate, receive_status, page, pageSize, orderByClause, spid);
  257 +
  258 + String fileName = "图文数据";
  259 +
  260 + XSSFWorkbook wb = new XSSFWorkbook();
  261 + ServletOutputStream out = null;
  262 + BufferedInputStream bis = null;
  263 + BufferedOutputStream bos = null;
  264 + try {
  265 + XSSFSheet sheetlist = wb.createSheet(fileName);
  266 + XSSFRow row = sheetlist.createRow(0);//行
  267 + XSSFCell cell = row.createCell(0);//列
  268 + cell.setCellValue("id");
  269 + cell = row.createCell(1);//列
  270 + cell.setCellValue("sp昵称");
  271 + cell = row.createCell(2);//列
  272 + cell.setCellValue("发布云id");
  273 + cell = row.createCell(3);//列
  274 + cell.setCellValue("内容标题");
  275 + cell = row.createCell(4);//列
  276 + cell.setCellValue("图文标签");
  277 + cell = row.createCell(5);//列
  278 + cell.setCellValue("审核类型");
  279 + cell = row.createCell(6);//列
  280 + cell.setCellValue("内容状态");
  281 + cell = row.createCell(7);//列
  282 + cell.setCellValue("图文创建时间");
  283 + cell = row.createCell(8);//列
  284 + cell.setCellValue("图文送审时间");
  285 + cell = row.createCell(9);//列
  286 + cell.setCellValue("领取状态");
  287 + cell = row.createCell(10);//列
  288 + cell.setCellValue("审核人");
  289 + cell = row.createCell(11);//列
  290 + cell.setCellValue("审核意见");
  291 + cell = row.createCell(12);//列
  292 + cell.setCellValue("来源");
  293 + cell = row.createCell(13);//列
  294 + cell.setCellValue("作者");
  295 + cell = row.createCell(14);//列
  296 + cell.setCellValue("图文url");
  297 +
  298 + for (int i = 0; i < contentList.size(); i++) {
  299 + row = sheetlist.createRow((short) (i + 1));//行
  300 + cell = row.createCell(0);//列
  301 + cell.setCellValue(contentList.get(i).getId());
  302 + cell = row.createCell(1);//列
  303 + cell.setCellValue(sitesService.findspidDescByspid(contentList.get(i).getSp_id()).getName());
  304 + cell = row.createCell(2);//列
  305 + cell.setCellValue(contentList.get(i).getContent_id());
  306 + cell = row.createCell(3);//列
  307 + cell.setCellValue(contentList.get(i).getTitle());
  308 + cell = row.createCell(4);//列
  309 + cell.setCellValue(contentList.get(i).getContent_tag());
  310 +
  311 + /*状态需要处理成用户可读*/
  312 + String shenheType = "";//审核类型,1:免审,2:机审,3:人工审
  313 + if (contentList.get(i).getShenhe_type() == 1) {
  314 + shenheType = "免审";
  315 + } else if (contentList.get(i).getShenhe_type() == 2) {
  316 + shenheType = "机审";
  317 + } else {
  318 + shenheType = "人工审";
  319 + }
  320 + cell = row.createCell(5);//列
  321 + cell.setCellValue(shenheType);
  322 +
  323 + /*状态需要处理成用户可读*/
  324 + String contentStatus = "";//内容状态:0:待发布,1:已发布,2:已下线,3:已删除
  325 + if (contentList.get(i).getContent_status() == 0) {
  326 + contentStatus = "待发布";
  327 + } else if (contentList.get(i).getContent_status() == 1) {
  328 + contentStatus = "已发布";
  329 + } else if(contentList.get(i).getContent_status() == 2){
  330 + contentStatus = "已下线";
  331 + }else if(contentList.get(i).getContent_status() == 3){
  332 + contentStatus = "已删除";
  333 + }
  334 +
  335 + cell = row.createCell(6);//列
  336 + cell.setCellValue(contentStatus);
  337 + cell = row.createCell(7);//列
  338 + cell.setCellValue(CommonUtils.formatDate(contentList.get(i).getContent_time(), "yyyy-MM-dd HH:mm:ss"));
  339 + cell = row.createCell(8);//列
  340 + cell.setCellValue(CommonUtils.formatDate(contentList.get(i).getCreate_date(), "yyyy-MM-dd HH:mm:ss"));
  341 +
  342 + /*状态需要处理成用户可读*/
  343 + String receiveStatus = "";//领取状态。0:未领取;1:已领取,2:已审核
  344 + if (contentList.get(i).getReceive_status() == 1) {
  345 + receiveStatus = "已领取";
  346 + } else if (contentList.get(i).getReceive_status() == 2) {
  347 + receiveStatus = "已审核";
  348 + } else {
  349 + receiveStatus = "未领取";
  350 + }
  351 +
  352 + cell = row.createCell(9);//列
  353 + cell.setCellValue(receiveStatus);
  354 +
  355 + /* 审核员需要做处理*/
  356 + String updater = "";//审核员名字
  357 + if (contentList.get(i).getReceive_status() != CommonConst.RECEIVE_BEFORE) {
  358 + updater = CommonUtils.isEmpty(contentList.get(i).getUpdater()) || "null".equals(contentList.get(i).getUpdater())? "自动通过":contentList.get(i).getUpdater();
  359 + String auditor_id = contentList.get(i).getAuditor_id();
  360 + if (CommonUtils.isNotEmpty(auditor_id)) {
  361 + ShyUsers user = new ShyUsers();
  362 + user.setUser_id(auditor_id);
  363 + user = usersService.select(user);
  364 + if (CommonUtils.isNotNull(user)) {
  365 + String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail();
  366 + String userName = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername();
  367 + updater = userName ;
  368 + }
  369 + }
  370 + }
  371 + cell = row.createCell(10);//列
  372 + cell.setCellValue(updater);
  373 +
  374 +
  375 +
  376 + cell = row.createCell(11);//列
  377 + cell.setCellValue(contentList.get(i).getShenhe_msg());
  378 + cell = row.createCell(12);//列
  379 + cell.setCellValue(contentList.get(i).getSource());
  380 + cell = row.createCell(13);//列
  381 + cell.setCellValue(contentList.get(i).getAuthor());
  382 + cell = row.createCell(14);//列
  383 + cell.setCellValue(contentList.get(i).getContent_url());
  384 + }
  385 +
  386 + ByteArrayOutputStream os = new ByteArrayOutputStream();
  387 + wb.write(os);
  388 + byte[] content = os.toByteArray();
  389 + InputStream is = new ByteArrayInputStream(content);
  390 + response.setContentType("application/vnd.ms-excel;charset=utf-8");
  391 + response.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xlsx").getBytes(), "iso-8859-1"));
  392 + out = response.getOutputStream();
  393 + bis = new BufferedInputStream(is);
  394 + bos = new BufferedOutputStream(out);
  395 + byte[] buff = new byte[2048];
  396 + int bytesRead;
  397 + while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
  398 + bos.write(buff, 0, bytesRead);
  399 + }
  400 + } catch (final Exception e) {
  401 + e.printStackTrace();
  402 + try {
  403 + if (bis != null)
  404 + bis.close();
  405 + if (bos != null)
  406 + bos.close();
  407 + } catch (Exception e1) {
  408 + e1.printStackTrace();
  409 + }
  410 + } finally {
  411 + try {
  412 + if (bis != null)
  413 + bis.close();
  414 + if (bos != null)
  415 + bos.close();
  416 + } catch (Exception e2) {
  417 + e2.printStackTrace();
  418 + }
  419 + }
  420 + }
210 421 }
... ...
src/main/java/com/cnlive/shenhe/controller/LiveController.java
... ... @@ -280,6 +280,190 @@ public class LiveController {
280 280 return responseBean;
281 281 }
282 282  
  283 + /**
  284 + * 根据条件导出excel
  285 + */
  286 + @GetMapping("excel")
  287 + public void getExcel(String activity_id,String start_date,String end_date,
  288 + String activity_name, Integer activity_status, Integer page,Integer pageSize,
  289 + Integer shenhe_state, String orderByClause, String sp_desc, HttpSession session,HttpServletResponse response) {
  290 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  291 + Integer spid = sessionUser.getSpid();
  292 + String userId = sessionUser.getUserId();
  293 + if (CommonUtils.isNotEmpty(sp_desc) && spid == 0) {
  294 + ShySites shySite=sitesService.findspidBySpdesc(sp_desc);
  295 + if(CommonUtils.isNotNull(shySite)){
  296 + spid = shySite.getSpid();
  297 + }
  298 + }else if (CommonUtils.isEmpty(sp_desc) && spid == 0) {
  299 + spid = null;
  300 + }
  301 + List<ShyLive> liveList = liveService.findByCondition(activity_name, start_date,end_date,
  302 + activity_id, activity_status, page, pageSize, shenhe_state, orderByClause, spid);
  303 +
  304 + String fileName = "直播数据";
  305 +
  306 + XSSFWorkbook wb = new XSSFWorkbook();
  307 + ServletOutputStream out = null;
  308 + BufferedInputStream bis = null;
  309 + BufferedOutputStream bos = null;
  310 + try {
  311 + XSSFSheet sheetlist = wb.createSheet(fileName);
  312 + XSSFRow row = sheetlist.createRow(0);//行
  313 + XSSFCell cell = row.createCell(0);//列
  314 + cell.setCellValue("id");
  315 + cell = row.createCell(1);//列
  316 + cell.setCellValue("sp昵称");
  317 + cell = row.createCell(2);//列
  318 + cell.setCellValue("频道_id");
  319 + cell = row.createCell(3);//列
  320 + cell.setCellValue("直播活动id");
  321 + cell = row.createCell(4);//列
  322 + cell.setCellValue("直播活动名称");
  323 + cell = row.createCell(5);//列
  324 + cell.setCellValue("直播活动状态");
  325 + cell = row.createCell(6);//列
  326 + cell.setCellValue("直播活动开始时间");
  327 + cell = row.createCell(7);//列
  328 + cell.setCellValue("直播活动结束时间");
  329 + cell = row.createCell(8);//列
  330 + cell.setCellValue("直播活动简介");
  331 + cell = row.createCell(9);//列
  332 + cell.setCellValue("审核类型");
  333 + cell = row.createCell(10);//列
  334 + cell.setCellValue("审核状态");
  335 + cell = row.createCell(11);//列
  336 + cell.setCellValue("审核员");
  337 + cell = row.createCell(12);//列
  338 + cell.setCellValue("审核信息");
  339 + cell = row.createCell(13);//列
  340 + cell.setCellValue("创建时间");
  341 + cell = row.createCell(14);//列
  342 + cell.setCellValue("最后更新时间");
  343 +
  344 + for (int i = 0; i < liveList.size(); i++) {
  345 + row = sheetlist.createRow((short) (i + 1));//行
  346 + cell = row.createCell(0);//列
  347 + cell.setCellValue(liveList.get(i).getId());
  348 + cell = row.createCell(1);//列
  349 + cell.setCellValue(sitesService.findspidDescByspid(liveList.get(i).getSp_id()).getName());
  350 + cell = row.createCell(2);//列
  351 + cell.setCellValue(liveList.get(i).getChannel_id());
  352 + cell = row.createCell(3);//列
  353 + cell.setCellValue(liveList.get(i).getActivity_id());
  354 + cell = row.createCell(4);//列
  355 + cell.setCellValue(liveList.get(i).getActivity_name());
  356 + /*状态需要处理成用户可读*/
  357 + String activityStatus = "";//直播活动状态,1:直播中,2:直播完成,3:待直播,0:直播撤销(手动),4:直播下线(强制)
  358 + if (liveList.get(i).getActivity_status() == 0) {
  359 + activityStatus = "直播撤销(手动)";
  360 + } else if (liveList.get(i).getActivity_status() == 1) {
  361 + activityStatus = "正在直播";
  362 + } else if(liveList.get(i).getActivity_status() == 2){
  363 + activityStatus = "直播完成";
  364 + }else if(liveList.get(i).getActivity_status() == 3){
  365 + activityStatus = "等待直播";
  366 + }else if(liveList.get(i).getActivity_status() == 4){
  367 + activityStatus = "直播下线(强制)";
  368 + }
  369 + cell = row.createCell(5);//列
  370 + cell.setCellValue(activityStatus);
  371 + cell = row.createCell(6);//列
  372 + cell.setCellValue(CommonUtils.formatDate(liveList.get(i).getActivity_start_time(), "yyyy-MM-dd HH:mm:ss"));
  373 + cell = row.createCell(7);//列
  374 + cell.setCellValue(CommonUtils.formatDate(liveList.get(i).getActivity_end_time(), "yyyy-MM-dd HH:mm:ss"));
  375 + cell = row.createCell(8);//列
  376 + cell.setCellValue(liveList.get(i).getActivity_intro());
  377 +
  378 + /*状态需要处理成用户可读*/
  379 + String shenheType = "";//审核类型,1:免审,2:机审,3:人工审
  380 + if (liveList.get(i).getShenhe_type() == 1) {
  381 + shenheType = "免审";
  382 + } else if (liveList.get(i).getShenhe_type() == 2) {
  383 + shenheType = "机审";
  384 + } else {
  385 + shenheType = "人工审";
  386 + }
  387 +
  388 + cell = row.createCell(9);//列
  389 + cell.setCellValue(shenheType);
  390 +
  391 + /*状态需要处理成用户可读*/
  392 + String shenheState = "";//审核状态 0:未认领 1.已认领,2:已审核
  393 + if (liveList.get(i).getShenhe_type() == 1) {
  394 + shenheState = "已认领";
  395 + } else if (liveList.get(i).getShenhe_type() == 2) {
  396 + shenheState = "已审核";
  397 + } else {
  398 + shenheState = "未认领";
  399 + }
  400 +
  401 + cell = row.createCell(10);//列
  402 + cell.setCellValue(shenheState);
  403 +
  404 + /* 审核员需要做处理*/
  405 + String updater = "";//审核员名字
  406 + if (liveList.get(i).getShenhe_state() != CommonConst.RECEIVE_BEFORE) {
  407 + updater = CommonUtils.isEmpty(liveList.get(i).getUpdater()) || "null".equals(liveList.get(i).getUpdater())? "自动通过":liveList.get(i).getUpdater();
  408 + String auditor_id = liveList.get(i).getAuditor();
  409 + if (CommonUtils.isNotEmpty(auditor_id)) {
  410 + ShyUsers user = new ShyUsers();
  411 + user.setUser_id(auditor_id);
  412 + user = usersService.select(user);
  413 + if (CommonUtils.isNotNull(user)) {
  414 + String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail();
  415 + String userName = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername();
  416 + updater = userName ;
  417 + }
  418 + }
  419 + }
  420 +
  421 + cell = row.createCell(11);//列
  422 + cell.setCellValue(updater);
  423 + cell = row.createCell(12);//列
  424 + cell.setCellValue(liveList.get(i).getShenhe_msg());
  425 + cell = row.createCell(13);//列
  426 + cell.setCellValue(CommonUtils.formatDate(liveList.get(i).getCreated_at(), "yyyy-MM-dd HH:mm:ss"));
  427 + cell = row.createCell(14);//列
  428 + cell.setCellValue(CommonUtils.formatDate(liveList.get(i).getUpdated_at(), "yyyy-MM-dd HH:mm:ss"));
  429 + }
  430 +
  431 + ByteArrayOutputStream os = new ByteArrayOutputStream();
  432 + wb.write(os);
  433 + byte[] content = os.toByteArray();
  434 + InputStream is = new ByteArrayInputStream(content);
  435 + response.setContentType("application/vnd.ms-excel;charset=utf-8");
  436 + response.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xlsx").getBytes(), "iso-8859-1"));
  437 + out = response.getOutputStream();
  438 + bis = new BufferedInputStream(is);
  439 + bos = new BufferedOutputStream(out);
  440 + byte[] buff = new byte[2048];
  441 + int bytesRead;
  442 + while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
  443 + bos.write(buff, 0, bytesRead);
  444 + }
  445 + } catch (final Exception e) {
  446 + e.printStackTrace();
  447 + try {
  448 + if (bis != null)
  449 + bis.close();
  450 + if (bos != null)
  451 + bos.close();
  452 + } catch (Exception e1) {
  453 + e1.printStackTrace();
  454 + }
  455 + } finally {
  456 + try {
  457 + if (bis != null)
  458 + bis.close();
  459 + if (bos != null)
  460 + bos.close();
  461 + } catch (Exception e2) {
  462 + e2.printStackTrace();
  463 + }
  464 + }
  465 + }
  466 +
283 467 @PostMapping("/ceshi")
284 468 @ResponseBody
285 469 public static String ceshi(String name) {
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/ContentServiceImpl.java
... ... @@ -3,6 +3,7 @@ package com.cnlive.shenhe.serviceImpl;
3 3 import com.alibaba.fastjson.JSONObject;
4 4 import com.cnlive.shenhe.entity.ShyComments;
5 5 import com.cnlive.shenhe.entity.ShyContent;
  6 +import com.cnlive.shenhe.entity.ShyLive;
6 7 import com.cnlive.shenhe.entity.ShySites;
7 8 import com.cnlive.shenhe.entity.ShyUsers;
8 9 import com.cnlive.shenhe.entity.ShyVideos;
... ... @@ -22,6 +23,8 @@ import org.springframework.beans.factory.annotation.Autowired;
22 23 import org.springframework.stereotype.Service;
23 24 import tk.mybatis.mapper.entity.Example;
24 25  
  26 +import java.sql.Timestamp;
  27 +import java.text.ParseException;
25 28 import java.util.Date;
26 29 import java.util.List;
27 30  
... ... @@ -91,9 +94,11 @@ public class ContentServiceImpl {
91 94 } else {
92 95 example.setOrderByClause("create_date desc");
93 96 }
94   - if (CommonUtils.isNotNull(start_date) && CommonUtils.isNotNull(end_date)) {
  97 + if (CommonUtils.isNotNull(start_date) ) {
95 98 criteria.andGreaterThanOrEqualTo("create_date", start_date);
96   - criteria.andLessThanOrEqualTo("create_date", end_date);
  99 + }
  100 + if ( CommonUtils.isNotNull(end_date)) {
  101 + criteria.andLessThanOrEqualTo("create_date", end_date);
97 102 }
98 103 if (CommonUtils.isNotEmpty(title)) {
99 104 criteria.andLike("title", "%" + title + "%");
... ... @@ -104,15 +109,9 @@ public class ContentServiceImpl {
104 109 if (CommonUtils.isNotNull(spid)) {
105 110 criteria.andEqualTo("sp_id", spid);
106 111 }
107   - if (CommonUtils.isNotNull(contentId)) {
  112 + if (CommonUtils.isNotEmpty(contentId)) {
108 113 criteria.andEqualTo("content_id", contentId);
109 114 }
110   -// if (CommonUtils.isNotNull(is_hot)) {
111   -// criteria.andEqualTo("is_hot", is_hot);
112   -// }
113   -// if (CommonUtils.isNotEmpty(activity_id)) {
114   -// criteria.andLike("auditor_id", "%" + activity_id + "%");
115   -// }
116 115 if (CommonUtils.isNotNull(receive_status)) {
117 116 criteria.andEqualTo("receive_status", receive_status);
118 117 if (receive_status!=CommonConst.RECEIVE_BEFORE) {
... ... @@ -120,20 +119,49 @@ public class ContentServiceImpl {
120 119 }
121 120 }
122 121  
123   -// if (CommonUtils.isNotEmpty(states)) {
124   -// Example.Criteria criteria1 = example.createCriteria();
125   -// String[] stas = states.split(",");
126   -// for (String s : stas) {
127   -// criteria1.orEqualTo("state", Integer.parseInt(s));
128   -// }
129   -// example.and(criteria1);
130   -// }
131   -
132 122 PageHelper.startPage(page, pageSize, true);
133 123 List<ShyContent> contentList = shyContentMapper.selectByExample(example);
134 124 PageInfo<ShyContent> pageInfo = new PageInfo<>(contentList);
135 125 return pageInfo;
136 126 }
  127 +
  128 + /**
  129 + * 根据条件导出数据excel
  130 + * @return
  131 + */
  132 + public List<ShyContent> findByCondition(String title,String contentId, Date start_date,
  133 + Date end_date,Integer receive_status, Integer page,
  134 + Integer pageSize, String orderByClause, Integer spid) {
  135 +
  136 + Example example = new Example(ShyContent.class);
  137 + Example.Criteria criteria = example.createCriteria();
  138 + if (CommonUtils.isNotEmpty(orderByClause)) {
  139 + example.setOrderByClause(orderByClause);
  140 + } else {
  141 + example.setOrderByClause("create_date desc");
  142 + }
  143 + if (CommonUtils.isNotNull(start_date) ) {
  144 + criteria.andGreaterThanOrEqualTo("create_date", start_date);
  145 + }
  146 + if ( CommonUtils.isNotNull(end_date)) {
  147 + criteria.andLessThanOrEqualTo("create_date", end_date);
  148 + }
  149 + if (CommonUtils.isNotEmpty(title)) {
  150 + criteria.andLike("title", "%" + title + "%");
  151 + }
  152 + if (CommonUtils.isNotNull(spid)) {
  153 + criteria.andEqualTo("sp_id", spid);
  154 + }
  155 + if (CommonUtils.isNotEmpty(contentId)) {
  156 + criteria.andEqualTo("content_id", contentId);
  157 + }
  158 + if (CommonUtils.isNotNull(receive_status)) {
  159 + criteria.andEqualTo("receive_status", receive_status);
  160 + }
  161 + List<ShyContent> shyContentList = shyContentMapper.selectByExample(example);
  162 + return shyContentList;
  163 + }
  164 +
137 165  
138 166 //******************************
139 167 public ShyContent getDetailsContent(Integer id) {
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/LiveServiceImpl.java
... ... @@ -253,65 +253,55 @@ public class LiveServiceImpl {
253 253  
254 254 /**
255 255 * 根据条件导出数据excel
256   - *
257   - * @param video_title
258   - * @param start_date
259   - * @param end_date
260   - * @param state
261   - * @param receive
262   - * @param video_priority
263   - * @param orderByClause
264   - * @param spid
265   - * @param userId
266 256 * @return
267 257 */
268   - public List<ShyVideos> findByCondition(String video_title, String start_date, String end_date, Integer state, Integer receive, String video_priority, String orderByClause, Integer spid, String userId) {
269   - Example example = new Example(ShyVideos.class);
  258 + public List<ShyLive> findByCondition(String activity_id,String start_date,String end_date,
  259 + String activity_name, Integer activity_status, Integer page,Integer pageSize,
  260 + Integer shenhe_state, String orderByClause, Integer spid) {
  261 + Example example = new Example(ShyLive.class);
270 262 Example.Criteria criteria = example.createCriteria();
271   - Example.Criteria criteria2 = example.createCriteria();
272 263 if (CommonUtils.isNotEmpty(orderByClause)) {
273 264 example.setOrderByClause(orderByClause);
  265 + }else{
  266 + //默认排序
  267 + example.setOrderByClause("activity_start_time asc");
274 268 }
275   - if (CommonUtils.isNotEmpty(start_date) && CommonUtils.isNotEmpty(end_date)) {
  269 + if (CommonUtils.isNotEmpty(start_date)) {
276 270 Timestamp startdate = null;
277   - Timestamp enddate = null;
278 271 try {
279   -// startdate = CommonUtils.parseDate(start_date, "yyyy-MM-dd HH:mm:ss");
280   -// enddate = CommonUtils.parseDate(end_date, "yyyy-MM-dd HH:mm:ss");
281   - startdate = CommonUtils.parseDate(start_date, "yyyy-MM-dd");
282   - enddate = CommonUtils.parseDate(end_date, "yyyy-MM-dd");
  272 + startdate = CommonUtils.parseDate(start_date, "yyyy-MM-dd HH:mm");
283 273 } catch (ParseException e) {
284 274 e.printStackTrace();
285 275 }
286   - criteria.andGreaterThanOrEqualTo("created_at", startdate);
287   - criteria.andLessThanOrEqualTo("created_at", enddate);
  276 + criteria.andGreaterThanOrEqualTo("activity_start_time", startdate);
288 277 }
289   - if (CommonUtils.isNotEmpty(video_title)) {
290   - criteria.andLike("video_title", "%" + video_title + "%");
  278 + if ( CommonUtils.isNotEmpty(end_date)) {
  279 + Timestamp enddate = null;
  280 + try {
  281 + enddate = CommonUtils.parseDate(end_date, "yyyy-MM-dd HH:mm");
  282 + } catch (ParseException e) {
  283 + e.printStackTrace();
  284 + }
  285 + criteria.andLessThanOrEqualTo("activity_end_time", enddate);
291 286 }
292   - if (CommonUtils.isNotNull(state) && state == 0) {
293   - criteria.andEqualTo("state", state);
294   - } else if (CommonUtils.isNotNull(state) && state == 1) {
295   - criteria.andEqualTo("state", state);
296   - criteria2.andEqualTo("state", 2);
297   - example.or(criteria2);
  287 + if (CommonUtils.isNotEmpty(activity_name)) {
  288 + criteria.andLike("activity_name", "%" + activity_name + "%");
298 289 }
299   - if (CommonUtils.isNotEmpty(video_priority)) {
300   - criteria.andEqualTo("video_priority", video_priority);
  290 + if (CommonUtils.isNotNull(activity_status) ) {
  291 + criteria.andEqualTo("activity_status", activity_status);
  292 + }
  293 + if (CommonUtils.isNotEmpty(activity_id)) {
  294 + criteria.andEqualTo("activity_id", activity_id);
301 295 }
302 296 if (CommonUtils.isNotNull(spid)) {
303 297 criteria.andEqualTo("spid", spid);
304 298 }
305   - if (CommonUtils.isNotNull(receive)) {
306   - criteria.andEqualTo("receive", receive);
307   - if (receive == CommonConst.RECEIVE_AFTER) {
308   - criteria.andEqualTo("receive_user_id", userId);
309   - }
  299 + if (CommonUtils.isNotNull(shenhe_state)) {
  300 + criteria.andEqualTo("shenhe_state", shenhe_state);
310 301 }
311   - //默认按上传时间倒序排序
312   - //example.setOrderByClause("video_upload_time desc");
313   - List<ShyVideos> shyVideosList = shyVideosMapper.selectByExample(example);
314   - return shyVideosList;
  302 +
  303 + List<ShyLive> shyLiveList = shyLiveMapper.selectByExample(example);
  304 + return shyLiveList;
315 305 }
316 306  
317 307  
... ...
src/main/resources/templates/html/game.html
1   -
2 1  
3 2  
4 3  
... ... @@ -110,7 +109,86 @@ function logout(){
110 109 <ul class="content-5">
111 110  
112 111  
113   -
  112 + <li class="content-6" >
  113 + <table >
  114 + <tr>
  115 + <td ><a href="#" target="_blank"><img src="http://sxzg.vods1.cnlive.com/82/games/base.png" style="width:78px;height:78px;" border="0" /></a> </td>
  116 + </tr>
  117 + <tr>
  118 + <td ><a href="#" target="_blank">泡泡消除 </a> </td>
  119 + </tr>
  120 + <tr>
  121 + <td><span style="color:#d0d0d0;font-family:'微软雅黑','宋体';font-size:12px;">29万次下载</span> </td>
  122 + </tr>
  123 + <tr>
  124 + <td><a href="http://sxzg.vods1.cnlive.com/82/games/base.apk" ><img src="http://y1.cnliveimg.com:8080/icms/game/images/down-1.gif" border="0" /></a> </td>
  125 + </tr>
  126 + </table>
  127 + </li>
  128 + <li class="content-6" >
  129 + <table >
  130 + <tr>
  131 + <td ><a href="#" target="_blank"><img src="http://sxzg.vods1.cnlive.com/82/games/leiting.png" style="width:78px;height:78px;" border="0" /></a> </td>
  132 + </tr>
  133 + <tr>
  134 + <td ><a href="#" target="_blank">雷霆战机 </a> </td>
  135 + </tr>
  136 + <tr>
  137 + <td><span style="color:#d0d0d0;font-family:'微软雅黑','宋体';font-size:12px;">35万次下载</span> </td>
  138 + </tr>
  139 + <tr>
  140 + <td><a href="http://sxzg.vods1.cnlive.com/82/games/leiting.apk" ><img src="http://y1.cnliveimg.com:8080/icms/game/images/down-1.gif" border="0" /></a> </td>
  141 + </tr>
  142 + </table>
  143 + </li>
  144 + <li class="content-6" >
  145 + <table >
  146 + <tr>
  147 + <td ><a href="#" target="_blank"><img src="http://sxzg.vods1.cnlive.com/82/games/mofa.png" style="width:78px;height:78px;" border="0" /></a> </td>
  148 + </tr>
  149 + <tr>
  150 + <td ><a href="#" target="_blank">魔法消除 </a> </td>
  151 + </tr>
  152 + <tr>
  153 + <td><span style="color:#d0d0d0;font-family:'微软雅黑','宋体';font-size:12px;">43万次下载</span> </td>
  154 + </tr>
  155 + <tr>
  156 + <td><a href="http://sxzg.vods1.cnlive.com/82/games/mofa.apk" ><img src="http://y1.cnliveimg.com:8080/icms/game/images/down-1.gif" border="0" /></a> </td>
  157 + </tr>
  158 + </table>
  159 + </li>
  160 + <li class="content-6" >
  161 + <table >
  162 + <tr>
  163 + <td ><a href="#" target="_blank"><img src="http://sxzg.vods1.cnlive.com/82/games/momv.jpg" style="width:78px;height:78px;" border="0" /></a> </td>
  164 + </tr>
  165 + <tr>
  166 + <td ><a href="#" target="_blank">魔女酷跑 </a> </td>
  167 + </tr>
  168 + <tr>
  169 + <td><span style="color:#d0d0d0;font-family:'微软雅黑','宋体';font-size:12px;">29万次下载</span> </td>
  170 + </tr>
  171 + <tr>
  172 + <td><a href="http://sxzg.vods1.cnlive.com/82/games/monv.apk" ><img src="http://y1.cnliveimg.com:8080/icms/game/images/down-1.gif" border="0" /></a> </td>
  173 + </tr>
  174 + </table>
  175 + </li>
  176 + <li class="content-6" >
  177 + <table >
  178 + <tr>
  179 + <td ><a href="#" target="_blank"><img src="http://sxzg.vods1.cnlive.com/82/games/zhanshen.png" style="width:78px;height:78px;" border="0" /></a> </td>
  180 + </tr>
  181 + <tr>
  182 + <td ><a href="#" target="_blank">战神机甲出击 </a> </td>
  183 + </tr>
  184 + <tr>
  185 + <td><span style="color:#d0d0d0;font-family:'微软雅黑','宋体';font-size:12px;">60万次下载</span> </td>
  186 + </tr>
  187 + <tr>
  188 + <td><a href="http://sxzg.vods1.cnlive.com/82/games/zhanshen.apk" ><img src="http://y1.cnliveimg.com:8080/icms/game/images/down-1.gif" border="0" /></a> </td>
  189 + </tr>
  190 + </table>
  191 + </li>
114 192 <li class="content-6" >
115 193 <table >
116 194 <tr>
... ... @@ -509,7 +587,86 @@ function logout(){
509 587 <ul class="content-5">
510 588  
511 589  
512   -
  590 + <li class="content-6" >
  591 + <table >
  592 + <tr>
  593 + <td ><a href="#" target="_blank"><img src="http://sxzg.vods1.cnlive.com/82/games/base.png" style="width:78px;height:78px;" border="0" /></a> </td>
  594 + </tr>
  595 + <tr>
  596 + <td ><a href="#" target="_blank">泡泡消除 </a> </td>
  597 + </tr>
  598 + <tr>
  599 + <td><span style="color:#d0d0d0;font-family:'微软雅黑','宋体';font-size:12px;">29万次下载</span> </td>
  600 + </tr>
  601 + <tr>
  602 + <td><a href="http://sxzg.vods1.cnlive.com/82/games/base.apk" ><img src="http://y1.cnliveimg.com:8080/icms/game/images/down-1.gif" border="0" /></a> </td>
  603 + </tr>
  604 + </table>
  605 + </li>
  606 + <li class="content-6" >
  607 + <table >
  608 + <tr>
  609 + <td ><a href="#" target="_blank"><img src="http://sxzg.vods1.cnlive.com/82/games/leiting.png" style="width:78px;height:78px;" border="0" /></a> </td>
  610 + </tr>
  611 + <tr>
  612 + <td ><a href="#" target="_blank">雷霆战机 </a> </td>
  613 + </tr>
  614 + <tr>
  615 + <td><span style="color:#d0d0d0;font-family:'微软雅黑','宋体';font-size:12px;">35万次下载</span> </td>
  616 + </tr>
  617 + <tr>
  618 + <td><a href="http://sxzg.vods1.cnlive.com/82/games/leiting.apk" ><img src="http://y1.cnliveimg.com:8080/icms/game/images/down-1.gif" border="0" /></a> </td>
  619 + </tr>
  620 + </table>
  621 + </li>
  622 + <li class="content-6" >
  623 + <table >
  624 + <tr>
  625 + <td ><a href="#" target="_blank"><img src="http://sxzg.vods1.cnlive.com/82/games/mofa.png" style="width:78px;height:78px;" border="0" /></a> </td>
  626 + </tr>
  627 + <tr>
  628 + <td ><a href="#" target="_blank">魔法消除 </a> </td>
  629 + </tr>
  630 + <tr>
  631 + <td><span style="color:#d0d0d0;font-family:'微软雅黑','宋体';font-size:12px;">43万次下载</span> </td>
  632 + </tr>
  633 + <tr>
  634 + <td><a href="http://sxzg.vods1.cnlive.com/82/games/mofa.apk" ><img src="http://y1.cnliveimg.com:8080/icms/game/images/down-1.gif" border="0" /></a> </td>
  635 + </tr>
  636 + </table>
  637 + </li>
  638 + <li class="content-6" >
  639 + <table >
  640 + <tr>
  641 + <td ><a href="#" target="_blank"><img src="http://sxzg.vods1.cnlive.com/82/games/momv.jpg" style="width:78px;height:78px;" border="0" /></a> </td>
  642 + </tr>
  643 + <tr>
  644 + <td ><a href="#" target="_blank">魔女酷跑 </a> </td>
  645 + </tr>
  646 + <tr>
  647 + <td><span style="color:#d0d0d0;font-family:'微软雅黑','宋体';font-size:12px;">29万次下载</span> </td>
  648 + </tr>
  649 + <tr>
  650 + <td><a href="http://sxzg.vods1.cnlive.com/82/games/monv.apk" ><img src="http://y1.cnliveimg.com:8080/icms/game/images/down-1.gif" border="0" /></a> </td>
  651 + </tr>
  652 + </table>
  653 + </li>
  654 + <li class="content-6" >
  655 + <table >
  656 + <tr>
  657 + <td ><a href="#" target="_blank"><img src="http://sxzg.vods1.cnlive.com/82/games/zhanshen.png" style="width:78px;height:78px;" border="0" /></a> </td>
  658 + </tr>
  659 + <tr>
  660 + <td ><a href="#" target="_blank">战神机甲出击 </a> </td>
  661 + </tr>
  662 + <tr>
  663 + <td><span style="color:#d0d0d0;font-family:'微软雅黑','宋体';font-size:12px;">60万次下载</span> </td>
  664 + </tr>
  665 + <tr>
  666 + <td><a href="http://sxzg.vods1.cnlive.com/82/games/zhanshen.apk" ><img src="http://y1.cnliveimg.com:8080/icms/game/images/down-1.gif" border="0" /></a> </td>
  667 + </tr>
  668 + </table>
  669 + </li>
513 670 <li class="content-6" >
514 671 <table >
515 672 <tr>
... ... @@ -841,31 +998,31 @@ function logout(){
841 998  
842 999 <tr>
843 1000 <td class="content-31"><p>1</p></td>
844   - <td><h2 class="h2"><a href="http://www.ikol.cn/yxzq/view1.html?id=416602" target="_blank">萌宠爱跳跃</a></h2></td>
  1001 + <td><h2 class="h2"><a href="http://sxzg.vods1.cnlive.com/82/games/base.apk" target="_blank">泡泡消除</a></h2></td>
845 1002 </tr>
846 1003  
847 1004  
848 1005 <tr>
849 1006 <td class="content-31"><p>2</p></td>
850   - <td><h2 class="h2"><a href="http://www.ikol.cn/yxzq/view1.html?id=417186" target="_blank">奇缘连萌</a></h2></td>
  1007 + <td><h2 class="h2"><a href="http://sxzg.vods1.cnlive.com/82/games/leiting.apk" target="_blank">雷霆战机</a></h2></td>
851 1008 </tr>
852 1009  
853 1010  
854 1011 <tr>
855 1012 <td class="content-31"><p>3</p></td>
856   - <td><h2 class="h2"><a href="http://www.ikol.cn/yxzq/view1.html?id=413425" target="_blank">布偶大逃亡</a></h2></td>
  1013 + <td><h2 class="h2"><a href="http://sxzg.vods1.cnlive.com/82/games/mofa.apk" target="_blank">魔法消除</a></h2></td>
857 1014 </tr>
858 1015  
859 1016  
860 1017 <tr>
861 1018 <td class="content-31-1"><p>4</p></td>
862   - <td><h2 class="h2"><a href="http://www.ikol.cn/yxzq/view1.html?id=286229" target="_blank">塔王之王</a></h2></td>
  1019 + <td><h2 class="h2"><a href="http://sxzg.vods1.cnlive.com/82/games/monv.apk" target="_blank">魔女酷跑</a></h2></td>
863 1020 </tr>
864 1021  
865 1022  
866 1023 <tr>
867 1024 <td class="content-31-1"><p>5</p></td>
868   - <td><h2 class="h2"><a href="http://www.ikol.cn/yxzq/view1.html?id=407798" target="_blank">冒泡水浒</a></h2></td>
  1025 + <td><h2 class="h2"><a href="http://sxzg.vods1.cnlive.com/82/games/zhanshen.apk" target="_blank">战神机甲出击</a></h2></td>
869 1026 </tr>
870 1027  
871 1028  
... ...
src/main/resources/templates/page/content.html
... ... @@ -53,10 +53,9 @@
53 53  
54 54  
55 55 <div class="btn-group margin-bottom pull-right">
56   -<!-- <button type="button" class="btn btn-success btn-sm margin-r-5 filter " -->
57   -<!-- th:onclick="'javascript:daochu()'" value="" id="excel"> -->
58   -<!-- 导出excel -->
59   -<!-- </button> -->
  56 + <button type="button" class="btn btn-success btn-sm margin-r-5 filter "
  57 + th:onclick="'javascript:daochu()'" value="" id="excel">导出excel
  58 + </button>
60 59 <button type="button" class="btn btn-sm margin-r-5 filter "
61 60 th:onclick="'javascript:quanbu()'" value="" id="quanbu">
62 61 全部
... ... @@ -562,6 +561,13 @@
562 561 }
563 562 })
564 563 }
  564 +
  565 +
  566 + //导出excel
  567 + function daochu() {
  568 + var param = location.search;
  569 + window.location.href = "/content/excel" + param;
  570 + }
565 571 </script>
566 572 <!-- 模态框(Modal) -->
567 573 <div class="modal fade" id="msgModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
... ...
src/main/resources/templates/page/live.html
... ... @@ -26,25 +26,6 @@
26 26 <div class="col-md-12">
27 27 <div class="box box-info">
28 28 <div class="box-body">
29   - <div class="modal fade" id="modal" tabindex="-1" role="dialog"
30   - aria-labelledby="myModalLabel" aria-hidden="true">
31   - <div class="modal-dialog">
32   - <div class="modal-content">
33   - <div class="modal-header">
34   - <button type="button" class="close" data-dismiss="modal"
35   - aria-hidden="true">&times;</button>
36   - <h4 class="modal-title">温馨提示</h4>
37   - </div>
38   - <div class="modal-body" id="msg">您确认认领该条信息吗?</div>
39   - <div class="modal-footer">
40   - <button type="button" class="btn btn-default"
41   - data-dismiss="modal">取消</button>
42   - <button type="button" class="btn btn-primary"
43   - id="modal_remove">确认</button>
44   - </div>
45   - </div>
46   - </div>
47   - </div>
48 29 <div class="clearfix">
49 30 <div class="btn-group margin-bottom" id="hide_select_area_2">
50 31 <div class="cb-toolbar">
... ... @@ -69,6 +50,9 @@
69 50 </div>
70 51  
71 52 <div class="btn-group margin-bottom pull-right">
  53 + <button type="button" class="btn btn-success btn-sm margin-r-5 filter "
  54 + th:onclick="'javascript:daochu()'" value="" id="excel">导出excel
  55 + </button>
72 56 <button type="button" class="btn btn-sm margin-r-5 filter >"
73 57 value="0" th:onclick="'javascript:quanbu()'" id="quanbu">全部</button>
74 58 <button type="button"
... ... @@ -510,6 +494,13 @@
510 494 }
511 495 })
512 496 }
  497 +
  498 + //导出excel
  499 + function daochu() {
  500 + var param = location.search;
  501 + window.location.href = "/live/excel" + param;
  502 + }
  503 +
513 504 //详情页
514 505 function detail(ids) {
515 506 location.href ="/live/details?id=" + ids;
... ...