|
@@ -30,7 +30,7 @@ public class AppCameraController extends AppBaseController {
|
|
|
/**
|
|
|
* 附近摄像头列表
|
|
|
*
|
|
|
- * @return
|
|
|
+ * @return AjaxResult
|
|
|
* @Version 1.0
|
|
|
* @author wang_xy
|
|
|
* @since 2023/2/22 10:47
|
|
@@ -257,34 +257,45 @@ public class AppCameraController extends AppBaseController {
|
|
|
/**
|
|
|
* 查询视联网详情
|
|
|
*
|
|
|
- * @param id 视联网设备ID
|
|
|
- * @param type 请求的数据类型:1=视联网/2=物联网/3=云广播
|
|
|
+ * @param id 视联网设备ID
|
|
|
* @return AjaxResult
|
|
|
*/
|
|
|
@GetMapping("/getCameraById")
|
|
|
- public AjaxResult getCameraByCameraId(@RequestParam("id") String id, @RequestParam("type") String type) {
|
|
|
- AjaxResult result;
|
|
|
- StringBuilder urlType = new StringBuilder();
|
|
|
- if ("1".equals(type)) {
|
|
|
- result = remoteMonitorBaseService.selectByCameraId(id);
|
|
|
- urlType.append("cameraImagesList");
|
|
|
- } else if ("2".equals(type)) {
|
|
|
- result = remoteMonitorBaseService.selectByDeviceId(id);
|
|
|
- urlType.append("deviceImagesList");
|
|
|
- } else if ("3".equals(type)) {
|
|
|
- result = remoteMonitorBaseService.selectByBroadcastId(id);
|
|
|
- urlType.append("broadcastImagesList");
|
|
|
- } else {
|
|
|
- return AjaxResult.error("Request type is not found!");
|
|
|
- }
|
|
|
- if ("200".equals(result.get("code").toString())) {
|
|
|
- Map<String, Object> data = (Map<String, Object>) result.get("data");
|
|
|
- List<LinkedHashMap<String, Object>> dataList = (List<LinkedHashMap<String, Object>>) data.get(urlType.toString());
|
|
|
+ public AjaxResult getCameraByCameraId(@RequestParam("id") String id) {
|
|
|
+ return replacePictures(remoteMonitorBaseService.selectByCameraId(id), "cameraImagesList");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询物联网详情
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("getDeviceById")
|
|
|
+ public AjaxResult getDeviceById(@RequestParam("id") String id) {
|
|
|
+ return replacePictures(remoteMonitorBaseService.selectByDeviceId(id), "deviceImagesList");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询云广播详情
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("getBroadcastById")
|
|
|
+ public AjaxResult getBroadcastById(@RequestParam("id") String id) {
|
|
|
+ return replacePictures(remoteMonitorBaseService.selectByBroadcastId(id), "broadcastImagesList");
|
|
|
+ }
|
|
|
+
|
|
|
+ private static AjaxResult replacePictures(AjaxResult ajaxResult, String type) {
|
|
|
+ if ("200".equals(ajaxResult.get("code").toString())) {
|
|
|
+ Map<String, Object> data = (Map<String, Object>) ajaxResult.get("data");
|
|
|
+ List<LinkedHashMap<String, Object>> dataList = (List<LinkedHashMap<String, Object>>) data.get(type);
|
|
|
PictureReplaceAll.replaceAllPictureUrl(dataList, "url");
|
|
|
- data.put(urlType.toString(), dataList);
|
|
|
+ data.put(type, dataList);
|
|
|
return AjaxResult.success(data);
|
|
|
} else {
|
|
|
- return result;
|
|
|
+ return ajaxResult;
|
|
|
}
|
|
|
}
|
|
|
|