Authored by 胡古飞

fix AggCommonHelper

... ... @@ -130,13 +130,10 @@ public class AggCommonHelper {
try {
double value1 = getDouble(o1.get(fieldSortOrder.getSortField()));
double value2 = getDouble(o2.get(fieldSortOrder.getSortField()));
if (value1 == value2) {
return 0;
}
if (fieldSortOrder.isDesc()) {
return value1 - value2 > 0 ? -1 : 1;
return value1 > value2 ? -1 : value1 < value2 ? 1 : 0;
} else {
return value1 - value2 > 0 ? 1 : -1;
return value1 > value2 ? 1 : value1 < value2 ? -1 : 0;
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
... ... @@ -151,25 +148,14 @@ public class AggCommonHelper {
}
private static double getDouble(Object value) {
if (value == null) {
try {
if (value == null) {
return 0;
}
return Double.parseDouble(value.toString());
} catch (Exception e) {
return 0;
}
if (value instanceof Float) {
return ((Float) value).floatValue();
}
if (value instanceof Integer) {
return ((Integer) value);
}
if (value instanceof Long) {
return ((Long) value);
}
if (value instanceof String) {
return Double.valueOf(value.toString());
}
if (value instanceof Double) {
return Double.valueOf(value.toString());
}
return 0;
}
/**
... ...