fix: Utils bugs
This commit is contained in:
parent
cbdc058672
commit
9d2aa4ddb2
@ -4,7 +4,8 @@ import com.example.nto.config.ObjectStorageConfig;
|
||||
import com.example.nto.domain.entity.Visit;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
import java.time.*;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
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
|
||||
Period period = Period.between(dtStart.toLocalDate(), dtEnd.toLocalDate());
|
||||
Duration duration = Duration.between(dtStart.toLocalTime(), dtEnd.toLocalTime());
|
||||
// Period period = Period.between(dtStart.toLocalDate(), dtEnd.toLocalDate());
|
||||
// Duration duration = Duration.between(dtStart.toLocalTime(), dtEnd.toLocalTime());
|
||||
|
||||
LocalDate localDate = LocalDate.of(period.getYears(), period.getMonths(), period.getDays());
|
||||
LocalTime localTime = LocalTime.of(duration.toHoursPart(), duration.toMinutesPart(), duration.toSecondsPart());
|
||||
return Duration.between(dtStart, dtEnd).toMinutes();
|
||||
|
||||
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) {
|
||||
@ -76,7 +79,7 @@ public class Utils {
|
||||
public static String getRandomUrlProfileImage() {
|
||||
int max = 26, min = 1;
|
||||
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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user