From bb1c39b37c6d262381118a0a66e83b680144b6b3 Mon Sep 17 00:00:00 2001 From: arybakov Date: Mon, 19 Aug 2024 12:34:06 -0600 Subject: [PATCH] Users' IDIR for audit history --- .../ArchiveStudentsCompletionNotificationListener.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/listener/ArchiveStudentsCompletionNotificationListener.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/listener/ArchiveStudentsCompletionNotificationListener.java index 4fc7d055..c4f32b60 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/listener/ArchiveStudentsCompletionNotificationListener.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/listener/ArchiveStudentsCompletionNotificationListener.java @@ -1,7 +1,9 @@ package ca.bc.gov.educ.api.batchgraduation.listener; import ca.bc.gov.educ.api.batchgraduation.model.DistributionSummaryDTO; +import ca.bc.gov.educ.api.batchgraduation.model.StudentSearchRequest; import ca.bc.gov.educ.api.batchgraduation.util.DateUtils; +import org.apache.commons.lang3.ObjectUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.BatchStatus; @@ -44,6 +46,9 @@ public void afterJob(JobExecution jobExecution) { LOGGER.info(" --------------------------------------------------------------------------------------"); LOGGER.info("Errors:{}", summaryDTO.getErrors().size()); + StudentSearchRequest payload = (StudentSearchRequest)jsonTransformer.unmarshall(studentSearchRequest, StudentSearchRequest.class); + String userName = ObjectUtils.defaultIfNull(payload.getUser(), "Batch Archive Process"); + updateUserSchedulingJobs(jobParameters); String jobParametersDTO = buildJobParametersDTO(jobType, studentSearchRequest, null, null); @@ -51,7 +56,7 @@ public void afterJob(JobExecution jobExecution) { processBatchJobHistory(summaryDTO, jobExecutionId, status, jobTrigger, jobType, startTime, endTime, jobParametersDTO); LOGGER.info(" --------------------------------------------------------------------------------------"); summaryDTO.getSchools().forEach((value) -> LOGGER.info("School {} number of archived Students : {}", value.getMincode(), value.getNumberOfStudents())); - restUtils.updateStudentGradRecordHistory(jobExecutionId, "Batch Archive Process", "USERSTUDARC"); + restUtils.updateStudentGradRecordHistory(jobExecutionId, userName, "USERSTUDARC"); } } }