奥体项目数据报表时间修改
正在显示
5 个修改的文件
包含
72 行增加
和
0 行删除
... | @@ -193,4 +193,15 @@ public class OlympicCenterController { | ... | @@ -193,4 +193,15 @@ public class OlympicCenterController { |
193 | return result; | 193 | return result; |
194 | } | 194 | } |
195 | 195 | ||
196 | @ApiOperation(value="获取历史报表数据", notes="获取历史报表数据") | ||
197 | @GetMapping(value = "/getHistoryReportData") | ||
198 | public Result<List<Map<String,Object>>> getHistoryReportData(String dataType,String loction){ | ||
199 | Result<List<Map<String,Object>>> result = new Result<List<Map<String,Object>>>(); | ||
200 | List<Map<String,Object>> list = new ArrayList<>(); | ||
201 | list = olympicCenterService.getHistoryReportData(dataType, loction); | ||
202 | result.setResult(list); | ||
203 | result.setSuccess(true); | ||
204 | return result; | ||
205 | } | ||
206 | |||
196 | } | 207 | } | ... | ... |
... | @@ -37,4 +37,6 @@ public interface IOlympicCenterService { | ... | @@ -37,4 +37,6 @@ public interface IOlympicCenterService { |
37 | List<Map<String, Object>> getPumpRealTimeReport(String sourceType); | 37 | List<Map<String, Object>> getPumpRealTimeReport(String sourceType); |
38 | 38 | ||
39 | List<Map<String, Object>> getHistoryReportClos(String dataType, String loction); | 39 | List<Map<String, Object>> getHistoryReportClos(String dataType, String loction); |
40 | |||
41 | List<Map<String, Object>> getHistoryReportData(String dataType, String loction); | ||
40 | } | 42 | } | ... | ... |
... | @@ -1306,6 +1306,52 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { | ... | @@ -1306,6 +1306,52 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { |
1306 | return list; | 1306 | return list; |
1307 | } | 1307 | } |
1308 | 1308 | ||
1309 | @Override | ||
1310 | public List<Map<String, Object>> getHistoryReportData(String dataType, String loction) { | ||
1311 | List<Map<String, Object>> list = new ArrayList<>(); | ||
1312 | List<WhatStructData> closList = new ArrayList<>(); | ||
1313 | Map<String, Object> monitorMap = new HashMap<>(); | ||
1314 | if("flow".equals(dataType)){ | ||
1315 | closList = whatStructDataMapper.getFlowList(loction); | ||
1316 | }else if("pressure".equals(dataType)){ | ||
1317 | closList = whatStructDataMapper.getPressureList(loction); | ||
1318 | }else if("temperature".equals(dataType)){ | ||
1319 | closList = whatStructDataMapper.getTemperatureList(loction); | ||
1320 | }else{ | ||
1321 | return list; | ||
1322 | } | ||
1323 | String pgField = ""; | ||
1324 | if(closList.size() == 0){ | ||
1325 | return list; | ||
1326 | }else{ | ||
1327 | for (WhatStructData whatStructData:closList) { | ||
1328 | pgField = pgField +","+whatStructData.getMonitorId(); | ||
1329 | if(whatStructData.getMonitorId()!=null){ | ||
1330 | monitorMap.put(whatStructData.getMonitorId(),whatStructData.getId()); | ||
1331 | } | ||
1332 | } | ||
1333 | } | ||
1334 | Calendar cal = Calendar.getInstance(); | ||
1335 | cal.add(Calendar.DATE, -30); | ||
1336 | String startDate = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime()); | ||
1337 | String start = startDate + " 00:00:00"; | ||
1338 | String endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | ||
1339 | String end = endDate + " 23:59:59"; | ||
1340 | List<Map<String, Object>> dataList = factoryInfoService.queryReportData(AT_ID, pgField, start, end,"hour"); | ||
1341 | for (Map<String, Object> map : dataList) { | ||
1342 | Map<String, Object> newMap = new HashMap<>(); | ||
1343 | for (Map.Entry<String, Object> entry : map.entrySet()) { | ||
1344 | if("time".equals(entry.getKey())){ | ||
1345 | newMap.put(entry.getKey(),entry.getValue()); | ||
1346 | }else { | ||
1347 | newMap.put(monitorMap.get(entry.getKey()).toString(),entry.getValue()); | ||
1348 | } | ||
1349 | } | ||
1350 | list.add(newMap); | ||
1351 | } | ||
1352 | return list; | ||
1353 | } | ||
1354 | |||
1309 | private String getStatus1(Map<String, Object> map, List<Map<String, Object>> list, String pumpId) { | 1355 | private String getStatus1(Map<String, Object> map, List<Map<String, Object>> list, String pumpId) { |
1310 | String status = "停止"; | 1356 | String status = "停止"; |
1311 | Map<String, Object> bean = list.get(0); | 1357 | Map<String, Object> bean = list.get(0); | ... | ... |
... | @@ -12,4 +12,17 @@ public interface IFmPgQueryService { | ... | @@ -12,4 +12,17 @@ public interface IFmPgQueryService { |
12 | 12 | ||
13 | List<Map<String, Object>> queryMonitorForReport(String factoryId, String fields); | 13 | List<Map<String, Object>> queryMonitorForReport(String factoryId, String fields); |
14 | 14 | ||
15 | /** | ||
16 | * | ||
17 | * @param departId 厂区编号 | ||
18 | * @param fields 要获取的字段集合,字段间以逗号分隔,例如 a,b,c | ||
19 | * @param startTime 开始时间 当传入""的时候,获取time最大的一条记录 | ||
20 | * @param endTime 结束时间 当传入""的时候,获取time最大的一条记录 | ||
21 | * @param tableType 表类型 0实时 1计算 | ||
22 | * @return | ||
23 | */ | ||
24 | public List<Map<String,Object>> queryFactoryInfos(String departId,String fields,String startTime,String endTime,String tableType); | ||
25 | |||
26 | public List<Map<String, Object>> queryReportData(String departId,String fields,String startTime,String endTime,String reportType); | ||
27 | |||
15 | } | 28 | } | ... | ... |
-
请 注册 或 登录 后发表评论