获取design detail
This commit is contained in:
@@ -44,8 +44,9 @@ public class DesignDetailController {
|
|||||||
}
|
}
|
||||||
@ApiOperation(value = "查询design详情")
|
@ApiOperation(value = "查询design详情")
|
||||||
@GetMapping("/getDetail")
|
@GetMapping("/getDetail")
|
||||||
public Response<DesignItemDetailVO> getDetail(@ApiParam("designItemId") @RequestParam("designItemId") Long designItemId) {
|
public Response<DesignItemDetailVO> getDetail(@ApiParam("designItemId") @RequestParam("designItemId") Long designItemId,
|
||||||
return Response.success(designService.detail(designItemId));
|
@ApiParam("designPythonOutfitId") @RequestParam(value = "designPythonOutfitId",required = false) Long designPythonOutfitId) {
|
||||||
|
return Response.success(designService.detail(designItemId,designItemId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "切换系统的element")
|
@ApiOperation(value = "切换系统的element")
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public class PanTone implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* pantone_index
|
* pantone_index
|
||||||
*/
|
*/
|
||||||
|
@TableId("pantone_index")
|
||||||
private Integer pantoneIndex;
|
private Integer pantoneIndex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.ai.da.model.vo;
|
package com.ai.da.model.vo;
|
||||||
|
|
||||||
|
import com.ai.da.mapper.entity.TDesignPythonOutfitDetail;
|
||||||
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;
|
||||||
@@ -10,12 +11,14 @@ import java.util.List;
|
|||||||
@ApiModel("designItem detail从python端获取的合成图+各图层响应")
|
@ApiModel("designItem detail从python端获取的合成图+各图层响应")
|
||||||
public class DesignPythonOutfitVO {
|
public class DesignPythonOutfitVO {
|
||||||
|
|
||||||
@ApiModelProperty("designPythonOutfitId")
|
@ApiModelProperty("当前图片无图层信息时,为空")
|
||||||
private Long designPythonOutfitId;
|
private Long designPythonOutfitId;
|
||||||
|
|
||||||
@ApiModelProperty("合成图")
|
@ApiModelProperty("合成图")
|
||||||
String designPythonOutfitUrl;
|
String designPythonOutfitUrl;
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
// 需明确,不需要的数据不要返回
|
||||||
@ApiModelProperty("各部分图层信息")
|
@ApiModelProperty("各部分图层信息")
|
||||||
List<DesignPythonOutfitDetailVO> designItemDetailLayers;
|
List<TDesignPythonOutfitDetail> designItemDetailLayers;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,5 +75,5 @@ public interface DesignService extends IService<Design> {
|
|||||||
* @param designItemId
|
* @param designItemId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
DesignItemDetailVO detail(Long designItemId);
|
DesignItemDetailVO detail(Long designPythonOutfitId,Long designItemId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import com.ai.da.model.vo.TDesignPythonOutfitDetailVO;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* design item详情表 服务类
|
* design item详情表 服务类
|
||||||
*
|
*
|
||||||
@@ -23,4 +25,10 @@ public interface ITDesignPythonOutfitDetailService extends IService<TDesignPytho
|
|||||||
*/
|
*/
|
||||||
IPage<TDesignPythonOutfitDetailVO> selectTDesignPythonOutfitDetailPage(IPage<TDesignPythonOutfitDetailVO> page, TDesignPythonOutfitDetailVO tDesignPythonOutfitDetail);
|
IPage<TDesignPythonOutfitDetailVO> selectTDesignPythonOutfitDetailPage(IPage<TDesignPythonOutfitDetailVO> page, TDesignPythonOutfitDetailVO tDesignPythonOutfitDetail);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过DesignPythonOutfitId获取designPythonOutfitDetail
|
||||||
|
* @param designPythonOutfitId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TDesignPythonOutfitDetail> getDetailByDesignPythonOutfitId(Long designPythonOutfitId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.ai.da.model.vo.PantoneVO;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务类
|
* 服务类
|
||||||
@@ -41,6 +42,8 @@ public interface PanToneService extends IService<PanTone> {
|
|||||||
*/
|
*/
|
||||||
PantoneVO getByRGB(Integer r,Integer g,Integer b);
|
PantoneVO getByRGB(Integer r,Integer g,Integer b);
|
||||||
|
|
||||||
|
Map<String,PantoneVO> getPantoneByRgbBatch(List<String> colors);
|
||||||
|
|
||||||
PantoneVO getPantoneByRgb(String color);
|
PantoneVO getPantoneByRgb(String color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,21 +5,17 @@ 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.SingleOverallEnum;
|
|
||||||
import com.ai.da.common.enums.SysFileLevel2TypeEnum;
|
import com.ai.da.common.enums.SysFileLevel2TypeEnum;
|
||||||
import com.ai.da.common.utils.CopyUtil;
|
import com.ai.da.common.utils.CopyUtil;
|
||||||
import com.ai.da.common.utils.DateUtil;
|
import com.ai.da.common.utils.DateUtil;
|
||||||
import com.ai.da.common.utils.FileUtil;
|
import com.ai.da.common.utils.FileUtil;
|
||||||
import com.ai.da.common.utils.LocalCacheUtils;
|
import com.ai.da.common.utils.LocalCacheUtils;
|
||||||
import com.ai.da.mapper.DesignMapper;
|
import com.ai.da.mapper.DesignMapper;
|
||||||
import com.ai.da.mapper.TDesignPythonOutfitDetailMapper;
|
|
||||||
import com.ai.da.mapper.TDesignPythonOutfitMapper;
|
|
||||||
import com.ai.da.mapper.entity.*;
|
import com.ai.da.mapper.entity.*;
|
||||||
import com.ai.da.mapper.entity.Collection;
|
import com.ai.da.mapper.entity.Collection;
|
||||||
import com.ai.da.model.dto.*;
|
import com.ai.da.model.dto.*;
|
||||||
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.DesignPythonItemPrint;
|
import com.ai.da.python.vo.DesignPythonItemPrint;
|
||||||
import com.ai.da.python.vo.DesignPythonObjects;
|
import com.ai.da.python.vo.DesignPythonObjects;
|
||||||
import com.ai.da.service.*;
|
import com.ai.da.service.*;
|
||||||
@@ -31,12 +27,10 @@ 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 net.sf.jsqlparser.expression.operators.relational.OldOracleJoinBinaryExpression;
|
|
||||||
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;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import sun.security.krb5.internal.crypto.Des;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -650,7 +644,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DesignItemDetailVO detail(Long designItemId) {
|
public DesignItemDetailVO detail(Long designPythonOutfitId,Long designItemId) {
|
||||||
DesignItem designItem = designItemService.getById(designItemId);
|
DesignItem designItem = designItemService.getById(designItemId);
|
||||||
Assert.notNull(designItem,"design item does not exist!");
|
Assert.notNull(designItem,"design item does not exist!");
|
||||||
Design design = getById(designItem.getDesignId());
|
Design design = getById(designItem.getDesignId());
|
||||||
@@ -658,7 +652,13 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
List<DesignItemDetail> designItemDetails = designItemDetailService.selectByDesignItemId(designItemId);
|
List<DesignItemDetail> designItemDetails = designItemDetailService.selectByDesignItemId(designItemId);
|
||||||
Assert.notEmpty(designItemDetails,"designItemDetails does not exist!");
|
Assert.notEmpty(designItemDetails,"designItemDetails does not exist!");
|
||||||
// 添加判断designPythonOutfitId是否存在
|
// 添加判断designPythonOutfitId是否存在
|
||||||
|
TDesignPythonOutfit designPythonOutfit = new TDesignPythonOutfit();
|
||||||
|
Boolean flag = Boolean.FALSE;
|
||||||
|
if (Objects.nonNull(designPythonOutfitId)){
|
||||||
|
designPythonOutfit = designPythonOutfitService.getById(designPythonOutfitId);
|
||||||
|
Assert.notNull(designPythonOutfit,"designPythonOutfit does not exist!");
|
||||||
|
flag = Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
DesignItemDetailVO response = new DesignItemDetailVO();
|
DesignItemDetailVO response = new DesignItemDetailVO();
|
||||||
response.setSingleOverall(design.getSingleOverall());
|
response.setSingleOverall(design.getSingleOverall());
|
||||||
@@ -688,7 +688,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
d.setId(o.getBusinessId());
|
d.setId(o.getBusinessId());
|
||||||
d.setPrintObject(new DesignPythonItemPrint());
|
d.setPrintObject(new DesignPythonItemPrint());
|
||||||
}));
|
}));
|
||||||
return editResponseColor(designItemDetails,response);
|
return editDesignItemLayer(flag,designPythonOutfit,designItem.getDesignUrl(),editResponseColor(designItemDetails,response));
|
||||||
}
|
}
|
||||||
private String converTypeToLevel1(String type){
|
private String converTypeToLevel1(String type){
|
||||||
if(StringUtils.isEmpty(type)){
|
if(StringUtils.isEmpty(type)){
|
||||||
@@ -735,7 +735,7 @@ 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 -> {
|
/*designItemDetails.forEach(d -> {
|
||||||
if (!StringUtil.isNullOrEmpty(d.getColor())){
|
if (!StringUtil.isNullOrEmpty(d.getColor())){
|
||||||
PantoneVO pantoneByRgb = panToneService.getPantoneByRgb(d.getColor());
|
PantoneVO pantoneByRgb = panToneService.getPantoneByRgb(d.getColor());
|
||||||
DesignItemClothesDetailVO clothesDetailVO = designItemDetailVO.getClothes().stream()
|
DesignItemClothesDetailVO clothesDetailVO = designItemDetailVO.getClothes().stream()
|
||||||
@@ -753,21 +753,50 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});*/
|
||||||
|
|
||||||
|
HashMap<Long, String> businessIdColor = new HashMap<>();
|
||||||
|
designItemDetails.forEach(designItemDetail -> {
|
||||||
|
if (!StringUtil.isNullOrEmpty(designItemDetail.getColor())){
|
||||||
|
businessIdColor.put(designItemDetail.getBusinessId(),designItemDetail.getColor());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Map<String, PantoneVO> pantoneByRgbBatch = panToneService.getPantoneByRgbBatch(new ArrayList<>(businessIdColor.values()));
|
||||||
|
|
||||||
|
designItemDetailVO.getClothes().forEach(c -> {
|
||||||
|
PantoneVO pantoneVO = pantoneByRgbBatch.get(businessIdColor.get(c.getId()));
|
||||||
|
c.setColor(pantoneVO);
|
||||||
|
});
|
||||||
|
|
||||||
|
designItemDetailVO.getOthers().forEach(o -> {
|
||||||
|
PantoneVO pantoneVO = pantoneByRgbBatch.get(businessIdColor.get(o.getId()));
|
||||||
|
o.setColor(pantoneVO);
|
||||||
|
});
|
||||||
|
|
||||||
return designItemDetailVO;
|
return designItemDetailVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private DesignItemDetailVO editDesignItemLayer(Long designPythonOutfitId,DesignItemDetailVO designItemDetailVO){
|
private DesignItemDetailVO editDesignItemLayer(Boolean flag,TDesignPythonOutfit designPythonOutfit,String designItemId,DesignItemDetailVO designItemDetailVO){
|
||||||
// 1、判断designPythonOutfitId查出的图层信息是否为空(不允许为空,系统内部错误)
|
DesignPythonOutfitVO designPythonOutfitVO = new DesignPythonOutfitVO();
|
||||||
|
|
||||||
// 2、将查询出的图层信息填充到designItemDetailVO中
|
if (flag){
|
||||||
|
// 1、判断designPythonOutfitId查出的图层信息是否为空(不允许为空,系统内部错误)
|
||||||
|
List<TDesignPythonOutfitDetail> details = designPythonOutfitDetailService.getDetailByDesignPythonOutfitId(designPythonOutfit.getId());
|
||||||
|
Assert.notEmpty(details,"Some errors occurred, please restart the design");
|
||||||
|
|
||||||
|
// 2、将查询出的图层信息填充到designItemDetailVO中
|
||||||
|
designPythonOutfitVO.setDesignPythonOutfitId(designPythonOutfit.getId());
|
||||||
|
designPythonOutfitVO.setDesignPythonOutfitUrl(designPythonOutfit.getDesignUrl());
|
||||||
|
designPythonOutfitVO.setDesignItemDetailLayers(details);
|
||||||
|
}else{
|
||||||
|
designPythonOutfitVO.setDesignPythonOutfitUrl(designItemId);
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
designItemDetailVO.setDesignItemUrl(designPythonOutfitVO);
|
||||||
|
|
||||||
|
return designItemDetailVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ public class PanToneServiceImpl extends ServiceImpl<PanToneMapper, PanTone> impl
|
|||||||
return coverPanToneToVo(panTones);
|
return coverPanToneToVo(panTones);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Map<String,PantoneVO> getPantoneByRgbBatch(List<String> colors){
|
public Map<String,PantoneVO> getPantoneByRgbBatch(List<String> colors){
|
||||||
|
|
||||||
HashMap<Integer,String> colorValueRgb = new HashMap<>();
|
HashMap<Integer,String> colorValueRgb = new HashMap<>();
|
||||||
@@ -89,13 +90,18 @@ public class PanToneServiceImpl extends ServiceImpl<PanToneMapper, PanTone> impl
|
|||||||
colorIndexRgb.put(colorValue.getColorIndex(),colorValueRgb.get(colorValue.getColorValue()));
|
colorIndexRgb.put(colorValue.getColorIndex(),colorValueRgb.get(colorValue.getColorValue()));
|
||||||
});
|
});
|
||||||
|
|
||||||
List<PanTone> panTones = panToneService.listByIds(colorIndexRgb.values());
|
List<PanTone> panTones = panToneService.listByIds(colorIndexRgb.keySet());
|
||||||
ArrayList<PantoneVO> pantoneVOS = new ArrayList<>();
|
ArrayList<PantoneVO> pantoneVOS = new ArrayList<>();
|
||||||
panTones.forEach(panTone -> {
|
panTones.forEach(panTone -> {
|
||||||
pantoneVOS.add(coverPanToneToVo(panTone));
|
pantoneVOS.add(coverPanToneToVo(panTone));
|
||||||
});
|
});
|
||||||
|
|
||||||
return null;
|
HashMap<String, PantoneVO> colorPantoneVO = new HashMap<>();
|
||||||
|
pantoneVOS.forEach(pantoneVO -> {
|
||||||
|
colorPantoneVO.put(colorIndexRgb.get(pantoneVO.getId()),pantoneVO);
|
||||||
|
});
|
||||||
|
|
||||||
|
return colorPantoneVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,13 @@ import com.ai.da.mapper.TDesignPythonOutfitDetailMapper;
|
|||||||
import com.ai.da.mapper.entity.TDesignPythonOutfitDetail;
|
import com.ai.da.mapper.entity.TDesignPythonOutfitDetail;
|
||||||
import com.ai.da.model.vo.TDesignPythonOutfitDetailVO;
|
import com.ai.da.model.vo.TDesignPythonOutfitDetailVO;
|
||||||
import com.ai.da.service.ITDesignPythonOutfitDetailService;
|
import com.ai.da.service.ITDesignPythonOutfitDetailService;
|
||||||
|
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 org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* design item详情表 服务实现类
|
* design item详情表 服务实现类
|
||||||
*
|
*
|
||||||
@@ -22,4 +25,13 @@ public class TDesignPythonOutfitDetailServiceImpl extends ServiceImpl<TDesignPyt
|
|||||||
return page.setRecords(baseMapper.selectTDesignPythonOutfitDetailPage(page, tDesignPythonOutfitDetail));
|
return page.setRecords(baseMapper.selectTDesignPythonOutfitDetailPage(page, tDesignPythonOutfitDetail));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TDesignPythonOutfitDetail> getDetailByDesignPythonOutfitId(Long designPythonOutfitId){
|
||||||
|
QueryWrapper<TDesignPythonOutfitDetail> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("design_python_outfit_id",designPythonOutfitId);
|
||||||
|
|
||||||
|
return baseMapper.selectList(queryWrapper);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user