Browse Source

添加获取机场航线列表接口

tags/v1.3.1
chengwang 1 year ago
parent
commit
f1bb6c06bc
4 changed files with 170 additions and 19 deletions
  1. +21
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/response/FlyLinePointResult.java
  2. +91
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/response/TZHLAirportLineResponse.java
  3. +24
    -19
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/airportline/TZHLGetAirportLineListService.java
  4. +34
    -0
      tuoheng-service/tuoheng-admin/src/test/java/com/tuoheng/admin/tzhl/TZHLGetAirportLineListServiceTest.java

+ 21
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/response/FlyLinePointResult.java View File

@@ -0,0 +1,21 @@
package com.tuoheng.admin.tzhl.response;

import lombok.Data;

/**
* @Author ChengWang
* @Date 2023/8/10
*/
@Data
public class FlyLinePointResult {

/**
* 纬度 精确7位
*/
private String latitude;

/**
* 经度 精确7位
*/
private String longitude;
}

+ 91
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/response/TZHLAirportLineResponse.java View File

@@ -0,0 +1,91 @@
package com.tuoheng.admin.tzhl.response;

import lombok.Data;

import java.util.List;

/**
* @Author ChengWang
* @Date 2023/8/10
*/
@Data
public class TZHLAirportLineResponse {

/**
* 航线id
*/
private Long id;

/**
* 航线名称
*/
private String name;

/**
* 航线距离 单位米 精确2位
*/
private String distince;

/**
* 航线高度 单位米 精确2位
*/
private Float height;

/**
* 飞行速度 单位m/s 精确2位
*/
private Integer speed;

/**
* 时长 单位s 精确0位
*/
private String duration;

/**
* 航点数量
*/
private Integer pointCount;


/**
* 部门ID
*/
private Long deptId;

/**
* 航线点集合
*/
private List<FlyLinePointResult> points;

/**
* 航线文件下载url
*/
private String downloadUrl;

/**
* MD5文件校验
*/
private String sign;

/**
* 航线截图下载路径(三维航线简略图)
*/
private String pictureUrl;

/**
* 预定义模板类型 waypoint:航点飞行,mapping2d:建图航拍 ,mapping3d:倾斜摄影,mappingStrip:航带飞行
*/
private String templateType;

/**
* 数据来源返回显示:0.内部kmz文件 1.外部导入kmz文件
*/
private Integer dataSourceType;

/**
* 航线版本 4(4.0) 3(3.0)
*/
private Integer flyLineVersion;


}

tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/airport/TZHLGetAirportLineListService.java → tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/airportline/TZHLGetAirportLineListService.java View File

@@ -1,18 +1,18 @@
package com.tuoheng.admin.tzhl.service.airport;
package com.tuoheng.admin.tzhl.service.airportline;

import ch.qos.logback.core.util.StringCollectionUtil;

import com.alibaba.fastjson.JSONObject;
import com.tuoheng.admin.tzhl.constant.TZHLConstant;
import com.tuoheng.admin.tzhl.request.TZHLGetAirportLineListRequest;
import com.tuoheng.admin.tzhl.response.TZHLAirportLineResponse;
import com.tuoheng.admin.tzhl.service.token.TZHLGetTokenService;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
@@ -31,9 +31,13 @@ public class TZHLGetAirportLineListService {
@Autowired
private RestTemplate restTemplate;

public JsonResult getAirportLine(TZHLGetAirportLineListRequest request){
public JsonResult getAirportLine(String name, String sn, String lineType){
String token = tzhlGetTokenService.getToken();
JsonResult result =this.check(request,token);
TZHLGetAirportLineListRequest request = new TZHLGetAirportLineListRequest();
request.setName(name);
request.setSn(sn);
request.setLineType(lineType);
JsonResult result =this.check(token);
if(result.getCode() != 0){
return JsonResult.error(result.getMsg());
}
@@ -53,23 +57,24 @@ public class TZHLGetAirportLineListService {
log.info("请求获取机场列表, httpEntity:{}", httpEntity);
return JsonResult.error("请求获取机场列表失败");
}
if(null == response || !response.hasBody()){
log.error("获取机场航线列表失败");
throw new ServiceException(HttpStatus.BAD_REQUEST.value(),"获取机场列表失败");
}
if(response.getBody().getCode() != 200){
log.error("获取机场航线列表失"+response.getBody());
return JsonResult.error(response.getBody().getMsg());
}

TZHLAirportLineResponse tzhlAirportLineResponse = JSONObject.parseObject(response.getBody().getData().toString(),
TZHLAirportLineResponse.class);



return null;
return JsonResult.success(tzhlAirportLineResponse);
}

private JsonResult check(TZHLGetAirportLineListRequest request,String token) {
if(StringUtils.isEmpty(request.getName())){
return JsonResult.error("机场名称为空");
}
if(StringUtils.isEmpty(request.getSn())){
return JsonResult.error("方舱序列号为空");
}
if(StringUtils.isEmpty(request.getLineType())){
return JsonResult.error("航线类型为空");
}
private JsonResult check(String token) {
if(StringUtils.isEmpty(token)){
return JsonResult.error("token不存在或已过期");
}

+ 34
- 0
tuoheng-service/tuoheng-admin/src/test/java/com/tuoheng/admin/tzhl/TZHLGetAirportLineListServiceTest.java View File

@@ -0,0 +1,34 @@
package com.tuoheng.admin.tzhl;

import com.tuoheng.admin.tzhl.service.airport.TZHLGetAirportListService;
import com.tuoheng.admin.tzhl.service.airportline.TZHLGetAirportLineListService;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
* @Author ChengWang
* @Date 2023/8/9
*/
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class TZHLGetAirportLineListServiceTest {

@Autowired
private TZHLGetAirportLineListService tzhlGetAirportLineListService;

@Test
public void testGetAirportLineListTest() {
String name = null;
String sn = null;
String lineType = null;
JsonResult result = tzhlGetAirportLineListService.getAirportLine(name,sn,lineType);
System.out.println("data" + result.getData());
}

}

Loading…
Cancel
Save