BUGFIX: 1、singleDesign使用generate的印花没有传minio导致出现错误

2、项目中没有保存生成和上传的印花的类型
This commit is contained in:
2025-08-29 14:18:17 +08:00
parent 6441bfbbba
commit c93ae85b65
4 changed files with 51 additions and 4 deletions

View File

@@ -44,6 +44,8 @@ import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
@@ -2924,6 +2926,7 @@ public class PythonService {
p.getLocation().set(0, p.getLocation().get(0));
p.getLocation().set(1, p.getLocation().get(1));
Integer priority = p.getPriority();
setUriToMinioPath(p);
// todo 下标越界问题
if (p.getIfSingle()){
locationS.set(priority - 1, p.getLocation());
@@ -2959,6 +2962,25 @@ public class PythonService {
return printToPython;
}
// 对印花类型为Generate的图片路径进行特殊处理
private void setUriToMinioPath(DesignSinglePrint print){
if (print.getDesignType().equals("Generate")){
if (!StringUtil.isNullOrEmpty(print.getPath())){
try {
URI uri = new URI(print.getPath());
String path = uri.getPath(); // 获取路径部分: /aida-users/87/print/9ac32f65-6043-424d-a146-92c9c6d204ee-4-87.png
String substring = path.substring(1);
print.setMinIOPath(substring);
} catch (URISyntaxException e) {
throw new BusinessException(e.getMessage());
}
} else {
log.error("designType为Generate的印花path传值为空 {}", print.getPath());
throw new BusinessException("The path for the print is empty.");
}
}
}
private void resolveDesignElement(DesignSinglePrintDTO trims, PrintToPython printToPython) {
// 没有design element 时的参数设置
DesignPythonItemElement element = new DesignPythonItemElement();