Commit 1f6cbae11ee228d15eba3ecfcadf2c30a3260a37

Authored by 徐近程
1 parent 5e783e7e

易盾网站检测update

src/main/java/com/cnlive/shenhe/job/ContentJob.java
... ... @@ -57,7 +57,7 @@ public class ContentJob {
57 57 /**
58 58 * 定时向易盾提交网站地址
59 59 */
60   - //@Scheduled(cron = "0 0/1 * * * ? ")//每分钟一次
  60 + @Scheduled(cron = "0 0/1 * * * ? ")//每分钟一次
61 61 public void videofilter() {
62 62 ShyContent shyContent = new ShyContent();
63 63 //机审
... ...
src/main/java/com/cnlive/shenhe/job/YiDunUrlResultJob.java
... ... @@ -54,7 +54,7 @@ public class YiDunUrlResultJob {
54 54 /**
55 55 * 定时查询易盾网站检测结果接口
56 56 */
57   - //@Scheduled(cron = "0 0/1 * * * ? ")//每分钟一次
  57 + @Scheduled(cron = "0 0/1 * * * ? ")//每分钟一次
58 58 public void YiDunUrl() {
59 59 try {
60 60 Map<String, String> params = new HashMap<String, String>(5);
... ... @@ -79,72 +79,82 @@ public class YiDunUrlResultJob {
79 79 //易盾返回结果的类型
80 80 String type;
81 81 //易盾失败结果的详情
82   - String desc = "";
  82 + String desc = "易盾网站审核";
83 83 if (code == 200 && "ok".equals(msg)) {
84 84 JSONArray resultJSONArray = resultObject.getJSONArray("result");
85   - if(resultJSONArray!=null&&resultJSONArray.size()>0){
  85 + if (resultJSONArray != null && resultJSONArray.size() > 0) {
86 86 for (int i = 0; i < resultJSONArray.size(); i++) {
87   - ShyContent shyContent = new ShyContent();
88   - JSONObject jsonObject = resultJSONArray.getJSONObject(i);
89   - String dataId = jsonObject.getString("dataId");
90   - ShyYidun yiDunMsg = yiDunServiceImpl.getYiDunMsg(dataId);
91 87 ShyYidun newYiDunMsg = new ShyYidun();
92   - newYiDunMsg.setId(yiDunMsg.getId());
93   - newYiDunMsg.setDuration(-1);
94   - newYiDunMsg.setUpdate_time(new Date());
95   - shyContent.setId(Integer.valueOf(yiDunMsg.getContent_id()));
96   - //检测结果, 1:正常(建议通过) 2:异常(建议拦截) 3:疑似(建议人工确认)0:无结果(检测失败)
97   - int result = jsonObject.getIntValue("result");
98   - newYiDunMsg.setResult_type(String.valueOf(result));
99   - if (result == 1) {
100   - desc = "易盾审核通过了";
101   - shyContent.setShenhe_msg(desc);
102   - newYiDunMsg.setDesc_msg(desc);
103   - //修改图文状态
104   - contentServiceImpl.callback(yiDunMsg.getContent_id(), desc, CommonConst.AUDIT_SUCCESS, "", "机审通过");
105   - } else {
106   - JSONObject evidences = jsonObject.getJSONObject("evidences");
107   - JSONArray texts = evidences.getJSONArray("texts");
108   - if (texts != null && texts.size() > 0) {
109   - for (int j = 0; j < texts.size(); j++) {
110   - JSONObject jsonObject1 = texts.getJSONObject(j);
111   - //检测结果,0:通过,1:嫌疑,2:不通过
112   - int action = jsonObject1.getIntValue("action");
113   - if (action == 1) {
114   - desc = desc + "文字嫌疑";
115   - break;
116   - }
117   - if (action == 2) {
118   - desc = desc + "文字违规";
119   - break;
  88 + ShyContent shyContent = new ShyContent();
  89 + try {
  90 + JSONObject jsonObject = resultJSONArray.getJSONObject(i);
  91 + String dataId = jsonObject.getString("dataId");
  92 + ShyYidun yiDunMsg = yiDunServiceImpl.getYiDunMsg(dataId);
  93 + newYiDunMsg.setId(yiDunMsg.getId());
  94 + newYiDunMsg.setDuration(-1);
  95 + newYiDunMsg.setUpdate_time(new Date());
  96 + shyContent.setId(Integer.valueOf(yiDunMsg.getContent_id()));
  97 + //检测结果, 1:正常(建议通过) 2:异常(建议拦截) 3:疑似(建议人工确认)0:无结果(检测失败)
  98 + int result = jsonObject.getIntValue("result");
  99 + newYiDunMsg.setResult_type(String.valueOf(result));
  100 + if (result == 1) {
  101 + desc = "通过了";
  102 + shyContent.setShenhe_msg(desc);
  103 + newYiDunMsg.setDesc_msg(desc);
  104 + //修改图文状态
  105 + contentServiceImpl.callback(yiDunMsg.getContent_id(), desc, CommonConst.AUDIT_SUCCESS, "", "机审通过");
  106 + } else {
  107 + JSONObject evidences = jsonObject.getJSONObject("evidences");
  108 + JSONArray texts = evidences.getJSONArray("texts");
  109 + if (texts != null && texts.size() > 0) {
  110 + for (int j = 0; j < texts.size(); j++) {
  111 + JSONObject jsonObject1 = texts.getJSONObject(j);
  112 + //检测结果,0:通过,1:嫌疑,2:不通过
  113 + int action = jsonObject1.getIntValue("action");
  114 + if (action == 1) {
  115 + desc = desc + "文字嫌疑";
  116 + break;
  117 + }
  118 + if (action == 2) {
  119 + desc = desc + "文字违规";
  120 + break;
  121 + }
120 122 }
121 123 }
122   - }
123   - JSONArray images = evidences.getJSONArray("images");
124   - if (images != null && images.size() > 0) {
125   - for (int k = 0; k < images.size(); k++){
126   - JSONObject jsonObject1 = images.getJSONObject(k);
127   - //0:正常,1:不确定,2:确定
128   - int level = jsonObject1.getIntValue("level");
129   - if (level == 1) {
130   - desc = desc + "图片嫌疑";
131   - break;
132   - }
133   - if (level == 2) {
134   - desc = desc + "图片违规";
135   - break;
  124 + JSONArray images = evidences.getJSONArray("images");
  125 + if (images != null && images.size() > 0) {
  126 + for (int k = 0; k < images.size(); k++) {
  127 + JSONObject jsonObject1 = images.getJSONObject(k);
  128 + //0:正常,1:不确定,2:确定
  129 + int level = jsonObject1.getIntValue("level");
  130 + if (level == 1) {
  131 + desc = desc + "第" + (i + 1) + "图片嫌疑";
  132 + break;
  133 + }
  134 + if (level == 2) {
  135 + desc = desc + "第" + (i + 1) + "图片违规";
  136 + break;
  137 + }
136 138 }
137 139 }
138   - }
139 140  
  141 + //审核类型改为人工审核
  142 + shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_USER);
  143 + //拒绝原因
  144 + shyContent.setShenhe_msg(desc);
  145 + newYiDunMsg.setDesc_msg(desc);
  146 +
  147 + desc = "";
  148 + }
  149 + } catch (NumberFormatException e) {
  150 + e.printStackTrace();
140 151 //审核类型改为人工审核
141 152 shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_USER);
142 153 //拒绝原因
143   - shyContent.setShenhe_msg(desc);
144   - newYiDunMsg.setDesc_msg(desc);
145   - contentServiceImpl.updateshyContent(shyContent);
146   - desc="";
  154 + shyContent.setShenhe_msg("易盾网站识别其它问题需排查");
  155 + newYiDunMsg.setDesc_msg("易盾网站识别其它问题需排查");
147 156 }
  157 + contentServiceImpl.updateshyContent(shyContent);
148 158 yiDunServiceImpl.updateYiDunMsg(newYiDunMsg);
149 159 }
150 160 }
... ... @@ -152,6 +162,5 @@ public class YiDunUrlResultJob {
152 162 } catch (Exception e) {
153 163 e.printStackTrace();
154 164 }
155   -
156 165 }
157 166 }
... ...