Browse Source

1、提交获取飞行日志、飞行画面、飞行数据框架代码;2、优化请求天翼平台代码;

tags/v1.3.1
wanjing 1 year ago
parent
commit
be4c5c8e87
14 changed files with 617 additions and 3 deletions
  1. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/constant/TZHLConstant.java
  2. +30
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/request/TZHLFlyDataRequest.java
  3. +25
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/request/TZHLFlyLogRequest.java
  4. +27
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/response/TZHLFlyDataResponse.java
  5. +40
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/response/TZHLFlyLogResponse.java
  6. +45
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/response/TZHLOnlineUavResponse.java
  7. +90
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/CallTianYiPlatformService.java
  8. +56
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/fly/data/FlyDataService.java
  9. +55
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/fly/log/FlyLogService.java
  10. +50
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/fly/onlineuav/OnlineUavService.java
  11. +2
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/token/TZHLGetTokenService.java
  12. +65
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/task/FlyDataTask.java
  13. +66
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/task/FlyLogTask.java
  14. +65
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/task/OnlineUavTask.java

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/constant/TZHLConstant.java View File

@@ -38,7 +38,7 @@ public interface TZHLConstant {
/**
* 天翼星云机场平台:下发任务
*/
String TIAN_YI_API_DISTRIBUTE_TASKS = "/prod-api/shelter/task";
String TIAN_YI_API_SHELTER_TASKS = "/prod-api/shelter/task";

/**
* 天翼星云机场平台:飞行日志回调

+ 30
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/request/TZHLFlyDataRequest.java View File

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

import lombok.Data;

/**
* 飞行数据请求参数
*
* @author wanjing
* @team tuoheng
* @date 2023-08-11
*/
@Data
public class TZHLFlyDataRequest {

/**
* 飞行记录编号
*/
private Long recordId;

/**
* 组织编号
*/
private String deptId;

/**
* 查询时间(第一次查询时,该字段为空。之后每次查询可带上上一次查询返回的最后一条数据的createTime,即可查询增量的飞行数据。若该字段为空则默认查全量飞行数据)
*/
private String createTime;

}

+ 25
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/request/TZHLFlyLogRequest.java View File

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

import lombok.Data;

/**
* 飞行日志请求参数
*
* @author wanjing
* @team tuoheng
* @date 2023-08-11
*/
@Data
public class TZHLFlyLogRequest {

/**
* 飞行记录编号
*/
private Long recordId;

/**
* 查询时间(第一次查询时,该字段为空。之后每次查询可带上上一次查询返回的最后一条数据的createTime,即可查询增量的飞行日志。若该字段为空则默认查全量飞行日志)
*/
private String createTime;

}

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

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

import lombok.Data;

/**
* 飞行数据返回参数
*
* @author wanjing
* @team tuoheng
* @date 2023-08-11
*/
@Data
public class TZHLFlyDataResponse {

/**
* 主键id
*/
private Long id;

/**
* 飞行记录编号
*/
private Long recordId;



}

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

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

import lombok.Data;

/**
* 飞行日志返回参数
*
* @author wanjing
* @team tuoheng
* @date 2023-08-11
*/
@Data
public class TZHLFlyLogResponse {

/**
* 主键id
*/
private Long id;

/**
* 飞行记录编号
*/
private Long recordId;

/**
* 状态(success、error、normal)
*/
private String status;

/**
* 标题
*/
private String title;

/**
* 内容
*/
private String content;

}

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

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

import lombok.Data;

/**
* 飞行画面返回参数
*
* @author wanjing
* @team tuoheng
* @date 2023-08-11
*/
@Data
public class TZHLOnlineUavResponse {

/**
* 无人机编号
*/
private Long uavId;

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

/**
* 飞行记录编号
*/
private Long recordId;

/**
* 组织编号
*/
private Long deptId;

/**
* 组织名称
*/
private String deptName;

/**
* 播放地址
*/
private String playUrl;

}

+ 90
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/CallTianYiPlatformService.java View File

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

import com.alibaba.fastjson.JSONObject;
import com.tuoheng.admin.tzhl.config.TZHLConfig;
import com.tuoheng.admin.tzhl.response.TZHLTokenResponse;
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.beans.factory.annotation.Qualifier;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;

@Slf4j
@Service
public class CallTianYiPlatformService {

@Autowired
@Qualifier("restTemplate")
private RestTemplate restTemplate;

@Autowired
private TZHLGetTokenService tzhlGetTokenService;

public String callGet(String apiPath, HttpEntity<Object> httpEntity) {
String token = tzhlGetTokenService.getToken();
if (StringUtils.isEmpty(token)) {
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "token不能为空");
}

String url = CommonConfig.tianYiUrl + apiPath;
String properties = "Bearer " + token;
HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", properties);

ResponseEntity<JsonResult> response;
try {
response = restTemplate.exchange(url, HttpMethod.GET, httpEntity, JsonResult.class);
} catch (RestClientException e) {
log.info("请求获取机场url:{}", url);
log.info("请求获取机场列表, httpEntity:{}", httpEntity);
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "token不能为空");
}

if (null == response || !response.hasBody()) {
log.error("请求获取机场,response为空");
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "token不能为空");
}
if (response.getBody().getCode() != 200) {
log.error("请求获取机场列表" + response.getBody());
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "token不能为空");
}
log.info("查询机场列表数据成功,response={}", response);

