|
|
@ -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.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; |
|
|
@ -57,8 +56,14 @@ 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 |
|
|
@ -73,8 +78,7 @@ 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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -137,8 +141,7 @@ 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() + "】获取地址失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -146,6 +149,7 @@ 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); |
|
|
@ -210,8 +214,7 @@ 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());
|
|
|
@ -230,8 +233,7 @@ 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(), () -> { |
|
|
@ -276,8 +278,7 @@ 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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -322,32 +323,31 @@ 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,Arrays.asList(28483776900235440L,28483776900235463L, 28483776900235466L))); |
|
|
|
in(StationVideoTypeEntity::getId, videoLeft)); |
|
|
|
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,Arrays.asList(28483776900235468L,28483776900235467L,28483776900235472L))); |
|
|
|
in(StationVideoTypeEntity::getId, videoRight)); |
|
|
|
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())); |
|
|
|