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

GRAD2-2639: initial implementation is done. #555

Merged
merged 6 commits into from
Dec 27, 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 @@ -84,7 +84,7 @@ public ArchiveStudentsReader archiveStudentsReader() {

@Bean
@StepScope
public ItemWriter<? super List<String>> archiveStudentsWriter() {
public ItemWriter<? super List<UUID>> archiveStudentsWriter() {
return new ArchiveStudentsWriter();
}

Expand Down Expand Up @@ -114,7 +114,7 @@ public DeleteStudentReportsReader deleteStudentReportsReader() {

@Bean
@StepScope
public ItemWriter<? super List<String>> archiveSchoolReportsWriter() {
public ItemWriter<? super List<UUID>> archiveSchoolReportsWriter() {
return new ArchiveSchoolReportsWriter();
}

Expand Down Expand Up @@ -148,7 +148,7 @@ public Step masterStepArchiveStudents(JobRepository jobRepository, PlatformTrans
@Bean
public Step archiveStudentsJobStep(JobRepository jobRepository, PlatformTransactionManager transactionManager, EducGradBatchGraduationApiConstants constant) {
return new StepBuilder("archiveStudentsJobStep", jobRepository)
.<List<String>, List<String>>chunk(1, transactionManager)
.<List<UUID>, List<UUID>>chunk(1, transactionManager)
.processor(archiveStudentsProcessor())
.reader(archiveStudentsReader())
.writer(archiveStudentsWriter())
Expand Down Expand Up @@ -178,7 +178,7 @@ public Step masterStepDeleteStudentReports(JobRepository jobRepository, Platform
@Bean
public Step archiveSchoolReportsJobStep(JobRepository jobRepository, PlatformTransactionManager transactionManager, EducGradBatchGraduationApiConstants constant) {
return new StepBuilder("archiveSchoolReportsJobStep", jobRepository)
.<List<String>, List<String>>chunk(1, transactionManager)
.<List<UUID>, List<UUID>>chunk(1, transactionManager)
.reader(archiveSchoolReportsReader())
.processor(archiveSchoolReportsProcessor())
.writer(archiveSchoolReportsWriter())
Expand Down Expand Up @@ -1074,7 +1074,7 @@ public RegenerateSchoolReportsWriter itemWriterSchoolReportsRegen() {
@Bean
public Step schoolReportsRegenJobStep(JobRepository jobRepository, PlatformTransactionManager transactionManager, SkipSQLTransactionExceptionsListener skipListener) {
return new StepBuilder("schoolReportsRegenJobStep", jobRepository)
.<String, String>chunk(1, transactionManager)
.<UUID, UUID>chunk(1, transactionManager)
.reader(itemReaderSchoolReportsRegen())
.processor(itemProcessorSchoolReportsRegen())
.writer(itemWriterSchoolReportsRegen())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,14 @@ public ResponseEntity<BatchJobResponse> launchRegGradSpecialJob(@RequestBody Stu
}

private void validateInput(BatchJobResponse response, StudentSearchRequest studentSearchRequest) {
if(studentSearchRequest.getStudentIDs().isEmpty() && studentSearchRequest.getPens().isEmpty() && studentSearchRequest.getDistricts().isEmpty() && studentSearchRequest.getSchoolCategoryCodes().isEmpty() && studentSearchRequest.getPrograms().isEmpty() && studentSearchRequest.getSchoolOfRecords().isEmpty()) {
if(studentSearchRequest.getStudentIDs().isEmpty() && studentSearchRequest.getPens().isEmpty() && studentSearchRequest.getDistrictIds().isEmpty() && studentSearchRequest.getSchoolCategoryCodes().isEmpty() && studentSearchRequest.getPrograms().isEmpty() && studentSearchRequest.getSchoolIds().isEmpty()) {
response.setException("Please provide at least 1 parameter");
}
response.setException(null);
}

private DistributionSummaryDTO validateInputDisRun(StudentSearchRequest studentSearchRequest) {
if(studentSearchRequest.getPens().isEmpty() && studentSearchRequest.getDistricts().isEmpty() && studentSearchRequest.getSchoolCategoryCodes().isEmpty() && studentSearchRequest.getPrograms().isEmpty() && studentSearchRequest.getSchoolOfRecords().isEmpty()) {
if(studentSearchRequest.getPens().isEmpty() && studentSearchRequest.getDistrictIds().isEmpty() && studentSearchRequest.getSchoolCategoryCodes().isEmpty() && studentSearchRequest.getPrograms().isEmpty() && studentSearchRequest.getSchoolIds().isEmpty()) {
DistributionSummaryDTO summaryDTO = new DistributionSummaryDTO();
summaryDTO.setException("Please provide at least 1 parameter");
return summaryDTO;
Expand Down Expand Up @@ -305,7 +305,7 @@ private void validateInputArchiveStudents(StudentSearchRequest studentSearchRequ
}

private BlankDistributionSummaryDTO validateInputBlankDisRun(BlankCredentialRequest blankCredentialRequest) {
if(blankCredentialRequest.getSchoolOfRecords().isEmpty() || blankCredentialRequest.getCredentialTypeCode().isEmpty()) {
if(blankCredentialRequest.getSchoolIds().isEmpty() || blankCredentialRequest.getCredentialTypeCode().isEmpty()) {
BlankDistributionSummaryDTO summaryDTO = new BlankDistributionSummaryDTO();
summaryDTO.setException("Please provide both parameters");
return summaryDTO;
Expand Down Expand Up @@ -466,7 +466,7 @@ public ResponseEntity<Boolean> launchRegenerateSchoolReports(@PathVariable Long
if (entity != null) {
try {
logger.info(" Re-Generating School Reports for {} --------------------------------------------------------", entity.getJobType());
List<String> uniqueSchoolList = gradBatchHistoryService.getSchoolListForReport(batchId);
List<UUID> uniqueSchoolList = gradBatchHistoryService.getSchoolListForReport(batchId);
logger.info(" Number of Schools [{}] ---------------------------------------------------------", uniqueSchoolList.size());
restUtils.createAndStoreSchoolReports(uniqueSchoolList, entity.getJobType());
return ResponseEntity.ok(Boolean.TRUE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public class BatchGradAlgorithmStudentEntity extends BaseEntity {
@Column(name = "SCHOOL_OF_RECORD", nullable = true)
private String schoolOfRecord;

@Column(name = "SCHOOL_OF_RECORD_ID", nullable = true)
private UUID schoolOfRecordId;

@Column(name = "STATUS", nullable = true)
private String status;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public class StudentCredentialDistributionEntity extends BaseEntity {
@Column(name = "GRADUATION_STUDENT_RECORD_ID", nullable = false)
private UUID studentID;

@Column(name = "SCHOOL_OF_RECORD", nullable = true)
private String schoolOfRecord;
@Column(name = "SCHOOL_OF_RECORD_ID", nullable = true)
private String schoolId;

@Lob
@Column(name = "PAYLOAD")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void afterJob(JobExecution jobExecution) {
// save batch job & error history
processBatchJobHistory(summaryDTO, jobExecutionId, status, jobTrigger, jobType, startTime, endTime, jobParametersDTO);
LOGGER.info(" --------------------------------------------------------------------------------------");
summaryDTO.getSchools().forEach((value) -> LOGGER.info("School {} number of archived School Reports : {}", value.getMincode(), value.getNumberOfSchoolReports()));
summaryDTO.getSchools().forEach((value) -> LOGGER.info("School {} number of archived School Reports : {}", value.getSchoolId(), value.getNumberOfSchoolReports()));

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void afterJob(JobExecution jobExecution) {
// save batch job & error history
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()));
summaryDTO.getSchools().forEach((value) -> LOGGER.info("School {} number of archived Students : {}", value.getSchoolId(), value.getNumberOfStudents()));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private void updateBackStudentFlagForErroredStudents(Map<UUID, ProcessError> err

private void processSchoolList(Long batchId, String jobType) {
LOGGER.info(" Creating Reports for {}", jobType);
List<String> uniqueSchoolList = gradBatchHistoryService.getSchoolListForReport(batchId);
List<UUID> uniqueSchoolList = gradBatchHistoryService.getSchoolListForReport(batchId);
LOGGER.info(" Number of Schools [{}]", uniqueSchoolList.size());
restUtils.createAndStoreSchoolReports(uniqueSchoolList,jobType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void afterJob(JobExecution jobExecution) {
StudentSearchRequest searchRequest = summaryDTO.getStudentSearchRequest();
String userName = extractUserName(summaryDTO, jobParameters, searchRequest);

summaryDTO.getSchools().forEach((value) -> LOGGER.info("School {} number of Deleted Student Reports : {}", value.getMincode(), value.getNumberOfStudents()));
summaryDTO.getSchools().forEach((value) -> LOGGER.info("School {} number of Deleted Student Reports : {}", value.getSchoolId(), value.getNumberOfStudents()));
if(summaryDTO.getProcessedCount() > 0) {
List<UUID> finalStudentGuids = searchRequest.getStudentIDs();
int partitionSize = finalStudentGuids.size()/200;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void afterJob(JobExecution jobExecution) {
log.info(" --------------------------------------------------------------------------------------");
log.info("Errors:{}", summaryDTO.getErrors().size());
log.info(" --------------------------------------------------------------------------------------");
summaryDTO.getSchools().forEach(value -> log.debug("School Report regenerated for {}", value.getMincode()));
summaryDTO.getSchools().forEach(value -> log.debug("School Report regenerated for {}", value.getSchoolId()));
// save batch job & error history
saveBatchJobHistory(summaryDTO, jobExecutionId, status, endTime);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ private void addTranscriptsToDistributionRequest(List<StudentCredentialDistribut
for(StudentCredentialDistribution trScd: transcriptDistributionList) {
if(certScd.getStudentID().equals(trScd.getStudentID())) {
trScd.setSchoolOfRecord(certScd.getSchoolOfRecord());
trScd.setSchoolId(certScd.getSchoolId());
trScd.setPen(certScd.getPen());
trScd.setLegalFirstName(certScd.getLegalFirstName());
trScd.setLegalMiddleNames(certScd.getLegalMiddleNames());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ public class BatchGraduationStudentRecord {
private String program;
private String programCompletionDate;
private String schoolOfRecord;
private UUID schoolOfRecordId;

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

import lombok.Data;

import java.util.UUID;

@Data
public class BlankCredentialDistribution {

private String credentialTypeCode;
private String schoolOfRecord;
private UUID schoolId;
private int quantity;
private String paperType;
private Address address;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@

import java.io.Serializable;
import java.util.List;
import java.util.UUID;

@Data
@Component
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class BlankCredentialRequest implements Serializable {
private List<String> schoolOfRecords;
private List<UUID> schoolIds;
private List<String> credentialTypeCode;
private String user;
private Address address;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public class CertificateRegenerationRequest extends StudentSearchRequest {

public boolean runForAll () {
return (getPens() == null || getPens().isEmpty()) &&
(getDistricts() == null || getDistricts().isEmpty()) &&
(getSchoolOfRecords() == null || getSchoolOfRecords().isEmpty()) &&
(getDistrictIds() == null || getDistrictIds().isEmpty()) &&
(getSchoolIds() == null || getSchoolIds().isEmpty()) &&
(getSchoolCategoryCodes() == null || getSchoolCategoryCodes().isEmpty()) &&
(getStudentIDs() == null || getStudentIDs().isEmpty());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class GraduationStudentRecordDistribution extends BaseModel{
private String legalLastName;
private String schoolOfRecord;
private String schoolAtGrad;
private UUID schoolOfRecordId;
private UUID schoolAtGradId;
private String programCompletionDate;
private String honoursStanding;
private String program;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ public class ReportGradStudentData implements Serializable {
private static final long serialVersionUID = 1L;

private UUID graduationStudentRecordId;
private String mincode;
private String mincodeAtGrad;
private String distcode;
private String distcodeAtGrad;
private UUID schoolOfRecordId;
private UUID schoolAtGradId;
private UUID districtId;
private UUID districtAtGradId;
private String pen;
private String firstName;
private String middleName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

public class School implements Serializable {

Expand All @@ -30,8 +31,12 @@ public class School implements Serializable {
public School() {
}

public School(String mincode) {
this.mincode = mincode;
public School(String schoolId) {
this.schoolId = schoolId;
}

public School(UUID schoolId) {
this.schoolId = schoolId != null? schoolId.toString() : null;
}

public String getSchoolId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class SchoolReport extends BaseModel {
private String reportTypeCode;
private String reportTypeLabel;
private String schoolOfRecord;
private UUID schoolOfRecordId;
private String schoolOfRecordName;
private String schoolCategory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class SchoolReportsRegenerationRequest extends StudentSearchRequest {
private String runMode; // "Y" or "N"

public boolean runForAll () {
return (getSchoolOfRecords() == null || getSchoolOfRecords().isEmpty()) &&
return (getSchoolIds() == null || getSchoolIds().isEmpty()) &&
(getSchoolCategoryCodes() == null || getSchoolCategoryCodes().isEmpty());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class StudentCredentialDistribution implements Serializable {
private UUID studentID;
private String paperType;
private String schoolOfRecord;
private UUID schoolId;
private String documentStatusCode;

private String pen;
Expand All @@ -31,8 +32,10 @@ public class StudentCredentialDistribution implements Serializable {
private List<GradRequirement> nonGradReasons;

@JsonIgnore
private String schoolAtGrad;
private UUID schoolAtGradId;
@JsonIgnore
private String schoolOfRecordOrigin;
private UUID schoolOfRecordOriginId;
@JsonIgnore
private UUID districtId;

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
@AllArgsConstructor
@Builder
public class StudentSearchRequest implements Serializable {
private List<String> schoolOfRecords = new ArrayList<>();
private List<String> districts = new ArrayList<>();
private List<UUID> schoolIds = new ArrayList<>();
private List<UUID> districtIds = new ArrayList<>();
private List<String> schoolCategoryCodes = new ArrayList<>();
private List<String> pens = new ArrayList<>();
private List<String> programs = new ArrayList<>();
private List<UUID> studentIDs = new ArrayList<>();
private List<String> statuses = new ArrayList<>();
private List<String> reportTypes = new ArrayList();
private List<String> reportTypes = new ArrayList<>();

private String user;
private Address address;
Expand All @@ -44,8 +44,8 @@ public class StudentSearchRequest implements Serializable {

@JsonIgnore
public boolean isEmpty() {
return (schoolOfRecords == null || schoolOfRecords.isEmpty()) &&
(districts == null || districts.isEmpty()) &&
return (schoolIds == null || schoolIds.isEmpty()) &&
(districtIds == null || districtIds.isEmpty()) &&
(schoolCategoryCodes == null || schoolCategoryCodes.isEmpty()) &&
(pens == null || pens.isEmpty()) &&
(studentIDs == null || studentIDs.isEmpty());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package ca.bc.gov.educ.api.batchgraduation.model.institute;

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

@Data
@Component("instituteDistrict")
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class District {

private String districtId;
private String districtNumber;
private String faxNumber;
private String phoneNumber;
private String email;
private String website;
private String displayName;
private String districtRegionCode;
private String districtStatusCode;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package ca.bc.gov.educ.api.batchgraduation.model.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;

}
Loading
Loading