design detail代码转移,临时存储
This commit is contained in:
@@ -41,6 +41,8 @@ public interface PanToneService extends IService<PanTone> {
|
||||
*/
|
||||
PantoneVO getByRGB(Integer r,Integer g,Integer b);
|
||||
|
||||
PantoneVO getPantoneByRgb(String color);
|
||||
|
||||
/**
|
||||
* 根据hsv批量查询
|
||||
* @param rgbByHsvBatch
|
||||
|
||||
@@ -157,6 +157,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
LibraryModelPoint modelPoint = libraryModelPointService.getById(design.getTemplateId());
|
||||
Assert.notNull(modelPoint,"template does not exists!");
|
||||
Library library = libraryService.getById(modelPoint.getLibraryId());
|
||||
// ??和上面重复
|
||||
Assert.notNull(modelPoint,"template does not exists!");
|
||||
designLibraryModelPointVO = collectionElementService.calculateTemplatePoint(modelPoint,library.getHigh(),library.getWidth(),library.getUrl());
|
||||
}
|
||||
@@ -170,6 +171,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
//designSingle
|
||||
DesignCollectionItemVO response = saveSingleDesignItemAndDetail(objects,design.getId(),designSingleDTO.getDesignItemId(),
|
||||
design.getCollectionId(),userInfo,designSingleDTO.getTimeZone());
|
||||
// ??
|
||||
designItem.setDesignUrl(response.getDesignItemUrl());
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.jsqlparser.expression.operators.relational.OldOracleJoinBinaryExpression;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -74,6 +75,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
private SysFileService sysFileService;
|
||||
@Resource
|
||||
private TCollectionElementRelationService tCollectionElementRelationService;
|
||||
@Resource
|
||||
private PanToneService panToneService;
|
||||
|
||||
// @Transactional
|
||||
@Override
|
||||
@@ -528,11 +531,14 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
Assert.notNull(design,"design does not exist!");
|
||||
List<DesignItemDetail> designItemDetails = designItemDetailService.selectByDesignItemId(designItemId);
|
||||
Assert.notEmpty(designItemDetails,"designItemDetails does not exist!");
|
||||
// 添加判断designPythonOutfitId是否存在
|
||||
|
||||
|
||||
DesignItemDetailVO response = new DesignItemDetailVO();
|
||||
response.setSingleOverall(design.getSingleOverall());
|
||||
response.setSwitchCategory(design.getSwitchCategory());
|
||||
response.setDesignItemId(designItemId);
|
||||
response.setDesignItemUrl(designItem.getDesignUrl());
|
||||
// response.setDesignItemUrl(designItem.getDesignUrl());
|
||||
response.setHighDesignUrl(designItem.getHighDesignUrl());
|
||||
List<DesignItemDetail> filterDetail = designItemDetails.stream()
|
||||
.filter(f -> OUTWEAR_DRESS_BLOUSE.contains(f.getType()) || SKIRT_TROUSERS.contains(f.getType()))
|
||||
@@ -556,7 +562,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
d.setId(o.getBusinessId());
|
||||
d.setPrintObject(new DesignPythonItemPrint());
|
||||
}));
|
||||
return response;
|
||||
return editResponseColor(designItemDetails,response);
|
||||
}
|
||||
private String converTypeToLevel1(String type){
|
||||
if(StringUtils.isEmpty(type)){
|
||||
@@ -596,5 +602,46 @@ 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())){
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
return designItemDetailVO;
|
||||
}
|
||||
|
||||
|
||||
private DesignItemDetailVO editDesignItemLayer(Long designPythonOutfitId,DesignItemDetailVO designItemDetailVO){
|
||||
// 1、判断designPythonOutfitId查出的图层信息是否为空(不允许为空,系统内部错误)
|
||||
|
||||
// 2、将查询出的图层信息填充到designItemDetailVO中
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.ai.da.service.impl;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.ai.da.common.config.exception.BusinessException;
|
||||
import com.ai.da.common.utils.CopyUtil;
|
||||
import com.ai.da.mapper.entity.Collection;
|
||||
import com.ai.da.common.utils.PantoneUtils;
|
||||
import com.ai.da.mapper.entity.ColorLookupTable;
|
||||
import com.ai.da.mapper.entity.PanTone;
|
||||
import com.ai.da.mapper.PanToneMapper;
|
||||
@@ -15,17 +15,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -35,6 +30,8 @@ public class PanToneServiceImpl extends ServiceImpl<PanToneMapper, PanTone> impl
|
||||
@Resource
|
||||
private PanToneMapper panToneMapper;
|
||||
@Resource
|
||||
private PanToneService panToneService;
|
||||
@Resource
|
||||
private ColorLoopUpTableService colorLoopUpTableService;
|
||||
|
||||
@Override
|
||||
@@ -74,6 +71,49 @@ public class PanToneServiceImpl extends ServiceImpl<PanToneMapper, PanTone> impl
|
||||
return coverPanToneToVo(panTones);
|
||||
}
|
||||
|
||||
public Map<String,PantoneVO> getPantoneByRgbBatch(List<String> colors){
|
||||
|
||||
HashMap<Integer,String> colorValueRgb = new HashMap<>();
|
||||
HashMap<Integer,String> colorIndexRgb = new HashMap<>();
|
||||
ArrayList<Integer> values = new ArrayList<>();
|
||||
colors.forEach(color -> {
|
||||
int[] rgb = Arrays.stream(color.split("\\s+")).mapToInt(Integer::parseInt).toArray();
|
||||
int[] hsv = PantoneUtils.rgbToHsv(rgb);
|
||||
|
||||
int value = (hsv[0] * 101 *101)+ (hsv[1]*101) +hsv[2];
|
||||
colorValueRgb.put(value,color);
|
||||
values.add(value);
|
||||
});
|
||||
List<ColorLookupTable> colorValueList = colorLoopUpTableService.getByColorValueList(values);
|
||||
colorValueList.forEach(colorValue ->{
|
||||
colorIndexRgb.put(colorValue.getColorIndex(),colorValueRgb.get(colorValue.getColorValue()));
|
||||
});
|
||||
|
||||
List<PanTone> panTones = panToneService.listByIds(colorIndexRgb.values());
|
||||
ArrayList<PantoneVO> pantoneVOS = new ArrayList<>();
|
||||
panTones.forEach(panTone -> {
|
||||
pantoneVOS.add(coverPanToneToVo(panTone));
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PantoneVO getPantoneByRgb(String color){
|
||||
GetRgbByHsvBatchDTO getRgbByHsvBatchDTO = new GetRgbByHsvBatchDTO();
|
||||
if (!StringUtil.isNullOrEmpty(color)){
|
||||
int[] rgb = Arrays.stream(color.split("\\s+")).mapToInt(Integer::parseInt).toArray();
|
||||
int[] hsv = PantoneUtils.rgbToHsv(rgb);
|
||||
|
||||
getRgbByHsvBatchDTO.setH(hsv[0]);
|
||||
getRgbByHsvBatchDTO.setS(hsv[1]);
|
||||
getRgbByHsvBatchDTO.setV(hsv[2]);
|
||||
}
|
||||
|
||||
return getByHSV(getRgbByHsvBatchDTO.getH(),getRgbByHsvBatchDTO.getS(),getRgbByHsvBatchDTO.getV());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PantoneVO> getRgbByHsvBatch(List<GetRgbByHsvBatchDTO> hsvBatch) {
|
||||
if(hsvBatch.size() >15){
|
||||
|
||||
Reference in New Issue
Block a user