| | |
| | | import cn.gistack.sm.hk.constant.ProtocolConstant; |
| | | import cn.gistack.sm.hk.service.HkService; |
| | | import cn.gistack.sm.hk.vo.HkVO; |
| | | import cn.gistack.sm.hk.vo.VideoVO; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.gistack.sm.hk.util.GetCameraUtils.*; |
| | |
| | | @ApiOperation(value = "海康设备-海康播放url查询(ws)", notes = "海康设备-海康播放url查询(ws)") |
| | | @GetMapping(value = "/queryHkPreviewUrl") |
| | | public R queryHkPreviewUrl(HkVO hk) { |
| | | String expand = ""; |
| | | if (null!=hk.getExpand() && !hk.getExpand().equals("")){ |
| | | expand = hk.getExpand(); |
| | | } |
| | | String url = ""; |
| | | // 获取海康播放url |
| | | String result = GetCameraPreviewURL(null==hk.getType()?1:hk.getType(),HkConstant.previewURLs, hk.getCameraIndexCode(), ProtocolConstant.WS); |
| | | String result = GetCameraPreviewURL(null==hk.getType()?1:hk.getType(), |
| | | HkConstant.previewURLs, |
| | | hk.getCameraIndexCode(), |
| | | ProtocolConstant.WS, |
| | | expand); |
| | | if (null!=result) { |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | Map map = (Map) jsonObject.get("data"); |
| | |
| | | @GetMapping(value = "/queryHkPreviewUrlCommon") |
| | | public R queryHkPreviewUrlCommon(HkVO hk) { |
| | | String url = ""; |
| | | String expand = ""; |
| | | if (null!=hk.getExpand() && !hk.getExpand().equals("")){ |
| | | expand = hk.getExpand(); |
| | | } |
| | | // 获取海康播放url |
| | | String result = GetCameraPreviewURL(null==hk.getType()?1:hk.getType(),HkConstant.previewURLs, hk.getCameraIndexCode(), hk.getProtocol()); |
| | | String result = GetCameraPreviewURL(null==hk.getType()?1:hk.getType(), |
| | | HkConstant.previewURLs, |
| | | hk.getCameraIndexCode(), |
| | | hk.getProtocol(), |
| | | expand); |
| | | if (null!=result) { |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | Map map = (Map) jsonObject.get("data"); |
| | |
| | | @GetMapping(value = "/queryHkPreviewUrlByHls") |
| | | public R queryHkPreviewUrlByHls(HkVO hk) { |
| | | String url = ""; |
| | | String expand = ""; |
| | | if (null!=hk.getExpand() && !hk.getExpand().equals("")){ |
| | | expand = hk.getExpand(); |
| | | } |
| | | // 获取海康播放url |
| | | String result = GetCameraPreviewURL(null==hk.getType()?1:hk.getType(),HkConstant.previewURLs, hk.getCameraIndexCode(), ProtocolConstant.HLS); |
| | | String result = GetCameraPreviewURL(null==hk.getType()?1:hk.getType(), |
| | | HkConstant.previewURLs, |
| | | hk.getCameraIndexCode(), |
| | | ProtocolConstant.HLS, |
| | | expand); |
| | | if (null!=result) { |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | Map map = (Map) jsonObject.get("data"); |
| | |
| | | return R.data(common(null==hk.getType()?1:hk.getType(),HkConstant.talkURLs, body)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置监控点的预置点信息 |
| | | * @param hk 查询参数 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "海康设备-设置监控点的预置点信息", notes = "海康设备-设置监控点的预置点信息") |
| | | @GetMapping(value = "/presetsAddition") |
| | | public R presetsAddition(HkVO hk) { |
| | | /** |
| | | * 组装请求参数 |
| | | */ |
| | | JSONObject jsonBody = new JSONObject(); |
| | | jsonBody.put("cameraIndexCode", hk.getCameraIndexCode()); |
| | | jsonBody.put("presetName", hk.getPresetName()); |
| | | jsonBody.put("presetIndex", hk.getPresetIndex()); |
| | | String body = jsonBody.toJSONString(); |
| | | |
| | | /** |
| | | * 调用接口并返回数据 |
| | | * post请求application/json类型参数; |
| | | */ |
| | | return R.data(common(null==hk.getType()?1:hk.getType(),HkConstant.presetsAdditionURLs, body)); |
| | | } |
| | | |
| | | /** |
| | | * 删除监控点的预置点信息 |
| | | * @param hk 查询参数 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "海康设备-删除监控点的预置点信息", notes = "海康设备-删除监控点的预置点信息") |
| | | @GetMapping(value = "/presetsDeletion") |
| | | public R presetsDeletion(HkVO hk) { |
| | | /** |
| | | * 组装请求参数 |
| | | */ |
| | | JSONObject jsonBody = new JSONObject(); |
| | | jsonBody.put("cameraIndexCode", hk.getCameraIndexCode()); |
| | | jsonBody.put("presetIndex", hk.getPresetIndex()); |
| | | String body = jsonBody.toJSONString(); |
| | | |
| | | /** |
| | | * 调用接口并返回数据 |
| | | * post请求application/json类型参数; |
| | | */ |
| | | return R.data(common(null==hk.getType()?1:hk.getType(),HkConstant.presetsDeletionURLs, body)); |
| | | } |
| | | |
| | | /** |
| | | * 同步水库设备信息 |
| | | * @param hk 水库设备 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "海康设备-同步水库设备信息", notes = "海康设备-同步水库设备信息") |
| | | @PostMapping(value = "/syncVideo") |
| | | public R syncVideo(@RequestBody HkVO hk) { |
| | | /** |
| | | * 组装请求参数 |
| | | */ |
| | | List<VideoVO> list = new ArrayList<>(); |
| | | VideoVO video = new VideoVO(); |
| | | video.setRegionName(hk.getRegionName()); |
| | | video.setRegionIndexCode(hk.getRegionIndexCode()); |
| | | video.setParentIndexCode("root000000"); |
| | | video.setRegionType(10); |
| | | list.add(video); |
| | | String body = JSON.toJSONString(list); |
| | | |
| | | /** |
| | | * 调用接口并返回数据 |
| | | * post请求application/json类型参数; |
| | | */ |
| | | return R.data(JSONObject.parseObject(common(null==hk.getType()?2:hk.getType(),HkConstant.batchAddURLs, body))); |
| | | } |
| | | |
| | | } |