Merge remote-tracking branch 'origin/dev/dev' into dev/dev

This commit is contained in:
shahaibo
2024-07-08 09:32:54 +08:00
28 changed files with 503 additions and 270 deletions

View File

@@ -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);
}