BUGFIX: 1、singleDesign使用generate的印花没有传minio导致出现错误
2、项目中没有保存生成和上传的印花的类型
This commit is contained in:
@@ -19,7 +19,7 @@ public class DesignSinglePrint implements Serializable {
|
|||||||
@ApiModelProperty("印花的类型 Slogan || Logo || Pattern")
|
@ApiModelProperty("印花的类型 Slogan || Logo || Pattern")
|
||||||
private String level2Type;
|
private String level2Type;
|
||||||
|
|
||||||
@ApiModelProperty("印花是用户上传的还是从library中选的 collection/library")
|
@ApiModelProperty("印花是用户上传的还是从library中选的 collection/library/Generate")
|
||||||
private String designType;
|
private String designType;
|
||||||
|
|
||||||
@ApiModelProperty("印花url")
|
@ApiModelProperty("印花url")
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ import java.io.IOException;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -2924,6 +2926,7 @@ public class PythonService {
|
|||||||
p.getLocation().set(0, p.getLocation().get(0));
|
p.getLocation().set(0, p.getLocation().get(0));
|
||||||
p.getLocation().set(1, p.getLocation().get(1));
|
p.getLocation().set(1, p.getLocation().get(1));
|
||||||
Integer priority = p.getPriority();
|
Integer priority = p.getPriority();
|
||||||
|
setUriToMinioPath(p);
|
||||||
// todo 下标越界问题
|
// todo 下标越界问题
|
||||||
if (p.getIfSingle()){
|
if (p.getIfSingle()){
|
||||||
locationS.set(priority - 1, p.getLocation());
|
locationS.set(priority - 1, p.getLocation());
|
||||||
@@ -2959,6 +2962,25 @@ public class PythonService {
|
|||||||
return printToPython;
|
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) {
|
private void resolveDesignElement(DesignSinglePrintDTO trims, PrintToPython printToPython) {
|
||||||
// 没有design element 时的参数设置
|
// 没有design element 时的参数设置
|
||||||
DesignPythonItemElement element = new DesignPythonItemElement();
|
DesignPythonItemElement element = new DesignPythonItemElement();
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
@@ -91,6 +93,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
private String clothingBucket;
|
private String clothingBucket;
|
||||||
@Value("${minio.bucketName.partialDesign}")
|
@Value("${minio.bucketName.partialDesign}")
|
||||||
private String partialDesignBucket;
|
private String partialDesignBucket;
|
||||||
|
@Value("${minio.endpoint}")
|
||||||
|
private String minioEndpoint;
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
@Resource
|
@Resource
|
||||||
@@ -583,7 +587,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
// preview -> 不存数据库 submit -> 存数据库
|
// preview -> 不存数据库 submit -> 存数据库
|
||||||
List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails;
|
List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails;
|
||||||
JSONObject data = jsonObject.getJSONObject("data");
|
JSONObject data = jsonObject.getJSONObject("data");
|
||||||
if (data == null) {
|
if (data == null || data.toJSONString().equals("{}") ) {
|
||||||
throw new BusinessException("python response data is null");
|
throw new BusinessException("python response data is null");
|
||||||
}
|
}
|
||||||
JSONObject outfit = data.getJSONObject("0");
|
JSONObject outfit = data.getJSONObject("0");
|
||||||
@@ -911,6 +915,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
// 2.2 否:先删除原始印花,再添加新印花信息
|
// 2.2 否:先删除原始印花,再添加新印花信息
|
||||||
designItemDetailPrintService.deleteByDesignItemDetailId(designItemDetailTypeIdMap.get(designSingleItem.getPriority()));
|
designItemDetailPrintService.deleteByDesignItemDetailId(designItemDetailTypeIdMap.get(designSingleItem.getPriority()));
|
||||||
}
|
}
|
||||||
|
setUriToMinioPath(print);
|
||||||
|
|
||||||
DesignItemDetailPrint designItemDetailPrint = new DesignItemDetailPrint();
|
DesignItemDetailPrint designItemDetailPrint = new DesignItemDetailPrint();
|
||||||
designItemDetailPrint.setDesignItemDetailId(designItemDetailTypeIdMap.get(designSingleItem.getPriority()));
|
designItemDetailPrint.setDesignItemDetailId(designItemDetailTypeIdMap.get(designSingleItem.getPriority()));
|
||||||
designItemDetailPrint.setPrintType(printType);
|
designItemDetailPrint.setPrintType(printType);
|
||||||
@@ -928,6 +934,25 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 对印花类型为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 List<OutfitDetailPythonItem> convertToOutfitDetailPythonItemList(List<DesignPythonOutfitVO> layers) {
|
private List<OutfitDetailPythonItem> convertToOutfitDetailPythonItemList(List<DesignPythonOutfitVO> layers) {
|
||||||
List<OutfitDetailPythonItem> composeLayerPythonItem = Arrays.asList(new OutfitDetailPythonItem[layers.size()]);
|
List<OutfitDetailPythonItem> composeLayerPythonItem = Arrays.asList(new OutfitDetailPythonItem[layers.size()]);
|
||||||
layers.forEach(layer -> {
|
layers.forEach(layer -> {
|
||||||
|
|||||||
@@ -2407,7 +2407,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
collectionElement.setAccountId(accountId);
|
collectionElement.setAccountId(accountId);
|
||||||
collectionElement.setProjectId(projectId);
|
collectionElement.setProjectId(projectId);
|
||||||
collectionElement.setLevel1Type(CollectionLevel1TypeEnum.PRINT_BOARD.getRealName());
|
collectionElement.setLevel1Type(CollectionLevel1TypeEnum.PRINT_BOARD.getRealName());
|
||||||
// collectionElement.setLevel2Type(board.getLevel2Type());
|
collectionElement.setLevel2Type(board.getLevel2Type());
|
||||||
// collectionElement.setName(generateDetail.get());
|
// collectionElement.setName(generateDetail.get());
|
||||||
collectionElement.setUrl(generateDetail.getUrl());
|
collectionElement.setUrl(generateDetail.getUrl());
|
||||||
collectionElement.setHasPin(board.getIsPin());
|
collectionElement.setHasPin(board.getIsPin());
|
||||||
@@ -2417,7 +2417,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
}else {
|
}else {
|
||||||
if (old.contains(board.getId())) {
|
if (old.contains(board.getId())) {
|
||||||
CollectionElement collectionElement = collectionElementMapper.selectById(board.getId());
|
CollectionElement collectionElement = collectionElementMapper.selectById(board.getId());
|
||||||
// collectionElement.setLevel2Type(board.getLevel2Type());
|
collectionElement.setLevel2Type(board.getLevel2Type());
|
||||||
collectionElement.setHasPin(board.getIsPin());
|
collectionElement.setHasPin(board.getIsPin());
|
||||||
collectionElement.setUpdateDate(new Date());
|
collectionElement.setUpdateDate(new Date());
|
||||||
collectionElementMapper.updateById(collectionElement);
|
collectionElementMapper.updateById(collectionElement);
|
||||||
|
|||||||
Reference in New Issue
Block a user