From 2db1aa88e8ab53096a936163d686b90d8e056a99 Mon Sep 17 00:00:00 2001
From: rain <167982779@qq.com>
Date: Wed, 21 Aug 2024 23:18:33 +0800
Subject: [PATCH] 国土对接返回信息加密
---
src/main/java/com/dji/sample/wayline/service/impl/WaylineJobServiceImpl.java | 694 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 635 insertions(+), 59 deletions(-)
diff --git a/src/main/java/com/dji/sample/wayline/service/impl/WaylineJobServiceImpl.java b/src/main/java/com/dji/sample/wayline/service/impl/WaylineJobServiceImpl.java
index 9d07192..12e77fe 100644
--- a/src/main/java/com/dji/sample/wayline/service/impl/WaylineJobServiceImpl.java
+++ b/src/main/java/com/dji/sample/wayline/service/impl/WaylineJobServiceImpl.java
@@ -1,22 +1,36 @@
package com.dji.sample.wayline.service.impl;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
+import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dji.sample.common.error.CommonErrorEnum;
import com.dji.sample.common.model.CustomClaim;
import com.dji.sample.common.model.Pagination;
import com.dji.sample.common.model.PaginationData;
import com.dji.sample.common.model.ResponseResult;
+import com.dji.sample.common.util.MinioUrlUtils;
import com.dji.sample.component.mqtt.model.*;
import com.dji.sample.component.mqtt.service.IMessageSenderService;
import com.dji.sample.component.redis.RedisConst;
import com.dji.sample.component.redis.RedisOpsUtils;
-import com.dji.sample.control.model.param.DrcModeParam;
+import com.dji.sample.control.model.dto.PointDTO;
+import com.dji.sample.control.model.param.*;
+import com.dji.sample.control.service.IControlService;
import com.dji.sample.control.service.IDrcService;
+import com.dji.sample.geo.entity.GeoJson;
+import com.dji.sample.log.dao.IDroneFlightLogMapper;
+import com.dji.sample.log.model.entity.DroneFlightLogEntity;
import com.dji.sample.manage.model.dto.DeviceDTO;
import com.dji.sample.manage.model.enums.DeviceModeCodeEnum;
import com.dji.sample.manage.model.enums.DockModeCodeEnum;
+import com.dji.sample.manage.model.enums.DroneRcLostActionEnum;
+import com.dji.sample.manage.model.enums.WaylineRcLostActionEnum;
import com.dji.sample.manage.model.receiver.OsdDockReceiver;
import com.dji.sample.manage.model.receiver.OsdSubDeviceReceiver;
import com.dji.sample.manage.service.IDeviceRedisService;
@@ -24,15 +38,18 @@
import com.dji.sample.media.model.MediaFileCountDTO;
import com.dji.sample.media.model.MediaMethodEnum;
import com.dji.sample.media.service.IFileService;
+import com.dji.sample.geo.utils.GeoUtils;
import com.dji.sample.wayline.dao.IWaylineJobMapper;
import com.dji.sample.wayline.model.dto.*;
+import com.dji.sample.wayline.model.entity.WaylineJobBreakPointEntity;
import com.dji.sample.wayline.model.entity.WaylineJobEntity;
import com.dji.sample.wayline.model.enums.*;
-import com.dji.sample.wayline.model.param.CreateJobParam;
-import com.dji.sample.wayline.model.param.UpdateJobParam;
+import com.dji.sample.wayline.model.param.*;
import com.dji.sample.wayline.service.IWaylineFileService;
+import com.dji.sample.wayline.service.IWaylineJobBreakPointService;
import com.dji.sample.wayline.service.IWaylineJobService;
import com.dji.sample.wayline.service.IWaylineRedisService;
+import com.dji.sample.wayline.util.ErrorCodeUtil;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
@@ -50,7 +67,11 @@
import java.sql.SQLException;
import java.time.*;
import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
+
+import static com.dji.sample.component.mqtt.model.TopicConst.*;
+import static com.dji.sample.component.mqtt.model.TopicConst._REPLY_SUF;
/**
* @author sean
@@ -89,6 +110,15 @@
@Autowired
private IWaylineRedisService waylineRedisService;
+ @Autowired
+ private IControlService controlService;
+
+ @Autowired
+ private IDroneFlightLogMapper flightLogMapper;
+
+ @Autowired
+ private IWaylineJobBreakPointService waylineJobBreakPointService;
+
private Optional<WaylineJobDTO> insertWaylineJob(WaylineJobEntity jobEntity) {
int id = mapper.insert(jobEntity);
if (id <= 0) {
@@ -101,6 +131,29 @@
public Optional<WaylineJobDTO> createWaylineJob(CreateJobParam param, String workspaceId, String username, Long beginTime, Long endTime) {
if (Objects.isNull(param)) {
return Optional.empty();
+ }
+ if (param.getJobId()!=null){
+ WaylineJobEntity jobEntity = WaylineJobEntity.builder()
+ .name(param.getName())
+ .dockSn(param.getDockSn())
+ .fileId(param.getFileId())
+ .username(username)
+ .workspaceId(workspaceId)
+ .jobId(param.getJobId())
+ .beginTime(beginTime)
+ .endTime(endTime)
+ .status(WaylineJobStatusEnum.PENDING.getVal())
+ .taskType(param.getTaskType().getVal())
+ .waylineType(param.getWaylineType().getVal())
+ .outOfControlAction(param.getOutOfControlAction())
+ .rthAltitude(param.getRthAltitude())
+ .rthMode(param.getRthMode())
+ .mediaCount(0)
+ .build();
+ if (StringUtils.hasText(param.getJobId())) {
+ jobEntity.setJobId(param.getJobId());
+ }
+ return insertWaylineJob(jobEntity);
}
// Immediate tasks, allocating time on the backend.
WaylineJobEntity jobEntity = WaylineJobEntity.builder()
@@ -117,9 +170,12 @@
.waylineType(param.getWaylineType().getVal())
.outOfControlAction(param.getOutOfControlAction())
.rthAltitude(param.getRthAltitude())
+ .rthMode(param.getRthMode())
.mediaCount(0)
.build();
-
+ if (StringUtils.hasText(param.getJobId())) {
+ jobEntity.setJobId(param.getJobId());
+ }
return insertWaylineJob(jobEntity);
}
@@ -139,26 +195,34 @@
return this.insertWaylineJob(jobEntity);
}
+ @Override
+ public String getWaylineId(String jobId){
+ WaylineJobEntity waylineJob=mapper.selectOne(new LambdaQueryWrapper<WaylineJobEntity>().select(WaylineJobEntity::getFileId).eq(WaylineJobEntity::getJobId,jobId));
+ return waylineJob.getFileId();
+ }
/**
- * For immediate tasks, the server time shall prevail.
+ * 对于即时任务,以服务器时间为准。
+ *
* @param param
*/
private void fillImmediateTime(CreateJobParam param) {
if (WaylineTaskTypeEnum.IMMEDIATE != param.getTaskType()) {
return;
}
- long now = System.currentTimeMillis() / 1000;
- param.setTaskDays(Collections.singletonList(now));
- param.setTaskPeriods(Collections.singletonList(Collections.singletonList(now)));
+ long now = System.currentTimeMillis() / 1000 - 10;
+// param.setTaskDays(Collections.singletonList(now));
+// param.setTaskPeriods(Collections.singletonList(Collections.singletonList(now)));
+ param.setTaskDays(List.of(now));
+ param.setTaskPeriods(List.of(List.of(now)));
}
@Override
public ResponseResult publishFlightTask(CreateJobParam param, CustomClaim customClaim) throws SQLException {
fillImmediateTime(param);
- param.getTaskDays().sort((a, b) -> (int) (a - b));
- param.getTaskPeriods().sort((a, b) -> (int) (a.get(0) - b.get(0)));
+// param.getTaskDays().sort((a, b) -> (int) (a - b));
+// param.getTaskPeriods().sort((a, b) -> (int) (a.get(0) - b.get(0)));
for (Long taskDay : param.getTaskDays()) {
LocalDate date = LocalDate.ofInstant(Instant.ofEpochSecond(taskDay), ZoneId.systemDefault());
for (List<Long> taskPeriod : param.getTaskPeriods()) {
@@ -168,22 +232,105 @@
LocalDateTime.of(date, LocalTime.ofInstant(Instant.ofEpochSecond(taskPeriod.get(1)), ZoneId.systemDefault()))
.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli() : beginTime;
if (WaylineTaskTypeEnum.IMMEDIATE != param.getTaskType() && endTime < System.currentTimeMillis()) {
- return ResponseResult.error("The task has expired.");
+ return ResponseResult.error("任务已过期");
}
Optional<WaylineJobDTO> waylineJobOpt = this.createWaylineJob(param, customClaim.getWorkspaceId(), customClaim.getUsername(), beginTime, endTime);
if (waylineJobOpt.isEmpty()) {
- return ResponseResult.error("Failed to create wayline job.");
+ throw new SQLException("任务创建失败");
}
-
WaylineJobDTO waylineJob = waylineJobOpt.get();
- if (WaylineTaskTypeEnum.IMMEDIATE == param.getTaskType()) {
- return this.publishOneFlightTask(waylineJob);
- }
-
// If it is a conditional task type, add conditions to the job parameters.
+ //如果是条件任务类型,需要在任务参数中添加条件。
addPreparedJob(waylineJob, param, beginTime, endTime);
+
+ ResponseResult response = this.publishOneFlightTask(waylineJob);
+ if (ResponseResult.CODE_SUCCESS != response.getCode()) {
+ return response;
+ }
}
}
+ return ResponseResult.success();
+ }
+
+ @Override
+ public ResponseResult publishFlightTaskCondition(CreateJobParam param, CustomClaim customClaim) throws SQLException {
+ //开始日期
+ LocalDate startDate = LocalDate.ofInstant(Instant.ofEpochSecond(param.getTaskDays().get(0)), ZoneId.systemDefault());
+ long start = LocalDateTime.of(startDate, LocalTime.ofInstant(Instant.ofEpochSecond(param.getExecuteStartTimeArr().get(0).get(0)), ZoneId.systemDefault()))
+ .atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
+
+ //结束日期
+ LocalDate endDate = LocalDate.ofInstant(Instant.ofEpochSecond(param.getTaskDays().get(1)), ZoneId.systemDefault());
+ long end = LocalDateTime.of(endDate, LocalTime.ofInstant(Instant.ofEpochSecond(param.getExecuteStartTimeArr().get(param.getExecuteStartTimeArr().size() - 1).get(0)), ZoneId.systemDefault()))
+ .atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
+
+ //保存数据
+ WaylineJobEntity waylineJobEntity = WaylineJobEntity.builder()
+ .jobId(UUID.randomUUID().toString())
+ .name(param.getName())
+ .dockSn(param.getDockSn())
+ .fileId(param.getFileId())
+ .username(customClaim.getUsername())
+ .workspaceId(customClaim.getWorkspaceId())
+
+ .beginTime(start)
+ .endTime(end)
+ .status(WaylineJobStatusEnum.PENDING.getVal())
+ .taskType(param.getTaskType().getVal())
+ .waylineType(param.getWaylineType().getVal())
+ .outOfControlAction(param.getOutOfControlAction())
+ .batteryCapacity(param.getMinBatteryCapacity())
+ .rthAltitude(param.getRthAltitude())
+ .mediaCount(0)
+ .repFreVal(param.getRepFreVal())
+ .repFreType(param.getRepFreType())
+ .repRuleType(param.getRepRuleType())
+ .repRuleVal(param.getRepRuleVal())
+ .executeTimeArr(param.getTaskPeriods())
+ .executeStartTimeArr(param.getExecuteStartTimeArr())
+ .build();
+
+ Optional<WaylineJobDTO> waylineJobOpt = insertWaylineJob(waylineJobEntity);
+
+ if (waylineJobOpt.isEmpty()) {
+ throw new SQLException("任务创建失败");
+ }
+
+ WaylineJobDTO waylineJob = waylineJobOpt.get();
+
+ //存一条记录,
+ List<Long> timeArr = param.getExecuteStartTimeArr().get(0);
+
+ LocalDate date = LocalDate.ofInstant(Instant.ofEpochSecond(timeArr.get(0)), ZoneId.systemDefault());
+ LocalDateTime beginTime = LocalDateTime.of(date, LocalTime.ofInstant(Instant.ofEpochSecond(timeArr.get(0)), ZoneId.systemDefault()));
+
+ LocalDateTime endTime = timeArr.size() > 1 && Objects.nonNull(timeArr.get(1)) ?
+ LocalDateTime.of(date, LocalTime.ofInstant(Instant.ofEpochSecond(timeArr.get(1)), ZoneId.systemDefault())) : beginTime;
+
+ if (WaylineTaskTypeEnum.IMMEDIATE != param.getTaskType() && endTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli() < System.currentTimeMillis()) {
+ return ResponseResult.error("任务已过期");
+ }
+ //条件任务
+ if (param.getTaskType() == WaylineTaskTypeEnum.CONDITION) {
+ //如果是条件任务类型,需要在任务参数中添加条件。
+ waylineJob.setConditions(
+ WaylineTaskConditionDTO.builder()
+ .executableConditions(Objects.nonNull(param.getMinStorageCapacity()) ? WaylineTaskExecutableConditionDTO.builder().storageCapacity(param.getMinStorageCapacity()).build() : null)
+ .readyConditions(WaylineTaskReadyConditionDTO.builder()
+ .batteryCapacity(param.getMinBatteryCapacity())
+ .beginTime(beginTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli())
+ .endTime(endTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli())
+ .build())
+ .build());
+ } else {
+ waylineJob.setBeginTime(beginTime);
+ }
+
+ ResponseResult response = this.publishOneFlightTask(waylineJob);
+ if (ResponseResult.CODE_SUCCESS != response.getCode()) {
+ return response;
+ }
+
return ResponseResult.success();
}
@@ -191,8 +338,7 @@
if (WaylineTaskTypeEnum.CONDITION == param.getTaskType()) {
waylineJob.setConditions(
WaylineTaskConditionDTO.builder()
- .executableConditions(Objects.nonNull(param.getMinStorageCapacity()) ?
- WaylineTaskExecutableConditionDTO.builder().storageCapacity(param.getMinStorageCapacity()).build() : null)
+ .executableConditions(Objects.nonNull(param.getMinStorageCapacity()) ? WaylineTaskExecutableConditionDTO.builder().storageCapacity(param.getMinStorageCapacity()).build() : null)
.readyConditions(WaylineTaskReadyConditionDTO.builder()
.batteryCapacity(param.getMinBatteryCapacity())
.beginTime(beginTime)
@@ -205,7 +351,7 @@
// value: {workspace_id}:{dock_sn}:{job_id}
boolean isAdd = waylineRedisService.addPreparedWaylineJob(waylineJob);
if (!isAdd) {
- throw new RuntimeException("Failed to create prepare job.");
+ throw new RuntimeException("创建任务失败。");
}
}
@@ -213,14 +359,15 @@
boolean isSuccess = this.prepareFlightTask(waylineJob);
if (!isSuccess) {
- return ResponseResult.error("Failed to prepare job.");
+ return ResponseResult.error("任务准备失败");
}
// Issue an immediate task execution command.
+ //发出立即任务执行命令
if (WaylineTaskTypeEnum.IMMEDIATE == waylineJob.getTaskType()) {
boolean isExecuted = executeFlightTask(waylineJob.getWorkspaceId(), waylineJob.getJobId());
if (!isExecuted) {
- return ResponseResult.error("Failed to execute job.");
+ return ResponseResult.error("当前状态不支持飞行,请检查是否已有正在执行的飞行任务!");
}
}
@@ -229,33 +376,44 @@
private Boolean prepareFlightTask(WaylineJobDTO waylineJob) throws SQLException {
- boolean isOnline = deviceRedisService.checkDeviceOnline(waylineJob.getDockSn());
+ /*boolean isOnline = deviceRedisService.checkDeviceOnline(waylineJob.getDockSn());
if (!isOnline) {
- throw new RuntimeException("Dock is offline.");
- }
+ throw new RuntimeException("设备离线。");
+ }*/
// get wayline file
Optional<WaylineFileDTO> waylineFile = waylineFileService.getWaylineByWaylineId(waylineJob.getWorkspaceId(), waylineJob.getFileId());
if (waylineFile.isEmpty()) {
- throw new SQLException("Wayline file doesn't exist.");
+ throw new SQLException("航线文件不存在。");
}
// get file url
+ //获取航线文件地址
URL url = waylineFileService.getObjectUrl(waylineJob.getWorkspaceId(), waylineFile.get().getWaylineId());
-
- WaylineTaskCreateDTO flightTask = WaylineTaskCreateDTO.builder()
- .flightId(waylineJob.getJobId())
+ WaylineTaskCreateDTO.WaylineTaskCreateDTOBuilder flightTaskBuilder = WaylineTaskCreateDTO.builder().flightId(waylineJob.getJobId())
.executeTime(waylineJob.getBeginTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli())
.taskType(waylineJob.getTaskType())
.waylineType(waylineJob.getWaylineType())
.rthAltitude(waylineJob.getRthAltitude())
+ .rthMode(waylineJob.getRthMode())
.outOfControlAction(waylineJob.getOutOfControlAction())
.file(WaylineTaskFileDTO.builder()
- .url(url.toString())
+ .url(MinioUrlUtils.getUrl(url))
.fingerprint(waylineFile.get().getSign())
- .build())
- .build();
+ .build());
+ WaylineJobBreakPointEntity entity = waylineJob.getWaylineJobBreakPointEntity();
+ if (null != entity) {
+ flightTaskBuilder.breakPoint(BreakPointJobDTO.builder()
+ .index(entity.getBpIndex())
+ .state(entity.getState())
+ .progress(entity.getProgress())
+ .waylineId(entity.getWaylineId())
+ .build());
+ }
+ WaylineTaskCreateDTO flightTask = flightTaskBuilder.build();
+
+ //当任务类型为条件时
if (WaylineTaskTypeEnum.CONDITION == waylineJob.getTaskType()) {
if (Objects.isNull(waylineJob.getConditions())) {
throw new IllegalArgumentException();
@@ -264,10 +422,12 @@
flightTask.setExecutableConditions(waylineJob.getConditions().getExecutableConditions());
}
+ //发布飞行指令
ServiceReply serviceReply = messageSender.publishServicesTopic(
waylineJob.getDockSn(), WaylineMethodEnum.FLIGHT_TASK_PREPARE.getMethod(), flightTask, waylineJob.getJobId());
if (ResponseResult.CODE_SUCCESS != serviceReply.getResult()) {
log.info("Prepare task ====> Error code: {}", serviceReply.getResult());
+ //飞行失败,更新数据库信息
this.updateJob(WaylineJobDTO.builder()
.workspaceId(waylineJob.getWorkspaceId())
.jobId(waylineJob.getJobId())
@@ -285,12 +445,12 @@
// get job
Optional<WaylineJobDTO> waylineJob = this.getJobByJobId(workspaceId, jobId);
if (waylineJob.isEmpty()) {
- throw new IllegalArgumentException("Job doesn't exist.");
+ throw new IllegalArgumentException("任务不存在");
}
boolean isOnline = deviceRedisService.checkDeviceOnline(waylineJob.get().getDockSn());
if (!isOnline) {
- throw new RuntimeException("Dock is offline.");
+ throw new RuntimeException("设备离线");
}
WaylineJobDTO job = waylineJob.get();
@@ -306,7 +466,7 @@
.status(WaylineJobStatusEnum.FAILED.getVal())
.completedTime(LocalDateTime.now())
.code(serviceReply.getResult()).build());
- // The conditional task fails and enters the blocking status.
+ // 条件任务失败,进入阻塞状态。
if (WaylineTaskTypeEnum.CONDITION == job.getTaskType()
&& WaylineErrorCodeEnum.find(serviceReply.getResult()).isBlock()) {
waylineRedisService.setBlockedWaylineJob(job.getDockSn(), jobId);
@@ -329,9 +489,9 @@
Set<String> waylineJobIds = waylineJobs.stream().map(WaylineJobDTO::getJobId).collect(Collectors.toSet());
// Check if the task status is correct.
- boolean isErr = !jobIds.removeAll(waylineJobIds) || !jobIds.isEmpty() ;
+ boolean isErr = !jobIds.removeAll(waylineJobIds) || !jobIds.isEmpty();
if (isErr) {
- throw new IllegalArgumentException("These tasks have an incorrect status and cannot be canceled. " + Arrays.toString(jobIds.toArray()));
+ throw new IllegalArgumentException("以下任务状态不正确,不能取消" + Arrays.toString(jobIds.toArray()));
}
// Group job id by dock sn.
@@ -345,14 +505,14 @@
public void publishCancelTask(String workspaceId, String dockSn, List<String> jobIds) {
boolean isOnline = deviceRedisService.checkDeviceOnline(dockSn);
if (!isOnline) {
- throw new RuntimeException("Dock is offline.");
+ throw new RuntimeException("设备离线");
}
ServiceReply serviceReply = messageSender.publishServicesTopic(
dockSn, WaylineMethodEnum.FLIGHT_TASK_CANCEL.getMethod(), Map.of(MapKeyConst.FLIGHT_IDS, jobIds));
if (ResponseResult.CODE_SUCCESS != serviceReply.getResult()) {
log.info("Cancel job ====> Error code: {}", serviceReply.getResult());
- throw new RuntimeException("Failed to cancel the wayline job of " + dockSn);
+ throw new RuntimeException("航路作业取消失败 " + dockSn);
}
for (String jobId : jobIds) {
@@ -368,10 +528,10 @@
public List<WaylineJobDTO> getJobsByConditions(String workspaceId, Collection<String> jobIds, WaylineJobStatusEnum status) {
return mapper.selectList(
- new LambdaQueryWrapper<WaylineJobEntity>()
- .eq(WaylineJobEntity::getWorkspaceId, workspaceId)
- .eq(Objects.nonNull(status), WaylineJobEntity::getStatus, status.getVal())
- .in(!CollectionUtils.isEmpty(jobIds), WaylineJobEntity::getJobId, jobIds))
+ new LambdaQueryWrapper<WaylineJobEntity>()
+ .eq(WaylineJobEntity::getWorkspaceId, workspaceId)
+ .eq(Objects.nonNull(status), WaylineJobEntity::getStatus, status.getVal())
+ .in(!CollectionUtils.isEmpty(jobIds), WaylineJobEntity::getJobId, jobIds))
.stream()
.map(this::entity2Dto)
.collect(Collectors.toList());
@@ -387,19 +547,45 @@
}
@Override
+ public Optional<WaylineJobDTO> getJobByJobId(String workspaceId, String jobId, Boolean isBreakPoint) {
+ WaylineJobEntity jobEntity = mapper.selectOne(
+ new LambdaQueryWrapper<WaylineJobEntity>()
+ .eq(WaylineJobEntity::getWorkspaceId, workspaceId)
+ .eq(WaylineJobEntity::getJobId, jobId));
+ WaylineJobDTO waylineJobDTO = entity2Dto(jobEntity);
+ if (isBreakPoint) {
+ QueryWrapper queryWrapper = new QueryWrapper();
+ queryWrapper.eq("job_id", jobId);
+ WaylineJobBreakPointEntity waylineJobBreakPointEntity = waylineJobBreakPointService.getOne(queryWrapper);
+ waylineJobDTO.setWaylineJobBreakPointEntity(waylineJobBreakPointEntity);
+ }
+
+ //设置当前时间为执行时间
+ waylineJobDTO.setBeginTime(LocalDateTime.now());
+ return Optional.ofNullable(waylineJobDTO);
+ }
+
+ @Override
public Boolean updateJob(WaylineJobDTO dto) {
+
+ try {
+ if (dto.getStatus() == 3) {
+ this.checkNextJob(dto);
+ }
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+
+
return mapper.update(this.dto2Entity(dto),
new LambdaUpdateWrapper<WaylineJobEntity>()
.eq(WaylineJobEntity::getJobId, dto.getJobId())) > 0;
}
@Override
- public PaginationData<WaylineJobDTO> getJobsByWorkspaceId(String workspaceId, long page, long pageSize) {
- Page<WaylineJobEntity> pageData = mapper.selectPage(
- new Page<WaylineJobEntity>(page, pageSize),
- new LambdaQueryWrapper<WaylineJobEntity>()
- .eq(WaylineJobEntity::getWorkspaceId, workspaceId)
- .orderByDesc(WaylineJobEntity::getId));
+ public PaginationData<WaylineJobDTO> getJobsByWorkspaceId(String workspaceId, long page, long pageSize, WaylineJobQueryParam waylineJobQueryParam) {
+ Page<WaylineJobEntity> pageData = mapper.getPage(new Page<WaylineJobEntity>(page, pageSize), waylineJobQueryParam, workspaceId);
+
List<WaylineJobDTO> records = pageData.getRecords()
.stream()
.map(this::entity2Dto)
@@ -408,12 +594,42 @@
return new PaginationData<WaylineJobDTO>(records, new Pagination(pageData));
}
+ @Override
+ public PaginationData<WaylineJobDTO> getJobsByWorkspaceIdNew(String workspaceId, long page, long pageSize, WaylineJobQueryParam waylineJobQueryParam, String order) {
+ Page<WaylineJobEntity> pageData = mapper.getPageNew(new Page<WaylineJobEntity>(page, pageSize), waylineJobQueryParam, workspaceId, order);
+
+ List<WaylineJobDTO> records = pageData.getRecords()
+ .stream()
+ .map(this::entity2Dto)
+ .collect(Collectors.toList());
+
+ // 是否需要断点续飞
+ records.forEach(wjd -> wjd.setBreakPoint(waylineJobBreakPointService.count(
+ new LambdaQueryWrapper<WaylineJobBreakPointEntity>().eq(WaylineJobBreakPointEntity::getJobId, wjd.getJobId())) > 0));
+
+
+ return new PaginationData<WaylineJobDTO>(records, new Pagination(pageData));
+ }
+
+ @Override
+ public List<WaylineJobDTO> getChildrenJobs(String workspaceId, WaylineJobQueryParam waylineJobQueryParam) {
+
+ List<WaylineJobEntity> list = mapper.getJobs(workspaceId, waylineJobQueryParam);
+ List<WaylineJobDTO> records = list
+ .stream()
+ .map(this::entity2Dto)
+ .collect(Collectors.toList());
+
+ return records;
+ }
+
@Override
@ServiceActivator(inputChannel = ChannelName.INBOUND_REQUESTS_FLIGHT_TASK_RESOURCE_GET, outputChannel = ChannelName.OUTBOUND)
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
public void flightTaskResourceGet(CommonTopicReceiver receiver, MessageHeaders headers) {
- Map<String, String> jobIdMap = objectMapper.convertValue(receiver.getData(), new TypeReference<Map<String, String>>() {});
+ Map<String, String> jobIdMap = objectMapper.convertValue(receiver.getData(), new TypeReference<Map<String, String>>() {
+ });
String jobId = jobIdMap.get(MapKeyConst.FLIGHT_ID);
CommonTopicResponse.CommonTopicResponseBuilder<RequestsReply> builder = CommonTopicResponse.<RequestsReply>builder()
@@ -451,7 +667,7 @@
url = waylineFileService.getObjectUrl(waylineJob.getWorkspaceId(), waylineFile.get().getWaylineId());
builder.data(RequestsReply.success(WaylineTaskCreateDTO.builder()
.file(WaylineTaskFileDTO.builder()
- .url(url.toString())
+ .url(MinioUrlUtils.getUrl(url))
.fingerprint(waylineFile.get().getSign())
.build())
.build()));
@@ -466,6 +682,89 @@
messageSender.publish(topic, builder.build());
}
+
+ /**
+ * 机场的获取离线地图协议请求回复
+ * @param receiver
+ */
+ @ServiceActivator(inputChannel = ChannelName.INBOUND_REQUESTS_OFFLINE_MAP_GET, outputChannel = ChannelName.OUTBOUND)
+ public void offlineMapGet(CommonTopicReceiver receiver) {
+ log.info("接收到机场的获取离线地图协议消息,编号:{}",receiver.getGateway());
+ // 查询在线设备,不存在就不发送了
+ Optional<DeviceDTO> deviceOpt = deviceRedisService.getDeviceOnline(receiver.getGateway());
+ if (deviceOpt.isEmpty()) {
+ return;
+ }
+ // 组装数据
+ CommonTopicResponse<Object> builder = CommonTopicResponse.builder()
+ .tid(receiver.getTid())
+ .bid(receiver.getBid())
+ .method(RequestsMethodEnum.OFFLINE_MAP_GET.getMethod())
+ .timestamp(System.currentTimeMillis())
+ .build();
+ // 组装 data 数据
+ Map<String, Integer> result = new ConcurrentHashMap<>(1);
+ result.put("result", 0);
+ builder.setData(result);
+ log.info("回复机场的获取离线地图协议消息:{},{}",BASIC_PRE + PRODUCT +receiver.getGateway() + REQUESTS_SUF + _REPLY_SUF, builder );
+ // 回复消息
+ messageSender.publish(
+ new StringBuilder()
+ .append(THING_MODEL_PRE)
+ .append(PRODUCT)
+ .append(receiver.getGateway())
+ .append(REQUESTS_SUF)
+ .append(_REPLY_SUF)
+ .toString(),
+ builder);
+ }
+
+ /**
+ * 自定义飞行区文件获取协议请求回复
+ * @param receiver
+ */
+ @ServiceActivator(inputChannel = ChannelName.INBOUND_REQUESTS_FLIGHT_AREAS_GET, outputChannel = ChannelName.OUTBOUND)
+ public void flightAreasGet(CommonTopicReceiver receiver) {
+ log.info("接收到自定义飞行区文件获取消息,编号:{}",receiver.getGateway());
+ // 查询在线设备,不存在就不发送了
+ Optional<DeviceDTO> deviceOpt = deviceRedisService.getDeviceOnline(receiver.getGateway());
+ if (deviceOpt.isEmpty()) {
+ return;
+ }
+ // 组装数据
+ CommonTopicResponse<Object> builder = CommonTopicResponse.builder()
+ .tid(receiver.getTid())
+ .bid(receiver.getBid())
+ .method(RequestsMethodEnum.FLIGHT_AREAS_GET.getMethod())
+ .timestamp(System.currentTimeMillis())
+ .build();
+ // 组装 data 数据
+ Map<String, Integer> result = new ConcurrentHashMap<>(1);
+ result.put("result", 0);
+ builder.setData(result);
+ log.info("回复自定义飞行区文件获取消息:{},{}",BASIC_PRE + PRODUCT +receiver.getGateway() + REQUESTS_SUF + _REPLY_SUF, builder );
+ // 回复消息
+ messageSender.publish(
+ new StringBuilder()
+ .append(THING_MODEL_PRE)
+ .append(PRODUCT)
+ .append(receiver.getGateway())
+ .append(REQUESTS_SUF)
+ .append(_REPLY_SUF)
+ .toString(),
+ builder);
+ }
+
+ @Override
+ public List<String> selectJobIdByName(String name) {
+ List<WaylineJobEntity> waylineJobs = mapper.selectList(new LambdaQueryWrapper<WaylineJobEntity>()
+ .select(WaylineJobEntity::getJobId)
+ .like(WaylineJobEntity::getName, name));
+ return waylineJobs.stream()
+ .map(WaylineJobEntity::getJobId)
+ .collect(Collectors.toList());
+ }
+
@Override
public void uploadMediaHighestPriority(String workspaceId, String jobId) {
@@ -483,7 +782,7 @@
ServiceReply reply = messageSender.publishServicesTopic(
dockSn, MediaMethodEnum.UPLOAD_FLIGHT_TASK_MEDIA_PRIORITIZE.getMethod(), Map.of(MapKeyConst.FLIGHT_ID, jobId));
if (ResponseResult.CODE_SUCCESS != reply.getResult()) {
- throw new RuntimeException("Failed to set media job upload priority. Error Code: " + reply.getResult());
+ throw new RuntimeException("设置媒体作业上传优先级失败. 错误码: " + reply.getResult());
}
}
@@ -525,12 +824,12 @@
public void updateJobStatus(String workspaceId, String jobId, UpdateJobParam param) {
Optional<WaylineJobDTO> waylineJobOpt = this.getJobByJobId(workspaceId, jobId);
if (waylineJobOpt.isEmpty()) {
- throw new RuntimeException("The job does not exist.");
+ throw new RuntimeException("任务不存在");
}
WaylineJobDTO waylineJob = waylineJobOpt.get();
WaylineJobStatusEnum statusEnum = this.getWaylineState(waylineJob.getDockSn());
if (statusEnum.getEnd() || WaylineJobStatusEnum.PENDING == statusEnum) {
- throw new RuntimeException("The wayline job status does not match, and the operation cannot be performed.");
+ throw new RuntimeException("航路线作业状态不匹配,无法执行操作.");
}
switch (param.getStatus()) {
@@ -542,6 +841,15 @@
break;
}
+ }
+
+ @Override
+ public List<String> getJobNamesByPartialName(String partialJobName) {
+ LambdaQueryWrapper<WaylineJobEntity> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.like(WaylineJobEntity::getName, partialJobName);
+ return mapper.selectList(queryWrapper).stream()
+ .map(WaylineJobEntity::getName)
+ .collect(Collectors.toList());
}
public WaylineJobStatusEnum getWaylineState(String dockSn) {
@@ -569,6 +877,271 @@
return WaylineJobStatusEnum.UNKNOWN;
}
+ @Override
+ public String getName(String jobId) {
+ WaylineJobEntity entity = mapper.selectOne(
+ new LambdaQueryWrapper<WaylineJobEntity>()
+ .select(WaylineJobEntity::getName)
+ .eq(WaylineJobEntity::getJobId, jobId)
+ );
+ return entity != null ? entity.getName() : null;
+ }
+
+ @Override
+ public List<String> getJobIds(String jobNames) {
+ List<String> names = getJobNamesByPartialName(jobNames);
+
+ // 如果 names 列表为空,直接返回空的 jobIdStringList
+ if (names.isEmpty()) {
+ return new ArrayList<>();
+ }
+
+ // 使用 LambdaQueryWrapper 进行查询
+ List<Object> jobIdList = mapper.selectObjs(
+ new LambdaQueryWrapper<WaylineJobEntity>()
+ .select(WaylineJobEntity::getJobId)
+ .in(WaylineJobEntity::getName, names) // 使用 IN 子句
+ );
+
+ // 将 Object 类型的 jobId 转换为 String 类型,并放入 List<String> 中
+ List<String> jobIdStringList = new ArrayList<>();
+ for (Object jobIdObj : jobIdList) {
+ jobIdStringList.add(String.valueOf(jobIdObj));
+ }
+ return jobIdStringList;
+ }
+
+
+ @Override
+ public WaylineJobEntity getLatestJob(String workspaceId, WaylineJobQueryParam waylineJobQueryParam) {
+ WaylineJobEntity waylineJobEntity = mapper.getLatest(workspaceId, waylineJobQueryParam);
+ return waylineJobEntity;
+ }
+
+ @Override
+ public ResponseResult flyByArea(String sn, FlyAreaParam flyAreaParam, String deviceSn) throws Exception {
+
+ //获取所有中心点
+// List<PointPOJO> targetList = GeoUtils.caculatePointList(flyAreaParam);
+ PointPOJO dockPoint = flyAreaParam.getDockPoint();
+ GeoJson geoJson = GeoUtils.readJsonFile(flyAreaParam.getJsonPath());
+ List<PointPOJO> targetList = GeoUtils.caculatePointList(geoJson, dockPoint, flyAreaParam.getRadius());
+
+ //一键起飞
+ TakeoffToPointParam takeoffToPointParam = buildTakeoffToPointParam(dockPoint);
+
+ ResponseResult takeoffToPointRes = controlService.takeoffToPoint(sn, takeoffToPointParam);
+
+ //设置飞向第一个点
+ while (takeoffToPointRes.getCode() == ResponseResult.CODE_SUCCESS) {
+ //获取无人机状态
+ DeviceModeCodeEnum deviceMode = deviceService.getDeviceMode(deviceSn);
+
+ //当无人机状态为手动飞行
+ if (deviceMode == DeviceModeCodeEnum.MANUAL) {
+ //飞向目标点
+ FlyToPointParam flyToPointParam = new FlyToPointParam();
+ flyToPointParam.setMaxSpeed(14);
+ List<PointDTO> pointDTOS = new ArrayList<>();
+
+ PointDTO pointDTO = new PointDTO();
+ pointDTO.setHeight(120.0);
+ pointDTO.setLongitude(targetList.get(0).getLon());
+ pointDTO.setLatitude(targetList.get(0).getLat());
+ pointDTOS.add(pointDTO);
+ flyToPointParam.setPoints(pointDTOS);
+
+
+ ResponseResult flyToRes = controlService.flyToPoint(sn, flyToPointParam);
+
+ if (flyToRes.getCode() == ResponseResult.CODE_SUCCESS) {
+ //第一个点指令飞行成功后,把数组存到redis中
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("targetList", targetList);
+ jsonObject.put("payloadIndex", flyAreaParam.getPayloadIndex());
+ jsonObject.put("curIndex", 0);
+ RedisOpsUtils.set("tuban:" + sn, jsonObject);
+ }
+ break;
+ }
+ }
+
+ return ResponseResult.success(targetList);
+ }
+
+ public TakeoffToPointParam buildTakeoffToPointParam(PointPOJO dockPoint) {
+ TakeoffToPointParam takeoffToPointParam = new TakeoffToPointParam();
+
+ takeoffToPointParam.setTargetLatitude(dockPoint.getLat());
+ takeoffToPointParam.setTargetLongitude(dockPoint.getLon());
+ //设置飞行高度
+ takeoffToPointParam.setTargetHeight(120.0);
+ //设置安全起飞高度
+ takeoffToPointParam.setSecurityTakeoffHeight(100.0);
+ //设置返航高度
+ takeoffToPointParam.setRthAltitude(100.0);
+ //设置失控操作
+ takeoffToPointParam.setRcLostAction(DroneRcLostActionEnum.RETURN_HOME);
+ //设置起飞速度
+ takeoffToPointParam.setMaxSpeed(10.0);
+ takeoffToPointParam.setExitWaylineWhenRcLost(WaylineRcLostActionEnum.EXECUTE_RC_LOST_ACTION);
+
+ return takeoffToPointParam;
+ }
+
+
+ @Override
+ public ResponseResult checkNextJob(WaylineJobDTO job) throws SQLException {
+
+ WaylineJobEntity params = new WaylineJobEntity();
+ params.setJobId(job.getJobId());
+
+
+ WaylineJobEntity job1 = mapper.selectOne(Wrappers.query(params));
+
+ WaylineJobEntity currentJob = JSON.parseObject(JSON.toJSONString(job1), WaylineJobEntity.class);
+
+ if (currentJob == null) {
+ return ResponseResult.error("该任务不存在");
+ }
+
+ //该任务没有多次时间
+ if (currentJob.getExecuteStartTimeArr() == null) {
+ return ResponseResult.success();
+ }
+
+ List<List<Long>> executeStartTimeArr = currentJob.getExecuteStartTimeArr();
+ int indexTime = -1;
+
+ long currentTime = System.currentTimeMillis();
+ for (int i = 0; i < executeStartTimeArr.size(); i++) {
+ Long startTime = executeStartTimeArr.get(i).get(0) * 1000;
+ //如果当前时间小于开始时间
+ if (currentTime < startTime) {
+ //当前索引就是下一次要执行的时间
+ indexTime = i;
+ break;
+ }
+ }
+
+ if (indexTime == -1) {
+ return ResponseResult.success();
+ }
+
+
+ List<Long> timeArr = currentJob.getExecuteStartTimeArr().get(indexTime);
+ LocalDate date = LocalDate.ofInstant(Instant.ofEpochSecond(timeArr.get(0)), ZoneId.systemDefault());
+ LocalDateTime beginDate = LocalDateTime.of(date, LocalTime.ofInstant(Instant.ofEpochSecond(timeArr.get(0)), ZoneId.systemDefault()));
+ LocalDateTime endDate = timeArr.size() > 1 && Objects.nonNull(timeArr.get(1)) ?
+ LocalDateTime.of(date, LocalTime.ofInstant(Instant.ofEpochSecond(timeArr.get(1)), ZoneId.systemDefault()))
+ : beginDate;
+
+ long beginTime = beginDate
+ .atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
+ long endTime = endDate
+ .atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
+
+
+ //添加一条新数据
+ WaylineJobEntity waylineJobEntity = WaylineJobEntity.builder()
+ .jobId(UUID.randomUUID().toString())
+ //大于1则拿前面的parentId,为1则拿第0个的id
+ .parentId(indexTime > 1 ? currentJob.getParentId().toString() : currentJob.getId().toString())
+ .name(currentJob.getName())
+ .dockSn(currentJob.getDockSn())
+ .fileId(currentJob.getFileId())
+ .username(currentJob.getUsername())
+ .workspaceId(currentJob.getWorkspaceId())
+
+ .beginTime(beginTime)
+ .endTime(endTime)
+ .status(WaylineJobStatusEnum.PENDING.getVal())
+ .taskType(currentJob.getTaskType())
+ .waylineType(currentJob.getWaylineType())
+ .outOfControlAction(currentJob.getOutOfControlAction())
+ .batteryCapacity(currentJob.getBatteryCapacity())
+ .rthAltitude(currentJob.getRthAltitude())
+ .mediaCount(0)
+ .repFreVal(currentJob.getRepFreVal())
+ .repFreType(currentJob.getRepFreType())
+ .repRuleType(currentJob.getRepRuleType())
+ .repRuleVal(currentJob.getRepRuleVal())
+ .executeTimeArr(currentJob.getExecuteTimeArr())
+ .executeStartTimeArr(currentJob.getExecuteStartTimeArr())
+ .build();
+
+ Optional<WaylineJobDTO> waylineJobOpt = insertWaylineJob(waylineJobEntity);
+
+ if (waylineJobOpt.isEmpty()) {
+ return ResponseResult.error("任务创建失败");
+ }
+
+ WaylineJobDTO waylineJob = waylineJobOpt.get();
+
+ LocalDateTime beginTimeNext = LocalDateTime.of(date, LocalTime.ofInstant(Instant.ofEpochSecond(timeArr.get(0)), ZoneId.systemDefault()));
+
+ LocalDateTime endTimeNext = timeArr.size() > 1 && Objects.nonNull(timeArr.get(1)) ?
+ LocalDateTime.of(date, LocalTime.ofInstant(Instant.ofEpochSecond(timeArr.get(1)), ZoneId.systemDefault())) : beginTimeNext;
+
+
+ //条件任务
+ if (currentJob.getTaskType() == 2) {
+ //如果是条件任务类型,需要在任务参数中添加条件。
+ waylineJob.setConditions(
+ WaylineTaskConditionDTO.builder()
+ .executableConditions(null)
+ .readyConditions(WaylineTaskReadyConditionDTO.builder()
+ .batteryCapacity(currentJob.getBatteryCapacity())
+ .beginTime(beginTime)
+ .endTime(endTime)
+ .build())
+ .build());
+ } else {
+ waylineJob.setBeginTime(beginDate);
+ }
+
+ ResponseResult response = this.publishOneFlightTask(waylineJob);
+ if (ResponseResult.CODE_SUCCESS != response.getCode()) {
+ return response;
+ }
+
+ return ResponseResult.success();
+ }
+
+
+ @Override
+ public WaylineJobCountDTO patrolStatistics(String workspaceId, String queryTime, String deviceSn) {
+ WaylineJobCountDTO waylineJobCountDTO = new WaylineJobCountDTO();
+ List<DroneFlightLogEntity> list = flightLogMapper.patrolStatistics(workspaceId, queryTime, deviceSn);
+ if (!CollectionUtils.isEmpty(list)) {
+ waylineJobCountDTO.setTotalNumber(list.size());
+ long totalTime = list.stream().filter(task -> task.getEndTime() != null && task.getStartTime() != null).mapToLong(s -> s.getEndTime() - s.getStartTime()).sum() / 1000;
+ long h = totalTime / 3600;
+ long m = (totalTime % 3600) / 60;
+ waylineJobCountDTO.setTotalDuration(String.format("%02d h %02d min", h, m));
+ List<String> deviceSns = list.stream().map(DroneFlightLogEntity::getDeviceSn).distinct().collect(Collectors.toList());
+ double sum = 0.0;
+ for (String sn : deviceSns) {
+ Double totalFlightDistance = new LambdaQueryChainWrapper<>(flightLogMapper)
+ .eq(DroneFlightLogEntity::getDeviceSn, sn).orderByDesc(DroneFlightLogEntity::getEndTime).last("limit 1").one().getTotalFlightDistance();
+ if (totalFlightDistance != null) {
+ sum += totalFlightDistance;
+ }
+ }
+ waylineJobCountDTO.setTotalDistance((int) sum);
+ }
+ return waylineJobCountDTO;
+ }
+
+ @Override
+ public void updateJobCollect(WaylineJobEntity waylineJob) {
+ new LambdaUpdateChainWrapper<>(mapper)
+ .eq(WaylineJobEntity::getJobId, waylineJob.getJobId())
+ .set(WaylineJobEntity::getCollectStatus, waylineJob.getCollectStatus())
+ .set(WaylineJobEntity::getUserId, waylineJob.getUserId())
+ .update();
+ }
+
private void pauseJob(String workspaceId, String dockSn, String jobId, WaylineJobStatusEnum statusEnum) {
if (WaylineJobStatusEnum.PAUSED == statusEnum && jobId.equals(waylineRedisService.getPausedWaylineJobId(dockSn))) {
waylineRedisService.setPausedWaylineJob(dockSn, jobId);
@@ -578,7 +1151,7 @@
ServiceReply reply = messageSender.publishServicesTopic(
dockSn, WaylineMethodEnum.FLIGHT_TASK_PAUSE.getMethod(), "", jobId);
if (ResponseResult.CODE_SUCCESS != reply.getResult()) {
- throw new RuntimeException("Failed to pause wayline job. Error Code: " + reply.getResult());
+ throw new RuntimeException("未能恢复航路作业。错误码: " + reply.getResult());
}
waylineRedisService.delRunningWaylineJob(dockSn);
waylineRedisService.setPausedWaylineJob(dockSn, jobId);
@@ -593,7 +1166,7 @@
ServiceReply reply = messageSender.publishServicesTopic(
dockSn, WaylineMethodEnum.FLIGHT_TASK_RESUME.getMethod(), "", jobId);
if (ResponseResult.CODE_SUCCESS != reply.getResult()) {
- throw new RuntimeException("Failed to resume wayline job. Error Code: " + reply.getResult());
+ throw new RuntimeException("未能恢复航路作业。错误码:: " + reply.getResult());
}
runningDataOpt.ifPresent(runningData -> waylineRedisService.setRunningWaylineJob(dockSn, runningData));
@@ -613,6 +1186,7 @@
WaylineJobDTO.WaylineJobDTOBuilder builder = WaylineJobDTO.builder()
.jobId(entity.getJobId())
+ .reason(ErrorCodeUtil.codeToReason(entity.getErrorCode()))
.jobName(entity.getName())
.fileId(entity.getFileId())
.fileName(waylineFileService.getWaylineByWaylineId(entity.getWorkspaceId(), entity.getFileId())
@@ -624,7 +1198,7 @@
.workspaceId(entity.getWorkspaceId())
.status(WaylineJobStatusEnum.IN_PROGRESS.getVal() == entity.getStatus() &&
entity.getJobId().equals(waylineRedisService.getPausedWaylineJobId(entity.getDockSn())) ?
- WaylineJobStatusEnum.PAUSED.getVal() : entity.getStatus())
+ WaylineJobStatusEnum.PAUSED.getVal() : entity.getStatus())
.code(entity.getErrorCode())
.beginTime(LocalDateTime.ofInstant(Instant.ofEpochMilli(entity.getBeginTime()), ZoneId.systemDefault()))
.endTime(Objects.nonNull(entity.getEndTime()) ?
@@ -636,8 +1210,10 @@
.taskType(WaylineTaskTypeEnum.find(entity.getTaskType()))
.waylineType(WaylineTemplateTypeEnum.find(entity.getWaylineType()))
.rthAltitude(entity.getRthAltitude())
+ .rthMode(entity.getRthMode())
.outOfControlAction(entity.getOutOfControlAction())
- .mediaCount(entity.getMediaCount());
+ .mediaCount(entity.getMediaCount())
+ .hasChildren(entity.getHasChildren());
if (Objects.nonNull(entity.getEndTime())) {
builder.endTime(LocalDateTime.ofInstant(Instant.ofEpochMilli(entity.getEndTime()), ZoneId.systemDefault()));
@@ -660,7 +1236,7 @@
Object mediaFileCount = RedisOpsUtils.hashGet(countKey, entity.getJobId());
if (Objects.nonNull(mediaFileCount)) {
builder.uploadedCount(((MediaFileCountDTO) mediaFileCount).getUploadedCount())
- .uploading(RedisOpsUtils.checkExist(key) && entity.getJobId().equals(((MediaFileCountDTO)RedisOpsUtils.get(key)).getJobId()));
+ .uploading(RedisOpsUtils.checkExist(key) && entity.getJobId().equals(((MediaFileCountDTO) RedisOpsUtils.get(key)).getJobId()));
return builder.build();
}
--
Gitblit v1.9.3