develop #5

Merged
Petr merged 5 commits from develop into master 2025-02-20 07:49:29 +00:00
Showing only changes of commit 9d2aa4ddb2 - Show all commits

View File

@ -4,7 +4,8 @@ import com.example.nto.config.ObjectStorageConfig;
import com.example.nto.domain.entity.Visit; import com.example.nto.domain.entity.Visit;
import lombok.experimental.UtilityClass; import lombok.experimental.UtilityClass;
import java.time.*; import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.ArrayList; import java.util.ArrayList;
@ -41,15 +42,17 @@ public class Utils {
} }
} }
public static LocalDateTime period(LocalDateTime dtStart, LocalDateTime dtEnd) { public static Long period(LocalDateTime dtStart, LocalDateTime dtEnd) {
// Возвращает разницу между двумя LocalDateTime // Возвращает разницу между двумя LocalDateTime
Period period = Period.between(dtStart.toLocalDate(), dtEnd.toLocalDate()); // Period period = Period.between(dtStart.toLocalDate(), dtEnd.toLocalDate());
Duration duration = Duration.between(dtStart.toLocalTime(), dtEnd.toLocalTime()); // Duration duration = Duration.between(dtStart.toLocalTime(), dtEnd.toLocalTime());
LocalDate localDate = LocalDate.of(period.getYears(), period.getMonths(), period.getDays()); return Duration.between(dtStart, dtEnd).toMinutes();
LocalTime localTime = LocalTime.of(duration.toHoursPart(), duration.toMinutesPart(), duration.toSecondsPart());
return LocalDateTime.of(localDate, localTime); // LocalDate localDate = LocalDate.of(period.getYears(), period.getMonths(), period.getDays());
// LocalTime localTime = LocalTime.of(duration.toHoursPart(), duration.toMinutesPart(), duration.toSecondsPart());
//
// return LocalDateTime.of(localDate, localTime);
} }
public static long periods(List<List<LocalDateTime>> periods) { public static long periods(List<List<LocalDateTime>> periods) {
@ -76,7 +79,7 @@ public class Utils {
public static String getRandomUrlProfileImage() { public static String getRandomUrlProfileImage() {
int max = 26, min = 1; int max = 26, min = 1;
String fileName = profileFileName(new Random().nextInt(max - min + 1) + min) + ".jpg"; String fileName = profileFileName(new Random().nextInt(max - min + 1) + min) + ".jpg";
return storageConfig.getS3Endpoint() + "/" + storageConfig.getBucketName() + "/standard/" + fileName; return "https://storage.yandexcloud.net/spring-boot-final-nto-bacet/standard/" + fileName;
} }
public static String convertDistance(float distance) { public static String convertDistance(float distance) {