Merge remote-tracking branch 'origin/dev/dev' into dev/dev
This commit is contained in:
@@ -1928,14 +1928,14 @@ public class PythonService {
|
||||
if (!elementVO.getDesignPythonItemPrint().getPath().equals("none")
|
||||
&& elementVO.getDesignPrintPictureTypeLayoutList().contains(type)) {
|
||||
DesignPythonItemPrint designPythonItemPrint = CopyUtil.copyObject(elementVO.getDesignPythonItemPrint(), DesignPythonItemPrint.class);
|
||||
designPythonItemPrint.setIfSingle(false);
|
||||
// designPythonItemPrint.setIfSingle(false);
|
||||
designPythonItemPrint.setPrint_path_list(Collections.singletonList(designPythonItemPrint.getPath()));
|
||||
designPythonItemBlouse.setPrint(designPythonItemPrint);
|
||||
designPythonItemBlouse.setPrint(new PrintToPython(designPythonItemPrint));
|
||||
} else {
|
||||
DesignPythonItemPrint designPythonItemPrint = new DesignPythonItemPrint();
|
||||
designPythonItemPrint.setIfSingle(false);
|
||||
// designPythonItemPrint.setIfSingle(false);
|
||||
designPythonItemPrint.setPrint_path_list(new ArrayList<>());
|
||||
designPythonItemBlouse.setPrint(designPythonItemPrint);
|
||||
designPythonItemBlouse.setPrint(new PrintToPython(designPythonItemPrint));
|
||||
}
|
||||
return designPythonItemBlouse;
|
||||
}
|
||||
@@ -1957,14 +1957,14 @@ public class PythonService {
|
||||
if (!elementVO.getDesignPythonItemPrint().getPath().equals("none")
|
||||
&& elementVO.getDesignPrintPictureTypeLayoutList().contains(collectionElement.getLevel2Type())) {
|
||||
DesignPythonItemPrint designPythonItemPrint = CopyUtil.copyObject(elementVO.getDesignPythonItemPrint(), DesignPythonItemPrint.class);
|
||||
designPythonItemPrint.setIfSingle(false);
|
||||
// designPythonItemPrint.setIfSingle(false);
|
||||
designPythonItemPrint.setPrint_path_list(Collections.singletonList(designPythonItemPrint.getPath()));
|
||||
designPythonItemBlouse.setPrint(designPythonItemPrint);
|
||||
designPythonItemBlouse.setPrint(new PrintToPython(designPythonItemPrint));
|
||||
} else {
|
||||
DesignPythonItemPrint designPythonItemPrint = new DesignPythonItemPrint();
|
||||
designPythonItemPrint.setIfSingle(false);
|
||||
// designPythonItemPrint.setIfSingle(false);
|
||||
designPythonItemPrint.setPrint_path_list(new ArrayList<>());
|
||||
designPythonItemBlouse.setPrint(designPythonItemPrint);
|
||||
designPythonItemBlouse.setPrint(new PrintToPython(designPythonItemPrint));
|
||||
}
|
||||
return designPythonItemBlouse;
|
||||
}
|
||||
@@ -2587,7 +2587,7 @@ public class PythonService {
|
||||
List<DesignPythonItem> response = CopyUtil.copyList(designPythonItemDto, DesignPythonItem.class, (o, d) -> {
|
||||
d.setBusinessId(o.getId());
|
||||
d.setIcon("none");
|
||||
d.setPrint(resolveDesignSinglePrint(o.getPrintObject(), o.getPath()));
|
||||
// d.setPrint(resolveDesignSinglePrint(o.getPrintObject(), o.getPath()));
|
||||
});
|
||||
DesignPythonItem body = new DesignPythonItem();
|
||||
body.setType(SysFileLevel2TypeEnum.BODY.getRealName());
|
||||
@@ -2636,12 +2636,13 @@ public class PythonService {
|
||||
// todo 当渐变色不为空时,是否需要将颜色置为 0 0 0
|
||||
}
|
||||
|
||||
PrintToPython printToPython = resolveDesignSinglePrint(designSingleItem.getPrintObject().getPrints());
|
||||
resolveDesignElement(designSingleItem.getTrims(), printToPython);
|
||||
response.add(new DesignPythonItem(
|
||||
designSingleItem.getType(),
|
||||
designSingleItem.getPath(),
|
||||
designSingleItem.getColor(),
|
||||
resolveDesignSinglePrint(designSingleItem.getPrintObject(), null),
|
||||
resolveDesignElement(designSingleItem.getTrims()),
|
||||
printToPython,
|
||||
// businessId designItemDetailId (python端确认没有作用,但是数据库需要存,作用:未知)
|
||||
// designSingleItem.getId(),
|
||||
businessId,
|
||||
@@ -2666,47 +2667,84 @@ public class PythonService {
|
||||
}
|
||||
|
||||
|
||||
private DesignPythonItemPrint resolveDesignSinglePrint(DesignSinglePrintDTO printObject, String clothesPath) {
|
||||
// 没有印花时的参数设置
|
||||
if (printObject.getIfSingle().equals(Boolean.FALSE) && CollectionUtil.isEmpty(printObject.getPrints())) {
|
||||
return new DesignPythonItemPrint(new ArrayList<>(), false);
|
||||
private PrintToPython resolveDesignSinglePrint(List<DesignSinglePrint> printObject) {
|
||||
PrintToPython printToPython = new PrintToPython();
|
||||
DesignPythonItemPrint printSingle = new DesignPythonItemPrint();
|
||||
DesignPythonItemPrint printOverall = new DesignPythonItemPrint();
|
||||
printToPython.setSingle(printSingle);
|
||||
printToPython.setOverall(printOverall);
|
||||
if (printObject.isEmpty()){
|
||||
return printToPython;
|
||||
}
|
||||
DesignPythonItemPrint print = CopyUtil.copyObject(printObject, DesignPythonItemPrint.class);
|
||||
|
||||
int size = printObject.getPrints().size();
|
||||
// 没有印花时的参数设置
|
||||
// if (printObject.getIfSingle().equals(Boolean.FALSE) && CollectionUtil.isEmpty(printObject.getPrints())) {
|
||||
// return new DesignPythonItemPrint(new ArrayList<>(), false);
|
||||
// }
|
||||
// DesignPythonItemPrint print = CopyUtil.copyObject(printObject, DesignPythonItemPrint.class);
|
||||
|
||||
int size = printObject.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));
|
||||
List<List<Double>> locationS = new ArrayList<>(Collections.nCopies(size, null));
|
||||
List<Double> scaleS = new ArrayList<>(Collections.nCopies(size, null));
|
||||
List<Double> angleS = new ArrayList<>(Collections.nCopies(size, null));
|
||||
ArrayList<String> pathsS = new ArrayList<>(Collections.nCopies(size, null));
|
||||
|
||||
List<List<Double>> locationO = new ArrayList<>(Collections.nCopies(size, null));
|
||||
List<Double> scaleO = new ArrayList<>(Collections.nCopies(size, null));
|
||||
List<Double> angleO = new ArrayList<>(Collections.nCopies(size, null));
|
||||
ArrayList<String> pathsO = new ArrayList<>(Collections.nCopies(size, null));
|
||||
|
||||
// 设置印花的位置、大小、旋转角度
|
||||
// 优先级越大,越靠近顶层,在传输给python的数组中,越靠前
|
||||
List<DesignSinglePrint> prints = printObject.getPrints();
|
||||
prints.forEach(p -> {
|
||||
// List<DesignSinglePrint> prints = printObject.getPrints();
|
||||
printObject.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());
|
||||
// todo 下标越界问题
|
||||
if (p.getIfSingle()){
|
||||
locationS.set(priority - 1, p.getLocation());
|
||||
scaleS.set(priority - 1, p.getScale());
|
||||
angleS.set( priority - 1, p.getAngle());
|
||||
pathsS.set(priority - 1, p.getMinIOPath());
|
||||
}else {
|
||||
locationO.set(priority - 1, p.getLocation());
|
||||
scaleO.set(priority - 1, p.getScale());
|
||||
angleO.set(priority - 1, p.getAngle());
|
||||
pathsO.set(priority - 1, p.getMinIOPath());
|
||||
}
|
||||
// log.info("本次print打点locations###{}###fileVO{}", p.getLocation(), JSON.toJSONString(fileVO));
|
||||
});
|
||||
print.setLocation(location);
|
||||
print.setPrint_scale_list(scale);
|
||||
print.setPrint_angle_list(angle);
|
||||
print.setPrint_path_list(paths);
|
||||
locationS.removeAll(Collections.singleton(null));
|
||||
scaleS.removeAll(Collections.singleton(null));
|
||||
angleS.removeAll(Collections.singleton(null));
|
||||
pathsS.removeAll(Collections.singleton(null));
|
||||
printSingle.setLocation(locationS);
|
||||
printSingle.setPrint_scale_list(scaleS);
|
||||
printSingle.setPrint_angle_list(angleS);
|
||||
printSingle.setPrint_path_list(pathsS);
|
||||
|
||||
return print;
|
||||
locationO.removeAll(Collections.singleton(null));
|
||||
scaleO.removeAll(Collections.singleton(null));
|
||||
angleO.removeAll(Collections.singleton(null));
|
||||
pathsO.removeAll(Collections.singleton(null));
|
||||
printOverall.setLocation(locationO);
|
||||
printOverall.setPrint_scale_list(scaleO);
|
||||
printOverall.setPrint_angle_list(angleO);
|
||||
printOverall.setPrint_path_list(pathsO);
|
||||
|
||||
return printToPython;
|
||||
}
|
||||
|
||||
private DesignPythonItemElement resolveDesignElement(DesignSinglePrintDTO trims) {
|
||||
private void resolveDesignElement(DesignSinglePrintDTO trims, PrintToPython printToPython) {
|
||||
// 没有design element 时的参数设置
|
||||
if (Objects.isNull(trims.getIfSingle()) && CollectionUtil.isEmpty(trims.getPrints())) {
|
||||
return null;
|
||||
DesignPythonItemElement element = new DesignPythonItemElement();
|
||||
if (CollectionUtil.isEmpty(trims.getPrints())) {
|
||||
printToPython.setElement(element);
|
||||
return;
|
||||
}
|
||||
DesignPythonItemElement print = new DesignPythonItemElement();
|
||||
|
||||
|
||||
int size = trims.getPrints().size();
|
||||
// 占位符填充数组
|
||||
@@ -2722,18 +2760,17 @@ public class PythonService {
|
||||
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());
|
||||
location.set(priority - 1, p.getLocation());
|
||||
scale.set(priority - 1, p.getScale());
|
||||
angle.set(priority - 1, p.getAngle());
|
||||
paths.set(priority - 1, 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;
|
||||
element.setLocation(location);
|
||||
element.setElement_scale_list(scale);
|
||||
element.setElement_angle_list(angle);
|
||||
element.setElement_path_list(paths);
|
||||
printToPython.setElement(element);
|
||||
}
|
||||
|
||||
private DesignPythonBasic coverToSingleBasic(DesignPythonItem designPythonItem, String singleOverall,
|
||||
@@ -2806,9 +2843,9 @@ public class PythonService {
|
||||
dress.setColor("none");
|
||||
dress.setIcon("none");
|
||||
DesignPythonItemPrint designPythonItemPrint = new DesignPythonItemPrint();
|
||||
designPythonItemPrint.setIfSingle(false);
|
||||
// designPythonItemPrint.setIfSingle(false);
|
||||
designPythonItemPrint.setPrint_path_list(new ArrayList<>());
|
||||
dress.setPrint(designPythonItemPrint);
|
||||
dress.setPrint(new PrintToPython(designPythonItemPrint));
|
||||
dress.setPath("aida-sys-image/images/female/blouse/0628001551.jpg");
|
||||
response.add(dress);
|
||||
|
||||
@@ -2817,9 +2854,9 @@ public class PythonService {
|
||||
skirt.setColor("none");
|
||||
skirt.setIcon("none");
|
||||
DesignPythonItemPrint designPythonItemPrint1 = new DesignPythonItemPrint();
|
||||
designPythonItemPrint1.setIfSingle(false);
|
||||
// designPythonItemPrint1.setIfSingle(false);
|
||||
designPythonItemPrint1.setPrint_path_list(new ArrayList<>());
|
||||
skirt.setPrint(designPythonItemPrint1);
|
||||
skirt.setPrint(new PrintToPython(designPythonItemPrint1));
|
||||
skirt.setPath("aida-sys-image/images/female/skirt/0628000022.jpg");
|
||||
// skirt.setPath("aida-sys-image/images/female/dress/0628000000.jpg");
|
||||
response.add(skirt);
|
||||
@@ -2829,9 +2866,9 @@ public class PythonService {
|
||||
top.setColor("none");
|
||||
top.setIcon("none");
|
||||
DesignPythonItemPrint designPythonItemPrint = new DesignPythonItemPrint();
|
||||
designPythonItemPrint.setIfSingle(false);
|
||||
// designPythonItemPrint.setIfSingle(false);
|
||||
designPythonItemPrint.setPrint_path_list(new ArrayList<>());
|
||||
top.setPrint(designPythonItemPrint);
|
||||
top.setPrint(new PrintToPython(designPythonItemPrint));
|
||||
top.setPath("aida-sys-image/images/male/tops/mens_test_10.png");
|
||||
response.add(top);
|
||||
|
||||
@@ -2840,9 +2877,9 @@ public class PythonService {
|
||||
bottom.setColor("none");
|
||||
bottom.setIcon("none");
|
||||
DesignPythonItemPrint designPythonItemPrint1 = new DesignPythonItemPrint();
|
||||
designPythonItemPrint1.setIfSingle(false);
|
||||
// designPythonItemPrint1.setIfSingle(false);
|
||||
designPythonItemPrint1.setPrint_path_list(new ArrayList<>());
|
||||
bottom.setPrint(designPythonItemPrint1);
|
||||
bottom.setPrint(new PrintToPython(designPythonItemPrint1));
|
||||
bottom.setPath("aida-sys-image/images/male/bottoms/mens_test_6252.png");
|
||||
response.add(bottom);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class DesignPythonItem {
|
||||
/**
|
||||
* 对应的print图片的绝对路径
|
||||
*/
|
||||
private DesignPythonItemPrint print;
|
||||
private PrintToPython print;
|
||||
|
||||
/**
|
||||
* trims 衣服上的装饰
|
||||
@@ -118,13 +118,12 @@ public class DesignPythonItem {
|
||||
this.image_id = image_id;
|
||||
}
|
||||
|
||||
public DesignPythonItem(String type, String path, String color, DesignPythonItemPrint print, DesignPythonItemElement element, Long businessId,
|
||||
public DesignPythonItem(String type, String path, String color, PrintToPython 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;
|
||||
this.print = print;
|
||||
this.element = element;
|
||||
// this.icon = icon;
|
||||
this.businessId = businessId;
|
||||
this.image_id = image_id;
|
||||
@@ -135,7 +134,7 @@ public class DesignPythonItem {
|
||||
this.gradientString = gradientString;
|
||||
}
|
||||
|
||||
public DesignPythonItem(String type, String path, String color, DesignPythonItemPrint print, String icon, Long businessId, Long image_id) {
|
||||
public DesignPythonItem(String type, String path, String color, PrintToPython print, String icon, Long businessId, Long image_id) {
|
||||
this.type = type;
|
||||
this.path = path;
|
||||
this.color = color;
|
||||
|
||||
@@ -3,21 +3,22 @@ package com.ai.da.python.vo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DesignPythonItemElement {
|
||||
|
||||
@ApiModelProperty("print的位置 传 [[0.2, 0.2]]")
|
||||
private List<List<Double>> location;
|
||||
private List<List<Double>> location = new ArrayList<>();
|
||||
|
||||
private List<String> element_path_list;
|
||||
private List<String> element_path_list = new ArrayList<>();
|
||||
|
||||
@ApiModelProperty("print的缩放比例 传 [0.2, 0.2]")
|
||||
private List<Double> element_scale_list;
|
||||
private List<Double> element_scale_list = new ArrayList<>();
|
||||
|
||||
@ApiModelProperty("print的旋转角度 传 [0.2, 0.2]")
|
||||
private List<Double> element_angle_list;
|
||||
private List<Double> element_angle_list = new ArrayList<>();
|
||||
|
||||
public DesignPythonItemElement() {
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ import com.alibaba.fastjson.annotation.JSONField;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@@ -14,7 +17,7 @@ public class DesignPythonItemPrint {
|
||||
@ApiModelProperty("图片绝对路径")
|
||||
private String path;
|
||||
|
||||
private List<String> print_path_list;
|
||||
private List<String> print_path_list = new ArrayList<>();
|
||||
|
||||
@ApiModelProperty("上传时候对应的类型,一级类型 Printboard ")
|
||||
private String level1Type;
|
||||
@@ -29,28 +32,38 @@ public class DesignPythonItemPrint {
|
||||
* 是否打点
|
||||
*/
|
||||
@ApiModelProperty("是否打点 是传true 否则false")
|
||||
private Boolean IfSingle;
|
||||
private Boolean ifSingle;
|
||||
|
||||
|
||||
@ApiModelProperty("print的位置 传 [[0.2, 0.2]]")
|
||||
private List<List<Double>> location;
|
||||
private List<List<Double>> location = new ArrayList<>();
|
||||
|
||||
@ApiModelProperty("print的缩放比例 传 [0.2, 0.2]")
|
||||
private List<Double> print_scale_list;
|
||||
private List<Double> print_scale_list = new ArrayList<>();
|
||||
|
||||
@ApiModelProperty("print的旋转角度 传 [0.2, 0.2]")
|
||||
private List<Double> print_angle_list;
|
||||
private List<Double> print_angle_list = new ArrayList<>();
|
||||
|
||||
@JSONField(name = "IfSingle")
|
||||
public Boolean getIfSingle() {
|
||||
return IfSingle;
|
||||
return ifSingle;
|
||||
}
|
||||
|
||||
public DesignPythonItemPrint(List<String> print_path_list, Boolean ifDesign) {
|
||||
if (ifDesign){
|
||||
this.print_path_list = print_path_list;
|
||||
this.location = Collections.singletonList(Arrays.asList(0.0, 0.0));
|
||||
this.print_scale_list = Arrays.asList(0.0, 0.0);
|
||||
this.print_angle_list = Arrays.asList(0.0, 0.0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public DesignPythonItemPrint(String singlePath, String level1Type, Float scale, Boolean ifSingle) {
|
||||
this.path = singlePath;
|
||||
this.level1Type = level1Type;
|
||||
this.scale = scale;
|
||||
IfSingle = ifSingle;
|
||||
this.ifSingle = ifSingle;
|
||||
}
|
||||
|
||||
public DesignPythonItemPrint() {
|
||||
@@ -60,8 +73,4 @@ public class DesignPythonItemPrint {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public DesignPythonItemPrint(List<String> print_path_list, Boolean ifSingle) {
|
||||
this.print_path_list = print_path_list;
|
||||
IfSingle = ifSingle;
|
||||
}
|
||||
}
|
||||
|
||||
20
src/main/java/com/ai/da/python/vo/PrintToPython.java
Normal file
20
src/main/java/com/ai/da/python/vo/PrintToPython.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.ai.da.python.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PrintToPython {
|
||||
private DesignPythonItemPrint single;
|
||||
private DesignPythonItemPrint overall;
|
||||
private DesignPythonItemElement element;
|
||||
|
||||
public PrintToPython(DesignPythonItemPrint overall) {
|
||||
this.overall = new DesignPythonItemPrint(overall.getPrint_path_list(),Boolean.TRUE);
|
||||
single = new DesignPythonItemPrint();
|
||||
element = new DesignPythonItemElement();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user