TASK: 裁剪白底字段添加;
This commit is contained in:
@@ -3,6 +3,7 @@ package com.ai.da.controller;
|
|||||||
import com.ai.da.common.config.exception.BusinessException;
|
import com.ai.da.common.config.exception.BusinessException;
|
||||||
import com.ai.da.common.response.Response;
|
import com.ai.da.common.response.Response;
|
||||||
import com.ai.da.model.dto.*;
|
import com.ai.da.model.dto.*;
|
||||||
|
import com.ai.da.model.vo.CollectionSketchVO;
|
||||||
import com.ai.da.model.vo.DesignCollectionVO;
|
import com.ai.da.model.vo.DesignCollectionVO;
|
||||||
import com.ai.da.model.vo.DesignLikeVO;
|
import com.ai.da.model.vo.DesignLikeVO;
|
||||||
import com.ai.da.service.DesignService;
|
import com.ai.da.service.DesignService;
|
||||||
@@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@Api(tags = "design模块")
|
@Api(tags = "design模块")
|
||||||
@@ -70,7 +72,7 @@ public class DesignController {
|
|||||||
|
|
||||||
@ApiOperation(value = "sketchBoard upload generate design前裁剪")
|
@ApiOperation(value = "sketchBoard upload generate design前裁剪")
|
||||||
@PostMapping("/sketchBoardsBoundingBox")
|
@PostMapping("/sketchBoardsBoundingBox")
|
||||||
public Response<Boolean> sketchesBoundingBox(@Valid @RequestBody SketchesBoundingBoxDTO sketchesBoundingBoxDTO) {
|
public Response<List<CollectionSketchVO>> sketchesBoundingBox(@Valid @RequestBody SketchesBoundingBoxDTO sketchesBoundingBoxDTO) {
|
||||||
return Response.success(designService.sketchesBoundingBox(sketchesBoundingBoxDTO));
|
return Response.success(designService.sketchesBoundingBox(sketchesBoundingBoxDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
17
src/main/java/com/ai/da/model/vo/CollectionSketchVO.java
Normal file
17
src/main/java/com/ai/da/model/vo/CollectionSketchVO.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package com.ai.da.model.vo;
|
||||||
|
|
||||||
|
import com.ai.da.model.dto.CollectionSketchDTO;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("设计Collection Sketch 入参")
|
||||||
|
public class CollectionSketchVO extends CollectionSketchDTO {
|
||||||
|
|
||||||
|
private String urlWithWhiteSide;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,6 +18,7 @@ public class PageQueryBaseVo {
|
|||||||
|
|
||||||
@ApiModelProperty("每页数量")
|
@ApiModelProperty("每页数量")
|
||||||
@Min(value = 0, message = "size最小值为1")
|
@Min(value = 0, message = "size最小值为1")
|
||||||
@Max(value = 50, message = "size最大值为50")
|
// TODO:异常处理
|
||||||
|
@Max(value = 50, message = "TODO:size最大值为50 ")
|
||||||
private Integer size = 20;
|
private Integer size = 20;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,5 +23,5 @@ public class UserLikeVO {
|
|||||||
@ApiModelProperty("图片路径")
|
@ApiModelProperty("图片路径")
|
||||||
private String designOutfitUrl;
|
private String designOutfitUrl;
|
||||||
private String pictureName;
|
private String pictureName;
|
||||||
|
private String urlWithWhiteSide;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1785,6 +1785,7 @@ public class PythonService {
|
|||||||
content.put("userid", userId);
|
content.put("userid", userId);
|
||||||
content.put("colony", modelSex);
|
content.put("colony", modelSex);
|
||||||
MediaType mediaType = MediaType.parse("application/json");
|
MediaType mediaType = MediaType.parse("application/json");
|
||||||
|
System.out.println(JSON.toJSONString(content));
|
||||||
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content));
|
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content));
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url("http://18.167.251.121:9991/api/attribute_retrieve")
|
.url("http://18.167.251.121:9991/api/attribute_retrieve")
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.ai.da.service;
|
|||||||
|
|
||||||
import com.ai.da.mapper.entity.Design;
|
import com.ai.da.mapper.entity.Design;
|
||||||
import com.ai.da.model.dto.*;
|
import com.ai.da.model.dto.*;
|
||||||
|
import com.ai.da.model.vo.CollectionSketchVO;
|
||||||
import com.ai.da.model.vo.DesignCollectionVO;
|
import com.ai.da.model.vo.DesignCollectionVO;
|
||||||
import com.ai.da.model.vo.DesignItemDetailVO;
|
import com.ai.da.model.vo.DesignItemDetailVO;
|
||||||
import com.ai.da.model.vo.DesignLikeVO;
|
import com.ai.da.model.vo.DesignLikeVO;
|
||||||
@@ -10,6 +11,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务类
|
* 服务类
|
||||||
@@ -91,5 +93,5 @@ public interface DesignService extends IService<Design> {
|
|||||||
|
|
||||||
void relationImageId(DesignPythonObjects objects);
|
void relationImageId(DesignPythonObjects objects);
|
||||||
|
|
||||||
Boolean sketchesBoundingBox(SketchesBoundingBoxDTO sketchesBoundingBoxDTO);
|
List<CollectionSketchVO> sketchesBoundingBox(SketchesBoundingBoxDTO sketchesBoundingBoxDTO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -348,23 +348,59 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean sketchesBoundingBox(SketchesBoundingBoxDTO sketchesBoundingBoxDTO) {
|
public List<CollectionSketchVO> sketchesBoundingBox(SketchesBoundingBoxDTO sketchesBoundingBoxDTO) {
|
||||||
List<CollectionSketchDTO> sketchBoards = sketchesBoundingBoxDTO.getSketchBoards();
|
List<CollectionSketchDTO> sketchBoards = sketchesBoundingBoxDTO.getSketchBoards();
|
||||||
List<CollectionSketchDTO> collect = sketchBoards.stream()
|
if (CollectionUtil.isNotEmpty(sketchBoards)) {
|
||||||
.filter(o -> !o.getDesignType().equals(DesignTypeEnum.LIBRARY.getRealName()))
|
List<CollectionSketchVO> result = new ArrayList<>();
|
||||||
.collect(Collectors.toList());
|
List<CollectionSketchDTO> collect = sketchBoards.stream()
|
||||||
if (CollectionUtil.isNotEmpty(collect)) {
|
.filter(o -> !o.getDesignType().equals(DesignTypeEnum.LIBRARY.getRealName()))
|
||||||
for (CollectionSketchDTO collectionSketchDTO : collect) {
|
.collect(Collectors.toList());
|
||||||
if (collectionSketchDTO.getDesignType().equals(DesignTypeEnum.COLLECTION.getRealName())) {
|
if (CollectionUtil.isNotEmpty(collect)) {
|
||||||
CollectionElement byId = collectionElementService.getById(collectionSketchDTO.getSketchBoardId());
|
for (CollectionSketchDTO collectionSketchDTO : collect) {
|
||||||
libraryService.processSketchBoards(byId.getUrl(), collectionSketchDTO.getLevel2Type());
|
CollectionSketchVO vo = CopyUtil.copyObject(collectionSketchDTO, CollectionSketchVO.class);
|
||||||
}else if (collectionSketchDTO.getDesignType().equals(DesignTypeEnum.GENERATE.getRealName())) {
|
if (collectionSketchDTO.getDesignType().equals(DesignTypeEnum.COLLECTION.getRealName())) {
|
||||||
GenerateDetail generateDetail = generateDetailMapper.selectById(collectionSketchDTO.getSketchBoardId());
|
CollectionElement byId = collectionElementService.getById(collectionSketchDTO.getSketchBoardId());
|
||||||
libraryService.processSketchBoards(generateDetail.getUrl(), collectionSketchDTO.getLevel2Type());
|
libraryService.processSketchBoards(byId.getUrl(), collectionSketchDTO.getLevel2Type());
|
||||||
|
String url = byId.getUrl();
|
||||||
|
if (url.contains(".")) {
|
||||||
|
String[] split = url.split("\\.");
|
||||||
|
vo.setUrlWithWhiteSide(minioUtil.getPresignedUrl(split[0] + "-show." + split[1], 24 * 60));
|
||||||
|
}else {
|
||||||
|
vo.setUrlWithWhiteSide(minioUtil.getPresignedUrl(url + "-show", 24 * 60));
|
||||||
|
}
|
||||||
|
result.add(vo);
|
||||||
|
}else if (collectionSketchDTO.getDesignType().equals(DesignTypeEnum.GENERATE.getRealName())) {
|
||||||
|
GenerateDetail generateDetail = generateDetailMapper.selectById(collectionSketchDTO.getSketchBoardId());
|
||||||
|
libraryService.processSketchBoards(generateDetail.getUrl(), collectionSketchDTO.getLevel2Type());
|
||||||
|
String url = generateDetail.getUrl();
|
||||||
|
if (url.contains(".")) {
|
||||||
|
String[] split = url.split("\\.");
|
||||||
|
vo.setUrlWithWhiteSide(minioUtil.getPresignedUrl(split[0] + "-show." + split[1], 24 * 60));
|
||||||
|
}else {
|
||||||
|
vo.setUrlWithWhiteSide(minioUtil.getPresignedUrl(url + "-show", 24 * 60));
|
||||||
|
}
|
||||||
|
result.add(vo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
List<CollectionSketchDTO> libraryList = sketchBoards.stream()
|
||||||
|
.filter(o -> o.getDesignType().equals(DesignTypeEnum.LIBRARY.getRealName()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
for (CollectionSketchDTO collectionSketchDTO : libraryList) {
|
||||||
|
CollectionSketchVO vo = CopyUtil.copyObject(collectionSketchDTO, CollectionSketchVO.class);
|
||||||
|
Library byId = libraryService.getById(collectionSketchDTO.getSketchBoardId());
|
||||||
|
String url = byId.getUrl();
|
||||||
|
if (url.contains(".")) {
|
||||||
|
String[] split = url.split("\\.");
|
||||||
|
vo.setUrlWithWhiteSide(minioUtil.getPresignedUrl(split[0] + "-show." + split[1], 24 * 60));
|
||||||
|
}else {
|
||||||
|
vo.setUrlWithWhiteSide(minioUtil.getPresignedUrl(url + "-show", 24 * 60));
|
||||||
|
}
|
||||||
|
result.add(vo);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
return Boolean.TRUE;
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Long> relationImageIds(DesignPythonObjects pythonObjects) {
|
public List<Long> relationImageIds(DesignPythonObjects pythonObjects) {
|
||||||
@@ -472,7 +508,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MinioUtil minIoUtil;
|
private MinioUtil minioUtil;
|
||||||
|
|
||||||
private DesignCollectionVO savePythonDesignItemAndDetail(DesignPythonObjects pythonObjects
|
private DesignCollectionVO savePythonDesignItemAndDetail(DesignPythonObjects pythonObjects
|
||||||
, Long designId, Long collectionId, AuthPrincipalVo userInfo, String timeZone, JSONObject responseJSONObject, String singleOverall) {
|
, Long designId, Long collectionId, AuthPrincipalVo userInfo, String timeZone, JSONObject responseJSONObject, String singleOverall) {
|
||||||
@@ -540,7 +576,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
String designUrl = designPythonOutfit.getDesignUrl();
|
String designUrl = designPythonOutfit.getDesignUrl();
|
||||||
if (!StringUtils.isEmpty(designUrl) && designUrl.contains("/")) {
|
if (!StringUtils.isEmpty(designUrl) && designUrl.contains("/")) {
|
||||||
int firstIndex = designUrl.indexOf("/");
|
int firstIndex = designUrl.indexOf("/");
|
||||||
designCollectionItemVO.setDesignOutfitUrl(minIoUtil.getPresignedUrl(designUrl.substring(0, firstIndex) + "/" + designUrl.substring(firstIndex + 1), 24 * 60));
|
designCollectionItemVO.setDesignOutfitUrl(minioUtil.getPresignedUrl(designUrl.substring(0, firstIndex) + "/" + designUrl.substring(firstIndex + 1), 24 * 60));
|
||||||
}
|
}
|
||||||
//response
|
//response
|
||||||
designCollectionItems.add(designCollectionItemVO);
|
designCollectionItems.add(designCollectionItemVO);
|
||||||
@@ -927,7 +963,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
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.setPath(minIoUtil.getPresignedUrl(o.getPath(), 24 * 60));
|
d.setPath(minioUtil.getPresignedUrl(o.getPath(), 24 * 60));
|
||||||
d.setMinIOPath(o.getPath());
|
d.setMinIOPath(o.getPath());
|
||||||
d.setLevel1Type(converTypeToLevel1(o.getType()));
|
d.setLevel1Type(converTypeToLevel1(o.getType()));
|
||||||
// 根据designItemDetailId获取印花
|
// 根据designItemDetailId获取印花
|
||||||
@@ -952,12 +988,12 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
response.setOthers(CopyUtil.copyList(filterDetail2, DesignItemOthersDetailVO.class, (o, d) -> {
|
response.setOthers(CopyUtil.copyList(filterDetail2, DesignItemOthersDetailVO.class, (o, d) -> {
|
||||||
d.setId(o.getBusinessId());
|
d.setId(o.getBusinessId());
|
||||||
d.setPath(minIoUtil.getPresignedUrl(o.getPath(), 24 * 60));
|
d.setPath(minioUtil.getPresignedUrl(o.getPath(), 24 * 60));
|
||||||
d.setMinIOPath(o.getPath());
|
d.setMinIOPath(o.getPath());
|
||||||
d.setPrintObject(new DesignPythonItemPrint());
|
d.setPrintObject(new DesignPythonItemPrint());
|
||||||
}));
|
}));
|
||||||
return editDesignItemLayer(flag, designPythonOutfit,
|
return editDesignItemLayer(flag, designPythonOutfit,
|
||||||
minIoUtil.getPresignedUrl(designPythonOutfit.getDesignUrl(), 24 * 60),
|
minioUtil.getPresignedUrl(designPythonOutfit.getDesignUrl(), 24 * 60),
|
||||||
editResponseColor(designItemDetails, response));
|
editResponseColor(designItemDetails, response));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1098,7 +1134,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 2、将查询出的图层信息填充到designItemDetailVO中
|
// 2、将查询出的图层信息填充到designItemDetailVO中
|
||||||
designItemDetailVO.setDesignItemUrl(minIoUtil.getPresignedUrl(designPythonOutfit.getDesignUrl(), 24 * 60));
|
designItemDetailVO.setDesignItemUrl(minioUtil.getPresignedUrl(designPythonOutfit.getDesignUrl(), 24 * 60));
|
||||||
// 2.1 填充clothes
|
// 2.1 填充clothes
|
||||||
designItemDetailVO.getClothes().forEach(c -> {
|
designItemDetailVO.getClothes().forEach(c -> {
|
||||||
String type = c.getType().toLowerCase();
|
String type = c.getType().toLowerCase();
|
||||||
@@ -1136,7 +1172,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
designSinglePrint.setLocation(JSONArray.parseArray(detailPrint.getPosition(), Double.class));
|
designSinglePrint.setLocation(JSONArray.parseArray(detailPrint.getPosition(), Double.class));
|
||||||
designSinglePrint.setAngle(detailPrint.getAngle());
|
designSinglePrint.setAngle(detailPrint.getAngle());
|
||||||
designSinglePrint.setPriority(detailPrint.getPriority());
|
designSinglePrint.setPriority(detailPrint.getPriority());
|
||||||
designSinglePrint.setPath(minIoUtil.getPresignedUrl(detailPrint.getPath(), 24 * 60));
|
designSinglePrint.setPath(minioUtil.getPresignedUrl(detailPrint.getPath(), 24 * 60));
|
||||||
designSinglePrint.setMinIOPath(detailPrint.getPath());
|
designSinglePrint.setMinIOPath(detailPrint.getPath());
|
||||||
designSinglePrint.setScale(detailPrint.getScale());
|
designSinglePrint.setScale(detailPrint.getScale());
|
||||||
prints.add(designSinglePrint);
|
prints.add(designSinglePrint);
|
||||||
@@ -1146,7 +1182,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
designItemDetailPrints.forEach(print -> {
|
designItemDetailPrints.forEach(print -> {
|
||||||
if (print.getSingleOrOverall().equals("single")) {
|
if (print.getSingleOrOverall().equals("single")) {
|
||||||
prints.add(new DesignSinglePrint(
|
prints.add(new DesignSinglePrint(
|
||||||
minIoUtil.getPresignedUrl(print.getPath(), 24 * 60),
|
minioUtil.getPresignedUrl(print.getPath(), 24 * 60),
|
||||||
print.getPath(),
|
print.getPath(),
|
||||||
JSONArray.parseArray(print.getPosition(), Double.class),
|
JSONArray.parseArray(print.getPosition(), Double.class),
|
||||||
print.getScale(),
|
print.getScale(),
|
||||||
|
|||||||
@@ -124,6 +124,13 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
o.setPictureName(o.getUrl().substring(index + 1));
|
o.setPictureName(o.getUrl().substring(index + 1));
|
||||||
}
|
}
|
||||||
o.setDesignOutfitUrl(minioUtil.getPresignedUrl(o.getUrl(), 24 * 60));
|
o.setDesignOutfitUrl(minioUtil.getPresignedUrl(o.getUrl(), 24 * 60));
|
||||||
|
String url = o.getUrl();
|
||||||
|
if (url.contains(".")) {
|
||||||
|
String[] split = url.split("\\.");
|
||||||
|
o.setUrlWithWhiteSide(minioUtil.getPresignedUrl(split[0] + "-show." + split[1], 24 * 60));
|
||||||
|
}else {
|
||||||
|
o.setUrlWithWhiteSide(minioUtil.getPresignedUrl(url + "-show", 24 * 60));
|
||||||
|
}
|
||||||
QueryWrapper<TDesignPythonOutfit> qw = new QueryWrapper<>();
|
QueryWrapper<TDesignPythonOutfit> qw = new QueryWrapper<>();
|
||||||
qw.lambda().eq(TDesignPythonOutfit::getDesignItemId, o.getDesignItemId());
|
qw.lambda().eq(TDesignPythonOutfit::getDesignItemId, o.getDesignItemId());
|
||||||
List<TDesignPythonOutfit> tDesignPythonOutfits = designPythonOutfitMapper.selectList(qw);
|
List<TDesignPythonOutfit> tDesignPythonOutfits = designPythonOutfitMapper.selectList(qw);
|
||||||
|
|||||||
Reference in New Issue
Block a user