| | |
| | | package com.dji.sample.media.controller; |
| | | |
| | | import com.dji.sample.common.model.PaginationData; |
| | | import com.dji.sample.common.model.ResponseResult; |
| | | import com.dji.sample.component.mqtt.model.MapKeyConst; |
| | | import com.dji.sample.media.model.FileUploadDTO; |
| | | import com.dji.sample.media.model.MediaJobDTO; |
| | | import com.dji.sample.media.model.param.SearchMediaParam; |
| | | import com.dji.sample.media.service.IMediaService; |
| | | import com.dji.sample.wayline.model.dto.WaylineJobDTO; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.awt.*; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | |
| | | /** |
| | | * Check if the file has been uploaded by the fingerprint. |
| | | * 检查文件是否已通过指纹上传。 |
| | | * |
| | | * @param workspaceId |
| | | * @param file |
| | | * @return |
| | |
| | | /** |
| | | * When the file is uploaded to the storage server by pilot, |
| | | * the basic information of the file is reported through this interface. |
| | | * |
| | | * @param workspaceId |
| | | * @param file |
| | | * @return |
| | | */ |
| | | @PostMapping("/{workspace_id}/upload-callback") |
| | | public ResponseResult<String> uploadCallback(@PathVariable(name = "workspace_id") String workspaceId, @RequestBody FileUploadDTO file) { |
| | | public ResponseResult<String> uploadCallback(@PathVariable(name = "workspace_id") String workspaceId, @RequestBody FileUploadDTO file) throws IOException, FontFormatException { |
| | | mediaService.saveMediaFile(workspaceId, file); |
| | | return ResponseResult.success(file.getObjectKey()); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Query the files that already exist in this workspace based on the workspace id and the collection of tiny fingerprints. |
| | | * |
| | | * @param workspaceId |
| | | * @param tinyFingerprints There is only one tiny_fingerprint parameter in the body. |
| | | * But it is not recommended to use Map to receive the parameter. |
| | |
| | | return ResponseResult.success(new ConcurrentHashMap<>(Map.of(MapKeyConst.TINY_FINGERPRINTS, existingList))); |
| | | } |
| | | |
| | | @GetMapping("/{workspace_id}/files/media_page") |
| | | public ResponseResult<PaginationData<MediaJobDTO>> mediaPage( |
| | | @PathVariable(name = "workspace_id") String workspaceId, @RequestBody SearchMediaParam param) { |
| | | |
| | | PaginationData<MediaJobDTO> data = mediaService.mediaPage(workspaceId, param); |
| | | return ResponseResult.success(data); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/files/detail/{job_id}") |
| | | public ResponseResult<PaginationData<MediaJobDTO>> mediaDetail( |
| | | @PathVariable(name = "job_id") String jobId, @RequestParam Long page, @RequestParam Long pageSize) { |
| | | |
| | | PaginationData<MediaJobDTO> data = mediaService.mediaDetail(jobId, page, pageSize); |
| | | return ResponseResult.success(data); |
| | | } |
| | | |
| | | |
| | | } |