Commit a09dc814 authored by Hando Lukats's avatar Hando Lukats
Browse files

TEIS-2380 updated RiskAssessmentPDF status

parent 53ba5bb7
...@@ -36,13 +36,13 @@ import org.apache.commons.lang3.BooleanUtils; ...@@ -36,13 +36,13 @@ import org.apache.commons.lang3.BooleanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static ee.sm.ti.teis.riskassessments.serviceclient.DocGenServiceClient.PreviewDocumentMsRequest; import static ee.sm.ti.teis.riskassessments.serviceclient.DocGenServiceClient.PreviewDocumentMsRequest;
import static ee.sm.ti.teis.types.enums.classifier.ObjectType.RISK_STATEMENT_ASSESSMENT; import static ee.sm.ti.teis.types.enums.classifier.ObjectType.RISK_STATEMENT_ASSESSMENT;
import static ee.sm.ti.teis.types.enums.classifier.RiskAssessmentStatus.*;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
...@@ -82,12 +82,11 @@ public class RiskAssessmentPDFService { ...@@ -82,12 +82,11 @@ public class RiskAssessmentPDFService {
.filter(AssessedBusinessTypePublicDto::isPrimary) .filter(AssessedBusinessTypePublicDto::isPrimary)
.findFirst(); .findFirst();
String secondaryBusinessTypeNames = getSecondaryBusinessTypeNames(riskAssessment); String secondaryBusinessTypeNames = getSecondaryBusinessTypeNames(riskAssessment);
String time = getTime();
RiskAssessmentPdfDto dto = new RiskAssessmentPdfDto(); RiskAssessmentPdfDto dto = new RiskAssessmentPdfDto();
String riskAssessmentStatus = calculateStatus(riskAssessment.getStatus().getCode());
dto.setTitle(riskAssessment.getTitle()); dto.setTitle(riskAssessment.getTitle());
dto.setArchivedDate(riskAssessment.getArchivedDate()); dto.setArchivedDate(riskAssessment.getArchivedDate());
dto.setCurrentDate(time); dto.setStatus(riskAssessmentStatus);
dto.setStatus(riskAssessment.getStatus().getName());
dto.setEmployerName(employer.getLegalPerson().getName()); dto.setEmployerName(employer.getLegalPerson().getName());
dto.setRegCode(employer.getLegalPerson().getRegCode()); dto.setRegCode(employer.getLegalPerson().getRegCode());
dto.setSecondaryBusinessTypes(secondaryBusinessTypeNames); dto.setSecondaryBusinessTypes(secondaryBusinessTypeNames);
...@@ -96,12 +95,14 @@ public class RiskAssessmentPDFService { ...@@ -96,12 +95,14 @@ public class RiskAssessmentPDFService {
return dto; return dto;
} }
private String getTime() { private String calculateStatus(String statusCode) {
Calendar calendar = Calendar.getInstance(); if (statusCode.equals(IN_PROGRESS.getCode()) || statusCode.equals(CONFIRMED.getCode())) {
SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy HH:mm"); return "Pooleli";
TimeZone timeZone = TimeZone.getTimeZone("Europe/Tallinn"); } else if (statusCode.equals(ARCHIVED.getCode())) {
calendar.setTimeZone(timeZone); return "Arhiveeritud";
return formatter.format(calendar.getTime()); } else {
return "Kehtiv";
}
} }
private List<RiskFactorPdfCategoryDto> composeRiskFactorCategories(UUID riskAssessmentId, private List<RiskFactorPdfCategoryDto> composeRiskFactorCategories(UUID riskAssessmentId,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment