TASK: cloud、posetransfer;
This commit is contained in:
@@ -2,10 +2,15 @@ package com.ai.da.mapper.primary;
|
|||||||
|
|
||||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||||
import com.ai.da.mapper.primary.entity.CloudTask;
|
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.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
import org.apache.ibatis.annotations.Update;
|
import org.apache.ibatis.annotations.Update;
|
||||||
|
|
||||||
public interface CloudTaskMapper extends CommonMapper<CloudTask> {
|
public interface CloudTaskMapper extends CommonMapper<CloudTask> {
|
||||||
@Update("UPDATE cloud_task SET completed_num = completed_num + 1, update_time = NOW() WHERE task_id = #{taskIdBatch}")
|
@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);
|
void increaseCompletedNum(@Param("taskIdBatch") String taskIdBatch);
|
||||||
|
@Select("SELECT * FROM cloud_task WHERE task_id = #{taskId} FOR UPDATE")
|
||||||
|
CloudTask selectForUpdate(String taskId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ public class PoseTransformationVO implements AllCollectionVO{
|
|||||||
private Long userLikeSortId;
|
private Long userLikeSortId;
|
||||||
private String relationType;
|
private String relationType;
|
||||||
|
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
public PoseTransformationVO(Long id, String taskId, String gifUrl, String videoUrl, String firstFrameUrl, byte isLiked, String status) {
|
public PoseTransformationVO(Long id, String taskId, String gifUrl, String videoUrl, String firstFrameUrl, byte isLiked, String status) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.taskId = taskId;
|
this.taskId = taskId;
|
||||||
|
|||||||
@@ -10,4 +10,5 @@ public class ToProductImageResultVO extends ToProductImageResult implements AllC
|
|||||||
private Integer sort;
|
private Integer sort;
|
||||||
private Long userLikeSortId;
|
private Long userLikeSortId;
|
||||||
private String relationType;
|
private String relationType;
|
||||||
|
private Long parentId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1269,6 +1269,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
qw.lambda().eq(CollectionSort::getProjectId, projectId);
|
qw.lambda().eq(CollectionSort::getProjectId, projectId);
|
||||||
if (null != parentId) {
|
if (null != parentId) {
|
||||||
qw.lambda().eq(CollectionSort::getParentId, parentId);
|
qw.lambda().eq(CollectionSort::getParentId, parentId);
|
||||||
|
}else {
|
||||||
|
qw.lambda().isNull(CollectionSort::getParentId);
|
||||||
}
|
}
|
||||||
List<CollectionSort> userLikeSorts = collectionSortMapper.selectList(qw);
|
List<CollectionSort> userLikeSorts = collectionSortMapper.selectList(qw);
|
||||||
if (CollectionUtils.isEmpty(userLikeSorts)) {
|
if (CollectionUtils.isEmpty(userLikeSorts)) {
|
||||||
@@ -2515,6 +2517,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public void processDesignBatch(Map<String, Object> designBatchResult) {
|
public void processDesignBatch(Map<String, Object> designBatchResult) {
|
||||||
Object progress = designBatchResult.get("progress");
|
Object progress = designBatchResult.get("progress");
|
||||||
if (progress instanceof String) {
|
if (progress instanceof String) {
|
||||||
|
|||||||
@@ -1426,6 +1426,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public void processPoseTransformResultBatch(String taskId, String gifUrl, String videoUrl, String imageUrl, String progress) {
|
public void processPoseTransformResultBatch(String taskId, String gifUrl, String videoUrl, String imageUrl, String progress) {
|
||||||
// 1、存储模型返回的数据
|
// 1、存储模型返回的数据
|
||||||
PoseTransformation poseTransformation;
|
PoseTransformation poseTransformation;
|
||||||
|
|||||||
@@ -1706,6 +1706,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
toProductImageResultVO.setSort(userLikeSort.getSort());
|
toProductImageResultVO.setSort(userLikeSort.getSort());
|
||||||
toProductImageResultVO.setUserLikeSortId(userLikeSort.getId());
|
toProductImageResultVO.setUserLikeSortId(userLikeSort.getId());
|
||||||
toProductImageResultVO.setRelationType(userLikeSort.getRelationType());
|
toProductImageResultVO.setRelationType(userLikeSort.getRelationType());
|
||||||
|
toProductImageResultVO.setParentId(userLikeSort.getParentId());
|
||||||
childList.add(toProductImageResultVO);
|
childList.add(toProductImageResultVO);
|
||||||
} else if (userLikeSort.getRelationType().equals(CollectionType.RELIGHT.getValue())) {
|
} else if (userLikeSort.getRelationType().equals(CollectionType.RELIGHT.getValue())) {
|
||||||
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(userLikeSort.getRelationId());
|
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(userLikeSort.getRelationId());
|
||||||
@@ -1726,6 +1727,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
toProductImageResultVO.setSort(userLikeSort.getSort());
|
toProductImageResultVO.setSort(userLikeSort.getSort());
|
||||||
toProductImageResultVO.setUserLikeSortId(userLikeSort.getId());
|
toProductImageResultVO.setUserLikeSortId(userLikeSort.getId());
|
||||||
toProductImageResultVO.setRelationType(userLikeSort.getRelationType());
|
toProductImageResultVO.setRelationType(userLikeSort.getRelationType());
|
||||||
|
toProductImageResultVO.setParentId(userLikeSort.getParentId());
|
||||||
childList.add(toProductImageResultVO);
|
childList.add(toProductImageResultVO);
|
||||||
} else if (userLikeSort.getRelationType().equals(CollectionType.POSE_TRANSFORM.getValue())) {
|
} else if (userLikeSort.getRelationType().equals(CollectionType.POSE_TRANSFORM.getValue())) {
|
||||||
PoseTransformation item = poseTransformationMapper.selectById(userLikeSort.getRelationId());
|
PoseTransformation item = poseTransformationMapper.selectById(userLikeSort.getRelationId());
|
||||||
@@ -1741,6 +1743,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
poseTransformationVO.setUserLikeSortId(userLikeSort.getId());
|
poseTransformationVO.setUserLikeSortId(userLikeSort.getId());
|
||||||
poseTransformationVO.setRelationType(userLikeSort.getRelationType());
|
poseTransformationVO.setRelationType(userLikeSort.getRelationType());
|
||||||
poseTransformationVO.setResultType(CollectionType.POSE_TRANSFORM.getValue());
|
poseTransformationVO.setResultType(CollectionType.POSE_TRANSFORM.getValue());
|
||||||
|
poseTransformationVO.setParentId(userLikeSort.getParentId());
|
||||||
childList.add(poseTransformationVO);
|
childList.add(poseTransformationVO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2529,6 +2532,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public void toProductBatch(String taskId, String url, String progress) {
|
public void toProductBatch(String taskId, String url, String progress) {
|
||||||
QueryWrapper<ToProductImageResult> qw = new QueryWrapper<>();
|
QueryWrapper<ToProductImageResult> qw = new QueryWrapper<>();
|
||||||
qw.lambda().eq(ToProductImageResult::getTaskId, taskId);
|
qw.lambda().eq(ToProductImageResult::getTaskId, taskId);
|
||||||
@@ -2538,6 +2542,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
toProductImageResultMapper.updateById(toProductImageResult);
|
toProductImageResultMapper.updateById(toProductImageResult);
|
||||||
String taskIdBatch = toProductImageResult.getTaskIdBatch();
|
String taskIdBatch = toProductImageResult.getTaskIdBatch();
|
||||||
log.info("toProductImage云生成 batchTaskId:" + taskIdBatch + " 完成数+1");
|
log.info("toProductImage云生成 batchTaskId:" + taskIdBatch + " 完成数+1");
|
||||||
|
|
||||||
|
CloudTask task = cloudTaskMapper.selectForUpdate(taskIdBatch);
|
||||||
cloudTaskMapper.increaseCompletedNum(taskIdBatch);
|
cloudTaskMapper.increaseCompletedNum(taskIdBatch);
|
||||||
|
|
||||||
String key = toProductImageResultKey + ":" + taskId;
|
String key = toProductImageResultKey + ":" + taskId;
|
||||||
@@ -2561,6 +2567,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public void relightBatch(String taskId, String url, String progress) {
|
public void relightBatch(String taskId, String url, String progress) {
|
||||||
QueryWrapper<ToProductImageResult> qw = new QueryWrapper<>();
|
QueryWrapper<ToProductImageResult> qw = new QueryWrapper<>();
|
||||||
qw.lambda().eq(ToProductImageResult::getTaskId, taskId);
|
qw.lambda().eq(ToProductImageResult::getTaskId, taskId);
|
||||||
|
|||||||
Reference in New Issue
Block a user