Kaynağa Gözat

Merge branch 'release' of gitadmin/tuoheng_air_monitor into master

tags/v1.0.2
wanjing 1 yıl önce
ebeveyn
işleme
2124966b41
10 değiştirilmiş dosya ile 225 ekleme ve 28 silme
  1. +9
    -9
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/constant/SystemConstant.java
  2. +121
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/AirPortVo.java
  3. +2
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mqtt/MqttProviderConfig.java
  4. +20
    -13
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airportline/add/AddAirportLineService.java
  5. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryVideoService.java
  6. +68
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/GetAirportListService.java
  7. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/resources/application-dev.yml
  8. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/resources/application-local.yml
  9. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/resources/application-prod.yml
  10. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/resources/application-test.yml

+ 9
- 9
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/constant/SystemConstant.java Dosyayı Görüntüle

@@ -36,32 +36,32 @@ public interface SystemConstant {
/**
* 机场平台:获取机场列表接口
*/
String API_AIRPORT_LIST = "/api/airportInterface/airportList";
String API_AIRPORT_LIST = "/airportInterface/airportList";

/**
* 机场平台:获取机场路线列表接口
*/
String API_AIRPORT_LINE_LIST = "/api/airportInterface/taskByDroneId";
String API_AIRPORT_LINE_LIST = "/airportInterface/taskByDroneId";

/**
* 机场平台:执行接口
*/
String API_AIRPORT_EXECUTE_TASK = "/api/airportInterface/executeTaskAnsy";
String API_AIRPORT_EXECUTE_TASK = "/airportInterface/executeTaskAnsy";

/**
* 机场平台:获取天气
*/
String API_AIRPORT_GET_WEATHER = "/api/airportInterface/getWeather";
String API_AIRPORT_GET_WEATHER = "/airportInterface/getWeather";

/**
* 机场平台:控制无人机
*/
String API_AIRPORT_DRONE_CONTROL = "/api/airportInterface/droneCommand";
String API_AIRPORT_DRONE_CONTROL = "/airportInterface/droneCommand";

/**
* 机场平台:定点飞行
*/
String API_AIRPORT_POINT_FLIGH = "/api/airportInterface/createPointLine";
String API_AIRPORT_POINT_FLIGH = "/airportInterface/createPointLine";

// 飞手平台不同接口url
/**
@@ -72,16 +72,16 @@ public interface SystemConstant {
/**
* 机场平台:获取机场状态
*/
String API_AIRPORT_STATUS_BY_AIRPORT_ID = "/api/airportInterface/getAirportStatusByAirportId";
String API_AIRPORT_STATUS_BY_AIRPORT_ID = "/airportInterface/getAirportStatusByAirportId";

/**
* 机场平台:获取航点文件坐标
*/
String API_AIRPORT_LOCATION = "/api/airportInterface/getLocationById";
String API_AIRPORT_LOCATION = "/airportInterface/getLocationById";

/**
* 机场平台:自动规划航线
*/
String API_AIRPORT_DRONE_LINE = "/api/airportInterface/createDroneLine";
String API_AIRPORT_DRONE_LINE = "/airportInterface/createDroneLine";

}

+ 121
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/AirPortVo.java Dosyayı Görüntüle

@@ -0,0 +1,121 @@
package com.tuoheng.admin.entity.vo;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
* 机场视图Vo
*
* @author wanjing
* @team tuoheng
* @date 2022-11-23
*/
@Data
@NoArgsConstructor
public class AirPortVo implements Serializable {

private static final long serialVersionUID = 1L;

/**
* 机场id
*/
private String id;

/**
* 机场代码
*/
private String code;

/**
* 机场名称
*/
private String name;

/**
* 机场图片
*/
private String image;

/**
* 机场外部监控地址
*/
private String externalMonitorUrl;

/**
* 机场外部监控FLV地址
*/
private String flvExternalMonitorUrl;

/**
* 机场内部监控地址
*/
private String internalMonitorUrl;

/**
* 覆盖范围(km)
*/
private String coverage;

/**
* 排序
*/
private String sort;

/**
* 经度
*/
private String longitude;

/**
* 纬度
*/
private String latitude;

/**
* 无人机id
*/
private String droneId;

/**
* 无人机名称
*/
private String droneName;

/**
* 设备id
*/
private String edgeId;

/**
* 创建人
*/
private String createUser;

/**
* 创建时间
*/
private String createTime;

/**
* 修改人
*/
private String updateUser;

/**
* 修改时间
*/
private String updateTime;

/**
* 状态: 1:空闲 2:飞行中
*/
private String status;

/**
* 是否在线:true:在线 false:离线
*/
private String online;
}

+ 2
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mqtt/MqttProviderConfig.java Dosyayı Görüntüle

