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
ToProductImageResultVO toProductImageResultVO = new ToProductImageResultVO();
if (Objects.nonNull(poseTransformDTO.getIsDefaultLike()) && poseTransformDTO.getIsDefaultLike()){
// 满足条件下添加到like // 满足条件下添加到like
Integer sort = addPoseTransferLike(poseTransformDTO, poseTransformation.getId()); Integer sort = addPoseTransferLike(poseTransformDTO, poseTransformation.getId());
Integer reSort = userLikeGroupService.rearrangeChildSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(), Integer reSort = userLikeGroupService.rearrangeChildSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(),
poseTransformDTO.getParentId(), poseTransformDTO.getUserLikeSortId()); 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,6 +489,8 @@ 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
if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && toProductImageDTO.getIsDefaultLike()){
// 满足条件情况下默认添加到like // 满足条件情况下默认添加到like
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId()); Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
// 重新排序 // 重新排序
@@ -496,6 +498,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId()); 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 {
if (StringUtils.isEmpty(prompt)) { if (StringUtils.isEmpty(prompt)) {
@@ -536,6 +539,8 @@ 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
if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && toProductImageDTO.getIsDefaultLike()){
// 满足条件情况下默认添加到like // 满足条件情况下默认添加到like
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId()); Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
// 重新排序 // 重新排序
@@ -543,6 +548,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId()); toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
// 将生成结果的排序返回 // 将生成结果的排序返回
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort); toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
}
result.add(toProductImageResult); result.add(toProductImageResult);
} }
i ++; i ++;
@@ -1130,7 +1136,8 @@ 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
if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && toProductImageDTO.getIsDefaultLike()){
// 满足条件情况下默认添加到like // 满足条件情况下默认添加到like
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId()); Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
// 重新排序 // 重新排序
@@ -1138,6 +1145,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId()); 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,6 +1176,8 @@ 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
if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && toProductImageDTO.getIsDefaultLike()){
// 满足条件情况下默认添加到like // 满足条件情况下默认添加到like
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId()); Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
// 重新排序 // 重新排序
@@ -1175,6 +1185,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId()); toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
// 将生成结果的排序返回 // 将生成结果的排序返回
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort); toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
}
result.add(toProductImageResult); result.add(toProductImageResult);
} }
// 添加需要扣除的积分到预扣除区 // 添加需要扣除的积分到预扣除区