Merge branch 'dev/dev' into dev/dev_xp

# Conflicts:
#	src/main/java/com/ai/da/model/dto/DesignSingleItemDTO.java
#	src/main/java/com/ai/da/python/vo/DesignPythonItem.java
This commit is contained in:
2024-05-10 17:25:06 +08:00
13 changed files with 138 additions and 13 deletions

View File

@@ -35,6 +35,7 @@ import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@@ -76,6 +77,8 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
@Value("${minio.bucketName.collectionElement}")
private String collectionElement;
@Value("${minio.bucketName.gradient}")
private String gradientBucketName;
@Transactional
@Override
@@ -348,7 +351,17 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
@Override
public ValidateElementVO validateElement(DesignCollectionDTO designDTO) {
ValidateElementVO elementVO = CopyUtil.copyObject(designDTO, ValidateElementVO.class);
List<CollectionColorDTO> colorBoards = elementVO.getColorBoards();
for (CollectionColorDTO colorBoard : colorBoards) {
String colorImg = colorBoard.getGradient().getColorImg();
String[] parts = colorImg.split(",");
String imageType = parts[0].split("/")[1].split(";")[0];
String base64Data = parts[1];
String gradientMinioUrl = minioUtil.uploadImageFromBase64(gradientBucketName, base64Data, imageType);
colorBoard.setGradientMinioUrl(gradientMinioUrl);
colorBoard.getGradient().setColorImg(null);
}
elementVO.setColorBoards(colorBoards);
List<Long> usedElementIds = elementVO.getUsedElementIds();
List<CollectionElement> libraryCollectionElements = elementVO.getLibraryCollectionElements();
List<CollectionElement> generateCollectionElements = elementVO.getGenerateCollectionElements();
@@ -767,7 +780,8 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
element.setColorRgb(color.getRgbValue());
//按时区计算
element.setCreateDate(DateUtil.getByTimeZone(timeZone));
color.getGradient().setColorImg(null);
element.setGradientString(JSON.toJSONString(color.getGradient()));
elements.add(element);
});
return elements;