BUGFIX: 模特preview;

This commit is contained in:
shahaibo
2023-10-16 10:53:37 +08:00
parent 0dd765123f
commit 5e70f7ca73
5 changed files with 43 additions and 14 deletions

View File

@@ -130,9 +130,9 @@ public class LibraryController {
modelsDotDTO.setHigh(fileVO.getHigh());
modelsDotDTO.setWidth(fileVO.getWidth());
//存储template临时地址
String path = calculateTempFileUrl(userInfo.getId());
File uploadFile = FileUtil.upload(file, path);
modelsDotDTO.setTemplateUrl(calculateTemplateUrl(uploadFile));
String path = calculateTempFileUrlNew(userInfo.getId());
String uploadPath = minioUtil.upload("aida-tmp", path, file);
modelsDotDTO.setTemplateUrl(uploadPath);
}else{
Assert.notNull(modelsDotDTO.getLibraryId(),"libraryId cannot be empty!");
Assert.notNull(modelsDotDTO.getTemplateId(),"templateId cannot be empty!");
@@ -147,7 +147,7 @@ public class LibraryController {
Response<String> response =new Response();
log.info("Models打点预览入参####{}", JSON.toJSONString(modelsDotDTO));
String url = libraryModelPointService.modelsDot(modelsDotDTO);
response.setData(url);
response.setData(minioUtil.getPresignedUrl(url, 24 * 60));
return response;
}
@@ -163,6 +163,10 @@ public class LibraryController {
return rootPath + day + File.separator + "tmp" + File.separator + userId + File.separator+ UUID.randomUUID().toString();
}
private String calculateTempFileUrlNew(Long userId) {
return userId.toString();
}
private String calculateTemplateUrl(File uploadFile){
String linuxDomain = fileProperties.getLinuxDomain();
if (!StringUtils.isEmpty(linuxDomain)) {

View File

@@ -1852,18 +1852,21 @@ public class PythonService {
dress.setType(SysFileLevel2TypeEnum.DRESS.getRealName());
dress.setColor("none");
dress.setIcon("none");
dress.setPrint(new DesignPythonItemPrint("none",
CollectionLevel1TypeEnum.PRINT_BOARD.getRealName(), 0.3f, Boolean.FALSE));
dress.setPath("https://www.aida.com.hk/download/sys/images/blouse/blouse_p5_817.jpg");
DesignPythonItemPrint designPythonItemPrint = new DesignPythonItemPrint();
designPythonItemPrint.setIfSingle(false);
designPythonItemPrint.setPrint_path_list(new ArrayList<>());
// dress.setPrint(new DesignPythonItemPrint("none",
// CollectionLevel1TypeEnum.PRINT_BOARD.getRealName(), 0.3f, Boolean.FALSE));
dress.setPrint(designPythonItemPrint);
dress.setPath("aida-sys-images/images/female/blouse/blouse_p5_817.jpg");
response.add(dress);
DesignPythonItem skirt = new DesignPythonItem();
skirt.setType(SysFileLevel2TypeEnum.SKIRT.getRealName());
skirt.setColor("none");
skirt.setIcon("none");
skirt.setPrint(new DesignPythonItemPrint("none",
CollectionLevel1TypeEnum.PRINT_BOARD.getRealName(), 0.3f, Boolean.FALSE));
skirt.setPath("https://www.aida.com.hk/download/sys/images/trousers/trousers_974.jpg");
skirt.setPrint(designPythonItemPrint);
skirt.setPath("aida-sys-images/images/female/trousers/trousers_974.jpg");
response.add(skirt);
DesignPythonItem body = new DesignPythonItem();

View File

@@ -5,6 +5,7 @@ import com.ai.da.model.dto.*;
import com.ai.da.model.vo.DesignCollectionVO;
import com.ai.da.model.vo.DesignItemDetailVO;
import com.ai.da.model.vo.DesignLikeVO;
import com.ai.da.python.vo.DesignPythonObjects;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -78,4 +79,6 @@ public interface DesignService extends IService<Design> {
DesignItemDetailVO detail(Long designPythonOutfitId,Long designItemId);
Integer designProcess(String processId);
void relationImageId(DesignPythonObjects objects);
}

View File

@@ -317,7 +317,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
// return saveDesignItemAndDetail(pythonObjects,designId,collectionId,userInfo,designDTO.getTimeZone());
}
private void relationImageId(DesignPythonObjects pythonObjects) {
@Override
public void relationImageId(DesignPythonObjects pythonObjects) {
if (Objects.isNull(pythonObjects)) {
return;
}

View File

@@ -2,6 +2,7 @@ package com.ai.da.service.impl;
import cn.hutool.core.lang.Assert;
import cn.hutool.json.JSONUtil;
import com.ai.da.common.config.exception.BusinessException;
import com.ai.da.common.enums.LibraryLevel1TypeEnum;
import com.ai.da.common.enums.SingleOverallEnum;
import com.ai.da.common.utils.CopyUtil;
@@ -17,15 +18,18 @@ import com.ai.da.model.vo.LibraryModelPointVO;
import com.ai.da.model.vo.LibraryUpdateVo;
import com.ai.da.python.PythonService;
import com.ai.da.python.vo.DesignPythonObjects;
import com.ai.da.service.DesignService;
import com.ai.da.service.LibraryModelPointService;
import com.ai.da.service.LibraryService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.omg.PortableServer.LIFESPAN_POLICY_ID;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.Arrays;
@@ -49,6 +53,8 @@ public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointM
private LibraryService libraryService;
@Resource
private PythonService pythonService;
@Resource
private DesignService designService;
@Override
public LibraryModelPointVO saveOrEditTemplatePoint(LibraryModelPointDTO libraryModelPointDTO) {
@@ -109,9 +115,21 @@ public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointM
public String modelsDot( ModelsDotDTO modelsDotDTO) {
DesignPythonObjects objects =pythonService.covertModelsDotParam(
modelsDotDTO, SingleOverallEnum.OVERALL.getRealName(),"");
pythonService.design(objects);
return objects.getObjects().get(0).getBasic().getSave_name();
designService.relationImageId(objects);
JSONObject jsonObject = pythonService.designNew(objects);
JSONObject data = jsonObject.getJSONObject("data");
if (data == null) {
throw new BusinessException("python design response is null");
}
JSONObject jsonObject1 = data.getJSONObject("0");
if (jsonObject1 == null) {
throw new BusinessException("python design response is null");
}
String synthesisUrl = jsonObject1.getString("synthesis_url");
if (StringUtils.isEmpty(synthesisUrl)) {
throw new BusinessException("python design response synthesis_url is null");
}
return synthesisUrl;
}
@Override