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;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
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.RiskAssessmentStatus.*;
@Service
@RequiredArgsConstructor
......@@ -82,12 +82,11 @@ public class RiskAssessmentPDFService {
.filter(AssessedBusinessTypePublicDto::isPrimary)
.findFirst();
String secondaryBusinessTypeNames = getSecondaryBusinessTypeNames(riskAssessment);
String time = getTime();
RiskAssessmentPdfDto dto = new RiskAssessmentPdfDto();
String riskAssessmentStatus = calculateStatus(riskAssessment.getStatus().getCode());
dto.setTitle(riskAssessment.getTitle());
dto.setArchivedDate(riskAssessment.getArchivedDate());
dto.setCurrentDate(time);
dto.setStatus(riskAssessment.getStatus().getName());
dto.setStatus(riskAssessmentStatus);
dto.setEmployerName(employer.getLegalPerson().getName());
dto.setRegCode(employer.getLegalPerson().getRegCode());
dto.setSecondaryBusinessTypes(secondaryBusinessTypeNames);
......@@ -96,12 +95,14 @@ public class RiskAssessmentPDFService {
return dto;
}
private String getTime() {
Calendar calendar = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy HH:mm");
TimeZone timeZone = TimeZone.getTimeZone("Europe/Tallinn");
calendar.setTimeZone(timeZone);
return formatter.format(calendar.getTime());
private String calculateStatus(String statusCode) {
if (statusCode.equals(IN_PROGRESS.getCode()) || statusCode.equals(CONFIRMED.getCode())) {
return "Pooleli";
} else if (statusCode.equals(ARCHIVED.getCode())) {
return "Arhiveeritud";
} else {
return "Kehtiv";
}
}
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