return JSONObject.toJSONString(response.getBody().getData());
}

public String callPost(String apiPath, HttpEntity<Object> httpEntity) {
// 获取同行令牌token
String token = tzhlGetTokenService.getToken();
if (StringUtils.isEmpty(token)) {
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "token不能为空");
}
String properties = "Bearer " + token;
HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", properties);

String url = TZHLConfig.tzhlURL + apiPath;
ResponseEntity<TZHLTokenResponse> response;
try {
response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, TZHLTokenResponse.class);
} catch (Exception e) {
log.info("泰州海陵区城管,接口异常, url:{}", url);
log.info("泰州海陵区城管,接口异常, httpEntity:{}", httpEntity);
throw new ServiceException("泰州海陵区城管,获取token接口异常");
}
if (null == response || !response.hasBody()) {
log.info("泰州海陵区城管,接口失败,response为空");
log.info("泰州海陵区城管,接口失败, url:{}", url);
log.info("泰州海陵区城管,接口失败, httpEntity:{}", httpEntity);
throw new ServiceException("南京海事局,接口失败");
}
return JSONObject.toJSONString(response.getBody());
}
}

+ 56
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/fly/data/FlyDataService.java View File

@@ -0,0 +1,56 @@
package com.tuoheng.admin.tzhl.service.fly.data;

import com.alibaba.fastjson.JSON;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.tzhl.constant.TZHLConstant;
import com.tuoheng.admin.tzhl.request.TZHLFlyDataRequest;
import com.tuoheng.admin.tzhl.response.TZHLFlyDataResponse;
import com.tuoheng.admin.tzhl.response.TZHLFlyLogResponse;
import com.tuoheng.admin.tzhl.service.CallTianYiPlatformService;
import com.tuoheng.common.core.utils.RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

@Slf4j
@Service
public class FlyDataService {

@Autowired
private RedisUtils redisUtils;

@Autowired
@Qualifier("restTemplate")
private RestTemplate restTemplate;

@Autowired
private CallTianYiPlatformService callTianYiPlatformService;

public void getFlyData(Inspection inspection) {
String apiPath = TZHLConstant.TIAN_YI_API_FLIGHT_DATA;

TZHLFlyDataRequest request = new TZHLFlyDataRequest();
request.setRecordId(null);
request.setDeptId("");
request.setCreateTime(null);

HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity httpEntity = new HttpEntity(request, headers);


String dataJson = callTianYiPlatformService.callGet(apiPath, httpEntity);

TZHLFlyLogResponse flyDataResponse = JSON.parseObject(dataJson, TZHLFlyLogResponse.class);

// TODO

}


}

+ 55
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/fly/log/FlyLogService.java View File

@@ -0,0 +1,55 @@
package com.tuoheng.admin.tzhl.service.fly.log;

import com.alibaba.fastjson.JSON;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.tzhl.constant.TZHLConstant;
import com.tuoheng.admin.tzhl.request.TZHLFlyDataRequest;
import com.tuoheng.admin.tzhl.response.TZHLFlyDataResponse;
import com.tuoheng.admin.tzhl.response.TZHLFlyLogResponse;
import com.tuoheng.admin.tzhl.service.CallTianYiPlatformService;
import com.tuoheng.common.core.utils.RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

@Slf4j
@Service
public class FlyLogService {

@Autowired
private RedisUtils redisUtils;

@Autowired
@Qualifier("restTemplate")
private RestTemplate restTemplate;

@Autowired
private CallTianYiPlatformService callTianYiPlatformService;

public void getFlyLog(Inspection inspection) {
String apiPath = TZHLConstant.TIAN_YI_API_FLIGHT_LOG;

TZHLFlyDataRequest request = new TZHLFlyDataRequest();
request.setRecordId(null);
request.setDeptId("");
request.setCreateTime(null);

HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity httpEntity = new HttpEntity(request, headers);

String dataJson = callTianYiPlatformService.callGet(apiPath, httpEntity);

TZHLFlyLogResponse flyLogResponse = JSON.parseObject(dataJson, TZHLFlyLogResponse.class);



}


}

+ 50
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/fly/onlineuav/OnlineUavService.java View File

@@ -0,0 +1,50 @@
package com.tuoheng.admin.tzhl.service.fly.onlineuav;

import com.alibaba.fastjson.JSON;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.tzhl.constant.TZHLConstant;
import com.tuoheng.admin.tzhl.request.TZHLFlyDataRequest;
import com.tuoheng.admin.tzhl.response.TZHLFlyDataResponse;
import com.tuoheng.admin.tzhl.response.TZHLOnlineUavResponse;
import com.tuoheng.admin.tzhl.service.CallTianYiPlatformService;
import com.tuoheng.common.core.utils.RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

@Slf4j
@Service
public class OnlineUavService {

@Autowired
private RedisUtils redisUtils;

@Autowired
@Qualifier("restTemplate")
private RestTemplate restTemplate;

@Autowired
private CallTianYiPlatformService callTianYiPlatformService;

public void getOnlineUav(Inspection inspection) {
String apiPath = TZHLConstant.TIAN_YI_API_FLIGHT_SCREEN;

HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity httpEntity = new HttpEntity(null, headers);

String dataJson = callTianYiPlatformService.callGet(apiPath, httpEntity);

TZHLOnlineUavResponse onlineUavResponse = JSON.parseObject(dataJson, TZHLOnlineUavResponse.class);



}


}

+ 2
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/token/TZHLGetTokenService.java View File

@@ -58,7 +58,7 @@ public class TZHLGetTokenService {
log.info("泰州海陵区城管,获取token接口失败,response为空");
log.info("泰州海陵区城管,获取token接口失败, url:{}", url);
log.info("泰州海陵区城管,获取token接口失败, httpEntity:{}", httpEntity);
throw new ServiceException("南京海事局,获取token接口失败");
throw new ServiceException("泰州海陵区城管,获取token接口失败");
}
TZHLTokenResponse tokenResponse = JSONObject.parseObject(JSONObject.toJSONString(response.getBody()), TZHLTokenResponse.class);
log.info("TZHLConstant.RESPONSE_SUCCESS_CODE:{}", TZHLConstant.RESPONSE_SUCCESS_CODE);
@@ -66,7 +66,7 @@ public class TZHLGetTokenService {

if (!TZHLConstant.RESPONSE_SUCCESS_CODE.equals(tokenResponse.getCode())) {
log.error("泰州海陵区城管,获取token接口失败,{}", response.getBody());
throw new ServiceException("南京海事局,获取token接口失败");
throw new ServiceException("泰州海陵区城管,获取token接口失败");
}
return tokenResponse;
}

+ 65
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/task/FlyDataTask.java View File

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

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.enums.InspectionStatusEnum;
import com.tuoheng.admin.enums.InspectionTypeEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.service.third.airport.AirportService;
import com.tuoheng.admin.tzhl.service.fly.data.FlyDataService;
import com.tuoheng.common.core.utils.StringUtils;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
* 定时扫描,然后飞行
*/
@Component
@Slf4j
public class FlyDataTask {

@Autowired
private InspectionMapper inspectionMapper;

@Autowired
private FlyDataService flyDataService;

@XxlJob("telecomumaleFlyDataTaskHandler")
public void airportTaskHandler() {
// 查询当前时间正负1分钟的时间跨度,xxljob执行频率为1分钟1次
long start = new Date().getTime() - 1 * 60000L;
long end = new Date().getTime() + 1 * 60000L;
Date startTime = new Date(start);
Date endTime = new Date(end);

log.info("执行定时执行飞行任务:" + LocalDateTime.now());
List<Inspection> inspectionList = inspectionMapper.selectList(new LambdaQueryWrapper<Inspection>()
.eq(Inspection::getMark, MarkEnum.VALID.getCode())
.between(Inspection::getInspectionTime, startTime, endTime)
//查询巡检方式为机场的任务
.eq(Inspection::getInspectionType, InspectionTypeEnum.AIRPORT.getCode())
//查询未执行任务
.eq(Inspection::getExecutionStatus, 1)
//任务待飞行
.eq(Inspection::getStatus, InspectionStatusEnum.WAIT_FLIGHT.getCode()));
log.info("执行定时执行飞行任务:机场任务数" + inspectionList.size());
if (StringUtils.isEmpty(inspectionList)) {
return;
}
for (Inspection inspection : inspectionList) {
log.info("执行定时,获取飞行数据: inspectionId:{}", inspection.getId());

flyDataService.getFlyData(inspection);

log.info("执行定时,获取飞行数据结束: inspectionId:{}");
}
}

}

+ 66
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/task/FlyLogTask.java View File

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

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.enums.InspectionStatusEnum;
import com.tuoheng.admin.enums.InspectionTypeEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.service.third.airport.AirportService;
import com.tuoheng.admin.tzhl.service.fly.data.FlyDataService;
import com.tuoheng.admin.tzhl.service.fly.log.FlyLogService;
import com.tuoheng.common.core.utils.StringUtils;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
* 定时扫描,然后飞行
*/
@Component
@Slf4j
public class FlyLogTask {

@Autowired
private InspectionMapper inspectionMapper;

@Autowired
private FlyLogService flyLogService;

@XxlJob("telecomumaleFlyLogTaskHandler")
public void airportTaskHandler() {
// 查询当前时间正负1分钟的时间跨度,xxljob执行频率为1分钟1次
long start = new Date().getTime() - 1 * 60000L;
long end = new Date().getTime() + 1 * 60000L;
Date startTime = new Date(start);
Date endTime = new Date(end);

log.info("执行定时执行飞行任务:" + LocalDateTime.now());
List<Inspection> inspectionList = inspectionMapper.selectList(new LambdaQueryWrapper<Inspection>()
.eq(Inspection::getMark, MarkEnum.VALID.getCode())
.between(Inspection::getInspectionTime, startTime, endTime)
//查询巡检方式为机场的任务
.eq(Inspection::getInspectionType, InspectionTypeEnum.AIRPORT.getCode())
//查询未执行任务
.eq(Inspection::getExecutionStatus, 1)
//任务待飞行
.eq(Inspection::getStatus, InspectionStatusEnum.WAIT_FLIGHT.getCode()));
log.info("执行定时执行飞行任务:机场任务数" + inspectionList.size());
if (StringUtils.isEmpty(inspectionList)) {
return;
}
for (Inspection inspection : inspectionList) {
log.info("执行定时,获取飞行日志: inspectionId:{}", inspection.getId());

flyLogService.getFlyLog(inspection);

log.info("执行定时,获取飞行日志结束: inspectionId:{}");
}
}

}

+ 65
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/task/OnlineUavTask.java View File

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

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.enums.InspectionStatusEnum;
import com.tuoheng.admin.enums.InspectionTypeEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.service.third.airport.AirportService;
import com.tuoheng.admin.tzhl.service.fly.onlineuav.OnlineUavService;
import com.tuoheng.common.core.utils.StringUtils;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
* 定时扫描,然后飞行
*/
@Component
@Slf4j
public class OnlineUavTask {

@Autowired
private InspectionMapper inspectionMapper;

@Autowired
private OnlineUavService onlineUavService;

@XxlJob("telecomumaleOnlineUavTaskHandler")
public void airportTaskHandler() {
// 查询当前时间正负1分钟的时间跨度,xxljob执行频率为1分钟1次
long start = new Date().getTime() - 1 * 60000L;
long end = new Date().getTime() + 1 * 60000L;
Date startTime = new Date(start);
Date endTime = new Date(end);

log.info("执行定时执行飞行任务:" + LocalDateTime.now());
List<Inspection> inspectionList = inspectionMapper.selectList(new LambdaQueryWrapper<Inspection>()
.eq(Inspection::getMark, MarkEnum.VALID.getCode())
.between(Inspection::getInspectionTime, startTime, endTime)
//查询巡检方式为机场的任务
.eq(Inspection::getInspectionType, InspectionTypeEnum.AIRPORT.getCode())
//查询未执行任务
.eq(Inspection::getExecutionStatus, 1)
//任务待飞行
.eq(Inspection::getStatus, InspectionStatusEnum.WAIT_FLIGHT.getCode()));
log.info("执行定时执行飞行任务:机场任务数" + inspectionList.size());
if (StringUtils.isEmpty(inspectionList)) {
return;
}
for (Inspection inspection : inspectionList) {
log.info("执行定时,获取飞行画面: inspectionId:{}", inspection.getId());

onlineUavService.getOnlineUav(inspection);

log.info("执行定时,获取飞行画面: inspectionId:{}");
}
}

}

Loading…
Cancel
Save