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

Year End Reports #191

Merged
merged 107 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from 103 commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
417cf82
year end distribution by district code
Apr 13, 2023
e8ef9d0
Merge branch 'grad-release' of https://github.com/bcgov/EDUC-GRAD-DIS…
Apr 13, 2023
0b6c9f2
year end distribution by district code
Apr 17, 2023
ad124f4
Code refactoring and optimization
Apr 21, 2023
35cf2c6
Year End distribution
Apr 21, 2023
3e40e3d
Year End distribution
Apr 21, 2023
441899c
Merge branch 'grad-release' of https://github.com/bcgov/EDUC-GRAD-DIS…
Apr 27, 2023
2387d5d
Year end reports continur
Apr 27, 2023
5e83ee6
Year end reports
May 3, 2023
b2b9d50
Year end reports
May 5, 2023
c034cf9
Merge branch 'grad-release' of https://github.com/bcgov/EDUC-GRAD-DIS…
May 19, 2023
92eb76d
Fixed unit tests
May 19, 2023
939ebc8
Year End NonGrad
May 26, 2023
bad9243
Year End NonGrad
May 26, 2023
4d90df5
Year End NonGrad
May 26, 2023
4552097
Year End NonGrad
May 26, 2023
7aaa447
Year End NonGrad
May 29, 2023
111f83e
Merge branch 'main' of https://github.com/bcgov/EDUC-GRAD-DISTRIBUTIO…
May 29, 2023
95877ac
Tests
May 29, 2023
88287c2
Year End Reports
arybakov-cgi May 30, 2023
6fcce50
Year End Reports
arybakov-cgi Jun 1, 2023
ac29ca4
Year End Reports
arybakov-cgi Jun 1, 2023
c8e3bac
Year End Reports
arybakov-cgi Jun 1, 2023
f6225bc
Year End Reports
arybakov-cgi Jun 1, 2023
26dfae5
Merge branch 'main' of https://github.com/bcgov/EDUC-GRAD-DISTRIBUTIO…
arybakov-cgi Jun 12, 2023
3026445
Remove some code smells
arybakov-cgi Jun 12, 2023
edeb9f5
Remove some code smells
arybakov-cgi Jun 12, 2023
dd440c1
Test Coverage
arybakov-cgi Jun 13, 2023
b6201fd
Merge branch 'main' of https://github.com/bcgov/EDUC-GRAD-DISTRIBUTIO…
arybakov-cgi Jun 13, 2023
e9f6914
Test Coverage
arybakov-cgi Jun 13, 2023
fa98376
Test Coverage
arybakov-cgi Jun 13, 2023
dbccad9
Test Coverage
arybakov-cgi Jun 13, 2023
d813aef
Test Coverage
arybakov-cgi Jun 13, 2023
296437a
Test Coverage
arybakov-cgi Jun 13, 2023
d6ee3f7
Test Coverage
arybakov-cgi Jun 13, 2023
ab15e3a
Test Coverage
arybakov-cgi Jun 13, 2023
d793dba
Test Coverage
arybakov-cgi Jun 13, 2023
626bd0c
Test Coverage
arybakov-cgi Jun 13, 2023
6d104dd
Test Coverage
arybakov-cgi Jun 13, 2023
d8b839b
Test Coverage
arybakov-cgi Jun 14, 2023
ccbc447
Test Coverage
arybakov-cgi Jun 14, 2023
6603102
Test Coverage
arybakov-cgi Jun 14, 2023
6f14767
Test Coverage
arybakov-cgi Jun 14, 2023
501e3fe
Test Coverage
arybakov-cgi Jun 14, 2023
a6c640e
Test Coverage
arybakov-cgi Jun 14, 2023
85c34bd
Sort by mincode on the file system
arybakov-cgi Jun 19, 2023
83951f3
Merge branch 'grad-release' of https://github.com/bcgov/EDUC-GRAD-DIS…
arybakov-cgi Jun 20, 2023
bbdeb35
Merge with grad-release
arybakov-cgi Jun 20, 2023
90c550c
Merge branch 'develop/GRAD2-1931-PSI-FTP' of https://github.com/bcgov…
arybakov-cgi Jun 20, 2023
bf7db37
Merge PSI code and bugs fixes
arybakov-cgi Jun 21, 2023
82189ab
Merge PSI code and bugs fixes
arybakov-cgi Jun 21, 2023
ccdf388
Merge PSI code and bugs fixes
arybakov-cgi Jun 21, 2023
59832c8
Merge PSI code and bugs fixes
arybakov-cgi Jun 21, 2023
691825d
Fix NPE on student reports
arybakov-cgi Jun 21, 2023
8b322cf
Merge branch 'grad-release' of https://github.com/bcgov/EDUC-GRAD-DIS…
arybakov-cgi Jun 21, 2023
0da975c
Fix NPE on student reports
arybakov-cgi Jun 21, 2023
f9fe95f
Fix NPE on student reports
arybakov-cgi Jun 21, 2023
d1df076
Fix report location
arybakov-cgi Jun 22, 2023
b0f4874
Fix blank parameters and SUPP reports
arybakov-cgi Jun 26, 2023
d250b3c
Fix blank parameters and SUPP reports
arybakov-cgi Jun 26, 2023
503cc9e
Merge branch 'grad-release' of https://github.com/bcgov/EDUC-GRAD-DIS…
arybakov-cgi Jun 26, 2023
a89ef3a
Merge branch 'grad-release' of https://github.com/bcgov/EDUC-GRAD-DIS…
arybakov-cgi Jun 28, 2023
6788d44
Merge code with grad-release
arybakov-cgi Jun 28, 2023
54d76a6
Fix code smells
arybakov-cgi Jun 28, 2023
23987a6
Merge branch 'grad-release' of https://github.com/bcgov/EDUC-GRAD-DIS…
arybakov-cgi Jun 28, 2023
9b69e49
Fix path
arybakov-cgi Jun 28, 2023
947caf8
YE yearly report fixes
arybakov-cgi Jun 28, 2023
dc341fd
YE yearly report fixes
arybakov-cgi Jun 29, 2023
1a8ceb8
Fix code smell
arybakov-cgi Jun 29, 2023
8523676
Test Coverage
arybakov-cgi Jun 29, 2023
6488801
YE Non Grad report added district report
arybakov-cgi Jul 4, 2023
349b0d9
Fix logic with 9 certificates
arybakov-cgi Jul 5, 2023
93b32ed
Test coverage
arybakov-cgi Jul 6, 2023
13fcf1b
Test coverage
arybakov-cgi Jul 6, 2023
d1d079c
Test coverage
arybakov-cgi Jul 6, 2023
bb3d5ef
Test coverage
arybakov-cgi Jul 6, 2023
d98a47e
Merge branch 'grad-release' of https://github.com/bcgov/EDUC-GRAD-DIS…
arybakov-cgi Jul 10, 2023
db917dd
Fix LocalDate and added certificates
arybakov-cgi Jul 10, 2023
afbcbd4
Fix LocalDate and added certificates
arybakov-cgi Jul 10, 2023
4d679b1
Fix YE reports
arybakov-cgi Jul 11, 2023
3cb6cd0
Fix code smells
arybakov-cgi Jul 11, 2023
c0d1978
Fix code smells
arybakov-cgi Jul 11, 2023
735f851
Fix code smells
arybakov-cgi Jul 11, 2023
7c5809c
Fix code smells
arybakov-cgi Jul 11, 2023
27fa924
Fix code smells
arybakov-cgi Jul 12, 2023
820611b
Fix Date format conversion to LocalDate
arybakov-cgi Jul 12, 2023
ebaf3d6
Fix Date format conversion to LocalDate
arybakov-cgi Jul 12, 2023
56eae6e
Fix Date format conversion to LocalDate
arybakov-cgi Jul 12, 2023
e41c3fc
Added debug info
arybakov-cgi Jul 12, 2023
dd069cc
Merge branch 'grad-release' of https://github.com/bcgov/EDUC-GRAD-DIS…
arybakov-cgi Jul 13, 2023
7fa8bfd
Align lib versions for com.fasterxml.jackson
arybakov-cgi Jul 13, 2023
a90cc0f
Merge branch 'Grad2-2205NonGradReasonsDatFile' of https://github.com/…
arybakov-cgi Jul 13, 2023
69d4278
Compilation error fix
arybakov-cgi Jul 13, 2023
b60bb90
Code change request fix
arybakov-cgi Jul 17, 2023
3cda5a3
Code change request fix
arybakov-cgi Jul 17, 2023
400fdca
Merge branch 'grad-release' of https://github.com/bcgov/EDUC-GRAD-DIS…
arybakov-cgi Jul 17, 2023
14711b2
Migrate Student updateDate to localDateTime
arybakov-cgi Jul 18, 2023
24f2569
Migrate Student updateDate to localDateTime
arybakov-cgi Jul 18, 2023
3878620
Merge branch 'grad-release' of https://github.com/bcgov/EDUC-GRAD-DIS…
arybakov-cgi Jul 18, 2023
8f98d20
Merge branch 'grad-release' into develop/alex
arybakov-cgi Jul 18, 2023
271d586
Fix counters
arybakov-cgi Jul 18, 2023
e4e0384
Merge branch 'develop/alex' of https://github.com/bcgov/EDUC-GRAD-DIS…
arybakov-cgi Jul 18, 2023
cc80d38
Fix counters
arybakov-cgi Jul 18, 2023
70a991f
Fix labels for school reports where only 1 school selected
arybakov-cgi Jul 19, 2023
ab79b6b
Added NONGRADDISTREP_SC report
arybakov-cgi Jul 20, 2023
9793741
Resolve amd merge with grad-release
arybakov-cgi Jul 20, 2023
262d75c
Added categories for school level reports
arybakov-cgi Jul 20, 2023
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
29 changes: 14 additions & 15 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
src/main/resources/**,
src/main/java/ca/bc/gov/educ/api/distribution/config/**,
src/main/java/ca/bc/gov/educ/api/distribution/exception/**,
src/main/java/ca/bc/gov/educ/api/distribution/process/**,
src/main/java/ca/bc/gov/educ/api/distribution/model/**,
src/main/java/ca/bc/gov/educ/api/distribution/util/**
</sonar.exclusions>
<sonar.coverage.exclusions>
src/main/resources/**,
src/main/java/ca/bc/gov/educ/api/distribution/config/**,
src/main/java/ca/bc/gov/educ/api/distribution/exception/**,
src/main/java/ca/bc/gov/educ/api/distribution/process/**,
src/main/java/ca/bc/gov/educ/api/distribution/model/**,
src/main/java/ca/bc/gov/educ/api/distribution/util/**
</sonar.coverage.exclusions>
Expand All @@ -35,7 +37,7 @@
<springdoc.version>2.0.2</springdoc.version>
<junit>4.12</junit>
<log4j.version>2.18.0</log4j.version>
<resilience4j.version>1.7.1</resilience4j.version>
<resilience4j.version>2.0.2</resilience4j.version>
</properties>

<parent>
Expand Down Expand Up @@ -63,6 +65,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
Expand Down Expand Up @@ -147,11 +153,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
Expand Down Expand Up @@ -201,22 +202,20 @@
<artifactId>resilience4j-spring-boot2</artifactId>
<version>${resilience4j.version}</version>
</dependency>
<!--Grad2-1931-->
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jsr310 -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.15.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-csv</artifactId>
<version>2.13.0</version>
<version>2.13.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.0</version>
<version>2.13.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.13.3</version>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.integration.annotation.IntegrationComponentScan;
import org.springframework.integration.config.EnableIntegration;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.reactive.function.client.ExchangeStrategies;
import org.springframework.web.reactive.function.client.WebClient;
Expand All @@ -12,6 +14,8 @@
import java.io.FileFilter;

@Configuration
@IntegrationComponentScan
@EnableIntegration
public class EducDistributionApiConfig {

@Bean
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package ca.bc.gov.educ.api.distribution.config;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.json.JsonMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
Expand All @@ -16,5 +21,13 @@ public class GradCommonConfig implements WebMvcConfigurer {
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(requestInterceptor);
}


@Bean
ObjectMapper jacksonObjectMapper() {
return JsonMapper.builder()
.findAndAddModules()
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package ca.bc.gov.educ.api.distribution.controller;

import ca.bc.gov.educ.api.distribution.model.dto.DistributionPrintRequest;
import ca.bc.gov.educ.api.distribution.model.dto.DistributionRequest;
import ca.bc.gov.educ.api.distribution.model.dto.DistributionResponse;
import ca.bc.gov.educ.api.distribution.service.GradDistributionService;
import ca.bc.gov.educ.api.distribution.service.PostingDistributionService;
import ca.bc.gov.educ.api.distribution.util.EducDistributionApiConstants;
import ca.bc.gov.educ.api.distribution.util.GradValidation;
import ca.bc.gov.educ.api.distribution.util.PermissionsConstants;
Expand All @@ -24,8 +25,6 @@
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping(EducDistributionApiConstants.DISTRIBUTION_API_ROOT_MAPPING)
Expand All @@ -40,6 +39,9 @@ public class DistributionController {
@Autowired
GradDistributionService gradDistributionService;

@Autowired
PostingDistributionService postingDistributionService;

@Autowired
GradValidation validation;

Expand All @@ -52,21 +54,21 @@ public class DistributionController {
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<DistributionResponse> distributeCredentials(
@PathVariable String runType, @RequestParam(required = false) Long batchId ,@RequestParam(required = false) String activityCode,
@RequestParam(required = false) String transmissionType, @RequestBody Map<String, DistributionPrintRequest> mapDist,
@RequestParam(required = false) String transmissionType, @RequestBody DistributionRequest distributionRequest,
@RequestParam(required = false) String localDownload, @RequestHeader(name="Authorization") String accessToken) {
if (isAsyncDistribution(runType, activityCode)) {
// non-blocking IO - launching async process to distribute credentials
gradDistributionService.asyncDistributeCredentials(runType,batchId,mapDist,activityCode,transmissionType,localDownload,accessToken);
gradDistributionService.asyncDistributeCredentials(runType,batchId,distributionRequest,activityCode,transmissionType,localDownload,accessToken);

// return as successful immediately
DistributionResponse disRes = new DistributionResponse();
disRes.setBatchId(batchId.toString());
disRes.setBatchId(batchId);
disRes.setLocalDownload(localDownload);
disRes.setMergeProcessResponse("Merge Successful and File Uploaded");
return response.GET(disRes);
} else {
// blocking IO - launching sync process to distribute credentials
return response.GET(gradDistributionService.distributeCredentials(runType,batchId,mapDist,activityCode,transmissionType,localDownload,accessToken));
return response.GET(gradDistributionService.distributeCredentials(runType,batchId,distributionRequest,activityCode,transmissionType,localDownload,accessToken));
}
}

Expand All @@ -81,6 +83,15 @@ public ResponseEntity<byte[]> downloadZipFile(@PathVariable(value = "batchId") L
return handleBinaryResponse(encoded,MediaType.TEXT_PLAIN,batchId);
}

@PostMapping(EducDistributionApiConstants.POST_DISTRIBUTION)
@PreAuthorize(PermissionsConstants.GRADUATE_STUDENT)
@Operation(summary = "Read Student Reports by Student ID and Report Type", description = "Read Student Reports by Student ID and Report Type", tags = { "Reports" })
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<Boolean> postingDistribution(@RequestBody DistributionResponse distributionResponse) {
logger.debug("zipBatchDirectory : ");
return response.GET(postingDistributionService.postingProcess(distributionResponse));
}

private ResponseEntity<byte[]> handleBinaryResponse(byte[] resultBinary, MediaType contentType,Long batchId) {
ResponseEntity<byte[]> responseEntity;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package ca.bc.gov.educ.api.distribution.exception;

import lombok.Data;

@Data
public class ServiceException extends RuntimeException {

private int statusCode;

public ServiceException() {
super();
}

public ServiceException(String message) {
super(message);
}

public ServiceException(String message, Throwable cause) {
super(message, cause);
}

public ServiceException(Throwable cause) {
super(cause);
}

protected ServiceException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}

public ServiceException(String message, int value) {
super(message);
this.statusCode = value;
}

public ServiceException(String s, int value, Exception e) {
super(s, e);
this.statusCode = value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package ca.bc.gov.educ.api.distribution.model.dto;

import lombok.Builder;
import lombok.Data;

import java.util.List;
import java.util.Map;

@Data
@Builder
public class DistributionRequest {
private String activityCode;
private List<School> schools;
private Map<String, DistributionPrintRequest> mapDist;
private StudentSearchRequest studentSearchRequest;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class DistributionResponse {
private String transcriptResponse;
private String yed2Response;
private String yedrResponse;
private String yedbResponse;
private String mergeProcessResponse;
private int numberOfPdfs;
private String jobStatus;
//Grad2-1931
private String batchId;
private Long batchId;
private String localDownload;
private String activityCode;
private String transmissionMode;
private List<School> schools = new ArrayList<>();
private List<School> districts = new ArrayList<>();
private StudentSearchRequest studentSearchRequest;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public class GraduationStatus implements Serializable {
private String graduationMessage = "";
private String programName = "";

@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
public LocalDate getProgramCompletionDate() {
return programCompletionDate;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package ca.bc.gov.educ.api.distribution.model.dto;

public class PaperType {
import java.io.Serializable;

public class PaperType implements Serializable {

private String code;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Data
@Component
Expand All @@ -27,5 +26,5 @@ public class ProcessorData {
private List<StudentCredentialDistribution> yed2List;
private List<StudentCredentialDistribution> yedrList;
private List<StudentCredentialDistribution> yedbList;
private Map<String,DistributionPrintRequest> mapDistribution;
private DistributionRequest distributionRequest;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import org.codehaus.jackson.annotate.JsonTypeInfo;
import org.springframework.stereotype.Component;

import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlSeeAlso;
import jakarta.xml.bind.annotation.XmlType;
import lombok.Data;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
Expand All @@ -31,9 +30,6 @@
Certificate.class
})
@JsonSerialize()
//@JsonPropertyOrder(alphabetic = true)
//@JsonRootName("generateReport")
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes({
@JsonSubTypes.Type(value = Student.class),
@JsonSubTypes.Type(value = School.class),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package ca.bc.gov.educ.api.distribution.model.dto;

import lombok.Data;
import org.codehaus.jackson.annotate.JsonTypeInfo;

import java.io.Serializable;

@Data
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
public class ReportOptions implements Serializable {

private boolean cacheReport;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.codehaus.jackson.annotate.JsonTypeInfo;

import java.io.Serializable;

@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonPropertyOrder({ "options", "data"})
public class ReportRequest implements Serializable {

Expand Down
Loading