|
|
@ -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<SceneDetailResult> 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<SceneDetailResult> 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 { |
|
|
|