| | |
| | | WaylineFileEntity file = this.dtoConvertToEntity(metadata); |
| | | file.setWaylineId(UUID.randomUUID().toString()); |
| | | file.setWorkspaceId(workspaceId); |
| | | |
| | | if (!StringUtils.hasText(file.getSign())) { |
| | | try (InputStream object = ossService.getObject(OssConfiguration.bucket, metadata.getObjectKey())) { |
| | | if (object.available() == 0) { |
| | |
| | | } |
| | | return waylineFile; |
| | | } |
| | | @Override |
| | | public WaylineFileDTO importPlaneKmzFile(MultipartFile file, String workspaceId, String creator,String newName,String id) { |
| | | WaylineFileDTO waylineFile = null; |
| | | Optional<WaylineFileDTO> waylineFileOpt = validKmzFile(file); |
| | | if (waylineFileOpt.isEmpty()) { |
| | | throw new RuntimeException("文件格式错误"); |
| | | } |
| | | |
| | | try { |
| | | waylineFile = waylineFileOpt.get(); |
| | | waylineFile.setWaylineId(workspaceId); |
| | | waylineFile.setUsername(creator); |
| | | ossService.putObject(OssConfiguration.bucket, waylineFile.getObjectKey(), file.getInputStream()); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return waylineFile; |
| | | } |
| | | |
| | | @Override |
| | | public WaylineFileEntity selectByName(String name) { |