diff --git a/documentation/general/architecture.md b/documentation/general/architecture.md new file mode 100644 index 0000000..fdceb7a --- /dev/null +++ b/documentation/general/architecture.md @@ -0,0 +1,3 @@ +# Архитектура платформы teh +## диаграмма компонентов +![диаграмма компонентов](architecture.png) diff --git a/documentation/general/architecture.png b/documentation/general/architecture.png new file mode 100644 index 0000000..a388a73 Binary files /dev/null and b/documentation/general/architecture.png differ diff --git a/documentation/general/architecture.puml b/documentation/general/architecture.puml new file mode 100644 index 0000000..3055a19 --- /dev/null +++ b/documentation/general/architecture.puml @@ -0,0 +1,52 @@ +@startuml +title "Архитектура платформы : teh" +skinparam componentStyle rectangle +allowmixing +left to right direction + +component docker { + component environment { + component jvm + component maven + component git + } + + component teh { + + component source { + portin in81 + portout out81 + } + component storage { + portin in82 + portout out82 + } + component face { + portin in83 + portout out83 + } + component logger { + portin in85 + portout out85 + } + component base { + portout out5432 + portin in5432 + } + + portin env + + out81 --> in83 : "Данные СУБД\n в json-формате" + out82 --> in83 : "Данные файловой системы\n в json-формате" + out5432 --> in81 : "данные СУБД\n в виде персистентных объектов" + out81 --> in85 : "Логи исполнения\n кода приложения" + out82 --> in85 : "Логи исполнения\n кода приложения" + out83 --> in85 : "Логи исполнения\n кода приложения" + } + jvm --> env + maven --> env + git --> env +} + + +@enduml \ No newline at end of file diff --git a/documentation/general/usecase.puml b/documentation/general/usecase.puml new file mode 100644 index 0000000..062e1fa --- /dev/null +++ b/documentation/general/usecase.puml @@ -0,0 +1,39 @@ +@startuml +title "usecase: teh" +left to right direction + +actor "Пользователь" as user + +package "mainframe" { + frame "Статистика файлообменника (storage-stat)" { + usecase "Данные по видам и количеству размещенных на сервере документов" + usecase "Переход: к файлообменнику (storage)" + } + frame "Статистика хранилища данных (base-stat)" { + usecase "Просмотр данных реестра обученных" + usecase "Переход: к формированию отчетов" + } +} + +package "storage" { + usecase "Переход: к mainframe" + usecase "Размещение в хранилище файлов" as upload + usecase "Скачивание файла с сервера" as download + usecase "Удаление файлов из хранилища" as delete + usecase "Просмотр списка файлов в хранилище" as list + usecase "Просмотр/получение сведений о файле" as info + usecase "Переход: к просмотру содержимого файла" + usecase "Переход: к формам экспорта данных" +} + +package "view-xlsx" as viewXlsx{ + usecase "Просмотр/получение содержимого файла (xlsx)" as view + usecase "Навигация по файлу" + usecase "Переход: к mainframe" + usecase "Переход: к storage" +} + +user --> mainframe +user --> storage +user --> viewXlsx +@enduml \ No newline at end of file diff --git a/documentation/storage/usecase.puml b/documentation/storage/usecase.puml new file mode 100644 index 0000000..9e5ff99 --- /dev/null +++ b/documentation/storage/usecase.puml @@ -0,0 +1,73 @@ +@startuml +title "USECASE: teh.storage" +allowmixing +left to right direction +' пользователи +actor "Пользователь" as user +actor "Стороний сервис" as service + +' возможности использования +usecase "получение сведений о корневой директории" as getRoot +usecase "Загрузка файла на сервер" as upload +usecase "Загрузка файлов на сервер пакетом" as uploads +usecase "Скачивание файла с сервера" as download +usecase "Удаление файла с сервера" as delete +usecase "Просмотр/получение перечня файлов на сервере" as list +usecase "Просмотр/получение сведений о файле" as fileInfo +usecase "Настройка параметров просмотра файла (xlsx)" as setParams +usecase "Просмотр/получение содержимого файла (xlsx)" as viewXlsx + +' FACE +user --> upload +user --> uploads +user --> download +user --> delete +user --> list +user --> fileInfo +user --> setParams +user --> viewXlsx + +' REST API +upload <-- service : "POST /api/v1/files/store" +uploads <-- service : "POST /api/v1/files/store-multiple" +download <-- service : "GET /api/v1/files/download" +delete <-- service : "DELETE /api/v1/files/delete" +list <-- service : "GET /api/v1/files" +fileInfo <-- service : "получаем с пусой страницей xlsxPage" +viewXlsx <-- service : "GET /api/v1/files/xlsx" +getRoot <-- service : "GET /api/v1/root" + +json "Сведения о файле" as fileMetadata { + "name":"наименование файла", + "extension":["xlsx", "pdf", "..."], + "rootPath": "/app/storage/uploads", + "relativePath":"/filename.xlsx", + "absolutePath":"/app/storage/uploads/filename.xlsx", + "size":"размер файла в байтах", + "createdDate":"время создания файла", + "lastModifiedDate":"время последнего изменения файла", + "owner":"пользователь - владелец файла", + "type": "файл или директория", + "permissions": "права, установленные файлу на сервере" +} + +json "Содержимое файла" as page { + "content":"выборка данных xlsx", + "metadata":"FileMetadata", + "pageSize": "размер страницы", + "pageNumber": "номер страницы", + "offset": "смещение", + "headerLine": "номер строки с заголовками", + "last": "является ли последней страницей", + "first": "является ли первой страницей", + "hasNext": "имеется ли следующая страница", + "hasPrevious": "имеется ли предыдущая страница", + "totalLines": "всего строк в xlsx-файле", + "totalColumns": "всего столбцов", + "totalPages": "всего страниц" +} + +fileInfo --{ fileMetadata +viewXlsx --{ page + +@enduml diff --git a/face/README.md b/face/README.md new file mode 100644 index 0000000..4ab5662 --- /dev/null +++ b/face/README.md @@ -0,0 +1 @@ +# teh.face \ No newline at end of file diff --git a/storage/logs/teh.log b/storage/logs/teh.log index 46f5913..b8eea9a 100644 --- a/storage/logs/teh.log +++ b/storage/logs/teh.log @@ -1,12 +1,12 @@ -{"@timestamp":"2024-10-10T05:48:48.071013600Z","log.level":"INFO","process.pid":5360,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.StorageApplicationTests","message":"Starting StorageApplicationTests using Java 17.0.7 with PID 5360 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\storage)","ecs.version":"8.11"} -{"@timestamp":"2024-10-10T05:48:48.083108600Z","log.level":"INFO","process.pid":5360,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.StorageApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} -{"@timestamp":"2024-10-10T05:48:49.021430Z","log.level":"INFO","process.pid":5360,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.services.FileServiceImpl","message":"Создание директории root(), для хранения файлов: C:\\Users\\devuser\\Documents\\code\\teh\\storage\\uploads","ecs.version":"8.11"} -{"@timestamp":"2024-10-10T05:48:49.895543100Z","log.level":"INFO","process.pid":5360,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.StorageApplicationTests","message":"Started StorageApplicationTests in 2.251 seconds (process running for 3.281)","ecs.version":"8.11"} -{"@timestamp":"2024-10-10T06:10:14.369765600Z","log.level":"INFO","process.pid":5140,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.StorageApplicationTests","message":"Starting StorageApplicationTests using Java 17.0.7 with PID 5140 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\storage)","ecs.version":"8.11"} -{"@timestamp":"2024-10-10T06:10:14.376062200Z","log.level":"INFO","process.pid":5140,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.StorageApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} -{"@timestamp":"2024-10-10T06:10:15.441671200Z","log.level":"INFO","process.pid":5140,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.services.FileServiceImpl","message":"Создание директории root(), для хранения файлов: C:\\Users\\devuser\\Documents\\code\\teh\\storage\\uploads","ecs.version":"8.11"} -{"@timestamp":"2024-10-10T06:10:16.498992600Z","log.level":"INFO","process.pid":5140,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.StorageApplicationTests","message":"Started StorageApplicationTests in 2.565 seconds (process running for 3.659)","ecs.version":"8.11"} -{"@timestamp":"2024-10-10T06:16:30.410659500Z","log.level":"INFO","process.pid":16080,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.StorageApplicationTests","message":"Starting StorageApplicationTests using Java 17.0.7 with PID 16080 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\storage)","ecs.version":"8.11"} -{"@timestamp":"2024-10-10T06:16:30.416388500Z","log.level":"INFO","process.pid":16080,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.StorageApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} -{"@timestamp":"2024-10-10T06:16:31.402964900Z","log.level":"INFO","process.pid":16080,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.services.FileServiceImpl","message":"Создание директории root(), для хранения файлов: C:\\Users\\devuser\\Documents\\code\\teh\\storage\\uploads","ecs.version":"8.11"} -{"@timestamp":"2024-10-10T06:16:32.211194900Z","log.level":"INFO","process.pid":16080,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.StorageApplicationTests","message":"Started StorageApplicationTests in 2.244 seconds (process running for 3.327)","ecs.version":"8.11"} +{"@timestamp":"2024-10-11T06:10:07.994244Z","log.level":"INFO","process.pid":13084,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.StorageApplicationTests","message":"Starting StorageApplicationTests using Java 17.0.7 with PID 13084 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\storage)","ecs.version":"8.11"} +{"@timestamp":"2024-10-11T06:10:08.012254100Z","log.level":"INFO","process.pid":13084,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.StorageApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} +{"@timestamp":"2024-10-11T06:10:08.913700800Z","log.level":"INFO","process.pid":13084,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.services.FileServiceImpl","message":"Создание директории root(), для хранения файлов: C:\\Users\\devuser\\Documents\\code\\teh\\storage\\uploads","ecs.version":"8.11"} +{"@timestamp":"2024-10-11T06:10:09.780682400Z","log.level":"INFO","process.pid":13084,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.StorageApplicationTests","message":"Started StorageApplicationTests in 2.237 seconds (process running for 3.3)","ecs.version":"8.11"} +{"@timestamp":"2024-10-11T06:35:21.950719700Z","log.level":"INFO","process.pid":8196,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.StorageApplicationTests","message":"Starting StorageApplicationTests using Java 17.0.7 with PID 8196 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\storage)","ecs.version":"8.11"} +{"@timestamp":"2024-10-11T06:35:21.956727800Z","log.level":"INFO","process.pid":8196,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.StorageApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} +{"@timestamp":"2024-10-11T06:35:22.854946600Z","log.level":"INFO","process.pid":8196,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.services.FileServiceImpl","message":"Создание директории root(), для хранения файлов: C:\\Users\\devuser\\Documents\\code\\teh\\storage\\uploads","ecs.version":"8.11"} +{"@timestamp":"2024-10-11T06:35:23.702006500Z","log.level":"INFO","process.pid":8196,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.StorageApplicationTests","message":"Started StorageApplicationTests in 2.194 seconds (process running for 3.32)","ecs.version":"8.11"} +{"@timestamp":"2024-10-11T07:10:32.899864600Z","log.level":"INFO","process.pid":6096,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.StorageApplicationTests","message":"Starting StorageApplicationTests using Java 17.0.7 with PID 6096 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\storage)","ecs.version":"8.11"} +{"@timestamp":"2024-10-11T07:10:32.906864100Z","log.level":"INFO","process.pid":6096,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.StorageApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} +{"@timestamp":"2024-10-11T07:10:33.959310800Z","log.level":"INFO","process.pid":6096,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.services.FileServiceImpl","message":"Создание директории root(), для хранения файлов: C:\\Users\\devuser\\Documents\\code\\teh\\storage\\uploads","ecs.version":"8.11"} +{"@timestamp":"2024-10-11T07:10:34.884139900Z","log.level":"INFO","process.pid":6096,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.storage.StorageApplicationTests","message":"Started StorageApplicationTests in 2.442 seconds (process running for 3.562)","ecs.version":"8.11"} diff --git a/storage/logs/teh.log.2024-10-10.0.gz b/storage/logs/teh.log.2024-10-10.0.gz new file mode 100644 index 0000000..e17aedf Binary files /dev/null and b/storage/logs/teh.log.2024-10-10.0.gz differ diff --git a/storage/src/main/java/gsp/technologies/storage/controllers/api/ApiController.java b/storage/src/main/java/gsp/technologies/storage/controllers/api/ApiController.java index 26570d0..3abf642 100644 --- a/storage/src/main/java/gsp/technologies/storage/controllers/api/ApiController.java +++ b/storage/src/main/java/gsp/technologies/storage/controllers/api/ApiController.java @@ -2,6 +2,7 @@ package gsp.technologies.storage.controllers.api; import java.io.IOException; import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; @@ -146,16 +147,10 @@ public class ApiController { LOG.info("pageNumber: {}", pageNumber); LOG.info("pageSize: {}", pageSize); - try { - String path = fs.loadAsResource(filename).getFile().getPath(); - - Xlsx xlsx = new Xlsx(path); - XlsxPage page = xlsx.page(Integer.parseInt(pageSize), Integer.parseInt(pageNumber)); - return ResponseEntity.ok(page); - } catch (IOException e) { - LOG.info("Error: {}", e.getMessage()); - return ResponseEntity.badRequest().body(null); - } + Path relative = Paths.get(filename); + Xlsx xlsx = fs.xlsx(relative); + XlsxPage page = xlsx.page(Integer.parseInt(pageSize), Integer.parseInt(pageNumber)); + return ResponseEntity.ok(page); } /** diff --git a/storage/src/main/java/gsp/technologies/storage/controllers/face/FaceController.java b/storage/src/main/java/gsp/technologies/storage/controllers/face/FaceController.java index 4c6a382..76d452d 100644 --- a/storage/src/main/java/gsp/technologies/storage/controllers/face/FaceController.java +++ b/storage/src/main/java/gsp/technologies/storage/controllers/face/FaceController.java @@ -189,25 +189,13 @@ public class FaceController { LOG.info("GET /view"); Path relative = Path.of(filename); - // Path absolute = fs.absolute(relative); - FileMetadata meta = fs - .metaFromPath(relative); + FileMetadata meta = fs.meta(relative); + //обработка xlsx файла if (meta.getExtension().equals("xlsx")) { LOG.info("Файл {} является xlsx-файлом", filename); - //преобразуем имя файла в путь - // String path = client.get() - // .uri(ApiLink.ROOT.full()) - // .retrieve() - // .bodyToMono(String.class) - // .block(); - // path = path + File.separator + filename; - // LOG.info("Путь к xlsx-файлу: {}", path); - - // Path relative = Path.of(filename); - // добавляем модель данные xlsx - Xlsx xlsx = new Xlsx(meta, fs); + Xlsx xlsx = fs.xlsx(relative); XlsxPage page = xlsx.page(pageSize, pageNumber); model.addAttribute("xlsx", page); @@ -215,7 +203,7 @@ public class FaceController { return "view-xlsx"; } - //возвращаем пользователя на главную страницу + //в остальных случаях возвращаем пользователя на главную страницу LOG.info("Файл {} не является xlsx-файлом. Возвращаем пользователя на главную страницу", filename); return FaceLink.MAINFRAME.redirect(); } diff --git a/storage/src/main/java/gsp/technologies/storage/controllers/hello/HelloController.java b/storage/src/main/java/gsp/technologies/storage/controllers/hello/HelloController.java index 0088068..e37d1a4 100644 --- a/storage/src/main/java/gsp/technologies/storage/controllers/hello/HelloController.java +++ b/storage/src/main/java/gsp/technologies/storage/controllers/hello/HelloController.java @@ -1,52 +1,20 @@ package gsp.technologies.storage.controllers.hello; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; -// import ru.molokoin.storagers.model.Document; -// import ru.molokoin.storagers.model.XlsxCell; -// import ru.molokoin.storagers.model.XlsxMultipartDocument; -// import ru.molokoin.storagers.service.StorageServiceFace; - /** * контроллер, для отрабтки тестов, * выводит страницу с информацией о сервисе пользователю */ @Controller public class HelloController { - /** - * получаем в переменную root - * значение свойства storage.location - * из файла application.yaml - */ - // private StorageServiceFace storage; - - /** - * Конструктор контроллера, дня инициализации объекта хранилища - * - передается интерфейс - * @param storage - */ - // public HelloController(StorageServiceFace storage){ - // this.storage = storage; - // } - + private static final Logger log = LoggerFactory.getLogger(HelloController.class); @GetMapping("/hello") public String hello(){ - // System.out.println("storageRS/hello-controller# " + "передача пользователю шаблона hello.html"); - // System.out.println("storageRS/hello-controller#(из config): " + storage.root()); - // System.out.println("Загружено документов: " + storage.list().size()); - System.out.println("Перечень загруженных документов:"); - // int i = 1; - // for (Document doc : storage.list()) { - // XlsxMultipartDocument parts = new XlsxMultipartDocument(doc); - // System.out.println("Document#" + i + ": " + doc.getPath() + "(size#" + doc.getSize() + ")" + " ### lines: " + parts.getLineCount()); - // for (XlsxCell c: parts.line(i-1)) { - // System.out.println(c.getContent()); - // } - // parts.close(); - // System.out.println("---------------------"); - // i++; - // } + log.info("GET /hello"); return "hello"; } } diff --git a/storage/src/main/java/gsp/technologies/storage/models/xlsx/Xlsx.java b/storage/src/main/java/gsp/technologies/storage/models/xlsx/Xlsx.java index 02eb28b..07ee80f 100644 --- a/storage/src/main/java/gsp/technologies/storage/models/xlsx/Xlsx.java +++ b/storage/src/main/java/gsp/technologies/storage/models/xlsx/Xlsx.java @@ -34,10 +34,6 @@ public class Xlsx { this.fs = fs; } - public Xlsx(String path){ - this.metadata = fs.metaFromPath(Paths.get(path)); - } - public XlsxPage page(int pageSize, int pageNumber) { return XlsxPage.builder() .pageSize(pageSize) diff --git a/storage/src/main/java/gsp/technologies/storage/services/FileService.java b/storage/src/main/java/gsp/technologies/storage/services/FileService.java index dec9f49..5253c02 100644 --- a/storage/src/main/java/gsp/technologies/storage/services/FileService.java +++ b/storage/src/main/java/gsp/technologies/storage/services/FileService.java @@ -9,6 +9,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.multipart.MultipartFile; import gsp.technologies.storage.models.FileMetadata; +import gsp.technologies.storage.models.xlsx.Xlsx; public interface FileService { // List listFiles(String path, Boolean recursive); @@ -38,5 +39,6 @@ public interface FileService { String permissions(Path path); List children(Path path); FileMetadata parent(Path path); - FileMetadata metaFromPath(Path relative); + FileMetadata meta(Path relative); + Xlsx xlsx(Path relative); } \ No newline at end of file diff --git a/storage/src/main/java/gsp/technologies/storage/services/FileServiceImpl.java b/storage/src/main/java/gsp/technologies/storage/services/FileServiceImpl.java index 692c451..3fa022b 100644 --- a/storage/src/main/java/gsp/technologies/storage/services/FileServiceImpl.java +++ b/storage/src/main/java/gsp/technologies/storage/services/FileServiceImpl.java @@ -26,6 +26,7 @@ import org.springframework.web.multipart.MultipartFile; import gsp.technologies.storage.config.StorageConfig; import gsp.technologies.storage.models.FileMetadata; +import gsp.technologies.storage.models.xlsx.Xlsx; import jakarta.annotation.PostConstruct; @Service @@ -252,7 +253,7 @@ public class FileServiceImpl implements FileService { catch (IOException e) { System.out.println("Не удалось сохранить файл " + file.getOriginalFilename()); } - return metaFromPath(Path.of(file.getOriginalFilename())); + return meta(Path.of(file.getOriginalFilename())); } @Override @@ -381,7 +382,7 @@ public class FileServiceImpl implements FileService { List list = List.of(); try { list = Files.list(path) - .map(p -> metaFromPath(p.getFileName())) + .map(p -> meta(p.getFileName())) .collect(Collectors.toList()); } catch (IOException e) { log.error("Не удалось получить метаданные для файла {}", filename(path)); @@ -390,10 +391,10 @@ public class FileServiceImpl implements FileService { } public FileMetadata parent(Path path){ - return metaFromPath(path.getParent()); + return meta(path.getParent()); } - public FileMetadata metaFromPath(Path relative) { + public FileMetadata meta(Path relative) { log.info("Создаем объект FileMetadata для пути {}", relative.toString()); FileMetadata meta = new FileMetadata(); Path absolute = this.absolute(relative); @@ -411,4 +412,8 @@ public class FileServiceImpl implements FileService { meta.setPermissions(permissions(absolute)); return meta; } + + public Xlsx xlsx(Path relative){ + return new Xlsx(meta(relative), this); + } } \ No newline at end of file diff --git a/storage/src/main/java/gsp/technologies/storage/services/RemoteFilesService.java b/storage/src/main/java/gsp/technologies/storage/services/RemoteFilesService.java index 7a9527b..84b75a0 100644 --- a/storage/src/main/java/gsp/technologies/storage/services/RemoteFilesService.java +++ b/storage/src/main/java/gsp/technologies/storage/services/RemoteFilesService.java @@ -9,7 +9,6 @@ import org.springframework.core.io.Resource; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.reactive.function.client.WebClient; -import org.springframework.web.util.UriBuilder; import org.springframework.web.util.UriComponents; import org.springframework.web.util.UriComponentsBuilder; @@ -50,17 +49,6 @@ public class RemoteFilesService { .block(); } - // public void uploadFile(String originalFilename, byte[] bytes) { - // System.out.println("originalFilename: " + originalFilename); - // System.out.println("bytes.length: " + bytes.length); - // client.post() - // .uri(filesURL + "/" + originalFilename) - // .body(Mono.just(bytes), byte[].class) - // .retrieve() - // .toBodilessEntity() - // .block(); - // } - public void uploadFile(MultipartFile file) { System.out.println("RemoteFilesService#uploadFile(): OK"); UriComponents uriComponents; @@ -102,7 +90,6 @@ public class RemoteFilesService { .retrieve() .toBodilessEntity() .block(); - } public Resource loadAsResource(String filename) { diff --git a/storage/src/main/resources/templates/hello.html b/storage/src/main/resources/templates/hello.html index 6a8f67e..f056275 100644 --- a/storage/src/main/resources/templates/hello.html +++ b/storage/src/main/resources/templates/hello.html @@ -9,6 +9,17 @@ xmlns:th="http://www.thymeleaf.org"> +

TEST: moodle links

+ https://ruphp.com/moodle-accept.html +
+ + + + +
+
+ +

hello-page

\ No newline at end of file diff --git a/storage/src/main/resources/templates/view-xlsx.html b/storage/src/main/resources/templates/view-xlsx.html index 8786776..8f2c51b 100644 --- a/storage/src/main/resources/templates/view-xlsx.html +++ b/storage/src/main/resources/templates/view-xlsx.html @@ -33,9 +33,13 @@ - path: + absolutePath: + + relativePath: + + root: