This commit is contained in:
@@ -106,3 +106,19 @@ CHECK (status IN (
|
|||||||
'TEMP'
|
'TEMP'
|
||||||
));
|
));
|
||||||
|
|
||||||
|
-------
|
||||||
|
Записи для лимитов поиска
|
||||||
|
|
||||||
|
INSERT INTO protect_check (user_id, limit_check, count_checked, last_check_at, version)
|
||||||
|
SELECT
|
||||||
|
u.id,
|
||||||
|
100, -- limit_check = 100
|
||||||
|
0, -- count_checked = 0
|
||||||
|
NULL, -- last_check_at = NULL
|
||||||
|
0 -- version = 0
|
||||||
|
FROM users u
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM protect_check pc
|
||||||
|
WHERE pc.user_id = u.id
|
||||||
|
);
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ public class ImageHashService {
|
|||||||
|
|
||||||
public Map<String, Long> calculateHash(Path imagePath) throws IOException {
|
public Map<String, Long> calculateHash(Path imagePath) throws IOException {
|
||||||
File file = imagePath.toFile();
|
File file = imagePath.toFile();
|
||||||
|
|
||||||
PHash pHash = PerceptualHashHelper.INSTANCE.generateDCTPerceptualHash(file);
|
PHash pHash = PerceptualHashHelper.INSTANCE.generateDCTPerceptualHash(file);
|
||||||
|
|
||||||
Long firstPart = pHash.getFirstPart();
|
Long firstPart = pHash.getFirstPart();
|
||||||
Long secondPart = pHash.getSecondPart();
|
Long secondPart = pHash.getSecondPart();
|
||||||
Map<String, Long> hash = Map.of(
|
Map<String, Long> hash = Map.of(
|
||||||
|
|||||||
@@ -358,11 +358,13 @@ public class FileUploadServiceImpl implements FileUploadService {
|
|||||||
|
|
||||||
private String assembleFileSynchronously(FileUploadSession session) throws IOException {
|
private String assembleFileSynchronously(FileUploadSession session) throws IOException {
|
||||||
Path finalFilePath = prepareFinalFile(session);
|
Path finalFilePath = prepareFinalFile(session);
|
||||||
|
log.info("file path: " + finalFilePath);
|
||||||
validateAllChunksExist(session);
|
validateAllChunksExist(session);
|
||||||
|
log.info("validateAllChunksExist : " + session);
|
||||||
mergeChunksToFile(session, finalFilePath);
|
mergeChunksToFile(session, finalFilePath);
|
||||||
|
log.info("mergeChunksToFile: " + session);
|
||||||
validateFinalFile(session, finalFilePath);
|
validateFinalFile(session, finalFilePath);
|
||||||
|
log.info("finalFilePath: " + finalFilePath);
|
||||||
return finalFilePath.toString();
|
return finalFilePath.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user