31ce05c6 张雷

奥体项目接口修改

1 个父辈 b3aadc7d
1 package com.skua.modules.business.controller; 1 package com.skua.modules.business.controller;
2 2
3 import com.skua.core.api.vo.Result; 3 import com.skua.core.api.vo.Result;
4 import com.skua.modules.business.entity.WhatStructData;
4 import com.skua.modules.business.service.IOlympicCenterService; 5 import com.skua.modules.business.service.IOlympicCenterService;
5 import com.skua.modules.business.service.ISynthesizeService; 6 import com.skua.modules.business.service.ISynthesizeService;
6 import com.skua.modules.business.vo.*; 7 import com.skua.modules.business.vo.*;
...@@ -205,10 +206,10 @@ public class OlympicCenterController { ...@@ -205,10 +206,10 @@ public class OlympicCenterController {
205 206
206 @ApiOperation(value="获取历史报表数据", notes="获取历史报表数据") 207 @ApiOperation(value="获取历史报表数据", notes="获取历史报表数据")
207 @GetMapping(value = "/getHistoryReportData") 208 @GetMapping(value = "/getHistoryReportData")
208 public Result<List<Map<String,Object>>> getHistoryReportData(String dataType,String loction){ 209 public Result<List<Map<String,Object>>> getHistoryReportData(ReportParamsVO reportParamsVO){
209 Result<List<Map<String,Object>>> result = new Result<List<Map<String,Object>>>(); 210 Result<List<Map<String,Object>>> result = new Result<List<Map<String,Object>>>();
210 List<Map<String,Object>> list = new ArrayList<>(); 211 List<Map<String,Object>> list = new ArrayList<>();
211 list = olympicCenterService.getHistoryReportData(dataType, loction); 212 list = olympicCenterService.getHistoryReportData(reportParamsVO);
212 result.setResult(list); 213 result.setResult(list);
213 result.setSuccess(true); 214 result.setSuccess(true);
214 return result; 215 return result;
...@@ -226,11 +227,20 @@ public class OlympicCenterController { ...@@ -226,11 +227,20 @@ public class OlympicCenterController {
226 227
227 @ApiOperation(value="获取趋势图", notes="获取趋势图") 228 @ApiOperation(value="获取趋势图", notes="获取趋势图")
228 @GetMapping(value = "/getHistoryTrendsByDate") 229 @GetMapping(value = "/getHistoryTrendsByDate")
229 public Result<List<EchartResult>> getHistoryTrendsByDate(InputQueryParams inputQueryParams){ 230 public Result<Map<String,Object>> getHistoryTrendsByDate(InputQueryParams inputQueryParams){
230 Result<List<EchartResult>> result = new Result<List<EchartResult>>(); 231 Result<Map<String,Object>> result = new Result<Map<String,Object>>();
231 List<EchartResult> list = new ArrayList<EchartResult>(); 232 Map<String,Object> map = new HashMap<>();
232 list = olympicCenterService.getHistoryTrendsByDate(inputQueryParams); 233 map.put("list",new ArrayList<EchartResult>());
233 result.setResult(list); 234 map.put("name","--");
235 List<EchartResult> list = olympicCenterService.getHistoryTrendsByDate(inputQueryParams);
236 if(list.size()>0){
237 map.put("list", list);
238 }
239 WhatStructData whatStructData = olympicCenterService.getFieldNameById(inputQueryParams.getEquipId());
240 if(whatStructData!=null){
241 map.put("name", whatStructData.getMonitorName());
242 }
243 result.setResult(map);
234 result.setSuccess(true); 244 result.setSuccess(true);
235 return result; 245 return result;
236 } 246 }
......
1 package com.skua.modules.business.service; 1 package com.skua.modules.business.service;
2 2
3 import com.skua.modules.business.entity.WhatStructData;
3 import com.skua.modules.business.vo.*; 4 import com.skua.modules.business.vo.*;
4 5
5 import java.util.List; 6 import java.util.List;
...@@ -40,7 +41,7 @@ public interface IOlympicCenterService { ...@@ -40,7 +41,7 @@ public interface IOlympicCenterService {
40 41
41 List<Map<String, Object>> getHistoryReportClos(String dataType, String loction); 42 List<Map<String, Object>> getHistoryReportClos(String dataType, String loction);
42 43
43 List<Map<String, Object>> getHistoryReportData(String dataType, String loction); 44 List<Map<String, Object>> getHistoryReportData(ReportParamsVO reportParamsVO);
44 45
45 Map<String, Object> getPumpOrFlowChart(InputQueryParams inputQueryParams); 46 Map<String, Object> getPumpOrFlowChart(InputQueryParams inputQueryParams);
46 47
...@@ -57,4 +58,6 @@ public interface IOlympicCenterService { ...@@ -57,4 +58,6 @@ public interface IOlympicCenterService {
57 Map<String, Object> getYearMonthSumFlowGroup(SumFlowParams sumFlowParams); 58 Map<String, Object> getYearMonthSumFlowGroup(SumFlowParams sumFlowParams);
58 59
59 Map<String, Object> getYearSumFlowGroup(SumFlowParams sumFlowParams); 60 Map<String, Object> getYearSumFlowGroup(SumFlowParams sumFlowParams);
61
62 WhatStructData getFieldNameById(String equipId);
60 } 63 }
......
...@@ -1544,17 +1544,11 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -1544,17 +1544,11 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
1544 for (WhatStructData whatStructData : closList) { 1544 for (WhatStructData whatStructData : closList) {
1545 Map<String, Object> map = new HashMap<>(); 1545 Map<String, Object> map = new HashMap<>();
1546 map.put("field",whatStructData.getId()); 1546 map.put("field",whatStructData.getId());
1547 String str = ""; 1547 if(whatStructData.getMonitorName()==null){
1548 if("flow".equals(whatStructData.getEquipType())){ 1548 map.put("title",whatStructData.getId().replaceFirst("_RLJLL", "").replaceFirst("_LJLL", ""));
1549 str = "瞬时流量"; 1549 }else {
1550 }else if("flow_ljll".equals(whatStructData.getEquipType())){ 1550 map.put("title", whatStructData.getMonitorName() + "(" + whatStructData.getId().replaceFirst("_RLJLL", "").replaceFirst("_LJLL", "") + ")");
1551 str = "正向累计";
1552 }else if("flow_rljll".equals(whatStructData.getEquipType())){
1553 str = "反向累计";
1554 }else{
1555 str = "";
1556 } 1551 }
1557 map.put("title",whatStructData.getId().replaceFirst("_RLJLL", "").replaceFirst("_LJLL", "")+str);
1558 list.add(map); 1552 list.add(map);
1559 } 1553 }
1560 }else if("pressure".equals(dataType)){ 1554 }else if("pressure".equals(dataType)){
...@@ -1562,7 +1556,11 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -1562,7 +1556,11 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
1562 for (WhatStructData whatStructData : closList) { 1556 for (WhatStructData whatStructData : closList) {
1563 Map<String, Object> map = new HashMap<>(); 1557 Map<String, Object> map = new HashMap<>();
1564 map.put("field",whatStructData.getId()); 1558 map.put("field",whatStructData.getId());
1565 map.put("title",whatStructData.getId()); 1559 if(whatStructData.getMonitorName()==null){
1560 map.put("title", whatStructData.getId());
1561 }else {
1562 map.put("title", whatStructData.getMonitorName() + "(" + whatStructData.getId() + ")");
1563 }
1566 list.add(map); 1564 list.add(map);
1567 } 1565 }
1568 }else if("temperature".equals(dataType)){ 1566 }else if("temperature".equals(dataType)){
...@@ -1570,7 +1568,11 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -1570,7 +1568,11 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
1570 for (WhatStructData whatStructData : closList) { 1568 for (WhatStructData whatStructData : closList) {
1571 Map<String, Object> map = new HashMap<>(); 1569 Map<String, Object> map = new HashMap<>();
1572 map.put("field",whatStructData.getId()); 1570 map.put("field",whatStructData.getId());
1573 map.put("title",whatStructData.getId()); 1571 if(whatStructData.getMonitorName()==null){
1572 map.put("title", whatStructData.getId());
1573 }else {
1574 map.put("title",whatStructData.getMonitorName()+"("+whatStructData.getId()+")");
1575 }
1574 list.add(map); 1576 list.add(map);
1575 } 1577 }
1576 }else{ 1578 }else{
...@@ -1580,10 +1582,13 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -1580,10 +1582,13 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
1580 } 1582 }
1581 1583
1582 @Override 1584 @Override
1583 public List<Map<String, Object>> getHistoryReportData(String dataType, String loction) { 1585 public List<Map<String, Object>> getHistoryReportData(ReportParamsVO reportParamsVO) {
1584 List<Map<String, Object>> list = new ArrayList<>(); 1586 List<Map<String, Object>> list = new ArrayList<>();
1585 List<WhatStructData> closList = new ArrayList<>(); 1587 List<WhatStructData> closList = new ArrayList<>();
1586 Map<String, Object> monitorMap = new HashMap<>(); 1588 Map<String, Object> monitorMap = new HashMap<>();
1589 String dataType = reportParamsVO.getDataType();
1590 String loction = reportParamsVO.getLoction();
1591 String dataDate = "";
1587 if("flow".equals(dataType)){ 1592 if("flow".equals(dataType)){
1588 closList = whatStructDataMapper.getFlowList(loction); 1593 closList = whatStructDataMapper.getFlowList(loction);
1589 }else if("pressure".equals(dataType)){ 1594 }else if("pressure".equals(dataType)){
...@@ -1604,12 +1609,13 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -1604,12 +1609,13 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
1604 } 1609 }
1605 } 1610 }
1606 } 1611 }
1607 Calendar cal = Calendar.getInstance(); 1612 if(reportParamsVO.getDataDate()==null||"".equals(reportParamsVO.getDataDate())){
1608 cal.add(Calendar.DATE, -30); 1613 dataDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
1609 String startDate = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime()); 1614 }else{
1610 String start = startDate + " 00:00:00"; 1615 dataDate = reportParamsVO.getDataDate();
1611 String endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); 1616 }
1612 String end = endDate + " 23:59:59"; 1617 String start = dataDate + " 00:00:00";
1618 String end = dataDate + " 23:59:59";
1613 List<Map<String, Object>> dataList = factoryInfoService.queryReportData(AT_ID, pgField, start, end,"hour"); 1619 List<Map<String, Object>> dataList = factoryInfoService.queryReportData(AT_ID, pgField, start, end,"hour");
1614 for (Map<String, Object> map : dataList) { 1620 for (Map<String, Object> map : dataList) {
1615 Map<String, Object> newMap = new HashMap<>(); 1621 Map<String, Object> newMap = new HashMap<>();
...@@ -2830,6 +2836,13 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -2830,6 +2836,13 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
2830 return map; 2836 return map;
2831 } 2837 }
2832 2838
2839 @Override
2840 public WhatStructData getFieldNameById(String equipId) {
2841 WhatStructData whatStructData = new WhatStructData();
2842 whatStructData = whatStructDataMapper.getOneById(equipId);
2843 return whatStructData;
2844 }
2845
2833 //遍历两个年份之间的年份 2846 //遍历两个年份之间的年份
2834 private static String[] getYearsArray(String startYear, String endYear) { 2847 private static String[] getYearsArray(String startYear, String endYear) {
2835 int length = Integer.parseInt(endYear) - Integer.parseInt(startYear) + 1; 2848 int length = Integer.parseInt(endYear) - Integer.parseInt(startYear) + 1;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!