From 2452395e4a4bb4bf5780376636e1341997f5fcd5 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 18 Jun 2020 18:29:03 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E6=98=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scan/service/impl/ScanServiceImpl.java | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java index 6848de234f..3637fa5163 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java @@ -12,7 +12,6 @@ import com.aliyuncs.green.model.v20180509.TextScanRequest; import com.aliyuncs.http.FormatType; import com.aliyuncs.http.HttpResponse; import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.openapi.scan.common.constant.SysConstant; import com.epmet.openapi.scan.common.enu.ImgSceneEnum; import com.epmet.openapi.scan.common.enu.SuggestionEnum; @@ -24,9 +23,9 @@ import com.epmet.openapi.scan.support.param.ImgScanParam; import com.epmet.openapi.scan.support.param.ImgTask; import com.epmet.openapi.scan.support.param.TextScanParam; import com.epmet.openapi.scan.support.param.TextTask; -import com.epmet.openapi.scan.support.result.SceneDetailResult; import com.epmet.openapi.scan.support.result.ImgAsyncScanResult; import com.epmet.openapi.scan.support.result.ScanTaskResult; +import com.epmet.openapi.scan.support.result.SceneDetailResult; import com.epmet.openapi.scan.support.result.SyncScanResult; import lombok.extern.slf4j.Slf4j; import org.apache.http.HttpStatus; @@ -189,14 +188,19 @@ public class ScanServiceImpl implements ScanService { //如果是多个场景 则为对个 BaseScanResult List sceneResults = taskResult.getResults(); //是文本检测 目前就一种场景 + boolean isSuccess = true; for (SceneDetailResult sceneResult : sceneResults) { String suggestion = sceneResult.getSuggestion(); if (SuggestionEnum.BLOCK.getCode().equals(suggestion)) { - result.getFailDataIds().add(taskResult.getDataId()); - } else { - result.getSuccessDataIds().add(taskResult.getDataId()); + isSuccess = false; + break; } } + if (isSuccess){ + result.getFailDataIds().add(taskResult.getDataId()); + } else { + result.getSuccessDataIds().add(taskResult.getDataId()); + } } else { result.getFailDataIds().add(taskResult.getDataId()); log.warn("executeSyncText task process fail:code:{},msg:{}", taskResult.getCode(), taskResult.getMsg()); @@ -284,21 +288,20 @@ public class ScanServiceImpl implements ScanService { } //如果是多个场景 则为对个 BaseScanResult List sceneResults = taskResult.getResults(); - //是文本检测 目前就一种场景 + + boolean isSuccess = true; for (SceneDetailResult sceneResult : sceneResults) { String suggestion = sceneResult.getSuggestion(); if (SuggestionEnum.BLOCK.getCode().equals(suggestion)) { - if (result.getFailDataIds().contains(taskResult.getDataId())) { - continue; - } - result.getFailDataIds().add(taskResult.getDataId()); - } else { - if (result.getSuccessDataIds().contains(taskResult.getDataId())) { - continue; - } - result.getSuccessDataIds().add(taskResult.getDataId()); + isSuccess = false; + break; } } + if (isSuccess){ + result.getSuccessDataIds().add(taskResult.getDataId()); + }else{ + result.getFailDataIds().add(taskResult.getDataId()); + } } return result; } else { From 0e02f8bac69645dd8929c3cf603642ee15f8a07e Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 18 Jun 2020 18:30:42 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7+1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml | 2 +- epmet-openapi/epmet-openapi-scan/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml index 5802d6a79c..c3ff2265ed 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.8 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.9 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/pom.xml b/epmet-openapi/epmet-openapi-scan/pom.xml index 9bb20ac89a..a03207ea82 100644 --- a/epmet-openapi/epmet-openapi-scan/pom.xml +++ b/epmet-openapi/epmet-openapi-scan/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.3.8 + 0.3.9 epmet-openapi-scan jar From b0befb6132ad60df3cc5d981321e967236869468 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 18 Jun 2020 18:46:29 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/openapi/scan/support/param/TextScanParam.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextScanParam.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextScanParam.java index 16ad063428..2b05d34e20 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextScanParam.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextScanParam.java @@ -26,14 +26,14 @@ public class TextScanParam implements Serializable { * * @see com.epmet.openapi.scan.common.enu.ImgSceneEnum; */ - @Valid - @NotEmpty(message = "任务列表不能为空") private List scenes; /** * 要检测的内容列表,必填 * remark:一组任务列表中的taskId不能相同 */ + @Valid + @NotEmpty(message = "任务列表不能为空") private List tasks; /** From 3c42e33b8b30d7093e902f4214ae1feb9a326063 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 18 Jun 2020 18:48:06 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7+1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml | 2 +- epmet-openapi/epmet-openapi-scan/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml index c3ff2265ed..9f4185c482 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.9 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.10 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/pom.xml b/epmet-openapi/epmet-openapi-scan/pom.xml index a03207ea82..7e4f5951f2 100644 --- a/epmet-openapi/epmet-openapi-scan/pom.xml +++ b/epmet-openapi/epmet-openapi-scan/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.3.9 + 0.3.10 epmet-openapi-scan jar From 2a71e82a0f512922c272de005be4546bb875c50c Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 18 Jun 2020 18:51:52 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/openapi/scan/service/impl/ScanServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java index 3637fa5163..709fc7aef4 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java @@ -191,7 +191,7 @@ public class ScanServiceImpl implements ScanService { boolean isSuccess = true; for (SceneDetailResult sceneResult : sceneResults) { String suggestion = sceneResult.getSuggestion(); - if (SuggestionEnum.BLOCK.getCode().equals(suggestion)) { + if (SuggestionEnum.PASS.getCode().equals(suggestion)) { isSuccess = false; break; } From 3b07a345b37951ce910c668cd5c3a0ebb5da4eeb Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 18 Jun 2020 18:52:54 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7+1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml | 2 +- epmet-openapi/epmet-openapi-scan/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml index 9f4185c482..10c2835084 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.10 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.11 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/pom.xml b/epmet-openapi/epmet-openapi-scan/pom.xml index 7e4f5951f2..8a80b425df 100644 --- a/epmet-openapi/epmet-openapi-scan/pom.xml +++ b/epmet-openapi/epmet-openapi-scan/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.3.10 + 0.3.11 epmet-openapi-scan jar