Commit 541bce57d7bcd58bcdc948b6cd99c6ff9fa93406

Authored by 周伟鹏
1 parent a28cb69c

添加打回操作

src/main/java/com/cnlive/shenhe/controller/VideosController.java
... ... @@ -132,7 +132,7 @@ public class VideosController {
132 132 user = usersService.select(user);
133 133 if (CommonUtils.isNotNull(user)) {
134 134 String userName = CommonUtils.isEmpty(user.getUsername()) ? "" : user.getUsername();
135   - String email = CommonUtils.isEmpty(user.getEmail()) ? "" : user.getEmail();
  135 + String email = CommonUtils.isEmpty(user.getEmail())||"null".equals(user.getEmail()) ? "" : user.getEmail();
136 136 auditor = userName + email;
137 137 }
138 138 }
... ... @@ -318,7 +318,7 @@ public class VideosController {
318 318 user = usersService.select(user);
319 319 if (CommonUtils.isNotNull(user)) {
320 320 String userName = CommonUtils.isEmpty(user.getUsername()) ? "" : user.getUsername();
321   - String email = CommonUtils.isEmpty(user.getEmail()) ? "" : user.getEmail();
  321 + String email = CommonUtils.isEmpty(user.getEmail())||"null".equals(user.getEmail()) ? "" : user.getEmail();
322 322 auditor = userName + email;
323 323 }
324 324 }
... ... @@ -387,4 +387,55 @@ public class VideosController {
387 387 }
388 388 }
389 389 }
  390 +
  391 + /**
  392 + * 打回(审核拒绝,应要求不加权限、状态等限制)
  393 + *
  394 + * @param ids
  395 + * @param msg
  396 + * @param session
  397 + * @return
  398 + */
  399 + @PostMapping("/repulse")
  400 + @ResponseBody
  401 + public ResponseBean repulse(String ids, String msg, HttpSession session) {
  402 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  403 + String userId = sessionUser.getUserId();
  404 + ResponseBean responseBean = new ResponseBean();
  405 + String[] shyVideoIds = ids.split(",");
  406 + String showMsg = "";
  407 + for (String shyVideoId : shyVideoIds) {
  408 + ShyVideos shyVideos = videosService.selectByPrimaryKey(Integer.parseInt(shyVideoId));
  409 + JSONObject result = null;
  410 + try {
  411 + result = Pass.auditPass(shyVideos.getVideo_id(), 4, msg, msg, shyVideos.getCallback());
  412 + } catch (Exception e) {
  413 + logger.error("视频审核失败,id==" + shyVideoId, e);
  414 + showMsg = showMsg + "," + shyVideos.getVideo_title() + " 拒绝请求失败";
  415 + break;
  416 + }
  417 + if (result == null) {
  418 + logger.error("视频审核失败且接口错误没有返回信息,id==" + shyVideoId);
  419 + showMsg = showMsg + "," + shyVideos.getVideo_title() + " 拒绝请求失败";
  420 + break;
  421 + }
  422 + Integer code = result.getInteger("code");
  423 + if (code != 0) {
  424 + logger.error("视频审核失败,id:{},code:{}", shyVideoId, code);
  425 + showMsg = showMsg + "," + shyVideos.getVideo_title() + " " + result.getString("msg");
  426 + break;
  427 + }
  428 + int i = videosService.updateVideo(Integer.parseInt(shyVideoId), userId, 2, msg);
  429 + if (i == 0) {
  430 + showMsg = showMsg + "," + shyVideos.getVideo_title() + " 更新失败";
  431 + break;
  432 + }
  433 + }
  434 + if (CommonUtils.isNotEmpty(showMsg)) {
  435 + responseBean.setErrorCode(ErrorEnum.ERROR.getErrorCode());
  436 + responseBean.setErrorMessage(showMsg);
  437 + }
  438 + return responseBean;
  439 + }
  440 +
390 441 }
... ...
src/main/resources/templates/page/video.html
... ... @@ -43,12 +43,16 @@
43 43 value="2" data="claim1000" id="claim1000" data-toggle="modal"
44 44 data-target="#modal" onclick="retReceive();">退领
45 45 </button>
  46 + <button type="button" class="btn btn-danger btn-sm margin-r-5 action claim"
  47 + value="2" data="claim1000" id="claim1000" data-toggle="modal"
  48 + data-target="#modal" onclick="repulse();">拒绝
  49 + </button>
46 50 </div>
47 51 </div>
48 52  
49 53  
50 54 <div class="btn-group margin-bottom pull-right">
51   - <button type="button" class="btn btn-sm margin-r-5 filter "
  55 + <button type="button" class="btn btn-success btn-sm margin-r-5 filter "
52 56 th:onclick="'javascript:daochu()'" value="" id="excel">
53 57 导出excel
54 58 </button>
... ... @@ -433,7 +437,7 @@
433 437 function retReceive() {
434 438 var rows = $("[name=btSelectItem]:checkbox:checked");
435 439 if (rows.length > 0) {
436   - var r = confirm("您确定退领选中的" + rows.length + "条评论吗?");
  440 + var r = confirm("您确定退领选中的" + rows.length + "条内容吗?");
437 441 if (r == true) {
438 442 var ids = "";
439 443 rows.each(function (i, e) {
... ... @@ -458,7 +462,61 @@
458 462 }
459 463 })
460 464 }
  465 + //拒绝(打回)
  466 + function repulse() {
  467 + var rows = $("[name=btSelectItem]:checkbox:checked");
  468 + if (rows.length > 0) {
  469 + var r = confirm("您确定拒绝选中的" + rows.length + "条内容吗?");
  470 + if (r == true) {
  471 + $('#msgModal').modal('show');
  472 + }
  473 + } else {
  474 + alert("没有选中的数据!");
  475 + }
  476 + }
  477 + //提交打回
  478 + function repulseSubmit() {
  479 + var rows = $("[name=btSelectItem]:checkbox:checked");
  480 + var ids = "";
  481 + rows.each(function (i, e) {
  482 + ids = ids + "," + e.value;
  483 + })
  484 + ids = ids.substring(1);
  485 + var msg = $("#reviewMsg").val();
  486 + $.post("/videos/repulse?ids=" + ids+"&msg="+msg, function (data) {
  487 + if (data.errorCode == 0) {
  488 + alert(data.errorMessage);
  489 + location.href = location.href;
  490 + } else {
  491 + alert(data.errorMessage);
  492 + }
  493 + })
  494 + }
461 495 </script>
  496 + <!-- 模态框(Modal) -->
  497 + <div class="modal fade" id="msgModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  498 + <div class="modal-dialog">
  499 + <div class="modal-content" style="margin-top: 30%;">
  500 + <div class="modal-header">
  501 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  502 + <h4 class="modal-title" id="myModalLabel">审核意见</h4>
  503 + </div>
  504 + <div class="modal-body">
  505 + <div class="form-group" style="margin-bottom: 0;">
  506 + <textarea id="reviewMsg" style="width: 100%;height: 80px;"></textarea>
  507 + </div>
  508 + <div class="form-group">
  509 + </div>
  510 + </div>
  511 + <div class="modal-footer">
  512 + <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
  513 + <button type="button" class="btn btn-primary" onclick="javascript:repulseSubmit();">提交</button>
  514 + </div>
  515 + </div><!-- /.modal-content -->
  516 + </div><!-- /.modal-dialog -->
  517 + </div>
  518 + <!-- /.modal -->
  519 +
462 520 <!--保留之前的样式代码-->
463 521 <script>
464 522 $('#a_down').hide();
... ...