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..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.8 + 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 9bb20ac89a..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.8 + 0.3.11 epmet-openapi-scan jar 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..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 @@ -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()); + if (SuggestionEnum.PASS.getCode().equals(suggestion)) { + 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 { 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; /**