|
@@ -90,23 +90,28 @@ public class LiveBroadcastController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取挑战码接口
|
|
|
+ * 根据监控点编号查询直播间信息
|
|
|
*/
|
|
|
-// @ApiOperation("获取挑战码接口")
|
|
|
- @PostMapping(value = "/challengeCode")
|
|
|
- public AjaxResult challengeCode(@RequestParam(value = "name") String name,
|
|
|
- @RequestParam(value = "productCode", required = false) String productCode,
|
|
|
- @RequestParam(value = "type") String type) {
|
|
|
+ @ApiOperation("根据监控点编号查询直播间信息")
|
|
|
+ @PostMapping(value = "/cameraCode")
|
|
|
+ public AjaxResult cameraCode(@RequestParam(value = "cameraCode", required = false) String cameraCode,
|
|
|
+ @RequestParam(value = "streamType", required = false) String streamType,
|
|
|
+ @RequestParam(value = "projectId") String projectId,
|
|
|
+ @RequestParam(value = "Authorization") String Authorization,
|
|
|
+ @RequestParam(value = "token") String token
|
|
|
+ ) {
|
|
|
|
|
|
Map<String, Object> rsp = new HashMap<>();
|
|
|
|
|
|
- rsp.put("name", name);
|
|
|
- rsp.put("productCode", productCode);
|
|
|
- rsp.put("type", type);
|
|
|
+ rsp.put("cameraCode", cameraCode);
|
|
|
+ rsp.put("streamType", streamType);
|
|
|
+ rsp.put("projectId", projectId);
|
|
|
|
|
|
OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
Request request = new Request.Builder()
|
|
|
- .url(LiveBroadcast.CHALLENGE_CODE)
|
|
|
+ .addHeader("access_token",token)
|
|
|
+ .addHeader("Authorization",Authorization)
|
|
|
+ .url(LiveBroadcast.CAMERA_CODE)
|
|
|
.method("post", RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), JsonUtil.toJson(rsp)))
|
|
|
.post(RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), JsonUtil.toJson(rsp)))
|
|
|
.build();
|
|
@@ -125,32 +130,32 @@ public class LiveBroadcastController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 登录
|
|
|
+ * 开通直播间
|
|
|
*/
|
|
|
-// @ApiOperation("登录")
|
|
|
- @PostMapping(value = "/login")
|
|
|
- public AjaxResult login(@RequestParam(value = "name") String name,
|
|
|
- @RequestParam(value = "password") String password,
|
|
|
- @RequestParam(value = "productCode", required = false) String productCode,
|
|
|
- @RequestParam(value = "type") String type,
|
|
|
- @RequestParam(value = "verifyCodeId", required = false) String verifyCodeId,
|
|
|
- @RequestParam(value = "expired", required = false) String expired,
|
|
|
- @RequestParam(value = "codeId") String codeId
|
|
|
+ @ApiOperation("开通直播间")
|
|
|
+ @PostMapping(value = "/create")
|
|
|
+ public AjaxResult create(@RequestParam(value = "title") String title,
|
|
|
+ @RequestParam(value = "desc") String desc,
|
|
|
+ @RequestParam(value = "projectId") String projectId,
|
|
|
+ @RequestParam(value = "canWatch", required = false) String canWatch,
|
|
|
+ @RequestParam(value = "autoVod", required = false) String autoVod,
|
|
|
+ @RequestParam(value = "Authorization") String Authorization,
|
|
|
+ @RequestParam(value = "token") String token
|
|
|
) {
|
|
|
|
|
|
Map<String, Object> rsp = new HashMap<>();
|
|
|
|
|
|
- rsp.put("name", name);
|
|
|
- rsp.put("password", password);
|
|
|
- rsp.put("productCode", productCode);
|
|
|
- rsp.put("type", type);
|
|
|
- rsp.put("verifyCodeId", verifyCodeId);
|
|
|
- rsp.put("expired", expired);
|
|
|
- rsp.put("codeId", codeId);
|
|
|
+ rsp.put("title", title);
|
|
|
+ rsp.put("desc", desc);
|
|
|
+ rsp.put("projectId", projectId);
|
|
|
+ rsp.put("canWatch", canWatch);
|
|
|
+ rsp.put("autoVod", autoVod);
|
|
|
|
|
|
OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
Request request = new Request.Builder()
|
|
|
- .url(LiveBroadcast.LOGIN)
|
|
|
+ .addHeader("Authorization",Authorization)
|
|
|
+ .addHeader("access_token",token)
|
|
|
+ .url(LiveBroadcast.CREATE)
|
|
|
.method("post", RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), JsonUtil.toJson(rsp)))
|
|
|
.post(RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), JsonUtil.toJson(rsp)))
|
|
|
.build();
|
|
@@ -168,30 +173,27 @@ public class LiveBroadcastController {
|
|
|
return AjaxResult.success(result);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
- * 根据监控点编号查询直播间信息
|
|
|
+ * 删除直播间
|
|
|
*/
|
|
|
- @ApiOperation("根据监控点编号查询直播间信息")
|
|
|
- @PostMapping(value = "/cameraCode")
|
|
|
- public AjaxResult cameraCode(@RequestParam(value = "cameraCode", required = false) String cameraCode,
|
|
|
- @RequestParam(value = "streamType", required = false) String streamType,
|
|
|
- @RequestParam(value = "projectId") String projectId,
|
|
|
- @RequestParam(value = "Authorization") String Authorization,
|
|
|
+ @ApiOperation("删除直播间")
|
|
|
+ @PostMapping(value = "/delete")
|
|
|
+ public AjaxResult delete(@RequestParam(value = "id") String id,
|
|
|
+ @RequestParam(value = "projectId") String projectId,
|
|
|
+ @RequestParam(value = "Authorization") String Authorization,
|
|
|
@RequestParam(value = "token") String token
|
|
|
) {
|
|
|
|
|
|
Map<String, Object> rsp = new HashMap<>();
|
|
|
|
|
|
- rsp.put("cameraCode", cameraCode);
|
|
|
- rsp.put("streamType", streamType);
|
|
|
+ rsp.put("id", id);
|
|
|
rsp.put("projectId", projectId);
|
|
|
|
|
|
OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
Request request = new Request.Builder()
|
|
|
.addHeader("access_token",token)
|
|
|
.addHeader("Authorization",Authorization)
|
|
|
- .url(LiveBroadcast.CAMERA_CODE)
|
|
|
+ .url(LiveBroadcast.DELETE)
|
|
|
.method("post", RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), JsonUtil.toJson(rsp)))
|
|
|
.post(RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), JsonUtil.toJson(rsp)))
|
|
|
.build();
|
|
@@ -210,32 +212,102 @@ public class LiveBroadcastController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 开通直播间
|
|
|
+ * 开启直播
|
|
|
*/
|
|
|
- @ApiOperation("开通直播间")
|
|
|
- @PostMapping(value = "/create")
|
|
|
- public AjaxResult create(@RequestParam(value = "title") String title,
|
|
|
- @RequestParam(value = "desc") String desc,
|
|
|
+ @ApiOperation("开启直播")
|
|
|
+ @PostMapping(value = "/open")
|
|
|
+ public AjaxResult open(@RequestParam(value = "source") String source,
|
|
|
@RequestParam(value = "projectId") String projectId,
|
|
|
- @RequestParam(value = "canWatch", required = false) String canWatch,
|
|
|
- @RequestParam(value = "autoVod", required = false) String autoVod,
|
|
|
@RequestParam(value = "Authorization") String Authorization,
|
|
|
@RequestParam(value = "token") String token
|
|
|
) {
|
|
|
|
|
|
Map<String, Object> rsp = new HashMap<>();
|
|
|
|
|
|
- rsp.put("title", title);
|
|
|
- rsp.put("desc", desc);
|
|
|
+ rsp.put("source", source);
|
|
|
+ rsp.put("projectId", projectId);
|
|
|
+
|
|
|
+ OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
+ Request request = new Request.Builder()
|
|
|
+ .addHeader("access_token",token)
|
|
|
+ .addHeader("Authorization",Authorization)
|
|
|
+ .url(LiveBroadcast.OPEN)
|
|
|
+ .method("post", RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), JsonUtil.toJson(rsp)))
|
|
|
+ .post(RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), JsonUtil.toJson(rsp)))
|
|
|
+ .build();
|
|
|
+
|
|
|
+ System.out.println("请求数据= " + JsonUtil.toJson(rsp));
|
|
|
+ String s;
|
|
|
+ try {
|
|
|
+ s = Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
|
|
|
+ } catch (IOException e) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return AjaxResult.error("请求反馈异常," + e.getMessage());
|
|
|
+ }
|
|
|
+ System.out.println(s);
|
|
|
+ JSONObject result = JSON.parseObject(s);
|
|
|
+ return AjaxResult.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 关闭直播
|
|
|
+ */
|
|
|
+ @ApiOperation("关闭直播")
|
|
|
+ @PostMapping(value = "/close")
|
|
|
+ public AjaxResult close(@RequestParam(value = "source") String source,
|
|
|
+ @RequestParam(value = "projectId") String projectId,
|
|
|
+ @RequestParam(value = "Authorization") String Authorization,
|
|
|
+ @RequestParam(value = "token") String token
|
|
|
+ ) {
|
|
|
+
|
|
|
+ Map<String, Object> rsp = new HashMap<>();
|
|
|
+
|
|
|
+ rsp.put("source", source);
|
|
|
rsp.put("projectId", projectId);
|
|
|
- rsp.put("canWatch", canWatch);
|
|
|
- rsp.put("autoVod", autoVod);
|
|
|
|
|
|
OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
Request request = new Request.Builder()
|
|
|
+ .addHeader("access_token",token)
|
|
|
.addHeader("Authorization",Authorization)
|
|
|
+ .url(LiveBroadcast.CLOSE)
|
|
|
+ .method("post", RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), JsonUtil.toJson(rsp)))
|
|
|
+ .post(RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), JsonUtil.toJson(rsp)))
|
|
|
+ .build();
|
|
|
+
|
|
|
+ System.out.println("请求数据= " + JsonUtil.toJson(rsp));
|
|
|
+ String s;
|
|
|
+ try {
|
|
|
+ s = Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
|
|
|
+ } catch (IOException e) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return AjaxResult.error("请求反馈异常," + e.getMessage());
|
|
|
+ }
|
|
|
+ System.out.println(s);
|
|
|
+ JSONObject result = JSON.parseObject(s);
|
|
|
+ return AjaxResult.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据直播源查询直播地址
|
|
|
+ */
|
|
|
+ @ApiOperation("根据直播源查询直播地址")
|
|
|
+ @PostMapping(value = "/address")
|
|
|
+ public AjaxResult address(@RequestParam(value = "source") String source,
|
|
|
+ @RequestParam(value = "projectId") String projectId,
|
|
|
+ @RequestParam(value = "Authorization") String Authorization,
|
|
|
+ @RequestParam(value = "token") String token
|
|
|
+ ) {
|
|
|
+
|
|
|
+ Map<String, Object> rsp = new HashMap<>();
|
|
|
+
|
|
|
+ rsp.put("source", source);
|
|
|
+ rsp.put("projectId", projectId);
|
|
|
+
|
|
|
+ OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
+ Request request = new Request.Builder()
|
|
|
.addHeader("access_token",token)
|
|
|
- .url(LiveBroadcast.CREATE)
|
|
|
+ .addHeader("Authorization",Authorization)
|
|
|
+ .url(LiveBroadcast.ADDRESS)
|
|
|
.method("post", RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), JsonUtil.toJson(rsp)))
|
|
|
.post(RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), JsonUtil.toJson(rsp)))
|
|
|
.build();
|
|
@@ -253,27 +325,36 @@ public class LiveBroadcastController {
|
|
|
return AjaxResult.success(result);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
- * 删除直播间
|
|
|
+ * 添加设备
|
|
|
*/
|
|
|
- @ApiOperation("删除直播间")
|
|
|
- @PostMapping(value = "/delete")
|
|
|
- public AjaxResult delete(@RequestParam(value = "id") String id,
|
|
|
- @RequestParam(value = "projectId") String projectId,
|
|
|
- @RequestParam(value = "Authorization") String Authorization,
|
|
|
- @RequestParam(value = "token") String token
|
|
|
+ @ApiOperation("添加设备")
|
|
|
+ @PostMapping(value = "/save")
|
|
|
+ public AjaxResult save(@RequestParam(value = "deviceSerial") String deviceSerial,
|
|
|
+ @RequestParam(value = "validateCode") String validateCode,
|
|
|
+ @RequestParam(value = "deviceOrgId") String deviceOrgId,
|
|
|
+ @RequestParam(value = "deviceName",required = false) String deviceName,
|
|
|
+ @RequestParam(value = "modelType",required = false) String modelType,
|
|
|
+ @RequestParam(value = "projectId") String projectId,
|
|
|
+ @RequestParam(value = "Authorization") String Authorization,
|
|
|
+ @RequestParam(value = "token") String token
|
|
|
) {
|
|
|
|
|
|
Map<String, Object> rsp = new HashMap<>();
|
|
|
|
|
|
- rsp.put("id", id);
|
|
|
+ rsp.put("deviceSerial", deviceSerial);
|
|
|
rsp.put("projectId", projectId);
|
|
|
+ rsp.put("validateCode", validateCode);
|
|
|
+ rsp.put("deviceOrgId", deviceOrgId);
|
|
|
+ rsp.put("deviceName", deviceName);
|
|
|
+ rsp.put("modelType", modelType);
|
|
|
|
|
|
OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
Request request = new Request.Builder()
|
|
|
.addHeader("access_token",token)
|
|
|
.addHeader("Authorization",Authorization)
|
|
|
- .url(LiveBroadcast.DELETE)
|
|
|
+ .url(LiveBroadcast.SAVE)
|
|
|
.method("post", RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), JsonUtil.toJson(rsp)))
|
|
|
.post(RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), JsonUtil.toJson(rsp)))
|
|
|
.build();
|
|
@@ -291,4 +372,50 @@ public class LiveBroadcastController {
|
|
|
return AjaxResult.success(result);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取Web端视频监控画面
|
|
|
+ */
|
|
|
+ @ApiOperation("获取Web端视频监控画面")
|
|
|
+ @PostMapping(value = "/videoWeb")
|
|
|
+ public AjaxResult videoWeb(@RequestParam(value = "deviceSerial") String deviceSerial,
|
|
|
+ @RequestParam(value = "channelNo",required = false) String channelNo,
|
|
|
+ @RequestParam(value = "videoLevel",required = false) String videoLevel,
|
|
|
+ @RequestParam(value = "recordType",required = false) String recordType,
|
|
|
+ @RequestParam(value = "projectId") String projectId,
|
|
|
+ @RequestParam(value = "Authorization") String Authorization,
|
|
|
+ @RequestParam(value = "token") String token
|
|
|
+ ) {
|
|
|
+
|
|
|
+ Map<String, Object> rsp = new HashMap<>();
|
|
|
+
|
|
|
+ rsp.put("deviceSerial", deviceSerial);
|
|
|
+ rsp.put("projectId", projectId);
|
|
|
+ rsp.put("channelNo", channelNo);
|
|
|
+ rsp.put("videoLevel", videoLevel);
|
|
|
+ rsp.put("recordType", recordType);
|
|
|
+
|
|
|
+ OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
+ Request request = new Request.Builder()
|
|
|
+ .addHeader("access_token",token)
|
|
|
+ .addHeader("Authorization",Authorization)
|
|
|
+ .url(LiveBroadcast.VIDEO_WEB)
|
|
|
+ .method("post", RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), JsonUtil.toJson(rsp)))
|
|
|
+ .post(RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), JsonUtil.toJson(rsp)))
|
|
|
+ .build();
|
|
|
+
|
|
|
+ System.out.println("请求数据= " + JsonUtil.toJson(rsp));
|
|
|
+ String s;
|
|
|
+ try {
|
|
|
+ s = Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
|
|
|
+ } catch (IOException e) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return AjaxResult.error("请求反馈异常," + e.getMessage());
|
|
|
+ }
|
|
|
+ System.out.println(s);
|
|
|
+ JSONObject result = JSON.parseObject(s);
|
|
|
+ return AjaxResult.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|