Commit c5db42dd authored by zhangjianqian's avatar zhangjianqian

添加报警声音,接收推送去掉报警状态判断

parent 423b7adb
...@@ -369,7 +369,6 @@ public class TDetectorReportController extends BaseController ...@@ -369,7 +369,6 @@ public class TDetectorReportController extends BaseController
if(!StringUtils.isEmpty(tDetectorReportDataForm.getDeviceType()) && tDetectorReportDataForm.getDeviceType().equals("1") && !StringUtils.isEmpty(tDetectorReportDataForm.getDeviceStatusId()) && new ArrayList<String>(Arrays.asList("7","9")).contains((tDetectorReportDataForm.getDeviceStatusId()))){ if(!StringUtils.isEmpty(tDetectorReportDataForm.getDeviceType()) && tDetectorReportDataForm.getDeviceType().equals("1") && !StringUtils.isEmpty(tDetectorReportDataForm.getDeviceStatusId()) && new ArrayList<String>(Arrays.asList("7","9")).contains((tDetectorReportDataForm.getDeviceStatusId()))){
flag = false; flag = false;
} }
//7,9通信故障不处理 //7,9通信故障不处理
if(flag){ if(flag){
...@@ -377,7 +376,6 @@ public class TDetectorReportController extends BaseController ...@@ -377,7 +376,6 @@ public class TDetectorReportController extends BaseController
tDetectorInfo.setDetectorCode(tDetectorReportDataForm.getDeviceNo()); tDetectorInfo.setDetectorCode(tDetectorReportDataForm.getDeviceNo());
List<TDetectorInfo> tDetectorInfoList = tDetectorInfoService.selectTDetectorInfoList(tDetectorInfo); List<TDetectorInfo> tDetectorInfoList = tDetectorInfoService.selectTDetectorInfoList(tDetectorInfo);
if(tDetectorInfoList.size() > 0){ if(tDetectorInfoList.size() > 0){
//报警设备类型,1探测器,2智慧用电 E+原始类型 //报警设备类型,1探测器,2智慧用电 E+原始类型
...@@ -387,7 +385,7 @@ public class TDetectorReportController extends BaseController ...@@ -387,7 +385,7 @@ public class TDetectorReportController extends BaseController
// 有未消警的数据 // 有未消警的数据
if(reportDataList.size()>0){ if(reportDataList.size()>0){
// 对比未消警数据与新推送数据的状态 // 对比未消警数据与新推送数据的状态
if(!reportDataList.get(0).getDetectorStatusId().equals(tDetectorReportDataForm.getDeviceStatusId())) { ///if(!reportDataList.get(0).getDetectorStatusId().equals(tDetectorReportDataForm.getDeviceStatusId())) {
TDetectorReportData temp = reportDataList.get(0); TDetectorReportData temp = reportDataList.get(0);
temp.setIsCancelAlarm("1"); temp.setIsCancelAlarm("1");
temp.setCancelTime(new Date()); temp.setCancelTime(new Date());
...@@ -412,7 +410,7 @@ public class TDetectorReportController extends BaseController ...@@ -412,7 +410,7 @@ public class TDetectorReportController extends BaseController
TDetectorInfo info = tDetectorInfoService.selectTDetectorInfoByCode(datas.getDetectorCode()); TDetectorInfo info = tDetectorInfoService.selectTDetectorInfoByCode(datas.getDetectorCode());
datas.setDetectorType(info.getDetectorType()); datas.setDetectorType(info.getDetectorType());
webSocketServer.batchSendMessage(JSONObject.toJSONString(datas)); webSocketServer.batchSendMessage(JSONObject.toJSONString(datas));
} //}
} else { } else {
TDetectorReportData datas = new TDetectorReportData(); TDetectorReportData datas = new TDetectorReportData();
......
...@@ -299,7 +299,7 @@ ...@@ -299,7 +299,7 @@
<!-- <div class="fong-div"></div> <!-- <div class="fong-div"></div>
<div class="fong-div" style="margin-left: 3px;"></div> <div class="fong-div" style="margin-left: 3px;"></div>
<div class="fong-div" style="margin-left: 3px;"></div> --> <div class="fong-div" style="margin-left: 3px;"></div> -->
<span style="letter-spacing: 1px; color: #fff; float: left"> <span style="letter-spacing: 1px; color: #fff; float: left" >
预警信息 预警信息
</span> </span>
<!-- <img src="../../assets/second1/ti-bg.png" alt=""> --> <!-- <img src="../../assets/second1/ti-bg.png" alt=""> -->
...@@ -360,14 +360,17 @@ ...@@ -360,14 +360,17 @@
width="500px" width="500px"
append-to-body append-to-body
@cancel="cancel1" @cancel="cancel1"
@close="stopbaojing"
> >
<div class="yujingtan" style="width: 100%; height: 160px"> <div class="yujingtan" style="width: 100%; height: 160px">
<audio id="myAudio" src="@/assets/video/baojing.mp3"></audio>
<div class="yujingone">所在单位:{{ yujingdata.unitName }}</div> <div class="yujingone">所在单位:{{ yujingdata.unitName }}</div>
<div class="yujingone">设备类型:{{ yujingdata.detectorType }}</div> <!--<div class="yujingone">设备类型:{{ yujingdata.detectorType }}</div>-->
<!--<div class="yujingone" v-if="yujingdata2.detectorCode=='866384067209974'">设备类型:可燃气体探测器(AEP)</div>--> <div class="yujingone" v-if="yujingdata.detectorType=='1'">设备类型:家用报警器</div>
<!--<div class="yujingone" v-if="yujingdata2.detectorCode=='860362056312914'">设备类型:家用报警器</div>--> <div class="yujingone" v-else-if="yujingdata.detectorType=='2'">设备类型:工业探测器</div>
<!--<div class="yujingone" v-if="yujingdata2.detectorCode=='868977060000767'">设备类型:家用报警器(AEP)</div>--> <div class="yujingone" v-else-if="yujingdata.detectorType==4">设备类型:激光家报</div>
<!--<div class="yujingone" v-if="yujingdata2.detectorCode=='B294F344'">设备类型:工业探测器</div>--> <div class="yujingone" v-else-if="yujingdata.detectorType==5">设备类型:地下井探测器</div>
<div class="yujingone" v-else >设备类型:{{ yujingdata.detectorType }}</div>
<div class="yujingone">预警信息:{{ yujingdata.statusName }}</div> <div class="yujingone">预警信息:{{ yujingdata.statusName }}</div>
<div class="yujingone" style="height: 30px"> <div class="yujingone" style="height: 30px">
预警时间:{{ yujingdata.alarmTime }} 预警时间:{{ yujingdata.alarmTime }}
...@@ -393,7 +396,7 @@ export default { ...@@ -393,7 +396,7 @@ export default {
data() { data() {
return { return {
open: true, open: false,
isopen: true, isopen: true,
allNum: {}, allNum: {},
diviceNum: { diviceNum: {
...@@ -499,6 +502,7 @@ export default { ...@@ -499,6 +502,7 @@ export default {
if (this.isopen) { if (this.isopen) {
this.open = true; this.open = true;
setTimeout(this.baojing,1500);
} }
// const obj = JSON.parse(evt.data); // const obj = JSON.parse(evt.data);
// console.log("接受socketobj", obj); // console.log("接受socketobj", obj);
...@@ -511,8 +515,10 @@ export default { ...@@ -511,8 +515,10 @@ export default {
closealways() { closealways() {
this.open = false; this.open = false;
this.isopen = false; this.isopen = false;
this.stopbaojing();
},
cancel1() {
}, },
cancel1() {},
getAlarm() { getAlarm() {
return alarmData().then((response) => { return alarmData().then((response) => {
// return; // return;
...@@ -733,6 +739,22 @@ export default { ...@@ -733,6 +739,22 @@ export default {
// ], // ],
// }); // });
// }, // },
baojing(){
console.log("--开始报警")
var audio = document.getElementById("myAudio");
console.log(audio)
audio.loop = true; // 设置音频循环播放
audio.play().catch(error => {
console.error("播放音频时发生错误:", error);
});
},
stopbaojing(){
console.log("关闭报警")
var audio = document.getElementById("myAudio");
audio.pause(); // 暂停音频
},
drawLine() { drawLine() {
// 基于准备好的dom,初始化echarts实例 // 基于准备好的dom,初始化echarts实例
let myChart1 = this.$echarts.init(document.getElementById("myChartone")); let myChart1 = this.$echarts.init(document.getElementById("myChartone"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment