Commit bd73f6aea4b8f517d5619177c1bd526edf659287

Authored by liwei2917
1 parent 89b54793

图文回调修改,非管理员的账号查询报错修复

src/main/java/com/cnlive/shenhe/api/ContentControllerApi.java
... ... @@ -55,12 +55,13 @@ public class ContentControllerApi {
55 55 shyContent1.setContent_status(json.getInteger("contentStatus"));//当前图文的审核状态
56 56 shyContent1.setSource(json.getString("source"));//来源
57 57 shyContent1.setAuthor(json.getString("author"));//作者
58   - String contentTime = json.getString("contentTime");//创建时间
  58 + String contentTime = json.getString("contentTime");//图文创建时间
59 59 if (CommonUtils.isNotEmpty(contentTime)) {
60 60 Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss");
61   - shyContent1.setCreate_date(timestamp);
  61 + shyContent1.setContent_time(timestamp);
62 62  
63 63 }
  64 + shyContent1.setCreate_date(CommonUtils.getCurrentTime());
64 65 shyContent1.setCallback(json.getString("callback"));//回调地址
65 66 shyContent1.setContent_url(json.getString("contentUrl"));//图文发布的url
66 67 shyContent1.setSp_id(json.getInteger("spId"));//spid
... ... @@ -86,9 +87,10 @@ public class ContentControllerApi {
86 87 String contentTime = json.getString("contentTime");//创建时间
87 88 if (CommonUtils.isNotEmpty(contentTime)) {
88 89 Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss");
89   - shyContent.setCreate_date(timestamp);
  90 + shyContent.setContent_time(timestamp);
90 91  
91 92 }
  93 + shyContent.setCreate_date(CommonUtils.getCurrentTime());
92 94 shyContent.setCallback(json.getString("callback"));//回调地址
93 95 shyContent.setContent_url(json.getString("contentUrl"));//图文发布的url
94 96 shyContent.setSp_id(json.getInteger("spId"));//spid
... ...
src/main/java/com/cnlive/shenhe/controller/VideosController.java
... ... @@ -469,5 +469,13 @@ public class VideosController {
469 469 }
470 470 return responseBean;
471 471 }
  472 +
  473 + @PostMapping("/ceshi")
  474 + @ResponseBody
  475 + public static String ceshi(String name) {
  476 +
  477 +
  478 + return name;
  479 + }
472 480  
473 481 }
... ...
src/main/java/com/cnlive/shenhe/entity/ShyContent.java
... ... @@ -64,7 +64,11 @@ public class ShyContent {
64 64 private String author;
65 65  
66 66 /**
67   - * 创建时间
  67 + * 图文创建时间
  68 + */
  69 + private Date content_time;
  70 + /**
  71 + * 图文送审时间
68 72 */
69 73 private Date create_date;
70 74  
... ... @@ -426,5 +430,14 @@ public class ShyContent {
426 430 public void setSp_desc(String sp_desc) {
427 431 this.sp_desc = sp_desc;
428 432 }
  433 +
  434 + public Date getContent_time() {
  435 + return content_time;
  436 + }
  437 +
  438 + public void setContent_time(Date content_time) {
  439 + this.content_time = content_time;
  440 + }
  441 +
429 442  
430 443 }
431 444 \ No newline at end of file
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/ContentServiceImpl.java
... ... @@ -102,7 +102,7 @@ public class ContentServiceImpl {
102 102 criteria.andEqualTo("updater", updater);
103 103 }
104 104 if (CommonUtils.isNotNull(spid)) {
105   - criteria.andEqualTo("spid", spid);
  105 + criteria.andEqualTo("sp_id", spid);
106 106 }
107 107 // if (CommonUtils.isNotNull(is_hot)) {
108 108 // criteria.andEqualTo("is_hot", is_hot);
... ... @@ -156,51 +156,54 @@ public class ContentServiceImpl {
156 156 }
157 157  
158 158 //**********************
159   - public boolean updateState(String ids,String msg, Integer state, String userId) {
160   - boolean success = true;
161   - String[] contentIds = ids.split(",");
162   - for (String contentId : contentIds) {
163   - ShyContent content = shyContentMapper.selectByPrimaryKey(Integer.parseInt(contentId));
164   - JSONObject json = new JSONObject();
165   - json.put("auditor_id", content.getAuditor_id());
166   - json.put("state", state);
167   - json.put("attr_tags", "");
168   - json.put("msg", msg);
169   -// JSONObject result = new JSONObject();
170   -// try {
171   -// result = Pass.commentPass(json, content.getCallback());
172   -// } catch (Exception e) {
173   -// logger.error("评论回调失败,auditor_id:{}", content.getAuditor_id());
174   -// success = false;
175   -// break;
176   -// }
177   -// if (result == null) {
178   -// logger.error("评论回调错误,且无返回信息。auditor_id:{}", content.getAuditor_id());
179   -// success = false;
180   -// break;
181   -// } else {
182   -// Integer code = result.getInteger("errorCode");
183   -// if (code != 0) {
184   -// logger.error("评论回调错误,auditor_id:{},errorCode:{},errorMessage:{}", content.getAuditor_id(), code, result.getString("errorMessage"));
185   -// success = false;
186   -// break;
187   -// }
188   - content.setContent_status(state);//设置图文状态为审核后的状态
189   - content.setReceive_status(CommonConst.RECEIVE_AUDIT);//领取状态为已审核
190   - content.setShenhe_msg(msg);//设置审核消息
191   - if(CommonUtils.isNotEmpty(userId)){
192   - content.setAuditor_id(userId);
193   - content.setShenhe_type(CommonConst.AUDIT_TYPE_USER);//设置审核类型为人工
194   - }
195   - int i = shyContentMapper.updateByPrimaryKeySelective(content);
196   - if (i != 1) {
197   - success = false;
198   - }
199   -// }
  159 + public boolean updateState(String ids, String msg, Integer state, String userId) {
  160 + boolean success = true;
  161 + String[] contentIds = ids.split(",");
  162 + for (String contentId : contentIds) {
  163 + ShyContent content = shyContentMapper.selectByPrimaryKey(Integer.parseInt(contentId));
  164 + JSONObject result = new JSONObject();
  165 +// String type = "fabu";// 1、fabu,2、xiaxian,3、shanchu
  166 +// if (state == 2) {
  167 +// type = "xiaxian";
  168 +// } else if (state == 3) {
  169 +// type = "shanchu";
  170 +// }
  171 + try {
  172 + result = Pass.contentPass(content.getContent_id(), state+"", msg, content.getCallback());
  173 + } catch (Exception e) {
  174 + logger.error("图文审核回调失败,图文id:{}", content.getId());
  175 + success = false;
  176 + break;
  177 + }
  178 + if (result == null) {
  179 + logger.error("图文回调错误,且无返回信息。图文id:{}", content.getId());
  180 + success = false;
  181 + break;
  182 + } else {
  183 + Integer code = result.getInteger("errorCode");
  184 + msg=CommonUtils.isNotEmpty(msg)?msg+",图文回调结果:"+result.getString("errorMessage"):"图文回调结果:"+result.getString("errorMessage");
  185 + if (code != 0) {
  186 + logger.error("图文回调错误,图文id:{},errorCode:{},errorMessage:{}", content.getId(), code,
  187 + result.getString("errorMessage"));
  188 + success = false;
  189 + break;
  190 + }
  191 + content.setContent_status(state);// 设置图文状态为审核后的状态
  192 + content.setReceive_status(CommonConst.RECEIVE_AUDIT);// 领取状态为已审核
  193 + content.setShenhe_msg(msg);// 设置审核消息
  194 + if (CommonUtils.isNotEmpty(userId)) {
  195 + content.setAuditor_id(userId);
  196 + content.setShenhe_type(CommonConst.AUDIT_TYPE_USER);// 设置审核类型为人工
  197 + }
  198 + int i = shyContentMapper.updateByPrimaryKeySelective(content);
  199 + if (i != 1) {
  200 + success = false;
  201 + }
  202 + }
200 203  
201   - }
202   - return success;
203   - }
  204 + }
  205 + return success;
  206 + }
204 207  
205 208 //**********************************
206 209 public Integer receive(String ids, Integer num, String userId, Integer spid) {
... ...
src/main/java/com/cnlive/shenhe/utils/AuditPass.java
... ... @@ -69,4 +69,21 @@ public class AuditPass {
69 69 String result = HttpUtil.form(callBack, map);
70 70 return JSONObject.parseObject(result);
71 71 }
  72 +
  73 + /**
  74 + * 图文审核回调
  75 + * @param ids
  76 + * @param type 1(fabu),2(xiaxian),3(shanchu)
  77 + * @param shenheStatus 1
  78 + * @param msg
  79 + * @param callBack
  80 + * @return
  81 + */
  82 + public JSONObject contentPass(String contentId, String type,String msg, String callBack) {
  83 + logger.info("图文回调:ids:{},type:{},msg:{}", contentId, type, msg);
  84 + HttpUtil httpUtil = HttpUtil.init();
  85 + String URL = callBack + "?contentId=" + contentId + "&type=" + type+ "&shenMsg=" + msg;
  86 + Map<String, String> post = httpUtil.post(URL);
  87 + return JSONObject.parseObject(post.get("result"));
  88 + }
72 89 }
... ...
src/main/resources/templates/page/content.html
... ... @@ -13,6 +13,7 @@
13 13 <h1>
14 14 图文审核
15 15 </h1>
  16 + <div th:text="${T(com.cnlive.shenhe.controller.VideosController).ceshi('')}">JAN</div>
16 17 <ol class="breadcrumb">
17 18 <li>首页</li>
18 19 <li class="active">图文审核</li>
... ... @@ -360,15 +361,21 @@
360 361 var param = location.search;
361 362 window.location.href = "/content/excel" + param;
362 363 }
  364 +
  365 + var title = $("#video_titleID").val();
  366 + var start_date = $("#start_date").val();
  367 + var end_date = $("#end_date").val();
  368 + var sp_desc = $("#sp_desc").val();
  369 + var count = $("#count").val();
  370 + var spId=[[session.sessionUser.spid]]
  371 + if(spId!=0){
  372 + sp_desc ="";
  373 + count="";
  374 + }
