Browse Source

add:视频展示信息改为nacos配置

show
luyie 2 weeks ago
parent
commit
3d10a2646b
  1. 34
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java

34
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java

@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.hnac.hzims.operational.config.HikPathConfiguration;
import com.hnac.hzims.operational.station.StationConstants;
@ -57,8 +56,14 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl<StationVideoTyp
private String videoLoginUrl;
@Value("${hzims.video.random-code}")
private String definitionCode;
@Value("${url.video.left}")
private List<String> videoLeft;
@Value("${url.video.right}")
private List<String> videoRight;
/**
* 获取海康视频接口
*
* @return
*/
@Override
@ -73,8 +78,7 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl<StationVideoTyp
, stationVideoTypeEntity.getPointCode(), DictCache.getValue(StationConstants.STATION_VIDEO_TYPE_CODE,
stationVideoTypeEntity.getType()), 0));
ids.add(stationVideoTypeEntity.getId());
}
catch (Exception e){
} catch (Exception e) {
stationVideoTypeEntity.setLiveSourceAddress(null);
}
}
@ -137,8 +141,7 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl<StationVideoTyp
for (StationVideoTypeEntity video : result.getRecords()) {
try {
video.setLiveSourceAddress(ArtemisPostUtils.getCameraPreviewFlvURL(video.getVideoHost(), video.getAppKey(), video.getAppSecret(), video.getPointCode(), 1));
}
catch(Exception e) {
} catch (Exception e) {
log.error("视频点位【" + video.getName() + "】获取地址失败");
}
}
@ -146,6 +149,7 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl<StationVideoTyp
return result;
}
@Override
public List<StationVideoTypeEntity> getVideoByIdsAndType(String ids, String type) {
List<Long> idList = Func.toLongList(",", ids);
@ -210,8 +214,7 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl<StationVideoTyp
HttpResponse response;
try {
response = HttpUtil.createGet(pathConfiguration.getStationsPath()).execute();
}
catch(Exception e) {
} catch (Exception e) {
logger.error("getHikVisionStations", e.getMessage());
return Lists.newArrayList();
// throw new ServiceException(e.getMessage());
@ -230,8 +233,7 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl<StationVideoTyp
HttpResponse response;
try {
response = HttpUtil.createGet(pathConfiguration.getMonitorsPath() + "/" + stationId).execute();
}
catch (RuntimeException e) {
} catch (RuntimeException e) {
throw new ServiceException(e.getMessage());
}
Assert.isTrue(HttpServletResponse.SC_OK == response.getStatus(), () -> {
@ -276,8 +278,7 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl<StationVideoTyp
, DictCache.getValue(StationConstants.STATION_VIDEO_TYPE_CODE, stationVideoTypeEntity.getType())
, streamType
));
}
catch (Exception e){
} catch (Exception e) {
stationVideoTypeEntity.setLiveSourceAddress(null);
}
}
@ -322,32 +323,31 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl<StationVideoTyp
/**
* 水利监控视频
*
* @return
*/
@Override
public WaterMonitorVideoVo waterMonitorVideo() {
WaterMonitorVideoVo video = new WaterMonitorVideoVo();
List<StationVideoTypeEntity> left = this.list(Wrappers.<StationVideoTypeEntity>lambdaQuery().
in(StationVideoTypeEntity::getId,Arrays.asList(28483776900235440L,28483776900235463L, 28483776900235466L)));
in(StationVideoTypeEntity::getId, videoLeft));
if (CollectionUtil.isNotEmpty(left)) {
video.setLeft(left.stream().peek(item -> {
try {
item.setLiveSourceAddress(ArtemisPostUtils.getCameraPreviewFlvURL(item.getVideoHost(), item.getAppKey(), item.getAppSecret(), item.getPointCode(), 1));
}
catch(Exception e) {
} catch (Exception e) {
log.error("视频点位【" + item.getPointCode() + "】获取地址失败");
}
}).collect(Collectors.toList()));
}
List<StationVideoTypeEntity> right = this.list(Wrappers.<StationVideoTypeEntity>lambdaQuery().
in(StationVideoTypeEntity::getId,Arrays.asList(28483776900235468L,28483776900235467L,28483776900235472L)));
in(StationVideoTypeEntity::getId, videoRight));
if (CollectionUtil.isNotEmpty(right)) {
video.setRight(right.stream().peek(item -> {
try {
item.setLiveSourceAddress(ArtemisPostUtils.getCameraPreviewFlvURL(item.getVideoHost(), item.getAppKey(), item.getAppSecret(), item.getPointCode(), 1));
}
catch(Exception e) {
} catch (Exception e) {
log.error("视频点位【" + item.getPointCode() + "】获取地址失败");
}
}).collect(Collectors.toList()));

Loading…
Cancel
Save