接口修改: designSingle添加返回参数 offset,currentFullBodyView

This commit is contained in:
xupei
2023-10-09 16:40:39 +08:00
parent 1f463aeaaa
commit 7d8c3ca8f3
6 changed files with 19 additions and 5 deletions

View File

@@ -46,6 +46,9 @@ public class DesignPythonOutfitVO {
*/
@ApiModelProperty(value = "位置")
private List<Long> position;
@ApiModelProperty(value = "偏移量")
private List<Long> offset;
/**
* 图层缩放比例
*/

View File

@@ -14,6 +14,8 @@ public class DesignSingleVO {
@ApiModelProperty("全身图")
private String designItemUrl;
@ApiModelProperty("当前全身图")
private String currentFullBodyView;
@ApiModelProperty("clothes 数组")
private List<DesignItemClothesDetailVO> clothes;

View File

@@ -33,7 +33,7 @@ public interface ITDesignPythonOutfitDetailService extends IService<TDesignPytho
*/
List<TDesignPythonOutfitDetail> getDetailByDesignPythonOutfitId(Long designPythonOutfitId);
DesignPythonOutfitVO convertToDesignPythonOutfitVO(TDesignPythonOutfitDetail detail);
DesignPythonOutfitVO convertToDesignPythonOutfitVO(TDesignPythonOutfitDetail detail,List<Long> type);
void deleteByDesignPythonOutfitId(Long designPythonOutfitId);

View File

@@ -434,7 +434,10 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
List<DesignPythonOutfitVO> detailsVO = new ArrayList<>();
tDesignPythonOutfitDetails.forEach(detail -> {
detailsVO.add(designPythonOutfitDetailService.convertToDesignPythonOutfitVO(detail));
Map<String, List<Long>> typeOffset = designSingleIncludeLayersDTO.getDesignSingleItemDTOList().stream()
.collect(Collectors.toMap(d -> d.getType().toLowerCase(), DesignSingleItemDTO::getOffset));
String type = detail.getImageCategory().split("_")[0];
detailsVO.add(designPythonOutfitDetailService.convertToDesignPythonOutfitVO(detail,typeOffset.get(type)));
});
TDesignPythonOutfit designPythonOutfit = designPythonOutfitService.getByDesignItemId(designSingleIncludeLayersDTO.getDesignItemId());
@@ -442,7 +445,9 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
return assembleDesignSingleResponse(designItem.getId(),
minioUtil.splitThenGetPreviewUrl(designPythonOutfit.getDesignUrl(),480),
designSingleIncludeLayersDTO.getDesignSingleItemDTOList(),detailsVO);
outfit.getString("synthesis_url"),
designSingleIncludeLayersDTO.getDesignSingleItemDTOList(),
detailsVO);
}
@Override
@@ -513,6 +518,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
}
private DesignSingleVO assembleDesignSingleResponse(Long designItemId,String designItemUrl,
String currentFullBodyView,
List<DesignSingleItemDTO> designSingleItemDTOList,
List<DesignPythonOutfitVO> layersObject){
@@ -522,6 +528,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
designSingleVO.setDesignItemId(designItemId);
// 图片用于修改前后的一键对比
designSingleVO.setDesignItemUrl(designItemUrl);
// 当前全身图
designSingleVO.setCurrentFullBodyView(minioUtil.splitThenGetPreviewUrl(currentFullBodyView,480));;
designSingleVO.setClothes(clothes);
designSingleItemDTOList.forEach(singleItem -> {

View File

@@ -987,7 +987,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
List<TDesignPythonOutfitDetail> details = designPythonOutfitDetailService.getDetailByDesignPythonOutfitId(designPythonOutfit.getId());
Assert.notEmpty(details, "Some errors occurred, please restart the design");
details.forEach(detail -> {
detailsVO.add(designPythonOutfitDetailService.convertToDesignPythonOutfitVO(detail));
detailsVO.add(designPythonOutfitDetailService.convertToDesignPythonOutfitVO(detail,null));
});
// 2、将查询出的图层信息填充到designItemDetailVO中

View File

@@ -49,7 +49,7 @@ public class TDesignPythonOutfitDetailServiceImpl extends ServiceImpl<TDesignPyt
}
@Override
public DesignPythonOutfitVO convertToDesignPythonOutfitVO(TDesignPythonOutfitDetail detail){
public DesignPythonOutfitVO convertToDesignPythonOutfitVO(TDesignPythonOutfitDetail detail,List<Long> offset){
if (Objects.isNull(detail)) {
return null;
}
@@ -62,6 +62,7 @@ public class TDesignPythonOutfitDetailServiceImpl extends ServiceImpl<TDesignPyt
designPythonOutfitVO.setMaskUrl(StringUtil.isNullOrEmpty(detail.getMaskUrl()) ? null : minIoUtil.splitThenGetPreviewUrl(detail.getMaskUrl(),480));
designPythonOutfitVO.setMaskMinioUrl(StringUtil.isNullOrEmpty(detail.getMaskUrl()) ? null : detail.getMaskUrl());
designPythonOutfitVO.setScale(Float.parseFloat(detail.getScale()));
designPythonOutfitVO.setOffset(offset);
/*if (!StringUtil.isNullOrEmpty(detail.getImageSize())){
List<Long> size = Arrays.stream(detail.getImageSize().replaceAll("\\[|\\]", "").split(",")).map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());