Commit 808de20a authored by maoying's avatar maoying

修改点位图视频相关接口

parent 89c6cb1b
......@@ -8,11 +8,19 @@ import lombok.Data;
@Data
public class AlamVideoVO {
private Long id;
private String url;
private String token;
private String name;
private String code;
private String address;
private String img;
private String presetPosition;
}
......@@ -2,6 +2,7 @@ package com.yeejoin.equipmanage.common.entity.vo;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -18,6 +19,6 @@ public class DetailPaneVO {
//图片
private String pic;
//参数
private List<Map<String,String>> items;
private List<Map<String,String>> items = new ArrayList<Map<String,String>>();
}
package com.yeejoin.equipmanage.common.enums;
/**
* 画布资源枚举
* @author DELL
*
*/
public enum BitmapEnum {
equipment("消防类设备", "equipment"),
video("视频类设备", "video");
BitmapEnum(String name, String key) {
this.name = name;
this.key = key;
}
private String name;
private String key;
public String getName() {
return name;
}
public String getKey() {
return key;
}
}
......@@ -153,8 +153,8 @@ public class EquipmentSpecificController extends AbstractBaseController {
@RequestMapping(value = "/getOneCard", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "组装组态使用装备卡片数据")
public DetailPaneVO getOneCard(Long id) {
return equipmentSpecificSerivce.getOneCard(id);
public Object getOneCard(Long id , String type) {
return equipmentSpecificSerivce.getOneCard(id , type);
}
/**
......
......@@ -280,7 +280,7 @@ public class VideoController extends AbstractBaseController {
@ApiOperation(httpMethod = "GET", value = "通过视频id和预置位获取可播放的flv格式地址", notes = "通过视频id和预置位获取可播放的flv格式地址")
public String getVideoFlvUrl(@RequestParam String videoId,
@RequestParam String presetIndex) {
String flvUrl = videoService.getVideoUrl(videoId, presetIndex, "");
String flvUrl = videoService.getVideoUrl(videoId, presetIndex, "", "");
return flvUrl;
}
......
package com.yeejoin.equipmanage.fegin;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig;
/**
* @description:
* @author: tw
* @createDate: 2021/10/20
*/
@FeignClient(name = "${video.fegin.name}", path = "video", configuration = {MultipartSupportConfig.class})
public interface VideoFeignClient {
@RequestMapping(value = "/video-original/url/video/{indexCode}", method = RequestMethod.GET)
ResponseModel<String> videoUrlByIndexCode(@PathVariable("indexCode") String indexCode);
}
......@@ -41,7 +41,8 @@ public interface VideoMapper extends BaseMapper<Video> {
* @return
*/
List<AlamVideoVO> getVideoBySpeId(Long id);
List<AlamVideoVO> getVideoById(Long id);
AlamVideoVO getVideoById(Long id);
/**
......
......@@ -80,7 +80,7 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
* @param id
* @return
*/
DetailPaneVO getOneCard(Long id);
Object getOneCard(Long id, String type);
/**
* 通过id获取设备区域建筑等信息
......
......@@ -75,5 +75,5 @@ public interface IVideoService extends IService<Video> {
* @param defaultUrl
* @return
*/
String getVideoUrl(String videoId, String presetIndex, String defaultUrl);
String getVideoUrl(String videoId, String presetIndex, String defaultUrl, String code);
}
......@@ -763,7 +763,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
x.setLocation(x.getAddress());
}
}
x.setUrl(videoService.getVideoUrl(x.getName(), x.getPresetPosition(), x.getUrl()));
x.setUrl(videoService.getVideoUrl(x.getName(), x.getPresetPosition(), x.getUrl(), x.getCode()));
});
}
return pages;
......
......@@ -83,9 +83,9 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
final String alarmType = "IOT_CORE_PARAM";
Map<String, Object> res = new HashMap<>();
if (videoType.equals(type)) {
List<AlamVideoVO> video = videoMapper.getVideoById(equipId);
List<AlamVideoVO> video = videoMapper.getVideoBySpeId(equipId);
video.forEach(action -> {
action.setUrl(videoService.getVideoUrl(action.getName(), action.getPresetPosition(), action.getUrl()));
action.setUrl(videoService.getVideoUrl(action.getName(), action.getPresetPosition(), action.getUrl(), action.getCode()));
});
res.put("video", video);
return res;
......@@ -103,7 +103,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
}
videoBySpeId.forEach(action -> {
action.setUrl(videoService.getVideoUrl(action.getName(), action.getPresetPosition(), action.getUrl()));
action.setUrl(videoService.getVideoUrl(action.getName(), action.getPresetPosition(), action.getUrl(), action.getCode()));
});
res.put("data", specificAlarm);
res.put("video", videoBySpeId);
......
......@@ -237,7 +237,7 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
video.setName(x.getName());
video.setTokens(x.getToken());
video.setUrl(x.getUrl());
video.setUrl(videoService.getVideoUrl(x.getName(), x.getPresetPosition(), x.getUrl()));
video.setUrl(videoService.getVideoUrl(x.getName(), x.getPresetPosition(), x.getUrl(), x.getCode()));
video.setIp(x.getIp());
video.setPort(x.getPort());
video.setCode(x.getCode());
......
......@@ -57,6 +57,7 @@ import com.yeejoin.equipmanage.common.entity.Video;
import com.yeejoin.equipmanage.common.entity.Warehouse;
import com.yeejoin.equipmanage.common.entity.WarehouseStructure;
import com.yeejoin.equipmanage.common.entity.dto.EquipmentSpecificDTO;
import com.yeejoin.equipmanage.common.entity.vo.AlamVideoVO;
import com.yeejoin.equipmanage.common.entity.vo.AlarmInfoVO;
import com.yeejoin.equipmanage.common.entity.vo.AlarmVO;
import com.yeejoin.equipmanage.common.entity.vo.ComplementCodeVO;
......@@ -76,6 +77,7 @@ import com.yeejoin.equipmanage.common.entity.vo.TechInfoListVO;
import com.yeejoin.equipmanage.common.entity.vo.TechInfoVO;
import com.yeejoin.equipmanage.common.entity.vo.VideoVO;
import com.yeejoin.equipmanage.common.enums.BillContentEnum;
import com.yeejoin.equipmanage.common.enums.BitmapEnum;
import com.yeejoin.equipmanage.common.enums.EquipmentRiskTypeEnum;
import com.yeejoin.equipmanage.common.enums.FileTypeEnum;
import com.yeejoin.equipmanage.common.enums.StockBillTypeEnum;
......@@ -89,10 +91,12 @@ import com.yeejoin.equipmanage.common.vo.EquipmentDetailVo;
import com.yeejoin.equipmanage.common.vo.EquipmentOnCarVo;
import com.yeejoin.equipmanage.common.vo.EquipmentSpecific3dVo;
import com.yeejoin.equipmanage.config.EquipmentIotMqttReceiveConfig;
import com.yeejoin.equipmanage.fegin.VideoFeignClient;
import com.yeejoin.equipmanage.mapper.EquipmentIndexMapper;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificAlarmMapper;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper;
import com.yeejoin.equipmanage.mapper.UploadFileMapper;
import com.yeejoin.equipmanage.mapper.VideoMapper;
import com.yeejoin.equipmanage.service.IEquPropertyService;
import com.yeejoin.equipmanage.service.IEquipmentCategoryService;
import com.yeejoin.equipmanage.service.IEquipmentDetailService;
......@@ -109,6 +113,7 @@ import com.yeejoin.equipmanage.service.IStockService;
import com.yeejoin.equipmanage.service.ISyncDataService;
import com.yeejoin.equipmanage.service.ISystemDicService;
import com.yeejoin.equipmanage.service.IUploadFileService;
import com.yeejoin.equipmanage.service.IVideoService;
import com.yeejoin.equipmanage.service.IWarehouseService;
import com.yeejoin.equipmanage.service.IWarehouseStructureService;
import com.yeejoin.equipmanage.utils.RelationRedisUtil;
......@@ -175,6 +180,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Autowired
IEquipmentIndexService iEquipmentIndexService;
@Autowired
private IVideoService videoService;
@Value("${systemctl.dict.iot-core-param}")
private String iotCoreParam;
......@@ -196,10 +204,14 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Autowired
private RelationRedisUtil relationRedisUtil;
@Autowired
private VideoMapper videoMapper;
@Value("${systemctl.sync.switch}")
private Boolean syncSwitch;
private final String injection = "{\n" +
"\n" +
" \"items\": [\n" +
......@@ -1050,13 +1062,24 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
}
@Override
public DetailPaneVO getOneCard(Long id) {
DetailPaneVO detailPaneVO = new DetailPaneVO();
Map<String, String> map = this.baseMapper.getQrCodeAndPic(id);
detailPaneVO.setQrCode(map.get("qrCode"));
detailPaneVO.setPic(map.get("pic"));
detailPaneVO.setItems(this.baseMapper.getOneCard(id));
return detailPaneVO;
public Object getOneCard(Long id, String type) {
if(BitmapEnum.video.getKey().equals(type)){
AlamVideoVO video = videoMapper.getVideoById(id);
if(!ObjectUtils.isEmpty(video)){
video.setUrl(videoService.getVideoUrl(video.getName().toString(), video.getPresetPosition(), video.getUrl(), video.getCode()));
}
return video;
}else{
DetailPaneVO detailPaneVO = new DetailPaneVO();
Map<String, String> map = this.baseMapper.getQrCodeAndPic(id);
if(ObjectUtils.isEmpty(map)){
return detailPaneVO;
}
detailPaneVO.setQrCode(map.get("qrCode"));
detailPaneVO.setPic(map.get("pic"));
detailPaneVO.setItems(this.baseMapper.getOneCard(id));
return detailPaneVO;
}
}
@Override
......
package com.yeejoin.equipmanage.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.EquipmentCategory;
import com.yeejoin.equipmanage.common.entity.EquipmentIndex;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
import com.yeejoin.equipmanage.common.entity.Video;
import com.yeejoin.equipmanage.common.entity.VideoEquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.VideoImportantEquipment;
import com.yeejoin.equipmanage.common.entity.VideoSource;
import com.yeejoin.equipmanage.common.entity.WarehouseStructure;
import com.yeejoin.equipmanage.common.entity.dto.VideoDTO;
import com.yeejoin.equipmanage.common.entity.dto.VideoSaveDto;
import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.common.entity.vo.BuildingListVO;
import com.yeejoin.equipmanage.common.entity.vo.BuildingVideoListVO;
import com.yeejoin.equipmanage.common.entity.vo.BuildingVideoVO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentCategoryTypeTreeVO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentSpecificVo;
import com.yeejoin.equipmanage.common.entity.vo.PageSecurityVideoVO;
import com.yeejoin.equipmanage.common.entity.vo.PageVideoVO;
import com.yeejoin.equipmanage.common.entity.vo.VideoDownloadVO;
import com.yeejoin.equipmanage.common.entity.vo.VideoListVo;
import com.yeejoin.equipmanage.common.enums.EquipmentSpeIndexEnum;
import com.yeejoin.equipmanage.common.enums.IndustryEnum;
import com.yeejoin.equipmanage.common.utils.HttpContentTypeUtil;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.fegin.VideoFeignClient;
import com.yeejoin.equipmanage.mapper.VideoMapper;
import com.yeejoin.equipmanage.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import com.yeejoin.equipmanage.service.IBuilldService;
import com.yeejoin.equipmanage.service.IEquipmentCategoryService;
import com.yeejoin.equipmanage.service.IEquipmentIndexService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificIndexService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce;
import com.yeejoin.equipmanage.service.IVideoEquipmentSpecificService;
import com.yeejoin.equipmanage.service.IVideoImportantEquipmentService;
import com.yeejoin.equipmanage.service.IVideoService;
import com.yeejoin.equipmanage.service.IVideoSourceService;
import com.yeejoin.equipmanage.service.IWarehouseStructureService;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
/**
* @author ZeHua Li
......@@ -67,6 +102,10 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
@Autowired
VideoMapper videoMapper;
@Autowired
VideoFeignClient videoFeignClient;
@Value("${param.htvideo.url}")
......@@ -482,12 +521,26 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
@Override
public String getVideoUrl(String videoId, String presetIndex, String defaultUrl) {
public String getVideoUrl(String videoId, String presetIndex, String defaultUrl, String code) {
if ("off".equals(isUseVideoTranscoding)) {
return defaultUrl;
String url = getVideoUrl(code);
return ObjectUtils.isEmpty(url) ? defaultUrl : url;
}
return getFlvUrlByVideoIdOrPresetIndex(videoId, presetIndex);
}
private String getVideoUrl(String code){
String url = "";
try{
ResponseModel<String> da = videoFeignClient.videoUrlByIndexCode(code);
if(!ObjectUtils.isEmpty(da)){
url = da.getResult().substring(da.getResult().indexOf("openUrl"));
}
}catch (Exception e) {
log.error("视频服务调用失败", e.getMessage());
}
return url;
}
public String getFlvUrlByVideoIdOrPresetIndex(String videoId, String presetIndex) {
try {
......@@ -542,91 +595,4 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
return "rtsp";
}
// /**
// * 异步保存监控和建筑关联关系
// * @param buildingCodes
// * @param videoId
// */
// @Async
// void saveVideoSource(String[] buildingCodes,Long videoId){
// List<VideoSource> videoSources = new ArrayList<>();
//
// //转map,方便后面code转id
// List<WarehouseStructure> list = warehouseStructureService.list();
// Map<String,Long> map = new HashMap<>();
// list.stream().forEach(x->{
// map.put(x.getCode(),x.getId());
// });
//
// //拼接数据
// for (int i = 0; i < buildingCodes.length; i++) {
// VideoSource videoSource = new VideoSource();
// videoSource.setVideoId(videoId);
// //通过code取id
// videoSource.setSourceId(map.get(buildingCodes[i]));
// videoSources.add(videoSource);
// }
//
// videoSourceService.saveBatch(videoSources);
// }
//
// /**
// * 异步保存监控和单个装备关联关系
// * @param equipmentSpecificCodes
// * @param videoId
// */
// @Async
// void saveEquipmentSpecificCodes(String[] equipmentSpecificCodes,Long videoId){
//
// List<VideoEquipmentSpecific> videoSources = new ArrayList<>();
//
// //转map,方便后面code转id
// List<EquipmentSpecific> list = equipmentSpecificSerivce.list();
// Map<String,Long> map = new HashMap<>();
// list.stream().forEach(x->{
// map.put(x.getCode(),x.getId());
// });
// //拼接数据
// for (int i = 0; i < equipmentSpecificCodes.length; i++) {
// VideoEquipmentSpecific videoEquipmentSpecific = new VideoEquipmentSpecific();
// videoEquipmentSpecific.setVideoId(videoId);
// //通过code取id
// videoEquipmentSpecific.setEquipmentSpecificId(map.get(equipmentSpecificCodes[i]));
// videoSources.add(videoEquipmentSpecific);
// }
//
// videoEquipmentSpecificService.saveBatch(videoSources);
// }
//
//
// /**
// * 异步保存监控和重点设备关联关系
// * @param importantEquipmentCodes
// * @param videoId
// */
// @Async
// void saveImportantEquipmentCodes(String[] importantEquipmentCodes,Long videoId){
//
// List<VideoImportantEquipment> videoImportantEquipments = new ArrayList<>();
//
// //转map,方便后面code转id
// List<EquipmentSpecificVo> list = baseMapper.selectImportantEquipment();
// Map<String,Long> map = new HashMap<>();
// list.stream().forEach(x->{
// map.put(x.getCode(),x.getId());
// });
//
// //拼接数据
// for (int i = 0; i < importantEquipmentCodes.length; i++) {
// VideoImportantEquipment videoImportantEquipment = new VideoImportantEquipment();
// videoImportantEquipment.setVideoId(videoId);
// //通过code取id
// videoImportantEquipment.setImportantEquipmentId(map.get(importantEquipmentCodes[i]));
// videoImportantEquipments.add(videoImportantEquipment);
// }
// videoImportantEquipmentService.saveBatch(videoImportantEquipments);
// }
}
......@@ -50,6 +50,8 @@ iot.vehicle.track=AMOS-API-IOT
jcs.fegin.name=JCS
video.fegin.name=VIDEO
#项目初始化画布id
morphic.projectSeq=1390314016458514433
......
......@@ -136,17 +136,20 @@
where equipment_specific_id = #{id}
</select>
<select id="getVideoById" resultType="com.yeejoin.equipmanage.common.entity.vo.AlamVideoVO">
select
vid.id,
vid.token,
vid.name,
vid.url,
vid.code,
vid.preset_position as presetPosition
from
wl_video_equipment_specific as ves
left join wl_video as vid on ves.video_id = vid.id
where video_id = #{id}
SELECT
v.`name`,
v.`code`,
v.url,
v.token,
CONCAT_WS(' ', ws.full_name, v.address) AS address,
v.img,
v.preset_position as presetPosition
FROM
wl_video v
LEFT JOIN wl_video_source vs ON vs.video_id = v.id
LEFT JOIN wl_warehouse_structure ws ON ws.id = vs.source_id
WHERE
v.id = #{id}
</select>
<select id="pageColaBuildingVideo" resultType="com.yeejoin.equipmanage.common.entity.vo.BuildingVideoVO">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment