Merge branch 'dev/dev_xp' into dev/dev

This commit is contained in:
2025-03-25 16:11:33 +08:00
5 changed files with 43 additions and 9 deletions

View File

@@ -110,6 +110,12 @@ public class GenerateController {
return Response.success(generateResult);
}
@ApiOperation("喜欢或取消喜欢姿势变换生成的图片")
@PostMapping("/likeOrDislike")
public Response<Boolean> likeOrDislike(@ApiParam("id") @RequestParam Long transformedId, @ApiParam("like || dislike") @RequestParam String likeOrDislike) {
return Response.success(generateService.disOrLikePose(transformedId, likeOrDislike));
}
@ApiOperation(value = "修改模特比例")
@PostMapping("/modifyProportion")
public Response<String> modifyModelProportion(@Valid @RequestBody ModifyModelProportionDTO proportionDTO){

View File

@@ -23,7 +23,7 @@ public class PoseTransformation extends BaseEntity {
private String videoUrl;
// GIF第一帧截图
private String imageUrl;
private String firstFrameUrl;
private byte isLiked;

View File

@@ -17,7 +17,7 @@ public class PoseTransformationVO {
private String videoUrl;
// GIF第一帧截图
private String imageUrl;
private String firstFrameUrl;
private byte isLiked;

View File

@@ -52,6 +52,10 @@ public interface GenerateService extends IService<Generate> {
PoseTransformationVO getPoseTransformationResult(String taskId);
List<PoseTransformationVO> getPoseTransformationResultList(String projectId);
Boolean disOrLikePose(Long transformedId, String likeOrDislike);
String modifyModelProportion(ModifyModelProportionDTO proportionDTO);
GenerateResultVO sketchReconstructionGenerate(SketchReconstructionDTO sketchReconstructionDTO);

View File

@@ -14,8 +14,6 @@ import com.ai.da.model.vo.*;
import com.ai.da.python.PythonService;
import com.ai.da.service.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
@@ -28,17 +26,14 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import static com.ai.da.common.enums.CollectionLevel1TypeEnum.*;
import static com.ai.da.service.impl.UserLikeGroupServiceImpl.convert;
@Slf4j
@Service
@@ -988,7 +983,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
poseTransformation = poseTransformations.get(0);
poseTransformation.setGifUrl(gifUrl);
poseTransformation.setVideoUrl(videoUrl);
poseTransformation.setImageUrl(imageUrl);
poseTransformation.setFirstFrameUrl(imageUrl);
poseTransformation.setUpdateTime(LocalDateTime.now());
poseTransformationMapper.updateById(poseTransformation);
@@ -1015,7 +1010,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
if (poseTransformationVO.getStatus().equals("Success")){
poseTransformationVO.setGifUrl(minioUtil.getPreSignedUrl(poseTransformationVO.getGifUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
poseTransformationVO.setVideoUrl(minioUtil.getPreSignedUrl(poseTransformationVO.getVideoUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
poseTransformationVO.setImageUrl(minioUtil.getPreSignedUrl(poseTransformationVO.getImageUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
poseTransformationVO.setFirstFrameUrl(minioUtil.getPreSignedUrl(poseTransformationVO.getFirstFrameUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
}
return poseTransformationVO;
}else {
@@ -1023,6 +1018,35 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
}
}
public List<PoseTransformationVO> getPoseTransformationResultList(String projectId){
List<PoseTransformation> poseTransformations = poseTransformationMapper.selectList(new QueryWrapper<PoseTransformation>().eq("project_id", projectId).eq("is_liked", 1));
List<PoseTransformationVO> vos = new ArrayList<>();
if (poseTransformations != null && poseTransformations.size() > 1){
poseTransformations.forEach(item -> {
PoseTransformationVO poseTransformationVO = CopyUtil.copyObject(item, PoseTransformationVO.class);
poseTransformationVO.setId(item.getId());
vos.add(poseTransformationVO);
});
}
return vos;
}
public Boolean disOrLikePose(Long transformedId, String likeOrDislike){
PoseTransformation poseTransformation = poseTransformationMapper.selectById(transformedId);
if (Objects.nonNull(poseTransformation)){
if (likeOrDislike.equals("like")){
poseTransformation.setIsLiked((byte)1);
}else if (likeOrDislike.equals("dislike")){
poseTransformation.setIsLiked((byte)0);
}
poseTransformation.setUpdateTime(LocalDateTime.now());
poseTransformationMapper.updateById(poseTransformation);
}else {
return false;
}
return true;
}
@Resource
private SysFileService sysFileService;