|
@@ -6,20 +6,17 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.welampiot.common.BaseResult;
|
|
|
import com.welampiot.common.Constant;
|
|
|
import com.welampiot.common.InterfaceResultEnum;
|
|
|
-import com.welampiot.common.ResultEnum;
|
|
|
-import com.welampiot.dto.UserDTO;
|
|
|
import com.welampiot.dto.VideoMonitorDTO;
|
|
|
-import com.welampiot.dto.WaterImmersionDevInfoDTO;
|
|
|
import com.welampiot.service.SystemConfigService;
|
|
|
import com.welampiot.service.VideoMonitorService;
|
|
|
-import com.welampiot.utils.MD5Utils;
|
|
|
import com.welampiot.utils.ToolUtils;
|
|
|
import com.welampiot.utils.VideoUtil;
|
|
|
import com.welampiot.utils.WebUtils;
|
|
|
-import com.welampiot.vo.LoginVO;
|
|
|
+import com.welampiot.vo.VideoMonitorDetailVO;
|
|
|
import com.welampiot.vo.VideoMonitorVO;
|
|
|
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;
|
|
@@ -30,6 +27,7 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
|
|
|
@RestController
|
|
|
@CrossOrigin
|
|
@@ -230,4 +228,120 @@ public class VideoController {
|
|
|
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);
|
|
|
+ }
|
|
|
}
|