Browse Source

任务新增飞行距离,飞行时长字段

pull/356/head
wanjing 11 months ago
parent
commit
b5d1fb423e
7 changed files with 82 additions and 29 deletions
  1. +3
    -1
      tuoheng-service/tuoheng-admin/sql/sql_change_v1.3.5.sql
  2. +10
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/FlightData.java
  3. +10
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Inspection.java
  4. +31
    -22
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/status/UpdateWaittStatusService.java
  5. +10
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/inspection/InspectionDetailsVo.java
  6. +10
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/inspection/InspectionVo.java
  7. +8
    -6
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionMapper.xml

+ 3
- 1
tuoheng-service/tuoheng-admin/sql/sql_change_v1.3.5.sql View File

@@ -36,4 +36,6 @@ create table th_inspection_cycle

-- 任务表中新增周期任务ID
alter table tuoheng_freeway.th_inspection add inspection_cycle_id varchar(36) default '' not null comment '周期性任务ID' after inspection_type;
alter table tuoheng_freeway.th_inspection add airport_task_id int default 0 not null comment '机场任务ID' after inspection_cycle_id;
alter table tuoheng_freeway.th_inspection add airport_task_id int default 0 not null comment '机场任务ID' after inspection_cycle_id;
alter table tuoheng_freeway.th_inspection add flytime varchar(50) default '' not null comment '总飞行时间(秒)' after fly_height;
alter table tuoheng_freeway.th_inspection add mileage varchar(50) default '' not null comment '总飞行里程(米)' after flytime;

+ 10
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/FlightData.java View File

@@ -103,4 +103,14 @@ public class FlightData extends BaseEntity {
*/
private String ysingal;

/**
* 总飞行时间:单位秒
*/
private String flytime;

/**
* 总里程
*/
private String mileage;

}

+ 10
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Inspection.java View File

