From ae1bcc70b22068f0b5765480033543e8a0503c7c Mon Sep 17 00:00:00 2001 From: arybakov Date: Mon, 24 Jul 2023 23:19:34 -0600 Subject: [PATCH] Fix date parse for yyyy-MM-ddTHH:mm:ss pattern --- .../bc/gov/educ/api/distribution/model/dto/Student.java | 9 +++++---- .../model/dto/StudentCredentialDistribution.java | 4 ++++ .../gov/educ/api/distribution/process/MergeProcess.java | 4 +++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/api/src/main/java/ca/bc/gov/educ/api/distribution/model/dto/Student.java b/api/src/main/java/ca/bc/gov/educ/api/distribution/model/dto/Student.java index 902c8ac6..520760e6 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/distribution/model/dto/Student.java +++ b/api/src/main/java/ca/bc/gov/educ/api/distribution/model/dto/Student.java @@ -5,8 +5,8 @@ import java.io.Serializable; import java.time.LocalDate; -import java.time.LocalDateTime; import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.Objects; @@ -19,7 +19,7 @@ public class Student implements Serializable { private String gender; private String citizenship; private LocalDate birthdate; - private LocalDateTime lastUpdateDate; + private Date lastUpdateDate; private Address address; private String grade; private String gradProgram; @@ -101,11 +101,12 @@ public void setBirthdate(LocalDate value) { this.birthdate = value; } - public LocalDateTime getLastUpdateDate() { + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss") + public Date getLastUpdateDate() { return lastUpdateDate; } - public void setLastUpdateDate(LocalDateTime lastUpdateDate) { + public void setLastUpdateDate(Date lastUpdateDate) { this.lastUpdateDate = lastUpdateDate; } diff --git a/api/src/main/java/ca/bc/gov/educ/api/distribution/model/dto/StudentCredentialDistribution.java b/api/src/main/java/ca/bc/gov/educ/api/distribution/model/dto/StudentCredentialDistribution.java index 7d779ecd..bfadf356 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/distribution/model/dto/StudentCredentialDistribution.java +++ b/api/src/main/java/ca/bc/gov/educ/api/distribution/model/dto/StudentCredentialDistribution.java @@ -28,4 +28,8 @@ public class StudentCredentialDistribution { private String program; private String studentGrade; private List nonGradReasons; + + public LocalDateTime getLastUpdateDate() { + return lastUpdateDate == null ? LocalDateTime.now() : lastUpdateDate; + } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/distribution/process/MergeProcess.java b/api/src/main/java/ca/bc/gov/educ/api/distribution/process/MergeProcess.java index d519af3b..d0840d17 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/distribution/process/MergeProcess.java +++ b/api/src/main/java/ca/bc/gov/educ/api/distribution/process/MergeProcess.java @@ -18,7 +18,9 @@ import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; +import java.sql.Date; import java.time.LocalDate; +import java.time.ZoneId; import java.util.ArrayList; import java.util.Comparator; import java.util.List; @@ -218,7 +220,7 @@ private Student prepareStudentObj(StudentCredentialDistribution scd, List