Skip to content

Commit c4ffff2

Browse files
김산김산
authored andcommitted
[#7] Fix: date calculation error fix
1 parent 8714a87 commit c4ffff2

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/main/java/com/example/helper/service/MealService.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,22 @@ else if(13 <= hour && hour < 19) {
5656
}
5757
else if(19 <= hour && hour < 24) {
5858
kindType = 0;
59+
currentDateTime = currentDateTime.plusDays(1);
5960
}
6061
else {
6162
kindType = 0;
62-
currentDateTime.plusDays(1);
63+
currentDateTime = currentDateTime.plusDays(1);
6364
}
6465

66+
log.info("currentDateTime Obj : " + currentDateTime.toString());
67+
6568
String date = currentDateTime.getYear() + "-";
6669
date += String.format("%02d", currentDateTime.getMonth().getValue()) + "-";
6770
date += String.format("%02d", currentDateTime.getDayOfMonth()) + "";
6871

72+
log.info("date Obj : " + date);
73+
log.info("langType Obj : " + langType);
74+
log.info("kindType Obj : " + kindType);
6975
Optional<Meal> result = sqlMealRepository.findByDate(2, langType, kindType, date);
7076

7177
if(result.isEmpty()) {

src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ spring.datasource.url=jdbc:mysql://${MYSQL_HOST:localhost}:3306/helper_db
33
spring.datasource.username=helper
44
spring.datasource.password=12345678
55
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
6-
spring.jpa.hibernate.ddl-auto=create
6+
spring.jpa.hibernate.ddl-auto=validate
77

88
spring.jpa.show-sql=true
99
spring.jpa.properties.hibernate.format_sql=true

0 commit comments

Comments
 (0)