esoe
1 month ago
40 changed files with 2255 additions and 41 deletions
@ -1,3 +1,6 @@ |
|||||||
# Архитектура платформы teh |
# Архитектура платформы teh |
||||||
## диаграмма компонентов |
## диаграмма компонентов |
||||||
![диаграмма компонентов](architecture.png) |
![диаграмма компонентов](architecture.png) |
||||||
|
## диаграмма состояний (teh.face) |
||||||
|
![диаграмма компонентов](states.png) |
||||||
|
|
||||||
|
After Width: | Height: | Size: 153 KiB |
@ -1,3 +1,72 @@ |
|||||||
{"@timestamp":"2024-10-14T07:42:59.798197100Z","log.level":"INFO","process.pid":24236,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 24236 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
{"@timestamp":"2024-10-15T06:58:25.401365200Z","log.level":"INFO","process.pid":18360,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 18360 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
{"@timestamp":"2024-10-14T07:42:59.811604300Z","log.level":"INFO","process.pid":24236,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
{"@timestamp":"2024-10-15T06:58:25.420342800Z","log.level":"INFO","process.pid":18360,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
{"@timestamp":"2024-10-14T07:43:01.511680800Z","log.level":"INFO","process.pid":24236,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.178 seconds (process running for 3.357)","ecs.version":"8.11"} |
{"@timestamp":"2024-10-15T06:58:27.149308400Z","log.level":"INFO","process.pid":18360,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.195 seconds (process running for 3.296)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T06:59:59.876416300Z","log.level":"INFO","process.pid":21256,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 21256 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T06:59:59.884775400Z","log.level":"INFO","process.pid":21256,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:00:01.898558600Z","log.level":"INFO","process.pid":21256,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.456 seconds (process running for 3.62)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:01:15.761298200Z","log.level":"INFO","process.pid":25484,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 25484 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:01:15.768132300Z","log.level":"INFO","process.pid":25484,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:01:17.384655100Z","log.level":"INFO","process.pid":25484,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.041 seconds (process running for 3.126)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:01:34.475610100Z","log.level":"INFO","process.pid":13404,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 13404 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:01:34.486051900Z","log.level":"INFO","process.pid":13404,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:01:36.009313200Z","log.level":"INFO","process.pid":13404,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 1.981 seconds (process running for 3.109)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:03:51.509645700Z","log.level":"INFO","process.pid":3924,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 3924 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:03:51.515645500Z","log.level":"INFO","process.pid":3924,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:03:53.098716800Z","log.level":"INFO","process.pid":3924,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.027 seconds (process running for 3.091)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:04:44.875344100Z","log.level":"INFO","process.pid":11632,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 11632 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:04:44.885344900Z","log.level":"INFO","process.pid":11632,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:04:46.599374900Z","log.level":"INFO","process.pid":11632,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.208 seconds (process running for 3.45)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:17:20.407868200Z","log.level":"INFO","process.pid":20068,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 20068 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:17:20.414844100Z","log.level":"INFO","process.pid":20068,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:17:22.041664800Z","log.level":"INFO","process.pid":20068,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.199 seconds (process running for 3.335)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:20:25.233141700Z","log.level":"INFO","process.pid":18632,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 18632 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:20:25.239706500Z","log.level":"INFO","process.pid":18632,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:20:26.883033200Z","log.level":"INFO","process.pid":18632,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.12 seconds (process running for 3.2)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:20:41.404344Z","log.level":"INFO","process.pid":10532,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 10532 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:20:41.410344700Z","log.level":"INFO","process.pid":10532,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:20:43.516986100Z","log.level":"INFO","process.pid":10532,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.638 seconds (process running for 3.995)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:27:16.970919600Z","log.level":"INFO","process.pid":18168,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 18168 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:27:16.980920100Z","log.level":"INFO","process.pid":18168,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:27:18.804281800Z","log.level":"INFO","process.pid":18168,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.313 seconds (process running for 3.511)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:29:00.247600900Z","log.level":"INFO","process.pid":13576,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 13576 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:29:00.258902300Z","log.level":"INFO","process.pid":13576,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T07:29:02.130547300Z","log.level":"INFO","process.pid":13576,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.438 seconds (process running for 3.687)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T08:15:33.927111800Z","log.level":"INFO","process.pid":19756,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 19756 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T08:15:33.934116500Z","log.level":"INFO","process.pid":19756,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T08:15:35.917222400Z","log.level":"INFO","process.pid":19756,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.559 seconds (process running for 3.912)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T08:17:20.248731200Z","log.level":"INFO","process.pid":18980,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 18980 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T08:17:20.256729800Z","log.level":"INFO","process.pid":18980,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T08:17:22.171203900Z","log.level":"INFO","process.pid":18980,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.491 seconds (process running for 3.731)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T08:36:01.602371300Z","log.level":"INFO","process.pid":15980,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 15980 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T08:36:01.608341Z","log.level":"INFO","process.pid":15980,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T08:36:03.146454900Z","log.level":"INFO","process.pid":15980,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.055 seconds (process running for 3.15)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T08:41:59.441333900Z","log.level":"INFO","process.pid":14156,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 14156 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T08:41:59.447360Z","log.level":"INFO","process.pid":14156,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T08:42:00.967345600Z","log.level":"INFO","process.pid":14156,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 1.995 seconds (process running for 3.092)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T09:04:42.999341700Z","log.level":"INFO","process.pid":18848,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 18848 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T09:04:43.008365200Z","log.level":"INFO","process.pid":18848,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T09:04:45.431310200Z","log.level":"INFO","process.pid":18848,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 3.125 seconds (process running for 4.801)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T09:38:53.193947900Z","log.level":"INFO","process.pid":10880,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 10880 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T09:38:53.200484Z","log.level":"INFO","process.pid":10880,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T09:38:55.226375300Z","log.level":"INFO","process.pid":10880,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.507 seconds (process running for 3.716)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T09:44:15.428223500Z","log.level":"INFO","process.pid":21836,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 21836 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T09:44:15.438215900Z","log.level":"INFO","process.pid":21836,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T09:44:16.927268900Z","log.level":"INFO","process.pid":21836,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 1.968 seconds (process running for 3.16)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T09:47:54.022919800Z","log.level":"INFO","process.pid":24984,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 24984 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T09:47:54.030918800Z","log.level":"INFO","process.pid":24984,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T09:47:55.955495200Z","log.level":"INFO","process.pid":24984,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.448 seconds (process running for 3.591)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T09:49:45.291168600Z","log.level":"INFO","process.pid":20836,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 20836 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T09:49:45.297167300Z","log.level":"INFO","process.pid":20836,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T09:49:46.828682100Z","log.level":"INFO","process.pid":20836,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 1.994 seconds (process running for 3.093)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T09:53:07.279315Z","log.level":"INFO","process.pid":25072,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 25072 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T09:53:07.286315500Z","log.level":"INFO","process.pid":25072,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T09:53:08.864121700Z","log.level":"INFO","process.pid":25072,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.028 seconds (process running for 3.193)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T12:10:18.164651800Z","log.level":"INFO","process.pid":28300,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 28300 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T12:10:18.172651500Z","log.level":"INFO","process.pid":28300,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T12:10:19.745267700Z","log.level":"INFO","process.pid":28300,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.047 seconds (process running for 3.157)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T12:14:59.582298700Z","log.level":"INFO","process.pid":27480,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 27480 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T12:14:59.589299300Z","log.level":"INFO","process.pid":27480,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T12:15:01.111189500Z","log.level":"INFO","process.pid":27480,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 1.986 seconds (process running for 3.104)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T12:17:12.827823700Z","log.level":"INFO","process.pid":25856,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 25856 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T12:17:12.833491600Z","log.level":"INFO","process.pid":25856,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"} |
||||||
|
{"@timestamp":"2024-10-15T12:17:14.373969600Z","log.level":"INFO","process.pid":25856,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 1.987 seconds (process running for 3.053)","ecs.version":"8.11"} |
||||||
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,21 @@ |
|||||||
|
package gsp.technologies.face.config; |
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean; |
||||||
|
import org.springframework.context.annotation.Configuration; |
||||||
|
import org.springframework.web.reactive.function.client.ExchangeStrategies; |
||||||
|
import org.springframework.web.reactive.function.client.WebClient; |
||||||
|
|
||||||
|
@Configuration |
||||||
|
public class WebConfig { |
||||||
|
@Bean |
||||||
|
WebClient webClient() { |
||||||
|
final int maxInMemorySize = 1000 * 1024 * 1024; // 1000MB
|
||||||
|
final ExchangeStrategies exchangeStrategies = ExchangeStrategies.builder() |
||||||
|
.codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(maxInMemorySize)) |
||||||
|
.build(); |
||||||
|
WebClient webClient = WebClient.builder() |
||||||
|
.exchangeStrategies(exchangeStrategies) |
||||||
|
.build(); |
||||||
|
return webClient; |
||||||
|
} |
||||||
|
} |
@ -1,13 +1,137 @@ |
|||||||
package gsp.technologies.face.controllers.face.v1.mainframe; |
package gsp.technologies.face.controllers.face.v1.mainframe; |
||||||
|
|
||||||
|
import java.time.Duration; |
||||||
|
import java.util.Optional; |
||||||
|
|
||||||
|
import org.slf4j.Logger; |
||||||
|
import org.slf4j.LoggerFactory; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.core.ParameterizedTypeReference; |
||||||
|
import org.springframework.http.HttpMethod; |
||||||
|
import org.springframework.http.client.MultipartBodyBuilder; |
||||||
import org.springframework.stereotype.Controller; |
import org.springframework.stereotype.Controller; |
||||||
|
import org.springframework.ui.Model; |
||||||
import org.springframework.web.bind.annotation.GetMapping; |
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute; |
||||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||||
|
import org.springframework.web.multipart.MultipartFile; |
||||||
|
import org.springframework.web.reactive.function.BodyInserters; |
||||||
|
import org.springframework.web.reactive.function.client.WebClient; |
||||||
|
|
||||||
|
import gsp.technologies.face.models.FileMetadata; |
||||||
|
import gsp.technologies.face.models.Post; |
||||||
|
import gsp.technologies.face.teh.fs.MpFile; |
||||||
|
import reactor.core.publisher.Mono; |
||||||
|
|
||||||
@Controller |
@Controller |
||||||
|
@RequestMapping(path = "/face/v1") |
||||||
public class MainframeController { |
public class MainframeController { |
||||||
|
private static final Logger log = LoggerFactory.getLogger(MainframeController.class); |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private WebClient client; |
||||||
|
|
||||||
|
// @Autowired
|
||||||
|
// private Storage storage;
|
||||||
|
|
||||||
|
@GetMapping("/mainframe") |
||||||
|
public String mainframe(Model model) { |
||||||
|
log.info("GET /face/v1/mainframe"); |
||||||
|
|
||||||
|
//добавляем объект Post для отправки сведений о новом документе в базу
|
||||||
|
Post post = new Post(); |
||||||
|
model.addAttribute("newPost", post); |
||||||
|
|
||||||
@GetMapping("/face/v1/mainframe") |
|
||||||
public String mainframe(){ |
|
||||||
return "mainframe"; |
return "mainframe"; |
||||||
} |
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Загрузка файла на сервер, |
||||||
|
* |
||||||
|
* Реализация: |
||||||
|
* постим запись в базу ресурсов, получаем id документа |
||||||
|
* отправляем файл в хранилище с новым именем {id}.{ext} |
||||||
|
* |
||||||
|
* @param file |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@PostMapping("/document/upload") |
||||||
|
public String upload(@RequestParam("file") MultipartFile file, Model model, @ModelAttribute("post") Post post) { |
||||||
|
log.info("POST /face/v1/document/upload, file: {}, type: {}", file.getOriginalFilename(), post.getType()); |
||||||
|
|
||||||
|
//подготавливаем объект метаданных
|
||||||
|
FileMetadata metadata = new FileMetadata(); |
||||||
|
metadata.setName(file.getOriginalFilename()); |
||||||
|
metadata.setSize(file.getSize()); |
||||||
|
|
||||||
|
// получаем объект метаданных с id
|
||||||
|
metadata = client.post() |
||||||
|
.uri("http://source:8181/api/v1/metadata/create") |
||||||
|
.body(Mono.just(metadata), FileMetadata.class) |
||||||
|
.retrieve() |
||||||
|
.bodyToMono(new ParameterizedTypeReference <FileMetadata>(){}) |
||||||
|
.timeout(Duration.ofSeconds(1)) |
||||||
|
.block(); |
||||||
|
|
||||||
|
// Добавление файла в файловое хранилище
|
||||||
|
MultipartBodyBuilder builder = new MultipartBodyBuilder(); |
||||||
|
Boolean ok; |
||||||
|
MultipartFile out = new MpFile(file, metadata.getId() + "." + metadata.getExtension()); |
||||||
|
builder.part("file", out.getResource()); |
||||||
|
|
||||||
|
// Document doc = new Document();
|
||||||
|
// doc.setName(file.getOriginalFilename());
|
||||||
|
// doc.setSize(file.getSize());
|
||||||
|
|
||||||
|
// Optional<String> ext = Optional.ofNullable(file.getOriginalFilename())
|
||||||
|
// .filter(f -> f.contains("."))
|
||||||
|
// .map(f -> f.substring(file.getOriginalFilename().lastIndexOf(".") + 1));
|
||||||
|
// doc.setExtension(ext.get());
|
||||||
|
// doc.setExtension( ext.get());
|
||||||
|
|
||||||
|
// Добавление записи о файле в базу данных
|
||||||
|
// doc = client.post()
|
||||||
|
// .uri("http://resource-service-api:8181/storage-entry/create")
|
||||||
|
// .body(Mono.just(doc), Document.class)
|
||||||
|
// .retrieve()
|
||||||
|
// .bodyToMono(new ParameterizedTypeReference <Document>(){})
|
||||||
|
// .timeout(Duration.ofSeconds(1))
|
||||||
|
// .block();
|
||||||
|
|
||||||
|
// post.setDocument(doc);
|
||||||
|
// post = client.post()
|
||||||
|
// .uri("http://resource-service-api:8181/post/create")
|
||||||
|
// .body(Mono.just(post), Post.class)
|
||||||
|
// .retrieve()
|
||||||
|
// .bodyToMono(new ParameterizedTypeReference <Post>(){})
|
||||||
|
// .timeout(Duration.ofSeconds(1))
|
||||||
|
// .block();
|
||||||
|
|
||||||
|
// System.out.println("Пакет передан в ресурсный сервис ...");
|
||||||
|
// System.out.println("Пакет: " + post.toString());
|
||||||
|
|
||||||
|
// Добавление файла в файловое хранилище
|
||||||
|
// MultipartBodyBuilder builder = new MultipartBodyBuilder();
|
||||||
|
// Boolean ok;
|
||||||
|
// MultipartFile out = new MpFile(file, doc.getId() + "." + doc.getExtension());
|
||||||
|
// builder.part("file", out.getResource());
|
||||||
|
|
||||||
|
// ok = client.method(HttpMethod.POST)
|
||||||
|
// .uri("http://storage:8282/api/document/store")
|
||||||
|
// .body(BodyInserters
|
||||||
|
// .fromMultipartData(builder.build()))
|
||||||
|
// .retrieve()
|
||||||
|
// .bodyToMono(new ParameterizedTypeReference <Boolean>(){})
|
||||||
|
// .block();
|
||||||
|
|
||||||
|
|
||||||
|
// System.out.println("Файл добавлен в хранилище: " + ok);
|
||||||
|
// System.out.println("ID: " + doc.getId());
|
||||||
|
// System.out.println(doc.toString());
|
||||||
|
|
||||||
|
//переход на страницу импорта данных из документа
|
||||||
|
return "redirect:/face/v1/mainframe"; |
||||||
|
} |
||||||
} |
} |
||||||
|
@ -0,0 +1,21 @@ |
|||||||
|
package gsp.technologies.face.models; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
@AllArgsConstructor |
||||||
|
@NoArgsConstructor |
||||||
|
@Data |
||||||
|
public class Post implements Serializable { |
||||||
|
private long id; |
||||||
|
private String type;//тип документа (реестр/ списочный состав/ прочее)
|
||||||
|
private FileMetadata metadata; |
||||||
|
|
||||||
|
public Post(String type, FileMetadata metadata) { |
||||||
|
this.type = type; |
||||||
|
this.metadata = metadata; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,72 @@ |
|||||||
|
package gsp.technologies.face.teh.fs; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
import java.io.IOException; |
||||||
|
import java.io.InputStream; |
||||||
|
|
||||||
|
import org.springframework.lang.NonNull; |
||||||
|
import org.springframework.lang.Nullable; |
||||||
|
import org.springframework.web.multipart.MultipartFile; |
||||||
|
|
||||||
|
/** |
||||||
|
* Переопределены методы MultipartFile |
||||||
|
*/ |
||||||
|
public class MpFile implements MultipartFile{ |
||||||
|
private MultipartFile file; |
||||||
|
private String name; |
||||||
|
|
||||||
|
/** |
||||||
|
* @param file |
||||||
|
* @param name |
||||||
|
*/ |
||||||
|
public MpFile(MultipartFile file, String name) { |
||||||
|
this.file = file; |
||||||
|
this.name = name; |
||||||
|
} |
||||||
|
|
||||||
|
@NonNull |
||||||
|
@Override |
||||||
|
public byte[] getBytes() throws IOException { |
||||||
|
return file.getBytes(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
@Nullable |
||||||
|
public String getContentType() { |
||||||
|
return file.getContentType(); |
||||||
|
} |
||||||
|
|
||||||
|
@NonNull |
||||||
|
@Override |
||||||
|
public InputStream getInputStream() throws IOException { |
||||||
|
return file.getInputStream(); |
||||||
|
} |
||||||
|
|
||||||
|
@NonNull |
||||||
|
@Override |
||||||
|
public String getName() { |
||||||
|
return file.getName(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
@Nullable |
||||||
|
public String getOriginalFilename() { |
||||||
|
return this.name; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public long getSize() { |
||||||
|
return file.getSize(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean isEmpty() { |
||||||
|
return file.isEmpty(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void transferTo(File dest) throws IOException, IllegalStateException { |
||||||
|
//NO REALIZATION
|
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1,5 +1,10 @@ |
|||||||
# mainframe.md |
# Инструкция по работе с платформой (mainframe.md) |
||||||
Форма предоставляет пользователю доступ ко всему функционалу платформы |
Форма предоставляет пользователю доступ ко всему функционалу платформы |
||||||
- ссылка на страницу работы с файлами (загрузка, проверка файлов) |
- ссылка на страницу работы с файлами (загрузка, проверка файлов) |
||||||
- ссылка на страницу работы с данными базы (редактирование данных, формирование отчетов) |
- ссылка на страницу работы с данными базы (редактирование данных, формирование отчетов) |
||||||
- |
|
||||||
|
## Загрузка файлов на платформу |
||||||
|
### Общее |
||||||
|
- xlsx файл не должен содержать более 5 тыс. строк |
||||||
|
- все ячейки должны содержать значения (формулы платформа не пересчитает) |
||||||
|
### Реестры обученных |
||||||
|
@ -0,0 +1,13 @@ |
|||||||
|
<!DOCTYPE html> |
||||||
|
<html xmlns:th="http://www.thymeleaf.org"> |
||||||
|
<body> |
||||||
|
<div th:fragment="copy"> |
||||||
|
<hr> |
||||||
|
© 2024 ООО "ГСП-Технологии" |
||||||
|
</div> |
||||||
|
<div th:fragment="info"> |
||||||
|
<hr> |
||||||
|
<zero-md th:src="@{/content/md/mainframe.md}"></zero-md> |
||||||
|
</div> |
||||||
|
</body> |
||||||
|
</html> |
@ -0,0 +1,25 @@ |
|||||||
|
version: "3.7" |
||||||
|
services: |
||||||
|
source: |
||||||
|
container_name: source |
||||||
|
hostname: source |
||||||
|
build: |
||||||
|
context: ../source |
||||||
|
dockerfile: dockerfile |
||||||
|
image: "source" |
||||||
|
command: ["java","-jar","/app/source/source-0.1.jar"] |
||||||
|
volumes: |
||||||
|
- teh-logs:${LOGGER_DATA} |
||||||
|
ports: |
||||||
|
- 81:8181 |
||||||
|
restart: unless-stopped |
||||||
|
networks: |
||||||
|
- teh-net |
||||||
|
volumes: |
||||||
|
teh-logs: |
||||||
|
external: true |
||||||
|
networks: |
||||||
|
teh-net: |
||||||
|
name: teh-net |
||||||
|
external: true |
||||||
|
driver: bridge |
@ -0,0 +1,8 @@ |
|||||||
|
FROM openjdk:17-jdk-alpine |
||||||
|
RUN apk update |
||||||
|
RUN apk upgrade |
||||||
|
COPY target/source-0.1.jar /app/source/source-0.1.jar |
||||||
|
WORKDIR /app/source |
||||||
|
# ENTRYPOINT ["java","-jar","/app/resource-service-api-0.1.jar"] |
||||||
|
# docker image build -t resource-service-api:latest . |
||||||
|
# docker run -p80:8181 resource-service-api:latest |
@ -0,0 +1,86 @@ |
|||||||
|
package gsp.technologies.source.controllers.api.v1; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.http.HttpStatus; |
||||||
|
import org.springframework.http.MediaType; |
||||||
|
import org.springframework.http.ResponseEntity; |
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||||
|
import org.springframework.web.bind.annotation.PutMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
import gsp.technologies.source.models.FileMetadata; |
||||||
|
import gsp.technologies.source.models.Post; |
||||||
|
import gsp.technologies.source.repositories.FileMetadataRepository; |
||||||
|
import gsp.technologies.source.repositories.PostRepository; |
||||||
|
|
||||||
|
/** |
||||||
|
* Контроллер для работы с таблицей, хранящей сведения о файлах в файловом хранилище |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequestMapping(path = "/api/v1/storage") |
||||||
|
public class StorageController { |
||||||
|
@Autowired |
||||||
|
private FileMetadataRepository metaRepo; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private PostRepository postRepo; |
||||||
|
|
||||||
|
@GetMapping("/metadata/list") |
||||||
|
public ResponseEntity<List<FileMetadata>> getStorageEntries(){ |
||||||
|
return new ResponseEntity<>(metaRepo.findAll(), HttpStatus.OK); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/post/list") |
||||||
|
public ResponseEntity<List<Post>> getPostList(){ |
||||||
|
return new ResponseEntity<>(postRepo.findAll(), HttpStatus.OK); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/metadata/{id}") |
||||||
|
public ResponseEntity<?> getStorageEntryByID(@PathVariable Integer id){ |
||||||
|
return new ResponseEntity<>(metaRepo.findById(id), HttpStatus.OK); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping(path = "/metadata/create", |
||||||
|
consumes = MediaType.APPLICATION_JSON_VALUE, |
||||||
|
produces = MediaType.APPLICATION_JSON_VALUE) |
||||||
|
public ResponseEntity<?> saveStorageEntry(@RequestBody FileMetadata metadata) { |
||||||
|
metaRepo.save(metadata); |
||||||
|
return new ResponseEntity<>(metadata, HttpStatus.CREATED); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping(path = "/post/create", |
||||||
|
consumes = MediaType.APPLICATION_JSON_VALUE, |
||||||
|
produces = MediaType.APPLICATION_JSON_VALUE) |
||||||
|
public ResponseEntity<?> savePost(@RequestBody Post post) { |
||||||
|
postRepo.save(post); |
||||||
|
return new ResponseEntity<>(post, HttpStatus.CREATED); |
||||||
|
} |
||||||
|
|
||||||
|
@PutMapping(path = "/metadata/update/{id}", |
||||||
|
consumes = MediaType.APPLICATION_JSON_VALUE, |
||||||
|
produces = MediaType.APPLICATION_JSON_VALUE) |
||||||
|
public ResponseEntity<?> updateStorageEntry(@PathVariable Integer id, @RequestBody FileMetadata metadata) { |
||||||
|
FileMetadata meta = metaRepo.findById(id); |
||||||
|
|
||||||
|
meta.setName(metadata.getName()); |
||||||
|
meta.setRelativePath(metadata.getRelativePath()); |
||||||
|
meta.setExtension(metadata.getExtension()); |
||||||
|
meta.setSize(metadata.getSize()); |
||||||
|
metaRepo.save(meta); |
||||||
|
return new ResponseEntity<>(metaRepo.findById(id), HttpStatus.CREATED); |
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping("/metadata/delete/{id}") |
||||||
|
public ResponseEntity<String> deleteStorageEntry(@PathVariable Integer id){ |
||||||
|
FileMetadata meta= metaRepo.findById(id); |
||||||
|
metaRepo.delete(meta); |
||||||
|
return new ResponseEntity<>("Запись id#" + id + " удалена ... ", HttpStatus.OK); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
package gsp.technologies.source.models; |
||||||
|
|
||||||
|
import jakarta.persistence.Column; |
||||||
|
import jakarta.persistence.Entity; |
||||||
|
import jakarta.persistence.GeneratedValue; |
||||||
|
import jakarta.persistence.GenerationType; |
||||||
|
import jakarta.persistence.Id; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
/** |
||||||
|
* Сущность объекта строительства |
||||||
|
*/ |
||||||
|
@NoArgsConstructor |
||||||
|
@AllArgsConstructor |
||||||
|
@Entity |
||||||
|
@Data |
||||||
|
public class Building { |
||||||
|
@Id |
||||||
|
@GeneratedValue(strategy=GenerationType.AUTO) |
||||||
|
private long id; |
||||||
|
@Column(length=50) |
||||||
|
private String nameShort;//Сокращенное наименование
|
||||||
|
private String nameFull;//Полное наименование
|
||||||
|
private String codeShort;//Краткий код
|
||||||
|
private String codeFull;//Полный код
|
||||||
|
|
||||||
|
// подготовить конструкторы на все варианты внесения информации о преподавателях
|
||||||
|
public Building(String name_short, String name_full, String code_short, String code_full){ |
||||||
|
this.nameShort = name_short; |
||||||
|
this.nameFull = name_full; |
||||||
|
this.codeShort = code_short; |
||||||
|
this.codeFull = code_full; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,47 @@ |
|||||||
|
package gsp.technologies.source.models; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
import org.hibernate.annotations.OnDelete; |
||||||
|
import org.hibernate.annotations.OnDeleteAction; |
||||||
|
|
||||||
|
import jakarta.persistence.Entity; |
||||||
|
import jakarta.persistence.FetchType; |
||||||
|
import jakarta.persistence.GeneratedValue; |
||||||
|
import jakarta.persistence.GenerationType; |
||||||
|
import jakarta.persistence.Id; |
||||||
|
import jakarta.persistence.ManyToOne; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Сведения о курсе (учебном потоке) |
||||||
|
*/ |
||||||
|
@NoArgsConstructor |
||||||
|
@AllArgsConstructor |
||||||
|
@Entity |
||||||
|
@Data |
||||||
|
public class Course { |
||||||
|
@Id |
||||||
|
@GeneratedValue(strategy=GenerationType.AUTO) |
||||||
|
private long id;//уникальный идентификатор курса
|
||||||
|
private String place;//место проведения занятий
|
||||||
|
private Date startDate;//дата начала курса
|
||||||
|
private Date protocolDate;//дата протокола
|
||||||
|
private String protocolNumber;//номер протоколаssss
|
||||||
|
private String reportPeriod;//отчетный период (наименование месяца)
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.EAGER, optional = false) |
||||||
|
@OnDelete(action = OnDeleteAction.SET_NULL) |
||||||
|
private Teacher teacher;//сведения о преподаватле
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.EAGER, optional = false) |
||||||
|
@OnDelete(action = OnDeleteAction.SET_NULL) |
||||||
|
private Program program;//сведения о программе обучения
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.EAGER, optional = false) |
||||||
|
@OnDelete(action = OnDeleteAction.SET_NULL) |
||||||
|
private Building building;//сведения об объекте строительства
|
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
package gsp.technologies.source.models; |
||||||
|
|
||||||
|
import org.hibernate.annotations.OnDelete; |
||||||
|
import org.hibernate.annotations.OnDeleteAction; |
||||||
|
|
||||||
|
import jakarta.persistence.Entity; |
||||||
|
import jakarta.persistence.FetchType; |
||||||
|
import jakarta.persistence.GeneratedValue; |
||||||
|
import jakarta.persistence.GenerationType; |
||||||
|
import jakarta.persistence.Id; |
||||||
|
import jakarta.persistence.ManyToOne; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
@NoArgsConstructor |
||||||
|
@AllArgsConstructor |
||||||
|
@Entity |
||||||
|
@Data |
||||||
|
public class EducationEntry { |
||||||
|
@Id |
||||||
|
@GeneratedValue(strategy=GenerationType.AUTO) |
||||||
|
private long id; |
||||||
|
private String sertificateNumber;//Номер удостоверения
|
||||||
|
private String frdoNumber;//ФРДО номер по реестру
|
||||||
|
private String eisotNumber;//ЕИСОТ номер по реестру
|
||||||
|
private String ones;//Единички (вспомогатльный столбец)
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.EAGER, optional = false) |
||||||
|
@OnDelete(action = OnDeleteAction.SET_NULL) |
||||||
|
private Course course;//Сведения о курсе
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.EAGER, optional = false) |
||||||
|
@OnDelete(action = OnDeleteAction.SET_NULL) |
||||||
|
private Student student;//Сведения о студенте
|
||||||
|
} |
@ -0,0 +1,44 @@ |
|||||||
|
package gsp.technologies.source.models; |
||||||
|
|
||||||
|
import jakarta.persistence.Entity; |
||||||
|
import jakarta.persistence.GeneratedValue; |
||||||
|
import jakarta.persistence.GenerationType; |
||||||
|
import jakarta.persistence.Id; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
/** |
||||||
|
* Сущность для хранения сведений об организации - контрагенте |
||||||
|
* - ПСК |
||||||
|
*/ |
||||||
|
@NoArgsConstructor |
||||||
|
@AllArgsConstructor |
||||||
|
@Entity |
||||||
|
@Data |
||||||
|
public class Organization { |
||||||
|
@Id |
||||||
|
@GeneratedValue(strategy=GenerationType.AUTO) |
||||||
|
private long id; |
||||||
|
private String ownership;//Форма собственности ПСК
|
||||||
|
private String nameShort;//Сокращенное наименование
|
||||||
|
private String nameFull;//Полное наименование
|
||||||
|
private String type;//вид ПСК - производственная/сервисная
|
||||||
|
private String inn;//ИНН организации
|
||||||
|
|
||||||
|
/** |
||||||
|
* подготовить конструкторы на все варианты внесения информации о преподавателях |
||||||
|
* @param ownership |
||||||
|
* @param name_short |
||||||
|
* @param name_full |
||||||
|
* @param type |
||||||
|
* @param inn |
||||||
|
*/ |
||||||
|
public Organization(String ownership, String name_short, String name_full, String type, String inn) { |
||||||
|
this.ownership = ownership; |
||||||
|
this.nameShort = name_short; |
||||||
|
this.nameFull = name_full; |
||||||
|
this.type = type; |
||||||
|
this.inn = inn; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,21 @@ |
|||||||
|
package gsp.technologies.source.models; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
@AllArgsConstructor |
||||||
|
@NoArgsConstructor |
||||||
|
@Data |
||||||
|
public class Post implements Serializable { |
||||||
|
private Long id; |
||||||
|
private String type;//тип документа (реестр/ списочный состав/ прочее)
|
||||||
|
private FileMetadata metadata; |
||||||
|
|
||||||
|
public Post(String type, FileMetadata metadata) { |
||||||
|
this.type = type; |
||||||
|
this.metadata = metadata; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
package gsp.technologies.source.models; |
||||||
|
|
||||||
|
import org.hibernate.annotations.OnDelete; |
||||||
|
import org.hibernate.annotations.OnDeleteAction; |
||||||
|
|
||||||
|
import jakarta.persistence.Entity; |
||||||
|
import jakarta.persistence.FetchType; |
||||||
|
import jakarta.persistence.GeneratedValue; |
||||||
|
import jakarta.persistence.GenerationType; |
||||||
|
import jakarta.persistence.Id; |
||||||
|
import jakarta.persistence.ManyToOne; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
@NoArgsConstructor |
||||||
|
@AllArgsConstructor |
||||||
|
@Entity |
||||||
|
@Data |
||||||
|
public class Program { |
||||||
|
@Id |
||||||
|
@GeneratedValue(strategy=GenerationType.AUTO) |
||||||
|
private long id; |
||||||
|
private String name;//Наименование
|
||||||
|
private Integer lenght;//длительность программы
|
||||||
|
private String studyDirection;//направление обучения: обязательное-производственное (учесть в ограничениях)
|
||||||
|
private Integer price; |
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.EAGER, optional = false) |
||||||
|
@OnDelete(action = OnDeleteAction.SET_NULL) |
||||||
|
private ProgramCretarea cretarea; |
||||||
|
} |
@ -0,0 +1,42 @@ |
|||||||
|
package gsp.technologies.source.models; |
||||||
|
|
||||||
|
import jakarta.persistence.Entity; |
||||||
|
import jakarta.persistence.GeneratedValue; |
||||||
|
import jakarta.persistence.GenerationType; |
||||||
|
import jakarta.persistence.Id; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
/** |
||||||
|
* Сущность критериев программы обучения: |
||||||
|
* - от |
||||||
|
* - в |
||||||
|
* - стр |
||||||
|
* - птм |
||||||
|
* - итд ... |
||||||
|
* |
||||||
|
* Одному критерию может соответствовать группа программ обучения. |
||||||
|
*/ |
||||||
|
@NoArgsConstructor |
||||||
|
@AllArgsConstructor |
||||||
|
@Entity |
||||||
|
@Data |
||||||
|
public class ProgramCretarea { |
||||||
|
@Id |
||||||
|
@GeneratedValue(strategy=GenerationType.AUTO) |
||||||
|
private long id; |
||||||
|
private String name;//Наименование
|
||||||
|
private String nameShort;//Наименование : сокращенно
|
||||||
|
|
||||||
|
/** |
||||||
|
* подготовить конструкторы на все варианты внесения информации о преподавателях |
||||||
|
* |
||||||
|
* @param name |
||||||
|
* @param name_short |
||||||
|
*/ |
||||||
|
public ProgramCretarea(String name, String nameShort) { |
||||||
|
this.name = name; |
||||||
|
this.nameShort = nameShort; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,44 @@ |
|||||||
|
package gsp.technologies.source.models; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
import org.hibernate.annotations.OnDelete; |
||||||
|
import org.hibernate.annotations.OnDeleteAction; |
||||||
|
|
||||||
|
import jakarta.persistence.Entity; |
||||||
|
import jakarta.persistence.FetchType; |
||||||
|
import jakarta.persistence.GeneratedValue; |
||||||
|
import jakarta.persistence.GenerationType; |
||||||
|
import jakarta.persistence.Id; |
||||||
|
import jakarta.persistence.ManyToOne; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
/** |
||||||
|
* Сведения об обученных |
||||||
|
*/ |
||||||
|
@NoArgsConstructor |
||||||
|
@AllArgsConstructor |
||||||
|
@Entity |
||||||
|
@Data |
||||||
|
public class Student { |
||||||
|
@Id |
||||||
|
@GeneratedValue(strategy=GenerationType.AUTO) |
||||||
|
private long id; |
||||||
|
private String firstName;//Имя
|
||||||
|
private String secondName;//Отчество
|
||||||
|
private String lastName;//Фамилия
|
||||||
|
private String profession;//Профессия
|
||||||
|
private String category;//Категория (ИТР или рабочий)
|
||||||
|
private String direction;//Структурное подразделение
|
||||||
|
private String snils;//СНИЛС
|
||||||
|
private Date berth;//Дата рождения
|
||||||
|
private String sitizenship;//Гражданство
|
||||||
|
private String sex;//Пол (м/ж)
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.EAGER, optional = false) |
||||||
|
@OnDelete(action = OnDeleteAction.SET_NULL) |
||||||
|
private Organization organization;//Организация - работодатель
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,72 @@ |
|||||||
|
package gsp.technologies.source.models; |
||||||
|
|
||||||
|
import gsp.technologies.source.teh.strings.Naimer; |
||||||
|
import jakarta.persistence.Entity; |
||||||
|
import jakarta.persistence.GeneratedValue; |
||||||
|
import jakarta.persistence.GenerationType; |
||||||
|
import jakarta.persistence.Id; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Сущьность преподавателя |
||||||
|
* добавить данные: |
||||||
|
* - телефоны (список) |
||||||
|
* - эл почты (список) |
||||||
|
* - программы которые преподает |
||||||
|
* - график работы |
||||||
|
* - основное место работы (офис, наимеование ОП) |
||||||
|
*/ |
||||||
|
@NoArgsConstructor |
||||||
|
@AllArgsConstructor |
||||||
|
@Entity |
||||||
|
@Data |
||||||
|
public class Teacher{ |
||||||
|
@Id |
||||||
|
@GeneratedValue(strategy=GenerationType.AUTO) |
||||||
|
private long id; |
||||||
|
private String secondName;//Фамилия
|
||||||
|
private String firstName;//Имя
|
||||||
|
private String lastName;//Отчество
|
||||||
|
private String employeeId; |
||||||
|
private String snils; |
||||||
|
|
||||||
|
// подготовить конструкторы на все варианты внесения информации о преподавателях
|
||||||
|
public Teacher(String second_name, String first_name, String last_name){ |
||||||
|
setSecondName(second_name); |
||||||
|
setFirstName(first_name); |
||||||
|
setLastName(last_name); |
||||||
|
} |
||||||
|
|
||||||
|
public Teacher(String fio){ |
||||||
|
setSecondName(Naimer.getSecondNameOf(fio)); |
||||||
|
setFirstName(Naimer.getFirstNameOf(fio)); |
||||||
|
setLastName(Naimer.getLastNameOf(fio)); |
||||||
|
} |
||||||
|
|
||||||
|
public String fio(){ |
||||||
|
return Naimer.getFioOf(this); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* проверка совпадения ФИО |
||||||
|
* @param teacher |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public boolean like(Teacher teacher) { |
||||||
|
return this.fio().equals(teacher.fio()); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* проверка совпадения всех полей кроме id |
||||||
|
* @param teacher |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public boolean isSimilar(Teacher teacher) { |
||||||
|
return this.fio().equals(teacher.fio())&& |
||||||
|
this.getEmployeeId().equals(teacher.getEmployeeId())&& |
||||||
|
this.getSnils().equals(teacher.getSnils()); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
package gsp.technologies.source.repositories; |
||||||
|
|
||||||
|
import org.springframework.data.domain.Page; |
||||||
|
import org.springframework.data.domain.PageRequest; |
||||||
|
import org.springframework.data.jpa.repository.JpaRepository; |
||||||
|
import org.springframework.stereotype.Repository; |
||||||
|
|
||||||
|
import gsp.technologies.source.models.FileMetadata; |
||||||
|
|
||||||
|
@Repository |
||||||
|
public interface FileMetadataRepository extends JpaRepository<FileMetadata, Long> { |
||||||
|
FileMetadata findById(long id); |
||||||
|
Page<FileMetadata> findById(PageRequest of, Long id); |
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
package gsp.technologies.source.repositories; |
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository; |
||||||
|
import org.springframework.stereotype.Repository; |
||||||
|
|
||||||
|
import gsp.technologies.source.models.Post; |
||||||
|
|
||||||
|
@Repository |
||||||
|
public interface PostRepository extends JpaRepository<Post, Long> { |
||||||
|
} |
@ -0,0 +1,15 @@ |
|||||||
|
package gsp.technologies.source.services; |
||||||
|
|
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import gsp.technologies.source.repositories.FileMetadataRepository; |
||||||
|
|
||||||
|
@Service |
||||||
|
public class FileMetadataService { |
||||||
|
private final FileMetadataRepository repo; |
||||||
|
|
||||||
|
public FileMetadataService(FileMetadataRepository repo) { |
||||||
|
this.repo = repo; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,15 @@ |
|||||||
|
package gsp.technologies.source.services; |
||||||
|
|
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import gsp.technologies.source.repositories.PostRepository; |
||||||
|
|
||||||
|
@Service |
||||||
|
public class PostService { |
||||||
|
private final PostRepository repo; |
||||||
|
|
||||||
|
public PostService(PostRepository repo){ |
||||||
|
this.repo = repo; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,51 @@ |
|||||||
|
package gsp.technologies.source.teh.strings; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public class Arrayer { |
||||||
|
|
||||||
|
/** |
||||||
|
* Удаляет все пустые строки из массива строк и возвращает новый массив с оставшимися строками. |
||||||
|
* |
||||||
|
* @param strings Массив строк из которогу удаляются пустые строки. |
||||||
|
* @return Новый массив с оставшимися строками. |
||||||
|
*/ |
||||||
|
public static String[] removeEmptyStrings(String[] strings) { |
||||||
|
|
||||||
|
// Подсчет количества непустых строк в входном массиве
|
||||||
|
int count = 0; |
||||||
|
for (String string : strings) { |
||||||
|
if (!string.equals("")) { |
||||||
|
count++; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// Новый массив для хранения непустых строк
|
||||||
|
String[] result = new String[count]; |
||||||
|
|
||||||
|
// Копирование непустых строк из входного массива в новый массив
|
||||||
|
int index = 0; |
||||||
|
for (String string : strings) { |
||||||
|
if (!string.equals("")) { |
||||||
|
result[index] = string; |
||||||
|
index++; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// Возвращение нового массива с непустыми строками
|
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Удаление повторяющихся элементов списка строк |
||||||
|
* Получение списка уникальных строк |
||||||
|
* |
||||||
|
*/ |
||||||
|
public static List<String> uniqueList(List<String> list) { |
||||||
|
// Удаление повторяющихся элементов списка
|
||||||
|
List<String> result = list.stream().distinct().toList(); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package gsp.technologies.source.teh.strings; |
||||||
|
|
||||||
|
import java.time.LocalDate; |
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* Обработка строк с датами |
||||||
|
*/ |
||||||
|
public class Dater { |
||||||
|
private Long longDate; |
||||||
|
private String stringDate; |
||||||
|
private Date date; |
||||||
|
private LocalDate localDate; |
||||||
|
private LocalDateTime localDateTime; |
||||||
|
} |
@ -0,0 +1,237 @@ |
|||||||
|
package gsp.technologies.source.teh.strings; |
||||||
|
|
||||||
|
import gsp.technologies.source.models.Teacher; |
||||||
|
|
||||||
|
/** |
||||||
|
* Обработка строк, содержащих сведения о ФИО |
||||||
|
* - Teacher |
||||||
|
* - Student |
||||||
|
* - Person |
||||||
|
*/ |
||||||
|
public class Naimer { |
||||||
|
private static String not = "Нет"; |
||||||
|
/** |
||||||
|
* Объединяет фамилию, имя и отчество в одну строку. |
||||||
|
* Возможые ситуации: |
||||||
|
* - фамилия, имя или отчество могут содержать нулевые значения |
||||||
|
* - отчество может содержать приписки |
||||||
|
* |
||||||
|
* @param second_name - фамилия |
||||||
|
* @param first_name - имя |
||||||
|
* @param last_name - отчество |
||||||
|
* @return объединенную строку или пустую строку, |
||||||
|
* если все входящие параметры являются нулевыми значениями |
||||||
|
*/ |
||||||
|
public static String getFioOf(String second_name, String first_name, String last_name) { |
||||||
|
// Инициализируем StringBuilder для хранения результата.
|
||||||
|
StringBuilder result = new StringBuilder(); |
||||||
|
|
||||||
|
// Проверяем, является ли фамилия нулевым значением.
|
||||||
|
if (!Stringer.checkForEmpty(second_name)) { |
||||||
|
// Если фамилия не является нулевым значением, то добавляем ее в строку.
|
||||||
|
result.append(second_name); |
||||||
|
} else { |
||||||
|
// Если фамилия является нулевым значением, то добавляем "Нет" в строку.
|
||||||
|
result.append(not); |
||||||
|
} |
||||||
|
|
||||||
|
// Проверяем, является ли имя нулевым значением.
|
||||||
|
if (!Stringer.checkForEmpty(first_name)) { |
||||||
|
// Если имя не является нулевым значением, то добавляем пробел и имя в строку.
|
||||||
|
result.append(" " + first_name); |
||||||
|
} else { |
||||||
|
// Если имя является нулевым значением, то добавляем "Нет" в строку.
|
||||||
|
result.append(" " + not); |
||||||
|
} |
||||||
|
|
||||||
|
// Проверяем, является ли отчество нулевым значением.
|
||||||
|
if (!Stringer.checkForEmpty(last_name)) { |
||||||
|
// Если отчество не является нулевым значением, то добавляем пробел и отчество в строку.
|
||||||
|
result.append(" " + last_name); |
||||||
|
} else { |
||||||
|
// Если отчество является нулевым значением, то добавляем "Нет" в строку.
|
||||||
|
result.append(" " + not); |
||||||
|
} |
||||||
|
|
||||||
|
// Возвращаем объединенную строку или строку "Нет Нет Нет",
|
||||||
|
//если все входящие параметры являются нулевыми значениями.
|
||||||
|
return result.toString().trim(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Объединяет фамилию, имя и отчество из объекта преподавателя в одну строку. |
||||||
|
* Возможные ситуации: |
||||||
|
* - фамилия, имя или отчество могут содержать нулевые значения |
||||||
|
* - отчество может содержать приписки |
||||||
|
* |
||||||
|
* @param teacher - объект преподавателя |
||||||
|
* @return объединенная строка или строка "Нет Нет Нет", |
||||||
|
* если все входящие параметры являются нулевыми значениями |
||||||
|
*/ |
||||||
|
public static String getFioOf(Teacher teacher) { |
||||||
|
// Инициализируем StringBuilder для хранения результата.
|
||||||
|
StringBuilder result = new StringBuilder(); |
||||||
|
|
||||||
|
// Проверяем, является ли фамилия нулевым значением.
|
||||||
|
if (!Stringer.checkForEmpty(teacher.getSecondName())) { |
||||||
|
// Если фамилия не является нулевым значением, то добавляем ее в строку.
|
||||||
|
result.append(teacher.getSecondName()); |
||||||
|
} else { |
||||||
|
// Если фамилия является нулевым значением, то добавляем "Нет" в строку.
|
||||||
|
result.append(not); |
||||||
|
} |
||||||
|
|
||||||
|
// Проверяем, является ли имя нулевым значением.
|
||||||
|
if (!Stringer.checkForEmpty(teacher.getFirstName())) { |
||||||
|
// Если имя не является нулевым значением, то добавляем пробел и имя в строку.
|
||||||
|
result.append(" " + teacher.getFirstName()); |
||||||
|
} else { |
||||||
|
// Если имя является нулевым значением, то добавляем "Нет" в строку.
|
||||||
|
result.append(" " + not); |
||||||
|
} |
||||||
|
|
||||||
|
// Проверяем, является ли отчество нулевым значением.
|
||||||
|
if (!Stringer.checkForEmpty(teacher.getLastName())) { |
||||||
|
// Если отчество не является нулевым значением, то добавляем пробел и отчество в строку.
|
||||||
|
result.append(" " + teacher.getLastName()); |
||||||
|
} else { |
||||||
|
// Если отчество является нулевым значением, то добавляем "Нет" в строку.
|
||||||
|
result.append(" " + not); |
||||||
|
} |
||||||
|
|
||||||
|
// Возвращаем объединенную строку или строку "Нет Нет Нет", если все входящие параметры
|
||||||
|
// являются нулевыми значениями.
|
||||||
|
return result.toString().trim(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Извлекает фамилию из строки, содержащей полное имя (ФИО). |
||||||
|
* Строка ФИО может содержать: |
||||||
|
* - пустую строку (null, empty, "") |
||||||
|
* - одно слово (фамилия, "Нет", односложный комментарий) |
||||||
|
* - два слова (фамилия, имя, "Нет") |
||||||
|
* - три слова (фамилия, имя, отчество, "Нет") |
||||||
|
* - четыре слова (фамилия, имя, отчество, постфикс отчества, комментарии) |
||||||
|
* - и более. |
||||||
|
* |
||||||
|
* Все слова начиная с пятого однозначно являются бесполезным наполнением, однако |
||||||
|
* такие слова должны включены в строку отчества, если они есть. |
||||||
|
* |
||||||
|
* Строка может быть извлечена из xlsx файла |
||||||
|
* или сгенерирована из данныых содержащихся в базе данных |
||||||
|
* |
||||||
|
* @param fio строка, содержащая ФИО |
||||||
|
* @return строка, содержащая первое слово из fio которое является фамилией или содержит слово "Нет" |
||||||
|
*/ |
||||||
|
public static String getSecondNameOf(String fio) { |
||||||
|
// Инициализируем StringBuilder для хранения результата.
|
||||||
|
StringBuilder result = new StringBuilder(); |
||||||
|
|
||||||
|
// Проверяем, является ли строка null, пустой строкой или состоит только из пробелов.
|
||||||
|
if (Stringer.checkForEmpty(fio)) { |
||||||
|
// Если строка является нулевым значением, то добавляем "Нет" в строку.
|
||||||
|
result.append(not); |
||||||
|
} else { |
||||||
|
//убираем пробелы в начале и в конце строки
|
||||||
|
fio = fio.trim(); |
||||||
|
|
||||||
|
// Разделяем строку на пробелы и возвращаем первую часть, которая как ожидается является фамилией
|
||||||
|
result.append(fio.split(" ")[0]); |
||||||
|
} |
||||||
|
|
||||||
|
// Возвращаем первое слово в строке или строку "Нет"
|
||||||
|
return result.toString().trim(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Извлекает имя (фамилия, имя или отчество) из строки, предположительно содержащей только одно слово. |
||||||
|
* - проверяет не пустая ли строка, если нет, то добавляет "Нет" |
||||||
|
* - очищает строку от лишних пробельных символов |
||||||
|
* - возвращает имя или "Нет" |
||||||
|
* |
||||||
|
* @param name |
||||||
|
* @return name |
||||||
|
*/ |
||||||
|
public static String getNameOf(String name) { |
||||||
|
// Проверяем, является ли строка null, пустой строкой или состоит только из пробелов.
|
||||||
|
if (Stringer.checkForEmpty(name)) { |
||||||
|
// Если строка является нулевым значением, то добавляем "Нет" в строку.
|
||||||
|
return not; |
||||||
|
} else { |
||||||
|
//очищаем строку
|
||||||
|
name = Stringer.clear(name); |
||||||
|
// возвращаем имя
|
||||||
|
return name; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Извлекает имя из строки, содержащей полное имя (ФИО). |
||||||
|
* |
||||||
|
* @param fio строка, содержащая ФИО |
||||||
|
* @return строка, содержащая второе слово из fio которое является именем или содержит слово "Нет" |
||||||
|
*/ |
||||||
|
public static String getFirstNameOf(String fio) { |
||||||
|
// Создаем StringBuilder для хранения результата
|
||||||
|
StringBuilder result = new StringBuilder(); |
||||||
|
|
||||||
|
// Проверяем, является ли строка null, пустой строкой или состоит только из пробелов.
|
||||||
|
if (Stringer.checkForEmpty(fio)) { |
||||||
|
// Если строка является нулевым значением, то добавляем "Нет" в строку.
|
||||||
|
result.append(not); |
||||||
|
} else { |
||||||
|
//убираем излишние пробельные символы
|
||||||
|
fio = Stringer.clear(fio); |
||||||
|
|
||||||
|
// Разбиваем строку по пробелам и пишем слова в массив
|
||||||
|
String[] strings = fio.split(" "); |
||||||
|
|
||||||
|
// Если массив содержит два или более слов, то второе слово является именем.
|
||||||
|
if (strings.length > 1) { |
||||||
|
// Пишем второе слово в результат
|
||||||
|
result.append(strings[1].trim()); |
||||||
|
}else { |
||||||
|
// Если массив содержит только одно слово, то добавляем "Нет" в строку.
|
||||||
|
result.append(not); |
||||||
|
} |
||||||
|
} |
||||||
|
// Возвращаем второе слово в строке или строку "Нет"
|
||||||
|
return result.toString().trim(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Извлекает отчество из строки, содержащей полное имя (ФИО). |
||||||
|
* @param fio строка, содержащая ФИО |
||||||
|
* @return строка, содержащая третье слово из fio которое является отчеством\ |
||||||
|
* или содержит слово "Нет" |
||||||
|
* или содержит все слова, содержащиеся в ФИО, за исключением первых двух |
||||||
|
*/ |
||||||
|
public static String getLastNameOf(String fio) { |
||||||
|
// Создаем StringBuilder для хранения результата
|
||||||
|
StringBuilder result = new StringBuilder(); |
||||||
|
|
||||||
|
// Проверяем, является ли строка null, пустой строкой или состоит только из пробелов.
|
||||||
|
if (Stringer.checkForEmpty(fio)) { |
||||||
|
// Если строка является нулевым значением, то добавляем "Нет" в строку.
|
||||||
|
result.append(not); |
||||||
|
} else { |
||||||
|
//убираем пробелы в начале и в конце строки
|
||||||
|
fio = fio.trim(); |
||||||
|
fio = Stringer.clear(fio); |
||||||
|
|
||||||
|
String[] strings = fio.split(" "); |
||||||
|
if (strings.length > 2) { |
||||||
|
// Пишем третье и последующие слова в результат
|
||||||
|
for (int i = 2; i < strings.length; i++) { |
||||||
|
result.append(strings[i]).append(" "); |
||||||
|
} |
||||||
|
} else { |
||||||
|
// Если массив содержит только два или менее слов, то добавляем "Нет" в строку.
|
||||||
|
result.append(not); |
||||||
|
} |
||||||
|
} |
||||||
|
// Возвращаем строку ФИО без первых двух слов с удаленными лишними пробелами
|
||||||
|
return result.toString().trim(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,54 @@ |
|||||||
|
package gsp.technologies.source.teh.strings; |
||||||
|
|
||||||
|
/** |
||||||
|
* Класс для работы со строками |
||||||
|
*/ |
||||||
|
public class Stringer { |
||||||
|
|
||||||
|
/** |
||||||
|
* Проверяет, является ли переданная строка null, пустой строкой или состоит только из пробелов. |
||||||
|
* |
||||||
|
* @param str Строка для проверки |
||||||
|
* @return True если строка является null, пустой строкой или состоит только из пробелов |
||||||
|
* False в противном случае |
||||||
|
*/ |
||||||
|
public static Boolean checkForEmpty(String str) { |
||||||
|
// Check if the string is null
|
||||||
|
if (str == null) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
// Check if the string is empty or consists only of whitespace characters
|
||||||
|
if (str.isEmpty() || str.trim().isEmpty()) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
// The string is not null, not empty and does not consist only of whitespace characters
|
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Удаляет регулярным выражением лишние пробельные символы из строки. |
||||||
|
* |
||||||
|
* Заменяет знаки переноса строки на пробелы с помощью использования регулярного выражения |
||||||
|
* \s+ - пробелы (и все ниже приведенные пробельные символы) |
||||||
|
* \t - табуляция |
||||||
|
* \v - вертикальная табуляция |
||||||
|
* \r - перенос в начало строки |
||||||
|
* \n - перенос строки |
||||||
|
* \f - форматированный перенос строки |
||||||
|
* |
||||||
|
* Осавляет по одному пробелу между словами, если слов больше одного |
||||||
|
* Возвращает пустую строку, если получена строка null |
||||||
|
* |
||||||
|
* @param string строка для обработки |
||||||
|
* @return строку без лишних пробелов или пустую строку |
||||||
|
*/ |
||||||
|
public static String clear(String string) { |
||||||
|
// Проверяем, не является ли строка null. Если строка null, возвращаем пустую строку.
|
||||||
|
if (string == null) { |
||||||
|
return ""; |
||||||
|
} |
||||||
|
|
||||||
|
// Удаляем лишние пробелы из строки.
|
||||||
|
return string.replaceAll("\\s+", " ").trim(); |
||||||
|
} |
||||||
|
} |
@ -1 +0,0 @@ |
|||||||
spring.application.name=source |
|
@ -0,0 +1,18 @@ |
|||||||
|
server: |
||||||
|
port: 8181 |
||||||
|
spring: |
||||||
|
application: |
||||||
|
name: source |
||||||
|
thymeleaf: |
||||||
|
enabled: true |
||||||
|
encoding: UTF-8 |
||||||
|
mode: LEGACYHTML5 |
||||||
|
# Разрешение на формирование скрытых запросов (DELETE) |
||||||
|
mvc: |
||||||
|
hiddenmethod: |
||||||
|
filter: |
||||||
|
enabled: true |
||||||
|
format: |
||||||
|
date: yyyy-MM-dd |
||||||
|
date-time: yyyy-MM-dd HH:mm:ss |
||||||
|
time: HH:mm:ss |
Loading…
Reference in new issue