Skip to content

Commit

Permalink
Merge pull request #682 from bcgov/grad-release
Browse files Browse the repository at this point in the history
Grad release 1.23
  • Loading branch information
githubmamatha committed Sep 12, 2024
2 parents 0a9c0cd + a6147b7 commit 1839042
Show file tree
Hide file tree
Showing 26 changed files with 799 additions and 139 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,7 @@ target/
build/

### VS Code ###
.vscode/
.vscode/

### Local dev ###
**/application-local.yaml
55 changes: 0 additions & 55 deletions api/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>ca.bc.gov.educ</groupId>
<artifactId>educ-grad-student-api</artifactId>
<version>1.8.62</version>
<version>1.8.63</version>
<name>educ-grad-student-api</name>
<description>Student Demographics API for GRAD team</description>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
package ca.bc.gov.educ.api.gradstudent.controller;

import java.util.List;

import ca.bc.gov.educ.api.gradstudent.model.dto.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import ca.bc.gov.educ.api.gradstudent.service.GradStudentService;
import ca.bc.gov.educ.api.gradstudent.util.EducGradStudentApiConstants;
import ca.bc.gov.educ.api.gradstudent.util.PermissionsConstants;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.UUID;

@RestController
@CrossOrigin
Expand Down Expand Up @@ -116,4 +117,12 @@ public GraduationStudentRecordDistribution getGradStudentByStudentIDFromGRAD(@Pa
public Student addNewPenFromStudentAPI(@Validated @RequestBody StudentCreate student, @RequestHeader(name="Authorization") String accessToken) {
return gradStudentService.addNewPenFromStudentAPI(student, accessToken.replaceAll("Bearer ", ""));
}

@PostMapping (EducGradStudentApiConstants.GRAD_STUDENT_BY_SEARCH_CRITERIAS)
@PreAuthorize(PermissionsConstants.READ_GRADUATION_STUDENT)
@Operation(summary = "Find Students by StudentSearchRequest criteria", description = "Find Students by StudentSearchRequest criteria", tags = { "Search Student Records" })
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public List<UUID> searchGraduationStudentRecords(@RequestBody StudentSearchRequest searchRequest) {
return gradStudentService.getStudentIDsBySearchCriteriaOrAll(searchRequest);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public ResponseEntity<GraduationStudentRecord> getStudentGradStatus(@PathVariabl
GraduationStudentRecord gradResponse = gradStatusService.getGraduationStatus(UUID.fromString(studentID),accessToken.replace(BEARER, ""));
if(gradResponse != null) {
return response.GET(gradResponse);
}else {
} else {
return response.NO_CONTENT();
}
}
Expand Down Expand Up @@ -349,20 +349,19 @@ public ResponseEntity<List<UUID>> getStudentsForYearlyRun() {
@PreAuthorize(PermissionsConstants.UPDATE_GRADUATION_STUDENT)
@Operation(summary = "Save Student Grad Status by Student ID for projected run", description = "Save Student Grad Status by Student ID for projected run", tags = { "Student Graduation Status" })
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<GraduationStudentRecord> saveStudentGradStatusDistributionRun(@PathVariable String studentID, @RequestParam(required = false) Long batchId,@RequestParam(required = false) String activityCode) {
public ResponseEntity<GraduationStudentRecord> saveStudentGradStatusDistributionRun(@PathVariable String studentID, @RequestParam(required = false) Long batchId, @RequestParam(required = false) String activityCode, @RequestParam(required = false) String username) {
logger.debug("Save Distribution student Grad Status for Student ID");
GraduationStudentRecord gradRecord = gradStatusService.saveStudentRecordDistributionRun(UUID.fromString(studentID),batchId,activityCode);
GraduationStudentRecord gradRecord = gradStatusService.saveStudentRecordDistributionRun(UUID.fromString(studentID),batchId,activityCode,username);
return response.GET(gradRecord);
}

@PutMapping(EducGradStudentApiConstants.GRADUATION_RECORD_HISTORY_BY_BATCH_ID_DISTRIBUTION_RUN)
@PreAuthorize(PermissionsConstants.UPDATE_GRADUATION_STUDENT)
@Operation(summary = "Save Student Grad Status by Student ID for projected run", description = "Save Student Grad Status by Student ID for projected run", tags = { "Student Graduation Status" })
@Operation(summary = "Save Student Grad Status History by List of Student IDs", description = "Save Student Grad Status History by List of Student IDs", tags = { "Student Graduation History" })
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<ApiResponseModel<Void>> updateStudentGradHistoryStatusDistributionRun(@PathVariable Long batchID, @RequestParam(required = false) String userName) {
public ResponseEntity<ApiResponseModel<Integer>> updateStudentGradHistoryStatusDistributionRun(@PathVariable Long batchID, @RequestParam(required = false) String userName, @RequestParam(required = false) String activityCode, @RequestBody List<UUID> studentGuids) {
logger.debug("Save Distribution student Grad history for Student ID");
historyService.updateStudentRecordHistoryDistributionRun(batchID, userName);
return response.UPDATED(null);
return response.UPDATED(historyService.updateStudentRecordHistoryDistributionRun(batchID, userName, activityCode, studentGuids));
}

@GetMapping (EducGradStudentApiConstants.STUDENT_LIST_FOR_SCHOOL_REPORT)
Expand Down Expand Up @@ -392,6 +391,22 @@ public ResponseEntity<Integer> getStudentsCountForAmalgamatedSchoolReport(@PathV
return response.GET(gradStatusService.countStudentsForAmalgamatedSchoolReport(schoolOfRecord));
}

@PostMapping (EducGradStudentApiConstants.STUDENT_COUNT)
@PreAuthorize(PermissionsConstants.READ_GRADUATION_STUDENT)
@Operation(summary = "Get Students Count by mincode and status", description = "Get Students Count by mincode and status", tags = { "Business" })
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<Long> getStudentsCount(@RequestParam(required = false) String studentStatus, @RequestBody List<String> schoolOfRecords) {
return response.GET(gradStatusService.countBySchoolOfRecordsAndStudentStatus(schoolOfRecords, studentStatus));
}

@PostMapping (EducGradStudentApiConstants.STUDENT_ARCHIVE)
@PreAuthorize(PermissionsConstants.ARCHIVE_GRADUATION_STUDENT)
@Operation(summary = "Get Students Count by mincode and status", description = "Get Students Count by mincode and status", tags = { "Business" })
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<Integer> archiveStudents(@RequestParam long batchId, @RequestParam(required = false) String studentStatus, @RequestParam(required = false) String userName, @RequestBody List<String> schoolOfRecords) {
return response.GET(gradStatusService.archiveStudents(batchId, schoolOfRecords, studentStatus, userName));
}

@PostMapping (EducGradStudentApiConstants.UPDATE_GRAD_STUDENT_FLAG_BY_BATCH_JOB_TYPE_AND_MULTIPLE_STUDENTIDS)
@PreAuthorize(PermissionsConstants.UPDATE_GRADUATION_STUDENT)
@Operation(summary = "Update Student Flag ready for batch by Batch Job Type and Student IDs", description = "Update Student Flag ready for batch by Batch Job Type and Student IDs", tags = { "Batch Algorithm" })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ public class StudentSearchRequest implements Serializable {
String schoolOfRecord;
String gradProgram;

private List<String> schoolOfRecords;
private List<String> districts;
private List<String> schoolCategoryCodes;
private List<String> pens;
private List<String> programs;
private List<UUID> studentIDs;
private List<String> schoolOfRecords = new ArrayList<>();
private List<String> districts = 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();

@JsonFormat(pattern= EducGradStudentApiConstants.DEFAULT_DATE_FORMAT)
LocalDate gradDateFrom;
Expand Down Expand Up @@ -82,4 +84,13 @@ public List<String> getPrograms() {
public String toJson() {
return new Gson().toJson(this);
}

public boolean isEmpty() {
return schoolOfRecords.isEmpty() &&
districts.isEmpty() &&
schoolCategoryCodes.isEmpty() &&
pens.isEmpty() &&
studentIDs.isEmpty() &&
programs.isEmpty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ protected void onCreate() {
if (StringUtils.isBlank(updateUser)) {
this.updateUser = EducGradStudentApiConstants.DEFAULT_UPDATED_BY;
}
}
this.createDate = LocalDateTime.now();
this.updateDate = LocalDateTime.now();
}
if(this.createDate == null) {
this.createDate = LocalDateTime.now();
}
if(this.updateDate == null) {
this.updateDate = LocalDateTime.now();
}

}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package ca.bc.gov.educ.api.gradstudent.model.entity;

import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import jakarta.persistence.*;
import java.util.Date;
import java.util.UUID;

Expand Down Expand Up @@ -78,6 +78,12 @@ public GraduationStudentRecordEntity() {
@Column(name = "STUDENT_PROJECTED_GRAD_DATA", columnDefinition="CLOB")
private String studentProjectedGradData;

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

@Column(name = "SCHOOL_AT_GRADUATION_ID", nullable = true)
private UUID schoolAtGraduationId;

@Transient
private String legalFirstName;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package ca.bc.gov.educ.api.gradstudent.model.entity;

import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.GenericGenerator;

import jakarta.persistence.*;
import java.util.Date;
import java.util.UUID;

Expand Down Expand Up @@ -75,6 +75,12 @@ public class GraduationStudentRecordHistoryEntity extends BaseEntity {
@Column(name = "ADULT_START_DATE", nullable = true)
private Date adultStartDate;

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

@Column(name = "SCHOOL_AT_GRADUATION_ID", nullable = true)
private UUID schoolAtGraduationId;

//@Lob
//@Column(name = "STUDENT_PROJECTED_GRAD_DATA", columnDefinition="CLOB")
@Transient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public interface GraduationStudentRecordView {
public String getStudentCitizenship();
public Date getAdultStartDate();
public String getStudentProjectedGradData() ;
public UUID getSchoolOfRecordId();
public UUID getSchoolAtGraduationId();
public LocalDateTime getCreateDate();
public LocalDateTime getUpdateDate();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package ca.bc.gov.educ.api.gradstudent.model.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.UUID;

@Data
@EqualsAndHashCode(callSuper = false)
@Entity
@Table(name = "STUDENT_GUID_PEN_XREF")
public class StudentGuidPenXrefEntity extends BaseEntity {

@Id
@Column(name = "STUDENT_GUID", nullable = false)
private UUID studentID;

@Column(name = "STUDENT_PEN", nullable = false)
private String pen;
}
Loading

0 comments on commit 1839042

Please sign in to comment.