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") @NotNull(message = "please select a pose")
private Integer poseId; private Integer poseId;
@ApiModelProperty("模型名")
private String modelName; private String modelName;
@ApiModelProperty("design结果在collectionSort中的id")
private Long parentId; private Long parentId;
@ApiModelProperty("子集中的元素作为父元素")
private Long userLikeSortId; private Long userLikeSortId;
@ApiModelProperty("是否默认喜欢")
private Boolean isDefaultLike;
} }

View File

@@ -18,6 +18,9 @@ public class ToProductImageDTO {
private BigDecimal imageStrengthMax; private BigDecimal imageStrengthMax;
private String modelName; private String modelName;
private String ageGroup; private String ageGroup;
// 使用子集中的元素作为父元素
private Long userLikeSortId; 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.setIsLiked((byte)1);
poseTransformation.setCreateTime(LocalDateTime.now()); poseTransformation.setCreateTime(LocalDateTime.now());
poseTransformationMapper.insert(poseTransformation); poseTransformationMapper.insert(poseTransformation);
// 满足条件下添加到like // 当需要默认like
Integer sort = addPoseTransferLike(poseTransformDTO, poseTransformation.getId()); ToProductImageResultVO toProductImageResultVO = new ToProductImageResultVO();
Integer reSort = userLikeGroupService.rearrangeChildSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(), if (Objects.nonNull(poseTransformDTO.getIsDefaultLike()) && poseTransformDTO.getIsDefaultLike()){
poseTransformDTO.getParentId(), poseTransformDTO.getUserLikeSortId()); // 满足条件下添加到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){ if (flag){
// 6、添加预扣除积分到redis // 6、添加预扣除积分到redis
creditsService.addRecordToCreditsDeduction(accountId, taskId, creditsEventsEnum); creditsService.addRecordToCreditsDeduction(accountId, taskId, creditsEventsEnum);
// 6.1 添加积分扣除记录到db // 6.1 添加积分扣除记录到db
creditsService.preInsert(accountId, creditsEventsEnum.getName(), taskId, Boolean.TRUE, null); creditsService.preInsert(accountId, creditsEventsEnum.getName(), taskId, Boolean.TRUE, null);
ToProductImageResultVO toProductImageResultVO = new ToProductImageResultVO();
toProductImageResultVO.setTaskId(taskId); toProductImageResultVO.setTaskId(taskId);
toProductImageResultVO.setSort(Objects.isNull(reSort) ? sort : reSort);
// 更新项目更新时间 // 更新项目更新时间
projectService.modifyProjectUpdateTime(projectId); projectService.modifyProjectUpdateTime(projectId);
return toProductImageResultVO; return toProductImageResultVO;

View File

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