|
|
|
|
@@ -417,12 +417,185 @@ public class PythonService {
|
|
|
|
|
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 DesignPythonItem calculatePythonItemOutwear(List<CollectionElement> pinData, ValidateElementVO elementVO, CurrentDesignPictureTypeEnum designPictureType) {
|
|
|
|
|
DesignPythonItem outwear = null;
|
|
|
|
|
//剩余的的PinData
|
|
|
|
|
List<Long> existPinDataIds = elementVO.getExistPinDataIds();
|
|
|
|
|
List<CollectionElement> residuePinData = residuePinData(pinData, existPinDataIds, elementVO.getHasUseMd5List());
|
|
|
|
|
if (CollectionUtil.isNotEmpty(residuePinData)) {
|
|
|
|
|
//single模式
|
|
|
|
|
if (SingleOverallEnum.SINGLE.getRealName().equals(elementVO.getSingleOverall())) {
|
|
|
|
|
if (DesignPythonItem.OUTWEAR.contains(elementVO.getSwitchCategory())) {
|
|
|
|
|
//是否包含的Pin
|
|
|
|
|
Boolean isPin = residuePinData.stream().filter(residue ->
|
|
|
|
|
elementVO.getSwitchCategory().equals(residue.getLevel2Type())).findFirst().isPresent();
|
|
|
|
|
//如果包含Pin只传一个
|
|
|
|
|
if (isPin) {
|
|
|
|
|
//Pin的数据
|
|
|
|
|
pinData = getPinDataByLevel2Type(pinData, elementVO.getSwitchCategory());
|
|
|
|
|
//剩余的的PinData
|
|
|
|
|
List<CollectionElement> residueInnerPinDataByType = residuePinData(pinData, existPinDataIds, elementVO.getHasUseMd5List());
|
|
|
|
|
CollectionElement elementNew = CollectionUtils.isEmpty(residueInnerPinDataByType) ? null : residueInnerPinDataByType.get(0);
|
|
|
|
|
if (Objects.nonNull(elementNew)) {
|
|
|
|
|
outwear = coverToDesignPythonItem(elementNew.getId(), elementVO.getSwitchCategory(), elementNew.getUrl(), elementVO);
|
|
|
|
|
//去重用
|
|
|
|
|
existPinDataIds.add(elementNew.getId());
|
|
|
|
|
//添加已使用的md5
|
|
|
|
|
elementVO.getHasUseMd5List().add(elementNew.getMd5());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//是否包含skirt的Pin
|
|
|
|
|
Boolean isPin = residuePinData.stream().filter(residue ->
|
|
|
|
|
DesignPythonItem.OUTWEAR.contains(residue.getLevel2Type())).findFirst().isPresent();
|
|
|
|
|
//如果包含Pin只传一个
|
|
|
|
|
if (isPin) {
|
|
|
|
|
for (String type : DesignPythonItem.OUTWEAR) {
|
|
|
|
|
//剩余的的PinData
|
|
|
|
|
List<CollectionElement> residueInnerPinData = residuePinData(pinData, existPinDataIds, elementVO.getHasUseMd5List());
|
|
|
|
|
CollectionElement elementNew = residueInnerPinData.stream()
|
|
|
|
|
.filter(element -> element.getLevel2Type().equals(type)).findFirst().orElse(null);
|
|
|
|
|
if (Objects.nonNull(elementNew)) {
|
|
|
|
|
outwear = coverToDesignPythonItem(elementNew.getId(), type, elementNew.getUrl(), elementVO);
|
|
|
|
|
//去重用
|
|
|
|
|
existPinDataIds.add(elementNew.getId());
|
|
|
|
|
//添加已使用的md5
|
|
|
|
|
elementVO.getHasUseMd5List().add(elementNew.getMd5());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (Objects.nonNull(outwear)) {
|
|
|
|
|
return outwear;
|
|
|
|
|
}
|
|
|
|
|
switch (designPictureType) {
|
|
|
|
|
case PIN:
|
|
|
|
|
if (Objects.isNull(outwear)) {
|
|
|
|
|
//single模式
|
|
|
|
|
if (SingleOverallEnum.SINGLE.getRealName().equals(elementVO.getSingleOverall())) {
|
|
|
|
|
if (DesignPythonItem.OUTWEAR.contains(elementVO.getSwitchCategory())) {
|
|
|
|
|
//系统获取
|
|
|
|
|
SysFileVO sysFileVO = getRandomSysFileByLevel2Type(elementVO.getSwitchCategory(), elementVO.getSysFileIds(), elementVO.getModelSex());
|
|
|
|
|
outwear = coverToDesignPythonItem(null, sysFileVO.getLevel2Type(), sysFileVO.getUrl(), elementVO);
|
|
|
|
|
outwear.setBusinessId(sysFileVO.getId());
|
|
|
|
|
return outwear;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//系统获取
|
|
|
|
|
SysFileVO sysFileVO = getRandomSysFileMaleBottoms(elementVO.getSysFileVo(), elementVO.getSysFileIds(), elementVO.getModelSex());
|
|
|
|
|
outwear = coverToDesignPythonItem(null, sysFileVO.getLevel2Type(), sysFileVO.getUrl(), elementVO);
|
|
|
|
|
outwear.setBusinessId(sysFileVO.getId());
|
|
|
|
|
//添加已使用的md5
|
|
|
|
|
return outwear;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case USER_LIBRARY:
|
|
|
|
|
//single模式
|
|
|
|
|
if (SingleOverallEnum.SINGLE.getRealName().equals(elementVO.getSingleOverall())) {
|
|
|
|
|
if (DesignPythonItem.OUTWEAR.contains(elementVO.getSwitchCategory())) {
|
|
|
|
|
LibraryVo libraryVo = getRandomLibrary(elementVO.getLibraryVos(),
|
|
|
|
|
Arrays.asList(elementVO.getSwitchCategory()), elementVO.getHasUseMd5List());
|
|
|
|
|
if (StringUtils.isEmpty(libraryVo)) {
|
|
|
|
|
//系统获取
|
|
|
|
|
SysFileVO sysFileVO = getRandomSysFileByLevel2Type(elementVO.getSwitchCategory(), elementVO.getSysFileIds(), elementVO.getModelSex());
|
|
|
|
|
outwear = coverToDesignPythonItem(null, sysFileVO.getLevel2Type(), sysFileVO.getUrl(), elementVO);
|
|
|
|
|
outwear.setBusinessId(sysFileVO.getId());
|
|
|
|
|
return outwear;
|
|
|
|
|
}
|
|
|
|
|
outwear = coverToDesignPythonItem(null, libraryVo.getLevel2Type(), libraryVo.getUrl(), elementVO);
|
|
|
|
|
elementVO.getHasUseMd5List().add(libraryVo.getMd5());
|
|
|
|
|
outwear.setBusinessId(libraryVo.getId());
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
LibraryVo libraryVo = getRandomLibrary(elementVO.getLibraryVos(),
|
|
|
|
|
DesignPythonItem.OUTWEAR, elementVO.getHasUseMd5List());
|
|
|
|
|
if (StringUtils.isEmpty(libraryVo)) {
|
|
|
|
|
//系统获取
|
|
|
|
|
SysFileVO sysFileVO = getRandomSysFileMaleBottoms(elementVO.getSysFileVo(), elementVO.getSysFileIds(), elementVO.getModelSex());
|
|
|
|
|
outwear = coverToDesignPythonItem(null, sysFileVO.getLevel2Type(), sysFileVO.getUrl(), elementVO);
|
|
|
|
|
outwear.setBusinessId(sysFileVO.getId());
|
|
|
|
|
//添加已使用的md5
|
|
|
|
|
return outwear;
|
|
|
|
|
}
|
|
|
|
|
outwear = coverToDesignPythonItem(null, libraryVo.getLevel2Type(), libraryVo.getUrl(), elementVO);
|
|
|
|
|
outwear.setBusinessId(libraryVo.getId());
|
|
|
|
|
elementVO.getHasUseMd5List().add(libraryVo.getMd5());
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case SYS_FILE:
|
|
|
|
|
//single模式
|
|
|
|
|
if (SingleOverallEnum.SINGLE.getRealName().equals(elementVO.getSingleOverall())) {
|
|
|
|
|
if (DesignPythonItem.OUTWEAR.contains(elementVO.getSwitchCategory())) {
|
|
|
|
|
//系统获取
|
|
|
|
|
SysFileVO sysFileVO = getRandomSysFileByLevel2Type(elementVO.getSwitchCategory(), elementVO.getSysFileIds(), elementVO.getModelSex());
|
|
|
|
|
outwear = coverToDesignPythonItem(null, sysFileVO.getLevel2Type(), sysFileVO.getUrl(), elementVO);
|
|
|
|
|
outwear.setBusinessId(sysFileVO.getId());
|
|
|
|
|
return outwear;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//系统获取
|
|
|
|
|
SysFileVO sysFileVO = getRandomSysFileMaleBottoms(elementVO.getSysFileVo(), elementVO.getSysFileIds(), elementVO.getModelSex());
|
|
|
|
|
outwear = coverToDesignPythonItem(null, sysFileVO.getLevel2Type(), sysFileVO.getUrl(), elementVO);
|
|
|
|
|
outwear.setBusinessId(sysFileVO.getId());
|
|
|
|
|
//添加已使用的md5
|
|
|
|
|
return outwear;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case NO_PIN:
|
|
|
|
|
//single模式
|
|
|
|
|
if (SingleOverallEnum.SINGLE.getRealName().equals(elementVO.getSingleOverall())) {
|
|
|
|
|
if (DesignPythonItem.OUTWEAR.contains(elementVO.getSwitchCategory())) {
|
|
|
|
|
//非Pin的数据
|
|
|
|
|
List<CollectionElement> noPinDataByType =
|
|
|
|
|
getNoPinData(elementVO.getSketchBoardElements(), Collections.singletonList(elementVO.getSwitchCategory()));
|
|
|
|
|
CollectionElement collectionElement = getRandomSketchLibrary(noPinDataByType, elementVO.getHasUseMd5List());
|
|
|
|
|
if (Objects.isNull(collectionElement)) {
|
|
|
|
|
//系统获取
|
|
|
|
|
SysFileVO sysFileVO = getRandomSysFileByLevel2Type(elementVO.getSwitchCategory(), elementVO.getSysFileIds(), elementVO.getModelSex());
|
|
|
|
|
outwear = coverToDesignPythonItem(null, sysFileVO.getLevel2Type(), sysFileVO.getUrl(), elementVO);
|
|
|
|
|
outwear.setBusinessId(sysFileVO.getId());
|
|
|
|
|
} else {
|
|
|
|
|
elementVO.getHasUseMd5List().add(collectionElement.getMd5());
|
|
|
|
|
outwear = coverToDesignPythonItem(collectionElement.getId(), collectionElement.getLevel2Type(), collectionElement.getUrl(), elementVO);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//非Pin的数据
|
|
|
|
|
List<CollectionElement> noPinData = getNoPinData(elementVO.getSketchBoardElements(), DesignPythonItem.OUTWEAR);
|
|
|
|
|
CollectionElement collectionElement = getRandomSketchLibrary(noPinData, elementVO.getHasUseMd5List());
|
|
|
|
|
if (Objects.isNull(collectionElement)) {
|
|
|
|
|
//系统获取
|
|
|
|
|
SysFileVO sysFileVO = getRandomSysFileMaleBottoms(elementVO.getSysFileVo(), elementVO.getSysFileIds(), elementVO.getModelSex());
|
|
|
|
|
outwear = coverToDesignPythonItem(null, sysFileVO.getLevel2Type(), sysFileVO.getUrl(), elementVO);
|
|
|
|
|
outwear.setBusinessId(sysFileVO.getId());
|
|
|
|
|
} else {
|
|
|
|
|
elementVO.getHasUseMd5List().add(collectionElement.getMd5());
|
|
|
|
|
outwear = coverToDesignPythonItem(collectionElement.getId(), collectionElement.getLevel2Type(), collectionElement.getUrl(), elementVO);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
}
|
|
|
|
|
return outwear;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private DesignPythonItem calculatePythonItemBottom(List<CollectionElement> pinData, ValidateElementVO elementVO, CurrentDesignPictureTypeEnum designPictureType) {
|
|
|
|
|
DesignPythonItem bottom = null;
|
|
|
|
|
//剩余的的PinData
|
|
|
|
|
|