designSingle 、getDetail 添加返回印花详细
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
package com.ai.da.mapper;
|
||||||
|
|
||||||
|
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||||
|
import com.ai.da.mapper.entity.DesignItemDetailPrint;
|
||||||
|
|
||||||
|
|
||||||
|
public interface DesignItemDetailPrintMapper extends CommonMapper<DesignItemDetailPrint> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.ai.da.mapper.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("t_design_item_detail_print")
|
||||||
|
public class DesignItemDetailPrint {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 关联t_design_item_detail表ID
|
||||||
|
*/
|
||||||
|
private Long designItemDetailId;
|
||||||
|
/**
|
||||||
|
* 印花路径
|
||||||
|
*/
|
||||||
|
private String path;
|
||||||
|
/**
|
||||||
|
* 印花位置
|
||||||
|
*/
|
||||||
|
private String position;
|
||||||
|
/**
|
||||||
|
* 印花缩放比例
|
||||||
|
*/
|
||||||
|
private Double scale;
|
||||||
|
/**
|
||||||
|
* 印花旋转角度
|
||||||
|
*/
|
||||||
|
private Double angle;
|
||||||
|
/**
|
||||||
|
* 印花优先级(多个印花)
|
||||||
|
*/
|
||||||
|
private Integer priority;
|
||||||
|
/**
|
||||||
|
* 选择single or overall 模式
|
||||||
|
*/
|
||||||
|
private String singleOrOverall;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createDate;
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateDate;
|
||||||
|
}
|
||||||
@@ -20,6 +20,7 @@ public class DesignSingleItemDTO {
|
|||||||
@ApiModelProperty("对应的图片的绝对路径")
|
@ApiModelProperty("对应的图片的绝对路径")
|
||||||
private String path;
|
private String path;
|
||||||
|
|
||||||
|
@NotBlank(message = "color cannot be empty!")
|
||||||
@ApiModelProperty("颜色 存 RGB值 中间空格分隔 比如 \"58 58 169\"")
|
@ApiModelProperty("颜色 存 RGB值 中间空格分隔 比如 \"58 58 169\"")
|
||||||
private String color;
|
private String color;
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import java.util.List;
|
|||||||
@ApiModel("design single 印花请求信息")
|
@ApiModel("design single 印花请求信息")
|
||||||
public class DesignSinglePrintDTO {
|
public class DesignSinglePrintDTO {
|
||||||
|
|
||||||
@ApiModelProperty("印花url")
|
// @ApiModelProperty("印花url")
|
||||||
private String path;
|
// private String path;
|
||||||
|
|
||||||
@ApiModelProperty("single -> true,overall -> false")
|
@ApiModelProperty("single -> true,overall -> false")
|
||||||
private Boolean ifSingle;
|
private Boolean ifSingle;
|
||||||
@@ -20,4 +20,6 @@ public class DesignSinglePrintDTO {
|
|||||||
@ApiModelProperty("印花详细")
|
@ApiModelProperty("印花详细")
|
||||||
private List<DesignSinglePrint> prints;
|
private List<DesignSinglePrint> prints;
|
||||||
|
|
||||||
|
public DesignSinglePrintDTO() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.ai.da.model.vo;
|
package com.ai.da.model.vo;
|
||||||
|
|
||||||
import com.ai.da.python.vo.DesignPythonItemPrint;
|
import com.ai.da.model.dto.DesignSinglePrintDTO;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -30,8 +30,11 @@ public class DesignItemClothesDetailVO {
|
|||||||
// private String color;
|
// private String color;
|
||||||
private PantoneVO color;
|
private PantoneVO color;
|
||||||
|
|
||||||
@ApiModelProperty("对应的print图片对象")
|
// @ApiModelProperty("对应的print图片对象")
|
||||||
private DesignPythonItemPrint printObject;
|
// private DesignPythonItemPrint printObject;
|
||||||
|
|
||||||
|
@ApiModelProperty("print详细")
|
||||||
|
private DesignSinglePrintDTO printObject;
|
||||||
|
|
||||||
@ApiModelProperty("对应图层信息")
|
@ApiModelProperty("对应图层信息")
|
||||||
private List<DesignPythonOutfitVO> layersObject;
|
private List<DesignPythonOutfitVO> layersObject;
|
||||||
|
|||||||
@@ -12,19 +12,37 @@ import java.util.List;
|
|||||||
@ApiModel("design single 印花详情")
|
@ApiModel("design single 印花详情")
|
||||||
public class DesignSinglePrint {
|
public class DesignSinglePrint {
|
||||||
|
|
||||||
|
@ApiModelProperty("印花url")
|
||||||
|
private String path;
|
||||||
|
|
||||||
@ApiModelProperty("印花位置")
|
@ApiModelProperty("印花位置")
|
||||||
private List<Float> location;
|
private List<Double> location;
|
||||||
|
|
||||||
@ApiModelProperty("印花大小")
|
@ApiModelProperty("印花大小")
|
||||||
@Range(max = 1,message = "印花缩放值需用大于等于0小于等于1的数表示")
|
@Range(max = 1,message = "印花缩放值需用大于等于0小于等于1的数表示")
|
||||||
private Float scale;
|
private Double scale;
|
||||||
|
|
||||||
@Range(min = -360,max = 360,message = "印花旋转角度范围为-360° ~ 360°")
|
@Range(min = -360,max = 360,message = "印花旋转角度范围为-360° ~ 360°")
|
||||||
@ApiModelProperty("印花角度")
|
@ApiModelProperty("印花角度")
|
||||||
private Float angle;
|
private Double angle;
|
||||||
|
|
||||||
@Min(value = 1)
|
@Min(value = 1)
|
||||||
@ApiModelProperty("印花优先级")
|
@ApiModelProperty("印花优先级")
|
||||||
private Integer priority;
|
private Integer priority;
|
||||||
|
|
||||||
|
public DesignSinglePrint() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public DesignSinglePrint(String path, Double scale) {
|
||||||
|
this.path = path;
|
||||||
|
this.scale = scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DesignSinglePrint(String path, List<Double> location, Double scale, Double angle, Integer priority) {
|
||||||
|
this.path = path;
|
||||||
|
this.location = location;
|
||||||
|
this.scale = scale;
|
||||||
|
this.angle = angle;
|
||||||
|
this.priority = priority;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1341,7 +1341,7 @@ public class PythonService {
|
|||||||
designSingleItem.getType(),
|
designSingleItem.getType(),
|
||||||
designSingleItem.getPath(),
|
designSingleItem.getPath(),
|
||||||
designSingleItem.getColor(),
|
designSingleItem.getColor(),
|
||||||
resolveDesignSinglePrint(designSingleItem .getPrintObject(), designSingleItem.getPath()),
|
resolveDesignSinglePrint(designSingleItem.getPrintObject(), designSingleItem.getPath()),
|
||||||
"none",
|
"none",
|
||||||
// todo businessId 待确认
|
// todo businessId 待确认
|
||||||
designSingleItem.getId(),
|
designSingleItem.getId(),
|
||||||
@@ -1363,46 +1363,55 @@ public class PythonService {
|
|||||||
|
|
||||||
|
|
||||||
private DesignPythonItemPrint resolveDesignSinglePrint(DesignSinglePrintDTO printObject, String clothesPath) {
|
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);
|
return new DesignPythonItemPrint(new ArrayList<>(),false);
|
||||||
}
|
}
|
||||||
DesignPythonItemPrint print = CopyUtil.copyObject(printObject, DesignPythonItemPrint.class);
|
DesignPythonItemPrint print = CopyUtil.copyObject(printObject, DesignPythonItemPrint.class);
|
||||||
if(StringUtils.isEmpty(printObject.getPath())){
|
// if(StringUtils.isEmpty(printObject.getPath())){
|
||||||
print.setPrint_path_list(new ArrayList<>());
|
// print.setPrint_path_list(new ArrayList<>());
|
||||||
}else {
|
// }else {
|
||||||
print.setPrint_path_list(Collections.singletonList(printObject.getPath()));
|
// print.setPrint_path_list(Collections.singletonList(printObject.getPath()));
|
||||||
}
|
// }
|
||||||
if (StringUtils.isEmpty(clothesPath)
|
// if (StringUtils.isEmpty(clothesPath)
|
||||||
|| "none".equals(clothesPath)
|
// || "none".equals(clothesPath)
|
||||||
|| CollectionUtils.isEmpty(printObject.getPrints())) {
|
// || CollectionUtils.isEmpty(printObject.getPrints())) {
|
||||||
return print;
|
// return print;
|
||||||
}
|
// }
|
||||||
//图片宽 高
|
//图片宽 高
|
||||||
FileVO fileVO = FileUtil.getFileSize(FileUtil.getOriginFile(clothesPath));
|
// FileVO fileVO = FileUtil.getFileSize(FileUtil.getOriginFile(clothesPath));
|
||||||
/* List<List<Float>> locations = printObject.getLocation();
|
/* List<List<Float>> locations = printObject.getLocation();
|
||||||
locations.forEach(location -> {
|
locations.forEach(location -> {
|
||||||
location.set(0, location.get(0) * fileVO.getWidth());
|
location.set(0, location.get(0) * fileVO.getWidth());
|
||||||
location.set(1, location.get(1) * fileVO.getHigh());
|
location.set(1, location.get(1) * fileVO.getHigh());
|
||||||
});*/
|
});*/
|
||||||
|
|
||||||
List<List<Float>> location = new ArrayList<>(printObject.getPrints().size());
|
List<List<Double>> location = new ArrayList<>(printObject.getPrints().size());
|
||||||
List<Float> scale = new ArrayList<>(printObject.getPrints().size());
|
List<Double> scale = new ArrayList<>(printObject.getPrints().size());
|
||||||
List<Float> angle = 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();
|
List<DesignSinglePrint> prints = printObject.getPrints();
|
||||||
prints.forEach(p -> {
|
prints.forEach(p -> {
|
||||||
|
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(0,p.getLocation().get(0));
|
||||||
p.getLocation().set(1,p.getLocation().get(1));
|
p.getLocation().set(1,p.getLocation().get(1));
|
||||||
Integer priority = p.getPriority();
|
Integer priority = p.getPriority();
|
||||||
location.add(priority - 1, p.getLocation());
|
location.add(priority - 1, p.getLocation());
|
||||||
scale.add(priority - 1,p.getScale());
|
scale.add(priority - 1,p.getScale());
|
||||||
angle.add(priority - 1,p.getAngle());
|
angle.add(priority - 1,p.getAngle());
|
||||||
log.info("本次print打点locations###{}###fileVO{}", p.getLocation(), JSON.toJSONString(fileVO));
|
paths.add(priority - 1,p.getPath());
|
||||||
|
}
|
||||||
|
// log.info("本次print打点locations###{}###fileVO{}", p.getLocation(), JSON.toJSONString(fileVO));
|
||||||
});
|
});
|
||||||
print.setLocation(location);
|
print.setLocation(location);
|
||||||
print.setPrint_scale_list(scale);
|
print.setPrint_scale_list(scale);
|
||||||
print.setPrint_angle_list(angle);
|
print.setPrint_angle_list(angle);
|
||||||
|
print.setPrint_path_list(paths);
|
||||||
|
|
||||||
return print;
|
return print;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,13 +33,13 @@ public class DesignPythonItemPrint {
|
|||||||
|
|
||||||
|
|
||||||
@ApiModelProperty("print的位置 传 [[0.2, 0.2]]")
|
@ApiModelProperty("print的位置 传 [[0.2, 0.2]]")
|
||||||
private List<List<Float>> location;
|
private List<List<Double>> location;
|
||||||
|
|
||||||
@ApiModelProperty("print的缩放比例 传 [0.2, 0.2]")
|
@ApiModelProperty("print的缩放比例 传 [0.2, 0.2]")
|
||||||
private List<Float> print_scale_list;
|
private List<Double> print_scale_list;
|
||||||
|
|
||||||
@ApiModelProperty("print的旋转角度 传 [0.2, 0.2]")
|
@ApiModelProperty("print的旋转角度 传 [0.2, 0.2]")
|
||||||
private List<Float> print_angle_list;
|
private List<Double> print_angle_list;
|
||||||
|
|
||||||
@JSONField(name="IfSingle")
|
@JSONField(name="IfSingle")
|
||||||
public Boolean getIfSingle() {
|
public Boolean getIfSingle() {
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.ai.da.service;
|
||||||
|
|
||||||
|
import com.ai.da.mapper.entity.DesignItemDetailPrint;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface DesignItemDetailPrintService extends IService<DesignItemDetailPrint> {
|
||||||
|
List<DesignItemDetailPrint> getByDesignItemDetailId(Long designItemDetailId);
|
||||||
|
|
||||||
|
void deleteByDesignItemDetailId(Long designItemDetailId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.ai.da.service.impl;
|
||||||
|
|
||||||
|
import com.ai.da.mapper.DesignItemDetailPrintMapper;
|
||||||
|
import com.ai.da.mapper.entity.DesignItemDetailPrint;
|
||||||
|
import com.ai.da.mapper.entity.TDesignPythonOutfitDetail;
|
||||||
|
import com.ai.da.service.DesignItemDetailPrintService;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DesignItemDetailPrintServiceImpl extends ServiceImpl<DesignItemDetailPrintMapper, DesignItemDetailPrint> implements DesignItemDetailPrintService {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DesignItemDetailPrint> getByDesignItemDetailId(Long designItemDetailId){
|
||||||
|
QueryWrapper<DesignItemDetailPrint> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("design_item_detail_id",designItemDetailId);
|
||||||
|
|
||||||
|
return baseMapper.selectList(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteByDesignItemDetailId(Long designItemDetailId){
|
||||||
|
UpdateWrapper<DesignItemDetailPrint> updateWrapper = new UpdateWrapper<>();
|
||||||
|
updateWrapper.eq("design_item_detail_id", designItemDetailId);
|
||||||
|
updateWrapper.set("is_deleted",(byte)1);
|
||||||
|
|
||||||
|
baseMapper.update(null,updateWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,6 +13,7 @@ import com.ai.da.mapper.entity.*;
|
|||||||
import com.ai.da.model.dto.DesignSingleDTO;
|
import com.ai.da.model.dto.DesignSingleDTO;
|
||||||
import com.ai.da.model.dto.DesignSingleIncludeLayersDTO;
|
import com.ai.da.model.dto.DesignSingleIncludeLayersDTO;
|
||||||
import com.ai.da.model.dto.DesignSingleItemDTO;
|
import com.ai.da.model.dto.DesignSingleItemDTO;
|
||||||
|
import com.ai.da.model.dto.DesignSinglePrintDTO;
|
||||||
import com.ai.da.model.vo.*;
|
import com.ai.da.model.vo.*;
|
||||||
import com.ai.da.python.PythonService;
|
import com.ai.da.python.PythonService;
|
||||||
import com.ai.da.python.vo.DesignPythonItem;
|
import com.ai.da.python.vo.DesignPythonItem;
|
||||||
@@ -26,7 +27,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
@@ -68,6 +68,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
@Resource
|
@Resource
|
||||||
private PanToneService panToneService;
|
private PanToneService panToneService;
|
||||||
@Resource
|
@Resource
|
||||||
|
private DesignItemDetailPrintService designItemDetailPrintService;
|
||||||
|
@Resource
|
||||||
private MinioUtil minioUtil;
|
private MinioUtil minioUtil;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -279,22 +281,20 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<TDesignPythonOutfitDetail> saveDesignSingleItemDetailAndLayers(DesignPythonObjects pythonObjects
|
private List<TDesignPythonOutfitDetail> saveDesignSingleItemDetailAndLayers(DesignPythonObjects pythonObjects
|
||||||
, Long designId,Long designItemId, Long collectionId, AuthPrincipalVo userInfo
|
, Long designId,Long designItemId, AuthPrincipalVo userInfo
|
||||||
, JSONObject outfit, String timeZone){
|
, JSONObject outfit, String timeZone,List<DesignSingleItemDTO> designSingleItemDTOList){
|
||||||
|
|
||||||
DesignItem designItem = new DesignItem();
|
DesignItem designItem = new DesignItem();
|
||||||
// String url = pythonObjects.getObjects().get(0).getBasic().getSave_name();
|
// String url = pythonObjects.getObjects().get(0).getBasic().getSave_name();
|
||||||
designItem.setUpdateDate(DateUtil.getByTimeZone(timeZone));
|
designItem.setUpdateDate(DateUtil.getByTimeZone(timeZone));
|
||||||
designItem.setDesignUrl(outfit.getString("synthesis_url"));
|
designItem.setDesignUrl(outfit.getString("synthesis_url"));
|
||||||
designItem.setId(designItemId);
|
designItem.setId(designItemId);
|
||||||
|
// 1、更新designItem
|
||||||
//更新designItem
|
|
||||||
updateById(designItem);
|
updateById(designItem);
|
||||||
//删除designItemDetail(逻辑删除)
|
// 2、删除designItemDetail(逻辑删除)
|
||||||
designItemDetailService.deleteByDesignItemId(designItemId);
|
designItemDetailService.deleteByDesignItemId(designItemId);
|
||||||
|
|
||||||
List<DesignItemDetail> designItemDetails = Lists.newArrayList();
|
List<DesignItemDetail> designItemDetails = Lists.newArrayList();
|
||||||
// 保存新的designItemDetail
|
// 3、保存新的designItemDetail
|
||||||
pythonObjects.getObjects().get(0).getItems().forEach(detail ->{
|
pythonObjects.getObjects().get(0).getItems().forEach(detail ->{
|
||||||
if(null == detail){
|
if(null == detail){
|
||||||
return;
|
return;
|
||||||
@@ -313,23 +313,28 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
designItemDetail.setIconPath(detail.getIcon());
|
designItemDetail.setIconPath(detail.getIcon());
|
||||||
DesignPythonItemPrint printObject = detail.getPrint();
|
DesignPythonItemPrint printObject = detail.getPrint();
|
||||||
designItemDetail.setPrintPath(Objects.isNull(printObject)? "" :printObject.getPath());
|
designItemDetail.setPrintPath(Objects.isNull(printObject)? "" :printObject.getPath());
|
||||||
designItemDetail.setPrintJson(JSON.toJSONString(printObject));
|
// 当有多个印花后,返回的printObject太长,导致存储到数据库时报错
|
||||||
|
// designItemDetail.setPrintJson(JSON.toJSONString(printObject));
|
||||||
designItemDetails.add(designItemDetail);
|
designItemDetails.add(designItemDetail);
|
||||||
});
|
});
|
||||||
// todo businessId 来自t_sys_file或者t_library
|
// businessId 来自t_sys_file或者t_library
|
||||||
designItemDetailService.saveBatch(designItemDetails);
|
designItemDetailService.saveBatch(designItemDetails);
|
||||||
|
|
||||||
// 覆盖designPythonOutfit表中的模特全身图
|
// 4、保存印花信息到designItemDetailPrint
|
||||||
|
List<DesignItemDetailPrint> designItemDetailPrints = setDesignItemDetailPrintList(designItemDetails, designSingleItemDTOList, timeZone);
|
||||||
|
designItemDetailPrintService.saveBatch(designItemDetailPrints);
|
||||||
|
|
||||||
|
// 5、覆盖designPythonOutfit表中的模特全身图
|
||||||
TDesignPythonOutfit designPythonOutfit = new TDesignPythonOutfit();
|
TDesignPythonOutfit designPythonOutfit = new TDesignPythonOutfit();
|
||||||
designPythonOutfit.setDesignUrl(outfit.getString("synthesis_url"));
|
designPythonOutfit.setDesignUrl(outfit.getString("synthesis_url"));
|
||||||
designPythonOutfit.setId(designPythonOutfitService.getByDesignItemId(designItemId).getId());
|
designPythonOutfit.setId(designPythonOutfitService.getByDesignItemId(designItemId).getId());
|
||||||
designPythonOutfit.setUpdateDate(LocalDateTime.now(ZoneId.of(timeZone)));
|
designPythonOutfit.setUpdateDate(LocalDateTime.now(ZoneId.of(timeZone)));
|
||||||
designPythonOutfitService.updateById(designPythonOutfit);
|
designPythonOutfitService.updateById(designPythonOutfit);
|
||||||
|
|
||||||
// 删除designPythonOutfitDetail表中原始的图层信息(逻辑删除)
|
// 6、删除designPythonOutfitDetail表中原始的图层信息(逻辑删除)
|
||||||
designPythonOutfitDetailService.deleteByDesignPythonOutfitId(designPythonOutfit.getId());
|
designPythonOutfitDetailService.deleteByDesignPythonOutfitId(designPythonOutfit.getId());
|
||||||
|
|
||||||
// 将新生成的图层信息存入designPythonOutfitDetail表
|
// 7、将新生成的图层信息存入designPythonOutfitDetail表
|
||||||
JSONArray layers = outfit.getJSONArray("layers");
|
JSONArray layers = outfit.getJSONArray("layers");
|
||||||
List<TDesignPythonOutfitDetail> list = setTDesignPythonOutfitDetailList(layers, designId, designPythonOutfit.getId(), userInfo.getId());
|
List<TDesignPythonOutfitDetail> list = setTDesignPythonOutfitDetailList(layers, designId, designPythonOutfit.getId(), userInfo.getId());
|
||||||
|
|
||||||
@@ -401,7 +406,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
if (!designSingleIncludeLayersDTO.getIsPreview()){
|
if (!designSingleIncludeLayersDTO.getIsPreview()){
|
||||||
// 更新及保存图层信息
|
// 更新及保存图层信息
|
||||||
tDesignPythonOutfitDetails = saveDesignSingleItemDetailAndLayers(objects, design.getId(), designSingleIncludeLayersDTO.getDesignItemId(),
|
tDesignPythonOutfitDetails = saveDesignSingleItemDetailAndLayers(objects, design.getId(), designSingleIncludeLayersDTO.getDesignItemId(),
|
||||||
design.getCollectionId(), userInfo, outfit, designSingleIncludeLayersDTO.getTimeZone());
|
userInfo, outfit, designSingleIncludeLayersDTO.getTimeZone(),designSingleIncludeLayersDTO.getDesignSingleItemDTOList());
|
||||||
}else {
|
}else {
|
||||||
JSONArray layers = outfit.getJSONArray("layers");
|
JSONArray layers = outfit.getJSONArray("layers");
|
||||||
tDesignPythonOutfitDetails = setTDesignPythonOutfitDetailList(layers,designItem.getDesignId(),null,userInfo.getId());
|
tDesignPythonOutfitDetails = setTDesignPythonOutfitDetailList(layers,designItem.getDesignId(),null,userInfo.getId());
|
||||||
@@ -433,9 +438,11 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
|
|
||||||
designSingleItemDTOList.forEach(singleItem -> {
|
designSingleItemDTOList.forEach(singleItem -> {
|
||||||
DesignItemClothesDetailVO designItemClothesDetailVO = new DesignItemClothesDetailVO();
|
DesignItemClothesDetailVO designItemClothesDetailVO = new DesignItemClothesDetailVO();
|
||||||
|
designItemClothesDetailVO.setId(singleItem.getId());
|
||||||
designItemClothesDetailVO.setType(singleItem.getType());
|
designItemClothesDetailVO.setType(singleItem.getType());
|
||||||
designItemClothesDetailVO.setColor(panToneService.getPantoneByRgb(singleItem.getColor()));
|
designItemClothesDetailVO.setColor(panToneService.getPantoneByRgb(singleItem.getColor()));
|
||||||
designItemClothesDetailVO.setPrintObject(new DesignPythonItemPrint(singleItem.getPrintObject().getPath()));
|
// designItemClothesDetailVO.setPrintObject(new DesignPythonItemPrint(singleItem.getPrintObject().getPath()));
|
||||||
|
designItemClothesDetailVO.setPrintObject(singleItem.getPrintObject());
|
||||||
designItemClothesDetailVO.setLayersObject(layersObject.stream().filter(
|
designItemClothesDetailVO.setLayersObject(layersObject.stream().filter(
|
||||||
layers -> singleItem.getType().toLowerCase().equals(layers.getImageCategory().split("_")[0])
|
layers -> singleItem.getType().toLowerCase().equals(layers.getImageCategory().split("_")[0])
|
||||||
).collect(Collectors.toList()));
|
).collect(Collectors.toList()));
|
||||||
@@ -447,4 +454,46 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
|
|
||||||
return designSingleVO;
|
return designSingleVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<DesignItemDetailPrint> setDesignItemDetailPrintList(List<DesignItemDetail> designItemDetails,
|
||||||
|
List<DesignSingleItemDTO> designSingleItemDTOList,
|
||||||
|
String timeZone){
|
||||||
|
|
||||||
|
Map<String, Long> designItemDetailTypeIdMap = designItemDetails.stream().collect(Collectors.toMap(DesignItemDetail::getType, DesignItemDetail::getId));
|
||||||
|
ArrayList<DesignItemDetailPrint> designItemDetailPrints = new ArrayList<>();
|
||||||
|
|
||||||
|
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.getType()));
|
||||||
|
if (!designItemDetailPrintList.isEmpty()){
|
||||||
|
// 2.2 否:先删除原始印花,再添加新印花信息
|
||||||
|
designItemDetailPrintService.deleteByDesignItemDetailId(designItemDetailTypeIdMap.get(designSingleItem.getType()));
|
||||||
|
}
|
||||||
|
DesignItemDetailPrint designItemDetailPrint = new DesignItemDetailPrint();
|
||||||
|
designItemDetailPrint.setDesignItemDetailId(designItemDetailTypeIdMap.get(designSingleItem.getType()));
|
||||||
|
designItemDetailPrint.setPath(print.getPath());
|
||||||
|
designItemDetailPrint.setScale(print.getScale());
|
||||||
|
designItemDetailPrint.setSingleOrOverall(printObject.getIfSingle() ? "single" : "overall");
|
||||||
|
designItemDetailPrint.setCreateDate(LocalDateTime.now(ZoneId.of(timeZone)));
|
||||||
|
// single模式下才有position、angle和priority
|
||||||
|
if (designItemDetailPrint.getSingleOrOverall().equals("single")){
|
||||||
|
designItemDetailPrint.setPosition(print.getLocation().toString());
|
||||||
|
designItemDetailPrint.setAngle(print.getAngle());
|
||||||
|
designItemDetailPrint.setPriority(print.getPriority());
|
||||||
|
}
|
||||||
|
designItemDetailPrints.add(designItemDetailPrint);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return designItemDetailPrints;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.ai.da.common.config.FileProperties;
|
|||||||
import com.ai.da.common.config.exception.BusinessException;
|
import com.ai.da.common.config.exception.BusinessException;
|
||||||
import com.ai.da.common.context.UserContext;
|
import com.ai.da.common.context.UserContext;
|
||||||
import com.ai.da.common.enums.CollectionLevel1TypeEnum;
|
import com.ai.da.common.enums.CollectionLevel1TypeEnum;
|
||||||
import com.ai.da.common.enums.DesignTypeEnum;
|
|
||||||
import com.ai.da.common.enums.SysFileLevel2TypeEnum;
|
import com.ai.da.common.enums.SysFileLevel2TypeEnum;
|
||||||
import com.ai.da.common.utils.*;
|
import com.ai.da.common.utils.*;
|
||||||
import com.ai.da.mapper.DesignMapper;
|
import com.ai.da.mapper.DesignMapper;
|
||||||
@@ -19,7 +18,6 @@ import com.ai.da.python.vo.DesignPythonItemPrint;
|
|||||||
import com.ai.da.python.vo.DesignPythonObject;
|
import com.ai.da.python.vo.DesignPythonObject;
|
||||||
import com.ai.da.python.vo.DesignPythonObjects;
|
import com.ai.da.python.vo.DesignPythonObjects;
|
||||||
import com.ai.da.service.*;
|
import com.ai.da.service.*;
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
@@ -27,7 +25,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import io.netty.util.internal.StringUtil;
|
import io.netty.util.internal.StringUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@@ -82,6 +79,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
private PanToneService panToneService;
|
private PanToneService panToneService;
|
||||||
@Resource
|
@Resource
|
||||||
private PythonTAllInfoService pythonTAllInfoService;
|
private PythonTAllInfoService pythonTAllInfoService;
|
||||||
|
@Resource
|
||||||
|
private DesignItemDetailPrintService designItemDetailPrintService;
|
||||||
|
|
||||||
// @Transactional
|
// @Transactional
|
||||||
@Override
|
@Override
|
||||||
@@ -811,13 +810,20 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
response.setClothes(CopyUtil.copyList(filterDetail,DesignItemClothesDetailVO.class,(o,d)->{
|
response.setClothes(CopyUtil.copyList(filterDetail,DesignItemClothesDetailVO.class,(o,d)->{
|
||||||
d.setId(o.getId());
|
d.setId(o.getId());
|
||||||
d.setLevel1Type(converTypeToLevel1(o.getType()));
|
d.setLevel1Type(converTypeToLevel1(o.getType()));
|
||||||
String printJson = o.getPrintJson();
|
// 根据designItemDetailId获取印花
|
||||||
if (StringUtils.isEmpty(printJson)) {
|
List<DesignItemDetailPrint> prints = designItemDetailPrintService.getByDesignItemDetailId(o.getId());
|
||||||
d.setPrintObject(new DesignPythonItemPrint(o.getPrintPath(),
|
// 判断有无印花
|
||||||
CollectionLevel1TypeEnum.PRINT_BOARD.getRealName(), 0.3f, Boolean.FALSE));
|
if (CollectionUtil.isNotEmpty(prints)){
|
||||||
} else {
|
// 有印花
|
||||||
d.setPrintObject(JSON.parseObject(printJson, DesignPythonItemPrint.class));
|
d.setPrintObject(convertToDesignSinglePrintDTO(prints));
|
||||||
}
|
}
|
||||||
|
// String printJson = o.getPrintJson();
|
||||||
|
// if (StringUtils.isEmpty(printJson)) {
|
||||||
|
// d.setPrintObject(new DesignPythonItemPrint(o.getPrintPath(),
|
||||||
|
// CollectionLevel1TypeEnum.PRINT_BOARD.getRealName(), 0.3f, Boolean.FALSE));
|
||||||
|
// } else {
|
||||||
|
// d.setPrintObject(JSON.parseObject(printJson, DesignPythonItemPrint.class));
|
||||||
|
// }
|
||||||
}));
|
}));
|
||||||
//single 和 Models(模特)时候 系统元素为空
|
//single 和 Models(模特)时候 系统元素为空
|
||||||
List<DesignItemDetail> filterDetail2 = designItemDetails.stream()
|
List<DesignItemDetail> filterDetail2 = designItemDetails.stream()
|
||||||
@@ -879,25 +885,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private DesignItemDetailVO editResponseColor(List<DesignItemDetail> designItemDetails, DesignItemDetailVO designItemDetailVO) {
|
private DesignItemDetailVO editResponseColor(List<DesignItemDetail> designItemDetails, DesignItemDetailVO designItemDetailVO) {
|
||||||
/*designItemDetails.forEach(d -> {
|
|
||||||
if (!StringUtil.isNullOrEmpty(d.getColor())){
|
|
||||||
PantoneVO pantoneByRgb = panToneService.getPantoneByRgb(d.getColor());
|
|
||||||
DesignItemClothesDetailVO clothesDetailVO = designItemDetailVO.getClothes().stream()
|
|
||||||
.filter(v -> v.getId().equals(d.getBusinessId()))
|
|
||||||
.findFirst().orElse(null);
|
|
||||||
if (Objects.nonNull(clothesDetailVO)){
|
|
||||||
clothesDetailVO.setColor(pantoneByRgb);
|
|
||||||
} else {
|
|
||||||
DesignItemOthersDetailVO othersDetailVO = designItemDetailVO.getOthers().stream()
|
|
||||||
.filter(v -> v.getId().equals(d.getBusinessId()))
|
|
||||||
.findFirst().orElse(null);
|
|
||||||
|
|
||||||
if (Objects.nonNull(othersDetailVO)) {
|
|
||||||
othersDetailVO.setColor(pantoneByRgb);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
// 使用designItemDetailId做映射
|
// 使用designItemDetailId做映射
|
||||||
HashMap<Long, String> designItemDetailIdColor = new HashMap<>();
|
HashMap<Long, String> designItemDetailIdColor = new HashMap<>();
|
||||||
designItemDetails.forEach(designItemDetail -> {
|
designItemDetails.forEach(designItemDetail -> {
|
||||||
@@ -921,7 +908,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
return designItemDetailVO;
|
return designItemDetailVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private DesignItemDetailVO editDesignItemLayer(Boolean flag, TDesignPythonOutfit designPythonOutfit, String designItemUrl, DesignItemDetailVO designItemDetailVO) {
|
private DesignItemDetailVO editDesignItemLayer(Boolean flag, TDesignPythonOutfit designPythonOutfit, String designItemUrl, DesignItemDetailVO designItemDetailVO) {
|
||||||
ArrayList<DesignPythonOutfitVO> detailsVO = new ArrayList<>();
|
ArrayList<DesignPythonOutfitVO> detailsVO = new ArrayList<>();
|
||||||
|
|
||||||
@@ -959,4 +945,44 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
|
|
||||||
return designItemDetailVO;
|
return designItemDetailVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DesignSinglePrintDTO convertToDesignSinglePrintDTO(List<DesignItemDetailPrint> designItemDetailPrints){
|
||||||
|
DesignSinglePrintDTO designSinglePrintDTO = new DesignSinglePrintDTO();
|
||||||
|
List<DesignSinglePrint> prints = new ArrayList<>();
|
||||||
|
|
||||||
|
// 只有一个印花
|
||||||
|
if (designItemDetailPrints.size() == 1){
|
||||||
|
DesignItemDetailPrint detailPrint = designItemDetailPrints.get(0);
|
||||||
|
DesignSinglePrint designSinglePrint = new DesignSinglePrint();
|
||||||
|
// overall 模式下只需要返回印花url和scale
|
||||||
|
if (detailPrint.getSingleOrOverall().equals("overall")){
|
||||||
|
designSinglePrintDTO.setIfSingle(Boolean.FALSE);
|
||||||
|
}else {
|
||||||
|
designSinglePrintDTO.setIfSingle(Boolean.TRUE);
|
||||||
|
designSinglePrint.setLocation(JSONArray.parseArray(detailPrint.getPosition(),Double.class));
|
||||||
|
designSinglePrint.setScale(detailPrint.getScale());
|
||||||
|
designSinglePrint.setAngle(detailPrint.getAngle());
|
||||||
|
designSinglePrint.setPriority(detailPrint.getPriority());
|
||||||
|
}
|
||||||
|
designSinglePrint.setPath(detailPrint.getPath());
|
||||||
|
designSinglePrint.setScale(detailPrint.getScale());
|
||||||
|
prints.add(designSinglePrint);
|
||||||
|
}else {
|
||||||
|
// single模式下多个印花
|
||||||
|
designSinglePrintDTO.setIfSingle(Boolean.TRUE);
|
||||||
|
designItemDetailPrints.forEach(print -> {
|
||||||
|
if (print.getSingleOrOverall().equals("single")){
|
||||||
|
prints.add(new DesignSinglePrint(print.getPath(),
|
||||||
|
JSONArray.parseArray(print.getPosition(),Double.class),
|
||||||
|
print.getScale(),
|
||||||
|
print.getAngle(),
|
||||||
|
print.getPriority()));
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
designSinglePrintDTO.setPrints(prints);
|
||||||
|
return designSinglePrintDTO;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user