| package com.dy.pipIrrWechat.video; | 
|   | 
| import com.dy.common.webUtil.BaseResponse; | 
| import com.dy.common.webUtil.BaseResponseUtils; | 
| import com.dy.common.webUtil.ResultCodeMsg; | 
| import com.dy.pipIrrGlobal.pojoVi.ViYsApp; | 
| import com.dy.pipIrrGlobal.voVi.VoCamera; | 
| import io.swagger.v3.oas.annotations.Operation; | 
| import io.swagger.v3.oas.annotations.media.Content; | 
| import io.swagger.v3.oas.annotations.media.Schema; | 
| import io.swagger.v3.oas.annotations.responses.ApiResponse; | 
| import io.swagger.v3.oas.annotations.responses.ApiResponses; | 
| import io.swagger.v3.oas.annotations.tags.Tag; | 
| import lombok.RequiredArgsConstructor; | 
| import lombok.extern.slf4j.Slf4j; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.http.MediaType; | 
| import org.springframework.web.bind.annotation.GetMapping; | 
| import org.springframework.web.bind.annotation.RequestMapping; | 
| import org.springframework.web.bind.annotation.RestController; | 
|   | 
| import java.util.ArrayList; | 
| import java.util.List; | 
|   | 
| /** | 
|  * @Author: liurunyu | 
|  * @Date: 2025/8/14 13:58 | 
|  * @Description | 
|  */ | 
| @Slf4j | 
| @Tag(name = "视频监控摄像头", description = "视频监控摄像头") | 
| @RestController | 
| @RequestMapping(path = "video") | 
| @RequiredArgsConstructor | 
| public class VideoCtrl{ | 
|   | 
|     private VideoSv sv ; | 
|   | 
|     @Autowired | 
|     public void setSv(VideoSv sv) { | 
|         this.sv = sv; | 
|     } | 
|   | 
|   | 
|     /** | 
|      * 客户端请求得到所有摄像头信息 | 
|      * @return 所有摄像头信息 | 
|      */ | 
|     @Operation(summary = "获得所有摄像头信息", description = "返回所有摄像头信息") | 
|     @ApiResponses(value = { | 
|             @ApiResponse( | 
|                     responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, | 
|                     description = "返回所有摄像头信息数据(BaseResponse.content:TypesVo[{}])", | 
|                     content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, | 
|                             schema = @Schema(implementation = VoVideo.class))} | 
|             ) | 
|     }) | 
|     @GetMapping(path = "all") | 
|     public BaseResponse<List<VoVideo>> all() { | 
|         List<VoVideo> reList = new ArrayList<>() ; | 
|         try { | 
|             List<VoCamera> list = this.sv.allCamera() ; | 
|             ViYsApp app = this.sv.ysApp() ; | 
|             if(list != null && list.size() > 0){ | 
|                 for (VoCamera voCamera : list) { | 
|                     VoVideo vvo = new VoVideo() ; | 
|                     vvo.from(voCamera, app == null ? null : app.accessToken); | 
|                     reList.add(vvo) ; | 
|                 } | 
|             } | 
|             return BaseResponseUtils.buildSuccess(reList); | 
|         } catch (Exception e) { | 
|             log.error("查询全部摄像头信息异常", e); | 
|             return BaseResponseUtils.buildException(e.getMessage()); | 
|         } | 
|     } | 
| } |