Commit 1d0f01aa4abe6e5573728b1aafdc2780c3bc30db

Authored by liwei2917
1 parent 00eaf988

增加直播申请审核业务,实现列表展示、详情查看、审核回调、excel导出等

src/main/java/com/cnlive/shenhe/api/LiveApplyControllerApi.java
@@ -11,6 +11,7 @@ import com.cnlive.shenhe.entity.ShyVideos; @@ -11,6 +11,7 @@ import com.cnlive.shenhe.entity.ShyVideos;
11 import com.cnlive.shenhe.serviceImpl.LiveApplyServiceImpl; 11 import com.cnlive.shenhe.serviceImpl.LiveApplyServiceImpl;
12 import com.cnlive.shenhe.serviceImpl.VideosServiceImpl; 12 import com.cnlive.shenhe.serviceImpl.VideosServiceImpl;
13 import com.cnlive.shenhe.utils.AntiFraudUtil; 13 import com.cnlive.shenhe.utils.AntiFraudUtil;
  14 +import com.cnlive.shenhe.utils.CommonConst;
14 import com.cnlive.shenhe.utils.CommonUtils; 15 import com.cnlive.shenhe.utils.CommonUtils;
15 16
16 import java.sql.Timestamp; 17 import java.sql.Timestamp;
@@ -64,6 +65,7 @@ public class LiveApplyControllerApi { @@ -64,6 +65,7 @@ public class LiveApplyControllerApi {
64 Integer businessModel = Integer.parseInt(json.getString("businessModel"));//商务模式:0免费 1收费 65 Integer businessModel = Integer.parseInt(json.getString("businessModel"));//商务模式:0免费 1收费
65 Integer contentProperty = Integer.parseInt(json.getString("contentProperty"));//内容属性:1商业类活动 0非商业活动 66 Integer contentProperty = Integer.parseInt(json.getString("contentProperty"));//内容属性:1商业类活动 0非商业活动
66 String simpleContent = json.getString("simpleContent");//内容简述 67 String simpleContent = json.getString("simpleContent");//内容简述
  68 + String live_type = json.getString("liveType");//直播类型
67 String keys = json.getString("keys");//要点报备:0品牌植入 1广告植入 2商品推销 3网家家独家麦标 69 String keys = json.getString("keys");//要点报备:0品牌植入 1广告植入 2商品推销 3网家家独家麦标
68 String livePlace = json.getString("livePlace");//直播地点 70 String livePlace = json.getString("livePlace");//直播地点
69 String pushUrl = json.getString("pushUrl");//推流地址 71 String pushUrl = json.getString("pushUrl");//推流地址
@@ -100,6 +102,7 @@ public class LiveApplyControllerApi { @@ -100,6 +102,7 @@ public class LiveApplyControllerApi {
100 shyliveApply.setMobile(mobile);//设置联系方式 102 shyliveApply.setMobile(mobile);//设置联系方式
101 shyliveApply.setOrganization(organization);//设置直播发起单位 103 shyliveApply.setOrganization(organization);//设置直播发起单位
102 shyliveApply.setTheme(theme);//直播主题 104 shyliveApply.setTheme(theme);//直播主题
  105 + shyliveApply.setLive_type(live_type);//直播类型
103 shyliveApply.setPre_start_time(timestamp_start);//预计开始时间 106 shyliveApply.setPre_start_time(timestamp_start);//预计开始时间
104 shyliveApply.setPre_end_time(timestamp_end);//预计结束时间 107 shyliveApply.setPre_end_time(timestamp_end);//预计结束时间
105 shyliveApply.setBusiness_model(businessModel);//商务模式:0免费 1收费 108 shyliveApply.setBusiness_model(businessModel);//商务模式:0免费 1收费
@@ -111,8 +114,9 @@ public class LiveApplyControllerApi { @@ -111,8 +114,9 @@ public class LiveApplyControllerApi {
111 shyliveApply.setPull_url(pullUrl);//拉流地址 114 shyliveApply.setPull_url(pullUrl);//拉流地址
112 shyliveApply.setPlatforms(platforms);//播出平台及通道:0网家家 1CNLive网站 2@TV互动电视 115 shyliveApply.setPlatforms(platforms);//播出平台及通道:0网家家 1CNLive网站 2@TV互动电视
113 shyliveApply.setCallback(callback);//设置回调地址 116 shyliveApply.setCallback(callback);//设置回调地址
114 - shyliveApply.setReceive(0);  
115 - shyliveApply.setShenhe_state(0); 117 + shyliveApply.setReceive(CommonConst.RECEIVE_BEFORE);
  118 + shyliveApply.setShenhe_state(CommonConst.AUDIT_INTT);
  119 + shyliveApply.setNotice_jishu(CommonConst.NOTICE_INTT);
116 shyliveApply.setUpdater(null); 120 shyliveApply.setUpdater(null);
117 shyliveApply.setAuditor(null); 121 shyliveApply.setAuditor(null);
118 shyliveApply.setUpdated_at(CommonUtils.getCurrentTime());//更新时间 122 shyliveApply.setUpdated_at(CommonUtils.getCurrentTime());//更新时间
@@ -127,6 +131,7 @@ public class LiveApplyControllerApi { @@ -127,6 +131,7 @@ public class LiveApplyControllerApi {
127 shyliveApply1.setMobile(mobile);//设置联系方式 131 shyliveApply1.setMobile(mobile);//设置联系方式
128 shyliveApply1.setOrganization(organization);//设置直播发起单位 132 shyliveApply1.setOrganization(organization);//设置直播发起单位
129 shyliveApply1.setTheme(theme);//直播主题 133 shyliveApply1.setTheme(theme);//直播主题
  134 + shyliveApply1.setLive_type(live_type);//直播类型
130 shyliveApply1.setPre_start_time(timestamp_start);//预计开始时间 135 shyliveApply1.setPre_start_time(timestamp_start);//预计开始时间
131 shyliveApply1.setPre_end_time(timestamp_end);//预计结束时间 136 shyliveApply1.setPre_end_time(timestamp_end);//预计结束时间
132 shyliveApply1.setBusiness_model(businessModel);//商务模式:0免费 1收费 137 shyliveApply1.setBusiness_model(businessModel);//商务模式:0免费 1收费
@@ -139,11 +144,13 @@ public class LiveApplyControllerApi { @@ -139,11 +144,13 @@ public class LiveApplyControllerApi {
139 shyliveApply1.setPlatforms(platforms);//播出平台及通道:0网家家 1CNLive网站 2@TV互动电视 144 shyliveApply1.setPlatforms(platforms);//播出平台及通道:0网家家 1CNLive网站 2@TV互动电视
140 shyliveApply1.setCallback(callback);//设置回调地址 145 shyliveApply1.setCallback(callback);//设置回调地址
141 liveApplyServiceImpl.getShenheType(shyliveApply1);//获取审核类型 146 liveApplyServiceImpl.getShenheType(shyliveApply1);//获取审核类型
142 - shyliveApply1.setReceive(0);  
143 - shyliveApply1.setShenhe_state(0); 147 + shyliveApply1.setReceive(CommonConst.RECEIVE_BEFORE);
  148 + shyliveApply1.setShenhe_state(CommonConst.AUDIT_INTT);
  149 + shyliveApply1.setNotice_jishu(CommonConst.NOTICE_INTT);
144 shyliveApply1.setUpdater(null); 150 shyliveApply1.setUpdater(null);
145 shyliveApply1.setAuditor(null); 151 shyliveApply1.setAuditor(null);
146 shyliveApply1.setShenhe_msg(null); 152 shyliveApply1.setShenhe_msg(null);
  153 + shyliveApply1.setNotice_msg(null);
147 shyliveApply1.setCreated_at(CommonUtils.getCurrentTime());//创建时间 154 shyliveApply1.setCreated_at(CommonUtils.getCurrentTime());//创建时间
148 shyliveApply1.setUpdated_at(CommonUtils.getCurrentTime());//更新时间 155 shyliveApply1.setUpdated_at(CommonUtils.getCurrentTime());//更新时间
149 156
src/main/java/com/cnlive/shenhe/controller/LiveApplyController.java
@@ -311,60 +311,12 @@ public class LiveApplyController { @@ -311,60 +311,12 @@ public class LiveApplyController {
311 } 311 }
312 312
313 /** 313 /**
314 - * 同步直播云信息  
315 - *  
316 - * @param ids  
317 - * @param msg  
318 - * @param session  
319 - * @return  
320 - */  
321 - @PostMapping("/syncLive")  
322 - @ResponseBody  
323 - public ResponseBean syncLive(String ids, HttpSession session) {  
324 - logger.info("同步直播云信息接口进入");  
325 - ResponseBean responseBean = new ResponseBean();  
326 - String[] shyLiveIds = ids.split(",");  
327 - String showMsg = "";  
328 - for (String shyLiveId : shyLiveIds) {  
329 - ShyLive shyLive = liveService.selectByPrimaryKey(Integer.parseInt(shyLiveId));  
330 - JSONObject result = null;  
331 - try {  
332 - result = Pass.syncLive(shyLive.getActivity_id());  
333 - } catch (Exception e) {  
334 - logger.error("直播云信息同步失败,id==" + shyLiveId, e);  
335 - showMsg = showMsg + "," + shyLive.getActivity_id() + " 拒绝请求失败";  
336 - break;  
337 - }  
338 - if (result == null) {  
339 - logger.error("直播云信息同步失败且接口错误没有返回信息,id==" + shyLiveId);  
340 - showMsg = showMsg + "," + shyLive.getActivity_id() + " 拒绝请求失败";  
341 - break;  
342 - }  
343 - Integer code = result.getInteger("errorCode");  
344 - if (code != 0) {  
345 - logger.error("直播云信息同步失败,id:{},code:{}", shyLiveId, code);  
346 - showMsg = result.getString("errorMessage");  
347 - break;  
348 - }  
349 - }  
350 - if (CommonUtils.isNotEmpty(showMsg)) {  
351 - responseBean.setErrorCode(ErrorEnum.ERROR.getErrorCode());  
352 - responseBean.setErrorMessage(showMsg);  
353 - }else{  
354 - showMsg="直播云信息同步成功";  
355 - responseBean.setErrorCode(ErrorEnum.SUCCESS.getErrorCode());  
356 - responseBean.setErrorMessage(showMsg);  
357 - }  
358 - return responseBean;  
359 - }  
360 -  
361 - /**  
362 * 根据条件导出excel 314 * 根据条件导出excel
363 */ 315 */
364 @GetMapping("excel") 316 @GetMapping("excel")
365 - public void getExcel(String activity_id,String start_date,String end_date,  
366 - String activity_name, Integer activity_status, Integer page,Integer pageSize,  
367 - Integer shenhe_state, String orderByClause, String sp_desc, HttpSession session,HttpServletResponse response) { 317 + public void getExcel(String start_date,String end_date,
  318 + String theme, Integer business_model, Integer page,Integer pageSize,
  319 + Integer shenhe_state,Integer receive, String sp_desc,String orderByClause, HttpSession session,HttpServletResponse response) {
368 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 320 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
369 Integer spid = sessionUser.getSpid(); 321 Integer spid = sessionUser.getSpid();
370 String userId = sessionUser.getUserId(); 322 String userId = sessionUser.getUserId();
@@ -376,10 +328,10 @@ public class LiveApplyController { @@ -376,10 +328,10 @@ public class LiveApplyController {
376 }else if (CommonUtils.isEmpty(sp_desc) && spid == 0) { 328 }else if (CommonUtils.isEmpty(sp_desc) && spid == 0) {
377 spid = null; 329 spid = null;
378 } 330 }
379 - List<ShyLive> liveList = liveService.findByCondition(activity_name, start_date,end_date,  
380 - activity_id, activity_status, page, pageSize, shenhe_state, orderByClause, spid); 331 + List<ShyLiveapply> liveApplyList = liveApplyServiceImpl.findByCondition(theme, start_date,end_date,
  332 + business_model, page, pageSize, shenhe_state,receive, orderByClause, spid, userId);
381 333
382 - String fileName = "直播数据"; 334 + String fileName = "直播申请数据";
383 335
384 XSSFWorkbook wb = new XSSFWorkbook(); 336 XSSFWorkbook wb = new XSSFWorkbook();
385 ServletOutputStream out = null; 337 ServletOutputStream out = null;
@@ -391,119 +343,60 @@ public class LiveApplyController { @@ -391,119 +343,60 @@ public class LiveApplyController {
391 XSSFCell cell = row.createCell(0);//列 343 XSSFCell cell = row.createCell(0);//列
392 cell.setCellValue("id"); 344 cell.setCellValue("id");
393 cell = row.createCell(1);//列 345 cell = row.createCell(1);//列
394 - cell.setCellValue("sp昵称"); 346 + cell.setCellValue("直播日期");
395 cell = row.createCell(2);//列 347 cell = row.createCell(2);//列
396 - cell.setCellValue("频道_id"); 348 + cell.setCellValue("预计开始时间");
397 cell = row.createCell(3);//列 349 cell = row.createCell(3);//列
398 - cell.setCellValue("直播活动id"); 350 + cell.setCellValue("预计结束时间");
399 cell = row.createCell(4);//列 351 cell = row.createCell(4);//列
400 - cell.setCellValue("直播活动名称"); 352 + cell.setCellValue("直播主题");
401 cell = row.createCell(5);//列 353 cell = row.createCell(5);//列
402 - cell.setCellValue("直播活动状态"); 354 + cell.setCellValue("直播申请方");
403 cell = row.createCell(6);//列 355 cell = row.createCell(6);//列
404 - cell.setCellValue("直播活动开始时间"); 356 + cell.setCellValue("直播类型");
405 cell = row.createCell(7);//列 357 cell = row.createCell(7);//列
406 - cell.setCellValue("直播活动结束时间"); 358 + cell.setCellValue("频道_id");
407 cell = row.createCell(8);//列 359 cell = row.createCell(8);//列
408 - cell.setCellValue("直播活动简介"); 360 + cell.setCellValue("直播活动id");
409 cell = row.createCell(9);//列 361 cell = row.createCell(9);//列
410 - cell.setCellValue("审核类型");  
411 - cell = row.createCell(10);//列  
412 - cell.setCellValue("审核状态");  
413 - cell = row.createCell(11);//列  
414 - cell.setCellValue("审核员");  
415 - cell = row.createCell(12);//列  
416 - cell.setCellValue("审核信息");  
417 - cell = row.createCell(13);//列  
418 cell.setCellValue("创建时间"); 362 cell.setCellValue("创建时间");
419 - cell = row.createCell(14);//列  
420 - cell.setCellValue("最后更新时间");  
421 363
422 - for (int i = 0; i < liveList.size(); i++) { 364 + for (int i = 0; i < liveApplyList.size(); i++) {
423 row = sheetlist.createRow((short) (i + 1));//行 365 row = sheetlist.createRow((short) (i + 1));//行
424 cell = row.createCell(0);//列 366 cell = row.createCell(0);//列
425 - cell.setCellValue(liveList.get(i).getId()); 367 + cell.setCellValue(liveApplyList.get(i).getId());
426 cell = row.createCell(1);//列 368 cell = row.createCell(1);//列
427 - cell.setCellValue(sitesService.findspidDescByspid(liveList.get(i).getSp_id()).getName()); 369 + cell.setCellValue(CommonUtils.formatDate(liveApplyList.get(i).getPre_start_time(), "yyyy/MM/dd"));
428 cell = row.createCell(2);//列 370 cell = row.createCell(2);//列
429 - cell.setCellValue(liveList.get(i).getChannel_id()); 371 + cell.setCellValue(CommonUtils.formatDate(liveApplyList.get(i).getPre_start_time(), "HH:mm"));
  372 + String endTime="";
  373 + long start = liveApplyList.get(i).getPre_start_time().getTime()+8*60*60*1000;
  374 + if(CommonUtils.isNull(liveApplyList.get(i).getPre_end_time())){//结束时间为空
  375 + endTime="待定";
  376 + }else{
  377 + long end = liveApplyList.get(i).getPre_end_time().getTime()+8*60*60*1000;
  378 + long count=end/(24*3600*1000)-start/(24*3600*1000);
  379 + logger.info(String.valueOf(count));
  380 + if(count==0){
  381 + endTime=CommonUtils.formatDate(liveApplyList.get(i).getPre_end_time(), "HH:mm");
  382 + }else if(count > 0){
  383 + endTime="跨"+count+"天 "+CommonUtils.formatDate(liveApplyList.get(i).getPre_end_time(), "HH:mm");
  384 + }
  385 + }
430 cell = row.createCell(3);//列 386 cell = row.createCell(3);//列
431 - cell.setCellValue(liveList.get(i).getActivity_id()); 387 + cell.setCellValue(endTime);
432 cell = row.createCell(4);//列 388 cell = row.createCell(4);//列
433 - cell.setCellValue(liveList.get(i).getActivity_name());  
434 - /*状态需要处理成用户可读*/  
435 - String activityStatus = "";//直播活动状态,1:直播中,2:直播完成,3:待直播,0:直播撤销(手动),4:直播下线(强制)  
436 - if (liveList.get(i).getActivity_status() == 0) {  
437 - activityStatus = "直播撤销(手动)";  
438 - } else if (liveList.get(i).getActivity_status() == 1) {  
439 - activityStatus = "正在直播";  
440 - } else if(liveList.get(i).getActivity_status() == 2){  
441 - activityStatus = "直播完成";  
442 - }else if(liveList.get(i).getActivity_status() == 3){  
443 - activityStatus = "等待直播";  
444 - }else if(liveList.get(i).getActivity_status() == 4){  
445 - activityStatus = "直播下线(强制)";  
446 - } 389 + cell.setCellValue(liveApplyList.get(i).getTheme());
447 cell = row.createCell(5);//列 390 cell = row.createCell(5);//列
448 - cell.setCellValue(activityStatus); 391 + cell.setCellValue(sitesService.findspidDescByspid(liveApplyList.get(i).getSp_id()).getName());
449 cell = row.createCell(6);//列 392 cell = row.createCell(6);//列
450 - cell.setCellValue(CommonUtils.formatDate(liveList.get(i).getActivity_start_time(), "yyyy-MM-dd HH:mm:ss")); 393 + cell.setCellValue(liveApplyList.get(i).getLive_type());
451 cell = row.createCell(7);//列 394 cell = row.createCell(7);//列
452 - cell.setCellValue(CommonUtils.formatDate(liveList.get(i).getActivity_end_time(), "yyyy-MM-dd HH:mm:ss")); 395 + cell.setCellValue(liveApplyList.get(i).getChannel_id());
453 cell = row.createCell(8);//列 396 cell = row.createCell(8);//列
454 - cell.setCellValue(liveList.get(i).getActivity_intro());  
455 -  
456 - /*状态需要处理成用户可读*/  
457 - String shenheType = "";//审核类型,1:免审,2:机审,3:人工审  
458 - if (liveList.get(i).getShenhe_type() == 1) {  
459 - shenheType = "免审";  
460 - } else if (liveList.get(i).getShenhe_type() == 2) {  
461 - shenheType = "机审";  
462 - } else {  
463 - shenheType = "人工审";  
464 - }  
465 - 397 + cell.setCellValue(liveApplyList.get(i).getActivity_id());
466 cell = row.createCell(9);//列 398 cell = row.createCell(9);//列
467 - cell.setCellValue(shenheType);  
468 -  
469 - /*状态需要处理成用户可读*/  
470 - String shenheState = "";//审核状态 0:未认领 1.已认领,2:已审核  
471 - if (liveList.get(i).getShenhe_type() == 1) {  
472 - shenheState = "已认领";  
473 - } else if (liveList.get(i).getShenhe_type() == 2) {  
474 - shenheState = "已审核";  
475 - } else {  
476 - shenheState = "未认领";  
477 - }  
478 -  
479 - cell = row.createCell(10);//列  
480 - cell.setCellValue(shenheState);  
481 -  
482 - /* 审核员需要做处理*/  
483 - String updater = "";//审核员名字  
484 - if (liveList.get(i).getShenhe_state() != CommonConst.RECEIVE_BEFORE) {  
485 - updater = CommonUtils.isEmpty(liveList.get(i).getUpdater()) || "null".equals(liveList.get(i).getUpdater())? "自动通过":liveList.get(i).getUpdater();  
486 - String auditor_id = liveList.get(i).getAuditor();  
487 - if (CommonUtils.isNotEmpty(auditor_id)) {  
488 - ShyUsers user = new ShyUsers();  
489 - user.setUser_id(auditor_id);  
490 - user = usersService.select(user);  
491 - if (CommonUtils.isNotNull(user)) {  
492 - String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail();  
493 - String userName = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername();  
494 - updater = userName ;  
495 - }  
496 - }  
497 - }  
498 -  
499 - cell = row.createCell(11);//列  
500 - cell.setCellValue(updater);  
501 - cell = row.createCell(12);//列  
502 - cell.setCellValue(liveList.get(i).getShenhe_msg());  
503 - cell = row.createCell(13);//列  
504 - cell.setCellValue(CommonUtils.formatDate(liveList.get(i).getCreated_at(), "yyyy-MM-dd HH:mm:ss"));  
505 - cell = row.createCell(14);//列  
506 - cell.setCellValue(CommonUtils.formatDate(liveList.get(i).getUpdated_at(), "yyyy-MM-dd HH:mm:ss")); 399 + cell.setCellValue(CommonUtils.formatDate(liveApplyList.get(i).getCreated_at(), "yyyy-MM-dd HH:mm"));
507 } 400 }
508 401
509 ByteArrayOutputStream os = new ByteArrayOutputStream(); 402 ByteArrayOutputStream os = new ByteArrayOutputStream();
src/main/java/com/cnlive/shenhe/entity/ShyLiveapply.java
@@ -47,6 +47,11 @@ public class ShyLiveapply { @@ -47,6 +47,11 @@ public class ShyLiveapply {
47 private String theme; 47 private String theme;
48 48
49 /** 49 /**
  50 + * 直播类型
  51 + */
  52 + private String live_type;
  53 +
  54 + /**
50 * 预计开始时间 55 * 预计开始时间
51 */ 56 */
52 private Date pre_start_time; 57 private Date pre_start_time;
@@ -127,6 +132,16 @@ public class ShyLiveapply { @@ -127,6 +132,16 @@ public class ShyLiveapply {
127 private String shenhe_msg; 132 private String shenhe_msg;
128 133
129 /** 134 /**
  135 + * 技术通知 1未通知 2已通知 3通知失败
  136 + */
  137 + private Integer notice_jishu;
  138 +
  139 + /**
  140 + * 通知消息
  141 + */
  142 + private String notice_msg;
  143 +
  144 + /**
130 * 创建时间 145 * 创建时间
131 */ 146 */
132 private Date created_at; 147 private Date created_at;
@@ -289,6 +304,24 @@ public class ShyLiveapply { @@ -289,6 +304,24 @@ public class ShyLiveapply {
289 } 304 }
290 305
291 /** 306 /**
  307 + * 获取直播类型
  308 + *
  309 + * @return live_type - 直播类型
  310 + */
  311 + public String getLive_type() {
  312 + return live_type;
  313 + }
  314 +
  315 + /**
  316 + * 设置直播类型
  317 + *
  318 + * @param live_type 直播类型
  319 + */
  320 + public void setLive_type(String live_type) {
  321 + this.live_type = live_type;
  322 + }
  323 +
  324 + /**
292 * 获取预计开始时间 325 * 获取预计开始时间
293 * 326 *
294 * @return pre_start_time - 预计开始时间 327 * @return pre_start_time - 预计开始时间
@@ -577,6 +610,42 @@ public class ShyLiveapply { @@ -577,6 +610,42 @@ public class ShyLiveapply {
577 } 610 }
578 611
579 /** 612 /**
  613 + * 获取技术通知 1未通知 2已通知 3通知失败
  614 + *
  615 + * @return notice_jishu - 技术通知 1未通知 2已通知 3通知失败
  616 + */
  617 + public Integer getNotice_jishu() {
  618 + return notice_jishu;
  619 + }
  620 +
  621 + /**
  622 + * 设置技术通知 1未通知 2已通知 3通知失败
  623 + *
  624 + * @param notice_jishu 技术通知 1未通知 2已通知 3通知失败
  625 + */
  626 + public void setNotice_jishu(Integer notice_jishu) {
  627 + this.notice_jishu = notice_jishu;
  628 + }
  629 +
  630 + /**
  631 + * 获取通知消息
  632 + *
  633 + * @return notice_msg - 通知消息
  634 + */
  635 + public String getNotice_msg() {
  636 + return notice_msg;
  637 + }
  638 +
  639 + /**
  640 + * 设置通知消息
  641 + *
  642 + * @param notice_msg 通知消息
  643 + */
  644 + public void setNotice_msg(String notice_msg) {
  645 + this.notice_msg = notice_msg;
  646 + }
  647 +
  648 + /**
580 * 获取创建时间 649 * 获取创建时间
581 * 650 *
582 * @return created_at - 创建时间 651 * @return created_at - 创建时间
src/main/java/com/cnlive/shenhe/job/LiveApplyJob.java 0 → 100644
  1 +package com.cnlive.shenhe.job;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.cnlive.shenhe.bean.ErrorEnum;
  5 +import com.cnlive.shenhe.bean.ResponseBean;
  6 +import com.cnlive.shenhe.entity.ShyChannel;
  7 +import com.cnlive.shenhe.entity.ShyComments;
  8 +import com.cnlive.shenhe.entity.ShyLiveapply;
  9 +import com.cnlive.shenhe.entity.ShyVideos;
  10 +import com.cnlive.shenhe.mapper.ShyLiveapplyMapper;
  11 +import com.cnlive.shenhe.serviceImpl.ChannelServiceImpl;
  12 +import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl;
  13 +import com.cnlive.shenhe.serviceImpl.LiveApplyServiceImpl;
  14 +import com.cnlive.shenhe.serviceImpl.SitesServiceImpl;
  15 +import com.cnlive.shenhe.serviceImpl.UsersServiceImpl;
  16 +import com.cnlive.shenhe.utils.AuditPass;
  17 +import com.cnlive.shenhe.utils.CommonConst;
  18 +import com.cnlive.shenhe.utils.CommonUtils;
  19 +import com.cnlive.shenhe.utils.HttpUtil;
  20 +import com.cnlive.shenhe.utils.InfoUtil;
  21 +import com.cnlive.shenhe.utils.OpenUtil;
  22 +
  23 +import tk.mybatis.mapper.entity.Example;
  24 +
  25 +import org.slf4j.Logger;
  26 +import org.slf4j.LoggerFactory;
  27 +import org.springframework.beans.factory.annotation.Autowired;
  28 +import org.springframework.beans.factory.annotation.Value;
  29 +import org.springframework.scheduling.annotation.Scheduled;
  30 +import org.springframework.stereotype.Component;
  31 +
  32 +import java.util.HashMap;
  33 +import java.util.List;
  34 +import java.util.Map;
  35 +
  36 +@Component
  37 +public class LiveApplyJob {
  38 + private static Logger logger = LoggerFactory.getLogger(LiveApplyJob.class);
  39 + @Value("${spring.localhost.url}")
  40 + private String localhost_url;//本机地址
  41 +
  42 + @Autowired
  43 + SitesServiceImpl sitesService;
  44 + @Autowired
  45 + AuditPass Pass;
  46 + @Autowired
  47 + InfoUtil infoUtil;
  48 + @Autowired
  49 + LiveApplyServiceImpl liveApplyServiceImpl;
  50 + @Autowired
  51 + ShyLiveapplyMapper shyLiveApplyMapper;
  52 +
  53 + @Autowired
  54 + UsersServiceImpl usersService;
  55 +
  56 +
  57 + @Scheduled(fixedRate = 60 * 1000)
  58 + public void updateLiveApply() {
  59 +
  60 + //遍历免审的spid去更改状态值
  61 + ShyLiveapply shyLiveApply = new ShyLiveapply();
  62 + shyLiveApply.setShenhe_type(CommonConst.AUDIT_TYPE_FREE);// 审核类型为免审
  63 + shyLiveApply.setShenhe_state(CommonConst.AUDIT_INTT);
  64 + List<ShyLiveapply> liveApplyList = liveApplyServiceImpl.findshyLiveApply(shyLiveApply);
  65 + if (liveApplyList.size() > 0) {
  66 + for (ShyLiveapply liveApply : liveApplyList) {
  67 + liveApplyServiceImpl.updateLiveApply(liveApply.getId(), "","白名单", CommonConst.AUDIT_SUCCESS,"白名单通过");
  68 + }
  69 + }
  70 + }
  71 +
  72 + /**
  73 + * 直播申请邮件通知
  74 + */
  75 + @Scheduled(fixedRate = 60 * 1000)
  76 + public void liveApplyNotice() {
  77 + Example example = new Example(ShyLiveapply.class);
  78 + Example.Criteria criteria = example.createCriteria();
  79 + criteria.andEqualTo("shenhe_state", CommonConst.AUDIT_SUCCESS);
  80 + criteria.andNotEqualTo("notice_jishu", CommonConst.NOTICE_SUCCESS);
  81 + List<ShyLiveapply> shyLiveApplyList = shyLiveApplyMapper.selectByExample(example);
  82 + if (shyLiveApplyList.size() > 0) {
  83 + logger.info("直播申请邮件通知开始,共"+shyLiveApplyList.size()+"个");
  84 + String app_id = "769_jetja50p18"; //开发者对应的id,与app_key相对应
  85 + String app_key = "ad101b9152817a79b5c33c3617b96ff91385096ff3b4ba"; //开发者帐号对应的key. 请开发者谨慎保管此值。
  86 + String URL = "http://sms.cnlive.com/CnliveM3/email/sendMoreVarEmail.action";//调用邮件发送服务器的地址
  87 + for(ShyLiveapply liveApply : shyLiveApplyList){
  88 + String startTime=CommonUtils.formatDate(liveApply.getPre_start_time(), "yyyy-MM-dd HH:mm:ss");
  89 + String endTime=CommonUtils.isNotNull(liveApply.getPre_end_time())?CommonUtils.formatDate(liveApply.getPre_end_time(), "yyyy-MM-dd HH:mm:ss"):"待定";
  90 + String content = liveApply.getSender()+"__"+liveApply.getMobile()+"__"+liveApply.getOrganization()+"__"+liveApply.getTheme()+"__"+startTime+"__"+endTime+"__"+liveApply.getLive_place()+"__"+liveApply.getPush_url()+"__"+liveApply.getPull_url();
  91 + String emailAddr = "642522156@qq.com";
  92 + String title = "新直播开播申请";
  93 + String templateId = "4017";
  94 + Integer notice_jishu = CommonConst.NOTICE_INTT;//初始化通知状态
  95 + String notice_msg = "";//初始化通知消息
  96 + Map<String, String> params = new HashMap<>();
  97 + params.put("appId", app_id);
  98 + params.put("emailAddr", emailAddr);
  99 + params.put("title",title );
  100 + params.put("content", content);
  101 + params.put("templateId", templateId);
  102 + params.put("sign", OpenUtil.sign(params,app_key));
  103 + HttpUtil httpUtil = HttpUtil.init();
  104 + httpUtil.setParamMap(params);
  105 + try {
  106 + Map<String, String> post = httpUtil.post(URL);
  107 + logger.info(post.get("result"));
  108 + JSONObject result=JSONObject.parseObject(post.get("result"));
  109 + if (result == null) {
  110 + notice_jishu=CommonConst.NOTICE_FAIL;
  111 + notice_msg="邮件服务器调用失败,result为空";
  112 + }
  113 + Integer code = result.getInteger("errorCode");
  114 + if (code != 0) {
  115 + notice_jishu=CommonConst.NOTICE_FAIL;
  116 + notice_msg="邮件服务器调用失败,result返回消息为:"+result.getString("errorMessage");
  117 + }else{
  118 + notice_jishu=CommonConst.NOTICE_SUCCESS;
  119 + notice_msg="邮件发送成功";
  120 + }
  121 + } catch (Exception e) {
  122 + notice_jishu=CommonConst.NOTICE_FAIL;
  123 + notice_msg="邮件服务器调用失败,服务器报错了";
  124 + }
  125 +
  126 + liveApply.setNotice_jishu(notice_jishu);
  127 + liveApply.setNotice_msg(notice_msg);
  128 + liveApplyServiceImpl.updateshyLiveApply(liveApply);
  129 + }
  130 + }
  131 +
  132 + }
  133 + /**
  134 + * 自动退领
  135 + */
  136 + @Scheduled(cron="0 0 0 * * ? ")//每天0点执行
  137 + public void autoRetReceive() {
  138 + logger.info("直播申请自动退领的进入.....");
  139 + ShyLiveapply liveApply = new ShyLiveapply();
  140 + liveApply.setShenhe_state(CommonConst.AUDIT_INTT);//审核状态:未审核
  141 + liveApply.setReceive(CommonConst.RECEIVE_AFTER);//已领取
  142 + List<ShyLiveapply> shyLiveapplyList = liveApplyServiceImpl.findshyLiveApply(liveApply);
  143 + if(shyLiveapplyList.size()>0){
  144 + for (ShyLiveapply liveapply : shyLiveapplyList) {
  145 + logger.info("自动退领的liveApply_id:"+liveapply.getId());
  146 + liveapply.setReceive(CommonConst.RECEIVE_BEFORE);//未领取
  147 + liveapply.setAuditor(null);
  148 + liveApplyServiceImpl.updateshyLiveApply(liveApply);
  149 + }
  150 + }
  151 + }
  152 +
  153 +}
src/main/java/com/cnlive/shenhe/serviceImpl/LiveApplyServiceImpl.java
@@ -237,53 +237,57 @@ public class LiveApplyServiceImpl { @@ -237,53 +237,57 @@ public class LiveApplyServiceImpl {
237 * 根据条件导出数据excel 237 * 根据条件导出数据excel
238 * @return 238 * @return
239 */ 239 */
240 - public List<ShyLive> findByCondition(String activity_id,String start_date,String end_date,  
241 - String activity_name, Integer activity_status, Integer page,Integer pageSize,  
242 - Integer shenhe_state, String orderByClause, Integer spid) {  
243 - Example example = new Example(ShyLive.class); 240 + public List<ShyLiveapply> findByCondition(String theme, String start_date, String end_date,
  241 + Integer business_model, Integer page, Integer pageSize,
  242 + Integer shenhe_state,Integer receive, String orderByClause, Integer spid, String userId) {
  243 + Example example = new Example(ShyLiveapply.class);
244 Example.Criteria criteria = example.createCriteria(); 244 Example.Criteria criteria = example.createCriteria();
245 if (CommonUtils.isNotEmpty(orderByClause)) { 245 if (CommonUtils.isNotEmpty(orderByClause)) {
246 example.setOrderByClause(orderByClause); 246 example.setOrderByClause(orderByClause);
247 }else{ 247 }else{
248 - //默认排序  
249 - example.setOrderByClause("activity_start_time asc"); 248 + example.setOrderByClause("pre_start_time");
250 } 249 }
251 if (CommonUtils.isNotEmpty(start_date)) { 250 if (CommonUtils.isNotEmpty(start_date)) {
252 Timestamp startdate = null; 251 Timestamp startdate = null;
253 try { 252 try {
254 - startdate = CommonUtils.parseDate(start_date, "yyyy-MM-dd HH:mm"); 253 + startdate = CommonUtils.parseDate(start_date, "yyyy-MM-dd");
255 } catch (ParseException e) { 254 } catch (ParseException e) {
256 e.printStackTrace(); 255 e.printStackTrace();
257 } 256 }
258 - criteria.andGreaterThanOrEqualTo("activity_start_time", startdate); 257 + criteria.andGreaterThanOrEqualTo("pre_start_time", startdate);
259 } 258 }
260 if ( CommonUtils.isNotEmpty(end_date)) { 259 if ( CommonUtils.isNotEmpty(end_date)) {
261 Timestamp enddate = null; 260 Timestamp enddate = null;
262 try { 261 try {
263 - enddate = CommonUtils.parseDate(end_date, "yyyy-MM-dd HH:mm"); 262 + enddate = CommonUtils.parseDate(end_date, "yyyy-MM-dd");
264 } catch (ParseException e) { 263 } catch (ParseException e) {
265 e.printStackTrace(); 264 e.printStackTrace();
266 } 265 }
267 - criteria.andLessThanOrEqualTo("activity_end_time", enddate);  
268 - }  
269 - if (CommonUtils.isNotEmpty(activity_name)) {  
270 - criteria.andLike("activity_name", "%" + activity_name + "%"); 266 + criteria.andLessThanOrEqualTo("pre_end_time", enddate);
271 } 267 }
272 - if (CommonUtils.isNotNull(activity_status) ) {  
273 - criteria.andEqualTo("activity_status", activity_status); 268 + if (CommonUtils.isNotEmpty(theme)) {
  269 + criteria.andLike("theme", "%" + theme + "%");
274 } 270 }
275 - if (CommonUtils.isNotEmpty(activity_id)) {  
276 - criteria.andEqualTo("activity_id", activity_id); 271 +
  272 + if (CommonUtils.isNotNull(business_model)) {
  273 + criteria.andEqualTo("business_model", business_model);
277 } 274 }
278 if (CommonUtils.isNotNull(spid)) { 275 if (CommonUtils.isNotNull(spid)) {
279 - criteria.andEqualTo("spid", spid); 276 + criteria.andEqualTo("sp_id", spid);
280 } 277 }
281 - if (CommonUtils.isNotNull(shenhe_state)) { 278 + if (CommonUtils.isNotNull(shenhe_state)&& shenhe_state != 3) {
282 criteria.andEqualTo("shenhe_state", shenhe_state); 279 criteria.andEqualTo("shenhe_state", shenhe_state);
  280 + }else if(CommonUtils.isNotNull(shenhe_state)&& shenhe_state == 3){
  281 + criteria.andNotEqualTo("shenhe_state", 0);
  282 + }
  283 + if (CommonUtils.isNotNull(receive)) {
  284 + criteria.andEqualTo("receive", receive);
  285 + if(receive!=0 && CommonUtils.isNotEmpty(userId)){
  286 + criteria.andEqualTo("auditor", userId);
  287 + }
283 } 288 }
284 -  
285 - List<ShyLive> shyLiveList = shyLiveMapper.selectByExample(example);  
286 - return shyLiveList; 289 + List<ShyLiveapply> shyLiveApplyList = shyLiveApplyMapper.selectByExample(example);
  290 + return shyLiveApplyList;
287 } 291 }
288 292
289 /** 293 /**
src/main/java/com/cnlive/shenhe/utils/CommonConst.java
@@ -61,6 +61,19 @@ public class CommonConst { @@ -61,6 +61,19 @@ public class CommonConst {
61 * 用户状态:禁用 61 * 用户状态:禁用
62 */ 62 */
63 public static Integer USER_STATUS_FORBID = 2; 63 public static Integer USER_STATUS_FORBID = 2;
  64 +
  65 + /**
  66 + * 通知状态:未通知
  67 + */
  68 + public static Integer NOTICE_INTT = 1;
  69 + /**
  70 + * 通知状态:已通知
  71 + */
  72 + public static Integer NOTICE_SUCCESS = 2;
  73 + /**
  74 + * 通知状态:通知失败
  75 + */
  76 + public static Integer NOTICE_FAIL = 3;
64 77
65 78
66 /** 79 /**
src/main/java/com/cnlive/shenhe/utils/OpenUtil.java
1 package com.cnlive.shenhe.utils; 1 package com.cnlive.shenhe.utils;
2 2
3 import javax.servlet.ServletRequest; 3 import javax.servlet.ServletRequest;
  4 +
  5 +import com.alibaba.fastjson.JSONObject;
  6 +
4 import java.io.UnsupportedEncodingException; 7 import java.io.UnsupportedEncodingException;
5 import java.net.URLDecoder; 8 import java.net.URLDecoder;
6 import java.net.URLEncoder; 9 import java.net.URLEncoder;
@@ -8,6 +11,24 @@ import java.util.*; @@ -8,6 +11,24 @@ import java.util.*;
8 11
9 public class OpenUtil { 12 public class OpenUtil {
10 13
  14 +
  15 + //生成post方式的请求参数签名
  16 + public static void main(String[] args) {
  17 +// String app_key = "ad101b9152817a79b5c33c3617b96ff91385096ff3b4ba"; //开发者帐号对应的key. 请开发者谨慎保管此值。
  18 +// Map<String, String> params = new HashMap<>();
  19 +// params.put("appId", "769_jetja50p18");
  20 +// params.put("emailAddr", "642522156@qq.com");
  21 +// params.put("title", "新直播开播申请");
  22 +// params.put("content", "李伟 __12001072345__中投视讯sdadadad__测试2测试2测试2测试2__2019-10-30 14:53:50__2019-10-30 14:55:15__花园桥花园桥花园桥花园桥花园桥花园桥__rtmp://sxzg.rtmpt2.cnlive.com/live-sxzg-82/82_newshen4?key=564329e44212e754__rtmp://sxzg.rtmpt2.cnlive.com/live-sxzg-82/82_newshen4");
  23 +// params.put("templateId", "4017");
  24 +// params.put("sign", sign(params,app_key));
  25 +// HttpUtil httpUtil = HttpUtil.init();
  26 +// httpUtil.setParamMap(params);
  27 +// String URL = "http://sms.cnlive.com/CnliveM3/email/sendMoreVarEmail.action";
  28 +// Map<String, String> post = httpUtil.post(URL);
  29 +// System.out.println(post.get("result"));
  30 + }
  31 +
11 32
12 /** 33 /**
13 * 验证签名 34 * 验证签名
src/main/resources/mapper/ShyLiveapplyMapper.xml
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
13 <result column="mobile" jdbcType="VARCHAR" property="mobile" /> 13 <result column="mobile" jdbcType="VARCHAR" property="mobile" />
14 <result column="organization" jdbcType="VARCHAR" property="organization" /> 14 <result column="organization" jdbcType="VARCHAR" property="organization" />
15 <result column="theme" jdbcType="VARCHAR" property="theme" /> 15 <result column="theme" jdbcType="VARCHAR" property="theme" />
  16 + <result column="live_type" jdbcType="VARCHAR" property="live_type" />
16 <result column="pre_start_time" jdbcType="TIMESTAMP" property="pre_start_time" /> 17 <result column="pre_start_time" jdbcType="TIMESTAMP" property="pre_start_time" />
17 <result column="pre_end_time" jdbcType="TIMESTAMP" property="pre_end_time" /> 18 <result column="pre_end_time" jdbcType="TIMESTAMP" property="pre_end_time" />
18 <result column="business_model" jdbcType="INTEGER" property="business_model" /> 19 <result column="business_model" jdbcType="INTEGER" property="business_model" />
@@ -29,6 +30,8 @@ @@ -29,6 +30,8 @@
29 <result column="updater" jdbcType="VARCHAR" property="updater" /> 30 <result column="updater" jdbcType="VARCHAR" property="updater" />
30 <result column="auditor" jdbcType="VARCHAR" property="auditor" /> 31 <result column="auditor" jdbcType="VARCHAR" property="auditor" />
31 <result column="shenhe_msg" jdbcType="VARCHAR" property="shenhe_msg" /> 32 <result column="shenhe_msg" jdbcType="VARCHAR" property="shenhe_msg" />
  33 + <result column="notice_jishu" jdbcType="INTEGER" property="notice_jishu" />
  34 + <result column="notice_msg" jdbcType="VARCHAR" property="notice_msg" />
32 <result column="created_at" jdbcType="TIMESTAMP" property="created_at" /> 35 <result column="created_at" jdbcType="TIMESTAMP" property="created_at" />
33 <result column="updated_at" jdbcType="TIMESTAMP" property="updated_at" /> 36 <result column="updated_at" jdbcType="TIMESTAMP" property="updated_at" />
34 <result column="simple_content" jdbcType="LONGVARCHAR" property="simple_content" /> 37 <result column="simple_content" jdbcType="LONGVARCHAR" property="simple_content" />
src/main/resources/templates/email/email_templates.html 0 → 100644
  1 +<html>
  2 +<head>
  3 +<title>新直播开播申请</title>
  4 +</head>
  5 +<body>
  6 + <div align="center" id="tabContents" class="tab-content">
  7 + <span style="font-size:30px;font-weight: bold;color:#F4A460;">中国网家家直播申请单</span>
  8 + <table border="1" style="background-color:#F5FFFA;width:80%;font-size:20px;" id="table">
  9 + <tr align="center" valign="middle" height="40px">
  10 + <td width="25%" >直播发起人</td>
  11 + <td width="30%" colspan="2" >
  12 + <span style="color:#DC143C" >${sender}</span>
  13 + </td>
  14 + <td width="15%">联系方式</td>
  15 + <td width="30%" colspan="2">
  16 + <span style="color:#DC143C" >${mobile}</span>
  17 + </td>
  18 + </tr>
  19 + <tr align="center" valign="middle" height="40px">
  20 + <td >直播发起单位</td>
  21 + <td colspan="5">
  22 + <span style="color:#DC143C" >${organization}</span>
  23 + </td>
  24 + </tr>
  25 + <tr align="center" valign="middle" height="40px">
  26 + <td >直播主题</td>
  27 + <td colspan="5">
  28 + <span style="color:#DC143C" >${theme}</span>
  29 + </td>
  30 + </tr>
  31 + <tr align="center" valign="middle" height="40px">
  32 + <td >直播开始时间</td>
  33 + <td colspan="5">
  34 + <span style="color:#DC143C" >${pre_start_time}</span>
  35 + </td>
  36 + </tr>
  37 + <tr align="center" valign="middle" height="40px">
  38 + <td >直播结束时间</td>
  39 + <td colspan="5">
  40 + <span style="color:#DC143C" >${pre_end_time}</span>
  41 + </td>
  42 + </tr>
  43 +
  44 + <tr align="center" valign="middle" height="40px">
  45 + <td >直播地点</td>
  46 + <td colspan="5">
  47 + <span style="color:#DC143C" >${live_place}</span>
  48 + </td>
  49 + </tr>
  50 + <tr align="center" valign="middle" height="40px">
  51 + <td >推流地址</td>
  52 + <td colspan="5">
  53 + <span style="color:#DC143C" >${push_url}</span>
  54 + </td>
  55 + </tr>
  56 + <tr align="center" valign="middle" height="40px">
  57 + <td >拉流地址</td>
  58 + <td colspan="5">
  59 + <span style="color:#DC143C" >${pull_url}</span>
  60 + </td>
  61 + </tr>
  62 +
  63 + </table>
  64 +
  65 + </div>
  66 +</body>
  67 +</html>
0 \ No newline at end of file 68 \ No newline at end of file