Commit ea7dcd21bc1945c31ff7ea4789f21c8e887f35ff
1 parent
4db67ee6
作业作品 家庭相册 改为免审、优化图文定时任务
Showing
3 changed files
with
35 additions
and
36 deletions
src/main/java/com/cnlive/shenhe/job/ContentJob.java
| @@ -40,7 +40,7 @@ public class ContentJob { | @@ -40,7 +40,7 @@ public class ContentJob { | ||
| 40 | logger.info("当前白名单通过的content_id:" + content.getId()); | 40 | logger.info("当前白名单通过的content_id:" + content.getId()); |
| 41 | content.setUpdater("白名单"); | 41 | content.setUpdater("白名单"); |
| 42 | // 更新点播和审核的视频状态 | 42 | // 更新点播和审核的视频状态 |
| 43 | - contentService.callback(content.getId() + "", "白名单审核通过", CommonConst.AUDIT_SUCCESS, "", "白名单"); | 43 | + contentService.callback(content.getId() + "", "白名单审核通过", CommonConst.AUDIT_SUCCESS, "", content.getUpdater()); |
| 44 | } | 44 | } |
| 45 | } | 45 | } |
| 46 | } | 46 | } |
| @@ -56,6 +56,7 @@ public class ContentJob { | @@ -56,6 +56,7 @@ public class ContentJob { | ||
| 56 | if (shyContentList != null && shyContentList.size() > 0) { | 56 | if (shyContentList != null && shyContentList.size() > 0) { |
| 57 | logger.info("审核云提交网页审核到易盾数据个数:{}", shyContentList.size()); | 57 | logger.info("审核云提交网页审核到易盾数据个数:{}", shyContentList.size()); |
| 58 | for (ShyContent content : shyContentList) { | 58 | for (ShyContent content : shyContentList) { |
| 59 | + content.setUpdater("机审"); | ||
| 59 | contentService.contentFilter(content); | 60 | contentService.contentFilter(content); |
| 60 | } | 61 | } |
| 61 | } | 62 | } |
src/main/java/com/cnlive/shenhe/job/YiDunUrlResultJob.java
| @@ -57,7 +57,7 @@ public class YiDunUrlResultJob { | @@ -57,7 +57,7 @@ public class YiDunUrlResultJob { | ||
| 57 | * 每分钟一次 | 57 | * 每分钟一次 |
| 58 | */ | 58 | */ |
| 59 | @Scheduled(cron = "0 0/1 * * * ? ") | 59 | @Scheduled(cron = "0 0/1 * * * ? ") |
| 60 | - public void YiDunUrl() { | 60 | + public void yiDunUrl() { |
| 61 | try { | 61 | try { |
| 62 | Map<String, String> params = new HashMap<>(5); | 62 | Map<String, String> params = new HashMap<>(5); |
| 63 | // 1.设置公共参数 | 63 | // 1.设置公共参数 |
| @@ -79,14 +79,14 @@ public class YiDunUrlResultJob { | @@ -79,14 +79,14 @@ public class YiDunUrlResultJob { | ||
| 79 | int code = resultObject.getIntValue("code"); | 79 | int code = resultObject.getIntValue("code"); |
| 80 | String msg = resultObject.getString("msg"); | 80 | String msg = resultObject.getString("msg"); |
| 81 | if (code == 200 && "ok".equals(msg)) { | 81 | if (code == 200 && "ok".equals(msg)) { |
| 82 | - JSONArray resultJSONArray = resultObject.getJSONArray("result"); | ||
| 83 | - if (resultJSONArray != null && resultJSONArray.size() > 0) { | ||
| 84 | - for (int i = 0; i < resultJSONArray.size(); i++) { | ||
| 85 | - String desc = "易盾网站审核"; | 82 | + JSONArray resultJsonArray = resultObject.getJSONArray("result"); |
| 83 | + if (resultJsonArray != null && resultJsonArray.size() > 0) { | ||
| 84 | + for (int i = 0; i < resultJsonArray.size(); i++) { | ||
| 85 | + StringBuilder desc = new StringBuilder("易盾网站审核"); | ||
| 86 | ShyYidun newYiDunMsg = new ShyYidun(); | 86 | ShyYidun newYiDunMsg = new ShyYidun(); |
| 87 | ShyContent shyContent = new ShyContent(); | 87 | ShyContent shyContent = new ShyContent(); |
| 88 | try { | 88 | try { |
| 89 | - JSONObject jsonObject = resultJSONArray.getJSONObject(i); | 89 | + JSONObject jsonObject = resultJsonArray.getJSONObject(i); |
| 90 | String dataId = jsonObject.getString("dataId"); | 90 | String dataId = jsonObject.getString("dataId"); |
| 91 | ShyYidun yiDunMsg = yiDunServiceImpl.getYiDunMsg(dataId); | 91 | ShyYidun yiDunMsg = yiDunServiceImpl.getYiDunMsg(dataId); |
| 92 | if (yiDunMsg == null) { | 92 | if (yiDunMsg == null) { |
| @@ -96,17 +96,16 @@ public class YiDunUrlResultJob { | @@ -96,17 +96,16 @@ public class YiDunUrlResultJob { | ||
| 96 | newYiDunMsg.setDuration(-1); | 96 | newYiDunMsg.setDuration(-1); |
| 97 | newYiDunMsg.setUpdate_time(new Date()); | 97 | newYiDunMsg.setUpdate_time(new Date()); |
| 98 | shyContent.setId(Integer.valueOf(yiDunMsg.getContent_id())); | 98 | shyContent.setId(Integer.valueOf(yiDunMsg.getContent_id())); |
| 99 | + shyContent.setUpdater("机审"); | ||
| 99 | //检测结果, 1:正常(建议通过) 2:异常(建议拦截) 3:疑似(建议人工确认)0:无结果(检测失败) | 100 | //检测结果, 1:正常(建议通过) 2:异常(建议拦截) 3:疑似(建议人工确认)0:无结果(检测失败) |
| 100 | int result = jsonObject.getIntValue("result"); | 101 | int result = jsonObject.getIntValue("result"); |
| 101 | newYiDunMsg.setResult_type(String.valueOf(result)); | 102 | newYiDunMsg.setResult_type(String.valueOf(result)); |
| 102 | if (result == 1) { | 103 | if (result == 1) { |
| 103 | - desc = "易盾网站审核通过了"; | ||
| 104 | - shyContent.setReceive_status(2); | ||
| 105 | - shyContent.setShenhe_msg(desc); | ||
| 106 | - newYiDunMsg.setDesc_msg(desc); | 104 | + desc = new StringBuilder("易盾网站审核通过了"); |
| 105 | + newYiDunMsg.setDesc_msg(desc.toString()); | ||
| 107 | newYiDunMsg.setCheck_status(0); | 106 | newYiDunMsg.setCheck_status(0); |
| 108 | //修改图文状态 | 107 | //修改图文状态 |
| 109 | - contentServiceImpl.callback(yiDunMsg.getContent_id(), desc, CommonConst.AUDIT_SUCCESS, "", "机审"); | 108 | + contentServiceImpl.callback(String.valueOf(shyContent.getId()), desc.toString(), CommonConst.AUDIT_SUCCESS, "", shyContent.getUpdater()); |
| 110 | logger.info("审核云结果回调业务对接方:dataId={}", dataId); | 109 | logger.info("审核云结果回调业务对接方:dataId={}", dataId); |
| 111 | } else { | 110 | } else { |
| 112 | JSONObject evidences = jsonObject.getJSONObject("evidences"); | 111 | JSONObject evidences = jsonObject.getJSONObject("evidences"); |
| @@ -116,28 +115,28 @@ public class YiDunUrlResultJob { | @@ -116,28 +115,28 @@ public class YiDunUrlResultJob { | ||
| 116 | JSONObject jsonObject1 = texts.getJSONObject(j); | 115 | JSONObject jsonObject1 = texts.getJSONObject(j); |
| 117 | //检测结果,0:通过,1:嫌疑,2:不通过 | 116 | //检测结果,0:通过,1:嫌疑,2:不通过 |
| 118 | int action = jsonObject1.getIntValue("action"); | 117 | int action = jsonObject1.getIntValue("action"); |
| 119 | - String labelMsg = ""; | 118 | + StringBuilder labelMsg = new StringBuilder(); |
| 120 | if (action != 0) { | 119 | if (action != 0) { |
| 121 | JSONArray labels = jsonObject1.getJSONArray("labels"); | 120 | JSONArray labels = jsonObject1.getJSONArray("labels"); |
| 122 | - labelMsg = "("; | 121 | + labelMsg = new StringBuilder("("); |
| 123 | if (labels != null && labels.size() > 0) { | 122 | if (labels != null && labels.size() > 0) { |
| 124 | for (Object obj : labels) { | 123 | for (Object obj : labels) { |
| 125 | JSONObject jsonObjectone = (JSONObject) obj; | 124 | JSONObject jsonObjectone = (JSONObject) obj; |
| 126 | Integer label = jsonObjectone.getInteger("label"); | 125 | Integer label = jsonObjectone.getInteger("label"); |
| 127 | String name = TextLabels.getName(label); | 126 | String name = TextLabels.getName(label); |
| 128 | - labelMsg = labelMsg + name; | 127 | + labelMsg.append(name); |
| 129 | 128 | ||
| 130 | } | 129 | } |
| 131 | } | 130 | } |
| 132 | } | 131 | } |
| 133 | if (action == 1) { | 132 | if (action == 1) { |
| 134 | - desc = desc + "文字嫌疑" + labelMsg + ")"; | 133 | + desc.append("文字嫌疑").append(labelMsg).append(")"); |
| 135 | break; | 134 | break; |
| 136 | } else if (action == 2) { | 135 | } else if (action == 2) { |
| 137 | - desc = desc + "文字违规" + labelMsg + ")"; | 136 | + desc.append("文字违规").append(labelMsg).append(")"); |
| 138 | break; | 137 | break; |
| 139 | } else { | 138 | } else { |
| 140 | - desc = desc + labelMsg + ")"; | 139 | + desc.append(labelMsg).append(")"); |
| 141 | } | 140 | } |
| 142 | } | 141 | } |
| 143 | } | 142 | } |
| @@ -147,10 +146,10 @@ public class YiDunUrlResultJob { | @@ -147,10 +146,10 @@ public class YiDunUrlResultJob { | ||
| 147 | JSONObject jsonObject1 = images.getJSONObject(k); | 146 | JSONObject jsonObject1 = images.getJSONObject(k); |
| 148 | //0:正常,1:不确定,2:确定 | 147 | //0:正常,1:不确定,2:确定 |
| 149 | int level = jsonObject1.getIntValue("level"); | 148 | int level = jsonObject1.getIntValue("level"); |
| 150 | - String labelMsg = ""; | 149 | + StringBuilder labelMsg = new StringBuilder(); |
| 151 | if (level != 0) { | 150 | if (level != 0) { |
| 152 | JSONArray labels = jsonObject1.getJSONArray("labels"); | 151 | JSONArray labels = jsonObject1.getJSONArray("labels"); |
| 153 | - labelMsg = "("; | 152 | + labelMsg = new StringBuilder("("); |
| 154 | if (labels != null && labels.size() > 0) { | 153 | if (labels != null && labels.size() > 0) { |
| 155 | for (Object obj : labels) { | 154 | for (Object obj : labels) { |
| 156 | JSONObject jsonObjectone = (JSONObject) obj; | 155 | JSONObject jsonObjectone = (JSONObject) obj; |
| @@ -159,40 +158,40 @@ public class YiDunUrlResultJob { | @@ -159,40 +158,40 @@ public class YiDunUrlResultJob { | ||
| 159 | if (labelsLevel != 0) { | 158 | if (labelsLevel != 0) { |
| 160 | Integer label = jsonObjectone.getInteger("label"); | 159 | Integer label = jsonObjectone.getInteger("label"); |
| 161 | String name = ImageLabels.getName(label); | 160 | String name = ImageLabels.getName(label); |
| 162 | - labelMsg = labelMsg + name; | 161 | + labelMsg.append(name); |
| 163 | } | 162 | } |
| 164 | } | 163 | } |
| 165 | } | 164 | } |
| 166 | 165 | ||
| 167 | } | 166 | } |
| 168 | if (level == 1) { | 167 | if (level == 1) { |
| 169 | - desc = desc + "第" + (i + 1) + "张图片嫌疑" + labelMsg + ")"; | 168 | + desc.append("第").append(i + 1).append("张图片嫌疑").append(labelMsg).append(")"); |
| 170 | break; | 169 | break; |
| 171 | - } | ||
| 172 | - if (level == 2) { | ||
| 173 | - desc = desc + "第" + (i + 1) + "张图片违规" + labelMsg + ")"; | 170 | + } else if (level == 2) { |
| 171 | + desc.append("第").append(i + 1).append("张图片违规").append(labelMsg).append(")"); | ||
| 174 | break; | 172 | break; |
| 173 | + } else { | ||
| 174 | + desc.append(labelMsg).append(")"); | ||
| 175 | } | 175 | } |
| 176 | } | 176 | } |
| 177 | } | 177 | } |
| 178 | - // 领取状态为已审核 | ||
| 179 | - shyContent.setReceive_status(CommonConst.RECEIVE_AUDIT); | ||
| 180 | - shyContent.setShenhe_msg(desc); | ||
| 181 | - shyContent.setContent_status(CommonConst.AUDIT_REFUSE); | ||
| 182 | - newYiDunMsg.setDesc_msg(desc); | 178 | + newYiDunMsg.setDesc_msg(desc.toString()); |
| 183 | newYiDunMsg.setCheck_status(2); | 179 | newYiDunMsg.setCheck_status(2); |
| 184 | //修改图文状态 | 180 | //修改图文状态 |
| 185 | - contentServiceImpl.callback(yiDunMsg.getContent_id(), "机审审核拒绝", CommonConst.AUDIT_REFUSE, "", "机审"); | 181 | + contentServiceImpl.callback(String.valueOf(shyContent.getId()), desc.toString(), CommonConst.AUDIT_REFUSE, "", shyContent.getUpdater()); |
| 186 | } | 182 | } |
| 187 | } catch (NumberFormatException e) { | 183 | } catch (NumberFormatException e) { |
| 188 | e.printStackTrace(); | 184 | e.printStackTrace(); |
| 185 | + // 领取状态为已审 | ||
| 186 | + shyContent.setReceive_status(CommonConst.RECEIVE_AUDIT); | ||
| 187 | + shyContent.setContent_status(CommonConst.AUDIT_REFUSE); | ||
| 189 | //审核类型改为人工审核 | 188 | //审核类型改为人工审核 |
| 190 | shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_USER); | 189 | shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_USER); |
| 191 | //拒绝原因 | 190 | //拒绝原因 |
| 192 | shyContent.setShenhe_msg("易盾网站识别其它问题需排查"); | 191 | shyContent.setShenhe_msg("易盾网站识别其它问题需排查"); |
| 193 | newYiDunMsg.setDesc_msg("易盾网站识别其它问题需排查"); | 192 | newYiDunMsg.setDesc_msg("易盾网站识别其它问题需排查"); |
| 193 | + contentServiceImpl.updateshyContent(shyContent); | ||
| 194 | } | 194 | } |
| 195 | - contentServiceImpl.updateshyContent(shyContent); | ||
| 196 | yiDunServiceImpl.updateYiDunMsg(newYiDunMsg); | 195 | yiDunServiceImpl.updateYiDunMsg(newYiDunMsg); |
| 197 | } | 196 | } |
| 198 | } | 197 | } |
src/main/java/com/cnlive/shenhe/serviceImpl/ContentServiceImpl.java
| @@ -419,11 +419,11 @@ public class ContentServiceImpl { | @@ -419,11 +419,11 @@ public class ContentServiceImpl { | ||
| 419 | //审核类型,1:免审,2:机审,3:人工审 默认人工审 | 419 | //审核类型,1:免审,2:机审,3:人工审 默认人工审 |
| 420 | Integer shenheType = CommonConst.AUDIT_TYPE_USER; | 420 | Integer shenheType = CommonConst.AUDIT_TYPE_USER; |
| 421 | //如果当前sp是免审sp | 421 | //如果当前sp是免审sp |
| 422 | - if (sites.contains(spId)) { | 422 | + if (sites.contains(spId) || ContentTag.startsWith("cms_") || ContentTag.startsWith("edu_")) { |
| 423 | //免审 | 423 | //免审 |
| 424 | shenheType = CommonConst.AUDIT_TYPE_FREE; | 424 | shenheType = CommonConst.AUDIT_TYPE_FREE; |
| 425 | } else { | 425 | } else { |
| 426 | - if ("content".equals(ContentTag) || ContentTag.startsWith("cms_") || ContentTag.startsWith("edu_")) { | 426 | + if ("content".equals(ContentTag)) { |
| 427 | //机审 | 427 | //机审 |
| 428 | shenheType = CommonConst.AUDIT_TYPE_MACHANE; | 428 | shenheType = CommonConst.AUDIT_TYPE_MACHANE; |
| 429 | } | 429 | } |
| @@ -445,13 +445,12 @@ public class ContentServiceImpl { | @@ -445,13 +445,12 @@ public class ContentServiceImpl { | ||
| 445 | logger.info("审核云向易盾网站检测接口提交的url:{}", contentUrl); | 445 | logger.info("审核云向易盾网站检测接口提交的url:{}", contentUrl); |
| 446 | //调用易盾网站检测接口 | 446 | //调用易盾网站检测接口 |
| 447 | JSONObject jsonObject = YiDunAntiFraudUtil.submitYiDunUrl(contentUrl); | 447 | JSONObject jsonObject = YiDunAntiFraudUtil.submitYiDunUrl(contentUrl); |
| 448 | - | ||
| 449 | if (jsonObject != null) { | 448 | if (jsonObject != null) { |
| 450 | Integer code = jsonObject.getInteger("code"); | 449 | Integer code = jsonObject.getInteger("code"); |
| 451 | String msg = jsonObject.getString("msg"); | 450 | String msg = jsonObject.getString("msg"); |
| 452 | if (code != 200) { | 451 | if (code != 200) { |
| 453 | // |0待发布 |1已发布 |2已下线 | 452 | // |0待发布 |1已发布 |2已下线 |
| 454 | - callback(String.valueOf(shyContent.getId()), "机审审核拒绝", CommonConst.AUDIT_REFUSE, "", "机审"); | 453 | + callback(String.valueOf(shyContent.getId()), "机审审核拒绝", CommonConst.AUDIT_REFUSE, "", shyContent.getUpdater()); |
| 455 | } | 454 | } |
| 456 | JSONObject result = jsonObject.getJSONObject("result"); | 455 | JSONObject result = jsonObject.getJSONObject("result"); |
| 457 | String dataId = result.getString("dataId"); | 456 | String dataId = result.getString("dataId"); |