TASK:product/pose transfer的回参添加sort和id

This commit is contained in:
2025-07-08 10:21:28 +08:00
parent 9fc8f52aca
commit 060db899cf
4 changed files with 10 additions and 19 deletions

View File

@@ -115,13 +115,8 @@ public class GenerateController {
@ApiOperation("喜欢或取消喜欢姿势变换生成的图片")
@PostMapping("/likeOrDislike")
public Response<Object> likeOrDislike(@ApiParam("id") @RequestParam Long transformedId, @ApiParam("like || dislike") @RequestParam String likeOrDislike, @RequestParam("projectId") Long projectId, @RequestParam(value = "collectionSortParentId", required = false) Long collectionSortParentId) {
Object obj = generateService.disOrLikePose(transformedId, likeOrDislike, projectId, collectionSortParentId);
if (obj instanceof CollectionSort){
return Response.success(((CollectionSort) obj).getId());
}else {
return Response.success(obj);
}
public Response<CollectionSort> likeOrDislike(@ApiParam("id") @RequestParam Long transformedId, @ApiParam("like || dislike") @RequestParam String likeOrDislike, @RequestParam("projectId") Long projectId, @RequestParam(value = "collectionSortParentId", required = false) Long collectionSortParentId) {
return Response.success(generateService.disOrLikePose(transformedId, likeOrDislike, projectId, collectionSortParentId));
}
@ApiOperation(value = "修改模特比例")

View File

@@ -205,9 +205,9 @@ public class SavedCollectionController {
@ApiOperation(value = "productImageLike")
@PostMapping("/productImageLike")
public Response<Long> productImageLike(@Valid @RequestBody ProductImageLikeDTO productImageLikeDTO) {
public Response<CollectionSort> productImageLike(@Valid @RequestBody ProductImageLikeDTO productImageLikeDTO) {
CollectionSort collectionSort = userLikeGroupService.productImageLike(productImageLikeDTO);
return Response.success(Objects.nonNull(collectionSort) ? collectionSort.getId() : null);
return Response.success(collectionSort);
}
@ApiOperation(value = "collectionLikeUpdate")

View File

@@ -1,6 +1,7 @@
package com.ai.da.service;
import com.ai.da.common.enums.CreditsEventsEnum;
import com.ai.da.mapper.primary.entity.CollectionSort;
import com.ai.da.mapper.primary.entity.Generate;
import com.ai.da.mapper.primary.entity.GenerateDetail;
import com.ai.da.model.dto.*;
@@ -57,7 +58,7 @@ public interface GenerateService extends IService<Generate> {
List<PoseTransformationVO> getPoseTransformationResultList(Long projectId, boolean like);
Object disOrLikePose(Long transformedId, String likeOrDislike, Long projectId, Long sortLikeParentId);
CollectionSort disOrLikePose(Long transformedId, String likeOrDislike, Long projectId, Long sortLikeParentId);
String modifyModelProportion(ModifyModelProportionDTO proportionDTO);

View File

@@ -1189,11 +1189,9 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
private Integer addPoseTransferLike(PoseTransformDTO poseTransformDTO, Long poseTransformationId){
if (Objects.nonNull(poseTransformDTO.getParentId())
&& !poseTransformDTO.getParentId().equals(0L)){
Object object = disOrLikePose(poseTransformationId, "like",
CollectionSort collectionSort = disOrLikePose(poseTransformationId, "like",
poseTransformDTO.getProjectId(), poseTransformDTO.getParentId());
if (object instanceof CollectionSort){
return ((CollectionSort) object).getSort();
}
return collectionSort.getSort();
}
return null;
}
@@ -1335,7 +1333,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
}
}
public Object disOrLikePose(Long transformedId, String likeOrDislike, Long projectId, Long collectionSortParentId){
public CollectionSort disOrLikePose(Long transformedId, String likeOrDislike, Long projectId, Long collectionSortParentId){
PoseTransformation poseTransformation = poseTransformationMapper.selectById(transformedId);
CollectionSort collectionSort = null;
if (Objects.nonNull(poseTransformation)){
@@ -1352,14 +1350,11 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
}
poseTransformation.setUpdateTime(LocalDateTime.now());
poseTransformationMapper.updateById(poseTransformation);
}else {
return false;
}
if (Objects.nonNull(collectionSort)) {
projectService.modifyProjectUpdateTime(projectId);
return collectionSort;
}
return true;
return collectionSort;
}
@Resource