designSingle 加入渐变色

This commit is contained in:
2024-05-13 16:23:37 +08:00
parent 718198bcfe
commit d1fab003d2
7 changed files with 51 additions and 43 deletions

View File

@@ -31,6 +31,7 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import io.netty.util.internal.StringUtil;
import lombok.extern.slf4j.Slf4j;
import okhttp3.*;
import org.springframework.beans.factory.annotation.Value;
@@ -67,10 +68,15 @@ public class PythonService {
private String accessPythonPort;
@Value("${access.python.sr}")
private String srPythonPort;
@Value("${minio.bucketName.gradient}")
private String gradientBucketName;
@Resource
private PythonTAllInfoService pythonTAllInfoService;
@Resource
private MinioUtil minioUtil;
/**
* 生成打印的图片 二合一 (废弃于2024/01/02)
*
@@ -2611,6 +2617,22 @@ public class PythonService {
}else {
businessId = designSingleItem.getId();
}
// 判断是否是渐变色
String minioPath = null;
String gradientString = null;
if (!Objects.isNull(designSingleItem.getGradient())){
String colorImg = designSingleItem.getGradient().getColorImg();
if (StringUtil.isNullOrEmpty(colorImg)){
throw new BusinessException("The base64 data of the image is empty");
}
minioPath = minioUtil.base64Upload(colorImg, gradientBucketName);
designSingleItem.getGradient().setColorImg(null);
gradientString = JSONObject.toJSONString(designSingleItem.getGradient());
// todo 当渐变色不为空时,是否需要将颜色置为 0 0 0
}
response.add(new DesignPythonItem(
designSingleItem.getType(),
designSingleItem.getPath(),
@@ -2622,7 +2644,9 @@ public class PythonService {
pythonTAllInfoService.getImageIdByPath(designSingleItem.getPath()),
designSingleItem.getOffset(),
designSingleItem.getScale(),
designSingleItem.getPriority()));
designSingleItem.getPriority(),
minioPath,
gradientString));
});

View File

@@ -78,10 +78,6 @@ public class DesignPythonItem {
*/
private Integer priority;
// private List<List<Integer>> gradient;
private Float gradient_angle;
public static List<String> OUTWEAR_DRESS_BLOUSE = Arrays.asList(CollectionLevel2TypeEnum.OUTWEAR.getRealName(),
CollectionLevel2TypeEnum.DRESS.getRealName(), CollectionLevel2TypeEnum.BLOUSE.getRealName());
@@ -117,7 +113,8 @@ public class DesignPythonItem {
this.image_id = image_id;
}
public DesignPythonItem(String type, String path, String color, DesignPythonItemPrint print, Long businessId, Long image_id, List<Long> offset, Float resize_scale,Integer priority) {
public DesignPythonItem(String type, String path, String color, DesignPythonItemPrint print, Long businessId,
Long image_id, List<Long> offset, Float resize_scale, Integer priority, String gradient, String gradientString) {
this.type = type;
this.path = path;
this.color = color;
@@ -128,23 +125,10 @@ public class DesignPythonItem {
this.offset = offset;
this.resize_scale = resize_scale;
this.priority = priority;
this.gradient = gradient;
this.gradientString = gradientString;
}
// public DesignPythonItem(String type, String path, String color, DesignPythonItemPrint print, Long businessId, Long image_id, List<Long> offset, Float resize_scale,Integer priority) {
// this.type = type;
// this.path = path;
// this.color = color;
// this.print = print;
//// this.icon = icon;
// this.businessId = businessId;
// this.image_id = image_id;
// this.offset = offset;
// this.resize_scale = resize_scale;
// this.priority = priority;
//// this.gradient = gradient;
//// this.gradient_angle = gradient_angle;
// }
public DesignPythonItem(String type, String path, String color, DesignPythonItemPrint print, String icon, Long businessId, Long image_id) {
this.type = type;
this.path = path;