src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
@@ -340,7 +340,7 @@ String app = json.getString("app"); String streamId = json.getString("stream"); StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId); if ("rtp".equals(app) && streamId.indexOf("gb_play") > -1 && streamInfo == null) { if ("rtp".equals(app) && streamId.contains("gb_play") && streamInfo == null) { String[] s = streamId.split("_"); if (s.length == 4) { String deviceId = s[2]; src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
@@ -104,4 +104,9 @@ */ boolean isChannelSendingRTP(String channelId); /** * 清空某个设备的所有缓存 * @param deviceId 设备ID */ void clearCatchByDeviceId(String deviceId); } src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
@@ -38,6 +38,11 @@ int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel); @Delete("<script> "+ "DELETE FROM platform_gb_channel WHERE deviceId='${deviceId}' " + "</script>") int delChannelForDeviceId(String deviceId); @Delete("<script> "+ "DELETE FROM platform_gb_channel WHERE platformId='${platformId}'" + "</script>") int cleanChannelForGB(String platformId); src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
@@ -259,4 +259,22 @@ } } @Override public void clearCatchByDeviceId(String deviceId) { List<Object> playLeys = redis.scan(String.format("%S_*_%s_*", VideoManagerConstants.PLAYER_PREFIX, deviceId)); if (playLeys.size() > 0) { for (Object key : playLeys) { redis.del(key.toString()); } } List<Object> playBackers = redis.scan(String.format("%S_*_%s_*", VideoManagerConstants.PLAY_BLACK_PREFIX, deviceId)); if (playBackers.size() > 0) { for (Object key : playBackers) { redis.del(key.toString()); } } } } src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
@@ -195,9 +195,22 @@ */ @Override public boolean delete(String deviceId) { int result = deviceMapper.del(deviceId); return result > 0; TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); boolean result = false; try { if (platformChannelMapper.delChannelForDeviceId(deviceId) <0 // 删除与国标平台的关联 || deviceChannelMapper.cleanChannelsByDeviceId(deviceId) < 0 // 删除他的通道 || deviceMapper.del(deviceId) < 0 // 移除设备信息 ) { //事务回滚 dataSourceTransactionManager.rollback(transactionStatus); } result = true; dataSourceTransactionManager.commit(transactionStatus); //手动提交 }catch (Exception e) { dataSourceTransactionManager.rollback(transactionStatus); } return result; } /** @@ -550,4 +563,6 @@ public void mediaOutline(String app, String streamId) { gbStreamMapper.setStatus(app, streamId, false); } } src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
@@ -2,6 +2,7 @@ import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.github.pagehelper.PageInfo; import io.swagger.annotations.*; import org.slf4j.Logger; @@ -33,6 +34,9 @@ @Autowired private IVideoManagerStorager storager; @Autowired private IRedisCatchStorage redisCatchStorage; @Autowired private SIPCommander cmder; @@ -177,8 +181,10 @@ if (offLineDetector.isOnline(deviceId)) { return new ResponseEntity<String>("不允许删除在线设备!", HttpStatus.NOT_ACCEPTABLE); } // 清除redis记录 boolean isSuccess = storager.delete(deviceId); if (isSuccess) { redisCatchStorage.clearCatchByDeviceId(deviceId); JSONObject json = new JSONObject(); json.put("deviceId", deviceId); return new ResponseEntity<>(json.toString(),HttpStatus.OK); web_src/src/components/DeviceList.vue
@@ -51,11 +51,12 @@ <el-table-column label="操作" width="360" align="center" fixed="right"> <template slot-scope="scope"> <el-button size="mini" :ref="scope.row.deviceId + 'refbtn' " icon="el-icon-refresh" @click="refDevice(scope.row)">刷新</el-button> <el-button size="mini" :ref="scope.row.deviceId + 'refbtn' " v-if="scope.row.online!=0" icon="el-icon-refresh" @click="refDevice(scope.row)">刷新</el-button> <el-button-group> <el-button size="mini" icon="el-icon-video-camera-solid" v-bind:disabled="scope.row.online==0" type="primary" @click="showChannelList(scope.row)">通道</el-button> <el-button size="mini" icon="el-icon-location" v-bind:disabled="scope.row.online==0" type="primary" @click="showDevicePosition(scope.row)">定位</el-button> <el-button size="mini" icon="el-icon-s-tools" v-bind:disabled="scope.row.online==0" type="primary">控制</el-button> <el-button size="mini" icon="el-icon-video-camera-solid" v-bind:disabled="scope.row.online==0" type="primary" @click="showChannelList(scope.row)">通道</el-button> <el-button size="mini" icon="el-icon-location" v-bind:disabled="scope.row.online==0" type="primary" @click="showDevicePosition(scope.row)">定位</el-button> <el-button size="mini" icon="el-icon-s-tools" v-bind:disabled="scope.row.online==0" type="primary">控制</el-button> <el-button size="mini" icon="el-icon-delete" type="danger" v-if="scope.row.online==0" @click="deleteDevice(scope.row)">删除</el-button> </el-button-group> </template> </el-table-column> @@ -155,6 +156,18 @@ }); }, deleteDevice: function(row) { let that = this; this.$axios({ method: 'delete', url:`/api/device/query/devices/${row.deviceId}/delete` }).then((res)=>{ this.getDeviceList(); }).catch((error) =>{ console.log(error); }); }, showChannelList: function(row) { console.log(JSON.stringify(row)) this.$router.push(`/channelList/${row.deviceId}/0/15/1`);