|
|
@ -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; |
|
|
|
} |
|
|
|
} |
|
|
|