|
@@ -19,7 +19,9 @@ import com.dji.sample.media.dao.IFileSumMapper;
|
|
|
import com.dji.sample.media.model.*;
|
|
import com.dji.sample.media.model.*;
|
|
|
import com.dji.sample.media.service.IFileService;
|
|
import com.dji.sample.media.service.IFileService;
|
|
|
import com.dji.sample.media.service.IMediaDirService;
|
|
import com.dji.sample.media.service.IMediaDirService;
|
|
|
|
|
+import com.dji.sample.wayline.model.dto.WaylineJobDTO;
|
|
|
import com.dji.sample.wayline.service.IWaylineFileService;
|
|
import com.dji.sample.wayline.service.IWaylineFileService;
|
|
|
|
|
+import com.dji.sample.wayline.service.IWaylineJobService;
|
|
|
import com.dji.sdk.cloudapi.device.DeviceEnum;
|
|
import com.dji.sdk.cloudapi.device.DeviceEnum;
|
|
|
import com.dji.sdk.cloudapi.map.*;
|
|
import com.dji.sdk.cloudapi.map.*;
|
|
|
import com.dji.sdk.cloudapi.media.MediaSubFileTypeEnum;
|
|
import com.dji.sdk.cloudapi.media.MediaSubFileTypeEnum;
|
|
@@ -78,6 +80,9 @@ public class FileServiceImpl implements IFileService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IWaylineFileService waylineFileService;
|
|
private IWaylineFileService waylineFileService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IWaylineJobService waylineJobService;
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IGroupElementService groupElementService;
|
|
private IGroupElementService groupElementService;
|
|
|
|
|
|
|
@@ -264,11 +269,16 @@ public class FileServiceImpl implements IFileService {
|
|
|
wrapper -> wrapper.like( MediaFileEntity::getFileName, param.getSearchInfo())
|
|
wrapper -> wrapper.like( MediaFileEntity::getFileName, param.getSearchInfo())
|
|
|
.or().like( MediaFileEntity::getPayload, param.getSearchInfo())
|
|
.or().like( MediaFileEntity::getPayload, param.getSearchInfo())
|
|
|
).and(MediaTypeEnum.PIC_ORIGIN.getVal() == param.getMediaType(),
|
|
).and(MediaTypeEnum.PIC_ORIGIN.getVal() == param.getMediaType(),
|
|
|
- wrapper -> wrapper.like( MediaFileEntity::getMediaType, IMAGE)
|
|
|
|
|
- .eq( MediaFileEntity::getIsOriginal, true)
|
|
|
|
|
|
|
+ wrapper -> wrapper.eq( MediaFileEntity::getPictureType, JPEG)
|
|
|
|
|
+ .eq(MediaFileEntity::getIsOriginal, true)
|
|
|
|
|
+ .eq(MediaFileEntity::getSubFileType, MediaSubFileTypeEnum.NORMAL.getType())
|
|
|
).and(MediaTypeEnum.PIC_SHOT.getVal() == param.getMediaType(),
|
|
).and(MediaTypeEnum.PIC_SHOT.getVal() == param.getMediaType(),
|
|
|
- wrapper -> wrapper.like( MediaFileEntity::getMediaType, IMAGE)
|
|
|
|
|
|
|
+ wrapper -> wrapper.eq( MediaFileEntity::getPictureType, JPEG)
|
|
|
.eq( MediaFileEntity::getIsOriginal, false)
|
|
.eq( MediaFileEntity::getIsOriginal, false)
|
|
|
|
|
+ .eq(MediaFileEntity::getSubFileType, MediaSubFileTypeEnum.NORMAL.getType())
|
|
|
|
|
+ ).and(MediaTypeEnum.PIC_PANORAMA.getVal() == param.getMediaType(),
|
|
|
|
|
+ wrapper -> wrapper.eq( MediaFileEntity::getPictureType, JPEG)
|
|
|
|
|
+ .eq(MediaFileEntity::getSubFileType, MediaSubFileTypeEnum.PANORAMA.getType())
|
|
|
).and(MediaTypeEnum.VIDEO.getVal() == param.getMediaType(),
|
|
).and(MediaTypeEnum.VIDEO.getVal() == param.getMediaType(),
|
|
|
wrapper -> wrapper.like( MediaFileEntity::getMediaType, VIDEO)
|
|
wrapper -> wrapper.like( MediaFileEntity::getMediaType, VIDEO)
|
|
|
).and(MediaTypeEnum.UNKNOWN.getVal() == param.getMediaType(),
|
|
).and(MediaTypeEnum.UNKNOWN.getVal() == param.getMediaType(),
|
|
@@ -360,7 +370,7 @@ public class FileServiceImpl implements IFileService {
|
|
|
*/
|
|
*/
|
|
|
private MediaFileEntity fileUploadConvertToEntity(String workspaceId, MediaUploadCallbackRequest file) {
|
|
private MediaFileEntity fileUploadConvertToEntity(String workspaceId, MediaUploadCallbackRequest file) {
|
|
|
//通过path 获取航线名称,文件夹名称
|
|
//通过path 获取航线名称,文件夹名称
|
|
|
- String waylineName = getWaylineName(file.getPath());
|
|
|
|
|
|
|
+ String waylineName = getWaylineName(workspaceId,file.getExt().getFileGroupId());
|
|
|
// String dirName = getDirName(waylineName, file.getPath());
|
|
// String dirName = getDirName(waylineName, file.getPath());
|
|
|
String dirName = file.getPath();
|
|
String dirName = file.getPath();
|
|
|
MediaDirDTO dirDto = null;
|
|
MediaDirDTO dirDto = null;
|
|
@@ -436,14 +446,24 @@ public class FileServiceImpl implements IFileService {
|
|
|
return "";
|
|
return "";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private String getWaylineName(String path) {
|
|
|
|
|
- if(StringUtils.hasText(path)) {
|
|
|
|
|
- String[] pathSplit = path.split("-");
|
|
|
|
|
- if(pathSplit.length > 1) {
|
|
|
|
|
- return pathSplit[pathSplit.length - 1];
|
|
|
|
|
|
|
+ private String getWaylineName(String workspaceId, String jobId) {
|
|
|
|
|
+ if(StringUtils.hasText(jobId)) {
|
|
|
|
|
+ Optional<WaylineJobDTO> wlJobOpt = waylineJobService.getJobByJobId(workspaceId,jobId);
|
|
|
|
|
+ if(wlJobOpt.isPresent()) {
|
|
|
|
|
+ Optional<GetWaylineListResponse> wlOpt = waylineFileService.getWaylineByWaylineId(workspaceId, wlJobOpt.get().getFileId());
|
|
|
|
|
+ if(wlOpt.isPresent()) {
|
|
|
|
|
+ return wlOpt.get().getName();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- return "";
|
|
|
|
|
|
|
+ return "N/A";
|
|
|
|
|
+// if(StringUtils.hasText(path)) {
|
|
|
|
|
+// String[] pathSplit = path.split("-");
|
|
|
|
|
+// if(pathSplit.length > 1) {
|
|
|
|
|
+// return pathSplit[pathSplit.length - 1];
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// return "";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//path:DJI_202406241424_027_项目编号0001-新建面状航线2
|
|
//path:DJI_202406241424_027_项目编号0001-新建面状航线2
|
|
@@ -561,7 +581,7 @@ public class FileServiceImpl implements IFileService {
|
|
|
|
|
|
|
|
private MediaTypeEnum convertMediaType(MediaFileEntity entity) {
|
|
private MediaTypeEnum convertMediaType(MediaFileEntity entity) {
|
|
|
if(StringUtils.hasText(entity.getMediaType())) {
|
|
if(StringUtils.hasText(entity.getMediaType())) {
|
|
|
- if (entity.getMediaType().startsWith(IMAGE) || JPEG.equalsIgnoreCase(entity.getMediaType())) {
|
|
|
|
|
|
|
+ if (JPEG.equalsIgnoreCase(entity.getPictureType()) && MediaSubFileTypeEnum.NORMAL.getType() == entity.getSubFileType()) {
|
|
|
if (entity.getIsOriginal()) {
|
|
if (entity.getIsOriginal()) {
|
|
|
return MediaTypeEnum.PIC_ORIGIN;
|
|
return MediaTypeEnum.PIC_ORIGIN;
|
|
|
} else {
|
|
} else {
|
|
@@ -569,7 +589,7 @@ public class FileServiceImpl implements IFileService {
|
|
|
}
|
|
}
|
|
|
} else if (entity.getMediaType().startsWith(VIDEO) || MP4.equalsIgnoreCase(entity.getPictureType())) {
|
|
} else if (entity.getMediaType().startsWith(VIDEO) || MP4.equalsIgnoreCase(entity.getPictureType())) {
|
|
|
return MediaTypeEnum.VIDEO;
|
|
return MediaTypeEnum.VIDEO;
|
|
|
- } else if (entity.getMediaType().startsWith("jfif")) {
|
|
|
|
|
|
|
+ } else if (JPEG.equalsIgnoreCase(entity.getPictureType()) && MediaSubFileTypeEnum.PANORAMA.getType() == entity.getSubFileType()) {
|
|
|
return MediaTypeEnum.PIC_PANORAMA;
|
|
return MediaTypeEnum.PIC_PANORAMA;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|