Resolved conflicts
This commit is contained in:
@@ -50,6 +50,7 @@ import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundExceptio
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
|
||||
import static net.gepafin.tendermanagement.enums.RoleStatusEnum.ROLE_SUPER_ADMIN;
|
||||
import static net.gepafin.tendermanagement.util.Utils.log;
|
||||
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
||||
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||
import static org.hibernate.internal.util.collections.CollectionHelper.listOf;
|
||||
@@ -128,6 +129,7 @@ public class CallDao {
|
||||
private ApplicationRepository applicationRepository;
|
||||
|
||||
public CallResponse createCallStep1(CreateCallRequestStep1 createCallRequest, UserEntity userEntity) {
|
||||
log.info("Starting Call creation - Step 1 by userId: {}", userEntity.getId());
|
||||
createCallRequest.setRegionId(userEntity.getRoleEntity().getRegion().getId());
|
||||
CallEntity callEntity = convertToCallEntity(createCallRequest, userEntity);
|
||||
|
||||
@@ -136,12 +138,15 @@ public class CallDao {
|
||||
|
||||
CallResponse createCallResponseBean = getCallResponseBean(callEntity);
|
||||
createCallResponseBean.setCurrentStep(GepafinConstant.STEP_1);
|
||||
log.info("Call creation - Step 1 completed successfully for callId: {}", callEntity.getId());
|
||||
return createCallResponseBean;
|
||||
|
||||
}
|
||||
public byte[] downloadCallDocumentsAsZip(Long callId) {
|
||||
log.info("Starting download of call documents as ZIP for callId: {}", callId);
|
||||
List<DocumentEntity> documents = documentRepository.findBySourceIdAndSourceAndTypeAndIsDeletedFalse(callId, DocumentSourceTypeEnum.CALL.getValue(),DocumentTypeEnum.DOCUMENT.getValue());
|
||||
if (documents.isEmpty()) {
|
||||
log.warn("No documents found for callId: {}", callId);
|
||||
throw new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.DOCUMENT_NOT_FOUND));
|
||||
}
|
||||
|
||||
@@ -149,6 +154,7 @@ public class CallDao {
|
||||
ZipOutputStream zos = new ZipOutputStream(zipOutputStream)) {
|
||||
|
||||
for (DocumentEntity document : documents) {
|
||||
log.info("Adding document to ZIP: documentId={}, fileName={}", document.getId(), document.getFileName());
|
||||
String s3Folder = s3PathConfig.generateDocumentPath(DocumentSourceTypeEnum.CALL, callId, 0L,0L);
|
||||
try (InputStream fileInputStream = amazonS3Service.getFile(s3Folder, document.getFilePath())) {
|
||||
String fileName = Utils.extractFileName(document.getFilePath());
|
||||
@@ -157,14 +163,17 @@ public class CallDao {
|
||||
IOUtils.copy(fileInputStream, zos);
|
||||
zos.closeEntry();
|
||||
} catch (IOException e) {
|
||||
log.error("Error downloading or adding document to ZIP. documentId={}, fileName={}", document.getId(), document.getFileName(), e);
|
||||
throw new RuntimeException("Error downloading or adding document to ZIP: " + document.getFileName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
zos.finish();
|
||||
log.info("Successfully created ZIP file for callId: {}", callId);
|
||||
return zipOutputStream.toByteArray();
|
||||
|
||||
} catch (IOException e) {
|
||||
log.error("Error while creating ZIP file for callId: {}", callId, e);
|
||||
throw new RuntimeException("Error while creating ZIP file", e);
|
||||
}
|
||||
}
|
||||
@@ -175,8 +184,11 @@ public class CallDao {
|
||||
CallEntity callEntity = new CallEntity();
|
||||
// validateCallEntity(createCallRequest);
|
||||
RegionEntity region = regionRepository.findById(createCallRequest.getRegionId())
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
|
||||
Translator.toLocale(GepafinConstant.REGION_NOT_FOUND)));
|
||||
.orElseThrow(() -> {
|
||||
log.error("Region not found for id: {}", createCallRequest.getRegionId());
|
||||
return new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.REGION_NOT_FOUND));
|
||||
});
|
||||
|
||||
callEntity.setRegion(region);
|
||||
callEntity.setName(createCallRequest.getName());
|
||||
callEntity.setDescriptionShort(createCallRequest.getDescriptionShort());
|
||||
@@ -198,6 +210,7 @@ public class CallDao {
|
||||
}
|
||||
callEntity.setDocumentationRequested(createCallRequest.getDocumentationRequested());
|
||||
if (createCallRequest.getAmountMin() != null && createCallRequest.getAmountMin().compareTo(BigDecimal.ZERO) < 0) {
|
||||
log.error("Invalid minimum amount: {}", createCallRequest.getAmountMin());
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR,Translator.toLocale(GepafinConstant.AMOUNT_GREATER_THAN_ZERO_MSG));
|
||||
}
|
||||
callEntity.setAmountMin(createCallRequest.getAmountMin());
|
||||
@@ -212,6 +225,7 @@ public class CallDao {
|
||||
callEntity.setNumberOfCheck(createCallRequest.getNumberOfCheck());
|
||||
callEntity.setAppointmentTemplateId(createCallRequest.getAppointmentTemplateId());
|
||||
callEntity = callRepository.save(callEntity);
|
||||
log.info("CallEntity saved with ID: {} for call name: '{}'", callEntity.getId(), callEntity.getName());
|
||||
|
||||
/** This code is responsible for adding a version history log for the "Create Call" operation. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(null).newData(callEntity).build());
|
||||
@@ -237,9 +251,11 @@ public class CallDao {
|
||||
}
|
||||
|
||||
private void softDeleteEvaluationCriteria(EvaluationCriteriaEntity evaluationCriteriaEntity) {
|
||||
log.info("Starting soft delete for EvaluationCriteriaEntity with ID: {}", evaluationCriteriaEntity.getId());
|
||||
EvaluationCriteriaEntity oldEvaluationCriteriaEntity = Utils.getClonedEntityForData(evaluationCriteriaEntity);
|
||||
evaluationCriteriaEntity.setIsDeleted(true);
|
||||
evaluationCriteriaRepository.save(evaluationCriteriaEntity);
|
||||
log.info("Soft deleted EvaluationCriteriaEntity with ID: {}", evaluationCriteriaEntity.getId());
|
||||
|
||||
/** This code is responsible for adding a version history log for the "soft delete evaluation criteria" operation **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.SOFT_DELETE).oldData(oldEvaluationCriteriaEntity).newData(evaluationCriteriaEntity).build());
|
||||
@@ -256,8 +272,8 @@ public class CallDao {
|
||||
/** This code is responsible for adding a version history log for the "soft delete criteria form field" operation **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.SOFT_DELETE).oldData(oldCriteriaFormFieldEntity).newData(data).build());
|
||||
});
|
||||
criteriaFormFieldRepository.saveAll(list);
|
||||
|
||||
criteriaFormFieldRepository.saveAll(list);
|
||||
log.info("Soft deleted all linked CriteriaFormFieldEntity records for EvaluationCriteriaEntity ID: {}", evaluationCriteriaEntity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,8 +343,11 @@ public class CallDao {
|
||||
private DocumentEntity convertToDocumentEntity(DocumentReq documentReq,Long sourceId) {
|
||||
validateDocumentEntity(documentReq.getId());
|
||||
DocumentEntity documentEntity = documentRepository.findByIdAndSourceIdAndSourceAndIsDeletedFalse(documentReq.getId(),sourceId, DocumentSourceTypeEnum.CALL.getValue())
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
|
||||
Translator.toLocale(GepafinConstant.DOCUMENT_NOT_FOUND)));
|
||||
.orElseThrow(() -> {
|
||||
log.error("Document not found or already deleted. Document ID: {}, Source ID: {}", documentReq.getId(), sourceId);
|
||||
return new ResourceNotFoundException(Status.NOT_FOUND,
|
||||
Translator.toLocale(GepafinConstant.DOCUMENT_NOT_FOUND));
|
||||
});
|
||||
return documentEntity;
|
||||
}
|
||||
|
||||
@@ -353,6 +372,7 @@ public class CallDao {
|
||||
|
||||
public void validateDocumentEntity(Long documentId) {
|
||||
if (documentId == null || documentId < 1) {
|
||||
log.warn("Invalid Document ID provided: {}", documentId);
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||
Translator.toLocale(GepafinConstant.DOCUMENT_ID_NOT_FOUND));
|
||||
}
|
||||
@@ -491,13 +511,16 @@ public class CallDao {
|
||||
}
|
||||
|
||||
public CallEntity validateCall(Long callId) {
|
||||
return callRepository.findById(callId).orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
|
||||
Translator.toLocale(GepafinConstant.CALL_NOT_FOUND)));
|
||||
return callRepository.findById(callId).orElseThrow(() -> { log.error("Call not found for ID: {}", callId);
|
||||
return new ResourceNotFoundException(Status.NOT_FOUND,
|
||||
Translator.toLocale(GepafinConstant.CALL_NOT_FOUND));
|
||||
});
|
||||
}
|
||||
|
||||
public CallResponse getCallById(HttpServletRequest request,UserEntity user, CallEntity callEntity, Long companyId) {
|
||||
Long userId = user.getId();
|
||||
Long callId = callEntity.getId();
|
||||
log.info("Fetching Call details for Call ID: {}, User ID: {}, Company ID: {}", callId, userId, companyId);
|
||||
|
||||
BeneficiaryPreferredCallEntity preferredCall;
|
||||
if (companyId != null) {
|
||||
@@ -523,10 +546,13 @@ public class CallDao {
|
||||
|
||||
public CallResponse createCallStep2(CallEntity callEntity, CreateCallRequestStep2 createCallRequest, UserEntity user) {
|
||||
// validateUpdate(callEntity);
|
||||
log.info("Starting Call Step 2 update for Call ID: {}, User ID: {}", callEntity.getId(), user.getId());
|
||||
if(createCallRequest.getThreshold() != null && Boolean.FALSE.equals(createCallRequest.getThreshold().equals(callEntity.getThreshold()))) {
|
||||
CallEntity oldCallEntity = Utils.getClonedEntityForData(callEntity);
|
||||
setIfUpdated(callEntity::getThreshold, callEntity::setThreshold, createCallRequest.getThreshold());
|
||||
callEntity = callRepository.save(callEntity);
|
||||
|
||||
log.info("Updated threshold for Call ID: {}", callEntity.getId());
|
||||
|
||||
/** This code is responsible for adding a version history log for the "update call step 2" operation **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldCallEntity).newData(callEntity).build());
|
||||
@@ -546,6 +572,7 @@ public class CallDao {
|
||||
|
||||
public void validateUpdate(CallEntity callEntity) {
|
||||
if(callEntity.getStatus().equals(CallStatusEnum.PUBLISH.getValue())) {
|
||||
log.warn("Attempted update on published call. Call ID: {}", callEntity.getId());
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||
Translator.toLocale(GepafinConstant.PUBLISHED_CALL_NOT_UPDATE));
|
||||
}
|
||||
@@ -574,12 +601,14 @@ public class CallDao {
|
||||
}
|
||||
|
||||
if (Boolean.FALSE.equals(isValid)) {
|
||||
log.error("Invalid date range detected for Call ID: {}", callEntity.getId());
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||
Translator.toLocale(GepafinConstant.INVALID_DATE_MSG));
|
||||
}
|
||||
}
|
||||
|
||||
public CallResponse updateCallStep1(HttpServletRequest request,CallEntity callEntity, UpdateCallRequestStep1 updateCallRequest, UserEntity userEntity) {
|
||||
log.info("Updating Call ID: {}, by User ID: {}", callEntity.getId(),userEntity.getId() );
|
||||
CallEntity oldCallEntity = Utils.getClonedEntityForData(callEntity);
|
||||
isValidDateRange(updateCallRequest, callEntity);
|
||||
setIfUpdated(callEntity::getName, callEntity::setName, updateCallRequest.getName());
|
||||
@@ -639,9 +668,11 @@ public class CallDao {
|
||||
updateCallRequest.getDocumentationRequested());
|
||||
|
||||
if (updateCallRequest.getAmountMin() != null && updateCallRequest.getAmountMin().compareTo(BigDecimal.ZERO) < 0) {
|
||||
log.error("Validation failed: Invalid email {} for Call ID: {}", updateCallRequest.getEmail(), callEntity.getId());
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR,Translator.toLocale(GepafinConstant.AMOUNT_GREATER_THAN_ZERO_MSG));
|
||||
}
|
||||
if(updateCallRequest.getEmail()!=null && Boolean.FALSE.equals(Utils.isValidEmail(updateCallRequest.getEmail()))){
|
||||
log.error("Validation failed: Invalid email {} for Call ID: {}", updateCallRequest.getEmail(), callEntity.getId());
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR,Translator.toLocale(GepafinConstant.VALIDATION_EMAIL,updateCallRequest.getEmail()));
|
||||
}
|
||||
setIfUpdated(callEntity::getAmountMin, callEntity::setAmountMin, updateCallRequest.getAmountMin());
|
||||
@@ -661,6 +692,7 @@ public class CallDao {
|
||||
updateFaq(updateCallRequest.getFaq(), callEntity, userEntity, LookUpDataTypeEnum.FAQ);
|
||||
CallResponse createCallResponseBean = getCallResponseBean(callEntity);
|
||||
createCallResponseBean.setCurrentStep(GepafinConstant.STEP_1);
|
||||
log.info("Call Step 1 update completed for Call ID: {}", callEntity.getId());
|
||||
return createCallResponseBean;
|
||||
}
|
||||
|
||||
@@ -764,6 +796,7 @@ public class CallDao {
|
||||
}
|
||||
|
||||
private CallResponse getCallResponseBean(CallEntity callEntity) {
|
||||
log.info("Building CallResponse for Call ID: {}", callEntity.getId());
|
||||
List<DocumentEntity> documentEntities = documentRepository.findBySourceIdAndSourceAndTypeAndIsDeletedFalse(callEntity.getId(),DocumentSourceTypeEnum.CALL.getValue()
|
||||
, DocumentTypeEnum.DOCUMENT.getValue());
|
||||
List<DocumentEntity> imageEntities = documentRepository.findBySourceIdAndSourceAndTypeAndIsDeletedFalse(callEntity.getId(), DocumentSourceTypeEnum.CALL.getValue()
|
||||
@@ -790,6 +823,9 @@ public class CallDao {
|
||||
|
||||
public List<CallDetailsResponseBean> getAllCalls(HttpServletRequest request,UserEntity user, Long companyId,Boolean onlyPreferredCall,Boolean onlyConfidiCall) {
|
||||
String type = user.getRoleEntity().getRoleType();
|
||||
log.info("Fetching calls for User ID: {}, Role: {}, Company ID: {}, onlyPreferredCall: {}, onlyConfidiCall: {}",
|
||||
user.getId(), type, companyId, onlyPreferredCall, onlyConfidiCall);
|
||||
|
||||
List<String> callStatusList = CallStatusEnum.getStatusValues();
|
||||
if (Boolean.FALSE.equals(ROLE_SUPER_ADMIN.getValue().equals(type))) {
|
||||
callStatusList = List.of(CallStatusEnum.PUBLISH.getValue());
|
||||
@@ -811,6 +847,7 @@ public class CallDao {
|
||||
call.getEndDate() != null && call.getEndTime() != null) {
|
||||
LocalDateTime callEndDateTime = LocalDateTime.of(LocalDate.from(call.getEndDate()), call.getEndTime());
|
||||
if (callEndDateTime.isBefore(now)) {
|
||||
log.info("Call ID: {} has expired. Updating status from PUBLISH to EXPIRED.", call.getId());
|
||||
call.setStatus(CallStatusEnum.EXPIRED.getValue());
|
||||
callRepository.save(call);
|
||||
}
|
||||
@@ -846,14 +883,17 @@ public class CallDao {
|
||||
}
|
||||
|
||||
public Map<String, BeneficiaryPreferredCallEntity> getBeneficiaryPreferredCallsForUser(HttpServletRequest request, UserEntity user, List<Long> callIds, Long companyId) {
|
||||
log.info("Fetching preferred calls for User ID: {}, Company ID: {}, Call IDs: {}", user.getId(), companyId, callIds);
|
||||
List<BeneficiaryPreferredCallEntity> beneficiaryPreferredCalls;
|
||||
|
||||
if (companyId != null && (Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi()))) {
|
||||
log.info("Validating user with company for preferred calls: User ID: {}, Company ID: {}", user.getId(), companyId);
|
||||
validator.validateUserWithCompany(request, companyId);
|
||||
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(user.getId(),companyId);
|
||||
beneficiaryPreferredCalls = beneficiaryPreferredCallRepository
|
||||
.findByUserIdAndCallIdInAndUserWithCompanyIdAndIsDeletedFalse(user.getId(), callIds, userWithCompanyEntity.getId());
|
||||
} else {
|
||||
log.info("Fetching preferred calls without company filtering for User ID: {}", user.getId());
|
||||
beneficiaryPreferredCalls = beneficiaryPreferredCallRepository
|
||||
.findByUserIdAndCallIdInAndIsDeletedFalse(user.getId(), callIds);
|
||||
beneficiaryPreferredCalls = beneficiaryPreferredCalls.stream()
|
||||
@@ -877,6 +917,7 @@ public class CallDao {
|
||||
|
||||
|
||||
public CallResponse validateCallData(CallEntity callEntity) {
|
||||
log.info("Starting call validation for Call ID: {}, Current Status: {}", callEntity.getId(), callEntity.getStatus());
|
||||
CallEntity oldCallEntity = Utils.getClonedEntityForData(callEntity);
|
||||
validateUpdate(callEntity);
|
||||
CallResponse callResponseBean = getCallResponseBean(callEntity);
|
||||
@@ -886,6 +927,7 @@ public class CallDao {
|
||||
CallValidatorServiceImpl.validateResponse(callResponseBean,flowResponseBean,formResponseBean,evaluationFormResponseBean);
|
||||
callEntity.setStatus(CallStatusEnum.READY_TO_PUBLISH.getValue());
|
||||
callEntity = callRepository.save(callEntity);
|
||||
log.info("Call status updated to READY_TO_PUBLISH for Call ID: {}", callEntity.getId());
|
||||
|
||||
/** This code is responsible for adding a version history log for the "validate call" operation **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldCallEntity).newData(callEntity).build());
|
||||
@@ -903,11 +945,13 @@ public class CallDao {
|
||||
// }
|
||||
|
||||
public CallResponse updateCallStatus(CallEntity callEntity, CallStatusEnum statusReq) {
|
||||
log.info("Updating call status for Call ID: {} from {} to {}", callEntity.getId(), callEntity.getStatus(), statusReq);
|
||||
CallEntity oldCallEntity = Utils.getClonedEntityForData(callEntity);
|
||||
CallStatusEnum currentStatus = CallStatusEnum.valueOf(callEntity.getStatus());
|
||||
validateStatusChange(currentStatus, statusReq, callEntity.getId());
|
||||
callEntity.setStatus(statusReq.getValue());
|
||||
callEntity = callRepository.save(callEntity);
|
||||
log.info("Call status updated in DB for Call ID: {}. New Status: {}", callEntity.getId(), callEntity.getStatus());
|
||||
|
||||
//Creating notification.
|
||||
List<Long> userIds = beneficiaryRepository.findUserIdsByHubIdAndBeneficiaryId(callEntity.getHub().getId());
|
||||
@@ -926,27 +970,32 @@ public class CallDao {
|
||||
}
|
||||
|
||||
private void validateStatusChange(CallStatusEnum currentStatus, CallStatusEnum newStatus, Long callId) {
|
||||
|
||||
log.info("Validating status change for Call ID: {} from '{}' to '{}'", callId, currentStatus, newStatus);
|
||||
if (currentStatus == newStatus) {
|
||||
log.warn("Validation failed: current status and new status are the same for Call ID: {}", callId);
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.STATUS_SAME_ERROR));
|
||||
}
|
||||
switch (currentStatus) {
|
||||
case DRAFT:
|
||||
if (newStatus == CallStatusEnum.READY_TO_PUBLISH || newStatus == CallStatusEnum.PUBLISH) {
|
||||
log.warn("Invalid status change attempt from DRAFT to {} for Call ID: {}", newStatus, callId);
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.INVALID_STATUS_CHANGE_FROM_DRAFT));
|
||||
}
|
||||
break;
|
||||
|
||||
case PUBLISH:
|
||||
if (newStatus == CallStatusEnum.READY_TO_PUBLISH) {
|
||||
log.warn("Invalid status change attempt from PUBLISH to READY_TO_PUBLISH for Call ID: {}", callId);
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.INVALID_STATUS_CHANGE_FROM_PUBLISH));
|
||||
}
|
||||
if (newStatus == CallStatusEnum.DRAFT && Boolean.TRUE.equals(applicationRepository.existsByCallId(callId))) {
|
||||
log.warn("Invalid status change attempt from PUBLISH to DRAFT for Call ID: {} due to existing applications", callId);
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.INVALID_STATUS_CHANGE_FROM_PUBLISH_TO_DRAFT));
|
||||
}
|
||||
break;
|
||||
|
||||
case EXPIRED:
|
||||
log.warn("Attempt to change status from EXPIRED for Call ID: {} which is not allowed", callId);
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.STATUS_CANNOT_BE_CHANGED));
|
||||
|
||||
case READY_TO_PUBLISH:
|
||||
@@ -957,9 +1006,11 @@ public class CallDao {
|
||||
}
|
||||
|
||||
public CallEntity validatePublishedCall(Long callId, Long hubId) {
|
||||
log.info("Validating published call for Call ID: {}, Hub ID: {}", callId, hubId);
|
||||
CallEntity callEntity= callRepository
|
||||
.findByIdAndStatusAndHubId(callId, CallStatusEnum.PUBLISH.getValue(), hubId);
|
||||
if(callEntity==null){
|
||||
log.warn("No published call found with Call ID: {} and Hub ID: {}", callId, hubId);
|
||||
throw new ResourceNotFoundException(
|
||||
Status.NOT_FOUND,
|
||||
Translator.toLocale(GepafinConstant.CALL_NOT_PUBLISHED));
|
||||
@@ -969,6 +1020,7 @@ public class CallDao {
|
||||
|
||||
if (currentDate.isBefore(callEntity.getStartDate().toLocalDate()) ||
|
||||
(currentDate.isEqual(callEntity.getStartDate().toLocalDate()) && currentTime.isBefore(callEntity.getStartTime()))) {
|
||||
log.warn("Call ID: {} has not started yet. Current time is before start time.", callId);
|
||||
throw new CustomValidationException(
|
||||
Status.BAD_REQUEST,
|
||||
Translator.toLocale(GepafinConstant.CALL_NOT_STARTED_YET)
|
||||
@@ -977,6 +1029,7 @@ public class CallDao {
|
||||
|
||||
if (currentDate.isAfter(callEntity.getEndDate().toLocalDate()) ||
|
||||
(currentDate.isEqual(callEntity.getEndDate().toLocalDate()) && currentTime.isAfter(callEntity.getEndTime()))) {
|
||||
log.warn("Call ID: {} has already ended. Current time is after end time.", callId);
|
||||
throw new CustomValidationException(
|
||||
Status.BAD_REQUEST,
|
||||
Translator.toLocale(GepafinConstant.CALL_ALREADY_ENDED)
|
||||
@@ -987,6 +1040,7 @@ public class CallDao {
|
||||
}
|
||||
|
||||
public PageableResponseBean<List<CallDetailsResponseBean>> getAllCallsByPagination(HttpServletRequest request,UserEntity user,Long companyId , Boolean onlyPreferredCall, Boolean onlyConfidiCall, CallPageableRequestBean callPageableRequestBean) {
|
||||
log.info("Fetching paginated calls for userId={}, companyId={}, onlyPreferredCall={}", user.getId(), companyId, onlyPreferredCall);
|
||||
Integer pageNo = null;
|
||||
Integer pageLimit = null;
|
||||
if (callPageableRequestBean.getGlobalFilters() != null) {
|
||||
@@ -1009,6 +1063,7 @@ public class CallDao {
|
||||
Specification<CallEntity> spec = search(request,user, callPageableRequestBean,onlyConfidiCall);
|
||||
Page<CallEntity> entityPage;
|
||||
if (Boolean.TRUE.equals(onlyPreferredCall)) {
|
||||
log.debug("Filtering calls for preferred by userId={} and companyId={}", user.getId(), companyId);
|
||||
validator.validateUserWithCompany(request, companyId);
|
||||
UserWithCompanyEntity userWithCompanyEntity = companyService.getUserWithCompany(user.getId(), companyId);
|
||||
List<BeneficiaryPreferredCallEntity> preferredCalls = beneficiaryPreferredCallRepository
|
||||
@@ -1171,6 +1226,8 @@ public class CallDao {
|
||||
|
||||
LocalDate currentDate = DateTimeUtil.DateServerToUTC(LocalDateTime.now()).toLocalDate();
|
||||
LocalTime currentTime = DateTimeUtil.LocalTimeServerToEurope(LocalTime.now());
|
||||
|
||||
log.info("Checking for expired published calls at date={}, time={}", currentDate, currentTime);
|
||||
|
||||
List<CallEntity> expirdedCallList = callRepository.findExpiredCallsWhichIsPublished(CallStatusEnum.PUBLISH.getValue(), currentDate, currentTime);
|
||||
|
||||
@@ -1321,7 +1378,7 @@ public class CallDao {
|
||||
|
||||
|
||||
public CallResponse createCallStep2EvaluationV2(CallEntity callEntity, CreateCallRequestStep2EvaluationV2 createCallRequest, UserEntity user) {
|
||||
|
||||
log.info("Starting Step 2 Evaluation (V2) for Call ID={}, User ID={}", callEntity.getId(), user.getId());
|
||||
convertToDocumentEntities(createCallRequest.getDocs(), callEntity.getId(), DocumentTypeEnum.DOCUMENT);
|
||||
|
||||
convertToDocumentEntities(createCallRequest.getImages(), callEntity.getId(), DocumentTypeEnum.IMAGES);
|
||||
|
||||
Reference in New Issue
Block a user