Skip to content

Commit

Permalink
GRAD2-2761: replaced minCode with schoolId for School v2 endpoint & s…
Browse files Browse the repository at this point in the history
…choolAtGradId is added in.

GRAD2-2761: replaced minCode with schoolId for School v2 endpoint & schoolAtGradId is added in.
  • Loading branch information
infstar committed Nov 20, 2024
1 parent e17cef7 commit 397cece
Show file tree
Hide file tree
Showing 20 changed files with 332 additions and 156 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class GradAlgorithmGraduationStudentRecord {
private String studentCitizenship;
private UUID studentID;
private String schoolAtGrad;
private UUID schoolAtGradId;
private String consumerEducationRequirementMet;
private String schoolAtGradName;
@JsonFormat(pattern=DEFAULT_DATE_FORMAT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class GradSearchStudent {
private String trueStudentID;
private String program;
private String schoolOfRecord;
private String schoolOfRecordId;
private String schoolOfRecordName;
private String schoolOfRecordindependentAffiliation;
private String studentGrade;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class GraduationStudentRecord extends BaseModel {
private String studentStatusName;
private UUID studentID;
private String schoolAtGrad;
private UUID schoolAtGradId;
private String schoolAtGradName;
private String legalFirstName;
private String legalMiddleNames;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public class ReportGradStudentData implements Serializable {
private UUID graduationStudentRecordId;
private String mincode;
private String mincodeAtGrad;
private String schoolOfRecordId;
private String schoolAtGradId;
private String pen;
private String firstName;
private String middleName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class School {
private String postal;
private String openFlag;
private String schoolCategoryCode;
private String schoolCategoryCodeInstitute;
private String schoolCategoryLegacyCode;

public String getSchoolName() {
return schoolName != null ? schoolName.trim(): null;
Expand Down Expand Up @@ -53,7 +53,7 @@ public String getOpenFlag() {

@Override
public String toString() {
return "School [minCode=" + minCode + ", schoolId=" + schoolId + ", schoolCategoryCode=" + schoolCategoryCode + ", schoolCategoryCodeInstitute=" + schoolCategoryCodeInstitute
return "School [minCode=" + minCode + ", schoolId=" + schoolId + ", schoolCategoryCode=" + schoolCategoryCode + ", schoolCategoryLegacyCode=" + schoolCategoryLegacyCode
+ ", schoolName=" + schoolName + ", districtName=" + districtName + ", transcriptEligibility=" + transcriptEligibility + ", certificateEligibility=" + certificateEligibility
+ ", address1=" + address1 + ", address2=" + address2 + ", city=" + city + ", provCode=" + provCode + ", countryCode=" + countryCode + ", postal=" + postal + ", openFlag=" + openFlag
+ "]";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package ca.bc.gov.educ.api.graduation.model.dto.institute;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.stereotype.Component;

@Data
@EqualsAndHashCode
@Component("instituteSchool")
@JsonIgnoreProperties(ignoreUnknown = true)
public class School {

private String schoolId;
private String districtId;
private String mincode;
private String independentAuthorityId;
private String schoolNumber;
private String faxNumber;
private String phoneNumber;
private String email;
private String website;
private String displayName;
private String displayNameNoSpecialChars;
private String schoolReportingRequirementCode;
private String schoolOrganizationCode;
private String schoolCategoryCode;
private String facilityTypeCode;
private String openedDate;
private String closedDate;
private boolean canIssueTranscripts;
private boolean canIssueCertificates;

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class School implements Serializable {

private static final long serialVersionUID = 2L;

private String schoolId;
private String mincode;
private String name;
private String typeIndicator;
Expand All @@ -27,6 +28,14 @@ public class School implements Serializable {

private List<Student> students;

public String getSchoolId() {
return schoolId;
}

public void setSchoolId(String value) {
this.schoolId = value;
}

public String getMincode() {
return mincode;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ public ExceptionMessage createStudentCertificateTranscriptReports(GraduationData
}
if(createCertificate) {
reportService.saveStudentCertificateReportJasper(graduationStatusResponse, graduationDataStatus, certType, false);
graduationDataStatus.getSchool().setSchoolCategoryCode(certType.getSchoolCategoryCode());
graduationDataStatus.getSchool().setSchoolCategoryLegacyCode(certType.getSchoolCategoryCode());
graduationDataStatus.getStudentCertificatesTranscript().addCertificateType(GradCertificateType.builder()
.code(certType.getCertificateTypeCode())
.description(certType.getCertificateTypeLabel())
.build());
}
} else {
reportService.saveStudentCertificateReportJasper(graduationStatusResponse, graduationDataStatus, certType, false);
graduationDataStatus.getSchool().setSchoolCategoryCode(certType.getSchoolCategoryCode());
graduationDataStatus.getSchool().setSchoolCategoryLegacyCode(certType.getSchoolCategoryCode());
graduationDataStatus.getStudentCertificatesTranscript().addCertificateType(GradCertificateType.builder()
.code(certType.getCertificateTypeCode())
.description(certType.getCertificateTypeLabel())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,13 @@ public byte[] getSchoolReports(List<String> uniqueSchoolList, String type) {
for (String usl : uniqueSchoolList) {
try {
List<GraduationStudentRecord> stdList = gradStatusService.getStudentListByMinCode(usl);
ca.bc.gov.educ.api.graduation.model.dto.School schoolDetails = schoolService.getSchoolDetails(usl);
if (schoolDetails != null) {
List<ca.bc.gov.educ.api.graduation.model.dto.institute.School> schoolDetails = schoolService.getSchoolDetails(usl);
if (schoolDetails != null && !schoolDetails.isEmpty()) {
ca.bc.gov.educ.api.graduation.model.dto.institute.School schoolDetail = schoolDetails.get(0);
School schoolObj = new School();
schoolObj.setMincode(schoolDetails.getMinCode());
schoolObj.setName(schoolDetails.getSchoolName());
schoolObj.setSchoolId(schoolDetail.getSchoolId());
schoolObj.setMincode(schoolDetail.getMincode());
schoolObj.setName(schoolDetail.getDisplayName());
ReportData gradReport;
switch (type) {
case GRADREG:
Expand Down Expand Up @@ -236,13 +238,15 @@ public Integer createAndStoreSchoolReports(List<String> uniqueSchoolList, String
String listOfStudents = jsonTransformer.marshall(stdList);
logger.debug("*** Student List of {} Acquired {}", totalStudents, listOfStudents);
}
ca.bc.gov.educ.api.graduation.model.dto.School schoolDetails = schoolService.getSchoolDetails(usl);
if (schoolDetails != null) {
logger.debug("*** School Details Acquired {}", schoolDetails.getSchoolName());
List<ca.bc.gov.educ.api.graduation.model.dto.institute.School> schoolDetails = schoolService.getSchoolDetails(usl);
if (schoolDetails != null && !schoolDetails.isEmpty()) {
ca.bc.gov.educ.api.graduation.model.dto.institute.School schoolDetail = schoolDetails.get(0);
logger.debug("*** School Details Acquired {}", schoolDetail.getDisplayName());
if (stdList != null && !stdList.isEmpty()) {
School schoolObj = new School();
schoolObj.setMincode(schoolDetails.getMinCode());
schoolObj.setName(schoolDetails.getSchoolName());
schoolObj.setSchoolId(schoolDetail.getSchoolId());
schoolObj.setMincode(schoolDetail.getMincode());
schoolObj.setName(schoolDetail.getDisplayName());
if (TVRRUN.equalsIgnoreCase(type)) {
List<Student> nonGradPrjStudents = processStudentList(filterStudentList(stdList, NONGRADPRJ), type);
logger.debug("*** Process processStudentNonGradPrjReport {} for {} students", schoolObj.getMincode(), nonGradPrjStudents.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public ReportService(JsonTransformer jsonTransformer, EducGraduationApiConstants
public ProgramCertificateTranscript getTranscript(GraduationStudentRecord gradResponse, ca.bc.gov.educ.api.graduation.model.dto.GraduationData graduationDataStatus, ExceptionMessage exception) {
ProgramCertificateReq req = new ProgramCertificateReq();
req.setProgramCode(gradResponse.getProgram());
req.setSchoolCategoryCode(StringUtils.isBlank(graduationDataStatus.getSchool().getSchoolCategoryCode())?
getSchoolCategoryCode(graduationDataStatus.getGradStatus().getSchoolOfRecord()) : graduationDataStatus.getSchool().getSchoolCategoryCode());
req.setSchoolCategoryCode(StringUtils.isBlank(graduationDataStatus.getSchool().getSchoolCategoryLegacyCode())?
getSchoolCategoryCode(graduationDataStatus.getGradStatus().getSchoolOfRecordId()) : graduationDataStatus.getSchool().getSchoolCategoryLegacyCode());
try {
return restService.post(educGraduationApiConstants.getTranscript(), req, ProgramCertificateTranscript.class);
} catch (Exception e) {
Expand All @@ -72,8 +72,8 @@ public List<ProgramCertificateTranscript> getCertificateList(GraduationStudentRe
req.setOptionalProgram(optionalPrograms.getOptionalProgramCode());
}
}
req.setSchoolCategoryCode(StringUtils.isBlank(graduationDataStatus.getSchool().getSchoolCategoryCode())?
getSchoolCategoryCode(graduationDataStatus.getGradStatus().getSchoolOfRecord()) : graduationDataStatus.getSchool().getSchoolCategoryCode());
req.setSchoolCategoryCode(StringUtils.isBlank(graduationDataStatus.getSchool().getSchoolCategoryLegacyCode())?
getSchoolCategoryCode(graduationDataStatus.getGradStatus().getSchoolOfRecordId()) : graduationDataStatus.getSchool().getSchoolCategoryLegacyCode());
try {
var response = restService.post(educGraduationApiConstants.getCertList(), req, List.class);
return jsonTransformer.convertValue(response, new TypeReference<List<ProgramCertificateTranscript>>() {});
Expand All @@ -84,9 +84,10 @@ public List<ProgramCertificateTranscript> getCertificateList(GraduationStudentRe
}
}

public String getSchoolCategoryCode(String mincode) {
ca.bc.gov.educ.api.graduation.model.dto.School school = this.restService.get(String.format(educGraduationApiConstants.getSchoolDetails(), mincode), ca.bc.gov.educ.api.graduation.model.dto.School.class);
return (school == null) ? null : school.getSchoolCategoryCode();
public String getSchoolCategoryCode(UUID schoolId) {
if (schoolId == null) return null;
ca.bc.gov.educ.api.graduation.model.dto.School school = this.restService.get(String.format(educGraduationApiConstants.getSchoolClobBySchoolIdUrl(), schoolId), ca.bc.gov.educ.api.graduation.model.dto.School.class);
return (school == null) ? null : school.getSchoolCategoryLegacyCode();
}

public List<ReportGradStudentData> getStudentsForSchoolYearEndReport(String accessToken) {
Expand Down Expand Up @@ -120,6 +121,12 @@ public List<ReportGradStudentData> getStudentsForSchoolReport() {

public ReportData prepareTranscriptData(ca.bc.gov.educ.api.graduation.model.dto.GraduationData graduationDataStatus, GraduationStudentRecord gradResponse, boolean xml, ExceptionMessage exception) {
try {
ca.bc.gov.educ.api.graduation.model.dto.School schoolClob = graduationDataStatus.getSchool();
if (schoolClob == null || StringUtils.isBlank(graduationDataStatus.getSchool().getSchoolId())) {
schoolClob = schoolService.getSchoolClob(gradResponse.getSchoolOfRecordId());
graduationDataStatus.setSchool(schoolClob);
}

School schoolAtGrad = getSchoolAtGradData(graduationDataStatus);
School schoolOfRecord = getSchoolData(graduationDataStatus.getSchool());
//--> Revert code back to school of record GRAD2-2758
Expand All @@ -129,7 +136,6 @@ public ReportData prepareTranscriptData(ca.bc.gov.educ.api.graduation.model.dto.
String mincode = schoolAtGrad.getMincode();
traxSchool = schoolService.getTraxSchoolDetails(mincode, exception);
} **/
ca.bc.gov.educ.api.graduation.model.dto.School schoolDetails = schoolService.getSchoolDetails(schoolOfRecord.getMincode());
//<--
GraduationStatus graduationStatus = getGraduationStatus(graduationDataStatus, schoolAtGrad, schoolOfRecord);
GraduationData graduationData = getGraduationData(graduationDataStatus, gradResponse);
Expand All @@ -146,7 +152,7 @@ public ReportData prepareTranscriptData(ca.bc.gov.educ.api.graduation.model.dto.
data.setTranscript(getTranscriptData(graduationDataStatus, gradResponse, xml, exception));
data.setNonGradReasons(isGraduated(gradResponse.getProgramCompletionDate(), graduationDataStatus.getGradStatus().getProgram()) ? new ArrayList<>() : getNonGradReasons(data.getGradProgram().getCode().getCode(), graduationDataStatus.getNonGradReasons(), xml, true));
data.setIssueDate(EducGraduationApiUtils.formatIssueDateForReportJasper(new java.sql.Date(System.currentTimeMillis()).toString()));
if(schoolDetails != null && !"N".equalsIgnoreCase(schoolDetails.getCertificateEligibility())) {
if(schoolClob != null && !"N".equalsIgnoreCase(schoolClob.getCertificateEligibility())) {
if ("SCCP".equalsIgnoreCase(data.getGradProgram().getCode().getCode())) {
data.getStudent().setSccDate(graduationStatus.getProgramCompletionDate());
}
Expand Down Expand Up @@ -712,8 +718,8 @@ private Student getStudentData(GradSearchStudent gradStudent, GraduationStudentR
}

private School getSchoolAtGradData(ca.bc.gov.educ.api.graduation.model.dto.GraduationData graduationDataStatus) {
if (graduationDataStatus.getGradStatus() != null && !StringUtils.isBlank(graduationDataStatus.getGradStatus().getSchoolAtGrad())) {
ca.bc.gov.educ.api.graduation.model.dto.School schoolDetails = schoolService.getSchoolDetails(graduationDataStatus.getGradStatus().getSchoolAtGrad());
if (graduationDataStatus.getGradStatus() != null && graduationDataStatus.getGradStatus().getSchoolAtGradId() != null) {
ca.bc.gov.educ.api.graduation.model.dto.School schoolDetails = schoolService.getSchoolClob(graduationDataStatus.getGradStatus().getSchoolAtGradId());
if (schoolDetails != null) {
return getSchoolData(schoolDetails);
}
Expand All @@ -730,9 +736,11 @@ private School getSchoolData(ca.bc.gov.educ.api.graduation.model.dto.School scho
addRess.setRegion(school.getProvCode());
addRess.setStreetLine1(school.getAddress1());
addRess.setStreetLine2(school.getAddress2());
schObj.setTypeIndicator("02".equalsIgnoreCase(school.getSchoolCategoryCode())? "02" : "");
schObj.setTypeIndicator("02".equalsIgnoreCase(school.getSchoolCategoryLegacyCode())? "02" : "");
schObj.setAddress(addRess);
schObj.setSchoolId(school.getSchoolId());
schObj.setMincode(school.getMinCode());
schObj.setSchoolCategoryCode(school.getSchoolCategoryLegacyCode());
schObj.setName(school.getSchoolName());
schObj.setSignatureCode(school.getMinCode().substring(0, 3));
schObj.setDistno(school.getMinCode().substring(0, 3));
Expand Down
Loading

0 comments on commit 397cece

Please sign in to comment.