Resolved Conflicts.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user