363 375  
364 376 //全部
365 377 function quanbu() {
366   -// var video_priority = $("#video_priority").val();
367   - var title = $("#video_titleID").val();
368   - var start_date = $("#start_date").val();
369   - var end_date = $("#end_date").val();
370   - var sp_desc = $("#sp_desc").val();
371   - var count = $("#count").val();
  378 +
372 379 // window.location.href = "/videos/page?video_title=&start_date=&end_date=&state=&receive=&video_priority=";
373 380 window.location.href = "/content/page?title=" + title + "&start_date=" + start_date + "&end_date=" + end_date + "&sp_desc=" + sp_desc+"&pageSize="+count;
374 381 }
... ... @@ -376,37 +383,31 @@
376 383 //全部待领
377 384 $('#daishen').click(function () {
378 385 var receive_status = 0;
379   -// var receive = 0;
380   -// var video_priority = $("#video_priority").val();
381   - var title = $("#video_titleID").val();
382   - var start_date = $("#start_date").val();
383   - var end_date = $("#end_date").val();
384   - var sp_desc = $("#sp_desc").val();
385   - var count = $("#count").val();
  386 +// var title = $("#video_titleID").val();
  387 +// var start_date = $("#start_date").val();
  388 +// var end_date = $("#end_date").val();
  389 +// var sp_desc = $("#sp_desc").val();
  390 +// var count = $("#count").val();
386 391 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;
387 392 });
388 393 //我的待审核
389 394 $('#Mydaishen').click(function () {
390 395 var receive_status = 1;
391   -// var receive = 1;
392   -// var video_priority = $("#video_priority").val();
393   - var title = $("#video_titleID").val();
394   - var start_date = $("#start_date").val();
395   - var end_date = $("#end_date").val();
396   - var sp_desc = $("#sp_desc").val();
397   - var count = $("#count").val();
  396 +// var title = $("#video_titleID").val();
  397 +// var start_date = $("#start_date").val();
  398 +// var end_date = $("#end_date").val();
  399 +// var sp_desc = $("#sp_desc").val();
  400 +// var count = $("#count").val();
398 401 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;
399 402 });
400 403 //我的已审核
401 404 $('#yishen').click(function () {
402 405 var receive_status = 2;
403   -// var receive = 1;
404   -// var video_priority = $("#video_priority").val();
405   - var title = $("#video_titleID").val();
406   - var start_date = $("#start_date").val();
407   - var end_date = $("#end_date").val();
408   - var sp_desc = $("#sp_desc").val();
409   - var count = $("#count").val();
  406 +// var title = $("#video_titleID").val();
  407 +// var start_date = $("#start_date").val();
  408 +// var end_date = $("#end_date").val();
  409 +// var sp_desc = $("#sp_desc").val();
  410 +// var count = $("#count").val();
410 411 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;
411 412 });
412 413  
... ... @@ -414,11 +415,11 @@
414 415 //查询
415 416 $('#videos_query').click(function () {
416 417 // var video_priority = $("#video_priority").val();
417   - var title = $("#video_titleID").val();
418   - var start_date = $("#start_date").val();
419   - var end_date = $("#end_date").val();
420   - var sp_desc = $("#sp_desc").val();
421   - var count = $("#count").val();
  418 +// var title = $("#video_titleID").val();
  419 +// var start_date = $("#start_date").val();
  420 +// var end_date = $("#end_date").val();
  421 +// var sp_desc = $("#sp_desc").val();
  422 +// var count = $("#count").val();
422 423 window.location.href = "/content/page?title=" + title + "&start_date=" + start_date + "&end_date=" + end_date + "&receive_status=" + "&sp_desc=" + sp_desc+"&pageSize="+count;
423 424 });
424 425 /*全选的操作*/
... ...
src/main/resources/templates/page/contentDetail.html
... ... @@ -68,15 +68,21 @@
68 68 </div>
69 69 <div class="col-sm-6">
70 70 <div class="form-group">
71   - <label for="program_id" class="control-label col-sm-2">图文id:</label>
  71 + <label for="program_id" class="control-label col-sm-2">图文审核id:</label>
