Commit 250b3299d4f59564b7e606f45a0b770bb121ad9a

Authored by liwei2917
1 parent b1b3a24e

修改图文审核的朋友圈接口

src/main/java/com/cnlive/shenhe/api/ContentControllerApi.java
... ... @@ -141,6 +141,7 @@ public class ContentControllerApi {
141 141 shyContent1.setSp_id(json.getInteger("spId"));//spid
142 142 shyContent1.setAuthor(json.getString("userId"));//用户id
143 143 shyContent1.setSource(json.getString("nickName"));//用户昵称
  144 + shyContent1.setVideoId(json.getString("videoId"));//关联videoId
144 145 shyContent1.setContent_tag("moment");//图文标签
145 146 shyContent1.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态
146 147 shyContent1.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间
... ... @@ -171,6 +172,7 @@ public class ContentControllerApi {
171 172 shyContent.setSp_id(json.getInteger("spId"));//spid
172 173 shyContent.setAuthor(json.getString("userId"));//用户id
173 174 shyContent.setSource(json.getString("nickName"));//用户昵称
  175 + shyContent.setVideoId(json.getString("videoId"));//关联videoId
174 176 shyContent.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态
175 177 shyContent.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间
176 178 boolean YorN = contentService.impotContent(shyContent);
... ...
src/main/java/com/cnlive/shenhe/controller/ContentController.java
... ... @@ -163,7 +163,11 @@ public class ContentController {
163 163 public ResponseBean pass(String ids, HttpSession session) {
164 164 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
165 165 String userId = sessionUser.getUserId();
166   - boolean success = contentService.updateState(ids,"审核通过", CommonConst.AUDIT_SUCCESS, userId);
  166 + boolean success =false;
  167 + String[] contentIds = ids.split(",");
  168 + for (String contentId : contentIds) {
  169 + success = contentService.callback(contentId,"审核通过", CommonConst.AUDIT_SUCCESS, userId);
  170 + }
167 171 if (success) {
168 172 return new ResponseBean();
169 173 } else {
... ... @@ -182,7 +186,11 @@ public class ContentController {
182 186 public ResponseBean refuse(String ids,String msg, HttpSession session) {
183 187 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
184 188 String userId = sessionUser.getUserId();
185   - boolean success = contentService.updateState(ids,msg, CommonConst.AUDIT_REFUSE, userId);
  189 + boolean success =false;
  190 + String[] contentIds = ids.split(",");
  191 + for (String contentId : contentIds) {
  192 + success = contentService.callback(contentId,msg, CommonConst.AUDIT_REFUSE, userId);
  193 + }
186 194 if (success) {
187 195 return new ResponseBean();
188 196 } else {
... ...
src/main/java/com/cnlive/shenhe/controller/VideosController.java
... ... @@ -437,31 +437,7 @@ public class VideosController {
437 437 String[] shyVideoIds = ids.split(",");
438 438 String showMsg = "";
439 439 for (String shyVideoId : shyVideoIds) {
440   - ShyVideos shyVideos = videosService.selectByPrimaryKey(Integer.parseInt(shyVideoId));
441   - JSONObject result = null;
442   - try {
443   - result = Pass.auditPass(shyVideos.getVideo_id(), 4, msg, msg, shyVideos.getCallback());
444   - } catch (Exception e) {
445   - logger.error("视频审核失败,id==" + shyVideoId, e);
446   - showMsg = showMsg + "," + shyVideos.getVideo_title() + " 拒绝请求失败";
447   - break;
448   - }
449   - if (result == null) {
450   - logger.error("视频审核失败且接口错误没有返回信息,id==" + shyVideoId);
451   - showMsg = showMsg + "," + shyVideos.getVideo_title() + " 拒绝请求失败";
452   - break;
453   - }
454   - Integer code = result.getInteger("code");
455   - if (code != 0) {
456   - logger.error("视频审核失败,id:{},code:{}", shyVideoId, code);
457   - showMsg = showMsg + "," + shyVideos.getVideo_title() + " " + result.getString("msg");
458   - break;
459   - }
460   - int i = videosService.updateVideo(Integer.parseInt(shyVideoId), userId,null,"", 2, msg);
461   - if (i == 0) {
462   - showMsg = showMsg + "," + shyVideos.getVideo_title() + " 更新失败";
463   - break;
464   - }
  440 + showMsg = videosService.repulse(shyVideoId, msg, userId);
465 441 }
466 442 if (CommonUtils.isNotEmpty(showMsg)) {
467 443 responseBean.setErrorCode(ErrorEnum.ERROR.getErrorCode());
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/ContentServiceImpl.java
... ... @@ -49,6 +49,8 @@ public class ContentServiceImpl {
49 49 AuditPass Pass;
50 50 @Autowired
51 51 SitesServiceImpl sitesService;
  52 + @Autowired
  53 + VideosServiceImpl videosService;
52 54  
53 55 public List<ShySites> getBusiness(ShySites shySites) {
54 56 List<ShySites> sitesList = shySitesMapper.select(shySites);
... ... @@ -187,10 +189,8 @@ public class ContentServiceImpl {
187 189 }
188 190  
189 191 //**********************
190   - public boolean updateState(String ids, String msg, Integer state, String userId) {
191   - boolean success = true;
192   - String[] contentIds = ids.split(",");
193   - for (String contentId : contentIds) {
  192 + public boolean callback(String contentId, String msg, Integer state, String userId) {
  193 + boolean success = true;
194 194 ShyContent content = shyContentMapper.selectByPrimaryKey(Integer.parseInt(contentId));
195 195 JSONObject result = new JSONObject();
196 196 try {
... ... @@ -202,21 +202,33 @@ public class ContentServiceImpl {
202 202 } catch (Exception e) {
203 203 logger.error("图文审核回调失败,图文id:{}", content.getId());
204 204 success = false;
205   - break;
  205 + return success;
206 206 }
207 207 if (result == null) {
208 208 logger.error("图文回调错误,且无返回信息。图文id:{}", content.getId());
209 209 success = false;
210   - break;
  210 + return success;
211 211 } else {
212 212 Integer code = result.getInteger("errorCode");
213   -// msg=CommonUtils.isNotEmpty(msg)?msg+",图文回调结果:"+result.getString("errorMessage"):"图文回调结果:"+result.getString("errorMessage");
214 213 if (code != 0) {
215 214 logger.error("图文回调错误,图文id:{},errorCode:{},errorMessage:{}", content.getId(), code,
216 215 result.getString("errorMessage"));
217 216 success = false;
218   - break;
  217 + return success;
  218 + }
  219 +
  220 + //如果当前图文是朋友圈的视频,通知点播云
  221 + if(CommonUtils.isNotEmpty(content.getContent_tag())
  222 + &&content.getContent_tag().equals("moment")
  223 + &&CommonUtils.isNotEmpty(content.getVideoId())
  224 + &&state==CommonConst.AUDIT_REFUSE){
  225 + String showMsg = videosService.repulse(content.getVideoId(), msg, userId);
  226 + if (CommonUtils.isNotEmpty(showMsg)) {
  227 + success = false;
  228 + return success;
  229 + }
219 230 }
  231 +
220 232 content.setContent_status(state);// 设置图文状态为审核后的状态
221 233 content.setReceive_status(CommonConst.RECEIVE_AUDIT);// 领取状态为已审核
222 234 content.setShenhe_msg(msg);// 设置审核消息
... ... @@ -231,7 +243,6 @@ public class ContentServiceImpl {
231 243 }
232 244 }
233 245  
234   - }
235 246 return success;
236 247 }
237 248  
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
... ... @@ -431,5 +431,37 @@ public class VideosServiceImpl {
431 431 }
432 432 shyVideo.setShenhe_type(shenheType);
433 433 }
  434 +
  435 +
  436 + public String repulse(String shyVideoId,String msg,String userId){
  437 + String showMsg="";
  438 + ShyVideos shyVideos = videosService.selectByPrimaryKey(Integer.parseInt(shyVideoId));
  439 + JSONObject result = null;
  440 + try {
  441 + result = Pass.auditPass(shyVideos.getVideo_id(), 4, msg, msg, shyVideos.getCallback());
  442 + } catch (Exception e) {
  443 + logger.error("视频审核失败,id==" + shyVideoId, e);
  444 + showMsg = showMsg + "," + shyVideos.getVideo_title() + " 拒绝请求失败";
  445 + return showMsg;
  446 + }
  447 + if (result == null) {
  448 + logger.error("视频审核失败且接口错误没有返回信息,id==" + shyVideoId);
  449 + showMsg = showMsg + "," + shyVideos.getVideo_title() + " 拒绝请求失败";
  450 + return showMsg;
  451 + }
  452 + Integer code = result.getInteger("code");
  453 + if (code != 0) {
  454 + logger.error("视频审核失败,id:{},code:{}", shyVideoId, code);
  455 + showMsg = showMsg + "," + shyVideos.getVideo_title() + " " + result.getString("msg");
  456 + return showMsg;
  457 + }
  458 + int i = videosService.updateVideo(Integer.parseInt(shyVideoId), userId,null,"", 2, msg);
  459 + if (i == 0) {
  460 + showMsg = showMsg + "," + shyVideos.getVideo_title() + " 更新失败";
  461 + return showMsg;
  462 + }
  463 +
  464 + return showMsg;
  465 + }
434 466  
435 467 }
... ...