2aa800a1 张雷

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

1 个父辈 d07e8068
......@@ -182,4 +182,15 @@ public class OlympicCenterController {
return result;
}
@ApiOperation(value="获取历史数据表头", notes="获取历史数据表头")
@GetMapping(value = "/getHistoryReportClos")
public Result<List<Map<String,Object>>> getHistoryReportClos(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.getHistoryReportClos(dataType, loction);
result.setResult(list);
result.setSuccess(true);
return result;
}
}
......
......@@ -35,4 +35,6 @@ public interface IOlympicCenterService {
Map<String, Object> getPumpRealTimeData(String sourceType, String pumpId);
List<Map<String, Object>> getPumpRealTimeReport(String sourceType);
List<Map<String, Object>> getHistoryReportClos(String dataType, String loction);
}
......
......@@ -425,22 +425,22 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
return list;
}
public static void main(String[] args) throws ParseException {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
String start = "2023-04-01";
String end = "2023-04-24";
Long startTime = df.parse(start).getTime();
Long endTime = df.parse(end).getTime();
Long oneDay = 1000 * 60 * 60 * 24l;
Long time = startTime;
while (time <= endTime) {
Date d = new Date(time);
System.out.println(df.format(d));
time += oneDay;
}
}
// public static void main(String[] args) throws ParseException {
// DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
// String start = "2023-04-01";
// String end = "2023-04-24";
//
// Long startTime = df.parse(start).getTime();
// Long endTime = df.parse(end).getTime();
// Long oneDay = 1000 * 60 * 60 * 24l;
//
// Long time = startTime;
// while (time <= endTime) {
// Date d = new Date(time);
// System.out.println(df.format(d));
// time += oneDay;
// }
// }
@Override
public Map<String, Object> getBzRealTimeData(String sourceType) {
......@@ -1047,6 +1047,19 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
return list;
}
//时间戳转时间字符串
private String timeStampToDateStr(Object time) {
SimpleDateFormat sdf=new SimpleDateFormat("MM-dd HH:mm");
if(time==null){
return "";
}else{
long timeStamp = Long.parseLong(time.toString()+"000");
// 时间戳转换成时间
String sd = sdf.format(new Date(timeStamp));
return sd;
}
}
@Override
public List<Map<String, Object>> getRealTimeReport(String dataType, String loction) {
List<Map<String, Object>> list = new ArrayList<>();
......@@ -1101,7 +1114,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
map.put("flow_rljll","");
for (Map<String, Object> mMap : monitorList ) {
if(whatStructData.getId().equals(mMap.get("equipId"))){
map.put("time",mMap.get("time"));
map.put("time",timeStampToDateStr(mMap.get("time")));
if("flow".equals(mMap.get("equipType"))){
map.put("flow",mMap.get("monitorvalue"));
}else if("flow_ljll".equals(mMap.get("equipType"))){
......@@ -1125,7 +1138,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
for (Map<String, Object> mMap : monitorList ) {
if(whatStructData.getMonitorId()!=null){
if(whatStructData.getMonitorId().equals(mMap.get("monitorid"))){
map.put("time",mMap.get("time"));
map.put("time",timeStampToDateStr(mMap.get("time")));
map.put("value",formatDouble(Double.parseDouble(mMap.get("monitorvalue").toString())*Double.parseDouble(whatStructData.getMonitorZoom())));
}
}else{
......@@ -1249,6 +1262,50 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
return list;
}
@Override
public List<Map<String, Object>> getHistoryReportClos(String dataType, String loction) {
List<Map<String, Object>> list = new ArrayList<>();
List<WhatStructData> closList = new ArrayList<>();
if("flow".equals(dataType)){
closList = whatStructDataMapper.getFlowList(loction);
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 = "";
}
map.put("title",whatStructData.getId().replaceFirst("_RLJLL", "").replaceFirst("_LJLL", "")+str);
list.add(map);
}
}else if("pressure".equals(dataType)){
closList = whatStructDataMapper.getPressureList(loction);
for (WhatStructData whatStructData : closList) {
Map<String, Object> map = new HashMap<>();
map.put("field",whatStructData.getId());
map.put("title",whatStructData.getId());
list.add(map);
}
}else if("temperature".equals(dataType)){
closList = whatStructDataMapper.getTemperatureList(loction);
for (WhatStructData whatStructData : closList) {
Map<String, Object> map = new HashMap<>();
map.put("field",whatStructData.getId());
map.put("title",whatStructData.getId());
list.add(map);
}
}else{
return list;
}
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);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!