@@ -40,6 +40,8 @@ import java.nio.file.Paths;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
|
||||||
|
import static java.awt.SystemColor.info;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@@ -164,20 +166,6 @@ public class ImageFoundRequestHandler implements RequestHandler {
|
|||||||
File file = tempFile.toFile();
|
File file = tempFile.toFile();
|
||||||
// String filePath = tempFile.toAbsolutePath().toString();
|
// String filePath = tempFile.toAbsolutePath().toString();
|
||||||
NoCopyCheckResult checkResult = noCopyFileService.checkFile(file, FileProtector.Type.IMAGE);
|
NoCopyCheckResult checkResult = noCopyFileService.checkFile(file, FileProtector.Type.IMAGE);
|
||||||
log.info("checkResult: " + checkResult);
|
|
||||||
log.info("checkResult: " + checkResult);
|
|
||||||
log.info("checkResult: " + checkResult);
|
|
||||||
log.info("checkResult: " + checkResult);
|
|
||||||
log.info("checkResult: " + checkResult);
|
|
||||||
log.info("checkResult: " + checkResult);
|
|
||||||
log.info("checkResult: " + checkResult);
|
|
||||||
log.info("checkResult: " + checkResult);
|
|
||||||
log.info("checkResult: " + checkResult);
|
|
||||||
log.info("checkResult: " + checkResult);
|
|
||||||
log.info("checkResult: " + checkResult);
|
|
||||||
log.info("checkResult: " + checkResult);
|
|
||||||
log.info("checkResult: " + checkResult);
|
|
||||||
log.info("checkResult: " + checkResult);
|
|
||||||
// Map<String, Long> hashSearchApiFile = imageHashService.calculateHash(Paths.get(filePath));
|
// Map<String, Long> hashSearchApiFile = imageHashService.calculateHash(Paths.get(filePath));
|
||||||
// ImageHashEntity checkFileHash = imageHashRepository.findByFileId(fileId);
|
// ImageHashEntity checkFileHash = imageHashRepository.findByFileId(fileId);
|
||||||
|
|
||||||
@@ -185,17 +173,10 @@ public class ImageFoundRequestHandler implements RequestHandler {
|
|||||||
// && hashSearchApiFile.get("low").equals(checkFileHash.getHash64Lo());
|
// && hashSearchApiFile.get("low").equals(checkFileHash.getHash64Lo());
|
||||||
switch (checkResult) {
|
switch (checkResult) {
|
||||||
case ImageCheckResult.Success success -> {
|
case ImageCheckResult.Success success -> {
|
||||||
FileProtector.FileInfo info = success.getInfo();
|
double watermarkCorrelation = success.getWatermarkCorrelation();
|
||||||
log.info("info: " + info);
|
log.info("watermarkCorrelation: " + watermarkCorrelation);
|
||||||
log.info("info: " + info);
|
|
||||||
log.info("info: " + info);
|
if (watermarkCorrelation < 50.0) {
|
||||||
log.info("info: " + info);
|
|
||||||
log.info("info: " + info);
|
|
||||||
log.info("info: " + info);
|
|
||||||
log.info("info: " + info);
|
|
||||||
log.info("info: " + info);
|
|
||||||
FileEntity entity = fileEntityRepository.findByFileId(info.getId());
|
|
||||||
if (entity == null) {
|
|
||||||
return new BaseResponse(request.getMsgId(), MessageCode.SUCCESS.getCode(),
|
return new BaseResponse(request.getMsgId(), MessageCode.SUCCESS.getCode(),
|
||||||
"Not found similar pictures", new YandexSearchResponse());
|
"Not found similar pictures", new YandexSearchResponse());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user