You've already forked FrameTour-BE
feat(face):优化视频重切任务的样本选择逻辑
- 根据设备配置限制视频样本数量 - 实现按设备分组并应用数量限制- 更新视频重切任务中的样本ID列表 - 保留原有照片与视频数量比较逻辑
This commit is contained in:
@@ -72,6 +72,7 @@ import java.io.File;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -633,6 +634,7 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<Long> faceSampleIds = faceSampleList.stream()
|
List<Long> faceSampleIds = faceSampleList.stream()
|
||||||
|
.sorted(Comparator.comparing(FaceSampleEntity::getCreateAt).reversed())
|
||||||
.collect(Collectors.groupingBy(FaceSampleEntity::getDeviceId))
|
.collect(Collectors.groupingBy(FaceSampleEntity::getDeviceId))
|
||||||
.entrySet()
|
.entrySet()
|
||||||
.stream().flatMap(entry -> {
|
.stream().flatMap(entry -> {
|
||||||
|
@@ -166,6 +166,7 @@ public class TaskFaceServiceImpl implements TaskFaceService {
|
|||||||
memberRelationRepository.clearSCacheByFace(faceId);
|
memberRelationRepository.clearSCacheByFace(faceId);
|
||||||
List<FaceSampleEntity> faceSampleList = faceRepository.getFaceSampleList(faceId);
|
List<FaceSampleEntity> faceSampleList = faceRepository.getFaceSampleList(faceId);
|
||||||
List<Long> faceSampleIds = faceSampleList.stream()
|
List<Long> faceSampleIds = faceSampleList.stream()
|
||||||
|
.sorted(Comparator.comparing(FaceSampleEntity::getCreateAt).reversed())
|
||||||
.collect(Collectors.groupingBy(FaceSampleEntity::getDeviceId))
|
.collect(Collectors.groupingBy(FaceSampleEntity::getDeviceId))
|
||||||
.entrySet()
|
.entrySet()
|
||||||
.stream().flatMap(entry -> {
|
.stream().flatMap(entry -> {
|
||||||
|
@@ -69,6 +69,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -269,7 +270,9 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
log.info("faceId:{} faceSampleList is empty", faceId);
|
log.info("faceId:{} faceSampleList is empty", faceId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<Long> faceSampleIds = faceSampleList.stream().collect(Collectors.groupingBy(FaceSampleEntity::getDeviceId)).entrySet()
|
List<Long> faceSampleIds = faceSampleList.stream()
|
||||||
|
.sorted(Comparator.comparing(FaceSampleEntity::getCreateAt).reversed())
|
||||||
|
.collect(Collectors.groupingBy(FaceSampleEntity::getDeviceId)).entrySet()
|
||||||
.stream().flatMap(entry -> {
|
.stream().flatMap(entry -> {
|
||||||
DeviceConfigManager configManager = deviceRepository.getDeviceConfigManager(entry.getKey());
|
DeviceConfigManager configManager = deviceRepository.getDeviceConfigManager(entry.getKey());
|
||||||
if (configManager.getInteger("limit_video", 0) > 0) {
|
if (configManager.getInteger("limit_video", 0) > 0) {
|
||||||
@@ -344,7 +347,9 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Long> faceSampleIds = faceSampleList.stream().collect(Collectors.groupingBy(FaceSampleEntity::getDeviceId)).entrySet()
|
List<Long> faceSampleIds = faceSampleList.stream()
|
||||||
|
.sorted(Comparator.comparing(FaceSampleEntity::getCreateAt).reversed())
|
||||||
|
.collect(Collectors.groupingBy(FaceSampleEntity::getDeviceId)).entrySet()
|
||||||
.stream().flatMap(entry -> {
|
.stream().flatMap(entry -> {
|
||||||
DeviceConfigManager configManager = deviceRepository.getDeviceConfigManager(entry.getKey());
|
DeviceConfigManager configManager = deviceRepository.getDeviceConfigManager(entry.getKey());
|
||||||
if (configManager.getInteger("limit_video", 0) > 0) {
|
if (configManager.getInteger("limit_video", 0) > 0) {
|
||||||
|
Reference in New Issue
Block a user