Browse Source

根据任务id获取巡检轨迹

tags/v1.0.0^2
chengwang 1 year ago
parent
commit
28c043ea7d
7 changed files with 128 additions and 2 deletions
  1. +11
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionController.java
  2. +6
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/FlightData.java
  3. +7
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/FlightDataMapper.java
  4. +8
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/IInspectionService.java
  5. +15
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/InspectionServiceImpl.java
  6. +44
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryFindFlightDataService.java
  7. +37
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/FlightDataMapper.xml

+ 11
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionController.java View File

@@ -99,6 +99,17 @@ public class InspectionController {
return iInspectionService.getVideoById(id);
}


/**
* 获取飞行轨迹
* @param id
* @return
*/
@GetMapping("/findFlightData/{id}")
public JsonResult finFlightData(@PathVariable("id") String id){
return iInspectionService.findFlightData(id);
}

/**
* 重新提交巡检任务
*/

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

@@ -22,6 +22,12 @@ public class FlightData extends BaseEntity {
*/
private Integer inspectionId;

/**
*租户id
*/
private String tenantId;


/**
* 云盒SN号
*/

+ 7
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/FlightDataMapper.java View File

@@ -3,9 +3,16 @@ package com.tuoheng.admin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.admin.entity.FlightData;


import java.util.List;

/**
* @Author ChengWang
* @Date 2022/12/1
*/
public interface FlightDataMapper extends BaseMapper<FlightData> {

List<FlightData> selectListByInspectionId(String id);


}

+ 8
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/IInspectionService.java View File

@@ -85,6 +85,13 @@ public interface IInspectionService {
JsonResult resubmit(EditInspectionRequest editInspectionRequest);

/**
<<<<<<< HEAD
* 获取飞行轨迹
* @param id
* @return
*/
JsonResult findFlightData(String id);
=======
* 立即执行
*
* @param id 任务id
@@ -92,4 +99,5 @@ public interface IInspectionService {
*/
JsonResult execute(String id);

>>>>>>> 187812e997321373e2dee541777d3ca3493967dd
}

+ 15
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/InspectionServiceImpl.java View File

@@ -57,9 +57,13 @@ public class InspectionServiceImpl implements IInspectionService {
@Autowired
private ResubmitInspectionService resubmitInspectionService;

@Autowired
private QueryFindFlightDataService queryFindFlightDataService;

@Autowired
private ExecuteInspectionService executeInspectionService;


/**
* 查询巡检任务分页分页列表
*
@@ -167,8 +171,17 @@ public class InspectionServiceImpl implements IInspectionService {
}

/**
* 立即执行
*
* 获取飞行轨迹
* @param id
* @return
*/
@Override
public JsonResult findFlightData(String id) {
return queryFindFlightDataService.findFlightData(id);
}

/**
*立即执行
* @param id 任务id
* @return 结果
*/

+ 44
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryFindFlightDataService.java View File

@@ -0,0 +1,44 @@
package com.tuoheng.admin.service.inspection.query;

import com.tuoheng.admin.entity.FlightData;
import com.tuoheng.admin.enums.code.inspection.QueryInspectionInfoByIdCodeEnum;
import com.tuoheng.admin.mapper.FlightDataMapper;
import com.tuoheng.admin.mapper.InspectionMapper;
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.stereotype.Service;

import java.util.List;

/**
* 获取飞行轨迹 业务处理层
*
* @Author ChengWang
* @Date 2022/12/1
*/
@Service
@Slf4j
public class QueryFindFlightDataService {

@Autowired
private InspectionMapper inspectionMapper;

@Autowired
private FlightDataMapper flightDataMapper;



public JsonResult findFlightData(String id) {
if(StringUtils.isEmpty(id)){
return JsonResult.error(QueryInspectionInfoByIdCodeEnum.INSPECTION_ID_IS_NULL.getCode(),QueryInspectionInfoByIdCodeEnum.INSPECTION_ID_IS_NULL.getMsg());
}
//根据任务id查询对应的云盒遥测数据
List<FlightData> listData = flightDataMapper.selectListByInspectionId(id);

return JsonResult.success(listData);


}
}

+ 37
- 0
tuoheng-service/tuoheng-admin/src/main/resources/mapper/FlightDataMapper.xml View File

@@ -4,4 +4,41 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tuoheng.admin.mapper.FlightDataMapper">

<resultMap id="BaseResultMap" type="com.tuoheng.admin.entity.FlightData">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
<result column="inspection_id" jdbcType="VARCHAR" property="inspectionId" />
<result column="box_sn" jdbcType="VARCHAR" property="boxSn" />
<result column="lng" jdbcType="VARCHAR" property="lng" />
<result column="lat" jdbcType="VARCHAR" property="lat" />
<result column="altitude" jdbcType="VARCHAR" property="altitude" />
<result column="ultrasonic" jdbcType="VARCHAR" property="ultrasonic" />
<result column="pitch" jdbcType="VARCHAR" property="pitch" />
<result column="roll" jdbcType="VARCHAR" property="roll" />
<result column="yaw" jdbcType="VARCHAR" property="yaw" />
<result column="airspeed" jdbcType="VARCHAR" property="airspeed" />
<result column="velocity" jdbcType="VARCHAR" property="velocity" />
<result column="timestamp" jdbcType="VARCHAR" property="timestamp" />
<result column="is_srt" jdbcType="INTEGER" property="isSrt" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_user" jdbcType="VARCHAR" property="updateUser" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="mark" jdbcType="INTEGER" property="mark" />
</resultMap>

<sql id="Base_Column_List">
id, tenant_id, inspection_id, box_sn, lng, lat, altitude, ultrasonic, pitch, roll, yaw, airspeed,
velocity, `timestamp`, is_srt, create_user, create_time, update_user, update_time, mark
</sql>

<select id="selectListByInspectionId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from th_flight_data
where inspection_id = #{id}
and mark = 1
order by timestamp asc
</select>

</mapper>

Loading…
Cancel
Save