|
|
@@ -642,7 +642,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
|
|
|
if (labRiskPlanLevel.getRiskPlanId() != null) {
|
|
|
log.info("触发预案具体信息={}", JSON.toJSONString(labRiskPlanLevel));
|
|
|
//预案缓存信息处理
|
|
|
- riskPlanRedisCache(subFunction);
|
|
|
+ riskPlanRedisCache(subFunction,labRiskPlanLevel);
|
|
|
//获取系统配置通知模板
|
|
|
getConfigNoticeTemplate(labRiskPlanLevel);
|
|
|
//获取园区和楼层信息(新楼栋)
|
|
|
@@ -658,7 +658,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
|
|
|
//记录通知
|
|
|
recordNotice(subFunction, labRiskPlanLevel, groupId);
|
|
|
//打开喇叭
|
|
|
- openLoudSpeaker(subFunction.getSubId(), labRiskPlanLevel.getFloorId(), labRiskPlanLevel.getRiskPlanId());
|
|
|
+ openLoudSpeaker(subFunction.getSubId(), labRiskPlanLevel);
|
|
|
//远程调用开始录制视频接口
|
|
|
startVideo(subFunction.getSubId());
|
|
|
//向前端发送mqtt预案触发提示
|
|
|
@@ -851,9 +851,9 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
|
|
|
* @Param [subFunction]
|
|
|
* @Return void
|
|
|
**/
|
|
|
- private void riskPlanRedisCache(SubFunction<SensorFunctionStatus> subFunction) {
|
|
|
- //有效预案延长2分钟
|
|
|
- redisService.setCacheObject("subjectByYa" + subFunction.getSubId(), subFunction.getSubId(), 2L, TimeUnit.MINUTES);
|
|
|
+ private void riskPlanRedisCache(SubFunction<SensorFunctionStatus> subFunction,LabRiskPlanLevel labRiskPlanLevel) {
|
|
|
+ //有效预案设置自动关闭时间
|
|
|
+ redisService.setCacheObject("subjectByYa" + subFunction.getSubId(), subFunction.getSubId(), Long.valueOf(labRiskPlanLevel.getRiskAutoOff()), TimeUnit.SECONDS);
|
|
|
//这里处理,如果是火焰预案,需要redis额外缓存
|
|
|
Optional.ofNullable(subFunction.getFunctionStatuses()).orElseGet(Collections::emptyList).stream().filter(a -> "huoyan".equals(a.getFunNum())).forEach(a -> {
|
|
|
if (StringUtils.isNotBlank(a.getVal()) && a.getVal().equals("1") && redisService.getCacheObject("subjectByHuoyan" + subFunction.getSubId()) == null) {
|
|
|
@@ -992,46 +992,52 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
|
|
|
* @Param [subjectId 实验室id, floorId 楼层id, riskPlanId 预案id]
|
|
|
* @Return void
|
|
|
**/
|
|
|
- private void openLoudSpeaker(Long subjectId, Long floorId, Long riskPlanId) {
|
|
|
+ private void openLoudSpeaker(Long subjectId,LabRiskPlanLevel labRiskPlanLevel) {
|
|
|
//查询合成音乐,喇叭列表,调用喇叭
|
|
|
try {
|
|
|
- //这里查询预案下的合成音乐
|
|
|
- LabAudioSynthesis labAudioSynthesis = new LabAudioSynthesis();
|
|
|
- labAudioSynthesis.setRiskPlanId(riskPlanId);
|
|
|
- List<LabAudioSynthesis> audioSyntheses = labAudioSynthesisMapper.selectLabAudioSynthesisList(labAudioSynthesis);
|
|
|
- log.info("打开喇叭-查询的音乐列表信息 audioSyntheses= {}", JSON.toJSONString(audioSyntheses));
|
|
|
- if (audioSyntheses != null && audioSyntheses.size() > 0) {
|
|
|
- //预案调用喇叭
|
|
|
- log.info("打开喇叭-远程调用查询喇叭列表,楼层id={},实验室id={}", floorId, subjectId);
|
|
|
- Integer count = labSparseHardwareService.selectSpeakerCount();
|
|
|
- R deviceList = remoteSpeakService.getDeviceList(1, count + 10, -99L, subjectId);
|
|
|
- log.info("打开喇叭-远程调用喇叭列表返回内容: deviceList={}", JSON.toJSONString(deviceList));
|
|
|
- if (deviceList.getCode() == 200) {
|
|
|
- List<PlayVo> playVoList = new ArrayList<>();
|
|
|
- List<Map<String, Object>> mapList = (List<Map<String, Object>>) deviceList.getData();
|
|
|
- for (Map<String, Object> map : mapList) {
|
|
|
- if (StringUtils.isNotNull(map.get("deviceSn")) && StringUtils.isNotNull(map.get("port"))) {
|
|
|
- PlayVo playVo = new PlayVo();
|
|
|
- playVo.setSn(map.get("deviceSn") + "");
|
|
|
- playVo.setDeviceIp(map.get("deviceIp") + "");
|
|
|
- playVo.setPort(Integer.parseInt(map.get("port") + ""));
|
|
|
- ParamVo paramVo = new ParamVo();
|
|
|
- paramVo.setVol(Integer.parseInt(map.get("deviceVol").toString()));
|
|
|
- playVo.setParams(paramVo);
|
|
|
- playVoList.add(playVo);
|
|
|
+ //查询喇叭是否配置在预案中
|
|
|
+ List<LabRiskPlanHardwareRelation> riskPlanHardwareList = labRiskPlanLevel.getRiskPlanHardwareList();
|
|
|
+ riskPlanHardwareList.forEach(labRiskPlanHardwareRelation -> {
|
|
|
+ if (labRiskPlanHardwareRelation.getHardwareType().equals(HardwareTypeEnum.LOUDSPEAKER.getCode())) {
|
|
|
+ //这里查询预案下的合成音乐
|
|
|
+ LabAudioSynthesis labAudioSynthesis = new LabAudioSynthesis();
|
|
|
+ labAudioSynthesis.setRiskPlanId(labRiskPlanLevel.getRiskPlanId());
|
|
|
+ List<LabAudioSynthesis> audioSyntheses = labAudioSynthesisMapper.selectLabAudioSynthesisList(labAudioSynthesis);
|
|
|
+ log.info("打开喇叭-查询的音乐列表信息 audioSyntheses= {}", JSON.toJSONString(audioSyntheses));
|
|
|
+ if (audioSyntheses != null && audioSyntheses.size() > 0) {
|
|
|
+ //预案调用喇叭
|
|
|
+ log.info("打开喇叭-远程调用查询喇叭列表,实验室id={}", subjectId);
|
|
|
+ Integer count = labSparseHardwareService.selectSpeakerCount();
|
|
|
+ R deviceList = remoteSpeakService.getDeviceList(1, count + 10, -99L, subjectId);
|
|
|
+ log.info("打开喇叭-远程调用喇叭列表返回内容: deviceList={}", JSON.toJSONString(deviceList));
|
|
|
+ if (deviceList.getCode() == 200) {
|
|
|
+ List<PlayVo> playVoList = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> mapList = (List<Map<String, Object>>) deviceList.getData();
|
|
|
+ for (Map<String, Object> map : mapList) {
|
|
|
+ if (StringUtils.isNotNull(map.get("deviceSn")) && StringUtils.isNotNull(map.get("port"))) {
|
|
|
+ PlayVo playVo = new PlayVo();
|
|
|
+ playVo.setSn(map.get("deviceSn") + "");
|
|
|
+ playVo.setDeviceIp(map.get("deviceIp") + "");
|
|
|
+ playVo.setPort(Integer.parseInt(map.get("port") + ""));
|
|
|
+ ParamVo paramVo = new ParamVo();
|
|
|
+ paramVo.setVol(Integer.parseInt(map.get("deviceVol").toString()));
|
|
|
+ playVo.setParams(paramVo);
|
|
|
+ playVoList.add(playVo);
|
|
|
+ } else {
|
|
|
+ log.info("打开喇叭-喇叭deviceSn/port为空!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ log.info("打开喇叭-远程调用喇叭播放音乐!url={},playVoList={}", audioSyntheses.get(0).getNewMusicUrl(), JSON.toJSONString(playVoList));
|
|
|
+ R r = remoteSpeakService.textMoreParseUrlAppIps(audioSyntheses.get(0).getNewMusicUrl(), playVoList, 100);
|
|
|
+ log.info("打开喇叭-远程调用喇叭播放音乐返回信息:{}", JSON.toJSONString(r));
|
|
|
} else {
|
|
|
- log.info("打开喇叭-喇叭deviceSn/port为空!");
|
|
|
+ log.info("打开喇叭-远程查询喇叭信息错误!");
|
|
|
}
|
|
|
+ } else {
|
|
|
+ log.info("打开喇叭-合成音乐列表为空,此预案不触发音乐!riskPlanId={}", labRiskPlanLevel.getRiskPlanId());
|
|
|
}
|
|
|
- log.info("打开喇叭-远程调用喇叭播放音乐!url={},playVoList={}", audioSyntheses.get(0).getNewMusicUrl(), JSON.toJSONString(playVoList));
|
|
|
- R r = remoteSpeakService.textMoreParseUrlAppIps(audioSyntheses.get(0).getNewMusicUrl(), playVoList,100);
|
|
|
- log.info("打开喇叭-远程调用喇叭播放音乐返回信息:{}", JSON.toJSONString(r));
|
|
|
- } else {
|
|
|
- log.info("打开喇叭-远程查询喇叭信息错误!");
|
|
|
}
|
|
|
- } else {
|
|
|
- log.info("打开喇叭-合成音乐列表为空,此预案不触发音乐!riskPlanId={}", riskPlanId);
|
|
|
- }
|
|
|
+ });
|
|
|
} catch (Exception e) {
|
|
|
log.error("开启喇叭异常!{}", e);
|
|
|
}
|