| | |
| | | package com.sandu.ximon.admin.controller; |
| | | |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.param.MonitorParam; |
| | | import com.sandu.ximon.admin.service.MonitorService; |
| | | import com.sandu.ximon.dao.domain.Monitor; |
| | | import com.sandu.ximon.dao.domain.YSY_MonitorDto; |
| | | import com.sandu.ximon.admin.dto.YSY_MonitorDto; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | return ResponseUtil.success(addMonitorDto); |
| | | } else if ("20017".equals(addMonitorDto.getCode())) { |
| | | //已经被自己添加的摄像头需要添加到数据库 |
| | | getYSYMonitorInfoAndaddMonitorToTable(monitorParam); |
| | | return ResponseUtil.error(20017, addMonitorDto.getMsg()); |
| | | boolean falg = getYSYMonitorInfoAndaddMonitorToTable(monitorParam); |
| | | if (falg) { |
| | | return ResponseUtil.success("添加摄像头成功!"); |
| | | |
| | | } else { |
| | | return ResponseUtil.fail("添加摄像头失败!"); |
| | | } |
| | | |
| | | } else { |
| | | return ResponseUtil.fail(addMonitorDto.getMsg()); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getYSYMonitorInfoAndaddMonitorToTable") |
| | | public ResponseVO<Object> getYSYMonitorInfoAndaddMonitorToTable(@RequestBody MonitorParam monitorParam) { |
| | | public boolean getYSYMonitorInfoAndaddMonitorToTable(@RequestBody MonitorParam monitorParam) { |
| | | YSY_MonitorDto getMonitorDto = monitorService.getYSYMonitorInfo(monitorParam.getAccessToken(), monitorParam.getDeviceSerial()); |
| | | |
| | | if ("200".equals(getMonitorDto.getCode())) { |
| | |
| | | monitor.setIsEncrypt(getMonitorDto.getData().getIsEncrypt()); |
| | | monitor.setAddTime(getMonitorDto.getData().getUpdateTime()); |
| | | monitor.setNetAddress(getMonitorDto.getData().getNetAddress()); |
| | | boolean flag = monitorService.addMonitorInfoToTable(monitor); |
| | | |
| | | if (flag) { |
| | | return ResponseUtil.success("储存摄像头设备信息成功!"); |
| | | } else { |
| | | |
| | | return ResponseUtil.fail("储存摄像头设备信息失败!"); |
| | | } |
| | | |
| | | return monitorService.addMonitorInfoToTable(monitor); |
| | | } else { |
| | | return ResponseUtil.fail(getMonitorDto.getMsg()); |
| | | throw new BusinessException(getMonitorDto.getMsg()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 编辑摄像头设备信息 |
| | | */ |
| | | /** |
| | | * 获取单个设备信息 getYSYMonitorInfo |
| | | * 编辑摄像头设备信息 |
| | | */ |
| | | @PostMapping("/UpDateMonitorInfo") |
| | | public ResponseVO<Object> UpDateMonitorInfo(@RequestBody MonitorParam monitorParam) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 编辑摄像头设备信息 |
| | | */ |
| | | @GetMapping("/getMonitorVideoUrl") |
| | | public ResponseVO<Object> getMonitorVideoUrl(@RequestBody MonitorParam monitorParam) { |
| | | String URL = monitorService.getMonitorVideoUrl(monitorParam.getAccessToken(), monitorParam.getDeviceSerial(), monitorParam.getProtocol()); |
| | | |
| | | return ResponseUtil.success(URL); |
| | | } |
| | | |
| | | } |