package com.ard.tianyu.service.impl;
|
|
import com.ard.tianyu.config.TyConfiguration;
|
import com.ard.tianyu.http.TyClient;
|
import com.ard.tianyu.model.dto.BoxHistoryDTO;
|
import com.ard.tianyu.model.dto.BoxPhotosDTO;
|
import com.ard.tianyu.model.receiver.*;
|
import com.ard.tianyu.service.ITyService;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
import java.util.Collections;
|
import java.util.List;
|
|
/**
|
* TyServiceImpl
|
*
|
* @author liusuyi
|
* @date 2024年10月22日8:37
|
**/
|
@Service
|
public class TyServiceImpl implements ITyService {
|
|
@Resource
|
private TyClient tyClient;
|
@Resource
|
private TyConfiguration tyConfiguration;
|
|
/**
|
* 获取天宇token信息
|
*
|
* @return
|
*/
|
@Override
|
public AccessTokenReceiver getAccessToken() {
|
return tyConfiguration.getAccessToken();
|
}
|
|
/**
|
* 获取云盒列表
|
*
|
* @return
|
*/
|
@Override
|
public List<BoxReceiver> getBoxList() {
|
//请求云盒列表
|
TyHttpCommonReceiver<List<BoxReceiver>> boxListReveiver = tyClient.getBoxList(tyConfiguration.getAccessToken().convertFromDTO());
|
return boxListReveiver.getContent();
|
}
|
|
/**
|
* 获取直播地址
|
*
|
* @return
|
*/
|
@Override
|
public PullStreamUrlReceiver getBoxLiveUrl(String boxSn) {
|
|
TyHttpCommonReceiver<PullStreamUrlReceiver> boxLiveUrl = tyClient.getBoxLiveUrl(boxSn, tyConfiguration.getAccessToken().convertFromDTO());
|
return boxLiveUrl.getContent();
|
}
|
|
/**
|
* 获取飞行历史
|
*
|
* @return
|
*/
|
@Override
|
public List<BoxHistoryReceiver> getBoxHistory(BoxHistoryDTO boxHistoryDTO) {
|
TyHttpCommonReceiver<List<BoxHistoryReceiver>> boxHistory = tyClient.getBoxHistory(boxHistoryDTO, tyConfiguration.getAccessToken().convertFromDTO());
|
return boxHistory.getContent();
|
}
|
|
/**
|
* 获取盒子图片
|
*
|
* @return
|
*/
|
@Override
|
public List<BoxPhotosReceiver> getBoxPhotos(BoxPhotosDTO boxPhotosDTO) {
|
TyHttpCommonReceiver<List<BoxPhotosReceiver>> boxPhotos = tyClient.getBoxPhotos(boxPhotosDTO, tyConfiguration.getAccessToken().convertFromDTO());
|
return boxPhotos.getContent();
|
}
|
}
|