添加全校排序
This commit is contained in:
parent
9047390717
commit
928fec692c
|
@ -128,7 +128,7 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
}
|
||||
}
|
||||
double size = entry.getValue().size();
|
||||
double passRate = size / sum*100;
|
||||
double passRate = size / sum * 100;
|
||||
// 定义格式化规则,保留四位小数
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#.#");
|
||||
String rate = decimalFormat.format(passRate);
|
||||
|
@ -253,6 +253,14 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
|
||||
}
|
||||
}
|
||||
//对ans进行排序
|
||||
ans.sort((o1, o2) -> {
|
||||
JSONObject json1 = (JSONObject) o1;
|
||||
JSONObject json2 = (JSONObject) o2;
|
||||
double passRate1 = Double.parseDouble(json1.getString("passRate"));
|
||||
double passRate2 = Double.parseDouble(json2.getString("passRate"));
|
||||
return passRate1 > passRate2 ? -1 : 1;
|
||||
});
|
||||
} else {
|
||||
|
||||
//获取该学院的所有专业
|
||||
|
|
Loading…
Reference in New Issue