updated code
This commit is contained in:
@@ -157,21 +157,6 @@ public class CallDao {
|
|||||||
}
|
}
|
||||||
return criteriaEntity;
|
return criteriaEntity;
|
||||||
}
|
}
|
||||||
// public List<EvaluationCriteriaEntity> convertListOfEvaluationCriteriaReqToEvaluationCriteriaEntities(List<EvaluationCriteriaReq> criteriaReqList, CallEntity callEntity) {
|
|
||||||
// List<EvaluationCriteriaEntity> evaluationCriteriaEntities = criteriaReqList.stream().map(req -> convertToEvaluationCriteriaEntity(req, callEntity)).collect(Collectors.toList());
|
|
||||||
// evaluationCriteriaRepository.saveAll(evaluationCriteriaEntities);
|
|
||||||
// return evaluationCriteriaEntities;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private EvaluationCriteriaEntity convertToEvaluationCriteriaEntity(EvaluationCriteriaReq criteriaReq, CallEntity callEntity) {
|
|
||||||
// EvaluationCriteriaEntity criteriaEntity = new EvaluationCriteriaEntity();
|
|
||||||
// validateEvolutionCrieteriaEntity(criteriaReq.getName(),criteriaReq.getScore());
|
|
||||||
// criteriaEntity.setName(criteriaReq.getName());
|
|
||||||
// criteriaEntity.setDescription(criteriaReq.getValue());
|
|
||||||
// criteriaEntity.setScore(criteriaReq.getScore());
|
|
||||||
// criteriaEntity.setCall(callEntity);
|
|
||||||
// return criteriaEntity;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
public List<DocumentEntity> convertToDocumentEntities(List<DocumentReq> documentReqList, CallEntity callEntity,
|
public List<DocumentEntity> convertToDocumentEntities(List<DocumentReq> documentReqList, CallEntity callEntity,
|
||||||
@@ -217,207 +202,6 @@ public class CallDao {
|
|||||||
return faqEntities;
|
return faqEntities;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public List<FaqEntity> convertToFaqEntities(List<FaqReq> faqReqList, CallEntity callEntity, Long userId) {
|
|
||||||
// List<FaqEntity> faqEntities = faqReqList.stream().map(req -> convertToFaqEntity(req, callEntity, userId)).collect(Collectors.toList());
|
|
||||||
// faqRepository.saveAll(faqEntities);
|
|
||||||
// return faqEntities;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public FaqEntity convertToFaqEntity(FaqReq faqReq, CallEntity callEntity, Long userId) {
|
|
||||||
// FaqEntity faqEntity = new FaqEntity();
|
|
||||||
// validateFaqEntity(faqReq.getQuestion());
|
|
||||||
// UserEntity userEntity = userService.validateUser(userId);
|
|
||||||
// faqEntity.setUser(userEntity);
|
|
||||||
// faqEntity.setIsVisible(true);
|
|
||||||
// if(faqReq.getIsVisible()!=null){
|
|
||||||
// faqEntity.setIsVisible(faqReq.getIsVisible());
|
|
||||||
// }
|
|
||||||
// faqEntity.setQuestionShort(faqReq.getQuestionShort());
|
|
||||||
// faqEntity.setQuestion(faqReq.getQuestion());
|
|
||||||
// if(faqReq.getResponse()!=null ||faqReq.getResponseShort()!=null){
|
|
||||||
// faqEntity.setResponseDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
|
||||||
// }
|
|
||||||
// faqEntity.setResponseShort(faqReq.getResponseShort());
|
|
||||||
// faqEntity.setResponse(faqReq.getResponse());
|
|
||||||
// faqEntity.setCall(callEntity);
|
|
||||||
// faqEntity.setIsDeleted(false);
|
|
||||||
// return faqEntity;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void validateFaqEntity( String question) {
|
|
||||||
// if (!StringUtils.hasText(question)) {
|
|
||||||
// throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.QUESTION_NOT_EMPTY_MSG));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void validateDocumentEntity(Long documentId,String name) {
|
|
||||||
// if(documentId==null){
|
|
||||||
// throw new CustomValidationException(Status.VALIDATION_ERROR,Translator.toLocale(GepafinConstant.DOCUMENT_ID_NOT_FOUND));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//// if (!StringUtils.hasText(name)) {
|
|
||||||
//// throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.NAME_NOT_EMPTY_MSG));
|
|
||||||
//// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void validateEvolutionCrieteriaEntity(String name,Integer score) {
|
|
||||||
// if (!StringUtils.hasText(name)) {
|
|
||||||
// throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.NAME_NOT_EMPTY_MSG));
|
|
||||||
// }
|
|
||||||
// if (score == null || score <= 0) {
|
|
||||||
// throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.SCORE_NOT_NULL_MSG));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void validateCallEntity(CreateCallRequestStep1 createCallRequest) {
|
|
||||||
// if (createCallRequest.getRegionId() == null) {
|
|
||||||
// throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.REGION_NOT_FOUND_MSG));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (createCallRequest.getAmount().compareTo(BigDecimal.ZERO) <= 0||createCallRequest.getAmountMax().compareTo(BigDecimal.ZERO) <= 0) {
|
|
||||||
// throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.AMOUNT_GREATER_THAN_ZERO_MSG));
|
|
||||||
// }
|
|
||||||
// if (createCallRequest.getStartDate().toLocalDate().isBefore(LocalDate.now()) || createCallRequest.getEndDate().toLocalDate().isBefore(LocalDate.now())) {
|
|
||||||
// throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.INVALID_DATE_MSG));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// public CreateCallResponseBean convertToCallResponseBean(CallEntity callEntity) {
|
|
||||||
// CreateCallResponseBean createCallResponseBean = new CreateCallResponseBean();
|
|
||||||
// createCallResponseBean.setId(callEntity.getId());
|
|
||||||
// createCallResponseBean.setName(callEntity.getName());
|
|
||||||
// createCallResponseBean.setDates(List.of(callEntity.getStartDate(), callEntity.getEndDate()));
|
|
||||||
// createCallResponseBean.setDescriptionShort(callEntity.getDescriptionShort());
|
|
||||||
// createCallResponseBean.setDescriptionLong(callEntity.getDescriptionLong());
|
|
||||||
// createCallResponseBean.setStatus(CallTypeEnum.valueOf(callEntity.getStatus()));
|
|
||||||
// createCallResponseBean.setRegionId(callEntity.getRegion().getId());
|
|
||||||
// createCallResponseBean.setAmount(callEntity.getAmount());
|
|
||||||
// createCallResponseBean.setAmountMax(callEntity.getAmountMax());
|
|
||||||
// createCallResponseBean.setContactInfo(callEntity.getContactInfo());
|
|
||||||
// createCallResponseBean.setSubmissionMethod(callEntity.getSubmissionMethod());
|
|
||||||
// createCallResponseBean.setThreshold(callEntity.getThreshold());
|
|
||||||
// createCallResponseBean.setDocumentationReqested(callEntity.getDocumentationRequested());
|
|
||||||
// createCallResponseBean.setPriorityArea(callEntity.getPriorityArea());
|
|
||||||
// createCallResponseBean.setCreatedDate(callEntity.getCreatedDate());
|
|
||||||
// createCallResponseBean.setUpdatedDate(callEntity.getUpdatedDate());
|
|
||||||
// return createCallResponseBean;
|
|
||||||
// }
|
|
||||||
// public EvaluationCriteriaResponseBean convertToEvaluationCriteriaResponseBean(EvaluationCriteriaEntity entity) {
|
|
||||||
// EvaluationCriteriaResponseBean responseBean = new EvaluationCriteriaResponseBean();
|
|
||||||
// responseBean.setId(entity.getId());
|
|
||||||
// responseBean.setName(entity.getName());
|
|
||||||
// responseBean.setDescription(entity.getDescription());
|
|
||||||
// responseBean.setScore(entity.getScore());
|
|
||||||
// responseBean.setCreatedDate(entity.getCreatedDate());
|
|
||||||
// responseBean.setUpdatedDate(entity.getUpdatedDate());
|
|
||||||
// return responseBean;
|
|
||||||
// }
|
|
||||||
// public DocumentResponseBean convertToDocumentResponseBean(DocumentEntity entity) {
|
|
||||||
// DocumentResponseBean responseBean = new DocumentResponseBean();
|
|
||||||
// responseBean.setId(entity.getId());
|
|
||||||
// responseBean.setName(entity.getFileName());
|
|
||||||
// responseBean.setDescription(entity.getDescription());
|
|
||||||
// responseBean.setFilePath(entity.getFilePath());
|
|
||||||
// responseBean.setCreatedDate(entity.getCreatedDate());
|
|
||||||
// responseBean.setUpdatedDate(entity.getUpdatedDate());
|
|
||||||
// return responseBean;
|
|
||||||
// }
|
|
||||||
// public FaqResponseBean convertToFaqResponseBean(FaqEntity entity) {
|
|
||||||
// FaqResponseBean responseBean = new FaqResponseBean();
|
|
||||||
// responseBean.setId(entity.getId());
|
|
||||||
// responseBean.setQuestionShort(entity.getQuestionShort());
|
|
||||||
// responseBean.setResponseShort(entity.getResponseShort());
|
|
||||||
// responseBean.setResponse(entity.getResponse());
|
|
||||||
// responseBean.setQuestion(entity.getQuestion());
|
|
||||||
// responseBean.setUserId(entity.getUser().getId());
|
|
||||||
// responseBean.setIsVisible(entity.getIsVisible());
|
|
||||||
// responseBean.setCreatedDate(entity.getCreatedDate());
|
|
||||||
// responseBean.setUpdatedDate(entity.getUpdatedDate());
|
|
||||||
// return responseBean;
|
|
||||||
// }
|
|
||||||
// public CreateCallResponseBean assembleCreateCallResponseBean(
|
|
||||||
// CallEntity callEntity,
|
|
||||||
// List<EvaluationCriteriaEntity> evaluationCriteriaEntities,
|
|
||||||
// List<DocumentEntity> documentEntities,
|
|
||||||
// List<FaqEntity> faqEntities,List<DocumentEntity> images) {
|
|
||||||
//
|
|
||||||
// CreateCallResponseBean callResponseBean = convertToCallResponseBean(callEntity);
|
|
||||||
//
|
|
||||||
// List<EvaluationCriteriaResponseBean> evaluationCriteriaResponseBeans = evaluationCriteriaEntities.stream()
|
|
||||||
// .map(this::convertToEvaluationCriteriaResponseBean)
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
//
|
|
||||||
// List<DocumentResponseBean> documentResponseBeans = documentEntities.stream()
|
|
||||||
// .map(this::convertToDocumentResponseBean)
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
//
|
|
||||||
// List<FaqResponseBean> faqResponseBeans = faqEntities.stream()
|
|
||||||
// .map(this::convertToFaqResponseBean)
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
//
|
|
||||||
// List<DocumentResponseBean> imagesResponseBean = images.stream()
|
|
||||||
// .map(this::convertToDocumentResponseBean)
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
// CreateCallResponseBean createCallResponseBean =callResponseBean;
|
|
||||||
// createCallResponseBean.setCriteria(evaluationCriteriaResponseBeans);
|
|
||||||
// createCallResponseBean.setDocs(documentResponseBeans);
|
|
||||||
// createCallResponseBean.setFaq(faqResponseBeans);
|
|
||||||
// createCallResponseBean.setImages(imagesResponseBean);
|
|
||||||
// return createCallResponseBean;
|
|
||||||
// }
|
|
||||||
// public List<LookUpDataResponse> convertLookUpDataEntities(List<LookUpDataReq> lookUpData, CallEntity callEntity, LookUpDataEntity.LookUpDataTypeEnum type) {
|
|
||||||
// List<LookUpDataEntity> lookUpDataEntities = lookUpData.stream()
|
|
||||||
// .map(req -> convertLookUpDataRequestIntoLookUpDataEntity(req, type))
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
//
|
|
||||||
// lookUpDataRepository.saveAll(lookUpDataEntities);
|
|
||||||
//
|
|
||||||
// return createCallTargetAudienceCheckList(callEntity, lookUpDataEntities);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private List<LookUpDataResponse> createCallTargetAudienceCheckList(CallEntity callEntity, List<LookUpDataEntity> lookUpDataEntities) {
|
|
||||||
// List<LookUpDataResponse> lookUpDataResponses=new ArrayList<>();
|
|
||||||
// for(LookUpDataEntity lookUpDataEntity:lookUpDataEntities){
|
|
||||||
// CallTargetAudienceChecklistEntity callTargetAudienceChecklistEntity=new CallTargetAudienceChecklistEntity();
|
|
||||||
// callTargetAudienceChecklistEntity.setIsValidated(false);
|
|
||||||
// callTargetAudienceChecklistEntity.setLookupData(lookUpDataEntity);
|
|
||||||
// callTargetAudienceChecklistEntity.setCall(callEntity);
|
|
||||||
// callTargetAudienceChecklistEntity= callTargetAudienceChecklistRepository.save(callTargetAudienceChecklistEntity);
|
|
||||||
// lookUpDataResponses.add(convertToLookUpDataResponseBean(callTargetAudienceChecklistEntity));
|
|
||||||
// }
|
|
||||||
// return lookUpDataResponses;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private LookUpDataEntity convertLookUpDataRequestIntoLookUpDataEntity(LookUpDataReq req, LookUpDataEntity.LookUpDataTypeEnum type) {
|
|
||||||
// if (req.getLookUpDataId() == null || req.getLookUpDataId().equals(0l)) {
|
|
||||||
// LookUpDataEntity newEntity = new LookUpDataEntity();
|
|
||||||
// newEntity.setValue(req.getValue());
|
|
||||||
// newEntity.setType(type.getValue());
|
|
||||||
// return newEntity;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return lookUpDataRepository.findById(req.getLookUpDataId())
|
|
||||||
// .orElseThrow(() -> new ResourceNotFoundException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.LOOK_UP_DATA_NOT_VALID_MSG)));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public LookUpDataResponse convertToLookUpDataResponseBean(CallTargetAudienceChecklistEntity callTargetAudienceChecklistEntity) {
|
|
||||||
// LookUpDataResponse lookUpDataResponse = new LookUpDataResponse();
|
|
||||||
// LookUpDataEntity lookUpDataEntity = callTargetAudienceChecklistEntity.getLookupData();
|
|
||||||
// lookUpDataResponse.setId(callTargetAudienceChecklistEntity.getId());
|
|
||||||
// lookUpDataResponse.setLookUpDataId(lookUpDataEntity.getId());
|
|
||||||
// lookUpDataResponse.setValue(lookUpDataEntity.getValue());
|
|
||||||
// lookUpDataResponse.setTitle(lookUpDataEntity.getTitle());
|
|
||||||
// lookUpDataResponse.setCreatedDate(lookUpDataEntity.getCreatedDate());
|
|
||||||
// lookUpDataResponse.setUpdatedDate(lookUpDataEntity.getUpdatedDate());
|
|
||||||
// return lookUpDataResponse;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// public CreateCallResponseBean createCallStep2(CreateCallRequestStep2 createCallRequest, Long userId) {
|
|
||||||
// CreateCallResponseBean createCallResponseBean = null;
|
|
||||||
// CallEntity callEntity = callRepository.findById(createCallRequest.getCallId())
|
|
||||||
// .orElseThrow(() -> new CustomValidationException(Status.VALIDATION_ERROR,
|
|
||||||
// Translator.toLocale(GepafinConstant.NAME_NOT_EMPTY_MSG)));
|
|
||||||
|
|
||||||
public FaqEntity convertToFaqEntity(FaqReq faqReq, CallEntity callEntity, Long userId) {
|
public FaqEntity convertToFaqEntity(FaqReq faqReq, CallEntity callEntity, Long userId) {
|
||||||
FaqEntity faqEntity = new FaqEntity();
|
FaqEntity faqEntity = new FaqEntity();
|
||||||
validateFaqEntity(faqReq.getQuestion());
|
validateFaqEntity(faqReq.getQuestion());
|
||||||
|
|||||||
Reference in New Issue
Block a user