Merge pull request #179 from Kitzanos/feature/GEPAFINBE-143
GEPAFINBE-143(Evaluation Process V2)
This commit is contained in:
@@ -390,5 +390,16 @@ public class GepafinConstant {
|
||||
public static final String VALIDATION_IN_TABLE = "validation.table.message";
|
||||
public static final String CALL_EXPIRED="call.expired";
|
||||
public static final String AMOUNT_REQUEST_SHOULD_GREATED_THEN_ZERO = "amount.request.should.greated.then.zero";
|
||||
|
||||
|
||||
|
||||
public static final String EVALUATION_FORM_CREATED_SUCCESSFULLY = "evaluation.form.created.successfully";
|
||||
public static final String EVALUATION_FORM_UPDATED_SUCCESSFULLY = "evaluation.form.updated.successfully";
|
||||
public static final String EVALUATION_FORM_DELETED_SUCCESSFULLY = "evaluation.form.deleted.successfully";
|
||||
public static final String EVALUATION_FORM_FETCHED_SUCCESSFULLY = "evaluation.form.fetched.successfully";
|
||||
|
||||
public static final String EVALUATION_FORM_NOT_FOUND = "evaluation.form.not.found";
|
||||
|
||||
public static final String EVALUATION_V2_STEP_2 = "EVALUATION_V2_STEP_2";
|
||||
}
|
||||
|
||||
|
||||
@@ -234,6 +234,7 @@ public class ApplicationDao {
|
||||
entity.setUserWithCompany(userWithCompany);
|
||||
entity.setIsDeleted(false);
|
||||
entity.setStatus(ApplicationStatusTypeEnum.DRAFT.getValue());
|
||||
entity.setEvaluationVersion(call.getEvaluationVersion());
|
||||
return entity;
|
||||
}
|
||||
|
||||
@@ -413,6 +414,7 @@ public class ApplicationDao {
|
||||
responseBean.setCallId(applicationEntity.getCall().getId());
|
||||
responseBean.setSubmissionDate(applicationEntity.getSubmissionDate());
|
||||
responseBean.setStatus(applicationEntity.getStatus());
|
||||
responseBean.setEvaluationVersion(EvaluationVersionEnum.valueOf(applicationEntity.getCall().getEvaluationVersion()));
|
||||
responseBean.setComments(applicationEntity.getComments());
|
||||
responseBean.setCompanyId(applicationEntity.getCompanyId());
|
||||
Optional<AssignedApplicationsEntity> assignedApplicationsOptional =
|
||||
|
||||
@@ -634,16 +634,33 @@ public class ApplicationEvaluationDao {
|
||||
application.setAmountAccepted(req.getAmountAccepted());
|
||||
}
|
||||
actionType = VersionActionTypeEnum.UPDATE;
|
||||
|
||||
entity = applicationEvaluationRepository.save(entity);
|
||||
|
||||
} else {
|
||||
AssignedApplicationsEntity assignedApplicationsEntity = assignedApplicationsService.validateAssignedApplication(assignedApplicationId);
|
||||
entity = convertToEntity(user, req, assignedApplicationId);
|
||||
actionType = VersionActionTypeEnum.INSERT;
|
||||
|
||||
entity = applicationEvaluationRepository.save(entity);
|
||||
|
||||
ApplicationEntity oldApplication = Utils.getClonedEntityForData(application);
|
||||
|
||||
application.setApplicationEvaluationId(entity.getId());
|
||||
|
||||
/** This code is responsible for adding a version history log for the "Update Application" operation. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(actionType).oldData(oldApplication).newData(application).build());
|
||||
|
||||
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_CREATION);
|
||||
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_CREATION);
|
||||
notificationDao.sendNotificationToInstructor(placeHolders,entity,NotificationTypeEnum.EVALUATION_CREATION);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** 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());
|
||||
|
||||
ApplicationStatusForEvaluation status = req.getApplicationStatus();
|
||||
// Fetch all amendment request entities associated with the evaluation ID
|
||||
List<ApplicationAmendmentRequestEntity> applicationAmendmentRequestEntities =
|
||||
@@ -653,21 +670,16 @@ public class ApplicationEvaluationDao {
|
||||
}
|
||||
// Fetch amendment details from the request
|
||||
if(req.getAmendmentDetails()!=null) {
|
||||
List<AmendmentDetailsRequest> amendmentDetailsRequests = req.getAmendmentDetails();
|
||||
|
||||
updateAmendmentDocumentsAndFormFields(applicationAmendmentRequestEntities, amendmentDetailsRequests);
|
||||
}
|
||||
|
||||
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());
|
||||
List<AmendmentDetailsRequest> amendmentDetailsRequests = req.getAmendmentDetails();
|
||||
|
||||
updateAmendmentDocumentsAndFormFields(applicationAmendmentRequestEntities, amendmentDetailsRequests);
|
||||
}
|
||||
|
||||
if (status != null) {
|
||||
AssignedApplicationsEntity assignedApplicationsEntity = assignedApplications.get();
|
||||
return updateApplicationEvaluationStatus(application, assignedApplicationsEntity, status);
|
||||
} else {
|
||||
return convertToResponse(savedEntity);
|
||||
return convertToResponse(entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import net.gepafin.tendermanagement.entities.CompanyEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
||||
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
|
||||
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
||||
@@ -202,6 +203,7 @@ public class AssignedApplicationsDao {
|
||||
assignedApplicationsResponse.setSubmissionDate(submissionDate);
|
||||
assignedApplicationsResponse.setCallEndDate(callEndDate);
|
||||
assignedApplicationsResponse.setCallStartDate(callStartDate);
|
||||
assignedApplicationsResponse.setEvaluationVersion(EvaluationVersionEnum.valueOf(application.getCall().getEvaluationVersion()));
|
||||
if(applicationEvaluationEntity.isPresent()){
|
||||
assignedApplicationsResponse.setEvaluationEndDate(applicationEvaluationEntity.get().getEndDate());
|
||||
}
|
||||
|
||||
@@ -116,6 +116,9 @@ public class CallDao {
|
||||
@Autowired
|
||||
private NotificationTypeRepository notificationTypeRepository;
|
||||
|
||||
@Autowired
|
||||
private EvaluationFormDao evalualtionFormDao;
|
||||
|
||||
public CallResponse createCallStep1(CreateCallRequestStep1 createCallRequest, UserEntity userEntity) {
|
||||
createCallRequest.setRegionId(userEntity.getRoleEntity().getRegion().getId());
|
||||
CallEntity callEntity = convertToCallEntity(createCallRequest, userEntity);
|
||||
@@ -178,6 +181,7 @@ public class CallDao {
|
||||
}
|
||||
}
|
||||
callEntity.setStatus(CallStatusEnum.DRAFT.getValue());
|
||||
callEntity.setEvaluationVersion(createCallRequest.getEvaluationVersion().getValue());
|
||||
callEntity.setAmountMax(createCallRequest.getAmountMax());
|
||||
callEntity.setAmount(createCallRequest.getAmount());
|
||||
callEntity.setConfidi(false);
|
||||
@@ -362,6 +366,7 @@ public class CallDao {
|
||||
createCallResponseBean.setDescriptionShort(callEntity.getDescriptionShort());
|
||||
createCallResponseBean.setDescriptionLong(callEntity.getDescriptionLong());
|
||||
createCallResponseBean.setStatus(CallStatusEnum.valueOf(callEntity.getStatus()));
|
||||
createCallResponseBean.setEvaluationVersion(EvaluationVersionEnum.valueOf(callEntity.getEvaluationVersion()));
|
||||
createCallResponseBean.setRegionId(callEntity.getRegion().getId());
|
||||
createCallResponseBean.setAmount(callEntity.getAmount());
|
||||
createCallResponseBean.setAmountMax(callEntity.getAmountMax());
|
||||
@@ -601,6 +606,7 @@ public class CallDao {
|
||||
setIfUpdated(callEntity::getStartTime, callEntity::setStartTime, DateTimeUtil.parseTime(updateCallRequest.getStartTime()));
|
||||
setIfUpdated(callEntity::getEndTime, callEntity::setEndTime, DateTimeUtil.parseTime(updateCallRequest.getEndTime()));
|
||||
setIfUpdated(callEntity::getConfidi, callEntity::setConfidi, updateCallRequest.getConfidi());
|
||||
setIfUpdated(callEntity::getEvaluationVersion, callEntity::setEvaluationVersion, updateCallRequest.getEvaluationVersion().getValue());
|
||||
callEntity = callRepository.save(callEntity);
|
||||
|
||||
/** This code is responsible for adding a version history log for the "update call step 1" operation **/
|
||||
@@ -691,6 +697,7 @@ public class CallDao {
|
||||
callDetailsResponseBean.setDescriptionShort(callEntity.getDescriptionShort());
|
||||
callDetailsResponseBean.setDescriptionLong(callEntity.getDescriptionLong());
|
||||
callDetailsResponseBean.setStatus(CallStatusEnum.valueOf(callEntity.getStatus()));
|
||||
callDetailsResponseBean.setEvaluationVersion(EvaluationVersionEnum.valueOf(callEntity.getEvaluationVersion()));
|
||||
callDetailsResponseBean.setRegionId(callEntity.getRegion().getId());
|
||||
callDetailsResponseBean.setAmount(callEntity.getAmount());
|
||||
callDetailsResponseBean.setAmountMax(callEntity.getAmountMax());
|
||||
@@ -811,7 +818,8 @@ public class CallDao {
|
||||
CallResponse callResponseBean = getCallResponseBean(callEntity);
|
||||
FlowResponseBean flowResponseBean = flowDao.getFlowByCallId(callEntity.getId());
|
||||
List<FormResponseBean> formResponseBean = formDao.getFormsByCallId(callEntity);
|
||||
CallValidatorServiceImpl.validateResponse(callResponseBean,flowResponseBean,formResponseBean);
|
||||
EvaluationFormResponseBean evaluationFormResponseBean = evalualtionFormDao.getEvaluationFormByCallId(callEntity);
|
||||
CallValidatorServiceImpl.validateResponse(callResponseBean,flowResponseBean,formResponseBean,evaluationFormResponseBean);
|
||||
callEntity.setStatus(CallStatusEnum.READY_TO_PUBLISH.getValue());
|
||||
callEntity = callRepository.save(callEntity);
|
||||
|
||||
@@ -1063,4 +1071,15 @@ public class CallDao {
|
||||
return predicates;
|
||||
|
||||
}
|
||||
|
||||
public CallResponse createCallStep2EvaluationV2(CallEntity callEntity, CreateCallRequestStep2EvaluationV2 createCallRequest, UserEntity user) {
|
||||
|
||||
convertToDocumentEntities(createCallRequest.getDocs(), callEntity.getId(), DocumentTypeEnum.DOCUMENT);
|
||||
|
||||
convertToDocumentEntities(createCallRequest.getImages(), callEntity.getId(), DocumentTypeEnum.IMAGES);
|
||||
|
||||
CallResponse createCallResponseBean = getCallResponseBean(callEntity);
|
||||
createCallResponseBean.setCurrentStep(GepafinConstant.EVALUATION_V2_STEP_2);
|
||||
return createCallResponseBean;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
package net.gepafin.tendermanagement.dao;
|
||||
|
||||
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.VersionActionTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.request.*;
|
||||
import net.gepafin.tendermanagement.model.response.ContentResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.EvaluationFormResponseBean;
|
||||
import net.gepafin.tendermanagement.repositories.*;
|
||||
import net.gepafin.tendermanagement.service.EvaluationCriteriaService;
|
||||
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
||||
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;
|
||||
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.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class EvaluationFormDao {
|
||||
|
||||
@Autowired
|
||||
private EvalualtionFormRepository evaluationFormRepository;
|
||||
|
||||
@Autowired
|
||||
private CallDao callDao;
|
||||
|
||||
@Autowired
|
||||
private VatCheckDao vatCheckDao;
|
||||
|
||||
@Autowired
|
||||
private CallRepository callRepository;
|
||||
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
|
||||
@Autowired
|
||||
private CriteriaFormFieldRepository criteriaFormFieldRepository;
|
||||
|
||||
@Autowired
|
||||
private EvaluationCriteriaService evaluationCriteriaService;
|
||||
|
||||
@Autowired
|
||||
private LoggingUtil loggingUtil;
|
||||
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
public EvaluationFormEntity saveEvaluationFormEntity(EvaluationFormEntity evaluationFormEntity){
|
||||
evaluationFormEntity= evaluationFormRepository.save(evaluationFormEntity);
|
||||
return evaluationFormEntity;
|
||||
}
|
||||
|
||||
public EvaluationFormEntity convertEvaluationFormRequestToEvaluationFormEntity(CallEntity callEntity, EvaluationFormRequest formRequest) {
|
||||
|
||||
EvaluationFormEntity evaluationFormEntity = new EvaluationFormEntity();
|
||||
evaluationFormEntity.setCall(callEntity);
|
||||
evaluationFormEntity.setLabel(formRequest.getLabel());
|
||||
evaluationFormEntity.setContent(setContentResponseBean(formRequest.getContent()));
|
||||
evaluationFormEntity.setIsDeleted(false);
|
||||
evaluationFormEntity = saveEvaluationFormEntity(evaluationFormEntity);
|
||||
|
||||
/** This code is responsible for adding a version history log for the "Create form" operation. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(null).newData(evaluationFormEntity).build());
|
||||
|
||||
return evaluationFormEntity;
|
||||
}
|
||||
|
||||
public EvaluationFormResponseBean convertEvaluationFormEntityToEvaluationFormResponseBean(EvaluationFormEntity formEntity) {
|
||||
EvaluationFormResponseBean evaluationFormResponseBean =new EvaluationFormResponseBean();
|
||||
evaluationFormResponseBean.setId(formEntity.getId());
|
||||
evaluationFormResponseBean.setContent(setContent(formEntity));
|
||||
evaluationFormResponseBean.setLabel(formEntity.getLabel());
|
||||
evaluationFormResponseBean.setCallId(formEntity.getCall().getId());
|
||||
evaluationFormResponseBean.setCallStatus(formEntity.getCall().getStatus());
|
||||
return evaluationFormResponseBean;
|
||||
}
|
||||
|
||||
private List<ContentResponseBean> setContent(EvaluationFormEntity formEntity) {
|
||||
List<ContentResponseBean> contentList = Utils.convertJsonStringToList(formEntity.getContent(),
|
||||
ContentResponseBean.class);
|
||||
return contentList;
|
||||
}
|
||||
|
||||
public EvaluationFormResponseBean createEvaluationForm(CallEntity callEntity, EvaluationFormRequest formRequest) {
|
||||
|
||||
validateEvaluationForm(formRequest);
|
||||
EvaluationFormEntity formEntity = convertEvaluationFormRequestToEvaluationFormEntity(callEntity, formRequest);
|
||||
return convertEvaluationFormEntityToEvaluationFormResponseBean(formEntity);
|
||||
}
|
||||
|
||||
public void validateEvaluationForm(EvaluationFormRequest formRequest){
|
||||
if(formRequest.getContent()==null || formRequest.getLabel()==null ){
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.REQUIRED_PARAMETER_NOT_FOUND_FOR_FORM));
|
||||
}
|
||||
}
|
||||
public EvaluationFormResponseBean updateEvaluationForm(UserEntity user, Long formId, EvaluationFormRequest formRequest) {
|
||||
EvaluationFormEntity evaluationFormEntity = validateForm(formId);
|
||||
//cloned for old form data
|
||||
EvaluationFormEntity oldFormData = Utils.getClonedEntityForData(evaluationFormEntity);
|
||||
|
||||
Utils.setIfUpdated(evaluationFormEntity::getLabel, evaluationFormEntity::setLabel, formRequest.getLabel());
|
||||
Utils.setIfUpdated(evaluationFormEntity::getContent, evaluationFormEntity::setContent, setContentResponseBean(formRequest.getContent()));
|
||||
evaluationFormEntity.setUpdatedDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||
evaluationFormEntity = saveEvaluationFormEntity(evaluationFormEntity);
|
||||
|
||||
/** This code is responsible for adding a version history log for the "Update form data" operation. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldFormData).newData(evaluationFormEntity).build());
|
||||
return convertEvaluationFormEntityToEvaluationFormResponseBean(evaluationFormEntity);
|
||||
|
||||
}
|
||||
|
||||
public EvaluationFormEntity validateForm(Long formId) {
|
||||
EvaluationFormEntity evaluationFormEntity = evaluationFormRepository.findByIdAndIsDeletedFalse(formId);
|
||||
if (evaluationFormEntity == null) {
|
||||
throw new ResourceNotFoundException(
|
||||
Status.NOT_FOUND,
|
||||
Translator.toLocale(GepafinConstant.EVALUATION_FORM_NOT_FOUND)
|
||||
);
|
||||
}
|
||||
return evaluationFormEntity;
|
||||
}
|
||||
|
||||
|
||||
public EvaluationFormResponseBean getEvaluationFormById(UserEntity user, Long formId) {
|
||||
EvaluationFormEntity evaluationFormEntity = validateForm(formId);
|
||||
validator.validateUserWithCall(user, evaluationFormEntity.getCall().getId());
|
||||
return convertEvaluationFormEntityToEvaluationFormResponseBean(evaluationFormEntity);
|
||||
}
|
||||
public void deleteEvaluationForm(UserEntity user, Long formId){
|
||||
EvaluationFormEntity evaluationFormEntity = validateForm(formId);
|
||||
EvaluationFormEntity clonedData = Utils.getClonedEntityForData(evaluationFormEntity);
|
||||
validator.validateUserWithCall(user, evaluationFormEntity.getCall().getId());
|
||||
evaluationFormEntity.setIsDeleted(Boolean.TRUE);
|
||||
evaluationFormEntity = saveEvaluationFormEntity(evaluationFormEntity);
|
||||
/** This code is responsible for adding a version history log for the "soft deleting evaluation from field" operation. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.SOFT_DELETE).oldData(clonedData).newData(evaluationFormEntity).build());
|
||||
|
||||
|
||||
}
|
||||
public EvaluationFormResponseBean getEvaluationFormByCallId(CallEntity callEntity) {
|
||||
if (callEntity == null) {
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||
Translator.toLocale(GepafinConstant.CALL_NOT_FOUND));
|
||||
}
|
||||
|
||||
EvaluationFormEntity formEntity = evaluationFormRepository
|
||||
.findByCallIdAndIsDeletedFalse(callEntity.getId());
|
||||
if(formEntity!=null)
|
||||
return convertEvaluationFormEntityToEvaluationFormResponseBean(formEntity);
|
||||
else return null;
|
||||
}
|
||||
|
||||
|
||||
public String setContentResponseBean(List<ContentRequestBean> contentRequestBeans){
|
||||
String stringContentRequest = Utils.convertListToJsonString(contentRequestBeans);
|
||||
List<ContentRequestBean> cloneContentRequestBeans = Utils.convertJsonStringToList(stringContentRequest, ContentRequestBean.class);
|
||||
cloneContentRequestBeans.forEach(data->data.setCriteria(null));
|
||||
return Utils.convertListToJsonString(cloneContentRequestBeans);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -68,4 +68,10 @@ public class ApplicationEntity extends BaseEntity {
|
||||
@Column(name="DATE_REJECTED")
|
||||
private LocalDateTime dateRejected;
|
||||
|
||||
@Column(name = "evaluationVersion")
|
||||
private String evaluationVersion;
|
||||
|
||||
@Column(name = "APPLICATION_EVALUATION_ID")
|
||||
private Long applicationEvaluationId;
|
||||
|
||||
}
|
||||
@@ -88,5 +88,8 @@ public class CallEntity extends BaseEntity {
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "HUB_ID")
|
||||
private HubEntity hub;
|
||||
|
||||
@Column(name = "evaluationVersion")
|
||||
private String evaluationVersion;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package net.gepafin.tendermanagement.entities;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@Entity
|
||||
@Table(name = "EVALUATION_FORM")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class EvaluationFormEntity extends BaseEntity{
|
||||
|
||||
|
||||
@Column(name = "LABEL")
|
||||
private String label;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "CALL_ID")
|
||||
private CallEntity call;
|
||||
|
||||
@Column(name = "CONTENT")
|
||||
private String content;
|
||||
|
||||
@Column(name="IS_DELETED")
|
||||
private Boolean isDeleted;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package net.gepafin.tendermanagement.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public enum EvaluationVersionEnum {
|
||||
V1("V1"),
|
||||
V2("V2");
|
||||
private String value;
|
||||
|
||||
EvaluationVersionEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static EvaluationVersionEnum fromValue(String value) {
|
||||
for (EvaluationVersionEnum b : EvaluationVersionEnum.values()) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
public static List<String> getStatusValues() {
|
||||
return Arrays.stream(EvaluationVersionEnum.values())
|
||||
.map(EvaluationVersionEnum::getValue)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,11 @@ public enum UserActionContextEnum {
|
||||
GET_CALL("GET_CALL"),
|
||||
DOWNLOAD_CALL_DOCUMENT("DOWNLOAD_CALL_DOCUMENT"),
|
||||
|
||||
|
||||
/** Evaluation V2 call action context **/
|
||||
EVALUATION_V2_CREATE_UPDATE_CALL_STEP_2("EVALUATION_V2_CREATE_UPDATE_CALL_STEP_2"),
|
||||
|
||||
|
||||
/** user action context **/
|
||||
CREATE_USER("CREATE_USER"),
|
||||
USER_LOGIN("USER_LOGIN"),
|
||||
@@ -173,6 +178,13 @@ public enum UserActionContextEnum {
|
||||
GET_ALL_APPLICATION_BY_PAGINATION("GET_ALL_APPLICATION_BY_PAGINATION"),
|
||||
|
||||
|
||||
/** Evaluation form action context **/
|
||||
GET_EVALUATION_FORM("GET_EVALUATION_FORM"),
|
||||
CREATE_EVALUATION_FORM("CREATE_EVALUATION_FORM"),
|
||||
UPDATE_EVALUATION_FORM("UPDATE_EVALUATION_FORM"),
|
||||
DELETE_EVALUATION_FORM("DELETE_EVALUATION_FORM"),
|
||||
|
||||
|
||||
GET_USER_ACTION("GET_USER_ACTION"),
|
||||
GET_ACTION_CONTEXT_LABELS("GET_ACTION_CONTEXT_LABELS");
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||
|
||||
@Data
|
||||
public class CreateCallRequestStep1 {
|
||||
@@ -41,4 +42,5 @@ public class CreateCallRequestStep1 {
|
||||
|
||||
private List<FaqReq> faq;
|
||||
|
||||
private EvaluationVersionEnum evaluationVersion;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package net.gepafin.tendermanagement.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CreateCallRequestStep2EvaluationV2 {
|
||||
|
||||
private List<DocumentReq> docs;
|
||||
|
||||
private List<DocumentReq> images;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package net.gepafin.tendermanagement.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class EvaluationFormRequest {
|
||||
|
||||
private String label;
|
||||
|
||||
private List<ContentRequestBean> content;
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||
|
||||
@Data
|
||||
public class UpdateCallRequestStep1 {
|
||||
@@ -40,4 +41,6 @@ public class UpdateCallRequestStep1 {
|
||||
|
||||
private List<FaqReq> faq;
|
||||
|
||||
private EvaluationVersionEnum evaluationVersion;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationFormFieldResponseBean;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -49,4 +50,6 @@ public class ApplicationResponse{
|
||||
|
||||
private LocalDateTime dateRejected;
|
||||
|
||||
private EvaluationVersionEnum evaluationVersion;
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
||||
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||
import net.gepafin.tendermanagement.model.BaseBean;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -22,6 +23,7 @@ public class AssignedApplicationsResponse extends BaseBean {
|
||||
private LocalDateTime callEndDate;
|
||||
private String companyName;
|
||||
private LocalDateTime evaluationEndDate;
|
||||
private EvaluationVersionEnum evaluationVersion;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -55,4 +56,6 @@ public class CallDetailsResponseBean {
|
||||
private LocalDateTime updatedDate;
|
||||
|
||||
private Long preferredCallId;
|
||||
|
||||
private EvaluationVersionEnum evaluationVersion;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.List;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Data;
|
||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||
import net.gepafin.tendermanagement.util.DynamicLocalTimeSerializer;
|
||||
|
||||
@Data
|
||||
@@ -74,6 +75,8 @@ public class CallResponse {
|
||||
private String currentStep;
|
||||
|
||||
private Long preferredCallId;
|
||||
|
||||
private EvaluationVersionEnum evaluationVersion;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class EvaluationFormResponseBean {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String callStatus;
|
||||
|
||||
private String label;
|
||||
|
||||
private Long callId;
|
||||
|
||||
private List<ContentResponseBean> content;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.EvaluationFormEntity;
|
||||
import net.gepafin.tendermanagement.entities.FormEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
@Repository
|
||||
public interface EvalualtionFormRepository extends JpaRepository<EvaluationFormEntity,Long> {
|
||||
|
||||
EvaluationFormEntity findByCallIdAndIsDeletedFalse(Long callId);
|
||||
EvaluationFormEntity findByIdAndIsDeletedFalse(Long formId);
|
||||
List<EvaluationFormEntity> findByIdInAndIsDeletedFalse(List<Long> evaluationFormId);
|
||||
}
|
||||
@@ -5,17 +5,15 @@ import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.entities.CallEntity;
|
||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||
import net.gepafin.tendermanagement.model.request.CallPageableRequestBean;
|
||||
import net.gepafin.tendermanagement.model.request.CreateCallRequestStep1;
|
||||
import net.gepafin.tendermanagement.model.request.CreateCallRequestStep2;
|
||||
import net.gepafin.tendermanagement.model.request.UpdateCallRequestStep1;
|
||||
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||
import net.gepafin.tendermanagement.model.request.*;
|
||||
import net.gepafin.tendermanagement.model.response.CallDetailsResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.CallResponse;
|
||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||
|
||||
public interface CallService {
|
||||
|
||||
CallResponse createCallStep1(HttpServletRequest request, CreateCallRequestStep1 createCallRequest);
|
||||
CallResponse createCallStep1(HttpServletRequest request, CreateCallRequestStep1 createCallRequest );
|
||||
|
||||
CallResponse createCallStep2(HttpServletRequest request, Long callId, CreateCallRequestStep2 createCallRequest);
|
||||
|
||||
@@ -36,5 +34,7 @@ public interface CallService {
|
||||
byte[] downloadCallDocumentsAsZip(HttpServletRequest request, Long callId);
|
||||
|
||||
PageableResponseBean<List<CallDetailsResponseBean>> getAllCallsByPagination(HttpServletRequest request, Long companyId , Boolean onlyPreferredCall,CallPageableRequestBean callPageableRequestBean);
|
||||
|
||||
CallResponse createCallStep2EvaluationV2(HttpServletRequest request, Long callId, CreateCallRequestStep2EvaluationV2 createCallRequest);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package net.gepafin.tendermanagement.service;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||
import net.gepafin.tendermanagement.entities.EvaluationFormEntity;
|
||||
import net.gepafin.tendermanagement.entities.FormEntity;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationFormFieldRequestBean;
|
||||
import net.gepafin.tendermanagement.model.request.EvaluationFormRequest;
|
||||
import net.gepafin.tendermanagement.model.response.EvaluationFormResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.FormResponseBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EvaluationFormService {
|
||||
|
||||
public EvaluationFormResponseBean createEvaluationForm(HttpServletRequest request, Long callId, EvaluationFormRequest formRequest);
|
||||
|
||||
public EvaluationFormResponseBean updateEvaluationForm(HttpServletRequest request, Long evaluationFormId, EvaluationFormRequest formRequest);
|
||||
|
||||
public EvaluationFormResponseBean getEvaluationFormById(HttpServletRequest request, Long evaluationFormId);
|
||||
|
||||
public void deleteEvaluationForm(HttpServletRequest request, Long evaluationFormId);
|
||||
|
||||
public EvaluationFormEntity validateEvaluationForm(Long id);
|
||||
|
||||
public EvaluationFormResponseBean getEvaluationFormByCallId(HttpServletRequest request, Long callId);
|
||||
|
||||
}
|
||||
@@ -5,10 +5,8 @@ import net.gepafin.tendermanagement.dao.CallDao;
|
||||
import net.gepafin.tendermanagement.entities.CallEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||
import net.gepafin.tendermanagement.model.request.CallPageableRequestBean;
|
||||
import net.gepafin.tendermanagement.model.request.CreateCallRequestStep1;
|
||||
import net.gepafin.tendermanagement.model.request.CreateCallRequestStep2;
|
||||
import net.gepafin.tendermanagement.model.request.UpdateCallRequestStep1;
|
||||
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||
import net.gepafin.tendermanagement.model.request.*;
|
||||
import net.gepafin.tendermanagement.model.response.CallDetailsResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.CallResponse;
|
||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||
@@ -110,5 +108,11 @@ public class CallServiceImpl implements CallService {
|
||||
UserEntity user = validator.validateUser(request);
|
||||
return callDao.getAllCallsByPagination(request,user,companyId,onlyPreferredCall,callPageableRequestBean);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CallResponse createCallStep2EvaluationV2(HttpServletRequest request, Long callId, CreateCallRequestStep2EvaluationV2 createCallRequest) {
|
||||
UserEntity user = validator.validateUser(request);
|
||||
CallEntity call = validator.validateUserWithCall(user, callId);
|
||||
return callDao.createCallStep2EvaluationV2(call, createCallRequest, user);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ import java.util.List;
|
||||
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||
import net.gepafin.tendermanagement.model.response.CallResponse;
|
||||
import net.gepafin.tendermanagement.model.response.EvaluationFormResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.FlowResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.FormResponseBean;
|
||||
import net.gepafin.tendermanagement.util.FieldValidator;
|
||||
@@ -15,7 +17,7 @@ import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationExceptio
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
|
||||
public class CallValidatorServiceImpl {
|
||||
public static void validateResponse(CallResponse response, FlowResponseBean flowResponse, List<FormResponseBean> formResponses) {
|
||||
public static void validateResponse(CallResponse response, FlowResponseBean flowResponse, List<FormResponseBean> formResponses, EvaluationFormResponseBean evaluationFormResponseBean) {
|
||||
// Validate CallResponse (existing logic)
|
||||
FieldValidator data = FieldValidator.create()
|
||||
.notNull(response.getId(), "id")
|
||||
@@ -28,26 +30,32 @@ public class CallValidatorServiceImpl {
|
||||
.notNull(response.getRegionId(), "regionId")
|
||||
.notNull(response.getAmount(), "amount")
|
||||
.notNull(response.getAmountMax(), "amountMax")
|
||||
.notNull(response.getThreshold(), "threshold")
|
||||
.notNull(response.getEmail(),"email")
|
||||
.notNull(response.getAmountMin(),"amountMin")
|
||||
.notNull(response.getStartTime(),"startTime")
|
||||
.notNull(response.getEndTime(),"endTime")
|
||||
.notNull(response.getDocumentationRequested(), "documentationRequested")
|
||||
.notEmpty(response.getAimedTo(), "aimedTo")
|
||||
.notEmpty(response.getCriteria(), "criteria")
|
||||
.notEmpty(response.getDocs(), "docs")
|
||||
.notEmpty(response.getCheckList(), "checkList");
|
||||
.notEmpty(response.getDocs(), "docs");
|
||||
if (response.getEvaluationVersion() == EvaluationVersionEnum.V1) {
|
||||
|
||||
data = data.notEmpty(response.getCheckList(), "checkList")
|
||||
.notEmpty(response.getCriteria(), "criteria")
|
||||
.notNull(response.getThreshold(), "threshold");
|
||||
}
|
||||
|
||||
if (response.getEvaluationVersion() == EvaluationVersionEnum.V2 && evaluationFormResponseBean == null) {
|
||||
data.addError(Translator.toLocale(GepafinConstant.EVALUATION_FORM_NOT_FOUND));
|
||||
}
|
||||
if (response.getDates().get(0) == null || response.getDates().get(1) == null
|
||||
|| response.getDates().get(0).toLocalDate().isBefore(LocalDate.now())
|
||||
|| response.getDates().get(1).toLocalDate().isBefore(LocalDate.now())
|
||||
|| response.getDates().get(0).toLocalDate().isAfter(response.getDates().get(1).toLocalDate())) {
|
||||
data = data.addError(Translator.toLocale(GepafinConstant.INVALID_DATE_MSG));
|
||||
}
|
||||
if (flowResponse == null || ((flowResponse.getFlowData() == null || flowResponse.getFlowData().isEmpty())
|
||||
&& (flowResponse.getFlowEdges() == null || flowResponse.getFlowEdges().isEmpty()))) {
|
||||
|
||||
if (flowResponse == null || ((flowResponse.getFlowData() == null || flowResponse.getFlowData().isEmpty()))
|
||||
&& (flowResponse.getFlowEdges() == null || flowResponse.getFlowEdges().isEmpty())) {
|
||||
data.addError(Translator.toLocale(GepafinConstant.FLOW_NOT_FOUND));
|
||||
}
|
||||
if (formResponses == null || formResponses.isEmpty()) {
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package net.gepafin.tendermanagement.service.impl;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.dao.EvaluationFormDao;
|
||||
import net.gepafin.tendermanagement.entities.*;
|
||||
import net.gepafin.tendermanagement.model.request.EvaluationFormRequest;
|
||||
import net.gepafin.tendermanagement.model.response.EvaluationFormResponseBean;
|
||||
import net.gepafin.tendermanagement.service.EvaluationFormService;
|
||||
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 EvaluationFormServiceImpl implements EvaluationFormService {
|
||||
|
||||
@Autowired
|
||||
private EvaluationFormDao evalauationFormDao;
|
||||
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
|
||||
@Override
|
||||
public EvaluationFormResponseBean createEvaluationForm(HttpServletRequest request, Long callId, EvaluationFormRequest evaluationFormRequest) {
|
||||
UserEntity user = validator.validateUser(request);
|
||||
CallEntity call = validator.validateUserWithCall(user, callId);
|
||||
return evalauationFormDao.createEvaluationForm(call,evaluationFormRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EvaluationFormResponseBean updateEvaluationForm(HttpServletRequest request, Long evaluationFormId, EvaluationFormRequest evaluationFormRequest) {
|
||||
UserEntity user = validator.validateUser(request);
|
||||
return evalauationFormDao.updateEvaluationForm(user, evaluationFormId,evaluationFormRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EvaluationFormResponseBean getEvaluationFormById(HttpServletRequest request, Long evaluationFormId) {
|
||||
UserEntity user = validator.validateUser(request);
|
||||
return evalauationFormDao.getEvaluationFormById(user, evaluationFormId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteEvaluationForm(HttpServletRequest request, Long evaluationFormId) {
|
||||
UserEntity user = validator.validateUser(request);
|
||||
evalauationFormDao.deleteEvaluationForm(user, evaluationFormId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EvaluationFormEntity validateEvaluationForm(Long id) {
|
||||
return evalauationFormDao.validateForm(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EvaluationFormResponseBean getEvaluationFormByCallId(HttpServletRequest request, Long callId) {
|
||||
UserEntity user = validator.validateUser(request);
|
||||
CallEntity call = validator.validateUserWithCall(user, callId);
|
||||
return evalauationFormDao.getEvaluationFormByCallId(call);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -3,7 +3,8 @@ package net.gepafin.tendermanagement.web.rest.api;
|
||||
import java.util.List;
|
||||
|
||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||
import net.gepafin.tendermanagement.model.request.CallPageableRequestBean;
|
||||
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||
import net.gepafin.tendermanagement.model.request.*;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -19,9 +20,6 @@ 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.CreateCallRequestStep1;
|
||||
import net.gepafin.tendermanagement.model.request.CreateCallRequestStep2;
|
||||
import net.gepafin.tendermanagement.model.request.UpdateCallRequestStep1;
|
||||
import net.gepafin.tendermanagement.model.response.CallDetailsResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.CallResponse;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
@@ -164,5 +162,20 @@ public interface CallApi {
|
||||
ResponseEntity<Response<PageableResponseBean<List<CallDetailsResponseBean>>>> getAllCallsByPagination(HttpServletRequest request,@RequestParam(value = "companyId", required = false) Long companyId , @RequestParam(value = "onlyPreferredCall", required = false, defaultValue = "false") Boolean onlyPreferredCall, @RequestBody CallPageableRequestBean callPageableRequestBean);
|
||||
|
||||
|
||||
@Operation(summary = "Api to update call step 2 (Evaluation V2)",
|
||||
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 = "/step2-v2/{callId}", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN')")
|
||||
public ResponseEntity<Response<CallResponse>> createCallStep2EvaluationV2(HttpServletRequest request,
|
||||
@Parameter(description = "The call id", required = true) @PathVariable("callId") Long callId,
|
||||
@Parameter(description = "Call request object", required = true) @Valid @RequestBody CreateCallRequestStep2EvaluationV2 createCallRequest);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
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.EvaluationFormRequest;
|
||||
import net.gepafin.tendermanagement.model.response.EvaluationFormResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.FormResponseBean;
|
||||
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 EvaluationFormApi {
|
||||
|
||||
@Operation(summary = "Api to create Evaluation form (Evaluation V2)",
|
||||
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 = "/call/{callId}", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN')")
|
||||
public ResponseEntity<Response<EvaluationFormResponseBean>> createEvaluationForm(HttpServletRequest request, @Parameter(description = "The call ID", required = true) @PathVariable("callId") Long callId,
|
||||
@Parameter(description = "evaluationForm request object", required = true)
|
||||
@Valid @RequestBody EvaluationFormRequest evaluationFormRequest);
|
||||
|
||||
|
||||
@Operation(summary = "Api to update Evaluation form (Evaluation V2)",
|
||||
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 = "/{evaluationFormId}",
|
||||
produces = { "application/json" })
|
||||
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN')")
|
||||
ResponseEntity<Response<EvaluationFormResponseBean>> updateEvaluationForm(HttpServletRequest request,
|
||||
@Parameter(description = "The Evaluation form ID", required = true) @PathVariable("evaluationFormId") Long evaluationFormId,
|
||||
@Parameter(description = "Evaluation form request object", required = true) @Valid @RequestBody EvaluationFormRequest evaluationFormRequest);
|
||||
|
||||
@Operation(summary = "Api to get Evaluation form by id (Evaluation V2)",
|
||||
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 = "/{evaluationFormId}",
|
||||
produces = { "application/json" })
|
||||
ResponseEntity<Response<EvaluationFormResponseBean>> getEvaluationFormById(HttpServletRequest request,
|
||||
@Parameter(description = "The Evaluation form ID", required = true) @PathVariable("evaluationFormId") Long evaluationFormId);
|
||||
|
||||
|
||||
@Operation(summary = "Api to delete Evaluation form (Evaluation V2)",
|
||||
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 = "/{evaluationFormId}")
|
||||
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN')")
|
||||
ResponseEntity<Response<Void>> deleteEvaluationForm(HttpServletRequest request,
|
||||
@Parameter(description = "The Evaluation form ID", required = true) @PathVariable("evaluationFormId") Long evaluationFormId);
|
||||
|
||||
@Operation(summary = "Api to get Evaluation forms by callId (Evaluation V2)",
|
||||
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 = "/call/{callId}",
|
||||
produces = { "application/json" })
|
||||
ResponseEntity<Response<EvaluationFormResponseBean>> getEvaluationFormByCallId(HttpServletRequest request,
|
||||
@Parameter(description = "The call ID", required = true) @PathVariable("callId") Long callId);
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||
import java.util.List;
|
||||
|
||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||
import net.gepafin.tendermanagement.model.request.*;
|
||||
@@ -160,6 +161,17 @@ public class CallApiController implements CallApi {
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(callsByPagination, Status.SUCCESS, Translator.toLocale(GepafinConstant.CALL_FETCH_SUCCESS_MSG)));
|
||||
}
|
||||
@Override
|
||||
@Transactional(rollbackFor=Exception.class)
|
||||
public ResponseEntity<Response<CallResponse>> createCallStep2EvaluationV2(HttpServletRequest request, Long callId, CreateCallRequestStep2EvaluationV2 createCallRequest) {
|
||||
|
||||
/** This code is responsible for creating user action logs for the "Create or update Call step 2 for Evaluation V2" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPDATE)
|
||||
.actionContext(UserActionContextEnum.EVALUATION_V2_CREATE_UPDATE_CALL_STEP_2).build());
|
||||
|
||||
CallResponse createCallStep2EvaluationV2 = callService.createCallStep2EvaluationV2(request, callId, createCallRequest);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(createCallStep2EvaluationV2, Status.SUCCESS, Translator.toLocale(GepafinConstant.CALL_CREATED_SUCCESSFULLY_MSG)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
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.UserActionContextEnum;
|
||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||
import net.gepafin.tendermanagement.model.request.EvaluationFormRequest;
|
||||
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||
import net.gepafin.tendermanagement.model.response.EvaluationFormResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.service.EvaluationFormService;
|
||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||
import net.gepafin.tendermanagement.web.rest.api.EvaluationFormApi;
|
||||
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/evaluationForm}")
|
||||
public class EvaluationFormApiController implements EvaluationFormApi {
|
||||
|
||||
@Autowired
|
||||
private EvaluationFormService evaluationFormService;
|
||||
|
||||
@Autowired
|
||||
private LoggingUtil loggingUtil;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<EvaluationFormResponseBean>> createEvaluationForm(HttpServletRequest request, Long callId, EvaluationFormRequest evaluationFormRequest) {
|
||||
|
||||
/** This code is responsible for creating user action logs for the "Create Evaluation form" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.INSERT).actionContext(UserActionContextEnum.CREATE_EVALUATION_FORM).build());
|
||||
|
||||
EvaluationFormResponseBean evaluationFormResponseBean = evaluationFormService.createEvaluationForm(request,callId, evaluationFormRequest);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(evaluationFormResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FORM_CREATED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<EvaluationFormResponseBean>> updateEvaluationForm(HttpServletRequest request, Long evaluationFormId, EvaluationFormRequest evaluationFormRequest) {
|
||||
|
||||
/** This code is responsible for creating user action logs for the "Update Evaluation form" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPDATE).actionContext(UserActionContextEnum.UPDATE_EVALUATION_FORM).build());
|
||||
|
||||
EvaluationFormResponseBean evaluationFormResponseBean = evaluationFormService.updateEvaluationForm(request, evaluationFormId, evaluationFormRequest);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(evaluationFormResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FORM_UPDATED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<EvaluationFormResponseBean>> getEvaluationFormById(HttpServletRequest request, Long evaluationFormId) {
|
||||
|
||||
/** This code is responsible for creating user action logs for the "Get Evaluation form by id" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_EVALUATION_FORM).build());
|
||||
|
||||
EvaluationFormResponseBean evaluationFormResponseBean= evaluationFormService.getEvaluationFormById(request,evaluationFormId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(evaluationFormResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FORM_FETCHED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<Void>> deleteEvaluationForm(HttpServletRequest request, Long evaluationFormId) {
|
||||
|
||||
/** This code is responsible for creating user action logs for the "delete Evaluation form" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.DELETE).actionContext(UserActionContextEnum.DELETE_EVALUATION_FORM).build());
|
||||
|
||||
evaluationFormService.deleteEvaluationForm(request,evaluationFormId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FORM_DELETED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<EvaluationFormResponseBean>> getEvaluationFormByCallId(HttpServletRequest request, Long callId) {
|
||||
|
||||
/** This code is responsible for creating user action logs for the "Get Evaluation forms by call id" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_EVALUATION_FORM).build());
|
||||
|
||||
EvaluationFormResponseBean evaluationFormResponseBean= evaluationFormService.getEvaluationFormByCallId(request,callId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(evaluationFormResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FORM_FETCHED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2253,5 +2253,57 @@
|
||||
<where>unique_uuid = 'p4lk3bcx1RStqTaIVVbXs'</where>
|
||||
</update>
|
||||
</changeSet>
|
||||
<changeSet id="23-01-2025_RK_195215" author="Rajesh Khore">
|
||||
<createTable tableName="evaluation_form">
|
||||
<column name="id" type="INTEGER" autoIncrement="true">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="evaluation_form_pkey"/>
|
||||
</column>
|
||||
<column name="label" type="VARCHAR(255)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="call_id" type="INTEGER">
|
||||
<constraints nullable="false" foreignKeyName="fk_call_form" references="call(id)"/>
|
||||
</column>
|
||||
<column name="content" type="TEXT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
|
||||
|
||||
<changeSet id="24-01-2025_PK_192615" author="Rajesh Khore">
|
||||
<addColumn tableName="call">
|
||||
<column name="evaluation_version" type="VARCHAR(255)" defaultValue="V1">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
</addColumn>
|
||||
|
||||
<sqlFile dbms="postgresql"
|
||||
path="db/dump/updated_form_field_data_24-01-2025.sql"/>
|
||||
|
||||
<addColumn tableName="application">
|
||||
<column name="evaluation_version" type="VARCHAR(255)" defaultValue="V1">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="24-01-2025_RK_194615" author="Rajesh Khore">
|
||||
<addColumn tableName="application">
|
||||
<column name="application_evaluation_id" type="INTEGER"> </column>
|
||||
</addColumn>
|
||||
|
||||
<!-- Updating the new column with data from 'application_evaluation' -->
|
||||
<update tableName="application">
|
||||
<column name="application_evaluation_id" valueComputed="(SELECT ae.id FROM application_evaluation ae WHERE ae.application_id = application.id)"/>
|
||||
<where>EXISTS (SELECT 1 FROM application_evaluation ae WHERE ae.application_id = application.id)</where>
|
||||
</update>
|
||||
</changeSet>
|
||||
|
||||
|
||||
</databaseChangeLog>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
UPDATE FORM_FIELD
|
||||
SET SETTINGS = '[{"name": "label", "value": "Numero"}, {"name": "placeholder", "value": 0}, {"name": "step", "value": 0}, {"name": "isRequestedAmount", "value": false}, {"name": "variable", "value": []}, {"name": "formula", "value": ""}]'
|
||||
WHERE ID = 4;
|
||||
|
||||
INSERT INTO FORM_FIELD (ID, SORT_ORDER, NAME, LABEL, DESCRIPTION, SETTINGS, VALIDATORS, CREATED_DATE, UPDATED_DATE)
|
||||
VALUES
|
||||
(
|
||||
21,
|
||||
21,
|
||||
'criteria_table',
|
||||
'Tabella di criteri',
|
||||
'Tabella di criteri',
|
||||
'[{"name": "label", "value": "Tabella"}, {"name": "criteria_table_columns", "value": {}}, {"name": "variable", "value": []}]',
|
||||
'{"custom": "nonEmptyTables"}',
|
||||
CURRENT_TIMESTAMP,
|
||||
CURRENT_TIMESTAMP
|
||||
);
|
||||
@@ -353,3 +353,12 @@ action.context.labels.fetched.successfully = Action Context Labels Fetched Succe
|
||||
amount.accepted.required=Amount accepted is required while approving the application.
|
||||
call.expired=Call has been expired.
|
||||
amount.request.should.greated.then.zero=Requested amount should not be empty and should be greater than zero.
|
||||
|
||||
|
||||
|
||||
evaluation.form.created.successfully=Evaluation form created successfully.
|
||||
evaluation.form.updated.successfully=Evaluation form updated successfully.
|
||||
evaluation.form.deleted.successfully=Evaluation form deleted successfully.
|
||||
evaluation.form.fetched.successfully=Evaluation form fetched successfully.
|
||||
evaluation.form.not.found=Evaluation form not found.
|
||||
|
||||
|
||||
@@ -343,4 +343,12 @@ action.context.labels.fetched.successfully = Etichette del contesto dell'azione
|
||||
amount.accepted.required=L'importo accettato <20> obbligatorio durante l'approvazione della domanda.
|
||||
call.expired=La chiamata <20> scaduta.
|
||||
amount.request.should.greated.then.zero=L'importo richiesto non deve essere vuoto e deve essere maggiore di zero.
|
||||
call.expired=La chiamata <20> scaduta.
|
||||
|
||||
|
||||
|
||||
evaluation.form.created.successfully=Modulo di valutazione creato con successo.
|
||||
evaluation.form.updated.successfully=Modulo di valutazione aggiornato con successo.
|
||||
evaluation.form.deleted.successfully=Modulo di valutazione eliminato con successo.
|
||||
evaluation.form.fetched.successfully=Modulo di valutazione recuperato con successo.
|
||||
evaluation.form.not.found=Modulo di valutazione non trovato.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user