Merge remote-tracking branch 'origin/dev/dev' into dev/dev
This commit is contained in:
@@ -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){
|
||||
|
||||
@@ -23,7 +23,7 @@ public class PoseTransformation extends BaseEntity {
|
||||
|
||||
private String videoUrl;
|
||||
// GIF第一帧截图
|
||||
private String imageUrl;
|
||||
private String firstFrameUrl;
|
||||
|
||||
private byte isLiked;
|
||||
|
||||
|
||||
@@ -15,4 +15,6 @@ public class SketchReconstruction extends BaseEntity{
|
||||
|
||||
private Long generateDetailId;
|
||||
|
||||
private String gender;
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class ModuleChooseVO {
|
||||
private CavasModuleChooseVO canvas;
|
||||
|
||||
private List<CollectionSketchVO> boundingBox;
|
||||
// private moodBoardModuleChooseVO poseTransfer;
|
||||
private List<PoseTransformationVO> poseTransfer;
|
||||
// private moodBoardModuleChooseVO patternMaking3D;
|
||||
private SketchReconstructionVO deReconstruction;
|
||||
}
|
||||
|
||||
@@ -13,13 +13,25 @@ public class PoseTransformationVO {
|
||||
|
||||
private String taskId;
|
||||
|
||||
private String productImage;
|
||||
|
||||
private String gifUrl;
|
||||
|
||||
private String videoUrl;
|
||||
// GIF第一帧截图
|
||||
private String imageUrl;
|
||||
private String firstFrameUrl;
|
||||
|
||||
private byte isLiked;
|
||||
|
||||
private String status;
|
||||
|
||||
public PoseTransformationVO(Long id, String taskId, String gifUrl, String videoUrl, String firstFrameUrl, byte isLiked, String status) {
|
||||
this.id = id;
|
||||
this.taskId = taskId;
|
||||
this.gifUrl = gifUrl;
|
||||
this.videoUrl = videoUrl;
|
||||
this.firstFrameUrl = firstFrameUrl;
|
||||
this.isLiked = isLiked;
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,8 @@ public class SketchReconstructionVO {
|
||||
|
||||
private boolean isLiked;
|
||||
|
||||
private String category;
|
||||
|
||||
private String categoryValue;
|
||||
|
||||
}
|
||||
|
||||
@@ -4074,7 +4074,7 @@ public class PythonService {
|
||||
}
|
||||
}
|
||||
|
||||
public String modifyModelProportion(String mannequinPath, Float scale, String name, int top, int bottom) {
|
||||
public String modifyModelProportion(String mannequinPath, Float stretch, String name, int top, int bottom) {
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.connectTimeout(30, TimeUnit.SECONDS)
|
||||
.pingInterval(5, TimeUnit.SECONDS)//websocket轮训间隔(单位:秒)
|
||||
@@ -4087,7 +4087,7 @@ public class PythonService {
|
||||
// 模特的minio地址
|
||||
content.put("mannequins", mannequinPath);
|
||||
// 缩放比
|
||||
content.put("scale", scale.toString());
|
||||
content.put("resize_pixel", stretch.toString());
|
||||
// 结果存放桶名
|
||||
content.put("bucket_name", "aida-users");
|
||||
// 模特名uuid
|
||||
|
||||
@@ -52,6 +52,10 @@ public interface GenerateService extends IService<Generate> {
|
||||
|
||||
PoseTransformationVO getPoseTransformationResult(String taskId);
|
||||
|
||||
List<PoseTransformationVO> getPoseTransformationResultList(Long projectId);
|
||||
|
||||
Boolean disOrLikePose(Long transformedId, String likeOrDislike);
|
||||
|
||||
String modifyModelProportion(ModifyModelProportionDTO proportionDTO);
|
||||
|
||||
GenerateResultVO sketchReconstructionGenerate(SketchReconstructionDTO sketchReconstructionDTO);
|
||||
|
||||
@@ -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,40 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
}
|
||||
}
|
||||
|
||||
public List<PoseTransformationVO> getPoseTransformationResultList(Long 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 = new PoseTransformationVO();
|
||||
poseTransformationVO.setId(item.getId());
|
||||
poseTransformationVO.setProductImage(minioUtil.getPreSignedUrl(item.getProductImage(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
poseTransformationVO.setGifUrl(minioUtil.getPreSignedUrl(item.getGifUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
poseTransformationVO.setVideoUrl(minioUtil.getPreSignedUrl(item.getVideoUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
poseTransformationVO.setFirstFrameUrl(minioUtil.getPreSignedUrl(item.getFirstFrameUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
poseTransformationVO.setIsLiked(item.getIsLiked());
|
||||
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;
|
||||
|
||||
@@ -1112,6 +1141,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
sketchReconstruction.setProjectId(projectId);
|
||||
sketchReconstruction.setCollageImgSketchUrl(targetPath);
|
||||
sketchReconstruction.setGenerateDetailId(generateResultVO.getId());
|
||||
sketchReconstruction.setGender(sketchReconstructionDTO.getGender());
|
||||
sketchReconstruction.setCreateTime(LocalDateTime.now());
|
||||
sketchReconstructionMapper.insert(sketchReconstruction);
|
||||
}else {
|
||||
@@ -1136,6 +1166,10 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
GenerateDetail generateDetail = generateDetailMapper.selectById(sketchReconstruction.getGenerateDetailId());
|
||||
vo.setCollageSketchUrl(minioUtil.getPreSignedUrl(generateDetail.getUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
vo.setLiked(generateDetail.getIsLike().equals((byte)1));
|
||||
String clothCategory = pythonService.getClothCategory(generateDetail.getUrl(), sketchReconstruction.getGender());
|
||||
String messageFromResource = BusinessException.getMessageFromResource(clothCategory.toUpperCase());
|
||||
vo.setCategory(clothCategory);
|
||||
vo.setCategoryValue(messageFromResource);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@@ -1573,6 +1573,9 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
}else if (module.equals(Module.deReconstruction.name())){
|
||||
SketchReconstructionVO sketchReconstruction = generateService.getSketchReconstruction(projectDTO.getId());
|
||||
moduleChooseVO.setDeReconstruction(sketchReconstruction);
|
||||
}else if (module.equals(Module.poseTransfer.name())){
|
||||
List<PoseTransformationVO> poseTransformationResultList = generateService.getPoseTransformationResultList(projectDTO.getId());
|
||||
moduleChooseVO.setPoseTransfer(poseTransformationResultList);
|
||||
}
|
||||
}
|
||||
return moduleChooseVO;
|
||||
|
||||
Reference in New Issue
Block a user