|
@@ -4,19 +4,10 @@ import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
|
-import com.ruoyi.data.domain.DataPointUnit;
|
|
|
|
|
-import com.ruoyi.data.domain.DeviceDataPoint;
|
|
|
|
|
-import com.ruoyi.data.domain.GateWayDevice;
|
|
|
|
|
-import com.ruoyi.data.domain.bo.TblEquipmentBo;
|
|
|
|
|
-import com.ruoyi.data.domain.bo.TblGatewayBo;
|
|
|
|
|
-import com.ruoyi.data.domain.bo.TblGatewayEquipmentBo;
|
|
|
|
|
-import com.ruoyi.data.domain.vo.TblEquipmentVo;
|
|
|
|
|
-import com.ruoyi.data.domain.vo.TblGatewayEquipmentVo;
|
|
|
|
|
-import com.ruoyi.data.domain.vo.TblGatewayVo;
|
|
|
|
|
-import com.ruoyi.data.service.ITblDatapointService;
|
|
|
|
|
-import com.ruoyi.data.service.ITblEquipmentService;
|
|
|
|
|
-import com.ruoyi.data.service.ITblGatewayEquipmentService;
|
|
|
|
|
-import com.ruoyi.data.service.ITblGatewayService;
|
|
|
|
|
|
|
+import com.ruoyi.data.domain.*;
|
|
|
|
|
+import com.ruoyi.data.domain.bo.*;
|
|
|
|
|
+import com.ruoyi.data.domain.vo.*;
|
|
|
|
|
+import com.ruoyi.data.service.*;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -45,53 +36,78 @@ public class TblDataController extends BaseController {
|
|
|
|
|
|
|
|
private final ITblGatewayEquipmentService iTblGatewayEquipmentService;
|
|
private final ITblGatewayEquipmentService iTblGatewayEquipmentService;
|
|
|
|
|
|
|
|
|
|
+ private final ITblSensorService iTblSensorService;
|
|
|
|
|
+
|
|
|
|
|
+ private final ITblUnitService iTblUnitService;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 查询网关设备列表
|
|
* 查询网关设备列表
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/deviceList")
|
|
@GetMapping("/deviceList")
|
|
|
- public TableDataInfo<GateWayDevice> list(TblEquipmentBo bo, PageQuery pageQuery) {
|
|
|
|
|
- TableDataInfo<GateWayDevice> obj= new TableDataInfo<GateWayDevice>();
|
|
|
|
|
|
|
+ public TableDataInfo<GateWaySensor> list(TblEquipmentBo bo, PageQuery pageQuery) {
|
|
|
|
|
+ TableDataInfo<GateWaySensor> obj = new TableDataInfo<GateWaySensor>();
|
|
|
|
|
+ TblGatewayBo tblGatewayBo = new TblGatewayBo();
|
|
|
|
|
+ List<TblGatewayVo> gatewayVoList = iTblGatewayService.queryList(tblGatewayBo);
|
|
|
TblEquipmentBo tblEquipmentBo = new TblEquipmentBo();
|
|
TblEquipmentBo tblEquipmentBo = new TblEquipmentBo();
|
|
|
- List<TblEquipmentVo> tblEquipmentVoList = iTblEquipmentService.queryList(tblEquipmentBo);
|
|
|
|
|
- DataPointUnit dataPointUnitBo = new DataPointUnit();
|
|
|
|
|
- List<DataPointUnit> dataPointUnitList = iTblDatapointService.getDataPointList(dataPointUnitBo);
|
|
|
|
|
- List<DeviceDataPoint> deviceDataPoints = new ArrayList<DeviceDataPoint>();
|
|
|
|
|
- for(TblEquipmentVo tblEquipmentVo:tblEquipmentVoList){
|
|
|
|
|
- DeviceDataPoint deviceDataPoint = new DeviceDataPoint();
|
|
|
|
|
- deviceDataPoint.setDevice(tblEquipmentVo);
|
|
|
|
|
- List<DataPointUnit> dataPointUnits = new ArrayList<DataPointUnit>();
|
|
|
|
|
- for(DataPointUnit dataPointUnit:dataPointUnitList){
|
|
|
|
|
- if(tblEquipmentVo.getId() == dataPointUnit.getDeviceId()){
|
|
|
|
|
- dataPointUnits.add(dataPointUnit);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ List<GateWaySensor> gateWaySensorList = new ArrayList<GateWaySensor>();
|
|
|
|
|
+ List<TblEquipmentVo> equipmentVoList = iTblEquipmentService.queryList(tblEquipmentBo);
|
|
|
|
|
+ List<SensorPoint> sensorPointList = getSensorPointList();
|
|
|
|
|
+ for(TblGatewayVo tblGatewayVo:gatewayVoList){
|
|
|
|
|
+ GateWaySensor gateWaySensor = new GateWaySensor();
|
|
|
|
|
+ gateWaySensor.setTblGateway(tblGatewayVo);
|
|
|
|
|
+ List<SensorPoint> sensorPoints = new ArrayList<SensorPoint>();
|
|
|
|
|
+ for(TblEquipmentVo tblEquipmentvo:equipmentVoList){
|
|
|
|
|
+ if(tblEquipmentvo.getGatewayId() == tblGatewayVo.getId()){
|
|
|
|
|
+ for(SensorPoint sensorPoint:sensorPointList){
|
|
|
|
|
+ if(sensorPoint.getTblSensorVo().getDeviceId() == tblEquipmentvo.getId()){
|
|
|
|
|
+ sensorPoints.add(sensorPoint);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ gateWaySensor.setSensorPointList(sensorPoints);
|
|
|
|
|
+ gateWaySensorList.add(gateWaySensor);
|
|
|
|
|
+ }
|
|
|
|
|
+ obj.setRows(gateWaySensorList);
|
|
|
|
|
+ return obj;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private List<SensorPoint> getSensorPointList(){
|
|
|
|
|
+ List<SensorPoint> list = new ArrayList<>();
|
|
|
|
|
+ List<PointUnit> pointUnitlist = new ArrayList<>();
|
|
|
|
|
+ TblSensorBo sensorBo = new TblSensorBo();
|
|
|
|
|
+ List<TblSensorVo> tblSeneorVoList = iTblSensorService.queryList(sensorBo);
|
|
|
|
|
+ TblDatapointBo tblDatapointBo = new TblDatapointBo();
|
|
|
|
|
+ List<TblDatapointVo> tblDatapointVoList = iTblDatapointService.queryList(tblDatapointBo);
|
|
|
|
|
+ TblUnitBo tblUnitBo = new TblUnitBo();
|
|
|
|
|
+ List<TblUnitVo> tblUnitVoList = iTblUnitService.queryList(tblUnitBo);
|
|
|
|
|
+ for(TblDatapointVo tblDatapointVo:tblDatapointVoList){
|
|
|
|
|
+ PointUnit pointUnit= new PointUnit();
|
|
|
|
|
+ pointUnit.setPointInfo(tblDatapointVo);
|
|
|
|
|
+ for(TblUnitVo tblUnitVo:tblUnitVoList){
|
|
|
|
|
+ if(tblDatapointVo.getDataType() == tblUnitVo.getId()){
|
|
|
|
|
+ pointUnit.setUnitName(tblUnitVo.getUnitName());
|
|
|
|
|
+ pointUnit.setUnitType(tblUnitVo.getUnitType());
|
|
|
|
|
+ pointUnit.setUnitSymbol(tblUnitVo.getUnitSymbol());
|
|
|
|
|
+ pointUnit.setName(tblDatapointVo.getValueType());
|
|
|
|
|
+ pointUnitlist.add(pointUnit);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- deviceDataPoint.setDataPointUnitList(dataPointUnits);
|
|
|
|
|
- deviceDataPoints.add(deviceDataPoint);
|
|
|
|
|
}
|
|
}
|
|
|
- TblGatewayBo tblGatewayBo = new TblGatewayBo();
|
|
|
|
|
- List<TblGatewayVo> tblGatewayVoList = iTblGatewayService.queryList(tblGatewayBo);
|
|
|
|
|
- TblGatewayEquipmentBo tblGatewayEquipmentBo = new TblGatewayEquipmentBo();
|
|
|
|
|
- List<TblGatewayEquipmentVo> tblGatewayEquipmentVoList = iTblGatewayEquipmentService.queryList(tblGatewayEquipmentBo);
|
|
|
|
|
- List<GateWayDevice> gateWayDeviceList = new ArrayList<GateWayDevice>();
|
|
|
|
|
- for(TblGatewayVo vo:tblGatewayVoList){
|
|
|
|
|
- GateWayDevice gateWayDevice = new GateWayDevice();
|
|
|
|
|
- gateWayDevice.setTblGateway(vo);
|
|
|
|
|
- List<DeviceDataPoint> deviceDataPointList = new ArrayList<DeviceDataPoint>();
|
|
|
|
|
- for(TblGatewayEquipmentVo geVo:tblGatewayEquipmentVoList){
|
|
|
|
|
- if(vo.getId() == geVo.getGatewayId()){
|
|
|
|
|
- for(DeviceDataPoint deviceDataPoint:deviceDataPoints){
|
|
|
|
|
- if(geVo.getEquipmentId() == deviceDataPoint.getDevice().getId()){
|
|
|
|
|
- deviceDataPointList.add(deviceDataPoint);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ for(TblSensorVo tblSensorVo:tblSeneorVoList){
|
|
|
|
|
+ SensorPoint sensorPoint = new SensorPoint();
|
|
|
|
|
+ sensorPoint.setTblSensorVo(tblSensorVo);
|
|
|
|
|
+ List<PointUnit> pointUnits = new ArrayList<PointUnit>();
|
|
|
|
|
+ for(PointUnit pointUnit:pointUnitlist){
|
|
|
|
|
+ if(tblSensorVo.getId() == pointUnit.getPointInfo().getSensorId()){
|
|
|
|
|
+ pointUnits.add(pointUnit);
|
|
|
}
|
|
}
|
|
|
- gateWayDevice.setDeviceDataPointList(deviceDataPointList);
|
|
|
|
|
- gateWayDeviceList.add(gateWayDevice);
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ sensorPoint.setDataPoints(pointUnits);
|
|
|
|
|
+ list.add(sensorPoint);
|
|
|
}
|
|
}
|
|
|
- obj.setRows(gateWayDeviceList);
|
|
|
|
|
- return obj;
|
|
|
|
|
|
|
+ return list;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|