2018bbf1 张雷

奥体项目接口修改(添加曲线最大最小值)

1 个父辈 f8d3f276
......@@ -1976,11 +1976,18 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
@Override
public Map<String, Object> getSumFlowData(SumFlowParams sumFlowParams) {
//定义返回的结果
List<EchartResult> f1List = new ArrayList<>();
List<EchartResult> f2List = new ArrayList<>();
List<EchartResult> f3List = new ArrayList<>();
List<EchartResult> f4List = new ArrayList<>();
List<EchartResult> f5List = new ArrayList<>();
//定义返回的结构MAP
Map<String,Object> f1Map = new HashMap<>();
Map<String,Object> f2Map = new HashMap<>();
Map<String,Object> f3Map = new HashMap<>();
Map<String,Object> f4Map = new HashMap<>();
Map<String,Object> f5Map = new HashMap<>();
String startTime = "";//开始时间
String endTime = "";//结束时间
int strCount = 10;
......@@ -2321,11 +2328,60 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
f5List.add(echartResult5);
}
}
map.put("F0001",f1List);
map.put("F0002",f2List);
map.put("F0003",f3List);
map.put("F0004",f4List);
map.put("F0005",f5List);
f1Map.put("data",f1List);
Map<String, Object> map1 = getMaxAndMin(f1List);
f1Map.put("max",map1.get("max"));
f1Map.put("min",map1.get("min"));
f2Map.put("data",f2List);
Map<String, Object> map2 = getMaxAndMin(f2List);
f2Map.put("max",map2.get("max"));
f2Map.put("min",map2.get("min"));
f3Map.put("data",f3List);
Map<String, Object> map3 = getMaxAndMin(f3List);
f3Map.put("max",map3.get("max"));
f3Map.put("min",map3.get("min"));
f4Map.put("data",f4List);
Map<String, Object> map4 = getMaxAndMin(f4List);
f4Map.put("max",map4.get("max"));
f4Map.put("min",map4.get("min"));
f5Map.put("data",f5List);
Map<String, Object> map5 = getMaxAndMin(f5List);
f5Map.put("max",map5.get("max"));
f5Map.put("min",map5.get("min"));
map.put("F0001",f1Map);
map.put("F0002",f2Map);
map.put("F0003",f3Map);
map.put("F0004",f4Map);
map.put("F0005",f5Map);
return map;
}
//查询出List中最大最小值
public Map<String, Object> getMaxAndMin(List<EchartResult> list){
Map<String, Object> map = new HashMap<>();
map.put("max","0");
map.put("min","0");
if(list.size() > 0){
String maxValue = list.stream()
.max(Comparator.comparing(EchartResult::getValue))
.map(EchartResult::getValue)
.orElse("");
if("".equals(maxValue)||"--".equals(maxValue)){
maxValue = "1000";
}else{
maxValue = String.valueOf(Double.valueOf(Double.parseDouble(maxValue)*1.2).intValue());
}
String minValue = list.stream()
.min(Comparator.comparing(EchartResult::getValue))
.map(EchartResult::getValue)
.orElse("");
if("".equals(minValue)||"--".equals(minValue)){
minValue = "0";
}
map.put("max",maxValue);
map.put("min",minValue);
}
return map;
}
......@@ -2337,6 +2393,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
List<EchartResult> f3List = new ArrayList<>();
List<EchartResult> f4List = new ArrayList<>();
List<EchartResult> f5List = new ArrayList<>();
//定义返回的结构MAP
Map<String,Object> f1Map = new HashMap<>();
Map<String,Object> f2Map = new HashMap<>();
Map<String,Object> f3Map = new HashMap<>();
Map<String,Object> f4Map = new HashMap<>();
Map<String,Object> f5Map = new HashMap<>();
if(!"".equals(sumFlowParams.getYearMonth())&&sumFlowParams.getYearMonth()!=null){
List<Map<String, Object>> monitorList = new ArrayList<>();
int currentYear = LocalDate.now().getYear();// 获取当前年份 currentYear
......@@ -2396,11 +2458,31 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
f5List.add(echartResult5);
}
}
map.put("F0001",f1List);
map.put("F0002",f2List);
map.put("F0003",f3List);
map.put("F0004",f4List);
map.put("F0005",f5List);
f1Map.put("data",f1List);
Map<String, Object> map1 = getMaxAndMin(f1List);
f1Map.put("max",map1.get("max"));
f1Map.put("min",map1.get("min"));
f2Map.put("data",f2List);
Map<String, Object> map2 = getMaxAndMin(f2List);
f2Map.put("max",map2.get("max"));
f2Map.put("min",map2.get("min"));
f3Map.put("data",f3List);
Map<String, Object> map3 = getMaxAndMin(f3List);
f3Map.put("max",map3.get("max"));
f3Map.put("min",map3.get("min"));
f4Map.put("data",f4List);
Map<String, Object> map4 = getMaxAndMin(f4List);
f4Map.put("max",map4.get("max"));
f4Map.put("min",map4.get("min"));
f5Map.put("data",f5List);
Map<String, Object> map5 = getMaxAndMin(f5List);
f5Map.put("max",map5.get("max"));
f5Map.put("min",map5.get("min"));
map.put("F0001",f1Map);
map.put("F0002",f2Map);
map.put("F0003",f3Map);
map.put("F0004",f4Map);
map.put("F0005",f5Map);
return map;
}
......@@ -2412,6 +2494,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
List<EchartResult> f3List = new ArrayList<>();
List<EchartResult> f4List = new ArrayList<>();
List<EchartResult> f5List = new ArrayList<>();
//定义返回的结构MAP
Map<String,Object> f1Map = new HashMap<>();
Map<String,Object> f2Map = new HashMap<>();
Map<String,Object> f3Map = new HashMap<>();
Map<String,Object> f4Map = new HashMap<>();
Map<String,Object> f5Map = new HashMap<>();
if(!"".equals(sumFlowParams.getYear())&&sumFlowParams.getYear()!=null){
List<Map<String, Object>> monitorList = new ArrayList<>();
int currentYear = LocalDate.now().getYear();// 获取当前年份 currentYear
......@@ -2469,11 +2557,31 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
f5List.add(echartResult5);
}
}
map.put("F0001",f1List);
map.put("F0002",f2List);
map.put("F0003",f3List);
map.put("F0004",f4List);
map.put("F0005",f5List);
f1Map.put("data",f1List);
Map<String, Object> map1 = getMaxAndMin(f1List);
f1Map.put("max",map1.get("max"));
f1Map.put("min",map1.get("min"));
f2Map.put("data",f2List);
Map<String, Object> map2 = getMaxAndMin(f2List);
f2Map.put("max",map2.get("max"));
f2Map.put("min",map2.get("min"));
f3Map.put("data",f3List);
Map<String, Object> map3 = getMaxAndMin(f3List);
f3Map.put("max",map3.get("max"));
f3Map.put("min",map3.get("min"));
f4Map.put("data",f4List);
Map<String, Object> map4 = getMaxAndMin(f4List);
f4Map.put("max",map4.get("max"));
f4Map.put("min",map4.get("min"));
f5Map.put("data",f5List);
Map<String, Object> map5 = getMaxAndMin(f5List);
f5Map.put("max",map5.get("max"));
f5Map.put("min",map5.get("min"));
map.put("F0001",f1Map);
map.put("F0002",f2Map);
map.put("F0003",f3Map);
map.put("F0004",f4Map);
map.put("F0005",f5Map);
return map;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!