@@ -4,6 +4,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||||||
import com.vrt.NoCopyFileService;
|
import com.vrt.NoCopyFileService;
|
||||||
import com.vrt.fileprotection.FileProtector;
|
import com.vrt.fileprotection.FileProtector;
|
||||||
import com.vrt.fileprotection.NoCopyCheckResult;
|
import com.vrt.fileprotection.NoCopyCheckResult;
|
||||||
|
import com.vrt.fileprotection.documents.DocumentCheckResult;
|
||||||
|
import com.vrt.fileprotection.image.ImageCheckResult;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -181,11 +183,25 @@ public class ImageFoundRequestHandler implements RequestHandler {
|
|||||||
|
|
||||||
// boolean hashesAreEqual = hashSearchApiFile.get("hi").equals(checkFileHash.getHash64Hi())
|
// boolean hashesAreEqual = hashSearchApiFile.get("hi").equals(checkFileHash.getHash64Hi())
|
||||||
// && hashSearchApiFile.get("low").equals(checkFileHash.getHash64Lo());
|
// && hashSearchApiFile.get("low").equals(checkFileHash.getHash64Lo());
|
||||||
|
switch (checkResult) {
|
||||||
// if (!hashesAreEqual) {
|
case ImageCheckResult.Success success -> {
|
||||||
// return new BaseResponse(request.getMsgId(), MessageCode.SUCCESS.getCode(),
|
FileProtector.FileInfo info = success.getInfo();
|
||||||
// "Not found similar pictures", new YandexSearchResponse());
|
log.info("info: " + info);
|
||||||
// }
|
log.info("info: " + info);
|
||||||
|
log.info("info: " + info);
|
||||||
|
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(),
|
||||||
|
"Not found similar pictures", new YandexSearchResponse());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default -> throw new IllegalStateException("Unexpected value: " + checkResult);
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (tempFile != null) {
|
if (tempFile != null) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user