奥体项目分类统计流量接口开发
正在显示
3 个修改的文件
包含
238 行增加
和
0 行删除
... | @@ -283,4 +283,26 @@ public class OlympicCenterController { | ... | @@ -283,4 +283,26 @@ public class OlympicCenterController { |
283 | result.setSuccess(true); | 283 | result.setSuccess(true); |
284 | return result; | 284 | return result; |
285 | } | 285 | } |
286 | |||
287 | @ApiOperation(value="分组获取相同月份的累计流量数据", notes="分组获取相同月份的累计流量数据") | ||
288 | @GetMapping(value = "/getYearMonthSumFlowGroup") | ||
289 | public Result<Map<String,Object>> getYearMonthSumFlowGroup(SumFlowParams sumFlowParams){ | ||
290 | Result<Map<String,Object>> result = new Result<Map<String,Object>>(); | ||
291 | Map<String,Object> map = new HashMap<>(); | ||
292 | map = olympicCenterService.getYearMonthSumFlowGroup(sumFlowParams); | ||
293 | result.setResult(map); | ||
294 | result.setSuccess(true); | ||
295 | return result; | ||
296 | } | ||
297 | |||
298 | @ApiOperation(value="分组获取年度的累计流量数据", notes="分组获取年度的累计流量数据") | ||
299 | @GetMapping(value = "/getYearSumFlowGroup") | ||
300 | public Result<Map<String,Object>> getYearSumFlowGroup(SumFlowParams sumFlowParams){ | ||
301 | Result<Map<String,Object>> result = new Result<Map<String,Object>>(); | ||
302 | Map<String,Object> map = new HashMap<>(); | ||
303 | map = olympicCenterService.getYearSumFlowGroup(sumFlowParams); | ||
304 | result.setResult(map); | ||
305 | result.setSuccess(true); | ||
306 | return result; | ||
307 | } | ||
286 | } | 308 | } | ... | ... |
... | @@ -53,4 +53,8 @@ public interface IOlympicCenterService { | ... | @@ -53,4 +53,8 @@ public interface IOlympicCenterService { |
53 | Map<String, Object> getYearMonthSumFlow(SumFlowParams sumFlowParams); | 53 | Map<String, Object> getYearMonthSumFlow(SumFlowParams sumFlowParams); |
54 | 54 | ||
55 | Map<String, Object> getYearSumFlow(SumFlowParams sumFlowParams); | 55 | Map<String, Object> getYearSumFlow(SumFlowParams sumFlowParams); |
56 | |||
57 | Map<String, Object> getYearMonthSumFlowGroup(SumFlowParams sumFlowParams); | ||
58 | |||
59 | Map<String, Object> getYearSumFlowGroup(SumFlowParams sumFlowParams); | ||
56 | } | 60 | } | ... | ... |
... | @@ -1181,6 +1181,9 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { | ... | @@ -1181,6 +1181,9 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { |
1181 | Map<String, Object> dataMap = new HashMap<>(); | 1181 | Map<String, Object> dataMap = new HashMap<>(); |
1182 | dataMap.put("value","--"); | 1182 | dataMap.put("value","--"); |
1183 | dataMap.put("status","abnormal"); | 1183 | dataMap.put("status","abnormal"); |
1184 | if("F0001".equals(whatStructData.getId())){ | ||
1185 | dataMap.put("status","normal"); | ||
1186 | } | ||
1184 | kMap.put("flow", dataMap); | 1187 | kMap.put("flow", dataMap); |
1185 | kMap.put("flow_ljll", dataMap); | 1188 | kMap.put("flow_ljll", dataMap); |
1186 | kMap.put("flow_rljll", dataMap); | 1189 | kMap.put("flow_rljll", dataMap); |
... | @@ -1218,6 +1221,9 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { | ... | @@ -1218,6 +1221,9 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { |
1218 | Map<String, Object> dataMap = new HashMap<>(); | 1221 | Map<String, Object> dataMap = new HashMap<>(); |
1219 | dataMap.put("value","--"); | 1222 | dataMap.put("value","--"); |
1220 | dataMap.put("status","abnormal"); | 1223 | dataMap.put("status","abnormal"); |
1224 | if("P0001".equals(whatStructData.getId())){ | ||
1225 | dataMap.put("status","normal"); | ||
1226 | } | ||
1221 | map.put(whatStructData.getId(),dataMap); | 1227 | map.put(whatStructData.getId(),dataMap); |
1222 | } | 1228 | } |
1223 | } | 1229 | } |
... | @@ -2585,6 +2591,212 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { | ... | @@ -2585,6 +2591,212 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { |
2585 | return map; | 2591 | return map; |
2586 | } | 2592 | } |
2587 | 2593 | ||
2594 | @Override | ||
2595 | public Map<String, Object> getYearMonthSumFlowGroup(SumFlowParams sumFlowParams) { | ||
2596 | Map<String, Object> map = new HashMap<>(); | ||
2597 | List<EchartResult> shList = new ArrayList<>(); | ||
2598 | List<EchartResult> xfList = new ArrayList<>(); | ||
2599 | List<EchartResult> allList = new ArrayList<>(); | ||
2600 | //定义返回的结构MAP | ||
2601 | Map<String,Object> shMap = new HashMap<>(); | ||
2602 | Map<String,Object> xfMap = new HashMap<>(); | ||
2603 | Map<String,Object> allMap = new HashMap<>(); | ||
2604 | if(!"".equals(sumFlowParams.getYearMonth())&&sumFlowParams.getYearMonth()!=null){ | ||
2605 | List<Map<String, Object>> monitorList = new ArrayList<>(); | ||
2606 | int currentYear = LocalDate.now().getYear();// 获取当前年份 currentYear | ||
2607 | String[] ymArray = sumFlowParams.getYearMonth().split("-"); | ||
2608 | String year = ymArray[0]; | ||
2609 | String month = ymArray[1]; | ||
2610 | String[] yearsArray = getYearsArray(year,String.valueOf(currentYear)); | ||
2611 | String startTime = year + "-01-01 00:00:00"; | ||
2612 | String endTime = currentYear + "-12-31 23:59:59"; | ||
2613 | monitorList = fmPgQueryService.queryAotiCurveDataByMonth(LJLL_FIELDS,startTime,endTime,month); | ||
2614 | for (int i = 0; i < yearsArray.length; i++) { | ||
2615 | String echartName = yearsArray[i]; | ||
2616 | double shCount = 0.00; | ||
2617 | double xfCount = 0.00; | ||
2618 | double allCount = 0.00; | ||
2619 | String value1 = "0"; | ||
2620 | String value2 = "0"; | ||
2621 | String value3 = "0"; | ||
2622 | String value4 = "0"; | ||
2623 | String value5 = "0"; | ||
2624 | EchartResult shResult = new EchartResult(); | ||
2625 | shResult.setName(echartName); | ||
2626 | shResult.setSeries(month + "月"); | ||
2627 | EchartResult xfResult = new EchartResult(); | ||
2628 | xfResult.setName(echartName); | ||
2629 | xfResult.setSeries(month + "月"); | ||
2630 | EchartResult allResult = new EchartResult(); | ||
2631 | allResult.setName(echartName); | ||
2632 | allResult.setSeries(month + "月"); | ||
2633 | Map<String, Object> map001 = getMapFormList(monitorList,yearsArray[i]+"-"+month,""); | ||
2634 | if(map001!=null){ | ||
2635 | value1 = map001.get("value").toString(); | ||
2636 | }else{ | ||
2637 | value1 = "0.00"; | ||
2638 | } | ||
2639 | allCount = allCount + Double.parseDouble(value1); | ||
2640 | Map<String, Object> map002 = getMapFormList(monitorList,yearsArray[i]+"-"+month,"A01A21A03_FZLYL_XF_ACC_FIT0002"); | ||
2641 | if(map002!=null){ | ||
2642 | value2 = map002.get("value").toString(); | ||
2643 | }else{ | ||
2644 | value2 = "0.00"; | ||
2645 | } | ||
2646 | allCount = allCount + Double.parseDouble(value2); | ||
2647 | xfCount = xfCount + Double.parseDouble(value2); | ||
2648 | Map<String, Object> map003 = getMapFormList(monitorList,yearsArray[i]+"-"+month,"A01A21A03_FZLYL_GS_ACC_FIT0003"); | ||
2649 | if(map003!=null){ | ||
2650 | value3 = map003.get("value").toString(); | ||
2651 | }else{ | ||
2652 | value3 = "0.00"; | ||
2653 | } | ||
2654 | allCount = allCount + Double.parseDouble(value3); | ||
2655 | shCount = shCount + Double.parseDouble(value3); | ||
2656 | Map<String, Object> map004 = getMapFormList(monitorList,yearsArray[i]+"-"+month,"A01A21A03_GXEL_XF_ACC_FIT0004"); | ||
2657 | if(map004!=null){ | ||
2658 | value4 = map004.get("value").toString(); | ||
2659 | }else{ | ||
2660 | value4 = "0.00"; | ||
2661 | } | ||
2662 | allCount = allCount + Double.parseDouble(value4); | ||
2663 | xfCount = xfCount + Double.parseDouble(value4); | ||
2664 | Map<String, Object> map005 = getMapFormList(monitorList,yearsArray[i]+"-"+month,"A01A21A03_GXEL_GS_ACC_FIT0005"); | ||
2665 | if(map005!=null){ | ||
2666 | value5 = map005.get("value").toString(); | ||
2667 | }else{ | ||
2668 | value5 = "0.00"; | ||
2669 | } | ||
2670 | allCount = allCount + Double.parseDouble(value5); | ||
2671 | shCount = shCount + Double.parseDouble(value5); | ||
2672 | shResult.setValue(String.valueOf(shCount)); | ||
2673 | xfResult.setValue(String.valueOf(xfCount)); | ||
2674 | allResult.setValue(String.valueOf(allCount)); | ||
2675 | shList.add(shResult); | ||
2676 | xfList.add(xfResult); | ||
2677 | allList.add(allResult); | ||
2678 | } | ||
2679 | } | ||
2680 | shMap.put("data",shList); | ||
2681 | Map<String, Object> map1 = getMaxAndMin(shList); | ||
2682 | shMap.put("max",map1.get("max")); | ||
2683 | shMap.put("min",map1.get("min")); | ||
2684 | xfMap.put("data",xfList); | ||
2685 | Map<String, Object> map2 = getMaxAndMin(xfList); | ||
2686 | xfMap.put("max",map2.get("max")); | ||
2687 | xfMap.put("min",map2.get("min")); | ||
2688 | allMap.put("data",allList); | ||
2689 | Map<String, Object> map3 = getMaxAndMin(allList); | ||
2690 | allMap.put("max",map3.get("max")); | ||
2691 | allMap.put("min",map3.get("min")); | ||
2692 | map.put("SHGS",shMap); | ||
2693 | map.put("XFYS",xfMap); | ||
2694 | map.put("ALL",allMap); | ||
2695 | return map; | ||
2696 | } | ||
2697 | |||
2698 | @Override | ||
2699 | public Map<String, Object> getYearSumFlowGroup(SumFlowParams sumFlowParams) { | ||
2700 | Map<String, Object> map = new HashMap<>(); | ||
2701 | List<EchartResult> shList = new ArrayList<>(); | ||
2702 | List<EchartResult> xfList = new ArrayList<>(); | ||
2703 | List<EchartResult> allList = new ArrayList<>(); | ||
2704 | //定义返回的结构MAP | ||
2705 | Map<String,Object> shMap = new HashMap<>(); | ||
2706 | Map<String,Object> xfMap = new HashMap<>(); | ||
2707 | Map<String,Object> allMap = new HashMap<>(); | ||
2708 | if(!"".equals(sumFlowParams.getYear())&&sumFlowParams.getYear()!=null){ | ||
2709 | List<Map<String, Object>> monitorList = new ArrayList<>(); | ||
2710 | int currentYear = LocalDate.now().getYear();// 获取当前年份 currentYear | ||
2711 | String year = sumFlowParams.getYear(); | ||
2712 | String[] yearsArray = getYearsArray(year,String.valueOf(currentYear)); | ||
2713 | String startTime = year + "-01-01 00:00:00"; | ||
2714 | String endTime = currentYear + "-12-31 23:59:59"; | ||
2715 | monitorList = fmPgQueryService.queryAotiCurveDataByYear(LJLL_FIELDS,startTime,endTime); | ||
2716 | for (int i = 0; i < yearsArray.length; i++) { | ||
2717 | String echartName = yearsArray[i]; | ||
2718 | double shCount = 0.00; | ||
2719 | double xfCount = 0.00; | ||
2720 | double allCount = 0.00; | ||
2721 | String value1 = "0"; | ||
2722 | String value2 = "0"; | ||
2723 | String value3 = "0"; | ||
2724 | String value4 = "0"; | ||
2725 | String value5 = "0"; | ||
2726 | EchartResult shResult = new EchartResult(); | ||
2727 | shResult.setName(echartName); | ||
2728 | shResult.setSeries("年度"); | ||
2729 | EchartResult xfResult = new EchartResult(); | ||
2730 | xfResult.setName(echartName); | ||
2731 | xfResult.setSeries("年度"); | ||
2732 | EchartResult allResult = new EchartResult(); | ||
2733 | allResult.setName(echartName); | ||
2734 | allResult.setSeries("年度"); | ||
2735 | Map<String, Object> map001 = getMapFormList(monitorList,yearsArray[i],""); | ||
2736 | if(map001!=null){ | ||
2737 | value1 = map001.get("value").toString(); | ||
2738 | }else{ | ||
2739 | value1 = "0.00"; | ||
2740 | } | ||
2741 | allCount = allCount + Double.parseDouble(value1); | ||
2742 | Map<String, Object> map002 = getMapFormList(monitorList,yearsArray[i],"A01A21A03_FZLYL_XF_ACC_FIT0002"); | ||
2743 | if(map002!=null){ | ||
2744 | value2 = map002.get("value").toString(); | ||
2745 | }else{ | ||
2746 | value2 = "0.00"; | ||
2747 | } | ||
2748 | allCount = allCount + Double.parseDouble(value2); | ||
2749 | xfCount = xfCount + Double.parseDouble(value2); | ||
2750 | Map<String, Object> map003 = getMapFormList(monitorList,yearsArray[i],"A01A21A03_FZLYL_GS_ACC_FIT0003"); | ||
2751 | if(map003!=null){ | ||
2752 | value3 = map003.get("value").toString(); | ||
2753 | }else{ | ||
2754 | value3 = "0.00"; | ||
2755 | } | ||
2756 | allCount = allCount + Double.parseDouble(value3); | ||
2757 | shCount = shCount + Double.parseDouble(value3); | ||
2758 | Map<String, Object> map004 = getMapFormList(monitorList,yearsArray[i],"A01A21A03_GXEL_XF_ACC_FIT0004"); | ||
2759 | if(map004!=null){ | ||
2760 | value4 = map004.get("value").toString(); | ||
2761 | }else{ | ||
2762 | value4 = "0.00"; | ||
2763 | } | ||
2764 | allCount = allCount + Double.parseDouble(value4); | ||
2765 | xfCount = xfCount + Double.parseDouble(value4); | ||
2766 | Map<String, Object> map005 = getMapFormList(monitorList,yearsArray[i],"A01A21A03_GXEL_GS_ACC_FIT0005"); | ||
2767 | if(map005!=null){ | ||
2768 | value5 = map005.get("value").toString(); | ||
2769 | }else{ | ||
2770 | value5 = "0.00"; | ||
2771 | } | ||
2772 | allCount = allCount + Double.parseDouble(value5); | ||
2773 | shCount = shCount + Double.parseDouble(value5); | ||
2774 | shResult.setValue(String.valueOf(shCount)); | ||
2775 | xfResult.setValue(String.valueOf(xfCount)); | ||
2776 | allResult.setValue(String.valueOf(allCount)); | ||
2777 | shList.add(shResult); | ||
2778 | xfList.add(xfResult); | ||
2779 | allList.add(allResult); | ||
2780 | } | ||
2781 | } | ||
2782 | shMap.put("data",shList); | ||
2783 | Map<String, Object> map1 = getMaxAndMin(shList); | ||
2784 | shMap.put("max",map1.get("max")); | ||
2785 | shMap.put("min",map1.get("min")); | ||
2786 | xfMap.put("data",xfList); | ||
2787 | Map<String, Object> map2 = getMaxAndMin(xfList); | ||
2788 | xfMap.put("max",map2.get("max")); | ||
2789 | xfMap.put("min",map2.get("min")); | ||
2790 | allMap.put("data",allList); | ||
2791 | Map<String, Object> map3 = getMaxAndMin(allList); | ||
2792 | allMap.put("max",map3.get("max")); | ||
2793 | allMap.put("min",map3.get("min")); | ||
2794 | map.put("SHGS",shMap); | ||
2795 | map.put("XFYS",xfMap); | ||
2796 | map.put("ALL",allMap); | ||
2797 | return map; | ||
2798 | } | ||
2799 | |||
2588 | //遍历两个年份之间的年份 | 2800 | //遍历两个年份之间的年份 |
2589 | private static String[] getYearsArray(String startYear, String endYear) { | 2801 | private static String[] getYearsArray(String startYear, String endYear) { |
2590 | int length = Integer.parseInt(endYear) - Integer.parseInt(startYear) + 1; | 2802 | int length = Integer.parseInt(endYear) - Integer.parseInt(startYear) + 1; | ... | ... |
-
请 注册 或 登录 后发表评论