src/main/java/com/dji/sample/component/websocket/service/impl/SendMessageServiceImpl.java
@@ -80,7 +80,7 @@ @Override public void sendBatch(String workspaceId, Integer userType, String bizCode, Object data) { if (!StringUtils.hasText(workspaceId)) { throw new RuntimeException("Workspace ID does not exist."); throw new RuntimeException("项目id不存在;Workspace ID does not exist."); } Collection<ConcurrentWebSocketSession> sessions = Objects.isNull(userType) ? webSocketManageService.getValueWithWorkspace(workspaceId) : @@ -97,4 +97,4 @@ public void sendBatch(String workspaceId, String bizCode, Object data) { this.sendBatch(workspaceId, null, bizCode, data); } } } src/main/java/com/dji/sample/manage/controller/DeviceLogsController.java
@@ -62,6 +62,7 @@ /** * Initiate a log upload request to the gateway. * 向网关发起日志上传请求。 * @return */ @PostMapping("/{workspace_id}/devices/{device_sn}/logs") src/main/java/com/dji/sample/manage/service/IDeviceLogsService.java
@@ -48,6 +48,7 @@ /** * Initiate a log upload request to the gateway. * 向网关发起日志上传请求。 * @param username * @param deviceSn * @param param src/main/java/com/dji/sample/manage/service/IDeviceRedisService.java
@@ -25,6 +25,7 @@ /** * Query the basic information of the device in redis. * 在redis中查询设备的基本信息。 * @param sn * @return */ src/main/java/com/dji/sample/media/controller/MediaController.java
@@ -28,6 +28,7 @@ /** * Check if the file has been uploaded by the fingerprint. * 检查文件是否已通过指纹上传。 * @param workspaceId * @param file * @return @@ -70,4 +71,4 @@ return ResponseResult.success(new ConcurrentHashMap<>(Map.of(MapKeyConst.TINY_FINGERPRINTS, existingList))); } } } src/main/java/com/dji/sample/media/service/impl/MediaServiceImpl.java
@@ -94,6 +94,7 @@ /** * Handle media files messages reported by dock. * 处理由dock报告的媒体文件消息。 * @param receiver * @return */ @@ -102,7 +103,7 @@ FileUploadCallback callback = objectMapper.convertValue(receiver.getData(), FileUploadCallback.class); if (callback.getResult() != ResponseResult.CODE_SUCCESS) { log.error("Media file upload failed!"); log.error("媒体文件上传失败;Media file upload failed!"); return null; } @@ -123,7 +124,7 @@ if (jobOpt.isPresent()) { boolean isSave = parseMediaFile(callback, jobOpt.get()); if (!isSave) { log.error("Failed to save the file to the database, please check the data manually."); log.error("保存文件到数据库失败,请手动检查数据;Failed to save the file to the database, please check the data manually."); return null; } } @@ -134,12 +135,14 @@ /** * update the uploaded count and notify web side * 更新上传的计数并通知web端 * @param mediaFileCount * @param receiver * @param jobId */ private void notifyUploadedCount(MediaFileCountDTO mediaFileCount, CommonTopicReceiver receiver, String jobId, DeviceDTO dock) { // Do not notify when files that do not belong to the route are uploaded. //上传不属于该路线的文件时不进行通知。 if (Objects.isNull(mediaFileCount)) { return; } @@ -149,10 +152,12 @@ String key = RedisConst.MEDIA_FILE_PREFIX + receiver.getGateway(); // After all the files of the job are uploaded, delete the media file key. //待作业的所有文件上传完成后,删除媒体文件密钥。 if (mediaFileCount.getUploadedCount() >= mediaFileCount.getMediaCount()) { RedisOpsUtils.hashDel(key, new String[]{jobId}); // After uploading, delete the key with the highest priority. //上传完成后,删除优先级最高的密钥。 String highestKey = RedisConst.MEDIA_HIGHEST_PRIORITY_PREFIX + receiver.getGateway(); if (RedisOpsUtils.checkExist(highestKey) && jobId.equals(((MediaFileCountDTO) RedisOpsUtils.get(highestKey)).getJobId())) { @@ -166,6 +171,7 @@ RedisOpsUtils.hashSet(key, jobId, mediaFileCount); } //通过websocket把数据发送给web sendMessageService.sendBatch(dock.getWorkspaceId(), UserTypeEnum.WEB.getVal(), BizCodeEnum.FILE_UPLOAD_CALLBACK.getCode(), mediaFileCount); } src/main/java/com/dji/sample/storage/service/IStorageService.java
@@ -13,6 +13,7 @@ /** * Get custom temporary credentials object for uploading the media and wayline. * 获取用于上传媒体和航路线的自定义临时凭据对象。 * @return temporary credentials object */ StsCredentialsDTO getSTSCredentials();