Browse Source

添加摄像头监控页面

master
yangzongjia 2 years ago
parent
commit
b2f42d1d6f
  1. 7
      yxt-supervise-monitor-biz/src/main/java/com/yxt/supervise/monitor/biz/device/YDeviceRest.java
  2. 58
      yxt-supervise-monitor-biz/src/main/java/com/yxt/supervise/monitor/biz/device/YDeviceService.java
  3. 2
      yxt-supervise-monitor-biz/src/main/java/com/yxt/supervise/monitor/biz/deviceImage/YDeviceImageRest.java
  4. 4
      yxt-supervise-monitor-biz/src/main/resources/application.yml

7
yxt-supervise-monitor-biz/src/main/java/com/yxt/supervise/monitor/biz/device/YDeviceRest.java

@ -146,4 +146,11 @@ public class YDeviceRest {
return rb;
}
@ApiOperation("获取初始化参数")
@GetMapping("/getDataInfoRes")
public ResultBean getDataInfoRes(String ckId) {
ResultBean rb = ResultBean.fireSuccess();
rb.setData(yDeviceService.getDataInfoRes(ckId));
return rb;
}
}

58
yxt-supervise-monitor-biz/src/main/java/com/yxt/supervise/monitor/biz/device/YDeviceService.java

@ -212,21 +212,6 @@ public class YDeviceService extends ServiceImpl<YDeviceMapper, Device> {
device.setCkId(nvrDevice.getCkId());
}
return rb.setData(this.save(device));
// // 先给海康接口添加设备 如果失败直接返回失败
// String url = "https://api2.hik-cloud.com/api/v1/open/basic/devices/create";
// Map<String, Object> param = new HashMap<>();
// param.put("deviceSerial", device.getDeviceSerial()); // 设备序列号 string
// param.put("groupNo", "A1181"); // 组编号 string
// param.put("validateCode", device.getVCode()); // 验证码 string
// String paramJson = JSONObject.toJSONString(param);
// String result = HttpUtils.sendPostJson(url, paramJson, SyncService.haiKangToken);
// JSONObject jsonObject = JSONObject.parseObject(result);
// if ("200".equals(jsonObject.get("code").toString())) {
// return rb.setData(this.save(device));
// } else {
// rb.setData(jsonObject.get("message"));
// return rb;
// }
}
public ResultBean createDeviceGroup(Device device) {
@ -250,18 +235,37 @@ public class YDeviceService extends ServiceImpl<YDeviceMapper, Device> {
rb.setData(this.removeById(id));
}
// for (String id : ids) {
// String url = "https://api2.hik-cloud.com/api/v1/open/basic/devices/delete";
// Map<String, Object> param = new HashMap<>();
// param.put("deviceSerial", id); // 设备序列号 string
//// String paramJson = JSONObject.toJSONString(param);
// String result = HttpUtils.sendPostMap(url, param, SyncService.haiKangToken);
// JSONObject jsonObject = JSONObject.parseObject(result);
// if ("200".equals(jsonObject.get("code").toString())) {
// rb.setData(this.removeById(id));
// }
// }
return rb;
}
public Map<String, Object> getDataInfoRes(String ckId) {
String appKey = "";
String spToken = "";
String url = "https://api2.hik-cloud.com/v1/ezviz/account/info";
try {
String result = HttpUtils.sendGet(url, SyncService.haiKangToken);
JSONObject jsonObject = JSONObject.parseObject(result);
JSONObject dataJson = (JSONObject) jsonObject.get("data");
appKey = dataJson.get("appKey").toString();
spToken = dataJson.get("token").toString();
} catch (Exception e) {
System.out.println(e);
}
Map<String, Object> map = new HashMap<>();
List<String> channelNoArr = new ArrayList<>();
// 先查询当前仓库下的nvr
QueryWrapper<Device> wrapper = new QueryWrapper<>();
wrapper.eq("ckId", ckId);
wrapper.eq("type", 1); //摄像头
List<Device> devices = this.list(wrapper);
for (Device device : devices) {
map.put("nvrNumber", device.getNvrSerial());
channelNoArr.add(device.getChannelNo());
}
map.put("channelNoArr", channelNoArr);
map.put("appKey", appKey);
map.put("ezvizToken", spToken);
return map;
}
}

2
yxt-supervise-monitor-biz/src/main/java/com/yxt/supervise/monitor/biz/deviceImage/YDeviceImageRest.java

@ -77,7 +77,7 @@ public class YDeviceImageRest {
}
@ApiOperation("获取回放视频流")
@ApiOperation("获取正常视频流")
@GetMapping("/getVedioPcLiveById")
public ResultBean getVedioPcLiveById(@RequestParam String id) {
Device device = yDeviceService.getById(id);

4
yxt-supervise-monitor-biz/src/main/resources/application.yml

@ -3,8 +3,8 @@ spring:
name: yxt-supervise-monitor
profiles:
# active: devv
# active: test
active: pro
active: test
# active: pro
messages:
# 国际化资源文件路径
basename: i18n/messages

Loading…
Cancel
Save