Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yaoai-video
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姚珂
yaoai-video
Commits
52c75644
Commit
52c75644
authored
May 28, 2026
by
yaoke.yk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导出视频合集多fix
parent
8c8e78a2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
12 deletions
+58
-12
AiTaskMapper.java
...n/src/main/java/com/yaoai/domain/mapper/AiTaskMapper.java
+12
-0
ShotAssetMapper.java
...rc/main/java/com/yaoai/domain/mapper/ShotAssetMapper.java
+15
-0
AssemblyPipelineServiceImpl.java
...ai/pipeline/service/impl/AssemblyPipelineServiceImpl.java
+31
-12
No files found.
yaoai-comic-studio/yaoai-domain/src/main/java/com/yaoai/domain/mapper/AiTaskMapper.java
View file @
52c75644
...
@@ -36,4 +36,16 @@ public interface AiTaskMapper extends BaseMapper<AiTask> {
...
@@ -36,4 +36,16 @@ public interface AiTaskMapper extends BaseMapper<AiTask> {
LIMIT #{limit}
LIMIT #{limit}
"""
)
"""
)
List
<
AiTask
>
findPollableVideoTasks
(
int
limit
);
List
<
AiTask
>
findPollableVideoTasks
(
int
limit
);
@Select
(
"""
SELECT * FROM ai_tasks
WHERE storyboard_id = #{storyboardId}
AND tenant_id = #{tenantId}
AND status = 'succeeded'
AND result_video_url IS NOT NULL
AND result_video_url <> ''
ORDER BY created_at DESC
LIMIT 1
"""
)
AiTask
findLatestSucceededVideoByStoryboard
(
Long
storyboardId
,
Long
tenantId
);
}
}
yaoai-comic-studio/yaoai-domain/src/main/java/com/yaoai/domain/mapper/ShotAssetMapper.java
View file @
52c75644
...
@@ -19,6 +19,21 @@ public interface ShotAssetMapper extends BaseMapper<ShotAsset> {
...
@@ -19,6 +19,21 @@ public interface ShotAssetMapper extends BaseMapper<ShotAsset> {
List
<
ShotAsset
>
findByStoryboard
(
@Param
(
"storyboardId"
)
Long
storyboardId
,
@Param
(
"tenantId"
)
Long
tenantId
);
List
<
ShotAsset
>
findByStoryboard
(
@Param
(
"storyboardId"
)
Long
storyboardId
,
@Param
(
"tenantId"
)
Long
tenantId
);
@Select
(
"""
@Select
(
"""
SELECT * FROM shot_assets
WHERE storyboard_id=#{storyboardId}
AND tenant_id=#{tenantId}
AND asset_type='video'
AND is_active=1
AND status='ready'
AND external_url IS NOT NULL
AND external_url <> ''
ORDER BY asset_version DESC, created_at DESC
LIMIT 1
"""
)
ShotAsset
findActiveReadyVideoByStoryboard
(
@Param
(
"storyboardId"
)
Long
storyboardId
,
@Param
(
"tenantId"
)
Long
tenantId
);
@Select
(
"""
SELECT a.* FROM shot_assets a
SELECT a.* FROM shot_assets a
LEFT JOIN storyboards s ON a.storyboard_id = s.id
LEFT JOIN storyboards s ON a.storyboard_id = s.id
LEFT JOIN ai_tasks t ON a.source_task_id = t.id AND a.tenant_id = t.tenant_id
LEFT JOIN ai_tasks t ON a.source_task_id = t.id AND a.tenant_id = t.tenant_id
...
...
yaoai-comic-studio/yaoai-pipeline/src/main/java/com/yaoai/pipeline/service/impl/AssemblyPipelineServiceImpl.java
View file @
52c75644
...
@@ -4,10 +4,14 @@ import cn.dev33.satoken.stp.StpUtil;
...
@@ -4,10 +4,14 @@ import cn.dev33.satoken.stp.StpUtil;
import
com.yaoai.billing.dto.BillingChargeRequest
;
import
com.yaoai.billing.dto.BillingChargeRequest
;
import
com.yaoai.billing.service.BillingService
;
import
com.yaoai.billing.service.BillingService
;
import
com.yaoai.common.context.UserContext
;
import
com.yaoai.common.context.UserContext
;
import
com.yaoai.domain.entity.AiTask
;
import
com.yaoai.domain.entity.AssemblyTask
;
import
com.yaoai.domain.entity.AssemblyTask
;
import
com.yaoai.domain.entity.ShotAsset
;
import
com.yaoai.domain.entity.ShotAsset
;
import
com.yaoai.domain.entity.Storyboard
;
import
com.yaoai.domain.mapper.AiTaskMapper
;
import
com.yaoai.domain.mapper.AssemblyTaskMapper
;
import
com.yaoai.domain.mapper.AssemblyTaskMapper
;
import
com.yaoai.domain.mapper.ShotAssetMapper
;
import
com.yaoai.domain.mapper.ShotAssetMapper
;
import
com.yaoai.domain.mapper.StoryboardMapper
;
import
com.yaoai.media.service.FfmpegService
;
import
com.yaoai.media.service.FfmpegService
;
import
com.yaoai.pipeline.service.AssemblyPipelineService
;
import
com.yaoai.pipeline.service.AssemblyPipelineService
;
import
com.yaoai.storage.service.TosService
;
import
com.yaoai.storage.service.TosService
;
...
@@ -19,6 +23,7 @@ import org.springframework.stereotype.Service;
...
@@ -19,6 +23,7 @@ import org.springframework.stereotype.Service;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Path
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.Executor
;
import
java.util.concurrent.Executor
;
...
@@ -28,7 +33,9 @@ import java.util.concurrent.Executor;
...
@@ -28,7 +33,9 @@ import java.util.concurrent.Executor;
public
class
AssemblyPipelineServiceImpl
implements
AssemblyPipelineService
{
public
class
AssemblyPipelineServiceImpl
implements
AssemblyPipelineService
{
private
final
AssemblyTaskMapper
assemblyTaskMapper
;
private
final
AssemblyTaskMapper
assemblyTaskMapper
;
private
final
StoryboardMapper
storyboardMapper
;
private
final
ShotAssetMapper
shotAssetMapper
;
private
final
ShotAssetMapper
shotAssetMapper
;
private
final
AiTaskMapper
aiTaskMapper
;
private
final
FfmpegService
ffmpegService
;
private
final
FfmpegService
ffmpegService
;
private
final
TosService
tosService
;
private
final
TosService
tosService
;
private
final
BillingService
billingService
;
private
final
BillingService
billingService
;
...
@@ -36,13 +43,17 @@ public class AssemblyPipelineServiceImpl implements AssemblyPipelineService {
...
@@ -36,13 +43,17 @@ public class AssemblyPipelineServiceImpl implements AssemblyPipelineService {
public
AssemblyPipelineServiceImpl
(
public
AssemblyPipelineServiceImpl
(
AssemblyTaskMapper
assemblyTaskMapper
,
AssemblyTaskMapper
assemblyTaskMapper
,
StoryboardMapper
storyboardMapper
,
ShotAssetMapper
shotAssetMapper
,
ShotAssetMapper
shotAssetMapper
,
AiTaskMapper
aiTaskMapper
,
FfmpegService
ffmpegService
,
FfmpegService
ffmpegService
,
TosService
tosService
,
TosService
tosService
,
BillingService
billingService
,
BillingService
billingService
,
@Qualifier
(
"assemblyExecutor"
)
Executor
assemblyExecutor
)
{
@Qualifier
(
"assemblyExecutor"
)
Executor
assemblyExecutor
)
{
this
.
assemblyTaskMapper
=
assemblyTaskMapper
;
this
.
assemblyTaskMapper
=
assemblyTaskMapper
;
this
.
storyboardMapper
=
storyboardMapper
;
this
.
shotAssetMapper
=
shotAssetMapper
;
this
.
shotAssetMapper
=
shotAssetMapper
;
this
.
aiTaskMapper
=
aiTaskMapper
;
this
.
ffmpegService
=
ffmpegService
;
this
.
ffmpegService
=
ffmpegService
;
this
.
tosService
=
tosService
;
this
.
tosService
=
tosService
;
this
.
billingService
=
billingService
;
this
.
billingService
=
billingService
;
...
@@ -90,19 +101,9 @@ public class AssemblyPipelineServiceImpl implements AssemblyPipelineService {
...
@@ -90,19 +101,9 @@ public class AssemblyPipelineServiceImpl implements AssemblyPipelineService {
Path
outputFile
=
null
;
Path
outputFile
=
null
;
try
{
try
{
List
<
ShotAsset
>
shots
=
shotAssetMapper
.
findActiveReadyVideosByEpisode
(
episodeId
,
task
.
getTenantId
());
List
<
String
>
urls
=
buildAssemblyUrls
(
episodeId
,
task
.
getTenantId
());
if
(
shots
.
isEmpty
())
{
fail
(
task
,
"没有可用的视频片段(需先生成每个镜头的视频)"
);
return
;
}
List
<
String
>
urls
=
shots
.
stream
()
.
map
(
ShotAsset:
:
getExternalUrl
)
.
filter
(
u
->
u
!=
null
&&
!
u
.
isBlank
())
.
toList
();
if
(
urls
.
isEmpty
())
{
if
(
urls
.
isEmpty
())
{
fail
(
task
,
"
所有镜头的视频 URL 为空
"
);
fail
(
task
,
"
没有可用的视频片段(需先生成每个镜头的视频)
"
);
return
;
return
;
}
}
...
@@ -142,6 +143,24 @@ public class AssemblyPipelineServiceImpl implements AssemblyPipelineService {
...
@@ -142,6 +143,24 @@ public class AssemblyPipelineServiceImpl implements AssemblyPipelineService {
}
}
}
}
private
List
<
String
>
buildAssemblyUrls
(
Long
episodeId
,
Long
tenantId
)
{
List
<
Storyboard
>
storyboards
=
storyboardMapper
.
findByEpisode
(
episodeId
,
tenantId
);
List
<
String
>
urls
=
new
ArrayList
<>();
for
(
Storyboard
storyboard
:
storyboards
)
{
AiTask
latestTask
=
aiTaskMapper
.
findLatestSucceededVideoByStoryboard
(
storyboard
.
getId
(),
tenantId
);
if
(
latestTask
!=
null
&&
latestTask
.
getResultVideoUrl
()
!=
null
&&
!
latestTask
.
getResultVideoUrl
().
isBlank
())
{
urls
.
add
(
latestTask
.
getResultVideoUrl
());
continue
;
}
ShotAsset
activeVideo
=
shotAssetMapper
.
findActiveReadyVideoByStoryboard
(
storyboard
.
getId
(),
tenantId
);
if
(
activeVideo
!=
null
&&
activeVideo
.
getExternalUrl
()
!=
null
&&
!
activeVideo
.
getExternalUrl
().
isBlank
())
{
urls
.
add
(
activeVideo
.
getExternalUrl
());
}
}
return
urls
;
}
private
void
fail
(
AssemblyTask
task
,
String
msg
)
{
private
void
fail
(
AssemblyTask
task
,
String
msg
)
{
task
.
setStatus
(
"failed"
);
task
.
setStatus
(
"failed"
);
task
.
setErrorMessage
(
msg
);
task
.
setErrorMessage
(
msg
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment