diff --git a/api/pom.xml b/api/pom.xml
index a70f2dd8..266660d3 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -6,7 +6,7 @@
ca.bc.gov.educ
educ-grad-batch-graduation-api
- 1.8.65
+ 1.8.66
educ-grad-batch-graduation-api
Ministry of Education GRAD BATCH GRADUATION API
diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/EducGradBatchGraduationApiUtils.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/EducGradBatchGraduationApiUtils.java
index 6ff88cf3..8ea07499 100644
--- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/EducGradBatchGraduationApiUtils.java
+++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/EducGradBatchGraduationApiUtils.java
@@ -1,6 +1,5 @@
package ca.bc.gov.educ.api.batchgraduation.util;
-import ca.bc.gov.educ.api.batchgraduation.service.GradService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
@@ -11,6 +10,7 @@
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.Period;
+import java.util.Calendar;
import java.util.Date;
public class EducGradBatchGraduationApiUtils {
@@ -63,7 +63,7 @@ public static Date parsingTraxDate(String sessionDate) {
try {
temp = EducGradBatchGraduationApiUtils.parseDate(actualSessionDate, EducGradBatchGraduationApiConstants.DATE_FORMAT);
String sDates = EducGradBatchGraduationApiUtils.formatDate(temp, EducGradBatchGraduationApiConstants.DEFAULT_DATE_FORMAT);
- sDate = EducGradBatchGraduationApiUtils.parseDate(sDates, EducGradBatchGraduationApiConstants.DEFAULT_DATE_FORMAT);
+ sDate = toLastDayOfMonth(EducGradBatchGraduationApiUtils.parseDate(sDates, EducGradBatchGraduationApiConstants.DEFAULT_DATE_FORMAT));
} catch (ParseException pe) {
logger.error(ERROR_MSG,pe.getMessage());
}
@@ -88,5 +88,15 @@ public static String getProgramCompletionDate(Date pcd) {
DateFormat dateFormat = new SimpleDateFormat(EducGradBatchGraduationApiConstants.DEFAULT_DATE_FORMAT);
return dateFormat.format(pcd);
}
+
+ static Date toLastDayOfMonth(Date date) {
+ if(date != null) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+ cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
+ return cal.getTime();
+ }
+ return null;
+ }
}
diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/GradLocalDateDeserializer.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/GradLocalDateDeserializer.java
index c31e738d..268a9f80 100644
--- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/GradLocalDateDeserializer.java
+++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/GradLocalDateDeserializer.java
@@ -11,6 +11,7 @@
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
+import java.time.temporal.TemporalAdjusters;
import static ca.bc.gov.educ.api.batchgraduation.util.EducGradBatchGraduationApiConstants.SECOND_DEFAULT_DATE_FORMAT;
@@ -34,7 +35,7 @@ public LocalDate deserialize(JsonParser jsonParser, DeserializationContext deser
if(slashCount > 0) {
formatter = DateTimeFormatter.ofPattern(SECOND_DEFAULT_DATE_FORMAT);
}
- return LocalDate.parse(dateAsString, formatter);
+ return LocalDate.parse(dateAsString, formatter).with(TemporalAdjusters.lastDayOfMonth());
} else if(jsonParser.hasToken(JsonToken.VALUE_NUMBER_INT)) {
long timestamp = jsonParser.getValueAsLong();
return LocalDate.ofInstant(Instant.ofEpochMilli(timestamp), ZoneId.systemDefault());
diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/GradLocalDateTimeDeserializer.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/GradLocalDateTimeDeserializer.java
index fd569f73..ec3bd6fd 100644
--- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/GradLocalDateTimeDeserializer.java
+++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/GradLocalDateTimeDeserializer.java
@@ -12,6 +12,7 @@
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
+import java.time.temporal.TemporalAdjusters;
import static ca.bc.gov.educ.api.batchgraduation.util.EducGradBatchGraduationApiConstants.*;
@@ -35,7 +36,7 @@ public LocalDateTime deserialize(JsonParser jsonParser, DeserializationContext d
if(slashCount > 0) {
formatter = DateTimeFormatter.ofPattern(SECOND_DEFAULT_DATE_FORMAT);
}
- return LocalDateTime.parse(dateAsString, formatter);
+ return LocalDateTime.parse(dateAsString, formatter).with(TemporalAdjusters.lastDayOfMonth());
} else if(jsonParser.hasToken(JsonToken.VALUE_NUMBER_INT)) {
long timestamp = jsonParser.getValueAsLong();
return LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), ZoneId.systemDefault());
diff --git a/api/src/main/resources/db/migration/1.0/V1.0.47__DML-INSERT_DATA-BATCH_JOB_TYPE_CODE.sql b/api/src/main/resources/db/migration/1.0/V1.0.47__DML-INSERT_DATA-BATCH_JOB_TYPE_CODE.sql
new file mode 100644
index 00000000..952e7a6c
--- /dev/null
+++ b/api/src/main/resources/db/migration/1.0/V1.0.47__DML-INSERT_DATA-BATCH_JOB_TYPE_CODE.sql
@@ -0,0 +1,2 @@
+INSERT INTO BATCH_JOB_TYPE_CODE (BATCH_JOB_TYPE_CODE,LABEL,DESCRIPTION,DISPLAY_ORDER,EFFECTIVE_DATE,EXPIRY_DATE)
+VALUES ('TVR_DELETE','Delete Student TVR Process','A year-end process that will delete student TVRs',120,TIMESTAMP'2024-06-24 00:00:00.0',NULL);
diff --git a/api/src/main/resources/db/migration/1.0/V1.0.48__DML-UPDATE_DATA-BATCH_JOB_TYPE_CODE.sql b/api/src/main/resources/db/migration/1.0/V1.0.48__DML-UPDATE_DATA-BATCH_JOB_TYPE_CODE.sql
new file mode 100644
index 00000000..3d151b2b
--- /dev/null
+++ b/api/src/main/resources/db/migration/1.0/V1.0.48__DML-UPDATE_DATA-BATCH_JOB_TYPE_CODE.sql
@@ -0,0 +1,3 @@
+UPDATE BATCH_JOB_TYPE_CODE
+SET DESCRIPTION='A year-end process that will set student status of CUR (current) and TER (terminated) to ARC (archived)', UPDATE_USER='API_GRAD_BATCH' , UPDATE_DATE=TIMESTAMP'2024-06-25 00:00:00.0'
+WHERE BATCH_JOB_TYPE_CODE='ARC_STUDENTS';
\ No newline at end of file
diff --git a/api/src/main/resources/db/migration/1.0/V1.0.49__DML-INSERT_DATA-BATCH_JOB_TYPE_CODE.sql b/api/src/main/resources/db/migration/1.0/V1.0.49__DML-INSERT_DATA-BATCH_JOB_TYPE_CODE.sql
new file mode 100644
index 00000000..96b5b8cc
--- /dev/null
+++ b/api/src/main/resources/db/migration/1.0/V1.0.49__DML-INSERT_DATA-BATCH_JOB_TYPE_CODE.sql
@@ -0,0 +1,2 @@
+INSERT INTO BATCH_JOB_TYPE_CODE (BATCH_JOB_TYPE_CODE,LABEL,DESCRIPTION,DISPLAY_ORDER,EFFECTIVE_DATE,EXPIRY_DATE)
+VALUES ('SCHL_RPT_REGEN','User Request School Report Regeneration','The User regenerate School Reports option allows Users to manually update school reports upon demand.',130,TIMESTAMP'2024-06-26 00:00:00.0',NULL);