designSingle 、getDetail 添加返回印花详细

This commit is contained in:
xupei
2023-09-26 15:47:01 +08:00
parent 255529c8bc
commit 8a3c42ac0e
12 changed files with 297 additions and 79 deletions

View File

@@ -1341,7 +1341,7 @@ public class PythonService {
designSingleItem.getType(),
designSingleItem.getPath(),
designSingleItem.getColor(),
resolveDesignSinglePrint(designSingleItem .getPrintObject(), designSingleItem.getPath()),
resolveDesignSinglePrint(designSingleItem.getPrintObject(), designSingleItem.getPath()),
"none",
// todo businessId 待确认
designSingleItem.getId(),
@@ -1363,46 +1363,55 @@ public class PythonService {
private DesignPythonItemPrint resolveDesignSinglePrint(DesignSinglePrintDTO printObject, String clothesPath) {
if (Objects.isNull(printObject.getPath()) || CollectionUtil.isEmpty(printObject.getPrints())) {
// 没有印花时的参数设置
if (printObject.getIfSingle().equals(Boolean.FALSE) && CollectionUtil.isEmpty(printObject.getPrints())) {
return new DesignPythonItemPrint(new ArrayList<>(),false);
}
DesignPythonItemPrint print = CopyUtil.copyObject(printObject, DesignPythonItemPrint.class);
if(StringUtils.isEmpty(printObject.getPath())){
print.setPrint_path_list(new ArrayList<>());
}else {
print.setPrint_path_list(Collections.singletonList(printObject.getPath()));
}
if (StringUtils.isEmpty(clothesPath)
|| "none".equals(clothesPath)
|| CollectionUtils.isEmpty(printObject.getPrints())) {
return print;
}
// if(StringUtils.isEmpty(printObject.getPath())){
// print.setPrint_path_list(new ArrayList<>());
// }else {
// print.setPrint_path_list(Collections.singletonList(printObject.getPath()));
// }
// if (StringUtils.isEmpty(clothesPath)
// || "none".equals(clothesPath)
// || CollectionUtils.isEmpty(printObject.getPrints())) {
// return print;
// }
//图片宽 高
FileVO fileVO = FileUtil.getFileSize(FileUtil.getOriginFile(clothesPath));
// FileVO fileVO = FileUtil.getFileSize(FileUtil.getOriginFile(clothesPath));
/* List<List<Float>> locations = printObject.getLocation();
locations.forEach(location -> {
location.set(0, location.get(0) * fileVO.getWidth());
location.set(1, location.get(1) * fileVO.getHigh());
});*/
List<List<Float>> location = new ArrayList<>(printObject.getPrints().size());
List<Float> scale = new ArrayList<>(printObject.getPrints().size());
List<Float> angle = new ArrayList<>(printObject.getPrints().size());
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());
// 设置印花的位置、大小、旋转角度
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());
log.info("本次print打点locations###{}###fileVO{}", p.getLocation(), JSON.toJSONString(fileVO));
if (printObject.getIfSingle().equals(Boolean.FALSE)){
scale.add(p.getScale());
paths.add(p.getPath());
}else {
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.getPath());
}
// 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);
return print;
}

View File

@@ -33,13 +33,13 @@ public class DesignPythonItemPrint {
@ApiModelProperty("print的位置 传 [[0.2, 0.2]]")
private List<List<Float>> location;
private List<List<Double>> location;
@ApiModelProperty("print的缩放比例 传 [0.2, 0.2]")
private List<Float> print_scale_list;
private List<Double> print_scale_list;
@ApiModelProperty("print的旋转角度 传 [0.2, 0.2]")
private List<Float> print_angle_list;
private List<Double> print_angle_list;
@JSONField(name="IfSingle")
public Boolean getIfSingle() {