TASK: ToProduct Relight Pose新增删除接口

This commit is contained in:
2025-07-16 19:14:41 +08:00
parent 301f58bc62
commit 5b3a52152a
8 changed files with 112 additions and 10 deletions

View File

@@ -75,6 +75,8 @@ public interface GenerateService extends IService<Generate> {
void processPoseTransformResultBatch(String taskId, String progress);
void deleteGeneratedPose(Long projectId, Long id);
String createAsyncTask(GenerateThroughImageTextDTO generateThroughImageTextDTO);
GenerateResultVO getAsyncTaskResult(String taskId);

View File

@@ -74,6 +74,8 @@ public interface UserLikeGroupService extends IService<UserLikeGroup> {
List<MagicToolResultVO> getRelightResult(List<String> taskIdList);
void deleteToProductRelightResult(Long id, Long projectId, String type);
String likeHistoryRelSketch();
String download();

View File

@@ -29,6 +29,7 @@ import com.alibaba.dashscope.utils.JsonUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -1725,16 +1726,15 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
String messageFromResource = BusinessException.getMessageFromResource(clothCategory.toUpperCase());
vo.setCategory(clothCategory);
vo.setCategoryValue(messageFromResource);
List<CollectionElement> collectionElements = collectionElementService.getByProjectId(projectId);
if (!collectionElements.isEmpty()){
collectionElements.forEach(item -> {
item.setUrl(StringUtil.isNullOrEmpty(item.getUrl()) ? null : minioUtil.getPreSignedUrl(item.getUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
});
vo.setUploadImages(collectionElements);
}else {
vo.setUploadImages(new ArrayList<>());
}
}
List<CollectionElement> collectionElements = collectionElementService.getByProjectId(projectId);
if (!collectionElements.isEmpty()){
collectionElements.forEach(item -> {
item.setUrl(StringUtil.isNullOrEmpty(item.getUrl()) ? null : minioUtil.getPreSignedUrl(item.getUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
});
vo.setUploadImages(collectionElements);
}else {
vo.setUploadImages(new ArrayList<>());
}
return vo;
}
@@ -1829,6 +1829,38 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
}
}
@Resource
private CollectionSortMapper collectionSortMapper;
@Transactional(rollbackFor = Exception.class)
public void deleteGeneratedPose(Long projectId, Long id){
Long accountId = UserContext.getUserHolder().getId();
// 1、删除generate中的结果
UpdateWrapper<PoseTransformation> wrapper = new UpdateWrapper<>();
wrapper.eq("id", id)
.set("is_deleted", 1) // 手动设置
.set("update_time", LocalDateTime.now());
int update = poseTransformationMapper.update(null, wrapper);
log.info("删除PoseTransfer 结果, id为{}, 影响行数={}", id, update);
if (update != 0) {
// 2、如果有排序删除排序,排序后是否需要重置排序计数器以及后续排序数字
// 先校验type的值是不是ToProductImage、Relight、PoseTransfer
if (id == null || projectId == null) {
throw new IllegalArgumentException("参数不能为null");
}
Project project = projectService.getById(projectId);
if (!project.getAccountId().equals(accountId)){
throw new IllegalArgumentException("项目id不属于当前账号请仅对自己的账号数据进行处理");
}
int deletedRows = collectionSortMapper.delete(new QueryWrapper<CollectionSort>()
.eq("project_id", projectId)
.eq("relation_id", id).eq("relation_type", "PoseTransfer"));
log.info("deleteGeneratedPose 删除记录id={}, type={}, 影响行数={}", id, "PoseTransfer", deletedRows);
}
}
/**
* 万象专业版

View File

@@ -1332,6 +1332,38 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
}
}
@Transactional(rollbackFor = Exception.class)
public void deleteToProductRelightResult(Long id, Long projectId, String type){
Long accountId = UserContext.getUserHolder().getId();
// 1、删除toProductResult中的结果
Project project = projectService.getById(projectId);
if (!project.getAccountId().equals(accountId)){
throw new IllegalArgumentException("项目id不属于当前账号请仅对自己的账号数据进行处理");
}
UpdateWrapper<ToProductImageResult> wrapper = new UpdateWrapper<>();
wrapper.eq("id", id)
.eq("project_id", projectId)
.set("is_deleted", 1); // 手动设置
int update = toProductImageResultMapper.update(null, wrapper);
log.info("删除{} 结果, id为{}, 影响行数={}", type, id, update);
if (update != 0) {
// 2、如果有排序删除排序,排序后是否需要重置排序计数器以及后续排序数字
// 先校验type的值是不是ToProductImage、Relight、PoseTransfer
if (id == null || type == null || projectId == null) {
throw new IllegalArgumentException("参数不能为null");
}
int deletedRows = collectionSortMapper.delete(new QueryWrapper<CollectionSort>()
.eq("project_id", projectId)
.eq("relation_id", id).eq("relation_type", type));
log.info("deleteToProductRelightResult 删除记录id={}, type={}, 影响行数={}", id, type, deletedRows);
}
}
@Override
public String likeHistoryRelSketch() {
QueryWrapper<UserLikeGroup> qw = new QueryWrapper<>();