Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/GRAD2-2465-km' into GRAD2-2465-km
Browse files Browse the repository at this point in the history
  • Loading branch information
kamal-mohammed committed Mar 4, 2024
2 parents 06a7ee5 + bdfd7e1 commit 376cd1f
Show file tree
Hide file tree
Showing 36 changed files with 1,032 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public StudentInfo getStudentInfo(ReportData reportData) {
student.getMiddleName(),// String middleName,
student.getLastName(),// String lastName,
student.getBirthdate() != null ? student.getBirthdate() : null,// Long birthdate,
student.getLocalId(),// String localId,
student.getPen().getEntityId(),// String localId,
student.getGender(),// Character studGender,
student.getCitizenship(), //citizenship
school.getMinistryCode(),// String mincode,
Expand Down Expand Up @@ -146,7 +146,7 @@ public Student getStudent(ReportData reportData) {
}
StudentImpl student = new StudentImpl();
BeanUtils.copyProperties(reportData.getStudent(), student);
student.setPen(new PersonalEducationNumberObject(reportData.getStudent().getPen().getPen()));
student.setPen(new PersonalEducationNumberObject(reportData.getStudent().getPen().getPen(), reportData.getStudent().getPen().getEntityID()));
PostalAddressImpl address = new PostalAddressImpl();
if (reportData.getStudent().getAddress() != null) {
BeanUtils.copyProperties(reportData.getStudent().getAddress(), address);
Expand Down Expand Up @@ -478,8 +478,7 @@ public Pair<List<Student>, TotalCounts> getStudents(ReportData reportData) {
}
StudentImpl student = new StudentImpl();
BeanUtils.copyProperties(st, student);
PersonalEducationNumberObject pen = new PersonalEducationNumberObject(st.getPen().getPen());
pen.setEntityId(st.getPen().getEntityID());
PersonalEducationNumberObject pen = new PersonalEducationNumberObject(st.getPen().getPen(), st.getPen().getEntityID());
student.setPen(pen);

if(result.add(student)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.UUID;

public interface StudentTranscriptRepository extends JpaRepository<StudentTranscriptEntity, UUID> {
Expand All @@ -15,4 +17,7 @@ public interface StudentTranscriptRepository extends JpaRepository<StudentTransc

@Query("select t from TranscriptTypeCodeEntity t join StudentTranscriptEntity c on t.transcriptTypeCode = c.transcriptTypeCode where c.documentStatusCode='COMPL' and c.graduationStudentRecordId=:graduationStudentRecordId")
List<TranscriptTypeCodeEntity> getStudentTranscriptTypes(UUID graduationStudentRecordId);

@Query("select max(c.updateDate) as updateDate from StudentTranscriptEntity c where c.graduationStudentRecordId=:graduationStudentRecordId")
Optional<Date> getTranscriptLastUpdateDate(UUID graduationStudentRecordId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public PersonalEducationNumberObject(String pen) {
this.pen = pen;
}

public PersonalEducationNumberObject(String pen, String entityId) {
this.pen = pen;
this.entityId = entityId;
}

@Override
public String getValue() {
return pen;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

public interface PersonalEducationNumber {

public static final PersonalEducationNumber NULL = new PersonalEducationNumberObject("");
public static final PersonalEducationNumber NULL = new PersonalEducationNumberObject("", "");

String getValue();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.*;
Expand All @@ -47,7 +46,7 @@
import static java.lang.Integer.parseInt;
import static java.util.Locale.CANADA;

public abstract class GradReportServiceImpl implements Serializable {
public abstract class GradReportServiceImpl {

private static final long serialVersionUID = 5L;

Expand All @@ -67,9 +66,9 @@ public abstract class GradReportServiceImpl implements Serializable {
@Autowired
JsonTransformer jsonTransformer;
@Autowired
transient WebClient webClient;
WebClient webClient;
@Autowired
transient EducGradReportApiConstants constants;
EducGradReportApiConstants constants;

@RolesAllowed({FULFILLMENT_SERVICES_USER})
public Parameters<String, Object> createParameters() {
Expand Down Expand Up @@ -143,7 +142,7 @@ Certificate getCertificate(ReportData reportData) {


InputStream openImageResource(final String resource) throws IOException {
//final URL url = getReportResource(resource);
/** final URL url = getReportResource(resource); **/
URL url = this.getClass().getResource(DIR_IMAGE_BASE + resource);
assert url != null;
return url.openStream();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package ca.bc.gov.educ.grad.report.service.impl;

import ca.bc.gov.educ.grad.report.api.client.ReportData;
import ca.bc.gov.educ.grad.report.dao.GradDataConvertionBean;
import ca.bc.gov.educ.grad.report.dao.ProgramCertificateTranscriptRepository;
import ca.bc.gov.educ.grad.report.dao.StudentTranscriptRepository;
import ca.bc.gov.educ.grad.report.dto.impl.*;
import ca.bc.gov.educ.grad.report.entity.ProgramCertificateTranscriptEntity;
import ca.bc.gov.educ.grad.report.exception.EntityNotFoundException;
Expand Down Expand Up @@ -108,14 +108,15 @@ public class StudentTranscriptServiceImpl extends GradReportServiceImpl implemen
*/
private static final String SORT_ASSESSMENT = "100";

@Autowired
private ReportService reportService;
private final ProgramCertificateTranscriptRepository programCertificateTranscriptRepository;

@Autowired
private GradDataConvertionBean gradDataConvertionBean;
private final StudentTranscriptRepository studentTranscriptRepository;

@Autowired
private ProgramCertificateTranscriptRepository programCertificateTranscriptRepository;
public StudentTranscriptServiceImpl(ProgramCertificateTranscriptRepository programCertificateTranscriptRepository, StudentTranscriptRepository studentTranscriptRepository) {
this.programCertificateTranscriptRepository = programCertificateTranscriptRepository;
this.studentTranscriptRepository = studentTranscriptRepository;
}

/**
* Creates the student's official transcript as a PDF (no other formats are
Expand Down Expand Up @@ -618,6 +619,17 @@ private StudentTranscriptReport getStudentTranscriptReport(
final String gradMessage = studentInfo.getGradMessage();
final List<NonGradReason> nonGradReasons = adaptReasons(studentInfo);

Date issueDate = transcript.getIssueDate();

if(preview && StringUtils.isNotBlank(personalEducationNumber.getEntityId())) {
LOG.log(Level.FINE, "Preview transcript get Last Update Date");
UUID graduationStudentRecordId = UUID.fromString(personalEducationNumber.getEntityId());
Optional<Date> transcriptLastUpdateDate = studentTranscriptRepository.getTranscriptLastUpdateDate(graduationStudentRecordId);
if(transcriptLastUpdateDate.isPresent()) {
issueDate = transcriptLastUpdateDate.get();
}
}

final StudentTranscriptReport report = createReport(
format,
preview,
Expand All @@ -628,7 +640,7 @@ private StudentTranscriptReport getStudentTranscriptReport(
program,
nonGradReasons,
gradMessage,
transcript.getIssueDate(),
issueDate,
parameters,
graduationData
);
Expand Down
5 changes: 4 additions & 1 deletion api/src/main/resources/reports/Transcript_BC1950-IND.jrxml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@
<variable name="V_TITLE" class="java.lang.String" calculation="System">
<initialValueExpression><![CDATA[(($P{P_REPORT_PREVIEW} ? "XML Transcript Preview" : "Transcript of Grades")).toUpperCase()]]></initialValueExpression>
</variable>
<variable name="V_ISSUE_DATE" class="java.lang.String" calculation="System">
<initialValueExpression><![CDATA[(($P{P_REPORT_PREVIEW} ? "Last Updated:" : "Issue Date:"))]]></initialValueExpression>
</variable>
<variable name="V_STUDENT_FULL_NAME" class="java.lang.String">
<variableExpression><![CDATA[$F{student.fullName}]]></variableExpression>
<initialValueExpression><![CDATA[$F{student.fullName}]]></initialValueExpression>
Expand Down Expand Up @@ -296,7 +299,7 @@ $V{V_SCHOOL_ADDRESS_POSTAL_CODE_NO_WHITESPACE}.substring( 0, 3 ) + " " + $V{V_SC
<printWhenExpression><![CDATA[!$P{P_REPORT_BLANK}]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Top"/>
<textFieldExpression><![CDATA["Issue Date: " + $V{V_REPORT_DATE}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{V_ISSUE_DATE} + " " + $V{V_REPORT_DATE}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement style="Title" x="327" y="6" width="230" height="15" uuid="05821e85-e4be-4d7f-b654-809db99c5756"/>
Expand Down
5 changes: 4 additions & 1 deletion api/src/main/resources/reports/Transcript_BC1950-PUB.jrxml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@
<variable name="V_TITLE" class="java.lang.String" calculation="System">
<initialValueExpression><![CDATA[(($P{P_REPORT_PREVIEW} ? "XML Transcript Preview" : "Transcript of Grades")).toUpperCase()]]></initialValueExpression>
</variable>
<variable name="V_ISSUE_DATE" class="java.lang.String" calculation="System">
<initialValueExpression><![CDATA[(($P{P_REPORT_PREVIEW} ? "Last Updated:" : "Issue Date:"))]]></initialValueExpression>
</variable>
<variable name="V_STUDENT_FULL_NAME" class="java.lang.String">
<variableExpression><![CDATA[$F{student.fullName}]]></variableExpression>
<initialValueExpression><![CDATA[$F{student.fullName}]]></initialValueExpression>
Expand Down Expand Up @@ -296,7 +299,7 @@ $V{V_SCHOOL_ADDRESS_POSTAL_CODE_NO_WHITESPACE}.substring( 0, 3 ) + " " + $V{V_SC
<printWhenExpression><![CDATA[!$P{P_REPORT_BLANK}]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Top"/>
<textFieldExpression><![CDATA["Issue Date: " + $V{V_REPORT_DATE}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{V_ISSUE_DATE} + " " + $V{V_REPORT_DATE}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement style="Title" x="327" y="6" width="230" height="15" uuid="05821e85-e4be-4d7f-b654-809db99c5756"/>
Expand Down
5 changes: 4 additions & 1 deletion api/src/main/resources/reports/Transcript_BC1986-IND.jrxml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@
<variable name="V_TITLE" class="java.lang.String" calculation="System">
<initialValueExpression><![CDATA[(($P{P_REPORT_PREVIEW} ? "XML Transcript Preview" : "Transcript of Grades")).toUpperCase()]]></initialValueExpression>
</variable>
<variable name="V_ISSUE_DATE" class="java.lang.String" calculation="System">
<initialValueExpression><![CDATA[(($P{P_REPORT_PREVIEW} ? "Last Updated:" : "Issue Date:"))]]></initialValueExpression>
</variable>
<variable name="V_STUDENT_FULL_NAME" class="java.lang.String">
<variableExpression><![CDATA[$F{student.fullName}]]></variableExpression>
<initialValueExpression><![CDATA[$F{student.fullName}]]></initialValueExpression>
Expand Down Expand Up @@ -280,7 +283,7 @@ $V{V_SCHOOL_ADDRESS_POSTAL_CODE_NO_WHITESPACE}.substring( 0, 3 ) + " " + $V{V_SC
<printWhenExpression><![CDATA[!$P{P_REPORT_BLANK}]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Top"/>
<textFieldExpression><![CDATA["Issue Date: " + $V{V_REPORT_DATE}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{V_ISSUE_DATE} + " " + $V{V_REPORT_DATE}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement style="Title" x="327" y="6" width="230" height="15" uuid="05821e85-e4be-4d7f-b654-809db99c5756"/>
Expand Down
5 changes: 4 additions & 1 deletion api/src/main/resources/reports/Transcript_BC1986-PUB.jrxml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@
<variable name="V_TITLE" class="java.lang.String" calculation="System">
<initialValueExpression><![CDATA[(($P{P_REPORT_PREVIEW} ? "XML Transcript Preview" : "Transcript of Grades")).toUpperCase()]]></initialValueExpression>
</variable>
<variable name="V_ISSUE_DATE" class="java.lang.String" calculation="System">
<initialValueExpression><![CDATA[(($P{P_REPORT_PREVIEW} ? "Last Updated:" : "Issue Date:"))]]></initialValueExpression>
</variable>
<variable name="V_STUDENT_FULL_NAME" class="java.lang.String">
<variableExpression><![CDATA[$F{student.fullName}]]></variableExpression>
<initialValueExpression><![CDATA[$F{student.fullName}]]></initialValueExpression>
Expand Down Expand Up @@ -280,7 +283,7 @@ $V{V_SCHOOL_ADDRESS_POSTAL_CODE_NO_WHITESPACE}.substring( 0, 3 ) + " " + $V{V_SC
<printWhenExpression><![CDATA[!$P{P_REPORT_BLANK}]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Top"/>
<textFieldExpression><![CDATA["Issue Date: " + $V{V_REPORT_DATE}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{V_ISSUE_DATE} + " " + $V{V_REPORT_DATE}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement style="Title" x="327" y="6" width="230" height="15" uuid="05821e85-e4be-4d7f-b654-809db99c5756"/>
Expand Down
5 changes: 4 additions & 1 deletion api/src/main/resources/reports/Transcript_BC1996-IND.jrxml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@
<variable name="V_TITLE" class="java.lang.String" calculation="System">
<initialValueExpression><![CDATA[(($P{P_REPORT_PREVIEW} ? "XML Transcript Preview" : "Transcript of Grades")).toUpperCase()]]></initialValueExpression>
</variable>
<variable name="V_ISSUE_DATE" class="java.lang.String" calculation="System">
<initialValueExpression><![CDATA[(($P{P_REPORT_PREVIEW} ? "Last Updated:" : "Issue Date:"))]]></initialValueExpression>
</variable>
<variable name="V_STUDENT_FULL_NAME" class="java.lang.String">
<variableExpression><![CDATA[$F{student.fullName}]]></variableExpression>
<initialValueExpression><![CDATA[$F{student.fullName}]]></initialValueExpression>
Expand Down Expand Up @@ -296,7 +299,7 @@ $V{V_SCHOOL_ADDRESS_POSTAL_CODE_NO_WHITESPACE}.substring( 0, 3 ) + " " + $V{V_SC
<printWhenExpression><![CDATA[!$P{P_REPORT_BLANK}]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Top"/>
<textFieldExpression><![CDATA["Issue Date: " + $V{V_REPORT_DATE}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{V_ISSUE_DATE} + " " + $V{V_REPORT_DATE}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement style="Title" x="327" y="6" width="230" height="15" uuid="05821e85-e4be-4d7f-b654-809db99c5756"/>
Expand Down
5 changes: 4 additions & 1 deletion api/src/main/resources/reports/Transcript_BC1996-PUB.jrxml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@
<variable name="V_TITLE" class="java.lang.String" calculation="System">
<initialValueExpression><![CDATA[(($P{P_REPORT_PREVIEW} ? "XML Transcript Preview" : "Transcript of Grades")).toUpperCase()]]></initialValueExpression>
</variable>
<variable name="V_ISSUE_DATE" class="java.lang.String" calculation="System">
<initialValueExpression><![CDATA[(($P{P_REPORT_PREVIEW} ? "Last Updated:" : "Issue Date:"))]]></initialValueExpression>
</variable>
<variable name="V_STUDENT_FULL_NAME" class="java.lang.String">
<variableExpression><![CDATA[$F{student.fullName}]]></variableExpression>
<initialValueExpression><![CDATA[$F{student.fullName}]]></initialValueExpression>
Expand Down Expand Up @@ -296,7 +299,7 @@ $V{V_SCHOOL_ADDRESS_POSTAL_CODE_NO_WHITESPACE}.substring( 0, 3 ) + " " + $V{V_SC
<printWhenExpression><![CDATA[!$P{P_REPORT_BLANK}]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Top"/>
<textFieldExpression><![CDATA["Issue Date: " + $V{V_REPORT_DATE}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{V_ISSUE_DATE} + " " + $V{V_REPORT_DATE}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement style="Title" x="327" y="6" width="230" height="15" uuid="05821e85-e4be-4d7f-b654-809db99c5756"/>
Expand Down
7 changes: 5 additions & 2 deletions api/src/main/resources/reports/Transcript_BC2004-IND.jrxml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<defaultValueExpression><![CDATA["Regular"]]></defaultValueExpression>
</parameter>
<parameter name="P_REPORT_DATE" class="java.util.Date">
<parameterDescription><![CDATA[Date the transcript result data was merged.]]></parameterDescription>
<parameterDescription><![CDATA[Date the transcript result data was merged]]></parameterDescription>
<defaultValueExpression><![CDATA[DATE(1990,06,02)]]></defaultValueExpression>
</parameter>
<parameter name="P_REPORT_PREVIEW" class="java.lang.Boolean">
Expand Down Expand Up @@ -144,6 +144,9 @@
<variable name="V_TITLE" class="java.lang.String" calculation="System">
<initialValueExpression><![CDATA[(($P{P_REPORT_PREVIEW} ? "XML Transcript Preview" : "Transcript of Grades")).toUpperCase()]]></initialValueExpression>
</variable>
<variable name="V_ISSUE_DATE" class="java.lang.String" calculation="System">
<initialValueExpression><![CDATA[(($P{P_REPORT_PREVIEW} ? "Last Updated:" : "Issue Date:"))]]></initialValueExpression>
</variable>
<variable name="V_STUDENT_FULL_NAME" class="java.lang.String">
<variableExpression><![CDATA[$F{student.fullName}]]></variableExpression>
<initialValueExpression><![CDATA[$F{student.fullName}]]></initialValueExpression>
Expand Down Expand Up @@ -299,7 +302,7 @@ $V{V_SCHOOL_ADDRESS_POSTAL_CODE_NO_WHITESPACE}.substring( 0, 3 ) + " " + $V{V_SC
<printWhenExpression><![CDATA[!$P{P_REPORT_BLANK}]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Top"/>
<textFieldExpression><![CDATA["Issue Date: " + $V{V_REPORT_DATE}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{V_ISSUE_DATE} + " " + $V{V_REPORT_DATE}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement style="Title" x="327" y="6" width="230" height="15" uuid="05821e85-e4be-4d7f-b654-809db99c5756"/>
Expand Down
7 changes: 5 additions & 2 deletions api/src/main/resources/reports/Transcript_BC2004-PUB.jrxml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<defaultValueExpression><![CDATA["Regular"]]></defaultValueExpression>
</parameter>
<parameter name="P_REPORT_DATE" class="java.util.Date">
<parameterDescription><![CDATA[Date the transcript result data was merged.]]></parameterDescription>
<parameterDescription><![CDATA[Date the transcript result data was merged]]></parameterDescription>
<defaultValueExpression><![CDATA[DATE(1990,06,02)]]></defaultValueExpression>
</parameter>
<parameter name="P_REPORT_PREVIEW" class="java.lang.Boolean">
Expand Down Expand Up @@ -144,6 +144,9 @@
<variable name="V_TITLE" class="java.lang.String" calculation="System">
<initialValueExpression><![CDATA[(($P{P_REPORT_PREVIEW} ? "XML Transcript Preview" : "Transcript of Grades")).toUpperCase()]]></initialValueExpression>
</variable>
<variable name="V_ISSUE_DATE" class="java.lang.String" calculation="System">
<initialValueExpression><![CDATA[(($P{P_REPORT_PREVIEW} ? "Last Updated:" : "Issue Date:"))]]></initialValueExpression>
</variable>
<variable name="V_STUDENT_FULL_NAME" class="java.lang.String">
<variableExpression><![CDATA[$F{student.fullName}]]></variableExpression>
<initialValueExpression><![CDATA[$F{student.fullName}]]></initialValueExpression>
Expand Down Expand Up @@ -299,7 +302,7 @@ $V{V_SCHOOL_ADDRESS_POSTAL_CODE_NO_WHITESPACE}.substring( 0, 3 ) + " " + $V{V_SC
<printWhenExpression><![CDATA[!$P{P_REPORT_BLANK}]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Top"/>
<textFieldExpression><![CDATA["Issue Date: " + $V{V_REPORT_DATE}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{V_ISSUE_DATE} + " " + $V{V_REPORT_DATE}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement style="Title" x="327" y="6" width="230" height="15" uuid="05821e85-e4be-4d7f-b654-809db99c5756"/>
Expand Down
Loading

0 comments on commit 376cd1f

Please sign in to comment.