新增pad端接口:根据护理单元id查询出其所有摄像头、智能电表、智能水表、温湿度计设备信息
This commit is contained in:
parent
9f33cd1b3a
commit
4a14eb2390
|
|
@ -0,0 +1,96 @@
|
|||
package com.nu.modules.pad.iot.common.api;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nu.entity.*;
|
||||
import com.nu.modules.electricitymeter.api.IElectricityMeterApi;
|
||||
import com.nu.modules.humiddevice.api.IHumidDeviceApi;
|
||||
import com.nu.modules.iot.tplink.camerainfo.entity.AppCameraInfo;
|
||||
import com.nu.modules.iot.tplink.camerainfo.service.IAppCameraInfoService;
|
||||
import com.nu.modules.water.api.IWaterApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/iot/common")
|
||||
@Slf4j
|
||||
public class IotCommonApi {
|
||||
@Autowired
|
||||
private IAppCameraInfoService cameraInfoService;
|
||||
@Autowired
|
||||
private IElectricityMeterApi electricityMeterApi;
|
||||
@Autowired
|
||||
private IWaterApi waterApi;
|
||||
@Autowired
|
||||
private IHumidDeviceApi humidDeviceApi;
|
||||
|
||||
/**
|
||||
* 护理单元物联设备列表
|
||||
*
|
||||
* @param nuId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IotCommonEntity> queryPageList(@RequestParam("nuId") String nuId) {
|
||||
IotCommonEntity result = new IotCommonEntity();
|
||||
result.setCameraInfoEntityList(List.of());
|
||||
|
||||
//摄像头
|
||||
{
|
||||
Page<AppCameraInfo> page = new Page<AppCameraInfo>(1, -1);
|
||||
AppCameraInfo cameraInfo = new AppCameraInfo();
|
||||
cameraInfo.setNuId(nuId);
|
||||
IPage<AppCameraInfo> pageList = cameraInfoService.findPage(page, cameraInfo);
|
||||
List<AppCameraInfo> records = pageList.getRecords();
|
||||
if (records != null && records.size() > 0) {
|
||||
result.setCameraInfoEntityList(BeanUtil.copyToList(records, CameraInfoEntity.class));
|
||||
}
|
||||
}
|
||||
|
||||
//智能电表
|
||||
{
|
||||
ElectricityMeterEntity electricityMeterEntity = new ElectricityMeterEntity();
|
||||
electricityMeterEntity.setNuId(nuId);
|
||||
IPage<ElectricityMeterEntity> pageList = electricityMeterApi.list(electricityMeterEntity, 1, -1, null);
|
||||
List<ElectricityMeterEntity> records = pageList.getRecords();
|
||||
if (records != null && records.size() > 0) {
|
||||
result.setElectricityMeterEntityList(BeanUtil.copyToList(records, ElectricityMeterEntity.class));
|
||||
}
|
||||
}
|
||||
|
||||
//智能水表
|
||||
{
|
||||
WaterMeterEntity waterMeterEntity = new WaterMeterEntity();
|
||||
waterMeterEntity.setNuId(nuId);
|
||||
IPage<WaterMeterEntity> pageList = waterApi.list(waterMeterEntity, 1, -1, null);
|
||||
List<WaterMeterEntity> records = pageList.getRecords();
|
||||
if (records != null && records.size() > 0) {
|
||||
result.setWaterMeterEntityList(BeanUtil.copyToList(records, WaterMeterEntity.class));
|
||||
}
|
||||
}
|
||||
|
||||
//温湿度计
|
||||
{
|
||||
HumidDeviceEntity humidDeviceEntity = new HumidDeviceEntity();
|
||||
humidDeviceEntity.setNuId(nuId);
|
||||
IPage<HumidDeviceEntity> pageList = humidDeviceApi.list(humidDeviceEntity, 1, -1, null);
|
||||
List<HumidDeviceEntity> records = pageList.getRecords();
|
||||
if (records != null && records.size() > 0) {
|
||||
result.setHumidDeviceEntityList(BeanUtil.copyToList(records, HumidDeviceEntity.class));
|
||||
}
|
||||
}
|
||||
|
||||
return Result.OK(result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.nu.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class IotCommonEntity implements Serializable {
|
||||
|
||||
private List<CameraInfoEntity> cameraInfoEntityList;
|
||||
private List<ElectricityMeterEntity> electricityMeterEntityList;
|
||||
private List<WaterMeterEntity> waterMeterEntityList;
|
||||
private List<HumidDeviceEntity> humidDeviceEntityList;
|
||||
|
||||
}
|
||||
|
|
@ -284,7 +284,6 @@ public class ElectricityMeterServiceImpl extends ServiceImpl<ElectricityMeterMap
|
|||
ElectricityMeter electricityMeter = new ElectricityMeter();
|
||||
BeanUtils.copyProperties(electricityMeterEntity,electricityMeter);
|
||||
Page<ElectricityMeter> page = new Page<ElectricityMeter>(pageNo, pageSize);
|
||||
QueryWrapper<ElectricityMeter> queryWrapper = QueryGenerator.initQueryWrapper(electricityMeter, req.getParameterMap());
|
||||
IPage<ElectricityMeter> pageList = syncImpl.findPage(page, electricityMeter);
|
||||
|
||||
List<ElectricityMeterEntity> entityList = pageList.getRecords().stream()
|
||||
|
|
|
|||
|
|
@ -635,7 +635,6 @@ public class WaterMeterServiceImpl extends ServiceImpl<WaterMeterMapper, WaterMe
|
|||
WaterMeter waterMeter = new WaterMeter();
|
||||
BeanUtils.copyProperties(waterMeterEntity, waterMeter);
|
||||
Page<WaterMeter> page = new Page<WaterMeter>(pageNo, pageSize);
|
||||
QueryWrapper<WaterMeter> queryWrapper = QueryGenerator.initQueryWrapper(waterMeter, req.getParameterMap());
|
||||
IPage<WaterMeter> pageList = syncImpl.findPage(page, waterMeter);
|
||||
|
||||
List<WaterMeterEntity> entityList = pageList.getRecords().stream()
|
||||
|
|
|
|||
|
|
@ -549,7 +549,6 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
HumidDevice humidDevice = new HumidDevice();
|
||||
BeanUtils.copyProperties(humidDeviceEntity, humidDevice);
|
||||
Page<HumidDevice> page = new Page<HumidDevice>(pageNo, pageSize);
|
||||
QueryWrapper<HumidDevice> queryWrapper = QueryGenerator.initQueryWrapper(humidDevice, req.getParameterMap());
|
||||
IPage<HumidDevice> pageList = syncImpl.findPage(page, humidDevice);
|
||||
|
||||
List<HumidDeviceEntity> entityList = pageList.getRecords().stream()
|
||||
|
|
|
|||
Loading…
Reference in New Issue