diff --git a/src/main/java/com/zcloud/controller/keyProjects/VideoResourcesController.java b/src/main/java/com/zcloud/controller/keyProjects/VideoResourcesController.java index 659c68be..be66af4b 100644 --- a/src/main/java/com/zcloud/controller/keyProjects/VideoResourcesController.java +++ b/src/main/java/com/zcloud/controller/keyProjects/VideoResourcesController.java @@ -1,8 +1,12 @@ package com.zcloud.controller.keyProjects; +import cn.hutool.core.collection.CollUtil; +import com.alibaba.druid.util.StringUtils; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; +import com.zcloud.service.keyProjects.OutSourcedService; +import com.zcloud.service.keyProjects.VideoManagerService; import com.zcloud.service.keyProjects.VideoResourcesService; import com.zcloud.util.DateUtil; import com.zcloud.util.Jurisdiction; @@ -13,10 +17,8 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; /** * 说明:视频管理 @@ -31,6 +33,12 @@ public class VideoResourcesController extends BaseController { @Autowired private VideoResourcesService videoResourcesService; + @Autowired + private VideoManagerService videoManagerService; + + @Autowired + private OutSourcedService outSourcedService; + /** * 新增 * @@ -190,4 +198,39 @@ public class VideoResourcesController extends BaseController { } + /** + * 通过摄像头查询绑定的重点工程数据 + */ + @RequestMapping("/getRelevanceOutsourced") + @ResponseBody + public Object getRelevanceOutsourced() throws Exception { + Map map = new HashMap<>(); + String errInfo = "success"; + List outsourcedList = Collections.emptyList(); + // 获取该摄像头绑定的重点工程ID列表 + List 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; + } + } diff --git a/src/main/java/com/zcloud/mapper/dsno2/keyProjects/OutSourcedMapper.java b/src/main/java/com/zcloud/mapper/dsno2/keyProjects/OutSourcedMapper.java index 063dfe83..9bed788f 100644 --- a/src/main/java/com/zcloud/mapper/dsno2/keyProjects/OutSourcedMapper.java +++ b/src/main/java/com/zcloud/mapper/dsno2/keyProjects/OutSourcedMapper.java @@ -91,5 +91,7 @@ public interface OutSourcedMapper{ List listForCount(PageData pd); + + List listOutSourcedByIds(List ids); } diff --git a/src/main/java/com/zcloud/mapper/dsno2/keyProjects/VideoManagerMapper.java b/src/main/java/com/zcloud/mapper/dsno2/keyProjects/VideoManagerMapper.java index 8215607b..3844ae30 100644 --- a/src/main/java/com/zcloud/mapper/dsno2/keyProjects/VideoManagerMapper.java +++ b/src/main/java/com/zcloud/mapper/dsno2/keyProjects/VideoManagerMapper.java @@ -77,5 +77,7 @@ public interface VideoManagerMapper { void updateAiByOUTSOURCED_ID(PageData pd); List dataApplistPage(Page page); + + List findRepeatOutSourcedIdByVideoId(PageData video); } diff --git a/src/main/java/com/zcloud/service/keyProjects/OutSourcedService.java b/src/main/java/com/zcloud/service/keyProjects/OutSourcedService.java index 663b85fb..664892d3 100644 --- a/src/main/java/com/zcloud/service/keyProjects/OutSourcedService.java +++ b/src/main/java/com/zcloud/service/keyProjects/OutSourcedService.java @@ -93,5 +93,7 @@ public interface OutSourcedService{ List listForCount(PageData pd); + + List listOutSourcedByIds(List ids); } diff --git a/src/main/java/com/zcloud/service/keyProjects/VideoManagerService.java b/src/main/java/com/zcloud/service/keyProjects/VideoManagerService.java index 4b7c0f25..3192b5ab 100644 --- a/src/main/java/com/zcloud/service/keyProjects/VideoManagerService.java +++ b/src/main/java/com/zcloud/service/keyProjects/VideoManagerService.java @@ -75,5 +75,7 @@ public interface VideoManagerService { void updateAiByOUTSOURCED_ID(PageData pd); List listApp(Page page); + + List findRepeatOutSourcedIdByVideoId(PageData video)throws Exception; } diff --git a/src/main/java/com/zcloud/service/keyProjects/impl/OutSourcedServiceImpl.java b/src/main/java/com/zcloud/service/keyProjects/impl/OutSourcedServiceImpl.java index 9516a978..a52c36f5 100644 --- a/src/main/java/com/zcloud/service/keyProjects/impl/OutSourcedServiceImpl.java +++ b/src/main/java/com/zcloud/service/keyProjects/impl/OutSourcedServiceImpl.java @@ -121,5 +121,9 @@ public class OutSourcedServiceImpl implements OutSourcedService { public List listForCount(PageData pd) { return outsourcedMapper.listForCount(pd); } + + public List listOutSourcedByIds(List ids){ + return outsourcedMapper.listOutSourcedByIds(ids); + } } diff --git a/src/main/java/com/zcloud/service/keyProjects/impl/VideoManagerServiceImpl.java b/src/main/java/com/zcloud/service/keyProjects/impl/VideoManagerServiceImpl.java index b0dfdba5..4e6f534d 100644 --- a/src/main/java/com/zcloud/service/keyProjects/impl/VideoManagerServiceImpl.java +++ b/src/main/java/com/zcloud/service/keyProjects/impl/VideoManagerServiceImpl.java @@ -126,5 +126,10 @@ public class VideoManagerServiceImpl implements VideoManagerService { public List listApp(Page page) { return videomanagerMapper.dataApplistPage(page); } + + @Override + public List findRepeatOutSourcedIdByVideoId(PageData video)throws Exception{ + return videomanagerMapper.findRepeatOutSourcedIdByVideoId(video); + } } diff --git a/src/main/resources/mybatis/dsno2/keyProjects/OutSourcedMapper.xml b/src/main/resources/mybatis/dsno2/keyProjects/OutSourcedMapper.xml index 45a9e11f..5e2d3e6d 100644 --- a/src/main/resources/mybatis/dsno2/keyProjects/OutSourcedMapper.xml +++ b/src/main/resources/mybatis/dsno2/keyProjects/OutSourcedMapper.xml @@ -955,4 +955,17 @@ and vac.CORPINFO_ID = #{CORPINFO_ID} + + + diff --git a/src/main/resources/mybatis/dsno2/keyProjects/VideoManagerMapper.xml b/src/main/resources/mybatis/dsno2/keyProjects/VideoManagerMapper.xml index d02004c1..eec18ac6 100644 --- a/src/main/resources/mybatis/dsno2/keyProjects/VideoManagerMapper.xml +++ b/src/main/resources/mybatis/dsno2/keyProjects/VideoManagerMapper.xml @@ -312,4 +312,25 @@ ) + + +