Commit abf850675e362c91a836ef0b8faa138cdda9f5e3

Authored by 郑超
1 parent c3927772

网页内容送审易盾审核

src/main/java/com/cnlive/shenhe/api/AudioControllerApi.java
... ... @@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONObject;
5 5 import com.cnlive.shenhe.bean.ErrorEnum;
6 6 import com.cnlive.shenhe.bean.ResponseBean;
7 7 import com.cnlive.shenhe.entity.ShyAudio;
8   -import com.cnlive.shenhe.entity.ShyContent;
9 8 import com.cnlive.shenhe.entity.ShyYidun;
10 9 import com.cnlive.shenhe.enums.TextLabels;
11 10 import com.cnlive.shenhe.serviceImpl.AudioServiceImpl;
... ... @@ -14,20 +13,15 @@ import com.cnlive.shenhe.utils.AuditPass;
14 13 import com.cnlive.shenhe.utils.CommonConst;
15 14 import com.cnlive.shenhe.utils.YiDunAntiFraudUtil;
16 15 import com.google.common.collect.EvictingQueue;
17   -import com.google.common.collect.Maps;
18   -import org.apache.commons.lang3.StringUtils;
19 16 import org.slf4j.Logger;
20 17 import org.slf4j.LoggerFactory;
21 18 import org.springframework.beans.factory.annotation.Autowired;
22 19 import org.springframework.stereotype.Controller;
23 20 import org.springframework.web.bind.annotation.PostMapping;
24   -import org.springframework.web.bind.annotation.RequestBody;
25 21 import org.springframework.web.bind.annotation.RequestMapping;
26 22 import org.springframework.web.bind.annotation.ResponseBody;
27 23  
28 24 import java.util.Date;
29   -import java.util.HashMap;
30   -import java.util.Map;
31 25  
32 26 /**
33 27 * @Author: xujincheng
... ... @@ -143,6 +137,7 @@ public class AudioControllerApi {
143 137 newshyAudio.setId(shyAudio.getId());
144 138 if (action == 0 && asrStatus == 3) {
145 139 newYiDunMsg.setDesc_msg("易盾点播音频审核通过了");
  140 + newYiDunMsg.setCheck_status(0);
146 141 newshyAudio.setMsg("易盾点播音频审核通过了");
147 142 newshyAudio.setUploader("机审通过");
148 143 newshyAudio.setState(1);
... ... @@ -176,6 +171,8 @@ public class AudioControllerApi {
176 171 newshyAudio.setState(0);
177 172 newshyAudio.setShenhe_type(CommonConst.AUDIT_TYPE_USER);
178 173 newshyAudio.setReceive(CommonConst.RECEIVE_BEFORE);
  174 + //审核失败
  175 + newYiDunMsg.setCheck_status(2);
179 176 }
180 177 newYiDunMsg.setResult_type(String.valueOf(action));
181 178 } catch (NumberFormatException e) {
... ...
src/main/java/com/cnlive/shenhe/api/ContentControllerApi.java
... ... @@ -101,7 +101,7 @@ public class ContentControllerApi {
101 101 return new ResponseBean(ErrorEnum.ERROR);
102 102 }
103 103 }
104   - return saveContent(json, shyContent, shenheType, newContentTag);
  104 + return saveContent(json, shyContent, shenheType);
105 105 }
106 106  
107 107 /**
... ... @@ -112,7 +112,7 @@ public class ContentControllerApi {
112 112 * @param shenheType
113 113 * @return
114 114 */
115   - private ResponseBean saveContent(JSONObject json, ShyContent shyContent, Integer shenheType, String contentTag) {
  115 + private ResponseBean saveContent(JSONObject json, ShyContent shyContent, Integer shenheType) {
116 116 //如果不存在直接插入
117 117 //标题
118 118 shyContent.setTitle(json.getString("title"));
... ... @@ -135,7 +135,8 @@ public class ContentControllerApi {
135 135 shyContent.setContent_time(timestamp);
136 136  
137 137 }
138   - shyContent.setContent_tag(contentTag);
  138 + String contentTag = json.getString("content_tag");
  139 + shyContent.setContent_tag(StringUtils.isEmpty(contentTag) ? "content" : contentTag);
139 140  
140 141 shyContent.setCreate_date(CommonUtils.getCurrentTime());
141 142 //回调地址
... ...
src/main/java/com/cnlive/shenhe/api/YiDunControllerApi.java
... ... @@ -72,7 +72,6 @@ public class YiDunControllerApi {
72 72 params.put("signature", signature);
73 73  
74 74 // 4.发送HTTP请求
75   - //String response = HttpClient4Utils.sendPost(httpClient, API_URL, params, Consts.UTF_8);
76 75 String s = HttpClientUtils.post_str(URL_SUBMIT, params);
77 76 logger.info("向易盾提交网站检测地址返回的结果:{}", s);
78 77 JSONObject jsonObject = JSONObject.parseObject(s);
... ... @@ -81,8 +80,13 @@ public class YiDunControllerApi {
81 80 if (code == 200 && "ok".equals(msg)) {
82 81 JSONObject result = jsonObject.getJSONObject("result");
83 82 String dataId = result.getString("dataId");
  83 + String taskId = result.getString("taskId");
84 84 ShyYidun shyYidun = new ShyYidun();
85 85 shyYidun.setId(dataId);
  86 + shyYidun.setTask_id(taskId);
  87 + shyYidun.setData_id(dataId);
  88 + //网页
  89 + shyYidun.setCheck_type(3);
86 90 shyYidun.setCreate_time(new Date());
87 91 yiDunServiceImpl.addYiDunMsg(shyYidun);
88 92 }
... ...
src/main/java/com/cnlive/shenhe/entity/ShyYidun.java
1 1 package com.cnlive.shenhe.entity;
2 2  
  3 +import javax.persistence.Id;
  4 +import javax.persistence.Table;
3 5 import java.util.Date;
4   -import javax.persistence.*;
5 6  
6 7 @Table(name = "shy_yidun")
7 8 public class ShyYidun {
... ... @@ -191,17 +192,59 @@ public class ShyYidun {
191 192 this.update_time = update_time;
192 193 }
193 194  
194   - public ShyYidun() {
  195 + private String task_id;
  196 + private String data_id;
  197 + private Integer check_type;
  198 + private Integer check_status;
  199 +
  200 + public String getTask_id() {
  201 + return task_id;
195 202 }
196 203  
197   - public ShyYidun(String id, String content_id, String url, String result_type, String desc_msg, Integer duration, Date create_time, Date update_time) {
198   - this.id = id;
199   - this.content_id = content_id;
200   - this.url = url;
201   - this.result_type = result_type;
202   - this.desc_msg = desc_msg;
203   - this.duration = duration;
204   - this.create_time = create_time;
205   - this.update_time = update_time;
  204 + public void setTask_id(String task_id) {
  205 + this.task_id = task_id;
  206 + }
  207 +
  208 + public Integer getCheck_type() {
  209 + return check_type;
  210 + }
  211 +
  212 + public void setCheck_type(Integer check_type) {
  213 + this.check_type = check_type;
206 214 }
  215 +
  216 + public Integer getCheck_status() {
  217 + return check_status;
  218 + }
  219 +
  220 + public void setCheck_status(Integer check_status) {
  221 + this.check_status = check_status;
  222 + }
  223 +
  224 + public String getData_id() {
  225 + return data_id;
  226 + }
  227 +
  228 + public void setData_id(String data_id) {
  229 + this.data_id = data_id;
  230 + }
  231 +
  232 +
  233 + public ShyYidun() {
  234 + }
  235 +
  236 +// public ShyYidun(String id, String content_id, String url, String result_type, String desc_msg, Integer duration, Date create_time, Date update_time
  237 +// , Integer check_type, String task_id) {
  238 +// this.id = id;
  239 +// this.content_id = content_id;
  240 +// this.url = url;
  241 +// this.result_type = result_type;
  242 +// this.desc_msg = desc_msg;
  243 +// this.duration = duration;
  244 +// this.create_time = create_time;
  245 +// this.update_time = update_time;
  246 +// this.check_type = check_type;
  247 +// this.task_id = task_id;
  248 +// }
  249 +
207 250 }
208 251 \ No newline at end of file
... ...
src/main/java/com/cnlive/shenhe/job/AudioJob.java
... ... @@ -63,13 +63,15 @@ public class AudioJob {
63 63 List<ShyAudio> shyAudioList = audioService.findshyAudio(shyAudio);
64 64 if (shyAudioList != null && shyAudioList.size() > 0) {
65 65 for (ShyAudio audio : shyAudioList) {
66   - ShyYidun shyYidun = new ShyYidun();
67   - shyYidun.setContent_id(audio.getId().toString());
68   - ShyYidun shyYidun1 = yiDunServiceImpl.getidunMsgByContentId(shyYidun);
69   - if (shyYidun1 == null) {
70   - logger.info("定时向易盾发送点播音频检测视频的audioId:" + audio.getAudioId());
71   - audioService.audioFilter(audio);
72   - }
  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 + logger.info("定时向易盾发送点播音频检测视频的audioId:" + audio.getAudioId());
  73 + audioService.audioFilter(audio);
  74 +// }
73 75 }
74 76 }
75 77 }
... ...
src/main/java/com/cnlive/shenhe/job/ContentJob.java
1 1 package com.cnlive.shenhe.job;
2 2  
3 3 import com.cnlive.shenhe.entity.ShyContent;
4   -import com.cnlive.shenhe.entity.ShyYidun;
5 4 import com.cnlive.shenhe.serviceImpl.ContentServiceImpl;
6 5 import com.cnlive.shenhe.serviceImpl.YiDunServiceImpl;
7 6 import com.cnlive.shenhe.utils.CommonConst;
... ... @@ -23,9 +22,6 @@ public class ContentJob {
23 22 private static Logger logger = LoggerFactory.getLogger(ContentJob.class);
24 23 @Autowired
25 24 ContentServiceImpl contentService;
26   - @Autowired
27   - YiDunServiceImpl yiDunServiceImpl;
28   -
29 25  
30 26 /**
31 27 * 白名单sp图文通过
... ... @@ -52,25 +48,23 @@ public class ContentJob {
52 48 * 定时向易盾提交网站地址
53 49 * //每分钟一次
54 50 */
55   - @Scheduled(cron = "0 0/1 * * * ? ")
  51 + @Scheduled(cron = "0 0/5 * * * ? ")
56 52 public void videofilter() {
57   - logger.info("提交网页审核到易盾...........");
58   - ShyContent shyContent = new ShyContent();
59   - //机审
60   - shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_MACHANE);
61   - //待审
62   - shyContent.setReceive_status(CommonConst.RECEIVE_BEFORE);
63   -
64   - List<ShyContent> shyContentList = contentService.findshyContent(shyContent);
  53 + logger.info("审核云提交网页审核到易盾...........");
  54 + List<ShyContent> shyContentList = contentService.findShyContentWithWebPage();
65 55 if (shyContentList != null && shyContentList.size() > 0) {
  56 + logger.info("审核云提交网页审核到易盾数据个数:{}", shyContentList.size());
66 57 for (ShyContent content : shyContentList) {
67 58 //易盾网站过滤
68   - ShyYidun shyYidun = new ShyYidun();
69   - shyYidun.setContent_id(content.getId().toString());
70   - ShyYidun shyYidun1 = yiDunServiceImpl.getidunMsgByContentId(shyYidun);
71   - if (shyYidun1 == null) {
72   - contentService.contentFilter(content);
73   - }
  59 +// ShyYidun shyYidun = new ShyYidun();
  60 +// shyYidun.setContent_id(content.getId().toString());
  61 +// //网页类型
  62 +// shyYidun.setCheck_type(3);
  63 +// ShyYidun shyYidun1 = yiDunServiceImpl.getidunMsgByContentId(shyYidun);
  64 +// logger.info("审核云ShyYidun表里不为空提交网页审核到易盾单条数据:{}", JSON.toJSONString(content));
  65 +// if (shyYidun1 == null) {
  66 + contentService.contentFilter(content);
  67 +// }
74 68 }
75 69 }
76 70 }
... ...
src/main/java/com/cnlive/shenhe/job/VideosJob.java
1 1 package com.cnlive.shenhe.job;
2 2  
3 3 import com.cnlive.shenhe.entity.ShyVideos;
  4 +import com.cnlive.shenhe.entity.ShyYidun;
4 5 import com.cnlive.shenhe.serviceImpl.VideosServiceImpl;
  6 +import com.cnlive.shenhe.serviceImpl.YiDunServiceImpl;
5 7 import com.cnlive.shenhe.utils.CommonConst;
6 8 import org.slf4j.Logger;
7 9 import org.slf4j.LoggerFactory;
... ... @@ -17,6 +19,9 @@ public class VideosJob {
17 19 @Autowired
18 20 VideosServiceImpl videosService;
19 21  
  22 + @Autowired
  23 + YiDunServiceImpl yiDunServiceImpl;
  24 +
20 25 /**
21 26 * 白名单sp视频通过
22 27 */
... ... @@ -37,21 +42,32 @@ public class VideosJob {
37 42 }
38 43  
39 44 /**
40   - * 定时向易盾发送视频进行检测
  45 + * 定时向易盾发送视频抽帧图片进行检测
41 46 */
42 47 @Scheduled(cron = "0 0/1 10-23 * * ? ")//每天10点到23点执行,每分钟一次
43 48 public void videofilter() {
44 49 ShyVideos shyVideos = new ShyVideos();
45   - shyVideos.setShenhe_type(CommonConst.AUDIT_TYPE_MACHANE);//审核类型为机审
46   - shyVideos.setState(CommonConst.AUDIT_INTT);//待审核状态
47   - shyVideos.setAvsample(CommonConst.AVSAMPLE_SUCCESS);//抽帧完成
  50 + //审核类型为机审
  51 + shyVideos.setShenhe_type(CommonConst.AUDIT_TYPE_MACHANE);
  52 + //待审核状态
  53 + shyVideos.setState(CommonConst.AUDIT_INTT);
  54 + //抽帧完成
  55 + shyVideos.setAvsample(CommonConst.AVSAMPLE_SUCCESS);
48 56 List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos);
49 57 if (shyVideosList != null && shyVideosList.size() > 0) {
50 58 for (ShyVideos video : shyVideosList) {
51   - logger.info("定时向易盾发送检测视频的videos_id:" + video.getId());
  59 + logger.info("定时向易盾发送检测视频的videos_id:{}", video.getId());
52 60 //易盾图片过滤
  61 +// ShyYidun shyYidun = new ShyYidun();
  62 +// //点播视频
  63 +// shyYidun.setContent_id(video.getId().toString());
  64 +// //图片类型
  65 +// shyYidun.setCheck_type(2);
  66 +// ShyYidun shyYidun1 = yiDunServiceImpl.getidunMsgByContentId(shyYidun);
  67 +// if (shyYidun1 == null) {
  68 + logger.info("审核云定时向易盾发送视频抽帧图片检测:{}", video.getVideo_id());
53 69 videosService.videoFilter(video.getId());
54   -
  70 +// }
55 71 }
56 72 }
57 73 }
... ... @@ -64,13 +80,16 @@ public class VideosJob {
64 80 public void autoRetReceive() {
65 81 logger.info("点播自动退领的进入.....");
66 82 ShyVideos shyVideos = new ShyVideos();
67   - shyVideos.setState(CommonConst.AUDIT_INTT);//审核状态:未审核
68   - shyVideos.setReceive(CommonConst.RECEIVE_AFTER);//已领取
  83 + //审核状态:未审核
  84 + shyVideos.setState(CommonConst.AUDIT_INTT);
  85 + //已领取
  86 + shyVideos.setReceive(CommonConst.RECEIVE_AFTER);
69 87 List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos);
70 88 if (shyVideosList.size() > 0) {
71 89 for (ShyVideos shyVideos2 : shyVideosList) {
72 90 logger.info("自动退领的videos_id:" + shyVideos2.getId());
73   - shyVideos2.setReceive(CommonConst.RECEIVE_BEFORE);//未领取
  91 + //未领取
  92 + shyVideos2.setReceive(CommonConst.RECEIVE_BEFORE);
74 93 shyVideos2.setReceive_user_id(null);
75 94 videosService.updateshyVideos(shyVideos2);
76 95 }
... ...
src/main/java/com/cnlive/shenhe/job/YiDunUrlResultJob.java
... ... @@ -23,7 +23,7 @@ import java.util.Map;
23 23 import java.util.Random;
24 24  
25 25 /**
26   - * 易盾网站检测
  26 + * 易盾网站检测定时拉取检测结果
27 27 *
28 28 * @Author: xujincheng
29 29 * @Date: 2020/3/23 15:16
... ... @@ -56,10 +56,10 @@ public class YiDunUrlResultJob {
56 56 /**
57 57 * 定时查询易盾网站检测结果接口
58 58 */
59   - @Scheduled(cron = "0 0/5 * * * ? ")//每5分钟一次
  59 + @Scheduled(cron = "0 0/1 * * * ? ")//每分钟一次
60 60 public void YiDunUrl() {
61 61 try {
62   - Map<String, String> params = new HashMap<String, String>(5);
  62 + Map<String, String> params = new HashMap<>(5);
63 63 // 1.设置公共参数
64 64 params.put("secretId", SECRETID);
65 65 params.put("version", "v1.0");
... ... @@ -72,7 +72,7 @@ public class YiDunUrlResultJob {
72 72  
73 73 // 3.发送HTTP请求
74 74 String s1 = HttpClientUtils.post_str(URL_RESULT, params);
75   - logger.info("查询易盾网站检测结果:{}", s1);
  75 + logger.info("审核云查询易盾网站检测结果:{}", s1);
76 76  
77 77 // 4.解析接口返回值
78 78 JSONObject resultObject = JSONObject.parseObject(s1);
... ... @@ -104,8 +104,10 @@ public class YiDunUrlResultJob {
104 104 shyContent.setReceive_status(2);
105 105 shyContent.setShenhe_msg(desc);
106 106 newYiDunMsg.setDesc_msg(desc);
  107 + newYiDunMsg.setCheck_status(0);
107 108 //修改图文状态
108 109 contentServiceImpl.callback(yiDunMsg.getContent_id(), desc, CommonConst.AUDIT_SUCCESS, "", "机审通过");
  110 + logger.info("审核云结果回调业务对接方:dataId={}", dataId);
109 111 } else {
110 112 JSONObject evidences = jsonObject.getJSONObject("evidences");
111 113 JSONArray texts = evidences.getJSONArray("texts");
... ... @@ -177,6 +179,7 @@ public class YiDunUrlResultJob {
177 179 shyContent.setReceive_status(3);
178 180 shyContent.setShenhe_msg(desc);
179 181 newYiDunMsg.setDesc_msg(desc);
  182 + newYiDunMsg.setCheck_status(2);
180 183 }
181 184 } catch (NumberFormatException e) {
182 185 e.printStackTrace();
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/AudioServiceImpl.java
... ... @@ -351,7 +351,7 @@ public class AudioServiceImpl {
351 351 * 易盾点播音频过滤
352 352 *
353 353 * @param shyAudio
354   - * @return
  354 + * @return 1:文本 2:图片 3.网页 4:点播音频
355 355 */
356 356 public void audioFilter(ShyAudio shyAudio) {
357 357 //调用易盾点播音频检测接口
... ... @@ -359,11 +359,15 @@ public class AudioServiceImpl {
359 359 if (jsonObject != null) {
360 360 JSONObject result = jsonObject.getJSONObject("result");
361 361 String taskId = result.getString("taskId");
  362 + String dataId = result.getString("dataId");
362 363 ShyYidun shyYidun = new ShyYidun();
363 364 shyYidun.setId(taskId);
364 365 shyYidun.setUrl(shyAudio.getAudioUrl());
365 366 shyYidun.setContent_id(shyAudio.getId().toString());
366 367 shyYidun.setCreate_time(new Date());
  368 + shyYidun.setTask_id(taskId);
  369 + shyYidun.setData_id(dataId);
  370 + shyYidun.setCheck_type(4);
367 371 yiDunServiceImpl.addYiDunMsg(shyYidun);
368 372 }
369 373 }
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/ContentServiceImpl.java
1 1 package com.cnlive.shenhe.serviceImpl;
2 2  
  3 +import com.alibaba.fastjson.JSON;
3 4 import com.alibaba.fastjson.JSONObject;
4 5 import com.cnlive.shenhe.dto.ContentDTO;
5 6 import com.cnlive.shenhe.entity.*;
6 7 import com.cnlive.shenhe.mapper.ShyCommentsMapper;
7 8 import com.cnlive.shenhe.mapper.ShyContentMapper;
8   -import com.cnlive.shenhe.mapper.ShySitesMapper;
9 9 import com.cnlive.shenhe.mapper.ShyUsersMapper;
10 10 import com.cnlive.shenhe.utils.AuditPass;
11 11 import com.cnlive.shenhe.utils.CommonConst;
... ... @@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Value;
21 21 import org.springframework.stereotype.Service;
22 22 import tk.mybatis.mapper.entity.Example;
23 23  
  24 +import java.util.ArrayList;
24 25 import java.util.Date;
25 26 import java.util.List;
26 27  
... ... @@ -38,8 +39,6 @@ public class ContentServiceImpl {
38 39 @Autowired
39 40 ShyContentMapper shyContentMapper;
40 41 @Autowired
41   - ShySitesMapper shySitesMapper;
42   - @Autowired
43 42 ShyUsersMapper shyUsersMapper;
44 43 @Autowired
45 44 AuditPass Pass;
... ... @@ -48,8 +47,6 @@ public class ContentServiceImpl {
48 47 @Autowired
49 48 VideosServiceImpl videosService;
50 49 @Autowired
51   - VideofilterServiceImpl videofilterServiceImpl;
52   - @Autowired
53 50 YiDunServiceImpl yiDunServiceImpl;
54 51  
55 52 @Value("${spring.localhost.url}")
... ... @@ -64,9 +61,20 @@ public class ContentServiceImpl {
64 61 }
65 62  
66 63 //**************************************
  64 +
67 65 public List<ShyContent> findshyContent(ShyContent shyContent) {
  66 + return shyContentMapper.selectByRowBounds(shyContent, new RowBounds(0, 100));
  67 + }
68 68  
69   - return shyContentMapper.selectByRowBounds(shyContent, new RowBounds(0, 50));
  69 + public List<ShyContent> findShyContentWithWebPage() {
  70 + List checkParamList = new ArrayList();
  71 + checkParamList.add("content");
  72 + Example example = new Example(ShyContent.class);
  73 + Example.Criteria criteria = example.createCriteria();
  74 + criteria.andNotIn("content_tag", checkParamList);
  75 + criteria.andEqualTo("shenhe_type", CommonConst.AUDIT_TYPE_MACHANE);
  76 + criteria.andEqualTo("receive_status", CommonConst.RECEIVE_BEFORE);
  77 + return shyContentMapper.selectByExampleAndRowBounds(example, new RowBounds(0, 100));
70 78 }
71 79  
72 80 //***************************
... ... @@ -375,22 +383,26 @@ public class ContentServiceImpl {
375 383 * 易盾网站过滤
376 384 *
377 385 * @param shyContent
378   - * @return
  386 + * @return 1:文本 2:图片 3.网页 4:点播音频
379 387 */
380 388 public void contentFilter(ShyContent shyContent) {
381 389 String contentUrl = shyContent.getContent_url();
382   - logger.info("向易盾网站检测接口提交的url:" + contentUrl);
  390 + logger.info("审核云向易盾网站检测接口提交的url:{}", contentUrl);
383 391 //调用易盾网站检测接口
384 392 JSONObject jsonObject = YiDunAntiFraudUtil.submitYiDunUrl(contentUrl);
385 393 if (jsonObject != null) {
386 394 JSONObject result = jsonObject.getJSONObject("result");
387 395 String dataId = result.getString("dataId");
  396 + String taskId = result.getString("taskId");
388 397 ShyYidun shyYidun = new ShyYidun();
389 398 shyYidun.setId(dataId);
390 399 shyYidun.setUrl(contentUrl);
391   -
  400 + shyYidun.setTask_id(taskId);
  401 + shyYidun.setData_id(dataId);
  402 + shyYidun.setCheck_type(3);
392 403 shyYidun.setContent_id(shyContent.getId().toString());
393 404 shyYidun.setCreate_time(new Date());
  405 + logger.info("审核云保存到ShyYidun表里数据:{}", JSON.toJSONString(shyYidun));
394 406 yiDunServiceImpl.addYiDunMsg(shyYidun);
395 407 }
396 408 }
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
... ... @@ -324,7 +324,6 @@ public class VideosServiceImpl {
324 324 }
325 325 }
326 326 //默认按上传时间倒序排序
327   - //example.setOrderByClause("video_upload_time desc");
328 327 List<ShyVideos> shyVideosList = shyVideosMapper.selectByExample(example);
329 328 return shyVideosList;
330 329 }
... ... @@ -333,7 +332,7 @@ public class VideosServiceImpl {
333 332 * 易盾视频(图片)过滤
334 333 *
335 334 * @param cid 审核云中视频的id
336   - * @return
  335 + * @return 1:文本 2:图片 3.网页 4:点播音频
337 336 */
338 337 public int videoFilter(Integer cid) {
339 338 ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(cid);
... ... @@ -375,7 +374,6 @@ public class VideosServiceImpl {
375 374 //拒绝原因
376 375 shyVideos.setMsg(desc);
377 376 videosService.updateshyVideos(shyVideos);
378   - //videosService.updateDianboAndShenhe(shyVideos,4);
379 377 }
380 378 try {
381 379 ShyYidun shyYidun = new ShyYidun();
... ... @@ -383,8 +381,11 @@ public class VideosServiceImpl {
383 381 shyYidun.setContent_id(cid.toString());
384 382 shyYidun.setUrl(url);
385 383 shyYidun.setDesc_msg(desc);
  384 + //校验图片类型
  385 + shyYidun.setCheck_type(2);
386 386 shyYidun.setDuration(shyVideos.getDuration());
387 387 shyYidun.setCreate_time(new Date());
  388 +
388 389 yiDunServiceImpl.addYiDunMsg(shyYidun);
389 390  
390 391 } catch (Exception e) {
... ...
src/main/java/com/cnlive/shenhe/utils/YiDunAntiFraudUtil.java
... ... @@ -4,11 +4,9 @@ import com.alibaba.fastjson.JSONArray;
4 4 import com.alibaba.fastjson.JSONObject;
5 5 import com.cnlive.shenhe.enums.ImageLabels;
6 6 import com.cnlive.shenhe.enums.TextLabels;
7   -import com.cnlive.shenhe.serviceImpl.YiDunServiceImpl;
8 7 import org.apache.commons.codec.digest.DigestUtils;
9 8 import org.slf4j.Logger;
10 9 import org.slf4j.LoggerFactory;
11   -import org.springframework.beans.factory.annotation.Autowired;
12 10 import org.springframework.util.StringUtils;
13 11  
14 12 import java.io.UnsupportedEncodingException;
... ... @@ -24,9 +22,6 @@ public class YiDunAntiFraudUtil {
24 22  
25 23 private static Logger logger = LoggerFactory.getLogger(YiDunAntiFraudUtil.class);
26 24  
27   - @Autowired
28   - YiDunServiceImpl yiDunServiceImpl;
29   -
30 25 /**
31 26 * 网站地址URL产品密钥ID,产品标识
32 27 */
... ... @@ -35,24 +30,12 @@ public class YiDunAntiFraudUtil {
35 30 * 网站地址URL产品私有密钥,服务端生成签名信息使用,请严格保管,避免泄露
36 31 */
37 32 private final static String SECRETKEY = "833222b4951a67a9bc63b5ed0c24d07d";
38   - /**
39   - * 网站地址URL提交接口地址
40   - */
41   - private final static String URL_SUBMIT = "https://as.dun.163yun.com/v1/crawler/submit";
42   - /**
43   - * 需检测的网站地址URL
44   - */
45   - private final static String FILE_URL = "http://shen.cnlive.com/api/content/detail/135058.html";
46   - /**
47   - * 网站地址URL检测结果获取接口地址
48   - */
49   - private final static String URL_RESULT = "https://as.dun.163yun.com/v1/crawler/callback/results";
50   -
51 33  
52 34 /**
53 35 * 文本识别 图片识别 点播音频识别产品密钥ID,产品标识
54 36 */
55 37 private final static String TEXTANDIMAGESECRETID = "11c62726ba11f03f3f7d87acbe2d4f03";
  38 +
56 39 /**
57 40 * 文本识别 图片识别 点播音频识别产品私有密钥,服务端生成签名信息使用,请严格保管,避免泄露
58 41 */
... ... @@ -61,64 +44,79 @@ public class YiDunAntiFraudUtil {
61 44 * 业务ID,易盾根据产品业务特点分配(文本)
62 45 */
63 46 private final static String TEXTBUSINESSID = "719926f98dc5b9bb9857e1b799ea3f5f";
64   - /**
65   - * 易盾内容安全文本在线检测接口地址
66   - */
67   - private final static String TEXT_RESULT = "https://as.dun.163yun.com/v3/text/check";
  47 +
68 48 /**
69 49 * 业务ID,易盾根据产品业务特点分配(图片)
70 50 */
71 51 private final static String IMAGEBUSINESSID = "f84d6ee9f62274243825d3e969ca4c5a";
72   - /**
73   - * 易盾内容安全服务图片在线检测接口地址
74   - */
75   - private final static String IMAGE_RESULT = "https://as.dun.163yun.com/v4/image/check";
  52 +
76 53 /**
77 54 * 业务ID,易盾根据产品业务特点分配(点播音频)
78 55 */
79 56 private final static String AUDIOONDEMANDBUSINESSID = "1b77454593bf55607e3e7120d02c6389";
80 57 /**
  58 + * 网站地址URL提交接口地址
  59 + * http://as.dun.163.com/v2/crawler/submit
  60 + */
  61 + private final static String URL_SUBMIT = "https://as.dun.163yun.com/v1/crawler/submit";
  62 +
  63 + /**
81 64 * 点播音频地址URL提交接口地址
82 65 */
83 66 private final static String AUDIOONDEMAND_URL_SUBMIT = "http://as.dun.163.com/v3/audio/submit";
84 67  
85   - public static void main(String[] args) {
86   - Map<String, String> params = new HashMap<String, String>(5);
87   - // 1.设置公共参数
88   - params.put("secretId", SECRETID);
89   - params.put("version", "v1.0");
90   - params.put("timestamp", String.valueOf(System.currentTimeMillis()));
91   - params.put("nonce", String.valueOf(new Random().nextInt()));
  68 + /**
  69 + * 易盾内容安全文本在线检测接口地址
  70 + */
  71 + private final static String TEXT_RESULT = "https://as.dun.163yun.com/v3/text/check";
92 72  
93   - // 2.生成签名信息
94   - String signature1 = YiDunAntiFraudUtil.genSignature(SECRETKEY, params);
95   - params.put("signature", signature1);
96   - String s1 = HttpClientUtils.post_str(URL_RESULT, params);
97   - logger.info("查询易盾网站检测结果:{}", s1);
  73 + /**
  74 + * 易盾内容安全服务图片在线检测接口地址
  75 + */
  76 + private final static String IMAGE_RESULT = "https://as.dun.163yun.com/v4/image/check";
  77 +
  78 + /**
  79 + * 网站地址URL检测结果获取接口地址
  80 + */
  81 + private final static String URL_RESULT = "https://as.dun.163yun.com/v1/crawler/callback/results";
  82 +
  83 + public static void main(String[] args) {
  84 +// Map<String, String> params = new HashMap<String, String>(5);
  85 +// // 1.设置公共参数
  86 +// params.put("secretId", SECRETID);
  87 +// params.put("version", "v1.0");
  88 +// params.put("timestamp", String.valueOf(System.currentTimeMillis()));
  89 +// params.put("nonce", String.valueOf(new Random().nextInt()));
  90 +//
  91 +// // 2.生成签名信息
  92 +// String signature1 = YiDunAntiFraudUtil.genSignature(SECRETKEY, params);
  93 +// params.put("signature", signature1);
  94 +// String s1 = HttpClientUtils.post_str(URL_RESULT, params);
  95 +// logger.info("查询易盾网站检测结果:{}", s1);
98 96 //智能文本识别审核测试
99 97 //getTextFilter("王八蛋");
100 98  
101 99 //智能图片识别审核测试
102   -// JSONArray jsonArray = new JSONArray();
103   -// JSONObject image1 = new JSONObject();
104   -// image1.put("name", UUID.randomUUID());
105   -// image1.put("type", 1);
106   -// image1.put("data", "http://article-bj.bj.bcebos.com//20200326/7f3d23bbb28421e6e2a6f131273554fb_15.jpg?authorization=bce-auth-v1%2F1eda661c3697440eaaca912ccb6f959c%2F2020-03-30T05%3A42%3A21Z%2F604800%2F%2F39f195e2327ef87270bd095fa64dfdcadad6f01a0d6dc6a4313306f164591cc5");
107   -// jsonArray.add(image1);
108   -// JSONObject image2 = new JSONObject();
109   -// image2.put("name", UUID.randomUUID());
110   -// image2.put("type", 1);
111   -// image2.put("data", "http://test.qnvod.cnlive.com/shen/802/2020/03/01/8a8a878c6dce5cfe017096cd07940c84/000002.jpg");
112   -// jsonArray.add(image2);
113   -// JSONObject image3 = new JSONObject();
114   -// image3.put("name", UUID.randomUUID());
115   -// image3.put("type", 1);
116   -// image3.put("data", "https://wjj.ys2.cnliveimg.com/769/img/0/2020/03/21/158474856886077030277.jpg");
117   -// jsonArray.add(image3);
118   -// System.out.println(jsonArray);
119   -// JSONObject imagesFilter = getImagesFilter(jsonArray.toString());
120   -//// System.out.println(image1);
121   -// System.out.println(imagesFilter);
  100 + JSONArray jsonArray = new JSONArray();
  101 + JSONObject image1 = new JSONObject();
  102 + image1.put("name", UUID.randomUUID());
  103 + image1.put("type", 1);
  104 + image1.put("data", "http://article-bj.bj.bcebos.com//20200326/7f3d23bbb28421e6e2a6f131273554fb_15.jpg?authorization=bce-auth-v1%2F1eda661c3697440eaaca912ccb6f959c%2F2020-03-30T05%3A42%3A21Z%2F604800%2F%2F39f195e2327ef87270bd095fa64dfdcadad6f01a0d6dc6a4313306f164591cc5");
  105 + jsonArray.add(image1);
  106 + JSONObject image2 = new JSONObject();
  107 + image2.put("name", UUID.randomUUID());
  108 + image2.put("type", 1);
  109 + image2.put("data", "http://test.qnvod.cnlive.com/shen/802/2020/03/01/8a8a878c6dce5cfe017096cd07940c84/000002.jpg");
  110 + jsonArray.add(image2);
  111 + JSONObject image3 = new JSONObject();
  112 + image3.put("name", UUID.randomUUID());
  113 + image3.put("type", 1);
  114 + image3.put("data", "https://wjj.ys2.cnliveimg.com/769/img/0/2020/03/21/158474856886077030277.jpg");
  115 + jsonArray.add(image3);
  116 + System.out.println(jsonArray);
  117 + JSONObject imagesFilter = getImagesFilter(jsonArray.toString());
  118 +// System.out.println(image1);
  119 + System.out.println(imagesFilter);
122 120  
123 121  
124 122 //智能网页识别审核测试
... ... @@ -398,7 +396,6 @@ public class YiDunAntiFraudUtil {
398 396 params.put("signature", signature);
399 397  
400 398 // 4.发送HTTP请求
401   - //String response = HttpClient4Utils.sendPost(httpClient, API_URL, params, Consts.UTF_8);
402 399 String s = HttpClientUtils.post_str(URL_SUBMIT, params);
403 400 System.out.println("图文检测提交url结果" + s);
404 401  
... ... @@ -431,7 +428,7 @@ public class YiDunAntiFraudUtil {
431 428 */
432 429 public static JSONObject submitYiDunUrl(String url) {
433 430 try {
434   - logger.info("向易盾网站检测接口提交的url.....................");
  431 + logger.info("审核云向易盾网站检测接口提交的url.....................");
435 432 Map<String, String> params = new HashMap<String, String>();
436 433  
437 434 // 1.设置公共参数
... ... @@ -456,7 +453,7 @@ public class YiDunAntiFraudUtil {
456 453  
457 454 // 4.发送HTTP请求
458 455 String s = HttpClientUtils.post_str(URL_SUBMIT, params);
459   - logger.info("向易盾提交网站检测地址返回的结果:{}", s);
  456 + logger.info("审核云向易盾提交网站检测地址返回的结果:{}", s);
460 457 JSONObject jsonObject = JSONObject.parseObject(s);
461 458 int code = jsonObject.getIntValue("code");
462 459 String msg = jsonObject.getString("msg");
... ...