1、design single 添加 design elements
2、design single -- print添加level2Type 3、替换部分flask接口 为 fastAPI接口
This commit is contained in:
@@ -20,6 +20,16 @@ public class DesignItemDetailPrint {
|
||||
* 关联t_design_item_detail表ID
|
||||
*/
|
||||
private Long designItemDetailId;
|
||||
|
||||
/**
|
||||
* 印花的类型 print || trims
|
||||
*/
|
||||
private String printType;
|
||||
|
||||
/**
|
||||
* 印花二级分类 Slogan || Logo || Pattern
|
||||
*/
|
||||
private String level2Type;
|
||||
/**
|
||||
* 印花路径
|
||||
*/
|
||||
|
||||
@@ -26,10 +26,10 @@ public class CollectionColorDTO {
|
||||
@ApiModelProperty("潘通RGB值")
|
||||
private String rgbValue;
|
||||
|
||||
// private Gradient gradient;
|
||||
//
|
||||
// private String gradientString;
|
||||
private Gradient gradient;
|
||||
|
||||
// private String gradientMinioUrl;
|
||||
private String gradientString;
|
||||
|
||||
private String gradientMinioUrl;
|
||||
|
||||
}
|
||||
|
||||
@@ -50,10 +50,13 @@ public class DesignSingleItemDTO implements Serializable {
|
||||
@ApiModelProperty("图层优先级")
|
||||
private Integer priority;
|
||||
|
||||
// @ApiModelProperty("渐变 颜色")
|
||||
// private Gradient gradient;
|
||||
@ApiModelProperty("渐变 颜色")
|
||||
private Gradient gradient;
|
||||
|
||||
@ApiModelProperty("画笔修改过的sketch图片的base64格式的数据")
|
||||
private String sketchString;
|
||||
|
||||
@ApiModelProperty("衣服上的装饰")
|
||||
private DesignSinglePrintDTO trims;
|
||||
|
||||
}
|
||||
|
||||
@@ -23,4 +23,9 @@ public class DesignSinglePrintDTO implements Serializable {
|
||||
|
||||
public DesignSinglePrintDTO() {
|
||||
}
|
||||
|
||||
public DesignSinglePrintDTO(Boolean ifSingle, List<DesignSinglePrint> prints) {
|
||||
this.ifSingle = ifSingle;
|
||||
this.prints = prints;
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,9 @@ public class DesignItemClothesDetailVO {
|
||||
@ApiModelProperty("print详细")
|
||||
private DesignSinglePrintDTO printObject = new DesignSinglePrintDTO();
|
||||
|
||||
@ApiModelProperty("design elements详细")
|
||||
private DesignSinglePrintDTO trims = new DesignSinglePrintDTO();
|
||||
|
||||
@ApiModelProperty("对应图层信息")
|
||||
private List<DesignPythonOutfitVO> layersObject;
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@ import java.util.List;
|
||||
@ApiModel("design single 印花详情")
|
||||
public class DesignSinglePrint implements Serializable {
|
||||
|
||||
@ApiModelProperty("印花的类型 Slogan || Logo || Pattern")
|
||||
private String level2Type;
|
||||
|
||||
@ApiModelProperty("印花是用户上传的还是从library中选的 collection/library")
|
||||
private String designType;
|
||||
|
||||
@@ -45,7 +48,8 @@ public class DesignSinglePrint implements Serializable {
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
public DesignSinglePrint(String path, String minIOPath, List<Double> location, Double scale, Double angle, Integer priority) {
|
||||
public DesignSinglePrint(String level2Type, String path, String minIOPath, List<Double> location, Double scale, Double angle, Integer priority) {
|
||||
this.level2Type = level2Type;
|
||||
this.path = path;
|
||||
this.minIOPath = minIOPath;
|
||||
this.location = location;
|
||||
|
||||
@@ -67,7 +67,7 @@ public class PythonService {
|
||||
@Value("${access.python.port:''}")
|
||||
private String accessPythonPort;
|
||||
@Value("${access.python.address}")
|
||||
private String srPythonPort;
|
||||
private String fastApiPythonAddress;
|
||||
@Value("${minio.bucketName.gradient}")
|
||||
private String gradientBucketName;
|
||||
|
||||
@@ -270,13 +270,13 @@ public class PythonService {
|
||||
private void updateSketchNumbers(CurrentDesignPictureTypeEnum designPictureType, int[] sketchNumbers) {
|
||||
switch (designPictureType) {
|
||||
case PIN:
|
||||
sketchNumbers[0] ++;
|
||||
sketchNumbers[0]++;
|
||||
break;
|
||||
case NO_PIN:
|
||||
sketchNumbers[2] --;
|
||||
sketchNumbers[2]--;
|
||||
break;
|
||||
case SYS_FILE:
|
||||
sketchNumbers[1] --;
|
||||
sketchNumbers[1]--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -316,7 +316,7 @@ public class PythonService {
|
||||
Long l = RandomsUtil.randomSysFile(0l, 2l);
|
||||
if (l == 0l) {
|
||||
return CurrentDesignPictureTypeEnum.NO_PIN;
|
||||
}else {
|
||||
} else {
|
||||
return CurrentDesignPictureTypeEnum.SYS_FILE;
|
||||
}
|
||||
}
|
||||
@@ -793,6 +793,7 @@ public class PythonService {
|
||||
RequestBody body = RequestBody.create(mediaType, param);
|
||||
Request request = new Request.Builder()
|
||||
.url(accessPythonIp + ":" + accessPythonPort + "/api/attribute_recognition")
|
||||
// .url(fastApiPythonAddress + "/api/attribute_recognition")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
@@ -835,6 +836,7 @@ public class PythonService {
|
||||
RequestBody body = RequestBody.create(mediaType, param);
|
||||
Request request = new Request.Builder()
|
||||
.url(accessPythonIp + ":" + accessPythonPort + "/api/attribute_recognition")
|
||||
// .url(fastApiPythonAddress + "/api/attribute_recognition")
|
||||
.method("POST", body)
|
||||
// .addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
||||
.addHeader("Content-Type", "application/json")
|
||||
@@ -2358,7 +2360,8 @@ public class PythonService {
|
||||
log.info("design请求python 参数:####{}", param);
|
||||
RequestBody body = RequestBody.create(mediaType, param);
|
||||
Request request = new Request.Builder()
|
||||
.url(accessPythonIp + ":" + accessPythonPort + "/api/design")
|
||||
// .url(accessPythonIp + ":" + accessPythonPort + "/api/design")
|
||||
.url(fastApiPythonAddress + "/api/design")
|
||||
// .url(accessPythonIp + ":10200/aifda/api/v1.0/generate")
|
||||
.method("POST", body)
|
||||
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
||||
@@ -2464,7 +2467,8 @@ public class PythonService {
|
||||
System.out.println(JSON.toJSONString(content));
|
||||
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content));
|
||||
Request request = new Request.Builder()
|
||||
.url(accessPythonIp + ":" + accessPythonPort + "/api/attribute_retrieve")
|
||||
// .url(accessPythonIp + ":" + accessPythonPort + "/api/attribute_retrieve")
|
||||
.url(fastApiPythonAddress + "/api/attribute_retrieve")
|
||||
// .url(accessPythonIp+":9991/aifda/api/v1.0/attribute_retrieval")
|
||||
.method("POST", body)
|
||||
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
||||
@@ -2611,22 +2615,22 @@ public class PythonService {
|
||||
|
||||
designSingleItemList.forEach(designSingleItem -> {
|
||||
Long businessId;
|
||||
if (!designSingleIncludeLayersDTO.getIsPreview() && designSingleItem.getChanged()){
|
||||
if (!designSingleIncludeLayersDTO.getIsPreview() && designSingleItem.getChanged()) {
|
||||
String s = String.valueOf(designSingleItem.getId());
|
||||
businessId = Long.parseLong(s.substring(0,s.length() - 3));
|
||||
}else {
|
||||
businessId = Long.parseLong(s.substring(0, s.length() - 3));
|
||||
} else {
|
||||
businessId = designSingleItem.getId();
|
||||
}
|
||||
|
||||
// 判断是否是渐变色
|
||||
String minioPath = null;
|
||||
String gradientString = null;
|
||||
if (!Objects.isNull(designSingleItem.getGradient())){
|
||||
if (!Objects.isNull(designSingleItem.getGradient())) {
|
||||
String colorImg = designSingleItem.getGradient().getColorImg();
|
||||
if (StringUtil.isNullOrEmpty(colorImg)){
|
||||
if (StringUtil.isNullOrEmpty(colorImg)) {
|
||||
throw new BusinessException("The base64 data of the image is empty");
|
||||
}
|
||||
minioPath = minioUtil.base64UploadToPath(colorImg, gradientBucketName,null);
|
||||
minioPath = minioUtil.base64UploadToPath(colorImg, gradientBucketName, null);
|
||||
designSingleItem.getGradient().setColorImg(null);
|
||||
gradientString = JSONObject.toJSONString(designSingleItem.getGradient());
|
||||
|
||||
@@ -2637,7 +2641,8 @@ public class PythonService {
|
||||
designSingleItem.getType(),
|
||||
designSingleItem.getPath(),
|
||||
designSingleItem.getColor(),
|
||||
resolveDesignSinglePrint(designSingleItem.getPrintObject(), designSingleItem.getPath()),
|
||||
resolveDesignSinglePrint(designSingleItem.getPrintObject(), null),
|
||||
resolveDesignElement(designSingleItem.getTrims()),
|
||||
// businessId designItemDetailId (python端确认没有作用,但是数据库需要存,作用:未知)
|
||||
// designSingleItem.getId(),
|
||||
businessId,
|
||||
@@ -2669,21 +2674,24 @@ public class PythonService {
|
||||
}
|
||||
DesignPythonItemPrint print = CopyUtil.copyObject(printObject, DesignPythonItemPrint.class);
|
||||
|
||||
List<List<Double>> location = new ArrayList<>(printObject.getPrints().size());
|
||||
List<Double> scale = new ArrayList<>(printObject.getPrints().size());
|
||||
List<Double> angle = new ArrayList<>(printObject.getPrints().size());
|
||||
ArrayList<String> paths = new ArrayList<>(printObject.getPrints().size());
|
||||
int size = printObject.getPrints().size();
|
||||
// 占位符填充数组
|
||||
List<List<Double>> location = new ArrayList<>(Collections.nCopies(size, null));
|
||||
List<Double> scale = new ArrayList<>(Collections.nCopies(size, null));
|
||||
List<Double> angle = new ArrayList<>(Collections.nCopies(size, null));
|
||||
ArrayList<String> paths = new ArrayList<>(Collections.nCopies(size, null));
|
||||
|
||||
// 设置印花的位置、大小、旋转角度
|
||||
// 优先级越大,越靠近顶层,在传输给python的数组中,越靠前
|
||||
List<DesignSinglePrint> prints = printObject.getPrints();
|
||||
prints.forEach(p -> {
|
||||
p.getLocation().set(0, p.getLocation().get(0));
|
||||
p.getLocation().set(1, p.getLocation().get(1));
|
||||
Integer priority = p.getPriority();
|
||||
location.add(priority - 1, p.getLocation());
|
||||
scale.add(priority - 1, p.getScale());
|
||||
angle.add(priority - 1, p.getAngle());
|
||||
paths.add(priority - 1, p.getMinIOPath());
|
||||
location.set(size - priority, p.getLocation());
|
||||
scale.set(size - priority, p.getScale());
|
||||
angle.set(size - priority, p.getAngle());
|
||||
paths.set(size - priority, p.getMinIOPath());
|
||||
// log.info("本次print打点locations###{}###fileVO{}", p.getLocation(), JSON.toJSONString(fileVO));
|
||||
});
|
||||
print.setLocation(location);
|
||||
@@ -2694,6 +2702,41 @@ public class PythonService {
|
||||
return print;
|
||||
}
|
||||
|
||||
private DesignPythonItemElement resolveDesignElement(DesignSinglePrintDTO trims) {
|
||||
// 没有design element 时的参数设置
|
||||
if (Objects.isNull(trims.getIfSingle()) && CollectionUtil.isEmpty(trims.getPrints())) {
|
||||
return null;
|
||||
}
|
||||
DesignPythonItemElement print = new DesignPythonItemElement();
|
||||
|
||||
int size = trims.getPrints().size();
|
||||
// 占位符填充数组
|
||||
List<List<Double>> location = new ArrayList<>(Collections.nCopies(size, null));
|
||||
List<Double> scale = new ArrayList<>(Collections.nCopies(size, null));
|
||||
List<Double> angle = new ArrayList<>(Collections.nCopies(size, null));
|
||||
ArrayList<String> paths = new ArrayList<>(Collections.nCopies(size, null));
|
||||
|
||||
// 设置印花的位置、大小、旋转角度
|
||||
// 优先级越大,越靠近顶层,在传输给python的数组中,越靠前
|
||||
List<DesignSinglePrint> prints = trims.getPrints();
|
||||
prints.forEach(p -> {
|
||||
p.getLocation().set(0, p.getLocation().get(0));
|
||||
p.getLocation().set(1, p.getLocation().get(1));
|
||||
Integer priority = p.getPriority();
|
||||
location.set(size - priority, p.getLocation());
|
||||
scale.set(size - priority, p.getScale());
|
||||
angle.set(size - priority, p.getAngle());
|
||||
paths.set(size - priority, p.getMinIOPath());
|
||||
// log.info("本次print打点locations###{}###fileVO{}", p.getLocation(), JSON.toJSONString(fileVO));
|
||||
});
|
||||
print.setLocation(location);
|
||||
print.setElement_scale_list(scale);
|
||||
print.setElement_angle_list(angle);
|
||||
print.setElement_path_list(paths);
|
||||
|
||||
return print;
|
||||
}
|
||||
|
||||
private DesignPythonBasic coverToSingleBasic(DesignPythonItem designPythonItem, String singleOverall,
|
||||
String switchCategory, List<String> priority,
|
||||
DesignLibraryModelPointVO designLibraryModelPoint) {
|
||||
@@ -2856,6 +2899,7 @@ public class PythonService {
|
||||
RequestBody body = RequestBody.create(mediaType, param);
|
||||
Request request = new Request.Builder()
|
||||
.url(accessPythonIp + ":" + accessPythonPort + "/api/design")
|
||||
// .url(fastApiPythonAddress + "/api/design")
|
||||
// .url(accessPythonIp + ":10200/aifda/api/v1.0/generate")
|
||||
.method("POST", body)
|
||||
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
||||
@@ -2953,7 +2997,7 @@ public class PythonService {
|
||||
// .url("http://127.0.0.1:5000/api/diffusion")
|
||||
// .url(accessPythonIp + ":" + accessPythonPort + "/api/diffusion")
|
||||
// .url(accessPythonIp + ":" + accessPythonPort + "/api/generate_image")
|
||||
.url(srPythonPort + servicePath)
|
||||
.url(fastApiPythonAddress + servicePath)
|
||||
.method("POST", body)
|
||||
// .addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
||||
.addHeader("Content-Type", "application/json")
|
||||
@@ -2997,7 +3041,7 @@ public class PythonService {
|
||||
log.info("Generate##responseObject###{}", jsonObject);
|
||||
// return setGenerateImageList(jsonObject.getJSONObject("data"));
|
||||
return Boolean.TRUE;
|
||||
}else {
|
||||
} else {
|
||||
log.info("generateSketchOrPrintPrint失败###{}", jsonObject);
|
||||
log.info("Generate Exception! Code : " + jsonObject.get("code"));
|
||||
return Boolean.FALSE;
|
||||
@@ -3016,6 +3060,7 @@ public class PythonService {
|
||||
RequestBody body = RequestBody.create(mediaType, content);
|
||||
Request request = new Request.Builder()
|
||||
.url(accessPythonIp + ":" + accessPythonPort + portAndRoute)
|
||||
// .url(fastApiPythonAddress + portAndRoute)
|
||||
.method("POST", body)
|
||||
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
||||
.addHeader("Content-Type", "application/json")
|
||||
@@ -3036,13 +3081,13 @@ public class PythonService {
|
||||
List<String> imageUrlList = JSONObject.parseArray(jsonObject.get("list").toString(), String.class);
|
||||
if (imageUrlList.isEmpty()) {
|
||||
log.error("PythonService##generateSketchOrPrint异常###{}", "diffusion response list is null");
|
||||
// todo 如果这里返回为空,是判断出错还是返回给前端空
|
||||
// 如果这里返回为空,是判断出错还是返回给前端空
|
||||
throw new BusinessException("The data returned on the python side is empty");
|
||||
}
|
||||
|
||||
return imageUrlList;
|
||||
}
|
||||
|
||||
/** 废弃状态 */
|
||||
public String composeLayers(List<OutfitDetailPythonItem> layersDetail) {
|
||||
HashMap<String, List<OutfitDetailPythonItem>> layers = new HashMap<>();
|
||||
HashMap<String, HashMap<String, List<OutfitDetailPythonItem>>> content = new HashMap<>();
|
||||
@@ -3135,7 +3180,8 @@ public class PythonService {
|
||||
.readTimeout(60, TimeUnit.SECONDS)//读取超时(单位:秒)
|
||||
.writeTimeout(60, TimeUnit.SECONDS)//写入超时(单位:秒)
|
||||
.build();
|
||||
String url = accessPythonIp + ":" + accessPythonPort + "/api/generate_cancel/" + taskId;
|
||||
// String url = accessPythonIp + ":" + accessPythonPort + "/api/generate_cancel/" + taskId;
|
||||
String url = fastApiPythonAddress + "/api/generate_cancel/" + taskId;
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
// .addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
||||
@@ -3177,7 +3223,7 @@ public class PythonService {
|
||||
String jsonString = JSON.toJSONString(content, SerializerFeature.WriteNullStringAsEmpty);
|
||||
RequestBody body = RequestBody.create(mediaType, jsonString);
|
||||
Request request = new Request.Builder()
|
||||
.url(srPythonPort + "/api/super_resolution")
|
||||
.url(fastApiPythonAddress + "/api/super_resolution")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
@@ -3217,6 +3263,7 @@ public class PythonService {
|
||||
RequestBody body = RequestBody.create(mediaType, jsonString);
|
||||
Request request = new Request.Builder()
|
||||
.url(accessPythonIp + ":" + accessPythonPort + "/api/translateToEN")
|
||||
// .url(fastApiPythonAddress + "/api/translateToEN")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
|
||||
@@ -28,15 +28,20 @@ public class DesignPythonItem {
|
||||
*/
|
||||
private String color;
|
||||
|
||||
// private String gradient;
|
||||
private String gradient;
|
||||
|
||||
// private String gradientString;
|
||||
private String gradientString;
|
||||
|
||||
/**
|
||||
* 对应的print图片的绝对路径
|
||||
*/
|
||||
private DesignPythonItemPrint print;
|
||||
|
||||
/**
|
||||
* trims 衣服上的装饰
|
||||
*/
|
||||
private DesignPythonItemElement element;
|
||||
|
||||
/**
|
||||
* 对应的icon的绝对路径
|
||||
*/
|
||||
@@ -113,20 +118,21 @@ 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, DesignPythonItemElement element, 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;
|
||||
this.print = print;
|
||||
this.element = element;
|
||||
// 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.gradientString = gradientString;
|
||||
this.gradient = gradient;
|
||||
this.gradientString = gradientString;
|
||||
}
|
||||
|
||||
public DesignPythonItem(String type, String path, String color, DesignPythonItemPrint print, String icon, Long businessId, Long image_id) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
|
||||
public interface DesignItemDetailPrintService extends IService<DesignItemDetailPrint> {
|
||||
List<DesignItemDetailPrint> getByDesignItemDetailId(Long designItemDetailId);
|
||||
List<DesignItemDetailPrint> getByDesignItemDetailId(Long designItemDetailId, String printType);
|
||||
|
||||
void deleteByDesignItemDetailId(Long designItemDetailId);
|
||||
}
|
||||
|
||||
@@ -87,6 +87,8 @@ public class ChatRobotServiceImpl implements ChatRobotService {
|
||||
private String accessPythonIp;
|
||||
@Value("${access.python.port:''}")
|
||||
private String accessPythonPort;
|
||||
@Value("${access.python.address}")
|
||||
private String fastApiPythonAddress;
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ChatRobotVO sendMessageToChatRobot(ChatSendDTO chatSendDTO) {
|
||||
@@ -150,7 +152,8 @@ public class ChatRobotServiceImpl implements ChatRobotService {
|
||||
RequestBody body = RequestBody.create(mediaType, param);
|
||||
Request request = new Request.Builder()
|
||||
// .url("http://127.0.0.1:5000/api/chat_stream_test")
|
||||
.url(accessPythonIp + ":" + accessPythonPort + "/api/chat_stream_test")
|
||||
// .url(accessPythonIp + ":" + accessPythonPort + "/api/chat_stream_test")
|
||||
.url(fastApiPythonAddress + "/api/chat_robot")
|
||||
// .url(accessPythonIp + ":10200/aifda/api/v1.0/generate")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
|
||||
@@ -15,9 +15,10 @@ public class DesignItemDetailPrintServiceImpl extends ServiceImpl<DesignItemDeta
|
||||
|
||||
|
||||
@Override
|
||||
public List<DesignItemDetailPrint> getByDesignItemDetailId(Long designItemDetailId) {
|
||||
public List<DesignItemDetailPrint> getByDesignItemDetailId(Long designItemDetailId, String printType) {
|
||||
QueryWrapper<DesignItemDetailPrint> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("design_item_detail_id", designItemDetailId);
|
||||
queryWrapper.eq("print_type", printType);
|
||||
|
||||
return baseMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@@ -681,6 +681,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
designItemClothesDetailVO.setMinIOPath(singleItem.getPath());
|
||||
designItemClothesDetailVO.setColor(panToneService.getPantoneByRgb(singleItem.getColor()));
|
||||
designItemClothesDetailVO.setPrintObject(singleItem.getPrintObject());
|
||||
designItemClothesDetailVO.setTrims(singleItem.getTrims());
|
||||
designItemClothesDetailVO.setLayersObject(layersObject.stream().filter(
|
||||
layers -> (singleItem.getType().toLowerCase().equals(layers.getImageCategory().split("_")[0])
|
||||
&& (flag ? Boolean.TRUE : singleItem.getPriority().equals(layers.getPriority())))
|
||||
@@ -704,36 +705,58 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
|
||||
designSingleItemDTOList.forEach(designSingleItem -> {
|
||||
// 1、判断有无印花,无印花则跳过
|
||||
DesignSinglePrintDTO printObject = designSingleItem.getPrintObject();
|
||||
if (printObject.getIfSingle().equals(Boolean.FALSE)
|
||||
&& CollectionUtil.isEmpty(printObject.getPrints())) {
|
||||
return;
|
||||
} else {
|
||||
// 2、有印花,添加到list
|
||||
printObject.getPrints().forEach(print -> {
|
||||
// 2.1 判断是否第一次添加印花,是:直接添加
|
||||
List<DesignItemDetailPrint> designItemDetailPrintList = designItemDetailPrintService.getByDesignItemDetailId(designItemDetailTypeIdMap.get(designSingleItem.getPriority()));
|
||||
if (!designItemDetailPrintList.isEmpty()) {
|
||||
// 2.2 否:先删除原始印花,再添加新印花信息
|
||||
designItemDetailPrintService.deleteByDesignItemDetailId(designItemDetailTypeIdMap.get(designSingleItem.getPriority()));
|
||||
}
|
||||
DesignItemDetailPrint designItemDetailPrint = new DesignItemDetailPrint();
|
||||
designItemDetailPrint.setDesignItemDetailId(designItemDetailTypeIdMap.get(designSingleItem.getPriority()));
|
||||
designItemDetailPrint.setPath(print.getMinIOPath());
|
||||
designItemDetailPrint.setScale(print.getScale());
|
||||
designItemDetailPrint.setSingleOrOverall(printObject.getIfSingle() ? "single" : "overall");
|
||||
designItemDetailPrint.setCreateDate(LocalDateTime.now(ZoneId.of(timeZone)));
|
||||
// single、overall模式下都有position、angle和priority
|
||||
designItemDetailPrint.setPosition(print.getLocation().toString());
|
||||
designItemDetailPrint.setAngle(print.getAngle());
|
||||
designItemDetailPrint.setPriority(print.getPriority());
|
||||
designItemDetailPrints.add(designItemDetailPrint);
|
||||
});
|
||||
}
|
||||
setDesignItemDetailPrintList(designSingleItem, designItemDetailPrints, "print", designItemDetailTypeIdMap, timeZone);
|
||||
|
||||
// 2、判断有无装饰配件
|
||||
setDesignItemDetailPrintList(designSingleItem, designItemDetailPrints, "trims", designItemDetailTypeIdMap, timeZone);
|
||||
});
|
||||
return designItemDetailPrints;
|
||||
}
|
||||
|
||||
private void setDesignItemDetailPrintList(DesignSingleItemDTO designSingleItem,
|
||||
ArrayList<DesignItemDetailPrint> designItemDetailPrints,
|
||||
String printType,
|
||||
Map<Integer, Long> designItemDetailTypeIdMap,
|
||||
String timeZone){
|
||||
DesignSinglePrintDTO printObject;
|
||||
if (printType.equals("print")){
|
||||
printObject = designSingleItem.getPrintObject();
|
||||
}else {
|
||||
printObject = designSingleItem.getTrims();
|
||||
if (Objects.isNull(printObject.getIfSingle())){
|
||||
printObject.setIfSingle(Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (printObject.getIfSingle().equals(Boolean.FALSE)
|
||||
&& CollectionUtil.isEmpty(printObject.getPrints())) {
|
||||
return;
|
||||
} else {
|
||||
// 2、有印花,添加到list
|
||||
printObject.getPrints().forEach(print -> {
|
||||
// 2.1 判断是否第一次添加印花,是:直接添加
|
||||
List<DesignItemDetailPrint> designItemDetailPrintList = designItemDetailPrintService.getByDesignItemDetailId(designItemDetailTypeIdMap.get(designSingleItem.getPriority()), printType);
|
||||
if (!designItemDetailPrintList.isEmpty()) {
|
||||
// 2.2 否:先删除原始印花,再添加新印花信息
|
||||
designItemDetailPrintService.deleteByDesignItemDetailId(designItemDetailTypeIdMap.get(designSingleItem.getPriority()));
|
||||
}
|
||||
DesignItemDetailPrint designItemDetailPrint = new DesignItemDetailPrint();
|
||||
designItemDetailPrint.setDesignItemDetailId(designItemDetailTypeIdMap.get(designSingleItem.getPriority()));
|
||||
designItemDetailPrint.setPrintType(printType);
|
||||
designItemDetailPrint.setLevel2Type(print.getLevel2Type());
|
||||
designItemDetailPrint.setPath(print.getMinIOPath());
|
||||
designItemDetailPrint.setScale(print.getScale());
|
||||
designItemDetailPrint.setSingleOrOverall(printType.equals("print") ? printObject.getIfSingle() ? "single" : "overall" : "single");
|
||||
designItemDetailPrint.setCreateDate(LocalDateTime.now(ZoneId.of(timeZone)));
|
||||
// single、overall模式下都有position、angle和priority
|
||||
designItemDetailPrint.setPosition(print.getLocation().toString());
|
||||
designItemDetailPrint.setAngle(print.getAngle());
|
||||
designItemDetailPrint.setPriority(print.getPriority());
|
||||
designItemDetailPrints.add(designItemDetailPrint);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private List<OutfitDetailPythonItem> convertToOutfitDetailPythonItemList(List<DesignPythonOutfitVO> layers) {
|
||||
List<OutfitDetailPythonItem> composeLayerPythonItem = Arrays.asList(new OutfitDetailPythonItem[layers.size()]);
|
||||
layers.forEach(layer -> {
|
||||
|
||||
@@ -1000,12 +1000,19 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
d.setLevel1Type(converTypeToLevel1(o.getType()));
|
||||
// d.setGradient(JSONObject.parseObject(o.getGradientString(), Gradient.class));
|
||||
// 根据designItemDetailId获取印花
|
||||
List<DesignItemDetailPrint> prints = designItemDetailPrintService.getByDesignItemDetailId(o.getId());
|
||||
List<DesignItemDetailPrint> prints = designItemDetailPrintService.getByDesignItemDetailId(o.getId(), "print");
|
||||
// 判断有无印花
|
||||
if (CollectionUtil.isNotEmpty(prints)) {
|
||||
// 有印花
|
||||
d.setPrintObject(convertToDesignSinglePrintDTO(prints));
|
||||
}
|
||||
// 根据designItemDetailId获取design elements
|
||||
List<DesignItemDetailPrint> trims = designItemDetailPrintService.getByDesignItemDetailId(o.getId(), "trims");
|
||||
// 判断有无装饰 trims
|
||||
if (CollectionUtil.isNotEmpty(trims)) {
|
||||
// 有印花
|
||||
d.setTrims(convertToDesignSinglePrintDTO(trims));
|
||||
}
|
||||
}));
|
||||
//single 和 Models(模特)时候 系统元素为空
|
||||
List<DesignItemDetail> filterDetail2 = designItemDetails.stream()
|
||||
@@ -1196,6 +1203,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
DesignItemDetailPrint detailPrint = designItemDetailPrints.get(0);
|
||||
DesignSinglePrint designSinglePrint = new DesignSinglePrint();
|
||||
designSinglePrintDTO.setIfSingle(detailPrint.getSingleOrOverall().equals("single") ? Boolean.TRUE : Boolean.FALSE);
|
||||
designSinglePrint.setLevel2Type(detailPrint.getLevel2Type());
|
||||
designSinglePrint.setLocation(JSONArray.parseArray(detailPrint.getPosition(), Double.class));
|
||||
designSinglePrint.setAngle(detailPrint.getAngle());
|
||||
designSinglePrint.setPriority(detailPrint.getPriority());
|
||||
@@ -1209,6 +1217,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
designItemDetailPrints.forEach(print -> {
|
||||
if (print.getSingleOrOverall().equals("single")) {
|
||||
prints.add(new DesignSinglePrint(
|
||||
print.getLevel2Type(),
|
||||
minioUtil.getPresignedUrl(print.getPath(), 24 * 60),
|
||||
print.getPath(),
|
||||
JSONArray.parseArray(print.getPosition(), Double.class),
|
||||
@@ -1216,12 +1225,10 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
print.getAngle(),
|
||||
print.getPriority()));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
designSinglePrintDTO.setPrints(prints);
|
||||
return designSinglePrintDTO;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -341,6 +341,11 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
throw new BusinessException("gender.cannot.be.empty");
|
||||
}
|
||||
}
|
||||
if (PRINT_BOARD.getRealName().equals(generateLikeDTO.getLevel1Type())) {
|
||||
if (StringUtil.isNullOrEmpty(generateLikeDTO.getLevel2Type())) {
|
||||
throw new BusinessException("level2Type.cannot.be.empty");
|
||||
}
|
||||
}
|
||||
// 1.2 判断参数是否真实有效
|
||||
Long generateDetailId = generateLikeDTO.getGenerateDetailId();
|
||||
GenerateDetail generateDetail = generateDetailMapper.selectById(generateDetailId);
|
||||
@@ -496,7 +501,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
}
|
||||
|
||||
// 将图片上传到图片服务器
|
||||
String path = minioUtil.base64Upload(generateThroughImageTextDTO.getSloganBase64(), sloganBucket);
|
||||
String path = minioUtil.base64UploadToPath(generateThroughImageTextDTO.getSloganBase64(), sloganBucket, null);
|
||||
String name = path.substring(path.lastIndexOf("/") + 1, path.lastIndexOf("."));
|
||||
// 保存到db,collection-element
|
||||
CollectionElement collectionElement = new CollectionElement();
|
||||
|
||||
@@ -92,6 +92,8 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
private String accessPythonIp;
|
||||
@Value("${access.python.port:''}")
|
||||
private String accessPythonPort;
|
||||
@Value("${access.python.address}")
|
||||
private String fastApiPythonAddress;
|
||||
|
||||
@Resource
|
||||
private PythonTAllInfoService pythonTAllInfoService;
|
||||
@@ -367,7 +369,8 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
log.info("processSketchBoards请求python 参数:####{}", param);
|
||||
RequestBody body = RequestBody.create(mediaType, param);
|
||||
Request request = new Request.Builder()
|
||||
.url(accessPythonIp + ":" + accessPythonPort + "/api/design_pre_processing")
|
||||
// .url(accessPythonIp + ":" + accessPythonPort + "/api/design_pre_processing")
|
||||
.url(fastApiPythonAddress + "/api/design_pre_processing")
|
||||
.method("POST", body)
|
||||
// .addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
||||
.addHeader("Content-Type", "application/json")
|
||||
|
||||
@@ -45,6 +45,7 @@ spring.servlet.multipart.max-request-size= 10MB
|
||||
access.python.ip=http://18.167.251.121
|
||||
access.python.port=9992
|
||||
access.python.sr=http://18.167.251.121:9994
|
||||
access.python.address=http://18.167.251.121:9996
|
||||
|
||||
minio.endpoint=https://www.minio.aida.com.hk:9000
|
||||
minio.accessKey=admin
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# developer-sandbox-xp
|
||||
#paypal.client-id=ATbaebYi7-GXWRWJqwRLYMzKEbwjh4BFRqD4Y13i4lZq0rplWIM_IpPrtPKpdkAt_KrPXd6IJTwsDqa5
|
||||
#paypal.client-secret=EHWWJqGmmbfjLXqCUpGrvxRYBPPtWvA3hR5ZaAyHlGSVJiHoQPS8skbNaJ9h39VObnchUbgiY2pPu__s
|
||||
#paypal.receiver.email=sb-ukxfk29608925@business.example.com
|
||||
#paypal.mode=sandbox
|
||||
paypal.client-id=ATbaebYi7-GXWRWJqwRLYMzKEbwjh4BFRqD4Y13i4lZq0rplWIM_IpPrtPKpdkAt_KrPXd6IJTwsDqa5
|
||||
paypal.client-secret=EHWWJqGmmbfjLXqCUpGrvxRYBPPtWvA3hR5ZaAyHlGSVJiHoQPS8skbNaJ9h39VObnchUbgiY2pPu__s
|
||||
paypal.receiver.email=sb-ukxfk29608925@business.example.com
|
||||
paypal.mode=sandbox
|
||||
# local
|
||||
#paypal.webhook_id=31797347YC028794L
|
||||
paypal.webhook_id=31797347YC028794L
|
||||
# dev
|
||||
#paypal.webhook_id=51V87014T6406322F
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
#paypal.webhook_id=1WH327112B602422N
|
||||
|
||||
# aida-live-kim
|
||||
paypal.client-id=ASWSIZ3MXJU5w5VOeOHeigWcSw6iinl30ZCipruziKpHclxP0ryf8-7VKG1Ba2VwZwa2DMvGEzTfCTgz
|
||||
paypal.client-secret=EHQg_K5PSqmp4FJlzEcOEH_kFkmq4aBzaI7jridw53L6cOQRULBAnfv2KakRfrsqaU1PDSkO4Co9Vyxc
|
||||
paypal.receiver.email=kimwong@code-create.com.hk
|
||||
paypal.mode=live
|
||||
#paypal.client-id=ASWSIZ3MXJU5w5VOeOHeigWcSw6iinl30ZCipruziKpHclxP0ryf8-7VKG1Ba2VwZwa2DMvGEzTfCTgz
|
||||
#paypal.client-secret=EHQg_K5PSqmp4FJlzEcOEH_kFkmq4aBzaI7jridw53L6cOQRULBAnfv2KakRfrsqaU1PDSkO4Co9Vyxc
|
||||
#paypal.receiver.email=kimwong@code-create.com.hk
|
||||
#paypal.mode=live
|
||||
#paypal.webhook_id=41L14847MC833625B
|
||||
paypal.webhook_id=1D107312EX592781K
|
||||
#paypal.webhook_id=1D107312EX592781K
|
||||
Reference in New Issue
Block a user