设备详情安防页面数据第一版

This commit is contained in:
wyw 2024-08-14 15:16:47 +08:00
parent 5272ca1570
commit 6922c0d053
4 changed files with 59 additions and 1 deletions

View File

@ -112,7 +112,20 @@ public class DeviceDetailController extends BaseController {
return AjaxResult.success(list);
}
/**
* 获取安防信息
* @param deviceId 传参
* @return com.fastbee.common.core.domain.AjaxResult
*/
@ApiOperation("获取安防信息")
@GetMapping("/anfangInfo")
public AjaxResult anfangInfo(Long deviceId)
{
if (null == deviceId || deviceId == 0L) {
return AjaxResult.error("请传入设备号");
}
return AjaxResult.success(deviceDetailService.anfangInfo(deviceId));
}
}

View File

@ -0,0 +1,14 @@
package com.fastbee.data.domain.vo;
import com.fastbee.iot.domain.Device;
import lombok.Data;
/**
* 安防信息
*/
@Data
public class AnfangInfoVo {
private Device jiankongDevice;
}

View File

@ -1,6 +1,7 @@
package com.fastbee.data.service.devicedetail;
import com.fastbee.common.model.vo.iot.QueryLogVo;
import com.fastbee.data.domain.vo.AnfangInfoVo;
import com.fastbee.iot.domain.Device;
import com.fastbee.waterele.domain.MaWatereleRecord;
import com.fastbee.waterele.domain.dto.MaGuangaiRecordDto;
@ -27,4 +28,6 @@ public interface IDeviceDetailService {
ArrayList<Object> gongdianChart(QueryLogVo queryLogVo);
List<XjInspectionRecords> xunjianRecord(QueryLogVo queryLogVo);
AnfangInfoVo anfangInfo(Long deviceId);
}

View File

@ -2,6 +2,8 @@ package com.fastbee.data.service.devicedetail.impl;
import com.fastbee.common.model.vo.iot.QueryLogVo;
import com.fastbee.common.utils.DevParamsUtils;
import com.fastbee.common.utils.StringUtils;
import com.fastbee.data.domain.vo.AnfangInfoVo;
import com.fastbee.data.service.devicedetail.IDeviceDetailService;
import com.fastbee.iot.domain.Device;
import com.fastbee.iot.domain.ThingsModel;
@ -110,6 +112,32 @@ public class DeviceDetailServiceImpl implements IDeviceDetailService {
return new ArrayList<>();
}
@Override
public AnfangInfoVo anfangInfo(Long deviceId) {
//获取监控设备信息
Device device = iDeviceService.selectDeviceByDeviceId(deviceId);
if (device == null) {
throw new RuntimeException("未查到该设备");
}
AnfangInfoVo anfangInfoVo = new AnfangInfoVo();
//获取设备参数
Map<String, Object> devParams = DevParamsUtils.getDevParams(device.getDevParams());
//安防设备
String jiankongIds = devParams.get("jiankongIds").toString();
if(StringUtils.isNotEmpty(jiankongIds)){
Device jiankongDevice = iDeviceService.selectDeviceByDeviceId(Long.parseLong(jiankongIds));
anfangInfoVo.setJiankongDevice(jiankongDevice);
}
//安防设备
String anfangIds = devParams.get("anfangIds").toString();
//获取设备安防状态
if(StringUtils.isNotEmpty(anfangIds)){
Device anfangDevice = iDeviceService.selectDeviceByDeviceId(Long.parseLong(anfangIds));
//获取当前安防告警状态
}
//获取安防历史记录
return null;
}
}