Resolved Conflicts
This commit is contained in:
@@ -4,19 +4,18 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
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.enums.*;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
|
||||
import net.gepafin.tendermanagement.model.request.ChecklistRequest;
|
||||
import net.gepafin.tendermanagement.model.request.CriteriaRequest;
|
||||
import net.gepafin.tendermanagement.model.request.FieldRequest;
|
||||
import net.gepafin.tendermanagement.model.request.*;
|
||||
import net.gepafin.tendermanagement.model.response.*;
|
||||
import net.gepafin.tendermanagement.repositories.*;
|
||||
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||
import net.gepafin.tendermanagement.service.CallService;
|
||||
import net.gepafin.tendermanagement.service.UserService;
|
||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||
import net.gepafin.tendermanagement.util.Utils;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
@@ -82,6 +81,12 @@ public class ApplicationEvaluationDao {
|
||||
@Autowired
|
||||
private FormDao formDao;
|
||||
|
||||
@Autowired
|
||||
private LoggingUtil loggingUtil;
|
||||
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
private ApplicationEvaluationEntity convertToEntity(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
|
||||
|
||||
ApplicationEvaluationEntity entity = new ApplicationEvaluationEntity();
|
||||
@@ -132,7 +137,6 @@ public class ApplicationEvaluationDao {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void setCriteriaResponses(ApplicationEvaluationEntity entity, ApplicationEvaluationResponse response, List<EvaluationCriteriaEntity> evaluationCriterias) {
|
||||
|
||||
List<CriteriaResponse> criteriaResponsesFromEntity = entity.getCriteria() != null ?
|
||||
@@ -326,7 +330,7 @@ public class ApplicationEvaluationDao {
|
||||
FormEntity formEntity = applicationForm.getForm();
|
||||
if (formEntity != null) {
|
||||
// List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||
contentResponseBeans.forEach(contentResponseBean -> {
|
||||
if ("fileupload".equals(contentResponseBean.getName()) && contentResponseBean.getId().equals(fieldResponse.getId())) {
|
||||
String label = null;
|
||||
@@ -342,7 +346,7 @@ public class ApplicationEvaluationDao {
|
||||
|
||||
Optional<ApplicationFormFieldEntity> optionalFormField =
|
||||
applicationFormFieldRepository.findByFieldIdAndApplicationFormIdAndApplicationFormApplicationId(
|
||||
fieldResponse.getId(), applicationForm.getId(), entity.getApplicationId());
|
||||
fieldResponse.getId(), applicationForm.getId(), entity.getApplicationId());
|
||||
|
||||
if (optionalFormField.isPresent()) {
|
||||
ApplicationFormFieldEntity formField = optionalFormField.get();
|
||||
@@ -403,7 +407,7 @@ public class ApplicationEvaluationDao {
|
||||
response.setBeneficiary(beneficiary);
|
||||
response.setMinScore(call.getThreshold() != null ? call.getThreshold() : null);
|
||||
response.setCallName(application.getCall().getName() != null ? application.getCall().getName() : null);
|
||||
response.setProtocolNumber(application.getProtocol() != null ? application.getProtocol().getProtocolNumber() : null);
|
||||
response.setProtocolNumber((application.getProtocol() != null && application.getProtocol().getProtocolNumber() != null) ? application.getProtocol().getProtocolNumber() : null);
|
||||
response.setSubmissionDate(application.getSubmissionDate() != null ? application.getSubmissionDate() : null);
|
||||
response.setEvaluationDate(application.getSubmissionDate() != null ? application.getSubmissionDate().plusDays(30) : null);
|
||||
LocalDateTime callEndDate = application.getCall().getEndDate();
|
||||
@@ -418,23 +422,31 @@ public class ApplicationEvaluationDao {
|
||||
|
||||
Optional<ApplicationEvaluationEntity> existingEntityOptional =
|
||||
applicationEvaluationRepository.findByAssignedApplicationsEntity_IdAndIsDeletedFalse(assignedApplicationId);
|
||||
ApplicationEvaluationEntity entity;
|
||||
ApplicationEvaluationEntity entity = null;
|
||||
Optional<AssignedApplicationsEntity> assignedApplications =
|
||||
assignedApplicationsRepository.findByIdAndIsDeletedFalse(assignedApplicationId);
|
||||
|
||||
ApplicationEvaluationEntity oldApplicationEvaluation = null;
|
||||
VersionActionTypeEnum actionType = VersionActionTypeEnum.INSERT;
|
||||
if (existingEntityOptional.isPresent()) {
|
||||
entity = existingEntityOptional.get();
|
||||
oldApplicationEvaluation = Utils.getClonedEntityForData(entity);
|
||||
entity.setCriteria(Utils.convertObjectToJson(filterNonNullCriteria(processCriteria(entity, req))));
|
||||
entity.setChecklist(Utils.convertObjectToJson(filterNonNullChecklist(processChecklist(entity, req))));
|
||||
entity.setFile(Utils.convertObjectToJson(filterNonNullFields(processField(entity, req))));
|
||||
entity.setIsDeleted(false);
|
||||
setIfUpdated(entity::getNote, entity::setNote, req.getNote());
|
||||
actionType = VersionActionTypeEnum.UPDATE;
|
||||
} else {
|
||||
entity = convertToEntity(user, req, assignedApplicationId);
|
||||
actionType = VersionActionTypeEnum.INSERT;
|
||||
}
|
||||
ApplicationStatusForEvaluation status = req.getApplicationStatus();
|
||||
|
||||
ApplicationEvaluationEntity savedEntity = applicationEvaluationRepository.save(entity);
|
||||
|
||||
/** This code is responsible for adding a version history log for the "Update Application Evaluation" operation. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(actionType).oldData(oldApplicationEvaluation).newData(entity).build());
|
||||
|
||||
if (status != null) {
|
||||
ApplicationEntity application = applicationService.validateApplication(assignedApplications.get().getApplication().getId());
|
||||
AssignedApplicationsEntity assignedApplicationsEntity = assignedApplications.get();
|
||||
@@ -692,10 +704,10 @@ public class ApplicationEvaluationDao {
|
||||
String formFieldId = criteriaFormField.getFormFieldId();
|
||||
if (!mappedFieldMap.containsKey(formFieldId)) {
|
||||
// CriteriaMappedField mappedField = new CriteriaMappedField();
|
||||
CriteriaMappedField mappedField = populateMappedField(formFieldId, criteriaFormField, applicationForm, applicationId);
|
||||
CriteriaMappedField mappedField = populateMappedField(formFieldId, criteriaFormField, applicationForm, applicationId);
|
||||
if(mappedField != null) {
|
||||
mappedFieldMap.put(formFieldId, mappedField);
|
||||
}
|
||||
mappedFieldMap.put(formFieldId, mappedField);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -704,16 +716,16 @@ public class ApplicationEvaluationDao {
|
||||
}
|
||||
|
||||
private CriteriaMappedField populateMappedField(String formFieldId,
|
||||
CriteriaFormFieldEntity criteriaFormField,
|
||||
ApplicationFormEntity applicationForm, Long applicationId) {
|
||||
CriteriaMappedField mappedField = new CriteriaMappedField();
|
||||
CriteriaFormFieldEntity criteriaFormField,
|
||||
ApplicationFormEntity applicationForm, Long applicationId) {
|
||||
CriteriaMappedField mappedField = new CriteriaMappedField();
|
||||
mappedField.setId(formFieldId);
|
||||
if(Boolean.FALSE.equals(criteriaFormField.getFormId().equals(applicationForm.getForm().getId()))) {
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
formRepository.findById(criteriaFormField.getFormId()).ifPresent(formEntity -> {
|
||||
// List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||
contentResponseBeans.stream().filter(bean -> bean.getId().equals(formFieldId)).findFirst().ifPresent(contentResponseBean -> {
|
||||
String label = getLabel(contentResponseBean);
|
||||
mappedField.setFieldName(contentResponseBean.getName());
|
||||
@@ -832,7 +844,7 @@ public class ApplicationEvaluationDao {
|
||||
}
|
||||
|
||||
private void setChecklistResponses(ApplicationEvaluationEntity entity, Long applicationId, ApplicationEvaluationResponse response,
|
||||
List<CallTargetAudienceChecklistEntity> checklistEntities) {
|
||||
List<CallTargetAudienceChecklistEntity> checklistEntities) {
|
||||
|
||||
List<ChecklistResponse> checklistResponses = entity.getChecklist() != null ? Utils.convertJsonToList(entity.getChecklist(), new TypeReference<List<ChecklistResponse>>() {
|
||||
}) : getChecklistResponse(applicationId);
|
||||
@@ -850,7 +862,7 @@ public class ApplicationEvaluationDao {
|
||||
}
|
||||
|
||||
private void setFileResponses(ApplicationEvaluationEntity entity, Long applicationId, ApplicationEvaluationResponse response,
|
||||
List<ApplicationFormEntity> applicationFormEntities) {
|
||||
List<ApplicationFormEntity> applicationFormEntities) {
|
||||
|
||||
List<FieldResponse> fieldResponses = entity.getFile() != null ? Utils.convertJsonToList(entity.getFile(), new TypeReference<List<FieldResponse>>() {
|
||||
}) : getFieldResponses(applicationId);
|
||||
@@ -865,7 +877,7 @@ public class ApplicationEvaluationDao {
|
||||
FormEntity formEntity = applicationForm.getForm();
|
||||
if (formEntity != null) {
|
||||
// List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||
contentResponseBeans.forEach(contentResponseBean -> {
|
||||
if ("fileupload".equals(contentResponseBean.getName()) && contentResponseBean.getId().equals(fieldResponse.getId())) {
|
||||
String label = null;
|
||||
@@ -881,7 +893,7 @@ public class ApplicationEvaluationDao {
|
||||
|
||||
Optional<ApplicationFormFieldEntity> optionalFormField =
|
||||
applicationFormFieldRepository.findByFieldIdAndApplicationFormIdAndApplicationFormApplicationId(
|
||||
fieldResponse.getId(), applicationForm.getId(), applicationId);
|
||||
fieldResponse.getId(), applicationForm.getId(), applicationId);
|
||||
|
||||
if (optionalFormField.isPresent() && optionalFormField.get().getFieldValue() != null) {
|
||||
String[] documentIds = optionalFormField.get().getFieldValue().split(",");
|
||||
@@ -926,7 +938,7 @@ public class ApplicationEvaluationDao {
|
||||
response.setBeneficiary(beneficiary);
|
||||
|
||||
response.setCallName(application.getCall().getName() != null ? application.getCall().getName() : null);
|
||||
response.setProtocolNumber(application.getProtocol() != null ? application.getProtocol().getProtocolNumber() : null);
|
||||
response.setProtocolNumber((application.getProtocol() != null && application.getProtocol().getProtocolNumber() != null) ? application.getProtocol().getProtocolNumber() : null);
|
||||
response.setSubmissionDate(application.getSubmissionDate() != null ? application.getSubmissionDate() : null);
|
||||
response.setEvaluationDate(application.getSubmissionDate() != null ? application.getSubmissionDate().plusDays(30) : null);
|
||||
|
||||
@@ -998,7 +1010,7 @@ public class ApplicationEvaluationDao {
|
||||
FormEntity formEntity = formRepository.findById(criteriaFormField.getFormId()).orElse(null);
|
||||
if (formEntity != null) {
|
||||
// List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||
contentResponseBeans.stream()
|
||||
.filter(bean -> bean.getId().equals(criteriaFormField.getFormFieldId()))
|
||||
.findFirst()
|
||||
@@ -1083,15 +1095,15 @@ public class ApplicationEvaluationDao {
|
||||
|
||||
private void handleParagraphField(Long applicationId, CriteriaFormFieldEntity criteriaFormField, ContentResponseBean contentResponseBean, CriteriaMappedField mappedField) {
|
||||
findFormFieldValue(applicationId, criteriaFormField.getFormFieldId()).ifPresent(formField -> {
|
||||
String paragraph = contentResponseBean.getSettings().stream()
|
||||
.filter(setting -> "text".equals(setting.getName()))
|
||||
.map(SettingResponseBean::getValue)
|
||||
.map(Object::toString)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (paragraph != null) {
|
||||
mappedField.setFieldValue(paragraph.trim());
|
||||
}
|
||||
String paragraph = contentResponseBean.getSettings().stream()
|
||||
.filter(setting -> "text".equals(setting.getName()))
|
||||
.map(SettingResponseBean::getValue)
|
||||
.map(Object::toString)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (paragraph != null) {
|
||||
mappedField.setFieldValue(paragraph.trim());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
@@ -1276,17 +1288,25 @@ public class ApplicationEvaluationDao {
|
||||
public void deleteById(Long id) {
|
||||
|
||||
ApplicationEvaluationEntity applicationEvaluationEntity = validateApplicationEvaluation(id);
|
||||
ApplicationEvaluationEntity oldApplicationEvaluation = Utils.getClonedEntityForData(applicationEvaluationEntity);
|
||||
applicationEvaluationEntity.setIsDeleted(true);
|
||||
saveApplicationEvaluationEntity(applicationEvaluationEntity);
|
||||
saveApplicationEvaluationEntity(applicationEvaluationEntity, oldApplicationEvaluation);
|
||||
}
|
||||
|
||||
public ApplicationEvaluationEntity saveApplicationEvaluationEntity(ApplicationEvaluationEntity applicationEvaluationEntityData) {
|
||||
public ApplicationEvaluationEntity saveApplicationEvaluationEntity(ApplicationEvaluationEntity applicationEvaluationEntityData, ApplicationEvaluationEntity oldApplicationEvaluation) {
|
||||
|
||||
return applicationEvaluationRepository.save(applicationEvaluationEntityData);
|
||||
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationRepository.save(applicationEvaluationEntityData);
|
||||
|
||||
/** This code is responsible for adding a version history log for the "Delete Application Evaluation" operation. **/
|
||||
loggingUtil.addVersionHistory(
|
||||
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.SOFT_DELETE).oldData(oldApplicationEvaluation).newData(applicationEvaluationEntityData)
|
||||
.build());
|
||||
|
||||
return applicationEvaluationEntity;
|
||||
}
|
||||
|
||||
public ApplicationEvaluationResponse updateApplicationEvaluationStatus(ApplicationEntity application, AssignedApplicationsEntity assignedApplicationsEntity,
|
||||
ApplicationStatusForEvaluation newStatus) {
|
||||
ApplicationStatusForEvaluation newStatus) {
|
||||
|
||||
Optional<ApplicationEvaluationEntity> existingEntityOptional = applicationEvaluationRepository.findByAssignedApplicationsEntity_IdAndIsDeletedFalse(
|
||||
assignedApplicationsEntity.getId());
|
||||
@@ -1297,8 +1317,16 @@ public class ApplicationEvaluationDao {
|
||||
ApplicationEvaluationEntity existingEntity = existingEntityOptional.get();
|
||||
// UserEntity userEntity = userService.validateUser(application.getUserId());
|
||||
// callService.validatePublishedCall(application.getCall().getId(), userEntity.getHub().getId());
|
||||
ApplicationEntity oldApplicationEntity = Utils.getClonedEntityForData(application);
|
||||
application.setStatus(newStatus.getValue());
|
||||
application = applicationRepository.save(application);
|
||||
|
||||
/** This code is responsible for adding a version history log for the "Update Application" operation. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationEntity).newData(application).build());
|
||||
|
||||
ApplicationEvaluationEntity oldApplicationEvaluation = Utils.getClonedEntityForData(existingEntity);
|
||||
AssignedApplicationsEntity oldAssignedApplication = Utils.getClonedEntityForData(assignedApplicationsEntity);
|
||||
|
||||
String statusType = application.getStatus();
|
||||
if (application.getStatus().equals(ApplicationStatusTypeEnum.APPROVED.getValue()) || application.getStatus().equals(ApplicationStatusTypeEnum.REJECTED.getValue())) {
|
||||
existingEntity.setStatus(ApplicationEvaluationStatusTypeEnum.CLOSE.getValue());
|
||||
@@ -1307,9 +1335,24 @@ public class ApplicationEvaluationDao {
|
||||
entity = applicationEvaluationRepository.save(existingEntity);
|
||||
assignedApplicationsRepository.save(assignedApplicationsEntity);
|
||||
|
||||
if (application.getStatus().equals(ApplicationStatusTypeEnum.APPROVED.getValue()) || application.getStatus().equals(ApplicationStatusTypeEnum.REJECTED.getValue())) {
|
||||
|
||||
/** This code is responsible for adding a version history log for the "Update Application Evaluation" operation. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationEvaluation).newData(entity).build());
|
||||
|
||||
/** This code is responsible for adding a version history log for the "Update Assigned Application" operation. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldAssignedApplication).newData(assignedApplicationsEntity).build());
|
||||
}
|
||||
|
||||
|
||||
List<ApplicationAmendmentRequestEntity> amendmentRequest = applicationAmendmentRequestRepository.findAllByApplicationEvaluationIdAndIsDeletedFalse(entity.getId());
|
||||
for (ApplicationAmendmentRequestEntity request : amendmentRequest) {
|
||||
request.setStatus(ApplicationAmendmentRequestEnum.CLOSE.getValue());
|
||||
for (ApplicationAmendmentRequestEntity amendment : amendmentRequest) {
|
||||
ApplicationAmendmentRequestEntity oldAmendment = Utils.getClonedEntityForData(amendment);
|
||||
amendment.setStatus(ApplicationAmendmentRequestEnum.CLOSE.getValue());
|
||||
|
||||
/** This code is responsible for adding a version history log for the "Update Application Amendment" operation. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldAmendment).newData(amendment).build());
|
||||
|
||||
}
|
||||
applicationAmendmentRequestRepository.saveAll(amendmentRequest);
|
||||
if (Boolean.TRUE.equals(statusType.equals((ApplicationStatusTypeEnum.APPROVED.getValue())))) {
|
||||
|
||||
@@ -79,7 +79,7 @@ public class AssignedApplicationsDao {
|
||||
application.setStatus(ApplicationStatusTypeEnum.EVALUATION.getValue());
|
||||
applicationRepository.save(application);
|
||||
|
||||
/** This code is responsible for adding a version history log for the "Create Application" operation. **/
|
||||
/** This code is responsible for adding a version history log for the "Update Application" operation. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationEntity).newData(application).build());
|
||||
|
||||
UserEntity user = userService.validateUser(userId);
|
||||
@@ -170,7 +170,7 @@ public class AssignedApplicationsDao {
|
||||
validator.validatePreInstructor(request, assignedApplicationsEntity.getUserId());
|
||||
AssignedApplicationsEntity oldAssignedApplicationEntity = Utils.getClonedEntityForData(assignedApplicationsEntity);
|
||||
assignedApplicationsEntity.setIsDeleted(true);
|
||||
assignedApplicationsEntity = saveAssignedApplication(assignedApplicationsEntity, oldAssignedApplicationEntity, VersionActionTypeEnum.DELETE);
|
||||
assignedApplicationsEntity = saveAssignedApplication(assignedApplicationsEntity, oldAssignedApplicationEntity, VersionActionTypeEnum.SOFT_DELETE);
|
||||
log.info("Assigned Application deleted with ID: {}", id);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,18 @@ package net.gepafin.tendermanagement.dao;
|
||||
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||
import net.gepafin.tendermanagement.entities.BeneficiaryPreferredCallEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import net.gepafin.tendermanagement.enums.BeneficiaryCallStatus;
|
||||
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.request.BeneficiaryPreferredCallReq;
|
||||
|
||||
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
||||
import net.gepafin.tendermanagement.model.response.BeneficiaryPreferredCallResponseBean;
|
||||
import net.gepafin.tendermanagement.repositories.BeneficiaryPreferredCallRepository;
|
||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||
import net.gepafin.tendermanagement.util.Utils;
|
||||
import net.gepafin.tendermanagement.util.Validator;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||
@@ -36,6 +41,11 @@ public class BeneficiaryPreferredCallDao {
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
|
||||
@Autowired
|
||||
private LoggingUtil loggingUtil;
|
||||
|
||||
@Autowired
|
||||
private HttpServletRequest httpServletRequest;
|
||||
|
||||
public BeneficiaryPreferredCallResponseBean createBeneficiaryPreferredCall(HttpServletRequest httpServletRequest, BeneficiaryPreferredCallReq request, UserEntity user) {
|
||||
log.info("Creating new beneficiary preferred call with details: {}", request);
|
||||
@@ -51,6 +61,10 @@ public class BeneficiaryPreferredCallDao {
|
||||
|
||||
BeneficiaryPreferredCallEntity entity = convertRequestToEntity(request, user);
|
||||
entity = beneficiaryPreferredCallRepository.save(entity);
|
||||
|
||||
/** This code is responsible for adding a version history log for "Create Beneficiary Preferred Call" operation. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(httpServletRequest).actionType(VersionActionTypeEnum.INSERT).oldData(null).newData(entity).build());
|
||||
|
||||
log.info("Beneficiary preferred call created with ID: {}", entity.getId());
|
||||
return convertEntityToResponse(entity);
|
||||
}
|
||||
@@ -92,13 +106,19 @@ public class BeneficiaryPreferredCallDao {
|
||||
log.info("Soft deleting beneficiary preferred call with ID: {}", id);
|
||||
BeneficiaryPreferredCallEntity entity = validateBeneficiaryPreferredCall(id);
|
||||
validator.validateUserId(request, entity.getUserId());
|
||||
BeneficiaryPreferredCallEntity oldBeneficiaryPreferredCallEntity = Utils.getClonedEntityForData(entity);
|
||||
entity.setIsDeleted(true);
|
||||
beneficiaryPreferredCallRepository.save(entity);
|
||||
|
||||
/** This code is responsible for adding a version history log for the "Delete Beneficiary Preferred Call" operation. **/
|
||||
loggingUtil.addVersionHistory(
|
||||
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.SOFT_DELETE).oldData(oldBeneficiaryPreferredCallEntity).newData(entity).build());
|
||||
|
||||
log.info("Beneficiary preferred call soft deleted with ID: {}", id);
|
||||
}
|
||||
|
||||
public List<BeneficiaryPreferredCallResponseBean> getAllBeneficiaryPreferredCalls(HttpServletRequest request) {
|
||||
UserEntity userEntity = validator.validateUser(request);
|
||||
UserEntity userEntity = validator.validateUser(request);
|
||||
log.info("Fetching all beneficiary preferred calls");
|
||||
List<BeneficiaryPreferredCallResponseBean> calls = beneficiaryPreferredCallRepository.findByUserIdAndIsDeletedFalse(userEntity.getId())
|
||||
.stream()
|
||||
@@ -130,8 +150,13 @@ public class BeneficiaryPreferredCallDao {
|
||||
public void updateBeneficiaryPreferredCallStatus(Long id, BeneficiaryCallStatus status) {
|
||||
log.info("Updating status for beneficiary preferred call with ID: {}", id);
|
||||
BeneficiaryPreferredCallEntity existingEntity = validateBeneficiaryPreferredCall(id);
|
||||
BeneficiaryPreferredCallEntity oldBeneficiaryPreferredCallEntity = Utils.getClonedEntityForData(existingEntity);
|
||||
existingEntity.setStatus(status.getValue());
|
||||
beneficiaryPreferredCallRepository.save(existingEntity);
|
||||
|
||||
/** This code is responsible for adding a version history log for the "Update Application" operation. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(httpServletRequest).actionType(VersionActionTypeEnum.UPDATE).oldData(oldBeneficiaryPreferredCallEntity).newData(existingEntity).build());
|
||||
|
||||
log.info("Beneficiary preferred call status updated with ID: {}", existingEntity.getId());
|
||||
}
|
||||
public List<BeneficiaryPreferredCallResponseBean> getBeneficiaryPreferredCallByUserId(UserEntity userEntity, Long companyId) {
|
||||
|
||||
@@ -60,6 +60,17 @@ public enum UserActionContextEnum {
|
||||
GET_ALL_HUB("GET_ALL_HUB"),
|
||||
GET_HUB_BY_UUID(" GET_HUB_BY_UUID"),
|
||||
|
||||
/** Application Evaluation action context **/
|
||||
CREATE_UPDATE_APPLICATION_EVALUATION("CREATE_UPDATE_APPLICATION_EVALUATION"),
|
||||
GET_APPLICATION_EVALUATION("GET_APPLICATION_EVALUATION"),
|
||||
DELETE_APPLICATION_EVALUATION("DELETE_APPLICATION_EVALUATION"),
|
||||
|
||||
/** Beneficiary Preferred Call action context **/
|
||||
CREATE_BENEFICIARY_PREFERRED_CALL("CREATE_BENEFICIARY_PREFERRED_CALL"),
|
||||
DELETE_BENEFICIARY_PREFERRED_CALL("DELETE_BENEFICIARY_PREFERRED_CALL"),
|
||||
GET_BENEFICIARY_PREFERRED_CALL("GET_BENEFICIARY_PREFERRED_CALL"),
|
||||
UPDATE_BENEFICIARY_PREFERRED_CALL("UPDATE_BENEFICIARY_PREFERRED_CALL"),
|
||||
|
||||
/** Assigned Application action context **/
|
||||
CREATE_ASSIGNED_APPLICATION("CREATE_ASSIGNED_APPLICATION"),
|
||||
DELETE_ASSIGNED_APPLICATION("DELETE_ASSIGNED_APPLICATION"),
|
||||
|
||||
@@ -4,10 +4,14 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationStatusForEvaluation;
|
||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
|
||||
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.service.ApplicationEvaluationService;
|
||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||
import net.gepafin.tendermanagement.web.rest.api.ApplicationEvaluationApi;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -23,12 +27,20 @@ public class ApplicationEvaluationApiController implements ApplicationEvaluation
|
||||
@Autowired
|
||||
private ApplicationEvaluationService applicationEvaluationService;
|
||||
|
||||
@Autowired
|
||||
private LoggingUtil loggingUtil;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<ApplicationEvaluationResponse>> createOrUpdateApplicationEvaluation(
|
||||
HttpServletRequest request,
|
||||
Long assignedApplicationsId,
|
||||
ApplicationEvaluationRequest evaluationRequest) {
|
||||
|
||||
/** This code is responsible for creating user action logs for the "Create or update Application Evaluation" operation. **/
|
||||
loggingUtil.logUserAction(
|
||||
UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPDATE).actionContext(UserActionContextEnum.CREATE_UPDATE_APPLICATION_EVALUATION).build());
|
||||
|
||||
|
||||
ApplicationEvaluationResponse response = applicationEvaluationService.createOrUpdateApplicationEvaluation(
|
||||
request, evaluationRequest, assignedApplicationsId);
|
||||
|
||||
@@ -41,6 +53,11 @@ public class ApplicationEvaluationApiController implements ApplicationEvaluation
|
||||
public ResponseEntity<Response<ApplicationEvaluationResponse>> getApplicationEvaluationByApplicationId(
|
||||
HttpServletRequest request, Long applicationId, Long assignedApplicationId) {
|
||||
|
||||
|
||||
/** This code is responsible for creating user action logs for the "Get Application Evaluation" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_APPLICATION_EVALUATION).build());
|
||||
|
||||
|
||||
ApplicationEvaluationResponse response = null;
|
||||
response = applicationEvaluationService.getApplicationEvaluationByApplicationId(request, applicationId,assignedApplicationId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
@@ -50,8 +67,15 @@ public class ApplicationEvaluationApiController implements ApplicationEvaluation
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<Void>> deleteApplicationEvaluation(HttpServletRequest request,
|
||||
Long id) {
|
||||
applicationEvaluationService.deleteApplicationEvaluation(request,id);
|
||||
Long id) {
|
||||
|
||||
|
||||
/** This code is responsible for creating user action logs for the "Delete Application Evaluation" operation. **/
|
||||
loggingUtil.logUserAction(
|
||||
UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.DELETE).actionContext(UserActionContextEnum.DELETE_APPLICATION_EVALUATION).build());
|
||||
|
||||
|
||||
applicationEvaluationService.deleteApplicationEvaluation(request, id);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_DELETED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@@ -4,11 +4,15 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.enums.BeneficiaryCallStatus;
|
||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||
import net.gepafin.tendermanagement.model.request.BeneficiaryPreferredCallReq;
|
||||
|
||||
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||
import net.gepafin.tendermanagement.model.response.BeneficiaryPreferredCallResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.service.BeneficiaryPreferredCallService;
|
||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||
import net.gepafin.tendermanagement.web.rest.api.BeneficiaryPreferredCallApi;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.slf4j.Logger;
|
||||
@@ -27,10 +31,16 @@ public class BeneficiaryPreferredCallApiController implements BeneficiaryPreferr
|
||||
|
||||
@Autowired
|
||||
private BeneficiaryPreferredCallService beneficiaryPreferredCallService;
|
||||
|
||||
@Autowired
|
||||
private LoggingUtil loggingUtil;
|
||||
@Override
|
||||
public ResponseEntity<Response<BeneficiaryPreferredCallResponseBean>> createBeneficiaryPreferredCall(HttpServletRequest request, BeneficiaryPreferredCallReq beneficiaryPreferredCallReq) {
|
||||
log.info("Creating Beneficiary Preferred Call");
|
||||
|
||||
/** This code is responsible for creating user action logs for the "Create Beneficiary Preferred Call" operation. **/
|
||||
loggingUtil.logUserAction(
|
||||
UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.INSERT).actionContext(UserActionContextEnum.CREATE_BENEFICIARY_PREFERRED_CALL).build());
|
||||
|
||||
BeneficiaryPreferredCallResponseBean responseBean = beneficiaryPreferredCallService.createBeneficiaryPreferredCall(request, beneficiaryPreferredCallReq);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(responseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.BENEFICIARY_PREFERRED_CALL_CREATED_SUCCESS_MSG)));
|
||||
@@ -47,6 +57,12 @@ public class BeneficiaryPreferredCallApiController implements BeneficiaryPreferr
|
||||
@Override
|
||||
public ResponseEntity<Response<BeneficiaryPreferredCallResponseBean>> getBeneficiaryPreferredCallById(HttpServletRequest request, Long id) {
|
||||
log.info("Fetching Beneficiary Preferred Call by ID - ID: {}", id);
|
||||
|
||||
|
||||
/** This code is responsible for creating user action logs for the "Get Beneficiary Preferred Call by id" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
||||
.actionContext(UserActionContextEnum.GET_BENEFICIARY_PREFERRED_CALL).build());
|
||||
|
||||
BeneficiaryPreferredCallResponseBean response = beneficiaryPreferredCallService.getBeneficiaryPreferredCallById(request, id);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_BENEFICIARY_PREFERRED_CALL_SUCCESS_MSG)));
|
||||
@@ -55,6 +71,10 @@ public class BeneficiaryPreferredCallApiController implements BeneficiaryPreferr
|
||||
@Override
|
||||
public ResponseEntity<Response<Void>> deleteBeneficiaryPreferredCall(HttpServletRequest request, Long id) {
|
||||
log.info("Deleting Beneficiary Preferred Call - ID: {}", id);
|
||||
|
||||
/** This code is responsible for creating user action logs for the "Delete Beneficiary Preferred Call" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.DELETE).actionContext(UserActionContextEnum.DELETE_BENEFICIARY_PREFERRED_CALL).build());
|
||||
|
||||
beneficiaryPreferredCallService.deleteBeneficiaryPreferredCall(request, id);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.DELETE_BENEFICIARY_PREFERRED_CALL_SUCCESS_MSG)));
|
||||
@@ -63,6 +83,11 @@ public class BeneficiaryPreferredCallApiController implements BeneficiaryPreferr
|
||||
@Override
|
||||
public ResponseEntity<Response<Void>> updateBeneficiaryPreferredCallStatus(HttpServletRequest request, Long id, BeneficiaryCallStatus status) {
|
||||
log.info("Updating status of Beneficiary Preferred Call - ID: {}, Status: {}", id, status);
|
||||
|
||||
/** This code is responsible for "Updating Beneficiary Preferred Call details" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPDATE)
|
||||
.actionContext(UserActionContextEnum.UPDATE_BENEFICIARY_PREFERRED_CALL).build());
|
||||
|
||||
beneficiaryPreferredCallService.updateBeneficiaryPreferredCallStatus(request, id, status);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.BENEFICIARY_PREFERRED_CALL_STATUS_UPDATED_SUCCESS_MSG)));
|
||||
@@ -71,6 +96,10 @@ public class BeneficiaryPreferredCallApiController implements BeneficiaryPreferr
|
||||
@Override
|
||||
public ResponseEntity<Response<List<BeneficiaryPreferredCallResponseBean>>> getBeneficiaryPreferredCallByUserId(HttpServletRequest request,Long userId,Long beneficiaryId,Long companyId) {
|
||||
log.info("Fetching all Beneficiary Preferred Calls for User ID");
|
||||
|
||||
/** This code is responsible for creating user action logs for the "Get Beneficiary Preferred Call" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_BENEFICIARY_PREFERRED_CALL).build());
|
||||
|
||||
List<BeneficiaryPreferredCallResponseBean> response = beneficiaryPreferredCallService.getBeneficiaryPreferredCallByUserId(request, userId,beneficiaryId,companyId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_ALL_BENEFICIARY_PREFERRED_CALLS_SUCCESS_MSG)));
|
||||
|
||||
Reference in New Issue
Block a user