Commit 61e34c1b authored by licc's avatar licc

优化方案查询

parent 3fdd0a02
......@@ -1047,14 +1047,14 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
List<Volunteer> result = new ArrayList<>();
List<Volunteer> otherList = new ArrayList<>();
//分组,每组数量大于2的,取两条,小于等于则全取
//分组,每组数量大于4的,取4条,小于等于则全取
Map<Double, List<Volunteer>> map = list.stream().collect(Collectors.groupingBy(Volunteer::getLowestMark
));
for (Map.Entry<Double, List<Volunteer>> entry : map.entrySet()) {
List<Volunteer> volunteers = entry.getValue();
if (volunteers.size() > 2) {
for (int i = 0; i < 2; i++) {
if (volunteers.size() > 4) {
for (int i = 0; i < 4; i++) {
Random mRandom = new Random();
int number = mRandom.nextInt(volunteers.size());
result.add(volunteers.get(number));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment