Browse Source

根据任务id获取巡检轨迹

tags/v1.0.0^2
chengwang 1 year ago
parent
commit
56305a8f89
7 changed files with 121 additions and 1 deletions
  1. +11
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionController.java
  2. +6
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/FlightData.java
  3. +4
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/FlightDataMapper.java
  4. +6
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/IInspectionService.java
  5. +14
    -0
      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. +36
    -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
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/FlightData.java View File

@@ -17,10 +17,15 @@ import lombok.experimental.Accessors;
public class FlightData extends BaseEntity {
private static final long serialVersionUID = 1L;

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

/**
* 巡检任务ID
*/
private Integer inspectionId;
private String inspectionId;

/**
* 云盒SN号

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

@@ -3,9 +3,13 @@ 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);

}

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

@@ -84,4 +84,10 @@ public interface IInspectionService {
*/
JsonResult resubmit(EditInspectionRequest editInspectionRequest);

/**
* 获取飞行轨迹
* @param id
* @return
*/
JsonResult findFlightData(String id);
}

+ 14
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/InspectionServiceImpl.java View File

@@ -56,6 +56,10 @@ public class InspectionServiceImpl implements IInspectionService {
@Autowired
private ResubmitInspectionService resubmitInspectionService;

@Autowired
private QueryFindFlightDataService queryFindFlightDataService;

/**
* 查询巡检任务分页分页列表
*
@@ -161,4 +165,14 @@ public class InspectionServiceImpl implements IInspectionService {
public JsonResult resubmit(EditInspectionRequest editInspectionRequest) {
return resubmitInspectionService.resubmit(editInspectionRequest);
}

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

+ 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);


}
}

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

@@ -4,4 +4,40 @@
"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