修改 获取design detail接口的返回数据格式
This commit is contained in:
@@ -2,6 +2,7 @@ package com.ai.da.service;
|
||||
|
||||
|
||||
import com.ai.da.mapper.entity.TDesignPythonOutfitDetail;
|
||||
import com.ai.da.model.vo.DesignPythonOutfitVO;
|
||||
import com.ai.da.model.vo.TDesignPythonOutfitDetailVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@@ -31,4 +32,6 @@ public interface ITDesignPythonOutfitDetailService extends IService<TDesignPytho
|
||||
* @return
|
||||
*/
|
||||
List<TDesignPythonOutfitDetail> getDetailByDesignPythonOutfitId(Long designPythonOutfitId);
|
||||
|
||||
DesignPythonOutfitVO convertToDesignPythonOutfitVO(TDesignPythonOutfitDetail detail);
|
||||
}
|
||||
|
||||
@@ -682,7 +682,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
}));
|
||||
//single 和 Models(模特)时候 系统元素为空
|
||||
List<DesignItemDetail> filterDetail2 =designItemDetails.stream()
|
||||
.filter(f -> SYS_HAIRSTYLE_SHOES.contains(f.getType()) )
|
||||
// .filter(f -> SYS_HAIRSTYLE_SHOES.contains(f.getType()) )
|
||||
.filter(f -> SYS_HAIRSTYLE_SHOES_BODY.contains(f.getType()) )
|
||||
.collect(Collectors.toList());
|
||||
response.setOthers(CopyUtil.copyList(filterDetail2,DesignItemOthersDetailVO.class,(o,d)->{
|
||||
d.setId(o.getBusinessId());
|
||||
@@ -728,12 +729,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
return design.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param designItemDetails
|
||||
* @param designItemDetailVO
|
||||
* @return
|
||||
*/
|
||||
private DesignItemDetailVO editResponseColor(List<DesignItemDetail> designItemDetails,DesignItemDetailVO designItemDetailVO){
|
||||
/*designItemDetails.forEach(d -> {
|
||||
if (!StringUtil.isNullOrEmpty(d.getColor())){
|
||||
@@ -778,25 +773,40 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
}
|
||||
|
||||
|
||||
private DesignItemDetailVO editDesignItemLayer(Boolean flag,TDesignPythonOutfit designPythonOutfit,String designItemId,DesignItemDetailVO designItemDetailVO){
|
||||
DesignPythonOutfitVO designPythonOutfitVO = new DesignPythonOutfitVO();
|
||||
private DesignItemDetailVO editDesignItemLayer(Boolean flag,TDesignPythonOutfit designPythonOutfit,String designItemUrl,DesignItemDetailVO designItemDetailVO){
|
||||
ArrayList<DesignPythonOutfitVO> detailsVO = new ArrayList<>();
|
||||
|
||||
if (flag){
|
||||
// 1、判断designPythonOutfitId查出的图层信息是否为空(不允许为空,系统内部错误)
|
||||
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));
|
||||
});
|
||||
|
||||
// 2、将查询出的图层信息填充到designItemDetailVO中
|
||||
designPythonOutfitVO.setDesignPythonOutfitId(designPythonOutfit.getId());
|
||||
designPythonOutfitVO.setDesignPythonOutfitUrl(designPythonOutfit.getDesignUrl());
|
||||
designPythonOutfitVO.setDesignItemDetailLayers(details);
|
||||
}else{
|
||||
designPythonOutfitVO.setDesignPythonOutfitUrl(designItemId);
|
||||
}
|
||||
designItemDetailVO.setDesignItemUrl(designPythonOutfit.getDesignUrl());
|
||||
// 2.1 填充clothes
|
||||
designItemDetailVO.getClothes().forEach(c -> {
|
||||
String type = c.getType().toLowerCase();
|
||||
List<DesignPythonOutfitVO> outfitVOS = detailsVO.stream().filter(detail -> detail.getImageCategory().equals(type + "_back") ||
|
||||
detail.getImageCategory().equals(type + "_front")).collect(Collectors.toList());
|
||||
|
||||
designItemDetailVO.setDesignItemUrl(designPythonOutfitVO);
|
||||
c.setLayersObject(outfitVOS);
|
||||
});
|
||||
// 2.2 填充others
|
||||
designItemDetailVO.getOthers().forEach(o -> {
|
||||
String type = o.getType().toLowerCase();
|
||||
List<DesignPythonOutfitVO> outfitVOS = detailsVO.stream().filter(detail -> detail.getImageCategory().equals(type + "_back") ||
|
||||
detail.getImageCategory().equals(type + "_front") ||
|
||||
detail.getImageCategory().equals("body")).collect(Collectors.toList());
|
||||
|
||||
o.setLayersObject(outfitVOS);
|
||||
});
|
||||
}else{
|
||||
designItemDetailVO.setDesignItemUrl(designItemUrl);
|
||||
}
|
||||
|
||||
return designItemDetailVO;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.ai.da.service.impl;
|
||||
|
||||
import com.ai.da.common.utils.CopyUtil;
|
||||
import com.ai.da.mapper.TDesignPythonOutfitDetailMapper;
|
||||
import com.ai.da.mapper.entity.TDesignPythonOutfitDetail;
|
||||
import com.ai.da.model.vo.DesignPythonOutfitVO;
|
||||
import com.ai.da.model.vo.TDesignPythonOutfitDetailVO;
|
||||
import com.ai.da.service.ITDesignPythonOutfitDetailService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -10,6 +12,7 @@ import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* design item详情表 服务实现类
|
||||
@@ -31,7 +34,15 @@ public class TDesignPythonOutfitDetailServiceImpl extends ServiceImpl<TDesignPyt
|
||||
queryWrapper.eq("design_python_outfit_id",designPythonOutfitId);
|
||||
|
||||
return baseMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DesignPythonOutfitVO convertToDesignPythonOutfitVO(TDesignPythonOutfitDetail detail){
|
||||
if (Objects.isNull(detail)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return CopyUtil.copyObject(detail,DesignPythonOutfitVO.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user