f8d3f276 张雷

奥体项目接口修改

1 个父辈 035378aa
...@@ -261,4 +261,26 @@ public class OlympicCenterController { ...@@ -261,4 +261,26 @@ public class OlympicCenterController {
261 result.setSuccess(true); 261 result.setSuccess(true);
262 return result; 262 return result;
263 } 263 }
264
265 @ApiOperation(value="获取相同月份的累计流量数据", notes="获取相同月份的累计流量数据")
266 @GetMapping(value = "/getYearMonthSumFlow")
267 public Result<Map<String,Object>> getYearMonthSumFlow(SumFlowParams sumFlowParams){
268 Result<Map<String,Object>> result = new Result<Map<String,Object>>();
269 Map<String,Object> map = new HashMap<>();
270 map = olympicCenterService.getYearMonthSumFlow(sumFlowParams);
271 result.setResult(map);
272 result.setSuccess(true);
273 return result;
274 }
275
276 @ApiOperation(value="获取年度的累计流量数据", notes="获取年度的累计流量数据")
277 @GetMapping(value = "/getYearSumFlow")
278 public Result<Map<String,Object>> getYearSumFlow(SumFlowParams sumFlowParams){
279 Result<Map<String,Object>> result = new Result<Map<String,Object>>();
280 Map<String,Object> map = new HashMap<>();
281 map = olympicCenterService.getYearSumFlow(sumFlowParams);
282 result.setResult(map);
283 result.setSuccess(true);
284 return result;
285 }
264 } 286 }
......
...@@ -49,4 +49,8 @@ public interface IOlympicCenterService { ...@@ -49,4 +49,8 @@ public interface IOlympicCenterService {
49 List<Map<String, Object>> getAlarmList(AlarmParams alarmParams); 49 List<Map<String, Object>> getAlarmList(AlarmParams alarmParams);
50 50
51 Map<String, Object> getSumFlowData(SumFlowParams sumFlowParams); 51 Map<String, Object> getSumFlowData(SumFlowParams sumFlowParams);
52
53 Map<String, Object> getYearMonthSumFlow(SumFlowParams sumFlowParams);
54
55 Map<String, Object> getYearSumFlow(SumFlowParams sumFlowParams);
52 } 56 }
......
...@@ -34,6 +34,8 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -34,6 +34,8 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
34 @Autowired 34 @Autowired
35 private WhatStructDataMapper whatStructDataMapper; 35 private WhatStructDataMapper whatStructDataMapper;
36 private static String AT_ID = "A01A21A03";//奥体项目厂ID 36 private static String AT_ID = "A01A21A03";//奥体项目厂ID
37 private static String LJLL_FIELDS = "A01A21A03_FZLYL_XF_ACC_FIT0002,A01A21A03_FZLYL_GS_ACC_FIT0003," +
38 "A01A21A03_GXEL_XF_ACC_FIT0004,A01A21A03_GXEL_GS_ACC_FIT0005";//累计流量点位
37 39
38 @Override 40 @Override
39 public Map<String,Object> getRealTimeData(String sourceType) { 41 public Map<String,Object> getRealTimeData(String sourceType) {
...@@ -1974,13 +1976,6 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -1974,13 +1976,6 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
1974 1976
1975 @Override 1977 @Override
1976 public Map<String, Object> getSumFlowData(SumFlowParams sumFlowParams) { 1978 public Map<String, Object> getSumFlowData(SumFlowParams sumFlowParams) {
1977 String fields = "A01A21A03_FZLYL_XF_ACC_FIT0002,A01A21A03_FZLYL_GS_ACC_FIT0003," +
1978 "A01A21A03_GXEL_XF_ACC_FIT0004,A01A21A03_GXEL_GS_ACC_FIT0005";
1979 Map<String,Object> monitorMap = new HashMap<>();
1980 monitorMap.put("A01A21A03_FZLYL_XF_ACC_FIT0002","F0002");
1981 monitorMap.put("A01A21A03_FZLYL_GS_ACC_FIT0003","F0003");
1982 monitorMap.put("A01A21A03_GXEL_XF_ACC_FIT0004","F0004");
1983 monitorMap.put("A01A21A03_GXEL_GS_ACC_FIT0005","F0005");
1984 List<EchartResult> f1List = new ArrayList<>(); 1979 List<EchartResult> f1List = new ArrayList<>();
1985 List<EchartResult> f2List = new ArrayList<>(); 1980 List<EchartResult> f2List = new ArrayList<>();
1986 List<EchartResult> f3List = new ArrayList<>(); 1981 List<EchartResult> f3List = new ArrayList<>();
...@@ -2027,11 +2022,13 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2027,11 +2022,13 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2027 startTime = lastMonthYearMonth + "-01 00:00:00"; 2022 startTime = lastMonthYearMonth + "-01 00:00:00";
2028 endTime = nextMonthYearMonth + "-01 00:00:00"; 2023 endTime = nextMonthYearMonth + "-01 00:00:00";
2029 } 2024 }
2030 monitorList = fmPgQueryService.queryAotiCurveData(fields,startTime,endTime,sumType,strCount); 2025 monitorList = fmPgQueryService.queryAotiCurveData(LJLL_FIELDS,startTime,endTime,sumType,strCount);
2031 if("day".equals(sumType)){ 2026 if("day".equals(sumType)){
2032 for (int i = 0; i < currentYearMonthMap.length; i++) { 2027 for (int i = 0; i < currentYearMonthMap.length; i++) {
2028 String dateTime = currentYearMonthMap[i];
2029 String echartName = dateTime.substring(dateTime.length() - 2);
2033 EchartResult echartResult1 = new EchartResult(); 2030 EchartResult echartResult1 = new EchartResult();
2034 echartResult1.setName(currentYearMonthMap[i]); 2031 echartResult1.setName(echartName);
2035 echartResult1.setValue("--"); 2032 echartResult1.setValue("--");
2036 echartResult1.setSeries("本月"); 2033 echartResult1.setSeries("本月");
2037 Map<String, Object> map1 = getMapFormList(monitorList,currentYearMonthMap[i],""); 2034 Map<String, Object> map1 = getMapFormList(monitorList,currentYearMonthMap[i],"");
...@@ -2040,7 +2037,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2040,7 +2037,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2040 } 2037 }
2041 f1List.add(echartResult1); 2038 f1List.add(echartResult1);
2042 EchartResult echartResult2 = new EchartResult(); 2039 EchartResult echartResult2 = new EchartResult();
2043 echartResult2.setName(currentYearMonthMap[i]); 2040 echartResult2.setName(echartName);
2044 echartResult2.setValue("--"); 2041 echartResult2.setValue("--");
2045 echartResult2.setSeries("本月"); 2042 echartResult2.setSeries("本月");
2046 Map<String, Object> map2 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_FZLYL_XF_ACC_FIT0002"); 2043 Map<String, Object> map2 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_FZLYL_XF_ACC_FIT0002");
...@@ -2049,7 +2046,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2049,7 +2046,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2049 } 2046 }
2050 f2List.add(echartResult2); 2047 f2List.add(echartResult2);
2051 EchartResult echartResult3 = new EchartResult(); 2048 EchartResult echartResult3 = new EchartResult();
2052 echartResult3.setName(currentYearMonthMap[i]); 2049 echartResult3.setName(echartName);
2053 echartResult3.setValue("--"); 2050 echartResult3.setValue("--");
2054 echartResult3.setSeries("本月"); 2051 echartResult3.setSeries("本月");
2055 Map<String, Object> map3 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_FZLYL_GS_ACC_FIT0003"); 2052 Map<String, Object> map3 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_FZLYL_GS_ACC_FIT0003");
...@@ -2058,7 +2055,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2058,7 +2055,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2058 } 2055 }
2059 f3List.add(echartResult3); 2056 f3List.add(echartResult3);
2060 EchartResult echartResult4 = new EchartResult(); 2057 EchartResult echartResult4 = new EchartResult();
2061 echartResult4.setName(currentYearMonthMap[i]); 2058 echartResult4.setName(echartName);
2062 echartResult4.setValue("--"); 2059 echartResult4.setValue("--");
2063 echartResult4.setSeries("本月"); 2060 echartResult4.setSeries("本月");
2064 Map<String, Object> map4 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_GXEL_XF_ACC_FIT0004"); 2061 Map<String, Object> map4 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_GXEL_XF_ACC_FIT0004");
...@@ -2067,7 +2064,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2067,7 +2064,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2067 } 2064 }
2068 f4List.add(echartResult4); 2065 f4List.add(echartResult4);
2069 EchartResult echartResult5 = new EchartResult(); 2066 EchartResult echartResult5 = new EchartResult();
2070 echartResult5.setName(currentYearMonthMap[i]); 2067 echartResult5.setName(echartName);
2071 echartResult5.setValue("--"); 2068 echartResult5.setValue("--");
2072 echartResult5.setSeries("本月"); 2069 echartResult5.setSeries("本月");
2073 Map<String, Object> map5 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_GXEL_GS_ACC_FIT0005"); 2070 Map<String, Object> map5 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_GXEL_GS_ACC_FIT0005");
...@@ -2077,8 +2074,10 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2077,8 +2074,10 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2077 f5List.add(echartResult5); 2074 f5List.add(echartResult5);
2078 } 2075 }
2079 for (int i = 0; i < lastMonthYearMonthMap.length; i++) { 2076 for (int i = 0; i < lastMonthYearMonthMap.length; i++) {
2077 String dateTime = lastMonthYearMonthMap[i];
2078 String echartName = dateTime.substring(dateTime.length() - 2);
2080 EchartResult echartResult1 = new EchartResult(); 2079 EchartResult echartResult1 = new EchartResult();
2081 echartResult1.setName(lastMonthYearMonthMap[i]); 2080 echartResult1.setName(echartName);
2082 echartResult1.setValue("--"); 2081 echartResult1.setValue("--");
2083 echartResult1.setSeries("上月"); 2082 echartResult1.setSeries("上月");
2084 Map<String, Object> map1 = getMapFormList(monitorList,lastMonthYearMonthMap[i],""); 2083 Map<String, Object> map1 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"");
...@@ -2087,7 +2086,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2087,7 +2086,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2087 } 2086 }
2088 f1List.add(echartResult1); 2087 f1List.add(echartResult1);
2089 EchartResult echartResult2 = new EchartResult(); 2088 EchartResult echartResult2 = new EchartResult();
2090 echartResult2.setName(lastMonthYearMonthMap[i]); 2089 echartResult2.setName(echartName);
2091 echartResult2.setValue("--"); 2090 echartResult2.setValue("--");
2092 echartResult2.setSeries("上月"); 2091 echartResult2.setSeries("上月");
2093 Map<String, Object> map2 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_FZLYL_XF_ACC_FIT0002"); 2092 Map<String, Object> map2 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_FZLYL_XF_ACC_FIT0002");
...@@ -2096,7 +2095,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2096,7 +2095,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2096 } 2095 }
2097 f2List.add(echartResult2); 2096 f2List.add(echartResult2);
2098 EchartResult echartResult3 = new EchartResult(); 2097 EchartResult echartResult3 = new EchartResult();
2099 echartResult3.setName(lastMonthYearMonthMap[i]); 2098 echartResult3.setName(echartName);
2100 echartResult3.setValue("--"); 2099 echartResult3.setValue("--");
2101 echartResult3.setSeries("上月"); 2100 echartResult3.setSeries("上月");
2102 Map<String, Object> map3 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_FZLYL_GS_ACC_FIT0003"); 2101 Map<String, Object> map3 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_FZLYL_GS_ACC_FIT0003");
...@@ -2105,7 +2104,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2105,7 +2104,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2105 } 2104 }
2106 f3List.add(echartResult3); 2105 f3List.add(echartResult3);
2107 EchartResult echartResult4 = new EchartResult(); 2106 EchartResult echartResult4 = new EchartResult();
2108 echartResult4.setName(lastMonthYearMonthMap[i]); 2107 echartResult4.setName(echartName);
2109 echartResult4.setValue("--"); 2108 echartResult4.setValue("--");
2110 echartResult4.setSeries("上月"); 2109 echartResult4.setSeries("上月");
2111 Map<String, Object> map4 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_GXEL_XF_ACC_FIT0004"); 2110 Map<String, Object> map4 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_GXEL_XF_ACC_FIT0004");
...@@ -2114,7 +2113,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2114,7 +2113,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2114 } 2113 }
2115 f4List.add(echartResult4); 2114 f4List.add(echartResult4);
2116 EchartResult echartResult5 = new EchartResult(); 2115 EchartResult echartResult5 = new EchartResult();
2117 echartResult5.setName(lastMonthYearMonthMap[i]); 2116 echartResult5.setName(echartName);
2118 echartResult5.setValue("--"); 2117 echartResult5.setValue("--");
2119 echartResult5.setSeries("上月"); 2118 echartResult5.setSeries("上月");
2120 Map<String, Object> map5 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_GXEL_GS_ACC_FIT0005"); 2119 Map<String, Object> map5 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_GXEL_GS_ACC_FIT0005");
...@@ -2125,8 +2124,10 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2125,8 +2124,10 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2125 } 2124 }
2126 }else if("month".equals(sumType)){ 2125 }else if("month".equals(sumType)){
2127 for (int i = 0; i < currentYearMap.length; i++) { 2126 for (int i = 0; i < currentYearMap.length; i++) {
2127 String dateTime = currentYearMap[i];
2128 String echartName = dateTime.substring(dateTime.length() - 2);
2128 EchartResult echartResult1 = new EchartResult(); 2129 EchartResult echartResult1 = new EchartResult();
2129 echartResult1.setName(currentYearMap[i]); 2130 echartResult1.setName(echartName);
2130 echartResult1.setValue("--"); 2131 echartResult1.setValue("--");
2131 echartResult1.setSeries("本年"); 2132 echartResult1.setSeries("本年");
2132 Map<String, Object> map1 = getMapFormList(monitorList,currentYearMap[i],""); 2133 Map<String, Object> map1 = getMapFormList(monitorList,currentYearMap[i],"");
...@@ -2135,7 +2136,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2135,7 +2136,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2135 } 2136 }
2136 f1List.add(echartResult1); 2137 f1List.add(echartResult1);
2137 EchartResult echartResult2 = new EchartResult(); 2138 EchartResult echartResult2 = new EchartResult();
2138 echartResult2.setName(currentYearMap[i]); 2139 echartResult2.setName(echartName);
2139 echartResult2.setValue("--"); 2140 echartResult2.setValue("--");
2140 echartResult2.setSeries("本年"); 2141 echartResult2.setSeries("本年");
2141 Map<String, Object> map2 = getMapFormList(monitorList,currentYearMap[i],"A01A21A03_FZLYL_XF_ACC_FIT0002"); 2142 Map<String, Object> map2 = getMapFormList(monitorList,currentYearMap[i],"A01A21A03_FZLYL_XF_ACC_FIT0002");
...@@ -2144,7 +2145,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2144,7 +2145,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2144 } 2145 }
2145 f2List.add(echartResult2); 2146 f2List.add(echartResult2);
2146 EchartResult echartResult3 = new EchartResult(); 2147 EchartResult echartResult3 = new EchartResult();
2147 echartResult3.setName(currentYearMap[i]); 2148 echartResult3.setName(echartName);
2148 echartResult3.setValue("--"); 2149 echartResult3.setValue("--");
2149 echartResult3.setSeries("本年"); 2150 echartResult3.setSeries("本年");
2150 Map<String, Object> map3 = getMapFormList(monitorList,currentYearMap[i],"A01A21A03_FZLYL_GS_ACC_FIT0003"); 2151 Map<String, Object> map3 = getMapFormList(monitorList,currentYearMap[i],"A01A21A03_FZLYL_GS_ACC_FIT0003");
...@@ -2153,7 +2154,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2153,7 +2154,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2153 } 2154 }
2154 f3List.add(echartResult3); 2155 f3List.add(echartResult3);
2155 EchartResult echartResult4 = new EchartResult(); 2156 EchartResult echartResult4 = new EchartResult();
2156 echartResult4.setName(currentYearMap[i]); 2157 echartResult4.setName(echartName);
2157 echartResult4.setValue("--"); 2158 echartResult4.setValue("--");
2158 echartResult4.setSeries("本年"); 2159 echartResult4.setSeries("本年");
2159 Map<String, Object> map4 = getMapFormList(monitorList,currentYearMap[i],"A01A21A03_GXEL_XF_ACC_FIT0004"); 2160 Map<String, Object> map4 = getMapFormList(monitorList,currentYearMap[i],"A01A21A03_GXEL_XF_ACC_FIT0004");
...@@ -2162,7 +2163,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2162,7 +2163,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2162 } 2163 }
2163 f4List.add(echartResult4); 2164 f4List.add(echartResult4);
2164 EchartResult echartResult5 = new EchartResult(); 2165 EchartResult echartResult5 = new EchartResult();
2165 echartResult5.setName(currentYearMap[i]); 2166 echartResult5.setName(echartName);
2166 echartResult5.setValue("--"); 2167 echartResult5.setValue("--");
2167 echartResult5.setSeries("本年"); 2168 echartResult5.setSeries("本年");
2168 Map<String, Object> map5 = getMapFormList(monitorList,currentYearMap[i],"A01A21A03_GXEL_GS_ACC_FIT0005"); 2169 Map<String, Object> map5 = getMapFormList(monitorList,currentYearMap[i],"A01A21A03_GXEL_GS_ACC_FIT0005");
...@@ -2172,8 +2173,10 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2172,8 +2173,10 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2172 f5List.add(echartResult5); 2173 f5List.add(echartResult5);
2173 } 2174 }
2174 for (int i = 0; i < lastYearMap.length; i++) { 2175 for (int i = 0; i < lastYearMap.length; i++) {
2176 String dateTime = lastYearMap[i];
2177 String echartName = dateTime.substring(dateTime.length() - 2);
2175 EchartResult echartResult1 = new EchartResult(); 2178 EchartResult echartResult1 = new EchartResult();
2176 echartResult1.setName(lastYearMap[i]); 2179 echartResult1.setName(echartName);
2177 echartResult1.setValue("--"); 2180 echartResult1.setValue("--");
2178 echartResult1.setSeries("去年"); 2181 echartResult1.setSeries("去年");
2179 Map<String, Object> map1 = getMapFormList(monitorList,lastYearMap[i],""); 2182 Map<String, Object> map1 = getMapFormList(monitorList,lastYearMap[i],"");
...@@ -2182,7 +2185,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2182,7 +2185,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2182 } 2185 }
2183 f1List.add(echartResult1); 2186 f1List.add(echartResult1);
2184 EchartResult echartResult2 = new EchartResult(); 2187 EchartResult echartResult2 = new EchartResult();
2185 echartResult2.setName(lastYearMap[i]); 2188 echartResult2.setName(echartName);
2186 echartResult2.setValue("--"); 2189 echartResult2.setValue("--");
2187 echartResult2.setSeries("去年"); 2190 echartResult2.setSeries("去年");
2188 Map<String, Object> map2 = getMapFormList(monitorList,lastYearMap[i],"A01A21A03_FZLYL_XF_ACC_FIT0002"); 2191 Map<String, Object> map2 = getMapFormList(monitorList,lastYearMap[i],"A01A21A03_FZLYL_XF_ACC_FIT0002");
...@@ -2191,7 +2194,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2191,7 +2194,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2191 } 2194 }
2192 f2List.add(echartResult2); 2195 f2List.add(echartResult2);
2193 EchartResult echartResult3 = new EchartResult(); 2196 EchartResult echartResult3 = new EchartResult();
2194 echartResult3.setName(lastYearMap[i]); 2197 echartResult3.setName(echartName);
2195 echartResult3.setValue("--"); 2198 echartResult3.setValue("--");
2196 echartResult3.setSeries("去年"); 2199 echartResult3.setSeries("去年");
2197 Map<String, Object> map3 = getMapFormList(monitorList,lastYearMap[i],"A01A21A03_FZLYL_GS_ACC_FIT0003"); 2200 Map<String, Object> map3 = getMapFormList(monitorList,lastYearMap[i],"A01A21A03_FZLYL_GS_ACC_FIT0003");
...@@ -2200,7 +2203,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2200,7 +2203,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2200 } 2203 }
2201 f3List.add(echartResult3); 2204 f3List.add(echartResult3);
2202 EchartResult echartResult4 = new EchartResult(); 2205 EchartResult echartResult4 = new EchartResult();
2203 echartResult4.setName(lastYearMap[i]); 2206 echartResult4.setName(echartName);
2204 echartResult4.setValue("--"); 2207 echartResult4.setValue("--");
2205 echartResult4.setSeries("去年"); 2208 echartResult4.setSeries("去年");
2206 Map<String, Object> map4 = getMapFormList(monitorList,lastYearMap[i],"A01A21A03_GXEL_XF_ACC_FIT0004"); 2209 Map<String, Object> map4 = getMapFormList(monitorList,lastYearMap[i],"A01A21A03_GXEL_XF_ACC_FIT0004");
...@@ -2209,7 +2212,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2209,7 +2212,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2209 } 2212 }
2210 f4List.add(echartResult4); 2213 f4List.add(echartResult4);
2211 EchartResult echartResult5 = new EchartResult(); 2214 EchartResult echartResult5 = new EchartResult();
2212 echartResult5.setName(lastYearMap[i]); 2215 echartResult5.setName(echartName);
2213 echartResult5.setValue("--"); 2216 echartResult5.setValue("--");
2214 echartResult5.setSeries("去年"); 2217 echartResult5.setSeries("去年");
2215 Map<String, Object> map5 = getMapFormList(monitorList,lastYearMap[i],"A01A21A03_GXEL_GS_ACC_FIT0005"); 2218 Map<String, Object> map5 = getMapFormList(monitorList,lastYearMap[i],"A01A21A03_GXEL_GS_ACC_FIT0005");
...@@ -2218,12 +2221,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2218,12 +2221,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2218 } 2221 }
2219 f5List.add(echartResult5); 2222 f5List.add(echartResult5);
2220 } 2223 }
2221 }else if("year".equals(sumType)){
2222
2223 }else{ 2224 }else{
2224 for (int i = 0; i < currentYearMonthMap.length; i++) { 2225 for (int i = 0; i < currentYearMonthMap.length; i++) {
2226 String dateTime = currentYearMonthMap[i];
2227 String echartName = dateTime.substring(dateTime.length() - 2);
2225 EchartResult echartResult1 = new EchartResult(); 2228 EchartResult echartResult1 = new EchartResult();
2226 echartResult1.setName(currentYearMonthMap[i]); 2229 echartResult1.setName(echartName);
2227 echartResult1.setValue("--"); 2230 echartResult1.setValue("--");
2228 echartResult1.setSeries("本月"); 2231 echartResult1.setSeries("本月");
2229 Map<String, Object> map1 = getMapFormList(monitorList,currentYearMonthMap[i],""); 2232 Map<String, Object> map1 = getMapFormList(monitorList,currentYearMonthMap[i],"");
...@@ -2232,7 +2235,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2232,7 +2235,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2232 } 2235 }
2233 f1List.add(echartResult1); 2236 f1List.add(echartResult1);
2234 EchartResult echartResult2 = new EchartResult(); 2237 EchartResult echartResult2 = new EchartResult();
2235 echartResult2.setName(currentYearMonthMap[i]); 2238 echartResult2.setName(echartName);
2236 echartResult2.setValue("--"); 2239 echartResult2.setValue("--");
2237 echartResult2.setSeries("本月"); 2240 echartResult2.setSeries("本月");
2238 Map<String, Object> map2 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_FZLYL_XF_ACC_FIT0002"); 2241 Map<String, Object> map2 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_FZLYL_XF_ACC_FIT0002");
...@@ -2241,7 +2244,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2241,7 +2244,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2241 } 2244 }
2242 f2List.add(echartResult2); 2245 f2List.add(echartResult2);
2243 EchartResult echartResult3 = new EchartResult(); 2246 EchartResult echartResult3 = new EchartResult();
2244 echartResult3.setName(currentYearMonthMap[i]); 2247 echartResult3.setName(echartName);
2245 echartResult3.setValue("--"); 2248 echartResult3.setValue("--");
2246 echartResult3.setSeries("本月"); 2249 echartResult3.setSeries("本月");
2247 Map<String, Object> map3 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_FZLYL_GS_ACC_FIT0003"); 2250 Map<String, Object> map3 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_FZLYL_GS_ACC_FIT0003");
...@@ -2250,7 +2253,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2250,7 +2253,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2250 } 2253 }
2251 f3List.add(echartResult3); 2254 f3List.add(echartResult3);
2252 EchartResult echartResult4 = new EchartResult(); 2255 EchartResult echartResult4 = new EchartResult();
2253 echartResult4.setName(currentYearMonthMap[i]); 2256 echartResult4.setName(echartName);
2254 echartResult4.setValue("--"); 2257 echartResult4.setValue("--");
2255 echartResult4.setSeries("本月"); 2258 echartResult4.setSeries("本月");
2256 Map<String, Object> map4 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_GXEL_XF_ACC_FIT0004"); 2259 Map<String, Object> map4 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_GXEL_XF_ACC_FIT0004");
...@@ -2259,7 +2262,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2259,7 +2262,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2259 } 2262 }
2260 f4List.add(echartResult4); 2263 f4List.add(echartResult4);
2261 EchartResult echartResult5 = new EchartResult(); 2264 EchartResult echartResult5 = new EchartResult();
2262 echartResult5.setName(currentYearMonthMap[i]); 2265 echartResult5.setName(echartName);
2263 echartResult5.setValue("--"); 2266 echartResult5.setValue("--");
2264 echartResult5.setSeries("本月"); 2267 echartResult5.setSeries("本月");
2265 Map<String, Object> map5 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_GXEL_GS_ACC_FIT0005"); 2268 Map<String, Object> map5 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_GXEL_GS_ACC_FIT0005");
...@@ -2269,8 +2272,10 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2269,8 +2272,10 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2269 f5List.add(echartResult5); 2272 f5List.add(echartResult5);
2270 } 2273 }
2271 for (int i = 0; i < lastMonthYearMonthMap.length; i++) { 2274 for (int i = 0; i < lastMonthYearMonthMap.length; i++) {
2275 String dateTime = lastMonthYearMonthMap[i];
2276 String echartName = dateTime.substring(dateTime.length() - 2);
2272 EchartResult echartResult1 = new EchartResult(); 2277 EchartResult echartResult1 = new EchartResult();
2273 echartResult1.setName(lastMonthYearMonthMap[i]); 2278 echartResult1.setName(echartName);
2274 echartResult1.setValue("--"); 2279 echartResult1.setValue("--");
2275 echartResult1.setSeries("上月"); 2280 echartResult1.setSeries("上月");
2276 Map<String, Object> map1 = getMapFormList(monitorList,lastMonthYearMonthMap[i],""); 2281 Map<String, Object> map1 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"");
...@@ -2279,7 +2284,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2279,7 +2284,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2279 } 2284 }
2280 f1List.add(echartResult1); 2285 f1List.add(echartResult1);
2281 EchartResult echartResult2 = new EchartResult(); 2286 EchartResult echartResult2 = new EchartResult();
2282 echartResult2.setName(lastMonthYearMonthMap[i]); 2287 echartResult2.setName(echartName);
2283 echartResult2.setValue("--"); 2288 echartResult2.setValue("--");
2284 echartResult2.setSeries("上月"); 2289 echartResult2.setSeries("上月");
2285 Map<String, Object> map2 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_FZLYL_XF_ACC_FIT0002"); 2290 Map<String, Object> map2 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_FZLYL_XF_ACC_FIT0002");
...@@ -2288,7 +2293,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2288,7 +2293,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2288 } 2293 }
2289 f2List.add(echartResult2); 2294 f2List.add(echartResult2);
2290 EchartResult echartResult3 = new EchartResult(); 2295 EchartResult echartResult3 = new EchartResult();
2291 echartResult3.setName(lastMonthYearMonthMap[i]); 2296 echartResult3.setName(echartName);
2292 echartResult3.setValue("--"); 2297 echartResult3.setValue("--");
2293 echartResult3.setSeries("上月"); 2298 echartResult3.setSeries("上月");
2294 Map<String, Object> map3 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_FZLYL_GS_ACC_FIT0003"); 2299 Map<String, Object> map3 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_FZLYL_GS_ACC_FIT0003");
...@@ -2297,7 +2302,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2297,7 +2302,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2297 } 2302 }
2298 f3List.add(echartResult3); 2303 f3List.add(echartResult3);
2299 EchartResult echartResult4 = new EchartResult(); 2304 EchartResult echartResult4 = new EchartResult();
2300 echartResult4.setName(lastMonthYearMonthMap[i]); 2305 echartResult4.setName(echartName);
2301 echartResult4.setValue("--"); 2306 echartResult4.setValue("--");
2302 echartResult4.setSeries("上月"); 2307 echartResult4.setSeries("上月");
2303 Map<String, Object> map4 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_GXEL_XF_ACC_FIT0004"); 2308 Map<String, Object> map4 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_GXEL_XF_ACC_FIT0004");
...@@ -2306,7 +2311,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2306,7 +2311,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2306 } 2311 }
2307 f4List.add(echartResult4); 2312 f4List.add(echartResult4);
2308 EchartResult echartResult5 = new EchartResult(); 2313 EchartResult echartResult5 = new EchartResult();
2309 echartResult5.setName(lastMonthYearMonthMap[i]); 2314 echartResult5.setName(echartName);
2310 echartResult5.setValue("--"); 2315 echartResult5.setValue("--");
2311 echartResult5.setSeries("上月"); 2316 echartResult5.setSeries("上月");
2312 Map<String, Object> map5 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_GXEL_GS_ACC_FIT0005"); 2317 Map<String, Object> map5 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_GXEL_GS_ACC_FIT0005");
...@@ -2324,6 +2329,165 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2324,6 +2329,165 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2324 return map; 2329 return map;
2325 } 2330 }
2326 2331
2332 @Override
2333 public Map<String, Object> getYearMonthSumFlow(SumFlowParams sumFlowParams) {
2334 Map<String, Object> map = new HashMap<>();
2335 List<EchartResult> f1List = new ArrayList<>();
2336 List<EchartResult> f2List = new ArrayList<>();
2337 List<EchartResult> f3List = new ArrayList<>();
2338 List<EchartResult> f4List = new ArrayList<>();
2339 List<EchartResult> f5List = new ArrayList<>();
2340 if(!"".equals(sumFlowParams.getYearMonth())&&sumFlowParams.getYearMonth()!=null){
2341 List<Map<String, Object>> monitorList = new ArrayList<>();
2342 int currentYear = LocalDate.now().getYear();// 获取当前年份 currentYear
2343 String[] ymArray = sumFlowParams.getYearMonth().split("-");
2344 String year = ymArray[0];
2345 String month = ymArray[1];
2346 String[] yearsArray = getYearsArray(year,String.valueOf(currentYear));
2347 String startTime = year + "-01-01 00:00:00";
2348 String endTime = currentYear + "-12-31 23:59:59";
2349 monitorList = fmPgQueryService.queryAotiCurveDataByMonth(LJLL_FIELDS,startTime,endTime,month);
2350 for (int i = 0; i < yearsArray.length; i++) {
2351 String echartName = yearsArray[i];
2352 EchartResult echartResult1 = new EchartResult();
2353 echartResult1.setName(echartName);
2354 echartResult1.setValue("--");
2355 echartResult1.setSeries(month + "月");
2356 Map<String, Object> map1 = getMapFormList(monitorList,yearsArray[i]+"-"+month,"");
2357 if(map1!=null){
2358 echartResult1.setValue(map1.get("value").toString());
2359 }
2360 f1List.add(echartResult1);
2361 EchartResult echartResult2 = new EchartResult();
2362 echartResult2.setName(echartName);
2363 echartResult2.setValue("--");
2364 echartResult2.setSeries(month + "月");
2365 Map<String, Object> map2 = getMapFormList(monitorList,yearsArray[i]+"-"+month,"A01A21A03_FZLYL_XF_ACC_FIT0002");
2366 if(map2!=null){
2367 echartResult2.setValue(map2.get("value").toString());
2368 }
2369 f2List.add(echartResult2);
2370 EchartResult echartResult3 = new EchartResult();
2371 echartResult3.setName(echartName);
2372 echartResult3.setValue("--");
2373 echartResult3.setSeries(month + "月");
2374 Map<String, Object> map3 = getMapFormList(monitorList,yearsArray[i]+"-"+month,"A01A21A03_FZLYL_GS_ACC_FIT0003");
2375 if(map3!=null){
2376 echartResult3.setValue(map3.get("value").toString());
2377 }
2378 f3List.add(echartResult3);
2379 EchartResult echartResult4 = new EchartResult();
2380 echartResult4.setName(echartName);
2381 echartResult4.setValue("--");
2382 echartResult4.setSeries(month + "月");
2383 Map<String, Object> map4 = getMapFormList(monitorList,yearsArray[i]+"-"+month,"A01A21A03_GXEL_XF_ACC_FIT0004");
2384 if(map4!=null){
2385 echartResult4.setValue(map4.get("value").toString());
2386 }
2387 f4List.add(echartResult4);
2388 EchartResult echartResult5 = new EchartResult();
2389 echartResult5.setName(echartName);
2390 echartResult5.setValue("--");
2391 echartResult5.setSeries(month + "月");
2392 Map<String, Object> map5 = getMapFormList(monitorList,yearsArray[i]+"-"+month,"A01A21A03_GXEL_GS_ACC_FIT0005");
2393 if(map5!=null){
2394 echartResult5.setValue(map5.get("value").toString());
2395 }
2396 f5List.add(echartResult5);
2397 }
2398 }
2399 map.put("F0001",f1List);
2400 map.put("F0002",f2List);
2401 map.put("F0003",f3List);
2402 map.put("F0004",f4List);
2403 map.put("F0005",f5List);
2404 return map;
2405 }
2406
2407 @Override
2408 public Map<String, Object> getYearSumFlow(SumFlowParams sumFlowParams) {
2409 Map<String, Object> map = new HashMap<>();
2410 List<EchartResult> f1List = new ArrayList<>();
2411 List<EchartResult> f2List = new ArrayList<>();
2412 List<EchartResult> f3List = new ArrayList<>();
2413 List<EchartResult> f4List = new ArrayList<>();
2414 List<EchartResult> f5List = new ArrayList<>();
2415 if(!"".equals(sumFlowParams.getYear())&&sumFlowParams.getYear()!=null){
2416 List<Map<String, Object>> monitorList = new ArrayList<>();
2417 int currentYear = LocalDate.now().getYear();// 获取当前年份 currentYear
2418 String year = sumFlowParams.getYear();
2419 String[] yearsArray = getYearsArray(year,String.valueOf(currentYear));
2420 String startTime = year + "-01-01 00:00:00";
2421 String endTime = currentYear + "-12-31 23:59:59";
2422 monitorList = fmPgQueryService.queryAotiCurveDataByYear(LJLL_FIELDS,startTime,endTime);
2423 for (int i = 0; i < yearsArray.length; i++) {
2424 String echartName = yearsArray[i];
2425 EchartResult echartResult1 = new EchartResult();
2426 echartResult1.setName(echartName);
2427 echartResult1.setValue("--");
2428 echartResult1.setSeries("年度");
2429 Map<String, Object> map1 = getMapFormList(monitorList,yearsArray[i],"");
2430 if(map1!=null){
2431 echartResult1.setValue(map1.get("value").toString());
2432 }
2433 f1List.add(echartResult1);
2434 EchartResult echartResult2 = new EchartResult();
2435 echartResult2.setName(echartName);
2436 echartResult2.setValue("--");
2437 echartResult2.setSeries("年度");
2438 Map<String, Object> map2 = getMapFormList(monitorList,yearsArray[i],"A01A21A03_FZLYL_XF_ACC_FIT0002");
2439 if(map2!=null){
2440 echartResult2.setValue(map2.get("value").toString());
2441 }
2442 f2List.add(echartResult2);
2443 EchartResult echartResult3 = new EchartResult();
2444 echartResult3.setName(echartName);
2445 echartResult3.setValue("--");
2446 echartResult3.setSeries("年度");
2447 Map<String, Object> map3 = getMapFormList(monitorList,yearsArray[i],"A01A21A03_FZLYL_GS_ACC_FIT0003");
2448 if(map3!=null){
2449 echartResult3.setValue(map3.get("value").toString());
2450 }
2451 f3List.add(echartResult3);
2452 EchartResult echartResult4 = new EchartResult();
2453 echartResult4.setName(echartName);
2454 echartResult4.setValue("--");
2455 echartResult4.setSeries("年度");
2456 Map<String, Object> map4 = getMapFormList(monitorList,yearsArray[i],"A01A21A03_GXEL_XF_ACC_FIT0004");
2457 if(map4!=null){
2458 echartResult4.setValue(map4.get("value").toString());
2459 }
2460 f4List.add(echartResult4);
2461 EchartResult echartResult5 = new EchartResult();
2462 echartResult5.setName(echartName);
2463 echartResult5.setValue("--");
2464 echartResult5.setSeries("年度");
2465 Map<String, Object> map5 = getMapFormList(monitorList,yearsArray[i],"A01A21A03_GXEL_GS_ACC_FIT0005");
2466 if(map5!=null){
2467 echartResult5.setValue(map5.get("value").toString());
2468 }
2469 f5List.add(echartResult5);
2470 }
2471 }
2472 map.put("F0001",f1List);
2473 map.put("F0002",f2List);
2474 map.put("F0003",f3List);
2475 map.put("F0004",f4List);
2476 map.put("F0005",f5List);
2477 return map;
2478 }
2479
2480 //遍历两个年份之间的年份
2481 private static String[] getYearsArray(String startYear, String endYear) {
2482 int length = Integer.parseInt(endYear) - Integer.parseInt(startYear) + 1;
2483 String[] years = new String[length];
2484 for (int i = 0; i < length; i++) {
2485 years[i] = String.valueOf(Integer.parseInt(startYear) + i);
2486 }
2487 return years;
2488 }
2489
2490 //List中精确查找元素
2327 public Map<String, Object> getMapFormList(List<Map<String, Object>> list,String dataTime,String monitorId){ 2491 public Map<String, Object> getMapFormList(List<Map<String, Object>> list,String dataTime,String monitorId){
2328 Map<String, Object> resultMap = new HashMap<>(); 2492 Map<String, Object> resultMap = new HashMap<>();
2329 Optional<Map<String, Object>> result = list.stream() 2493 Optional<Map<String, Object>> result = list.stream()
......
...@@ -10,9 +10,16 @@ public class SumFlowParams { ...@@ -10,9 +10,16 @@ public class SumFlowParams {
10 10
11 /**聚合类型 日:day, 月:month,年:year*/ 11 /**聚合类型 日:day, 月:month,年:year*/
12 private String sumType; 12 private String sumType;
13
13 /**开始时间 yyyy-MM-DD*/ 14 /**开始时间 yyyy-MM-DD*/
14 private String start; 15 private String start;
15 /**结束时间 yyyy-MM-DD*/ 16 /**结束时间 yyyy-MM-DD*/
16 private String end; 17 private String end;
17 18
19 /**时间 年月 yyyy-MM*/
20 private String yearMonth;
21
22 /**时间 年 yyyy*/
23 private String year;
24
18 } 25 }
......
...@@ -21,10 +21,13 @@ public interface IFmPgQueryService { ...@@ -21,10 +21,13 @@ public interface IFmPgQueryService {
21 * @param tableType 表类型 0实时 1计算 21 * @param tableType 表类型 0实时 1计算
22 * @return 22 * @return
23 */ 23 */
24 public List<Map<String,Object>> queryFactoryInfos(String departId,String fields,String startTime,String endTime,String tableType); 24 List<Map<String,Object>> queryFactoryInfos(String departId,String fields,String startTime,String endTime,String tableType);
25 25
26 public List<Map<String, Object>> queryReportData(String departId,String fields,String startTime,String endTime,String reportType); 26 List<Map<String, Object>> queryReportData(String departId,String fields,String startTime,String endTime,String reportType);
27 27
28 public List<Map<String, Object>> queryAotiCurveData(String fields,String startTime,String endTime,String sumType,int strCount); 28 List<Map<String, Object>> queryAotiCurveData(String fields,String startTime,String endTime,String sumType,int strCount);
29 29
30 List<Map<String, Object>> queryAotiCurveDataByMonth(String fields, String startTime, String endTime, String month);
31
32 List<Map<String, Object>> queryAotiCurveDataByYear(String fields, String startTime, String endTime);
30 } 33 }
......
...@@ -393,4 +393,75 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService { ...@@ -393,4 +393,75 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
393 } 393 }
394 return dataList; 394 return dataList;
395 } 395 }
396
397 @Override
398 public List<Map<String, Object>> queryAotiCurveDataByMonth(String fields, String startTime, String endTime, String month) {
399 List<Map<String, Object>> dataList = new ArrayList<>();
400 //获取数据采集pg数据库,实时数据获取统一从数据采集pg库获取
401 JdbcTemplate pgDB = (JdbcTemplate)SpringContextUtils.getBean("pg-db");
402 String countTableName = "a01a21a03_count";
403 //获取要查询的指标
404 String fieldSqlPart = "";
405 String[] fieldsArr = fields.split(",");
406 for (int i = 0; i < fieldsArr.length; ++i){
407 fieldSqlPart = fieldSqlPart + (",'"+fieldsArr[i]+"'");
408 }
409 if(!StringUtils.isEmpty(fieldSqlPart)) {
410 fieldSqlPart = fieldSqlPart.substring(1);
411 }
412 try{
413 String tsStartTime = String.valueOf(DateUtils.getMillis(DateUtils.parseDate(startTime, "yyyy-MM-dd HH:mm:ss"))/1000);
414 String tsEndTime = String.valueOf(DateUtils.getMillis(DateUtils.parseDate(endTime, "yyyy-MM-dd HH:mm:ss"))/1000);
415 String sql = "SELECT * FROM (" +
416 "SELECT nm, " +
417 " LEFT(TO_CHAR(TO_TIMESTAMP(CAST(ts AS INTEGER)), 'YYYY-MM-DD HH24:MI:SS'), 7) AS time, " +
418 " SUM(v::numeric) AS value " +
419 " FROM " + countTableName +
420 " WHERE nm in ("+fieldSqlPart+")" +
421 " AND type = 'def'" +
422 " AND ts >= ? AND ts < ? " +
423 " GROUP BY nm, time " +
424 " ORDER BY time" +
425 ") a " +
426 "WHERE RIGHT(a.time,2) = '"+month+"' ";
427 dataList = pgDB.queryForList(sql,tsStartTime,tsEndTime);
428 }catch (Exception e){
429 e.printStackTrace();
430 }
431 return dataList;
432 }
433
434 @Override
435 public List<Map<String, Object>> queryAotiCurveDataByYear(String fields, String startTime, String endTime) {
436 List<Map<String, Object>> dataList = new ArrayList<>();
437 //获取数据采集pg数据库,实时数据获取统一从数据采集pg库获取
438 JdbcTemplate pgDB = (JdbcTemplate)SpringContextUtils.getBean("pg-db");
439 String countTableName = "a01a21a03_count";
440 //获取要查询的指标
441 String fieldSqlPart = "";
442 String[] fieldsArr = fields.split(",");
443 for (int i = 0; i < fieldsArr.length; ++i){
444 fieldSqlPart = fieldSqlPart + (",'"+fieldsArr[i]+"'");
445 }
446 if(!StringUtils.isEmpty(fieldSqlPart)) {
447 fieldSqlPart = fieldSqlPart.substring(1);
448 }
449 try{
450 String tsStartTime = String.valueOf(DateUtils.getMillis(DateUtils.parseDate(startTime, "yyyy-MM-dd HH:mm:ss"))/1000);
451 String tsEndTime = String.valueOf(DateUtils.getMillis(DateUtils.parseDate(endTime, "yyyy-MM-dd HH:mm:ss"))/1000);
452 String sql = "SELECT nm, " +
453 " LEFT(TO_CHAR(TO_TIMESTAMP(CAST(ts AS INTEGER)), 'YYYY-MM-DD HH24:MI:SS'), 4) AS time, " +
454 " SUM(v::numeric) AS value " +
455 " FROM " + countTableName +
456 " WHERE nm in ("+fieldSqlPart+")" +
457 " AND type = 'def'" +
458 " AND ts >= ? AND ts < ? " +
459 " GROUP BY nm, time " +
460 " ORDER BY time";
461 dataList = pgDB.queryForList(sql,tsStartTime,tsEndTime);
462 }catch (Exception e){
463 e.printStackTrace();
464 }
465 return dataList;
466 }
396 } 467 }
......
...@@ -96,17 +96,17 @@ spring: ...@@ -96,17 +96,17 @@ spring:
96 username: jk_test 96 username: jk_test
97 password: Jk_test1211rw 97 password: Jk_test1211rw
98 driver-class-name: com.mysql.jdbc.Driver 98 driver-class-name: com.mysql.jdbc.Driver
99 # mysql-alarm: 99 mysql-alarm:
100 # url: jdbc:mysql://47.104.99.86:3306/intelligent-devices?characterEncoding=UTF-8&useUnicode=true&useSSL=false 100 url: jdbc:mysql://47.104.99.86:3306/intelligent-devices?characterEncoding=UTF-8&useUnicode=true&useSSL=false
101 # username: id_rw 101 username: id_rw
102 # password: s2eCvUEPO2Vk3U1w 102 password: s2eCvUEPO2Vk3U1w
103 # driver-class-name: com.mysql.jdbc.Driver 103 driver-class-name: com.mysql.jdbc.Driver
104 # # 多数据源配置 104 # 多数据源配置
105 # pg-db: 105 pg-db:
106 # url: jdbc:postgresql://47.104.99.86:10086/postgres?useUnicode=true&characterEncoding=UTF8 106 url: jdbc:postgresql://47.104.99.86:10086/postgres?useUnicode=true&characterEncoding=UTF8
107 # username: postgres 107 username: postgres
108 # password: JKjnf9713xt 108 password: JKjnf9713xt
109 # driver-class-name: org.postgresql.Driver 109 driver-class-name: org.postgresql.Driver
110 #redis 配置 110 #redis 配置
111 redis: 111 redis:
112 database: 0 112 database: 0
......
1 spring: 1 spring:
2 profiles: 2 profiles:
3 active: dev 3 active: prod
4 # 信息安全 4 # 信息安全
5 security: 5 security:
6 csrf: 6 csrf:
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!