@@ -75,7 +75,8 @@ public class MqttProviderConfig {
client.connect(options);

//String topic = "$share/airmonitor/298dd766/environment/message";
String topic = "/v1/298dd766/environment/message";
String topic = "/v1/+/environment/message";
//String topic = "#";
client.subscribe(topic, 0);
} catch (MqttException e) {
e.printStackTrace();

+ 20
- 13
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airportline/add/AddAirportLineService.java Dosyayı Görüntüle

@@ -10,10 +10,12 @@ import com.tuoheng.admin.entity.domain.Tenant;
import com.tuoheng.admin.entity.domain.User;
import com.tuoheng.admin.entity.dto.AirportRouteDto;
import com.tuoheng.admin.entity.request.inspection.AirportLineRequest;
import com.tuoheng.admin.entity.vo.AirPortVo;
import com.tuoheng.admin.enums.AirportLineEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.AirportLineMapper;
import com.tuoheng.admin.mapper.TenantMapper;
import com.tuoheng.admin.service.third.airport.GetAirportListService;
import com.tuoheng.admin.utils.AliyunOSSUtil;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.common.core.config.common.CommonConfig;
@@ -50,7 +52,8 @@ public class AddAirportLineService {
@Autowired
private TenantMapper tenantMapper;


@Autowired
private GetAirportListService getAirportListService;

public JsonResult add(AirportLineRequest request) {
log.info("进入添加航线接口");
@@ -70,7 +73,14 @@ public class AddAirportLineService {
log.info("添加航线数据校验失败:{}",jsonResult.getMsg());
return jsonResult;
}
String ossUrl = this.createPointLineForOss(request.getAirportRouteDtoList());

List<AirPortVo> airPortVoList = getAirportListService.getAirportListByTenantId(tenantId);
if (CollectionUtils.isEmpty(airPortVoList)) {
log.info("添加航线数据,获取机场信息为空");
return jsonResult;
}
AirPortVo airPortVo = airPortVoList.get(0);
String ossUrl = this.createPointLineForOss(airPortVo, request.getAirportRouteDtoList());
String airportLineName = request.getAirportLineName();
Integer airportId = request.getAirportId();
//回调机场平台接口 生成航线id
@@ -149,34 +159,31 @@ public class AddAirportLineService {
return JsonResult.success();
}


/**
* 生成指点航线
*
* @param airportRouteList
* @return
*/
public String createPointLineForOss(List<AirportRouteDto> airportRouteList) {
public String createPointLineForOss(AirPortVo airPortVo, List<AirportRouteDto> airportRouteList) {
String fileUrl = "";
try {
String s = "QGC WPL 110\n";
String tmp = "\t0.00000000\t0.00000000\t0.00000000\t0.00000000\t";
String tmp16 = "\t0\t3\t16" + tmp;
String tmpFirst16 = "\t1\t0\t16" + tmp;
String tmpEnd16 = "\t0\t3\t16" + tmp;
String tmp22 = "\t0\t3\t22" + tmp;
String tmp20 = "\t0\t3\t20" + tmp;
String tmp20 = "\t0\t0\t20" + tmp;
String end = ".000000\t1\n";
AirportRouteDto airportRoute;
s += 0 + tmpFirst16 + airPortVo.getLatitude() + "\t" + airPortVo.getLongitude() + "\t" + "100" + end;
s += 1 + tmp22 + airPortVo.getLatitude() + "\t" + airPortVo.getLongitude() + "\t" + "100" + end;
for (int i = 1; i <= airportRouteList.size(); i++) {
airportRoute = airportRouteList.get(i - 1);
if (1 == i) {
s += i + tmp22;
} else if (airportRouteList.size() == i) {
s += i + tmp20;
} else {
s += i + tmp16;
}
s += (i + 1) + tmpEnd16;
s += airportRoute.getLat() + "\t" + airportRoute.getLng() + "\t" + airportRoute.getAltitude() + end;
}
s += 2 + airportRouteList.size() + tmp20 + airPortVo.getLatitude() + "\t" + airPortVo.getLongitude() + "\t" + "100" + ".000000\t1";
ByteArrayOutputStream out = new ByteArrayOutputStream();
out.write(s.getBytes());
// 将outputstream转成inputstream

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryVideoService.java Dosyayı Görüntüle

@@ -144,7 +144,7 @@ public class QueryVideoService {
log.info("获取的数据,dataObject={}", dataObject.toJSONString());
String records = dataObject.get("records").toString();
List<Airport> airportList = JSONObject.parseArray(records, Airport.class);
log.info("获取records中的数据为:airportList={}", airportList);
//log.info("获取records中的数据为:airportList={}", airportList);
if(CollectionUtil.isNotEmpty(airportList) || airportList.size() != 0){
Airport airport = airportList.get(0);
if(ObjectUtil.isNotNull(airport)){

+ 68
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/GetAirportListService.java Dosyayı Görüntüle

@@ -3,6 +3,7 @@ package com.tuoheng.admin.service.third.airport;
import cn.hutool.core.util.ObjectUtil;
import com.tuoheng.admin.constant.SystemConstant;
import com.tuoheng.admin.entity.domain.Tenant;
import com.tuoheng.admin.entity.vo.AirPortVo;
import com.tuoheng.admin.enums.code.AriportCodeEnum;
import com.tuoheng.admin.mapper.TenantMapper;
import com.tuoheng.admin.utils.CurrentUserUtil;
@@ -14,6 +15,12 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Slf4j
@Service
public class GetAirportListService {
@@ -41,4 +48,65 @@ public class GetAirportListService {
return jsonResult;
}

public List<AirPortVo> getAirportListByTenantId(String tenantId) {
List<AirPortVo> airPortVoList = new ArrayList<>();
//读取不同租户的机场平台url
Tenant tenant = tenantMapper.selectById(tenantId);
if (ObjectUtil.isEmpty(tenant)) {
log.info("获取机场信息, 租户为空,tenantId={}", tenantId);
return null;
}
String url = CommonConfig.airportURL + SystemConstant.API_AIRPORT_LIST;
String param = "page=1&limit=100&tenantCode=" + tenant.getCode();
String airPortStr = HttpUtils.sendGet(url, param);
JsonResult jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class);
if (ObjectUtil.isEmpty(jsonResult) || (!ObjectUtil.isEmpty(jsonResult.getData()) && jsonResult.getCode() != 0)) {
log.info("获取机场信息失败, jsonResult={}", jsonResult);
return null;
}
Map<String, Object> map = (Map<String, Object>) jsonResult.getData();
List<Object> list = (List<Object>) map.get("records");
AirPortVo airPortVo;
Map<String, Object> airPortVoMap;
for (Object obj : list) {
airPortVoMap = new HashMap<>();
for (Object entry : ((Map) obj).entrySet()) {
String key = ((Map.Entry) entry).getKey().toString();
String value = "";
if (ObjectUtil.isNotEmpty(((Map.Entry) entry).getValue())) {
value = ((Map.Entry) entry).getValue().toString();
}
airPortVoMap.put(key, value);
}
airPortVo = (AirPortVo) this.copyObject(airPortVoMap);
if (ObjectUtil.isNotEmpty(airPortVo)) {
airPortVoList.add(airPortVo);
}
}
return airPortVoList;
}

public static <T> Object copyObject(Map<String, Object> field_Val) {
Object o;
try {
Class clz = AirPortVo.class;
o = clz.newInstance();
for (Field tf : clz.getDeclaredFields()) {
String fieldName = tf.getName();
Object targetV = field_Val.get(fieldName);
if (targetV == null) {
continue;
}
tf.setAccessible(true);
tf.set(o, targetV);
}
} catch (InstantiationException e) {
log.info("获取机场信息,InstantiationException:{}", e);
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
log.info("获取机场信息,IllegalAccessException:{}", e);
throw new RuntimeException(e);
}
return o;
}
}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/resources/application-dev.yml Dosyayı Görüntüle

@@ -158,7 +158,7 @@ tuoheng:
pilot-url: http://192.168.11.11:7011/pilot/web/
#airport配置地址
#airport-url: https://airport-test.t-aaron.com
airport-url: http://192.168.11.22:9060
airport-url: http://192.168.11.11:7011/airport/admin
# 文件配置
uploads:
#上传的服务器上的映射文件夹

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/resources/application-local.yml Dosyayı Görüntüle

@@ -169,7 +169,7 @@ tuoheng:
#飞手平台地址
pilot-url: http://192.168.11.241:7011/pilot/web/
#airport配置地址
airport-url: https://airport-test.t-aaron.com
airport-url: https://airport-test.t-aaron.com/airport/admin
# 文件配置
uploads:
#上传的服务器上的映射文件夹

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/resources/application-prod.yml Dosyayı Görüntüle

@@ -158,7 +158,7 @@ tuoheng:
#飞手平台地址
pilot-url: https://pilot.t-aaron.com/pilot/web/
#airport配置地址
airport-url: https://airport.t-aaron.com
airport-url: https://airport.t-aaron.com/airport/admin
# 文件配置
uploads:
#上传的服务器上的映射文件夹

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/resources/application-test.yml Dosyayı Görüntüle

@@ -158,7 +158,7 @@ tuoheng:
#飞手平台地址
pilot-url: http://172.15.1.11:7011/pilot/web/
#airport配置地址
airport-url: https://airport-test.t-aaron.com
airport-url: https://airport-test.t-aaron.com/airport/admin
# 文件配置
uploads:
#上传的服务器上的映射文件夹

Yükleniyor…
İptal
Kaydet