TASK: cloud、posetransfer;

This commit is contained in:
shahaibo
2025-06-17 16:25:57 +08:00
parent 5e066995e8
commit 137ef7045b
6 changed files with 19 additions and 0 deletions

View File

@@ -2,10 +2,15 @@ package com.ai.da.mapper.primary;
import com.ai.da.common.config.mybatis.plus.CommonMapper;
import com.ai.da.mapper.primary.entity.CloudTask;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
public interface CloudTaskMapper extends CommonMapper<CloudTask> {
@Update("UPDATE cloud_task SET completed_num = completed_num + 1, update_time = NOW() WHERE task_id = #{taskIdBatch}")
@Options(useGeneratedKeys = false, flushCache = Options.FlushCachePolicy.TRUE)
void increaseCompletedNum(@Param("taskIdBatch") String taskIdBatch);
@Select("SELECT * FROM cloud_task WHERE task_id = #{taskId} FOR UPDATE")
CloudTask selectForUpdate(String taskId);
}

View File

@@ -32,6 +32,8 @@ public class PoseTransformationVO implements AllCollectionVO{
private Long userLikeSortId;
private String relationType;
private Long parentId;
public PoseTransformationVO(Long id, String taskId, String gifUrl, String videoUrl, String firstFrameUrl, byte isLiked, String status) {
this.id = id;
this.taskId = taskId;

View File

@@ -10,4 +10,5 @@ public class ToProductImageResultVO extends ToProductImageResult implements AllC
private Integer sort;
private Long userLikeSortId;
private String relationType;
private Long parentId;
}

View File

@@ -1269,6 +1269,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
qw.lambda().eq(CollectionSort::getProjectId, projectId);
if (null != parentId) {
qw.lambda().eq(CollectionSort::getParentId, parentId);
}else {
qw.lambda().isNull(CollectionSort::getParentId);
}
List<CollectionSort> userLikeSorts = collectionSortMapper.selectList(qw);
if (CollectionUtils.isEmpty(userLikeSorts)) {
@@ -2515,6 +2517,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
}
@Override
@Transactional
public void processDesignBatch(Map<String, Object> designBatchResult) {
Object progress = designBatchResult.get("progress");
if (progress instanceof String) {

View File

@@ -1426,6 +1426,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
}
@Override
@Transactional
public void processPoseTransformResultBatch(String taskId, String gifUrl, String videoUrl, String imageUrl, String progress) {
// 1、存储模型返回的数据
PoseTransformation poseTransformation;

View File

@@ -1706,6 +1706,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
toProductImageResultVO.setSort(userLikeSort.getSort());
toProductImageResultVO.setUserLikeSortId(userLikeSort.getId());
toProductImageResultVO.setRelationType(userLikeSort.getRelationType());
toProductImageResultVO.setParentId(userLikeSort.getParentId());
childList.add(toProductImageResultVO);
} else if (userLikeSort.getRelationType().equals(CollectionType.RELIGHT.getValue())) {
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(userLikeSort.getRelationId());
@@ -1726,6 +1727,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
toProductImageResultVO.setSort(userLikeSort.getSort());
toProductImageResultVO.setUserLikeSortId(userLikeSort.getId());
toProductImageResultVO.setRelationType(userLikeSort.getRelationType());
toProductImageResultVO.setParentId(userLikeSort.getParentId());
childList.add(toProductImageResultVO);
} else if (userLikeSort.getRelationType().equals(CollectionType.POSE_TRANSFORM.getValue())) {
PoseTransformation item = poseTransformationMapper.selectById(userLikeSort.getRelationId());
@@ -1741,6 +1743,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
poseTransformationVO.setUserLikeSortId(userLikeSort.getId());
poseTransformationVO.setRelationType(userLikeSort.getRelationType());
poseTransformationVO.setResultType(CollectionType.POSE_TRANSFORM.getValue());
poseTransformationVO.setParentId(userLikeSort.getParentId());
childList.add(poseTransformationVO);
}
}
@@ -2529,6 +2532,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
}
@Override
@Transactional
public void toProductBatch(String taskId, String url, String progress) {
QueryWrapper<ToProductImageResult> qw = new QueryWrapper<>();
qw.lambda().eq(ToProductImageResult::getTaskId, taskId);
@@ -2538,6 +2542,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
toProductImageResultMapper.updateById(toProductImageResult);
String taskIdBatch = toProductImageResult.getTaskIdBatch();
log.info("toProductImage云生成 batchTaskId:" + taskIdBatch + " 完成数+1");
CloudTask task = cloudTaskMapper.selectForUpdate(taskIdBatch);
cloudTaskMapper.increaseCompletedNum(taskIdBatch);
String key = toProductImageResultKey + ":" + taskId;
@@ -2561,6 +2567,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
}
@Override
@Transactional
public void relightBatch(String taskId, String url, String progress) {
QueryWrapper<ToProductImageResult> qw = new QueryWrapper<>();
qw.lambda().eq(ToProductImageResult::getTaskId, taskId);