Updated code for evaluation-v2(call)
This commit is contained in:
@@ -399,5 +399,7 @@ public class GepafinConstant {
|
|||||||
public static final String EVALUATION_FORM_FETCHED_SUCCESSFULLY = "evaluation.form.fetched.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_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.setUserWithCompany(userWithCompany);
|
||||||
entity.setIsDeleted(false);
|
entity.setIsDeleted(false);
|
||||||
entity.setStatus(ApplicationStatusTypeEnum.DRAFT.getValue());
|
entity.setStatus(ApplicationStatusTypeEnum.DRAFT.getValue());
|
||||||
|
entity.setEvaluationVersion(call.getEvaluationVersion());
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,6 +414,7 @@ public class ApplicationDao {
|
|||||||
responseBean.setCallId(applicationEntity.getCall().getId());
|
responseBean.setCallId(applicationEntity.getCall().getId());
|
||||||
responseBean.setSubmissionDate(applicationEntity.getSubmissionDate());
|
responseBean.setSubmissionDate(applicationEntity.getSubmissionDate());
|
||||||
responseBean.setStatus(applicationEntity.getStatus());
|
responseBean.setStatus(applicationEntity.getStatus());
|
||||||
|
responseBean.setEvaluationVersion(EvaluationVersionEnum.valueOf(applicationEntity.getCall().getEvaluationVersion()));
|
||||||
responseBean.setComments(applicationEntity.getComments());
|
responseBean.setComments(applicationEntity.getComments());
|
||||||
responseBean.setCompanyId(applicationEntity.getCompanyId());
|
responseBean.setCompanyId(applicationEntity.getCompanyId());
|
||||||
Optional<AssignedApplicationsEntity> assignedApplicationsOptional =
|
Optional<AssignedApplicationsEntity> assignedApplicationsOptional =
|
||||||
|
|||||||
@@ -116,6 +116,9 @@ public class CallDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private NotificationTypeRepository notificationTypeRepository;
|
private NotificationTypeRepository notificationTypeRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EvaluationFormDao evalualtionFormDao;
|
||||||
|
|
||||||
public CallResponse createCallStep1(CreateCallRequestStep1 createCallRequest, UserEntity userEntity) {
|
public CallResponse createCallStep1(CreateCallRequestStep1 createCallRequest, UserEntity userEntity) {
|
||||||
createCallRequest.setRegionId(userEntity.getRoleEntity().getRegion().getId());
|
createCallRequest.setRegionId(userEntity.getRoleEntity().getRegion().getId());
|
||||||
CallEntity callEntity = convertToCallEntity(createCallRequest, userEntity);
|
CallEntity callEntity = convertToCallEntity(createCallRequest, userEntity);
|
||||||
@@ -178,6 +181,7 @@ public class CallDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
callEntity.setStatus(CallStatusEnum.DRAFT.getValue());
|
callEntity.setStatus(CallStatusEnum.DRAFT.getValue());
|
||||||
|
callEntity.setEvaluationVersion(createCallRequest.getEvaluationVersion().getValue());
|
||||||
callEntity.setAmountMax(createCallRequest.getAmountMax());
|
callEntity.setAmountMax(createCallRequest.getAmountMax());
|
||||||
callEntity.setAmount(createCallRequest.getAmount());
|
callEntity.setAmount(createCallRequest.getAmount());
|
||||||
callEntity.setConfidi(false);
|
callEntity.setConfidi(false);
|
||||||
@@ -362,6 +366,7 @@ public class CallDao {
|
|||||||
createCallResponseBean.setDescriptionShort(callEntity.getDescriptionShort());
|
createCallResponseBean.setDescriptionShort(callEntity.getDescriptionShort());
|
||||||
createCallResponseBean.setDescriptionLong(callEntity.getDescriptionLong());
|
createCallResponseBean.setDescriptionLong(callEntity.getDescriptionLong());
|
||||||
createCallResponseBean.setStatus(CallStatusEnum.valueOf(callEntity.getStatus()));
|
createCallResponseBean.setStatus(CallStatusEnum.valueOf(callEntity.getStatus()));
|
||||||
|
createCallResponseBean.setEvaluationVersion(EvaluationVersionEnum.valueOf(callEntity.getEvaluationVersion()));
|
||||||
createCallResponseBean.setRegionId(callEntity.getRegion().getId());
|
createCallResponseBean.setRegionId(callEntity.getRegion().getId());
|
||||||
createCallResponseBean.setAmount(callEntity.getAmount());
|
createCallResponseBean.setAmount(callEntity.getAmount());
|
||||||
createCallResponseBean.setAmountMax(callEntity.getAmountMax());
|
createCallResponseBean.setAmountMax(callEntity.getAmountMax());
|
||||||
@@ -601,6 +606,7 @@ public class CallDao {
|
|||||||
setIfUpdated(callEntity::getStartTime, callEntity::setStartTime, DateTimeUtil.parseTime(updateCallRequest.getStartTime()));
|
setIfUpdated(callEntity::getStartTime, callEntity::setStartTime, DateTimeUtil.parseTime(updateCallRequest.getStartTime()));
|
||||||
setIfUpdated(callEntity::getEndTime, callEntity::setEndTime, DateTimeUtil.parseTime(updateCallRequest.getEndTime()));
|
setIfUpdated(callEntity::getEndTime, callEntity::setEndTime, DateTimeUtil.parseTime(updateCallRequest.getEndTime()));
|
||||||
setIfUpdated(callEntity::getConfidi, callEntity::setConfidi, updateCallRequest.getConfidi());
|
setIfUpdated(callEntity::getConfidi, callEntity::setConfidi, updateCallRequest.getConfidi());
|
||||||
|
setIfUpdated(callEntity::getEvaluationVersion, callEntity::setEvaluationVersion, updateCallRequest.getEvaluationVersion().getValue());
|
||||||
callEntity = callRepository.save(callEntity);
|
callEntity = callRepository.save(callEntity);
|
||||||
|
|
||||||
/** This code is responsible for adding a version history log for the "update call step 1" operation **/
|
/** 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.setDescriptionShort(callEntity.getDescriptionShort());
|
||||||
callDetailsResponseBean.setDescriptionLong(callEntity.getDescriptionLong());
|
callDetailsResponseBean.setDescriptionLong(callEntity.getDescriptionLong());
|
||||||
callDetailsResponseBean.setStatus(CallStatusEnum.valueOf(callEntity.getStatus()));
|
callDetailsResponseBean.setStatus(CallStatusEnum.valueOf(callEntity.getStatus()));
|
||||||
|
callDetailsResponseBean.setEvaluationVersion(EvaluationVersionEnum.valueOf(callEntity.getEvaluationVersion()));
|
||||||
callDetailsResponseBean.setRegionId(callEntity.getRegion().getId());
|
callDetailsResponseBean.setRegionId(callEntity.getRegion().getId());
|
||||||
callDetailsResponseBean.setAmount(callEntity.getAmount());
|
callDetailsResponseBean.setAmount(callEntity.getAmount());
|
||||||
callDetailsResponseBean.setAmountMax(callEntity.getAmountMax());
|
callDetailsResponseBean.setAmountMax(callEntity.getAmountMax());
|
||||||
@@ -811,7 +818,8 @@ public class CallDao {
|
|||||||
CallResponse callResponseBean = getCallResponseBean(callEntity);
|
CallResponse callResponseBean = getCallResponseBean(callEntity);
|
||||||
FlowResponseBean flowResponseBean = flowDao.getFlowByCallId(callEntity.getId());
|
FlowResponseBean flowResponseBean = flowDao.getFlowByCallId(callEntity.getId());
|
||||||
List<FormResponseBean> formResponseBean = formDao.getFormsByCallId(callEntity);
|
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.setStatus(CallStatusEnum.READY_TO_PUBLISH.getValue());
|
||||||
callEntity = callRepository.save(callEntity);
|
callEntity = callRepository.save(callEntity);
|
||||||
|
|
||||||
@@ -1063,4 +1071,15 @@ public class CallDao {
|
|||||||
return predicates;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,17 +149,20 @@ public class EvaluationFormDao {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public List<EvaluationFormResponseBean> getEvaluationFormsByCallId(CallEntity callEntity){
|
public EvaluationFormResponseBean getEvaluationFormByCallId(CallEntity callEntity) {
|
||||||
if (callEntity == null) {
|
if (callEntity == null) {
|
||||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||||
Translator.toLocale(GepafinConstant.CALL_NOT_FOUND));
|
Translator.toLocale(GepafinConstant.CALL_NOT_FOUND));
|
||||||
}
|
}
|
||||||
List<EvaluationFormEntity> formEntities= evaluationFormRepository.findByCallIdAndIsDeletedFalse(callEntity.getId());
|
|
||||||
List<EvaluationFormResponseBean> formResponseBeanList = formEntities.stream()
|
EvaluationFormEntity formEntity = evaluationFormRepository
|
||||||
.map(req -> convertEvaluationFormEntityToEvaluationFormResponseBean(req))
|
.findByCallIdAndIsDeletedFalse(callEntity.getId());
|
||||||
.collect(Collectors.toList());
|
if(formEntity!=null)
|
||||||
return formResponseBeanList;
|
return convertEvaluationFormEntityToEvaluationFormResponseBean(formEntity);
|
||||||
|
else return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String setContentResponseBean(List<ContentRequestBean> contentRequestBeans){
|
public String setContentResponseBean(List<ContentRequestBean> contentRequestBeans){
|
||||||
String stringContentRequest = Utils.convertListToJsonString(contentRequestBeans);
|
String stringContentRequest = Utils.convertListToJsonString(contentRequestBeans);
|
||||||
List<ContentRequestBean> cloneContentRequestBeans = Utils.convertJsonStringToList(stringContentRequest, ContentRequestBean.class);
|
List<ContentRequestBean> cloneContentRequestBeans = Utils.convertJsonStringToList(stringContentRequest, ContentRequestBean.class);
|
||||||
|
|||||||
@@ -68,4 +68,7 @@ public class ApplicationEntity extends BaseEntity {
|
|||||||
@Column(name="DATE_REJECTED")
|
@Column(name="DATE_REJECTED")
|
||||||
private LocalDateTime dateRejected;
|
private LocalDateTime dateRejected;
|
||||||
|
|
||||||
|
@Column(name = "evaluationVersion")
|
||||||
|
private String evaluationVersion;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -88,5 +88,8 @@ public class CallEntity extends BaseEntity {
|
|||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "HUB_ID")
|
@JoinColumn(name = "HUB_ID")
|
||||||
private HubEntity hub;
|
private HubEntity hub;
|
||||||
|
|
||||||
|
@Column(name = "evaluationVersion")
|
||||||
|
private String evaluationVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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"),
|
GET_CALL("GET_CALL"),
|
||||||
DOWNLOAD_CALL_DOCUMENT("DOWNLOAD_CALL_DOCUMENT"),
|
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 **/
|
/** user action context **/
|
||||||
CREATE_USER("CREATE_USER"),
|
CREATE_USER("CREATE_USER"),
|
||||||
USER_LOGIN("USER_LOGIN"),
|
USER_LOGIN("USER_LOGIN"),
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CreateCallRequestStep1 {
|
public class CreateCallRequestStep1 {
|
||||||
@@ -41,4 +42,5 @@ public class CreateCallRequestStep1 {
|
|||||||
|
|
||||||
private List<FaqReq> faq;
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import java.time.LocalTime;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class UpdateCallRequestStep1 {
|
public class UpdateCallRequestStep1 {
|
||||||
@@ -40,4 +41,6 @@ public class UpdateCallRequestStep1 {
|
|||||||
|
|
||||||
private List<FaqReq> faq;
|
private List<FaqReq> faq;
|
||||||
|
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.gepafin.tendermanagement.model.response;
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationFormFieldResponseBean;
|
import net.gepafin.tendermanagement.model.response.ApplicationFormFieldResponseBean;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -49,4 +50,6 @@ public class ApplicationResponse{
|
|||||||
|
|
||||||
private LocalDateTime dateRejected;
|
private LocalDateTime dateRejected;
|
||||||
|
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@ package net.gepafin.tendermanagement.model.response;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -55,4 +56,6 @@ public class CallDetailsResponseBean {
|
|||||||
private LocalDateTime updatedDate;
|
private LocalDateTime updatedDate;
|
||||||
|
|
||||||
private Long preferredCallId;
|
private Long preferredCallId;
|
||||||
|
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import java.util.List;
|
|||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
import net.gepafin.tendermanagement.util.DynamicLocalTimeSerializer;
|
import net.gepafin.tendermanagement.util.DynamicLocalTimeSerializer;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -74,6 +75,8 @@ public class CallResponse {
|
|||||||
private String currentStep;
|
private String currentStep;
|
||||||
|
|
||||||
private Long preferredCallId;
|
private Long preferredCallId;
|
||||||
|
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import java.util.List;
|
|||||||
@Repository
|
@Repository
|
||||||
public interface EvalualtionFormRepository extends JpaRepository<EvaluationFormEntity,Long> {
|
public interface EvalualtionFormRepository extends JpaRepository<EvaluationFormEntity,Long> {
|
||||||
|
|
||||||
List<EvaluationFormEntity> findByCallIdAndIsDeletedFalse(Long callId);
|
EvaluationFormEntity findByCallIdAndIsDeletedFalse(Long callId);
|
||||||
EvaluationFormEntity findByIdAndIsDeletedFalse(Long formId);
|
EvaluationFormEntity findByIdAndIsDeletedFalse(Long formId);
|
||||||
List<EvaluationFormEntity> findByIdInAndIsDeletedFalse(List<Long> evaluationFormId);
|
List<EvaluationFormEntity> findByIdInAndIsDeletedFalse(List<Long> evaluationFormId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,8 @@ import java.util.List;
|
|||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import net.gepafin.tendermanagement.entities.CallEntity;
|
import net.gepafin.tendermanagement.entities.CallEntity;
|
||||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
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.CreateCallRequestStep1;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
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.CallDetailsResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.CallResponse;
|
import net.gepafin.tendermanagement.model.response.CallResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
@@ -37,4 +35,6 @@ public interface CallService {
|
|||||||
|
|
||||||
PageableResponseBean<List<CallDetailsResponseBean>> getAllCallsByPagination(HttpServletRequest request, Long companyId , Boolean onlyPreferredCall,CallPageableRequestBean callPageableRequestBean);
|
PageableResponseBean<List<CallDetailsResponseBean>> getAllCallsByPagination(HttpServletRequest request, Long companyId , Boolean onlyPreferredCall,CallPageableRequestBean callPageableRequestBean);
|
||||||
|
|
||||||
|
CallResponse createCallStep2EvaluationV2(HttpServletRequest request, Long callId, CreateCallRequestStep2EvaluationV2 createCallRequest);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,6 @@ public interface EvaluationFormService {
|
|||||||
|
|
||||||
public EvaluationFormEntity validateEvaluationForm(Long id);
|
public EvaluationFormEntity validateEvaluationForm(Long id);
|
||||||
|
|
||||||
public List<EvaluationFormResponseBean> getEvaluationFormsByCallId(HttpServletRequest request, Long callId);
|
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.CallEntity;
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
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.CreateCallRequestStep1;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
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.CallDetailsResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.CallResponse;
|
import net.gepafin.tendermanagement.model.response.CallResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
@@ -110,5 +108,11 @@ public class CallServiceImpl implements CallService {
|
|||||||
UserEntity user = validator.validateUser(request);
|
UserEntity user = validator.validateUser(request);
|
||||||
return callDao.getAllCallsByPagination(request,user,companyId,onlyPreferredCall,callPageableRequestBean);
|
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.config.Translator;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
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.CallResponse;
|
||||||
|
import net.gepafin.tendermanagement.model.response.EvaluationFormResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.FlowResponseBean;
|
import net.gepafin.tendermanagement.model.response.FlowResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.FormResponseBean;
|
import net.gepafin.tendermanagement.model.response.FormResponseBean;
|
||||||
import net.gepafin.tendermanagement.util.FieldValidator;
|
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;
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
|
|
||||||
public class CallValidatorServiceImpl {
|
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)
|
// Validate CallResponse (existing logic)
|
||||||
FieldValidator data = FieldValidator.create()
|
FieldValidator data = FieldValidator.create()
|
||||||
.notNull(response.getId(), "id")
|
.notNull(response.getId(), "id")
|
||||||
@@ -28,29 +30,35 @@ public class CallValidatorServiceImpl {
|
|||||||
.notNull(response.getRegionId(), "regionId")
|
.notNull(response.getRegionId(), "regionId")
|
||||||
.notNull(response.getAmount(), "amount")
|
.notNull(response.getAmount(), "amount")
|
||||||
.notNull(response.getAmountMax(), "amountMax")
|
.notNull(response.getAmountMax(), "amountMax")
|
||||||
.notNull(response.getThreshold(), "threshold")
|
|
||||||
.notNull(response.getEmail(),"email")
|
.notNull(response.getEmail(),"email")
|
||||||
.notNull(response.getAmountMin(),"amountMin")
|
.notNull(response.getAmountMin(),"amountMin")
|
||||||
.notNull(response.getStartTime(),"startTime")
|
.notNull(response.getStartTime(),"startTime")
|
||||||
.notNull(response.getEndTime(),"endTime")
|
.notNull(response.getEndTime(),"endTime")
|
||||||
.notNull(response.getDocumentationRequested(), "documentationRequested")
|
.notNull(response.getDocumentationRequested(), "documentationRequested")
|
||||||
.notEmpty(response.getAimedTo(), "aimedTo")
|
.notEmpty(response.getAimedTo(), "aimedTo")
|
||||||
|
.notEmpty(response.getDocs(), "docs");
|
||||||
|
if (response.getEvaluationVersion() == EvaluationVersionEnum.V1) {
|
||||||
|
|
||||||
|
data = data.notEmpty(response.getCheckList(), "checkList")
|
||||||
.notEmpty(response.getCriteria(), "criteria")
|
.notEmpty(response.getCriteria(), "criteria")
|
||||||
.notEmpty(response.getDocs(), "docs")
|
.notNull(response.getThreshold(), "threshold");
|
||||||
.notEmpty(response.getCheckList(), "checkList");
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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
|
if (response.getDates().get(0) == null || response.getDates().get(1) == null
|
||||||
|| response.getDates().get(0).toLocalDate().isBefore(LocalDate.now())
|
|| response.getDates().get(0).toLocalDate().isBefore(LocalDate.now())
|
||||||
|| response.getDates().get(1).toLocalDate().isBefore(LocalDate.now())
|
|| response.getDates().get(1).toLocalDate().isBefore(LocalDate.now())
|
||||||
|| response.getDates().get(0).toLocalDate().isAfter(response.getDates().get(1).toLocalDate())) {
|
|| response.getDates().get(0).toLocalDate().isAfter(response.getDates().get(1).toLocalDate())) {
|
||||||
data = data.addError(Translator.toLocale(GepafinConstant.INVALID_DATE_MSG));
|
data = data.addError(Translator.toLocale(GepafinConstant.INVALID_DATE_MSG));
|
||||||
}
|
}
|
||||||
if (flowResponse == null || ((flowResponse.getFlowData() == null || flowResponse.getFlowData().isEmpty())
|
|
||||||
|
if (response.getEvaluationVersion() == EvaluationVersionEnum.V1 &&(flowResponse == null || ((flowResponse.getFlowData() == null || flowResponse.getFlowData().isEmpty()))
|
||||||
&& (flowResponse.getFlowEdges() == null || flowResponse.getFlowEdges().isEmpty()))) {
|
&& (flowResponse.getFlowEdges() == null || flowResponse.getFlowEdges().isEmpty()))) {
|
||||||
data.addError(Translator.toLocale(GepafinConstant.FLOW_NOT_FOUND));
|
data.addError(Translator.toLocale(GepafinConstant.FLOW_NOT_FOUND));
|
||||||
}
|
}
|
||||||
if (formResponses == null || formResponses.isEmpty()) {
|
if (response.getEvaluationVersion() == EvaluationVersionEnum.V1 &&(formResponses == null || formResponses.isEmpty()) ){
|
||||||
data.addError(Translator.toLocale(GepafinConstant.FORM_NOT_FOUND));
|
data.addError(Translator.toLocale(GepafinConstant.FORM_NOT_FOUND));
|
||||||
}
|
}
|
||||||
data.validate();
|
data.validate();
|
||||||
|
|||||||
@@ -52,10 +52,10 @@ public class EvaluationFormServiceImpl implements EvaluationFormService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<EvaluationFormResponseBean> getEvaluationFormsByCallId(HttpServletRequest request, Long callId) {
|
public EvaluationFormResponseBean getEvaluationFormByCallId(HttpServletRequest request, Long callId) {
|
||||||
UserEntity user = validator.validateUser(request);
|
UserEntity user = validator.validateUser(request);
|
||||||
CallEntity call = validator.validateUserWithCall(user, callId);
|
CallEntity call = validator.validateUserWithCall(user, callId);
|
||||||
return evalauationFormDao.getEvaluationFormsByCallId(call);
|
return evalauationFormDao.getEvaluationFormByCallId(call);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ package net.gepafin.tendermanagement.web.rest.api;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
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.ApplicationResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
import org.springframework.http.MediaType;
|
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 io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.validation.Valid;
|
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.CallDetailsResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.CallResponse;
|
import net.gepafin.tendermanagement.model.response.CallResponse;
|
||||||
import net.gepafin.tendermanagement.model.util.Response;
|
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);
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public interface EvaluationFormApi {
|
|||||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
@GetMapping(value = "/call/{callId}",
|
@GetMapping(value = "/call/{callId}",
|
||||||
produces = { "application/json" })
|
produces = { "application/json" })
|
||||||
ResponseEntity<Response<List<EvaluationFormResponseBean>>> getEvaluationFormsByCallId(HttpServletRequest request,
|
ResponseEntity<Response<EvaluationFormResponseBean>> getEvaluationFormByCallId(HttpServletRequest request,
|
||||||
@Parameter(description = "The call ID", required = true) @PathVariable("callId") Long callId);
|
@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 java.util.List;
|
||||||
|
|
||||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.*;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
@@ -160,6 +161,17 @@ public class CallApiController implements CallApi {
|
|||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
.body(new Response<>(callsByPagination, Status.SUCCESS, Translator.toLocale(GepafinConstant.CALL_FETCH_SUCCESS_MSG)));
|
.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)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -75,12 +75,12 @@ public class EvaluationFormApiController implements EvaluationFormApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<List<EvaluationFormResponseBean>>> getEvaluationFormsByCallId(HttpServletRequest request, Long callId) {
|
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. **/
|
/** 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());
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_EVALUATION_FORM).build());
|
||||||
|
|
||||||
List<EvaluationFormResponseBean> evaluationFormResponseBean= evaluationFormService.getEvaluationFormsByCallId(request,callId);
|
EvaluationFormResponseBean evaluationFormResponseBean= evaluationFormService.getEvaluationFormByCallId(request,callId);
|
||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
.body(new Response<>(evaluationFormResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FORM_FETCHED_SUCCESSFULLY)));
|
.body(new Response<>(evaluationFormResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FORM_FETCHED_SUCCESSFULLY)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2274,4 +2274,23 @@
|
|||||||
</column>
|
</column>
|
||||||
</createTable>
|
</createTable>
|
||||||
</changeSet>
|
</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>
|
||||||
|
|
||||||
</databaseChangeLog>
|
</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
|
||||||
|
);
|
||||||
Reference in New Issue
Block a user