123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519 |
- package com.welampiot.controller;
- import com.alibaba.fastjson.JSON;
- import com.alibaba.fastjson.JSONArray;
- import com.alibaba.fastjson.JSONObject;
- import com.welampiot.common.BaseResult;
- import com.welampiot.common.Constant;
- import com.welampiot.common.InterfaceResultEnum;
- import com.welampiot.dto.VideoMonitorDTO;
- import com.welampiot.dto.VideoPointInfoDTO;
- import com.welampiot.service.SystemConfigService;
- import com.welampiot.service.VideoMonitorService;
- import com.welampiot.service.VideoPointInfoService;
- import com.welampiot.utils.ToolUtils;
- import com.welampiot.utils.VideoUtil;
- import com.welampiot.utils.WebUtils;
- import com.welampiot.vo.VideoMonitorDetailVO;
- import com.welampiot.vo.VideoMonitorVO;
- import com.welampiot.vo.VideoPointInfoVO;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.BeanUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.CrossOrigin;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- import javax.servlet.http.HttpServletRequest;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.List;
- @RestController
- @CrossOrigin
- @RequestMapping("/video")
- public class VideoController {
- private final static Logger log = LoggerFactory.getLogger(VideoController.class);
- @Autowired
- private ToolUtils toolUtils;
- @Autowired
- private VideoMonitorService videoMonitorService;
- @Autowired
- private SystemConfigService systemConfigService;
- @Autowired
- private VideoPointInfoService videoPointInfoService;
- /**
- * 设置AI开关状态
- * @param request
- * @return
- */
- @RequestMapping(value = "/setAiStatus", method = RequestMethod.POST)
- public BaseResult setAiStatus(HttpServletRequest request){
- int version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
- int lampPoleId = request.getParameter("lampPoleId") == null ? 0 : Integer.parseInt(request.getParameter("lampPoleId"));
- int status = request.getParameter("status") == null ? 0 : Integer.parseInt(request.getParameter("status"));
- VideoMonitorDTO videoMonitorDTO = new VideoMonitorDTO();
- videoMonitorDTO.setLampPoleId(lampPoleId);
- videoMonitorDTO.setIsInspect(status);
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
- }
- /**
- * 获取摄像头回放列表
- * @param videoMonitorDTO
- * @return
- */
- @RequestMapping(value = "/getRecordList", method = RequestMethod.POST)
- public BaseResult getRecordList(VideoMonitorDTO videoMonitorDTO){
- int version = videoMonitorDTO.getVersion();
- long startTime = System.currentTimeMillis() - 24 * 3600 * 1000;
- ArrayList<VideoMonitorDTO> videoMonitorDTOS = new ArrayList<>();
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- while (System.currentTimeMillis() > startTime + 20 * 60 * 1000) {
- VideoMonitorDTO videoMonitorDTO1 = new VideoMonitorDTO();
- videoMonitorDTO1.setStartTime(simpleDateFormat.format(new Date(startTime)));
- videoMonitorDTO1.setEndTime(simpleDateFormat.format(new Date(startTime + 20 * 60 * 1000)));
- videoMonitorDTOS.add(videoMonitorDTO1);
- }
- VideoMonitorVO videoMonitorVO = new VideoMonitorVO();
- videoMonitorVO.setList(videoMonitorDTOS);
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,videoMonitorVO);
- }
- /**
- * 获取回放播放地址
- * @param videoMonitorDTO
- * @return
- */
- @RequestMapping(value = "/getRecordPlay", method = RequestMethod.POST)
- public BaseResult getRecordPlay(VideoMonitorDTO videoMonitorDTO){
- int version = videoMonitorDTO.getVersion();
- Integer id = videoMonitorDTO.getId();
- String startTime = videoMonitorDTO.getStartTime();
- String endTime = videoMonitorDTO.getEndTime();
- if (startTime == null || endTime == null) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
- VideoMonitorDTO oneById = videoMonitorService.getOneById(id);
- String gbAddress = oneById.getGbAddress();
- String gbPlayBackAddress = VideoUtil.getGbPlayBackAddress(videoMonitorService, systemConfigService, gbAddress, startTime, endTime);
- VideoMonitorDTO videoMonitorDTO1 = new VideoMonitorDTO();
- videoMonitorDTO1.setAddress(gbPlayBackAddress);
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,videoMonitorDTO1);
- }
- /**
- * 获取NVR通道值信息
- * @param videoMonitorDTO
- * @return
- */
- @RequestMapping(value = "/getChannelValue", method = RequestMethod.POST)
- public BaseResult getChannelValue(VideoMonitorDTO videoMonitorDTO){
- int version = videoMonitorDTO.getVersion();
- Integer id = videoMonitorDTO.getId();
- if (id == null || id == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
- VideoMonitorDTO oneById = videoMonitorService.getOneById(id);
- String url = Constant.GB_HOST_ADDRESS+"/api/devices";
- String s = WebUtils.requestGet(url);
- JSONArray jsonArray = JSON.parseArray(s);
- JSONObject data = null;
- if (jsonArray != null){
- for (Object j: jsonArray) {
- JSONObject j1 = (JSONObject) j;
- String deviceId = (String) j1.get("deviceId");
- if (deviceId.equalsIgnoreCase(oneById.getGbAddress())){
- data = j1;
- }
- }
- }
- ArrayList<Object> objects = new ArrayList<>();
- if (data != null){
- for (Object channelMap : (JSONArray) data.get("channelMap")) {
- JSONObject channelMap1 = (JSONObject) channelMap;
- VideoMonitorDTO videoMonitorDTO1 = new VideoMonitorDTO();
- videoMonitorDTO1.setName((String) channelMap1.get("name"));
- videoMonitorDTO1.setChannelId((String) channelMap1.get("channelId"));
- objects.add(videoMonitorDTO1);
- }
- }
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,objects);
- }
- /**
- * NVR获取回放列表
- * @param videoMonitorDTO
- * @return
- */
- @RequestMapping(value = "/getNvrRecordList", method = RequestMethod.POST)
- public BaseResult getNvrRecordList(VideoMonitorDTO videoMonitorDTO){
- int version = videoMonitorDTO.getVersion();
- long startTime = System.currentTimeMillis() - 24 * 3600 * 1000;
- ArrayList<VideoMonitorDTO> videoMonitorDTOS = new ArrayList<>();
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- while (System.currentTimeMillis() > startTime + 20 * 60 * 1000) {
- VideoMonitorDTO videoMonitorDTO1 = new VideoMonitorDTO();
- videoMonitorDTO1.setStartTime(simpleDateFormat.format(new Date(startTime)));
- videoMonitorDTO1.setEndTime(simpleDateFormat.format(new Date(startTime + 20 * 60 * 1000)));
- videoMonitorDTOS.add(videoMonitorDTO1);
- }
- VideoMonitorVO videoMonitorVO = new VideoMonitorVO();
- videoMonitorVO.setList(videoMonitorDTOS);
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,videoMonitorVO);
- }
- /**
- * NVR获取回放地址
- * @param videoMonitorDTO
- * @return
- */
- @RequestMapping(value = "/getPlayBackAddressByChannel", method = RequestMethod.POST)
- public BaseResult getPlayBackAddressByChannel(VideoMonitorDTO videoMonitorDTO){
- int version = videoMonitorDTO.getVersion();
- if (videoMonitorDTO.getId() == null || videoMonitorDTO.getChannel() == null || videoMonitorDTO.getStartTime() == null || videoMonitorDTO.getEndTime() == null) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
- VideoMonitorDTO oneById = videoMonitorService.getOneById(videoMonitorDTO.getId());
- String nvrGbPlayBackAddress = VideoUtil.getNvrGbPlayBackAddress(videoMonitorService, systemConfigService, oneById.getGbAddress(), videoMonitorDTO.getStartTime(), videoMonitorDTO.getEndTime(), videoMonitorDTO.getChannel());
- VideoMonitorDTO videoMonitorDTO1 = new VideoMonitorDTO();
- videoMonitorDTO1.setAddress(nvrGbPlayBackAddress);
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,videoMonitorDTO1);
- }
- /**
- * NVR获取通道播放地址
- * @param videoMonitorDTO
- * @return
- */
- @RequestMapping(value = "/getPlayAddressByChannel", method = RequestMethod.POST)
- public BaseResult getPlayAddressByChannel(VideoMonitorDTO videoMonitorDTO){
- int version = videoMonitorDTO.getVersion();
- if (videoMonitorDTO.getId() == null || videoMonitorDTO.getChannel() == null || videoMonitorDTO.getStartTime() == null || videoMonitorDTO.getEndTime() == null) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
- VideoMonitorDTO oneById = videoMonitorService.getOneById(videoMonitorDTO.getId());
- String nvrGbPlayBackAddress = VideoUtil.getNvrGbPlayAddress(videoMonitorService, systemConfigService, oneById.getGbAddress(), videoMonitorDTO.getChannel());
- VideoMonitorDTO videoMonitorDTO1 = new VideoMonitorDTO();
- videoMonitorDTO1.setAddress(nvrGbPlayBackAddress);
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,videoMonitorDTO1);
- }
- /**
- * 设置报警位
- * @param videoMonitorDTO
- * @return
- */
- @RequestMapping(value = "/setEmergencyLocation", method = RequestMethod.POST)
- public BaseResult setEmergencyLocation(VideoMonitorDTO videoMonitorDTO){
- int version = videoMonitorDTO.getVersion();
- if (videoMonitorDTO.getId() == null) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
- VideoMonitorDTO oneById = videoMonitorService.getOneById(videoMonitorDTO.getId());
- String url = Constant.GB_HOST_ADDRESS+"/api/postion/"+oneById.getGbAddress()+"/34020000001320000001";
- String param = "{\"code\":1,\"postion\":1}";
- WebUtils.requestPost(url, param);
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
- }
- /**
- * 查看报警位
- * @param videoMonitorDTO
- * @return
- */
- @RequestMapping(value = "/getEmergencyLocation", method = RequestMethod.POST)
- public BaseResult getEmergencyLocation(VideoMonitorDTO videoMonitorDTO){
- int version = videoMonitorDTO.getVersion();
- if (videoMonitorDTO.getId() == null) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
- VideoMonitorDTO oneById = videoMonitorService.getOneById(videoMonitorDTO.getId());
- String url = Constant.GB_HOST_ADDRESS+"/api/postion/"+oneById.getGbAddress()+"/34020000001320000001";
- String param = "{\"code\":2,\"postion\":1}";
- WebUtils.requestPost(url, param);
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
- }
- /**
- * 视屏监控列表
- * @param request 路段,关键字搜索,分页
- * @return 视屏监控列表
- */
- @RequestMapping(value = "/getList", method = RequestMethod.POST)
- public BaseResult<?> getList(HttpServletRequest request) {
- Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
- Integer page = (Integer) toolUtils.getRequestContent(request,"page",1);
- Integer count = (Integer) toolUtils.getRequestContent(request,"count",1);
- Integer areaId = (Integer) toolUtils.getRequestContent(request,"areaId",1);
- Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",1);
- String keyword = (String) toolUtils.getRequestContent(request,"keyword",2);
- if (page == 0) page = 1;
- if (count == 0) count = 16;
- VideoMonitorVO vo = new VideoMonitorVO();
- vo.setLimit(count * (page - 1));
- vo.setOffset(count);
- vo.setAreaId(areaId);
- vo.setSectionId(sectionId);
- vo.setKeyword(keyword);
- vo.setSectionList(toolUtils.getSectionList(request));
- List<VideoMonitorDTO> videoList = videoMonitorService.getVideoListByVO(vo);
- Integer total = videoMonitorService.getVideoTotal(vo);
- VideoMonitorVO videoMonitorVO = new VideoMonitorVO();
- videoMonitorVO.setList(videoList);
- videoMonitorVO.setTotal((int) Math.ceil(total / (double) count));
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,videoMonitorVO);
- }
- /**
- * 视屏监控详情
- * @param vo id
- * @return 视屏监控详情
- */
- @RequestMapping(value = "/info", method = RequestMethod.POST)
- public BaseResult<?> info(VideoMonitorVO vo) {
- if (vo.getVersion() == null) vo.setVersion(0);
- Integer version = vo.getVersion();
- Integer id = vo.getId();
- if (id == null || id == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
- VideoMonitorDTO videoMonitorDTO = videoMonitorService.getVideoMonitorDetailsById(vo);
- if (videoMonitorDTO == null) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL,version);
- VideoMonitorDetailVO videoMonitorDetailVO = new VideoMonitorDetailVO();
- BeanUtils.copyProperties(videoMonitorDTO,videoMonitorDetailVO);
- if (videoMonitorDetailVO.getType() != null && videoMonitorDetailVO.getType() == 1) {
- videoMonitorDetailVO.setTypeStr("NVR");
- } else {
- videoMonitorDetailVO.setTypeStr("IPC");
- }
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,videoMonitorDetailVO);
- }
- /**
- * 添加/编辑视屏监控
- * @param vo 视屏监控字段
- * @return 添加/编辑视屏监控
- */
- @RequestMapping(value = "/save", method = RequestMethod.POST)
- public BaseResult<?> save(VideoMonitorDetailVO vo) {
- if (vo.getVersion() == null) vo.setVersion(0);
- Integer version = vo.getVersion();
- Integer id = vo.getId();
- if (vo.getName() == null || vo.getName().trim().isEmpty())
- return toolUtils.response(InterfaceResultEnum.LACK_NAME_ERROR,version);
- if (vo.getSectionId() == null || vo.getSectionId() == 0)
- return toolUtils.response(InterfaceResultEnum.LACK_SECTION_ERROR,version);
- if (vo.getAreaId() == null || vo.getAreaId() == 0)
- return toolUtils.response(InterfaceResultEnum.LACK_AREA_ERROR,version);
- if (vo.getDevId() == null || vo.getDevId().isEmpty())
- return toolUtils.response(InterfaceResultEnum.LACK_DEV_SN_ERROR,version);
- if (vo.getPassword() == null || vo.getPassword().isEmpty())
- return toolUtils.response(InterfaceResultEnum.LACK_DEV_CODE_ERROR,version);
- if (vo.getDeviceType() == null)
- return toolUtils.response(InterfaceResultEnum.LACK_DEV_TYPE_ERROR,version);
- if (vo.getType() == null)
- return toolUtils.response(InterfaceResultEnum.LACK_VIDEO_TYPE_ERROR,version);
- VideoMonitorDTO videoMonitorDTO = new VideoMonitorDTO();
- BeanUtils.copyProperties(vo,videoMonitorDTO);
- VideoMonitorDTO dto = new VideoMonitorDTO();
- if (id == null || id == 0) { // 添加
- dto.setDevId(vo.getDevId());
- if (videoMonitorService.checkVideoDevId(dto) > 0)
- return toolUtils.response(InterfaceResultEnum.DEV_SN_UNIQUE_ERROR,version);
- videoMonitorService.addVideoMonitorData(videoMonitorDTO);
- } else { // 编辑
- dto.setId(id);
- dto.setDevId(vo.getDevId());
- if (videoMonitorService.checkVideoDevId(dto) > 0)
- return toolUtils.response(InterfaceResultEnum.DEV_SN_UNIQUE_ERROR,version);
- videoMonitorService.updateVideoMonitorData(videoMonitorDTO);
- }
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
- }
- /**
- * 删除视屏监控
- * @param vo id
- * @return 删除视屏监控
- */
- @RequestMapping(value = "/del", method = RequestMethod.POST)
- public BaseResult<?> del(VideoMonitorVO vo) {
- if (vo.getVersion() == null) vo.setVersion(0);
- Integer version = vo.getVersion();
- String videoId = vo.getVideoId();
- if (videoId == null || videoId.trim().isEmpty())
- return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
- String[] split = videoId.split(",");
- for (String s : split) {
- Integer id = Integer.valueOf(s);
- videoMonitorService.deleteVideoMonitorById(id);
- }
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
- }
- /**
- * 获取视屏监控点位信息
- * @param vo id
- * @return 获取视屏监控点位信息
- */
- @RequestMapping(value = "/getPointInfo", method = RequestMethod.POST)
- public BaseResult<?> getPointInfo(VideoPointInfoVO vo) {
- if (vo.getVersion() == null) vo.setVersion(0);
- Integer version = vo.getVersion();
- Integer id = vo.getId();
- if (id == null || id == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
- List<VideoPointInfoDTO> videoPointList = videoPointInfoService.getVideoPointListByVideoId(id);
- VideoPointInfoVO videoPointInfoVO = new VideoPointInfoVO();
- videoPointInfoVO.setList(videoPointList);
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,videoPointInfoVO);
- }
- /**
- * 设置点位信息
- * @param vo 点位属性
- * @return 设置点位信息
- */
- @RequestMapping(value = "/setPointInfo", method = RequestMethod.POST)
- public BaseResult<?> setPointInfo(VideoPointInfoVO vo) {
- if (vo.getVersion() == null) vo.setVersion(0);
- Integer version = vo.getVersion();
- Integer point = vo.getPoint();
- Integer time = vo.getTime();
- Integer videoId = vo.getVideoId();
- if (point == null || time == null || videoId == null)
- return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
- VideoPointInfoDTO videoPointInfoDTO = new VideoPointInfoDTO();
- BeanUtils.copyProperties(vo,videoPointInfoDTO);
- videoPointInfoService.addVideoPointData(videoPointInfoDTO);
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
- }
- /**
- * 设置点位状态
- * @param vo 点位属性
- * @return 设置点位状态
- */
- @RequestMapping(value = "/setPointStatus", method = RequestMethod.POST)
- public BaseResult<?> setPointStatus(VideoPointInfoVO vo) {
- if (vo.getVersion() == null) vo.setVersion(0);
- Integer version = vo.getVersion();
- Integer point = vo.getPoint();
- Integer status = vo.getStatus();
- Integer videoId = vo.getVideoId();
- if (point == null || status == null || videoId == null)
- return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
- VideoPointInfoDTO videoPointInfoDTO = new VideoPointInfoDTO();
- BeanUtils.copyProperties(vo,videoPointInfoDTO);
- videoPointInfoService.updateVideoPointStatus(videoPointInfoDTO);
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
- }
- /**
- * 云台控制
- * @param request
- * @return
- */
- @RequestMapping(value = "/yunStart", method = RequestMethod.POST)
- public BaseResult yunStart(HttpServletRequest request){
- Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
- Integer direction = (Integer) toolUtils.getRequestContent(request,"direction",1);
- String deviceSerial = (String) toolUtils.getRequestContent(request,"deviceSerial",2);
- if (deviceSerial.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
- String requestData = "{\"moveSpeed\":130,\"zoomSpeed\":130";
- switch (direction){
- case 0:
- requestData += ",\"upDown\":1,\"leftRight\":0,\"inOut\":0";
- case 1:
- requestData += ",\"upDown\":2,\"leftRight\":0,\"inOut\":0";
- case 2:
- requestData += ",\"upDown\":0,\"leftRight\":1,\"inOut\":0";
- case 3:
- requestData += ",\"upDown\":0,\"leftRight\":2,\"inOut\":0";
- case 4:
- requestData += ",\"upDown\":1,\"leftRight\":1,\"inOut\":0";
- case 5:
- requestData += ",\"upDown\":2,\"leftRight\":1,\"inOut\":0";
- case 6:
- requestData += ",\"upDown\":1,\"leftRight\":2,\"inOut\":0";
- case 7:
- requestData += ",\"upDown\":2,\"leftRight\":2,\"inOut\":0";
- case 8:
- requestData += ",\"upDown\":0,\"leftRight\":0,\"inOut\":2";
- case 9:
- requestData += ",\"upDown\":0,\"leftRight\":0,\"inOut\":1";
- }
- requestData += "}";
- VideoMonitorDTO oneByDevId = videoMonitorService.getOneByDevId(deviceSerial);
- String url1 = Constant.GB_HOST_ADDRESS+"/api/ptz/"+oneByDevId.getGbAddress()+"/34020000001320000001";
- WebUtils.requestPost(url1, requestData);
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- // throw new RuntimeException(e);
- }
- requestData = "{\"upDown\":0,\"leftRight\":0,\"inOut\":0,\"moveSpeed\":0,\"zoomSpeed\":0}";
- WebUtils.requestPost(url1, requestData);
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
- }
- /**
- * 播放视屏监控
- * @param request
- * @return
- */
- @RequestMapping(value = "/videoPlay", method = RequestMethod.POST)
- public BaseResult videoPlay(HttpServletRequest request){
- Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
- Integer id = (Integer) toolUtils.getRequestContent(request,"id",1);
- if (id == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
- VideoMonitorDTO oneById = videoMonitorService.getOneById(id);
- String gbPlayAddress = VideoUtil.getGbPlayAddress(oneById.getGbAddress());
- oneById.setHlsHd(gbPlayAddress);
- oneById.setRtmp(gbPlayAddress);
- oneById.setRtmp2(gbPlayAddress);
- oneById.setRtmpHD2(gbPlayAddress);
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,oneById);
- }
- /**
- * 播放视屏监控
- * @param request
- * @return
- */
- @RequestMapping(value = "/videoPlayAsy", method = RequestMethod.POST)
- public BaseResult videoPlayAsy(HttpServletRequest request){
- Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
- Integer id = (Integer) toolUtils.getRequestContent(request,"id",1);
- if (id == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
- VideoMonitorDTO oneById = videoMonitorService.getOneById(id);
- String gbPlayAddress = VideoUtil.getGbPlayAddress(oneById.getGbAddress());
- oneById.setHlsHd(gbPlayAddress);
- oneById.setRtmp(gbPlayAddress);
- oneById.setRtmp2(gbPlayAddress);
- oneById.setRtmpHD2(gbPlayAddress);
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,oneById);
- }
- /**
- * 查看点位
- * @param request
- * @return
- */
- @RequestMapping(value = "/viewPoint", method = RequestMethod.POST)
- public BaseResult viewPoint(HttpServletRequest request){
- Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
- Integer id = (Integer) toolUtils.getRequestContent(request,"videoId",1);
- Integer point = (Integer) toolUtils.getRequestContent(request,"point",1);
- if (id == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
- VideoMonitorDTO oneById = videoMonitorService.getOneById(id);
- point = point + 1;
- String url = Constant.GB_HOST_ADDRESS+"/api/postion/"+oneById.getGbAddress()+"/34020000001320000001";
- String param = "{\"code\":2,\"postion\":"+point+"}";
- WebUtils.requestPost(url, param);
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
- }
- }
|