diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/listener/UserReqDistributionRunCompletionNotificationListener.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/listener/UserReqDistributionRunCompletionNotificationListener.java index 4715f750..f00e5040 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/listener/UserReqDistributionRunCompletionNotificationListener.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/listener/UserReqDistributionRunCompletionNotificationListener.java @@ -128,7 +128,7 @@ private void processGlobalList(DistributionSummaryDTO summaryDTO, Long batchId, DistributionResponse disres = null; String activityCode = null; if(credentialType != null) { - if(credentialType.equalsIgnoreCase("OC")) { + if("OC".equalsIgnoreCase(credentialType)) { activityCode = "USERDISTOC"; /** GRADT-553 * User Request Distribution Run - Original Certificate OC @@ -136,7 +136,7 @@ private void processGlobalList(DistributionSummaryDTO summaryDTO, Long batchId, */ addTranscriptsToDistributionRequest(cList,summaryDTO,batchId,properName); } else { - activityCode = credentialType.equalsIgnoreCase("OT")?"USERDISTOT":"USERDISTRC"; + activityCode = "OT".equalsIgnoreCase(credentialType) ? "USERDISTOT" : "USERDISTRC"; } if(!cList.isEmpty()) { DistributionRequest distributionRequest = DistributionRequest.builder().mapDist(mapDist).activityCode(activityCode).studentSearchRequest(summaryDTO.getStudentSearchRequest()).build(); diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/processor/DistributionRunStatusUpdateProcessor.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/processor/DistributionRunStatusUpdateProcessor.java index d76f2ace..251fc968 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/processor/DistributionRunStatusUpdateProcessor.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/processor/DistributionRunStatusUpdateProcessor.java @@ -16,6 +16,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.UUID; @Component public class DistributionRunStatusUpdateProcessor { @@ -69,19 +70,27 @@ private Map updateBackStudentRecords(List studentIDs = cList.stream().map(StudentCredentialDistribution::getStudentID).toList(); cList.forEach(scd-> { try { final String accessToken = restUtils.getAccessToken(); restUtils.updateStudentCredentialRecord(scd.getStudentID(),scd.getCredentialTypeCode(),scd.getPaperType(), "NONGRADYERUN".equalsIgnoreCase(activityCode)? "IP" : scd.getDocumentStatusCode(),activityCode,accessToken); LOGGER.debug("Dist Job [{}] / [{}] - update {} of {} student credential record: studentID, credentials, document status [{}, {}, {}]", batchId, activityCode, processedCount[0] + 1, totalCount, scd.getStudentID(), scd.getCredentialTypeCode(), scd.getDocumentStatusCode()); + processedCount[0]++; + } catch (Exception e) { + unprocessedStudents.put(scd.getStudentID().toString(), new ServiceException(e)); + } + }); + studentIDs.forEach(uuid-> { + try { if(!StringUtils.equalsAnyIgnoreCase(jobType, "REGALG", "TVRRUN")) { - restUtils.updateStudentGradRecord(scd.getStudentID(), batchId, activityCode); - LOGGER.debug("Dist Job [{}] / [{}] - update {} of {} student grad record: studentID, credentials, document status [{}, {}, {}]", batchId, activityCode, processedCount[0] + 1, totalCount, scd.getStudentID(), scd.getCredentialTypeCode(), scd.getDocumentStatusCode()); + restUtils.updateStudentGradRecord(uuid, batchId, activityCode); + LOGGER.debug("Dist Job [{}] / [{}] - update {} of {} student grad record: studentID [{}]", batchId, activityCode, processedCount[0] + 1, totalCount, uuid); } processedCount[0]++; } catch (Exception e) { - unprocessedStudents.put(scd.getStudentID().toString(), new ServiceException(e)); + unprocessedStudents.put(uuid.toString(), new ServiceException(e)); } }); return unprocessedStudents;