| | |
| | | package com.dji.sample.media.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dji.sample.common.model.Pagination; |
| | | import com.dji.sample.common.model.PaginationData; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<MediaFileEntity> listMediaFileEntity(String workspaceId, String jobId) { |
| | | return mapper.selectList(new LambdaQueryWrapper<MediaFileEntity>() |
| | | .eq(MediaFileEntity::getWorkspaceId, workspaceId).eq(MediaFileEntity::getJobId,jobId)); |
| | | } |
| | | |
| | | @Override |
| | | public PaginationData<MediaFileDTO> getMediaFilesPaginationByWorkspaceId(String workspaceId, long page, long pageSize, MediaFileQueryParam mediaFileQueryParam) { |
| | | // Page<MediaFileEntity> pageData = mapper.selectPage( |
| | | // new Page<MediaFileEntity>(page, pageSize), |
| | |
| | | public URL getObjectUrl(String workspaceId, String fileId) { |
| | | Optional<MediaFileEntity> mediaFileOpt = getMediaByFileId(workspaceId, fileId); |
| | | if (mediaFileOpt.isEmpty()) { |
| | | throw new IllegalArgumentException("{} doesn't exist."); |
| | | throw new IllegalArgumentException("{} 不存在"); |
| | | } |
| | | |
| | | return ossService.getObjectUrl(OssConfiguration.bucket, mediaFileOpt.get().getObjectKey()); |
| | |
| | | @Override |
| | | public Boolean updateMediaFile(String workspaceId, MediaFileEntity mediaFileEntity) { |
| | | |
| | | MediaFileEntity params = new MediaFileEntity(); |
| | | /*MediaFileEntity params = new MediaFileEntity(); |
| | | params.setFileId(mediaFileEntity.getFileId()); |
| | | params.setWorkspaceId(mediaFileEntity.getWorkspaceId()); |
| | | |
| | | int update = mapper.update(mediaFileEntity, Wrappers.update(params)); |
| | | return update>0; |
| | | params.setWorkspaceId(mediaFileEntity.getWorkspaceId());*/ |
| | | boolean update1 = new LambdaUpdateChainWrapper<>(mapper).eq(MediaFileEntity::getFileId, mediaFileEntity.getFileId()) |
| | | .set(MediaFileEntity::getFileName, mediaFileEntity.getFileName()) |
| | | .set(MediaFileEntity::getCollectStatus,mediaFileEntity.getCollectStatus()) |
| | | .set(MediaFileEntity::getUserId,mediaFileEntity.getUserId()) |
| | | .update(); |
| | | // int update = mapper.update(mediaFileEntity, Wrappers.update(params)); |
| | | return update1; |
| | | } |
| | | |
| | | /** |
| | |
| | | .subFileType(file.getSubFileType()) |
| | | .isOriginal(file.getExt().getIsOriginal()) |
| | | .jobId(file.getExt().getFlightId()) |
| | | .drone(file.getExt().getSn()) |
| | | .drone(file.getExt().getSn()).metadata(file.getMetadata()) |
| | | .tinnyFingerprint(file.getExt().getTinnyFingerprint()); |
| | | |
| | | // domain-type-subType |