TASK: 印花逻辑;

This commit is contained in:
shahaibo
2023-11-21 15:35:58 +08:00
parent ff34193e02
commit 8ff91be0f0

View File

@@ -415,23 +415,16 @@ public class PythonService {
if (CollectionUtils.isEmpty(printBoardElements)) { if (CollectionUtils.isEmpty(printBoardElements)) {
return 0; return 0;
} }
long pinNum = printBoardElements.stream().filter(f -> f.getHasPin() == 1).count();
long noPinNum = printBoardElements.stream().filter(f -> f.getHasPin() == 0).count(); long noPinNum = printBoardElements.stream().filter(f -> f.getHasPin() == 0).count();
if (pinNum <= 4) { if (noPinNum == 0L) {
if (noPinNum <= 4) {
return RandomsUtil.randomSysFile(0L, noPinNum + 1);
}else {
return RandomsUtil.randomSysFile(0L, 5L);
}
}else if (pinNum < 8) {
if (noPinNum <= 8 - pinNum) {
return RandomsUtil.randomSysFile(0L, noPinNum + 1);
}else {
long maxNum = 8 - pinNum;
return RandomsUtil.randomSysFile(0L, maxNum + 1);
}
}else {
return 0; 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);
}
} }
} }