Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -9,6 +9,7 @@ import com.ai.da.common.utils.*;
|
||||
import com.ai.da.mapper.entity.CollectionElement;
|
||||
import com.ai.da.mapper.entity.DesignHistory;
|
||||
import com.ai.da.model.dto.*;
|
||||
import com.ai.da.model.enums.Sex;
|
||||
import com.ai.da.model.vo.*;
|
||||
import com.ai.da.python.vo.*;
|
||||
import com.ai.da.service.DesignHistoryService;
|
||||
@@ -263,7 +264,7 @@ public class PythonService {
|
||||
DesignPythonItemPrint designPythonItemPrint = getRandomPrint(elementVO, designPrintPictureType);
|
||||
elementVO.setDesignPythonItemPrint(designPythonItemPrint);
|
||||
//参数透传 确定本次designSingle如果需要print对应的种类
|
||||
elementVO.setDesignPrintPictureTypeLayoutList(calculateCurrentDesignPintPictureTypeLayout());
|
||||
elementVO.setDesignPrintPictureTypeLayoutList(calculateCurrentDesignPintPictureTypeLayout(elementVO.getModelSex()));
|
||||
//designSingle具体参数组装
|
||||
DesignPythonObject pythonObject = new DesignPythonObject();
|
||||
pythonObject.setItems(coverToDesignPythonItem(elementVO, designPictureType));
|
||||
@@ -370,18 +371,33 @@ public class PythonService {
|
||||
}
|
||||
|
||||
//计算当前的Print图片类型具体分布位置 0. 上衣 1.下衣 2.上衣和下衣都print
|
||||
private List<String> calculateCurrentDesignPintPictureTypeLayout() {
|
||||
Long randomIndex = RandomsUtil.randomSysFile(0L, 3L);
|
||||
if (randomIndex == 0) {
|
||||
return DesignPythonItem.OUTWEAR_DRESS_BLOUSE;
|
||||
}
|
||||
if (randomIndex == 1) {
|
||||
return DesignPythonItem.SKIRT_TROUSERS;
|
||||
}
|
||||
if (randomIndex == 2) {
|
||||
List<String> all = new ArrayList<>(DesignPythonItem.OUTWEAR_DRESS_BLOUSE);
|
||||
all.addAll(new ArrayList<>(DesignPythonItem.SKIRT_TROUSERS));
|
||||
return all;
|
||||
private List<String> calculateCurrentDesignPintPictureTypeLayout(String modelSex) {
|
||||
if (modelSex.equals(Sex.FEMALE.getValue())) {
|
||||
Long randomIndex = RandomsUtil.randomSysFile(0L, 3L);
|
||||
if (randomIndex == 0) {
|
||||
return DesignPythonItem.OUTWEAR_DRESS_BLOUSE;
|
||||
}
|
||||
if (randomIndex == 1) {
|
||||
return DesignPythonItem.SKIRT_TROUSERS;
|
||||
}
|
||||
if (randomIndex == 2) {
|
||||
List<String> all = new ArrayList<>(DesignPythonItem.OUTWEAR_DRESS_BLOUSE);
|
||||
all.addAll(new ArrayList<>(DesignPythonItem.SKIRT_TROUSERS));
|
||||
return all;
|
||||
}
|
||||
}else if (modelSex.equals(Sex.MALE.getValue())) {
|
||||
Long randomIndex = RandomsUtil.randomSysFile(0L, 3L);
|
||||
if (randomIndex == 0) {
|
||||
return DesignPythonItem.TOPS;
|
||||
}
|
||||
if (randomIndex == 1) {
|
||||
return DesignPythonItem.BOTTOMS;
|
||||
}
|
||||
if (randomIndex == 2) {
|
||||
List<String> all = new ArrayList<>(DesignPythonItem.TOPS);
|
||||
all.addAll(new ArrayList<>(DesignPythonItem.BOTTOMS));
|
||||
return all;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -399,12 +415,17 @@ public class PythonService {
|
||||
if (CollectionUtils.isEmpty(printBoardElements)) {
|
||||
return 0;
|
||||
}
|
||||
long totalNum = printBoardElements.size() / 2;
|
||||
long pinNum = printBoardElements.stream().filter(f -> f.getHasPin() == 1).count();
|
||||
if (pinNum >= totalNum) {
|
||||
long noPinNum = printBoardElements.stream().filter(f -> f.getHasPin() == 0).count();
|
||||
if (noPinNum == 0L) {
|
||||
return 0;
|
||||
}else {
|
||||
long pinNum = printBoardElements.stream().filter(f -> f.getHasPin() == 1).count();
|
||||
if (8 - pinNum < 4) {
|
||||
return RandomsUtil.randomSysFile(0L, 8 - pinNum + 1);
|
||||
}else {
|
||||
return RandomsUtil.randomSysFile(0L, 4L + 1);
|
||||
}
|
||||
}
|
||||
return totalNum - pinNum;
|
||||
}
|
||||
|
||||
private List<DesignPythonItem> coverToDesignPythonItem(ValidateElementVO elementVO, CurrentDesignPictureTypeEnum designPictureType) {
|
||||
@@ -1568,9 +1589,14 @@ public class PythonService {
|
||||
print.setPath("none");
|
||||
return print;
|
||||
}
|
||||
List<CollectionElement> printBoardElements = elementVO.getPrintBoardElements()
|
||||
.stream()
|
||||
.filter(f -> !elementVO.getHasUseMd5List().contains(f.getMd5())).collect(Collectors.toList());
|
||||
List<CollectionElement> printBoardElements;
|
||||
if (designPrintPictureType.equals(CurrentDesignPrintPictureTypeEnum.PIN)) {
|
||||
printBoardElements = elementVO.getPrintBoardElements()
|
||||
.stream()
|
||||
.filter(f -> !elementVO.getHasUseMd5List().contains(f.getMd5())).collect(Collectors.toList());
|
||||
}else {
|
||||
printBoardElements = elementVO.getPrintBoardElements();
|
||||
}
|
||||
if (CollectionUtil.isEmpty(printBoardElements)) {
|
||||
print.setPath("none");
|
||||
return print;
|
||||
|
||||
Reference in New Issue
Block a user