Authored by mali

视频直播

... ... @@ -183,7 +183,7 @@ public class UfoLiveController {
public ApiResponse savePhoneCameraRecord(PhoneUidCameraBo phoneUidCameraBo) {
LOGGER.info("savePhoneCameraRecord in. phoneUidCameraBo is {}", phoneUidCameraBo);
Boolean reslut = phoneUidCameraService.insert(phoneUidCameraBo);
return new ApiResponse.ApiResponseBuilder().code(200).data(reslut).message("查询成功").build();
return new ApiResponse.ApiResponseBuilder().code(reslut ? 200 : 400).data(reslut).message("查询成功").build();
}
... ...
... ... @@ -33,6 +33,10 @@ public class PhoneUidCameraService {
return false;
}
if (null != phoneUidCameraMapper.selectByphoneUid(record.getPhoneUid())) {
return false; //已存在
}
PhoneUidCamera phoneUidCamera = new PhoneUidCamera();
try {
BeanUtils.copyProperties(phoneUidCamera, record);
... ...
... ... @@ -226,12 +226,19 @@ public class UfoLiveService {
}
public Integer queryCurrentTime(Long orderCode, String phoneUid) throws PlatformException {
if (StringUtils.isNotEmpty(phoneUid) && null == phoneUidCameraService.selectByphoneUid(phoneUid)) { // 如果启动手机唯一标识来关联摄像头,则走此流程
throw new PlatformException("没有选择摄像头", 400);
if (StringUtils.isNotEmpty(phoneUid)) { // 如果启动手机唯一标识来关联摄像头,则走此流程
if (null == phoneUidCameraService.selectByphoneUid(phoneUid)) {
throw new PlatformException("没有选择摄像头", 400);
} else {
int currentTimeSeconds = DateUtil.getCurrentTimeSeconds();
if (!Objects.isNull(orderCode)) {
liveRecordTimeMapper.insertOrUpdate(new LiveRecordTime(orderCode, currentTimeSeconds));
}
return currentTimeSeconds;
}
}
Integer userId = new UserHelper().getUserId();
RedisKeyBuilder key = RedisKeyBuilder.newInstance().appendFixed(RedisKeyConstants.LIVE_USER).appendVar(userId);
if (redisTemplate.hasKey(key)) {
int currentTimeSeconds = DateUtil.getCurrentTimeSeconds();
... ...