2023-11-07 09:32:12 +08:00
|
|
|
|
package com.zcloud.controller.keyProjects;
|
|
|
|
|
|
2024-05-28 18:19:46 +08:00
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import com.alibaba.druid.util.StringUtils;
|
2023-11-07 09:32:12 +08:00
|
|
|
|
import com.zcloud.controller.base.BaseController;
|
|
|
|
|
import com.zcloud.entity.Page;
|
|
|
|
|
import com.zcloud.entity.PageData;
|
2024-05-28 18:19:46 +08:00
|
|
|
|
import com.zcloud.service.keyProjects.OutSourcedService;
|
|
|
|
|
import com.zcloud.service.keyProjects.VideoManagerService;
|
2023-11-07 09:32:12 +08:00
|
|
|
|
import com.zcloud.service.keyProjects.VideoResourcesService;
|
|
|
|
|
import com.zcloud.util.DateUtil;
|
|
|
|
|
import com.zcloud.util.Jurisdiction;
|
|
|
|
|
import com.zcloud.util.Tools;
|
|
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
2024-05-28 18:19:46 +08:00
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
2023-11-07 09:32:12 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 说明:视频管理
|
|
|
|
|
* 作者:luoxiaobao
|
|
|
|
|
* 时间:2021-05-10
|
|
|
|
|
* 官网:www.zcloudchina.com
|
|
|
|
|
*/
|
|
|
|
|
@Controller
|
|
|
|
|
@RequestMapping("/videoResources")
|
|
|
|
|
public class VideoResourcesController extends BaseController {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private VideoResourcesService videoResourcesService;
|
|
|
|
|
|
2024-05-28 18:19:46 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
private VideoManagerService videoManagerService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private OutSourcedService outSourcedService;
|
|
|
|
|
|
2023-11-07 09:32:12 +08:00
|
|
|
|
/**
|
|
|
|
|
* 新增
|
|
|
|
|
*
|
|
|
|
|
* @param
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/add")
|
|
|
|
|
@RequiresPermissions("videomanager:add")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Object add() throws Exception {
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
|
|
String errInfo = "success";
|
|
|
|
|
PageData pd = this.getPageData();
|
|
|
|
|
pd.put("VIDEO_RESOURCES_ID", this.get32UUID()); //主键
|
|
|
|
|
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //操作日期
|
|
|
|
|
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //操作日期
|
2023-11-08 08:53:50 +08:00
|
|
|
|
pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //操作人
|
|
|
|
|
pd.put("CREATOR", Jurisdiction.getUSER_ID()); //操作人
|
2023-11-07 09:32:12 +08:00
|
|
|
|
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //操作人
|
|
|
|
|
pd.put("ISDELETE", "0"); //是否删除
|
|
|
|
|
videoResourcesService.save(pd);
|
|
|
|
|
map.put("result", errInfo);
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除
|
|
|
|
|
*
|
|
|
|
|
* @param
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/delete")
|
|
|
|
|
@RequiresPermissions("videomanager:del")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Object delete() throws Exception {
|
|
|
|
|
Map<String, String> map = new HashMap<String, String>();
|
|
|
|
|
String errInfo = "success";
|
|
|
|
|
PageData pd = new PageData();
|
|
|
|
|
pd = this.getPageData();
|
|
|
|
|
videoResourcesService.delete(pd);
|
|
|
|
|
map.put("result", errInfo); //返回结果
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/findById")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Object findById() {
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
String errInfo = "success";
|
|
|
|
|
PageData pd = this.getPageData();
|
|
|
|
|
PageData value = videoResourcesService.findById(pd);
|
|
|
|
|
map.put("pd", value); //返回结果
|
|
|
|
|
map.put("result", errInfo); //返回结果
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getPageOutSourceBySid")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Object getPageOutSourceBySid(Page page) {
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
String errInfo = "success";
|
|
|
|
|
PageData pd = this.getPageData();
|
|
|
|
|
page.setPd(pd);
|
|
|
|
|
List<PageData> value = videoResourcesService.getPageOutSourceBySid(page);
|
|
|
|
|
map.put("page", page); //返回结果
|
|
|
|
|
map.put("varList", value); //返回结果
|
|
|
|
|
map.put("result", errInfo); //返回结果
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 修改
|
|
|
|
|
*
|
|
|
|
|
* @param
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/edit")
|
|
|
|
|
@RequiresPermissions("videomanager:edit")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Object edit() throws Exception {
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
|
|
String errInfo = "success";
|
|
|
|
|
PageData pd = this.getPageData();
|
|
|
|
|
videoResourcesService.edit(pd);
|
|
|
|
|
map.put("result", errInfo);
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 列表
|
|
|
|
|
*
|
|
|
|
|
* @param page
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/listAll")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Object listAll() throws Exception {
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
|
|
String errInfo = "success";
|
|
|
|
|
PageData pd = this.getPageData();
|
|
|
|
|
pd.put("CORPINFO_ID",Jurisdiction.getCORPINFO_ID());
|
|
|
|
|
List<PageData> varList = videoResourcesService.listAll(pd); //列出VideoManager列表
|
|
|
|
|
map.put("varList", varList);
|
|
|
|
|
map.put("result", errInfo);
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 列表
|
|
|
|
|
*
|
|
|
|
|
* @param page
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/list")
|
|
|
|
|
@RequiresPermissions("videomanager:list")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Object list(Page page) throws Exception {
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
|
|
String errInfo = "success";
|
|
|
|
|
PageData pd = this.getPageData();
|
|
|
|
|
String KEYWORDS = pd.getString("VIDEONAME"); //关键词检索条件
|
|
|
|
|
if (Tools.notEmpty(KEYWORDS)) pd.put("VIDEONAME", KEYWORDS.trim());
|
|
|
|
|
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
|
|
|
|
|
page.setPd(pd);
|
|
|
|
|
List<PageData> varList = videoResourcesService.list(page); //列出VideoManager列表
|
|
|
|
|
map.put("varList", varList);
|
|
|
|
|
map.put("page", page);
|
|
|
|
|
map.put("result", errInfo);
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 批量删除
|
|
|
|
|
*
|
|
|
|
|
* @param
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/deleteAll")
|
|
|
|
|
@RequiresPermissions("videomanager:del")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Object deleteAll() throws Exception {
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
|
|
String errInfo = "success";
|
|
|
|
|
PageData pd = this.getPageData();
|
|
|
|
|
String DATA_IDS = pd.getString("DATA_IDS");
|
|
|
|
|
if (Tools.notEmpty(DATA_IDS)) {
|
|
|
|
|
String ArrayDATA_IDS[] = DATA_IDS.split(",");
|
|
|
|
|
videoResourcesService.deleteAll(ArrayDATA_IDS);
|
|
|
|
|
errInfo = "success";
|
|
|
|
|
} else {
|
|
|
|
|
errInfo = "error";
|
|
|
|
|
}
|
|
|
|
|
map.put("result", errInfo); //返回结果
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-05-28 18:19:46 +08:00
|
|
|
|
/**
|
|
|
|
|
* 通过摄像头查询绑定的重点工程数据
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/getRelevanceOutsourced")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Object getRelevanceOutsourced() throws Exception {
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
String errInfo = "success";
|
|
|
|
|
List<PageData> outsourcedList = Collections.emptyList();
|
|
|
|
|
// 获取该摄像头绑定的重点工程ID列表
|
|
|
|
|
List<PageData> outsourcedIds = videoManagerService.findRepeatOutSourcedIdByVideoId(this.getPageData());
|
|
|
|
|
// 非空判断
|
|
|
|
|
if (CollUtil.isNotEmpty(outsourcedIds)){
|
|
|
|
|
// 通过Ids查询重点工程数据
|
|
|
|
|
outsourcedList = outSourcedService.listOutSourcedByIds(outsourcedIds.stream().map(e -> e.getString("OUTSOURCED_ID")).collect(Collectors.toList()))
|
|
|
|
|
.stream().map(e -> {
|
|
|
|
|
// 遍历带有"VIDEOMANAGER_ID"的列表
|
|
|
|
|
outsourcedIds.forEach(
|
|
|
|
|
m -> {
|
|
|
|
|
if (StringUtils.equals(m.getString("OUTSOURCED_ID"), e.getString("OUTSOURCED_ID"))){
|
|
|
|
|
// 补全信息
|
|
|
|
|
e.put("VIDEOMANAGER_ID", m.getString("VIDEOMANAGER_ID"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
return e;
|
|
|
|
|
})
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
map.put("varList", outsourcedList);
|
|
|
|
|
map.put("result", errInfo);
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-07 09:32:12 +08:00
|
|
|
|
}
|