|
@@ -1,5 +1,8 @@
|
|
package cn.com.qmth.examcloud.web.actuator;
|
|
package cn.com.qmth.examcloud.web.actuator;
|
|
|
|
|
|
|
|
+import java.lang.reflect.Field;
|
|
|
|
+import java.util.Collections;
|
|
|
|
+import java.util.Comparator;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -49,7 +52,7 @@ public class ApiStatusEndpoint {
|
|
@ReadOperation(produces = {MediaType.TEXT_HTML_VALUE})
|
|
@ReadOperation(produces = {MediaType.TEXT_HTML_VALUE})
|
|
public String get(@Selector String order) {
|
|
public String get(@Selector String order) {
|
|
|
|
|
|
- System.out.println(order);
|
|
|
|
|
|
+ System.out.println("order by " + order);
|
|
ReportorHolder.getApiDataReportor().report();
|
|
ReportorHolder.getApiDataReportor().report();
|
|
ReportorHolder.getConsoleReporter().report();
|
|
ReportorHolder.getConsoleReporter().report();
|
|
List<ReportInfo> reportInfoList = ReportorHolder.getApiDataReportor().getReportInfoList();
|
|
List<ReportInfo> reportInfoList = ReportorHolder.getApiDataReportor().getReportInfoList();
|
|
@@ -142,6 +145,30 @@ public class ApiStatusEndpoint {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ Collections.sort(list, new Comparator<ApiStatusInfo>() {
|
|
|
|
+ @Override
|
|
|
|
+ public int compare(ApiStatusInfo o1, ApiStatusInfo o2) {
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ Field field = o1.getClass().getField(order);
|
|
|
|
+ Object value1 = field.get(o1);
|
|
|
|
+ Object value2 = field.get(o2);
|
|
|
|
+
|
|
|
|
+ if (value1 instanceof Long) {
|
|
|
|
+ return (int) (((Long) value1) - ((Long) value2));
|
|
|
|
+ } else if (value1 instanceof Double) {
|
|
|
|
+ return (int) (((Double) value1) - ((Double) value2));
|
|
|
|
+ } else if (value1 instanceof String) {
|
|
|
|
+ return ((String) value1).compareToIgnoreCase((String) value2);
|
|
|
|
+ } else {
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
Map<String, Object> map = Maps.newHashMap();
|
|
Map<String, Object> map = Maps.newHashMap();
|
|
map.put("data", list);
|
|
map.put("data", list);
|
|
map.put("dateTime", reportInfo.getDateTime());
|
|
map.put("dateTime", reportInfo.getDateTime());
|