31ce05c6 张雷

奥体项目接口修改

1 个父辈 b3aadc7d
package com.skua.modules.business.controller;
import com.skua.core.api.vo.Result;
import com.skua.modules.business.entity.WhatStructData;
import com.skua.modules.business.service.IOlympicCenterService;
import com.skua.modules.business.service.ISynthesizeService;
import com.skua.modules.business.vo.*;
......@@ -205,10 +206,10 @@ public class OlympicCenterController {
@ApiOperation(value="获取历史报表数据", notes="获取历史报表数据")
@GetMapping(value = "/getHistoryReportData")
public Result<List<Map<String,Object>>> getHistoryReportData(String dataType,String loction){
public Result<List<Map<String,Object>>> getHistoryReportData(ReportParamsVO reportParamsVO){
Result<List<Map<String,Object>>> result = new Result<List<Map<String,Object>>>();
List<Map<String,Object>> list = new ArrayList<>();
list = olympicCenterService.getHistoryReportData(dataType, loction);
list = olympicCenterService.getHistoryReportData(reportParamsVO);
result.setResult(list);
result.setSuccess(true);
return result;
......@@ -226,11 +227,20 @@ public class OlympicCenterController {
@ApiOperation(value="获取趋势图", notes="获取趋势图")
@GetMapping(value = "/getHistoryTrendsByDate")
public Result<List<EchartResult>> getHistoryTrendsByDate(InputQueryParams inputQueryParams){
Result<List<EchartResult>> result = new Result<List<EchartResult>>();
List<EchartResult> list = new ArrayList<EchartResult>();
list = olympicCenterService.getHistoryTrendsByDate(inputQueryParams);
result.setResult(list);
public Result<Map<String,Object>> getHistoryTrendsByDate(InputQueryParams inputQueryParams){
Result<Map<String,Object>> result = new Result<Map<String,Object>>();
Map<String,Object> map = new HashMap<>();
map.put("list",new ArrayList<EchartResult>());
map.put("name","--");
List<EchartResult> list = olympicCenterService.getHistoryTrendsByDate(inputQueryParams);
if(list.size()>0){
map.put("list", list);
}
WhatStructData whatStructData = olympicCenterService.getFieldNameById(inputQueryParams.getEquipId());
if(whatStructData!=null){
map.put("name", whatStructData.getMonitorName());
}
result.setResult(map);
result.setSuccess(true);
return result;
}
......
package com.skua.modules.business.service;
import com.skua.modules.business.entity.WhatStructData;
import com.skua.modules.business.vo.*;
import java.util.List;
......@@ -40,7 +41,7 @@ public interface IOlympicCenterService {
List<Map<String, Object>> getHistoryReportClos(String dataType, String loction);
List<Map<String, Object>> getHistoryReportData(String dataType, String loction);
List<Map<String, Object>> getHistoryReportData(ReportParamsVO reportParamsVO);
Map<String, Object> getPumpOrFlowChart(InputQueryParams inputQueryParams);
......@@ -57,4 +58,6 @@ public interface IOlympicCenterService {
Map<String, Object> getYearMonthSumFlowGroup(SumFlowParams sumFlowParams);
Map<String, Object> getYearSumFlowGroup(SumFlowParams sumFlowParams);
WhatStructData getFieldNameById(String equipId);
}
......
......@@ -1544,17 +1544,11 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
for (WhatStructData whatStructData : closList) {
Map<String, Object> map = new HashMap<>();
map.put("field",whatStructData.getId());
String str = "";
if("flow".equals(whatStructData.getEquipType())){
str = "瞬时流量";
}else if("flow_ljll".equals(whatStructData.getEquipType())){
str = "正向累计";
}else if("flow_rljll".equals(whatStructData.getEquipType())){
str = "反向累计";
}else{
str = "";
if(whatStructData.getMonitorName()==null){
map.put("title",whatStructData.getId().replaceFirst("_RLJLL", "").replaceFirst("_LJLL", ""));
}else {
map.put("title", whatStructData.getMonitorName() + "(" + whatStructData.getId().replaceFirst("_RLJLL", "").replaceFirst("_LJLL", "") + ")");
}
map.put("title",whatStructData.getId().replaceFirst("_RLJLL", "").replaceFirst("_LJLL", "")+str);
list.add(map);
}
}else if("pressure".equals(dataType)){
......@@ -1562,7 +1556,11 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
for (WhatStructData whatStructData : closList) {
Map<String, Object> map = new HashMap<>();
map.put("field",whatStructData.getId());
map.put("title",whatStructData.getId());
if(whatStructData.getMonitorName()==null){
map.put("title", whatStructData.getId());
}else {
map.put("title", whatStructData.getMonitorName() + "(" + whatStructData.getId() + ")");
}
list.add(map);
}
}else if("temperature".equals(dataType)){
......@@ -1570,7 +1568,11 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
for (WhatStructData whatStructData : closList) {
Map<String, Object> map = new HashMap<>();
map.put("field",whatStructData.getId());
map.put("title",whatStructData.getId());
if(whatStructData.getMonitorName()==null){
map.put("title", whatStructData.getId());
}else {
map.put("title",whatStructData.getMonitorName()+"("+whatStructData.getId()+")");
}
list.add(map);
}
}else{
......@@ -1580,10 +1582,13 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
@Override
public List<Map<String, Object>> getHistoryReportData(String dataType, String loction) {
public List<Map<String, Object>> getHistoryReportData(ReportParamsVO reportParamsVO) {
List<Map<String, Object>> list = new ArrayList<>();
List<WhatStructData> closList = new ArrayList<>();
Map<String, Object> monitorMap = new HashMap<>();
String dataType = reportParamsVO.getDataType();
String loction = reportParamsVO.getLoction();
String dataDate = "";
if("flow".equals(dataType)){
closList = whatStructDataMapper.getFlowList(loction);
}else if("pressure".equals(dataType)){
......@@ -1604,12 +1609,13 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
}
}
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -30);
String startDate = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime());
String start = startDate + " 00:00:00";
String endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
String end = endDate + " 23:59:59";
if(reportParamsVO.getDataDate()==null||"".equals(reportParamsVO.getDataDate())){
dataDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
}else{
dataDate = reportParamsVO.getDataDate();
}
String start = dataDate + " 00:00:00";
String end = dataDate + " 23:59:59";
List<Map<String, Object>> dataList = factoryInfoService.queryReportData(AT_ID, pgField, start, end,"hour");
for (Map<String, Object> map : dataList) {
Map<String, Object> newMap = new HashMap<>();
......@@ -2830,6 +2836,13 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
return map;
}
@Override
public WhatStructData getFieldNameById(String equipId) {
WhatStructData whatStructData = new WhatStructData();
whatStructData = whatStructDataMapper.getOneById(equipId);
return whatStructData;
}
//遍历两个年份之间的年份
private static String[] getYearsArray(String startYear, String endYear) {
int length = Integer.parseInt(endYear) - Integer.parseInt(startYear) + 1;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!