BUGFIX:Single design;
This commit is contained in:
@@ -23,6 +23,9 @@ public class QueryLibraryPageVO {
|
||||
@ApiModelProperty("二级类型")
|
||||
private String level2Type;
|
||||
|
||||
@ApiModelProperty("三级类型")
|
||||
private String level3Type;
|
||||
|
||||
@ApiModelProperty("design类型 用户design生成时候区别library和collection")
|
||||
private String designType;
|
||||
|
||||
|
||||
@@ -311,21 +311,21 @@ public class PythonService {
|
||||
return result.setScale(0, RoundingMode.HALF_UP).intValue();
|
||||
}
|
||||
|
||||
private int calculatePinSketchNum(List<CollectionElement> sketchBoardElements, List<String> hasUseMd5List) {
|
||||
List<CollectionElement> pinData = getPinData(sketchBoardElements, hasUseMd5List);
|
||||
if (CollectionUtil.isEmpty(pinData)) {
|
||||
return 0;
|
||||
}
|
||||
// long topNum = sketchBoardElements.stream()
|
||||
// .filter(skecth -> skecth.getHasPin() == 1
|
||||
// && DesignPythonItem.OUTWEAR_DRESS_BLOUSE.contains(skecth.getLevel2Type())).count();
|
||||
// long bottomNum = sketchBoardElements.stream()
|
||||
// .filter(skecth -> skecth.getHasPin() == 1
|
||||
// && DesignPythonItem.SKIRT_TROUSERS.contains(skecth.getLevel2Type())).count();
|
||||
// int num = Arrays.asList(topNum, bottomNum).stream().max(Comparator.comparing(Long::valueOf)).get().intValue();
|
||||
int num = pinData.size();
|
||||
return Math.min(num, 8);
|
||||
}
|
||||
// private int calculatePinSketchNum(List<CollectionElement> sketchBoardElements, List<String> hasUseMd5List) {
|
||||
// List<CollectionElement> pinData = getPinData(sketchBoardElements, hasUseMd5List);
|
||||
// if (CollectionUtil.isEmpty(pinData)) {
|
||||
// return 0;
|
||||
// }
|
||||
//// long topNum = sketchBoardElements.stream()
|
||||
//// .filter(skecth -> skecth.getHasPin() == 1
|
||||
//// && DesignPythonItem.OUTWEAR_DRESS_BLOUSE.contains(skecth.getLevel2Type())).count();
|
||||
//// long bottomNum = sketchBoardElements.stream()
|
||||
//// .filter(skecth -> skecth.getHasPin() == 1
|
||||
//// && DesignPythonItem.SKIRT_TROUSERS.contains(skecth.getLevel2Type())).count();
|
||||
//// int num = Arrays.asList(topNum, bottomNum).stream().max(Comparator.comparing(Long::valueOf)).get().intValue();
|
||||
// int num = pinData.size();
|
||||
// return Math.min(num, 8);
|
||||
// }
|
||||
|
||||
//计算当前的图片类型
|
||||
private CurrentDesignPictureTypeEnum calculateCurrentDesignPictureType(int pinSketchNum, int sysSketchNum, int noPinSketchNum) {
|
||||
@@ -377,23 +377,23 @@ public class PythonService {
|
||||
}
|
||||
|
||||
//计算Pin图片张数
|
||||
private int calculatePinPictureNum(List<CollectionElement> sketchBoardElements, List<String> hasUseMd5List) {
|
||||
List<CollectionElement> pinData = getPinData(sketchBoardElements, hasUseMd5List);
|
||||
if (CollectionUtil.isEmpty(pinData)) {
|
||||
return 0;
|
||||
}
|
||||
long topNum = sketchBoardElements.stream()
|
||||
.filter(skecth -> skecth.getHasPin() == 1
|
||||
&& DesignPythonItem.OUTWEAR_DRESS_BLOUSE.contains(skecth.getLevel2Type())).count();
|
||||
long bottomNum = sketchBoardElements.stream()
|
||||
.filter(skecth -> skecth.getHasPin() == 1
|
||||
&& DesignPythonItem.SKIRT_TROUSERS.contains(skecth.getLevel2Type())).count();
|
||||
int num = Arrays.asList(topNum, bottomNum).stream().max(Comparator.comparing(Long::valueOf)).get().intValue();
|
||||
if (num > 8) {
|
||||
return 8;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
// private int calculatePinPictureNum(List<CollectionElement> sketchBoardElements, List<String> hasUseMd5List) {
|
||||
// List<CollectionElement> pinData = getPinData(sketchBoardElements, hasUseMd5List);
|
||||
// if (CollectionUtil.isEmpty(pinData)) {
|
||||
// return 0;
|
||||
// }
|
||||
// long topNum = sketchBoardElements.stream()
|
||||
// .filter(skecth -> skecth.getHasPin() == 1
|
||||
// && DesignPythonItem.OUTWEAR_DRESS_BLOUSE.contains(skecth.getLevel2Type())).count();
|
||||
// long bottomNum = sketchBoardElements.stream()
|
||||
// .filter(skecth -> skecth.getHasPin() == 1
|
||||
// && DesignPythonItem.SKIRT_TROUSERS.contains(skecth.getLevel2Type())).count();
|
||||
// int num = Arrays.asList(topNum, bottomNum).stream().max(Comparator.comparing(Long::valueOf)).get().intValue();
|
||||
// if (num > 8) {
|
||||
// return 8;
|
||||
// }
|
||||
// return num;
|
||||
// }
|
||||
|
||||
//计算当前的Print图片类型
|
||||
private CurrentDesignPrintPictureTypeEnum calculateCurrentDesignPintPictureType(long pinPrintNum, long noPinPrintNum, long noPrintNum) {
|
||||
@@ -478,42 +478,42 @@ public class PythonService {
|
||||
}
|
||||
}
|
||||
|
||||
private List<DesignPythonItem> coverToDesignPythonItem(ValidateElementVO elementVO, CurrentDesignPictureTypeEnum designPictureType) {
|
||||
//Pin的数据
|
||||
List<CollectionElement> pinData = getPinData(elementVO.getSketchBoardElements(), elementVO.getHasUseMd5List());
|
||||
//计算填充PythonItemBlouse
|
||||
List<DesignPythonItem> items = Lists.newArrayList();
|
||||
if (elementVO.getModelSex().equals("Female")) {
|
||||
List<DesignPythonItem> blouseList = calculatePythonItemBlouse(pinData, elementVO, designPictureType);
|
||||
if (!CollectionUtils.isEmpty(blouseList)) {
|
||||
items.addAll(blouseList);
|
||||
}
|
||||
//计算填充PythonItemSkirt
|
||||
DesignPythonItem skirt = calculatePythonItemSkirt(pinData, elementVO, designPictureType);
|
||||
if (Objects.nonNull(skirt)) {
|
||||
items.add(skirt);
|
||||
}
|
||||
} else {
|
||||
// 男装逻辑
|
||||
DesignPythonItem top = calculatePythonItemTop(pinData, elementVO, designPictureType);
|
||||
if (Objects.nonNull(top)) {
|
||||
items.add(top);
|
||||
}
|
||||
DesignPythonItem bottom = calculatePythonItemBottom(pinData, elementVO, designPictureType);
|
||||
if (Objects.nonNull(bottom)) {
|
||||
items.add(bottom);
|
||||
}
|
||||
if (SingleOverallEnum.SINGLE.getRealName().equals(elementVO.getSingleOverall()) && elementVO.getSwitchCategory().equals("Outwear")) {
|
||||
DesignPythonItem outwear = calculatePythonItemOutwear(pinData, elementVO, designPictureType);
|
||||
if (Objects.nonNull(outwear)) {
|
||||
items.add(outwear);
|
||||
}
|
||||
}
|
||||
}
|
||||
//计算填充Hairstyle Earring Shoes Body
|
||||
items.addAll(calculatePythonItemHairstyleShoes(elementVO, elementVO.getDesignLibraryModelPoint()));
|
||||
return items;
|
||||
}
|
||||
// private List<DesignPythonItem> coverToDesignPythonItem(ValidateElementVO elementVO, CurrentDesignPictureTypeEnum designPictureType) {
|
||||
// //Pin的数据
|
||||
// List<CollectionElement> pinData = getPinData(elementVO.getSketchBoardElements(), elementVO.getHasUseMd5List());
|
||||
// //计算填充PythonItemBlouse
|
||||
// List<DesignPythonItem> items = Lists.newArrayList();
|
||||
// if (elementVO.getModelSex().equals("Female")) {
|
||||
// List<DesignPythonItem> blouseList = calculatePythonItemBlouse(pinData, elementVO, designPictureType);
|
||||
// if (!CollectionUtils.isEmpty(blouseList)) {
|
||||
// items.addAll(blouseList);
|
||||
// }
|
||||
// //计算填充PythonItemSkirt
|
||||
// DesignPythonItem skirt = calculatePythonItemSkirt(pinData, elementVO, designPictureType);
|
||||
// if (Objects.nonNull(skirt)) {
|
||||
// items.add(skirt);
|
||||
// }
|
||||
// } else {
|
||||
// // 男装逻辑
|
||||
// DesignPythonItem top = calculatePythonItemTop(pinData, elementVO, designPictureType);
|
||||
// if (Objects.nonNull(top)) {
|
||||
// items.add(top);
|
||||
// }
|
||||
// DesignPythonItem bottom = calculatePythonItemBottom(pinData, elementVO, designPictureType);
|
||||
// if (Objects.nonNull(bottom)) {
|
||||
// items.add(bottom);
|
||||
// }
|
||||
// if (SingleOverallEnum.SINGLE.getRealName().equals(elementVO.getSingleOverall()) && elementVO.getSwitchCategory().equals("Outwear")) {
|
||||
// DesignPythonItem outwear = calculatePythonItemOutwear(pinData, elementVO, designPictureType);
|
||||
// if (Objects.nonNull(outwear)) {
|
||||
// items.add(outwear);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// //计算填充Hairstyle Earring Shoes Body
|
||||
// items.addAll(calculatePythonItemHairstyleShoes(elementVO, elementVO.getDesignLibraryModelPoint()));
|
||||
// return items;
|
||||
// }
|
||||
|
||||
private List<DesignPythonItem> coverToDesignPythonItemNew(ValidateElementVO elementVO, CurrentDesignPictureTypeEnum designPictureType, BigDecimal systemScale) {
|
||||
List<DesignPythonItem> itemList = new ArrayList<>();
|
||||
@@ -575,7 +575,12 @@ public class PythonService {
|
||||
}
|
||||
case NO_PIN:
|
||||
case SYS_FILE: {
|
||||
List<CollectionElement> collectNoPin = elementVO.getSketchBoardElements().stream().filter(o -> o.getHasPin() == 0 && o.getLevel2Type().equals(styleCategory)).collect(Collectors.toList());
|
||||
List<CollectionElement> collectNoPin;
|
||||
if (CollectionUtils.isEmpty(elementVO.getSketchBoardElements())) {
|
||||
collectNoPin = null;
|
||||
}else {
|
||||
collectNoPin = elementVO.getSketchBoardElements().stream().filter(o -> o.getHasPin() == 0 && o.getLevel2Type().equals(styleCategory)).collect(Collectors.toList());
|
||||
}
|
||||
int poolNum = 20;
|
||||
if (CollectionUtil.isNotEmpty(collectNoPin)) {
|
||||
int collectionNoPinSize = collectNoPin.size();
|
||||
@@ -887,8 +892,7 @@ public class PythonService {
|
||||
List<CollectionElement> noPinData = getNoPinData(elementVO);
|
||||
if (CollectionUtil.isEmpty(noPinData)) {
|
||||
// 根据pin的获取 type
|
||||
List<CollectionElement> sketchBoardPins = elementVO.getSketchBoardElements()
|
||||
.stream().filter(v -> v.getHasPin() == 1).collect(Collectors.toList());
|
||||
List<CollectionElement> sketchBoardPins = getPinDataWhole(elementVO);
|
||||
if (elementVO.getSingleOverall().equals(SingleOverallEnum.SINGLE.getRealName())) {
|
||||
sketchBoardPins = sketchBoardPins.stream().filter(o -> o.getLevel2Type().equals(elementVO.getSwitchCategory())).collect(Collectors.toList());
|
||||
}
|
||||
@@ -924,16 +928,23 @@ public class PythonService {
|
||||
case SYS_FILE: {
|
||||
// 根据pin noPin的获取 type
|
||||
List<CollectionElement> sketchBoardPins = elementVO.getSketchBoardElements();
|
||||
if (elementVO.getSingleOverall().equals(SingleOverallEnum.SINGLE.getRealName())) {
|
||||
sketchBoardPins = sketchBoardPins.stream().filter(o -> o.getLevel2Type().equals(elementVO.getSwitchCategory())).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(sketchBoardPins)) {
|
||||
if (elementVO.getModelSex().equals(Sex.MALE.getValue())) {
|
||||
sketchBoardPins = sketchBoardPins.stream().filter(o -> MALE_CATEGORY.contains(o.getLevel2Type())).collect(Collectors.toList());
|
||||
}
|
||||
if (elementVO.getModelSex().equals(Sex.FEMALE.getValue())) {
|
||||
sketchBoardPins = sketchBoardPins.stream().filter(o -> FEMALE_CATEGORY.contains(o.getLevel2Type())).collect(Collectors.toList());
|
||||
}
|
||||
if (elementVO.getSingleOverall().equals(SingleOverallEnum.SINGLE.getRealName())) {
|
||||
sketchBoardPins = sketchBoardPins.stream().filter(o -> o.getLevel2Type().equals(elementVO.getSwitchCategory())).collect(Collectors.toList());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(sketchBoardPins)) {
|
||||
Integer randomNum = RandomsUtil.randomSysFile(sketchBoardPins.size());
|
||||
CollectionElement element = sketchBoardPins.get(randomNum);
|
||||
JSONObject attributeRecognition = getAttributeRecognitionBySameCategory(element, elementVO.getModelSex());
|
||||
return processAttributeRecognitionBySameCategory(attributeRecognition, elementVO, element.getLevel2Type());
|
||||
}
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(sketchBoardPins)) {
|
||||
Integer randomNum = RandomsUtil.randomSysFile(sketchBoardPins.size());
|
||||
CollectionElement element = sketchBoardPins.get(randomNum);
|
||||
JSONObject attributeRecognition = getAttributeRecognitionBySameCategory(element, elementVO.getModelSex());
|
||||
return processAttributeRecognitionBySameCategory(attributeRecognition, elementVO, element.getLevel2Type());
|
||||
}
|
||||
|
||||
QueryWrapper<Dressing> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(Dressing::getApparel, elementVO.getModelSex());
|
||||
if (elementVO.getSingleOverall().equals(SingleOverallEnum.SINGLE.getRealName())) {
|
||||
@@ -2004,7 +2015,7 @@ public class PythonService {
|
||||
}
|
||||
|
||||
private List<CollectionElement> getPinData(ValidateElementVO elementVO) {
|
||||
List<CollectionElement> pinData = getPinData(elementVO.getSketchBoardElements(), elementVO.getHasUseMd5List());
|
||||
List<CollectionElement> pinData = getPinData(elementVO.getSketchBoardElements(), elementVO.getHasUseMd5List(), elementVO.getModelSex());
|
||||
if (elementVO.getSingleOverall().equals(SingleOverallEnum.SINGLE.getRealName())) {
|
||||
if (!CollectionUtils.isEmpty(pinData)) {
|
||||
return pinData.stream().filter(o -> o.getLevel2Type().equals(elementVO.getSwitchCategory())).collect(Collectors.toList());
|
||||
@@ -2016,12 +2027,52 @@ public class PythonService {
|
||||
}
|
||||
}
|
||||
|
||||
private List<CollectionElement> getPinData(List<CollectionElement> sketchBoardElements, List<String> hasUseMd5List) {
|
||||
private List<CollectionElement> getPinDataWhole(ValidateElementVO elementVO) {
|
||||
List<CollectionElement> pinData = getPinDataWhole(elementVO.getSketchBoardElements(), elementVO.getHasUseMd5List(), elementVO.getModelSex());
|
||||
if (elementVO.getSingleOverall().equals(SingleOverallEnum.SINGLE.getRealName())) {
|
||||
if (!CollectionUtils.isEmpty(pinData)) {
|
||||
return pinData.stream().filter(o -> o.getLevel2Type().equals(elementVO.getSwitchCategory())).collect(Collectors.toList());
|
||||
}else {
|
||||
return pinData;
|
||||
}
|
||||
}else {
|
||||
return pinData;
|
||||
}
|
||||
}
|
||||
|
||||
private List<CollectionElement> getPinDataWhole(List<CollectionElement> sketchBoardElements, List<String> hasUseMd5List, String modelSex) {
|
||||
if (CollectionUtils.isEmpty(sketchBoardElements)) {
|
||||
return null;
|
||||
}
|
||||
List<CollectionElement> sketchBoardPins = sketchBoardElements
|
||||
.stream().filter(v -> v.getHasPin() == 1).collect(Collectors.toList());
|
||||
if (modelSex.equals(Sex.MALE.getValue())) {
|
||||
sketchBoardPins = sketchBoardPins.stream().filter(o -> MALE_CATEGORY.contains(o.getLevel2Type())).collect(Collectors.toList());
|
||||
}
|
||||
if (modelSex.equals(Sex.FEMALE.getValue())) {
|
||||
sketchBoardPins = sketchBoardPins.stream().filter(o -> FEMALE_CATEGORY.contains(o.getLevel2Type())).collect(Collectors.toList());
|
||||
}
|
||||
if (CollectionUtils.isEmpty(sketchBoardPins)) {
|
||||
return null;
|
||||
}
|
||||
return sketchBoardPins;
|
||||
}
|
||||
|
||||
public final static List<String> FEMALE_CATEGORY = Arrays.asList("Dress","Blouse","Skirt","Trousers","Outwear");
|
||||
public final static List<String> MALE_CATEGORY = Arrays.asList("Tops","Bottoms","Outwear");
|
||||
|
||||
private List<CollectionElement> getPinData(List<CollectionElement> sketchBoardElements, List<String> hasUseMd5List, String modelSex) {
|
||||
if (CollectionUtils.isEmpty(sketchBoardElements)) {
|
||||
return null;
|
||||
}
|
||||
List<CollectionElement> sketchBoardPins = sketchBoardElements
|
||||
.stream().filter(v -> v.getHasPin() == 1 && (!hasUseMd5List.contains(v.getMd5()))).collect(Collectors.toList());
|
||||
if (modelSex.equals(Sex.MALE.getValue())) {
|
||||
sketchBoardPins = sketchBoardPins.stream().filter(o -> MALE_CATEGORY.contains(o.getLevel2Type())).collect(Collectors.toList());
|
||||
}
|
||||
if (modelSex.equals(Sex.FEMALE.getValue())) {
|
||||
sketchBoardPins = sketchBoardPins.stream().filter(o -> FEMALE_CATEGORY.contains(o.getLevel2Type())).collect(Collectors.toList());
|
||||
}
|
||||
if (CollectionUtils.isEmpty(sketchBoardPins)) {
|
||||
return null;
|
||||
}
|
||||
@@ -2030,22 +2081,28 @@ public class PythonService {
|
||||
|
||||
private List<CollectionElement> getNoPinData(ValidateElementVO elementVO) {
|
||||
if (elementVO.getSingleOverall().equals(SingleOverallEnum.SINGLE.getRealName())) {
|
||||
List<CollectionElement> noPinData = getNoPinData(elementVO.getSketchBoardElements());
|
||||
List<CollectionElement> noPinData = getNoPinData(elementVO.getSketchBoardElements(), elementVO.getModelSex());
|
||||
if (CollectionUtils.isEmpty(noPinData)) {
|
||||
return null;
|
||||
}
|
||||
return noPinData.stream().filter(o -> o.getLevel2Type().equals(elementVO.getSwitchCategory())).collect(Collectors.toList());
|
||||
}else {
|
||||
return getNoPinData(elementVO.getSketchBoardElements());
|
||||
return getNoPinData(elementVO.getSketchBoardElements(), elementVO.getModelSex());
|
||||
}
|
||||
}
|
||||
|
||||
private List<CollectionElement> getNoPinData(List<CollectionElement> sketchBoardElements) {
|
||||
private List<CollectionElement> getNoPinData(List<CollectionElement> sketchBoardElements, String modelSex) {
|
||||
if (CollectionUtils.isEmpty(sketchBoardElements)) {
|
||||
return null;
|
||||
}
|
||||
List<CollectionElement> sketchBoardPins = sketchBoardElements
|
||||
.stream().filter(v -> v.getHasPin() == 0).collect(Collectors.toList());
|
||||
if (modelSex.equals(Sex.MALE.getValue())) {
|
||||
sketchBoardPins = sketchBoardPins.stream().filter(o -> MALE_CATEGORY.contains(o.getLevel2Type())).collect(Collectors.toList());
|
||||
}
|
||||
if (modelSex.equals(Sex.FEMALE.getValue())) {
|
||||
sketchBoardPins = sketchBoardPins.stream().filter(o -> FEMALE_CATEGORY.contains(o.getLevel2Type())).collect(Collectors.toList());
|
||||
}
|
||||
if (CollectionUtils.isEmpty(sketchBoardPins)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
//保存design
|
||||
Long designId = saveOne(designDTO, collectionId, userInfo.getId());
|
||||
//计算library
|
||||
calculateLibraryAndSysFile(designDTO, elementVO, userInfo);
|
||||
// calculateLibraryAndSysFile(designDTO, elementVO, userInfo);
|
||||
//组装design入参
|
||||
DesignPythonObjects pythonObjects = pythonService.covertDesignParam(designDTO.getSystemScale(),
|
||||
designDTO.getSingleOverall(), designDTO.getSwitchCategory(), elementVO, designDTO.getProcessId());
|
||||
@@ -702,10 +702,10 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
throw new BusinessException("collection.not.found");
|
||||
}
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
//查询用户 sketch library
|
||||
List<LibraryVo> libraryVos = libraryService.selectByAccountIdAnd1TypeList(userInfo.getId(),
|
||||
Arrays.asList(CollectionLevel1TypeEnum.PRINT_BOARD.getRealName(),
|
||||
CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName()));
|
||||
// //查询用户 sketch library
|
||||
// List<LibraryVo> libraryVos = libraryService.selectByAccountIdAnd1TypeList(userInfo.getId(),
|
||||
// Arrays.asList(CollectionLevel1TypeEnum.PRINT_BOARD.getRealName(),
|
||||
// CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName()));
|
||||
//校验collection element
|
||||
DesignCollectionDTO designCollectionDTO = CopyUtil.copyObject(reDesignDTO, DesignCollectionDTO.class);
|
||||
ValidateElementVO elementVO = collectionElementService.validateElement(designCollectionDTO);
|
||||
|
||||
Reference in New Issue
Block a user