奥体项目接口修改(添加曲线最大最小值)
正在显示
1 个修改的文件
包含
123 行增加
和
15 行删除
... | @@ -1976,11 +1976,18 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { | ... | @@ -1976,11 +1976,18 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { |
1976 | 1976 | ||
1977 | @Override | 1977 | @Override |
1978 | public Map<String, Object> getSumFlowData(SumFlowParams sumFlowParams) { | 1978 | public Map<String, Object> getSumFlowData(SumFlowParams sumFlowParams) { |
1979 | //定义返回的结果 | ||
1979 | List<EchartResult> f1List = new ArrayList<>(); | 1980 | List<EchartResult> f1List = new ArrayList<>(); |
1980 | List<EchartResult> f2List = new ArrayList<>(); | 1981 | List<EchartResult> f2List = new ArrayList<>(); |
1981 | List<EchartResult> f3List = new ArrayList<>(); | 1982 | List<EchartResult> f3List = new ArrayList<>(); |
1982 | List<EchartResult> f4List = new ArrayList<>(); | 1983 | List<EchartResult> f4List = new ArrayList<>(); |
1983 | List<EchartResult> f5List = new ArrayList<>(); | 1984 | List<EchartResult> f5List = new ArrayList<>(); |
1985 | //定义返回的结构MAP | ||
1986 | Map<String,Object> f1Map = new HashMap<>(); | ||
1987 | Map<String,Object> f2Map = new HashMap<>(); | ||
1988 | Map<String,Object> f3Map = new HashMap<>(); | ||
1989 | Map<String,Object> f4Map = new HashMap<>(); | ||
1990 | Map<String,Object> f5Map = new HashMap<>(); | ||
1984 | String startTime = "";//开始时间 | 1991 | String startTime = "";//开始时间 |
1985 | String endTime = "";//结束时间 | 1992 | String endTime = "";//结束时间 |
1986 | int strCount = 10; | 1993 | int strCount = 10; |
... | @@ -2321,11 +2328,60 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { | ... | @@ -2321,11 +2328,60 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { |
2321 | f5List.add(echartResult5); | 2328 | f5List.add(echartResult5); |
2322 | } | 2329 | } |
2323 | } | 2330 | } |
2324 | map.put("F0001",f1List); | 2331 | f1Map.put("data",f1List); |
2325 | map.put("F0002",f2List); | 2332 | Map<String, Object> map1 = getMaxAndMin(f1List); |
2326 | map.put("F0003",f3List); | 2333 | f1Map.put("max",map1.get("max")); |
2327 | map.put("F0004",f4List); | 2334 | f1Map.put("min",map1.get("min")); |
2328 | map.put("F0005",f5List); | 2335 | f2Map.put("data",f2List); |
2336 | Map<String, Object> map2 = getMaxAndMin(f2List); | ||
2337 | f2Map.put("max",map2.get("max")); | ||
2338 | f2Map.put("min",map2.get("min")); | ||
2339 | f3Map.put("data",f3List); | ||
2340 | Map<String, Object> map3 = getMaxAndMin(f3List); | ||
2341 | f3Map.put("max",map3.get("max")); | ||
2342 | f3Map.put("min",map3.get("min")); | ||
2343 | f4Map.put("data",f4List); | ||
2344 | Map<String, Object> map4 = getMaxAndMin(f4List); | ||
2345 | f4Map.put("max",map4.get("max")); | ||
2346 | f4Map.put("min",map4.get("min")); | ||
2347 | f5Map.put("data",f5List); | ||
2348 | Map<String, Object> map5 = getMaxAndMin(f5List); | ||
2349 | f5Map.put("max",map5.get("max")); | ||
2350 | f5Map.put("min",map5.get("min")); | ||
2351 | map.put("F0001",f1Map); | ||
2352 | map.put("F0002",f2Map); | ||
2353 | map.put("F0003",f3Map); | ||
2354 | map.put("F0004",f4Map); | ||
2355 | map.put("F0005",f5Map); | ||
2356 | return map; | ||
2357 | } | ||
2358 | |||
2359 | //查询出List中最大最小值 | ||
2360 | public Map<String, Object> getMaxAndMin(List<EchartResult> list){ | ||
2361 | Map<String, Object> map = new HashMap<>(); | ||
2362 | map.put("max","0"); | ||
2363 | map.put("min","0"); | ||
2364 | if(list.size() > 0){ | ||
2365 | String maxValue = list.stream() | ||
2366 | .max(Comparator.comparing(EchartResult::getValue)) | ||
2367 | .map(EchartResult::getValue) | ||
2368 | .orElse(""); | ||
2369 | if("".equals(maxValue)||"--".equals(maxValue)){ | ||
2370 | maxValue = "1000"; | ||
2371 | }else{ | ||
2372 | maxValue = String.valueOf(Double.valueOf(Double.parseDouble(maxValue)*1.2).intValue()); | ||
2373 | |||
2374 | } | ||
2375 | String minValue = list.stream() | ||
2376 | .min(Comparator.comparing(EchartResult::getValue)) | ||
2377 | .map(EchartResult::getValue) | ||
2378 | .orElse(""); | ||
2379 | if("".equals(minValue)||"--".equals(minValue)){ | ||
2380 | minValue = "0"; | ||
2381 | } | ||
2382 | map.put("max",maxValue); | ||
2383 | map.put("min",minValue); | ||
2384 | } | ||
2329 | return map; | 2385 | return map; |
2330 | } | 2386 | } |
2331 | 2387 | ||
... | @@ -2337,6 +2393,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { | ... | @@ -2337,6 +2393,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { |
2337 | List<EchartResult> f3List = new ArrayList<>(); | 2393 | List<EchartResult> f3List = new ArrayList<>(); |
2338 | List<EchartResult> f4List = new ArrayList<>(); | 2394 | List<EchartResult> f4List = new ArrayList<>(); |
2339 | List<EchartResult> f5List = new ArrayList<>(); | 2395 | List<EchartResult> f5List = new ArrayList<>(); |
2396 | //定义返回的结构MAP | ||
2397 | Map<String,Object> f1Map = new HashMap<>(); | ||
2398 | Map<String,Object> f2Map = new HashMap<>(); | ||
2399 | Map<String,Object> f3Map = new HashMap<>(); | ||
2400 | Map<String,Object> f4Map = new HashMap<>(); | ||
2401 | Map<String,Object> f5Map = new HashMap<>(); | ||
2340 | if(!"".equals(sumFlowParams.getYearMonth())&&sumFlowParams.getYearMonth()!=null){ | 2402 | if(!"".equals(sumFlowParams.getYearMonth())&&sumFlowParams.getYearMonth()!=null){ |
2341 | List<Map<String, Object>> monitorList = new ArrayList<>(); | 2403 | List<Map<String, Object>> monitorList = new ArrayList<>(); |
2342 | int currentYear = LocalDate.now().getYear();// 获取当前年份 currentYear | 2404 | int currentYear = LocalDate.now().getYear();// 获取当前年份 currentYear |
... | @@ -2396,11 +2458,31 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { | ... | @@ -2396,11 +2458,31 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { |
2396 | f5List.add(echartResult5); | 2458 | f5List.add(echartResult5); |
2397 | } | 2459 | } |
2398 | } | 2460 | } |
2399 | map.put("F0001",f1List); | 2461 | f1Map.put("data",f1List); |
2400 | map.put("F0002",f2List); | 2462 | Map<String, Object> map1 = getMaxAndMin(f1List); |
2401 | map.put("F0003",f3List); | 2463 | f1Map.put("max",map1.get("max")); |
2402 | map.put("F0004",f4List); | 2464 | f1Map.put("min",map1.get("min")); |
2403 | map.put("F0005",f5List); | 2465 | f2Map.put("data",f2List); |
2466 | Map<String, Object> map2 = getMaxAndMin(f2List); | ||
2467 | f2Map.put("max",map2.get("max")); | ||
2468 | f2Map.put("min",map2.get("min")); | ||
2469 | f3Map.put("data",f3List); | ||
2470 | Map<String, Object> map3 = getMaxAndMin(f3List); | ||
2471 | f3Map.put("max",map3.get("max")); | ||
2472 | f3Map.put("min",map3.get("min")); | ||
2473 | f4Map.put("data",f4List); | ||
2474 | Map<String, Object> map4 = getMaxAndMin(f4List); | ||
2475 | f4Map.put("max",map4.get("max")); | ||
2476 | f4Map.put("min",map4.get("min")); | ||
2477 | f5Map.put("data",f5List); | ||
2478 | Map<String, Object> map5 = getMaxAndMin(f5List); | ||
2479 | f5Map.put("max",map5.get("max")); | ||
2480 | f5Map.put("min",map5.get("min")); | ||
2481 | map.put("F0001",f1Map); | ||
2482 | map.put("F0002",f2Map); | ||
2483 | map.put("F0003",f3Map); | ||
2484 | map.put("F0004",f4Map); | ||
2485 | map.put("F0005",f5Map); | ||
2404 | return map; | 2486 | return map; |
2405 | } | 2487 | } |
2406 | 2488 | ||
... | @@ -2412,6 +2494,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { | ... | @@ -2412,6 +2494,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { |
2412 | List<EchartResult> f3List = new ArrayList<>(); | 2494 | List<EchartResult> f3List = new ArrayList<>(); |
2413 | List<EchartResult> f4List = new ArrayList<>(); | 2495 | List<EchartResult> f4List = new ArrayList<>(); |
2414 | List<EchartResult> f5List = new ArrayList<>(); | 2496 | List<EchartResult> f5List = new ArrayList<>(); |
2497 | //定义返回的结构MAP | ||
2498 | Map<String,Object> f1Map = new HashMap<>(); | ||
2499 | Map<String,Object> f2Map = new HashMap<>(); | ||
2500 | Map<String,Object> f3Map = new HashMap<>(); | ||
2501 | Map<String,Object> f4Map = new HashMap<>(); | ||
2502 | Map<String,Object> f5Map = new HashMap<>(); | ||
2415 | if(!"".equals(sumFlowParams.getYear())&&sumFlowParams.getYear()!=null){ | 2503 | if(!"".equals(sumFlowParams.getYear())&&sumFlowParams.getYear()!=null){ |
2416 | List<Map<String, Object>> monitorList = new ArrayList<>(); | 2504 | List<Map<String, Object>> monitorList = new ArrayList<>(); |
2417 | int currentYear = LocalDate.now().getYear();// 获取当前年份 currentYear | 2505 | int currentYear = LocalDate.now().getYear();// 获取当前年份 currentYear |
... | @@ -2469,11 +2557,31 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { | ... | @@ -2469,11 +2557,31 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { |
2469 | f5List.add(echartResult5); | 2557 | f5List.add(echartResult5); |
2470 | } | 2558 | } |
2471 | } | 2559 | } |
2472 | map.put("F0001",f1List); | 2560 | f1Map.put("data",f1List); |
2473 | map.put("F0002",f2List); | 2561 | Map<String, Object> map1 = getMaxAndMin(f1List); |
2474 | map.put("F0003",f3List); | 2562 | f1Map.put("max",map1.get("max")); |
2475 | map.put("F0004",f4List); | 2563 | f1Map.put("min",map1.get("min")); |
2476 | map.put("F0005",f5List); | 2564 | f2Map.put("data",f2List); |
2565 | Map<String, Object> map2 = getMaxAndMin(f2List); | ||
2566 | f2Map.put("max",map2.get("max")); | ||
2567 | f2Map.put("min",map2.get("min")); | ||
2568 | f3Map.put("data",f3List); | ||
2569 | Map<String, Object> map3 = getMaxAndMin(f3List); | ||
2570 | f3Map.put("max",map3.get("max")); | ||
2571 | f3Map.put("min",map3.get("min")); | ||
2572 | f4Map.put("data",f4List); | ||
2573 | Map<String, Object> map4 = getMaxAndMin(f4List); | ||
2574 | f4Map.put("max",map4.get("max")); | ||
2575 | f4Map.put("min",map4.get("min")); | ||
2576 | f5Map.put("data",f5List); | ||
2577 | Map<String, Object> map5 = getMaxAndMin(f5List); | ||
2578 | f5Map.put("max",map5.get("max")); | ||
2579 | f5Map.put("min",map5.get("min")); | ||
2580 | map.put("F0001",f1Map); | ||
2581 | map.put("F0002",f2Map); | ||
2582 | map.put("F0003",f3Map); | ||
2583 | map.put("F0004",f4Map); | ||
2584 | map.put("F0005",f5Map); | ||
2477 | return map; | 2585 | return map; |
2478 | } | 2586 | } |
2479 | 2587 | ... | ... |
-
请 注册 或 登录 后发表评论