ソースを参照

2023-2-14 疏散喇叭修改调用播放100次的接口,结束疏散调用关闭喇叭接口。

chaiyunlong 2 年 前
コミット
7662ff20de
共有1 個のファイルを変更した42 個の追加3 個の削除を含む
  1. 42 3
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabExitLineVertexServiceImpl.java

+ 42 - 3
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabExitLineVertexServiceImpl.java

@@ -1,6 +1,7 @@
 package com.zd.laboratory.service.impl;
 
 import cn.hutool.core.date.StopWatch;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.zd.algorithm.api.speaker.entity.ParamVo;
 import com.zd.algorithm.api.speaker.entity.PlayVo;
@@ -205,7 +206,7 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
         exitPointRelay.setBuildId(labExitLineEvacuationVo.getBuildId());
         exitPointRelay.setFloorId(labExitLineEvacuationVo.getFloorId());
         List <LabExitPointRelay> labExitPointRelays = labExitPointRelayMapper.selectLabExitPointRelayList(exitPointRelay);
-        //todo  开启继电器开关
+        //todo  关闭继电器开关
         for(LabExitPointRelay relay : labExitPointRelays) {
             try {
                 if (relay.getRelayType().intValue() == 1) {
@@ -221,6 +222,8 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
                 e.printStackTrace();
             }
         }
+        //todo 关闭喇叭
+        closeHorn(labExitLineEvacuationVo);
     }
 
     //todo 计算坏点(目前只有发生预案的实验室需要标记为坏点),需要把非坏点关联坏点点位全部改成无限大
@@ -379,11 +382,11 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
                 log.info("查询喇叭总数:{}",count);
                 R deviceList = remoteSpeakService.getDeviceList(1,count + 10,labExitLineEvacuationVo.getFloorId());
                 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){
                         log.info("喇叭日志============================="+map);
                         if(StringUtils.isNotNull(map.get("deviceSn")) && StringUtils.isNotNull(map.get("port"))){
-                            List<PlayVo> playVoList = new ArrayList<>();
                             PlayVo playVo = new PlayVo();
                             playVo.setSn(map.get("deviceSn")+"");
                             playVo.setDeviceIp(map.get("deviceIp")+"");
@@ -392,9 +395,9 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
                             paramVo.setVol(Integer.parseInt(map.get("deviceVol").toString()));
                             playVo.setParams(paramVo);
                             playVoList.add(playVo);
-                            remoteSpeakService.textParseUrlAppIps(audioSyntheses.get(0).getNewMusicUrl(),playVoList);
                         }
                     }
+                    remoteSpeakService.textMoreParseUrlAppIps(audioSyntheses.get(0).getNewMusicUrl(),playVoList,100);
                 }
             }
         }catch (Exception e){
@@ -403,6 +406,42 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
     }
 
 
+
+    /**
+     * 关闭喇叭播放音乐
+     *
+     * @param labExitLineEvacuationVo 楼栋和楼层的基础数据
+     */
+    public void closeHorn(LabExitLineEvacuationVo labExitLineEvacuationVo){
+        try{
+            //这里查询预案下的合成音乐
+            LabAudioSynthesis labAudioSynthesis = new LabAudioSynthesis();
+            labAudioSynthesis.setSceneType(2);
+            List<LabAudioSynthesis> audioSyntheses = labAudioSynthesisMapper.selectLabAudioSynthesisList(labAudioSynthesis);
+            if(audioSyntheses.size()>0){
+                //预案调用喇叭
+                Integer count = labSparseHardwareService.selectSpeakerCount();
+                log.info("查询喇叭总数:{}",count);
+                R deviceList = remoteSpeakService.getDeviceList(1,count + 10,labExitLineEvacuationVo.getFloorId());
+                if(deviceList.getCode()==200){
+                    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"))) {
+                            log.info("关闭喇叭-疏散调用喇叭播放音乐!url={},deviceSn={}", audioSyntheses.get(0).getNewMusicUrl(), map.get("deviceSn"));
+                            R r = remoteSpeakService.stopPlayMusic(map.get("deviceSn") + "", audioSyntheses.get(0).getNewMusicUrl());
+                            log.info("关闭喇叭-疏散调用喇叭播放音乐返回信息:{}", JSON.toJSONString(r));
+                        } else {
+                            log.info("关闭喇叭deviceSn/port为空!");
+                        }
+                    }
+                }
+            }
+        }catch (Exception e){
+            log.error("疏散关闭喇叭失败!!!!!:"+e);
+        }
+    }
+
+
     /**
      * 关联过滤线路
      *