|
@@ -0,0 +1,99 @@
|
|
|
|
|
+package com.ruoyi.data.controller;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+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 lombok.RequiredArgsConstructor;
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
|
|
+import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
|
+import com.ruoyi.common.core.domain.PageQuery;
|
|
|
|
|
+
|
|
|
|
|
+import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * 网关设备点位数据
|
|
|
|
|
+ *
|
|
|
|
|
+ * @author ruoyi
|
|
|
|
|
+ * @date 2023-12-05
|
|
|
|
|
+ */
|
|
|
|
|
+@Validated
|
|
|
|
|
+@RequiredArgsConstructor
|
|
|
|
|
+@RestController
|
|
|
|
|
+@RequestMapping("/data/device")
|
|
|
|
|
+public class TblDataController extends BaseController {
|
|
|
|
|
+
|
|
|
|
|
+ private final ITblEquipmentService iTblEquipmentService;
|
|
|
|
|
+
|
|
|
|
|
+ private final ITblDatapointService iTblDatapointService;
|
|
|
|
|
+
|
|
|
|
|
+ private final ITblGatewayService iTblGatewayService;
|
|
|
|
|
+
|
|
|
|
|
+ private final ITblGatewayEquipmentService iTblGatewayEquipmentService;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询网关设备列表
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/deviceList")
|
|
|
|
|
+ public TableDataInfo<GateWayDevice> list(TblEquipmentBo bo, PageQuery pageQuery) {
|
|
|
|
|
+ TableDataInfo<GateWayDevice> obj= new TableDataInfo<GateWayDevice>();
|
|
|
|
|
+ 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);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ 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);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ gateWayDevice.setDeviceDataPointList(deviceDataPointList);
|
|
|
|
|
+ gateWayDeviceList.add(gateWayDevice);
|
|
|
|
|
+ }
|
|
|
|
|
+ obj.setRows(gateWayDeviceList);
|
|
|
|
|
+ return obj;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+}
|