9873efc0 张雷

奥体项目数据报表时间修改

1 个父辈 2aa800a1
......@@ -193,4 +193,15 @@ public class OlympicCenterController {
return result;
}
@ApiOperation(value="获取历史报表数据", notes="获取历史报表数据")
@GetMapping(value = "/getHistoryReportData")
public Result<List<Map<String,Object>>> getHistoryReportData(String dataType,String loction){
Result<List<Map<String,Object>>> result = new Result<List<Map<String,Object>>>();
List<Map<String,Object>> list = new ArrayList<>();
list = olympicCenterService.getHistoryReportData(dataType, loction);
result.setResult(list);
result.setSuccess(true);
return result;
}
}
......
......@@ -37,4 +37,6 @@ public interface IOlympicCenterService {
List<Map<String, Object>> getPumpRealTimeReport(String sourceType);
List<Map<String, Object>> getHistoryReportClos(String dataType, String loction);
List<Map<String, Object>> getHistoryReportData(String dataType, String loction);
}
......
......@@ -1306,6 +1306,52 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
return list;
}
@Override
public List<Map<String, Object>> getHistoryReportData(String dataType, String loction) {
List<Map<String, Object>> list = new ArrayList<>();
List<WhatStructData> closList = new ArrayList<>();
Map<String, Object> monitorMap = new HashMap<>();
if("flow".equals(dataType)){
closList = whatStructDataMapper.getFlowList(loction);
}else if("pressure".equals(dataType)){
closList = whatStructDataMapper.getPressureList(loction);
}else if("temperature".equals(dataType)){
closList = whatStructDataMapper.getTemperatureList(loction);
}else{
return list;
}
String pgField = "";
if(closList.size() == 0){
return list;
}else{
for (WhatStructData whatStructData:closList) {
pgField = pgField +","+whatStructData.getMonitorId();
if(whatStructData.getMonitorId()!=null){
monitorMap.put(whatStructData.getMonitorId(),whatStructData.getId());
}
}
}
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";
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<>();
for (Map.Entry<String, Object> entry : map.entrySet()) {
if("time".equals(entry.getKey())){
newMap.put(entry.getKey(),entry.getValue());
}else {
newMap.put(monitorMap.get(entry.getKey()).toString(),entry.getValue());
}
}
list.add(newMap);
}
return list;
}
private String getStatus1(Map<String, Object> map, List<Map<String, Object>> list, String pumpId) {
String status = "停止";
Map<String, Object> bean = list.get(0);
......
......@@ -12,4 +12,17 @@ public interface IFmPgQueryService {
List<Map<String, Object>> queryMonitorForReport(String factoryId, String fields);
/**
*
* @param departId 厂区编号
* @param fields 要获取的字段集合,字段间以逗号分隔,例如 a,b,c
* @param startTime 开始时间 当传入""的时候,获取time最大的一条记录
* @param endTime 结束时间 当传入""的时候,获取time最大的一条记录
* @param tableType 表类型 0实时 1计算
* @return
*/
public List<Map<String,Object>> queryFactoryInfos(String departId,String fields,String startTime,String endTime,String tableType);
public List<Map<String, Object>> queryReportData(String departId,String fields,String startTime,String endTime,String reportType);
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!