You've already forked FrameTour-BE
2
This commit is contained in:
@ -129,7 +129,7 @@ public class VideoPieceGetter {
|
|||||||
new ArrayBlockingQueue<>(512),
|
new ArrayBlockingQueue<>(512),
|
||||||
threadFactory
|
threadFactory
|
||||||
);
|
);
|
||||||
List<String> currentPlaceholder = new ArrayList<>();
|
List<String> currentUnFinPlaceholder = new ArrayList<>();
|
||||||
List<FaceSampleEntity> list = faceSampleMapper.listByIds(task.getFaceSampleIds());
|
List<FaceSampleEntity> list = faceSampleMapper.listByIds(task.getFaceSampleIds());
|
||||||
Map<Long, Long> pairDeviceMap = new ConcurrentHashMap<>();
|
Map<Long, Long> pairDeviceMap = new ConcurrentHashMap<>();
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
@ -143,16 +143,24 @@ public class VideoPieceGetter {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Collection<List<FaceSampleEntity>> collection = list.stream()
|
Map<Long, List<FaceSampleEntity>> collection = list.stream()
|
||||||
.filter(faceSample -> {
|
.filter(faceSample -> {
|
||||||
if (templatePlaceholder != null) {
|
if (templatePlaceholder != null) {
|
||||||
return templatePlaceholder.contains(faceSample.getDeviceId().toString());
|
return templatePlaceholder.contains(faceSample.getDeviceId().toString());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
.collect(Collectors.groupingBy(FaceSampleEntity::getDeviceId))
|
.collect(Collectors.groupingBy(FaceSampleEntity::getDeviceId));
|
||||||
.values();
|
if (templatePlaceholder != null) {
|
||||||
collection.forEach(faceSampleList -> {
|
IntStream.range(0, templatePlaceholder.size()).forEach(i -> {
|
||||||
|
currentUnFinPlaceholder.add(templatePlaceholder.get(i));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
collection.keySet().forEach(i -> {
|
||||||
|
currentUnFinPlaceholder.add(i.toString());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
collection.values().forEach(faceSampleList -> {
|
||||||
executor.execute(() -> {
|
executor.execute(() -> {
|
||||||
AtomicBoolean isFirst = new AtomicBoolean(true);
|
AtomicBoolean isFirst = new AtomicBoolean(true);
|
||||||
faceSampleList.forEach(faceSample -> {
|
faceSampleList.forEach(faceSample -> {
|
||||||
@ -174,14 +182,14 @@ public class VideoPieceGetter {
|
|||||||
boolean result = doCut(pairDeviceId, faceSample.getId(), faceSample.getCreateAt(), task);
|
boolean result = doCut(pairDeviceId, faceSample.getId(), faceSample.getCreateAt(), task);
|
||||||
if (templatePlaceholder != null) {
|
if (templatePlaceholder != null) {
|
||||||
if (templatePlaceholder.contains(faceSample.getDeviceId().toString())) {
|
if (templatePlaceholder.contains(faceSample.getDeviceId().toString())) {
|
||||||
if (!currentPlaceholder.contains(faceSample.getDeviceId().toString())) {
|
if (currentUnFinPlaceholder.contains(faceSample.getDeviceId().toString())) {
|
||||||
if (result) {
|
if (result) {
|
||||||
currentPlaceholder.add(faceSample.getDeviceId().toString());
|
currentUnFinPlaceholder.remove(faceSample.getDeviceId().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info("当前进度:{}/{}", currentPlaceholder.size(), collection.size());
|
log.info("当前进度:!{}/{}", currentUnFinPlaceholder.size(), collection.size());
|
||||||
if (currentPlaceholder.size() >= collection.size()) {
|
if (currentUnFinPlaceholder.size() <= 0) {
|
||||||
if (!invoke.get()) {
|
if (!invoke.get()) {
|
||||||
invoke.set(true);
|
invoke.set(true);
|
||||||
task.getCallback().onInvoke();
|
task.getCallback().onInvoke();
|
||||||
@ -197,14 +205,14 @@ public class VideoPieceGetter {
|
|||||||
boolean result = doCut(faceSample.getDeviceId(), faceSample.getId(), faceSample.getCreateAt(), task);
|
boolean result = doCut(faceSample.getDeviceId(), faceSample.getId(), faceSample.getCreateAt(), task);
|
||||||
if (templatePlaceholder != null) {
|
if (templatePlaceholder != null) {
|
||||||
if (templatePlaceholder.contains(faceSample.getDeviceId().toString())) {
|
if (templatePlaceholder.contains(faceSample.getDeviceId().toString())) {
|
||||||
if (!currentPlaceholder.contains(faceSample.getDeviceId().toString())) {
|
if (currentUnFinPlaceholder.contains(faceSample.getDeviceId().toString())) {
|
||||||
if (result) {
|
if (result) {
|
||||||
currentPlaceholder.add(faceSample.getDeviceId().toString());
|
currentUnFinPlaceholder.remove(faceSample.getDeviceId().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info("当前进度:{}/{}", currentPlaceholder.size(), collection.size());
|
log.info("当前进度:!{}/{}", currentUnFinPlaceholder.size(), collection.size());
|
||||||
if (currentPlaceholder.size() >= collection.size()) {
|
if (currentUnFinPlaceholder.size() <= 0) {
|
||||||
if (!invoke.get()) {
|
if (!invoke.get()) {
|
||||||
invoke.set(true);
|
invoke.set(true);
|
||||||
task.getCallback().onInvoke();
|
task.getCallback().onInvoke();
|
||||||
|
Reference in New Issue
Block a user