Merge branch 'develop' of https://github.com/Kitzanos/GEPAFIN-BE into develop
This commit is contained in:
@@ -233,6 +233,15 @@ public class GepafinConstant {
|
||||
public static final String CANNOT_DELETE_COMPANY_WITH_APPLICATION_SUBMITT = "application.in.submit.status.cannot.delete.company";
|
||||
public static final String GET_USERS_SUCCESS_MSG = "get.users.success.msg";
|
||||
public static final String CANNOT_CREATE_BENEFICIARY_USER="cannot.create.beneficiary.user";
|
||||
public static final String EVALUATION_CREATED_SUCCESSFULLY = "evaluation.created.successfully";
|
||||
public static final String EVALUATION_UPDATED_SUCCESSFULLY = "evaluation.updated.successfully";
|
||||
public static final String EVALUATION_FETCHED_SUCCESSFULLY = "evaluation.fetched.successfully";
|
||||
public static final String EVALUATION_DELETED_SUCCESSFULLY = "evaluation.deleted.successfully";
|
||||
public static final String EVALUATIONS_FETCHED_SUCCESSFULLY = "evaluations.fetched.successfully";
|
||||
public static final String APPLICATION_EVALUATION_NOT_FOUND = "application.evaluation.not.found";
|
||||
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 APPLICATION_ASSIGNED= "application.assigned.success.msg";
|
||||
public static final String APPLICATION_ALREADY_ASSIGNED = "application.already.assigned.msg";
|
||||
@@ -260,5 +269,22 @@ public class GepafinConstant {
|
||||
public static final String S3_PATH_CONFIG_DUPLICATE_TYPE_ALREADY_EXIST ="s3.path.config.already.exist.";
|
||||
public static final String S3_PATH_GENERATION_ERROR_MSG ="s3.path.config.already.exist.";
|
||||
public static final String INVALID_APPLICATION_STATUS = "invalid.application.status";
|
||||
|
||||
public static final String APPLICATION_DATA_FOR_AMENDMENT_SUCCESS_MSG = "application.data.amendment.success";
|
||||
public static final String DELETE_APPLICATION_AMENDMENT_SUCCESS_MSG = "delete.application.amendment.success";
|
||||
public static final String CREATE_APPLICATION_DATA_FOR_AMENDMENT_MSG = "create.application.data.amendment.msg";
|
||||
public static final String APPLICATION_AMENDMENT_NOT_FOUND_MSG = "application.amendment.not.found";
|
||||
public static final String GET_APPLICATION_AMENDMENT_SUCCESS_MSG = "application.amendment.get.success";
|
||||
public static final String APPLICATION_AMENDMENT_UPDATE_SUCCESSFULLY_MSG = "application.amendment.update.successfully";
|
||||
|
||||
public static final String COMMUNICATION_ADDED_TO_AMENDMENT_REQUEST_SUCCESS = "added.comment.to.amendment.request.success";
|
||||
public static final String COMMENT_NOT_FOUND = "comment.not.found";
|
||||
public static final String COMMENT_UPDATED_SUCCESS_MSG = "comment.updated.successfully";
|
||||
public static final String COMMENT_DELETED_SUCCESS_MSG = "comment.deleted.successfully";
|
||||
public static final String COMMENT_NOT_ASSOCIATE_WITH_AMENDMENT_ID_ERROR_MSG = "comment.not.associate.with.amendment";
|
||||
public static final String AMENDMENT_FOUND_SUCCESS = "amendment.found.success";
|
||||
public static final String INVALID_AMENDMENT_FOR_COMMENT = "invalid.amendment.for.comment";
|
||||
public static final String DD_MM_YYYY_HH_MM = "DD_MM_YYYY_HH_MM";
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,425 @@
|
||||
package net.gepafin.tendermanagement.dao;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import jakarta.persistence.criteria.Join;
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.entities.*;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationFormFieldRequestBean;
|
||||
import net.gepafin.tendermanagement.model.response.AmendmentFormFieldResponse;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
||||
import net.gepafin.tendermanagement.repositories.*;
|
||||
import net.gepafin.tendermanagement.service.*;
|
||||
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static net.gepafin.tendermanagement.util.Utils.log;
|
||||
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
||||
|
||||
@Component
|
||||
public class ApplicationAmendmentRequestDao {
|
||||
@Value("${application.amendment.expiration.days}")
|
||||
private long expirationDays;
|
||||
|
||||
@Autowired
|
||||
private ApplicationService applicationService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private DocumentService documentService;
|
||||
|
||||
@Autowired
|
||||
private ApplicationFormRepository applicationFormRepository;
|
||||
|
||||
@Autowired
|
||||
private ApplicationAmendmentRequestRepository applicationAmendmentRequestRepository;
|
||||
|
||||
@Autowired
|
||||
private ApplicationFormFieldRepository applicationFormFieldRepository;
|
||||
|
||||
@Autowired
|
||||
private CommunicationDao communicationDao;
|
||||
|
||||
@Autowired
|
||||
private ApplicationEvaluationService applicationEvaluationService;
|
||||
|
||||
@Autowired
|
||||
private ProtocolDao protocolDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
private AssignedApplicationsService assignedApplicationsService;
|
||||
|
||||
@Autowired
|
||||
private ApplicationEvaluationRepository applicationEvaluationRepository;
|
||||
|
||||
@Autowired
|
||||
private ApplicationRepository applicationRepository;
|
||||
|
||||
@Autowired
|
||||
private AssignedApplicationsRepository assignedApplicationsRepository;
|
||||
|
||||
public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(HttpServletRequest request, Long applicationEvaluationId) {
|
||||
log.info("Fetching the application data for the Amendment process {}", applicationEvaluationId);
|
||||
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(applicationEvaluationId);
|
||||
Long applicationId = applicationEvaluationEntity.getApplicationId();
|
||||
ApplicationEntity application = applicationService.validateApplication(applicationId);
|
||||
|
||||
// Set common application-level details
|
||||
String callName = application.getCall().getName();
|
||||
Long protocolNumber = (application.getProtocol() != null && application.getProtocol().getProtocolNumber() != null)
|
||||
? application.getProtocol().getProtocolNumber()
|
||||
: null;
|
||||
|
||||
UserEntity userEntity = userService.validateUser(application.getUserId());
|
||||
String firstName = userEntity.getBeneficiary() != null ? userEntity.getBeneficiary().getFirstName() : "";
|
||||
String lastName = userEntity.getBeneficiary() != null ? userEntity.getBeneficiary().getLastName() : "";
|
||||
|
||||
String beneficiaryName = (!firstName.isBlank() ? firstName : "") +
|
||||
(!lastName.isBlank() ? " " + lastName : "");
|
||||
beneficiaryName = beneficiaryName.isBlank() ? "" : beneficiaryName;
|
||||
|
||||
ApplicationAmendmentRequestResponse response = new ApplicationAmendmentRequestResponse();
|
||||
response.setId(applicationEvaluationId);
|
||||
response.setProtocolNumber(protocolNumber);
|
||||
response.setCallName(callName);
|
||||
response.setBeneficiaryName(beneficiaryName);
|
||||
response.setApplicationId(applicationId);
|
||||
response.setApplicationEvaluationId(applicationEvaluationId);
|
||||
|
||||
List<ApplicationFormEntity> forms = applicationFormRepository.findByApplicationId(applicationId);
|
||||
List<AmendmentFormFieldResponse> allFormFields = new ArrayList<>();
|
||||
|
||||
for (ApplicationFormEntity form : forms) {
|
||||
String content = form.getForm().getContent();
|
||||
List<Map<String, Object>> result = filterByName(content, "fileupload");
|
||||
allFormFields.addAll(getIdAndLabelFromResult(result));
|
||||
}
|
||||
|
||||
response.setFormFields(allFormFields);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
public List<AmendmentFormFieldResponse> getIdAndLabelFromResult(List<Map<String, Object>> result) {
|
||||
List<AmendmentFormFieldResponse> formFieldResponses = new ArrayList<>();
|
||||
|
||||
for (Map<String, Object> item : result) {
|
||||
AmendmentFormFieldResponse formFieldResponse = new AmendmentFormFieldResponse();
|
||||
formFieldResponse.setFieldId((String) item.get("id"));
|
||||
|
||||
// Extract "label" value from the "settings" array
|
||||
List<Map<String, Object>> settings = (List<Map<String, Object>>) item.get("settings");
|
||||
String label = settings.stream()
|
||||
.filter(setting -> "label".equals(setting.get("name")))
|
||||
.map(setting -> (String) setting.get("value"))
|
||||
.findFirst()
|
||||
.orElse(""); // Default to empty string if not found
|
||||
|
||||
if (label == null || label.trim().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
formFieldResponse.setLabel(label); // Set the label as fieldValue
|
||||
formFieldResponses.add(formFieldResponse);
|
||||
}
|
||||
|
||||
return formFieldResponses;
|
||||
}
|
||||
|
||||
|
||||
public static List<Map<String, Object>> filterByName(String content, String target) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<Map<String, Object>> filteredList = new ArrayList<>();
|
||||
|
||||
try {
|
||||
List<Map<String, Object>> dataList = objectMapper.readValue(
|
||||
content, new TypeReference<List<Map<String, Object>>>() {});
|
||||
|
||||
for (Map<String, Object> data : dataList) {
|
||||
if (target.equals(data.get("name"))) {
|
||||
filteredList.add(data);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return filteredList;
|
||||
}
|
||||
|
||||
public ApplicationAmendmentRequestResponse createApplicationAmendmentRequest(Long applicationEvaluationId, ApplicationAmendmentRequest applicationAmendmentRequest){
|
||||
log.info("Submiting application data for amendment Process with details: {}", applicationEvaluationId);
|
||||
|
||||
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = createApplicationAmendmentRequestEntity(applicationAmendmentRequest, applicationEvaluationId);
|
||||
ApplicationAmendmentRequestResponse applicationAmendmentRequestResponse = convertEntityToResponse(applicationAmendmentRequestEntity);
|
||||
log.info("Application submitted successfully for amendment", applicationAmendmentRequestResponse);
|
||||
if(Boolean.TRUE.equals(applicationAmendmentRequestResponse.isSendEmail())){
|
||||
communicationDao.sendMailToNotifyBeneficiaryRegardingNewAmendment(applicationAmendmentRequestEntity);
|
||||
}
|
||||
return applicationAmendmentRequestResponse;
|
||||
}
|
||||
|
||||
public ApplicationAmendmentRequestEntity createApplicationAmendmentRequestEntity(ApplicationAmendmentRequest applicationAmendmentRequest,Long applicationEvaluationId){
|
||||
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = new ApplicationAmendmentRequestEntity();
|
||||
applicationAmendmentRequestEntity.setNote(applicationAmendmentRequest.getNote());
|
||||
applicationAmendmentRequestEntity.setResponseDays(applicationAmendmentRequest.getResponseDays());
|
||||
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(applicationEvaluationId);
|
||||
|
||||
applicationAmendmentRequestEntity.setApplicationEvaluationEntity(applicationEvaluationEntity);
|
||||
Long applicationId = applicationEvaluationEntity.getApplicationId();
|
||||
Long assignedApplicationId = applicationEvaluationEntity.getAssignedApplicationsEntity().getId();
|
||||
applicationAmendmentRequestEntity.setApplicationId(applicationId);
|
||||
|
||||
if (applicationAmendmentRequest.getFormFields() != null) {
|
||||
String fieldIdsString = applicationAmendmentRequest.getFormFields().stream()
|
||||
.filter(AmendmentFormFieldResponse::isSelected)
|
||||
.map(AmendmentFormFieldResponse::getFieldId)
|
||||
.collect(Collectors.joining(","));
|
||||
applicationAmendmentRequestEntity.setFormFields(fieldIdsString);
|
||||
}
|
||||
UserEntity userEntity = userService.validateUser(applicationEvaluationId);
|
||||
Long protocolNumber = protocolDao.getProtocolNumber(userEntity.getHub());
|
||||
ProtocolEntity protocolEntity = protocolDao.createProtocolEntity(
|
||||
applicationEvaluationEntity.getAssignedApplicationsEntity().getApplication(), protocolNumber,
|
||||
userEntity.getHub().getId());
|
||||
applicationAmendmentRequestEntity.setProtocol(protocolEntity);
|
||||
applicationAmendmentRequestEntity.setIsEmail(false);
|
||||
applicationAmendmentRequestEntity.setIsNotification(false);
|
||||
ApplicationAmendmentRequestEntity applicationAmendment = saveApplicationAmendmentRequestEntity(applicationAmendmentRequestEntity);
|
||||
|
||||
//Set Status
|
||||
applicationEvaluationEntity.setStatus(ApplicationEvaluationStatusTypeEnum.SOCCORSO.getValue());
|
||||
applicationEvaluationRepository.save(applicationEvaluationEntity);
|
||||
|
||||
ApplicationEntity applicationEntity = applicationService.validateApplication(applicationId);
|
||||
applicationEntity.setStatus(ApplicationStatusTypeEnum.SOCCORSO.getValue());
|
||||
applicationRepository.save(applicationEntity);
|
||||
|
||||
AssignedApplicationsEntity assignedApplicationsEntity = assignedApplicationsService.validateAssignedApplication(assignedApplicationId);
|
||||
assignedApplicationsEntity.setStatus(AssignedApplicationEnum.SOCCORSO.getValue());
|
||||
assignedApplicationsRepository.save(assignedApplicationsEntity);
|
||||
|
||||
return applicationAmendment;
|
||||
}
|
||||
|
||||
public ApplicationAmendmentRequestEntity saveApplicationAmendmentRequestEntity(ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity){
|
||||
ApplicationAmendmentRequestEntity applicationAmendmentRequest= applicationAmendmentRequestRepository.save(applicationAmendmentRequestEntity);
|
||||
return applicationAmendmentRequest;
|
||||
}
|
||||
|
||||
public ApplicationAmendmentRequestResponse convertEntityToResponse(ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity){
|
||||
ApplicationAmendmentRequestResponse applicationAmendmentRequestResponse = new ApplicationAmendmentRequestResponse();
|
||||
applicationAmendmentRequestResponse.setId(applicationAmendmentRequestEntity.getId());
|
||||
Long applicationId= applicationAmendmentRequestEntity.getApplicationId();
|
||||
|
||||
ApplicationEntity application = applicationService.validateApplication(applicationId);
|
||||
applicationAmendmentRequestResponse.setApplicationId(applicationId);
|
||||
applicationAmendmentRequestResponse.setApplicationEvaluationId(applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getId());
|
||||
applicationAmendmentRequestResponse.setNote(applicationAmendmentRequestEntity.getNote());
|
||||
applicationAmendmentRequestResponse.setResponseDays(applicationAmendmentRequestEntity.getResponseDays());
|
||||
LocalDateTime startDate = applicationAmendmentRequestEntity.getCreatedDate();
|
||||
applicationAmendmentRequestResponse.setStartDate(startDate);
|
||||
|
||||
LocalDateTime expirationDate = startDate.plus(expirationDays, ChronoUnit.DAYS);
|
||||
applicationAmendmentRequestResponse.setExpirationDate(expirationDate);
|
||||
|
||||
applicationAmendmentRequestResponse.setSendEmail(applicationAmendmentRequestEntity.getIsEmail());
|
||||
applicationAmendmentRequestResponse.setSendNotification(applicationAmendmentRequestEntity.getIsNotification());
|
||||
String callName = application.getCall().getName();
|
||||
Long protocolNumber = (applicationAmendmentRequestEntity.getProtocol() != null && applicationAmendmentRequestEntity.getProtocol().getProtocolNumber() != null)
|
||||
? applicationAmendmentRequestEntity.getProtocol().getProtocolNumber()
|
||||
: null;
|
||||
UserEntity userEntity = userService.validateUser(application.getUserId());
|
||||
String firstName = userEntity.getBeneficiary() != null ? userEntity.getBeneficiary().getFirstName() : "";
|
||||
String lastName = userEntity.getBeneficiary() != null ? userEntity.getBeneficiary().getLastName() : "";
|
||||
|
||||
String beneficiaryName = (!firstName.isBlank() ? firstName : "") +
|
||||
(!lastName.isBlank() ? " " + lastName : "");
|
||||
|
||||
beneficiaryName = beneficiaryName.isBlank() ? "" : beneficiaryName;
|
||||
applicationAmendmentRequestResponse.setCallName(callName);
|
||||
applicationAmendmentRequestResponse.setProtocolNumber(protocolNumber);
|
||||
applicationAmendmentRequestResponse.setBeneficiaryName(beneficiaryName);
|
||||
|
||||
String formFieldsString = applicationAmendmentRequestEntity.getFormFields();
|
||||
List<String> storedFieldIds = (formFieldsString != null) ? Arrays.asList(formFieldsString.split(",")) : Collections.emptyList();
|
||||
List<ApplicationFormEntity> applicationForms = applicationFormRepository.findByApplicationId(application.getId());
|
||||
List<AmendmentFormFieldResponse> formFields = new ArrayList<>();
|
||||
for (ApplicationFormEntity formEntity : applicationForms) {
|
||||
String content = formEntity.getForm().getContent();
|
||||
List<Map<String, Object>> result = filterByName(content, "fileupload");
|
||||
|
||||
List<AmendmentFormFieldResponse> matchingFields = getIdAndLabelFromResult(result).stream()
|
||||
.filter(field -> storedFieldIds.contains(field.getFieldId()))
|
||||
.collect(Collectors.toList());
|
||||
formFields.addAll(matchingFields);
|
||||
}
|
||||
applicationAmendmentRequestResponse.setFormFields(formFields);
|
||||
|
||||
List<AmendmentFormFieldResponse> formField = formFields.stream()
|
||||
.map(field -> {
|
||||
AmendmentFormFieldResponse responseField = new AmendmentFormFieldResponse();
|
||||
responseField.setFieldId(field.getFieldId());
|
||||
responseField.setLabel(field.getLabel());
|
||||
responseField.setSelected(true);
|
||||
return responseField;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
applicationAmendmentRequestResponse.setFormFields(formField);
|
||||
|
||||
return applicationAmendmentRequestResponse;
|
||||
}
|
||||
|
||||
public ApplicationAmendmentRequestEntity validateApplicationAmendmentRequest(Long id) {
|
||||
return applicationAmendmentRequestRepository.findByIdAndIsDeletedFalse(id)
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
|
||||
Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_NOT_FOUND_MSG)));
|
||||
}
|
||||
|
||||
public void deleteById(Long id) {
|
||||
log.info("Deleting assigned application with ID: {}", id);
|
||||
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity= validateApplicationAmendmentRequest(id);
|
||||
applicationAmendmentRequestEntity.setIsDeleted(true);
|
||||
saveApplicationAmendmentRequestEntity(applicationAmendmentRequestEntity);
|
||||
log.info(" Application amendment deleted with ID: {}", id);
|
||||
}
|
||||
|
||||
public ApplicationAmendmentRequestResponse getApplicationAmendmentRequestById(Long id) {
|
||||
log.info("Fetching application amendment with ID: {}", id);
|
||||
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = validateApplicationAmendmentRequest(id);
|
||||
ApplicationAmendmentRequestResponse response = convertEntityToResponse(applicationAmendmentRequestEntity);
|
||||
log.info("Application Amendment fetched successfully by ID: {}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
public List<ApplicationAmendmentRequestResponse> getAllApplicationAmendmentRequest(Long userId) {
|
||||
Specification<ApplicationAmendmentRequestEntity> spec = search(userId);
|
||||
List<ApplicationAmendmentRequestEntity> applicationAmendmentRequestEntities =
|
||||
applicationAmendmentRequestRepository.findAll(spec);
|
||||
|
||||
return applicationAmendmentRequestEntities.stream()
|
||||
.map(this::convertEntityToResponse)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private Specification<ApplicationAmendmentRequestEntity> search(Long userId) {
|
||||
return (root, query, builder) -> {
|
||||
Predicate predicate = builder.isFalse(root.get("isDeleted")); // Only non-deleted records
|
||||
|
||||
if (userId != null) {
|
||||
Join<Object, Object> evaluationJoin = root.join("applicationEvaluationEntity");
|
||||
predicate = builder.and(predicate, builder.equal(evaluationJoin.get("userId"), userId));
|
||||
}
|
||||
|
||||
return predicate; // Return final predicate
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public ApplicationAmendmentRequestResponse updateApplicationAmendment(
|
||||
Long id, ApplicationAmendmentRequestBean updateRequest) {
|
||||
|
||||
log.info("Updating application amendement with ID: {}", id);
|
||||
ApplicationAmendmentRequestEntity existingApplicationAmendment = validateApplicationAmendmentRequest(id);
|
||||
|
||||
setIfUpdated(existingApplicationAmendment::getNote, existingApplicationAmendment::setNote, updateRequest.getNote());
|
||||
if (updateRequest.getUpdatedFormFields() != null) {
|
||||
updateApplicationFormFields(existingApplicationAmendment, updateRequest.getUpdatedFormFields());
|
||||
}
|
||||
existingApplicationAmendment.setUpdatedDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||
|
||||
ApplicationAmendmentRequestEntity updatedApplicationAmendment = saveApplicationAmendmentRequestEntity(existingApplicationAmendment);
|
||||
ApplicationAmendmentRequestResponse response = convertEntityToResponse(updatedApplicationAmendment);
|
||||
log.info("Application Amendment updated successfully: {}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
private void updateApplicationFormFields(ApplicationAmendmentRequestEntity applicationAmendment, ApplicationFormFieldRequestBean updatedFormField) {
|
||||
List<String> documentIds;
|
||||
|
||||
// Check if fieldValue is an array
|
||||
if (updatedFormField.getFieldValue() instanceof List) {
|
||||
documentIds = ((List<?>) updatedFormField.getFieldValue()).stream()
|
||||
.map(Object::toString)
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
log.warn("Expected fieldValue as a list but got: {}", updatedFormField.getFieldValue());
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> validDocumentIds = new ArrayList<>();
|
||||
for (String documentId : documentIds) {
|
||||
DocumentEntity documentEntity = documentService.validateDocument(Long.parseLong(documentId));
|
||||
if (documentEntity != null) {
|
||||
validDocumentIds.add(documentId);
|
||||
} else {
|
||||
log.warn("Document with ID {} does not exist. Skipping this ID.", documentId);
|
||||
}
|
||||
}
|
||||
|
||||
if (!validDocumentIds.isEmpty()) {
|
||||
List<ApplicationFormEntity> applicationForms = applicationFormRepository.findByApplicationId(applicationAmendment.getApplicationId());
|
||||
|
||||
boolean fieldUpdated = false;
|
||||
|
||||
for (ApplicationFormEntity applicationForm : applicationForms) {
|
||||
Optional<ApplicationFormFieldEntity> formFieldEntityOptional = applicationFormFieldRepository
|
||||
.findByApplicationFormIdAndFieldId(applicationForm.getId(), updatedFormField.getFieldId());
|
||||
|
||||
if (formFieldEntityOptional.isPresent()) {
|
||||
ApplicationFormFieldEntity formEntity = formFieldEntityOptional.get();
|
||||
formEntity.setFieldValue(String.join(",", validDocumentIds));
|
||||
applicationFormFieldRepository.save(formEntity);
|
||||
log.info("Updated field value for application ID {} and field ID {} with document IDs {}",
|
||||
applicationAmendment.getApplicationId(), updatedFormField.getFieldId(), String.join(",", validDocumentIds));
|
||||
fieldUpdated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fieldUpdated) {
|
||||
log.warn("No ApplicationFormFieldEntity found for application ID {} and field ID {}. Skipping update.",
|
||||
applicationAmendment.getApplicationId(), updatedFormField.getFieldId());
|
||||
}
|
||||
} else {
|
||||
log.warn("No valid document IDs found for update. Skipping field ID {}", updatedFormField.getFieldId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<ApplicationAmendmentRequestResponse> getAllAmendmentRequestByBeneficiaryId(Long beneficiaryId) {
|
||||
|
||||
List<ApplicationAmendmentRequestEntity> entities =
|
||||
applicationAmendmentRequestRepository.findByUserId(beneficiaryId);
|
||||
|
||||
return entities.stream()
|
||||
.map(this::convertEntityToResponse)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,7 +44,6 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -92,9 +91,6 @@ public class ApplicationDao {
|
||||
@Autowired
|
||||
private CompanyService companyService;
|
||||
|
||||
@Autowired
|
||||
private ProtocolRepository protocolRepository;
|
||||
|
||||
@Autowired
|
||||
private SystemEmailTemplatesService systemEmailTemplatesService;
|
||||
|
||||
@@ -122,14 +118,14 @@ public class ApplicationDao {
|
||||
@Value("${aws.s3.url.folder.signed.document}")
|
||||
private String signedDocumentS3Folder;
|
||||
|
||||
@Value("${default.hub.uuid}")
|
||||
private String defaultHubUuid;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
S3PathConfig s3ConfigBean;
|
||||
private S3PathConfig s3ConfigBean;
|
||||
|
||||
@Autowired
|
||||
private ProtocolDao protocolDao;
|
||||
|
||||
|
||||
public ApplicationResponseBean createApplication(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long formId, Long applicationId) {
|
||||
@@ -606,8 +602,8 @@ public class ApplicationDao {
|
||||
}
|
||||
if (status.equals(ApplicationStatusTypeEnum.SUBMIT) && Boolean.TRUE.equals(applicationEntity.getStatus().equals(ApplicationStatusTypeEnum.READY.getValue()))) {
|
||||
callService.validatePublishedCall(applicationEntity.getCall().getId(), userEntity.getHub().getId());
|
||||
Long protocolNumber = getProtocolNumber(userEntity.getHub());
|
||||
ProtocolEntity protocolEntity = createProtocolEntity(applicationEntity,protocolNumber, userEntity.getHub().getId());
|
||||
Long protocolNumber = protocolDao.getProtocolNumber(userEntity.getHub());
|
||||
ProtocolEntity protocolEntity = protocolDao.createProtocolEntity(applicationEntity,protocolNumber, userEntity.getHub().getId());
|
||||
applicationEntity.setProtocol(protocolEntity);
|
||||
applicationEntity.setStatus(ApplicationStatusTypeEnum.SUBMIT.getValue());
|
||||
applicationEntity.setSubmissionDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||
@@ -622,14 +618,7 @@ public class ApplicationDao {
|
||||
return getApplicationResponse(applicationEntity);
|
||||
}
|
||||
|
||||
private Long getProtocolNumber(HubEntity hubEntity) {
|
||||
Long maxProtocolNumber = protocolRepository.findMaxProtocolNumberAndHubId(hubEntity.getId());
|
||||
Long startNumber = 10000001L;
|
||||
if(Boolean.FALSE.equals(defaultHubUuid.equals(hubEntity.getUniqueUuid()))) {
|
||||
startNumber = 20000001L;
|
||||
}
|
||||
return (maxProtocolNumber != null) ? maxProtocolNumber + 1 : startNumber;
|
||||
}
|
||||
|
||||
public Integer calculateProgress(Long totalSteps, Long completedSteps) {
|
||||
if (FieldValidator.isNullOrZero(totalSteps)) {
|
||||
throw new CustomValidationException(Status.BAD_REQUEST,Translator.toLocale(GepafinConstant.TOTAL_STEPS_NOT_BE_ZERO));
|
||||
@@ -703,18 +692,6 @@ public class ApplicationDao {
|
||||
}
|
||||
}
|
||||
|
||||
public ProtocolEntity createProtocolEntity(ApplicationEntity applicationEntity,Long protocolNumber, Long hubId){
|
||||
ProtocolEntity protocolEntity=new ProtocolEntity();
|
||||
protocolEntity.setCall(applicationEntity.getCall().getId());
|
||||
LocalDateTime utcDateTime = DateTimeUtil.DateServerToUTC(LocalDateTime.now());
|
||||
protocolEntity.setYear(utcDateTime.getYear());
|
||||
protocolEntity.setProtocolNumber(protocolNumber);
|
||||
protocolEntity.setTime(LocalTime.now());
|
||||
protocolEntity.setApplicationId(applicationEntity.getId());
|
||||
protocolEntity.setHubId(hubId);
|
||||
protocolRepository.save(protocolEntity);
|
||||
return protocolEntity;
|
||||
}
|
||||
private void sendMailToUserAndCompany(UserEntity userEntity, ApplicationEntity applicationEntity) {
|
||||
CallEntity call =applicationEntity.getCall();
|
||||
CompanyEntity company = applicationEntity.getCompany();
|
||||
|
||||
@@ -0,0 +1,914 @@
|
||||
package net.gepafin.tendermanagement.dao;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.entities.*;
|
||||
import net.gepafin.tendermanagement.enums.*;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
|
||||
import net.gepafin.tendermanagement.model.request.ChecklistRequest;
|
||||
import net.gepafin.tendermanagement.model.request.CriteriaRequest;
|
||||
import net.gepafin.tendermanagement.model.request.FieldRequest;
|
||||
import net.gepafin.tendermanagement.model.response.*;
|
||||
import net.gepafin.tendermanagement.repositories.*;
|
||||
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||
import net.gepafin.tendermanagement.service.UserService;
|
||||
import net.gepafin.tendermanagement.util.Utils;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
||||
|
||||
@Component
|
||||
public class ApplicationEvaluationDao {
|
||||
|
||||
@Autowired
|
||||
private ApplicationEvaluationRepository applicationEvaluationRepository;
|
||||
@Autowired
|
||||
private ApplicationService applicationService;
|
||||
@Autowired
|
||||
private CallRepository callRepository;
|
||||
@Autowired
|
||||
private ApplicationRepository applicationRepository;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private EvaluationCriteriaRepository evaluationCriteriaRepository;
|
||||
@Autowired
|
||||
private FormRepository formRepository;
|
||||
@Autowired
|
||||
private CallTargetAudienceChecklistRepository callTargetAudienceChecklistRepository;
|
||||
@Autowired
|
||||
private DocumentRepository documentRepository;
|
||||
@Autowired
|
||||
private ApplicationFormRepository applicationFormRepository;
|
||||
@Autowired
|
||||
private ApplicationFormFieldRepository applicationFormFieldRepository;
|
||||
@Autowired
|
||||
private AssignedApplicationsRepository assignedApplicationsRepository;
|
||||
@Autowired
|
||||
private CriteriaFormFieldRepository criteriaFormFieldRepository;
|
||||
|
||||
|
||||
private ApplicationEvaluationEntity convertToEntity(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
|
||||
ApplicationEvaluationEntity entity = new ApplicationEvaluationEntity();
|
||||
|
||||
AssignedApplicationsEntity assignedApplications = assignedApplicationsRepository.findByIdAndIsDeletedFalse(assignedApplciationId).orElse(null);
|
||||
ApplicationEntity application = applicationService.validateApplication(assignedApplications.getApplication().getId());
|
||||
entity.setApplicationId(application.getId());
|
||||
entity.setAssignedApplicationsEntity(assignedApplications);
|
||||
entity.setUserId(user.getId());
|
||||
entity.setCriteria(Utils.convertObjectToJson(req.getCriteria()));
|
||||
entity.setChecklist(Utils.convertObjectToJson(req.getChecklist()));
|
||||
entity.setFile(Utils.convertObjectToJson(req.getFiles()));
|
||||
entity.setNote(req.getNote());
|
||||
entity.setIsDeleted(false);
|
||||
entity.setStatus(ApplicationEvaluationStatusTypeEnum.OPEN.getValue());
|
||||
return entity;
|
||||
}
|
||||
|
||||
private ApplicationEvaluationResponse convertToResponse(ApplicationEvaluationEntity entity) {
|
||||
ApplicationEvaluationResponse response = new ApplicationEvaluationResponse();
|
||||
populateBasicDetails(entity, response);
|
||||
|
||||
CallEntity call = callRepository.findCallEntityByApplicationId(entity.getApplicationId());
|
||||
List<EvaluationCriteriaEntity> evaluationCriterias = evaluationCriteriaRepository.findByCallId(call.getId());
|
||||
List<CallTargetAudienceChecklistEntity> checklistEntities = callTargetAudienceChecklistRepository.findByCallId(call.getId());
|
||||
List<ApplicationFormEntity> applicationFormEntities = applicationFormRepository.findByApplicationId(entity.getApplicationId());
|
||||
|
||||
setCriteriaResponses(entity, response, evaluationCriterias);
|
||||
setChecklistResponses(entity, response, checklistEntities);
|
||||
setFieldResponses(entity, response, applicationFormEntities);
|
||||
|
||||
setApplicationDetails(response, entity);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
private void populateBasicDetails(ApplicationEvaluationEntity entity, ApplicationEvaluationResponse response) {
|
||||
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());
|
||||
}
|
||||
|
||||
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
|
||||
? Utils.convertJsonToList(entity.getCriteria(), new TypeReference<List<CriteriaResponse>>() {
|
||||
})
|
||||
: new ArrayList<>();
|
||||
|
||||
List<CriteriaResponse> criteriaResponsesFromDB = getCriteriaResponse(entity.getApplicationId());
|
||||
addMissingCriteriaResponses(criteriaResponsesFromEntity, criteriaResponsesFromDB, entity.getApplicationId());
|
||||
criteriaResponsesFromEntity.forEach(criteriaResponse -> {
|
||||
EvaluationCriteriaEntity matchingEvaluationCriteria = evaluationCriterias.stream()
|
||||
.filter(evaluationCriteria -> evaluationCriteria.getId().equals(criteriaResponse.getId()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (matchingEvaluationCriteria != null) {
|
||||
criteriaResponse.setLabel(matchingEvaluationCriteria.getLookupData().getValue());
|
||||
criteriaResponse.setMaxScore(matchingEvaluationCriteria.getScore());
|
||||
|
||||
List<CriteriaMappedField> mappedFields = getMappedFieldsForCriteria(matchingEvaluationCriteria.getId(), entity.getApplicationId());
|
||||
criteriaResponse.setCriteriaMappedFields(mappedFields);
|
||||
}
|
||||
});
|
||||
|
||||
response.setCriteria(criteriaResponsesFromEntity);
|
||||
}
|
||||
|
||||
private void addMissingCriteriaResponses(List<CriteriaResponse> criteriaResponsesFromEntity, List<CriteriaResponse> criteriaResponsesFromDB, Long applicationId) {
|
||||
Set<Long> existingCriteriaIds = criteriaResponsesFromEntity.stream()
|
||||
.map(CriteriaResponse::getId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
for (CriteriaResponse dbResponse : criteriaResponsesFromDB) {
|
||||
if (!existingCriteriaIds.contains(dbResponse.getId())) {
|
||||
List<CriteriaMappedField> mappedFields = getMappedFieldsForCriteria(dbResponse.getId(), applicationId);
|
||||
dbResponse.setCriteriaMappedFields(mappedFields);
|
||||
criteriaResponsesFromEntity.add(dbResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<CriteriaMappedField> getMappedFieldsForCriteria(Long evaluationCriteriaId, Long applicationId) {
|
||||
List<CriteriaFormFieldEntity> criteriaFormFields = criteriaFormFieldRepository
|
||||
.findByEvaluationCriteriaIdAndIsDeletedFalse(evaluationCriteriaId);
|
||||
List<CriteriaMappedField> mappedFields = new ArrayList<>();
|
||||
|
||||
Set<String> uniqueFieldIds = new HashSet<>();
|
||||
|
||||
List<ApplicationFormEntity> applicationForms = applicationFormRepository.findByApplicationId(applicationId);
|
||||
for (ApplicationFormEntity applicationForm : applicationForms) {
|
||||
for (CriteriaFormFieldEntity formField : criteriaFormFields) {
|
||||
String formFieldId = formField.getFormFieldId();
|
||||
|
||||
if (!uniqueFieldIds.contains(formFieldId)) {
|
||||
CriteriaMappedField mappedField = new CriteriaMappedField();
|
||||
mappedField.setId(formFieldId);
|
||||
|
||||
FormEntity formEntity = formRepository.findById(formField.getFormId()).orElse(null);
|
||||
if (formEntity != null) {
|
||||
List<ContentResponseBean> contentBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
contentBeans.stream()
|
||||
.filter(contentBean -> contentBean.getId().equals(formFieldId))
|
||||
.findFirst()
|
||||
.ifPresent(contentBean -> {
|
||||
String label = contentBean.getLabel();
|
||||
if (contentBean.getSettings() != null) {
|
||||
for (SettingResponseBean setting : contentBean.getSettings()) {
|
||||
if ("label".equals(setting.getName())) {
|
||||
label = setting.getValue() != null ? setting.getValue().toString() : label;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
mappedField.setFieldLabel(label);
|
||||
});
|
||||
}
|
||||
|
||||
Optional<ApplicationFormFieldEntity> formFieldEntityOptional = applicationFormFieldRepository
|
||||
.findByFieldIdAndApplicationFormIdAndApplicationFormApplicationId(formFieldId, applicationForm.getId(), applicationId);
|
||||
|
||||
formFieldEntityOptional.ifPresent(field -> mappedField.setFieldValue(field.getFieldValue()));
|
||||
|
||||
mappedFields.add(mappedField);
|
||||
uniqueFieldIds.add(formFieldId);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mappedFields;
|
||||
}
|
||||
|
||||
private void setChecklistResponses(ApplicationEvaluationEntity entity, ApplicationEvaluationResponse response, List<CallTargetAudienceChecklistEntity> checklistEntities) {
|
||||
List<ChecklistResponse> checklistResponsesFromEntity = entity.getChecklist() != null
|
||||
? Utils.convertJsonToList(entity.getChecklist(), new TypeReference<List<ChecklistResponse>>() {
|
||||
})
|
||||
: new ArrayList<>();
|
||||
|
||||
List<ChecklistResponse> checklistResponsesFromDB = getChecklistResponse(entity.getApplicationId());
|
||||
addMissingChecklistResponses(checklistResponsesFromEntity, checklistResponsesFromDB);
|
||||
|
||||
checklistResponsesFromEntity.forEach(checklistResponse -> {
|
||||
CallTargetAudienceChecklistEntity matchingChecklist = checklistEntities.stream()
|
||||
.filter(checklistEntity -> checklistEntity.getId().equals(checklistResponse.getId()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (matchingChecklist != null) {
|
||||
checklistResponse.setLabel(matchingChecklist.getLookupData().getValue());
|
||||
}
|
||||
});
|
||||
|
||||
response.setChecklist(checklistResponsesFromEntity);
|
||||
}
|
||||
|
||||
private void addMissingChecklistResponses(List<ChecklistResponse> checklistResponsesFromEntity, List<ChecklistResponse> checklistResponsesFromDB) {
|
||||
Set<Long> existingChecklistIds = checklistResponsesFromEntity.stream()
|
||||
.map(ChecklistResponse::getId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
for (ChecklistResponse dbResponse : checklistResponsesFromDB) {
|
||||
if (!existingChecklistIds.contains(dbResponse.getId())) {
|
||||
checklistResponsesFromEntity.add(dbResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setFieldResponses(ApplicationEvaluationEntity entity, ApplicationEvaluationResponse response, List<ApplicationFormEntity> applicationFormEntities) {
|
||||
List<FieldResponse> fieldResponsesFromEntity = entity.getFile() != null
|
||||
? Utils.convertJsonToList(entity.getFile(), new TypeReference<List<FieldResponse>>() {
|
||||
})
|
||||
: new ArrayList<>();
|
||||
List<FieldResponse> fieldResponsesFromDB = getFieldResponses(entity.getApplicationId());
|
||||
addMissingFieldResponses(fieldResponsesFromEntity, fieldResponsesFromDB);
|
||||
|
||||
Set<String> processedFieldIds = new HashSet<>();
|
||||
|
||||
fieldResponsesFromEntity.forEach(fieldResponse -> {
|
||||
if (processedFieldIds.contains(fieldResponse.getId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
applicationFormEntities.forEach(applicationForm -> {
|
||||
FormEntity formEntity = applicationForm.getForm();
|
||||
if (formEntity != null) {
|
||||
List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
contentResponseBeans.forEach(contentResponseBean -> {
|
||||
if ("fileupload".equals(contentResponseBean.getName()) && contentResponseBean.getId().equals(fieldResponse.getId())) {
|
||||
String label = null;
|
||||
if (contentResponseBean.getSettings() != null) {
|
||||
for (SettingResponseBean setting : contentResponseBean.getSettings()) {
|
||||
if ("label".equals(setting.getName())) {
|
||||
label = setting.getValue() != null ? setting.getValue().toString() : label;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
fieldResponse.setLabel(label);
|
||||
|
||||
Optional<ApplicationFormFieldEntity> optionalFormField = applicationFormFieldRepository
|
||||
.findByFieldIdAndApplicationFormIdAndApplicationFormApplicationId(
|
||||
fieldResponse.getId(), applicationForm.getId(), entity.getApplicationId()
|
||||
);
|
||||
|
||||
if (optionalFormField.isPresent()) {
|
||||
ApplicationFormFieldEntity formField = optionalFormField.get();
|
||||
if (formField.getFieldValue() != null) {
|
||||
String[] documentIds = formField.getFieldValue().split(",");
|
||||
List<DocumentResponseBean> documentResponseBeans = new ArrayList<>();
|
||||
|
||||
for (String docId : documentIds) {
|
||||
Long documentId = Long.valueOf(docId.trim());
|
||||
documentRepository.findByIdAndNotDeleted(documentId).ifPresent(documentEntity -> {
|
||||
DocumentResponseBean responseBean = new DocumentResponseBean();
|
||||
responseBean.setId(documentEntity.getId());
|
||||
responseBean.setName(documentEntity.getFileName());
|
||||
responseBean.setType(DocumentTypeEnum.valueOf(documentEntity.getType()));
|
||||
responseBean.setSource(DocumentSourceTypeEnum.valueOf(documentEntity.getSource()));
|
||||
responseBean.setSourceId(documentEntity.getSourceId());
|
||||
responseBean.setFilePath(documentEntity.getFilePath());
|
||||
responseBean.setCreatedDate(documentEntity.getCreatedDate());
|
||||
responseBean.setUpdatedDate(documentEntity.getUpdatedDate());
|
||||
documentResponseBeans.add(responseBean);
|
||||
});
|
||||
}
|
||||
|
||||
fieldResponse.setFileDetail(documentResponseBeans);
|
||||
}
|
||||
}
|
||||
processedFieldIds.add(fieldResponse.getId());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
response.setFiles(fieldResponsesFromEntity);
|
||||
}
|
||||
|
||||
private void addMissingFieldResponses(List<FieldResponse> fieldResponsesFromEntity, List<FieldResponse> fieldResponsesFromDB) {
|
||||
Set<String> existingFieldIds = fieldResponsesFromEntity.stream()
|
||||
.map(FieldResponse::getId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
for (FieldResponse dbResponse : fieldResponsesFromDB) {
|
||||
if (!existingFieldIds.contains(dbResponse.getId())) {
|
||||
fieldResponsesFromEntity.add(dbResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setApplicationDetails(ApplicationEvaluationResponse response, ApplicationEvaluationEntity entity) {
|
||||
ApplicationEntity application = applicationService.validateApplication(entity.getApplicationId() != null ? entity.getApplicationId() : null);
|
||||
UserEntity user = userService.validateUser(application.getUserId());
|
||||
|
||||
CallEntity call = callRepository.findCallEntityByApplicationId(entity.getApplicationId());
|
||||
|
||||
String firstName = user.getFirstName() != null ? user.getFirstName() : "";
|
||||
String lastName = user.getLastName() != null ? user.getLastName() : "";
|
||||
String beneficiary = String.join(" ", firstName, lastName).trim();
|
||||
response.setApplicationStatus(ApplicationStatusTypeEnum.valueOf(application.getStatus()));
|
||||
response.setBeneficiary(beneficiary);
|
||||
response.setMinScore(call.getThreshold()!=null?call.getThreshold():null);
|
||||
response.setCallName(application.getCall().getName()!=null?application.getCall().getName():null);
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public ApplicationEvaluationResponse createOrUpdateApplicationEvaluation(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
|
||||
Optional<ApplicationEvaluationEntity> existingEntityOptional = applicationEvaluationRepository.findByAssignedApplicationsEntity_IdAndIsDeletedFalse(assignedApplciationId);
|
||||
ApplicationEvaluationEntity entity;
|
||||
|
||||
if (existingEntityOptional.isPresent()) {
|
||||
entity = existingEntityOptional.get();
|
||||
entity.setCriteria(Utils.convertObjectToJson(filterNonNullCriteria(processCriteria(entity, req))));
|
||||
entity.setChecklist(Utils.convertObjectToJson(filterNonNullChecklist(processChecklist(entity, req))));
|
||||
entity.setFile(Utils.convertObjectToJson(filterNonNullFields(processField(entity, req))));
|
||||
entity.setIsDeleted(false);
|
||||
setIfUpdated(entity::getNote, entity::setNote, req.getNote());
|
||||
} else {
|
||||
entity = convertToEntity(user, req, assignedApplciationId);
|
||||
}
|
||||
|
||||
ApplicationEvaluationEntity savedEntity = applicationEvaluationRepository.save(entity);
|
||||
return convertToResponse(savedEntity);
|
||||
}
|
||||
|
||||
private List<ChecklistRequest> filterNonNullChecklist(List<ChecklistRequest> checklistRequests) {
|
||||
return checklistRequests.stream()
|
||||
.filter(request -> request.getValid() != null)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<CriteriaRequest> filterNonNullCriteria(List<CriteriaRequest> criteriaRequests) {
|
||||
return criteriaRequests.stream()
|
||||
.filter(request -> request.getScore() != null && request.getValid() != null)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<FieldRequest> filterNonNullFields(List<FieldRequest> fieldRequests) {
|
||||
return fieldRequests.stream()
|
||||
.filter(request -> request.getValid() != null)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<CriteriaRequest> processCriteria(ApplicationEvaluationEntity entity, ApplicationEvaluationRequest req) {
|
||||
List<CriteriaResponse> existingCriteriaList = entity.getCriteria() != null
|
||||
? Utils.convertJsonToList(entity.getCriteria(), new TypeReference<List<CriteriaResponse>>() {
|
||||
})
|
||||
: new ArrayList<>();
|
||||
|
||||
Map<Long, CriteriaResponse> existingCriteriaMap = existingCriteriaList.stream()
|
||||
.collect(Collectors.toMap(CriteriaResponse::getId, criteria -> criteria));
|
||||
|
||||
List<CriteriaRequest> updatedCriteriaList = req.getCriteria().stream()
|
||||
.map(incoming -> {
|
||||
CriteriaRequest request = new CriteriaRequest();
|
||||
request.setId(incoming.getId());
|
||||
request.setScore(incoming.getScore());
|
||||
request.setValid(incoming.getValid());
|
||||
|
||||
CriteriaResponse existingCriteria = existingCriteriaMap.get(incoming.getId());
|
||||
if (existingCriteria != null) {
|
||||
request.setScore(incoming.getScore() != null ? incoming.getScore() : null);
|
||||
request.setValid(incoming.getValid() != null ? incoming.getValid() : null);
|
||||
}
|
||||
return request;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<CriteriaRequest> missingCriteriaRequests = existingCriteriaList.stream()
|
||||
.filter(existing -> !updatedCriteriaList.stream()
|
||||
.map(CriteriaRequest::getId)
|
||||
.toList()
|
||||
.contains(existing.getId()))
|
||||
.map(existing -> {
|
||||
CriteriaRequest request = new CriteriaRequest();
|
||||
request.setId(existing.getId());
|
||||
request.setScore(existing.getScore());
|
||||
request.setValid(existing.getValid());
|
||||
return request;
|
||||
})
|
||||
.toList();
|
||||
|
||||
updatedCriteriaList.addAll(missingCriteriaRequests);
|
||||
return updatedCriteriaList;
|
||||
}
|
||||
|
||||
private List<ChecklistRequest> processChecklist(ApplicationEvaluationEntity entity, ApplicationEvaluationRequest req) {
|
||||
List<ChecklistResponse> existingChecklistList = entity.getChecklist() != null
|
||||
? Utils.convertJsonToList(entity.getChecklist(), new TypeReference<List<ChecklistResponse>>() {
|
||||
})
|
||||
: new ArrayList<>();
|
||||
|
||||
Map<Long, ChecklistResponse> existingChecklistMap = existingChecklistList.stream()
|
||||
.collect(Collectors.toMap(ChecklistResponse::getId, checklist -> checklist));
|
||||
|
||||
List<ChecklistRequest> updatedChecklistList = req.getChecklist().stream()
|
||||
.map(incoming -> {
|
||||
ChecklistRequest request = new ChecklistRequest();
|
||||
request.setId(incoming.getId());
|
||||
request.setValid(incoming.getValid());
|
||||
|
||||
ChecklistResponse existingChecklist = existingChecklistMap.get(incoming.getId());
|
||||
if (existingChecklist != null && incoming.getValid() == null) {
|
||||
request.setValid(null);
|
||||
}
|
||||
return request;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<ChecklistRequest> missingChecklistRequests = existingChecklistList.stream()
|
||||
.filter(existing -> !updatedChecklistList.stream()
|
||||
.map(ChecklistRequest::getId)
|
||||
.toList()
|
||||
.contains(existing.getId()))
|
||||
.map(existing -> {
|
||||
ChecklistRequest request = new ChecklistRequest();
|
||||
request.setId(existing.getId());
|
||||
request.setValid(existing.getValid() != null ? existing.getValid() : null);
|
||||
return request;
|
||||
})
|
||||
.toList();
|
||||
|
||||
updatedChecklistList.addAll(missingChecklistRequests);
|
||||
return updatedChecklistList;
|
||||
}
|
||||
|
||||
private List<FieldRequest> processField(ApplicationEvaluationEntity entity, ApplicationEvaluationRequest req) {
|
||||
List<FieldResponse> existingFieldList = entity.getFile() != null
|
||||
? Utils.convertJsonToList(entity.getFile(), new TypeReference<List<FieldResponse>>() {
|
||||
})
|
||||
: new ArrayList<>();
|
||||
|
||||
Map<String, FieldResponse> existingFieldMap = existingFieldList.stream()
|
||||
.collect(Collectors.toMap(FieldResponse::getId, field -> field));
|
||||
|
||||
List<FieldRequest> updatedFieldList = req.getFiles().stream()
|
||||
.map(incoming -> {
|
||||
FieldRequest request = new FieldRequest();
|
||||
request.setId(incoming.getId());
|
||||
request.setValid(incoming.getValid());
|
||||
|
||||
FieldResponse existingField = existingFieldMap.get(incoming.getId());
|
||||
if (existingField != null) {
|
||||
request.setValid(incoming.getValid() != null ? incoming.getValid() : null);
|
||||
}
|
||||
return request;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<FieldRequest> missingFieldRequests = existingFieldList.stream()
|
||||
.filter(existing -> !updatedFieldList.stream()
|
||||
.map(FieldRequest::getId)
|
||||
.toList()
|
||||
.contains(existing.getId()))
|
||||
.map(existing -> {
|
||||
FieldRequest request = new FieldRequest();
|
||||
request.setId(existing.getId());
|
||||
request.setValid(existing.getValid());
|
||||
return request;
|
||||
})
|
||||
.toList();
|
||||
|
||||
updatedFieldList.addAll(missingFieldRequests);
|
||||
return updatedFieldList;
|
||||
}
|
||||
|
||||
public ApplicationEvaluationEntity validateApplicationEvaluation(Long id) {
|
||||
Optional<ApplicationEvaluationEntity> entityOptional = applicationEvaluationRepository.findByIdAndIsDeletedFalse(id);
|
||||
if (entityOptional.isEmpty()) {
|
||||
throw new ResourceNotFoundException(Status.NOT_FOUND,
|
||||
Translator.toLocale(GepafinConstant.APPLICATION_EVALUATION_NOT_FOUND, id));
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
||||
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)));
|
||||
}
|
||||
|
||||
|
||||
public ApplicationEvaluationResponse getEvaluationResponseByApplicationid(UserEntity user, Long applicationId, Long assignedApplicationId) {
|
||||
ApplicationEvaluationEntity entity = new ApplicationEvaluationEntity();
|
||||
ApplicationEvaluationResponse response = new ApplicationEvaluationResponse();
|
||||
CallEntity call = null;
|
||||
ApplicationEntity application=null;
|
||||
AssignedApplicationsEntity assignedApplications = null;
|
||||
if (applicationId != null && assignedApplicationId==null) {
|
||||
application = applicationService.validateApplication(applicationId);
|
||||
call = callRepository.findCallEntityByApplicationId(applicationId);
|
||||
assignedApplications = assignedApplicationsRepository.findByApplicationIdAndIsDeletedFalse(applicationId).orElse(null);
|
||||
} else if (assignedApplicationId != null) {
|
||||
assignedApplications = assignedApplicationsRepository.findByIdAndIsDeletedFalse(assignedApplicationId).orElseThrow(() ->
|
||||
new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.ASSIGNED_APPLICATION_NOT_FOUND_MSG)));
|
||||
application = applicationService.validateApplication(assignedApplications.getApplication().getId());
|
||||
call = callRepository.findCallEntityByApplicationId(application.getId());
|
||||
|
||||
} else {
|
||||
call = callRepository.findCallEntityByApplicationId(applicationId);
|
||||
assignedApplications = assignedApplicationsRepository.findByApplicationIdAndIsDeletedFalse(applicationId).orElse(null);
|
||||
}
|
||||
List<EvaluationCriteriaEntity> evaluationCriterias = evaluationCriteriaRepository.findByCallId(call.getId());
|
||||
List<CallTargetAudienceChecklistEntity> checklistEntities = callTargetAudienceChecklistRepository.findByCallId(call.getId());
|
||||
List<ApplicationFormEntity> applicationFormEntities = applicationFormRepository.findByApplicationId(applicationId);
|
||||
response.setApplicationId(application.getId());
|
||||
response.setAssignedApplicationId(assignedApplications.getId());
|
||||
response.setNote(null);
|
||||
response.setApplicationStatus(ApplicationStatusTypeEnum.valueOf(application.getStatus()));
|
||||
response.setStatus(ApplicationEvaluationStatusTypeEnum.valueOf(ApplicationEvaluationStatusTypeEnum.OPEN.getValue()));
|
||||
response.setMinScore(call.getThreshold()!=null?call.getThreshold():null);
|
||||
setCriteriaResponses(entity, application.getId(), response, evaluationCriterias);
|
||||
setChecklistResponses(entity, application.getId(), response, checklistEntities);
|
||||
setFileResponses(entity, application.getId(), response, applicationFormEntities);
|
||||
|
||||
setApplicationDetails(response, application.getId(), user);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
private void setCriteriaResponses(ApplicationEvaluationEntity entity, Long applicationId, ApplicationEvaluationResponse response, List<EvaluationCriteriaEntity> evaluationCriterias) {
|
||||
List<CriteriaResponse> criteriaResponses = entity.getCriteria() != null
|
||||
? Utils.convertJsonToList(entity.getCriteria(), new TypeReference<List<CriteriaResponse>>() {
|
||||
})
|
||||
: getCriteriaResponse(applicationId);
|
||||
|
||||
criteriaResponses.forEach(criteriaResponse -> {
|
||||
EvaluationCriteriaEntity matchingEvaluationCriteria = evaluationCriterias.stream()
|
||||
.filter(evaluationCriteria -> evaluationCriteria.getId().equals(criteriaResponse.getId()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
List<ApplicationFormEntity> applicationForms = applicationFormRepository.findByApplicationId(applicationId);
|
||||
Map<String, CriteriaMappedField> mappedFieldMap = new HashMap<>();
|
||||
|
||||
if (matchingEvaluationCriteria != null) {
|
||||
criteriaResponse.setLabel(matchingEvaluationCriteria.getLookupData().getValue());
|
||||
criteriaResponse.setMaxScore(matchingEvaluationCriteria.getScore());
|
||||
|
||||
List<CriteriaFormFieldEntity> criteriaFormFields = criteriaFormFieldRepository
|
||||
.findByEvaluationCriteriaIdAndIsDeletedFalse(matchingEvaluationCriteria.getId());
|
||||
|
||||
for (ApplicationFormEntity applicationForm : applicationForms) {
|
||||
for (CriteriaFormFieldEntity criteriaFormField : criteriaFormFields) {
|
||||
String formFieldId = criteriaFormField.getFormFieldId();
|
||||
if (!mappedFieldMap.containsKey(formFieldId)) {
|
||||
CriteriaMappedField mappedField = new CriteriaMappedField();
|
||||
mappedField.setId(formFieldId);
|
||||
FormEntity formEntity = formRepository.findById(criteriaFormField.getFormId()).orElse(null);
|
||||
|
||||
if (formEntity != null) {
|
||||
List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
contentResponseBeans.stream()
|
||||
.filter(bean -> bean.getId().equals(formFieldId))
|
||||
.findFirst()
|
||||
.ifPresent(contentResponseBean -> {
|
||||
String label = contentResponseBean.getLabel();
|
||||
if (contentResponseBean.getSettings() != null) {
|
||||
for (SettingResponseBean setting : contentResponseBean.getSettings()) {
|
||||
if ("label".equals(setting.getName())) {
|
||||
label = setting.getValue() != null ? setting.getValue().toString() : label;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
mappedField.setFieldLabel(label);
|
||||
});
|
||||
}
|
||||
Optional<ApplicationFormFieldEntity> formFieldEntityOptional = applicationFormFieldRepository
|
||||
.findByFieldIdAndApplicationFormIdAndApplicationFormApplicationId(formFieldId, applicationForm.getId(), applicationId);
|
||||
|
||||
formFieldEntityOptional.ifPresent(formField -> mappedField.setFieldValue(formField.getFieldValue()));
|
||||
mappedFieldMap.put(formFieldId, mappedField);
|
||||
}
|
||||
}
|
||||
}
|
||||
criteriaResponse.setCriteriaMappedFields(new ArrayList<>(mappedFieldMap.values()));
|
||||
}
|
||||
});
|
||||
|
||||
response.setCriteria(criteriaResponses);
|
||||
}
|
||||
|
||||
private void setChecklistResponses(ApplicationEvaluationEntity entity, Long applicationId, ApplicationEvaluationResponse response, List<CallTargetAudienceChecklistEntity> checklistEntities) {
|
||||
List<ChecklistResponse> checklistResponses = entity.getChecklist() != null
|
||||
? Utils.convertJsonToList(entity.getChecklist(), new TypeReference<List<ChecklistResponse>>() {
|
||||
})
|
||||
: getChecklistResponse(applicationId);
|
||||
|
||||
checklistResponses.forEach(checklistResponse -> {
|
||||
CallTargetAudienceChecklistEntity matchingChecklist = checklistEntities.stream()
|
||||
.filter(checklistEntity -> checklistEntity.getId().equals(checklistResponse.getId()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (matchingChecklist != null) {
|
||||
checklistResponse.setLabel(matchingChecklist.getLookupData().getValue());
|
||||
}
|
||||
});
|
||||
|
||||
response.setChecklist(checklistResponses);
|
||||
}
|
||||
|
||||
private void setFileResponses(ApplicationEvaluationEntity entity, Long applicationId, ApplicationEvaluationResponse response, List<ApplicationFormEntity> applicationFormEntities) {
|
||||
List<FieldResponse> fieldResponses = entity.getFile() != null
|
||||
? Utils.convertJsonToList(entity.getFile(), new TypeReference<List<FieldResponse>>() {
|
||||
})
|
||||
: getFieldResponses(applicationId);
|
||||
Set<String> processedFieldIds = new HashSet<>();
|
||||
|
||||
fieldResponses.forEach(fieldResponse -> {
|
||||
if (processedFieldIds.contains(fieldResponse.getId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
applicationFormEntities.forEach(applicationForm -> {
|
||||
FormEntity formEntity = applicationForm.getForm();
|
||||
if (formEntity != null) {
|
||||
List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
contentResponseBeans.forEach(contentResponseBean -> {
|
||||
if ("fileupload".equals(contentResponseBean.getName()) && contentResponseBean.getId().equals(fieldResponse.getId())) {
|
||||
String label = null;
|
||||
if (contentResponseBean.getSettings() != null) {
|
||||
for (SettingResponseBean setting : contentResponseBean.getSettings()) {
|
||||
if ("label".equals(setting.getName())) {
|
||||
label = setting.getValue() != null ? setting.getValue().toString() : label;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
fieldResponse.setLabel(label);
|
||||
|
||||
Optional<ApplicationFormFieldEntity> optionalFormField = applicationFormFieldRepository
|
||||
.findByFieldIdAndApplicationFormIdAndApplicationFormApplicationId(fieldResponse.getId(), applicationForm.getId(), applicationId);
|
||||
|
||||
if (optionalFormField.isPresent() && optionalFormField.get().getFieldValue() != null) {
|
||||
String[] documentIds = optionalFormField.get().getFieldValue().split(",");
|
||||
List<DocumentResponseBean> documentResponseBeans = new ArrayList<>();
|
||||
|
||||
for (String docId : documentIds) {
|
||||
Long documentId = Long.valueOf(docId.trim());
|
||||
documentRepository.findByIdAndNotDeleted(documentId).ifPresent(documentEntity -> {
|
||||
DocumentResponseBean responseBean = new DocumentResponseBean();
|
||||
responseBean.setId(documentEntity.getId());
|
||||
responseBean.setName(documentEntity.getFileName());
|
||||
responseBean.setType(DocumentTypeEnum.valueOf(documentEntity.getType()));
|
||||
responseBean.setSource(DocumentSourceTypeEnum.valueOf(documentEntity.getSource()));
|
||||
responseBean.setSourceId(documentEntity.getSourceId());
|
||||
responseBean.setFilePath(documentEntity.getFilePath());
|
||||
responseBean.setCreatedDate(documentEntity.getCreatedDate());
|
||||
responseBean.setUpdatedDate(documentEntity.getUpdatedDate());
|
||||
documentResponseBeans.add(responseBean);
|
||||
});
|
||||
}
|
||||
|
||||
fieldResponse.setFileDetail(documentResponseBeans);
|
||||
}
|
||||
|
||||
// Mark this field ID as processed to prevent duplicates
|
||||
processedFieldIds.add(fieldResponse.getId());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
response.setFiles(fieldResponses);
|
||||
}
|
||||
|
||||
|
||||
private void setApplicationDetails(ApplicationEvaluationResponse response, Long applicationId, UserEntity user) {
|
||||
ApplicationEntity application = applicationService.validateApplication(applicationId);
|
||||
userService.validateUser(application.getUserId());
|
||||
String firstName = user.getFirstName() != null ? user.getFirstName() : "";
|
||||
String lastName = user.getLastName() != null ? user.getLastName() : "";
|
||||
|
||||
String beneficiary = String.join(" ", firstName, lastName).trim();
|
||||
response.setBeneficiary(beneficiary);
|
||||
|
||||
response.setCallName(application.getCall().getName()!=null?application.getCall().getName():null);
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
List<CriteriaResponse> getCriteriaResponse(Long applicationId) {
|
||||
CallEntity call = callRepository.findCallEntityByApplicationId(applicationId);
|
||||
List<EvaluationCriteriaEntity> evaluationCriterias = evaluationCriteriaRepository.findByCallId(call.getId());
|
||||
|
||||
List<CriteriaResponse> criteriaResponses = evaluationCriterias.stream().map(criteria -> {
|
||||
CriteriaResponse response = new CriteriaResponse();
|
||||
response.setId(criteria.getId());
|
||||
response.setLabel(criteria.getLookupData().getValue());
|
||||
response.setScore(null);
|
||||
response.setMaxScore(criteria.getScore());
|
||||
response.setValid(null);
|
||||
|
||||
List<CriteriaFormFieldEntity> criteriaFormFields = criteriaFormFieldRepository
|
||||
.findByEvaluationCriteriaIdAndIsDeletedFalse(criteria.getId());
|
||||
|
||||
List<CriteriaMappedField> mappedFields = new ArrayList<>();
|
||||
Set<String> processedFormFieldIds = new HashSet<>();
|
||||
|
||||
for (CriteriaFormFieldEntity criteriaFormField : criteriaFormFields) {
|
||||
if (processedFormFieldIds.contains(criteriaFormField.getFormFieldId())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CriteriaMappedField mappedField = new CriteriaMappedField();
|
||||
mappedField.setId(criteriaFormField.getFormFieldId());
|
||||
|
||||
FormEntity formEntity = formRepository.findById(criteriaFormField.getFormId()).orElse(null);
|
||||
if (formEntity != null) {
|
||||
List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(
|
||||
formEntity.getContent(), ContentResponseBean.class);
|
||||
contentResponseBeans.stream()
|
||||
.filter(bean -> bean.getId().equals(criteriaFormField.getFormFieldId()))
|
||||
.findFirst()
|
||||
.ifPresent(contentResponseBean -> {
|
||||
String label = contentResponseBean.getLabel();
|
||||
if (contentResponseBean.getSettings() != null) {
|
||||
for (SettingResponseBean setting : contentResponseBean.getSettings()) {
|
||||
if ("label".equals(setting.getName())) {
|
||||
label = setting.getValue() != null ? setting.getValue().toString() : label;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
mappedField.setFieldLabel(label);
|
||||
});
|
||||
}
|
||||
|
||||
applicationFormRepository.findByApplicationId(applicationId).stream()
|
||||
.flatMap(applicationForm -> applicationFormFieldRepository
|
||||
.findByFieldIdAndApplicationFormIdAndApplicationFormApplicationId(
|
||||
criteriaFormField.getFormFieldId(), applicationForm.getId(), applicationId)
|
||||
.stream())
|
||||
.findFirst()
|
||||
.ifPresent(formField -> mappedField.setFieldValue(formField.getFieldValue()));
|
||||
|
||||
mappedFields.add(mappedField);
|
||||
processedFormFieldIds.add(criteriaFormField.getFormFieldId());
|
||||
}
|
||||
|
||||
response.setCriteriaMappedFields(mappedFields);
|
||||
return response;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return criteriaResponses;
|
||||
}
|
||||
|
||||
List<ChecklistResponse> getChecklistResponse(Long applicationId) {
|
||||
CallEntity call = callRepository.findCallEntityByApplicationId(applicationId);
|
||||
List<CallTargetAudienceChecklistEntity> checklistEntities = callTargetAudienceChecklistRepository.findByCallId(call.getId());
|
||||
List<ChecklistResponse> checklistResponses = checklistEntities.stream().map(checklist -> {
|
||||
ChecklistResponse response = new ChecklistResponse();
|
||||
response.setId(checklist.getId());
|
||||
response.setLabel(checklist.getLookupData().getValue());
|
||||
response.setValid(null);
|
||||
|
||||
return response;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return checklistResponses;
|
||||
}
|
||||
|
||||
public List<FieldResponse> getFieldResponses(Long applicationId) {
|
||||
List<ApplicationFormEntity> applicationFormEntities = applicationFormRepository.findByApplicationId(applicationId);
|
||||
List<FieldResponse> fieldResponses = new ArrayList<>();
|
||||
|
||||
for (ApplicationFormEntity applicationForm : applicationFormEntities) {
|
||||
FormEntity formEntity = applicationForm.getForm();
|
||||
|
||||
if (formEntity != null) {
|
||||
List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
|
||||
for (ContentResponseBean contentResponseBean : contentResponseBeans) {
|
||||
if ("fileupload".equals(contentResponseBean.getName())) {
|
||||
String fieldId = contentResponseBean.getId();
|
||||
Long applicationFormId = applicationForm.getId();
|
||||
|
||||
Optional<ApplicationFormFieldEntity> optionalFormField = applicationFormFieldRepository
|
||||
.findByFieldIdAndApplicationFormIdAndApplicationFormApplicationId(fieldId, applicationFormId, applicationId);
|
||||
|
||||
if (optionalFormField.isPresent()) {
|
||||
ApplicationFormFieldEntity formField = optionalFormField.get();
|
||||
|
||||
if (formField.getFieldValue() != null) {
|
||||
FieldResponse fieldResponse = new FieldResponse();
|
||||
fieldResponse.setId(fieldId);
|
||||
String label = null;
|
||||
if (contentResponseBean.getSettings() != null) {
|
||||
for (SettingResponseBean setting : contentResponseBean.getSettings()) {
|
||||
if ("label".equals(setting.getName())) {
|
||||
label = setting.getValue() != null ? setting.getValue().toString() : label;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
fieldResponse.setLabel(label);
|
||||
fieldResponse.setValid(null);
|
||||
String[] documentIds = formField.getFieldValue().split(",");
|
||||
List<DocumentResponseBean> documentResponseBeans = new ArrayList<>();
|
||||
|
||||
for (String docId : documentIds) {
|
||||
Long documentId = Long.valueOf(docId.trim());
|
||||
documentRepository.findByIdAndNotDeleted(documentId).ifPresent(documentEntity -> {
|
||||
DocumentResponseBean responseBean = new DocumentResponseBean();
|
||||
responseBean.setId(documentEntity.getId());
|
||||
responseBean.setName(documentEntity.getFileName());
|
||||
responseBean.setType(DocumentTypeEnum.valueOf(documentEntity.getType()));
|
||||
responseBean.setSource(DocumentSourceTypeEnum.valueOf(documentEntity.getSource()));
|
||||
responseBean.setSourceId(documentEntity.getSourceId());
|
||||
responseBean.setFilePath(documentEntity.getFilePath());
|
||||
responseBean.setCreatedDate(documentEntity.getCreatedDate());
|
||||
responseBean.setUpdatedDate(documentEntity.getUpdatedDate());
|
||||
documentResponseBeans.add(responseBean);
|
||||
});
|
||||
}
|
||||
|
||||
fieldResponse.setFileDetail(documentResponseBeans);
|
||||
|
||||
// Now add fieldResponse to the list
|
||||
fieldResponses.add(fieldResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return fieldResponses;
|
||||
}
|
||||
|
||||
public void deleteById(Long id) {
|
||||
ApplicationEvaluationEntity applicationEvaluationEntity = validateApplicationEvaluation(id);
|
||||
applicationEvaluationEntity.setIsDeleted(true);
|
||||
applicationEvaluationEntity = saveApplicationEvaluationEntity(applicationEvaluationEntity);
|
||||
}
|
||||
|
||||
public ApplicationEvaluationEntity saveApplicationEvaluationEntity(ApplicationEvaluationEntity applicationEvaluationEntityData) {
|
||||
return applicationEvaluationRepository.save(applicationEvaluationEntityData);
|
||||
}
|
||||
|
||||
public ApplicationEvaluationResponse updateApplicationEvaluationStatus(ApplicationEntity application, AssignedApplicationsEntity assignedApplicationsEntity) {
|
||||
Optional<ApplicationEvaluationEntity> existingEntityOptional = applicationEvaluationRepository.findByAssignedApplicationsEntity_IdAndIsDeletedFalse(assignedApplicationsEntity.getId());
|
||||
ApplicationEvaluationEntity entity = null;
|
||||
|
||||
if (existingEntityOptional.isPresent()) {
|
||||
ApplicationEvaluationEntity existingEntity = existingEntityOptional.get();
|
||||
if (Boolean.TRUE.equals(
|
||||
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);
|
||||
assignedApplicationsEntity=assignedApplicationsRepository.save(assignedApplicationsEntity);
|
||||
|
||||
return convertToResponse(entity);}return null;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class AssignedApplicationsDao {
|
||||
assignApplication.setApplication(application);
|
||||
assignApplication.setAssignedBy(assignedByUser.getId());
|
||||
assignApplication.setUserId(userId);
|
||||
assignApplication.setStatus(AssignedApplicationEnum.ASSIGNED.getValue());
|
||||
assignApplication.setStatus(AssignedApplicationEnum.OPEN.getValue());
|
||||
if(assignedApplicationsRequest.getStatus() != null) {
|
||||
assignApplication.setStatus(assignedApplicationsRequest.getStatus().getValue());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,249 @@
|
||||
package net.gepafin.tendermanagement.dao;
|
||||
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
||||
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||
import net.gepafin.tendermanagement.entities.CallEntity;
|
||||
import net.gepafin.tendermanagement.entities.CommunicationEntity;
|
||||
import net.gepafin.tendermanagement.entities.CompanyEntity;
|
||||
import net.gepafin.tendermanagement.entities.ProtocolEntity;
|
||||
import net.gepafin.tendermanagement.entities.SystemEmailTemplatesEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import net.gepafin.tendermanagement.model.request.CommunicationRequestBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse;
|
||||
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.SystemEmailTemplateResponse;
|
||||
import net.gepafin.tendermanagement.repositories.CommunicationRepository;
|
||||
import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService;
|
||||
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||
import net.gepafin.tendermanagement.service.SystemEmailTemplatesService;
|
||||
import net.gepafin.tendermanagement.service.UserService;
|
||||
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
||||
import net.gepafin.tendermanagement.util.MailUtil;
|
||||
import net.gepafin.tendermanagement.util.Utils;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class CommunicationDao {
|
||||
private static final Logger log = LoggerFactory.getLogger(CommunicationDao.class);
|
||||
|
||||
@Autowired
|
||||
private CommunicationRepository communicationRepository;
|
||||
|
||||
@Autowired
|
||||
ApplicationAmendmentRequestService applicationAmendmentRequestService;
|
||||
|
||||
@Autowired
|
||||
private MailUtil mailUtil;
|
||||
|
||||
@Autowired
|
||||
private SystemEmailTemplatesService systemEmailTemplatesService;
|
||||
|
||||
@Autowired
|
||||
private ApplicationService applicationService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
|
||||
public CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationReq, Long amendmentId) {
|
||||
|
||||
log.info("Adding communication request...");
|
||||
CommunicationEntity communicationEntity = convertToCommunicationCommentEntity(communicationReq, amendmentId);
|
||||
communicationEntity = communicationRepository.save(communicationEntity);
|
||||
log.info("Added comment: {}", communicationEntity);
|
||||
return convertToCommunicationResponseBean(communicationEntity);
|
||||
}
|
||||
|
||||
public String deleteComment(Long amendmentId, Long commentId) {
|
||||
|
||||
CommunicationEntity data = communicationRepository.findById(commentId)
|
||||
.orElseThrow(() -> new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND)));
|
||||
if (!data.getApplicationAmendmentRequest().getId().equals(amendmentId)) {
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.INVALID_AMENDMENT_FOR_COMMENT));
|
||||
}
|
||||
data.setIsDeleted(true);
|
||||
communicationRepository.save(data);
|
||||
return "Deleted Comment Successfully.";
|
||||
}
|
||||
|
||||
public ApplicationAmendmentResponse getAmendmentComments(Long amendmentId) {
|
||||
|
||||
ApplicationAmendmentRequestEntity amendmentData = applicationAmendmentRequestService.validateApplicationAmendmentRequest(amendmentId);
|
||||
List<CommunicationResponseBean> commentsList = communicationRepository.findCommentDetailsByAmendmentId(amendmentId);
|
||||
if (commentsList == null) {
|
||||
throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND));
|
||||
}
|
||||
return new ApplicationAmendmentResponse(amendmentData, commentsList);
|
||||
}
|
||||
|
||||
public CommunicationResponseBean updateAmendmentComment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId) {
|
||||
|
||||
log.info("Updating communication comment...");
|
||||
CommunicationEntity existingComment = communicationRepository.findById(commentId)
|
||||
.orElseThrow(() -> new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND)));
|
||||
if (!existingComment.getApplicationAmendmentRequest().getId().equals(amendmentId)) {
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.COMMENT_NOT_ASSOCIATE_WITH_AMENDMENT_ID_ERROR_MSG));
|
||||
}
|
||||
existingComment.setCommunicationTitle(communicationRequestBean.getTitle());
|
||||
existingComment.setCommunicationComment(communicationRequestBean.getComment());
|
||||
existingComment.setCommentedDate(LocalDateTime.now());
|
||||
existingComment = communicationRepository.save(existingComment);
|
||||
log.info("Updated Comment: {}", existingComment);
|
||||
return convertToCommunicationResponseBean(existingComment);
|
||||
}
|
||||
|
||||
private CommunicationResponseBean convertToCommunicationResponseBean(CommunicationEntity entity) {
|
||||
|
||||
CommunicationResponseBean response = new CommunicationResponseBean();
|
||||
response.setComment(entity.getCommunicationComment());
|
||||
response.setCommentedDate(entity.getCommentedDate());
|
||||
response.setAmendmentId(entity.getApplicationAmendmentRequest().getId());
|
||||
response.setCreatedDate(entity.getCreatedDate());
|
||||
response.setUpdatedDate(entity.getUpdatedDate());
|
||||
response.setTitle(entity.getCommunicationTitle());
|
||||
return response;
|
||||
}
|
||||
|
||||
private CommunicationEntity convertToCommunicationCommentEntity(CommunicationRequestBean communicationReq, Long amendmentId) {
|
||||
|
||||
ApplicationAmendmentRequestEntity amendmentRequest = applicationAmendmentRequestService.validateApplicationAmendmentRequest(amendmentId);
|
||||
CommunicationEntity communicationEntity = new CommunicationEntity();
|
||||
communicationEntity.setApplicationAmendmentRequest(amendmentRequest);
|
||||
communicationEntity.setCommunicationTitle(communicationReq.getTitle());
|
||||
communicationEntity.setCommunicationComment(communicationReq.getComment());
|
||||
communicationEntity.setIsDeleted(false);
|
||||
communicationEntity.setCommentedDate(LocalDateTime.now());
|
||||
return communicationEntity;
|
||||
}
|
||||
|
||||
public void sendMailToNotifyBeneficiaryRegardingNewAmendment(ApplicationAmendmentRequestEntity applicationAmendmentRequest) {
|
||||
|
||||
ApplicationEntity applicationEntity = applicationService.validateApplication(applicationAmendmentRequest.getApplicationId());
|
||||
|
||||
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService.retrieveTemplateByTypeAndCall(
|
||||
SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.DOCUMENTATION_INTEGRATION_REQUEST, applicationEntity.getCall(), null);
|
||||
|
||||
// Create the map for subject placeholders
|
||||
Map<String, String> subjectPlaceholders = new HashMap<>();
|
||||
subjectPlaceholders.put("{{call_name}}", applicationEntity.getCall().getName());
|
||||
subjectPlaceholders.put("{{company_name}}", applicationEntity.getCompany().getCompanyName());
|
||||
|
||||
// Create the map for body placeholders
|
||||
Map<String, String> bodyPlaceholders = new HashMap<>();
|
||||
bodyPlaceholders.put("{{call_name}}", applicationEntity.getCall().getName());
|
||||
bodyPlaceholders.put("{{protocol_number}}", applicationEntity.getProtocol().getProtocolNumber().toString());
|
||||
bodyPlaceholders.put("{{protocol_date}}", DateTimeUtil.formatLocalDateTime(applicationAmendmentRequest.getProtocol().getCreatedDate(), GepafinConstant.DD_MM_YYYY));
|
||||
bodyPlaceholders.put("{{protocol_time}}", DateTimeUtil.parseLocalTimeToString(applicationAmendmentRequest.getProtocol().getTime(), GepafinConstant.HH_MM_SS));
|
||||
bodyPlaceholders.put("{{form_dataInput}}", "");
|
||||
|
||||
// Replace placeholders in the subject and body
|
||||
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
|
||||
String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
|
||||
UserEntity userEntity = userService.validateUser(applicationEntity.getUserId());
|
||||
mailUtil.sendByMailGun(subject, body, List.of(userEntity.getBeneficiary().getEmail()), null);
|
||||
}
|
||||
|
||||
public void sendApplicationFailureNotificationEmail(String userEmail, ApplicationEntity applicationEntity) {
|
||||
|
||||
CallEntity call = applicationEntity.getCall();
|
||||
CompanyEntity company = applicationEntity.getCompany();
|
||||
ProtocolEntity protocol = applicationEntity.getProtocol();
|
||||
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService.retrieveTemplateByTypeAndCall(
|
||||
SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.INADMISSIBILITY_NOTIFICATION_DUE_TO_FAILURE, call, null);
|
||||
|
||||
// Create the map for subject placeholders
|
||||
Map<String, String> subjectPlaceholders = new HashMap<>();
|
||||
subjectPlaceholders.put("{{call_name}}", call.getName());
|
||||
subjectPlaceholders.put("{{company_name}}", company.getCompanyName());
|
||||
|
||||
// Create the map for body placeholders
|
||||
Map<String, String> bodyPlaceholders = new HashMap<>();
|
||||
bodyPlaceholders.put("{{call_name}}", call.getName());
|
||||
bodyPlaceholders.put("{{date_time_emailSend}}", DateTimeUtil.formatLocalDateTime(protocol.getCreatedDate(), GepafinConstant.DD_MM_YYYY_HH_MM));
|
||||
|
||||
// Replace placeholders in the subject and body
|
||||
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
|
||||
String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
|
||||
|
||||
mailUtil.sendByMailGun(subject, body, List.of(userEmail), null);
|
||||
mailUtil.sendByMailGun(subject, body, List.of(applicationEntity.getCompany().getEmail()), null);
|
||||
}
|
||||
|
||||
private void sendAdmissibilityNotificationEmail(UserEntity userEntity, ApplicationEntity applicationEntity) {
|
||||
|
||||
CallEntity call = applicationEntity.getCall();
|
||||
CompanyEntity company = applicationEntity.getCompany();
|
||||
ProtocolEntity protocol = applicationEntity.getProtocol();
|
||||
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService.retrieveTemplateByTypeAndCall(
|
||||
SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.ADMISSIBILITY_NOTIFICATION, call, null);
|
||||
|
||||
// Create the map for subject placeholders
|
||||
Map<String, String> subjectPlaceholders = new HashMap<>();
|
||||
subjectPlaceholders.put("{{call_name}}", call.getName());
|
||||
subjectPlaceholders.put("{{company_name}}", company.getCompanyName());
|
||||
|
||||
// Create the map for body placeholders
|
||||
Map<String, String> bodyPlaceholders = new HashMap<>();
|
||||
bodyPlaceholders.put("{{call_name}}", call.getName());
|
||||
bodyPlaceholders.put("{{protocol_number}}", protocol.getProtocolNumber().toString());
|
||||
bodyPlaceholders.put("{{protocol_date}}", DateTimeUtil.formatCreatedDate(protocol.getCreatedDate()));
|
||||
bodyPlaceholders.put("{{protocol_time}}", DateTimeUtil.parseLocalTimeToString(protocol.getTime(), GepafinConstant.HH_MM_SS));
|
||||
|
||||
// Replace placeholders in the subject and body
|
||||
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
|
||||
String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
|
||||
|
||||
String email = userEntity.getEmail();
|
||||
if (userEntity.getBeneficiary() != null) {
|
||||
email = userEntity.getBeneficiary().getEmail();
|
||||
}
|
||||
mailUtil.sendByMailGun(subject, body, List.of(email), null);
|
||||
mailUtil.sendByMailGun(subject, body, List.of(applicationEntity.getCompany().getEmail()), null);
|
||||
}
|
||||
|
||||
private void sendInadmissibilityTemplateEmail(UserEntity userEntity, ApplicationEntity applicationEntity) {
|
||||
|
||||
CallEntity call = applicationEntity.getCall();
|
||||
CompanyEntity company = applicationEntity.getCompany();
|
||||
ProtocolEntity protocol = applicationEntity.getProtocol();
|
||||
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService.retrieveTemplateByTypeAndCall(
|
||||
SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.INADMISSIBILITY_TEMPLATE, call, null);
|
||||
|
||||
// Create the map for subject placeholders
|
||||
Map<String, String> subjectPlaceholders = new HashMap<>();
|
||||
subjectPlaceholders.put("{{call_name}}", call.getName());
|
||||
subjectPlaceholders.put("{{company_name}}", company.getCompanyName());
|
||||
|
||||
// Create the map for body placeholders
|
||||
Map<String, String> bodyPlaceholders = new HashMap<>();
|
||||
bodyPlaceholders.put("{{call_name}}", call.getName());
|
||||
bodyPlaceholders.put("{{protocol_number}}", protocol.getProtocolNumber().toString());
|
||||
bodyPlaceholders.put("{{protocol_date}}", DateTimeUtil.formatCreatedDate(protocol.getCreatedDate()));
|
||||
bodyPlaceholders.put("{{protocol_time}}", DateTimeUtil.parseLocalTimeToString(protocol.getTime(), GepafinConstant.HH_MM_SS));
|
||||
bodyPlaceholders.put("{{form_text}}", "YOUR_FORM_TEXT_HERE"); // Replace with actual data input if available
|
||||
|
||||
// Replace placeholders in the subject and body
|
||||
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
|
||||
String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
|
||||
|
||||
String email = userEntity.getEmail();
|
||||
if (userEntity.getBeneficiary() != null) {
|
||||
email = userEntity.getBeneficiary().getEmail();
|
||||
}
|
||||
mailUtil.sendByMailGun(subject, body, List.of(email), null);
|
||||
mailUtil.sendByMailGun(subject, body, List.of(applicationEntity.getCompany().getEmail()), null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package net.gepafin.tendermanagement.dao;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||
import net.gepafin.tendermanagement.entities.HubEntity;
|
||||
import net.gepafin.tendermanagement.entities.ProtocolEntity;
|
||||
import net.gepafin.tendermanagement.repositories.ProtocolRepository;
|
||||
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
||||
|
||||
@Component
|
||||
public class ProtocolDao {
|
||||
|
||||
@Autowired
|
||||
private ProtocolRepository protocolRepository;
|
||||
|
||||
|
||||
@Value("${default.hub.uuid}")
|
||||
private String defaultHubUuid;
|
||||
|
||||
|
||||
public Long getProtocolNumber(HubEntity hubEntity) {
|
||||
Long maxProtocolNumber = protocolRepository.findMaxProtocolNumberAndHubId(hubEntity.getId());
|
||||
Long startNumber = 10000001L;
|
||||
if(Boolean.FALSE.equals(defaultHubUuid.equals(hubEntity.getUniqueUuid()))) {
|
||||
startNumber = 20000001L;
|
||||
}
|
||||
return (maxProtocolNumber != null) ? maxProtocolNumber + 1 : startNumber;
|
||||
}
|
||||
|
||||
public ProtocolEntity createProtocolEntity(ApplicationEntity applicationEntity,Long protocolNumber, Long hubId){
|
||||
ProtocolEntity protocolEntity=new ProtocolEntity();
|
||||
protocolEntity.setCall(applicationEntity.getCall().getId());
|
||||
LocalDateTime utcDateTime = DateTimeUtil.DateServerToUTC(LocalDateTime.now());
|
||||
protocolEntity.setYear(utcDateTime.getYear());
|
||||
protocolEntity.setProtocolNumber(protocolNumber);
|
||||
protocolEntity.setTime(LocalTime.now());
|
||||
protocolEntity.setApplicationId(applicationEntity.getId());
|
||||
protocolEntity.setHubId(hubId);
|
||||
protocolRepository.save(protocolEntity);
|
||||
return protocolEntity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package net.gepafin.tendermanagement.entities;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
|
||||
@Entity
|
||||
@Table(name="application_amendment_request")
|
||||
@Data
|
||||
public class ApplicationAmendmentRequestEntity extends BaseEntity {
|
||||
|
||||
@Column(name = "NOTE")
|
||||
private String note;
|
||||
|
||||
@Column(name ="RESPONSE_DAYS")
|
||||
private Long responseDays;
|
||||
|
||||
@Column(name = "IS_NOTIFICATION")
|
||||
private Boolean isNotification = false;
|
||||
|
||||
@Column(name = "IS_EMAIL")
|
||||
private Boolean isEmail=false;
|
||||
|
||||
@Column(name = "APPLICATION_ID")
|
||||
private Long applicationId;
|
||||
|
||||
@Column(name = "FORM_FIELDS")
|
||||
private String formFields;
|
||||
|
||||
@Column(name="IS_DELETED")
|
||||
private Boolean isDeleted=false;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "APPLICATION_EVALUATION_ID", nullable = false)
|
||||
private ApplicationEvaluationEntity applicationEvaluationEntity;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "PROTOCOL_Id")
|
||||
private ProtocolEntity protocol;
|
||||
|
||||
}
|
||||
@@ -8,9 +8,6 @@ import java.time.LocalDateTime;
|
||||
@Entity
|
||||
@Table(name = "APPLICATION")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class ApplicationEntity extends BaseEntity {
|
||||
|
||||
@Column(name = "USER_ID")
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package net.gepafin.tendermanagement.entities;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "application_evaluation")
|
||||
public class ApplicationEvaluationEntity extends BaseEntity{
|
||||
|
||||
@Column(name = "application_Id")
|
||||
private Long applicationId;
|
||||
|
||||
@Column(name = "user_id")
|
||||
private Long userId;
|
||||
|
||||
@Column(name = "criteria")
|
||||
private String criteria;
|
||||
|
||||
@Column(name = "checklist")
|
||||
private String checklist;
|
||||
|
||||
@Column(name = "file")
|
||||
private String file;
|
||||
|
||||
@Column(name = "note")
|
||||
private String note;
|
||||
|
||||
@Column(name = "status")
|
||||
private String status;
|
||||
|
||||
@Column(name="IS_DELETED")
|
||||
private Boolean isDeleted;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "assigned_applications_id", nullable = true)
|
||||
private AssignedApplicationsEntity assignedApplicationsEntity;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package net.gepafin.tendermanagement.entities;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Table(name = "communication")
|
||||
@Data
|
||||
public class CommunicationEntity extends BaseEntity {
|
||||
|
||||
@Column(name = "COMMUNICATION_TITLE")
|
||||
private String communicationTitle;
|
||||
|
||||
@Column(name = "COMMUNICATION_COMMENT")
|
||||
private String communicationComment;
|
||||
|
||||
@Column(name = "IS_DELETED")
|
||||
private Boolean isDeleted = false;
|
||||
|
||||
@Column(name = "COMMENTED_DATE")
|
||||
private LocalDateTime commentedDate;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "AMENDMENT_ID", referencedColumnName = "id", nullable = false)
|
||||
private ApplicationAmendmentRequestEntity applicationAmendmentRequest;
|
||||
|
||||
}
|
||||
@@ -39,7 +39,11 @@ public class SystemEmailTemplatesEntity extends BaseEntity {
|
||||
public enum SystemEmailTemplatesEntityTypeEnum {
|
||||
|
||||
APPLICATION_SUBMISSION_TO_USER_AND_COMPANY("APPLICATION_SUBMISSION_TO_USER_AND_COMPANY"),
|
||||
APPLICATION_SUBMISSION_TO_GEPAFIN("APPLICATION_SUBMISSION_TO_GEPAFIN");
|
||||
APPLICATION_SUBMISSION_TO_GEPAFIN("APPLICATION_SUBMISSION_TO_GEPAFIN"),
|
||||
DOCUMENTATION_INTEGRATION_REQUEST("DOCUMENTATION_INTEGRATION_REQUEST"),
|
||||
INADMISSIBILITY_NOTIFICATION_DUE_TO_FAILURE("INADMISSIBILITY_NOTIFICATION_DUE_TO_FAILURE"),
|
||||
ADMISSIBILITY_NOTIFICATION("ADMISSIBILITY_NOTIFICATION"),
|
||||
INADMISSIBILITY_TEMPLATE("INADMISSIBILITY_NOTIFICATION_2");
|
||||
|
||||
private String value;
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package net.gepafin.tendermanagement.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
public enum ApplicationEvaluationStatusTypeEnum {
|
||||
OPEN ("OPEN"),
|
||||
SOCCORSO("SOCCORSO"),
|
||||
CLOSE("CLOSE");
|
||||
|
||||
private String value;
|
||||
|
||||
ApplicationEvaluationStatusTypeEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,9 @@ public enum ApplicationStatusTypeEnum {
|
||||
AWAITING("AWAITING"),
|
||||
READY("READY"),
|
||||
DISCARD("DISCARD"),
|
||||
SOCCORSO("SOCCORSO"),
|
||||
APPROVED("APPROVED"),
|
||||
REJECTED("REJECTED"),
|
||||
EVALUATION("EVALUATION");
|
||||
|
||||
private String value;
|
||||
|
||||
@@ -3,9 +3,9 @@ package net.gepafin.tendermanagement.enums;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
public enum AssignedApplicationEnum {
|
||||
ASSIGNED("ASSIGNED"),
|
||||
APPROVED("APPROVED"),
|
||||
REJECTED("REJECTED");
|
||||
OPEN ("OPEN"),
|
||||
SOCCORSO("SOCCORSO"),
|
||||
CLOSE("CLOSE");
|
||||
|
||||
|
||||
private final String value;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package net.gepafin.tendermanagement.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
import net.gepafin.tendermanagement.model.response.AmendmentFormFieldResponse;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ApplicationAmendmentRequest {
|
||||
private String note;
|
||||
private List<AmendmentFormFieldResponse> formFields;
|
||||
private Long responseDays;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package net.gepafin.tendermanagement.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApplicationAmendmentRequestBean {
|
||||
private String note;
|
||||
private ApplicationFormFieldRequestBean updatedFormFields;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package net.gepafin.tendermanagement.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@Data
|
||||
public class ApplicationEvaluationRequest {
|
||||
|
||||
private List<CriteriaRequest> criteria;
|
||||
private List<ChecklistRequest> checklist;
|
||||
private List<FieldRequest> files;
|
||||
private String note;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package net.gepafin.tendermanagement.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ChecklistRequest {
|
||||
private Long id;
|
||||
private Boolean valid;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package net.gepafin.tendermanagement.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CommunicationRequestBean {
|
||||
private String title;
|
||||
private String comment;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package net.gepafin.tendermanagement.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CriteriaRequest {
|
||||
private Long id;
|
||||
private Long score;
|
||||
private Boolean valid;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package net.gepafin.tendermanagement.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FieldRequest {
|
||||
private String id;
|
||||
private Boolean valid;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
package net.gepafin.tendermanagement.model.request;public class UpdateApplicationEvaluationRequest {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AmendmentFormFieldResponse {
|
||||
private String fieldId;
|
||||
private String label;
|
||||
private boolean isSelected = false;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ApplicationAmendmentRequestResponse {
|
||||
private Long id;
|
||||
private String note;
|
||||
private Long responseDays;
|
||||
private LocalDateTime startDate;
|
||||
private boolean isSendNotification;
|
||||
private boolean isSendEmail;
|
||||
private Long protocolNumber;
|
||||
private String callName;
|
||||
private String beneficiaryName;
|
||||
private List<AmendmentFormFieldResponse> formFields;
|
||||
private List<ApplicationFormFieldResponseBean> applicationFormFields;
|
||||
private Long applicationId;
|
||||
private Long applicationEvaluationId;
|
||||
private LocalDateTime expirationDate;
|
||||
private List<CommunicationResponseBean> commentsList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ApplicationAmendmentResponse {
|
||||
private ApplicationAmendmentRequestEntity amendment;
|
||||
private List<CommunicationResponseBean> commentsList;
|
||||
public ApplicationAmendmentResponse(ApplicationAmendmentRequestEntity amendment, List<CommunicationResponseBean> comments) {
|
||||
this.amendment = amendment;
|
||||
this.commentsList = comments;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ApplicationEvaluationResponse {
|
||||
|
||||
|
||||
private Long id;
|
||||
private Long applicationId;
|
||||
private ApplicationStatusTypeEnum applicationStatus;
|
||||
private Long assignedApplicationId;
|
||||
private String note;
|
||||
private ApplicationEvaluationStatusTypeEnum status;
|
||||
private Long minScore;
|
||||
private List<CriteriaResponse> criteria;
|
||||
private List<ChecklistResponse> checklist;
|
||||
private List<FieldResponse> files;
|
||||
private LocalDateTime createdDate;
|
||||
private LocalDateTime updatedDate;
|
||||
private String beneficiary;
|
||||
private Long protocolNumber;
|
||||
private String callName;
|
||||
private LocalDateTime submissionDate;
|
||||
private LocalDateTime evaluationDate;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ChecklistResponse {
|
||||
private Long id;
|
||||
private String label;
|
||||
private Boolean valid;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class CommunicationResponseBean {
|
||||
private LocalDateTime commentedDate;
|
||||
|
||||
private String comment;
|
||||
|
||||
private String title;
|
||||
|
||||
private LocalDateTime createdDate;
|
||||
|
||||
private LocalDateTime updatedDate;
|
||||
|
||||
private Long amendmentId;
|
||||
public CommunicationResponseBean(LocalDateTime commentedDate, String comment, String title, LocalDateTime createdDate, LocalDateTime updatedDate, Long amendmentId) {
|
||||
|
||||
this.commentedDate = commentedDate;
|
||||
this.comment = comment;
|
||||
this.title = title;
|
||||
this.createdDate = createdDate;
|
||||
this.updatedDate = updatedDate;
|
||||
this.amendmentId = amendmentId;
|
||||
}
|
||||
|
||||
public CommunicationResponseBean() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CriteriaMappedField {
|
||||
private String id;
|
||||
private String fieldLabel;
|
||||
private String fieldValue;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CriteriaResponse {
|
||||
private Long id;
|
||||
private String label;
|
||||
private Long score;
|
||||
private Long maxScore;
|
||||
private List<CriteriaMappedField> criteriaMappedFields;
|
||||
private Boolean valid;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FieldResponse {
|
||||
private String id;
|
||||
private String label;
|
||||
private Boolean valid;
|
||||
private List<DocumentResponseBean> fileDetail ;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface ApplicationAmendmentRequestRepository extends JpaRepository<ApplicationAmendmentRequestEntity,Long>, JpaSpecificationExecutor<ApplicationAmendmentRequestEntity> {
|
||||
Optional<ApplicationAmendmentRequestEntity> findByIdAndIsDeletedFalse(Long id);
|
||||
|
||||
@Query(value = "SELECT ar.* FROM application_amendment_request ar " +
|
||||
"JOIN application app ON ar.application_id = app.id " +
|
||||
"WHERE app.user_id = :userId AND ar.is_deleted = false",
|
||||
nativeQuery = true)
|
||||
List<ApplicationAmendmentRequestEntity> findByUserId(@Param("userId") Long userId);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public interface ApplicationEvaluationRepository extends JpaRepository<ApplicationEvaluationEntity, Long> {
|
||||
|
||||
List<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();
|
||||
|
||||
}
|
||||
@@ -23,5 +23,19 @@ public interface ApplicationFormFieldRepository extends JpaRepository<Applicatio
|
||||
|
||||
public List<ApplicationFormFieldEntity> findByFieldValueInAndApplicationFormApplicationId(
|
||||
List<String> fieldValue, Long applicationId);
|
||||
/**
|
||||
* Find ApplicationFormField entity by Field ID, Form ID, and Application ID.
|
||||
*
|
||||
* @param fieldId The Field ID to search.
|
||||
* @param formId The Form ID to search.
|
||||
* @param applicationId The Application ID to search.
|
||||
* @return Optional of ApplicationFormFieldEntity
|
||||
*/
|
||||
Optional<ApplicationFormFieldEntity> findByFieldIdAndApplicationFormIdAndApplicationFormApplicationId(
|
||||
String fieldId, Long formId, Long applicationId);
|
||||
|
||||
|
||||
public ApplicationFormFieldEntity findByFieldId(String FieldId);
|
||||
|
||||
Optional<ApplicationFormFieldEntity> findByApplicationFormIdAndFieldId(Long id, String fieldId);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,26 @@ package net.gepafin.tendermanagement.repositories;
|
||||
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
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(
|
||||
@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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,14 @@ public interface CallRepository extends JpaRepository<CallEntity, Long> {
|
||||
// @Query("SELECT COALESCE(SUM(c.amount), 0) FROM CallEntity c WHERE c.status = 'PUBLISH'")
|
||||
// BigDecimal findTotalAmountOfPublishedCalls();
|
||||
|
||||
@Query("SELECT c.name, COUNT(a.id) " +
|
||||
"FROM CallEntity c LEFT JOIN ApplicationEntity a ON c.id = a.call.id " +
|
||||
"GROUP BY c.name")
|
||||
List<Object[]> findApplicationsPerCall();
|
||||
|
||||
|
||||
@Query("SELECT c FROM CallEntity c JOIN ApplicationEntity a ON c.id = a.call.id WHERE a.id = :applicationId")
|
||||
CallEntity findCallEntityByApplicationId(Long applicationId);
|
||||
// @Query("SELECT c.name, COUNT(a.id) " +
|
||||
// "FROM CallEntity c LEFT JOIN ApplicationEntity a ON c.id = a.call.id " +
|
||||
// "GROUP BY c.name")
|
||||
|
||||
@@ -17,4 +17,5 @@ public interface CallTargetAudienceChecklistRepository extends JpaRepository<Cal
|
||||
Optional<CallTargetAudienceChecklistEntity> findById(@Param("id") Long id);
|
||||
|
||||
List<CallTargetAudienceChecklistEntity> findByCallIdAndLookupDataTypeAndIsDeletedFalse(Long id, String type);
|
||||
List<CallTargetAudienceChecklistEntity> findByCallId(Long callId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.CommunicationEntity;
|
||||
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CommunicationRepository extends JpaRepository<CommunicationEntity, Long> {
|
||||
|
||||
@Query("Select new net.gepafin.tendermanagement.model.response.CommunicationResponseBean(c.commentedDate, c.communicationComment, c.communicationTitle, c.createdDate, c.updatedDate, c.applicationAmendmentRequest.id) " +
|
||||
"from CommunicationEntity c Where c.applicationAmendmentRequest.id = :applicationAmendmentRequestId")
|
||||
List<CommunicationResponseBean> findCommentsByApplicationAmendmentRequestId(@Param("applicationAmendmentRequestId") Long amendmentRequestId);
|
||||
|
||||
@Query("SELECT new net.gepafin.tendermanagement.model.response.CommunicationResponseBean( " + "c.commentedDate, c.communicationComment, c.communicationTitle, c.createdDate, c" +
|
||||
".updatedDate, c.applicationAmendmentRequest.id) " + "FROM CommunicationEntity c " + "WHERE c.applicationAmendmentRequest.id = :amendmentId AND c.isDeleted = false")
|
||||
List<CommunicationResponseBean> findCommentDetailsByAmendmentId(@Param("amendmentId") Long amendmentId);
|
||||
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import org.springframework.stereotype.Repository;
|
||||
public interface DocumentRepository extends JpaRepository<DocumentEntity, Long> {
|
||||
|
||||
@Query("SELECT d FROM DocumentEntity d WHERE d.id = :id AND d.isDeleted = false")
|
||||
Optional<DocumentEntity> findById(@Param("id") Long id);
|
||||
Optional<DocumentEntity> findByIdAndNotDeleted(@Param("id") Long id);
|
||||
|
||||
// List<DocumentEntity> findBySourceIdAndTypeAndIsDeletedFalse(Long sourceId, String type);
|
||||
|
||||
|
||||
@@ -16,4 +16,6 @@ public interface EvaluationCriteriaRepository extends JpaRepository<EvaluationCr
|
||||
Optional<EvaluationCriteriaEntity> findById(@Param("id") Long id);
|
||||
|
||||
List<EvaluationCriteriaEntity> findByCallIdAndLookupDataTypeAndIsDeletedFalse(Long callId, String type);
|
||||
List<EvaluationCriteriaEntity> findByCallId(Long callId);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
//package net.gepafin.tendermanagement.scheduler;
|
||||
//
|
||||
//import net.gepafin.tendermanagement.dao.CommunicationDao;
|
||||
//import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
||||
//import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||
//import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
//import net.gepafin.tendermanagement.repositories.ApplicationAmendmentRepository;
|
||||
//import net.gepafin.tendermanagement.repositories.ApplicationRepository;
|
||||
//import net.gepafin.tendermanagement.repositories.UserRepository;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.scheduling.annotation.Scheduled;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import java.time.LocalDateTime;
|
||||
//import java.util.List;
|
||||
//
|
||||
//@Component
|
||||
//public class NotificationScheduler {
|
||||
//
|
||||
// @Autowired
|
||||
// UserRepository userRepository;
|
||||
//
|
||||
// @Autowired
|
||||
// ApplicationRepository applicationRepository;
|
||||
//
|
||||
// @Autowired
|
||||
// ApplicationAmendmentRepository applicationAmendmentRepository;
|
||||
//
|
||||
// @Autowired
|
||||
// CommunicationDao communicationDao;
|
||||
//
|
||||
// @Scheduled(cron = "0 0/10 * * * ?", zone = "Asia/Kolkata")
|
||||
// void sendNotificationForRejectedApplicationToBeneficiary() {
|
||||
//
|
||||
// List<ApplicationEntity> applicationsList = applicationRepository.findByIsDeletedFalse();
|
||||
// List<ApplicationAmendmentRequestEntity> amendmentRequestList = applicationAmendmentRepository.findByIsDeletedFalse();
|
||||
//
|
||||
// LocalDateTime today = LocalDateTime.now();
|
||||
//
|
||||
// for (ApplicationEntity application : applicationsList) {
|
||||
// ApplicationAmendmentRequestEntity amendmentRequest = getAmendmentRequestForApplication(application, amendmentRequestList);
|
||||
//
|
||||
// if (amendmentRequest != null) {
|
||||
// LocalDateTime requestDate = amendmentRequest.getStartedDate();
|
||||
//
|
||||
// // Check if requestDate + 7 days is less than or equal to today
|
||||
// if (requestDate.plusDays(7).isAfter(today)) {
|
||||
// // Update the application status to REJECTED
|
||||
// application.setStatus("REJECTED");
|
||||
// applicationRepository.save(application); // Save updated application
|
||||
//
|
||||
// // Update the amendment request status to CLOSED
|
||||
// amendmentRequest.setStatus("CLOSED");
|
||||
// applicationAmendmentRepository.save(amendmentRequest); // Save updated amendment request
|
||||
//
|
||||
// // Get the user associated with the application
|
||||
// UserEntity user = userRepository.findById(application.getUserId()).orElse(null); // Adjust according to your UserRepository's method
|
||||
//
|
||||
// // Send email notification if user is found
|
||||
// if (user != null && user.getEmail() != null) {
|
||||
// communicationDao.sendApplicationFailureNotificationEmail(user.getEmail(), application);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private ApplicationAmendmentRequestEntity getAmendmentRequestForApplication(ApplicationEntity application, List<ApplicationAmendmentRequestEntity> amendmentRequestList) {
|
||||
//
|
||||
// return amendmentRequestList.stream().filter(request -> request.getId().equals(application.getId())).findFirst().orElse(null);
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,21 @@
|
||||
package net.gepafin.tendermanagement.service;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ApplicationAmendmentRequestService {
|
||||
public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(HttpServletRequest request,Long applicationEvaluationId);
|
||||
public ApplicationAmendmentRequestResponse createApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId , ApplicationAmendmentRequest applicationAmendmentRequest);
|
||||
void deleteApplicationAmendmentRequest(HttpServletRequest request, Long id);
|
||||
ApplicationAmendmentRequestResponse getApplicationAmendmentRequestById(HttpServletRequest request,Long id);
|
||||
List<ApplicationAmendmentRequestResponse> getAllApplicationAmendmentRequest(HttpServletRequest request,Long userId);
|
||||
ApplicationAmendmentRequestResponse updateApplicationAmendment(HttpServletRequest request, Long id, ApplicationAmendmentRequestBean applicationAmendmentRequestBean);
|
||||
ApplicationAmendmentRequestEntity validateApplicationAmendmentRequest(Long applicationAmendmentId);
|
||||
List<ApplicationAmendmentRequestResponse> getAllAmendmentRequestByBeneficiaryId(HttpServletRequest request,Long beneficiaryId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
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.model.request.ApplicationEvaluationRequest;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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);
|
||||
|
||||
|
||||
ApplicationEvaluationEntity validateApplicationEvaluation(Long applicationEvaluationId);
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public interface ApplicationService {
|
||||
|
||||
void deleteApplication(HttpServletRequest request, Long applicationId);
|
||||
|
||||
public ApplicationEntity validateApplication(Long userId);
|
||||
public ApplicationEntity validateApplication(Long applicationId);
|
||||
|
||||
public ApplicationResponse createApplication(HttpServletRequest request, Long companyId, ApplicationRequest applicationRequest, Long callId);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.gepafin.tendermanagement.service;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
||||
|
||||
@@ -16,4 +17,5 @@ public interface AssignedApplicationsService {
|
||||
List<AssignedApplicationsResponse> getAllAssignedApplications(HttpServletRequest request, Long userId);
|
||||
AssignedApplicationsResponse updateAssignedApplication(HttpServletRequest request, Long id, AssignedApplicationsRequest assignedApplicationsRequest);
|
||||
AssignedApplicationsResponse getAssignedApplicationById(HttpServletRequest request, Long id);
|
||||
AssignedApplicationsEntity validateAssignedApplication(Long assignedApplicationId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package net.gepafin.tendermanagement.service;
|
||||
|
||||
import net.gepafin.tendermanagement.model.request.CommunicationRequestBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse;
|
||||
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
|
||||
|
||||
public interface CommunicationService {
|
||||
CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationRequestBean, Long amendmentId);
|
||||
|
||||
String deleteComment(Long amendmentId, Long commentId);
|
||||
|
||||
CommunicationResponseBean updateAmendmentComment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId);
|
||||
|
||||
ApplicationAmendmentResponse getAmendmentComments(Long id);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package net.gepafin.tendermanagement.service.impl;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.dao.ApplicationAmendmentRequestDao;
|
||||
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
||||
import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService;
|
||||
import net.gepafin.tendermanagement.util.Validator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendmentRequestService {
|
||||
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
|
||||
@Autowired
|
||||
private ApplicationAmendmentRequestDao applicationAmendmentRequestDao;
|
||||
|
||||
@Override
|
||||
public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(HttpServletRequest request, Long applicationEvaluationId) {
|
||||
UserEntity user= validator.validateUser(request);
|
||||
return applicationAmendmentRequestDao.getApplicationDataForAmendment(request,applicationEvaluationId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationAmendmentRequestResponse createApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId , ApplicationAmendmentRequest applicationAmendmentRequest) {
|
||||
UserEntity user= validator.validateUser(request);
|
||||
return applicationAmendmentRequestDao.createApplicationAmendmentRequest(applicationEvaluationId,applicationAmendmentRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteApplicationAmendmentRequest(HttpServletRequest request, Long id) {
|
||||
applicationAmendmentRequestDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationAmendmentRequestResponse getApplicationAmendmentRequestById(HttpServletRequest request,Long id) {
|
||||
return applicationAmendmentRequestDao.getApplicationAmendmentRequestById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ApplicationAmendmentRequestResponse> getAllApplicationAmendmentRequest(HttpServletRequest request,Long userId) {
|
||||
return applicationAmendmentRequestDao.getAllApplicationAmendmentRequest(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationAmendmentRequestResponse updateApplicationAmendment(HttpServletRequest request, Long id, ApplicationAmendmentRequestBean applicationAmendmentRequestBean) {
|
||||
UserEntity updatedByUser= validator.validateUser(request);
|
||||
return applicationAmendmentRequestDao.updateApplicationAmendment(id,applicationAmendmentRequestBean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationAmendmentRequestEntity validateApplicationAmendmentRequest(Long applicationAmendmentId) {
|
||||
return applicationAmendmentRequestDao.validateApplicationAmendmentRequest(applicationAmendmentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ApplicationAmendmentRequestResponse> getAllAmendmentRequestByBeneficiaryId(HttpServletRequest request, Long beneficiaryId) {
|
||||
return applicationAmendmentRequestDao.getAllAmendmentRequestByBeneficiaryId(beneficiaryId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package net.gepafin.tendermanagement.service.impl;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.dao.ApplicationEvaluationDao;
|
||||
|
||||
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.model.request.ApplicationEvaluationRequest;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
|
||||
|
||||
import net.gepafin.tendermanagement.repositories.AssignedApplicationsRepository;
|
||||
import net.gepafin.tendermanagement.service.ApplicationEvaluationService;
|
||||
import net.gepafin.tendermanagement.util.Validator;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class ApplicationEvaluationServiceImpl implements ApplicationEvaluationService {
|
||||
|
||||
@Autowired
|
||||
private ApplicationEvaluationDao applicationEvaluationDao;
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
@Autowired
|
||||
private AssignedApplicationsRepository assignedApplicationsRepository;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ApplicationEvaluationResponse createOrUpdateApplicationEvaluation(HttpServletRequest request, ApplicationEvaluationRequest req,Long assignedApplicationsId) {
|
||||
AssignedApplicationsEntity assignedApplication = assignedApplicationsRepository.findByIdAndIsDeletedFalse(assignedApplicationsId).orElseThrow(()->
|
||||
new ResourceNotFoundException(Status.NOT_FOUND,Translator.toLocale(GepafinConstant.ASSIGNED_APPLICATION_NOT_FOUND_MSG)));
|
||||
UserEntity user=validator.validatePreInstructor(request,assignedApplication.getUserId());
|
||||
return applicationEvaluationDao.createOrUpdateApplicationEvaluation(user,req,assignedApplication.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<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;
|
||||
|
||||
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(
|
||||
Status.BAD_REQUEST,
|
||||
Translator.toLocale(GepafinConstant.ASSIGNED_APPLICATION_NOT_FOUND_WITH_ID_MSG)
|
||||
);
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteApplicationEvaluation(HttpServletRequest request,Long id) {
|
||||
validator.getUserIdFromToken(request);
|
||||
applicationEvaluationDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ApplicationEvaluationResponse updateApplicationEvaluationStatus(HttpServletRequest request, Long assignedApplicationId) {
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationEvaluationEntity validateApplicationEvaluation(Long applicationEvaluationId) {
|
||||
return applicationEvaluationDao.validateApplicationEvaluation(applicationEvaluationId);
|
||||
}
|
||||
}
|
||||
@@ -56,8 +56,8 @@ public class ApplicationServiceImpl implements ApplicationService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationEntity validateApplication(Long id) {
|
||||
return applicationDao.validateApplication(id);
|
||||
public ApplicationEntity validateApplication(Long applicationId) {
|
||||
return applicationDao.validateApplication(applicationId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.gepafin.tendermanagement.service.impl;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.dao.AssignedApplicationsDao;
|
||||
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
||||
@@ -54,4 +55,9 @@ public class AssignedApplicationsServiceImpl implements AssignedApplicationsServ
|
||||
return assignedApplicationsDao.getAssignedApplicationById(request, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AssignedApplicationsEntity validateAssignedApplication(Long assignedApplicationId) {
|
||||
return assignedApplicationsDao.validateAssignedApplication(assignedApplicationId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package net.gepafin.tendermanagement.service.impl;
|
||||
|
||||
import net.gepafin.tendermanagement.dao.CommunicationDao;
|
||||
import net.gepafin.tendermanagement.model.request.CommunicationRequestBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse;
|
||||
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
|
||||
import net.gepafin.tendermanagement.service.CommunicationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
@Service
|
||||
public class CommunicationServiceImpl implements CommunicationService {
|
||||
|
||||
@Autowired
|
||||
CommunicationDao communicationDao;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationRequestBean, Long amendmentId) {
|
||||
|
||||
return communicationDao.addCommentToAmendmentRequest(communicationRequestBean, amendmentId);
|
||||
}
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String deleteComment(Long amendmentId, Long commentId) {
|
||||
|
||||
return communicationDao.deleteComment(amendmentId, commentId);
|
||||
}
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CommunicationResponseBean updateAmendmentComment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId) {
|
||||
|
||||
return communicationDao.updateAmendmentComment(communicationRequestBean, amendmentId, commentId);
|
||||
}
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public ApplicationAmendmentResponse getAmendmentComments(Long id) {
|
||||
|
||||
return communicationDao.getAmendmentComments(id);
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public class S3ReUploadMigrationService {
|
||||
File localFile = downloadFileFromS3(oldUrl);
|
||||
String newKey = generateNewS3Path(document); // Make sure this generates the correct new path
|
||||
String uploadedPath = uploadFileToNewBucket(localFile, newKey);
|
||||
updateDocumentPathAndDeleteOldEntry(document, uploadedPath);
|
||||
updateDocumentPathAndNameEntry(document, uploadedPath);
|
||||
} catch (Exception e) {
|
||||
log.error("Error processing document {}: {}", document.getId(), e.getMessage());
|
||||
}
|
||||
@@ -178,20 +178,12 @@ public class S3ReUploadMigrationService {
|
||||
}
|
||||
|
||||
|
||||
private void updateDocumentPathAndDeleteOldEntry(DocumentEntity document, String newPath) {
|
||||
private void updateDocumentPathAndNameEntry(DocumentEntity document, String newPath) {
|
||||
|
||||
String fileName = extractFileName(newPath);
|
||||
DocumentEntity newDocument = new DocumentEntity();
|
||||
newDocument.setFilePath(newPath);
|
||||
newDocument.setSource(document.getSource());
|
||||
newDocument.setType(document.getType());
|
||||
newDocument.setIsDeleted(false);
|
||||
newDocument.setSourceId(document.getSourceId());
|
||||
newDocument.setFileName(fileName);
|
||||
|
||||
documentRepository.save(newDocument);
|
||||
documentRepository.delete(document);
|
||||
|
||||
document.setFilePath(newPath);
|
||||
document.setFileName(fileName);
|
||||
documentRepository.save(document);
|
||||
log.info("Migrated document ID: {} to new path: {}", document.getId(), newPath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,6 @@ public class UserSignedAndDelegationServiceImpl {
|
||||
|
||||
private boolean migrationCompleted = false;
|
||||
|
||||
|
||||
public String migrateUserDelegatedDocuments(String providedKey) {
|
||||
|
||||
if (migrationCompleted) {
|
||||
@@ -84,7 +83,7 @@ public class UserSignedAndDelegationServiceImpl {
|
||||
File localFile = downloadFileFromS3(oldUrl);
|
||||
String newKey = generateNewS3PathForDelegationDoc();
|
||||
String uploadedPath = uploadFileToNewBucket(localFile, newKey);
|
||||
updateDelegatedDocumentPathAndDeleteOldEntry(document, uploadedPath);
|
||||
updateDelegatedDocumentPathAndNameEntry(document, uploadedPath);
|
||||
} catch (Exception e) {
|
||||
log.error("Error processing user designated document {}: {}", document.getId(), e.getMessage());
|
||||
}
|
||||
@@ -92,7 +91,6 @@ public class UserSignedAndDelegationServiceImpl {
|
||||
return "Migrated";
|
||||
}
|
||||
|
||||
|
||||
public String migrateUserSignedDocuments(String providedKey) {
|
||||
|
||||
if (migrationCompleted) {
|
||||
@@ -117,7 +115,7 @@ public class UserSignedAndDelegationServiceImpl {
|
||||
File localFile = downloadFileFromS3(oldUrl);
|
||||
String newKey = generateNewS3PathForUserSignedDoc(document);
|
||||
String uploadedPath = uploadFileToNewBucket(localFile, newKey);
|
||||
updateDocumentPathAndDeleteOldEntry(document, uploadedPath);
|
||||
updateDocumentPathAndNameEntry(document, uploadedPath);
|
||||
} catch (Exception e) {
|
||||
log.error("Error processing user signed document {}: {}", document.getId(), e.getMessage());
|
||||
}
|
||||
@@ -227,35 +225,21 @@ public class UserSignedAndDelegationServiceImpl {
|
||||
return path.substring(path.lastIndexOf('/') + 1);
|
||||
}
|
||||
|
||||
private void updateDocumentPathAndDeleteOldEntry(ApplicationSignedDocumentEntity document, String newPath) {
|
||||
private void updateDocumentPathAndNameEntry(ApplicationSignedDocumentEntity document, String newPath) {
|
||||
|
||||
ApplicationSignedDocumentEntity newDocument = new ApplicationSignedDocumentEntity();
|
||||
String fileName = extractFileNameFromPath(newPath);
|
||||
newDocument.setFilePath(newPath);
|
||||
newDocument.setFileName(fileName);
|
||||
newDocument.setApplication(document.getApplication());
|
||||
newDocument.setStatus("ACTIVE");
|
||||
|
||||
applicationSignedDocumentRepository.save(newDocument);
|
||||
applicationSignedDocumentRepository.delete(document);
|
||||
|
||||
document.setFilePath(newPath);
|
||||
document.setFileName(fileName);
|
||||
applicationSignedDocumentRepository.save(document);
|
||||
log.info("Migrated document ID: {} to new path: {}", document.getId(), newPath);
|
||||
}
|
||||
|
||||
private void updateDelegatedDocumentPathAndDeleteOldEntry(UserCompanyDelegationEntity document, String newPath) {
|
||||
private void updateDelegatedDocumentPathAndNameEntry(UserCompanyDelegationEntity document, String newPath) {
|
||||
|
||||
String fileName = extractFileNameFromPath(newPath);
|
||||
UserCompanyDelegationEntity newDocument = new UserCompanyDelegationEntity();
|
||||
newDocument.setFilePath(newPath);
|
||||
newDocument.setFileName(fileName);
|
||||
newDocument.setBeneficiaryId(document.getBeneficiaryId());
|
||||
newDocument.setUserId(document.getUserId());
|
||||
newDocument.setCompanyId(document.getCompanyId());
|
||||
newDocument.setStatus("ACTIVE");
|
||||
|
||||
userCompanyDelegationRepository.save(newDocument);
|
||||
userCompanyDelegationRepository.delete(document);
|
||||
|
||||
document.setFilePath(newPath);
|
||||
document.setFileName(fileName);
|
||||
userCompanyDelegationRepository.save(document);
|
||||
log.info("Migrated document ID: {} to new path: {}", document.getId(), newPath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,4 +108,12 @@ public class DateTimeUtil {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static String formatCreatedDate(LocalDateTime createdDate) {
|
||||
|
||||
if (createdDate == null) {
|
||||
return "";
|
||||
}
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
|
||||
return createdDate.format(formatter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.gepafin.tendermanagement.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Type;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -316,6 +317,23 @@ public class Utils {
|
||||
|
||||
return new StringTokenizer(header, ",").nextToken().trim();
|
||||
}
|
||||
public static <T> List<T> convertJsonToList(String json, TypeReference<List<T>> typeRef) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
return objectMapper.readValue(json, typeRef);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
public static String convertObjectToJson(Object obj) {
|
||||
try {
|
||||
if(obj == null){return null;}
|
||||
return new ObjectMapper().writeValueAsString(obj);
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Failed to convert object to JSON: {}", e.getMessage(), e);
|
||||
throw new RuntimeException("Failed to convert object to JSON", e);}}
|
||||
|
||||
public static String replaceSpacesWithUnderscores(String content) {
|
||||
if (content == null) {
|
||||
|
||||
@@ -135,11 +135,10 @@ public class Validator {
|
||||
return requestedUser;
|
||||
}
|
||||
|
||||
private Long getUserIdFromToken(HttpServletRequest request) {
|
||||
public Long getUserIdFromToken(HttpServletRequest request) {
|
||||
Map<String, Object> userInfo= tokenProvider.getUserInfoAndUserIdFromToken(request);
|
||||
return Long.parseLong(userInfo.get("userId").toString());
|
||||
}
|
||||
|
||||
public CallEntity validateUserWithCall(UserEntity user, Long callId) {
|
||||
CallEntity callEntity = callService.validateCall(callId);
|
||||
if(Boolean.FALSE.equals(user.getHub().getId().equals(callEntity.getHub().getId()))) {
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package net.gepafin.tendermanagement.web.rest.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Validated
|
||||
public interface ApplicationAmendmentRequestApi {
|
||||
@Operation(summary = "Api to get application data for the Amendment 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 = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@GetMapping(value = "applicationEvaluation/{id}", produces = "application/json")
|
||||
ResponseEntity<Response<ApplicationAmendmentRequestResponse>> getApplicationDataForAmendment(HttpServletRequest request, @Parameter(description = "The Application Evaluation id", required = true) @PathVariable(value = "id", required = true) Long applicationEvaluationId);
|
||||
|
||||
@Operation(summary = "Api to submit the application data for the Amendment",
|
||||
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 = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@PostMapping(value = "", produces = "application/json")
|
||||
ResponseEntity<Response<ApplicationAmendmentRequestResponse>> createApplicationAmendmentRequest(HttpServletRequest request,
|
||||
@Parameter(description = "Application Evaluation Id", required = true) @RequestParam Long applicationEvaluationId,
|
||||
@Valid @RequestBody ApplicationAmendmentRequest applicationAmendmentRequest);
|
||||
|
||||
@Operation(summary = "Api to delete application amendment request",
|
||||
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 = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@DeleteMapping(value = "/{id}")
|
||||
ResponseEntity<Response<Void>> deleteApplicationAmendmentRequest(HttpServletRequest request,
|
||||
@Parameter(description = "The application Amendment id", required = true) @PathVariable("id") Long id);
|
||||
|
||||
@Operation(summary = "Api to get an application amendment by id",
|
||||
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 = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@GetMapping(value = "", produces = "application/json")
|
||||
ResponseEntity<Response<ApplicationAmendmentRequestResponse>> getApplicationAmendmentRequestById(HttpServletRequest request,@Parameter(description = "The application amendment id", required = true) @RequestParam(value = "id", required = true) Long id);
|
||||
|
||||
@Operation(summary = "Api to get all applications amendment request",
|
||||
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 = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@GetMapping(value = "/user/{id}", produces = "application/json")
|
||||
ResponseEntity<Response<List<ApplicationAmendmentRequestResponse>>> getAllApplicationAmendmentRequest(HttpServletRequest request,
|
||||
@Parameter(description = "The User ID", required = false) @PathVariable(value = "id",required = false) Long userId);
|
||||
|
||||
@Operation(summary = "Api to update application amendment",
|
||||
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 = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) }))
|
||||
})
|
||||
@PutMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Response<ApplicationAmendmentRequestResponse>> updateApplicationAmendment(HttpServletRequest request,
|
||||
@Parameter(description = "The Application Amendment id", required = true) @PathVariable("id") Long id,
|
||||
@Parameter(description = "Assigned Application request object", required = true) @Valid @RequestBody ApplicationAmendmentRequestBean applicationAmendmentRequestBean);
|
||||
|
||||
@Operation(summary = "Api to get all applications amendment request by beneficary user Id",
|
||||
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 = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@GetMapping(value = "/beneficiary/{id}", produces = "application/json")
|
||||
ResponseEntity<Response<List<ApplicationAmendmentRequestResponse>>> getAllAmendmentRequestByBeneficiaryId(HttpServletRequest request,
|
||||
@Parameter(description = "Id", required = false) @PathVariable(value = "id",required = false) Long beneficiaryId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package net.gepafin.tendermanagement.web.rest.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
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.model.request.ApplicationEvaluationRequest;
|
||||
import net.gepafin.tendermanagement.model.request.UpdateApplicationEvaluationRequest;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ApplicationEvaluationApi {
|
||||
|
||||
@Operation(summary = "API to create or update ApplicationEvaluation",
|
||||
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) }))
|
||||
})
|
||||
@PutMapping(value = "/{assignedApplicationsId}", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Response<ApplicationEvaluationResponse>> createOrUpdateApplicationEvaluation(
|
||||
HttpServletRequest request,
|
||||
@Parameter(required = true) @PathVariable("assignedApplicationsId") Long assignedApplicationsId,
|
||||
@Parameter( required = true) @Valid @RequestBody ApplicationEvaluationRequest evaluationRequest);
|
||||
|
||||
@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) }))
|
||||
})
|
||||
@GetMapping(value = "/application", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Response<List<ApplicationEvaluationResponse>>> getApplicationEvaluationByApplicationId(
|
||||
HttpServletRequest request,
|
||||
@Parameter(required = false) @RequestParam(value = "applicationId", required = false) Long applicationId,
|
||||
@Parameter(required = false) @RequestParam(value = "assignedApplicationId", required = false) Long assignedApplicationId);
|
||||
|
||||
@Operation(summary = "API to delete ApplicationEvaluation",
|
||||
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) }))
|
||||
})
|
||||
@DeleteMapping(value = "/{id}")
|
||||
ResponseEntity<Response<Void>> deleteApplicationEvaluation(HttpServletRequest request,
|
||||
@Parameter( required = true) @PathVariable("id") Long id);
|
||||
|
||||
@Operation(summary = "Api to update application evaluation status",
|
||||
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 = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@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);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package net.gepafin.tendermanagement.web.rest.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.model.request.CommunicationRequestBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse;
|
||||
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@Validated
|
||||
public interface CommunicationApi {
|
||||
@Operation(summary = "Api to create communication amendment comment", 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 = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@PostMapping(value = "/{amendmentId}", produces = { "application/json" })
|
||||
ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request,
|
||||
@RequestBody @Parameter CommunicationRequestBean communicationResponseBean, @Param(value = "amendmentId") Long amendmentId);
|
||||
|
||||
@Operation(summary = "API to Get Amendment Request Comment", 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 = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value =
|
||||
ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE))),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value =
|
||||
ErrorConstants.BADREQUEST_ERROR_EXAMPLE))) })
|
||||
@GetMapping(value = "/{amendmentId}", produces = "application/json")
|
||||
public ResponseEntity<Response<ApplicationAmendmentResponse>> getAmendmentComments(@PathVariable Long amendmentId);
|
||||
|
||||
@Operation(summary = "Api to update communication comments", 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 = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@PutMapping(value = "/{amendmentId}/{commentId}", produces = { "application/json" })
|
||||
ResponseEntity<Response<CommunicationResponseBean>> updateCommunicationAmendment(HttpServletRequest request,
|
||||
@RequestBody @Parameter CommunicationRequestBean communicationResponseBean, @PathVariable Long amendmentId, @PathVariable Long commentId);
|
||||
|
||||
@Operation(summary = "Api to delete communication comments", 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 = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@DeleteMapping(value = "/{amendmentId}/{commentId}", produces = { "application/json" })
|
||||
ResponseEntity<Response<String>> deleteApplicationAmendmentComment(HttpServletRequest request, @Param(value = "amendmentId") Long amendmentId,
|
||||
@Param(value = "commentId") Long commentId);
|
||||
}
|
||||
@@ -51,6 +51,8 @@ public class GlobalExceptionHandler {
|
||||
|
||||
@ExceptionHandler(ResourceNotFoundException.class)
|
||||
public ResponseEntity<Response<Void>> handleResourceNotFoundException(ResourceNotFoundException ex) {
|
||||
log.error(ex.getMessage());
|
||||
log.error(ex.getLocalizedMessage(), ex);
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND)
|
||||
.body(new Response<>(null, ex.getStatus(), ex.getMessage()));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService;
|
||||
import net.gepafin.tendermanagement.web.rest.api.ApplicationAmendmentRequestApi;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("${openapi.gepafin.base-path:/v1/amendments}")
|
||||
@Log4j2
|
||||
public class ApplicationAmendmentRequestController implements ApplicationAmendmentRequestApi {
|
||||
|
||||
@Autowired
|
||||
ApplicationAmendmentRequestService applicationAmendmentRequestService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<ApplicationAmendmentRequestResponse>> getApplicationDataForAmendment(HttpServletRequest request, Long applicationEvaluationId) {
|
||||
ApplicationAmendmentRequestResponse applicationAmendmentBean = applicationAmendmentRequestService.getApplicationDataForAmendment(request,applicationEvaluationId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(applicationAmendmentBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.APPLICATION_DATA_FOR_AMENDMENT_SUCCESS_MSG)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<ApplicationAmendmentRequestResponse>> createApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId, ApplicationAmendmentRequest applicationAmendmentRequest) {
|
||||
ApplicationAmendmentRequestResponse applicationAmendmentRequestResponse = applicationAmendmentRequestService.createApplicationAmendmentRequest(request,applicationEvaluationId,applicationAmendmentRequest);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(applicationAmendmentRequestResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.CREATE_APPLICATION_DATA_FOR_AMENDMENT_MSG)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<Void>> deleteApplicationAmendmentRequest(HttpServletRequest request, Long id) {
|
||||
log.info("Delete Application Amendment Request- Application Amendment ID: {}", id);
|
||||
applicationAmendmentRequestService.deleteApplicationAmendmentRequest(request,id);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.DELETE_APPLICATION_AMENDMENT_SUCCESS_MSG)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<ApplicationAmendmentRequestResponse>> getApplicationAmendmentRequestById(HttpServletRequest request,Long id) {
|
||||
log.info("Get Application Amendment Request By Id");
|
||||
ApplicationAmendmentRequestResponse applicationAmendmentRequestResponse = applicationAmendmentRequestService.getApplicationAmendmentRequestById(request,id);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(applicationAmendmentRequestResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_AMENDMENT_SUCCESS_MSG)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<List<ApplicationAmendmentRequestResponse>>> getAllApplicationAmendmentRequest(HttpServletRequest request,Long userId) {
|
||||
log.info("Get All Applications Amendment Request");
|
||||
List<ApplicationAmendmentRequestResponse> applicationAmendmentRequestResponses = applicationAmendmentRequestService.getAllApplicationAmendmentRequest(request,userId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(applicationAmendmentRequestResponses, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_AMENDMENT_SUCCESS_MSG)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<ApplicationAmendmentRequestResponse>> updateApplicationAmendment(HttpServletRequest request, Long id, ApplicationAmendmentRequestBean applicationAmendmentRequestBean) {
|
||||
log.info("Update Application Amendment");
|
||||
ApplicationAmendmentRequestResponse updateApplicationAmendment = applicationAmendmentRequestService.updateApplicationAmendment(request, id, applicationAmendmentRequestBean);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(updateApplicationAmendment, Status.SUCCESS, Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_UPDATE_SUCCESSFULLY_MSG)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<List<ApplicationAmendmentRequestResponse>>> getAllAmendmentRequestByBeneficiaryId(HttpServletRequest request, Long beneficiaryId) {
|
||||
log.info("Get All Application Amendment Request By Beneficiary ID");
|
||||
List<ApplicationAmendmentRequestResponse> applicationAmendmentRequestResponseList = applicationAmendmentRequestService.getAllAmendmentRequestByBeneficiaryId(request, beneficiaryId);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(applicationAmendmentRequestResponseList, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_AMENDMENT_SUCCESS_MSG)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
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.model.request.ApplicationEvaluationRequest;
|
||||
import net.gepafin.tendermanagement.model.request.UpdateApplicationEvaluationRequest;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.service.ApplicationEvaluationService;
|
||||
import net.gepafin.tendermanagement.web.rest.api.ApplicationEvaluationApi;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("${openapi.gepafin.base-path:/v1/applicationEvaluation}")
|
||||
public class ApplicationEvaluationApiController implements ApplicationEvaluationApi {
|
||||
|
||||
@Autowired
|
||||
private ApplicationEvaluationService applicationEvaluationService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<ApplicationEvaluationResponse>> createOrUpdateApplicationEvaluation(HttpServletRequest request,
|
||||
Long assignedApplicationsId,ApplicationEvaluationRequest evaluationRequest) {
|
||||
ApplicationEvaluationResponse response = applicationEvaluationService.createOrUpdateApplicationEvaluation(request,evaluationRequest,assignedApplicationsId);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_CREATED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<List<ApplicationEvaluationResponse>>> getApplicationEvaluationByApplicationId(
|
||||
HttpServletRequest request, Long applicationId, Long assignedApplicationId) {
|
||||
|
||||
List<ApplicationEvaluationResponse> responseList =
|
||||
applicationEvaluationService.getApplicationEvaluationByApplicationId(request, applicationId, assignedApplicationId);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(responseList, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FETCHED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<Void>> deleteApplicationEvaluation(HttpServletRequest request,
|
||||
Long id) {
|
||||
applicationEvaluationService.deleteApplicationEvaluation(request,id);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_DELETED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<ApplicationEvaluationResponse>> updateApplicationEvaluationStatus(HttpServletRequest request, Long assignedApplicationId) {
|
||||
ApplicationEvaluationResponse applicationEvaluationResponse = applicationEvaluationService.updateApplicationEvaluationStatus(request, assignedApplicationId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(applicationEvaluationResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.APPLICATION_EVALUATION_STATUS_UPDATED_SUCCESSFULLY)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.model.request.CommunicationRequestBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse;
|
||||
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.service.CommunicationService;
|
||||
import net.gepafin.tendermanagement.web.rest.api.CommunicationApi;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("${openapi.gepafin.base-path:/v1/communication}")
|
||||
public class CommunicationController implements CommunicationApi {
|
||||
|
||||
@Autowired
|
||||
CommunicationService communicationService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request, CommunicationRequestBean communicationRequestBean,
|
||||
Long amendmentId) {
|
||||
|
||||
CommunicationResponseBean communicationResponseBean = communicationService.addCommentToAmendmentRequest(communicationRequestBean, amendmentId);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMUNICATION_ADDED_TO_AMENDMENT_REQUEST_SUCCESS)));
|
||||
}
|
||||
@Override
|
||||
public ResponseEntity<Response<ApplicationAmendmentResponse>> getAmendmentComments(Long amendmentId) {
|
||||
|
||||
ApplicationAmendmentResponse response = communicationService.getAmendmentComments(amendmentId);
|
||||
return ResponseEntity.ok(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.AMENDMENT_FOUND_SUCCESS)));
|
||||
}
|
||||
@Override
|
||||
public ResponseEntity<Response<CommunicationResponseBean>> updateCommunicationAmendment(HttpServletRequest request, CommunicationRequestBean communicationRequestBean,
|
||||
Long amendmentId, Long commentId) {
|
||||
|
||||
CommunicationResponseBean communicationResponseBean = communicationService.updateAmendmentComment(communicationRequestBean, amendmentId, commentId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMENT_UPDATED_SUCCESS_MSG)));
|
||||
}
|
||||
@Override
|
||||
public ResponseEntity<Response<String>> deleteApplicationAmendmentComment(HttpServletRequest request, Long applicationAmendId, Long commentId) {
|
||||
|
||||
String communicationResponseBean = communicationService.deleteComment(applicationAmendId, commentId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMENT_DELETED_SUCCESS_MSG)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -60,3 +60,5 @@ mailGun_base_url=https://api.eu.mailgun.net/
|
||||
apiKey=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
|
||||
#senderEmail=mailer@bflows.net
|
||||
|
||||
application.amendment.expiration.days=30
|
||||
|
||||
|
||||
@@ -1336,20 +1336,20 @@
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="19-10-2024_2" author="Harish Bagora">
|
||||
<modifyDataType tableName="protocol" columnName="HUB_ID" newDataType="INTEGER"/>
|
||||
<modifyDataType tableName="protocol" columnName="HUB_ID" newDataType="INTEGER"/>
|
||||
|
||||
<addForeignKeyConstraint baseTableName="protocol"
|
||||
baseColumnNames="HUB_ID"
|
||||
constraintName="fk_protocol_hub"
|
||||
referencedTableName="hub"
|
||||
referencedColumnNames="id"/>
|
||||
</changeSet>
|
||||
<addForeignKeyConstraint baseTableName="protocol"
|
||||
baseColumnNames="HUB_ID"
|
||||
constraintName="fk_protocol_hub"
|
||||
referencedTableName="hub"
|
||||
referencedColumnNames="id"/>
|
||||
</changeSet>
|
||||
|
||||
|
||||
<changeSet id="24-10-2024_1" author="Rajesh Khore">
|
||||
<dropUniqueConstraint
|
||||
constraintName="company_vat_number_key"
|
||||
tableName="company"/>
|
||||
constraintName="company_vat_number_key"
|
||||
tableName="company"/>
|
||||
|
||||
<addColumn tableName="company">
|
||||
<column name="hub_id" type="INTEGER" defaultValue="1">
|
||||
@@ -1358,23 +1358,23 @@
|
||||
</addColumn>
|
||||
|
||||
<addUniqueConstraint
|
||||
columnNames="VAT_NUMBER, hub_id"
|
||||
tableName="company"
|
||||
constraintName="uk_vat_hub" />
|
||||
columnNames="VAT_NUMBER, hub_id"
|
||||
tableName="company"
|
||||
constraintName="uk_vat_hub"/>
|
||||
|
||||
<addForeignKeyConstraint
|
||||
baseTableName="company"
|
||||
baseColumnNames="hub_id"
|
||||
referencedTableName="hub"
|
||||
referencedColumnNames="id"
|
||||
constraintName="fk_company_hub" />
|
||||
baseTableName="company"
|
||||
baseColumnNames="hub_id"
|
||||
referencedTableName="hub"
|
||||
referencedColumnNames="id"
|
||||
constraintName="fk_company_hub"/>
|
||||
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="24-10-2024_2" author="Rajesh Khore">
|
||||
<dropUniqueConstraint
|
||||
constraintName="beneficiary_codice_fiscale_key"
|
||||
tableName="beneficiary"/>
|
||||
constraintName="beneficiary_codice_fiscale_key"
|
||||
tableName="beneficiary"/>
|
||||
|
||||
<addColumn tableName="beneficiary">
|
||||
<column name="hub_id" type="INTEGER" defaultValue="1">
|
||||
@@ -1383,16 +1383,16 @@
|
||||
</addColumn>
|
||||
|
||||
<addUniqueConstraint
|
||||
columnNames="CODICE_FISCALE, hub_id"
|
||||
tableName="beneficiary"
|
||||
constraintName="uk_codice_hub" />
|
||||
columnNames="CODICE_FISCALE, hub_id"
|
||||
tableName="beneficiary"
|
||||
constraintName="uk_codice_hub"/>
|
||||
|
||||
<addForeignKeyConstraint
|
||||
baseTableName="beneficiary"
|
||||
baseColumnNames="hub_id"
|
||||
referencedTableName="hub"
|
||||
referencedColumnNames="id"
|
||||
constraintName="fk_beneficiary_hub" />
|
||||
baseTableName="beneficiary"
|
||||
baseColumnNames="hub_id"
|
||||
referencedTableName="hub"
|
||||
referencedColumnNames="id"
|
||||
constraintName="fk_beneficiary_hub"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="24-10-2024_3" author="Rajesh Khore">
|
||||
@@ -1403,11 +1403,11 @@
|
||||
</addColumn>
|
||||
|
||||
<addForeignKeyConstraint
|
||||
baseTableName="application"
|
||||
baseColumnNames="hub_id"
|
||||
referencedTableName="hub"
|
||||
referencedColumnNames="id"
|
||||
constraintName="fk_application_hub" />
|
||||
baseTableName="application"
|
||||
baseColumnNames="hub_id"
|
||||
referencedTableName="hub"
|
||||
referencedColumnNames="id"
|
||||
constraintName="fk_application_hub"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="25-10-2024_1" author="Piyush">
|
||||
@@ -1443,7 +1443,7 @@
|
||||
<column name="bucket_name" value="mementoresources"/>
|
||||
<column name="created_date" value="2024-10-25 03:00:00"/>
|
||||
<column name="updated_date" value="2024-10-25 03:00:00"/>
|
||||
<column name="parent_folder" value="gepafin/staging"/>
|
||||
<column name="parent_folder" value="gepafin/local"/>
|
||||
</insert>
|
||||
|
||||
<insert tableName="s3_path_configuration">
|
||||
@@ -1452,7 +1452,7 @@
|
||||
<column name="bucket_name" value="mementoresources"/>
|
||||
<column name="created_date" value="2024-10-25 03:00:00"/>
|
||||
<column name="updated_date" value="2024-10-25 03:00:00"/>
|
||||
<column name="parent_folder" value="gepafin/staging"/>
|
||||
<column name="parent_folder" value="gepafin/local"/>
|
||||
</insert>
|
||||
|
||||
<insert tableName="s3_path_configuration">
|
||||
@@ -1461,7 +1461,7 @@
|
||||
<column name="bucket_name" value="mementoresources"/>
|
||||
<column name="created_date" value="2024-10-25 03:00:00"/>
|
||||
<column name="updated_date" value="2024-10-25 03:00:00"/>
|
||||
<column name="parent_folder" value="gepafin/staging"/>
|
||||
<column name="parent_folder" value="gepafin/local"/>
|
||||
</insert>
|
||||
|
||||
<insert tableName="s3_path_configuration">
|
||||
@@ -1470,7 +1470,7 @@
|
||||
<column name="bucket_name" value="mementoresources"/>
|
||||
<column name="created_date" value="2024-10-25 03:00:00"/>
|
||||
<column name="updated_date" value="2024-10-25 03:00:00"/>
|
||||
<column name="parent_folder" value="gepafin/staging"/>
|
||||
<column name="parent_folder" value="gepafin/local"/>
|
||||
</insert>
|
||||
|
||||
<insert tableName="s3_path_configuration">
|
||||
@@ -1479,10 +1479,171 @@
|
||||
<column name="bucket_name" value="mementoresources"/>
|
||||
<column name="created_date" value="2024-10-25 03:00:00"/>
|
||||
<column name="updated_date" value="2024-10-25 03:00:00"/>
|
||||
<column name="parent_folder" value="gepafin/staging"/>
|
||||
<column name="parent_folder" value="gepafin/local"/>
|
||||
</insert>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="26-10-2024_1" author="Harish Bagora">
|
||||
<createTable tableName="application_evaluation">
|
||||
<column autoIncrement="true" name="id" type="INTEGER">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="application_evaluation_pkey"/>
|
||||
</column>
|
||||
<column name="assigned_applications_id" type="INTEGER">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="application_id" type="INTEGER">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="user_id" type="INTEGER">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="criteria" type="TEXT">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
<column name="checklist" type="TEXT">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
<column name="file" type="TEXT">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
<column name="note" type="TEXT">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
<column name="status" type="VARCHAR(255)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
</createTable>
|
||||
|
||||
<addForeignKeyConstraint
|
||||
baseTableName="application_evaluation"
|
||||
baseColumnNames="user_id"
|
||||
referencedTableName="gepafin_user"
|
||||
referencedColumnNames="id"
|
||||
constraintName="fk_application_evaluation_gepafin_user"
|
||||
onDelete="CASCADE"/>
|
||||
<addForeignKeyConstraint
|
||||
baseTableName="application_evaluation"
|
||||
baseColumnNames="assigned_applications_id"
|
||||
referencedTableName="assigned_applications"
|
||||
referencedColumnNames="id"
|
||||
constraintName="fk_application_evaluation_assigned_applications"
|
||||
onDelete="CASCADE"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="27-10-2024_1" author="Rajesh Khore">
|
||||
<createTable tableName="application_amendment_request">
|
||||
<column autoIncrement="true" name="id" type="INTEGER">
|
||||
<constraints nullable="false" primaryKey="true"
|
||||
primaryKeyName="pk_application_amendment_request"/>
|
||||
</column>
|
||||
|
||||
<column name="note" type="TEXT">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
|
||||
<column name="response_days" type="INTEGER">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
|
||||
<column name="is_notification" type="BOOLEAN">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
|
||||
<column name="is_email" type="BOOLEAN">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
|
||||
<column name="form_fields" type="TEXT">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
|
||||
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
|
||||
<column name="application_id" type="INTEGER">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
|
||||
<column name="application_evaluation_id" type="INTEGER">
|
||||
<constraints nullable="false"
|
||||
foreignKeyName="fk_application_evaluation_application_amendment_request"
|
||||
references="application_evaluation(id)"/>
|
||||
</column>
|
||||
|
||||
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="28-10-2024_1" author="Piyush">
|
||||
<createTable tableName="communication">
|
||||
<column autoIncrement="true" name="id" type="INTEGER">
|
||||
<constraints nullable="false" primaryKey="true"
|
||||
primaryKeyName="pk_communication"/>
|
||||
</column>
|
||||
|
||||
<column name="communication_title" type="TEXT">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
|
||||
<column name="communication_comment" type="TEXT">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
|
||||
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
|
||||
<column name="commented_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
|
||||
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||
|
||||
<column name="amendment_id" type="INTEGER">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
</createTable>
|
||||
<!-- Add foreign key constraint between communication and application_amendment_request -->
|
||||
<addForeignKeyConstraint baseTableName="communication"
|
||||
baseColumnNames="amendment_id"
|
||||
referencedTableName="application_amendment_request"
|
||||
referencedColumnNames="id"
|
||||
constraintName="fk_communication_application_amendment_request"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="28-10-2024_2" author="Piyush">
|
||||
<sqlFile dbms="postgresql"
|
||||
path="db/dump/insert_system_email_template_for_notification_mail_27_10_2024.sql"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="28-10-2024_3" author="Rajesh Khore">
|
||||
<addColumn tableName="application_amendment_request">
|
||||
<column name="protocol_id" type="INTEGER"/>
|
||||
</addColumn>
|
||||
|
||||
<addForeignKeyConstraint
|
||||
baseTableName="application_amendment_request"
|
||||
baseColumnNames="protocol_id"
|
||||
referencedTableName="protocol"
|
||||
referencedColumnNames="id"
|
||||
constraintName="fk_application_amendment_request_protocol"/>
|
||||
</changeSet>
|
||||
|
||||
|
||||
</databaseChangeLog>
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
INSERT INTO gepafin_schema.system_email_template
|
||||
(
|
||||
id, template_name, "type", html_content, subject, "json", "system",
|
||||
is_deleted, created_date, updated_date
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
3,
|
||||
'Instructional Aid/Request for Documentation Integration Template',
|
||||
'DOCUMENTATION_INTEGRATION_REQUEST',
|
||||
'<html>
|
||||
<body style="font-family: Arial, sans-serif; color: #000; line-height: 1.6;">
|
||||
<div style="padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;">
|
||||
<p><strong>RICHIESTA INTEGRAZIONE DOCUMENTALE</strong></p>
|
||||
<p>Buongiorno,</p>
|
||||
<p>In riferimento alla domanda di concessione di Finanziamento agevolato a valere sul Fondo prestiti
|
||||
<strong>{{call_name}}</strong> di cui al <strong>Protocollo n. {{protocol_number}} del
|
||||
{{protocol_date}} e {{protocol_time}}</strong>, alla luce dell’attività istruttoria svolta,
|
||||
segnaliamo quanto segue:</p>
|
||||
<ul>
|
||||
<li>{{form_dataInput}}</li>
|
||||
</ul>
|
||||
<p>Vi invitiamo a fornire quanto sopra richiesto integrando la documentazione sia caricandola all’interno dello sportello
|
||||
online <a href="https://bandi.gepafin.it/">https://bandi.gepafin.it/</a> che inviandola a mezzo PEC all’indirizzo
|
||||
bandi.gepafin@legalmail.it entro e <strong>non oltre 10 giorni</strong> dal ricevimento della presente comunicazione,
|
||||
precisando che, in caso di mancata ricezione nei termini indicati, saremo costretti a non prendere in considerazione la Vostra richiesta di finanziamento.</p>
|
||||
<p>Vi informiamo che per la ricezione della PEC farà fede la ricevuta di avvenuta consegna che attesterà il buon esito
|
||||
dell’invio. La documentazione trasmessa e le informazioni fornite saranno processate dall''istruttore assegnatario della pratica.</p>
|
||||
<p>Distinti Saluti,</p>
|
||||
<p><strong>Gepafin S.p.a.</strong></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>',
|
||||
'BANDO {{call_name}} - Domanda di concessione di finanziamento agevolato {{company_name}}',
|
||||
NULL,
|
||||
true,
|
||||
false,
|
||||
'2024-10-26 20:00:00',
|
||||
'2024-10-26 20:00:00'
|
||||
);
|
||||
INSERT INTO gepafin_schema.system_email_template
|
||||
(
|
||||
id, template_name, "type", html_content, subject, "json", "system",
|
||||
is_deleted, created_date, updated_date
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
4,
|
||||
'Notification of Inadmissibility Due to Failure to Respond Template',
|
||||
'INADMISSIBILITY_NOTIFICATION',
|
||||
'<html>
|
||||
<body style="font-family: Arial, sans-serif; color: #000; line-height: 1.6;">
|
||||
<div style="padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;">
|
||||
<p><strong>Comunicazione di non ammissibilità per mancata risposta a richiesta integrazione documentale</strong></p>
|
||||
<p>Buongiorno,</p>
|
||||
<p>Con posta elettronica certificata del <strong>{{date_time_emailSend}}</strong>, vi abbiamo comunicato che i documenti richiesti
|
||||
dal Gestore sarebbero dovuti pervenire entro <strong>10 giorni</strong> dal ricevimento di detta comunicazione.
|
||||
Trascorso il termine senza la ricezione dei documenti richiesti, il Gestore non ha potuto prendere in considerazione la richiesta di finanziamento.</p>
|
||||
<p>È possibile presentare ricorso tramite modello disponibile nello sportello online
|
||||
<a href="https://bandi.gepafin.it/">https://bandi.gepafin.it/</a> entro <strong>10 giorni</strong> dalla ricezione di questa comunicazione.</p>
|
||||
<p>Distinti Saluti,</p>
|
||||
<p><strong>Gepafin S.p.a.</strong></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>',
|
||||
'BANDO {{call_name}} - Domanda di finanziamento agevolato non ammessa {{company_name}}',
|
||||
NULL,
|
||||
true,
|
||||
false,
|
||||
'2024-10-26 20:00:00',
|
||||
'2024-10-26 20:00:00'
|
||||
);
|
||||
INSERT INTO gepafin_schema.system_email_template
|
||||
(
|
||||
id, template_name, "type", html_content, subject, "json", "system",
|
||||
is_deleted, created_date, updated_date
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
5,
|
||||
'Notification of Admissibility Template',
|
||||
'ADMISSIBILITY_NOTIFICATION',
|
||||
'<html>
|
||||
<body style="font-family: Arial, sans-serif; color: #000; line-height: 1.6;">
|
||||
<div style="padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;">
|
||||
<p>Buongiorno,</p>
|
||||
<p>In riferimento alla domanda di concessione di Finanziamento agevolato “<strong>{{call_name}}</strong>” di cui al
|
||||
<strong>Protocollo n. {{protocol_number}} del {{protocol_date}} alle {{protocol_time}}</strong>, l’istruttoria di ammissibilità
|
||||
è stata completata con esito positivo.</p>
|
||||
<p>Seguirà una comunicazione relativa alla valutazione tecnica ed economico-finanziaria ai fini della valutazione finale.</p>
|
||||
<p>Distinti Saluti,</p>
|
||||
<p><strong>Gepafin S.p.a.</strong></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>',
|
||||
'BANDO {{call_name}} – Esito positivo istruttoria di ammissibilità {{company_name}}',
|
||||
NULL,
|
||||
true,
|
||||
false,
|
||||
'2024-10-26 20:00:00',
|
||||
'2024-10-26 20:00:00'
|
||||
);
|
||||
INSERT INTO gepafin_schema.system_email_template
|
||||
(
|
||||
id, template_name, "type", html_content, subject, "json", "system",
|
||||
is_deleted, created_date, updated_date
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
6,
|
||||
'Notification of Inadmissibility Template',
|
||||
'INADMISSIBILITY_NOTIFICATION',
|
||||
'<html>
|
||||
<body style="font-family: Arial, sans-serif; color: #000; line-height: 1.6;">
|
||||
<div style="padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;">
|
||||
<p>Buongiorno,</p>
|
||||
<p>In riferimento alla domanda di concessione di Finanziamento agevolato “<strong>{{call_name}}</strong>” di cui al
|
||||
<strong>Protocollo n. {{protocol_number}} del {{protocol_date}} alle {{protocol_time}}</strong>,
|
||||
l''istruttoria di ammissibilità è stata completata con esito negativo.</p>
|
||||
<p>Motivazioni: <strong>{{form_text}}</strong></p>
|
||||
<p>È possibile presentare ricorso tramite modello disponibile nello sportello online
|
||||
<a href="https://bandi.gepafin.it/">https://bandi.gepafin.it/</a> entro <strong>10 giorni</strong> dalla ricezione di questa comunicazione.</p>
|
||||
<p>Distinti Saluti,</p>
|
||||
<p><strong>Gepafin S.p.a.</strong></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>',
|
||||
'BANDO {{call_name}} – Esito negativo istruttoria di ammissibilità {{company_name}}',
|
||||
NULL,
|
||||
true,
|
||||
false,
|
||||
'2024-10-26 20:00:00',
|
||||
'2024-10-26 20:00:00'
|
||||
);
|
||||
@@ -253,8 +253,16 @@ get_login_attempt_se_msg=Login attempts fetched successfully.
|
||||
application.in.submit.status.cannot.delete.company=The company cannot be deleted because there are active applications in the SUBMITTED status.
|
||||
get.users.success.msg = Successfully fetched users.
|
||||
cannot.create.beneficiary.user = Creation of a Beneficiary user is not allowed. Please assign the appropriate role.
|
||||
application.evaluation.not.found=Application Evaluation not found with ID: {0}
|
||||
evaluation.created.successfully = Application evaluation created successfully.
|
||||
evaluation.updated.successfully = Application evaluation updated successfully.
|
||||
evaluation.fetched.successfully = Application evaluation fetched successfully.
|
||||
evaluation.deleted.successfully = Application evaluation deleted successfully.
|
||||
evaluations.fetched.successfully = All application evaluations fetched successfully.
|
||||
application.evaluation.status.updated.successfully=Application evaluation status updated successfully.
|
||||
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.
|
||||
|
||||
# Hub Messages
|
||||
hub_create_success=Hub created successfully
|
||||
@@ -276,3 +284,19 @@ assigned.application.get.success=Assigned Application details fetched successful
|
||||
assigned.application.update.successfully=Assigned Application updated successfully.
|
||||
get.error.s3=Failed to fetch the file from S3.
|
||||
invalid.application.status = Invalid Application status.
|
||||
|
||||
application.data.amendment.success = Successfully retrieved the application data for the amendment process.
|
||||
delete.application.amendment.success = Application Amendment successfully deleted.
|
||||
create.application.data.amendment.msg = Application amendment submited succesfully.
|
||||
application.amendment.not.found = Application Amendment Request not found with the given ID.
|
||||
application.amendment.get.success = Application Amendment details fetched successfully with given ID.
|
||||
application.amendment.update.successfully = Application Amendment Updated Successfully.
|
||||
|
||||
added.comment.to.amendment.request.success = Application Amendment Comment Added Successfully.;
|
||||
comment.not.found = Comment Not Found.";
|
||||
comment.updated.successfully = Comment Updated Successfully.";
|
||||
comment.deleted.successfully = Comment Deleted Successfully.";
|
||||
comment.not.associate.with.amendment = Comment Not Associated with Amendment Request.";
|
||||
amendment.found.success = Amendment Request Found Successfully.";
|
||||
invalid.amendment.for.comment = Invalid Amendment Request for the Given Comment.";
|
||||
DD_MM_YYYY_HH_MM = DD-MM-YYYY HH:MM.";
|
||||
|
||||
@@ -252,6 +252,15 @@ get.users.success.msg = Utenti recuperati con successo
|
||||
cannot.create.beneficiary.user = La creazione di un utente beneficiario non � consentita. Si prega di assegnare il ruolo appropriato.
|
||||
evaluationCriteria.invalid=Questo criterio di valutazione non appartiene alla chiamata corrente.
|
||||
|
||||
application.evaluation.not.found=Valutazione dell'applicazione non trovata con ID: {0}
|
||||
evaluation.created.successfully = Valutazione dell'applicazione creata con successo.
|
||||
evaluation.updated.successfully = Valutazione dell'applicazione aggiornata con successo.
|
||||
evaluation.fetched.successfully = Valutazione dell'applicazione recuperata con successo.
|
||||
evaluation.deleted.successfully = Valutazione dell'applicazione eliminata con successo.
|
||||
evaluations.fetched.successfully = Tutte le valutazioni delle applicazioni recuperate con successo.
|
||||
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.
|
||||
|
||||
application.assigned.success.msg =Domanda assegnata con successo
|
||||
application.already.assigned.msg =La domanda � gi� assegnata
|
||||
@@ -271,3 +280,19 @@ hub_not_found=Hub non trovato
|
||||
|
||||
application.not.in.draft.status=La domanda non � in stato DRAFT.
|
||||
get.error.s3=Impossibile recuperare il file da S3.
|
||||
|
||||
application.data.amendment.success = Recupero riuscito dei dati dell'applicazione per il processo di modifica
|
||||
delete.application.amendment.success =Emendamento all'applicazione eliminato con successo.
|
||||
application.amendment.not.found = Richiesta di modifica dell'applicazione non trovata con l'ID indicato.
|
||||
application.amendment.get.success = Dettagli della modifica dell'applicazione recuperati correttamente con l'ID fornito.
|
||||
application.amendment.update.successfully = Emendamento all'applicazione aggiornato con successo.
|
||||
|
||||
added.comment.to.amendment.request.success = Commento aggiunto con successo alla richiesta di emendamento.
|
||||
comment.not.found = Commento non trovato.
|
||||
comment.updated.successfully = Commento aggiornato con successo.
|
||||
comment.deleted.successfully = Commento eliminato con successo.
|
||||
comment.not.associate.with.amendment = Il commento non � associato alla richiesta di emendamento.
|
||||
amendment.found.success = Richiesta di emendamento trovata con successo.
|
||||
invalid.amendment.for.comment = Richiesta di emendamento non valida per il commento fornito.
|
||||
DD_MM_YYYY_HH_MM = DD-MM-YYYY HH:MM.
|
||||
create.application.data.amendment.msg =Emendamento alla domanda inviato con successo
|
||||
|
||||
Reference in New Issue
Block a user