Commit 7831ad1e8d5066ad3ce048af28725d6d6f3993e7
1 parent
8f62499f
开发话题、易盾云接口测试并优化代码
Showing
20 changed files
with
276 additions
and
137 deletions
src/main/java/com/cnlive/shenhe/api/AudioControllerApi.java
| ... | ... | @@ -8,7 +8,7 @@ import com.cnlive.shenhe.entity.ShyAudio; |
| 8 | 8 | import com.cnlive.shenhe.entity.ShyYidun; |
| 9 | 9 | import com.cnlive.shenhe.enums.TextLabels; |
| 10 | 10 | import com.cnlive.shenhe.service.AudioService; |
| 11 | -import com.cnlive.shenhe.service.serviceImpl.YiDunServiceImpl; | |
| 11 | +import com.cnlive.shenhe.service.YiDunService; | |
| 12 | 12 | import com.cnlive.shenhe.utils.AuditPass; |
| 13 | 13 | import com.cnlive.shenhe.utils.CommonConst; |
| 14 | 14 | import com.cnlive.shenhe.utils.YiDunAntiFraudUtil; |
| ... | ... | @@ -39,7 +39,7 @@ public class AudioControllerApi { |
| 39 | 39 | @Autowired |
| 40 | 40 | AudioService audioService; |
| 41 | 41 | @Autowired |
| 42 | - YiDunServiceImpl yiDunServiceImpl; | |
| 42 | + YiDunService yiDunService; | |
| 43 | 43 | @Autowired |
| 44 | 44 | AuditPass pass; |
| 45 | 45 | |
| ... | ... | @@ -126,7 +126,7 @@ public class AudioControllerApi { |
| 126 | 126 | //2:检测中,3:检测完成,4:检测失败 |
| 127 | 127 | int asrStatus = objectAntispam.getIntValue("asrStatus"); |
| 128 | 128 | String taskId = objectAntispam.getString("taskId"); |
| 129 | - ShyYidun yiDunMsg = yiDunServiceImpl.getYiDunMsg(taskId); | |
| 129 | + ShyYidun yiDunMsg = yiDunService.getYiDunMsg(taskId); | |
| 130 | 130 | if (yiDunMsg == null) { |
| 131 | 131 | continue; |
| 132 | 132 | } |
| ... | ... | @@ -145,16 +145,16 @@ public class AudioControllerApi { |
| 145 | 145 | newshyAudio.setReceive(CommonConst.RECEIVE_AUDIT); |
| 146 | 146 | pass.audioPass(shyAudio.getAudioId(), 3, shyAudio.getAttr_tags(), "易盾点播音频审核通过了", shyAudio.getCallback()); |
| 147 | 147 | } else { |
| 148 | - String labelMsg = ""; | |
| 148 | + StringBuilder labelMsg = new StringBuilder(); | |
| 149 | 149 | if (action != 0 && asrStatus == 3) { |
| 150 | 150 | JSONArray labels = objectAntispam.getJSONArray("labels"); |
| 151 | - labelMsg = "("; | |
| 151 | + labelMsg = new StringBuilder("("); | |
| 152 | 152 | if (labels != null && labels.size() > 0) { |
| 153 | 153 | for (Object labelObj : labels) { |
| 154 | 154 | JSONObject jsonObjectone = (JSONObject) labelObj; |
| 155 | 155 | Integer label = jsonObjectone.getInteger("label"); |
| 156 | 156 | String name = TextLabels.getName(label); |
| 157 | - labelMsg = labelMsg + name; | |
| 157 | + labelMsg.append(name); | |
| 158 | 158 | |
| 159 | 159 | } |
| 160 | 160 | } |
| ... | ... | @@ -183,7 +183,7 @@ public class AudioControllerApi { |
| 183 | 183 | newshyAudio.setMsg("易盾点播音频审核其它问题需排查"); |
| 184 | 184 | newYiDunMsg.setDesc_msg("易盾点播音频审核其它问题需排查"); |
| 185 | 185 | } |
| 186 | - yiDunServiceImpl.updateYiDunMsg(newYiDunMsg); | |
| 186 | + yiDunService.updateYiDunMsg(newYiDunMsg); | |
| 187 | 187 | audioService.updateAudioMsg(newshyAudio); |
| 188 | 188 | } |
| 189 | 189 | } | ... | ... |
src/main/java/com/cnlive/shenhe/api/TopicControllerApi.java
| ... | ... | @@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject; |
| 4 | 4 | import com.cnlive.shenhe.bean.ErrorEnum; |
| 5 | 5 | import com.cnlive.shenhe.bean.ResponseBean; |
| 6 | 6 | import com.cnlive.shenhe.entity.ShyTopic; |
| 7 | -import com.cnlive.shenhe.service.serviceImpl.TopicServiceImpl; | |
| 7 | +import com.cnlive.shenhe.service.TopicService; | |
| 8 | 8 | import com.cnlive.shenhe.utils.CommonConst; |
| 9 | 9 | import com.cnlive.shenhe.utils.CommonUtils; |
| 10 | 10 | import com.cnlive.shenhe.utils.TransitServiceUtils; |
| ... | ... | @@ -27,7 +27,7 @@ public class TopicControllerApi { |
| 27 | 27 | |
| 28 | 28 | private static Logger logger = LoggerFactory.getLogger(TopicControllerApi.class); |
| 29 | 29 | @Autowired |
| 30 | - TopicServiceImpl topicService; | |
| 30 | + TopicService topicService; | |
| 31 | 31 | @Autowired |
| 32 | 32 | TransitServiceUtils transitServiceUtils; |
| 33 | 33 | |
| ... | ... | @@ -53,7 +53,7 @@ public class TopicControllerApi { |
| 53 | 53 | //判断是否存在 |
| 54 | 54 | ShyTopic shyTopic = new ShyTopic(); |
| 55 | 55 | shyTopic.setTopic_id(topicId); |
| 56 | - List<ShyTopic> topicList = topicService.findshyTopic(shyTopic); | |
| 56 | + List<ShyTopic> topicList = topicService.findShyTopic(shyTopic); | |
| 57 | 57 | //获取审核类型 |
| 58 | 58 | Integer shenheType = topicService.getShenheType(spId); |
| 59 | 59 | if (topicList.size() > 0) { |
| ... | ... | @@ -104,9 +104,9 @@ public class TopicControllerApi { |
| 104 | 104 | //最后一次更新时间 |
| 105 | 105 | shyTopic.setUpdate_date(CommonUtils.getCurrentTime()); |
| 106 | 106 | if (shyTopic.getId() == null) { |
| 107 | - return topicService.impotshyTopic(shyTopic); | |
| 107 | + return topicService.impotShyTopic(shyTopic); | |
| 108 | 108 | } else { |
| 109 | - return topicService.updateshyTopic(shyTopic); | |
| 109 | + return topicService.updateShyTopic(shyTopic); | |
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
| ... | ... | @@ -152,7 +152,7 @@ public class TopicControllerApi { |
| 152 | 152 | topic.setShenhe_type(CommonConst.AUDIT_TYPE_USER); |
| 153 | 153 | topic.setAuditor_id(null); |
| 154 | 154 | } |
| 155 | - boolean rs = topicService.updateshyTopic(topic); | |
| 155 | + boolean rs = topicService.updateShyTopic(topic); | |
| 156 | 156 | Map<String, Object> ee = new HashMap<>(16); |
| 157 | 157 | ee.put("topic_id", topicId); |
| 158 | 158 | if (rs) { | ... | ... |
src/main/java/com/cnlive/shenhe/api/YiDunControllerApi.java
| ... | ... | @@ -2,7 +2,7 @@ package com.cnlive.shenhe.api; |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | 4 | import com.cnlive.shenhe.entity.ShyYidun; |
| 5 | -import com.cnlive.shenhe.service.serviceImpl.YiDunServiceImpl; | |
| 5 | +import com.cnlive.shenhe.service.YiDunService; | |
| 6 | 6 | import com.cnlive.shenhe.utils.CommonConstStates; |
| 7 | 7 | import com.cnlive.shenhe.utils.HttpClientUtils; |
| 8 | 8 | import com.cnlive.shenhe.utils.YiDunAntiFraudUtil; |
| ... | ... | @@ -27,7 +27,7 @@ public class YiDunControllerApi { |
| 27 | 27 | private static Logger logger = LoggerFactory.getLogger(YiDunControllerApi.class); |
| 28 | 28 | |
| 29 | 29 | @Autowired |
| 30 | - YiDunServiceImpl yiDunServiceImpl; | |
| 30 | + YiDunService yiDunService; | |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * 网站地址URL产品密钥ID,产品标识 |
| ... | ... | @@ -88,7 +88,7 @@ public class YiDunControllerApi { |
| 88 | 88 | //网页 |
| 89 | 89 | shyYidun.setCheck_type(CommonConstStates.WANGYE); |
| 90 | 90 | shyYidun.setCreate_time(new Date()); |
| 91 | - yiDunServiceImpl.addYiDunMsg(shyYidun); | |
| 91 | + yiDunService.addYiDunMsg(shyYidun); | |
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | } | ... | ... |
src/main/java/com/cnlive/shenhe/controller/AudioController.java
| ... | ... | @@ -220,13 +220,13 @@ public class AudioController extends BaseController { |
| 220 | 220 | String userId = sessionUser.getUserId(); |
| 221 | 221 | ResponseBean responseBean = new ResponseBean(); |
| 222 | 222 | String[] shyAudiods = ids.split(","); |
| 223 | - String showMsg = ""; | |
| 223 | + StringBuilder showMsg = new StringBuilder(); | |
| 224 | 224 | for (String shyAudioId : shyAudiods) { |
| 225 | - showMsg = audioService.repulse(shyAudioId, msg, userId); | |
| 225 | + showMsg.append(audioService.repulse(shyAudioId, msg, userId)); | |
| 226 | 226 | } |
| 227 | - if (CommonUtils.isNotEmpty(showMsg)) { | |
| 227 | + if (CommonUtils.isNotEmpty(showMsg.toString())) { | |
| 228 | 228 | responseBean.setErrorCode(ErrorEnum.ERROR.getErrorCode()); |
| 229 | - responseBean.setErrorMessage(showMsg); | |
| 229 | + responseBean.setErrorMessage(showMsg.toString()); | |
| 230 | 230 | } |
| 231 | 231 | return responseBean; |
| 232 | 232 | } |
| ... | ... | @@ -428,9 +428,9 @@ public class AudioController extends BaseController { |
| 428 | 428 | * 审核结果更新并通知点播音频 |
| 429 | 429 | * |
| 430 | 430 | * @param activity_id 音频id(audioId) |
| 431 | - * @param state 状态码 | |
| 432 | - * @param attr_tags 常用审核意见(标签) | |
| 433 | - * @param msg 审核备注 | |
| 431 | + * @param state 状态码 | |
| 432 | + * @param attr_tags 常用审核意见(标签) | |
| 433 | + * @param msg 审核备注 | |
| 434 | 434 | * @return |
| 435 | 435 | */ |
| 436 | 436 | @PostMapping("/shenheAudio") | ... | ... |
src/main/java/com/cnlive/shenhe/controller/ChannelController.java
| ... | ... | @@ -204,10 +204,10 @@ public class ChannelController extends BaseController { |
| 204 | 204 | String userId = sessionUser.getUserId(); |
| 205 | 205 | ResponseBean responseBean = new ResponseBean(); |
| 206 | 206 | String[] channelIds = ids.split(","); |
| 207 | - String showMsg = ""; | |
| 207 | + StringBuilder showMsg = new StringBuilder(); | |
| 208 | 208 | for (String channelId : channelIds) { |
| 209 | 209 | ShyChannel channel = channelService.selectByPrimaryKey(Integer.parseInt(channelId)); |
| 210 | - JSONObject result = null; | |
| 210 | + JSONObject result; | |
| 211 | 211 | JSONObject json = new JSONObject(); |
| 212 | 212 | json.put("channel_id", channel.getChannel_id()); |
| 213 | 213 | json.put("state", 4); |
| ... | ... | @@ -217,18 +217,18 @@ public class ChannelController extends BaseController { |
| 217 | 217 | result = pass.commentPass(json, channel.getCallback()); |
| 218 | 218 | } catch (Exception e) { |
| 219 | 219 | logger.error("评论回调失败,activity_id:{}", channel.getChannel_id()); |
| 220 | - showMsg = showMsg + "," + channel.getChannel_name() + "的评论拒绝请求失败"; | |
| 220 | + showMsg.append(",").append(channel.getChannel_name()).append("的评论拒绝请求失败"); | |
| 221 | 221 | break; |
| 222 | 222 | } |
| 223 | 223 | if (result == null) { |
| 224 | 224 | logger.error("评论回调错误,且无返回信息。activity_id:{}", channel.getChannel_id()); |
| 225 | - showMsg = showMsg + "," + channel.getChannel_name() + "的评论拒绝请求失败"; | |
| 225 | + showMsg.append(",").append(channel.getChannel_name()).append("的评论拒绝请求失败"); | |
| 226 | 226 | break; |
| 227 | 227 | } else { |
| 228 | 228 | Integer code = result.getInteger("errorCode"); |
| 229 | 229 | if (code != 0) { |
| 230 | 230 | logger.error("评论回调错误,activity_id:{},errorCode:{},errorMessage:{}", channel.getChannel_id(), code, result.getString("errorMessage")); |
| 231 | - showMsg = showMsg + "," + channel.getChannel_name() + "的评论拒绝请求失败"; | |
| 231 | + showMsg.append(",").append(channel.getChannel_name()).append("的评论拒绝请求失败"); | |
| 232 | 232 | break; |
| 233 | 233 | } |
| 234 | 234 | channel.setShenhe_status(2); |
| ... | ... | @@ -237,13 +237,13 @@ public class ChannelController extends BaseController { |
| 237 | 237 | int i = channelService.updateByPrimaryKeySelective(channel); |
| 238 | 238 | if (i != 1) { |
| 239 | 239 | logger.error("评论回调失败,修改结果为0条activity_id:{}", channel.getChannel_id()); |
| 240 | - showMsg = showMsg + "," + channel.getChannel_name() + "的评论拒绝请求失败"; | |
| 240 | + showMsg.append(",").append(channel.getChannel_name()).append("的评论拒绝请求失败"); | |
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | } |
| 244 | - if (CommonUtils.isNotEmpty(showMsg)) { | |
| 244 | + if (CommonUtils.isNotEmpty(showMsg.toString())) { | |
| 245 | 245 | responseBean.setErrorCode(ErrorEnum.ERROR.getErrorCode()); |
| 246 | - responseBean.setErrorMessage(showMsg); | |
| 246 | + responseBean.setErrorMessage(showMsg.toString()); | |
| 247 | 247 | } |
| 248 | 248 | return responseBean; |
| 249 | 249 | } | ... | ... |
src/main/java/com/cnlive/shenhe/controller/CommentsController.java
| ... | ... | @@ -246,10 +246,10 @@ public class CommentsController extends BaseController { |
| 246 | 246 | String userId = sessionUser.getUserId(); |
| 247 | 247 | ResponseBean responseBean = new ResponseBean(); |
| 248 | 248 | String[] commentsIds = ids.split(","); |
| 249 | - String showMsg = ""; | |
| 249 | + StringBuilder showMsg = new StringBuilder(); | |
| 250 | 250 | for (String commentsId : commentsIds) { |
| 251 | 251 | ShyComments comments = commentsService.selectByPrimaryKey(Integer.parseInt(commentsId)); |
| 252 | - JSONObject result = null; | |
| 252 | + JSONObject result; | |
| 253 | 253 | JSONObject json = new JSONObject(); |
| 254 | 254 | json.put("activity_id", comments.getActivity_id()); |
| 255 | 255 | json.put("state", 4); |
| ... | ... | @@ -259,18 +259,18 @@ public class CommentsController extends BaseController { |
| 259 | 259 | result = pass.commentPass(json, comments.getCallback()); |
| 260 | 260 | } catch (Exception e) { |
| 261 | 261 | logger.error("评论回调失败,activity_id:{}", comments.getActivity_id()); |
| 262 | - showMsg = showMsg + "," + comments.getComment_user_name() + "的评论拒绝请求失败"; | |
| 262 | + showMsg.append(",").append(comments.getComment_user_name()).append("的评论拒绝请求失败"); | |
| 263 | 263 | break; |
| 264 | 264 | } |
| 265 | 265 | if (result == null) { |
| 266 | 266 | logger.error("评论回调错误,且无返回信息。activity_id:{}", comments.getActivity_id()); |
| 267 | - showMsg = showMsg + "," + comments.getComment_user_name() + "的评论拒绝请求失败"; | |
| 267 | + showMsg.append(",").append(comments.getComment_user_name()).append("的评论拒绝请求失败"); | |
| 268 | 268 | break; |
| 269 | 269 | } else { |
| 270 | 270 | Integer code = result.getInteger("errorCode"); |
| 271 | 271 | if (code != 0) { |
| 272 | 272 | logger.error("评论回调错误,activity_id:{},errorCode:{},errorMessage:{}", comments.getActivity_id(), code, result.getString("errorMessage")); |
| 273 | - showMsg = showMsg + "," + comments.getComment_user_name() + "的评论拒绝请求失败"; | |
| 273 | + showMsg.append(",").append(comments.getComment_user_name()).append("的评论拒绝请求失败"); | |
| 274 | 274 | break; |
| 275 | 275 | } |
| 276 | 276 | comments.setState(2); |
| ... | ... | @@ -279,13 +279,13 @@ public class CommentsController extends BaseController { |
| 279 | 279 | int i = commentsService.updateByPrimaryKeySelective(comments); |
| 280 | 280 | if (i != 1) { |
| 281 | 281 | logger.error("评论回调失败,修改结果为0条activity_id:{}", comments.getActivity_id()); |
| 282 | - showMsg = showMsg + "," + comments.getComment_user_name() + "的评论拒绝请求失败"; | |
| 282 | + showMsg.append(",").append(comments.getComment_user_name()).append("的评论拒绝请求失败"); | |
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | - if (CommonUtils.isNotEmpty(showMsg)) { | |
| 286 | + if (CommonUtils.isNotEmpty(showMsg.toString())) { | |
| 287 | 287 | responseBean.setErrorCode(ErrorEnum.ERROR.getErrorCode()); |
| 288 | - responseBean.setErrorMessage(showMsg); | |
| 288 | + responseBean.setErrorMessage(showMsg.toString()); | |
| 289 | 289 | } |
| 290 | 290 | return responseBean; |
| 291 | 291 | } | ... | ... |
src/main/java/com/cnlive/shenhe/controller/LiveApplyController.java
| ... | ... | @@ -77,7 +77,7 @@ public class LiveApplyController extends BaseController { |
| 77 | 77 | String userId = sessionUser.getUserId(); |
| 78 | 78 | ResponseBean responseBean = new ResponseBean(); |
| 79 | 79 | String[] shyLiveApplyIds = ids.split(","); |
| 80 | - String showMsg = ""; | |
| 80 | + StringBuilder showMsg = new StringBuilder(); | |
| 81 | 81 | for (String shyLiveApplyId : shyLiveApplyIds) { |
| 82 | 82 | ShyLiveapply shyLiveapply = liveApplyService.selectByPrimaryKey(Integer.parseInt(shyLiveApplyId)); |
| 83 | 83 | JSONObject result; |
| ... | ... | @@ -85,29 +85,29 @@ public class LiveApplyController extends BaseController { |
| 85 | 85 | result = pass.liveApplyPass(shyLiveapply.getActivity_id(), state + 2, msg, msg, shyLiveapply.getCallback()); |
| 86 | 86 | } catch (Exception e) { |
| 87 | 87 | logger.error("直播视频审核失败,id==" + shyLiveApplyId, e); |
| 88 | - showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " 拒绝请求失败"; | |
| 88 | + showMsg.append(",").append(shyLiveapply.getActivity_id()).append(" 拒绝请求失败"); | |
| 89 | 89 | break; |
| 90 | 90 | } |
| 91 | 91 | if (result == null) { |
| 92 | 92 | logger.error("直播视频审核失败且接口错误没有返回信息,id==" + shyLiveApplyId); |
| 93 | - showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " 拒绝请求失败"; | |
| 93 | + showMsg.append(",").append(shyLiveapply.getActivity_id()).append(" 拒绝请求失败"); | |
| 94 | 94 | break; |
| 95 | 95 | } |
| 96 | 96 | Integer code = result.getInteger("errorCode"); |
| 97 | 97 | if (code != 0) { |
| 98 | 98 | logger.error("直播视频审核失败,id:{},code:{}", shyLiveApplyId, code); |
| 99 | - showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " " + result.getString(" errorMessage"); | |
| 99 | + showMsg.append(",").append(shyLiveapply.getActivity_id()).append(" ").append(result.getString(" errorMessage")); | |
| 100 | 100 | break; |
| 101 | 101 | } |
| 102 | 102 | int i = liveApplyService.updateLiveApply(Integer.parseInt(shyLiveApplyId), userId, "", state, msg); |
| 103 | 103 | if (i == 0) { |
| 104 | - showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " 更新失败"; | |
| 104 | + showMsg.append(",").append(shyLiveapply.getActivity_id()).append(" 更新失败"); | |
| 105 | 105 | break; |
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | - if (CommonUtils.isNotEmpty(showMsg)) { | |
| 108 | + if (CommonUtils.isNotEmpty(showMsg.toString())) { | |
| 109 | 109 | responseBean.setErrorCode(ErrorEnum.ERROR.getErrorCode()); |
| 110 | - responseBean.setErrorMessage(showMsg); | |
| 110 | + responseBean.setErrorMessage(showMsg.toString()); | |
| 111 | 111 | } |
| 112 | 112 | return responseBean; |
| 113 | 113 | } |
| ... | ... | @@ -265,7 +265,7 @@ public class LiveApplyController extends BaseController { |
| 265 | 265 | String userId = sessionUser.getUserId(); |
| 266 | 266 | ResponseBean responseBean = new ResponseBean(); |
| 267 | 267 | String[] shyLiveIds = ids.split(","); |
| 268 | - String showMsg = ""; | |
| 268 | + StringBuilder showMsg = new StringBuilder(); | |
| 269 | 269 | for (String shyLiveId : shyLiveIds) { |
| 270 | 270 | ShyLiveapply shyLiveapply = liveApplyService.selectByPrimaryKey(Integer.parseInt(shyLiveId)); |
| 271 | 271 | JSONObject result; |
| ... | ... | @@ -273,29 +273,29 @@ public class LiveApplyController extends BaseController { |
| 273 | 273 | result = pass.liveApplyPass(shyLiveapply.getActivity_id(), 4, msg, msg, shyLiveapply.getCallback()); |
| 274 | 274 | } catch (Exception e) { |
| 275 | 275 | logger.error("直播视频审核失败,id==" + shyLiveId, e); |
| 276 | - showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " 拒绝请求失败"; | |
| 276 | + showMsg.append(",").append(shyLiveapply.getActivity_id()).append(" 拒绝请求失败"); | |
| 277 | 277 | break; |
| 278 | 278 | } |
| 279 | 279 | if (result == null) { |
| 280 | 280 | logger.error("直播视频审核失败且接口错误没有返回信息,id==" + shyLiveId); |
| 281 | - showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " 拒绝请求失败"; | |
| 281 | + showMsg.append(",").append(shyLiveapply.getActivity_id()).append(" 拒绝请求失败"); | |
| 282 | 282 | break; |
| 283 | 283 | } |
| 284 | 284 | Integer code = result.getInteger("errorCode"); |
| 285 | 285 | if (code != 0) { |
| 286 | 286 | logger.error("直播视频审核失败,id:{},code:{}", shyLiveId, code); |
| 287 | - showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " " + result.getString(" errorMessage"); | |
| 287 | + showMsg.append(",").append(shyLiveapply.getActivity_id()).append(" ").append(result.getString(" errorMessage")); | |
| 288 | 288 | break; |
| 289 | - } | |
| 289 | + } | |
| 290 | 290 | int i = liveService.updateLive(Integer.parseInt(shyLiveId), userId, "", 4, msg); |
| 291 | 291 | if (i == 0) { |
| 292 | - showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " 更新失败"; | |
| 292 | + showMsg.append(",").append(shyLiveapply.getActivity_id()).append(" 更新失败"); | |
| 293 | 293 | break; |
| 294 | 294 | } |
| 295 | 295 | } |
| 296 | - if (CommonUtils.isNotEmpty(showMsg)) { | |
| 296 | + if (CommonUtils.isNotEmpty(showMsg.toString())) { | |
| 297 | 297 | responseBean.setErrorCode(ErrorEnum.ERROR.getErrorCode()); |
| 298 | - responseBean.setErrorMessage(showMsg); | |
| 298 | + responseBean.setErrorMessage(showMsg.toString()); | |
| 299 | 299 | } |
| 300 | 300 | return responseBean; |
| 301 | 301 | } | ... | ... |
src/main/java/com/cnlive/shenhe/controller/LiveController.java
| ... | ... | @@ -72,9 +72,9 @@ public class LiveController extends BaseController { |
| 72 | 72 | * 审核信息返回接口 |
| 73 | 73 | * |
| 74 | 74 | * @param activity_id 视频id |
| 75 | - * @param state 状态码 | |
| 76 | - * @param attr_tags 标签 | |
| 77 | - * @param msg 备注信息 | |
| 75 | + * @param state 状态码 | |
| 76 | + * @param attr_tags 标签 | |
| 77 | + * @param msg 备注信息 | |
| 78 | 78 | * @return |
| 79 | 79 | */ |
| 80 | 80 | @PostMapping("/shenheVideo") |
| ... | ... | @@ -275,37 +275,37 @@ public class LiveController extends BaseController { |
| 275 | 275 | String userId = sessionUser.getUserId(); |
| 276 | 276 | ResponseBean responseBean = new ResponseBean(); |
| 277 | 277 | String[] shyLiveIds = ids.split(","); |
| 278 | - String showMsg = ""; | |
| 278 | + StringBuilder showMsg = new StringBuilder(); | |
| 279 | 279 | for (String shyLiveId : shyLiveIds) { |
| 280 | 280 | ShyLive shyLive = liveService.selectByPrimaryKey(Integer.parseInt(shyLiveId)); |
| 281 | - JSONObject result = null; | |
| 281 | + JSONObject result; | |
| 282 | 282 | try { |
| 283 | 283 | result = pass.livePass(shyLive.getActivity_id(), status, msg, msg, shyLive.getCallback()); |
| 284 | 284 | } catch (Exception e) { |
| 285 | 285 | logger.error("直播视频审核失败,id==" + shyLiveId, e); |
| 286 | - showMsg = showMsg + "," + shyLive.getActivity_id() + " 拒绝请求失败"; | |
| 286 | + showMsg.append(",").append(shyLive.getActivity_id()).append(" 拒绝请求失败"); | |
| 287 | 287 | break; |
| 288 | 288 | } |
| 289 | 289 | if (result == null) { |
| 290 | 290 | logger.error("直播视频审核失败且接口错误没有返回信息,id==" + shyLiveId); |
| 291 | - showMsg = showMsg + "," + shyLive.getActivity_id() + " 拒绝请求失败"; | |
| 291 | + showMsg.append(",").append(shyLive.getActivity_id()).append(" 拒绝请求失败"); | |
| 292 | 292 | break; |
| 293 | 293 | } |
| 294 | 294 | Integer code = result.getInteger("errorCode"); |
| 295 | 295 | if (code != 0) { |
| 296 | 296 | logger.error("直播视频审核失败,id:{},code:{}", shyLiveId, code); |
| 297 | - showMsg = showMsg + "," + shyLive.getActivity_id() + " " + result.getString(" errorMessage"); | |
| 297 | + showMsg.append(",").append(shyLive.getActivity_id()).append(" ").append(result.getString(" errorMessage")); | |
| 298 | 298 | break; |
| 299 | 299 | } |
| 300 | 300 | int i = liveService.updateLive(Integer.parseInt(shyLiveId), userId, "", status == 3 ? 3 : 4, msg); |
| 301 | 301 | if (i == 0) { |
| 302 | - showMsg = showMsg + "," + shyLive.getActivity_id() + " 更新失败"; | |
| 302 | + showMsg.append(",").append(shyLive.getActivity_id()).append(" 更新失败"); | |
| 303 | 303 | break; |
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | - if (CommonUtils.isNotEmpty(showMsg)) { | |
| 306 | + if (CommonUtils.isNotEmpty(showMsg.toString())) { | |
| 307 | 307 | responseBean.setErrorCode(ErrorEnum.ERROR.getErrorCode()); |
| 308 | - responseBean.setErrorMessage(showMsg); | |
| 308 | + responseBean.setErrorMessage(showMsg.toString()); | |
| 309 | 309 | } |
| 310 | 310 | return responseBean; |
| 311 | 311 | } |
| ... | ... | @@ -323,36 +323,36 @@ public class LiveController extends BaseController { |
| 323 | 323 | logger.info("同步直播云信息接口进入"); |
| 324 | 324 | ResponseBean responseBean = new ResponseBean(); |
| 325 | 325 | String[] shyLiveIds = ids.split(","); |
| 326 | - String showMsg = ""; | |
| 326 | + StringBuilder showMsg = new StringBuilder(); | |
| 327 | 327 | for (String shyLiveId : shyLiveIds) { |
| 328 | 328 | ShyLive shyLive = liveService.selectByPrimaryKey(Integer.parseInt(shyLiveId)); |
| 329 | - JSONObject result = null; | |
| 329 | + JSONObject result; | |
| 330 | 330 | try { |
| 331 | 331 | result = pass.syncLive(shyLive.getActivity_id()); |
| 332 | 332 | } catch (Exception e) { |
| 333 | 333 | logger.error("直播云信息同步失败,id==" + shyLiveId, e); |
| 334 | - showMsg = showMsg + "," + shyLive.getActivity_id() + " 拒绝请求失败"; | |
| 334 | + showMsg.append(",").append(shyLive.getActivity_id()).append(" 拒绝请求失败"); | |
| 335 | 335 | break; |
| 336 | 336 | } |
| 337 | 337 | if (result == null) { |
| 338 | 338 | logger.error("直播云信息同步失败且接口错误没有返回信息,id==" + shyLiveId); |
| 339 | - showMsg = showMsg + "," + shyLive.getActivity_id() + " 拒绝请求失败"; | |
| 339 | + showMsg.append(",").append(shyLive.getActivity_id()).append(" 拒绝请求失败"); | |
| 340 | 340 | break; |
| 341 | 341 | } |
| 342 | 342 | Integer code = result.getInteger("errorCode"); |
| 343 | 343 | if (code != 0) { |
| 344 | 344 | logger.error("直播云信息同步失败,id:{},code:{}", shyLiveId, code); |
| 345 | - showMsg = result.getString("errorMessage"); | |
| 345 | + showMsg.append(result.getString("errorMessage")); | |
| 346 | 346 | break; |
| 347 | 347 | } |
| 348 | 348 | } |
| 349 | - if (CommonUtils.isNotEmpty(showMsg)) { | |
| 349 | + if (CommonUtils.isNotEmpty(showMsg.toString())) { | |
| 350 | 350 | responseBean.setErrorCode(ErrorEnum.ERROR.getErrorCode()); |
| 351 | - responseBean.setErrorMessage(showMsg); | |
| 351 | + responseBean.setErrorMessage(showMsg.toString()); | |
| 352 | 352 | } else { |
| 353 | - showMsg = "直播云信息同步成功"; | |
| 353 | + showMsg.append("直播云信息同步成功"); | |
| 354 | 354 | responseBean.setErrorCode(ErrorEnum.SUCCESS.getErrorCode()); |
| 355 | - responseBean.setErrorMessage(showMsg); | |
| 355 | + responseBean.setErrorMessage(showMsg.toString()); | |
| 356 | 356 | } |
| 357 | 357 | return responseBean; |
| 358 | 358 | } | ... | ... |
src/main/java/com/cnlive/shenhe/controller/TopicController.java
| ... | ... | @@ -8,7 +8,7 @@ import com.cnlive.shenhe.dto.TopicDTO; |
| 8 | 8 | import com.cnlive.shenhe.entity.ShySites; |
| 9 | 9 | import com.cnlive.shenhe.entity.ShyTopic; |
| 10 | 10 | import com.cnlive.shenhe.service.SitesService; |
| 11 | -import com.cnlive.shenhe.service.serviceImpl.TopicServiceImpl; | |
| 11 | +import com.cnlive.shenhe.service.TopicService; | |
| 12 | 12 | import com.cnlive.shenhe.utils.CommonConst; |
| 13 | 13 | import com.cnlive.shenhe.utils.CommonUtils; |
| 14 | 14 | import com.github.pagehelper.PageInfo; |
| ... | ... | @@ -38,7 +38,7 @@ public class TopicController extends BaseController { |
| 38 | 38 | |
| 39 | 39 | private static Logger logger = LoggerFactory.getLogger(TopicController.class); |
| 40 | 40 | @Autowired |
| 41 | - TopicServiceImpl topicService; | |
| 41 | + TopicService topicService; | |
| 42 | 42 | @Autowired |
| 43 | 43 | SitesService sitesService; |
| 44 | 44 | |
| ... | ... | @@ -177,7 +177,7 @@ public class TopicController extends BaseController { |
| 177 | 177 | ShyTopic shyTopic = new ShyTopic(); |
| 178 | 178 | shyTopic.setShenhe_status(CommonConst.AUDIT_INTT); |
| 179 | 179 | shyTopic.setShenhe_type(CommonConst.AUDIT_TYPE_USER); |
| 180 | - List<ShyTopic> shyTopicList = topicService.findshyTopic(shyTopic); | |
| 180 | + List<ShyTopic> shyTopicList = topicService.findShyTopic(shyTopic); | |
| 181 | 181 | if (shyTopicList != null && shyTopicList.size() > 0) { |
| 182 | 182 | logger.info("您有" + shyTopicList.size() + "条新的话题审核,请注意查看!"); |
| 183 | 183 | // 第三个提示框,避免冲突 | ... | ... |
src/main/java/com/cnlive/shenhe/controller/VideosController.java
| ... | ... | @@ -553,13 +553,13 @@ public class VideosController extends BaseController { |
| 553 | 553 | String userId = sessionUser.getUserId(); |
| 554 | 554 | ResponseBean responseBean = new ResponseBean(); |
| 555 | 555 | String[] shyVideoIds = ids.split(","); |
| 556 | - String showMsg = ""; | |
| 556 | + StringBuilder showMsg = new StringBuilder(); | |
| 557 | 557 | for (String shyVideoId : shyVideoIds) { |
| 558 | - showMsg = videosService.repulse(shyVideoId, msg, userId); | |
| 558 | + showMsg.append(videosService.repulse(shyVideoId, msg, userId)); | |
| 559 | 559 | } |
| 560 | - if (CommonUtils.isNotEmpty(showMsg)) { | |
| 560 | + if (CommonUtils.isNotEmpty(showMsg.toString())) { | |
| 561 | 561 | responseBean.setErrorCode(ErrorEnum.ERROR.getErrorCode()); |
| 562 | - responseBean.setErrorMessage(showMsg); | |
| 562 | + responseBean.setErrorMessage(showMsg.toString()); | |
| 563 | 563 | } |
| 564 | 564 | return responseBean; |
| 565 | 565 | } | ... | ... |
src/main/java/com/cnlive/shenhe/job/LiveApplyJob.java
| ... | ... | @@ -100,7 +100,8 @@ public class LiveApplyJob { |
| 100 | 100 | //初始化通知状态 |
| 101 | 101 | Integer noticeState = liveApply.getEmail_notice_state(); |
| 102 | 102 | //初始化通知消息 |
| 103 | - String noticeMsg = liveApply.getEmail_notice_msg(); | |
| 103 | + //String noticeMsg = liveApply.getEmail_notice_msg(); | |
| 104 | + StringBuilder noticeMsg = new StringBuilder(liveApply.getEmail_notice_msg()); | |
| 104 | 105 | //显示spid简称 |
| 105 | 106 | ShySites shySites = sitesService.findspidDescByspid(liveApply.getSp_id()); |
| 106 | 107 | if (CommonUtils.isNotNull(shySites)) { |
| ... | ... | @@ -131,27 +132,27 @@ public class LiveApplyJob { |
| 131 | 132 | JSONObject result = JSONObject.parseObject(post.get("result")); |
| 132 | 133 | if (result == null) { |
| 133 | 134 | noticeState = CommonConst.NOTICE_FAIL; |
| 134 | - noticeMsg = noticeMsg + "\n" + dateTime + " 邮件服务器调用失败,result为空"; | |
| 135 | + noticeMsg.append("\n").append(dateTime).append(" 邮件服务器调用失败,result为空"); | |
| 135 | 136 | break; |
| 136 | 137 | } |
| 137 | 138 | Integer code = result.getInteger("errorCode"); |
| 138 | 139 | if (code != 0) { |
| 139 | 140 | noticeState = CommonConst.NOTICE_FAIL; |
| 140 | - noticeMsg = noticeMsg + "\n" + dateTime + " 邮件服务器调用失败,result返回消息为:" + result.getString("errorMessage"); | |
| 141 | + noticeMsg.append("\n").append(dateTime).append(" 邮件服务器调用失败,result返回消息为:").append(result.getString("errorMessage")); | |
| 141 | 142 | break; |
| 142 | 143 | } else { |
| 143 | 144 | noticeState = CommonConst.NOTICE_SUCCESS; |
| 144 | - noticeMsg = noticeMsg + "\n" + dateTime + " 邮件" + emailAddr + "(" + shyEmail.getRemark() + ")发送成功"; | |
| 145 | + noticeMsg.append("\n").append(dateTime).append(" 邮件").append(emailAddr).append("(").append(shyEmail.getRemark()).append(")发送成功"); | |
| 145 | 146 | } |
| 146 | 147 | } catch (Exception e) { |
| 147 | 148 | logger.info("异常结果为:{}", e.getMessage()); |
| 148 | 149 | noticeState = CommonConst.NOTICE_FAIL; |
| 149 | - noticeMsg = noticeMsg + "\n" + dateTime + " 邮件服务器调用失败,服务器报错了"; | |
| 150 | + noticeMsg.append("\n").append(dateTime).append(" 邮件服务器调用失败,服务器报错了"); | |
| 150 | 151 | break; |
| 151 | 152 | } |
| 152 | 153 | } |
| 153 | 154 | liveApply.setEmail_notice_state(noticeState); |
| 154 | - liveApply.setEmail_notice_msg(noticeMsg); | |
| 155 | + liveApply.setEmail_notice_msg(noticeMsg.toString()); | |
| 155 | 156 | liveApplyService.updateShyLiveApply(liveApply); |
| 156 | 157 | } |
| 157 | 158 | } | ... | ... |
src/main/java/com/cnlive/shenhe/job/TopicJob.java
| 1 | 1 | package com.cnlive.shenhe.job; |
| 2 | 2 | |
| 3 | 3 | import com.cnlive.shenhe.entity.ShyTopic; |
| 4 | -import com.cnlive.shenhe.service.serviceImpl.TopicServiceImpl; | |
| 4 | +import com.cnlive.shenhe.service.TopicService; | |
| 5 | 5 | import com.cnlive.shenhe.utils.CommonConst; |
| 6 | 6 | import com.cnlive.shenhe.utils.InfoUtil; |
| 7 | 7 | import org.slf4j.Logger; |
| ... | ... | @@ -22,7 +22,7 @@ public class TopicJob { |
| 22 | 22 | |
| 23 | 23 | private static Logger logger = LoggerFactory.getLogger(TopicJob.class); |
| 24 | 24 | @Autowired |
| 25 | - TopicServiceImpl topicService; | |
| 25 | + TopicService topicService; | |
| 26 | 26 | @Autowired |
| 27 | 27 | InfoUtil infoUtil; |
| 28 | 28 | @Value("${spring.localhost.url}") |
| ... | ... | @@ -33,7 +33,7 @@ public class TopicJob { |
| 33 | 33 | ShyTopic shyTopic = new ShyTopic(); |
| 34 | 34 | shyTopic.setShenhe_status(CommonConst.AUDIT_INTT); |
| 35 | 35 | shyTopic.setShenhe_type(CommonConst.AUDIT_TYPE_USER); |
| 36 | - List<ShyTopic> shyTopicList = topicService.findshyTopic(shyTopic); | |
| 36 | + List<ShyTopic> shyTopicList = topicService.findShyTopic(shyTopic); | |
| 37 | 37 | if (shyTopicList != null && shyTopicList.size() > 0) { |
| 38 | 38 | logger.info("您有" + shyTopicList.size() + "条新的话题审核,请注意查看!"); |
| 39 | 39 | // 设置Headless模式,linux系统下 | ... | ... |
src/main/java/com/cnlive/shenhe/job/YiDunUrlResultJob.java
| ... | ... | @@ -7,7 +7,7 @@ import com.cnlive.shenhe.entity.ShyYidun; |
| 7 | 7 | import com.cnlive.shenhe.enums.ImageLabels; |
| 8 | 8 | import com.cnlive.shenhe.enums.TextLabels; |
| 9 | 9 | import com.cnlive.shenhe.service.ContentService; |
| 10 | -import com.cnlive.shenhe.service.serviceImpl.YiDunServiceImpl; | |
| 10 | +import com.cnlive.shenhe.service.YiDunService; | |
| 11 | 11 | import com.cnlive.shenhe.utils.CommonConst; |
| 12 | 12 | import com.cnlive.shenhe.utils.HttpClientUtils; |
| 13 | 13 | import com.cnlive.shenhe.utils.YiDunAntiFraudUtil; |
| ... | ... | @@ -47,9 +47,9 @@ public class YiDunUrlResultJob { |
| 47 | 47 | private final static String URL_RESULT = "https://as.dun.163yun.com/v1/crawler/callback/results"; |
| 48 | 48 | |
| 49 | 49 | @Autowired |
| 50 | - YiDunServiceImpl yiDunServiceImpl; | |
| 50 | + YiDunService yiDunService; | |
| 51 | 51 | @Autowired |
| 52 | - ContentService contentServiceImpl; | |
| 52 | + ContentService contentService; | |
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | /** |
| ... | ... | @@ -88,7 +88,7 @@ public class YiDunUrlResultJob { |
| 88 | 88 | try { |
| 89 | 89 | JSONObject jsonObject = resultJsonArray.getJSONObject(i); |
| 90 | 90 | String dataId = jsonObject.getString("dataId"); |
| 91 | - ShyYidun yiDunMsg = yiDunServiceImpl.getYiDunMsg(dataId); | |
| 91 | + ShyYidun yiDunMsg = yiDunService.getYiDunMsg(dataId); | |
| 92 | 92 | if (yiDunMsg == null) { |
| 93 | 93 | continue; |
| 94 | 94 | } |
| ... | ... | @@ -105,7 +105,7 @@ public class YiDunUrlResultJob { |
| 105 | 105 | newYiDunMsg.setDesc_msg(desc.toString()); |
| 106 | 106 | newYiDunMsg.setCheck_status(0); |
| 107 | 107 | //修改图文状态 |
| 108 | - contentServiceImpl.callback(String.valueOf(shyContent.getId()), desc.toString(), CommonConst.AUDIT_SUCCESS, "", shyContent.getUpdater()); | |
| 108 | + contentService.callback(String.valueOf(shyContent.getId()), desc.toString(), CommonConst.AUDIT_SUCCESS, "", shyContent.getUpdater()); | |
| 109 | 109 | logger.info("审核云结果回调业务对接方:dataId={}", dataId); |
| 110 | 110 | } else { |
| 111 | 111 | JSONObject evidences = jsonObject.getJSONObject("evidences"); |
| ... | ... | @@ -178,7 +178,7 @@ public class YiDunUrlResultJob { |
| 178 | 178 | newYiDunMsg.setDesc_msg(desc.toString()); |
| 179 | 179 | newYiDunMsg.setCheck_status(2); |
| 180 | 180 | //修改图文状态 |
| 181 | - contentServiceImpl.callback(String.valueOf(shyContent.getId()), desc.toString(), CommonConst.AUDIT_REFUSE, "", shyContent.getUpdater()); | |
| 181 | + contentService.callback(String.valueOf(shyContent.getId()), desc.toString(), CommonConst.AUDIT_REFUSE, "", shyContent.getUpdater()); | |
| 182 | 182 | } |
| 183 | 183 | } catch (NumberFormatException e) { |
| 184 | 184 | e.printStackTrace(); |
| ... | ... | @@ -190,9 +190,9 @@ public class YiDunUrlResultJob { |
| 190 | 190 | //拒绝原因 |
| 191 | 191 | shyContent.setShenhe_msg("易盾网站识别其它问题需排查"); |
| 192 | 192 | newYiDunMsg.setDesc_msg("易盾网站识别其它问题需排查"); |
| 193 | - contentServiceImpl.updateShyContent(shyContent); | |
| 193 | + contentService.updateShyContent(shyContent); | |
| 194 | 194 | } |
| 195 | - yiDunServiceImpl.updateYiDunMsg(newYiDunMsg); | |
| 195 | + yiDunService.updateYiDunMsg(newYiDunMsg); | |
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | } | ... | ... |
src/main/java/com/cnlive/shenhe/service/TopicService.java
0 → 100644
| 1 | +package com.cnlive.shenhe.service; | |
| 2 | + | |
| 3 | +import com.cnlive.shenhe.dto.TopicDTO; | |
| 4 | +import com.cnlive.shenhe.entity.ShyTopic; | |
| 5 | +import com.github.pagehelper.PageInfo; | |
| 6 | + | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * @Author: yan-zhao-wang | |
| 11 | + * @DateTime: 2022-11-09 9:47 | |
| 12 | + */ | |
| 13 | +public interface TopicService { | |
| 14 | + /** | |
| 15 | + * 获取话题实体对象 | |
| 16 | + * | |
| 17 | + * @param shyTopic | |
| 18 | + * @return | |
| 19 | + */ | |
| 20 | + ShyTopic getShyTopic(ShyTopic shyTopic); | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 根据条件获取话题列表集合 | |
| 24 | + * | |
| 25 | + * @param shyTopic | |
| 26 | + * @return | |
| 27 | + */ | |
| 28 | + List<ShyTopic> findShyTopic(ShyTopic shyTopic); | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 修改话题 返回布尔类型 | |
| 32 | + * | |
| 33 | + * @param shyTopic | |
| 34 | + * @return | |
| 35 | + */ | |
| 36 | + boolean updateShyTopic(ShyTopic shyTopic); | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 导入话题 返回布尔类型 | |
| 40 | + * | |
| 41 | + * @param shyTopic | |
| 42 | + * @return | |
| 43 | + */ | |
| 44 | + boolean impotShyTopic(ShyTopic shyTopic); | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 分页、条件查询列表 | |
| 48 | + * | |
| 49 | + * @param topicDTO | |
| 50 | + * @return | |
| 51 | + */ | |
| 52 | + PageInfo<ShyTopic> getPage(TopicDTO topicDTO); | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 话题回调 | |
| 56 | + * | |
| 57 | + * @param id | |
| 58 | + * @param msg | |
| 59 | + * @param state | |
| 60 | + * @param userId | |
| 61 | + * @param updater | |
| 62 | + * @return | |
| 63 | + */ | |
| 64 | + boolean callback(String id, String msg, Integer state, String userId, String updater); | |
| 65 | + | |
| 66 | + /** | |
| 67 | + * 根据主键id查询话题对象 | |
| 68 | + * | |
| 69 | + * @param id | |
| 70 | + * @return | |
| 71 | + */ | |
| 72 | + ShyTopic selectByPrimaryKey(Integer id); | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * 根据主键修改话题对象 | |
| 76 | + * | |
| 77 | + * @param topic | |
| 78 | + * @return | |
| 79 | + */ | |
| 80 | + int updateByPrimaryKeySelective(ShyTopic topic); | |
| 81 | + | |
| 82 | + /** | |
| 83 | + * 获得审核类型 | |
| 84 | + * | |
| 85 | + * @param spId | |
| 86 | + */ | |
| 87 | + Integer getShenheType(Integer spId); | |
| 88 | +} | ... | ... |
src/main/java/com/cnlive/shenhe/service/YiDunService.java
0 → 100644
| 1 | +package com.cnlive.shenhe.service; | |
| 2 | + | |
| 3 | +import com.cnlive.shenhe.entity.ShyYidun; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * @Author: yan-zhao-wang | |
| 7 | + * @DateTime: 2022-11-09 9:48 | |
| 8 | + */ | |
| 9 | +public interface YiDunService { | |
| 10 | + /** | |
| 11 | + * 添加易盾记录 | |
| 12 | + * | |
| 13 | + * @param shyYidun | |
| 14 | + * @return | |
| 15 | + */ | |
| 16 | + boolean addYiDunMsg(ShyYidun shyYidun); | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 根据主键id查询易盾对象 | |
| 20 | + * | |
| 21 | + * @param dataId | |
| 22 | + * @return | |
| 23 | + */ | |
| 24 | + ShyYidun getYiDunMsg(String dataId); | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 根据主键修改易盾对象 返回布尔类型 | |
| 28 | + * | |
| 29 | + * @param shyYidun | |
| 30 | + * @return | |
| 31 | + */ | |
| 32 | + boolean updateYiDunMsg(ShyYidun shyYidun); | |
| 33 | +} | ... | ... |
src/main/java/com/cnlive/shenhe/service/serviceImpl/AudioServiceImpl.java
| ... | ... | @@ -11,6 +11,7 @@ import com.cnlive.shenhe.mapper.ShyAudioMapper; |
| 11 | 11 | import com.cnlive.shenhe.mapper.ShyUsersMapper; |
| 12 | 12 | import com.cnlive.shenhe.service.AudioService; |
| 13 | 13 | import com.cnlive.shenhe.service.SitesService; |
| 14 | +import com.cnlive.shenhe.service.YiDunService; | |
| 14 | 15 | import com.cnlive.shenhe.utils.*; |
| 15 | 16 | import com.github.pagehelper.PageHelper; |
| 16 | 17 | import com.github.pagehelper.PageInfo; |
| ... | ... | @@ -49,7 +50,7 @@ public class AudioServiceImpl implements AudioService { |
| 49 | 50 | @Autowired |
| 50 | 51 | SitesService sitesService; |
| 51 | 52 | @Autowired |
| 52 | - YiDunServiceImpl yiDunServiceImpl; | |
| 53 | + YiDunService yiDunService; | |
| 53 | 54 | @Value("${yiDun_audio_callback}") |
| 54 | 55 | String yiDun_audio_callback; |
| 55 | 56 | |
| ... | ... | @@ -208,34 +209,34 @@ public class AudioServiceImpl implements AudioService { |
| 208 | 209 | |
| 209 | 210 | @Override |
| 210 | 211 | public String repulse(String shyAudioId, String msg, String userId) { |
| 211 | - String showMsg = ""; | |
| 212 | + StringBuilder showMsg = new StringBuilder(); | |
| 212 | 213 | ShyAudio shyAudio = audioService.selectByPrimaryKey(Integer.parseInt(shyAudioId)); |
| 213 | 214 | JSONObject result; |
| 214 | 215 | try { |
| 215 | 216 | result = pass.audioPass(shyAudio.getAudioId(), 4, msg, msg, shyAudio.getCallback()); |
| 216 | 217 | } catch (Exception e) { |
| 217 | 218 | logger.error("音频审核失败,id==" + shyAudioId, e); |
| 218 | - showMsg = showMsg + "," + shyAudio.getAudioTitle() + " 拒绝请求失败"; | |
| 219 | - return showMsg; | |
| 219 | + showMsg.append(",").append(shyAudio.getAudioTitle()).append(" 拒绝请求失败"); | |
| 220 | + return showMsg.toString(); | |
| 220 | 221 | } |
| 221 | 222 | if (result == null) { |
| 222 | 223 | logger.error("音频审核失败且接口错误没有返回信息,id==" + shyAudioId); |
| 223 | - showMsg = showMsg + "," + shyAudio.getAudioTitle() + " 拒绝请求失败"; | |
| 224 | - return showMsg; | |
| 224 | + showMsg.append(",").append(shyAudio.getAudioTitle()).append(" 拒绝请求失败"); | |
| 225 | + return showMsg.toString(); | |
| 225 | 226 | } |
| 226 | 227 | Integer code = result.getInteger("code"); |
| 227 | 228 | if (code != 0) { |
| 228 | 229 | logger.error("音频审核失败,id:{},code:{}", shyAudioId, code); |
| 229 | - showMsg = showMsg + "," + shyAudio.getAudioTitle() + " " + result.getString("msg"); | |
| 230 | - return showMsg; | |
| 230 | + showMsg.append(",").append(shyAudio.getAudioTitle()).append(" ").append(result.getString("msg")); | |
| 231 | + return showMsg.toString(); | |
| 231 | 232 | } |
| 232 | 233 | //0.未审核,1:已审核,2.拒绝 |
| 233 | 234 | int i = audioService.updateAudio(Integer.parseInt(shyAudioId), userId, null, "", 2, msg); |
| 234 | 235 | if (i == 0) { |
| 235 | - showMsg = showMsg + "," + shyAudio.getAudioTitle() + " 更新失败"; | |
| 236 | - return showMsg; | |
| 236 | + showMsg.append(",").append(shyAudio.getAudioTitle()).append(" 更新失败"); | |
| 237 | + return showMsg.toString(); | |
| 237 | 238 | } |
| 238 | - return showMsg; | |
| 239 | + return showMsg.toString(); | |
| 239 | 240 | } |
| 240 | 241 | |
| 241 | 242 | /** |
| ... | ... | @@ -431,7 +432,7 @@ public class AudioServiceImpl implements AudioService { |
| 431 | 432 | shyYidun.setTask_id(taskId); |
| 432 | 433 | shyYidun.setData_id(dataId); |
| 433 | 434 | shyYidun.setCheck_type(CommonConstStates.DIANBOYINPIN); |
| 434 | - yiDunServiceImpl.addYiDunMsg(shyYidun); | |
| 435 | + yiDunService.addYiDunMsg(shyYidun); | |
| 435 | 436 | } |
| 436 | 437 | } |
| 437 | 438 | } | ... | ... |
src/main/java/com/cnlive/shenhe/service/serviceImpl/ContentServiceImpl.java
| ... | ... | @@ -8,6 +8,7 @@ import com.cnlive.shenhe.mapper.ShyContentMapper; |
| 8 | 8 | import com.cnlive.shenhe.mapper.ShyUsersMapper; |
| 9 | 9 | import com.cnlive.shenhe.service.ContentService; |
| 10 | 10 | import com.cnlive.shenhe.service.SitesService; |
| 11 | +import com.cnlive.shenhe.service.YiDunService; | |
| 11 | 12 | import com.cnlive.shenhe.utils.*; |
| 12 | 13 | import com.github.pagehelper.PageHelper; |
| 13 | 14 | import com.github.pagehelper.PageInfo; |
| ... | ... | @@ -42,7 +43,7 @@ public class ContentServiceImpl implements ContentService { |
| 42 | 43 | @Autowired |
| 43 | 44 | VideosServiceImpl videosService; |
| 44 | 45 | @Autowired |
| 45 | - YiDunServiceImpl yiDunServiceImpl; | |
| 46 | + YiDunService yiDunService; | |
| 46 | 47 | |
| 47 | 48 | |
| 48 | 49 | /** |
| ... | ... | @@ -465,7 +466,7 @@ public class ContentServiceImpl implements ContentService { |
| 465 | 466 | shyYidun.setContent_id(shyContent.getId().toString()); |
| 466 | 467 | shyYidun.setCreate_time(new Date()); |
| 467 | 468 | logger.info("审核云保存到ShyYidun表里数据:{}", JSON.toJSONString(shyYidun)); |
| 468 | - yiDunServiceImpl.addYiDunMsg(shyYidun); | |
| 469 | + yiDunService.addYiDunMsg(shyYidun); | |
| 469 | 470 | } |
| 470 | 471 | } catch (Exception e) { |
| 471 | 472 | e.printStackTrace(); | ... | ... |
src/main/java/com/cnlive/shenhe/service/serviceImpl/TopicServiceImpl.java
| ... | ... | @@ -6,6 +6,7 @@ import com.cnlive.shenhe.dto.TopicDTO; |
| 6 | 6 | import com.cnlive.shenhe.entity.ShyTopic; |
| 7 | 7 | import com.cnlive.shenhe.mapper.ShyTopicMapper; |
| 8 | 8 | import com.cnlive.shenhe.service.SitesService; |
| 9 | +import com.cnlive.shenhe.service.TopicService; | |
| 9 | 10 | import com.cnlive.shenhe.utils.CommonConst; |
| 10 | 11 | import com.cnlive.shenhe.utils.CommonUtils; |
| 11 | 12 | import com.cnlive.shenhe.utils.TransitServiceUtils; |
| ... | ... | @@ -26,7 +27,7 @@ import java.util.List; |
| 26 | 27 | * @Description: |
| 27 | 28 | */ |
| 28 | 29 | @Service |
| 29 | -public class TopicServiceImpl { | |
| 30 | +public class TopicServiceImpl implements TopicService { | |
| 30 | 31 | |
| 31 | 32 | private static Logger logger = LoggerFactory.getLogger(TopicServiceImpl.class); |
| 32 | 33 | @Autowired |
| ... | ... | @@ -36,6 +37,13 @@ public class TopicServiceImpl { |
| 36 | 37 | @Autowired |
| 37 | 38 | SitesService sitesService; |
| 38 | 39 | |
| 40 | + /** | |
| 41 | + * 获取话题实体对象 | |
| 42 | + * | |
| 43 | + * @param shyTopic | |
| 44 | + * @return | |
| 45 | + */ | |
| 46 | + @Override | |
| 39 | 47 | public ShyTopic getShyTopic(ShyTopic shyTopic) { |
| 40 | 48 | List<ShyTopic> shyTopicList = shyTopicMapper.select(shyTopic); |
| 41 | 49 | if (CommonUtils.isNotNull(shyTopicList) && shyTopicList.size() > 0) { |
| ... | ... | @@ -50,7 +58,8 @@ public class TopicServiceImpl { |
| 50 | 58 | * @param shyTopic |
| 51 | 59 | * @return |
| 52 | 60 | */ |
| 53 | - public List<ShyTopic> findshyTopic(ShyTopic shyTopic) { | |
| 61 | + @Override | |
| 62 | + public List<ShyTopic> findShyTopic(ShyTopic shyTopic) { | |
| 54 | 63 | return shyTopicMapper.selectByRowBounds(shyTopic, new RowBounds(0, 100)); |
| 55 | 64 | } |
| 56 | 65 | |
| ... | ... | @@ -60,7 +69,8 @@ public class TopicServiceImpl { |
| 60 | 69 | * @param shyTopic |
| 61 | 70 | * @return |
| 62 | 71 | */ |
| 63 | - public boolean updateshyTopic(ShyTopic shyTopic) { | |
| 72 | + @Override | |
| 73 | + public boolean updateShyTopic(ShyTopic shyTopic) { | |
| 64 | 74 | int result = shyTopicMapper.updateByPrimaryKey(shyTopic); |
| 65 | 75 | return result != 0; |
| 66 | 76 | } |
| ... | ... | @@ -71,7 +81,8 @@ public class TopicServiceImpl { |
| 71 | 81 | * @param shyTopic |
| 72 | 82 | * @return |
| 73 | 83 | */ |
| 74 | - public boolean impotshyTopic(ShyTopic shyTopic) { | |
| 84 | + @Override | |
| 85 | + public boolean impotShyTopic(ShyTopic shyTopic) { | |
| 75 | 86 | int result = shyTopicMapper.insertSelective(shyTopic); |
| 76 | 87 | return result != 0; |
| 77 | 88 | } |
| ... | ... | @@ -82,6 +93,7 @@ public class TopicServiceImpl { |
| 82 | 93 | * @param topicDTO |
| 83 | 94 | * @return |
| 84 | 95 | */ |
| 96 | + @Override | |
| 85 | 97 | public PageInfo<ShyTopic> getPage(TopicDTO topicDTO) { |
| 86 | 98 | logger.info("接受参数列表为,TopicDTO:{}", JSON.toJSONString(topicDTO)); |
| 87 | 99 | Example example = new Example(ShyTopic.class); |
| ... | ... | @@ -139,6 +151,7 @@ public class TopicServiceImpl { |
| 139 | 151 | * @param updater |
| 140 | 152 | * @return |
| 141 | 153 | */ |
| 154 | + @Override | |
| 142 | 155 | public boolean callback(String id, String msg, Integer state, String userId, String updater) { |
| 143 | 156 | boolean success; |
| 144 | 157 | ShyTopic topic = shyTopicMapper.selectByPrimaryKey(Integer.parseInt(id)); |
| ... | ... | @@ -178,6 +191,7 @@ public class TopicServiceImpl { |
| 178 | 191 | * @param id |
| 179 | 192 | * @return |
| 180 | 193 | */ |
| 194 | + @Override | |
| 181 | 195 | public ShyTopic selectByPrimaryKey(Integer id) { |
| 182 | 196 | return shyTopicMapper.selectByPrimaryKey(id); |
| 183 | 197 | } |
| ... | ... | @@ -188,6 +202,7 @@ public class TopicServiceImpl { |
| 188 | 202 | * @param topic |
| 189 | 203 | * @return |
| 190 | 204 | */ |
| 205 | + @Override | |
| 191 | 206 | public int updateByPrimaryKeySelective(ShyTopic topic) { |
| 192 | 207 | return shyTopicMapper.updateByPrimaryKeySelective(topic); |
| 193 | 208 | } |
| ... | ... | @@ -197,6 +212,7 @@ public class TopicServiceImpl { |
| 197 | 212 | * |
| 198 | 213 | * @param spId |
| 199 | 214 | */ |
| 215 | + @Override | |
| 200 | 216 | public Integer getShenheType(Integer spId) { |
| 201 | 217 | //获取图文免审sp |
| 202 | 218 | List<Integer> sites = sitesService.getBusinessList(CommonConst.BUSINESS_TOPIC); | ... | ... |
src/main/java/com/cnlive/shenhe/service/serviceImpl/VideosServiceImpl.java
| ... | ... | @@ -15,6 +15,7 @@ import com.cnlive.shenhe.mapper.ShyVideosMapper; |
| 15 | 15 | import com.cnlive.shenhe.service.ShyActivityService; |
| 16 | 16 | import com.cnlive.shenhe.service.SitesService; |
| 17 | 17 | import com.cnlive.shenhe.service.UsersfreeService; |
| 18 | +import com.cnlive.shenhe.service.YiDunService; | |
| 18 | 19 | import com.cnlive.shenhe.utils.*; |
| 19 | 20 | import com.github.pagehelper.PageHelper; |
| 20 | 21 | import com.github.pagehelper.PageInfo; |
| ... | ... | @@ -52,7 +53,7 @@ public class VideosServiceImpl { |
| 52 | 53 | @Autowired |
| 53 | 54 | private UsersfreeService usersfreeService; |
| 54 | 55 | @Autowired |
| 55 | - private YiDunServiceImpl yiDunServiceImpl; | |
| 56 | + private YiDunService yiDunService; | |
| 56 | 57 | @Autowired |
| 57 | 58 | private ShyActivityService shyActivityService; |
| 58 | 59 | @Value("${qn_domain}") |
| ... | ... | @@ -422,7 +423,7 @@ public class VideosServiceImpl { |
| 422 | 423 | shyYidun.setCheck_type(CommonConstStates.TUPIAN); |
| 423 | 424 | shyYidun.setDuration(shyVideos.getDuration()); |
| 424 | 425 | shyYidun.setCreate_time(new Date()); |
| 425 | - yiDunServiceImpl.addYiDunMsg(shyYidun); | |
| 426 | + yiDunService.addYiDunMsg(shyYidun); | |
| 426 | 427 | } catch (Exception e) { |
| 427 | 428 | e.printStackTrace(); |
| 428 | 429 | } |
| ... | ... | @@ -536,33 +537,33 @@ public class VideosServiceImpl { |
| 536 | 537 | * @return |
| 537 | 538 | */ |
| 538 | 539 | public String repulse(String shyVideoId, String msg, String userId) { |
| 539 | - String showMsg = ""; | |
| 540 | + StringBuilder showMsg = new StringBuilder(); | |
| 540 | 541 | ShyVideos shyVideos = videosService.selectByPrimaryKey(Integer.parseInt(shyVideoId)); |
| 541 | 542 | JSONObject result; |
| 542 | 543 | try { |
| 543 | 544 | result = pass.auditPass(shyVideos.getVideo_id(), 4, msg, msg, shyVideos.getCallback()); |
| 544 | 545 | } catch (Exception e) { |
| 545 | 546 | logger.error("视频审核失败,id==" + shyVideoId, e); |
| 546 | - showMsg = showMsg + "," + shyVideos.getVideo_title() + " 拒绝请求失败"; | |
| 547 | - return showMsg; | |
| 547 | + showMsg.append(",").append(shyVideos.getVideo_title()).append(" 拒绝请求失败"); | |
| 548 | + return showMsg.toString(); | |
| 548 | 549 | } |
| 549 | 550 | if (result == null) { |
| 550 | 551 | logger.error("视频审核失败且接口错误没有返回信息,id==" + shyVideoId); |
| 551 | - showMsg = showMsg + "," + shyVideos.getVideo_title() + " 拒绝请求失败"; | |
| 552 | - return showMsg; | |
| 552 | + showMsg.append(",").append(shyVideos.getVideo_title()).append(" 拒绝请求失败"); | |
| 553 | + return showMsg.toString(); | |
| 553 | 554 | } |
| 554 | 555 | Integer code = result.getInteger("code"); |
| 555 | 556 | if (code != 0) { |
| 556 | 557 | logger.error("视频审核失败,id:{},code:{}", shyVideoId, code); |
| 557 | - showMsg = showMsg + "," + shyVideos.getVideo_title() + " " + result.getString("msg"); | |
| 558 | - return showMsg; | |
| 558 | + showMsg.append(",").append(shyVideos.getVideo_title()).append(" ").append(result.getString("msg")); | |
| 559 | + return showMsg.toString(); | |
| 559 | 560 | } |
| 560 | 561 | int i = videosService.updateVideo(Integer.parseInt(shyVideoId), userId, null, "", 2, msg); |
| 561 | 562 | if (i == 0) { |
| 562 | - showMsg = showMsg + "," + shyVideos.getVideo_title() + " 更新失败"; | |
| 563 | - return showMsg; | |
| 563 | + showMsg.append(",").append(shyVideos.getVideo_title()).append(" 更新失败"); | |
| 564 | + return showMsg.toString(); | |
| 564 | 565 | } |
| 565 | - return showMsg; | |
| 566 | + return showMsg.toString(); | |
| 566 | 567 | } |
| 567 | 568 | |
| 568 | 569 | } | ... | ... |
src/main/java/com/cnlive/shenhe/service/serviceImpl/YiDunServiceImpl.java
| ... | ... | @@ -3,6 +3,7 @@ package com.cnlive.shenhe.service.serviceImpl; |
| 3 | 3 | import com.alibaba.fastjson.JSON; |
| 4 | 4 | import com.cnlive.shenhe.entity.ShyYidun; |
| 5 | 5 | import com.cnlive.shenhe.mapper.ShyYidunMapper; |
| 6 | +import com.cnlive.shenhe.service.YiDunService; | |
| 6 | 7 | import org.slf4j.Logger; |
| 7 | 8 | import org.slf4j.LoggerFactory; |
| 8 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -13,7 +14,7 @@ import org.springframework.stereotype.Service; |
| 13 | 14 | * @Date: 2020/3/27 17:31 |
| 14 | 15 | */ |
| 15 | 16 | @Service |
| 16 | -public class YiDunServiceImpl { | |
| 17 | +public class YiDunServiceImpl implements YiDunService { | |
| 17 | 18 | |
| 18 | 19 | private static Logger logger = LoggerFactory.getLogger(YiDunServiceImpl.class); |
| 19 | 20 | |
| ... | ... | @@ -26,13 +27,11 @@ public class YiDunServiceImpl { |
| 26 | 27 | * @param shyYidun |
| 27 | 28 | * @return |
| 28 | 29 | */ |
| 30 | + @Override | |
| 29 | 31 | public boolean addYiDunMsg(ShyYidun shyYidun) { |
| 30 | 32 | logger.info("URL:{}", JSON.toJSONString(shyYidun.getUrl())); |
| 31 | 33 | int result = shyYidunMapper.insert(shyYidun); |
| 32 | - if (result == 0) { | |
| 33 | - return false; | |
| 34 | - } | |
| 35 | - return true; | |
| 34 | + return result != 0; | |
| 36 | 35 | } |
| 37 | 36 | |
| 38 | 37 | /** |
| ... | ... | @@ -41,6 +40,7 @@ public class YiDunServiceImpl { |
| 41 | 40 | * @param dataId |
| 42 | 41 | * @return |
| 43 | 42 | */ |
| 43 | + @Override | |
| 44 | 44 | public ShyYidun getYiDunMsg(String dataId) { |
| 45 | 45 | return shyYidunMapper.selectByPrimaryKey(dataId); |
| 46 | 46 | } |
| ... | ... | @@ -51,11 +51,9 @@ public class YiDunServiceImpl { |
| 51 | 51 | * @param shyYidun |
| 52 | 52 | * @return |
| 53 | 53 | */ |
| 54 | + @Override | |
| 54 | 55 | public boolean updateYiDunMsg(ShyYidun shyYidun) { |
| 55 | 56 | int result = shyYidunMapper.updateByPrimaryKeySelective(shyYidun); |
| 56 | - if (result == 0) { | |
| 57 | - return false; | |
| 58 | - } | |
| 59 | - return true; | |
| 57 | + return result != 0; | |
| 60 | 58 | } |
| 61 | 59 | } | ... | ... |