TASK:design new;
This commit is contained in:
@@ -218,66 +218,88 @@ public class PythonService {
|
||||
|
||||
//系统比列
|
||||
BigDecimal sysRatio = systemScale;
|
||||
int pinPictureNum = calculatePinPictureNum(elementVO.getSketchBoardElements(), elementVO.getHasUseMd5List());
|
||||
int sysPictureNum = calculateSysPictureNum(sysRatio, pinPictureNum);
|
||||
int userPictureNum = calculateUserLibraryPictureNum(sysPictureNum, pinPictureNum);
|
||||
int noPinPictureNum = 8 - pinPictureNum - sysPictureNum - userPictureNum;
|
||||
int pinSketchNum = calculatePinSketchNum(elementVO.getSketchBoardElements(), elementVO.getHasUseMd5List());
|
||||
int sysSketchNum = calculateSysSketchNum(sysRatio, pinSketchNum);
|
||||
// int noPinSketchNum = calculateNoPinSketchNum(pinSketchNum, sysSketchNum);
|
||||
// int sysPictureNum = calculateSysPictureNum(sysRatio, pinPictureNum);
|
||||
// int userPictureNum = calculateUserLibraryPictureNum(sysPictureNum, pinPictureNum);
|
||||
// int noPinPictureNum = 8 - pinPictureNum - sysPictureNum - userPictureNum;
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
//sketch计算
|
||||
CurrentDesignPictureTypeEnum designPictureType =
|
||||
calculateCurrentDesignPictureType(pinPictureNum, sysPictureNum, userPictureNum, noPinPictureNum);
|
||||
if (Objects.isNull(designPictureType)) {
|
||||
break;
|
||||
}
|
||||
switch (designPictureType) {
|
||||
case PIN:
|
||||
pinPictureNum--;
|
||||
break;
|
||||
case USER_LIBRARY:
|
||||
userPictureNum--;
|
||||
break;
|
||||
case SYS_FILE:
|
||||
sysPictureNum--;
|
||||
break;
|
||||
case NO_PIN:
|
||||
noPinPictureNum--;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
//print计算
|
||||
CurrentDesignPrintPictureTypeEnum designPrintPictureType =
|
||||
calculateCurrentDesignPintPictureType(pinPrintNum, noPinPrintNum, noPrintNum);
|
||||
if (Objects.isNull(designPrintPictureType)) {
|
||||
break;
|
||||
}
|
||||
switch (designPrintPictureType) {
|
||||
case PIN:
|
||||
pinPrintNum--;
|
||||
break;
|
||||
case NO_PIN:
|
||||
noPinPrintNum--;
|
||||
break;
|
||||
case NO:
|
||||
noPrintNum--;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
//确定本次designSingle是否print
|
||||
DesignPythonItemPrint designPythonItemPrint = getRandomPrint(elementVO, designPrintPictureType);
|
||||
elementVO.setDesignPythonItemPrint(designPythonItemPrint);
|
||||
//参数透传 确定本次designSingle如果需要print对应的种类
|
||||
elementVO.setDesignPrintPictureTypeLayoutList(calculateCurrentDesignPintPictureTypeLayout(elementVO.getModelSex()));
|
||||
//designSingle具体参数组装
|
||||
DesignPythonObject pythonObject = new DesignPythonObject();
|
||||
pythonObject.setItems(coverToDesignPythonItem(elementVO, designPictureType));
|
||||
pythonObject.setBasic(coverToBasic(pythonObject.getItems().get(0),
|
||||
singleOverall, switchCategory, elementVO.getDesignLibraryModelPoint()));
|
||||
objects.add(pythonObject);
|
||||
}
|
||||
// for (int i = 0; i < 8; i++) {
|
||||
// //sketch计算
|
||||
// CurrentDesignPictureTypeEnum designPictureType =
|
||||
// calculateCurrentDesignPictureType(pinPictureNum, sysPictureNum, userPictureNum, noPinPictureNum);
|
||||
// if (Objects.isNull(designPictureType)) {
|
||||
// break;
|
||||
// }
|
||||
// switch (designPictureType) {
|
||||
// case PIN:
|
||||
// pinPictureNum--;
|
||||
// break;
|
||||
// case USER_LIBRARY:
|
||||
// userPictureNum--;
|
||||
// break;
|
||||
// case SYS_FILE:
|
||||
// sysPictureNum--;
|
||||
// break;
|
||||
// case NO_PIN:
|
||||
// noPinPictureNum--;
|
||||
// break;
|
||||
// default:
|
||||
// }
|
||||
// //print计算
|
||||
// CurrentDesignPrintPictureTypeEnum designPrintPictureType =
|
||||
// calculateCurrentDesignPintPictureType(pinPrintNum, noPinPrintNum, noPrintNum);
|
||||
// if (Objects.isNull(designPrintPictureType)) {
|
||||
// break;
|
||||
// }
|
||||
// switch (designPrintPictureType) {
|
||||
// case PIN:
|
||||
// pinPrintNum--;
|
||||
// break;
|
||||
// case NO_PIN:
|
||||
// noPinPrintNum--;
|
||||
// break;
|
||||
// case NO:
|
||||
// noPrintNum--;
|
||||
// break;
|
||||
// default:
|
||||
// }
|
||||
// //确定本次designSingle是否print
|
||||
// DesignPythonItemPrint designPythonItemPrint = getRandomPrint(elementVO, designPrintPictureType);
|
||||
// elementVO.setDesignPythonItemPrint(designPythonItemPrint);
|
||||
// //参数透传 确定本次designSingle如果需要print对应的种类
|
||||
// elementVO.setDesignPrintPictureTypeLayoutList(calculateCurrentDesignPintPictureTypeLayout(elementVO.getModelSex()));
|
||||
// //designSingle具体参数组装
|
||||
// DesignPythonObject pythonObject = new DesignPythonObject();
|
||||
// pythonObject.setItems(coverToDesignPythonItem(elementVO, designPictureType));
|
||||
// pythonObject.setBasic(coverToBasic(pythonObject.getItems().get(0),
|
||||
// singleOverall, switchCategory, elementVO.getDesignLibraryModelPoint()));
|
||||
// objects.add(pythonObject);
|
||||
// }
|
||||
return designPythonObjects;
|
||||
}
|
||||
|
||||
private int calculateSysSketchNum(BigDecimal sysRatio, int pinSketchNum) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
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 pinPictureNum, int sysPictureNum, int userPictureNum, int noPinPictureNum) {
|
||||
List<Integer> codes = Lists.newArrayList();
|
||||
@@ -1451,10 +1473,10 @@ public class PythonService {
|
||||
if (CollectionUtils.isEmpty(sketchBoardPins)) {
|
||||
return null;
|
||||
}
|
||||
List<CollectionElement> response = resolveElementFilterHistoryMd5(sketchBoardPins);
|
||||
if (CollectionUtils.isEmpty(response)) {
|
||||
return null;
|
||||
}
|
||||
// List<CollectionElement> response = resolveElementFilterHistoryMd5(sketchBoardPins);
|
||||
// if (CollectionUtils.isEmpty(response)) {
|
||||
// return null;
|
||||
// }
|
||||
return CopyUtil.copyList(sketchBoardPins, CollectionElement.class);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user