Commit e04a722c by zhangkb

修改指标值排名逻辑

parent f9b26cf3
...@@ -208,16 +208,22 @@ public class IndicatorsReportService { ...@@ -208,16 +208,22 @@ public class IndicatorsReportService {
String indRule = driveIndDef.getIndRule(); String indRule = driveIndDef.getIndRule();
Map<String,String> valueRate = new HashMap<>(); Map<String,String> valueRate = new HashMap<>();
for(IndicatorsReportOne indReportData : datas) { for(IndicatorsReportOne indReportData : datas) {
if(StringUtils.isBlank(indReportData.getValueRate())) {
continue;
}
valueRate.put(indReportData.getCompareObj(), indReportData.getValueRate()); valueRate.put(indReportData.getCompareObj(), indReportData.getValueRate());
} }
//增幅排名 if(!valueRate.isEmpty()) {
Map<String,Integer> valueRateRank = CalculateUtils.rankValue(valueRate, indRule); //增幅排名
for(Map.Entry<String,Integer> map : valueRateRank.entrySet()) { Map<String,Integer> valueRateRank = CalculateUtils.rankValue(valueRate, indRule);
for(int i=0;i<datas.size();i++) { for(Map.Entry<String,Integer> map : valueRateRank.entrySet()) {
if(map.getKey().equals(datas.get(i).getCompareObj())) { for(int i=0;i<datas.size();i++) {
datas.get(i).setValueRateRank(map.getValue()+""); IndicatorsReportOne data = datas.get(i);
datas.set(i, datas.get(i)); if(map.getKey().equals(data.getCompareObj())) {
break; data.setValueRateRank(map.getValue()+"");
datas.set(i, data);
break;
}
} }
} }
} }
...@@ -316,17 +322,18 @@ public class IndicatorsReportService { ...@@ -316,17 +322,18 @@ public class IndicatorsReportService {
//同比提升单位 //同比提升单位
Map<String,Object> sameImproveResult = this.sameImproveUnits(indId, date, compareObjs, Map<String,Object> sameImproveResult = this.sameImproveUnits(indId, date, compareObjs,
calDatas); calDatas);
indReportData.setSameImproveUnits(Integer.parseInt(sameImproveResult.get("improveNum").toString())); if(Integer.parseInt(sameImproveResult.get("improveNum").toString())!=0) {
indReportData.setSameImproveUnits(Integer.parseInt(sameImproveResult.get("improveNum").toString()));
}
//同比提升前三 //同比提升前三
int start = 0; int start = 0;
int end = 3; int end = 3;
Map<String,Integer> resultRank = (Map<String,Integer>)sameImproveResult.get("resultRank"); Map<String,Integer> resultRank = (Map<String,Integer>)sameImproveResult.get("resultRank");
//根据省对市地区顺序排列排名并列的情况
Map<String,Object> objSortRank = CalculateUtils.rankByObjSort(resultRank, objSort);
resultRank = (Map<String,Integer>)objSortRank.get("rankMap");
end = Integer.parseInt(objSortRank.get("rankNum").toString());
if(!resultRank.isEmpty()) { if(!resultRank.isEmpty()) {
//根据省对市地区顺序排列排名并列的情况
Map<String,Object> objSortRank = CalculateUtils.rankByObjSort(resultRank, objSort);
resultRank = (Map<String,Integer>)objSortRank.get("rankMap");
end = Integer.parseInt(objSortRank.get("rankNum").toString());
StringBuilder sameImproveHeadThree = new StringBuilder("");//同比提升前三 StringBuilder sameImproveHeadThree = new StringBuilder("");//同比提升前三
StringBuilder sameImproveHeadThreeDesc = new StringBuilder(""); StringBuilder sameImproveHeadThreeDesc = new StringBuilder("");
for(Map.Entry<String,Integer> entry : resultRank.entrySet()) { for(Map.Entry<String,Integer> entry : resultRank.entrySet()) {
......
...@@ -90,7 +90,8 @@ public class CalculateUtils { ...@@ -90,7 +90,8 @@ public class CalculateUtils {
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);
order+=1; headIndValue = entry.getValue();
order++;
i++; i++;
continue; continue;
} }
...@@ -352,20 +353,26 @@ public class CalculateUtils { ...@@ -352,20 +353,26 @@ public class CalculateUtils {
} }
public static void main(String[] args) { public static void main(String[] args) {
// Map<String,String> map = new HashMap<>(); Map<String,String> map = new HashMap<>();
// map.put("1001", "12"); map.put("4302", "48.0000");
// map.put("1002", "-1"); map.put("4308", "24.0000");
// map.put("1003", "-4"); map.put("4304", "24.0000");
// map.put("1004", "3"); map.put("4310", "43.9100");
// map.put("1005", "5"); map.put("4331", "48.0000");
// map.put("1006", "7"); map.put("4312", "48.0000");
// map.put("1007", "0"); map.put("4313", "24.0000");
// map.put("1008", "-6"); map.put("4303", "39.8400");
map.put("4309", "48.0000");
map.put("4307", "48.0000");
map.put("4301", "48.0000");
map.put("4306", "48.0000");
map.put("4305", "48.0000");
map.put("4311", "39.8400");
CalculateUtils cal = new CalculateUtils(); CalculateUtils cal = new CalculateUtils();
System.out.println(cal.isValidformula("([1001]+[1002])-[1004]")); // System.out.println(cal.isValidformula("([1001]+[1002])-[1004]"));
// Map<String,Integer> result = cal.rankValue(map, "0"); Map<String,Integer> result = cal.rankValue(map, "1");
// result = cal.sortMapByValue(result,1); result = cal.sortMapByValue(result,1);
// System.out.println(result); System.out.println(result);
// //
// String formula = "([1001]+[1002])/2"; // String formula = "([1001]+[1002])/2";
// Map<String,String> map = new HashMap<>(); // Map<String,String> map = new HashMap<>();
......
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