Commit 80c53134bf659f24f136b17bc34a52966d17d39e
1 parent
366586e6
优化代码中的数字替换成常量
Showing
7 changed files
with
52 additions
and
60 deletions
src/main/java/com/cnlive/shenhe/job/AudioJob.java
| 1 | 1 | package com.cnlive.shenhe.job; |
| 2 | 2 | |
| 3 | 3 | import com.cnlive.shenhe.entity.ShyAudio; |
| 4 | -import com.cnlive.shenhe.entity.ShyYidun; | |
| 5 | 4 | import com.cnlive.shenhe.serviceImpl.AudioServiceImpl; |
| 6 | 5 | import com.cnlive.shenhe.serviceImpl.YiDunServiceImpl; |
| 7 | 6 | import com.cnlive.shenhe.utils.CommonConst; |
| ... | ... | @@ -43,7 +42,7 @@ public class AudioJob { |
| 43 | 42 | logger.info("当前白名单通过的AudioId:" + audio.getAudioId()); |
| 44 | 43 | shyAudio.setUploader("白名单"); |
| 45 | 44 | // 更新点播音频和审核的音频状态 |
| 46 | - audioService.updateAudioAndShenhe(audio, 3); | |
| 45 | + audioService.updateAudioAndShenhe(audio, CommonConst.AUDIT_SUCCESS); | |
| 47 | 46 | } |
| 48 | 47 | } |
| 49 | 48 | } |
| ... | ... | @@ -63,15 +62,8 @@ public class AudioJob { |
| 63 | 62 | List<ShyAudio> shyAudioList = audioService.findshyAudio(shyAudio); |
| 64 | 63 | if (shyAudioList != null && shyAudioList.size() > 0) { |
| 65 | 64 | for (ShyAudio audio : shyAudioList) { |
| 66 | -// ShyYidun shyYidun = new ShyYidun(); | |
| 67 | -// shyYidun.setContent_id(audio.getId().toString()); | |
| 68 | -// //点播视频 | |
| 69 | -// shyYidun.setCheck_type(4); | |
| 70 | -// ShyYidun shyYidun1 = yiDunServiceImpl.getidunMsgByContentId(shyYidun); | |
| 71 | -// if (shyYidun1 == null) { | |
| 72 | 65 | logger.info("定时向易盾发送点播音频检测视频的audioId:" + audio.getAudioId()); |
| 73 | 66 | audioService.audioFilter(audio); |
| 74 | -// } | |
| 75 | 67 | } |
| 76 | 68 | } |
| 77 | 69 | } | ... | ... |
src/main/java/com/cnlive/shenhe/job/ContentJob.java
| ... | ... | @@ -40,7 +40,7 @@ public class ContentJob { |
| 40 | 40 | logger.info("当前白名单通过的content_id:" + content.getId()); |
| 41 | 41 | content.setUpdater("白名单"); |
| 42 | 42 | // 更新点播和审核的视频状态 |
| 43 | - contentService.callback(content.getId() + "", "白名单审核通过", 1, "", "白名单"); | |
| 43 | + contentService.callback(content.getId() + "", "白名单审核通过", CommonConst.AUDIT_SUCCESS, "", "白名单"); | |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | } |
| ... | ... | @@ -56,16 +56,7 @@ public class ContentJob { |
| 56 | 56 | if (shyContentList != null && shyContentList.size() > 0) { |
| 57 | 57 | logger.info("审核云提交网页审核到易盾数据个数:{}", shyContentList.size()); |
| 58 | 58 | for (ShyContent content : shyContentList) { |
| 59 | - //易盾网站过滤 | |
| 60 | -// ShyYidun shyYidun = new ShyYidun(); | |
| 61 | -// shyYidun.setContent_id(content.getId().toString()); | |
| 62 | -// //网页类型 | |
| 63 | -// shyYidun.setCheck_type(3); | |
| 64 | -// ShyYidun shyYidun1 = yiDunServiceImpl.getidunMsgByContentId(shyYidun); | |
| 65 | -// logger.info("审核云ShyYidun表里不为空提交网页审核到易盾单条数据:{}", JSON.toJSONString(content)); | |
| 66 | -// if (shyYidun1 == null) { | |
| 67 | 59 | contentService.contentFilter(content); |
| 68 | -// } | |
| 69 | 60 | } |
| 70 | 61 | } |
| 71 | 62 | } | ... | ... |
src/main/java/com/cnlive/shenhe/job/VideosJob.java
| ... | ... | @@ -28,6 +28,7 @@ public class VideosJob { |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * 白名单sp视频通过 |
| 31 | + * 免审、未审核 | |
| 31 | 32 | */ |
| 32 | 33 | @Scheduled(fixedRate = 60 * 1000) |
| 33 | 34 | public void updateVideos() { |
| ... | ... | @@ -42,13 +43,14 @@ public class VideosJob { |
| 42 | 43 | logger.info("当前白名单通过的videos_id:" + video.getId()); |
| 43 | 44 | video.setUpdater("白名单"); |
| 44 | 45 | // 更新点播和审核的视频状态 |
| 45 | - videosService.updateDianboAndShenhe(video, 3); | |
| 46 | + videosService.updateDianboAndShenhe(video, CommonConst.AUDIT_SUCCESS); | |
| 46 | 47 | } |
| 47 | 48 | } |
| 48 | 49 | } |
| 49 | 50 | |
| 50 | 51 | /** |
| 51 | 52 | * 定时向易盾发送视频抽帧图片进行检测 |
| 53 | + * 机审 、未审核 、抽帧完成 进行送审 | |
| 52 | 54 | * 每天10点到23点执行,每分钟一次 |
| 53 | 55 | */ |
| 54 | 56 | @Scheduled(cron = "0 0/1 10-23 * * ? ") |
| ... | ... | @@ -65,16 +67,8 @@ public class VideosJob { |
| 65 | 67 | for (ShyVideos video : shyVideosList) { |
| 66 | 68 | logger.info("定时向易盾发送检测视频的videos_id:{}", video.getId()); |
| 67 | 69 | //易盾图片过滤 |
| 68 | -// ShyYidun shyYidun = new ShyYidun(); | |
| 69 | -// //点播视频 | |
| 70 | -// shyYidun.setContent_id(video.getId().toString()); | |
| 71 | -// //图片类型 | |
| 72 | -// shyYidun.setCheck_type(2); | |
| 73 | -// ShyYidun shyYidun1 = yiDunServiceImpl.getidunMsgByContentId(shyYidun); | |
| 74 | -// if (shyYidun1 == null) { | |
| 75 | 70 | logger.info("审核云定时向易盾发送视频抽帧图片检测:{}", video.getVideo_id()); |
| 76 | 71 | videosService.videoFilter(video.getId()); |
| 77 | -// } | |
| 78 | 72 | } |
| 79 | 73 | } |
| 80 | 74 | } | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/AudioServiceImpl.java
| ... | ... | @@ -7,10 +7,7 @@ import com.cnlive.shenhe.dto.AudioDTO; |
| 7 | 7 | import com.cnlive.shenhe.entity.*; |
| 8 | 8 | import com.cnlive.shenhe.mapper.ShyAudioMapper; |
| 9 | 9 | import com.cnlive.shenhe.mapper.ShyUsersMapper; |
| 10 | -import com.cnlive.shenhe.utils.AuditPass; | |
| 11 | -import com.cnlive.shenhe.utils.CommonConst; | |
| 12 | -import com.cnlive.shenhe.utils.CommonUtils; | |
| 13 | -import com.cnlive.shenhe.utils.YiDunAntiFraudUtil; | |
| 10 | +import com.cnlive.shenhe.utils.*; | |
| 14 | 11 | import com.github.pagehelper.PageHelper; |
| 15 | 12 | import com.github.pagehelper.PageInfo; |
| 16 | 13 | import org.apache.ibatis.session.RowBounds; |
| ... | ... | @@ -74,13 +71,19 @@ public class AudioServiceImpl { |
| 74 | 71 | return shyAudiolist; |
| 75 | 72 | } |
| 76 | 73 | |
| 74 | + /** | |
| 75 | + * 更新音频和审核状态 | |
| 76 | + * @param shyAudio | |
| 77 | + * @param audioState 视频状态,1通过,2不通过 | |
| 78 | + * @return | |
| 79 | + */ | |
| 77 | 80 | public int updateAudioAndShenhe(ShyAudio shyAudio, int audioState) { |
| 78 | 81 | //修改点播云音频状态 |
| 79 | 82 | JSONObject result = Pass.audioPass(shyAudio.getAudioId(), audioState, shyAudio.getAttr_tags(), shyAudio.getMsg(), shyAudio.getCallback()); |
| 80 | 83 | Integer code = result.getInteger("code"); |
| 81 | 84 | Integer shenheState = CommonConst.AUDIT_REFUSE; |
| 82 | 85 | if (0 == code) { |
| 83 | - if (audioState == 3) { | |
| 86 | + if (audioState == CommonConst.AUDIT_SUCCESS) { | |
| 84 | 87 | shenheState = CommonConst.AUDIT_SUCCESS; |
| 85 | 88 | } |
| 86 | 89 | //修改审核云的音频状态 |
| ... | ... | @@ -350,9 +353,10 @@ public class AudioServiceImpl { |
| 350 | 353 | |
| 351 | 354 | /** |
| 352 | 355 | * 易盾点播音频过滤 |
| 353 | - * | |
| 356 | + * 音频送审时 给了回调地址 | |
| 357 | + * 送审类型:1:文本 2:图片 3.网页 4:点播音频 | |
| 354 | 358 | * @param shyAudio |
| 355 | - * @return 1:文本 2:图片 3.网页 4:点播音频 | |
| 359 | + * @return | |
| 356 | 360 | */ |
| 357 | 361 | public void audioFilter(ShyAudio shyAudio) { |
| 358 | 362 | //调用易盾点播音频检测接口 |
| ... | ... | @@ -368,7 +372,7 @@ public class AudioServiceImpl { |
| 368 | 372 | shyYidun.setCreate_time(new Date()); |
| 369 | 373 | shyYidun.setTask_id(taskId); |
| 370 | 374 | shyYidun.setData_id(dataId); |
| 371 | - shyYidun.setCheck_type(4); | |
| 375 | + shyYidun.setCheck_type(CommonConstStates.DIANBOYINPIN); | |
| 372 | 376 | yiDunServiceImpl.addYiDunMsg(shyYidun); |
| 373 | 377 | } |
| 374 | 378 | } | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/ContentServiceImpl.java
| ... | ... | @@ -7,10 +7,7 @@ import com.cnlive.shenhe.entity.*; |
| 7 | 7 | import com.cnlive.shenhe.mapper.ShyCommentsMapper; |
| 8 | 8 | import com.cnlive.shenhe.mapper.ShyContentMapper; |
| 9 | 9 | import com.cnlive.shenhe.mapper.ShyUsersMapper; |
| 10 | -import com.cnlive.shenhe.utils.AuditPass; | |
| 11 | -import com.cnlive.shenhe.utils.CommonConst; | |
| 12 | -import com.cnlive.shenhe.utils.CommonUtils; | |
| 13 | -import com.cnlive.shenhe.utils.YiDunAntiFraudUtil; | |
| 10 | +import com.cnlive.shenhe.utils.*; | |
| 14 | 11 | import com.github.pagehelper.PageHelper; |
| 15 | 12 | import com.github.pagehelper.PageInfo; |
| 16 | 13 | import org.apache.ibatis.session.RowBounds; |
| ... | ... | @@ -384,9 +381,9 @@ public class ContentServiceImpl { |
| 384 | 381 | |
| 385 | 382 | /** |
| 386 | 383 | * 易盾网站过滤 |
| 387 | - * | |
| 384 | + * 送审类型:1:文本 2:图片 3.网页 4:点播音频 | |
| 388 | 385 | * @param shyContent |
| 389 | - * @return 1:文本 2:图片 3.网页 4:点播音频 | |
| 386 | + * @return | |
| 390 | 387 | */ |
| 391 | 388 | public void contentFilter(ShyContent shyContent) { |
| 392 | 389 | try { |
| ... | ... | @@ -403,7 +400,7 @@ public class ContentServiceImpl { |
| 403 | 400 | shyYidun.setUrl(contentUrl); |
| 404 | 401 | shyYidun.setTask_id(taskId); |
| 405 | 402 | shyYidun.setData_id(dataId); |
| 406 | - shyYidun.setCheck_type(3); | |
| 403 | + shyYidun.setCheck_type(CommonConstStates.WANGYE); | |
| 407 | 404 | shyYidun.setContent_id(shyContent.getId().toString()); |
| 408 | 405 | shyYidun.setCreate_time(new Date()); |
| 409 | 406 | logger.info("审核云保存到ShyYidun表里数据:{}", JSON.toJSONString(shyYidun)); | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
| ... | ... | @@ -12,10 +12,7 @@ import com.cnlive.shenhe.entity.ShyVideos; |
| 12 | 12 | import com.cnlive.shenhe.entity.ShyYidun; |
| 13 | 13 | import com.cnlive.shenhe.mapper.ShyUsersMapper; |
| 14 | 14 | import com.cnlive.shenhe.mapper.ShyVideosMapper; |
| 15 | -import com.cnlive.shenhe.utils.AuditPass; | |
| 16 | -import com.cnlive.shenhe.utils.CommonConst; | |
| 17 | -import com.cnlive.shenhe.utils.CommonUtils; | |
| 18 | -import com.cnlive.shenhe.utils.YiDunAntiFraudUtil; | |
| 15 | +import com.cnlive.shenhe.utils.*; | |
| 19 | 16 | import com.github.pagehelper.PageHelper; |
| 20 | 17 | import com.github.pagehelper.PageInfo; |
| 21 | 18 | import org.apache.ibatis.session.RowBounds; |
| ... | ... | @@ -28,7 +25,10 @@ import org.springframework.util.StringUtils; |
| 28 | 25 | import tk.mybatis.mapper.entity.Example; |
| 29 | 26 | |
| 30 | 27 | import java.text.ParseException; |
| 31 | -import java.util.*; | |
| 28 | +import java.util.Arrays; | |
| 29 | +import java.util.Date; | |
| 30 | +import java.util.List; | |
| 31 | +import java.util.UUID; | |
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * @Auther: chenhao |
| ... | ... | @@ -332,9 +332,9 @@ public class VideosServiceImpl { |
| 332 | 332 | |
| 333 | 333 | /** |
| 334 | 334 | * 易盾视频(图片)过滤 |
| 335 | - * | |
| 335 | + * type:1:文本 2:图片 3.网页 4:点播音频 | |
| 336 | 336 | * @param cid 审核云中视频的id |
| 337 | - * @return 1:文本 2:图片 3.网页 4:点播音频 | |
| 337 | + * @return | |
| 338 | 338 | */ |
| 339 | 339 | public int videoFilter(Integer cid) { |
| 340 | 340 | ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(cid); |
| ... | ... | @@ -384,7 +384,7 @@ public class VideosServiceImpl { |
| 384 | 384 | shyYidun.setUrl(url); |
| 385 | 385 | shyYidun.setDesc_msg(desc); |
| 386 | 386 | //校验图片类型 |
| 387 | - shyYidun.setCheck_type(2); | |
| 387 | + shyYidun.setCheck_type(CommonConstStates.TUPIAN); | |
| 388 | 388 | shyYidun.setDuration(shyVideos.getDuration()); |
| 389 | 389 | shyYidun.setCreate_time(new Date()); |
| 390 | 390 | |
| ... | ... | @@ -400,7 +400,7 @@ public class VideosServiceImpl { |
| 400 | 400 | * 更新点播和审核的视频状态 |
| 401 | 401 | * |
| 402 | 402 | * @param video |
| 403 | - * @param dianboState 视频状态,3通过,4不通过 | |
| 403 | + * @param dianboState 视频状态,1通过,2不通过 | |
| 404 | 404 | * @return |
| 405 | 405 | */ |
| 406 | 406 | public int updateDianboAndShenhe(ShyVideos video, int dianboState) { |
| ... | ... | @@ -413,7 +413,7 @@ public class VideosServiceImpl { |
| 413 | 413 | String callback = video.getCallback(); |
| 414 | 414 | if (callback.contains("bc.cnlive.com")) { |
| 415 | 415 | if ("0".equals(errorCode)) { |
| 416 | - if (dianboState == 3) { | |
| 416 | + if (dianboState == CommonConst.AUDIT_SUCCESS) { | |
| 417 | 417 | shenheState = CommonConst.AUDIT_SUCCESS; |
| 418 | 418 | } |
| 419 | 419 | //修改审核云的视频状态 |
| ... | ... | @@ -429,7 +429,7 @@ public class VideosServiceImpl { |
| 429 | 429 | } |
| 430 | 430 | } else { |
| 431 | 431 | if (0 == code) { |
| 432 | - if (dianboState == 3) { | |
| 432 | + if (dianboState == CommonConst.AUDIT_SUCCESS) { | |
| 433 | 433 | shenheState = CommonConst.AUDIT_SUCCESS; |
| 434 | 434 | } |
| 435 | 435 | //修改审核云的视频状态 | ... | ... |
src/main/java/com/cnlive/shenhe/utils/CommonConstStates.java
| ... | ... | @@ -46,8 +46,6 @@ public class CommonConstStates { |
| 46 | 46 | */ |
| 47 | 47 | public static Integer QUANBU = 0; |
| 48 | 48 | |
| 49 | - | |
| 50 | - //是否显示 0:不显示 1:显示 | |
| 51 | 49 | /** |
| 52 | 50 | * 是否显示 0:不显示 1:显示 |
| 53 | 51 | */ |
| ... | ... | @@ -57,8 +55,6 @@ public class CommonConstStates { |
| 57 | 55 | */ |
| 58 | 56 | public static Integer SHIFOU_XIANSHIYES = 1; |
| 59 | 57 | |
| 60 | - | |
| 61 | - //商务模式:0免费 1收费 | |
| 62 | 58 | /** |
| 63 | 59 | * 商务模式:0免费 1收费 |
| 64 | 60 | */ |
| ... | ... | @@ -68,8 +64,6 @@ public class CommonConstStates { |
| 68 | 64 | */ |
| 69 | 65 | public static Integer SHOUFEI = 1; |
| 70 | 66 | |
| 71 | - //0表示正常 1表示下线 | |
| 72 | - | |
| 73 | 67 | /** |
| 74 | 68 | * 0表示正常 1表示下线 |
| 75 | 69 | */ |
| ... | ... | @@ -78,4 +72,24 @@ public class CommonConstStates { |
| 78 | 72 | * 0表示正常 1表示下线 |
| 79 | 73 | */ |
| 80 | 74 | public static Integer XIAXIAN = 1; |
| 75 | + | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * 1:文本 2:图片 3.网页 4:点播音频 | |
| 79 | + */ | |
| 80 | + public static Integer DIANBOYINPIN = 4; | |
| 81 | + /** | |
| 82 | + * 1:文本 2:图片 3.网页 4:点播音频 | |
| 83 | + */ | |
| 84 | + public static Integer WANGYE = 3; | |
| 85 | + /** | |
| 86 | + * 1:文本 2:图片 3.网页 4:点播音频 | |
| 87 | + */ | |
| 88 | + public static Integer TUPIAN = 2; | |
| 89 | + /** | |
| 90 | + * 1:文本 2:图片 3.网页 4:点播音频 | |
| 91 | + */ | |
| 92 | + public static Integer WENBEN = 1; | |
| 93 | + | |
| 94 | + | |
| 81 | 95 | } | ... | ... |