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 1806 #687

Open
wants to merge 8 commits into
base: grad-release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 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 @@ -39,6 +39,7 @@ public class Student implements Serializable {
private String localId = "";
private String hasOtherProgram = "";
private LocalDateTime lastUpdateDate;
private LocalDateTime projectedGradDate;
private List<OtherProgram> otherProgramParticipation = new ArrayList<>();
private List<NonGradReason> nonGradReasons = new ArrayList<>();

Expand Down Expand Up @@ -237,6 +238,15 @@ public void setLastUpdateDate(LocalDateTime lastUpdateDate) {
this.lastUpdateDate = lastUpdateDate;
}

@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
public LocalDateTime getProjectedGradDate() {
return projectedGradDate;
}

public void setProjectedGradDate(LocalDateTime projectedGradDate) {
this.projectedGradDate = projectedGradDate;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class ReportController extends BaseController {
@PreAuthorize(PermissionsContants.STUDENT_ACHIEVEMENT_REPORT)
@Operation(summary = "Generate Student Achievement Report", description = "Generate Student Achievement Report", tags = {"Report"})
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<byte[]> getStudentAchievementReport(@RequestBody ReportRequest report, @RequestHeader(name = "Authorization") String accessToken) {
public ResponseEntity<byte[]> getStudentAchievementReport(@RequestHeader(name = "Authorization") String accessToken, @RequestBody ReportRequest report) {
logger.debug("getStudentAchievementReport");
logRequest(report);
setAccessToken(report, accessToken);
Expand All @@ -51,7 +51,7 @@ public ResponseEntity<byte[]> getStudentAchievementReport(@RequestBody ReportReq
@PreAuthorize(PermissionsContants.STUDENT_TRANSCRIPT_REPORT)
@Operation(summary = "Generate Student Transcript Report", description = "Generate Student Transcript Report", tags = {"Report"})
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<byte[]> getStudentTranscriptReport(@RequestBody ReportRequest report, @RequestHeader(name = "Authorization") String accessToken) {
public ResponseEntity<byte[]> getStudentTranscriptReport(@RequestHeader(name = "Authorization") String accessToken, @RequestBody ReportRequest report) {
logger.debug("getStudentTranscriptReport");
logRequest(report);
setAccessToken(report, accessToken);
Expand Down Expand Up @@ -85,7 +85,7 @@ public ResponseEntity<byte[]> getStudentXmlTranscriptReport(@RequestBody XmlRepo
@PreAuthorize(PermissionsContants.STUDENT_CERTIFICATE)
@Operation(summary = "Generate Student Certificate", description = "Generate Student Certificate", tags = {"Report"})
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<byte[]> getStudentCertificate(@RequestBody ReportRequest report, @RequestHeader(name = "Authorization") String accessToken) {
public ResponseEntity<byte[]> getStudentCertificate(@RequestHeader(name = "Authorization") String accessToken, @RequestBody ReportRequest report) {
logger.debug("getStudentCertificate");
logRequest(report);
setAccessToken(report, accessToken);
Expand All @@ -102,7 +102,7 @@ public ResponseEntity<byte[]> getStudentCertificate(@RequestBody ReportRequest r
@PreAuthorize(PermissionsContants.PACKING_SLIP)
@Operation(summary = "Generate Packing Slip", description = "Generate Packing Slip", tags = {"Report"})
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<byte[]> getPackingSlip(@RequestBody ReportRequest report, @RequestHeader(name = "Authorization") String accessToken) {
public ResponseEntity<byte[]> getPackingSlip(@RequestHeader(name = "Authorization") String accessToken, @RequestBody ReportRequest report) {
logger.debug("getPackingSlip");
logRequest(report);
setAccessToken(report, accessToken);
Expand All @@ -119,7 +119,7 @@ public ResponseEntity<byte[]> getPackingSlip(@RequestBody ReportRequest report,
@PreAuthorize(PermissionsContants.SCHOOL_DISTRIBUTION)
@Operation(summary = "Generate School Distribution Report", description = "Generate School Distribution Report", tags = {"Report"})
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<byte[]> getSchoolDistribution(@RequestBody ReportRequest report, @RequestHeader(name = "Authorization") String accessToken) {
public ResponseEntity<byte[]> getSchoolDistribution(@RequestHeader(name = "Authorization") String accessToken, @RequestBody ReportRequest report) {
logger.debug("getSchoolDistribution");
logRequest(report);
setAccessToken(report, accessToken);
Expand All @@ -136,7 +136,7 @@ public ResponseEntity<byte[]> getSchoolDistribution(@RequestBody ReportRequest r
@PreAuthorize(PermissionsContants.SCHOOL_DISTRIBUTION)
@Operation(summary = "Generate School Distribution Report", description = "Generate School Distribution Report", tags = {"Report"})
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<byte[]> getSchoolDistributionYearEnd(@RequestBody ReportRequest report, @RequestHeader(name = "Authorization") String accessToken) {
public ResponseEntity<byte[]> getSchoolDistributionYearEnd(@RequestHeader(name = "Authorization") String accessToken, @RequestBody ReportRequest report) {
logger.debug("getSchoolDistributionYearEnd");
logRequest(report);
setAccessToken(report, accessToken);
Expand All @@ -153,7 +153,7 @@ public ResponseEntity<byte[]> getSchoolDistributionYearEnd(@RequestBody ReportRe
@PreAuthorize(PermissionsContants.SCHOOL_DISTRIBUTION)
@Operation(summary = "Generate District Distribution Report", description = "Generate District Distribution Year End Report", tags = {"Report"})
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<byte[]> getDistrictDistributionYearEnd(@RequestBody ReportRequest report, @RequestHeader(name = "Authorization") String accessToken) {
public ResponseEntity<byte[]> getDistrictDistributionYearEnd(@RequestHeader(name = "Authorization") String accessToken, @RequestBody ReportRequest report) {
logger.debug("getDistrictDistributionYearEnd");
logRequest(report);
setAccessToken(report, accessToken);
Expand All @@ -170,7 +170,7 @@ public ResponseEntity<byte[]> getDistrictDistributionYearEnd(@RequestBody Report
@PreAuthorize(PermissionsContants.SCHOOL_DISTRIBUTION)
@Operation(summary = "Generate District Distribution Report", description = "Generate District Distribution Year End Non Grad Report", tags = {"Report"})
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<byte[]> getDistrictDistributionYearEndNonGrad(@RequestBody ReportRequest report, @RequestHeader(name = "Authorization") String accessToken) {
public ResponseEntity<byte[]> getDistrictDistributionYearEndNonGrad(@RequestHeader(name = "Authorization") String accessToken, @RequestBody ReportRequest report) {
logger.debug("getDistrictDistributionYearEndNonGrad");
logRequest(report);
setAccessToken(report, accessToken);
Expand All @@ -187,7 +187,7 @@ public ResponseEntity<byte[]> getDistrictDistributionYearEndNonGrad(@RequestBody
@PreAuthorize(PermissionsContants.SCHOOL_LABEL)
@Operation(summary = "Generate School Label Report", description = "Generate School Label Report", tags = {"Report"})
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<byte[]> getSchoolLabel(@RequestBody ReportRequest report, @RequestHeader(name = "Authorization") String accessToken) {
public ResponseEntity<byte[]> getSchoolLabel(@RequestHeader(name = "Authorization") String accessToken, @RequestBody ReportRequest report) {
logger.debug("getSchoolLabel");
logRequest(report);
setAccessToken(report, accessToken);
Expand All @@ -204,7 +204,7 @@ public ResponseEntity<byte[]> getSchoolLabel(@RequestBody ReportRequest report,
@PreAuthorize(PermissionsContants.SCHOOL_GRADUATION)
@Operation(summary = "Generate School Graduation Report", description = "Generate School Graduation Report", tags = {"Report"})
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<byte[]> getSchoolGraduation(@RequestBody ReportRequest report, @RequestHeader(name = "Authorization") String accessToken) {
public ResponseEntity<byte[]> getSchoolGraduation(@RequestHeader(name = "Authorization") String accessToken, @RequestBody ReportRequest report) {
logger.debug("getSchoolGraduation");
logRequest(report);
setAccessToken(report, accessToken);
Expand All @@ -221,7 +221,7 @@ public ResponseEntity<byte[]> getSchoolGraduation(@RequestBody ReportRequest rep
@PreAuthorize(PermissionsContants.SCHOOL_NON_GRADUATION)
@Operation(summary = "Generate School Non-Graduates Report", description = "Generate School Non-Graduates Report", tags = {"Report"})
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<byte[]> getSchoolNonGraduation(@RequestBody ReportRequest report, @RequestHeader(name = "Authorization") String accessToken) {
public ResponseEntity<byte[]> getSchoolNonGraduation(@RequestHeader(name = "Authorization") String accessToken, @RequestBody ReportRequest report) {
logger.debug("getSchoolNonGraduation");
logRequest(report);
setAccessToken(report, accessToken);
Expand All @@ -238,7 +238,7 @@ public ResponseEntity<byte[]> getSchoolNonGraduation(@RequestBody ReportRequest
@PreAuthorize(PermissionsContants.STUDENT_NON_GRAD)
@Operation(summary = "Generate Student NonGraduate Projected Requirements Report", description = "Generate Student NonGraduate Projected Requirements Report", tags = {"Report"})
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<byte[]> getStudentNonGradProjected(@RequestBody ReportRequest report, @RequestHeader(name = "Authorization") String accessToken) {
public ResponseEntity<byte[]> getStudentNonGradProjected(@RequestHeader(name = "Authorization") String accessToken, @RequestBody ReportRequest report) {
logger.debug("getStudentNonGradProjected");
logRequest(report);
setAccessToken(report, accessToken);
Expand All @@ -251,11 +251,28 @@ public ResponseEntity<byte[]> getStudentNonGradProjected(@RequestBody ReportRequ
}
}

@PostMapping(ReportApiConstants.STUDENT_GRAD_PROJECTED)
@PreAuthorize(PermissionsContants.STUDENT_GRAD)
@Operation(summary = "Generate Student Graduate Projected Requirements Report", description = "Generate Student Graduate Projected Requirements Report", tags = {"Report"})
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<byte[]> getStudentGradProjected(@RequestHeader(name = "Authorization") String accessToken, @RequestBody ReportRequest report) {
logger.debug("getStudentGradProjected");
logRequest(report);
setAccessToken(report, accessToken);
try {
String reportFile = report.getOptions().getReportFile();
byte[] resultBinary = reportService.getStudentGradProjectedReport(report);
return handleBinaryResponse(resultBinary, reportFile);
} catch (Exception e) {
return getInternalServerErrorResponse(e);
}
}

@PostMapping(ReportApiConstants.STUDENT_NON_GRAD)
@PreAuthorize(PermissionsContants.STUDENT_NON_GRAD)
@Operation(summary = "Generate Student NonGraduate Report", description = "Generate Student NonGraduate Report", tags = {"Report"})
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<byte[]> getStudentNonGrad(@RequestBody ReportRequest report, @RequestHeader(name = "Authorization") String accessToken) {
public ResponseEntity<byte[]> getStudentNonGrad(@RequestHeader(name = "Authorization") String accessToken, @RequestBody ReportRequest report) {
logger.debug("getStudentNonGrad");
logRequest(report);
setAccessToken(report, accessToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ public class GradReportService {
@Autowired
StudentNonGradProjectedService studentNonGradProjectedService;

@Autowired
StudentGradProjectedService studentGradProjectedService;

@Autowired
StudentNonGradService studentNonGradService;

Expand Down Expand Up @@ -376,6 +379,22 @@ public byte[] getStudentNonGradProjectedReport(ReportRequest reportRequest) {
return response;
}

public byte[] getStudentGradProjectedReport(ReportRequest reportRequest) {
String methodName = "getStudentGradProjectedReport(ReportRequest reportRequest)";
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);

byte[] response = null;

try {
StudentGradProjectedReport studentGradProjectedReport = getStudentGradProjectedReportDocument(reportRequest);
response = studentGradProjectedReport.asBytes();
} catch (Exception e) {
throw new ReportApiServiceException(String.format(EXCEPTION_MSG, methodName), e);
}
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);
return response;
}

public byte[] getStudentNonGradReport(ReportRequest reportRequest) {
String methodName = "getStudentNonGradReport(ReportRequest reportRequest)";
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);
Expand Down Expand Up @@ -479,6 +498,15 @@ public StudentNonGradProjectedReport getStudentNonGradProjectedReportDocument(Re
return studentNonGradProjectedService.buildStudentNonGradProjectedReport();
}

public StudentGradProjectedReport getStudentGradProjectedReportDocument(ReportRequest reportRequest) throws IOException {
String methodName = "getStudentGradProjectedReportDocument(ReportRequest reportRequest)";
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);

ReportRequestDataThreadLocal.setReportData(reportRequest.getData());

return studentGradProjectedService.buildStudentGradProjectedReport();
}

public StudentNonGradReport getStudentNonGradReportDocument(ReportRequest reportRequest) throws IOException {
String methodName = "getStudentNonGradReportDocument(ReportRequest reportRequest)";
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public interface PermissionsContants {
String SCHOOL_GRADUATION = _PREFIX + "SCOPE_CREATE_SCHOOL_GRADUATION" + _SUFFIX;
String SCHOOL_NON_GRADUATION = _PREFIX + "SCOPE_CREATE_SCHOOL_NON_GRADUATION" + _SUFFIX;
String STUDENT_NON_GRAD = _PREFIX + "SCOPE_CREATE_STUDENT_NON_GRAD" + _SUFFIX;
String STUDENT_GRAD = _PREFIX + "SCOPE_CREATE_STUDENT_GRAD" + _SUFFIX;

String CREATE_OR_UPDATE_SIGNATURE_IMAGE = _PREFIX + "SCOPE_CREATE_OR_UPDATE_SIGNATURE_IMAGE" + _SUFFIX;
String READ_SIGNATURE_IMAGE_BY_CODE = _PREFIX + "SCOPE_READ_SIGNATURE_IMAGE_BY_CODE" + _SUFFIX;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class ReportApiConstants {
public static final String SCHOOL_NON_GRADUATION = "/schoolnongraduation";
public static final String STUDENT_NON_GRAD = "/studentnongrad";
public static final String STUDENT_NON_GRAD_PROJECTED = "/studentnongradprojected";
public static final String STUDENT_GRAD_PROJECTED = "/studentgradprojected";

//Attribute Constants
public static final String PEN_ATTRIBUTE = "pen";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,11 @@ public Pair<List<Student>, TotalCounts> getStudents(ReportData reportData) {
updateDate = Date.from(st.getLastUpdateDate().atZone(ZoneId.systemDefault()).toInstant());
}

Date projectedGradDate = null;
if(st.getProjectedGradDate() != null) {
projectedGradDate = Date.from(st.getProjectedGradDate().atZone(ZoneId.systemDefault()).toInstant());
}

if(!StringUtils.isBlank(pen.getEntityId())) {
Optional<Date> distributionDate = studentCertificateRepository.getCertificateDistributionDate(UUID.fromString(pen.getEntityId()));
distributionDate.ifPresent(student::setCertificateDistributionDate);
Expand All @@ -518,14 +523,15 @@ public Pair<List<Student>, TotalCounts> getStudents(ReportData reportData) {
student.setTranscriptTypes(transcriptTypes.stream().map(TranscriptTypeCodeEntity::getLabel).collect(Collectors.toList()));
totals.countTranscript(transcriptTypes.size());

if("buildStudentNonGradProjectedReport()".equalsIgnoreCase(reportData.getReportIdentity())) {
if(StringUtils.containsAnyIgnoreCase(reportData.getReportIdentity(), "buildStudentNonGradProjectedReport()", "buildStudentGradProjectedReport()")) {
Optional<Date> reportUpdatedTimestamp = studentReportRepository.getReportUpdatedTimestamp(UUID.fromString(pen.getEntityId()));
if(reportUpdatedTimestamp.isPresent()) {
updateDate = reportUpdatedTimestamp.get();
}
}
}
student.setLastUpdateDate(updateDate);
student.setProjectedGradDate(projectedGradDate);
}
return Pair.of(new ArrayList<>(result), totals);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* *********************************************************************
* Copyright (c) 2016, Ministry of Education, BC.
*
* All rights reserved.
* This information contained herein may not be used in whole
* or in part without the express written consent of the
* Government of British Columbia, Canada.
*
* Revision Control Information
* File: $Id:: $
* Date of Last Commit: $Date:: $
* Revision Number: $Rev:: $
* Last Commit by: $Author:: $
*
* ***********************************************************************
*/
package ca.bc.gov.educ.grad.report.dto.impl;

import ca.bc.gov.educ.grad.report.model.common.support.report.BusinessReportEntity;
import ca.bc.gov.educ.grad.report.model.reports.ReportFormat;
import ca.bc.gov.educ.grad.report.model.student.StudentGradProjectedReport;

/**
* The underlying implementation for the GUI. This is an intermediary between
* the GUI and the report service to loosely couple the producer and the
* consumer. It provides the data necessary for the GUI to display an unofficial
* transcript of grades report.
*
* @author CGI Information Management Consultants Inc.
*/
public final class StudentGradProjectedReportImpl extends BusinessReportEntity
implements StudentGradProjectedReport {

private static final long serialVersionUID = 3L;

/**
* Class Constructor populates all the object attributes during
* construction.
*
* @param reportData
* @param reportFormat
* @param reportName
* @param filename
*/
public StudentGradProjectedReportImpl(
final byte[] reportData,
final ReportFormat reportFormat,
final String filename,
final String reportName) {
super(reportData, reportFormat, filename, reportName);
}
}
Loading
Loading