Skip to content

Commit

Permalink
[fix] 채소별 루틴 check 코드 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryeolee committed Jul 8, 2024
1 parent 9504c20 commit 38fee5a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import lombok.extern.slf4j.Slf4j;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
Expand Down Expand Up @@ -56,7 +59,12 @@ private static List<MyVeggieRoutine> checkRoutine(MyVeggie myVeggie){

private static Boolean signRoutineCheck(Date date){
boolean check = true;
if (date.equals(LocalDate.now())) {
LocalDate currentDate = LocalDate.now();
LocalTime fixedTime = LocalTime.of(0, 0, 0, 0);
LocalDateTime dateTime = LocalDateTime.of(currentDate, fixedTime);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.S");
String formattedDateTime = dateTime.format(formatter);
if (date.equals(formattedDateTime)) {
check = false;
}
log.info(String.valueOf(date));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import org.springframework.stereotype.Component;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;

Expand Down Expand Up @@ -52,7 +55,12 @@ public static List<MyVeggieRoutine> processData(List<Routine> routineList){

private static Boolean signRoutineCheck(Date date){
boolean check = true;
if (date.equals(LocalDate.now())) {
LocalDate currentDate = LocalDate.now();
LocalTime fixedTime = LocalTime.of(0, 0, 0, 0);
LocalDateTime dateTime = LocalDateTime.of(currentDate, fixedTime);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.S");
String formattedDateTime = dateTime.format(formatter);
if (date.equals(formattedDateTime)) {
check = false;
}
log.info(String.valueOf(date));
Expand Down

0 comments on commit 38fee5a

Please sign in to comment.