八项作业摄像头播放相关

pull/4/head
dearlin 2024-02-03 09:43:34 +08:00
parent c6c76886d7
commit 571bff720f
6 changed files with 213 additions and 106 deletions

View File

@ -212,6 +212,18 @@ public class MapController extends BaseController {
return timeArray;
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/2/1/001 15:43
* @Param: [] []
* @Return: java.lang.Object
*/
@RequestMapping(value = "/getCameraList")
@ResponseBody
public Object getCameraList() throws Exception {
return ReturnMap.ok().put("varList", videomanagerService.getCameraList(getPageData()));
}
public static void main(String[] args) {
List<Map<String, String>> timeArray = generateTimeArray();
for (Map<String, String> monthInfo : timeArray) {

View File

@ -111,5 +111,4 @@ public class MapEightController extends BaseController {
}

View File

@ -75,5 +75,7 @@ public interface VideoManagerService {
PageData getCameraAlarmTimeCount(PageData pageData);
PageData getCameraTopToShow(PageData pageData);
List<PageData> getCameraList(PageData pageData) throws Exception;
}

View File

@ -1,15 +1,25 @@
package com.zcloud.service.video.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.video.VideoManagerMapper;
import com.zcloud.service.video.VideoManagerService;
import com.zcloud.util.Jurisdiction;
import com.zcloud.mapper.datasource.eightWork.EightWorkVideoManagerMapper;
import com.zcloud.util.PLSUtil;
import com.zcloud.util.ReturnMap;
import com.zcloud.util.Tools;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
/**
*
@ -21,122 +31,183 @@ import java.util.List;
@Transactional //开启事物
public class VideoManagerServiceImpl implements VideoManagerService {
@Autowired
private VideoManagerMapper videomanagerMapper;
@Autowired
private VideoManagerMapper videomanagerMapper;
/**
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception{
videomanagerMapper.save(pd);
}
@Autowired
private EightWorkVideoManagerMapper eightWorkVideoManagerMapper;
/**
* @param pd
* @throws Exception
*/
public void delete(PageData pd)throws Exception{
videomanagerMapper.delete(pd);
}
@Override
public void editZhiding(PageData pd) throws Exception {
// TODO Auto-generated method stub
videomanagerMapper.editZhiding(pd);
}
/**
* @param pd
* @throws Exception
*/
public void edit(PageData pd)throws Exception{
videomanagerMapper.edit(pd);
}
/**
*
*
* @param pd
* @throws Exception
*/
public void save(PageData pd) throws Exception {
videomanagerMapper.save(pd);
}
public void editPls(PageData pd)throws Exception{
videomanagerMapper.editPls(pd);
}
/**
*
*
* @param pd
* @throws Exception
*/
public void delete(PageData pd) throws Exception {
videomanagerMapper.delete(pd);
}
public void editIsShowBycorpinfoid(PageData pd)throws Exception{
videomanagerMapper.editIsShowBycorpinfoid(pd);
}
public void editIsShow(PageData pd)throws Exception{
videomanagerMapper.editIsShow(pd);
}
@Override
public void editZhiding(PageData pd) throws Exception {
// TODO Auto-generated method stub
videomanagerMapper.editZhiding(pd);
}
/**
* @param page
* @throws Exception
*/
public List<PageData> list(Page page)throws Exception{
return videomanagerMapper.datalistPage(page);
}
/**
*
*
* @param pd
* @throws Exception
*/
public void edit(PageData pd) throws Exception {
videomanagerMapper.edit(pd);
}
/**()
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception{
return videomanagerMapper.listAll(pd);
}
public void editPls(PageData pd) throws Exception {
videomanagerMapper.editPls(pd);
}
/**id
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception{
return videomanagerMapper.findById(pd);
}
public void editIsShowBycorpinfoid(PageData pd) throws Exception {
videomanagerMapper.editIsShowBycorpinfoid(pd);
}
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(String[] ArrayDATA_IDS)throws Exception{
videomanagerMapper.deleteAll(ArrayDATA_IDS);
}
public void editIsShow(PageData pd) throws Exception {
videomanagerMapper.editIsShow(pd);
}
@Override
public PageData findByCode(PageData videoPd) {
return videomanagerMapper.findByCode(videoPd);
}
/**
*
*
* @param page
* @throws Exception
*/
public List<PageData> list(Page page) throws Exception {
return videomanagerMapper.datalistPage(page);
}
@Override
public List<PageData> getCameraAlarmCount(PageData pageData) {
return videomanagerMapper.getCameraAlarmCount(pageData);
}
/**
* ()
*
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd) throws Exception {
return videomanagerMapper.listAll(pd);
}
@Override
public List<PageData> getCameraAlarmTypeCount(PageData pageData) {
return videomanagerMapper.getCameraAlarmTypeCount(pageData);
}
/**
* id
*
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd) throws Exception {
return videomanagerMapper.findById(pd);
}
@Override
public PageData getCameraAlarmTimeCount(PageData pageData) {
List<PageData> cameraAlarmTimeCount = videomanagerMapper.getCameraAlarmTimeCount(pageData);
int leijicont = 0;
// 月份集合
List<String> monthStrList = new ArrayList<>();
// 当月数据
List<Integer> monthList = new ArrayList<>();
// 累计数据
List<Integer> accumulatedList = new ArrayList<>();
for (PageData item : cameraAlarmTimeCount) {
monthStrList.add(item.getString("MONTH"));
monthList.add(Integer.parseInt(item.getString("MONTH_COUNT")));
leijicont += Integer.parseInt(item.getString("MONTH_COUNT"));
accumulatedList.add(leijicont);
}
PageData valuePd = new PageData();
valuePd.put("monthStrList",monthStrList);
valuePd.put("monthList",monthList);
valuePd.put("accumulatedList",accumulatedList);
return valuePd;
}
/**
*
*
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(String[] ArrayDATA_IDS) throws Exception {
videomanagerMapper.deleteAll(ArrayDATA_IDS);
}
@Override
public PageData getCameraTopToShow(PageData pageData) {
return videomanagerMapper.getCameraTopToShow(pageData);
}
@Override
public PageData findByCode(PageData videoPd) {
return videomanagerMapper.findByCode(videoPd);
}
@Override
public List<PageData> getCameraAlarmCount(PageData pageData) {
return videomanagerMapper.getCameraAlarmCount(pageData);
}
@Override
public List<PageData> getCameraAlarmTypeCount(PageData pageData) {
return videomanagerMapper.getCameraAlarmTypeCount(pageData);
}
@Override
public PageData getCameraAlarmTimeCount(PageData pageData) {
List<PageData> cameraAlarmTimeCount = videomanagerMapper.getCameraAlarmTimeCount(pageData);
int leijicont = 0;
// 月份集合
List<String> monthStrList = new ArrayList<>();
// 当月数据
List<Integer> monthList = new ArrayList<>();
// 累计数据
List<Integer> accumulatedList = new ArrayList<>();
for (PageData item : cameraAlarmTimeCount) {
monthStrList.add(item.getString("MONTH"));
monthList.add(Integer.parseInt(item.getString("MONTH_COUNT")));
leijicont += Integer.parseInt(item.getString("MONTH_COUNT"));
accumulatedList.add(leijicont);
}
PageData valuePd = new PageData();
valuePd.put("monthStrList", monthStrList);
valuePd.put("monthList", monthList);
valuePd.put("accumulatedList", accumulatedList);
return valuePd;
}
@Override
public PageData getCameraTopToShow(PageData pageData) {
return videomanagerMapper.getCameraTopToShow(pageData);
}
@Override
public List<PageData> getCameraList(PageData pageData) throws Exception {
pageData.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
JSONObject ryCameraList = PLSUtil.getCameraList(pageData.getString("CORPINFO_ID"));
switch (pageData.getString("CAMREA_TYPE")) {
case "workSafelyCamera":
// 八项作业摄像头
List<PageData> eightWorkVideoList = eightWorkVideoManagerMapper.listAll(pageData);
return getMapCameraList(eightWorkVideoList, ryCameraList);
default:
return null;
}
}
private List<PageData> getMapCameraList(List<PageData> eightWorkVideoList, JSONObject ryCameraList) {
HashMap<String, String> videoIds = new HashMap<>();
HashMap<String, String> videolonlat = new HashMap<>();
eightWorkVideoList.forEach(item -> {
videoIds.put(item.getString("PLS_ID"), item.getString("VIDEOMANAGER_ID"));
videoIds.put("NAME" + item.getString("PLS_ID"), item.getString("VIDEONAME"));
videoIds.put("URL" + item.getString("PLS_ID"), item.getString("VIDEOURL"));
videoIds.put("CODE" + item.getString("PLS_ID"), item.getString("CODE"));
}
);
if (!"200".equals(ryCameraList.getString("code"))) {
return null;
}
// 除去没有经纬度的摄像头。
List<PageData> collect = JSON.parseArray(JSON.toJSONString(ryCameraList.getJSONArray("rows")), PageData.class).stream()
.filter((item -> Tools.notEmpty(item.getString("lon")) && videoIds.containsKey(item.getString("camId")))).collect(Collectors.toList());
collect
.forEach(item -> {
item.put("VIDEOMANAGER_ID", videoIds.get(item.getString("camId")));
item.put("VIDEONAME", videoIds.get("NAME" + item.getString("camId")));
item.put("VIDEOURL", videoIds.get("URL" + item.getString("camId")));
item.put("CODE", videoIds.get("CODE" + item.getString("camId")));
videolonlat.put(item.getString("camId"), item.getString("lon") + "," + item.getString("lat"));
});
return collect;
}
}

View File

@ -68,7 +68,20 @@ public class PLSUtil {
JSONObject.class);
return exchange.getBody();
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/25/025 14:37
* @Param: [java.lang.String, java.lang.Integer, java.lang.Integer] [keywords, currentPage, showCount]
* @Return: com.alibaba.fastjson.JSONObject
*/
public static JSONObject getCameraList(String CORPINFO_ID) throws Exception {
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", getToken(CORPINFO_ID));
HttpEntity<JSONObject> httpEntity = new HttpEntity<>(headers);
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/device/camera/list?pageNum=1&pageSize=100000&str=", HttpMethod.GET, httpEntity, JSONObject.class);
return exchange.getBody();
}
/**
* @Description:

View File

@ -183,9 +183,19 @@
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
<include refid="Field"></include>,
v.VIDEONAME,
v.VIDEOURL,
v.CODE,
v.PLS_ID
from
<include refid="tableName"></include> f
LEFT JOIN bus_videomanager v ON f.VIDEOMANAGER_ID = v.VIDEOMANAGER_ID and v.ISDELETE = 0
where
f.ISDELETE = 0
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
and f.CORPINFO_ID = #{CORPINFO_ID}
</if>
</select>
<!-- 批量删除 -->