Commit 3155cd598c8dc016c18403d8575f7955a0229bc9

Authored by 郑超
1 parent bdf32f7b

update

src/main/java/com/cnlive/shenhe/api/VideosControllerApi.java
@@ -80,12 +80,12 @@ public class VideosControllerApi { @@ -80,12 +80,12 @@ public class VideosControllerApi {
80 Integer duration = json.getInteger("duration"); 80 Integer duration = json.getInteger("duration");
81 if (CommonUtils.isNotNull(duration)) duration = duration / 1000; 81 if (CommonUtils.isNotNull(duration)) duration = duration / 1000;
82 //获取栏目分类 82 //获取栏目分类
83 - String category=CommonUtils.isEmpty(json.getString("multiplecategory"))?"":json.getString("multiplecategory"); 83 + String category = CommonUtils.isEmpty(json.getString("multiplecategory")) ? "" : json.getString("multiplecategory");
84 //获取视频上传人的id 84 //获取视频上传人的id
85 - String sid=CommonUtils.isEmpty(json.getString("videoClipsName"))?"":json.getString("videoClipsName");  
86 - logger.info("videoClipsName:"+sid);  
87 - sid=CommonUtils.isEmpty(sid)?"":sid.split("_")[2];  
88 - logger.info("sid:"+sid); 85 + String sid = CommonUtils.isEmpty(json.getString("videoClipsName")) ? "" : json.getString("videoClipsName");
  86 + logger.info("videoClipsName:" + sid);
  87 + sid = CommonUtils.isEmpty(sid) ? "" : sid.split("_")[2];
  88 + logger.info("sid:" + sid);
89 //初始化一个审核状态 89 //初始化一个审核状态
90 // Integer shenheType=3;//审核类型,1:免审,2:机审,3:人工审 90 // Integer shenheType=3;//审核类型,1:免审,2:机审,3:人工审
91 // shenheType=videosService.getShenheType(json.getInteger("spId"),category,sid); 91 // shenheType=videosService.getShenheType(json.getInteger("spId"),category,sid);
@@ -161,20 +161,20 @@ public class VideosControllerApi { @@ -161,20 +161,20 @@ public class VideosControllerApi {
161 shyVideos1.setVideo_user_id(sid);//传入sid 161 shyVideos1.setVideo_user_id(sid);//传入sid
162 videosService.getShenheType(shyVideos1);//获取审核类型 162 videosService.getShenheType(shyVideos1);//获取审核类型
163 163
164 - if(shyVideos1.getShenhe_type()!=1){  
165 - if(shyVideos1.getShenhe_type()==CommonConst.AUDIT_TYPE_USER){//如果审核类型是人工审核,按照原有规则 164 + if (shyVideos1.getShenhe_type() != 1) {
  165 + if (shyVideos1.getShenhe_type() == CommonConst.AUDIT_TYPE_USER) {//如果审核类型是人工审核,按照原有规则
166 if (CommonUtils.isNotNull(duration) && duration > 80) { 166 if (CommonUtils.isNotNull(duration) && duration > 80) {
167 shyVideos1 = avsample(shyVideos1);//视频至少可以抽8张,请求抽帧 167 shyVideos1 = avsample(shyVideos1);//视频至少可以抽8张,请求抽帧
168 } 168 }
169 - }else if(shyVideos1.getShenhe_type()==CommonConst.AUDIT_TYPE_MACHANE){//如果审核类型是机审 169 + } else if (shyVideos1.getShenhe_type() == CommonConst.AUDIT_TYPE_MACHANE) {//如果审核类型是机审
170 if (CommonUtils.isNotNull(duration) && duration < 60) {//"目击者"视频,小于60秒的抽帧 170 if (CommonUtils.isNotNull(duration) && duration < 60) {//"目击者"视频,小于60秒的抽帧
171 shyVideos1 = avsample(shyVideos1); 171 shyVideos1 = avsample(shyVideos1);
172 - }else{//机审超过60秒的改为人工审核 172 + } else {//机审超过60秒的改为人工审核
173 shyVideos1.setShenhe_type(3); 173 shyVideos1.setShenhe_type(3);
174 } 174 }
175 } 175 }
176 } 176 }
177 - logger.info("当前视频类型是:"+shyVideos1.getShenhe_type()); 177 + logger.info("当前视频类型是:" + shyVideos1.getShenhe_type());
178 boolean result = videosService.impotVideo(shyVideos1); 178 boolean result = videosService.impotVideo(shyVideos1);
179 179
180 if (result == true) { 180 if (result == true) {
@@ -205,26 +205,26 @@ public class VideosControllerApi { @@ -205,26 +205,26 @@ public class VideosControllerApi {
205 205
206 JSONObject attach = new JSONObject(); 206 JSONObject attach = new JSONObject();
207 JSONObject extParam = new JSONObject(); 207 JSONObject extParam = new JSONObject();
208 -  
209 - if(!video.getCategory().equals(CommonConst.CATEGORY_WITNESS)){//非“目击者”视频  
210 - Integer interval=10;//默认抽帧时长  
211 - interval=video.getDuration()/3600*10+10;//抽帧时长的算法:视频时长每增加一小时,抽帧时长增加10秒  
212 - attach.put("interval", interval);  
213 - attach.put("strategy", 1);  
214 - attach.put("duration", video.getDuration());  
215 - }else{  
216 - if(video.getDuration()>4){//“目击者”视频时间大于4秒  
217 - attach.put("interval", 4);//间隔 单位s  
218 - attach.put("num", video.getDuration()/4);//覆盖转码服务的默认抽帧图数量  
219 - attach.put("duration", video.getDuration()); 208 +
  209 + if (!video.getCategory().equals(CommonConst.CATEGORY_WITNESS)) {//非“目击者”视频
  210 + Integer interval = 10;//默认抽帧时长
  211 + interval = video.getDuration() / 3600 * 10 + 10;//抽帧时长的算法:视频时长每增加一小时,抽帧时长增加10秒
  212 + attach.put("interval", interval);
  213 + attach.put("strategy", 1);
  214 + attach.put("duration", video.getDuration());
  215 + } else {
  216 + if (video.getDuration() > 4) {//“目击者”视频时间大于4秒
  217 + attach.put("interval", 4);//间隔 单位s
  218 + attach.put("num", video.getDuration() / 4);//覆盖转码服务的默认抽帧图数量
  219 + attach.put("duration", video.getDuration());
220 // attach.put("strategy", 1);//是否从头抽到尾(1:是,优先级大于num) 220 // attach.put("strategy", 1);//是否从头抽到尾(1:是,优先级大于num)
221 - }else{  
222 - attach.put("num", 1);//抽帧图片张数  
223 - attach.put("first", 0);//是否首帧,0:是。num=1时有效  
224 - } 221 + } else {
  222 + attach.put("num", 1);//抽帧图片张数
  223 + attach.put("first", 0);//是否首帧,0:是。num=1时有效
  224 + }
225 } 225 }
226 -  
227 - 226 +
  227 +
228 logger.info("抽帧attach参数:attach:{}", attach); 228 logger.info("抽帧attach参数:attach:{}", attach);
229 extParam.put("domain", domian); 229 extParam.put("domain", domian);
230 if (CommonConst.KS_PLAT == plat) { 230 if (CommonConst.KS_PLAT == plat) {
src/main/java/com/cnlive/shenhe/api/YiDunControllerApi.java
@@ -85,7 +85,6 @@ public class YiDunControllerApi { @@ -85,7 +85,6 @@ public class YiDunControllerApi {
85 shyYidun.setId(dataId); 85 shyYidun.setId(dataId);
86 shyYidun.setCreate_time(new Date()); 86 shyYidun.setCreate_time(new Date());
87 yiDunServiceImpl.addYiDunMsg(shyYidun); 87 yiDunServiceImpl.addYiDunMsg(shyYidun);
88 -  
89 } 88 }
90 89
91 } 90 }
src/main/java/com/cnlive/shenhe/utils/YiDunAntiFraudUtil.java
@@ -88,7 +88,7 @@ public class YiDunAntiFraudUtil { @@ -88,7 +88,7 @@ public class YiDunAntiFraudUtil {
88 //getTextFilter("王八蛋"); 88 //getTextFilter("王八蛋");
89 89
90 //智能图片识别审核测试 90 //智能图片识别审核测试
91 - /*JSONArray jsonArray = new JSONArray(); 91 + JSONArray jsonArray = new JSONArray();
92 JSONObject image1 = new JSONObject(); 92 JSONObject image1 = new JSONObject();
93 image1.put("name", UUID.randomUUID()); 93 image1.put("name", UUID.randomUUID());
94 image1.put("type", 1); 94 image1.put("type", 1);
@@ -104,7 +104,11 @@ public class YiDunAntiFraudUtil { @@ -104,7 +104,11 @@ public class YiDunAntiFraudUtil {
104 image3.put("type", 1); 104 image3.put("type", 1);
105 image3.put("data", "https://wjj.ys2.cnliveimg.com/769/img/0/2020/03/21/158474856886077030277.jpg"); 105 image3.put("data", "https://wjj.ys2.cnliveimg.com/769/img/0/2020/03/21/158474856886077030277.jpg");
106 jsonArray.add(image3); 106 jsonArray.add(image3);
107 - getImagesFilter(jsonArray.toJSONString());*/ 107 + System.out.println(jsonArray);
  108 + JSONObject imagesFilter = getImagesFilter(jsonArray.toString());
  109 +// System.out.println(image1);
  110 + System.out.println(imagesFilter);
  111 +
108 112
109 //智能网页识别审核测试 113 //智能网页识别审核测试
110 //getURLFilter(FILE_URL); 114 //getURLFilter(FILE_URL);