BUGFIX: 1、singleDesign使用generate的印花没有传minio导致出现错误
2、项目中没有保存生成和上传的印花的类型
This commit is contained in:
@@ -37,6 +37,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
@@ -91,6 +93,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
private String clothingBucket;
|
||||
@Value("${minio.bucketName.partialDesign}")
|
||||
private String partialDesignBucket;
|
||||
@Value("${minio.endpoint}")
|
||||
private String minioEndpoint;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@Resource
|
||||
@@ -583,7 +587,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
// preview -> 不存数据库 submit -> 存数据库
|
||||
List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails;
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
if (data == null) {
|
||||
if (data == null || data.toJSONString().equals("{}") ) {
|
||||
throw new BusinessException("python response data is null");
|
||||
}
|
||||
JSONObject outfit = data.getJSONObject("0");
|
||||
@@ -911,6 +915,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
// 2.2 否:先删除原始印花,再添加新印花信息
|
||||
designItemDetailPrintService.deleteByDesignItemDetailId(designItemDetailTypeIdMap.get(designSingleItem.getPriority()));
|
||||
}
|
||||
setUriToMinioPath(print);
|
||||
|
||||
DesignItemDetailPrint designItemDetailPrint = new DesignItemDetailPrint();
|
||||
designItemDetailPrint.setDesignItemDetailId(designItemDetailTypeIdMap.get(designSingleItem.getPriority()));
|
||||
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) {
|
||||
List<OutfitDetailPythonItem> composeLayerPythonItem = Arrays.asList(new OutfitDetailPythonItem[layers.size()]);
|
||||
layers.forEach(layer -> {
|
||||
|
||||
@@ -2407,7 +2407,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
collectionElement.setAccountId(accountId);
|
||||
collectionElement.setProjectId(projectId);
|
||||
collectionElement.setLevel1Type(CollectionLevel1TypeEnum.PRINT_BOARD.getRealName());
|
||||
// collectionElement.setLevel2Type(board.getLevel2Type());
|
||||
collectionElement.setLevel2Type(board.getLevel2Type());
|
||||
// collectionElement.setName(generateDetail.get());
|
||||
collectionElement.setUrl(generateDetail.getUrl());
|
||||
collectionElement.setHasPin(board.getIsPin());
|
||||
@@ -2417,7 +2417,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
}else {
|
||||
if (old.contains(board.getId())) {
|
||||
CollectionElement collectionElement = collectionElementMapper.selectById(board.getId());
|
||||
// collectionElement.setLevel2Type(board.getLevel2Type());
|
||||
collectionElement.setLevel2Type(board.getLevel2Type());
|
||||
collectionElement.setHasPin(board.getIsPin());
|
||||
collectionElement.setUpdateDate(new Date());
|
||||
collectionElementMapper.updateById(collectionElement);
|
||||
|
||||
Reference in New Issue
Block a user