You've already forked FrameTour-BE
逻辑
This commit is contained in:
@ -52,11 +52,11 @@ public class VideoPieceGetter {
|
||||
@Data
|
||||
public static class Task {
|
||||
public String type = "normal";
|
||||
public Long deviceId;
|
||||
public Long faceSampleId;
|
||||
public Date createTime;
|
||||
public Callback callback;
|
||||
public Long memberId;
|
||||
public Long faceId;
|
||||
|
||||
public static interface Callback {
|
||||
void onInvoke();
|
||||
@ -88,8 +88,27 @@ public class VideoPieceGetter {
|
||||
return;
|
||||
}
|
||||
FaceSampleRespVO faceSample = faceSampleMapper.getById(task.getFaceSampleId());
|
||||
DeviceEntity device = deviceMapper.getByDeviceId(task.getDeviceId());
|
||||
DeviceConfigEntity config = deviceMapper.getConfigByDeviceId(task.getDeviceId());
|
||||
DeviceEntity device = deviceMapper.getByDeviceId(faceSample.getDeviceId());
|
||||
DeviceConfigEntity config = deviceMapper.getConfigByDeviceId(faceSample.getDeviceId());
|
||||
|
||||
SourceEntity source = sourceMapper.querySameVideo(faceSample.getId(), device.getId());
|
||||
if (source != null) {
|
||||
// 有原视频
|
||||
int count = sourceMapper.hasRelationTo(task.getMemberId(), source.getId(), 1);
|
||||
if (count > 0) {
|
||||
return;
|
||||
}
|
||||
MemberSourceEntity videoSource = new MemberSourceEntity();
|
||||
videoSource.setId(SnowFlakeUtil.getLongId());
|
||||
videoSource.setScenicId(faceSample.getScenicId());
|
||||
videoSource.setFaceId(task.getFaceId());
|
||||
videoSource.setMemberId(task.getMemberId());
|
||||
videoSource.setType(1);
|
||||
videoSource.setIsBuy(0);
|
||||
videoSource.setSourceId(source.getId());
|
||||
sourceMapper.addRelation(videoSource);
|
||||
return;
|
||||
}
|
||||
BigDecimal cutPre = BigDecimal.valueOf(5L);
|
||||
BigDecimal cutPost = BigDecimal.valueOf(4L);
|
||||
if (config == null) {
|
||||
@ -115,7 +134,7 @@ public class VideoPieceGetter {
|
||||
log.warn("没有可用的文件");
|
||||
return;
|
||||
}
|
||||
long offset = task.getCreateTime().getTime() - listByDtRange.get(0).getCreateTime().getTime() - cutPre.multiply(BigDecimal.valueOf(1000)).longValue();
|
||||
long offset = task.getCreateTime().getTime() - cutPre.multiply(BigDecimal.valueOf(1000)).longValue() - listByDtRange.get(0).getCreateTime().getTime();
|
||||
FfmpegTask ffmpegTask = new FfmpegTask();
|
||||
ffmpegTask.setFileList(listByDtRange);
|
||||
ffmpegTask.setDuration(duration);
|
||||
@ -144,7 +163,6 @@ public class VideoPieceGetter {
|
||||
}
|
||||
sourceEntity.setVideoUrl(url);
|
||||
sourceEntity.setFaceSampleId(faceSample.getId());
|
||||
sourceEntity.setMemberId(task.getMemberId());
|
||||
sourceEntity.setScenicId(faceSample.getScenicId());
|
||||
sourceEntity.setDeviceId(faceSample.getDeviceId());
|
||||
sourceEntity.setType(1);
|
||||
|
Reference in New Issue
Block a user