Showing
6 changed files
with
41 additions
and
18 deletions
... | ... | @@ -35,10 +35,7 @@ import org.thingsboard.server.common.data.yunteng.utils.i18n.MessageUtils; |
35 | 35 | import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; |
36 | 36 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
37 | 37 | import org.thingsboard.server.controller.BaseController; |
38 | -import org.thingsboard.server.dao.yunteng.service.TkAlarmInfoService; | |
39 | -import org.thingsboard.server.dao.yunteng.service.TkDeviceProfileService; | |
40 | -import org.thingsboard.server.dao.yunteng.service.TkDeviceService; | |
41 | -import org.thingsboard.server.dao.yunteng.service.TkOrganizationService; | |
38 | +import org.thingsboard.server.dao.yunteng.service.*; | |
42 | 39 | import org.thingsboard.server.dao.yunteng.service.media.TkVideoChannelService; |
43 | 40 | import org.thingsboard.server.queue.util.TbCoreComponent; |
44 | 41 | import org.thingsboard.server.service.entitiy.alarm.TbAlarmService; |
... | ... | @@ -69,6 +66,7 @@ public class TkDeviceController extends BaseController { |
69 | 66 | private final TkOrganizationService organizationService; |
70 | 67 | private final CacheUtils cacheUtils; |
71 | 68 | private final TkVideoChannelService tkVideoChannelService; |
69 | + private final TkVideoService tkVideoService; | |
72 | 70 | @PostMapping("/batch/update") |
73 | 71 | @ApiOperation("批量修改设备") |
74 | 72 | @PreAuthorize( |
... | ... | @@ -353,6 +351,7 @@ public class TkDeviceController extends BaseController { |
353 | 351 | deleteAlarm(id); |
354 | 352 | } |
355 | 353 | tkVideoChannelService.clearDeviceChannelByDeviceIds(currentTenantId,tbIds); |
354 | + tkVideoService.deleteGBT28181VideosByDeviceIds(currentTenantId,tbIds); | |
356 | 355 | } |
357 | 356 | } |
358 | 357 | ... | ... |
... | ... | @@ -69,18 +69,20 @@ public class ZLMediaKitHookController extends BaseController { |
69 | 69 | String cameraCode = result.get(FastIotConstants.ZLMediaBody.CAMERA_CODE).asText(); |
70 | 70 | VideoChanelDTO chanelDTO = |
71 | 71 | tkVideoChannelService.findVideoChannelById(cameraCode, channelId, null); |
72 | - controlService.byeCmdInSsrcTransaction( | |
73 | - chanelDTO.getTenantId(), | |
74 | - false, | |
75 | - chanelDTO.getDeviceId(), | |
76 | - cameraCode, | |
77 | - channelId, | |
78 | - result.get(FastIotConstants.ZLMediaBody.SSRCINFO_STREAM).asText(), | |
79 | - fromDeviceRpcResponse -> {}); | |
80 | - tkVideoChannelService.updateVideoChannelStreamId( | |
81 | - null, | |
82 | - cameraCode, | |
83 | - channelId); // storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId()); | |
72 | + if(null != chanelDTO){ | |
73 | + controlService.byeCmdInSsrcTransaction( | |
74 | + chanelDTO.getTenantId(), | |
75 | + false, | |
76 | + chanelDTO.getDeviceId(), | |
77 | + cameraCode, | |
78 | + channelId, | |
79 | + result.get(FastIotConstants.ZLMediaBody.SSRCINFO_STREAM).asText(), | |
80 | + fromDeviceRpcResponse -> {}); | |
81 | + tkVideoChannelService.updateVideoChannelStreamId( | |
82 | + null, | |
83 | + cameraCode, | |
84 | + channelId); // storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId()); | |
85 | + } | |
84 | 86 | } |
85 | 87 | return result; |
86 | 88 | } | ... | ... |
... | ... | @@ -253,7 +253,18 @@ public class TkVideoServiceImpl extends AbstractBaseService<TkVideoMapper, TkVid |
253 | 253 | return videoDTOList.get(0); |
254 | 254 | } |
255 | 255 | |
256 | - | |
256 | + @Override | |
257 | + @Transactional | |
258 | + public boolean deleteGBT28181VideosByDeviceIds(String tenantId, List<String> deviceIds) { | |
259 | + boolean result = false; | |
260 | + if(null !=deviceIds && deviceIds.size()>FastIotConstants.MagicNumber.ZERO){ | |
261 | + for (String deviceId : deviceIds) { | |
262 | + baseMapper.deleteVideosByDeviceIds(tenantId,deviceId); | |
263 | + } | |
264 | + result = true; | |
265 | + } | |
266 | + return result; | |
267 | + } | |
257 | 268 | void saveGbtS(TkVideoGbtDTO dto){ |
258 | 269 | List<TkVideoGbtDeviceDTO> deviceList = dto.getGbtDeviceDTOS(); |
259 | 270 | deviceList.forEach(device -> { | ... | ... |
... | ... | @@ -44,4 +44,8 @@ public interface TkVideoMapper extends BaseMapper<TkVideoEntity> { |
44 | 44 | * @return |
45 | 45 | */ |
46 | 46 | List<TkVideoDTO> getVideoInfosByOrganizationIds(@Param("tenantId") String tenantId, @Param("organizationIds") List<String> organizationIds); |
47 | + | |
48 | + | |
49 | + int deleteVideosByDeviceIds(@Param("tenantId") String tenantId, @Param("deviceId") String deviceId); | |
50 | + | |
47 | 51 | } | ... | ... |
... | ... | @@ -122,4 +122,6 @@ public interface TkVideoService extends BaseService<TkVideoEntity> { |
122 | 122 | * @return 视频列表 |
123 | 123 | */ |
124 | 124 | List<TkVideoDTO> getVideoList(String organizationId, String tenantId); |
125 | + boolean deleteGBT28181VideosByDeviceIds(String tenantId,List<String> deviceIds); | |
126 | + | |
125 | 127 | } | ... | ... |