重点工程-平台中所有的视频现支持反查绑定的重点工程

626相关方人员数据对接
water_xu 2024-05-28 18:19:46 +08:00
parent 7b4f85a08c
commit 6e46289973
9 changed files with 98 additions and 4 deletions

View File

@ -1,8 +1,12 @@
package com.zcloud.controller.keyProjects; 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.controller.base.BaseController;
import com.zcloud.entity.Page; import com.zcloud.entity.Page;
import com.zcloud.entity.PageData; 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.service.keyProjects.VideoResourcesService;
import com.zcloud.util.DateUtil; import com.zcloud.util.DateUtil;
import com.zcloud.util.Jurisdiction; 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.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Date; import java.util.*;
import java.util.HashMap; import java.util.stream.Collectors;
import java.util.List;
import java.util.Map;
/** /**
* *
@ -31,6 +33,12 @@ public class VideoResourcesController extends BaseController {
@Autowired @Autowired
private VideoResourcesService videoResourcesService; 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<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;
}
} }

View File

@ -91,5 +91,7 @@ public interface OutSourcedMapper{
List<PageData> listForCount(PageData pd); List<PageData> listForCount(PageData pd);
List<PageData> listOutSourcedByIds(List ids);
} }

View File

@ -77,5 +77,7 @@ public interface VideoManagerMapper {
void updateAiByOUTSOURCED_ID(PageData pd); void updateAiByOUTSOURCED_ID(PageData pd);
List<PageData> dataApplistPage(Page page); List<PageData> dataApplistPage(Page page);
List<PageData> findRepeatOutSourcedIdByVideoId(PageData video);
} }

View File

@ -93,5 +93,7 @@ public interface OutSourcedService{
List<PageData> listForCount(PageData pd); List<PageData> listForCount(PageData pd);
List<PageData> listOutSourcedByIds(List ids);
} }

View File

@ -75,5 +75,7 @@ public interface VideoManagerService {
void updateAiByOUTSOURCED_ID(PageData pd); void updateAiByOUTSOURCED_ID(PageData pd);
List<PageData> listApp(Page page); List<PageData> listApp(Page page);
List<PageData> findRepeatOutSourcedIdByVideoId(PageData video)throws Exception;
} }

View File

@ -121,5 +121,9 @@ public class OutSourcedServiceImpl implements OutSourcedService {
public List<PageData> listForCount(PageData pd) { public List<PageData> listForCount(PageData pd) {
return outsourcedMapper.listForCount(pd); return outsourcedMapper.listForCount(pd);
} }
public List<PageData> listOutSourcedByIds(List ids){
return outsourcedMapper.listOutSourcedByIds(ids);
}
} }

View File

@ -126,5 +126,10 @@ public class VideoManagerServiceImpl implements VideoManagerService {
public List<PageData> listApp(Page page) { public List<PageData> listApp(Page page) {
return videomanagerMapper.dataApplistPage(page); return videomanagerMapper.dataApplistPage(page);
} }
@Override
public List<PageData> findRepeatOutSourcedIdByVideoId(PageData video)throws Exception{
return videomanagerMapper.findRepeatOutSourcedIdByVideoId(video);
}
} }

View File

@ -955,4 +955,17 @@
and vac.CORPINFO_ID = #{CORPINFO_ID} and vac.CORPINFO_ID = #{CORPINFO_ID}
</if> </if>
</select> </select>
<!-- 通过List批量获取重点工程数据 -->
<select id="listOutSourcedByIds" parameterType="List" resultType="pd">
select <include refid="Field"></include>
from <include refid="tableName"></include> f
where f.ISDELETE = '0'
and f.OUTSOURCED_ID in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper> </mapper>

View File

@ -312,4 +312,25 @@
) )
</if> </if>
</select> </select>
<!-- 获取到重复的摄像头绑定 -->
<select id="findRepeatOutSourcedIdByVideoId" resultType="com.zcloud.entity.PageData">
select
f.OUTSOURCED_ID,
f.VIDEOMANAGER_ID,
f.VIDEONAME,
f.CAMERAID,
IFNULL(f.VIDEO_RESOURCES_ID,f.PLATFORMVIDEOMANAGEMENT_ID) as VIDEO_ID,
(case when f.VIDEO_RESOURCES_ID is not null then '0' when f.PLATFORMVIDEOMANAGEMENT_ID is not null then '1' else '-1' end) as VIDEO_TYPE
from
<include refid="tableName"></include>
f
where
#{VIDEO_ID} = (
case when f.VIDEO_RESOURCES_ID is not null and f.VIDEO_RESOURCES_ID != '' then f.VIDEO_RESOURCES_ID
when f.PLATFORMVIDEOMANAGEMENT_ID is not null and f.PLATFORMVIDEOMANAGEMENT_ID != '' then f.PLATFORMVIDEOMANAGEMENT_ID
else '-1' end
)
and f.ISDELETE='0'
</select>
</mapper> </mapper>