Commit c2ffa0ebd8f617ccb58b8cd3e839936deed8e9c4
1 parent
4b97da2a
音频审核增加免审功能update
Showing
2 changed files
with
76 additions
and
4 deletions
src/main/java/com/cnlive/shenhe/job/AudioJob.java
0 → 100644
| 1 | +package com.cnlive.shenhe.job; | |
| 2 | + | |
| 3 | +import com.cnlive.shenhe.entity.ShyAudio; | |
| 4 | +import com.cnlive.shenhe.entity.ShyVideos; | |
| 5 | +import com.cnlive.shenhe.serviceImpl.AudioServiceImpl; | |
| 6 | +import com.cnlive.shenhe.utils.CommonConst; | |
| 7 | +import org.slf4j.Logger; | |
| 8 | +import org.slf4j.LoggerFactory; | |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | +import org.springframework.scheduling.annotation.Scheduled; | |
| 11 | +import org.springframework.stereotype.Component; | |
| 12 | + | |
| 13 | +import java.util.List; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * @Author: xujincheng | |
| 17 | + * @Date: 2020/6/18 13:06 | |
| 18 | + */ | |
| 19 | +@Component | |
| 20 | +public class AudioJob { | |
| 21 | + | |
| 22 | + private static Logger logger = LoggerFactory.getLogger(AudioJob.class); | |
| 23 | + | |
| 24 | + @Autowired | |
| 25 | + AudioServiceImpl audioService; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 白名单sp音频通过 | |
| 29 | + */ | |
| 30 | + @Scheduled(fixedRate = 60 * 1000) | |
| 31 | + public void updateVideos() { | |
| 32 | + ShyAudio shyAudio = new ShyAudio(); | |
| 33 | + // 审核类型为免审 | |
| 34 | + shyAudio.setShenhe_type(CommonConst.AUDIT_TYPE_FREE); | |
| 35 | + // 审核状态为未审核 | |
| 36 | + shyAudio.setState(CommonConst.AUDIT_INTT); | |
| 37 | + List<ShyAudio> shyAudioList = audioService.findshyAudio(shyAudio); | |
| 38 | + if (shyAudioList != null && shyAudioList.size() > 0) { | |
| 39 | + for (ShyAudio audio : shyAudioList) { | |
| 40 | + logger.info("当前白名单通过的AudioId:" + audio.getAudioId()); | |
| 41 | + shyAudio.setUploader("白名单"); | |
| 42 | + // 更新点播音频和审核的音频状态 | |
| 43 | + audioService.updateAudioAndShenhe(audio, 3); | |
| 44 | + } | |
| 45 | + } | |
| 46 | + } | |
| 47 | +} | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/AudioServiceImpl.java
| ... | ... | @@ -5,7 +5,6 @@ import com.cnlive.shenhe.bean.ErrorEnum; |
| 5 | 5 | import com.cnlive.shenhe.bean.ResponseBean; |
| 6 | 6 | import com.cnlive.shenhe.entity.ShyAudio; |
| 7 | 7 | import com.cnlive.shenhe.entity.ShyUsers; |
| 8 | -import com.cnlive.shenhe.entity.ShyUsersfree; | |
| 9 | 8 | import com.cnlive.shenhe.entity.ShyVideos; |
| 10 | 9 | import com.cnlive.shenhe.mapper.ShyAudioMapper; |
| 11 | 10 | import com.cnlive.shenhe.mapper.ShyUsersMapper; |
| ... | ... | @@ -20,9 +19,6 @@ import org.slf4j.LoggerFactory; |
| 20 | 19 | import org.springframework.beans.factory.annotation.Autowired; |
| 21 | 20 | import org.springframework.stereotype.Service; |
| 22 | 21 | import tk.mybatis.mapper.entity.Example; |
| 23 | - | |
| 24 | -import java.sql.Timestamp; | |
| 25 | -import java.text.ParseException; | |
| 26 | 22 | import java.util.List; |
| 27 | 23 | |
| 28 | 24 | /** |
| ... | ... | @@ -66,6 +62,35 @@ public class AudioServiceImpl { |
| 66 | 62 | return shyAudio; |
| 67 | 63 | } |
| 68 | 64 | |
| 65 | + public List<ShyAudio> findshyAudio(ShyAudio shyAudio) { | |
| 66 | + List<ShyAudio> shyAudiolist = shyAudioMapper.selectByRowBounds(shyAudio, new RowBounds(0, 100)); | |
| 67 | + return shyAudiolist; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public int updateAudioAndShenhe(ShyAudio shyAudio, int audioState) { | |
| 71 | + //修改点播云音频状态 | |
| 72 | + JSONObject result = Pass.audioPass(shyAudio.getAudioId(), audioState, shyAudio.getAttr_tags(), shyAudio.getMsg(), shyAudio.getCallback()); | |
| 73 | + Integer code = result.getInteger("code"); | |
| 74 | + Integer shenheState=CommonConst.AUDIT_REFUSE; | |
| 75 | + if (0 == code) { | |
| 76 | + if(audioState==3){ | |
| 77 | + shenheState=CommonConst.AUDIT_SUCCESS; | |
| 78 | + } | |
| 79 | + //修改审核云的音频状态 | |
| 80 | + int i = audioService.updateAudio(shyAudio.getId(), null,shyAudio.getUploader(),"", shenheState, shyAudio.getMsg()); | |
| 81 | + if (i != 1) { | |
| 82 | + logger.error("点播音频更改失败,AudioId:{}", shyAudio.getAudioId()); | |
| 83 | + } | |
| 84 | + return i; | |
| 85 | + } else { | |
| 86 | + shyAudio.setMsg("点播音频回调失败,"+shyAudio.getMsg()); | |
| 87 | + audioService.updateAudio(shyAudio.getId(), null,shyAudio.getUploader(),"", CommonConst.AUDIT_CALLBACK_FAIL, shyAudio.getMsg()); | |
| 88 | + logger.error("点播音频回调失败,activity_id:{},code:{},msg:{}", shyAudio.getAudioId(), code, result.getString("msg")); | |
| 89 | + } | |
| 90 | + | |
| 91 | + return 0; | |
| 92 | + } | |
| 93 | + | |
| 69 | 94 | //认领 |
| 70 | 95 | public Integer receive(String ids, Integer num, String userId, Integer spid) { |
| 71 | 96 | Integer n = 0; | ... | ... |