Updated code with communication and notification.
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 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 GET_USERS_SUCCESS_MSG = "get.users.success.msg";
|
||||||
public static final String CANNOT_CREATE_BENEFICIARY_USER="cannot.create.beneficiary.user";
|
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 APPLICATION_ASSIGNED= "application.assigned.success.msg";
|
public static final String APPLICATION_ASSIGNED= "application.assigned.success.msg";
|
||||||
public static final String APPLICATION_ALREADY_ASSIGNED = "application.already.assigned.msg";
|
public static final String APPLICATION_ALREADY_ASSIGNED = "application.already.assigned.msg";
|
||||||
@@ -261,15 +270,21 @@ public class GepafinConstant {
|
|||||||
public static final String S3_PATH_GENERATION_ERROR_MSG ="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 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 COMMUNICATION_ADDED_TO_AMENDMENT_REQUEST_SUCCESS = "added.comment.to.amendment.request.success";
|
||||||
public static final String AMENDMENT_NOT_FOUND = "amendment.not.found";
|
|
||||||
public static final String COMMENT_NOT_FOUND = "comment.not.found";
|
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_UPDATED_SUCCESS_MSG = "comment.updated.successfully";
|
||||||
public static final String COMMENT_DELETED_SUCCESS_MSG = "comment.deleted.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 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 AMENDMENT_FOUND_SUCCESS = "amendment.found.success";
|
||||||
public static final String INVALID_AMENDMENT_FOR_COMMENT = "invalid.amendment.for.comment";
|
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";
|
public static final String DD_MM_YYYY_HH_MM = "DD_MM_YYYY_HH_MM";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,326 @@
|
|||||||
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
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.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.model.response.CommunicationResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.repositories.*;
|
||||||
|
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||||
|
import net.gepafin.tendermanagement.service.UserService;
|
||||||
|
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.stereotype.Component;
|
||||||
|
|
||||||
|
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 {
|
||||||
|
@Autowired
|
||||||
|
private ApplicationService applicationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FormRepository formRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationFormRepository applicationFormRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationAmendmentRequestRepository applicationAmendmentRequestRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationFormFieldRepository applicationFormFieldRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DocumentRepository documentRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CommunicationRepository communicationRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CommunicationDao communicationDao;
|
||||||
|
|
||||||
|
public List<ApplicationAmendmentRequestResponse> getApplicationDataForAmendment(HttpServletRequest request,Long applicationId){
|
||||||
|
log.info("Fetching the application data for the Amendment process {}", applicationId);
|
||||||
|
ApplicationEntity application = applicationService.validateApplication(applicationId);
|
||||||
|
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;
|
||||||
|
|
||||||
|
List<ApplicationFormEntity> forms = applicationFormRepository.findByApplicationId(applicationId);
|
||||||
|
List<ApplicationAmendmentRequestResponse> responses = new ArrayList<>();
|
||||||
|
for (ApplicationFormEntity form : forms) {
|
||||||
|
String content = form.getForm().getContent();
|
||||||
|
List<Map<String, Object>> result = filterByName(content, "fileupload");
|
||||||
|
List<AmendmentFormFieldResponse> formFields = getIdAndLabelFromResult(result);
|
||||||
|
|
||||||
|
|
||||||
|
ApplicationAmendmentRequestResponse response = convertEntityToResponse(
|
||||||
|
protocolNumber, callName, formFields, beneficiaryName);
|
||||||
|
List<CommunicationResponseBean> communicationList = communicationRepository.findCommentsById(response.getId());
|
||||||
|
response.setCommentsList(communicationList);
|
||||||
|
responses.add(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private ApplicationAmendmentRequestResponse convertEntityToResponse(
|
||||||
|
Long protocolNumber, String callName,
|
||||||
|
List<AmendmentFormFieldResponse> formFields,String beneficiaryName) {
|
||||||
|
|
||||||
|
ApplicationAmendmentRequestResponse response = new ApplicationAmendmentRequestResponse();
|
||||||
|
response.setProtocolNumber(protocolNumber);
|
||||||
|
response.setCallName(callName);
|
||||||
|
response.setBeneficiaryName(beneficiaryName);
|
||||||
|
response.setFormFields(formFields);
|
||||||
|
response.setResponseDays(null);
|
||||||
|
response.setSendEmail(false);
|
||||||
|
response.setSendNotification(false);
|
||||||
|
response.setNote(null);
|
||||||
|
response.setStartDate(null);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 applicationId, ApplicationAmendmentRequest applicationAmendmentRequest){
|
||||||
|
log.info("Submiting application data for amendment Process with details: {}", applicationId);
|
||||||
|
|
||||||
|
ApplicationEntity applicationEntity = applicationService.validateApplication(applicationId);
|
||||||
|
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = createApplicationAmendmentRequestEntity(applicationAmendmentRequest);
|
||||||
|
ApplicationAmendmentRequestResponse applicationAmendmentRequestResponse = convertEntityToResponse(applicationAmendmentRequestEntity);
|
||||||
|
log.info("Application submitted successfully for amendment", applicationAmendmentRequestResponse);
|
||||||
|
if(!applicationAmendmentRequestResponse.isSendEmail()){
|
||||||
|
communicationDao.sendMailToNotifyBeneficiaryRegardingNewAmendment(applicationEntity);
|
||||||
|
}
|
||||||
|
return applicationAmendmentRequestResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationAmendmentRequestEntity createApplicationAmendmentRequestEntity(ApplicationAmendmentRequest applicationAmendmentRequest){
|
||||||
|
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = new ApplicationAmendmentRequestEntity();
|
||||||
|
applicationAmendmentRequestEntity.setNote(applicationAmendmentRequest.getNote());
|
||||||
|
applicationAmendmentRequestEntity.setResponseDays(applicationAmendmentRequest.getResponseDays());
|
||||||
|
|
||||||
|
if (applicationAmendmentRequest.getFormFields() != null) {
|
||||||
|
String fieldIdsString = applicationAmendmentRequest.getFormFields().stream()
|
||||||
|
.filter(AmendmentFormFieldResponse::isSelected)
|
||||||
|
.map(AmendmentFormFieldResponse::getFieldId)
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
applicationAmendmentRequestEntity.setFormFields(fieldIdsString);
|
||||||
|
}
|
||||||
|
|
||||||
|
applicationAmendmentRequestEntity.setIsEmail(false);
|
||||||
|
applicationAmendmentRequestEntity.setIsNotification(false);
|
||||||
|
ApplicationAmendmentRequestEntity applicationAmendment = saveApplicationAmendmentRequestEntity(applicationAmendmentRequestEntity);
|
||||||
|
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 = 20L;
|
||||||
|
ApplicationEntity application = applicationService.validateApplication(applicationId);
|
||||||
|
applicationAmendmentRequestResponse.setNote(applicationAmendmentRequestEntity.getNote());
|
||||||
|
applicationAmendmentRequestResponse.setResponseDays(applicationAmendmentRequestEntity.getResponseDays());
|
||||||
|
applicationAmendmentRequestResponse.setStartDate(applicationAmendmentRequestEntity.getCreatedDate());
|
||||||
|
applicationAmendmentRequestResponse.setSendEmail(applicationAmendmentRequestEntity.getIsEmail());
|
||||||
|
applicationAmendmentRequestResponse.setSendNotification(applicationAmendmentRequestEntity.getIsNotification());
|
||||||
|
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.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(formFields);
|
||||||
|
return applicationAmendmentRequestResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationAmendmentRequestEntity validateApplicationAmendmentRequest(Long id) {
|
||||||
|
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = applicationAmendmentRequestRepository.findByIdAndIsDeletedFalse(id);
|
||||||
|
if (applicationAmendmentRequestEntity == null) {
|
||||||
|
throw new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_NOT_FOUND_MSG));
|
||||||
|
} return applicationAmendmentRequestEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
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() {
|
||||||
|
List<ApplicationAmendmentRequestEntity> applicationAmendmentRequestEntities =
|
||||||
|
applicationAmendmentRequestRepository.findAll();
|
||||||
|
|
||||||
|
return applicationAmendmentRequestEntities.stream()
|
||||||
|
.map(this::convertEntityToResponse)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 boolean documentExists(String documentId) {
|
||||||
|
Long documentIdLong = Long.parseLong(documentId); // Convert to Long
|
||||||
|
return documentRepository.existsById(documentIdLong);
|
||||||
|
|
||||||
|
}
|
||||||
|
private void updateApplicationFormFields(ApplicationAmendmentRequestEntity applicationAmendment, ApplicationFormFieldRequestBean updatedFormField) {
|
||||||
|
List<String> documentIds = Arrays.asList(updatedFormField.getFieldValue().toString().split(","));
|
||||||
|
for (String documentId : documentIds) {
|
||||||
|
if (!documentExists(documentId)) {
|
||||||
|
log.warn("Document with ID {} does not exist. Skipping update.", documentId);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ApplicationFormFieldEntity formEntity = applicationFormFieldRepository.findByFieldId(updatedFormField.getFieldId());
|
||||||
|
|
||||||
|
if (formEntity != null) {
|
||||||
|
formEntity.setFieldValue(updatedFormField.getFieldValue().toString());
|
||||||
|
applicationFormFieldRepository.save(formEntity);
|
||||||
|
log.info("Updated field value for field ID {} with document IDs {}", updatedFormField.getFieldId(), updatedFormField.getFieldValue());
|
||||||
|
} else {
|
||||||
|
log.warn("No ApplicationFormEntity found with field ID {}. Skipping update.", updatedFormField.getFieldId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,852 @@
|
|||||||
|
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.ApplicationEvaluationStatusTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.DocumentTypeEnum;
|
||||||
|
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 applicationId) {
|
||||||
|
ApplicationEvaluationEntity entity = new ApplicationEvaluationEntity();
|
||||||
|
ApplicationEntity application = applicationService.validateApplication(applicationId);
|
||||||
|
AssignedApplicationsEntity assignedApplications = assignedApplicationsRepository.findByApplicationIdAndIsDeletedFalse(applicationId).orElse(null);
|
||||||
|
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());
|
||||||
|
AssignedApplicationsEntity assignedApplications = assignedApplicationsRepository.findByApplicationIdAndIsDeletedFalse(entity.getApplicationId()).orElse(null);
|
||||||
|
response.setAssignedApplicationId(assignedApplications.getId());
|
||||||
|
response.setNote(entity.getNote());
|
||||||
|
response.setStatus(ApplicationEvaluationStatusTypeEnum.valueOf(entity.getStatus()));
|
||||||
|
response.setCreatedDate(entity.getCreatedDate());
|
||||||
|
response.setUpdatedDate(entity.getUpdatedDate());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setCriteriaResponses(ApplicationEvaluationEntity entity, ApplicationEvaluationResponse response, List<EvaluationCriteriaEntity> evaluationCriterias) {
|
||||||
|
List<CriteriaResponse> criteriaResponsesFromEntity = entity.getCriteria() != null
|
||||||
|
? 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.setBeneficiary(beneficiary);
|
||||||
|
response.setMinScore(call.getThreshold());
|
||||||
|
response.setCallName(application.getCall().getName());
|
||||||
|
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 applicationId) {
|
||||||
|
Optional<ApplicationEvaluationEntity> existingEntityOptional = applicationEvaluationRepository.findByApplicationIdAndIsDeletedFalse(applicationId);
|
||||||
|
ApplicationEvaluationEntity entity;
|
||||||
|
|
||||||
|
if (existingEntityOptional.isPresent()) {
|
||||||
|
entity = existingEntityOptional.get();
|
||||||
|
entity.setCriteria(Utils.convertObjectToJson(processCriteria(entity, req)));
|
||||||
|
entity.setChecklist(Utils.convertObjectToJson(processChecklist(entity, req)));
|
||||||
|
entity.setFile(Utils.convertObjectToJson(processField(entity, req)));
|
||||||
|
entity.setIsDeleted(false);
|
||||||
|
setIfUpdated(entity::getNote, entity::setNote, req.getNote());
|
||||||
|
} else {
|
||||||
|
entity = convertToEntity(user, req,applicationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplicationEvaluationEntity savedEntity = applicationEvaluationRepository.save(entity);
|
||||||
|
return convertToResponse(savedEntity);
|
||||||
|
}
|
||||||
|
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() : existingCriteria.getScore());
|
||||||
|
request.setValid(incoming.getValid() != null ? incoming.getValid() : existingCriteria.getValid());
|
||||||
|
}
|
||||||
|
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) {
|
||||||
|
request.setValid(incoming.getValid() != null ? incoming.getValid() : existingChecklist.getValid());
|
||||||
|
}
|
||||||
|
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());
|
||||||
|
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() : existingField.getValid());
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ApplicationEvaluationEntity validateApplicationEvaluation(Long id) {
|
||||||
|
Optional<ApplicationEvaluationEntity> entityOptional = applicationEvaluationRepository.findById(id);
|
||||||
|
if (entityOptional.isEmpty()) {
|
||||||
|
throw new ResourceNotFoundException(Status.NOT_FOUND,
|
||||||
|
Translator.toLocale(GepafinConstant.APPLICATION_EVALUATION_NOT_FOUND, id));
|
||||||
|
}
|
||||||
|
return entityOptional.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ApplicationEvaluationResponse getApplicationEvaluationByApplicationId(UserEntity user, Long applicationId, Long assignedApplicationId) {
|
||||||
|
|
||||||
|
applicationService.validateApplication(applicationId);
|
||||||
|
|
||||||
|
Optional<ApplicationEvaluationEntity> entityOptional;
|
||||||
|
|
||||||
|
if (applicationId != null && assignedApplicationId != null) {
|
||||||
|
entityOptional = applicationEvaluationRepository.findByApplicationIdAndAssignedApplicationsEntity_IdAndIsDeletedFalse(applicationId, assignedApplicationId);
|
||||||
|
} else if (applicationId != null) {
|
||||||
|
entityOptional = applicationEvaluationRepository.findByApplicationIdAndIsDeletedFalse(applicationId);
|
||||||
|
} else if (assignedApplicationId != null) {
|
||||||
|
entityOptional = applicationEvaluationRepository.findByAssignedApplicationsEntity_IdAndIsDeletedFalse(assignedApplicationId);
|
||||||
|
} else {
|
||||||
|
entityOptional = applicationEvaluationRepository.findFirstByIsDeletedFalseOrderByCreatedDateDesc();
|
||||||
|
}
|
||||||
|
return entityOptional.map(this::convertToResponse)
|
||||||
|
.orElseGet(() -> {
|
||||||
|
return getEvaluationResponseByApplicationid(user, applicationId, assignedApplicationId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationEvaluationResponse getEvaluationResponseByApplicationid(UserEntity user, Long applicationId,Long assignedApplicationId) {
|
||||||
|
ApplicationEvaluationEntity entity = new ApplicationEvaluationEntity();
|
||||||
|
ApplicationEvaluationResponse response = new ApplicationEvaluationResponse();
|
||||||
|
CallEntity call=null;
|
||||||
|
AssignedApplicationsEntity assignedApplications=null;
|
||||||
|
if (applicationId != null) {
|
||||||
|
call = callRepository.findCallEntityByApplicationId(applicationId);
|
||||||
|
assignedApplications = assignedApplicationsRepository.findByApplicationIdAndIsDeletedFalse(applicationId).orElse(null);
|
||||||
|
} else if (assignedApplicationId != null) {
|
||||||
|
call = callRepository.findCallEntityByApplicationId(assignedApplicationId);
|
||||||
|
assignedApplications = assignedApplicationsRepository.findByIdAndIsDeletedFalse(assignedApplicationId).orElseThrow(()->
|
||||||
|
new ResourceNotFoundException(Status.NOT_FOUND,Translator.toLocale(GepafinConstant.ASSIGNED_APPLICATION_NOT_FOUND_MSG)));
|
||||||
|
}
|
||||||
|
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(applicationId);
|
||||||
|
response.setAssignedApplicationId(assignedApplications.getId());
|
||||||
|
response.setNote(null);
|
||||||
|
response.setStatus(ApplicationEvaluationStatusTypeEnum.valueOf(ApplicationEvaluationStatusTypeEnum.OPEN.getValue()));
|
||||||
|
response.setMinScore(call.getThreshold());
|
||||||
|
setCriteriaResponses(entity, applicationId, response, evaluationCriterias);
|
||||||
|
setChecklistResponses(entity, applicationId, response, checklistEntities);
|
||||||
|
setFileResponses(entity, applicationId, response, applicationFormEntities);
|
||||||
|
|
||||||
|
setApplicationDetails(response, applicationId, 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());
|
||||||
|
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(Long applicationId, ApplicationEvaluationStatusTypeEnum status) {
|
||||||
|
ApplicationEvaluationEntity existingEntity = validateApplicationEvaluation(applicationId);
|
||||||
|
if (status != null && !status.getValue().equals(existingEntity.getStatus())) {
|
||||||
|
existingEntity.setStatus(status.getValue());
|
||||||
|
}
|
||||||
|
ApplicationEvaluationEntity updatedEntity = applicationEvaluationRepository.save(existingEntity);
|
||||||
|
return convertToResponse(updatedEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -79,7 +79,7 @@ public class AssignedApplicationsDao {
|
|||||||
assignApplication.setApplication(application);
|
assignApplication.setApplication(application);
|
||||||
assignApplication.setAssignedBy(assignedByUser.getId());
|
assignApplication.setAssignedBy(assignedByUser.getId());
|
||||||
assignApplication.setUserId(userId);
|
assignApplication.setUserId(userId);
|
||||||
assignApplication.setStatus(AssignedApplicationEnum.ASSIGNED.getValue());
|
assignApplication.setStatus(AssignedApplicationEnum.OPEN.getValue());
|
||||||
if(assignedApplicationsRequest.getStatus() != null) {
|
if(assignedApplicationsRequest.getStatus() != null) {
|
||||||
assignApplication.setStatus(assignedApplicationsRequest.getStatus().getValue());
|
assignApplication.setStatus(assignedApplicationsRequest.getStatus().getValue());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package net.gepafin.tendermanagement.dao;
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
import net.gepafin.tendermanagement.config.Translator;
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
||||||
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||||
import net.gepafin.tendermanagement.entities.CallEntity;
|
import net.gepafin.tendermanagement.entities.CallEntity;
|
||||||
import net.gepafin.tendermanagement.entities.CommunicationEntity;
|
import net.gepafin.tendermanagement.entities.CommunicationEntity;
|
||||||
@@ -13,8 +15,14 @@ import net.gepafin.tendermanagement.model.request.CommunicationRequestBean;
|
|||||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
|
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.SystemEmailTemplateResponse;
|
import net.gepafin.tendermanagement.model.response.SystemEmailTemplateResponse;
|
||||||
|
import net.gepafin.tendermanagement.repositories.ApplicationAmendmentRequestRepository;
|
||||||
|
import net.gepafin.tendermanagement.repositories.ApplicationRepository;
|
||||||
|
import net.gepafin.tendermanagement.repositories.CallRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.CommunicationRepository;
|
import net.gepafin.tendermanagement.repositories.CommunicationRepository;
|
||||||
|
import net.gepafin.tendermanagement.repositories.CompanyRepository;
|
||||||
|
import net.gepafin.tendermanagement.repositories.UserWithCompanyRepository;
|
||||||
import net.gepafin.tendermanagement.service.SystemEmailTemplatesService;
|
import net.gepafin.tendermanagement.service.SystemEmailTemplatesService;
|
||||||
|
import net.gepafin.tendermanagement.service.UserService;
|
||||||
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
||||||
import net.gepafin.tendermanagement.util.MailUtil;
|
import net.gepafin.tendermanagement.util.MailUtil;
|
||||||
import net.gepafin.tendermanagement.util.Utils;
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
@@ -31,14 +39,14 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CommunicationAmendmentDao {
|
public class CommunicationDao {
|
||||||
private static final Logger log = LoggerFactory.getLogger(CommunicationAmendmentDao.class);
|
private static final Logger log = LoggerFactory.getLogger(CommunicationDao.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
CommunicationRepository communicationRepository;
|
CommunicationRepository communicationRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
ApplicationAmendmentRepository applicationAmendmentRepository;
|
ApplicationAmendmentRequestRepository applicationAmendmentRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MailUtil mailUtil;
|
private MailUtil mailUtil;
|
||||||
@@ -46,6 +54,13 @@ public class CommunicationAmendmentDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SystemEmailTemplatesService systemEmailTemplatesService;
|
private SystemEmailTemplatesService systemEmailTemplatesService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
UserService userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ApplicationRepository applicationRepository;
|
||||||
|
|
||||||
|
@Transactional(rollbackOn = Exception.class)
|
||||||
public CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationReq, Long amendmentId) {
|
public CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationReq, Long amendmentId) {
|
||||||
|
|
||||||
log.info("Adding communication request...");
|
log.info("Adding communication request...");
|
||||||
@@ -55,23 +70,23 @@ public class CommunicationAmendmentDao {
|
|||||||
return convertToCommunicationResponseBean(communicationEntity);
|
return convertToCommunicationResponseBean(communicationEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String deleteCommunicationAmendmentComment(Long amendmentId, Long commentId) {
|
public String deleteComment(Long amendmentId, Long commentId) {
|
||||||
|
|
||||||
CommunicationEntity data = communicationRepository.findById(commentId)
|
CommunicationEntity data = communicationRepository.findById(commentId)
|
||||||
.orElseThrow(() -> new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND)));
|
.orElseThrow(() -> new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND)));
|
||||||
if (!data.getAmendmentRequest().getId().equals(amendmentId)) {
|
if (!data.getApplicationAmendmentRequest().getId().equals(amendmentId)) {
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.INVALID_AMENDMENT_FOR_COMMENT));
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.INVALID_AMENDMENT_FOR_COMMENT));
|
||||||
}
|
}
|
||||||
communicationRepository.deleteById(commentId);
|
data.setIsDeleted(true);
|
||||||
|
communicationRepository.save(data);
|
||||||
return "Deleted Comment Successfully.";
|
return "Deleted Comment Successfully.";
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicationAmendmentResponse getAmendmentComments(Long amendmentId) {
|
public ApplicationAmendmentResponse getAmendmentComments(Long amendmentId) {
|
||||||
|
|
||||||
ApplicationAmendmentRequestEntity amendmentData = applicationAmendmentRepository.findAmendmentById(amendmentId);
|
ApplicationAmendmentRequestEntity amendmentData = applicationAmendmentRepository.findByIdAndIsDeletedFalse(amendmentId);
|
||||||
|
|
||||||
if (amendmentData == null) {
|
if (amendmentData == null) {
|
||||||
throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.AMENDMENT_NOT_FOUND));
|
throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_NOT_FOUND_MSG));
|
||||||
}
|
}
|
||||||
List<CommunicationResponseBean> commentsList = communicationRepository.findCommentDetailsByAmendmentId(amendmentId);
|
List<CommunicationResponseBean> commentsList = communicationRepository.findCommentDetailsByAmendmentId(amendmentId);
|
||||||
if (commentsList == null) {
|
if (commentsList == null) {
|
||||||
@@ -80,13 +95,13 @@ public class CommunicationAmendmentDao {
|
|||||||
return new ApplicationAmendmentResponse(amendmentData, commentsList);
|
return new ApplicationAmendmentResponse(amendmentData, commentsList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommunicationResponseBean updateCommunicationAmendment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId) {
|
@Transactional(rollbackOn = Exception.class)
|
||||||
|
public CommunicationResponseBean updateAmendmentComment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId) {
|
||||||
|
|
||||||
log.info("Updating communication comment...");
|
log.info("Updating communication comment...");
|
||||||
CommunicationEntity existingComment = communicationRepository.findById(commentId)
|
CommunicationEntity existingComment = communicationRepository.findById(commentId)
|
||||||
.orElseThrow(() -> new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND)));
|
.orElseThrow(() -> new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND)));
|
||||||
|
if (!existingComment.getApplicationAmendmentRequest().getId().equals(amendmentId)) {
|
||||||
if (!existingComment.getAmendmentRequest().getId().equals(amendmentId)) {
|
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.COMMENT_NOT_ASSOCIATE_WITH_AMENDMENT_ID_ERROR_MSG));
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.COMMENT_NOT_ASSOCIATE_WITH_AMENDMENT_ID_ERROR_MSG));
|
||||||
}
|
}
|
||||||
existingComment.setCommunicationTitle(communicationRequestBean.getTitle());
|
existingComment.setCommunicationTitle(communicationRequestBean.getTitle());
|
||||||
@@ -101,18 +116,19 @@ public class CommunicationAmendmentDao {
|
|||||||
|
|
||||||
CommunicationResponseBean response = new CommunicationResponseBean();
|
CommunicationResponseBean response = new CommunicationResponseBean();
|
||||||
response.setComment(entity.getCommunicationComment());
|
response.setComment(entity.getCommunicationComment());
|
||||||
response.setCommentedDate(entity.setCommentedDate(););
|
response.setCommentedDate(entity.getCommentedDate());
|
||||||
response.setAmendmentId(entity.getAmendmentRequest().getId());
|
response.setAmendmentId(entity.getApplicationAmendmentRequest().getId());
|
||||||
response.setCreatedDate(entity.getCreatedDate());
|
response.setCreatedDate(entity.getCreatedDate());
|
||||||
response.setUpdatedDate(entity.getUpdatedDate());
|
response.setUpdatedDate(entity.getUpdatedDate());
|
||||||
|
response.setTitle(entity.getCommunicationTitle());
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CommunicationEntity convertToCommunicationCommentEntity(CommunicationRequestBean communicationReq, Long amendmentId) {
|
private CommunicationEntity convertToCommunicationCommentEntity(CommunicationRequestBean communicationReq, Long amendmentId) {
|
||||||
|
|
||||||
ApplicationAmendmentRequestEntity amendmentRequest = applicationAmendmentRepository.findAmendmentById(amendmentId);
|
ApplicationAmendmentRequestEntity amendmentRequest = applicationAmendmentRepository.findByIdAndIsDeletedFalse(amendmentId);
|
||||||
CommunicationEntity communicationEntity = new CommunicationEntity();
|
CommunicationEntity communicationEntity = new CommunicationEntity();
|
||||||
communicationEntity.setAmendmentRequest(amendmentRequest);
|
communicationEntity.setApplicationAmendmentRequest(amendmentRequest);
|
||||||
communicationEntity.setCommunicationTitle(communicationReq.getTitle());
|
communicationEntity.setCommunicationTitle(communicationReq.getTitle());
|
||||||
communicationEntity.setCommunicationComment(communicationReq.getComment());
|
communicationEntity.setCommunicationComment(communicationReq.getComment());
|
||||||
communicationEntity.setIsDeleted(false);
|
communicationEntity.setIsDeleted(false);
|
||||||
@@ -120,46 +136,38 @@ public class CommunicationAmendmentDao {
|
|||||||
return communicationEntity;
|
return communicationEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendMailToNotifyBeneficiaryRegardingNewAmendment(UserEntity userEntity, ApplicationEntity applicationEntity) {
|
public void sendMailToNotifyBeneficiaryRegardingNewAmendment(ApplicationEntity applicationEntity) {
|
||||||
CallEntity call = applicationEntity.getCall();
|
|
||||||
CompanyEntity company = applicationEntity.getCompany();
|
// UserEntity user = userService.validateUser(applicationEntity.getUserId());
|
||||||
ProtocolEntity protocol = applicationEntity.getProtocol();
|
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService.retrieveTemplateByTypeAndCall(
|
||||||
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService
|
SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.DOCUMENTATION_INTEGRATION_REQUEST, applicationEntity.getCall(), null);
|
||||||
.retrieveTemplateByTypeAndCall(SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.DOCUMENTATION_INTEGRATION_REQUEST,
|
|
||||||
call, null);
|
|
||||||
|
|
||||||
// Create the map for subject placeholders
|
// Create the map for subject placeholders
|
||||||
Map<String, String> subjectPlaceholders = new HashMap<>();
|
Map<String, String> subjectPlaceholders = new HashMap<>();
|
||||||
subjectPlaceholders.put("{{call_name}}", call.getName());
|
subjectPlaceholders.put("{{call_name}}", applicationEntity.getCall().getName());
|
||||||
subjectPlaceholders.put("{{company_name}}", company.getCompanyName());
|
subjectPlaceholders.put("{{company_name}}", applicationEntity.getCompany().getCompanyName());
|
||||||
|
|
||||||
// Create the map for body placeholders
|
// Create the map for body placeholders
|
||||||
Map<String, String> bodyPlaceholders = new HashMap<>();
|
Map<String, String> bodyPlaceholders = new HashMap<>();
|
||||||
bodyPlaceholders.put("{{call_name}}", call.getName());
|
bodyPlaceholders.put("{{call_name}}", applicationEntity.getCall().getName());
|
||||||
bodyPlaceholders.put("{{protocol_number}}", protocol.getProtocolNumber().toString());
|
bodyPlaceholders.put("{{protocol_number}}", applicationEntity.getProtocol().getProtocolNumber().toString());
|
||||||
bodyPlaceholders.put("{{protocol_date}}", DateTimeUtil.formatCreatedDate(protocol.getCreatedDate()));
|
bodyPlaceholders.put("{{protocol_date}}", DateTimeUtil.formatCreatedDate(applicationEntity.getProtocol().getCreatedDate()));
|
||||||
bodyPlaceholders.put("{{protocol_time}}", DateTimeUtil.parseLocalTimeToString(protocol.getTime(), GepafinConstant.HH_MM_SS));
|
bodyPlaceholders.put("{{protocol_time}}", DateTimeUtil.parseLocalTimeToString(applicationEntity.getProtocol().getTime(), GepafinConstant.HH_MM_SS));
|
||||||
bodyPlaceholders.put("{{form_dataInput}}", "YOUR_FORM_DATA_HERE");
|
bodyPlaceholders.put("{{form_dataInput}}", "");
|
||||||
|
|
||||||
// Replace placeholders in the subject and body
|
// Replace placeholders in the subject and body
|
||||||
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
|
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
|
||||||
String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
|
String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
|
||||||
|
mailUtil.sendByMailGun(subject, body, List.of("piyush1.kag1@gmail.com"), null);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendApplicationFailureNotificationEmail(String userEmail, ApplicationEntity applicationEntity) {
|
public void sendApplicationFailureNotificationEmail(String userEmail, ApplicationEntity applicationEntity) {
|
||||||
|
|
||||||
CallEntity call = applicationEntity.getCall();
|
CallEntity call = applicationEntity.getCall();
|
||||||
CompanyEntity company = applicationEntity.getCompany();
|
CompanyEntity company = applicationEntity.getCompany();
|
||||||
ProtocolEntity protocol = applicationEntity.getProtocol();
|
ProtocolEntity protocol = applicationEntity.getProtocol();
|
||||||
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService
|
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService.retrieveTemplateByTypeAndCall(
|
||||||
.retrieveTemplateByTypeAndCall(SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.INADMISSIBILITY_NOTIFICATION_DUE_TO_FAILURE,
|
SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.INADMISSIBILITY_NOTIFICATION_DUE_TO_FAILURE, call, null);
|
||||||
call, null);
|
|
||||||
|
|
||||||
// Create the map for subject placeholders
|
// Create the map for subject placeholders
|
||||||
Map<String, String> subjectPlaceholders = new HashMap<>();
|
Map<String, String> subjectPlaceholders = new HashMap<>();
|
||||||
@@ -180,12 +188,12 @@ public class CommunicationAmendmentDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendAdmissibilityNotificationEmail(UserEntity userEntity, ApplicationEntity applicationEntity) {
|
private void sendAdmissibilityNotificationEmail(UserEntity userEntity, ApplicationEntity applicationEntity) {
|
||||||
|
|
||||||
CallEntity call = applicationEntity.getCall();
|
CallEntity call = applicationEntity.getCall();
|
||||||
CompanyEntity company = applicationEntity.getCompany();
|
CompanyEntity company = applicationEntity.getCompany();
|
||||||
ProtocolEntity protocol = applicationEntity.getProtocol();
|
ProtocolEntity protocol = applicationEntity.getProtocol();
|
||||||
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService
|
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService.retrieveTemplateByTypeAndCall(
|
||||||
.retrieveTemplateByTypeAndCall(SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.ADMISSIBILITY_NOTIFICATION,
|
SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.ADMISSIBILITY_NOTIFICATION, call, null);
|
||||||
call, null);
|
|
||||||
|
|
||||||
// Create the map for subject placeholders
|
// Create the map for subject placeholders
|
||||||
Map<String, String> subjectPlaceholders = new HashMap<>();
|
Map<String, String> subjectPlaceholders = new HashMap<>();
|
||||||
@@ -212,12 +220,12 @@ public class CommunicationAmendmentDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendInadmissibilityTemplateEmail(UserEntity userEntity, ApplicationEntity applicationEntity) {
|
private void sendInadmissibilityTemplateEmail(UserEntity userEntity, ApplicationEntity applicationEntity) {
|
||||||
|
|
||||||
CallEntity call = applicationEntity.getCall();
|
CallEntity call = applicationEntity.getCall();
|
||||||
CompanyEntity company = applicationEntity.getCompany();
|
CompanyEntity company = applicationEntity.getCompany();
|
||||||
ProtocolEntity protocol = applicationEntity.getProtocol();
|
ProtocolEntity protocol = applicationEntity.getProtocol();
|
||||||
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService
|
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService.retrieveTemplateByTypeAndCall(
|
||||||
.retrieveTemplateByTypeAndCall(SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.INADMISSIBILITY_TEMPLATE,
|
SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.INADMISSIBILITY_TEMPLATE, call, null);
|
||||||
call, null);
|
|
||||||
|
|
||||||
// Create the map for subject placeholders
|
// Create the map for subject placeholders
|
||||||
Map<String, String> subjectPlaceholders = new HashMap<>();
|
Map<String, String> subjectPlaceholders = new HashMap<>();
|
||||||
@@ -10,7 +10,6 @@ import com.itextpdf.text.Rectangle;
|
|||||||
import com.itextpdf.text.pdf.*;
|
import com.itextpdf.text.pdf.*;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import net.gepafin.tendermanagement.entities.*;
|
import net.gepafin.tendermanagement.entities.*;
|
||||||
import net.gepafin.tendermanagement.model.request.FieldLabelValuePairRequest;
|
import net.gepafin.tendermanagement.model.request.FieldLabelValuePairRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.*;
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
@@ -25,6 +24,7 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -60,7 +60,8 @@ public class PdfDao {
|
|||||||
// writer.setPageEvent(pageEvent);
|
// writer.setPageEvent(pageEvent);
|
||||||
document.open();
|
document.open();
|
||||||
// pageEvent.setTotalPages(writer.getPageNumber());
|
// pageEvent.setTotalPages(writer.getPageNumber());
|
||||||
addLogo(document, "https://mementoresources.s3.eu-west-1.amazonaws.com/gepafin/logo.jpg"); // Add your image path here
|
// addLogo(document, "logo.jpg"); // Add your image path here the migration code after cherry-pick
|
||||||
|
addLogo(document, "https://mementoresources.s3.eu-west-1.amazonaws.com/gepafin/logo.jpg");
|
||||||
|
|
||||||
|
|
||||||
BaseColor customColor = new BaseColor(0, 128, 0); // Adjust RGB values as needed
|
BaseColor customColor = new BaseColor(0, 128, 0); // Adjust RGB values as needed
|
||||||
@@ -82,8 +83,6 @@ public class PdfDao {
|
|||||||
|
|
||||||
ApplicationGetResponseBean applicationGetResponseBean=applicationDao.getApplicationByFormId(request, applicationId, null);
|
ApplicationGetResponseBean applicationGetResponseBean=applicationDao.getApplicationByFormId(request, applicationId, null);
|
||||||
for(FormApplicationResponse formApplicationResponse: applicationGetResponseBean.getForm()) {
|
for(FormApplicationResponse formApplicationResponse: applicationGetResponseBean.getForm()) {
|
||||||
document.add(new Paragraph(formApplicationResponse.getLabel(),sectionFont));
|
|
||||||
document.add(new Paragraph(" ")); // Add line break
|
|
||||||
List<FieldLabelValuePairRequest> fieldLabelValuePairRequests = getFormFieldsToLabels(formApplicationResponse,writer,document);
|
List<FieldLabelValuePairRequest> fieldLabelValuePairRequests = getFormFieldsToLabels(formApplicationResponse,writer,document);
|
||||||
addColoredLines(writer,document,greenColor);
|
addColoredLines(writer,document,greenColor);
|
||||||
document.add(new Paragraph(" ")); // Add line break
|
document.add(new Paragraph(" ")); // Add line break
|
||||||
@@ -231,24 +230,68 @@ public class PdfDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PdfPCell valueCell = new PdfPCell(new Phrase(String.valueOf(value), valueFont));
|
|
||||||
valueCell.setPadding(5f); // Increase padding for better spacing
|
|
||||||
valueCell.setPaddingLeft(leftMargin); // Increase left margin for value
|
|
||||||
valueCell.setBorder(Rectangle.NO_BORDER); // Remove border for value cell
|
|
||||||
valueCell.setMinimumHeight(30f);
|
|
||||||
valueCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
||||||
valueCell.setCellEvent(new RoundedCorners()); // Apply rounded corners
|
|
||||||
|
|
||||||
valueTable.addCell(valueCell);
|
String fieldValue=Utils.convertToString(value);
|
||||||
document.add(valueTable);
|
Image img = null; // This may throw MalformedURLException
|
||||||
|
if (fieldValue.trim().equalsIgnoreCase("true")) {
|
||||||
|
// Use images for tick and cross
|
||||||
|
try {
|
||||||
|
// img = Image.getInstance("true.jpg"); update code after cherry-pick
|
||||||
|
img = Image.getInstance("https://mementoresources.s3.eu-west-1.amazonaws.com/gepafin/true.png");
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("Error while uploading image for pdf for true");
|
||||||
|
}
|
||||||
|
img.scaleAbsolute(15, 15); // Resize the image if needed
|
||||||
|
|
||||||
|
PdfPCell cell = new PdfPCell(img);
|
||||||
|
cell.setPadding(0); // Remove padding
|
||||||
|
cell.setBorder(Rectangle.NO_BORDER); // Remove border
|
||||||
|
cell.setMinimumHeight(15f); // Set height to fit checkbox image
|
||||||
|
cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||||
|
cell.setHorizontalAlignment(Element.ALIGN_LEFT); // Align the checkbox image to the left
|
||||||
|
|
||||||
|
valueTable.addCell(cell); // Add cell with checkbox to the table
|
||||||
|
document.add(valueTable);
|
||||||
|
} else if (fieldValue.trim().equalsIgnoreCase("false")) {
|
||||||
|
// Use images for tick and cross
|
||||||
|
try {
|
||||||
|
img = Image.getInstance("https://mementoresources.s3.eu-west-1.amazonaws.com/gepafin/false.png");
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("Error while uploading image for pdf for false");
|
||||||
|
}
|
||||||
|
img.scaleAbsolute(15, 15); // Resize the image if needed
|
||||||
|
|
||||||
|
PdfPCell cell = new PdfPCell(img);
|
||||||
|
cell.setPadding(0); // Remove padding
|
||||||
|
cell.setBorder(Rectangle.NO_BORDER); // Remove border
|
||||||
|
cell.setMinimumHeight(15f); // Set height to fit checkbox image
|
||||||
|
cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||||
|
cell.setHorizontalAlignment(Element.ALIGN_LEFT); // Align the checkbox image to the left
|
||||||
|
|
||||||
|
valueTable.addCell(cell); // Add cell with checkbox to the table
|
||||||
|
document.add(valueTable);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
PdfPCell valueCell = new PdfPCell(new Phrase(String.valueOf(value), valueFont));
|
||||||
|
valueCell.setPadding(5f); // Increase padding for better spacing
|
||||||
|
valueCell.setPaddingLeft(leftMargin); // Increase left margin for value
|
||||||
|
valueCell.setBorder(Rectangle.NO_BORDER); // Remove border for value cell
|
||||||
|
valueCell.setMinimumHeight(30f);
|
||||||
|
valueCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||||
|
valueCell.setCellEvent(new RoundedCorners()); // Apply rounded corners
|
||||||
|
|
||||||
|
valueTable.addCell(valueCell);
|
||||||
|
document.add(valueTable);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
document.add(new Paragraph("\n")); // Add line break after each value
|
document.add(new Paragraph("\n")); // Add line break after each value
|
||||||
}
|
}
|
||||||
|
|
||||||
private Document createPdfTable(List<Map<String, Object>> extractedData, Document document, ContentResponseBean contentResponseBean) throws DocumentException {
|
private Document createPdfTable(List<Map<String, Object>> extractedData, Document document, ContentResponseBean contentResponseBean) throws DocumentException {
|
||||||
// Create a PdfPTable with dynamic column count based on stateFieldMap size
|
// Create a PdfPTable with dynamic column count based on stateFieldMap size
|
||||||
Map<String, String> stateFieldMap = new HashMap<>();
|
Map<String, String> stateFieldMap = new HashMap<>();
|
||||||
|
Map<String, Boolean> stateFieldBoolean = new HashMap<>();
|
||||||
|
|
||||||
// Populate stateFieldMap from contentResponseBean settings
|
// Populate stateFieldMap from contentResponseBean settings
|
||||||
contentResponseBean.getSettings().stream()
|
contentResponseBean.getSettings().stream()
|
||||||
@@ -268,8 +311,23 @@ public class PdfDao {
|
|||||||
stateFieldMap.put(fieldName, fieldDataValue);
|
stateFieldMap.put(fieldName, fieldDataValue);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
contentResponseBean.getSettings().stream()
|
||||||
PdfPTable table = new PdfPTable(stateFieldMap.size()); // Number of columns equals the number of map entries
|
.filter(setting -> "table_columns".equals(setting.getName())) // Check for "table_columns"
|
||||||
|
.map(SettingResponseBean::getValue)
|
||||||
|
.filter(Objects::nonNull) // Ensure value is not null
|
||||||
|
.filter(settingValue -> settingValue instanceof Map) // Ensure value is a Map
|
||||||
|
.map(settingValue -> (Map<String, Object>) settingValue) // Cast to Map
|
||||||
|
.map(valueMap -> (List<Map<String, Object>>) valueMap.get("stateFieldData")) // Extract stateFieldData list
|
||||||
|
.filter(Objects::nonNull) // Ensure stateFieldData is not null
|
||||||
|
.flatMap(List::stream) // Flatten the list of field data maps
|
||||||
|
.forEach(fieldData -> {
|
||||||
|
String fieldName = (String) fieldData.get("name"); // Get the name field
|
||||||
|
Boolean predefined = (Boolean) fieldData.get("predefined"); // Get the predefined field
|
||||||
|
if (fieldName != null && fieldName != null) {
|
||||||
|
stateFieldBoolean.put(fieldName, predefined);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
PdfPTable table = new PdfPTable(stateFieldMap.size()); // Number of columns equals the number of map entries
|
||||||
table.setWidthPercentage(100); // Set table width to 100%
|
table.setWidthPercentage(100); // Set table width to 100%
|
||||||
table.setTableEvent(new RoundedBorderEvent());
|
table.setTableEvent(new RoundedBorderEvent());
|
||||||
|
|
||||||
@@ -278,29 +336,37 @@ public class PdfDao {
|
|||||||
float maxTableHeight = 700f; // Maximum height of the table before a page break
|
float maxTableHeight = 700f; // Maximum height of the table before a page break
|
||||||
boolean headersAdded = false; // Flag to check if headers have been added
|
boolean headersAdded = false; // Flag to check if headers have been added
|
||||||
|
|
||||||
|
List<String> trueKeys = new ArrayList<>();
|
||||||
|
List<String> falseKeys = new ArrayList<>();
|
||||||
|
for (Map.Entry<String, Boolean> entry : stateFieldBoolean.entrySet()) {
|
||||||
|
if (Boolean.TRUE.equals(entry.getValue())) {
|
||||||
|
trueKeys.add(entry.getKey()); // Store true keys
|
||||||
|
} else {
|
||||||
|
falseKeys.add(entry.getKey()); // Store false keys
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<String> orderedKeys = new ArrayList<>(trueKeys);
|
||||||
|
orderedKeys.addAll(falseKeys);
|
||||||
// Iterate through extracted data to populate the table
|
// Iterate through extracted data to populate the table
|
||||||
for (Map<String, Object> row : extractedData) {
|
for (Map<String, Object> row : extractedData) {
|
||||||
// Add headers once
|
// Add headers once
|
||||||
if (!headersAdded) {
|
if (!headersAdded) {
|
||||||
for (Map.Entry<String, String> stateField : stateFieldMap.entrySet()) {
|
for (String key : orderedKeys) {
|
||||||
String headerValue = stateField.getValue(); // Header text
|
String headerValue = stateFieldMap.get(key); // Header text
|
||||||
|
PdfPCell headerCell = new PdfPCell(new Phrase(headerValue)); // Create a new PdfPCell for the header
|
||||||
|
headerCell.setHorizontalAlignment(Element.ALIGN_CENTER); // Center align
|
||||||
|
headerCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||||
|
headerCell.setBackgroundColor(new BaseColor(178, 190, 181)); // Light gray background for header
|
||||||
|
|
||||||
PdfPCell headerCell = new PdfPCell(new Phrase(headerValue)); // Create a new PdfPCell for the header
|
table.addCell(headerCell); // Add the header cell to the table
|
||||||
headerCell.setHorizontalAlignment(Element.ALIGN_CENTER); // Center align
|
}
|
||||||
headerCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
||||||
headerCell.setBackgroundColor(new BaseColor(178, 190, 181)); // Light gray background for header
|
|
||||||
|
|
||||||
table.addCell(headerCell); // Add the header cell to the table
|
|
||||||
}
|
|
||||||
headersAdded = true; // Prevent headers from being added again
|
headersAdded = true; // Prevent headers from being added again
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add data rows matching stateFieldMap keys
|
// Add data rows matching stateFieldMap keys
|
||||||
for (Map.Entry<String, String> stateField : stateFieldMap.entrySet()) {
|
for (Map.Entry<String, String> stateField : stateFieldMap.entrySet()) {
|
||||||
String stateKey = stateField.getKey(); // Get the key from stateFieldMap
|
for (String key : orderedKeys) { // Iterate over the ordered keys
|
||||||
if (row.containsKey(stateKey)) { // If row contains the stateKey
|
Object value = row.getOrDefault(key, ""); // Fetch value or use empty string if key not present
|
||||||
Object value = row.get(stateKey); // Get the value from the row map
|
|
||||||
|
|
||||||
PdfPCell dynamicCell = new PdfPCell(new Phrase(value != null ? value.toString() : "", textFont));
|
PdfPCell dynamicCell = new PdfPCell(new Phrase(value != null ? value.toString() : "", textFont));
|
||||||
dynamicCell.setBackgroundColor(new BaseColor(239, 243, 248)); // Light blue for the cell
|
dynamicCell.setBackgroundColor(new BaseColor(239, 243, 248)); // Light blue for the cell
|
||||||
dynamicCell.setMinimumHeight(rowHeight);
|
dynamicCell.setMinimumHeight(rowHeight);
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@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 = "FORM_FIELDS")
|
||||||
|
private String formFields;
|
||||||
|
|
||||||
|
@Column(name="IS_DELETED")
|
||||||
|
private Boolean isDeleted=false;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "applicationAmendmentRequest", fetch = FetchType.LAZY)
|
||||||
|
@JsonIgnore
|
||||||
|
private List<CommunicationEntity> communicationList;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
@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;
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ import lombok.Data;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "communication_amendment")
|
@Table(name = "communication")
|
||||||
@Data
|
@Data
|
||||||
public class CommunicationEntity extends BaseEntity {
|
public class CommunicationEntity extends BaseEntity {
|
||||||
|
|
||||||
@@ -28,4 +28,9 @@ public class CommunicationEntity extends BaseEntity {
|
|||||||
@Column(name = "COMMENTED_DATE")
|
@Column(name = "COMMENTED_DATE")
|
||||||
private LocalDateTime commentedDate;
|
private LocalDateTime commentedDate;
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JsonIgnore
|
||||||
|
@JoinColumn(name = "AMENDMENT_ID", referencedColumnName = "id", nullable = false)
|
||||||
|
private ApplicationAmendmentRequestEntity applicationAmendmentRequest;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -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"),
|
AWAITING("AWAITING"),
|
||||||
READY("READY"),
|
READY("READY"),
|
||||||
DISCARD("DISCARD"),
|
DISCARD("DISCARD"),
|
||||||
|
SOCCORSO("SOCCORSO"),
|
||||||
|
APPROVED("APPROVED"),
|
||||||
|
REJECTED("REJECTED"),
|
||||||
EVALUATION("EVALUATION");
|
EVALUATION("EVALUATION");
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package net.gepafin.tendermanagement.enums;
|
|||||||
import com.fasterxml.jackson.annotation.JsonValue;
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
|
||||||
public enum AssignedApplicationEnum {
|
public enum AssignedApplicationEnum {
|
||||||
ASSIGNED("ASSIGNED"),
|
OPEN ("OPEN"),
|
||||||
APPROVED("APPROVED"),
|
SOCCORSO("SOCCORSO"),
|
||||||
REJECTED("REJECTED");
|
CLOSE("CLOSE");
|
||||||
|
|
||||||
|
|
||||||
private final String value;
|
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 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,23 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
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> updatedFormFields;
|
||||||
|
private List<CommunicationResponseBean> commentsList;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.gepafin.tendermanagement.model.response;
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApplicationEvaluationResponse {
|
||||||
|
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private Long applicationId;
|
||||||
|
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,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,10 @@
|
|||||||
|
package net.gepafin.tendermanagement.repositories;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public interface ApplicationAmendmentRequestRepository extends JpaRepository<ApplicationAmendmentRequestEntity,Long> {
|
||||||
|
ApplicationAmendmentRequestEntity findByIdAndIsDeletedFalse(Long id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
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.Optional;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface ApplicationEvaluationRepository extends JpaRepository<ApplicationEvaluationEntity, Long> {
|
||||||
|
|
||||||
|
Optional<ApplicationEvaluationEntity> findByApplicationIdAndIsDeletedFalse(Long applicationId);
|
||||||
|
|
||||||
|
Optional<ApplicationEvaluationEntity> findByAssignedApplicationsEntity_IdAndIsDeletedFalse(Long assignedApplicationId);
|
||||||
|
|
||||||
|
Optional<ApplicationEvaluationEntity> findByApplicationIdAndAssignedApplicationsEntity_IdAndIsDeletedFalse(Long applicationId, Long assignedApplicationId);
|
||||||
|
|
||||||
|
Optional<ApplicationEvaluationEntity> findFirstByIsDeletedFalseOrderByCreatedDateDesc();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -23,5 +23,18 @@ public interface ApplicationFormFieldRepository extends JpaRepository<Applicatio
|
|||||||
|
|
||||||
public List<ApplicationFormFieldEntity> findByFieldValueInAndApplicationFormApplicationId(
|
public List<ApplicationFormFieldEntity> findByFieldValueInAndApplicationFormApplicationId(
|
||||||
List<String> fieldValue, Long applicationId);
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package net.gepafin.tendermanagement.repositories;
|
|||||||
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
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 org.springframework.stereotype.Repository;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@@ -9,5 +11,11 @@ import java.util.Optional;
|
|||||||
public interface AssignedApplicationsRepository extends JpaRepository<AssignedApplicationsEntity,Long>, JpaSpecificationExecutor<AssignedApplicationsEntity>{
|
public interface AssignedApplicationsRepository extends JpaRepository<AssignedApplicationsEntity,Long>, JpaSpecificationExecutor<AssignedApplicationsEntity>{
|
||||||
Optional<AssignedApplicationsEntity> findByApplicationIdAndIsDeletedFalse(Long applicationId);
|
Optional<AssignedApplicationsEntity> findByApplicationIdAndIsDeletedFalse(Long applicationId);
|
||||||
Optional<AssignedApplicationsEntity> findByIdAndIsDeletedFalse(Long id);
|
Optional<AssignedApplicationsEntity> findByIdAndIsDeletedFalse(Long id);
|
||||||
|
@Query("SELECT aa FROM AssignedApplicationsEntity aa WHERE aa.isDeleted = false " +
|
||||||
|
"AND (:applicationId IS NULL OR aa.application.id = :applicationId) " +
|
||||||
|
"AND (:id IS NULL OR aa.id = :id)")
|
||||||
|
Optional<AssignedApplicationsEntity> findByApplicationIdOrId(@Param("applicationId") Long applicationId,
|
||||||
|
@Param("id") Long id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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'")
|
// @Query("SELECT COALESCE(SUM(c.amount), 0) FROM CallEntity c WHERE c.status = 'PUBLISH'")
|
||||||
// BigDecimal findTotalAmountOfPublishedCalls();
|
// 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) " +
|
// @Query("SELECT c.name, COUNT(a.id) " +
|
||||||
// "FROM CallEntity c LEFT JOIN ApplicationEntity a ON c.id = a.call.id " +
|
// "FROM CallEntity c LEFT JOIN ApplicationEntity a ON c.id = a.call.id " +
|
||||||
// "GROUP BY c.name")
|
// "GROUP BY c.name")
|
||||||
|
|||||||
@@ -17,4 +17,5 @@ public interface CallTargetAudienceChecklistRepository extends JpaRepository<Cal
|
|||||||
Optional<CallTargetAudienceChecklistEntity> findById(@Param("id") Long id);
|
Optional<CallTargetAudienceChecklistEntity> findById(@Param("id") Long id);
|
||||||
|
|
||||||
List<CallTargetAudienceChecklistEntity> findByCallIdAndLookupDataTypeAndIsDeletedFalse(Long id, String type);
|
List<CallTargetAudienceChecklistEntity> findByCallIdAndLookupDataTypeAndIsDeletedFalse(Long id, String type);
|
||||||
|
List<CallTargetAudienceChecklistEntity> findByCallId(Long callId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,12 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface CommunicationRepository extends JpaRepository<CommunicationEntity, Long> {
|
public interface CommunicationRepository extends JpaRepository<CommunicationEntity, Long> {
|
||||||
|
|
||||||
@Query("Select c from CommunicationEntity c Where c.id = :id")
|
@Query("Select new net.gepafin.tendermanagement.model.response.CommunicationResponseBean(c.commentedDate, c.communicationComment, c.communicationTitle, c.createdDate, c.updatedDate, c.applicationAmendmentRequest.id) " +
|
||||||
CommunicationEntity findCommentsById(@Param("id") Long id);
|
"from CommunicationEntity c Where c.applicationAmendmentRequest.id = :id")
|
||||||
|
List<CommunicationResponseBean> findCommentsById(@Param("id") Long id);
|
||||||
|
|
||||||
@Query("SELECT new net.gepafin.tendermanagement.model.response.CommunicationResponseBean( " + "c.addedDate, c.communicationComment, c.communicationTitle, c.createdDate, c" +
|
@Query("SELECT new net.gepafin.tendermanagement.model.response.CommunicationResponseBean( " + "c.commentedDate, c.communicationComment, c.communicationTitle, c.createdDate, c" +
|
||||||
".updatedDate, c.amendmentRequest.id) " + "FROM CommunicationEntity c " + "WHERE c.amendmentRequest.id = :amendmentId AND c.isDeleted = false")
|
".updatedDate, c.applicationAmendmentRequest.id) " + "FROM CommunicationEntity c " + "WHERE c.applicationAmendmentRequest.id = :amendmentId AND c.isDeleted = false")
|
||||||
List<CommunicationResponseBean> findCommentDetailsByAmendmentId(@Param("amendmentId") Long amendmentId);
|
List<CommunicationResponseBean> findCommentDetailsByAmendmentId(@Param("amendmentId") Long amendmentId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import org.springframework.stereotype.Repository;
|
|||||||
public interface DocumentRepository extends JpaRepository<DocumentEntity, Long> {
|
public interface DocumentRepository extends JpaRepository<DocumentEntity, Long> {
|
||||||
|
|
||||||
@Query("SELECT d FROM DocumentEntity d WHERE d.id = :id AND d.isDeleted = false")
|
@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);
|
// List<DocumentEntity> findBySourceIdAndTypeAndIsDeletedFalse(Long sourceId, String type);
|
||||||
|
|
||||||
|
|||||||
@@ -16,4 +16,6 @@ public interface EvaluationCriteriaRepository extends JpaRepository<EvaluationCr
|
|||||||
Optional<EvaluationCriteriaEntity> findById(@Param("id") Long id);
|
Optional<EvaluationCriteriaEntity> findById(@Param("id") Long id);
|
||||||
|
|
||||||
List<EvaluationCriteriaEntity> findByCallIdAndLookupDataTypeAndIsDeletedFalse(Long callId, String type);
|
List<EvaluationCriteriaEntity> findByCallIdAndLookupDataTypeAndIsDeletedFalse(Long callId, String type);
|
||||||
|
List<EvaluationCriteriaEntity> findByCallId(Long callId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//package net.gepafin.tendermanagement.scheduler;
|
//package net.gepafin.tendermanagement.scheduler;
|
||||||
//
|
//
|
||||||
//import net.gepafin.tendermanagement.dao.CommunicationAmendmentDao;
|
//import net.gepafin.tendermanagement.dao.CommunicationDao;
|
||||||
//import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
//import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
||||||
//import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
//import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||||
//import net.gepafin.tendermanagement.entities.UserEntity;
|
//import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
// ApplicationAmendmentRepository applicationAmendmentRepository;
|
// ApplicationAmendmentRepository applicationAmendmentRepository;
|
||||||
//
|
//
|
||||||
// @Autowired
|
// @Autowired
|
||||||
// CommunicationAmendmentDao communicationAmendmentDao;
|
// CommunicationDao communicationDao;
|
||||||
//
|
//
|
||||||
// @Scheduled(cron = "0 0/10 * * * ?", zone = "Asia/Kolkata")
|
// @Scheduled(cron = "0 0/10 * * * ?", zone = "Asia/Kolkata")
|
||||||
// void sendNotificationForRejectedApplicationToBeneficiary() {
|
// void sendNotificationForRejectedApplicationToBeneficiary() {
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
//
|
//
|
||||||
// // Send email notification if user is found
|
// // Send email notification if user is found
|
||||||
// if (user != null && user.getEmail() != null) {
|
// if (user != null && user.getEmail() != null) {
|
||||||
// communicationAmendmentDao.sendApplicationFailureNotificationEmail(user.getEmail(), application);
|
// communicationDao.sendApplicationFailureNotificationEmail(user.getEmail(), application);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package net.gepafin.tendermanagement.service;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
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 List<ApplicationAmendmentRequestResponse> getApplicationDataForAmendment(HttpServletRequest request,Long applicationId);
|
||||||
|
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);
|
||||||
|
ApplicationAmendmentRequestResponse updateApplicationAmendment(HttpServletRequest request, Long id, ApplicationAmendmentRequestBean applicationAmendmentRequestBean);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package net.gepafin.tendermanagement.service;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
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 java.util.List;
|
||||||
|
|
||||||
|
public interface ApplicationEvaluationService {
|
||||||
|
ApplicationEvaluationResponse createOrUpdateApplicationEvaluation(HttpServletRequest request, ApplicationEvaluationRequest applicationEvaluationRequest,Long assignedApplicationsId);
|
||||||
|
void deleteApplicationEvaluation(HttpServletRequest request,Long id);
|
||||||
|
|
||||||
|
ApplicationEvaluationResponse getApplicationEvaluationByApplicationId(HttpServletRequest request,Long applicationId,Long assignedApplicationId);
|
||||||
|
ApplicationEvaluationResponse updateApplicationEvaluationStatus(HttpServletRequest request, Long applicationEvaluationId, ApplicationEvaluationStatusTypeEnum status);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -26,7 +26,7 @@ public interface ApplicationService {
|
|||||||
|
|
||||||
void deleteApplication(HttpServletRequest request, Long applicationId);
|
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);
|
public ApplicationResponse createApplication(HttpServletRequest request, Long companyId, ApplicationRequest applicationRequest, Long callId);
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import net.gepafin.tendermanagement.model.request.CommunicationRequestBean;
|
|||||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
|
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
|
||||||
|
|
||||||
public interface CommunicationAmendmentService {
|
public interface CommunicationService {
|
||||||
CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationRequestBean, Long amendmentId);
|
CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationRequestBean, Long amendmentId);
|
||||||
|
|
||||||
String deleteCommunicationAmendmentComment(Long amendmentId, Long commentId);
|
String deleteComment(Long amendmentId, Long commentId);
|
||||||
|
|
||||||
CommunicationResponseBean updateCommunicationAmendment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId);
|
CommunicationResponseBean updateAmendmentComment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId);
|
||||||
|
|
||||||
ApplicationAmendmentResponse getAmendmentComments(Long id);
|
ApplicationAmendmentResponse getAmendmentComments(Long id);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package net.gepafin.tendermanagement.service.impl;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import net.gepafin.tendermanagement.dao.ApplicationAmendmentRequestDao;
|
||||||
|
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 List<ApplicationAmendmentRequestResponse> getApplicationDataForAmendment(HttpServletRequest request, Long applicationId) {
|
||||||
|
UserEntity user= validator.validateUser(request);
|
||||||
|
return applicationAmendmentRequestDao.getApplicationDataForAmendment(request,applicationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@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) {
|
||||||
|
return applicationAmendmentRequestDao.getAllApplicationAmendmentRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApplicationAmendmentRequestResponse updateApplicationAmendment(HttpServletRequest request, Long id, ApplicationAmendmentRequestBean applicationAmendmentRequestBean) {
|
||||||
|
UserEntity updatedByUser= validator.validateUser(request);
|
||||||
|
return applicationAmendmentRequestDao.updateApplicationAmendment(id,applicationAmendmentRequestBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
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.AssignedApplicationsEntity;
|
||||||
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
|
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.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.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.getApplication().getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public ApplicationEvaluationResponse getApplicationEvaluationByApplicationId(
|
||||||
|
HttpServletRequest request, Long applicationId, Long assignedApplicationId) {
|
||||||
|
|
||||||
|
Optional<AssignedApplicationsEntity> assignedApplicationsOptional =
|
||||||
|
assignedApplicationsRepository.findByApplicationIdOrId(applicationId, assignedApplicationId);
|
||||||
|
|
||||||
|
AssignedApplicationsEntity assignedApplications = assignedApplicationsOptional
|
||||||
|
.orElseThrow(() -> new CustomValidationException(
|
||||||
|
Status.BAD_REQUEST,
|
||||||
|
Translator.toLocale(GepafinConstant.ASSIGNED_APPLICATION_NOT_FOUND_WITH_ID_MSG)
|
||||||
|
));
|
||||||
|
UserEntity user = validator.validatePreInstructor(request, assignedApplications.getUserId());
|
||||||
|
return applicationEvaluationDao.getApplicationEvaluationByApplicationId(
|
||||||
|
user,
|
||||||
|
assignedApplications.getApplication().getId(),
|
||||||
|
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 applicationId, ApplicationEvaluationStatusTypeEnum status) {
|
||||||
|
AssignedApplicationsEntity assignedApplications = assignedApplicationsRepository.findByApplicationIdAndIsDeletedFalse(applicationId).orElse(null);
|
||||||
|
if(assignedApplications==null){
|
||||||
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.ASSIGNED_APPLICATION_NOT_FOUND_WITH_ID_MSG));
|
||||||
|
}
|
||||||
|
validator.validatePreInstructor(request, assignedApplications.getUserId());
|
||||||
|
return applicationEvaluationDao.updateApplicationEvaluationStatus(applicationId, status);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -56,8 +56,8 @@ public class ApplicationServiceImpl implements ApplicationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApplicationEntity validateApplication(Long id) {
|
public ApplicationEntity validateApplication(Long applicationId) {
|
||||||
return applicationDao.validateApplication(id);
|
return applicationDao.validateApplication(applicationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
package net.gepafin.tendermanagement.service.impl;
|
|
||||||
|
|
||||||
import net.gepafin.tendermanagement.dao.CommunicationAmendmentDao;
|
|
||||||
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.CommunicationAmendmentService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class CommunicationAmendmentServiceImpl implements CommunicationAmendmentService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
CommunicationAmendmentDao communicationAmendmentDao;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationRequestBean, Long amendmentId) {
|
|
||||||
return communicationAmendmentDao.addCommentToAmendmentRequest(communicationRequestBean,amendmentId);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public String deleteCommunicationAmendmentComment(Long amendmentId, Long commentId) {
|
|
||||||
|
|
||||||
return communicationAmendmentDao.deleteCommunicationAmendmentComment(amendmentId, commentId);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public CommunicationResponseBean updateCommunicationAmendment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId) {
|
|
||||||
|
|
||||||
return communicationAmendmentDao.updateCommunicationAmendment(communicationRequestBean, amendmentId, commentId);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public ApplicationAmendmentResponse getAmendmentComments(Long id) {
|
|
||||||
|
|
||||||
return communicationAmendmentDao.getAmendmentComments(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CommunicationServiceImpl implements CommunicationService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CommunicationDao communicationDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationRequestBean, Long amendmentId) {
|
||||||
|
|
||||||
|
return communicationDao.addCommentToAmendmentRequest(communicationRequestBean, amendmentId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String deleteComment(Long amendmentId, Long commentId) {
|
||||||
|
|
||||||
|
return communicationDao.deleteComment(amendmentId, commentId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public CommunicationResponseBean updateAmendmentComment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId) {
|
||||||
|
|
||||||
|
return communicationDao.updateAmendmentComment(communicationRequestBean, amendmentId, commentId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public ApplicationAmendmentResponse getAmendmentComments(Long id) {
|
||||||
|
|
||||||
|
return communicationDao.getAmendmentComments(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.gepafin.tendermanagement.util;
|
package net.gepafin.tendermanagement.util;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
@@ -310,6 +311,23 @@ public class Utils {
|
|||||||
|
|
||||||
return new StringTokenizer(header, ",").nextToken().trim();
|
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) {
|
public static String replaceSpacesWithUnderscores(String content) {
|
||||||
if (content == null) {
|
if (content == null) {
|
||||||
|
|||||||
@@ -135,11 +135,10 @@ public class Validator {
|
|||||||
return requestedUser;
|
return requestedUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Long getUserIdFromToken(HttpServletRequest request) {
|
public Long getUserIdFromToken(HttpServletRequest request) {
|
||||||
Map<String, Object> userInfo= tokenProvider.getUserInfoAndUserIdFromToken(request);
|
Map<String, Object> userInfo= tokenProvider.getUserInfoAndUserIdFromToken(request);
|
||||||
return Long.parseLong(userInfo.get("userId").toString());
|
return Long.parseLong(userInfo.get("userId").toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CallEntity validateUserWithCall(UserEntity user, Long callId) {
|
public CallEntity validateUserWithCall(UserEntity user, Long callId) {
|
||||||
CallEntity callEntity = callService.validateCall(callId);
|
CallEntity callEntity = callService.validateCall(callId);
|
||||||
if(Boolean.FALSE.equals(user.getHub().getId().equals(callEntity.getHub().getId()))) {
|
if(Boolean.FALSE.equals(user.getHub().getId().equals(callEntity.getHub().getId()))) {
|
||||||
|
|||||||
@@ -0,0 +1,102 @@
|
|||||||
|
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 = "/{applicationId}", produces = "application/json")
|
||||||
|
ResponseEntity<Response<List<ApplicationAmendmentRequestResponse>>> getApplicationDataForAmendment(HttpServletRequest request, @Parameter(description = "The application id", required = true) @PathVariable(value = "applicationId", required = true) Long applicationId);
|
||||||
|
|
||||||
|
@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 = "/getAll", produces = "application/json")
|
||||||
|
ResponseEntity<Response<List<ApplicationAmendmentRequestResponse>>> getAllApplicationAmendmentRequest(HttpServletRequest request);
|
||||||
|
|
||||||
|
@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);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
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) }))
|
||||||
|
})
|
||||||
|
@GetMapping(value = "/application", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
ResponseEntity<Response<ApplicationEvaluationResponse>> getApplicationEvaluationByApplicationId(
|
||||||
|
HttpServletRequest request,
|
||||||
|
@Parameter(description = "Application ID", required = false) @RequestParam(value = "applicationId", required = false) Long applicationId,
|
||||||
|
@Parameter(description = "Assigned Application ID", 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(description = "The evaluation ID", 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 = "/{applicationId}/status", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
ResponseEntity<Response<ApplicationEvaluationResponse>> updateApplicationEvaluationStatus(HttpServletRequest request,
|
||||||
|
@Parameter( required = true) @PathVariable("applicationId") Long applicationId,
|
||||||
|
@Parameter(description = "status", required = true)@RequestParam(value = "status", required = true) ApplicationEvaluationStatusTypeEnum status);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.PutMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
@Validated
|
@Validated
|
||||||
public interface CommunicationAmendmentApi {
|
public interface CommunicationApi {
|
||||||
@Operation(summary = "Api to create communication amendment comment", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
@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 = {
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
@@ -32,8 +32,8 @@ public interface CommunicationAmendmentApi {
|
|||||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
@PostMapping(value = "/{amendmentId}", produces = { "application/json" })
|
@PostMapping(value = "/{amendmentId}", produces = { "application/json" })
|
||||||
ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request, @RequestBody @Parameter CommunicationRequestBean communicationResponseBean,
|
ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request,
|
||||||
@Param(value = "amendmentId") Long amendmentId);
|
@RequestBody @Parameter CommunicationRequestBean communicationResponseBean, @Param(value = "amendmentId") Long amendmentId);
|
||||||
|
|
||||||
@Operation(summary = "API to Get Amendment Request Comment", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
@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 =
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value =
|
||||||
@@ -53,8 +53,8 @@ public interface CommunicationAmendmentApi {
|
|||||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
@PutMapping(value = "/{amendmentId}/{commentId}", produces = { "application/json" })
|
@PutMapping(value = "/{amendmentId}/{commentId}", produces = { "application/json" })
|
||||||
ResponseEntity<Response<CommunicationResponseBean>> updateCommunicationAmendment(HttpServletRequest request, @RequestBody @Parameter CommunicationRequestBean communicationResponseBean,
|
ResponseEntity<Response<CommunicationResponseBean>> updateCommunicationAmendment(HttpServletRequest request,
|
||||||
@PathVariable Long amendmentId, @PathVariable Long commentId);
|
@RequestBody @Parameter CommunicationRequestBean communicationResponseBean, @PathVariable Long amendmentId, @PathVariable Long commentId);
|
||||||
|
|
||||||
@Operation(summary = "Api to delete communication comments", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
@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 = {
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@@ -64,5 +64,6 @@ public interface CommunicationAmendmentApi {
|
|||||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
@DeleteMapping(value = "/{amendmentId}/{commentId}", produces = { "application/json" })
|
@DeleteMapping(value = "/{amendmentId}/{commentId}", produces = { "application/json" })
|
||||||
ResponseEntity<Response<String>> deleteApplicationAmendmentComment(HttpServletRequest request, @Param(value = "amendmentId")Long amendmentId, @Param(value = "commentId")Long commentId);
|
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)
|
@ExceptionHandler(ResourceNotFoundException.class)
|
||||||
public ResponseEntity<Response<Void>> handleResourceNotFoundException(ResourceNotFoundException ex) {
|
public ResponseEntity<Response<Void>> handleResourceNotFoundException(ResourceNotFoundException ex) {
|
||||||
|
log.error(ex.getMessage());
|
||||||
|
log.error(ex.getLocalizedMessage(), ex);
|
||||||
return ResponseEntity.status(HttpStatus.NOT_FOUND)
|
return ResponseEntity.status(HttpStatus.NOT_FOUND)
|
||||||
.body(new Response<>(null, ex.getStatus(), ex.getMessage()));
|
.body(new Response<>(null, ex.getStatus(), ex.getMessage()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
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<List<ApplicationAmendmentRequestResponse>>> getApplicationDataForAmendment(HttpServletRequest request, Long applicationId) {
|
||||||
|
List<ApplicationAmendmentRequestResponse> applicationAmendmentBean = applicationAmendmentRequestService.getApplicationDataForAmendment(request,applicationId);
|
||||||
|
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) {
|
||||||
|
log.info("Get All Applications Amendment Request");
|
||||||
|
List<ApplicationAmendmentRequestResponse> applicationAmendmentRequestResponses = applicationAmendmentRequestService.getAllApplicationAmendmentRequest(request);
|
||||||
|
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)));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
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<ApplicationEvaluationResponse>> getApplicationEvaluationByApplicationId(
|
||||||
|
HttpServletRequest request, Long applicationId, Long assignedApplicationId) {
|
||||||
|
|
||||||
|
ApplicationEvaluationResponse response = null;
|
||||||
|
response = applicationEvaluationService.getApplicationEvaluationByApplicationId(request, applicationId,assignedApplicationId);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<>(response, 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 applicationId,
|
||||||
|
ApplicationEvaluationStatusTypeEnum status) {
|
||||||
|
ApplicationEvaluationResponse applicationEvaluationResponse = applicationEvaluationService.updateApplicationEvaluationStatus(request, applicationId, status);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<>(applicationEvaluationResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.APPLICATION_EVALUATION_STATUS_UPDATED_SUCCESSFULLY)));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,8 +7,8 @@ import net.gepafin.tendermanagement.model.request.CommunicationRequestBean;
|
|||||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
|
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.util.Response;
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
import net.gepafin.tendermanagement.service.CommunicationAmendmentService;
|
import net.gepafin.tendermanagement.service.CommunicationService;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.CommunicationAmendmentApi;
|
import net.gepafin.tendermanagement.web.rest.api.CommunicationApi;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -17,38 +17,38 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("${openapi.gepafin.base-path:/v1/communication-amendment}")
|
@RequestMapping("${openapi.gepafin.base-path:/v1/communication}")
|
||||||
public class CommunicationAmendmentController implements CommunicationAmendmentApi {
|
public class CommunicationController implements CommunicationApi {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
CommunicationAmendmentService communicationAmendmentService;
|
CommunicationService communicationService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request, CommunicationRequestBean communicationRequestBean,
|
public ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request, CommunicationRequestBean communicationRequestBean,
|
||||||
Long amendmentId) {
|
Long amendmentId) {
|
||||||
|
|
||||||
CommunicationResponseBean communicationResponseBean = communicationAmendmentService.addCommentToAmendmentRequest(communicationRequestBean, amendmentId);
|
CommunicationResponseBean communicationResponseBean = communicationService.addCommentToAmendmentRequest(communicationRequestBean, amendmentId);
|
||||||
return ResponseEntity.status(HttpStatus.CREATED)
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
.body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMUNICATION_ADDED_TO_AMENDMENT_REQUEST_SUCCESS)));
|
.body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMUNICATION_ADDED_TO_AMENDMENT_REQUEST_SUCCESS)));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<ApplicationAmendmentResponse>> getAmendmentComments(Long amendmentId) {
|
public ResponseEntity<Response<ApplicationAmendmentResponse>> getAmendmentComments(Long amendmentId) {
|
||||||
|
|
||||||
ApplicationAmendmentResponse response = communicationAmendmentService.getAmendmentComments(amendmentId);
|
ApplicationAmendmentResponse response = communicationService.getAmendmentComments(amendmentId);
|
||||||
return ResponseEntity.ok(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.AMENDMENT_FOUND_SUCCESS)));
|
return ResponseEntity.ok(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.AMENDMENT_FOUND_SUCCESS)));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<CommunicationResponseBean>> updateCommunicationAmendment(HttpServletRequest request, CommunicationRequestBean communicationRequestBean,
|
public ResponseEntity<Response<CommunicationResponseBean>> updateCommunicationAmendment(HttpServletRequest request, CommunicationRequestBean communicationRequestBean,
|
||||||
Long amendmentId, Long commentId) {
|
Long amendmentId, Long commentId) {
|
||||||
|
|
||||||
CommunicationResponseBean communicationResponseBean = communicationAmendmentService.updateCommunicationAmendment(communicationRequestBean, amendmentId, commentId);
|
CommunicationResponseBean communicationResponseBean = communicationService.updateAmendmentComment(communicationRequestBean, amendmentId, commentId);
|
||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
.body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMENT_UPDATED_SUCCESS_MSG)));
|
.body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMENT_UPDATED_SUCCESS_MSG)));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<String>> deleteApplicationAmendmentComment(HttpServletRequest request, Long applicationAmendId, Long commentId) {
|
public ResponseEntity<Response<String>> deleteApplicationAmendmentComment(HttpServletRequest request, Long applicationAmendId, Long commentId) {
|
||||||
|
|
||||||
String communicationResponseBean = communicationAmendmentService.deleteCommunicationAmendmentComment(applicationAmendId, commentId);
|
String communicationResponseBean = communicationService.deleteComment(applicationAmendId, commentId);
|
||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
.body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMENT_DELETED_SUCCESS_MSG)));
|
.body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMENT_DELETED_SUCCESS_MSG)));
|
||||||
}
|
}
|
||||||
@@ -1483,4 +1483,143 @@
|
|||||||
</insert>
|
</insert>
|
||||||
</changeSet>
|
</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="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>
|
||||||
|
|
||||||
|
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ VALUES
|
|||||||
<p><strong>RICHIESTA INTEGRAZIONE DOCUMENTALE</strong></p>
|
<p><strong>RICHIESTA INTEGRAZIONE DOCUMENTALE</strong></p>
|
||||||
<p>Buongiorno,</p>
|
<p>Buongiorno,</p>
|
||||||
<p>In riferimento alla domanda di concessione di Finanziamento agevolato a valere sul Fondo prestiti
|
<p>In riferimento alla domanda di concessione di Finanziamento agevolato a valere sul Fondo prestiti
|
||||||
<strong>{{call_name}}</strong> di cui al Protocollo n. <strong>{{protocol_number}}</strong> del
|
<strong>{{call_name}}</strong> di cui al <strong>Protocollo n. {{protocol_number}} del
|
||||||
<strong>{{protocol_date}}</strong> e <strong>{{protocol_time}}</strong>, alla luce dell’attività istruttoria svolta,
|
{{protocol_date}} e {{protocol_time}}</strong>, alla luce dell’attività istruttoria svolta,
|
||||||
segnaliamo quanto segue:</p>
|
segnaliamo quanto segue:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>{{form_dataInput}}</li>
|
<li>{{form_dataInput}}</li>
|
||||||
@@ -132,4 +132,3 @@ VALUES
|
|||||||
'2024-10-26 20:00:00',
|
'2024-10-26 20:00:00',
|
||||||
'2024-10-26 20:00:00'
|
'2024-10-26 20:00:00'
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -253,7 +253,15 @@ 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.
|
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.
|
get.users.success.msg = Successfully fetched users.
|
||||||
cannot.create.beneficiary.user = Creation of a Beneficiary user is not allowed. Please assign the appropriate role.
|
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.
|
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
|
||||||
|
|
||||||
|
|
||||||
# Hub Messages
|
# Hub Messages
|
||||||
@@ -276,3 +284,18 @@ assigned.application.get.success=Assigned Application details fetched successful
|
|||||||
assigned.application.update.successfully=Assigned Application updated successfully.
|
assigned.application.update.successfully=Assigned Application updated successfully.
|
||||||
get.error.s3=Failed to fetch the file from S3.
|
get.error.s3=Failed to fetch the file from S3.
|
||||||
invalid.application.status = Invalid Application status.
|
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.
|
||||||
|
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,14 @@ 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.
|
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.
|
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
|
||||||
|
|
||||||
application.assigned.success.msg =Domanda assegnata con successo
|
application.assigned.success.msg =Domanda assegnata con successo
|
||||||
application.already.assigned.msg =La domanda � gi� assegnata
|
application.already.assigned.msg =La domanda � gi� assegnata
|
||||||
@@ -271,3 +279,18 @@ hub_not_found=Hub non trovato
|
|||||||
|
|
||||||
application.not.in.draft.status=La domanda non � in stato DRAFT.
|
application.not.in.draft.status=La domanda non � in stato DRAFT.
|
||||||
get.error.s3=Impossibile recuperare il file da S3.
|
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.
|
||||||
|
|||||||
Reference in New Issue
Block a user