Resolved Conflicts.
This commit is contained in:
@@ -98,7 +98,7 @@ public class ApplicationAmendmentRequestDao {
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
|
||||
public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(HttpServletRequest request, Long applicationEvaluationId) {
|
||||
public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(Long applicationEvaluationId) {
|
||||
log.info("Fetching the application data for the Amendment process {}", applicationEvaluationId);
|
||||
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(applicationEvaluationId);
|
||||
Long applicationId = applicationEvaluationEntity.getApplicationId();
|
||||
@@ -228,8 +228,6 @@ public class ApplicationAmendmentRequestDao {
|
||||
applicationEvaluationEntity.getAssignedApplicationsEntity().getApplication(), protocolNumber,
|
||||
userEntity.getHub().getId());
|
||||
applicationAmendmentRequestEntity.setProtocol(protocolEntity);
|
||||
applicationAmendmentRequestEntity.setIsEmail(false);
|
||||
applicationAmendmentRequestEntity.setIsNotification(false);
|
||||
ApplicationAmendmentRequestEntity applicationAmendment = saveApplicationAmendmentRequestEntity(applicationAmendmentRequestEntity);
|
||||
|
||||
//Set Status
|
||||
@@ -379,7 +377,6 @@ public class ApplicationAmendmentRequestDao {
|
||||
}
|
||||
|
||||
public List<ApplicationAmendmentRequestResponse> getAllApplicationAmendmentRequest(HttpServletRequest request,Long userId) {
|
||||
UserEntity user = validator.validateUser(request);
|
||||
if(validator.checkIsPreInstructor() && userId == null) {
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.USER_ID_NOT_NULL_MSG));
|
||||
}
|
||||
@@ -580,8 +577,10 @@ public class ApplicationAmendmentRequestDao {
|
||||
String subject = prepareSubject(emailTemplate, amendment, beneficiaryUser);
|
||||
String body = prepareBody(emailTemplate, amendment, beneficiaryUser);
|
||||
String email = beneficiaryUser.getEmail();
|
||||
if (Boolean.TRUE.equals(amendment.getIsEmail())&&email != null && !email.isEmpty()) {
|
||||
String companyEmail = applicationEntity.getCompany().getEmail();
|
||||
if (Boolean.TRUE.equals(amendment.getIsEmail())&&email != null && !email.isEmpty() && companyEmail != null && !companyEmail.isEmpty()) {
|
||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(email));
|
||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(companyEmail));
|
||||
// mailUtil.sendByMailGun(subject,body,List.of(email),null);
|
||||
} else {
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.BENEFICIARY_EMAIL_NOT_FOUND_MSG));
|
||||
|
||||
@@ -32,6 +32,7 @@ import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationExceptio
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -110,6 +111,9 @@ public class ApplicationDao {
|
||||
@Value("${carlo_email}")
|
||||
private String carloEmail;
|
||||
|
||||
@Value("${call.id}")
|
||||
private String callId;
|
||||
|
||||
@Autowired
|
||||
private AmazonS3Service amazonS3Service;
|
||||
|
||||
@@ -776,7 +780,7 @@ public class ApplicationDao {
|
||||
MultipartFile file) {
|
||||
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
||||
validator.validateUserWithCompany(request, applicationEntity.getCompany().getId());
|
||||
validateFileType(file);
|
||||
validateFileTypeForCall(file, applicationEntity);
|
||||
ApplicationSignedDocumentEntity applicationSignedDocument = applicationSignedDocumentRepository
|
||||
.findByApplicationIdAndStatus(applicationId, ApplicationSignedDocumentStatusEnum.ACTIVE.getValue());
|
||||
if (applicationSignedDocument != null) {
|
||||
@@ -796,6 +800,16 @@ public class ApplicationDao {
|
||||
applicationRepository.save(applicationEntity);
|
||||
return convertApplicationSignedDocumentToApplicationSignedDocumentResponse(applicationSignedDocument);
|
||||
}
|
||||
|
||||
private void validateFileTypeForCall(MultipartFile file, ApplicationEntity applicationEntity) {
|
||||
List<String> validCallIds = Arrays.asList(callId.split(","));
|
||||
if (applicationEntity != null && validCallIds.contains(applicationEntity.getCall().getId().toString())) {
|
||||
return;
|
||||
}
|
||||
validateFileType(file);
|
||||
}
|
||||
|
||||
|
||||
private UploadFileOnAmazonS3Response uploadFileOnAmazonS3ForUserSignedDocument(MultipartFile file, Long callId, Long applicationId) {
|
||||
try {
|
||||
String s3Path = generateS3PathForDelegation(callId, applicationId);
|
||||
|
||||
@@ -897,12 +897,13 @@ public class ApplicationEvaluationDao {
|
||||
assignedApplicationsRepository.save(assignedApplicationsEntity);
|
||||
|
||||
ApplicationAmendmentRequestEntity amendmentRequest = applicationAmendmentRequestRepository.findByApplicationEvaluationIdAndIsDeletedFalse(entity.getId());
|
||||
if(amendmentRequest!=null){
|
||||
if (Boolean.TRUE.equals(statusType.equals((ApplicationStatusTypeEnum.APPROVED.getValue())))) {
|
||||
emailNotificationDao.sendAdmissibilityNotificationEmailForApprovedApplication(amendmentRequest);
|
||||
}
|
||||
if (Boolean.TRUE.equals(statusType.equals((ApplicationStatusTypeEnum.REJECTED.getValue())))) {
|
||||
emailNotificationDao.sendInadmissibilityEmailForRejectedApplication(amendmentRequest);
|
||||
}
|
||||
}}
|
||||
return convertToResponse(entity);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -77,9 +77,15 @@ public class EmailNotificationDao {
|
||||
|
||||
UserEntity userEntity = userService.validateUser(applicationEntity.getUserId());
|
||||
List<String> recipientEmails = new ArrayList<>();
|
||||
if (applicationEntity.getCompany().getEmail() != null) {
|
||||
recipientEmails.add(applicationEntity.getCompany().getEmail());
|
||||
String companyEmail = applicationEntity.getCompany().getEmail();
|
||||
String contactEmail = applicationEntity.getCompany().getContactEmail();
|
||||
if (companyEmail != null && !companyEmail.isEmpty()) {
|
||||
recipientEmails.add(companyEmail);
|
||||
}
|
||||
if (contactEmail != null && !contactEmail.isEmpty() && !contactEmail.equals(companyEmail)) {
|
||||
recipientEmails.add(contactEmail);
|
||||
}
|
||||
|
||||
if (userEntity.getBeneficiary().getEmail() != null) {
|
||||
recipientEmails.add(userEntity.getBeneficiary().getEmail());
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class PdfDao {
|
||||
@@ -476,7 +477,7 @@ public class PdfDao {
|
||||
String contentId = content.getId(); // Content ID
|
||||
String label = content.getLabel(); // Content label
|
||||
String name = content.getName(); // Content name
|
||||
Object fieldValue = null;
|
||||
Object fieldValue = "";
|
||||
|
||||
String contentLabel = content.getSettings().stream()
|
||||
.filter(setting -> "label".equals(setting.getName())) // Filter settings by name
|
||||
@@ -485,6 +486,32 @@ public class PdfDao {
|
||||
.findFirst() // Get the first matching value
|
||||
.orElse(null); // If no match is found, set label to null
|
||||
// Find the form field in the response that matches the contentId
|
||||
if (name.equals("paragraph")){
|
||||
String paragraph = content.getSettings().stream()
|
||||
.filter(setting -> "text".equals(setting.getName())) // Filter settings by name
|
||||
.map(SettingResponseBean::getValue) // Extract the value from the matching setting
|
||||
.map(Object::toString) // Convert the value to a string
|
||||
.findFirst() // Get the first matching value
|
||||
.orElse(null);
|
||||
Paragraph labelParagraph = new Paragraph();
|
||||
PdfPCell labelCell = new PdfPCell(PdfUtils.htmlToPdfPCell(paragraph,labelFont));
|
||||
labelCell.setBorder(Rectangle.NO_BORDER);
|
||||
labelCell.setGrayFill(7);
|
||||
labelCell.setPadding(5);
|
||||
|
||||
// Create a PdfPTable with 1 column and add the PdfPCell to it
|
||||
PdfPTable table = new PdfPTable(1);
|
||||
table.setWidthPercentage(100);
|
||||
table.addCell(labelCell);
|
||||
labelParagraph.add(table);
|
||||
try {
|
||||
document.add(labelParagraph);
|
||||
document.add(new Paragraph(" "));
|
||||
|
||||
} catch (DocumentException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
Optional<ApplicationFormFieldResponseBean> matchingFormField = formFields.stream()
|
||||
.filter(formField -> formField.getFieldId().equals(contentId))
|
||||
.findFirst();
|
||||
@@ -501,7 +528,13 @@ public class PdfDao {
|
||||
|
||||
// Process 'fileupload' and 'checkboxes' cases as in the original logic
|
||||
if (name.equals("fileupload")) {
|
||||
continue;
|
||||
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") && fieldValue instanceof List<?>) {
|
||||
List<String> check = (List<String>) fieldValue;
|
||||
List<SettingResponseBean> settingResponseBeans = content.getSettings();
|
||||
@@ -529,15 +562,12 @@ public class PdfDao {
|
||||
|
||||
// Further processing of field value (e.g., finding labels in options)
|
||||
fieldValue = findLabelInOptions(content.getSettings(), fieldValue);
|
||||
} else {
|
||||
// If no matching form field is found, store contentId with an empty string
|
||||
fieldValue = "";
|
||||
}
|
||||
|
||||
try {
|
||||
if((contentLabel!=null && Boolean.FALSE.equals(contentLabel.isEmpty())) || (fieldValue!=null && !StringUtils.isEmpty((CharSequence) fieldValue))) {
|
||||
addLabelValuePair(writer, document, contentLabel, fieldValue, labelFont, valueFont, content);
|
||||
if((contentLabel==null || StringUtils.isEmpty(contentLabel)) && (fieldValue==null || StringUtils.isEmpty(fieldValue.toString()))) {
|
||||
continue;
|
||||
}
|
||||
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