| | |
| | | package com.ard.sample.media.service.impl; |
| | | |
| | | import com.ard.common.config.OssConfiguration; |
| | | import com.ard.sample.common.error.CommonErrorEnum; |
| | | import com.ard.sample.common.model.ResponseResult; |
| | | import com.ard.sample.component.mqtt.model.*; |
| | |
| | | import com.ard.sample.component.websocket.model.CustomWebSocketMessage; |
| | | import com.ard.sample.component.websocket.service.ISendMessageService; |
| | | import com.ard.sample.component.websocket.service.IWebSocketManageService; |
| | | import com.ard.sample.config.DockConfiguration; |
| | | import com.ard.sample.manage.model.dto.DeviceDTO; |
| | | import com.ard.sample.manage.model.enums.UserTypeEnum; |
| | | import com.ard.sample.manage.service.IDeviceService; |
| | |
| | | // 设置拍摄媒体的无人机 |
| | | Optional<DeviceDTO> dockDTO = deviceService.getDeviceBySn(job.getDockSn()); |
| | | dockDTO.ifPresent(dock -> callback.getFile().getExt().setSn(dock.getChildDeviceSn())); |
| | | dockDTO.ifPresent(dock -> callback.getFile().getExt().setPayloadModelKey(dockDTO.get().getDomain()+"-"+dockDTO.get().getType()+"-"+dockDTO.get().getSubType())); |
| | | |
| | | // 设定路径 |
| | | String objectKey = callback.getFile().getObjectKey(); |
| | | callback.getFile().setPath(objectKey.substring(objectKey.indexOf("/") + 1, objectKey.lastIndexOf("/"))); |
| | | String objectKey = callback.getFile().getObjectKey()!= null ? callback.getFile().getObjectKey() : ""; |
| | | String path = String.format("%s/%s/%s", OssConfiguration.endpoint, DockConfiguration.bucket, objectKey); |
| | | log.info("媒体库上传文件完整路path:{}",path); |
| | | callback.getFile().setPath(path); |
| | | // callback.getFile().setPath(objectKey.substring(objectKey.indexOf("/") + 1, objectKey.lastIndexOf("/"))); |
| | | log.info("保存媒体库数据:{}",callback); |
| | | return fileService.saveFile(callback.getFile()) > 0; |
| | | } |