TASK:product/relight/pose transfer的入参添加是否需要默认like

This commit is contained in:
2025-07-08 11:39:05 +08:00
parent 060db899cf
commit 1f77500d61
4 changed files with 59 additions and 36 deletions

View File

@@ -20,9 +20,15 @@ public class PoseTransformDTO {
@NotNull(message = "please select a pose")
private Integer poseId;
@ApiModelProperty("模型名")
private String modelName;
@ApiModelProperty("design结果在collectionSort中的id")
private Long parentId;
@ApiModelProperty("子集中的元素作为父元素")
private Long userLikeSortId;
@ApiModelProperty("是否默认喜欢")
private Boolean isDefaultLike;
}

View File

@@ -18,6 +18,9 @@ public class ToProductImageDTO {
private BigDecimal imageStrengthMax;
private String modelName;
private String ageGroup;
// 使用子集中的元素作为父元素
private Long userLikeSortId;
// 是否默认like生成的元素
private Boolean isDefaultLike;
}

View File

@@ -1166,19 +1166,22 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
poseTransformation.setIsLiked((byte)1);
poseTransformation.setCreateTime(LocalDateTime.now());
poseTransformationMapper.insert(poseTransformation);
// 满足条件下添加到like
Integer sort = addPoseTransferLike(poseTransformDTO, poseTransformation.getId());
Integer reSort = userLikeGroupService.rearrangeChildSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(),
poseTransformDTO.getParentId(), poseTransformDTO.getUserLikeSortId());
// 当需要默认like
ToProductImageResultVO toProductImageResultVO = new ToProductImageResultVO();
if (Objects.nonNull(poseTransformDTO.getIsDefaultLike()) && poseTransformDTO.getIsDefaultLike()){
// 满足条件下添加到like
Integer sort = addPoseTransferLike(poseTransformDTO, poseTransformation.getId());
Integer reSort = userLikeGroupService.rearrangeChildSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(),
poseTransformDTO.getParentId(), poseTransformDTO.getUserLikeSortId());
toProductImageResultVO.setSort(Objects.isNull(reSort) ? sort : reSort);
}
if (flag){
// 6、添加预扣除积分到redis
creditsService.addRecordToCreditsDeduction(accountId, taskId, creditsEventsEnum);
// 6.1 添加积分扣除记录到db
creditsService.preInsert(accountId, creditsEventsEnum.getName(), taskId, Boolean.TRUE, null);
ToProductImageResultVO toProductImageResultVO = new ToProductImageResultVO();
toProductImageResultVO.setTaskId(taskId);
toProductImageResultVO.setSort(Objects.isNull(reSort) ? sort : reSort);
// 更新项目更新时间
projectService.modifyProjectUpdateTime(projectId);
return toProductImageResultVO;

View File

@@ -489,13 +489,16 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
toProductImageResult.setResultType(CollectionType.TO_PRODUCT_IMAGE.getValue());
toProductImageResultMapper.insert(toProductImageResult);
// toProductImageResult.setUrl(minioUtil.getPresignedUrl(toProductImageResult.getUrl(), 24 * 60));
// 满足条件情况下默认添加到like
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
// 重新排序
Integer reSort = rearrangeChildSort(toProductImageResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(),
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
// 将生成结果的排序返回
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
// 先判断是否需要默认like
if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && toProductImageDTO.getIsDefaultLike()){
// 满足条件情况下默认添加到like
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
// 重新排序
Integer reSort = rearrangeChildSort(toProductImageResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(),
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
// 将生成结果的排序返回
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
}
result.add(toProductImageResult);
}else {
if (StringUtils.isEmpty(prompt)) {
@@ -536,13 +539,16 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
toProductImageResult.setResultType(CollectionType.TO_PRODUCT_IMAGE.getValue());
toProductImageResultMapper.insert(toProductImageResult);
// toProductImageResult.setUrl(minioUtil.getPresignedUrl(toProductImageResult.getUrl(), 24 * 60));
// 满足条件情况下默认添加到like
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
// 重新排序
Integer reSort = rearrangeChildSort(toProductImageResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(),
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
// 将生成结果的排序返回
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
// 先判断是否需要默认like
if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && toProductImageDTO.getIsDefaultLike()){
// 满足条件情况下默认添加到like
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
// 重新排序
Integer reSort = rearrangeChildSort(toProductImageResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(),
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
// 将生成结果的排序返回
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
}
result.add(toProductImageResult);
}
i ++;
@@ -1130,14 +1136,16 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
toProductImageResult.setResultType(CollectionType.RELIGHT.getValue());
toProductImageResultMapper.insert(toProductImageResult);
// toProductImageResult.setUrl(minioUtil.getPresignedUrl(toProductImageResult.getUrl(), 24 * 60));
// 满足条件情况下默认添加到like
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
// 重新排序
Integer reSort = rearrangeChildSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(),
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
// 将生成结果的排序返回
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
// 先判断是否需要默认like
if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && toProductImageDTO.getIsDefaultLike()){
// 满足条件情况下默认添加到like
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
// 重新排序
Integer reSort = rearrangeChildSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(),
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
// 将生成结果的排序返回
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
}
result.add(toProductImageResult);
}else {
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageVO.getElementId());
@@ -1168,13 +1176,16 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
toProductImageResult.setResultType(CollectionType.RELIGHT.getValue());
toProductImageResultMapper.insert(toProductImageResult);
// toProductImageResult.setUrl(minioUtil.getPresignedUrl(toProductImageResult.getUrl(), 24 * 60));
// 满足条件情况下默认添加到like
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
// 重新排序
Integer reSort = rearrangeChildSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(),
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
// 将生成结果的排序返回
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
// 先判断是否需要默认like
if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && toProductImageDTO.getIsDefaultLike()){
// 满足条件情况下默认添加到like
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
// 重新排序
Integer reSort = rearrangeChildSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(),
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
// 将生成结果的排序返回
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
}
result.add(toProductImageResult);
}
// 添加需要扣除的积分到预扣除区