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