@@ -246,6 +246,16 @@ public class Inspection extends BaseEntity {
*/
private String flyHeight;

/**
* 飞行总时长(秒)
*/
private String flytime;

/**
* 飞行总里程(米)
*/
private String mileage;

/**
* srt文件名称
*/

+ 31
- 22
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/status/UpdateWaittStatusService.java View File

@@ -65,14 +65,13 @@ public class UpdateWaittStatusService {
.orderByDesc(Business::getCreateTime));

if (CollectionUtil.isEmpty(businessList)) {
log.info("业务数据为空");
inspectionMapper.updateById(inspectionUpdate);
return;
// 硬件停止后,停止AI分析
log.info("硬件停止后,停止AI分析, inspectionId:{}", inspection.getId());
dspService.stopAI(businessList.get(0).getMsgId(), inspection.getId());
} else {
log.info("硬件停止后,停止AI分析, 业务数据为空, inspectionId:{}", inspection.getId());
}

// 硬件停止后,停止AI分析
dspService.stopAI(businessList.get(0).getMsgId(), inspection.getId());

//获取天气信息
JsonResult result = this.getWeather(CommonConfig.airportURL, inspection.getAirportId());
if (0 != result.getCode()) {
@@ -85,22 +84,12 @@ public class UpdateWaittStatusService {
String weatherStr = AirWeatherUtil.getWeather(weather);
inspectionUpdate.setWeather(weatherStr);

Integer flightDataCount = flightDataMapper.selectCount(new LambdaQueryWrapper<FlightData>()
.eq(FlightData::getInspectionId, inspection.getId())
.eq(FlightData::getTenantId, inspection.getTenantId())
.eq(FlightData::getMark, MarkEnum.VALID.getCode()));
log.info("坐标数据,flightDataCount:{}", flightDataCount);
if (flightDataCount > 0) {
int index = (int) Math.ceil((double) flightDataCount / 2);
FlightData flightData = flightDataMapper.selectOne(new LambdaQueryWrapper<FlightData>()
.eq(FlightData::getInspectionId, inspection.getId())
.eq(FlightData::getTenantId, inspection.getTenantId())
.eq(FlightData::getMark, MarkEnum.VALID.getCode())
.orderByDesc(FlightData::getTimestamp)
.last("limit " + index + ",1"));
if (ObjectUtil.isNotNull(flightData)) {
inspectionUpdate.setFlyHeight(flightData.getUltrasonic());
}
// 增加实时数据最后一次“飞行总里程”、“飞行总时长”
FlightData flightData = this.getFlightData(inspection);
if (ObjectUtil.isNotNull(flightData)) {
inspectionUpdate.setFlyHeight(flightData.getUltrasonic());
inspectionUpdate.setFlytime(flightData.getFlytime());
inspectionUpdate.setMileage(flightData.getMileage());
}

inspectionMapper.updateById(inspectionUpdate);
@@ -137,6 +126,26 @@ public class UpdateWaittStatusService {
}
}

private FlightData getFlightData(Inspection inspection) {
FlightData flightData = null;
Integer flightDataCount = flightDataMapper.selectCount(new LambdaQueryWrapper<FlightData>()
.eq(FlightData::getInspectionId, inspection.getId())
.eq(FlightData::getTenantId, inspection.getTenantId())
.eq(FlightData::getMark, MarkEnum.VALID.getCode()));
log.info("坐标数据,flightDataCount:{}", flightDataCount);
if (flightDataCount > 0) {
int index = (int) Math.ceil((double) flightDataCount / 2);
flightData = flightDataMapper.selectOne(new LambdaQueryWrapper<FlightData>()
.eq(FlightData::getInspectionId, inspection.getId())
.eq(FlightData::getTenantId, inspection.getTenantId())
.eq(FlightData::getMark, MarkEnum.VALID.getCode())
.orderByDesc(FlightData::getTimestamp)
.last("limit " + index + ",1"));

}
return flightData;
}

private void updateReport(Inspection inspection) {
Report report = reportMapper.selectOne(Wrappers.<Report>lambdaQuery()
.eq(Report::getInspectionId, inspection.getId())

+ 10
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/inspection/InspectionDetailsVo.java View File

@@ -60,6 +60,16 @@ public class InspectionDetailsVo {
*/
private String inspectionLineName;

/**
* 飞行总里程(米)
*/
private String mileage;

/**
* 飞行总时长(秒)
*/
private String flytime;

/**
* 是否实时,1:实时 2:离线 默认:null
*/

+ 10
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/inspection/InspectionVo.java View File

@@ -232,6 +232,16 @@ public class InspectionVo extends BaseEntity {
*/
private String flyHeight;

/**
* 飞行总时长(秒)
*/
private String flytime;

/**
* 飞行总里程(米)
*/
private String mileage;

/**
* srt文件名称
*/

+ 8
- 6
tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionMapper.xml View File

@@ -48,6 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="note" column="note" />
<result property="weather" column="weather" />
<result property="flyHeight" column="fly_height" />
<result property="flytime" column="flytime" />
<result property="mileage" column="mileage" />
<result property="srtName" column="srt_name" />
<result property="heartbeatTime" column="heartbeat_time" />
<result property="executionStatus" column="execution_status" />
@@ -69,9 +71,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
id, tenant_id, dept_id, code, name, type, road_id, road_name, section_id, section_name, inspection_type,
inspectionCycleI, airport_task_id, airport_id, drone_id, airport_name, inspection_line, inspection_line_name,
equipment_id, equipment_name, equipment_mount_id, equipment_mount_name, cloud_box_id, cloud_box_name, box_sn,
flight_hand, flight_hand_name, inspection_time,
execution_start_time, execution_end_time, is_live, is_taken, is_tilt, video_url, ai_video_url, report_url, srt_url,
status, analyse_status, progressbar, note, weather, fly_height, srt_name, heartbeat_time, execution_status,
flight_hand, flight_hand_name, inspection_time, execution_start_time, execution_end_time, is_live, is_taken, is_tilt,
video_url, ai_video_url, report_url, srt_url, status, analyse_status, progressbar, note, weather,
fly_height, flytime, mileage, srt_name, heartbeat_time, execution_status,
start_longitude, start_latitude, end_longitude, end_latitude, mobile, patrol_location,
create_user, create_time, update_user, update_time, mark
</sql>
@@ -80,9 +82,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, tenant_id, dept_id, code, name, type, road_id, road_name, section_id, section_name, inspection_type,
inspectionCycleI, airport_task_id, airport_id, drone_id, airport_name, inspection_line, inspection_line_name,
equipment_id, equipment_name, equipment_mount_id, equipment_mount_name, cloud_box_id, cloud_box_name, box_sn,
flight_hand, flight_hand_name, inspection_time,
execution_start_time, execution_end_time, is_live, is_taken, is_tilt, video_url, ai_video_url, report_url, srt_url,
status, analyse_status, progressbar, note, weather, fly_height, srt_name, heartbeat_time, execution_status,
flight_hand, flight_hand_name, inspection_time, execution_start_time, execution_end_time, is_live, is_taken, is_tilt,
video_url, ai_video_url, report_url, srt_url, status, analyse_status, progressbar, note, weather,
fly_height, flytime, mileage, srt_name, heartbeat_time, execution_status,
start_longitude, start_latitude, end_longitude, end_latitude, mobile, patrol_location,
create_user, create_time, update_user, update_time, mark
from th_inspection

Loading…
Cancel
Save