72 72 <div class="col-sm-10">
73 73 <h5 th:text="${content.id}">604</h5>
74 74 </div>
75 75 </div>
76 76 <div class="form-group">
  77 + <label for="program_id" class="control-label col-sm-2">图文发布id:</label>
  78 + <div class="col-sm-10">
  79 + <h5 th:text="${content.content_id}">604</h5>
  80 + </div>
  81 + </div>
  82 + <div class="form-group">
77 83 <label for="comment_user_id" class="control-label col-sm-2">发布站点:</label>
78 84 <div class="col-sm-10">
79   - <h5 th:text="${content.sp_id}+':'+${content.sp_desc}">821403</h5>
  85 + <h5 th:text="${content.sp_id}+'('+${content.sp_desc}+')'">821403</h5>
80 86 </div>
81 87 </div>
82 88  
... ...
src/main/resources/templates/page/video.html
... ... @@ -359,15 +359,21 @@
359 359 var param = location.search;
360 360 window.location.href = "/videos/excel" + param;
361 361 }
362   -
363   - //全部
364   - function quanbu() {
  362 +
365 363 var video_priority = $("#video_priority").val();
366 364 var video_title = $("#video_titleID").val();
367 365 var start_date = $("#start_date").val();
368 366 var end_date = $("#end_date").val();
369 367 var sp_desc = $("#sp_desc").val();
370 368 var count = $("#count").val();
  369 + var spId=[[session.sessionUser.spid]]
  370 + if(spId!=0){
  371 + sp_desc ="";
  372 + count="";
  373 + }
  374 +
  375 + //全部
  376 + function quanbu() {
371 377 // window.location.href = "/videos/page?video_title=&start_date=&end_date=&state=&receive=&video_priority=";
372 378 window.location.href = "/videos/page?video_title=" + video_title + "&start_date=" + start_date + "&end_date=" + end_date + "&video_priority=" + video_priority + "&sp_desc=" + sp_desc+"&pageSize="+count;
373 379 }
... ... @@ -376,48 +382,48 @@
376 382 $('#daishen').click(function () {
377 383 var state = 0;
378 384 var receive = 0;
379   - var video_priority = $("#video_priority").val();
380   - var video_title = $("#video_titleID").val();
381   - var start_date = $("#start_date").val();
382   - var end_date = $("#end_date").val();
383   - var sp_desc = $("#sp_desc").val();
384   - var count = $("#count").val();
  385 +// var video_priority = $("#video_priority").val();
  386 +// var video_title = $("#video_titleID").val();
  387 +// var start_date = $("#start_date").val();
  388 +// var end_date = $("#end_date").val();
  389 +// var sp_desc = $("#sp_desc").val();
  390 +// var count = $("#count").val();
385 391 window.location.href = "page?video_title=" + video_title + "&start_date=" + start_date + "&end_date=" + end_date + "&state=" + state + "&receive=" + receive + "&video_priority=" + video_priority + "&sp_desc=" + sp_desc+"&pageSize="+count;
386 392 });
387 393 //我的待审核
388 394 $('#Mydaishen').click(function () {
389 395 var state = 0;
390 396 var receive = 1;
391   - var video_priority = $("#video_priority").val();
392   - var video_title = $("#video_titleID").val();
393   - var start_date = $("#start_date").val();
394   - var end_date = $("#end_date").val();
395   - var sp_desc = $("#sp_desc").val();
396   - var count = $("#count").val();
  397 +// var video_priority = $("#video_priority").val();
  398 +// var video_title = $("#video_titleID").val();
  399 +// var start_date = $("#start_date").val();
  400 +// var end_date = $("#end_date").val();
  401 +// var sp_desc = $("#sp_desc").val();
  402 +// var count = $("#count").val();
397 403 window.location.href = "page?video_title=" + video_title + "&start_date=" + start_date + "&end_date=" + end_date + "&state=" + state + "&receive=" + receive + "&video_priority=" + video_priority + "&sp_desc=" + sp_desc+"&pageSize="+count;
398 404 });
399 405 //我的已审核
400 406 $('#yishen').click(function () {
401 407 var state = 1;
402 408 var receive = 1;
403   - var video_priority = $("#video_priority").val();
404   - var video_title = $("#video_titleID").val();
405   - var start_date = $("#start_date").val();
406   - var end_date = $("#end_date").val();
407   - var sp_desc = $("#sp_desc").val();
408   - var count = $("#count").val();
  409 +// var video_priority = $("#video_priority").val();
  410 +// var video_title = $("#video_titleID").val();
  411 +// var start_date = $("#start_date").val();
  412 +// var end_date = $("#end_date").val();
  413 +// var sp_desc = $("#sp_desc").val();
  414 +// var count = $("#count").val();
409 415 window.location.href = "page?video_title=" + video_title + "&start_date=" + start_date + "&end_date=" + end_date + "&state=" + state + "&receive=" + receive + "&video_priority=" + video_priority + "&sp_desc=" + sp_desc+"&pageSize="+count;
410 416 });
411 417  
412 418  
413 419 //查询
414 420 $('#videos_query').click(function () {
415   - var video_priority = $("#video_priority").val();
416   - var video_title = $("#video_titleID").val();
417   - var start_date = $("#start_date").val();
418   - var end_date = $("#end_date").val();
419   - var sp_desc = $("#sp_desc").val();
420   - var count = $("#count").val();
  421 +// var video_priority = $("#video_priority").val();
  422 +// var video_title = $("#video_titleID").val();
  423 +// var start_date = $("#start_date").val();
  424 +// var end_date = $("#end_date").val();
  425 +// var sp_desc = $("#sp_desc").val();
  426 +// var count = $("#count").val();
421 427 window.location.href = "/videos/page?video_title=" + video_title + "&start_date=" + start_date + "&end_date=" + end_date + "&state=&video_priority=" + video_priority + "&sp_desc=" + sp_desc+"&pageSize="+count;
422 428 });
423 429 /*全选的操作*/
... ...