Commit f20046af63f35d3aaa466a7fcfaa19d161e5070f
Merge branch 'dev'
Showing
9 changed files
with
117 additions
and
16 deletions
src/main/java/com/cnlive/shenhe/api/ContentControllerApi.java
| ... | ... | @@ -48,12 +48,15 @@ public class ContentControllerApi { |
| 48 | 48 | shyContent.setContent_id(json.getString("contentId")); |
| 49 | 49 | shyContent.setContent_tag("content");//图文标签 |
| 50 | 50 | List<ShyContent> contentList = contentService.findshyContent(shyContent); |
| 51 | + | |
| 52 | + //获取审核类型 | |
| 53 | + Integer shenheType = contentService.getShenheType(json.getInteger("spId"),"content"); | |
| 51 | 54 | //存在则更新 |
| 52 | 55 | if (contentList.size() > 0) { |
| 53 | 56 | ShyContent shyContent1 = contentList.get(0); |
| 54 | 57 | shyContent1.setTitle(json.getString("title"));//标题 |
| 55 | 58 | shyContent1.setTitle_image(json.getString("titleImage"));//标题图片 |
| 56 | - shyContent1.setShenhe_type(CommonConst.AUDIT_TYPE_USER);//审核类型是人工 | |
| 59 | + shyContent1.setShenhe_type(shenheType);//审核类型 | |
| 57 | 60 | shyContent1.setContent_status(json.getInteger("contentStatus"));//当前图文的审核状态 |
| 58 | 61 | shyContent1.setSource(json.getString("source"));//来源 |
| 59 | 62 | shyContent1.setAuthor(json.getString("author"));//作者 |
| ... | ... | @@ -83,7 +86,7 @@ public class ContentControllerApi { |
| 83 | 86 | //如果不存在直接插入 |
| 84 | 87 | shyContent.setTitle(json.getString("title"));//标题 |
| 85 | 88 | shyContent.setTitle_image(json.getString("titleImage"));//标题图片 |
| 86 | - shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_USER);//审核类型是人工 | |
| 89 | + shyContent.setShenhe_type(shenheType);//审核类型 | |
| 87 | 90 | shyContent.setContent_status(json.getInteger("contentStatus"));//当前图文的审核状态 |
| 88 | 91 | shyContent.setSource(json.getString("source"));//来源 |
| 89 | 92 | shyContent.setAuthor(json.getString("author"));//作者 |
| ... | ... | @@ -123,12 +126,14 @@ public class ContentControllerApi { |
| 123 | 126 | shyContent.setContent_id(json.getString("momentId"));//朋友圈id |
| 124 | 127 | shyContent.setContent_tag("moment");//朋友圈标签 |
| 125 | 128 | List<ShyContent> contentList = contentService.findshyContent(shyContent); |
| 129 | + //获取审核类型 | |
| 130 | + Integer shenheType = contentService.getShenheType(json.getInteger("spId"),"moment"); | |
| 126 | 131 | //存在则更新 |
| 127 | 132 | if (contentList.size() > 0) { |
| 128 | 133 | ShyContent shyContent1 = contentList.get(0); |
| 129 | 134 | shyContent1.setTitle(json.getString("title"));//标题 |
| 130 | 135 | shyContent1.setTitle_image(json.getString("image"));//用户头像 |
| 131 | - shyContent1.setShenhe_type(CommonConst.AUDIT_TYPE_USER);//审核类型是人工 | |
| 136 | + shyContent1.setShenhe_type(shenheType);//审核类型 | |
| 132 | 137 | String contentTime = json.getString("createTime");//朋友圈内容创建时间 |
| 133 | 138 | if (CommonUtils.isNotEmpty(contentTime)) { |
| 134 | 139 | // Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss"); |
| ... | ... | @@ -158,7 +163,7 @@ public class ContentControllerApi { |
| 158 | 163 | //如果不存在直接插入 |
| 159 | 164 | shyContent.setTitle(json.getString("title"));//标题 |
| 160 | 165 | shyContent.setTitle_image(json.getString("image"));//用户头像 |
| 161 | - shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_USER);//审核类型是人工 | |
| 166 | + shyContent.setShenhe_type(shenheType);//审核类型 | |
| 162 | 167 | shyContent.setContent_status(1);//当前朋友圈内容的审核状态,先发后审 |
| 163 | 168 | String contentTime = json.getString("createTime");//创建时间 |
| 164 | 169 | if (CommonUtils.isNotEmpty(contentTime)) { | ... | ... |
src/main/java/com/cnlive/shenhe/controller/ContentController.java
| ... | ... | @@ -166,7 +166,7 @@ public class ContentController { |
| 166 | 166 | boolean success =false; |
| 167 | 167 | String[] contentIds = ids.split(","); |
| 168 | 168 | for (String contentId : contentIds) { |
| 169 | - success = contentService.callback(contentId,"审核通过", CommonConst.AUDIT_SUCCESS, userId); | |
| 169 | + success = contentService.callback(contentId,"审核通过", CommonConst.AUDIT_SUCCESS, userId,""); | |
| 170 | 170 | } |
| 171 | 171 | if (success) { |
| 172 | 172 | return new ResponseBean(); |
| ... | ... | @@ -189,7 +189,7 @@ public class ContentController { |
| 189 | 189 | boolean success =false; |
| 190 | 190 | String[] contentIds = ids.split(","); |
| 191 | 191 | for (String contentId : contentIds) { |
| 192 | - success = contentService.callback(contentId,msg, CommonConst.AUDIT_REFUSE, userId); | |
| 192 | + success = contentService.callback(contentId,msg, CommonConst.AUDIT_REFUSE, userId,""); | |
| 193 | 193 | } |
| 194 | 194 | if (success) { |
| 195 | 195 | return new ResponseBean(); | ... | ... |
src/main/java/com/cnlive/shenhe/controller/SitesController.java
| ... | ... | @@ -79,7 +79,7 @@ public class SitesController { |
| 79 | 79 | ShySites site = sitesService.get(siteId); |
| 80 | 80 | SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); |
| 81 | 81 | Integer spid = sessionUser.getSpid(); |
| 82 | - if ((!sessionUser.isMaster() && spid != 0) || (sessionUser.isMaster() && site.getSpid() != spid)) { | |
| 82 | + if ((!sessionUser.isMaster() && spid != 0) ) { | |
| 83 | 83 | return "page/error.html"; |
| 84 | 84 | } |
| 85 | 85 | String write = ""; | ... | ... |
src/main/java/com/cnlive/shenhe/job/ContentJob.java
| ... | ... | @@ -39,7 +39,7 @@ public class ContentJob { |
| 39 | 39 | /** |
| 40 | 40 | * 白名单sp图文通过 |
| 41 | 41 | */ |
| 42 | -// @Scheduled(fixedRate = 60 * 1000) | |
| 42 | + @Scheduled(fixedRate = 60 * 1000) | |
| 43 | 43 | public void updateVideos() { |
| 44 | 44 | ShyContent shyContent = new ShyContent(); |
| 45 | 45 | shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_FREE);// 审核类型为免审 |
| ... | ... | @@ -50,7 +50,7 @@ public class ContentJob { |
| 50 | 50 | logger.info("当前白名单通过的content_id:"+content.getId()); |
| 51 | 51 | content.setUpdater("白名单"); |
| 52 | 52 | // 更新点播和审核的视频状态 |
| 53 | - contentService.callback(content.getId()+"","白名单审核通过", 1,""); | |
| 53 | + contentService.callback(content.getId()+"","白名单审核通过", 1,"","白名单"); | |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | } |
| ... | ... | @@ -58,7 +58,7 @@ public class ContentJob { |
| 58 | 58 | /** |
| 59 | 59 | * 定时发送数美检测视频 |
| 60 | 60 | */ |
| 61 | -// @Scheduled(cron="0 0/1 10-23 * * ? ")//每天10点到23点执行,每分钟一次 | |
| 61 | + @Scheduled(cron="0 0/1 10-23 * * ? ")//每天10点到23点执行,每分钟一次 | |
| 62 | 62 | public void videofilter() { |
| 63 | 63 | ShyContent shyContent = new ShyContent(); |
| 64 | 64 | shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_MACHANE);//审核类型为机审 |
| ... | ... | @@ -68,7 +68,7 @@ public class ContentJob { |
| 68 | 68 | for (ShyContent content : shyContentList) { |
| 69 | 69 | logger.info("定时发送数美检测的content_id:"+content.getId()); |
| 70 | 70 | //数美图片过滤 |
| 71 | -// videosService.videoFilter(video.getId(),CommonConst.DYNAMIC_USER); | |
| 71 | + contentService.contentFilter(content,"NEWS"); | |
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | } | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/CommentsServiceImpl.java
| ... | ... | @@ -255,7 +255,7 @@ public class CommentsServiceImpl { |
| 255 | 255 | */ |
| 256 | 256 | public void getShenheType(ShyComments shyComments){ |
| 257 | 257 | |
| 258 | - //获取点播免审sp | |
| 258 | + //获取评论免审sp | |
| 259 | 259 | List<Integer> sites = sitesService.getBusinessList(CommonConst.BUSINESS_COMMENT); |
| 260 | 260 | //初始化一个审核状态 |
| 261 | 261 | Integer shenheType=3;//审核类型,1:免审,2:机审,3:人工审 | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/ContentServiceImpl.java
| 1 | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | 2 | |
| 3 | +import com.alibaba.fastjson.JSONArray; | |
| 3 | 4 | import com.alibaba.fastjson.JSONObject; |
| 4 | 5 | import com.cnlive.shenhe.entity.ShyComments; |
| 5 | 6 | import com.cnlive.shenhe.entity.ShyContent; |
| 6 | 7 | import com.cnlive.shenhe.entity.ShyLive; |
| 7 | 8 | import com.cnlive.shenhe.entity.ShySites; |
| 8 | 9 | import com.cnlive.shenhe.entity.ShyUsers; |
| 10 | +import com.cnlive.shenhe.entity.ShyVideofilter; | |
| 9 | 11 | import com.cnlive.shenhe.entity.ShyVideos; |
| 10 | 12 | import com.cnlive.shenhe.mapper.ShyCommentsMapper; |
| 11 | 13 | import com.cnlive.shenhe.mapper.ShyContentMapper; |
| 12 | 14 | import com.cnlive.shenhe.mapper.ShySitesMapper; |
| 13 | 15 | import com.cnlive.shenhe.mapper.ShyUsersMapper; |
| 16 | +import com.cnlive.shenhe.utils.AntiFraudUtil; | |
| 14 | 17 | import com.cnlive.shenhe.utils.AuditPass; |
| 15 | 18 | import com.cnlive.shenhe.utils.CommonConst; |
| 16 | 19 | import com.cnlive.shenhe.utils.CommonUtils; |
| ... | ... | @@ -25,8 +28,12 @@ import tk.mybatis.mapper.entity.Example; |
| 25 | 28 | |
| 26 | 29 | import java.sql.Timestamp; |
| 27 | 30 | import java.text.ParseException; |
| 31 | +import java.util.ArrayList; | |
| 28 | 32 | import java.util.Date; |
| 33 | +import java.util.HashMap; | |
| 29 | 34 | import java.util.List; |
| 35 | +import java.util.Map; | |
| 36 | +import java.util.UUID; | |
| 30 | 37 | |
| 31 | 38 | /** |
| 32 | 39 | * @Auther: liwei |
| ... | ... | @@ -51,6 +58,8 @@ public class ContentServiceImpl { |
| 51 | 58 | SitesServiceImpl sitesService; |
| 52 | 59 | @Autowired |
| 53 | 60 | VideosServiceImpl videosService; |
| 61 | + @Autowired | |
| 62 | + VideofilterServiceImpl videofilterServiceImpl; | |
| 54 | 63 | |
| 55 | 64 | public ShyContent getShyContent(ShyContent shyContent) { |
| 56 | 65 | List<ShyContent> shyContentList = shyContentMapper.select(shyContent); |
| ... | ... | @@ -198,7 +207,7 @@ public class ContentServiceImpl { |
| 198 | 207 | } |
| 199 | 208 | |
| 200 | 209 | //********************** |
| 201 | - public boolean callback(String contentId, String msg, Integer state, String userId) { | |
| 210 | + public boolean callback(String contentId, String msg, Integer state, String userId,String updater) { | |
| 202 | 211 | boolean success = true; |
| 203 | 212 | ShyContent content = shyContentMapper.selectByPrimaryKey(Integer.parseInt(contentId)); |
| 204 | 213 | JSONObject result = new JSONObject(); |
| ... | ... | @@ -250,6 +259,8 @@ public class ContentServiceImpl { |
| 250 | 259 | if (CommonUtils.isNotEmpty(userId)) { |
| 251 | 260 | content.setAuditor_id(userId); |
| 252 | 261 | content.setShenhe_type(CommonConst.AUDIT_TYPE_USER);// 设置审核类型为人工 |
| 262 | + }else{ | |
| 263 | + content.setUpdater(updater);//设置更新人 | |
| 253 | 264 | } |
| 254 | 265 | content.setLast_update(CommonUtils.getCurrentTime()); |
| 255 | 266 | int i = shyContentMapper.updateByPrimaryKeySelective(content); |
| ... | ... | @@ -320,6 +331,74 @@ public class ContentServiceImpl { |
| 320 | 331 | public int updateByPrimaryKeySelective(ShyContent content) { |
| 321 | 332 | return shyContentMapper.updateByPrimaryKeySelective(content); |
| 322 | 333 | } |
| 334 | + | |
| 335 | + /** | |
| 336 | + * 获得审核类型 | |
| 337 | + * @param spId | |
| 338 | + */ | |
| 339 | + public Integer getShenheType(Integer spId,String ContentTag){ | |
| 340 | + | |
| 341 | + //获取图文免审sp | |
| 342 | + List<Integer> sites = sitesService.getBusinessList(CommonConst.BUSINESS_CONTENT); | |
| 343 | + //初始化一个审核状态 | |
| 344 | + Integer shenheType=3;//审核类型,1:免审,2:机审,3:人工审 | |
| 345 | + //如果当前sp是免审sp | |
| 346 | + if(sites.contains(spId)){ | |
| 347 | + shenheType=1;//免审 | |
| 348 | + }else{ | |
| 349 | + if("content".equals(ContentTag)){ | |
| 350 | + shenheType=2;//机审 | |
| 351 | + }else{ | |
| 352 | + shenheType=3;//人工审 | |
| 353 | + } | |
| 354 | + } | |
| 355 | + return shenheType; | |
| 356 | + } | |
| 357 | + | |
| 358 | + /** | |
| 359 | + * 数美视频(图片)过滤 | |
| 360 | + * @param cid 审核云中图文id | |
| 361 | + * @param channel 尺度 | |
| 362 | + * @return | |
| 363 | + */ | |
| 364 | + public int contentFilter(ShyContent shyContent,String channel){ | |
| 365 | + | |
| 366 | + JSONObject result = null;//数美返回结果 | |
| 367 | + String type="";//数美返回结果的类型 | |
| 368 | + String desc="";//数美失败结果的详情 | |
| 369 | + String Token_id=UUID.randomUUID().toString(); | |
| 370 | + try{ | |
| 371 | + //调用数美接口 | |
| 372 | + result = AntiFraudUtil.filterArticle(Token_id,shyContent.getContent_url(),channel); | |
| 373 | + type=result.getString("riskLevel"); | |
| 374 | + desc=result.getString("desc");//数美失败结果的详情 | |
| 375 | + }catch(Exception e){ | |
| 376 | + type=CommonConst.REJECT;//报错就给一个拒绝状态 | |
| 377 | + desc="数美审核报错了"; | |
| 378 | + } | |
| 379 | + if(type.toLowerCase().equals(CommonConst.PASS)){//数美通过 | |
| 380 | + desc="数美审核通过了"; | |
| 381 | + shyContent.setShenhe_msg(desc); | |
| 382 | + //修改图文状态 | |
| 383 | + callback(shyContent.getId().toString(),desc,CommonConst.AUDIT_SUCCESS,"","机审通过"); | |
| 384 | + }else if(type.toLowerCase().equals(CommonConst.REJECT)||type.toLowerCase().equals(CommonConst.REVIEW)){//数美拒绝 | |
| 385 | + shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_USER);//审核类型改为人工审核 | |
| 386 | + shyContent.setShenhe_msg(desc);//拒绝原因 | |
| 387 | + updateshyContent(shyContent); | |
| 388 | +// videosService.updateDianboAndShenhe(shyVideos,4); | |
| 389 | + } | |
| 390 | + ShyVideofilter videofilter=new ShyVideofilter(); | |
| 391 | + videofilter.setChannel(channel); | |
| 392 | + videofilter.setDesc_msg(desc); | |
| 393 | + videofilter.setResult_type(type); | |
| 394 | + videofilter.setToken_id(Token_id); | |
| 395 | + videofilter.setVideos_id(shyContent.getId()); | |
| 396 | + videofilter.setDuration(-1); | |
| 397 | + videofilter.setCreated_at(CommonUtils.getCurrentTime()); | |
| 398 | + videofilterServiceImpl.impotVideofilter(videofilter); | |
| 399 | + | |
| 400 | + return 0; | |
| 401 | + } | |
| 323 | 402 | |
| 324 | 403 | } |
| 325 | 404 | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/SitesServiceImpl.java
| ... | ... | @@ -30,15 +30,18 @@ public class SitesServiceImpl { |
| 30 | 30 | public PageInfo<ShySites> getPage(Integer page, Integer pageSize, String orderByClause, String key, Integer spId) { |
| 31 | 31 | Example example = new Example(ShySites.class); |
| 32 | 32 | Example.Criteria criteria = example.createCriteria(); |
| 33 | + Example.Criteria criteria2 = example.createCriteria(); | |
| 33 | 34 | if (CommonUtils.isNotEmpty(orderByClause)) { |
| 34 | 35 | example.setOrderByClause(orderByClause); |
| 35 | 36 | } |
| 36 | 37 | if (CommonUtils.isNotEmpty(key)) { |
| 37 | 38 | criteria.andLike("name", "%" + key + "%"); |
| 38 | - criteria.andLike("company", "%" + key + "%"); | |
| 39 | + criteria2.andLike("spid", "%" + key + "%"); | |
| 40 | + example.or(criteria2); | |
| 39 | 41 | } |
| 40 | 42 | if (CommonUtils.isNotNull(spId)) |
| 41 | 43 | criteria.andEqualTo("spid", spId); |
| 44 | + criteria2.andEqualTo("spid", spId); | |
| 42 | 45 | PageHelper.startPage(page, pageSize, true); |
| 43 | 46 | List<ShySites> shySitesList = shySitesMapper.selectByExample(example); |
| 44 | 47 | PageInfo<ShySites> pageInfo = new PageInfo<ShySites>(shySitesList); | ... | ... |
src/main/java/com/cnlive/shenhe/utils/AntiFraudUtil.java
| ... | ... | @@ -5,8 +5,12 @@ import com.alibaba.fastjson.JSONArray; |
| 5 | 5 | import com.alibaba.fastjson.JSONObject; |
| 6 | 6 | import org.apache.commons.lang3.StringUtils; |
| 7 | 7 | |
| 8 | +import java.util.HashMap; | |
| 9 | +import java.util.Map; | |
| 8 | 10 | import java.util.UUID; |
| 9 | 11 | |
| 12 | +import javax.swing.plaf.basic.BasicScrollPaneUI.HSBChangeListener; | |
| 13 | + | |
| 10 | 14 | |
| 11 | 15 | /** |
| 12 | 16 | * 数美 反欺诈工具类 |
| ... | ... | @@ -44,6 +48,13 @@ public class AntiFraudUtil { |
| 44 | 48 | //queryVideoResult("02b649b7-3451-403e-abd0-592302cec2a0"); |
| 45 | 49 | |
| 46 | 50 | try { |
| 51 | +// Map<Object, Object> hashMap = new HashMap<Object, Object>(); | |
| 52 | +// hashMap.put("11", "1111"); | |
| 53 | +// String object = (String) hashMap.get("11"); | |
| 54 | +// String object2 = (String) hashMap.get("22"); | |
| 55 | +// System.out.println(object); | |
| 56 | +// System.out.println(object2); | |
| 57 | + | |
| 47 | 58 | // System.out.println(addBlackContents("2222")); |
| 48 | 59 | } catch (Exception e) { |
| 49 | 60 | e.printStackTrace(); |
| ... | ... | @@ -381,14 +392,17 @@ try { |
| 381 | 392 | } |
| 382 | 393 | |
| 383 | 394 | private static JSONObject getResult(JSONObject result) { |
| 395 | + | |
| 384 | 396 | if (result != null) { |
| 385 | - System.out.println(result); | |
| 397 | + System.out.println("数美过滤返回结果" + result); | |
| 398 | + JSONObject jsonObj = new JSONObject(); | |
| 386 | 399 | Integer code = result.getInteger("code"); |
| 387 | 400 | |
| 388 | 401 | if (code != null && code == 1100) { //请求成功 |
| 389 | 402 | String riskLevel = result.getString("riskLevel"); |
| 390 | 403 | |
| 391 | 404 | if ("PASS".equals(riskLevel)) { |
| 405 | + jsonObj.put("type", "REJECT"); | |
| 392 | 406 | return result; |
| 393 | 407 | } |
| 394 | 408 | ... | ... |
src/main/java/com/cnlive/shenhe/utils/CommonConst.java
| ... | ... | @@ -78,7 +78,7 @@ public class CommonConst { |
| 78 | 78 | */ |
| 79 | 79 | public static Integer BUSINESS_CONTENT = 3; |
| 80 | 80 | |
| 81 | - public static JSONObject BUSINESS = JSONObject.parseObject("{\"1\":\"点播业务\",\"2\":\"评论业务\"}"); | |
| 81 | + public static JSONObject BUSINESS = JSONObject.parseObject("{\"1\":\"点播业务\",\"2\":\"评论业务\",\"3\":\"图文业务\"}"); | |
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | 84 | * 抽帧状态:未抽帧 | ... | ... |