查询站点已绑定/未绑定设备列表,气象设备实时数据接口返回格式调整等
This commit is contained in:
parent
6c835034cd
commit
79cdd499f7
@ -38,12 +38,12 @@ public class AgricultureCropYieldController extends BaseController
|
||||
@Autowired
|
||||
private IAgricultureCropYieldService agricultureCropYieldService;
|
||||
|
||||
/**
|
||||
* 查询作物产量记录列表
|
||||
*/
|
||||
//@PreAuthorize("@ss.hasPermi('crop:yield:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询作物产量记录列表")
|
||||
/**
|
||||
* 查询作物产量记录列表
|
||||
*/
|
||||
//@PreAuthorize("@ss.hasPermi('crop:yield:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询作物产量记录列表")
|
||||
public TableDataInfo list(AgricultureCropYield agricultureCropYield)
|
||||
{
|
||||
startPage();
|
||||
|
@ -52,17 +52,21 @@ public class DeviceHistoryDataController extends BaseController {
|
||||
public TableDataInfo getMeteorologyHistoryData(DeviceRealtimedataMeteorology deviceRealtimedataMeteorology){
|
||||
startPage();
|
||||
List<DeviceRealtimedataMeteorology> list = new LambdaQueryChainWrapper<>(deviceRealtimedataMeteorologyMapper)
|
||||
.eq(DeviceRealtimedataMeteorology::getDeviceId,deviceRealtimedataMeteorology.getDeviceId()).list();
|
||||
.eq(DeviceRealtimedataMeteorology::getDeviceId,deviceRealtimedataMeteorology.getDeviceId())
|
||||
.orderByDesc(DeviceRealtimedataMeteorology::getRealTime)
|
||||
.list();
|
||||
return getDataTable(list);
|
||||
}
|
||||
/**
|
||||
* 获取墒情实时数据
|
||||
* 获取墒情设备历史数据
|
||||
*/
|
||||
@GetMapping("/moisture")
|
||||
public TableDataInfo getMoistureHistoryData(DeviceRealtimedataMoisture deviceRealtimedataMoisture){
|
||||
startPage();
|
||||
List<DeviceRealtimedataMoisture> list = new LambdaQueryChainWrapper<>(deviceRealtimedataMoistureMapper)
|
||||
.eq(DeviceRealtimedataMoisture::getDeviceId,deviceRealtimedataMoisture.getDeviceId()).list();
|
||||
.eq(DeviceRealtimedataMoisture::getDeviceId,deviceRealtimedataMoisture.getDeviceId())
|
||||
.orderByDesc(DeviceRealtimedataMoisture::getRealTime)
|
||||
.list();
|
||||
return getDataTable(list);
|
||||
}
|
||||
/**
|
||||
|
@ -9,11 +9,16 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 监控设备实时数据
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/device/real/data")
|
||||
public class DeviceMonitorController extends BaseController {
|
||||
@Autowired
|
||||
private YingshiyunService yingshiyunService;
|
||||
|
||||
|
||||
@GetMapping("/monitor")
|
||||
public AjaxResult getVideoUrl(@Param("deviceId") String deviceId){
|
||||
return success(yingshiyunService.getVideoPlayUrl(deviceId));
|
||||
|
@ -19,7 +19,6 @@ public class DeviceRealtimedataMeteorologyController {
|
||||
|
||||
/**
|
||||
* 获取最新的一条气象数据
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/weather/realtimedata")
|
||||
public AjaxResult getLatestWeatherRealtimedata() {
|
||||
|
@ -0,0 +1,44 @@
|
||||
package com.fastbee.data.controller.gis.water;
|
||||
|
||||
import com.fastbee.common.core.controller.BaseController;
|
||||
import com.fastbee.common.core.domain.AjaxResult;
|
||||
import com.fastbee.ggroup.domain.GSiteDevice;
|
||||
import com.fastbee.ggroup.domain.vo.GSiteDeviceVo;
|
||||
import com.fastbee.ggroup.service.IGSiteDeviceService;
|
||||
import io.swagger.annotations.Api;
|
||||
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.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/gis/site/device")
|
||||
@Api(tags = "站点设备")
|
||||
public class GSiteDeviceController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IGSiteDeviceService gSiteDeviceService;
|
||||
|
||||
/**
|
||||
* 查询站点未关联的设备列表
|
||||
* @param siteId 站点id
|
||||
* @param groupId 设备组id
|
||||
*/
|
||||
@GetMapping("/unbind")
|
||||
public AjaxResult getUnbindDeviceList(Long siteId,Long groupId) {
|
||||
List<GSiteDeviceVo> gSiteDeviceList = gSiteDeviceService.selectUnbindDeviceList(siteId,groupId);
|
||||
return AjaxResult.success(gSiteDeviceList);
|
||||
}
|
||||
/**
|
||||
* 查询站点已关联的设备列表
|
||||
* @param siteId 站点id
|
||||
* @param groupId 设备组id
|
||||
*/
|
||||
@GetMapping("/bind")
|
||||
public AjaxResult getBindDeviceList(Long siteId,Long groupId) {
|
||||
List<GSiteDeviceVo> gSiteDeviceList = gSiteDeviceService.selectBindDeviceList(siteId,groupId);
|
||||
return AjaxResult.success(gSiteDeviceList);
|
||||
}
|
||||
}
|
@ -68,5 +68,5 @@ public interface IDeviceRealtimedataMeteorologyService extends IService<DeviceRe
|
||||
* 获取最新的一条气象数据
|
||||
* @return
|
||||
*/
|
||||
public List<DeviceProperties> getLatestWeatherRealtimedata();
|
||||
public Map<String,Object> getLatestWeatherRealtimedata();
|
||||
}
|
||||
|
@ -106,15 +106,17 @@ public class DeviceRealtimedataMeteorologyServiceImpl extends ServiceImpl<Device
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<DeviceProperties> getLatestWeatherRealtimedata(){
|
||||
public Map<String,Object> getLatestWeatherRealtimedata(){
|
||||
Map<String,Object> rest= new HashMap<>();
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.orderByDesc("real_time");
|
||||
queryWrapper.last("limit 1");
|
||||
DeviceRealtimedataMeteorology meteorology = deviceRealtimedataMeteorologyMapper.selectOne(queryWrapper);
|
||||
|
||||
List<DeviceProperties> devicePropertiesList = new ArrayList<>();
|
||||
rest.put("props",devicePropertiesList);
|
||||
if(Objects.isNull(meteorology)){
|
||||
return devicePropertiesList;
|
||||
return rest;
|
||||
}
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("空气温度").value(meteorology.getAirTemp().toString()).unit("°C").build());
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("空气湿度").value(meteorology.getAirHumi().toString()).unit("°C").build());
|
||||
@ -129,6 +131,10 @@ public class DeviceRealtimedataMeteorologyServiceImpl extends ServiceImpl<Device
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("蒸发量").value(meteorology.getZhengfa().toString()).unit("t/h").build());
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("土壤温度").value(meteorology.getSoilTemp().toString()).unit("°C").build());
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("土壤湿度").value(meteorology.getSoilHumi().toString()).unit("°C").build());
|
||||
return devicePropertiesList;
|
||||
|
||||
Map<String,Object> info=new HashMap<>();
|
||||
info.put("deviceEncoding", meteorology.getDeviceId());
|
||||
rest.put("info",info);
|
||||
return rest;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
package com.fastbee.ggroup.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GSiteDeviceVo {
|
||||
|
||||
private Long deviceId;//设备id
|
||||
private String deviceName ;//设备名称
|
||||
private Long siteId ;//站点id
|
||||
}
|
@ -3,6 +3,7 @@ package com.fastbee.ggroup.service;
|
||||
import java.util.List;
|
||||
import com.fastbee.ggroup.domain.GSiteDevice;
|
||||
import com.fastbee.ggroup.domain.dto.GSiteDeviceDto;
|
||||
import com.fastbee.ggroup.domain.vo.GSiteDeviceVo;
|
||||
import com.fastbee.iot.domain.Device;
|
||||
|
||||
/**
|
||||
@ -18,7 +19,14 @@ public interface IGSiteDeviceService
|
||||
/**
|
||||
* 查询站点未关联的设备列表
|
||||
*/
|
||||
public List<GSiteDevice> selectUnbindDeviceList(Long siteId);
|
||||
public List<GSiteDeviceVo> selectUnbindDeviceList(Long siteId,Long groupId);
|
||||
|
||||
/**
|
||||
* 查询站点已关联设备列表
|
||||
* @param siteId 站点设备关系主键
|
||||
*/
|
||||
public List<GSiteDeviceVo> selectBindDeviceList(Long siteId,Long groupId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询站点设备关系
|
||||
@ -68,12 +76,6 @@ public interface IGSiteDeviceService
|
||||
*/
|
||||
public int deleteGSiteDeviceById(Long id);
|
||||
|
||||
/**
|
||||
* 查询站点设备已经关联关系信息
|
||||
*
|
||||
* @param id 站点设备关系主键
|
||||
* @return 结果
|
||||
*/
|
||||
public List<GSiteDeviceDto> getGSiteDeviceByDevice(Long id);
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,11 +3,15 @@ package com.fastbee.ggroup.service.impl;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.fastbee.ggroup.domain.GSites;
|
||||
import com.fastbee.ggroup.domain.dto.GSiteDeviceDto;
|
||||
import com.fastbee.ggroup.domain.vo.GSiteDeviceVo;
|
||||
import com.fastbee.ggroup.mapper.GSitesMapper;
|
||||
import com.fastbee.iot.domain.Device;
|
||||
import com.fastbee.iot.domain.Group;
|
||||
import com.fastbee.iot.mapper.DeviceMapper;
|
||||
import com.fastbee.iot.mapper.GroupMapper;
|
||||
import com.github.yulichang.query.MPJLambdaQueryWrapper;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -34,26 +38,42 @@ public class GSiteDeviceServiceImpl implements IGSiteDeviceService
|
||||
@Autowired
|
||||
private DeviceMapper deviceMapper;
|
||||
|
||||
@Autowired
|
||||
private GroupMapper groupMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询设备
|
||||
* @param siteId
|
||||
* @return
|
||||
* 查询站点未关联的设备列表
|
||||
* @param siteId 站点id
|
||||
*/
|
||||
@Override
|
||||
public List<GSiteDevice> selectUnbindDeviceList(Long siteId) {
|
||||
MPJLambdaWrapper<Device> objectMPJLambdaWrapper = new MPJLambdaWrapper<Device>()
|
||||
.select(Device::getDeviceId, Device::getDeviceName)
|
||||
public List<GSiteDeviceVo> selectUnbindDeviceList(Long siteId,Long groupId) {
|
||||
MPJLambdaWrapper<GSiteDevice> objectMPJLambdaWrapper = new MPJLambdaWrapper<GSiteDevice>()
|
||||
.select(GSiteDevice::getSiteId, GSiteDevice::getDeviceId)
|
||||
.leftJoin(GSites.class, GSites::getId, GSiteDevice::getSiteId);
|
||||
List<GSiteDevice> gSiteDevices = deviceMapper.selectJoinList(GSiteDevice.class, objectMPJLambdaWrapper);
|
||||
.select(Device::getDeviceId, Device::getDeviceName)
|
||||
.leftJoin(Device.class, Device::getDeviceId, GSiteDevice::getDeviceId)
|
||||
.ne(GSiteDevice::getSiteId, siteId);
|
||||
return gSiteDeviceMapper.selectJoinList(GSiteDeviceVo.class, objectMPJLambdaWrapper);
|
||||
}
|
||||
|
||||
return gSiteDevices;
|
||||
/**
|
||||
* 查询站点已关联设备列表
|
||||
* @param siteId 站点设备关系主键
|
||||
*/
|
||||
@Override
|
||||
public List<GSiteDeviceVo> selectBindDeviceList(Long siteId,Long groupId){
|
||||
MPJLambdaWrapper<GSiteDevice> objectMPJLambdaWrapper = new MPJLambdaWrapper<GSiteDevice>()
|
||||
.select(GSiteDevice::getSiteId, GSiteDevice::getDeviceId)
|
||||
.select(Device::getDeviceId, Device::getDeviceName)
|
||||
.leftJoin(Device.class, Device::getDeviceId, GSiteDevice::getDeviceId)
|
||||
.eq(GSiteDevice::getSiteId, siteId);
|
||||
List<GSiteDeviceVo> gSiteDeviceVos = gSiteDeviceMapper.selectJoinList(GSiteDeviceVo.class, objectMPJLambdaWrapper);
|
||||
List<Group> groups = new LambdaQueryChainWrapper<>(groupMapper).select(Group::getGroupId,Group::getGroupName).list();
|
||||
return gSiteDeviceVos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询站点设备关系
|
||||
*
|
||||
* @param id 站点设备关系主键
|
||||
* @return 站点设备关系
|
||||
*/
|
||||
@ -123,15 +143,5 @@ public class GSiteDeviceServiceImpl implements IGSiteDeviceService
|
||||
return gSiteDeviceMapper.deleteGSiteDeviceById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询站点设备已经关联关系信息
|
||||
*
|
||||
* @param id 站点设备关系主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public List<GSiteDeviceDto> getGSiteDeviceByDevice(Long id){
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import java.util.Set;
|
||||
import com.fastbee.iot.domain.Group;
|
||||
import com.fastbee.iot.model.DeviceGroupInput;
|
||||
import com.fastbee.iot.model.IdOutput;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
@ -15,7 +16,7 @@ import org.springframework.stereotype.Repository;
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@Repository
|
||||
public interface GroupMapper
|
||||
public interface GroupMapper extends MPJBaseMapper<Group>
|
||||
{
|
||||
/**
|
||||
* 查询设备分组
|
||||
|
Loading…
x
Reference in New Issue
Block a user