| | |
| | | package com.ld.igds.phone35.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ld.igds.camera.CameraUtil; |
| | | import com.ld.igds.constant.RespCodeEnum; |
| | | import com.ld.igds.phone35.constant.Phone35Constant; |
| | | import com.ld.igds.phone35.dto.Phone35AuthUser; |
| | | import com.ld.igds.phone35.dto.PhoneResponse; |
| | | import com.ld.igds.phone35.param.Phone35Request; |
| | | import com.ld.igds.phone35.param.Phone35VideoCommonParam; |
| | | import com.ld.igds.phone35.service.Phone35Service; |
| | | import com.ld.igds.phone35.util.PhoneRespUtil; |
| | | import com.ld.igds.sec.dto.SecCameraDto; |
| | | import com.ld.igds.sec.manager.SecManager; |
| | | import com.ld.igds.sec.service.CoreSecCameraService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 监控播放 |
| | | * |
| | | * @Author:YAN |
| | | */ |
| | | @Service |
| | | public class Phone35ServiceImpl5605 implements Phone35Service { |
| | | @Autowired |
| | | private SecManager securityManager; |
| | | @Autowired |
| | | private CoreSecCameraService secCameraService; |
| | | @Override |
| | | public String getInterfaceId() { |
| | | return Phone35Constant.API_PHONE_5605; |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | @Override |
| | | public PhoneResponse<Object> execute(Phone35Request<JSONObject> req, Phone35AuthUser phone35AuthUser) throws Exception { |
| | | return null; |
| | | //转化对象 |
| | | Phone35VideoCommonParam param = JSONObject.parseObject(req.getData().toString(), Phone35VideoCommonParam.class); |
| | | if (null == param) { |
| | | return PhoneRespUtil.error(RespCodeEnum.CODE_1111, "参数有误,请重试!!"); |
| | | } |
| | | //参数验证 |
| | | if (StringUtils.isEmpty(param.getId())) { |
| | | return PhoneRespUtil.error(RespCodeEnum.CODE_1111, "参数有误,请重试!!"); |
| | | } |
| | | if (CameraUtil.PLAY_TYPE_DEFAULT.equals(param.getPlayType())) { |
| | | return PhoneRespUtil.error(RespCodeEnum.CODE_1007, "系统未配置当前摄像头播放方式,不执行预览"); |
| | | } |
| | | |
| | | //获取设备信息 |
| | | SecCameraDto camera = secCameraService.getCameraById(phone35AuthUser.getCompanyId(), param.getId()); |
| | | if (camera == null) { |
| | | return PhoneRespUtil.error(RespCodeEnum.CODE_1007, "未查询到相关设备!"); |
| | | } |
| | | if(StringUtils.isNotEmpty(camera.getPhoneAddr())){ |
| | | camera.setPlayAddr(camera.getPhoneAddr()); |
| | | return PhoneRespUtil.success(camera, req); |
| | | } |
| | | |
| | | camera = securityManager.getPlayAddr(camera); |
| | | if (camera == null) { |
| | | return PhoneRespUtil.error(RespCodeEnum.CODE_1007,"未查询到相关设备!"); |
| | | } |
| | | |
| | | return PhoneRespUtil.success(camera, req); |
| | | } |
| | | } |