Resolved Conflicts.
This commit is contained in:
@@ -242,7 +242,7 @@ public class GepafinConstant {
|
||||
public static final String APPLICATION_EVALUATION_STATUS_UPDATED_SUCCESSFULLY = "application.evaluation.status.updated.successfully";
|
||||
public static final String ASSIGNED_APPLICATION_NOT_FOUND_WITH_ID_MSG = "assigned.application.not.found.with.id";
|
||||
public static final String EITHER_APPLICATION_OR_ASSIGNED_APPLICATION_ID_REQUIRED_MSG = "either.application.or.assigned.application.id.required";
|
||||
|
||||
public static final String EVALUATION_ALREADY_EXISTS_MSG = "evaluation.already.exists";
|
||||
public static final String APPLICATION_ASSIGNED= "application.assigned.success.msg";
|
||||
public static final String APPLICATION_ALREADY_ASSIGNED = "application.already.assigned.msg";
|
||||
public static final String ASSIGNED_APPLICATION_NOT_FOUND_MSG="aasigned.application.not.found";
|
||||
|
||||
@@ -19,6 +19,7 @@ import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -113,22 +114,16 @@ public class ApplicationEvaluationDao {
|
||||
|
||||
response.setId(entity.getId());
|
||||
response.setApplicationId(entity.getApplicationId());
|
||||
|
||||
List<AssignedApplicationsEntity> assignedApplicationsList = assignedApplicationsRepository.findAllByApplicationId(entity.getApplicationId());
|
||||
|
||||
if (assignedApplicationsList.isEmpty()) {
|
||||
response.setAssignedApplicationId(null);
|
||||
} else {
|
||||
// AssignedApplicationsEntity assignedApplications = assignedApplicationsList.get(0);
|
||||
response.setAssignedApplicationId(entity.getAssignedApplicationsEntity().getId());
|
||||
}
|
||||
|
||||
AssignedApplicationsEntity assignedApplications = assignedApplicationsRepository.findByIdAndIsDeletedFalse(entity.getAssignedApplicationsEntity().getId()).orElse(null);
|
||||
response.setAssignedApplicationId(assignedApplications.getId());
|
||||
response.setNote(entity.getNote());
|
||||
response.setStatus(ApplicationEvaluationStatusTypeEnum.valueOf(entity.getStatus()));
|
||||
response.setCreatedDate(entity.getCreatedDate());
|
||||
response.setUpdatedDate(entity.getUpdatedDate());
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void setCriteriaResponses(ApplicationEvaluationEntity entity, ApplicationEvaluationResponse response, List<EvaluationCriteriaEntity> evaluationCriterias) {
|
||||
|
||||
List<CriteriaResponse> criteriaResponsesFromEntity = entity.getCriteria() != null ?
|
||||
@@ -343,14 +338,15 @@ public class ApplicationEvaluationDao {
|
||||
response.setProtocolNumber(application.getProtocol() != null ? application.getProtocol().getProtocolNumber() : null);
|
||||
response.setSubmissionDate(application.getSubmissionDate() != null ? application.getSubmissionDate() : null);
|
||||
response.setEvaluationDate(application.getSubmissionDate() != null ? application.getSubmissionDate().plusDays(30) : null);
|
||||
|
||||
LocalDateTime callEndDate = application.getCall().getEndDate();
|
||||
response.setCallEndDate(callEndDate);
|
||||
}
|
||||
|
||||
public ApplicationEvaluationResponse createOrUpdateApplicationEvaluation(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
|
||||
|
||||
Optional<ApplicationEvaluationEntity> existingEntityOptional = applicationEvaluationRepository.findByAssignedApplicationsEntity_IdAndIsDeletedFalse(assignedApplciationId);
|
||||
ApplicationEvaluationEntity entity;
|
||||
|
||||
Optional<AssignedApplicationsEntity> assignedApplications=assignedApplicationsRepository.findByIdAndIsDeletedFalse(assignedApplciationId);
|
||||
if (existingEntityOptional.isPresent()) {
|
||||
entity = existingEntityOptional.get();
|
||||
entity.setCriteria(Utils.convertObjectToJson(filterNonNullCriteria(processCriteria(entity, req))));
|
||||
@@ -488,20 +484,26 @@ public class ApplicationEvaluationDao {
|
||||
return entityOptional.get();
|
||||
}
|
||||
|
||||
public List<ApplicationEvaluationResponse> getApplicationEvaluationByApplicationId(UserEntity user, Long applicationId, Long assignedApplicationId) {
|
||||
|
||||
if (applicationId != null && assignedApplicationId == null) {
|
||||
applicationService.validateApplication(applicationId);
|
||||
List<ApplicationEvaluationEntity> evaluationEntities = applicationEvaluationRepository.findByApplicationIdAndIsDeletedFalse(applicationId);
|
||||
return evaluationEntities.stream().map(this::convertToResponse).collect(Collectors.toList());
|
||||
public ApplicationEvaluationResponse getApplicationEvaluationByApplicationId(UserEntity user, Long applicationId, Long assignedApplicationId) {
|
||||
|
||||
applicationService.validateApplication(applicationId);
|
||||
|
||||
Optional<ApplicationEvaluationEntity> entityOptional;
|
||||
|
||||
if (applicationId != null && assignedApplicationId != null) {
|
||||
entityOptional = applicationEvaluationRepository.findByApplicationIdAndAssignedApplicationsEntity_IdAndIsDeletedFalse(applicationId, assignedApplicationId);
|
||||
} else if (applicationId != null) {
|
||||
entityOptional = applicationEvaluationRepository.findByApplicationIdAndIsDeletedFalse(applicationId);
|
||||
} else if (assignedApplicationId != null) {
|
||||
entityOptional = applicationEvaluationRepository.findByAssignedApplicationsEntity_IdAndIsDeletedFalse(assignedApplicationId);
|
||||
} else {
|
||||
entityOptional = applicationEvaluationRepository.findFirstByIsDeletedFalseOrderByCreatedDateDesc();
|
||||
}
|
||||
|
||||
Optional<ApplicationEvaluationEntity> entityOptional = (applicationId != null && assignedApplicationId != null) ?
|
||||
applicationEvaluationRepository.findByApplicationIdAndAssignedApplicationsEntity_IdAndIsDeletedFalse(applicationId, assignedApplicationId) :
|
||||
applicationEvaluationRepository.findByAssignedApplicationsEntity_IdAndIsDeletedFalse(assignedApplicationId);
|
||||
|
||||
return entityOptional.map(entity -> Collections.singletonList(convertToResponse(entity)))
|
||||
.orElseGet(() -> Collections.singletonList(getEvaluationResponseByApplicationid(user, applicationId, assignedApplicationId)));
|
||||
return entityOptional.map(this::convertToResponse)
|
||||
.orElseGet(() -> {
|
||||
return getEvaluationResponseByApplicationid(user, applicationId, assignedApplicationId);
|
||||
});
|
||||
}
|
||||
|
||||
public ApplicationEvaluationResponse getEvaluationResponseByApplicationid(UserEntity user, Long applicationId, Long assignedApplicationId) {
|
||||
@@ -533,7 +535,9 @@ public class ApplicationEvaluationDao {
|
||||
response.setNote(null);
|
||||
response.setApplicationStatus(ApplicationStatusTypeEnum.valueOf(application.getStatus()));
|
||||
response.setStatus(ApplicationEvaluationStatusTypeEnum.valueOf(ApplicationEvaluationStatusTypeEnum.OPEN.getValue()));
|
||||
response.setMinScore(call.getThreshold() != null ? call.getThreshold() : null);
|
||||
response.setMinScore(call.getThreshold()!=null?call.getThreshold():null);
|
||||
LocalDateTime callEndDate = application.getCall().getEndDate();
|
||||
response.setCallEndDate(callEndDate);
|
||||
setCriteriaResponses(entity, application.getId(), response, evaluationCriterias);
|
||||
setChecklistResponses(entity, application.getId(), response, checklistEntities);
|
||||
setFileResponses(entity, application.getId(), response, applicationFormEntities);
|
||||
@@ -849,7 +853,7 @@ public class ApplicationEvaluationDao {
|
||||
|
||||
ApplicationEvaluationEntity applicationEvaluationEntity = validateApplicationEvaluation(id);
|
||||
applicationEvaluationEntity.setIsDeleted(true);
|
||||
applicationEvaluationEntity = saveApplicationEvaluationEntity(applicationEvaluationEntity);
|
||||
saveApplicationEvaluationEntity(applicationEvaluationEntity);
|
||||
}
|
||||
|
||||
public ApplicationEvaluationEntity saveApplicationEvaluationEntity(ApplicationEvaluationEntity applicationEvaluationEntityData) {
|
||||
@@ -857,7 +861,8 @@ public class ApplicationEvaluationDao {
|
||||
return applicationEvaluationRepository.save(applicationEvaluationEntityData);
|
||||
}
|
||||
|
||||
public ApplicationEvaluationResponse updateApplicationEvaluationStatus(ApplicationEntity application, AssignedApplicationsEntity assignedApplicationsEntity) {
|
||||
public ApplicationEvaluationResponse updateApplicationEvaluationStatus(ApplicationEntity application, AssignedApplicationsEntity assignedApplicationsEntity,
|
||||
AssignedEvaluationStatus newStatus) {
|
||||
|
||||
Optional<ApplicationEvaluationEntity> existingEntityOptional = applicationEvaluationRepository.findByAssignedApplicationsEntity_IdAndIsDeletedFalse(
|
||||
assignedApplicationsEntity.getId());
|
||||
@@ -866,13 +871,15 @@ public class ApplicationEvaluationDao {
|
||||
String statusType = application.getStatus();
|
||||
if (existingEntityOptional.isPresent()) {
|
||||
ApplicationEvaluationEntity existingEntity = existingEntityOptional.get();
|
||||
if (Boolean.TRUE.equals(application.getStatus().equals(ApplicationStatusTypeEnum.APPROVED.getValue()) || application.getStatus()
|
||||
.equals(ApplicationStatusTypeEnum.REJECTED.getValue()))) {
|
||||
application.setStatus(newStatus.getValue());
|
||||
application = applicationRepository.save(application);
|
||||
if (application.getStatus().equals(ApplicationStatusTypeEnum.APPROVED.getValue()) || application.getStatus().equals(ApplicationStatusTypeEnum.REJECTED.getValue())) {
|
||||
existingEntity.setStatus(ApplicationEvaluationStatusTypeEnum.CLOSE.getValue());
|
||||
assignedApplicationsEntity.setStatus(AssignedApplicationEnum.CLOSE.getValue());
|
||||
}
|
||||
entity = applicationEvaluationRepository.save(existingEntity);
|
||||
assignedApplicationsRepository.save(assignedApplicationsEntity);
|
||||
|
||||
ApplicationAmendmentRequestEntity amendmentRequest = applicationAmendmentRequestRepository.findByApplicationEvaluationIdAndIsDeletedFalse(existingEntity.getId());
|
||||
if (Boolean.TRUE.equals(statusType.equals((ApplicationStatusTypeEnum.APPROVED.getValue())))) {
|
||||
emailNotificationDao.sendAdmissibilityNotificationEmailForApprovedApplication(amendmentRequest);
|
||||
@@ -883,7 +890,6 @@ public class ApplicationEvaluationDao {
|
||||
return convertToResponse(entity);
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,10 @@ import net.gepafin.tendermanagement.entities.*;
|
||||
import net.gepafin.tendermanagement.model.request.FieldLabelValuePairRequest;
|
||||
import net.gepafin.tendermanagement.model.response.*;
|
||||
import net.gepafin.tendermanagement.service.CallService;
|
||||
import net.gepafin.tendermanagement.util.PdfUtils;
|
||||
import net.gepafin.tendermanagement.util.Utils;
|
||||
import net.gepafin.tendermanagement.util.Validator;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -91,73 +93,73 @@ public class PdfDao {
|
||||
Font boldSmallFont = new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD,new BaseColor(105, 105, 105));
|
||||
|
||||
// Adding the "Documenti Allegati" section title
|
||||
document.add(new Paragraph(" "));
|
||||
|
||||
// pageEvent.setTotalPages(writer.getPageNumber());
|
||||
document.newPage();
|
||||
// pageEvent.setTotalPages(writer.getPageNumber());
|
||||
document.add(new Paragraph("Documenti Allegati", sectionFont));
|
||||
document.add(new Paragraph(" "));
|
||||
|
||||
|
||||
// 1. Autocertificazione possesso Requisiti
|
||||
Paragraph p1 = new Paragraph();
|
||||
p1.add(new Chunk("1. ", boldSmallFont));
|
||||
p1.add(new Chunk("Autocertificazione possesso Requisiti ", boldSmallFont));
|
||||
p1.add(new Chunk("ai sensi degli artt. 46 e 47 del DPR 445/2000", smallFont));
|
||||
document.add(p1);
|
||||
document.add(new Paragraph(" "));
|
||||
|
||||
|
||||
|
||||
// 2. Informativa Privacy relativa al trattamento dei dati personali
|
||||
Paragraph p2 = new Paragraph();
|
||||
p2.add(new Chunk("2. ", boldSmallFont));
|
||||
p2.add(new Chunk("Informativa Privacy relativa al trattamento dei dati personali", boldSmallFont));
|
||||
document.add(p2);
|
||||
document.add(new Paragraph(" "));
|
||||
|
||||
|
||||
// 3. Dati richiesti per la valutazione dell’adeguatezza dei flussi finanziari
|
||||
Paragraph p3 = new Paragraph();
|
||||
p3.add(new Chunk("3. ", boldSmallFont));
|
||||
p3.add(new Chunk("Dati richiesti per la valutazione dell’adeguatezza dei flussi finanziari prospettici come da tabella di cui all’Appendice 9", boldSmallFont));
|
||||
document.add(p3);
|
||||
document.add(new Paragraph(" "));
|
||||
|
||||
|
||||
// 4. Rilevazione Centrale dei Rischi
|
||||
Paragraph p4 = new Paragraph();
|
||||
p4.add(new Chunk("4. ", boldSmallFont));
|
||||
p4.add(new Chunk("Rilevazione Centrale dei Rischi riferita agli ultimi 36 mesi disponibili alla data di presentazione della Domanda", boldSmallFont));
|
||||
document.add(p4);
|
||||
document.add(new Paragraph(" "));
|
||||
|
||||
|
||||
// 5. Schema di presentazione dei dati di bilancio
|
||||
Paragraph p5 = new Paragraph();
|
||||
p5.add(new Chunk("5. ", boldSmallFont));
|
||||
p5.add(new Chunk("Schema di presentazione dei dati di bilancio", boldSmallFont));
|
||||
document.add(p5);
|
||||
document.add(new Paragraph(" "));
|
||||
|
||||
|
||||
// 6. Dettagli bilanci in forma abbreviata
|
||||
Paragraph p6 = new Paragraph();
|
||||
p6.add(new Chunk("6. ", boldSmallFont));
|
||||
p6.add(new Chunk("Dettagli bilanci in forma abbreviata", boldSmallFont));
|
||||
document.add(p6);
|
||||
document.add(new Paragraph(" "));
|
||||
|
||||
|
||||
// 7. Relazione aziendale illustrativa
|
||||
Paragraph p7 = new Paragraph();
|
||||
p7.add(new Chunk("7. ", boldSmallFont));
|
||||
p7.add(new Chunk("Relazione aziendale illustrativa", boldSmallFont));
|
||||
document.add(p7);
|
||||
document.add(new Paragraph(" "));
|
||||
|
||||
addColoredLines(writer,document,greenColor);
|
||||
// document.add(new Paragraph(" "));
|
||||
//
|
||||
//// pageEvent.setTotalPages(writer.getPageNumber());
|
||||
// document.newPage();
|
||||
//// pageEvent.setTotalPages(writer.getPageNumber());
|
||||
// document.add(new Paragraph("Documenti Allegati", sectionFont));
|
||||
// document.add(new Paragraph(" "));
|
||||
//
|
||||
//
|
||||
//// 1. Autocertificazione possesso Requisiti
|
||||
// Paragraph p1 = new Paragraph();
|
||||
// p1.add(new Chunk("1. ", boldSmallFont));
|
||||
// p1.add(new Chunk("Autocertificazione possesso Requisiti ", boldSmallFont));
|
||||
// p1.add(new Chunk("ai sensi degli artt. 46 e 47 del DPR 445/2000", smallFont));
|
||||
// document.add(p1);
|
||||
// document.add(new Paragraph(" "));
|
||||
//
|
||||
//
|
||||
//
|
||||
//// 2. Informativa Privacy relativa al trattamento dei dati personali
|
||||
// Paragraph p2 = new Paragraph();
|
||||
// p2.add(new Chunk("2. ", boldSmallFont));
|
||||
// p2.add(new Chunk("Informativa Privacy relativa al trattamento dei dati personali", boldSmallFont));
|
||||
// document.add(p2);
|
||||
// document.add(new Paragraph(" "));
|
||||
//
|
||||
//
|
||||
//// 3. Dati richiesti per la valutazione dell’adeguatezza dei flussi finanziari
|
||||
// Paragraph p3 = new Paragraph();
|
||||
// p3.add(new Chunk("3. ", boldSmallFont));
|
||||
// p3.add(new Chunk("Dati richiesti per la valutazione dell’adeguatezza dei flussi finanziari prospettici come da tabella di cui all’Appendice 9", boldSmallFont));
|
||||
// document.add(p3);
|
||||
// document.add(new Paragraph(" "));
|
||||
//
|
||||
//
|
||||
//// 4. Rilevazione Centrale dei Rischi
|
||||
// Paragraph p4 = new Paragraph();
|
||||
// p4.add(new Chunk("4. ", boldSmallFont));
|
||||
// p4.add(new Chunk("Rilevazione Centrale dei Rischi riferita agli ultimi 36 mesi disponibili alla data di presentazione della Domanda", boldSmallFont));
|
||||
// document.add(p4);
|
||||
// document.add(new Paragraph(" "));
|
||||
//
|
||||
//
|
||||
//// 5. Schema di presentazione dei dati di bilancio
|
||||
// Paragraph p5 = new Paragraph();
|
||||
// p5.add(new Chunk("5. ", boldSmallFont));
|
||||
// p5.add(new Chunk("Schema di presentazione dei dati di bilancio", boldSmallFont));
|
||||
// document.add(p5);
|
||||
// document.add(new Paragraph(" "));
|
||||
//
|
||||
//
|
||||
//// 6. Dettagli bilanci in forma abbreviata
|
||||
// Paragraph p6 = new Paragraph();
|
||||
// p6.add(new Chunk("6. ", boldSmallFont));
|
||||
// p6.add(new Chunk("Dettagli bilanci in forma abbreviata", boldSmallFont));
|
||||
// document.add(p6);
|
||||
// document.add(new Paragraph(" "));
|
||||
//
|
||||
//
|
||||
//// 7. Relazione aziendale illustrativa
|
||||
// Paragraph p7 = new Paragraph();
|
||||
// p7.add(new Chunk("7. ", boldSmallFont));
|
||||
// p7.add(new Chunk("Relazione aziendale illustrativa", boldSmallFont));
|
||||
// document.add(p7);
|
||||
// document.add(new Paragraph(" "));
|
||||
//
|
||||
// addColoredLines(writer,document,greenColor);
|
||||
|
||||
document.close();
|
||||
|
||||
@@ -206,13 +208,17 @@ public class PdfDao {
|
||||
|
||||
// Loop through the list of strings and create a cell for each string
|
||||
for (String item : values) {
|
||||
PdfPCell valueCell = new PdfPCell(new Phrase(item, valueFont));
|
||||
valueCell.setPadding(5f); // Increase padding for better spacing
|
||||
|
||||
// PdfPCell valueCell = new PdfPCell(new Phrase(item, valueFont));
|
||||
PdfPCell valueCell = PdfUtils.htmlToPdfPCell(item, valueFont);
|
||||
valueCell.setFixedHeight(30f); // Set a fixed height for the cell
|
||||
valueCell.setPaddingLeft(10f); // Adjust left padding as needed
|
||||
valueCell.setPaddingTop(0f); // Remove padding from top to allow vertical centering
|
||||
valueCell.setPaddingBottom(6f);
|
||||
valueCell.setPaddingLeft(leftMargin); // Increase left margin for value
|
||||
valueCell.setBorder(Rectangle.NO_BORDER); // Remove border for value cell
|
||||
valueCell.setMinimumHeight(30f);
|
||||
valueCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
valueCell.setCellEvent(new RoundedCorners()); // Apply rounded corners
|
||||
valueCell.setHorizontalAlignment(Element.ALIGN_LEFT); valueCell.setCellEvent(new RoundedCorners()); // Apply rounded corners
|
||||
|
||||
// Add the cell to the table
|
||||
valueTable.addCell(valueCell);
|
||||
@@ -272,14 +278,24 @@ public class PdfDao {
|
||||
document.add(valueTable);
|
||||
}
|
||||
else {
|
||||
PdfPCell valueCell = new PdfPCell(new Phrase(String.valueOf(value), valueFont));
|
||||
valueCell.setPadding(5f); // Increase padding for better spacing
|
||||
String fieldValue1= (String) value;
|
||||
if(Utils.isValidDateString(fieldValue1)){
|
||||
fieldValue1=Utils.formatDateString(String.valueOf(value));
|
||||
}
|
||||
if(Boolean.TRUE.equals(Utils.isItalianFormattedAmount(fieldValue)) ){
|
||||
fieldValue= String.valueOf(Utils.convertToItalianFormat(fieldValue));
|
||||
}
|
||||
// PdfPCell valueCell = new PdfPCell(new Phrase(fieldValue1, valueFont));
|
||||
PdfPCell valueCell = PdfUtils.htmlToPdfPCell(fieldValue1, valueFont);
|
||||
valueCell.setFixedHeight(30f); // Set a fixed height for the cell
|
||||
valueCell.setPaddingLeft(10f); // Adjust left padding as needed
|
||||
valueCell.setPaddingTop(0f); // Remove padding from top to allow vertical centering
|
||||
valueCell.setPaddingBottom(6f);
|
||||
valueCell.setPaddingLeft(leftMargin); // Increase left margin for value
|
||||
valueCell.setBorder(Rectangle.NO_BORDER); // Remove border for value cell
|
||||
valueCell.setMinimumHeight(30f);
|
||||
valueCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
valueCell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
||||
valueCell.setCellEvent(new RoundedCorners()); // Apply rounded corners
|
||||
|
||||
valueTable.addCell(valueCell);
|
||||
document.add(valueTable);
|
||||
}
|
||||
@@ -292,6 +308,7 @@ public class PdfDao {
|
||||
// Create a PdfPTable with dynamic column count based on stateFieldMap size
|
||||
Map<String, String> stateFieldMap = new HashMap<>();
|
||||
Map<String, Boolean> stateFieldBoolean = new HashMap<>();
|
||||
// Font textFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new BaseColor(178, 190, 181)); // Gray text
|
||||
|
||||
// Populate stateFieldMap from contentResponseBean settings
|
||||
contentResponseBean.getSettings().stream()
|
||||
@@ -348,33 +365,45 @@ public class PdfDao {
|
||||
List<String> orderedKeys = new ArrayList<>(trueKeys);
|
||||
orderedKeys.addAll(falseKeys);
|
||||
// Iterate through extracted data to populate the table
|
||||
for (Map<String, Object> row : extractedData) {
|
||||
// Add headers once
|
||||
if (!headersAdded) {
|
||||
for (String key : orderedKeys) {
|
||||
String headerValue = stateFieldMap.get(key); // Header text
|
||||
PdfPCell headerCell = new PdfPCell(new Phrase(headerValue)); // Create a new PdfPCell for the header
|
||||
// PdfPCell headerCell = new PdfPCell(new Phrase(headerValue)); // Create a new PdfPCell for the header
|
||||
PdfPCell headerCell = PdfUtils.htmlToPdfPCell(headerValue, textFont);
|
||||
headerCell.setHorizontalAlignment(Element.ALIGN_CENTER); // Center align
|
||||
headerCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
headerCell.setBackgroundColor(new BaseColor(178, 190, 181)); // Light gray background for header
|
||||
|
||||
headerCell.setFixedHeight(30f); // Set a fixed height for the cell
|
||||
headerCell.setPaddingLeft(10f); // Adjust left padding as needed
|
||||
headerCell.setPaddingTop(0f); // Remove padding from top to allow vertical centering
|
||||
headerCell.setPaddingBottom(6f);
|
||||
table.addCell(headerCell); // Add the header cell to the table
|
||||
}
|
||||
headersAdded = true; // Prevent headers from being added again
|
||||
}
|
||||
|
||||
// Add data rows matching stateFieldMap keys
|
||||
for (Map.Entry<String, String> stateField : stateFieldMap.entrySet()) {
|
||||
for (String key : orderedKeys) { // Iterate over the ordered keys
|
||||
Object value = row.getOrDefault(key, ""); // Fetch value or use empty string if key not present
|
||||
PdfPCell dynamicCell = new PdfPCell(new Phrase(value != null ? value.toString() : "", textFont));
|
||||
dynamicCell.setBackgroundColor(new BaseColor(239, 243, 248)); // Light blue for the cell
|
||||
dynamicCell.setMinimumHeight(rowHeight);
|
||||
dynamicCell.setPadding(7f);
|
||||
|
||||
table.addCell(dynamicCell); // Add the dynamically created cell to the table
|
||||
for (Map<String, Object> row : extractedData) {
|
||||
// Add data rows matching stateFieldMap keys
|
||||
for (String key : orderedKeys) {
|
||||
if (stateFieldMap.containsKey(key)) { // Only add data cell if key is in stateFieldMap
|
||||
Object value = row.getOrDefault(key, ""); // Fetch value or use empty string if key not present
|
||||
String fieldValue= (String) value;
|
||||
if(Boolean.TRUE.equals(Utils.isItalianFormattedAmount(fieldValue)) ){
|
||||
fieldValue= String.valueOf(Utils.convertToItalianFormat(fieldValue));
|
||||
}
|
||||
// PdfPCell dataCell = new PdfPCell(new Phrase(fieldValue != null ?fieldValue: "", textFont));
|
||||
PdfPCell dataCell = PdfUtils.htmlToPdfPCell(fieldValue != null ? fieldValue : "", textFont);
|
||||
dataCell.setBackgroundColor(new BaseColor(239, 243, 248)); // Light blue for the cell
|
||||
dataCell.setPaddingLeft(10f); // Adjust left padding as needed
|
||||
dataCell.setPaddingTop(0f); // Remove padding from top to allow vertical centering
|
||||
dataCell.setPaddingBottom(6f);
|
||||
dataCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
dataCell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
||||
table.addCell(dataCell); // Add the cell to the table
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if adding another row would exceed max height
|
||||
if (table.getTotalHeight() + rowHeight > maxTableHeight) {
|
||||
@@ -454,14 +483,8 @@ public class PdfDao {
|
||||
|
||||
// Process 'fileupload' and 'checkboxes' cases as in the original logic
|
||||
if (name.equals("fileupload")) {
|
||||
if (fieldValue instanceof List<?> && ((List<?>) fieldValue).stream().allMatch(item -> item instanceof DocumentResponseBean)) {
|
||||
List<DocumentResponseBean> documentList = (List<DocumentResponseBean>) fieldValue;
|
||||
List<String> names = documentList.stream()
|
||||
.map(DocumentResponseBean::getName)
|
||||
.collect(Collectors.toList());
|
||||
fieldValue = names;
|
||||
}
|
||||
} else if (name.equals("checkboxes")) {
|
||||
continue;
|
||||
} else if (name.equals("checkboxes") && fieldValue instanceof List<?>) {
|
||||
List<String> check = (List<String>) fieldValue;
|
||||
List<SettingResponseBean> settingResponseBeans = content.getSettings();
|
||||
List<String> matchedLabels = new ArrayList<>();
|
||||
@@ -494,7 +517,9 @@ public class PdfDao {
|
||||
}
|
||||
|
||||
try {
|
||||
addLabelValuePair(writer,document, contentLabel, fieldValue, labelFont,valueFont,content);
|
||||
if((contentLabel!=null && Boolean.FALSE.equals(contentLabel.isEmpty())) || (fieldValue!=null && !StringUtils.isEmpty((CharSequence) fieldValue))) {
|
||||
addLabelValuePair(writer, document, contentLabel, fieldValue, labelFont, valueFont, content);
|
||||
}
|
||||
} catch (DocumentException e) {
|
||||
log.error("Error checking object: " + e.getMessage(), e);
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package net.gepafin.tendermanagement.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
public enum AssignedEvaluationStatus {
|
||||
APPROVED("APPROVED"),
|
||||
REJECTED("REJECTED");
|
||||
|
||||
private String value;
|
||||
|
||||
AssignedEvaluationStatus(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -28,4 +28,5 @@ public class ApplicationEvaluationResponse {
|
||||
private String callName;
|
||||
private LocalDateTime submissionDate;
|
||||
private LocalDateTime evaluationDate;
|
||||
private LocalDateTime callEndDate;
|
||||
}
|
||||
|
||||
@@ -12,12 +12,14 @@ import java.util.Optional;
|
||||
@Repository
|
||||
public interface ApplicationEvaluationRepository extends JpaRepository<ApplicationEvaluationEntity, Long> {
|
||||
|
||||
List<ApplicationEvaluationEntity> findByApplicationIdAndIsDeletedFalse(Long applicationId);
|
||||
Optional<ApplicationEvaluationEntity> findByApplicationIdAndIsDeletedFalse(Long applicationId);
|
||||
Optional<ApplicationEvaluationEntity> findByIdAndIsDeletedFalse(Long id);
|
||||
Optional<ApplicationEvaluationEntity> findByAssignedApplicationsEntity_IdAndIsDeletedFalse(Long assignedApplicationId);
|
||||
|
||||
Optional<ApplicationEvaluationEntity> findByApplicationIdAndAssignedApplicationsEntity_IdAndIsDeletedFalse(Long applicationId, Long assignedApplicationId);
|
||||
|
||||
Optional<ApplicationEvaluationEntity> findFirstByIsDeletedFalseOrderByCreatedDateDesc();
|
||||
boolean existsByApplicationIdAndIsDeletedFalse(Long applicationId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,15 @@ import java.util.Optional;
|
||||
public interface AssignedApplicationsRepository extends JpaRepository<AssignedApplicationsEntity,Long>, JpaSpecificationExecutor<AssignedApplicationsEntity>{
|
||||
Optional<AssignedApplicationsEntity> findByApplicationIdAndIsDeletedFalse(Long applicationId);
|
||||
Optional<AssignedApplicationsEntity> findByIdAndIsDeletedFalse(Long id);
|
||||
@Query("SELECT aa FROM AssignedApplicationsEntity aa WHERE aa.isDeleted = false AND aa.application.id = :applicationId")
|
||||
List<AssignedApplicationsEntity> findAllByApplicationId(@Param("applicationId") Long applicationId);
|
||||
|
||||
@Query("SELECT aa FROM AssignedApplicationsEntity aa WHERE aa.isDeleted = false AND aa.application.id = :applicationId AND aa.id = :assignedApplicationId")
|
||||
Optional<AssignedApplicationsEntity> findByApplicationIdAndAssignedApplicationId(
|
||||
@Query("SELECT aa FROM AssignedApplicationsEntity aa WHERE aa.isDeleted = false " +
|
||||
"AND (:applicationId IS NULL OR aa.application.id = :applicationId) " +
|
||||
"AND (:id IS NULL OR aa.id = :id) " +
|
||||
"AND (:userId IS NULL OR aa.userId = :userId)")
|
||||
Optional<AssignedApplicationsEntity> findByApplicationIdOrIdAndUserIdAndIsDeletedFalse(
|
||||
@Param("applicationId") Long applicationId,
|
||||
@Param("assignedApplicationId") Long assignedApplicationId);
|
||||
@Query("SELECT aa FROM AssignedApplicationsEntity aa WHERE aa.isDeleted = false AND aa.id = :assignedApplicationId")
|
||||
Optional<AssignedApplicationsEntity> findByAssignedApplicationId(@Param("assignedApplicationId") Long assignedApplicationId);
|
||||
@Param("id") Long id,
|
||||
@Param("userId") Long userId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.gepafin.tendermanagement.service;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.AssignedEvaluationStatus;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
|
||||
|
||||
@@ -13,8 +14,8 @@ public interface ApplicationEvaluationService {
|
||||
ApplicationEvaluationResponse createOrUpdateApplicationEvaluation(HttpServletRequest request, ApplicationEvaluationRequest applicationEvaluationRequest,Long assignedApplicationsId);
|
||||
void deleteApplicationEvaluation(HttpServletRequest request,Long id);
|
||||
|
||||
List<ApplicationEvaluationResponse> getApplicationEvaluationByApplicationId(HttpServletRequest request,Long applicationId,Long assignedApplicationId);
|
||||
ApplicationEvaluationResponse updateApplicationEvaluationStatus(HttpServletRequest request, Long assignedApplicationId);
|
||||
ApplicationEvaluationResponse getApplicationEvaluationByApplicationId(HttpServletRequest request,Long applicationId,Long assignedApplicationId);
|
||||
ApplicationEvaluationResponse updateApplicationEvaluationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedEvaluationStatus status);
|
||||
|
||||
|
||||
ApplicationEvaluationEntity validateApplicationEvaluation(Long applicationEvaluationId);
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
|
||||
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.AssignedEvaluationStatus;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
|
||||
|
||||
@@ -47,56 +48,38 @@ public class ApplicationEvaluationServiceImpl implements ApplicationEvaluationSe
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<ApplicationEvaluationResponse> getApplicationEvaluationByApplicationId(
|
||||
public ApplicationEvaluationResponse getApplicationEvaluationByApplicationId(
|
||||
HttpServletRequest request, Long applicationId, Long assignedApplicationId) {
|
||||
|
||||
if (applicationId == null && assignedApplicationId == null) {
|
||||
throw new CustomValidationException(
|
||||
Status.BAD_REQUEST,
|
||||
Translator.toLocale(GepafinConstant.EITHER_APPLICATION_OR_ASSIGNED_APPLICATION_ID_REQUIRED_MSG)
|
||||
);
|
||||
}
|
||||
AssignedApplicationsEntity assignedApplications;
|
||||
UserEntity preInstructor = validator.validateUser(request);
|
||||
Optional<AssignedApplicationsEntity> assignedApplicationsOptional =
|
||||
assignedApplicationsRepository.findByApplicationIdOrIdAndUserIdAndIsDeletedFalse(applicationId,assignedApplicationId, preInstructor.getId());
|
||||
|
||||
if (applicationId != null && assignedApplicationId != null) {
|
||||
assignedApplications = assignedApplicationsRepository
|
||||
.findByApplicationIdAndAssignedApplicationId(applicationId, assignedApplicationId)
|
||||
.orElseThrow(() -> new CustomValidationException(
|
||||
Status.BAD_REQUEST,
|
||||
Translator.toLocale(GepafinConstant.ASSIGNED_APPLICATION_NOT_FOUND_WITH_ID_MSG)
|
||||
));
|
||||
} else if (assignedApplicationId != null) {
|
||||
assignedApplications = assignedApplicationsRepository
|
||||
.findByAssignedApplicationId(assignedApplicationId)
|
||||
.orElseThrow(() -> new CustomValidationException(
|
||||
Status.BAD_REQUEST,
|
||||
Translator.toLocale(GepafinConstant.ASSIGNED_APPLICATION_NOT_FOUND_WITH_ID_MSG)
|
||||
));
|
||||
} else {
|
||||
List<AssignedApplicationsEntity> assignedApplicationsList = assignedApplicationsRepository
|
||||
.findAllByApplicationId(applicationId);
|
||||
|
||||
if (assignedApplicationsList.isEmpty()) {
|
||||
throw new CustomValidationException(
|
||||
if (assignedApplicationId != null) {
|
||||
assignedApplicationsOptional = assignedApplicationsOptional.filter(a -> a.getId().equals(assignedApplicationId));
|
||||
}
|
||||
AssignedApplicationsEntity assignedApplications = assignedApplicationsOptional
|
||||
.orElseThrow(() -> new CustomValidationException(
|
||||
Status.BAD_REQUEST,
|
||||
Translator.toLocale(GepafinConstant.ASSIGNED_APPLICATION_NOT_FOUND_WITH_ID_MSG)
|
||||
);
|
||||
}
|
||||
));
|
||||
validator.validatePreInstructor(request, assignedApplications.getUserId());
|
||||
|
||||
assignedApplications = assignedApplicationsList.get(0);
|
||||
}
|
||||
|
||||
UserEntity user = validator.validatePreInstructor(request, assignedApplications.getUserId());
|
||||
if (applicationId != null && assignedApplicationId == null) {
|
||||
return applicationEvaluationDao.getApplicationEvaluationByApplicationId(user, assignedApplications.getApplication().getId(), null);
|
||||
}
|
||||
|
||||
if (applicationId != null && assignedApplicationId != null) {
|
||||
return applicationEvaluationDao.getApplicationEvaluationByApplicationId(user, assignedApplications.getApplication().getId(), assignedApplications.getId());
|
||||
}
|
||||
return applicationEvaluationDao.getApplicationEvaluationByApplicationId(user, null, assignedApplications.getId());
|
||||
return applicationEvaluationDao.getApplicationEvaluationByApplicationId(
|
||||
preInstructor,
|
||||
assignedApplications.getApplication().getId(),
|
||||
assignedApplications.getId()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteApplicationEvaluation(HttpServletRequest request,Long id) {
|
||||
@@ -106,11 +89,11 @@ public class ApplicationEvaluationServiceImpl implements ApplicationEvaluationSe
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ApplicationEvaluationResponse updateApplicationEvaluationStatus(HttpServletRequest request, Long assignedApplicationId) {
|
||||
public ApplicationEvaluationResponse updateApplicationEvaluationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedEvaluationStatus status) {
|
||||
AssignedApplicationsEntity assignedApplication = assignedApplicationsRepository.findByIdAndIsDeletedFalse(assignedApplicationId).orElseThrow(()->
|
||||
new ResourceNotFoundException(Status.NOT_FOUND,Translator.toLocale(GepafinConstant.ASSIGNED_APPLICATION_NOT_FOUND_MSG)));
|
||||
validator.validatePreInstructor(request,assignedApplication.getUserId());
|
||||
return applicationEvaluationDao.updateApplicationEvaluationStatus(assignedApplication.getApplication(),assignedApplication);
|
||||
return applicationEvaluationDao.updateApplicationEvaluationStatus(assignedApplication.getApplication(),assignedApplication,status);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package net.gepafin.tendermanagement.util;
|
||||
import com.itextpdf.text.DocumentException;
|
||||
import com.itextpdf.text.Element;
|
||||
import com.itextpdf.text.Font;
|
||||
import com.itextpdf.text.pdf.PdfPCell;
|
||||
import com.itextpdf.text.html.simpleparser.HTMLWorker;
|
||||
import com.itextpdf.text.html.simpleparser.StyleSheet;
|
||||
import com.itextpdf.text.Paragraph;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class PdfUtils {
|
||||
|
||||
|
||||
|
||||
public static PdfPCell htmlToPdfPCell(String htmlContent, Font font) {
|
||||
PdfPCell cell = new PdfPCell();
|
||||
|
||||
// Check if the content is not null or empty
|
||||
if (htmlContent != null && !htmlContent.trim().isEmpty()) {
|
||||
// Wrap plain text in a paragraph tag if it doesn't contain any HTML
|
||||
// Check if the string does not contain any '<' or '>' characters
|
||||
if (!htmlContent.contains("<") || !htmlContent.contains(">")) {
|
||||
htmlContent = "<p>" + htmlContent + "</p>"; // Wrap in paragraph tags
|
||||
}
|
||||
|
||||
try {
|
||||
// Create a list to hold the elements parsed from the HTML
|
||||
List<Element> elements = HTMLWorker.parseToList(new StringReader(htmlContent), new StyleSheet());
|
||||
|
||||
// Create a paragraph to hold the formatted text
|
||||
Paragraph paragraph = new Paragraph();
|
||||
|
||||
// Add each element to the paragraph
|
||||
for (Element element : elements) {
|
||||
// If the element is a Paragraph, set the font directly
|
||||
if (element instanceof Paragraph) {
|
||||
((Paragraph) element).setFont(font);
|
||||
}
|
||||
// If the element is a Chunk, set the font directly
|
||||
else if (element instanceof com.itextpdf.text.Chunk) {
|
||||
((com.itextpdf.text.Chunk) element).setFont(font);
|
||||
}
|
||||
// Add the element to the paragraph
|
||||
paragraph.add(element);
|
||||
}
|
||||
|
||||
// Add the paragraph to the cell
|
||||
cell.addElement(paragraph);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(); // Log the exception for debugging
|
||||
}
|
||||
}
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,12 +5,20 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Type;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.SecureRandom;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.itextpdf.styledxmlparser.jsoup.Jsoup;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.slf4j.Logger;
|
||||
@@ -387,5 +395,76 @@ public class Utils {
|
||||
throw new RuntimeException("Error converting map to string", e);
|
||||
}
|
||||
}
|
||||
public static boolean isValidDateString(String dateStr) {
|
||||
Pattern datePattern = Pattern.compile("\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}");
|
||||
return datePattern.matcher(dateStr).matches();
|
||||
}
|
||||
|
||||
// Method to convert a valid date string to the "dd-MM-yyyy" format
|
||||
public static String formatDateString(String dateStr) {
|
||||
String originalFormatPattern = "yyyy-MM-dd'T'HH:mm:ss";
|
||||
String targetFormatPattern = "dd-MM-yyyy";
|
||||
|
||||
try {
|
||||
SimpleDateFormat originalFormat = new SimpleDateFormat(originalFormatPattern);
|
||||
Date date = originalFormat.parse(dateStr);
|
||||
SimpleDateFormat targetFormat = new SimpleDateFormat(targetFormatPattern);
|
||||
|
||||
return targetFormat.format(date);
|
||||
} catch (ParseException e) {
|
||||
log.error("error while prcoessing date formate");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// public static String convertItalianAmountToDouble(String amount) throws NumberFormatException {
|
||||
// // Step 1: Remove the thousands separator and replace the decimal separator
|
||||
// String normalizedAmount = amount.replace(".", "").replace(",", ".");
|
||||
//
|
||||
// // Step 2: Parse the string to a double
|
||||
// double value = Double.parseDouble(normalizedAmount);
|
||||
// if (value <= 0) {
|
||||
// return amount;
|
||||
// }
|
||||
// // Step 3: Format the double to 2 decimal places
|
||||
// DecimalFormat decimalFormat = new DecimalFormat("#.00");
|
||||
// return decimalFormat.format(value); // Return formatted string
|
||||
// }
|
||||
|
||||
public static String convertToItalianFormat(String amount) {
|
||||
try {
|
||||
// Step 1: Sanitize and standardize the input
|
||||
String sanitizedAmount = amount.trim();
|
||||
if (sanitizedAmount.matches("\\d")) {
|
||||
return sanitizedAmount;
|
||||
}
|
||||
// Step 2: Handle Italian-style input (e.g., "37.192,00")
|
||||
if (sanitizedAmount.contains(".") && sanitizedAmount.contains(",")) {
|
||||
// Assume the period is a thousand separator and the comma is a decimal separator
|
||||
sanitizedAmount = sanitizedAmount.replace(".", "").replace(",", ".");
|
||||
} else if (sanitizedAmount.contains(",")) {
|
||||
// If the input contains only a comma, treat it as a decimal separator
|
||||
sanitizedAmount = sanitizedAmount.replace(",", ".");
|
||||
}
|
||||
// Step 3: Parse the cleaned-up string into a double
|
||||
double parsedAmount = Double.parseDouble(sanitizedAmount);
|
||||
// Step 4: Format the parsed amount to Italian format
|
||||
NumberFormat italianFormat = NumberFormat.getInstance(Locale.ITALY);
|
||||
italianFormat.setMinimumFractionDigits(2);
|
||||
italianFormat.setMaximumFractionDigits(2);
|
||||
|
||||
return italianFormat.format(parsedAmount);
|
||||
} catch (NumberFormatException e) {
|
||||
// In case of any issues with parsing, return a default or error message
|
||||
return "Invalid amount format";
|
||||
}
|
||||
}
|
||||
public static boolean isItalianFormattedAmount(String input) {
|
||||
// Regular expression to match Italian-style amounts (e.g., 41.003,00 or 123,45)
|
||||
String sanitizedInput = input.replace(",", "");
|
||||
|
||||
// Step 2: Check if the remaining string is a whole number
|
||||
String wholeNumberPattern = "^\\d+$"; // Regex to match whole numbers
|
||||
|
||||
return sanitizedInput.matches(wholeNumberPattern);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.AssignedEvaluationStatus;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
|
||||
import net.gepafin.tendermanagement.model.request.UpdateApplicationEvaluationRequest;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
|
||||
@@ -38,21 +39,17 @@ public interface ApplicationEvaluationApi {
|
||||
@Parameter(required = true) @PathVariable("assignedApplicationsId") Long assignedApplicationsId,
|
||||
@Parameter( required = true) @Valid @RequestBody ApplicationEvaluationRequest evaluationRequest);
|
||||
|
||||
@Operation(
|
||||
summary = "API to get ApplicationEvaluation data for evaluation process",
|
||||
@Operation(summary = "API to get ApplicationEvaluation data for evaluation process",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) }))
|
||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) }))
|
||||
})
|
||||
@GetMapping(value = "/application", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Response<List<ApplicationEvaluationResponse>>> getApplicationEvaluationByApplicationId(
|
||||
ResponseEntity<Response<ApplicationEvaluationResponse>> getApplicationEvaluationByApplicationId(
|
||||
HttpServletRequest request,
|
||||
@Parameter(required = false) @RequestParam(value = "applicationId", required = false) Long applicationId,
|
||||
@Parameter(required = false) @RequestParam(value = "assignedApplicationId", required = false) Long assignedApplicationId);
|
||||
|
||||
@Parameter( required = false) @RequestParam(value = "assignedApplicationId", required = false) Long assignedApplicationId);
|
||||
@Operation(summary = "API to delete ApplicationEvaluation",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@@ -74,6 +71,7 @@ public interface ApplicationEvaluationApi {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@PutMapping(value = "/{assignedApplicationId}/status", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Response<ApplicationEvaluationResponse>> updateApplicationEvaluationStatus(HttpServletRequest request,
|
||||
@Parameter( required = true) @PathVariable("assignedApplicationId") Long assignedApplicationId);
|
||||
@Parameter( required = true) @PathVariable("assignedApplicationId") Long assignedApplicationId,
|
||||
@Parameter(description = "status", required = true)@RequestParam(value = "status", required = true) AssignedEvaluationStatus status);
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.AssignedEvaluationStatus;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
|
||||
import net.gepafin.tendermanagement.model.request.UpdateApplicationEvaluationRequest;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
|
||||
@@ -37,14 +38,13 @@ public class ApplicationEvaluationApiController implements ApplicationEvaluation
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<List<ApplicationEvaluationResponse>>> getApplicationEvaluationByApplicationId(
|
||||
public ResponseEntity<Response<ApplicationEvaluationResponse>> getApplicationEvaluationByApplicationId(
|
||||
HttpServletRequest request, Long applicationId, Long assignedApplicationId) {
|
||||
|
||||
List<ApplicationEvaluationResponse> responseList =
|
||||
applicationEvaluationService.getApplicationEvaluationByApplicationId(request, applicationId, assignedApplicationId);
|
||||
|
||||
ApplicationEvaluationResponse response = null;
|
||||
response = applicationEvaluationService.getApplicationEvaluationByApplicationId(request, applicationId,assignedApplicationId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(responseList, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FETCHED_SUCCESSFULLY)));
|
||||
.body(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FETCHED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ public class ApplicationEvaluationApiController implements ApplicationEvaluation
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<ApplicationEvaluationResponse>> updateApplicationEvaluationStatus(HttpServletRequest request, Long assignedApplicationId) {
|
||||
ApplicationEvaluationResponse applicationEvaluationResponse = applicationEvaluationService.updateApplicationEvaluationStatus(request, assignedApplicationId);
|
||||
public ResponseEntity<Response<ApplicationEvaluationResponse>> updateApplicationEvaluationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedEvaluationStatus status) {
|
||||
ApplicationEvaluationResponse applicationEvaluationResponse = applicationEvaluationService.updateApplicationEvaluationStatus(request, assignedApplicationId,status);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(applicationEvaluationResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.APPLICATION_EVALUATION_STATUS_UPDATED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@@ -263,6 +263,7 @@ application.evaluation.status.updated.successfully=Application evaluation status
|
||||
evaluationCriteria.invalid=This evaluation criterion does not belong to the current call.
|
||||
assigned.application.not.found.with.id=Assigned application with this application ID not found
|
||||
either.application.or.assigned.application.id.required=Either applicationId or assignedApplicationId is required.
|
||||
evaluation.already.exists=An application evaluation already exists for this application ID.
|
||||
|
||||
# Hub Messages
|
||||
hub_create_success=Hub created successfully
|
||||
|
||||
@@ -261,6 +261,7 @@ evaluations.fetched.successfully = Tutte le valutazioni delle applicazioni recup
|
||||
application.evaluation.status.updated.successfully=Stato della valutazione dell'applicazione aggiornato con successo.
|
||||
assigned.application.not.found.with.id=Applicazione assegnata con questo ID dell'applicazione non trovata
|
||||
either.application.or.assigned.application.id.required=È richiesto almeno uno tra applicationId o assignedApplicationId.
|
||||
evaluation.already.exists=Una valutazione dell'applicazione esiste già per questo ID applicazione.
|
||||
|
||||
application.assigned.success.msg =Domanda assegnata con successo
|
||||
application.already.assigned.msg =La domanda � gi� assegnata
|
||||
|
||||
Reference in New Issue
Block a user