You've already forked FrameTour-BE
模板支持相同机位
This commit is contained in:
@@ -75,6 +75,7 @@ public class VideoPieceGetter {
|
||||
public Long memberId;
|
||||
public Long faceId;
|
||||
public Long templateId;
|
||||
public boolean force;
|
||||
|
||||
public static interface Callback {
|
||||
void onInvoke();
|
||||
@@ -170,6 +171,7 @@ public class VideoPieceGetter {
|
||||
} catch (InterruptedException ignore) {
|
||||
}
|
||||
}
|
||||
isFirst.set(false);
|
||||
if (pairDeviceMap.containsValue(faceSample.getDeviceId())) {
|
||||
// 有关联设备!
|
||||
// 找到对应的deviceId
|
||||
@@ -179,40 +181,18 @@ public class VideoPieceGetter {
|
||||
log.info("找到同景区关联设备:{} -> {}", pairDeviceId, faceSample.getDeviceId());
|
||||
if (pairDeviceId != null) {
|
||||
executor.execute(() -> {
|
||||
boolean result = doCut(pairDeviceId, faceSample.getId(), faceSample.getCreateAt(), task);
|
||||
if (templatePlaceholder != null) {
|
||||
if (templatePlaceholder.contains(faceSample.getDeviceId().toString())) {
|
||||
if (currentUnFinPlaceholder.contains(faceSample.getDeviceId().toString())) {
|
||||
if (result) {
|
||||
currentUnFinPlaceholder.remove(faceSample.getDeviceId().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("当前进度:!{}/{}", currentUnFinPlaceholder.size(), collection.size());
|
||||
if (currentUnFinPlaceholder.size() <= 0) {
|
||||
if (!invoke.get()) {
|
||||
invoke.set(true);
|
||||
task.getCallback().onInvoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
doCut(pairDeviceId, faceSample.getId(), faceSample.getCreateAt(), task);
|
||||
currentUnFinPlaceholder.remove(faceSample.getDeviceId().toString());
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
isFirst.set(false);
|
||||
executor.execute(() -> {
|
||||
boolean result = doCut(faceSample.getDeviceId(), faceSample.getId(), faceSample.getCreateAt(), task);
|
||||
doCut(faceSample.getDeviceId(), faceSample.getId(), faceSample.getCreateAt(), task);
|
||||
currentUnFinPlaceholder.remove(faceSample.getDeviceId().toString());
|
||||
if (templatePlaceholder != null) {
|
||||
if (templatePlaceholder.contains(faceSample.getDeviceId().toString())) {
|
||||
if (currentUnFinPlaceholder.contains(faceSample.getDeviceId().toString())) {
|
||||
if (result) {
|
||||
currentUnFinPlaceholder.remove(faceSample.getDeviceId().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("当前进度:!{}/{}", currentUnFinPlaceholder.size(), collection.size());
|
||||
if (currentUnFinPlaceholder.size() <= 0) {
|
||||
log.info("当前进度:!{}/{}", currentUnFinPlaceholder.size(), templatePlaceholder.size());
|
||||
if (currentUnFinPlaceholder.isEmpty()) {
|
||||
if (!invoke.get()) {
|
||||
invoke.set(true);
|
||||
task.getCallback().onInvoke();
|
||||
@@ -250,7 +230,7 @@ public class VideoPieceGetter {
|
||||
|
||||
SourceEntity source = sourceMapper.querySameVideo(faceSampleId, device.getId());
|
||||
|
||||
if (source == null) {
|
||||
if (source == null || task.force) {
|
||||
BigDecimal cutPre = BigDecimal.valueOf(5L);
|
||||
BigDecimal cutPost = BigDecimal.valueOf(4L);
|
||||
if (config != null) {
|
||||
@@ -299,38 +279,44 @@ public class VideoPieceGetter {
|
||||
// 上传成功后删除文件
|
||||
outFile.delete();
|
||||
}
|
||||
SourceEntity imgSource = sourceMapper.findBySampleId(faceSampleId);
|
||||
SourceEntity sourceEntity = new SourceEntity();
|
||||
sourceEntity.setId(SnowFlakeUtil.getLongId());
|
||||
sourceEntity.setCreateTime(baseTime);
|
||||
if (imgSource != null) {
|
||||
sourceEntity.setUrl(imgSource.getUrl());
|
||||
sourceEntity.setPosJson(imgSource.getPosJson());
|
||||
}
|
||||
sourceEntity.setVideoUrl(url);
|
||||
sourceEntity.setFaceSampleId(faceSampleId);
|
||||
sourceEntity.setScenicId(device.getScenicId());
|
||||
sourceEntity.setDeviceId(deviceId);
|
||||
sourceEntity.setType(1);
|
||||
if (task.memberId != null && task.faceId != null) {
|
||||
MemberSourceEntity videoSource = new MemberSourceEntity();
|
||||
videoSource.setMemberId(task.getMemberId());
|
||||
videoSource.setType(1);
|
||||
videoSource.setFaceId(task.getFaceId());
|
||||
videoSource.setScenicId(device.getScenicId());
|
||||
videoSource.setSourceId(sourceEntity.getId());
|
||||
IsBuyRespVO isBuy = orderBiz.isBuy(task.getMemberId(), device.getScenicId(), 1, task.getFaceId());
|
||||
if (isBuy.isBuy()) { // 如果用户买过
|
||||
videoSource.setIsBuy(1);
|
||||
} else if (isBuy.isFree()) { // 全免费逻辑
|
||||
videoSource.setIsBuy(1);
|
||||
} else {
|
||||
videoSource.setIsBuy(0);
|
||||
if (source == null) {
|
||||
SourceEntity imgSource = sourceMapper.findBySampleId(faceSampleId);
|
||||
SourceEntity sourceEntity = new SourceEntity();
|
||||
sourceEntity.setId(SnowFlakeUtil.getLongId());
|
||||
sourceEntity.setCreateTime(baseTime);
|
||||
if (imgSource != null) {
|
||||
sourceEntity.setUrl(imgSource.getUrl());
|
||||
sourceEntity.setPosJson(imgSource.getPosJson());
|
||||
}
|
||||
sourceMapper.addRelation(videoSource);
|
||||
sourceEntity.setVideoUrl(url);
|
||||
sourceEntity.setFaceSampleId(faceSampleId);
|
||||
sourceEntity.setScenicId(device.getScenicId());
|
||||
sourceEntity.setDeviceId(deviceId);
|
||||
sourceEntity.setType(1);
|
||||
if (task.memberId != null && task.faceId != null) {
|
||||
MemberSourceEntity videoSource = new MemberSourceEntity();
|
||||
videoSource.setMemberId(task.getMemberId());
|
||||
videoSource.setType(1);
|
||||
videoSource.setFaceId(task.getFaceId());
|
||||
videoSource.setScenicId(device.getScenicId());
|
||||
videoSource.setSourceId(sourceEntity.getId());
|
||||
IsBuyRespVO isBuy = orderBiz.isBuy(task.getMemberId(), device.getScenicId(), 1, task.getFaceId());
|
||||
if (isBuy.isBuy()) { // 如果用户买过
|
||||
videoSource.setIsBuy(1);
|
||||
} else if (isBuy.isFree()) { // 全免费逻辑
|
||||
videoSource.setIsBuy(1);
|
||||
} else {
|
||||
videoSource.setIsBuy(0);
|
||||
}
|
||||
sourceMapper.addRelation(videoSource);
|
||||
}
|
||||
sourceMapper.add(sourceEntity);
|
||||
videoReUploader.addTask(url, sourceEntity.getId());
|
||||
} else {
|
||||
source.setVideoUrl(url);
|
||||
sourceMapper.update(source);
|
||||
videoReUploader.addTask(url, source.getId());
|
||||
}
|
||||
sourceMapper.add(sourceEntity);
|
||||
videoReUploader.addTask(sourceEntity.getVideoUrl(), sourceEntity.getId());
|
||||
} else {
|
||||
// 有原视频
|
||||
if (task.memberId != null && task.faceId != null) {
|
||||
|
@@ -84,7 +84,7 @@ public class VideoTaskGenerator {
|
||||
query.setStartTime(DateUtil.beginOfDay(new Date()));
|
||||
query.setEndTime(DateUtil.endOfDay(new Date()));
|
||||
List<FaceRespVO> list = faceMapper.list(query);
|
||||
list.stream().parallel().forEach(face -> {
|
||||
list.forEach(face -> {
|
||||
faceService.matchFaceId(face.getId(), false);
|
||||
if (Integer.valueOf(3).equals(scenicConfig.getBookRoutine())) {
|
||||
// 全部生成
|
||||
|
Reference in New Issue
Block a user