|
|
|
@ -5,6 +5,12 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
|
|
|
|
import com.ruoyi.common.annotation.Excel;
|
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
|
|
import com.ruoyi.system.domain.BaseSensorInfo;
|
|
|
|
|
import com.ruoyi.system.domain.BaseSensorType;
|
|
|
|
|
import com.ruoyi.system.domain.dto.BaseSensorInfoDto;
|
|
|
|
|
import com.ruoyi.system.service.IBaseSensorInfoService;
|
|
|
|
|
import com.ruoyi.system.service.IBaseSensorTypeService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
@ -28,7 +34,11 @@ import java.util.UUID;
|
|
|
|
|
@RequestMapping("/iot/sensorSummary")
|
|
|
|
|
public class SensorSummaryController extends BaseController {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IBaseSensorTypeService baseSensorTypeService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IBaseSensorInfoService baseSensorInfoService;
|
|
|
|
|
|
|
|
|
|
@GetMapping()
|
|
|
|
|
public String sensorSummary()
|
|
|
|
@ -36,24 +46,38 @@ public class SensorSummaryController extends BaseController {
|
|
|
|
|
return "iot-ui/sensorSummary";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/getSensorType")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public String getSensorType(){
|
|
|
|
|
List<BaseSensorType> baseSensorTypeList = baseSensorTypeService.selectBaseSensorTypeList(new BaseSensorType(null,null,0L));
|
|
|
|
|
|
|
|
|
|
return JSONArray.toJSONString(baseSensorTypeList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/getSensorInfo")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public String getSensorInfo(){
|
|
|
|
|
public String getSensorInfo(String sensorTypeId){
|
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
|
|
|
|
List<BaseSensorInfoDto> baseSensorInfoDtos = baseSensorInfoService.selectBaseSensorInfoList(new BaseSensorInfo(sensorTypeId, 0L));
|
|
|
|
|
|
|
|
|
|
List<sensorTableModel> sensorTableModelList = new ArrayList<>();
|
|
|
|
|
for (int i =1;i<24;i++){
|
|
|
|
|
for (int i =1;i<baseSensorInfoDtos.size();i++){
|
|
|
|
|
sensorTableModel sensor = new sensorTableModel();
|
|
|
|
|
sensor.setId(i);
|
|
|
|
|
sensor.setEdgeId(UUID.randomUUID().toString().substring(0,8));
|
|
|
|
|
sensor.setSensorId(UUID.randomUUID().toString().substring(0,8));
|
|
|
|
|
sensor.setEdgeId(baseSensorInfoDtos.get(i).getEdgeId());
|
|
|
|
|
sensor.setSensorId(baseSensorInfoDtos.get(i).getSensorId());
|
|
|
|
|
|
|
|
|
|
//生成随机数,带两位小数
|
|
|
|
|
double a=Math.random()*10;
|
|
|
|
|
DecimalFormat df = new DecimalFormat( "0.00" );
|
|
|
|
|
String str=df.format( a );
|
|
|
|
|
sensor.setSensorData(new BigDecimal(str));
|
|
|
|
|
|
|
|
|
|
sensor.setRssi(new BigDecimal(str));
|
|
|
|
|
|
|
|
|
|
sensor.setCollectTime(simpleDateFormat.format(new Date()));
|
|
|
|
|
sensor.setMonitorLocation(i+"#监控点");
|
|
|
|
|
sensor.setMonitorLocation(baseSensorInfoDtos.get(i).getSensorLocation());
|
|
|
|
|
sensorTableModelList.add(sensor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|