Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop/alex grad2 2377 #483

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ 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
**** Also select the students’ transcript for print
*/
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

@Component
public class DistributionRunStatusUpdateProcessor {
Expand Down Expand Up @@ -69,19 +70,27 @@ private Map<String, ServiceException> updateBackStudentRecords(List<StudentCrede
String activityCode = getActivitCode(jobType);
final int totalCount = cList.size();
final int[] processedCount = {0};
List<UUID> 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;
Expand Down
Loading