Commit 9ca3a5090ca3e42d1f6f5b5833c02e0a854837f0
1 parent
ffdc1c9a
feat:1.单独新增GBT视频时校验是否存在2.视频通道分页接口增加状态筛选条件
Showing
5 changed files
with
23 additions
and
0 deletions
... | ... | @@ -16,6 +16,7 @@ import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; |
16 | 16 | import org.thingsboard.server.common.data.yunteng.dto.DeviceDTO; |
17 | 17 | import org.thingsboard.server.common.data.yunteng.dto.sip.VideoChanelDTO; |
18 | 18 | import org.thingsboard.server.common.data.yunteng.enums.OrderTypeEnum; |
19 | +import org.thingsboard.server.common.data.yunteng.enums.StatusEnum; | |
19 | 20 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
20 | 21 | import org.thingsboard.server.controller.BaseController; |
21 | 22 | import org.thingsboard.server.dao.yunteng.mapper.DeviceMapper; |
... | ... | @@ -49,6 +50,8 @@ public class TkVideoChannelController extends BaseController { |
49 | 50 | @RequestParam(value = "tbDeviceId") String tbDeviceId, |
50 | 51 | @ApiParam(value = "视频通道名称") |
51 | 52 | @RequestParam(value = "name", required = false) String name, |
53 | + @ApiParam(value = "设备状态") | |
54 | + @RequestParam(value = "status", required = false) StatusEnum status, | |
52 | 55 | @ApiParam(value = "国标编号") |
53 | 56 | @RequestParam(value = "cameraCode", required = false) String cameraCode) throws ThingsboardException { |
54 | 57 | HashMap<String, Object> queryMap = new HashMap<>(); |
... | ... | @@ -58,6 +61,9 @@ public class TkVideoChannelController extends BaseController { |
58 | 61 | if(StringUtils.isNotEmpty(cameraCode)){ |
59 | 62 | queryMap.put("cameraCode",cameraCode); |
60 | 63 | } |
64 | + if(status!=null){ | |
65 | + queryMap.put("status",status); | |
66 | + } | |
61 | 67 | String tenantId = getCurrentUser().getCurrentTenantId(); |
62 | 68 | if(StringUtils.isEmpty(tbDeviceId)){ |
63 | 69 | throw new TkDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); | ... | ... |
... | ... | @@ -135,6 +135,7 @@ public enum ErrorMessage { |
135 | 135 | OUTER_NET_ERROR(400110,"外网ip+端口不能重复,请重新输入"), |
136 | 136 | |
137 | 137 | DEVICE_NOT_ONLINE(400111,"设备不在线,无法执行相关操作!"), |
138 | + GBT_VIDEO_REPETITION(400112,"该设备通道号视频已存在!"), | |
138 | 139 | HAVE_NO_PERMISSION(500002,"没有修改权限"), |
139 | 140 | NOT_ALLOED_ISOLATED_IN_MONOLITH(500003,"【monolith】模式下,不能选择【isolated】类型的租户配置"); |
140 | 141 | ... | ... |
... | ... | @@ -70,6 +70,17 @@ public class TkVideoServiceImpl extends AbstractBaseService<TkVideoMapper, TkVid |
70 | 70 | @Override |
71 | 71 | @Transactional(rollbackFor = Exception.class) |
72 | 72 | public TkVideoDTO saveOrUpdate(TkVideoDTO videoDTO) { |
73 | + if(videoDTO.getAccessMode()==FastIotConstants.MagicNumber.TWO){ | |
74 | + TkVideoEntity oldVideo = baseMapper.selectOne(new QueryWrapper<TkVideoEntity>().lambda() | |
75 | + .eq(TkVideoEntity::getSn, videoDTO.getSn()) | |
76 | + .eq(TkVideoEntity::getTenantId,videoDTO.getTenantId()) | |
77 | + .like(TkVideoEntity::getParams, videoDTO.getParams())); | |
78 | + if(null!=oldVideo | |
79 | + &&((StringUtils.isNotBlank(videoDTO.getId())&&!oldVideo.getId().equals(videoDTO.getId())) | |
80 | + ||(StringUtils.isEmpty(videoDTO.getId())))){ | |
81 | + throw new TkDataValidationException(ErrorMessage.GBT_VIDEO_REPETITION.getMessage()); | |
82 | + } | |
83 | + } | |
73 | 84 | if (StringUtils.isNotEmpty(videoDTO.getId())) { |
74 | 85 | TkVideoEntity oldVideo = baseMapper.selectOne(new QueryWrapper<TkVideoEntity>().lambda() |
75 | 86 | .eq(TkVideoEntity::getTenantId, videoDTO.getTenantId()) |
... | ... | @@ -242,6 +253,7 @@ public class TkVideoServiceImpl extends AbstractBaseService<TkVideoMapper, TkVid |
242 | 253 | videoDto.setTenantId(dto.getTenantId()); |
243 | 254 | TkVideoEntity oldVideo = baseMapper.selectOne(new QueryWrapper<TkVideoEntity>().lambda() |
244 | 255 | .eq(TkVideoEntity::getSn, channelNo) |
256 | + .eq(TkVideoEntity::getTenantId,dto.getTenantId()) | |
245 | 257 | .like(TkVideoEntity::getParams, deviceId)); |
246 | 258 | if(oldVideo!=null){ |
247 | 259 | videoDto.setId(oldVideo.getId()); | ... | ... |
... | ... | @@ -13,6 +13,7 @@ import org.thingsboard.server.common.data.StringUtils; |
13 | 13 | import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; |
14 | 14 | import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; |
15 | 15 | import org.thingsboard.server.common.data.yunteng.dto.sip.VideoChanelDTO; |
16 | +import org.thingsboard.server.common.data.yunteng.enums.StatusEnum; | |
16 | 17 | import org.thingsboard.server.common.data.yunteng.utils.ReflectUtils; |
17 | 18 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
18 | 19 | import org.thingsboard.server.dao.yunteng.entities.TkVideoChannelEntity; |
... | ... | @@ -30,12 +31,14 @@ public class TkVideoChannelServiceImpl |
30 | 31 | String name = (String) queryMap.get("name"); |
31 | 32 | String cameraCode = (String) queryMap.get("cameraCode"); |
32 | 33 | String tbDeviceId = (String) queryMap.get("tbDeviceId"); |
34 | + StatusEnum status= (StatusEnum) queryMap.get("status"); | |
33 | 35 | IPage<TkVideoChannelEntity> iPage = |
34 | 36 | baseMapper.selectPage( |
35 | 37 | getPage(queryMap, "create_time", false), |
36 | 38 | new LambdaQueryWrapper<TkVideoChannelEntity>() |
37 | 39 | .eq(TkVideoChannelEntity::getTenantId, tenantId) |
38 | 40 | .eq(TkVideoChannelEntity::getDeviceId, tbDeviceId) |
41 | + .eq(status!=null,TkVideoChannelEntity::getStatus, status) | |
39 | 42 | .like(StringUtils.isNotEmpty(name), TkVideoChannelEntity::getName, name) |
40 | 43 | .like( |
41 | 44 | StringUtils.isNotEmpty(cameraCode), | ... | ... |