添加监控设备在线状态;设备详情接口添加projectId
This commit is contained in:
parent
27737c0cb9
commit
2b9a21c063
@ -124,10 +124,11 @@ public class DeviceInfoController extends BaseController {
|
||||
* 查询气象设备列表
|
||||
*/
|
||||
@GetMapping("/weatherList")
|
||||
public AjaxResult getDeviceList() {
|
||||
public AjaxResult getDeviceList(Long projectId) {
|
||||
LambdaQueryWrapper<DeviceInformationMeteorology> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(DeviceInformationMeteorology::getId,DeviceInformationMeteorology::getName,
|
||||
DeviceInformationMeteorology::getLongitude,DeviceInformationMeteorology::getLatitude);
|
||||
DeviceInformationMeteorology::getLongitude,DeviceInformationMeteorology::getLatitude)
|
||||
.eq(DeviceInformationMeteorology::getProjectId,projectId);
|
||||
return success(deviceInformationMeteorologyMapper.selectList(queryWrapper));
|
||||
}
|
||||
|
||||
@ -136,10 +137,11 @@ public class DeviceInfoController extends BaseController {
|
||||
* 查询虫情设备列表
|
||||
*/
|
||||
@GetMapping("/wormList")
|
||||
public AjaxResult getWeatherList() {
|
||||
public AjaxResult getWeatherList(Long projectId) {
|
||||
LambdaQueryWrapper<DeviceInformationWorms> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(DeviceInformationWorms::getId,DeviceInformationWorms::getName,
|
||||
DeviceInformationWorms::getLongitude,DeviceInformationWorms::getLatitude);
|
||||
DeviceInformationWorms::getLongitude,DeviceInformationWorms::getLatitude)
|
||||
.eq(DeviceInformationWorms::getProjectId,projectId);
|
||||
return success(deviceInformationWormsMapper.selectList(queryWrapper));
|
||||
}
|
||||
|
||||
@ -147,40 +149,44 @@ public class DeviceInfoController extends BaseController {
|
||||
* 查询墒情设备列表
|
||||
*/
|
||||
@GetMapping("/soilList")
|
||||
public AjaxResult getSoilList() {
|
||||
public AjaxResult getSoilList(Long projectId) {
|
||||
LambdaQueryWrapper<DeviceInformationMoisture> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(DeviceInformationMoisture::getId,DeviceInformationMoisture::getName,
|
||||
DeviceInformationMoisture::getLongitude,DeviceInformationMoisture::getLatitude);
|
||||
DeviceInformationMoisture::getLongitude,DeviceInformationMoisture::getLatitude)
|
||||
.eq(DeviceInformationMoisture::getProjectId,projectId);
|
||||
return success(deviceInformationMoistureMapper.selectList(queryWrapper));
|
||||
}
|
||||
/**
|
||||
* 查询杀虫灯设备列表
|
||||
*/
|
||||
@GetMapping("/lightList")
|
||||
public AjaxResult getLightList() {
|
||||
public AjaxResult getLightList(Long projectId) {
|
||||
LambdaQueryWrapper<DeviceInformationTargetpests> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(DeviceInformationTargetpests::getId,DeviceInformationTargetpests::getName,
|
||||
DeviceInformationTargetpests::getLongitude,DeviceInformationTargetpests::getLatitude);
|
||||
DeviceInformationTargetpests::getLongitude,DeviceInformationTargetpests::getLatitude)
|
||||
.eq(DeviceInformationTargetpests::getProjectId,projectId);
|
||||
return success(deviceInformationTargetpestsMapper.selectList(queryWrapper));
|
||||
}
|
||||
/**
|
||||
* 查询苗情设备列表
|
||||
*/
|
||||
@GetMapping("/miaoList")
|
||||
public AjaxResult getmiaoList() {
|
||||
public AjaxResult getmiaoList(Long projectId) {
|
||||
LambdaQueryWrapper<DeviceInformationMiaoqing> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(DeviceInformationMiaoqing::getId,DeviceInformationMiaoqing::getName,
|
||||
DeviceInformationMiaoqing::getLongitude,DeviceInformationMiaoqing::getLatitude);
|
||||
DeviceInformationMiaoqing::getLongitude,DeviceInformationMiaoqing::getLatitude)
|
||||
.eq(DeviceInformationMiaoqing::getProjectId,projectId);
|
||||
return success(deviceInformationMiaoqingMapper.selectList(queryWrapper));
|
||||
}
|
||||
/**
|
||||
* 查询监控站设备列表
|
||||
*/
|
||||
@GetMapping("/monitorList")
|
||||
public AjaxResult getmonitorList() {
|
||||
public AjaxResult getmonitorList(Long projectId) {
|
||||
LambdaQueryWrapper<DeviceInformationMonitor> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(DeviceInformationMonitor::getId,DeviceInformationMonitor::getName,
|
||||
DeviceInformationMonitor::getLongitude,DeviceInformationMonitor::getLatitude);
|
||||
DeviceInformationMonitor::getLongitude,DeviceInformationMonitor::getLatitude)
|
||||
.eq(DeviceInformationMonitor::getProjectId,projectId);
|
||||
return success(deviceInformationMonitorMapper.selectList(queryWrapper));
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.fastbee.data.controller.aaScreenAgricultural.deviceBaseInfo;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.fastbee.deviceInfo.mapper.DeviceInformationMeteorologyMapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@ -35,6 +36,8 @@ public class DeviceInformationMeteorologyController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IDeviceInformationMeteorologyService deviceInformationMeteorologyService;
|
||||
@Autowired
|
||||
private DeviceInformationMeteorologyMapper deviceInformationMeteorologyMapper;
|
||||
|
||||
/**
|
||||
* 查询气象设备基础信息列表
|
||||
@ -75,7 +78,7 @@ public class DeviceInformationMeteorologyController extends BaseController
|
||||
/**
|
||||
* 新增气象设备基础信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('deviceInfo:meteorology:add')")
|
||||
//@PreAuthorize("@ss.hasPermi('deviceInfo:meteorology:add')")
|
||||
@PostMapping
|
||||
@ApiOperation("新增气象设备基础信息")
|
||||
public AjaxResult add(@RequestBody DeviceInformationMeteorology deviceInformationMeteorology)
|
||||
@ -86,7 +89,7 @@ public class DeviceInformationMeteorologyController extends BaseController
|
||||
/**
|
||||
* 修改气象设备基础信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('deviceInfo:meteorology:edit')")
|
||||
//@PreAuthorize("@ss.hasPermi('deviceInfo:meteorology:edit')")
|
||||
@PutMapping
|
||||
@ApiOperation("修改气象设备基础信息")
|
||||
public AjaxResult edit(@RequestBody DeviceInformationMeteorology deviceInformationMeteorology)
|
||||
@ -97,11 +100,13 @@ public class DeviceInformationMeteorologyController extends BaseController
|
||||
/**
|
||||
* 删除气象设备基础信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('deviceInfo:meteorology:remove')")
|
||||
@DeleteMapping("/{ids}")
|
||||
//@PreAuthorize("@ss.hasPermi('deviceInfo:meteorology:remove')")
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation("删除气象设备基础信息")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
public AjaxResult remove(@PathVariable Long id)
|
||||
{
|
||||
return toAjax(deviceInformationMeteorologyService.deleteDeviceInformationMeteorologyByIds(ids));
|
||||
int flag=deviceInformationMeteorologyMapper.deleteDeviceInformationMeteorologyById(id);
|
||||
return toAjax(flag);
|
||||
//return toAjax(deviceInformationMeteorologyService.deleteDeviceInformationMeteorologyByIds(ids));
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.fastbee.data.controller.aaScreenAgricultural.deviceBaseInfo;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.fastbee.deviceInfo.mapper.DeviceInformationMonitorMapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@ -35,11 +36,13 @@ public class DeviceInformationMonitorController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IDeviceInformationMonitorService deviceInformationMonitorService;
|
||||
@Autowired
|
||||
private DeviceInformationMonitorMapper deviceInformationMonitorMapper;
|
||||
|
||||
/**
|
||||
* 查询监控站设备基础信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('deviceInfo:monitor:list')")
|
||||
//@PreAuthorize("@ss.hasPermi('deviceInfo:monitor:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询监控站设备基础信息列表")
|
||||
public TableDataInfo list(DeviceInformationMonitor deviceInformationMonitor)
|
||||
@ -53,7 +56,7 @@ public class DeviceInformationMonitorController extends BaseController
|
||||
* 导出监控站设备基础信息列表
|
||||
*/
|
||||
@ApiOperation("导出监控站设备基础信息列表")
|
||||
@PreAuthorize("@ss.hasPermi('deviceInfo:monitor:export')")
|
||||
//@PreAuthorize("@ss.hasPermi('deviceInfo:monitor:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, DeviceInformationMonitor deviceInformationMonitor)
|
||||
{
|
||||
@ -75,7 +78,7 @@ public class DeviceInformationMonitorController extends BaseController
|
||||
/**
|
||||
* 新增监控站设备基础信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('deviceInfo:monitor:add')")
|
||||
//@PreAuthorize("@ss.hasPermi('deviceInfo:monitor:add')")
|
||||
@PostMapping
|
||||
@ApiOperation("新增监控站设备基础信息")
|
||||
public AjaxResult add(@RequestBody DeviceInformationMonitor deviceInformationMonitor)
|
||||
@ -86,7 +89,7 @@ public class DeviceInformationMonitorController extends BaseController
|
||||
/**
|
||||
* 修改监控站设备基础信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('deviceInfo:monitor:edit')")
|
||||
//@PreAuthorize("@ss.hasPermi('deviceInfo:monitor:edit')")
|
||||
@PutMapping
|
||||
@ApiOperation("修改监控站设备基础信息")
|
||||
public AjaxResult edit(@RequestBody DeviceInformationMonitor deviceInformationMonitor)
|
||||
@ -97,11 +100,13 @@ public class DeviceInformationMonitorController extends BaseController
|
||||
/**
|
||||
* 删除监控站设备基础信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('deviceInfo:monitor:remove')")
|
||||
@DeleteMapping("/{ids}")
|
||||
//@PreAuthorize("@ss.hasPermi('deviceInfo:monitor:remove')")
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation("删除监控站设备基础信息")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
public AjaxResult remove(@PathVariable Long id)
|
||||
{
|
||||
return toAjax(deviceInformationMonitorService.deleteDeviceInformationMonitorByIds(ids));
|
||||
//return toAjax(deviceInformationMonitorService.deleteDeviceInformationMonitorByIds(ids));
|
||||
int flag=deviceInformationMonitorMapper.deleteDeviceInformationMonitorById(id);
|
||||
return toAjax(flag);
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,9 @@ public class DeviceRealtimedataSeedlingGrowthController {
|
||||
DeviceInformationMonitor::getName,
|
||||
DeviceInformationMonitor::getDeviceEncoding,
|
||||
DeviceInformationMonitor::getLatitude,
|
||||
DeviceInformationMonitor::getLongitude)
|
||||
DeviceInformationMonitor::getLongitude,
|
||||
DeviceInformationMonitor::getRemarksInformation,
|
||||
DeviceInformationMonitor::getProjectId)
|
||||
.eq(DeviceInformationMonitor::getProjectId,projectId)
|
||||
//.eq(DeviceInformationMonitor::getDeviceEncoding,deviceEncoding)
|
||||
.list();
|
||||
@ -61,10 +63,17 @@ public class DeviceRealtimedataSeedlingGrowthController {
|
||||
if (videoPlayMap.containsKey("playUrl")) {
|
||||
Object playUrl = videoPlayMap.get("playUrl");
|
||||
monitor.setPlayUrl(playUrl.toString());
|
||||
|
||||
}
|
||||
if( videoPlayMap.containsKey("accessToken")){
|
||||
Object accessToken = videoPlayMap.get("accessToken");
|
||||
monitor.setAccessToken(accessToken.toString());
|
||||
}
|
||||
if(videoPlayMap.containsKey("status")){
|
||||
Object status=videoPlayMap.get("status");//设备在线状态,0=离线,1=在线
|
||||
Object statusDesc=videoPlayMap.get("statusDesc");//设备在线状态描述
|
||||
monitor.setStatusDesc(statusDesc.toString());
|
||||
monitor.setStatus((Long) status);
|
||||
}
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
||||
import com.fastbee.common.holder.ProjectHolder;
|
||||
import com.fastbee.deviceData.domain.NgYingshiCloudIntegrationInfo;
|
||||
import com.fastbee.deviceData.mapper.NgYingshiCloudIntegrationInfoMapper;
|
||||
@ -96,6 +97,40 @@ public class YingshiyunService {
|
||||
}
|
||||
String accessToken = getAuth(infoList.get(0).getAppkey(),infoList.get(0).getAppsecret());
|
||||
System.err.println(accessToken);
|
||||
|
||||
|
||||
/**
|
||||
* 获取单个设备信息,包括设备在线状态和设备是否加密
|
||||
*/
|
||||
Map<String,Object> info=getInfo(accessToken,deviceSerial);
|
||||
Long status= (Long) info.get("status"); //设备状态。0=离线;1=在线
|
||||
String statusDesc= info.get("statusDesc").toString();//设备状态描述
|
||||
|
||||
int isEncrypt= (int) info.get("isEncrypt");//设备是否加密,1=加密
|
||||
//在数据库中更新设备状态为当前状态
|
||||
new LambdaUpdateChainWrapper<>(deviceInformationMonitorMapper)
|
||||
.set(DeviceInformationMonitor::getStatus,status)
|
||||
.eq(DeviceInformationMonitor::getDeviceEncoding,deviceSerial)
|
||||
.update();
|
||||
System.err.println("更新数据库状态为"+status);
|
||||
if(status==0)
|
||||
{
|
||||
map.put("status",status);
|
||||
map.put("statusDesc","离线");
|
||||
return map;
|
||||
}
|
||||
if(isEncrypt==1)
|
||||
{
|
||||
//解密
|
||||
int decryptFlag=decrypt(accessToken,deviceSerial);//设备解密,1=解密成功
|
||||
if(decryptFlag!=1)
|
||||
{
|
||||
return map;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取设备播放地址
|
||||
*/
|
||||
String VIDEO_PLAY_URL = "https://open.ys7.com/api/lapp/v2/live/address/get";
|
||||
|
||||
String body = StrUtil.format("accessToken={}&deviceSerial={}&protocol={}",accessToken ,deviceSerial,"2");
|
||||
@ -105,24 +140,6 @@ public class YingshiyunService {
|
||||
JSONObject jsonObject = JSONUtil.parseObj(response.body());
|
||||
System.err.println("jsonObject:"+jsonObject);
|
||||
|
||||
if(jsonObject.get("code").toString().equals("60019"))
|
||||
{
|
||||
//如果设备加密
|
||||
//解密
|
||||
String VIDEO_DECODE_URL = "https://open.ys7.com/api/lapp/device/encrypt/off";
|
||||
String decodeBody=StrUtil.format("accessToken={}&deviceSerial={}",accessToken ,deviceSerial);
|
||||
HttpResponse decodeResponse=HttpRequest.post(VIDEO_DECODE_URL).body(decodeBody).execute();
|
||||
JSONObject decodeJsonObject=JSONUtil.parseObj(decodeResponse.body());
|
||||
System.err.println("decodeJsonObject:"+decodeJsonObject);
|
||||
if(!decodeJsonObject.get("code").toString().equals("200"))
|
||||
{
|
||||
return map;
|
||||
}
|
||||
response = HttpRequest.post(VIDEO_PLAY_URL)
|
||||
.body(body).execute();
|
||||
jsonObject = JSONUtil.parseObj(response.body());
|
||||
System.err.println("解密后jsonObject:"+jsonObject);
|
||||
}
|
||||
if(!jsonObject.get("code").toString().equals("200")){
|
||||
return map;
|
||||
}
|
||||
@ -134,12 +151,64 @@ public class YingshiyunService {
|
||||
|
||||
map.put("playUrl",playUrl);
|
||||
map.put("accessToken",accessToken);
|
||||
map.put("status",status);//设备在线状态-0=离线,1=在线
|
||||
map.put("statusDesc",statusDesc);//状态描述
|
||||
System.err.println("playUrl:"+playUrl);
|
||||
System.err.println("accessToken:"+accessToken);
|
||||
System.err.println("status:"+status);
|
||||
System.err.println("statusDesc:"+statusDesc);
|
||||
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个设备信息,包括在线状态和是否加密
|
||||
* @param accessToken
|
||||
* @param deviceSerial
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> getInfo(String accessToken,String deviceSerial)
|
||||
{
|
||||
Map<String,Object> map = new HashMap<>();//结果
|
||||
String INFO_URL="https://open.ys7.com/api/lapp/device/info";//获取单个设备信息接口地址
|
||||
String infoBody=StrUtil.format("accessToken={}&deviceSerial={}",accessToken,deviceSerial);
|
||||
HttpResponse infoResponse=HttpRequest.post(INFO_URL)
|
||||
.body(infoBody).execute();
|
||||
if(!JSONUtil.parseObj(infoResponse.body()).get("code").toString().equals("200"))
|
||||
{
|
||||
return map;
|
||||
}
|
||||
JSONObject infoData=JSONUtil.parseObj(infoResponse.body()).getJSONObject("data");
|
||||
Long status=infoData.getLong("status");//获取设备在线状态
|
||||
String statusDesc= status==0 ? "离线" : "在线";//如果status是0则是离线,否则是在线
|
||||
int isEncrypt=infoData.getInt("isEncrypt");//设备是否加密,0-不加密,1-加密
|
||||
map.put("status",status);
|
||||
map.put("statusDesc",statusDesc);
|
||||
map.put("isEncrypt",isEncrypt);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备解密
|
||||
* @param accessToken
|
||||
* @param deviceSerial
|
||||
* @return
|
||||
*/
|
||||
public int decrypt(String accessToken,String deviceSerial)
|
||||
{
|
||||
//设备解密,1=成功
|
||||
String VIDEO_DECODE_URL = "https://open.ys7.com/api/lapp/device/encrypt/off";
|
||||
String decodeBody=StrUtil.format("accessToken={}&deviceSerial={}",accessToken ,deviceSerial);
|
||||
HttpResponse decodeResponse=HttpRequest.post(VIDEO_DECODE_URL).body(decodeBody).execute();
|
||||
JSONObject decodeJsonObject=JSONUtil.parseObj(decodeResponse.body());
|
||||
System.err.println("decodeJsonObject:"+decodeJsonObject);
|
||||
if(!decodeJsonObject.get("code").toString().equals("200"))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -121,19 +121,55 @@ public class DeviceRealtimedataMeteorologyServiceImpl extends ServiceImpl<Device
|
||||
if(Objects.isNull(meteorology)){
|
||||
return rest;
|
||||
}
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("空气温度").value(meteorology.getAirTemp()==null?"":meteorology.getAirTemp().toString()).unit("°C").build());
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("空气湿度").value(meteorology.getAirHumi()==null?"":meteorology.getAirHumi().toString()).unit("%").build());
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("风速").value(meteorology.getWindSpeed()==null?"":meteorology.getWindSpeed().toString()).unit("m/s").build());
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("风向").value(windDirMap(meteorology.getWindDir())).unit("风").build());
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("大气压力").value(meteorology.getAirPre()==null?"":meteorology.getAirPre().toString()).unit("hPa").build());
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("光照度").value(meteorology.getGuangzhao()==null?"":meteorology.getGuangzhao().toString()).unit("lx").build());
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("光合有效辐射").value(meteorology.getFushe()==null?"":meteorology.getFushe().toString()).unit("Lux").build());
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("累积雨量").value(meteorology.getSumRain()==null?"":meteorology.getSumRain().toString()).unit("mm").build());
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("瞬时雨量").value(meteorology.getInsRain()==null?"":meteorology.getInsRain().toString()).unit("mm").build());
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("日雨量").value(meteorology.getDayRain()==null?"":meteorology.getDayRain().toString()).unit("mm").build());
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("蒸发量").value(meteorology.getZhengfa()==null?"":meteorology.getZhengfa().toString()).unit("t/h").build());
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("土壤温度").value(meteorology.getSoilTemp()==null?"":meteorology.getSoilTemp().toString()).unit("°C").build());
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("土壤湿度").value(meteorology.getSoilHumi()==null?"":meteorology.getSoilHumi().toString()).unit("%").build());
|
||||
if(meteorology.getAirTemp()!=null)
|
||||
{
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("空气温度").value(meteorology.getAirTemp().toString()).unit("°C").build());
|
||||
}
|
||||
if(meteorology.getAirHumi()!=null)
|
||||
{
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("空气湿度").value(meteorology.getAirHumi().toString()).unit("%").build());
|
||||
}
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("风速").value(meteorology.getWindSpeed().toString()).unit("m/s").build());
|
||||
if(meteorology.getWindDir()!=null)
|
||||
{
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("风向").value(windDirMap(meteorology.getWindDir())).unit("风").build());
|
||||
}
|
||||
if(meteorology.getAirPre()!=null)
|
||||
{
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("大气压力").value(meteorology.getAirPre().toString()).unit("hPa").build());
|
||||
}
|
||||
if(meteorology.getGuangzhao()!=null)
|
||||
{
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("光照度").value(meteorology.getGuangzhao().toString()).unit("lx").build());
|
||||
}
|
||||
if(meteorology.getFushe()!=null)
|
||||
{
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("光合有效辐射").value(meteorology.getFushe().toString()).unit("Lux").build());
|
||||
}
|
||||
if(meteorology.getSumRain()!=null)
|
||||
{
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("累积雨量").value(meteorology.getSumRain().toString()).unit("mm").build());
|
||||
}
|
||||
if(meteorology.getInsRain()!=null)
|
||||
{
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("瞬时雨量").value(meteorology.getInsRain().toString()).unit("mm").build());
|
||||
}
|
||||
if(meteorology.getDayRain()!=null)
|
||||
{
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("日雨量").value(meteorology.getDayRain().toString()).unit("mm").build());
|
||||
}
|
||||
if(meteorology.getZhengfa()!=null)
|
||||
{
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("蒸发量").value(meteorology.getZhengfa().toString()).unit("t/h").build());
|
||||
}
|
||||
if(meteorology.getSoilTemp()!=null)
|
||||
{
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("土壤温度").value(meteorology.getSoilTemp().toString()).unit("°C").build());
|
||||
}
|
||||
if(meteorology.getSoilHumi()!=null)
|
||||
{
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("土壤湿度").value(meteorology.getSoilHumi().toString()).unit("%").build());
|
||||
}
|
||||
|
||||
Map<String,Object> info=new HashMap<>();
|
||||
info.put("deviceEncoding", meteorology.getDeviceId());
|
||||
|
@ -96,6 +96,6 @@ private static final long serialVersionUID = 1L;
|
||||
/** projectId */
|
||||
@Excel(name = "projectId")
|
||||
@ApiModelProperty("projectId")
|
||||
private String projectId;
|
||||
private Long projectId;
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.fastbee.deviceInfo.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
@ -132,5 +133,9 @@ public class DeviceInformationMonitor extends BaseEntity
|
||||
@ApiModelProperty("projectId")
|
||||
private Long projectId;
|
||||
|
||||
/**设备状态描述,离线/在线 */
|
||||
@TableField(exist=false)
|
||||
private String statusDesc;
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
package com.fastbee.deviceInfo.manager;
|
||||
|
||||
import com.fastbee.deviceData.domain.DeviceRealtimedataPhotovoltaic;
|
||||
import com.fastbee.deviceData.domain.dto.DeviceProperties;
|
||||
import com.fastbee.deviceInfo.domain.*;
|
||||
import com.fastbee.deviceInfo.mapper.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class DeviceInformationManager {
|
||||
@ -37,7 +37,7 @@ public class DeviceInformationManager {
|
||||
public Map<String,Object> getAllDeviceCount(Long projectId) {
|
||||
System.err.println("projectId:"+projectId);
|
||||
DeviceInformationMeteorology informationMeteorology=new DeviceInformationMeteorology();
|
||||
informationMeteorology.setProjectId(String.valueOf(projectId));
|
||||
informationMeteorology.setProjectId(projectId);
|
||||
DeviceInformationMiaoqing informationMiaoqing=new DeviceInformationMiaoqing();
|
||||
informationMiaoqing.setProjectId(projectId);
|
||||
DeviceInformationMoisture informationMoisture=new DeviceInformationMoisture();
|
||||
@ -56,13 +56,41 @@ public class DeviceInformationManager {
|
||||
List<DeviceInformationWorms> wormList = wormsMapper.selectDeviceInformationWormsList(informationWorms);
|
||||
|
||||
Map<String,Object> resp =new HashMap<>();
|
||||
resp.put("meteorologieTotal",meteorologieList.size());
|
||||
/*resp.put("meteorologieTotal",meteorologieList.size());
|
||||
resp.put("miaoqingTotal",miaoqingList.size());
|
||||
resp.put("moistureTotal",moistureList.size());
|
||||
resp.put("monitorTotal",monitorList.size());
|
||||
resp.put("targetpestTotal",targetpestList.size());
|
||||
resp.put("wormTotal",wormList.size());
|
||||
resp.put("photovoltaicTotal",miaoqingList.size());
|
||||
resp.put("photovoltaicTotal",miaoqingList.size());*/
|
||||
|
||||
List<DeviceProperties> devicePropertiesList = new ArrayList<>();
|
||||
if(meteorologieList.size()!=0)
|
||||
{
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("meteorologieTotal").value(String.valueOf(meteorologieList.size())).unit("气象设备").build());
|
||||
}
|
||||
if(miaoqingList.size()!=0)
|
||||
{
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("miaoqingTotal").value(String.valueOf(miaoqingList.size())).unit("苗情设备").build());
|
||||
}
|
||||
if(moistureList.size()!=0)
|
||||
{
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("moistureTotal").value(String.valueOf(moistureList.size())).unit("墒情设备").build());
|
||||
}
|
||||
if(targetpestList.size()!=0)
|
||||
{
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("targetpestTotal").value(String.valueOf(targetpestList.size())).unit("靶标害虫设备").build());
|
||||
}
|
||||
if(wormList.size()!=0)
|
||||
{
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("wormTotal").value(String.valueOf(wormList.size())).unit("虫情设备").build());
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("photovoltaicTotal").value(String.valueOf(wormList.size())).unit("光伏设备").build());
|
||||
}
|
||||
if(monitorList.size()!=0)
|
||||
{
|
||||
devicePropertiesList.add(DeviceProperties.builder().name("monitorTotal").value(String.valueOf(monitorList.size())).unit("监控设备").build());
|
||||
}
|
||||
resp.put("props",devicePropertiesList);
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
@ -23,10 +23,11 @@
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="projectId" column="project_id" />
|
||||
<result property="status" column="status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeviceInformationMeteorologyVo">
|
||||
select id, name, device_brand, device_type, device_encoding, type, longitude, latitude, installation_location, name_project, construction_year, docking_method, del_flag, create_time, create_by, update_time, update_by,project_id from iot_device_information_meteorology
|
||||
select id, name, device_brand, device_type, device_encoding, type, longitude, latitude, installation_location, name_project, construction_year, docking_method, del_flag, create_time, create_by, update_time, update_by,project_id,status from iot_device_information_meteorology
|
||||
</sql>
|
||||
|
||||
<select id="selectDeviceInformationMeteorologyList" parameterType="DeviceInformationMeteorology" resultMap="DeviceInformationMeteorologyResult">
|
||||
@ -44,6 +45,7 @@
|
||||
<if test="constructionYear != null "> and construction_year = #{constructionYear}</if>
|
||||
<if test="dockingMethod != null and dockingMethod != ''"> and docking_method = #{dockingMethod}</if>
|
||||
<if test="projectId != null and projectId != ''"> and project_id = #{projectId}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -72,6 +74,7 @@
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="projectId != null">project_id,</if>
|
||||
<if test="status != null">status,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">#{name},</if>
|
||||
@ -91,6 +94,7 @@
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="projectId != null">#{projectId},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -114,6 +118,7 @@
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="projectId != null">project_id = #{projectId},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
@ -28,10 +28,11 @@
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="playUrl" column="play_url" />
|
||||
<result property="projectId" column="project_id" />
|
||||
<result property="status" column="status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeviceInformationMonitorVo">
|
||||
select id, name, device_encoding, type, longitude, latitude, installation_location, device_brand, device_type, name_project, construction_year, affiliation_township, management_leader, management_leader_telephone, management_unit, remarks_information, del_flag, create_time, create_by, update_time, update_by, play_url,project_id from iot_device_information_monitor
|
||||
select id, name, device_encoding, type, longitude, latitude, installation_location, device_brand, device_type, name_project, construction_year, affiliation_township, management_leader, management_leader_telephone, management_unit, remarks_information, del_flag, create_time, create_by, update_time, update_by, play_url,project_id,status from iot_device_information_monitor
|
||||
</sql>
|
||||
|
||||
<select id="selectDeviceInformationMonitorList" parameterType="DeviceInformationMonitor" resultMap="DeviceInformationMonitorResult">
|
||||
@ -54,6 +55,7 @@
|
||||
<if test="remarksInformation != null and remarksInformation != ''"> and remarks_information = #{remarksInformation}</if>
|
||||
<if test="playUrl != null and playUrl != ''"> and play_url = #{playUrl}</if>
|
||||
<if test="projectId != null and projectId != ''"> and project_id = #{projectId}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -87,6 +89,7 @@
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="playUrl != null">play_url,</if>
|
||||
<if test="projectId != null">project_id,</if>
|
||||
<if test="status != null">status,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">#{name},</if>
|
||||
@ -111,6 +114,7 @@
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="playUrl != null">#{playUrl},</if>
|
||||
<if test="projectId != null">#{projectId},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -139,6 +143,7 @@
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="playUrl != null">play_url = #{playUrl},</if>
|
||||
<if test="projectId != null">project_id = #{projectId},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
Loading…
x
Reference in New Issue
Block a user