Commit 77b79e0e by zhangkb

修改排名逻辑

parent 41339ac0
...@@ -72,6 +72,8 @@ public class CalculateUtils { ...@@ -72,6 +72,8 @@ public class CalculateUtils {
int order = 0; int order = 0;
Double headIndValue = 0.0; Double headIndValue = 0.0;
int i=0; int i=0;
int isEquals = 0;
int equalsCount = 1;
for(Entry<String,Double> entry : compareMap.entrySet()) { for(Entry<String,Double> entry : compareMap.entrySet()) {
if(i==0) { if(i==0) {
result.put(entry.getKey(), 1); result.put(entry.getKey(), 1);
...@@ -81,8 +83,16 @@ public class CalculateUtils { ...@@ -81,8 +83,16 @@ public class CalculateUtils {
} }
if(entry.getValue().equals(headIndValue)) { if(entry.getValue().equals(headIndValue)) {
result.put(entry.getKey(), order); result.put(entry.getKey(), order);
isEquals = 1;
equalsCount+=1;
}else { }else {
order+=1; if(isEquals==1) {
order+=equalsCount;
isEquals = 0;
equalsCount = 1;
}else {
order+=1;
}
result.put(entry.getKey(), order); result.put(entry.getKey(), order);
} }
headIndValue = entry.getValue(); headIndValue = entry.getValue();
...@@ -204,38 +214,17 @@ public class CalculateUtils { ...@@ -204,38 +214,17 @@ public class CalculateUtils {
} }
public static void main(String[] args) { public static void main(String[] args) {
// System.out.println(AviatorEvaluator.execute("(35.9756-84.4884)/(35.9756-2556.3310)*10")); Map<String,String> map = new HashMap<>();
map.put("1001", "1");
// Map<String, Object> env = Maps.newHashMap(); map.put("1002", "2");
// env.put("F004", 18471.8080); map.put("1003", "3");
// env.put("F002", 197125.8532); map.put("1004", "4");
// // 输出的是6.333333333333333 map.put("1005", "4");
// System.out.println(AviatorEvaluator.execute("F004/F002*100", env)); map.put("1006", "5");
map.put("1007", "6");
// List<String> values = new ArrayList<>(); map.put("1008", "3");
// values.add("0"); CalculateUtils cal = new CalculateUtils();
// values.add("18"); Map<String,Integer> result = cal.rankValue(map, "1");
// values.add("18"); System.out.println(result);
// values.add("17.2837");
// CalculateUtils cal = new CalculateUtils();
// String average = cal.sumValue(values);
// System.out.println(average);
// Map<String,String> map = new HashMap<>();
// map.put("1", "NaN");
// map.put("2", "12.3345");
// map.put("3", "9.2349");
// map.put("4", "10.2457");
// map.put("5", "7.2221");
// map.put("6", "10.2457");
// map.put("7", "NaN");
// map.put("8", "8.343");
// CalculateUtils cal = new CalculateUtils();
// Map<String,Integer> result = cal.rankValue(map, "1");
// System.out.println(result);
String version = "1.0";
double anoterVersion = Double.valueOf(version)+1;
System.out.println(String.valueOf(anoterVersion));
} }
} }
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