From 6dc8976edaa104b2bda8a2054da282220e0b2c44 Mon Sep 17 00:00:00 2001 From: Petr Rudichev Date: Wed, 19 Feb 2025 10:39:56 +0300 Subject: [PATCH] fix: add import ObjectStorageConfig --- src/main/java/com/example/nto/utils/Utils.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/example/nto/utils/Utils.java b/src/main/java/com/example/nto/utils/Utils.java index 10a4f48..1437800 100644 --- a/src/main/java/com/example/nto/utils/Utils.java +++ b/src/main/java/com/example/nto/utils/Utils.java @@ -1,5 +1,6 @@ package com.example.nto.utils; +import com.example.nto.config.ObjectStorageConfig; import lombok.experimental.UtilityClass; import java.time.*; @@ -14,6 +15,8 @@ public class Utils { private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd"); private static final DateTimeFormatter TIME_FORMAT = DateTimeFormatter.ofPattern("HH:mm:ss"); + private static final ObjectStorageConfig storageConfig = new ObjectStorageConfig(); + public static String profileFileName(long userId) { return "profile--" + userId; } @@ -24,12 +27,17 @@ public class Utils { public static String nowTime(DataFormatType type) { switch (type) { - case DATE_TIME: return LocalDateTime.now().format(DATE_TIME_FORMAT); - case DATE: return LocalDateTime.now().format(DATE_FORMAT); - case TIME: return LocalDateTime.now().format(TIME_FORMAT); - default: return "Произошла ошибка при форматировании даты или времени."; + case DATE_TIME: + return LocalDateTime.now().format(DATE_TIME_FORMAT); + case DATE: + return LocalDateTime.now().format(DATE_FORMAT); + case TIME: + return LocalDateTime.now().format(TIME_FORMAT); + default: + return "Произошла ошибка при форматировании даты или времени."; } } + public static LocalDateTime period(LocalDateTime dtStart, LocalDateTime dtEnd) { // Возвращает разницу между двумя LocalDateTime Period period = Period.between(dtStart.toLocalDate(), dtEnd.toLocalDate());