Updated code for evaluation-v2(call)

This commit is contained in:
Piyush
2025-01-24 19:33:47 +05:30
parent e64d10add6
commit 0ebd33e544
26 changed files with 214 additions and 36 deletions

View File

@@ -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 =

View File

@@ -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;
}
}

View File

@@ -149,17 +149,20 @@ public class EvaluationFormDao {
}
public List<EvaluationFormResponseBean> getEvaluationFormsByCallId(CallEntity callEntity){
if(callEntity== null){
public EvaluationFormResponseBean getEvaluationFormByCallId(CallEntity callEntity) {
if (callEntity == null) {
throw new CustomValidationException(Status.VALIDATION_ERROR,
Translator.toLocale(GepafinConstant.CALL_NOT_FOUND));
}
List<EvaluationFormEntity> formEntities= evaluationFormRepository.findByCallIdAndIsDeletedFalse(callEntity.getId());
List<EvaluationFormResponseBean> formResponseBeanList = formEntities.stream()
.map(req -> convertEvaluationFormEntityToEvaluationFormResponseBean(req))
.collect(Collectors.toList());
return formResponseBeanList;
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);