TASK: 结果返回parentId;

This commit is contained in:
shahaibo
2025-06-20 13:50:29 +08:00
parent 627dad7aac
commit df5bbc3675
10 changed files with 73 additions and 2 deletions

View File

@@ -23,31 +23,45 @@ public class CloudTask implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty("任务名")
private String name;
@ApiModelProperty("项目ID")
private Long projectId;
@ApiModelProperty("collectionId")
private Long collectionId;
@ApiModelProperty("designId")
private Long designId;
@ApiModelProperty("任务类型")
private String buildType;
@ApiModelProperty("生成数量")
private Integer nums;
@ApiModelProperty("完成数量")
private Integer completedNum;
@ApiModelProperty("消耗积分")
private Integer costCredits;
@ApiModelProperty("状态1完成0未完成")
private Integer status;
@ApiModelProperty("批处理ID")
private String taskId;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
@ApiModelProperty("任务开始时间")
private LocalDateTime startTime;
@ApiModelProperty("任务更新时间")
private LocalDateTime updateTime;
@ApiModelProperty("用户ID")
private Long accountId;
}

View File

@@ -29,6 +29,7 @@ public class AccountLoginDTO {
@ApiModelProperty("邮箱验证码")
private String emailVerifyCode;
@ApiModelProperty("组织名")
private String organizationName;
}

View File

@@ -1,14 +1,16 @@
package com.ai.da.model.dto;
import com.ai.da.mapper.primary.entity.CloudTask;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class CloudTaskDTO extends CloudTask {
@ApiModelProperty("toProduct/relight入参")
private ToProductImageDTO toProductImage;
@ApiModelProperty("posetransfer入参")
private List<PoseTransformBatchDTO> poseTransform;

View File

@@ -1,13 +1,17 @@
package com.ai.da.model.dto;
import com.ai.da.mapper.primary.entity.CollectionSort;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class CollectionSortDTO{
@ApiModelProperty("userLikeGroupId")
private Long userLikeGroupId;
@ApiModelProperty("排序数组")
List<CollectionSort> userLikeSortList;
}

View File

@@ -29,6 +29,7 @@ public class DesignCollectionDTO {
@ApiModelProperty("手稿板图片id 数组")
private List<CollectionSketchDTO> sketchBoards;
@ApiModelProperty("模特 数组")
private List<MannequinDTO> mannequins;
@NotNull(message = "systemScale.cannot.be.empty")
@@ -65,14 +66,19 @@ public class DesignCollectionDTO {
@ApiModelProperty("python端design进程ID")
private String processId;
@ApiModelProperty("moodboard 位置信息")
private String moodboardPosition;
@ApiModelProperty("获取结果标识数组")
private List<String> requestIdList;
@ApiModelProperty("design数量")
private Integer designNum;
@ApiModelProperty("品牌ID")
private Long brandId;
@ApiModelProperty("品牌占比")
private Double brandScale;
}

View File

@@ -23,5 +23,6 @@ public class DisDesignLikeDTO {
@ApiModelProperty("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
private String timeZone;
@ApiModelProperty("项目ID")
private Long projectId;
}

View File

@@ -4,6 +4,7 @@ import lombok.Data;
@Data
public class PoseTransformBatchDTO {
private String productImage;
private Integer poseId;

View File

@@ -29,6 +29,8 @@ public class MagicToolResultVO {
private Long elementId;
private Long parentId;
public MagicToolResultVO(String status) {
this.status = status;
}

View File

@@ -48,6 +48,7 @@ import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom;
@@ -152,6 +153,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
@Resource
private UserBehaviorMapper userBehaviorMapper;
@Resource
private UserPreferenceLogMapper userPreferenceLogMapper;
@Resource
private CollectionElementRelModelMapper collectionElementRelModelMapper;
private final ConcurrentHashMap<String, Map<String, Object>> designContext = new ConcurrentHashMap<>();
@@ -1242,6 +1245,15 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
userBehavior.setUrl(designItemDetail.getPath());
userBehavior.setCreateTime(LocalDateTime.now());
userBehaviorMapper.insert(userBehavior);
UserPreferenceLogTest userPreferenceLogTest = new UserPreferenceLogTest();
userPreferenceLogTest.setPath(designItemDetail.getPath());
userPreferenceLogTest.setAccountId(userHolder.getId());
// userPreferenceLogTest.setUserLikeGroupId(userLike.getUserLikeGroupId());
userPreferenceLogTest.setDataTime(designItemDetail.getCreateDate().toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDateTime());
userPreferenceLogMapper.insert(userPreferenceLogTest);
}
}
}
@@ -2533,7 +2545,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
public void processDesignBatch(Map<String, Object> designBatchResult) {
Object progress = designBatchResult.get("progress");
if (progress instanceof String) {
if (progress.equals("0/100")) {
if (((String) progress).startsWith("0/")) {
return;
}
if (progress.equals("ok")) {

View File

@@ -690,9 +690,21 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
if (toProductImageResult.getElementType().equals("ProductElement")) {
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResult.getElementId());
magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductElement.getUrl(), 24 * 60));
Long parentId = getParentIdByElementIdAndElementType(toProductImageResult.getElementId(), toProductImageResult.getElementType());
magicToolResultVO.setParentId(parentId);
}else {
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResult.getElementId());
magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
QueryWrapper<UserLike> userLikeQueryWrapper = new QueryWrapper<>();
userLikeQueryWrapper.lambda().eq(UserLike::getDesignOutfitId, tDesignPythonOutfit.getId());
List<UserLike> userLikeList = userLikeMapper.selectList(userLikeQueryWrapper);
if (!CollectionUtils.isEmpty(userLikeList)) {
UserLike userLike = userLikeList.get(0);
Long parentId = getParentIdByElementIdAndElementType(userLike.getId(), toProductImageResult.getElementType());
magicToolResultVO.setParentId(parentId);
}
}
}
} else if (Objects.isNull(magicToolResultVO)) {
@@ -704,6 +716,22 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
return results;
}
private Long getParentIdByElementIdAndElementType(Long elementId, String elementType) {
QueryWrapper<CollectionSort> qw = new QueryWrapper<>();
qw.lambda().eq(CollectionSort::getRelationId, elementId);
qw.lambda().eq(CollectionSort::getRelationType, elementType);
List<CollectionSort> collectionSortList = collectionSortMapper.selectList(qw);
if (CollectionUtils.isEmpty(collectionSortList)) {
return null;
}
CollectionSort collectionSort = collectionSortList.get(0);
Long parentId = collectionSort.getParentId();
if (parentId == null) {
return collectionSort.getId();
}
return collectionSort.getParentId();
}
private MagicToolResultVO processFluxResult(String fluxImgMinioPath, ToProductImageResult toProductImageResult, String taskId){
toProductImageResult.setUrl(fluxImgMinioPath);
toProductImageResultMapper.updateById(toProductImageResult);