|
|
@@ -4,27 +4,22 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.dji.sample.common.smsp.CallSmsp;
|
|
|
import com.dji.sample.common.util.DesUtil;
|
|
|
import com.dji.sample.configuration.CustomConfiguration;
|
|
|
-import com.dji.sample.manage.dao.IDevicePayloadMapper;
|
|
|
import com.dji.sample.manage.dao.IManageDeviceLivestreamUrlMapper;
|
|
|
import com.dji.sample.manage.dao.IUserMapper;
|
|
|
import com.dji.sample.manage.model.dto.ManageDeviceLivestreamUrlDTO;
|
|
|
import com.dji.sample.manage.model.dto.RtmpUrlDTO;
|
|
|
-import com.dji.sample.manage.model.entity.DevicePayloadEntity;
|
|
|
import com.dji.sample.manage.model.entity.ManageDeviceLivestreamUrlEntity;
|
|
|
import com.dji.sample.manage.model.entity.UserEntity;
|
|
|
import com.dji.sample.manage.model.enums.LiveUrlTypeEnum;
|
|
|
import com.dji.sample.manage.model.enums.UserTypeEnum;
|
|
|
import com.dji.sample.manage.service.IManageDeviceLivestreamUrlService;
|
|
|
import com.dji.sdk.cloudapi.device.DeviceSubTypeEnum;
|
|
|
-import com.dji.sdk.common.HttpResultResponse;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -43,7 +38,7 @@ public class ManageDeviceLivestreamUrlServiceImpl implements IManageDeviceLivest
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public ManageDeviceLivestreamUrlDTO getUrl(ManageDeviceLivestreamUrlDTO deviceLivestreamUrlDTO) {
|
|
|
+ public ManageDeviceLivestreamUrlDTO getUrl(ManageDeviceLivestreamUrlDTO deviceLivestreamUrlDTO,String protocal) {
|
|
|
|
|
|
|
|
|
QueryWrapper<UserEntity> userWrapper = new QueryWrapper<>();
|
|
|
@@ -62,7 +57,7 @@ public class ManageDeviceLivestreamUrlServiceImpl implements IManageDeviceLivest
|
|
|
}
|
|
|
|
|
|
//获取rtmp地址
|
|
|
- RtmpUrlDTO rtmpUrlDTO = CallSmsp.getRtmp(tokenMap.get("Token"),deviceLivestreamUrlDTO.getDeviceSn());
|
|
|
+ RtmpUrlDTO rtmpUrlDTO = CallSmsp.getRtmp(tokenMap.get("Token"),deviceLivestreamUrlDTO.getDeviceSn(),protocal);
|
|
|
ManageDeviceLivestreamUrlDTO rtmpDto = new ManageDeviceLivestreamUrlDTO();
|
|
|
|
|
|
//获取数据库中deviceSn对应的url信息
|
|
|
@@ -72,14 +67,13 @@ public class ManageDeviceLivestreamUrlServiceImpl implements IManageDeviceLivest
|
|
|
List<ManageDeviceLivestreamUrlEntity> urlListFromDB = mapper.selectList(wrapper);
|
|
|
|
|
|
if(urlListFromDB.size() == 0 && rtmpUrlDTO.getMessage() != null ){
|
|
|
- log.debug("The result is null.");
|
|
|
if(tokenMap.get("message") != null) {
|
|
|
throw new RuntimeException (tokenMap.get("message"));
|
|
|
}
|
|
|
if(rtmpUrlDTO.getMessage() != null) {
|
|
|
throw new RuntimeException (rtmpUrlDTO.getMessage());
|
|
|
}
|
|
|
- throw new RuntimeException ("The result is null.");
|
|
|
+ throw new RuntimeException ("获取推流拉流地址异常,请联系技术人员确认!");
|
|
|
}
|
|
|
List<ManageDeviceLivestreamUrlDTO> rtmpList = new ArrayList<>();
|
|
|
if (rtmpUrlDTO.getList().size() > 0) {
|
|
|
@@ -145,7 +139,7 @@ public class ManageDeviceLivestreamUrlServiceImpl implements IManageDeviceLivest
|
|
|
rtmpDto.setRtmpUrl(channelList.get(0).getRtmpUrl());
|
|
|
rtmpDto.setWebRtcUrl(channelList.get(0).getWebRtcUrl());
|
|
|
} else {
|
|
|
- throw new RuntimeException("the url is null.");
|
|
|
+ throw new RuntimeException("没有获取到可以使用的推流和拉流地址");
|
|
|
}
|
|
|
}
|
|
|
return rtmpDto;
|