|
|
@ -1,11 +1,15 @@
|
|
|
|
package com.os.ems.record.controller;
|
|
|
|
package com.os.ems.record.controller;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
|
|
|
|
|
import com.os.common.utils.StringUtils;
|
|
|
|
import com.os.ems.base.service.IEmsBaseEnergyTypeService;
|
|
|
|
import com.os.ems.base.service.IEmsBaseEnergyTypeService;
|
|
|
|
import com.os.ems.base.service.IEmsBaseMonitorInfoService;
|
|
|
|
import com.os.ems.base.service.IEmsBaseMonitorInfoService;
|
|
|
|
import com.os.ems.record.domain.EmsIOTData;
|
|
|
|
import com.os.ems.record.domain.EmsIOTData;
|
|
|
|
|
|
|
|
import com.os.ems.record.domain.EmsIOTInstantMonitorData;
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
@ -42,6 +46,8 @@ public class TWTempertureDataController extends BaseController
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private IEmsBaseEnergyTypeService emsBaseEnergyTypeService;
|
|
|
|
private IEmsBaseEnergyTypeService emsBaseEnergyTypeService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 查询物联网实时数据列表
|
|
|
|
* 查询物联网实时数据列表
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -81,6 +87,44 @@ public class TWTempertureDataController extends BaseController
|
|
|
|
return success(emsIOTData);
|
|
|
|
return success(emsIOTData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 查询物联网设备实时监控数据
|
|
|
|
|
|
|
|
* @param monitorCodeList
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@GetMapping("/iotInstantMonitoring")
|
|
|
|
|
|
|
|
public AjaxResult iotInstantMonitoring(String monitorCodeList){
|
|
|
|
|
|
|
|
List<TWTempertureData> list = new ArrayList<TWTempertureData>();
|
|
|
|
|
|
|
|
if(StringUtils.isNotEmpty(monitorCodeList)){
|
|
|
|
|
|
|
|
String[] split = monitorCodeList.split(",");
|
|
|
|
|
|
|
|
for (String monitorId : split) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TWTempertureData tWTempertureData = new TWTempertureData();
|
|
|
|
|
|
|
|
tWTempertureData.setMonitorId(monitorId);
|
|
|
|
|
|
|
|
Map<String,Object> params = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
|
|
|
|
|
calendar.add(Calendar.MINUTE,-5);
|
|
|
|
|
|
|
|
Calendar startTime = (Calendar) calendar.clone();
|
|
|
|
|
|
|
|
params.put("beginRecordTime",sdf.format(startTime.getTime()));
|
|
|
|
|
|
|
|
params.put("endRecordTime",sdf.format(new Date()));
|
|
|
|
|
|
|
|
tWTempertureData.setParams(params);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<TWTempertureData> twTempertureData = tWTempertureDataService.selectIotInstantList(tWTempertureData);
|
|
|
|
|
|
|
|
if(twTempertureData.size()>0){
|
|
|
|
|
|
|
|
Optional<TWTempertureData> first = twTempertureData.stream().sorted(Comparator.comparing(TWTempertureData::getRecodeTime)).findFirst();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
list.add(first.get());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println(JSONArray.toJSONString(list));
|
|
|
|
|
|
|
|
return success(list);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 导出物联网实时数据列表
|
|
|
|
* 导出物联网实时数据列表
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|