Resolved conflicts

This commit is contained in:
rajesh
2025-01-02 15:45:37 +05:30
158 changed files with 5895 additions and 1053 deletions

View File

@@ -1,13 +1,18 @@
package net.gepafin.tendermanagement.repositories;
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
import net.gepafin.tendermanagement.entities.ApplicationEntity;
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
import java.util.Set;
public interface ApplicationAmendmentRequestRepository extends JpaRepository<ApplicationAmendmentRequestEntity,Long>, JpaSpecificationExecutor<ApplicationAmendmentRequestEntity> {
Optional<ApplicationAmendmentRequestEntity> findByIdAndIsDeletedFalse(Long id);
@@ -25,6 +30,7 @@ public interface ApplicationAmendmentRequestRepository extends JpaRepository<App
@Query(value = "SELECT amr FROM ApplicationAmendmentRequestEntity amr " +
"WHERE amr.applicationEvaluationEntity.id = :id " +
"AND amr.isDeleted = false " +
"AND amr.applicationEvaluationEntity.isDeleted = false")
List<ApplicationAmendmentRequestEntity> findAllByApplicationEvaluationIdAndIsDeletedFalse(Long id);
@@ -34,4 +40,38 @@ public interface ApplicationAmendmentRequestRepository extends JpaRepository<App
List<ApplicationAmendmentRequestEntity> findByApplicationIdAndStatusInAndIsDeletedFalse(Long applicationId, List<String> statuses);
@Query("SELECT app " +
"FROM ApplicationEntity app " +
"WHERE app.id = (SELECT aar.applicationId " +
"FROM ApplicationAmendmentRequestEntity aar " +
"WHERE aar.id = :amendmentId AND aar.isDeleted = false)")
ApplicationEntity findApplicationByAmendmentId(Long amendmentId);
@Query(value = "SELECT amr " +
"FROM ApplicationAmendmentRequestEntity amr " +
"WHERE amr.applicationEvaluationEntity.id = :id " +
"AND amr.isDeleted = false " +
"AND amr.applicationEvaluationEntity.isDeleted = false " +
"AND amr.status IN (:statuses)")
List<ApplicationAmendmentRequestEntity> findAllByApplicationEvaluationIdAndStatusAndIsDeletedFalse(Long id, List<String> statuses);
@Query("SELECT a FROM ApplicationAmendmentRequestEntity a " +
"WHERE a.isDeleted = false " +
"AND a.status <> 'CLOSE' " +
"AND a.endDate < :currentTime")
List<ApplicationAmendmentRequestEntity> findAmendmentsDueForExpiration(LocalDateTime currentTime);
@Query("SELECT DISTINCT a.applicationEvaluationEntity " +
"FROM ApplicationAmendmentRequestEntity a " +
"WHERE a.applicationEvaluationEntity.id IN :applicationEvaluationIds " +
"AND a.isDeleted = false " +
"AND NOT EXISTS ( " +
" SELECT 1 FROM ApplicationAmendmentRequestEntity activeAmendment" +
" WHERE activeAmendment.applicationEvaluationEntity.id = a.applicationEvaluationEntity.id " +
" AND activeAmendment.status <> 'CLOSE' " +
" AND activeAmendment.isDeleted = false) ")
Set<ApplicationEvaluationEntity> findEvaluationsWithoutActiveAmendmentsByIds(@Param("applicationEvaluationIds") Set<Long> applicationEvaluationIds);
}

View File

@@ -1,11 +1,13 @@
package net.gepafin.tendermanagement.repositories;
import net.gepafin.tendermanagement.entities.ApplicationEntity;
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
@@ -20,6 +22,13 @@ public interface ApplicationEvaluationRepository extends JpaRepository<Applicati
Optional<ApplicationEvaluationEntity> findFirstByIsDeletedFalseOrderByCreatedDateDesc();
boolean existsByApplicationIdAndIsDeletedFalse(Long applicationId);
@Query("SELECT app " +
"FROM ApplicationEntity app " +
"WHERE app.id = (SELECT aar.applicationId " +
"FROM ApplicationEvaluationEntity aar " +
"WHERE aar.id = :evaluationId AND aar.isDeleted = false)")
ApplicationEntity findApplicationByEvaluationId(Long evaluationId);
@Query("SELECT a FROM ApplicationEvaluationEntity a WHERE a.isDeleted = false AND a.endDate < :currentDate")
List<ApplicationEvaluationEntity> findAllByIsDeletedFalseAndEndDateBefore(@Param("currentDate") LocalDateTime currentDate);
}

View File

@@ -24,15 +24,17 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
public Optional<ApplicationEntity> findByIdAndUserIdAndIsDeletedFalse(Long id,Long userId);
Optional<ApplicationEntity> findByUserIdAndCompanyIdAndCallIdAndIsDeletedFalse(Long userId, Long companyId, Long callId);
Optional<ApplicationEntity> findByUserIdAndUserWithCompanyIdAndCallIdAndIsDeletedFalse(Long userId, Long userWithCompanyId, Long callId);
public Optional<ApplicationEntity> findByIdAndUserIdAndCallIdAndIsDeletedFalse(Long applicationId, Long userId,
Long callId);
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.userId = :userId AND a.company.id = :companyId AND a.status = 'SUBMIT' AND a.isDeleted = false")
Long countSubmittedApplicationsByUserId(@Param("userId") Long userId, @Param("companyId") Long companyId);
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.userId = :userId AND a.userWithCompany.id = :userWithCompanyId AND a.status = 'SUBMIT' AND a.isDeleted = false")
Long countSubmittedApplicationsByUserId(@Param("userId") Long userId, @Param("userWithCompanyId") Long userWithCompanyId);
List<ApplicationEntity> findByUserWithCompanyIdAndUserIdAndIsDeletedFalse(Long userWithCompanyId, Long userId);
List<ApplicationEntity> findByCompanyIdAndUserIdAndIsDeletedFalse(Long companyId,Long userId);
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.status = 'SUBMIT' And a.hubId = :hubId AND a.isDeleted = false")
public Long countSubmittedApplicationsByHubId(@Param("hubId") Long hubId);
@@ -40,6 +42,6 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.status = 'DRAFT' And a.hubId = :hubId AND a.isDeleted = false")
public Long countDraftApplicationsByHubId(@Param("hubId") Long hubId);
@Query("SELECT a.call.id FROM ApplicationEntity a WHERE a.id = :id")
@Query("SELECT a.call.id FROM ApplicationEntity a WHERE a.id = :id AND a.isDeleted = false")
Long findCallIdById(@Param("id") Long id);
}

View File

@@ -13,12 +13,17 @@ public interface BeneficiaryPreferredCallRepository extends JpaRepository<Benefi
List<BeneficiaryPreferredCallEntity> findByBeneficiaryIdAndIsDeletedFalse(Long beneficiaryId);
List<BeneficiaryPreferredCallEntity> findByUserIdAndIsDeletedFalse(Long userId);
@Query("SELECT preferredCall FROM BeneficiaryPreferredCallEntity preferredCall where preferredCall.userId=:userId AND (:companyId is null OR preferredCall.companyId=:companyId) AND isDeleted=false")
List<BeneficiaryPreferredCallEntity> findByUserIdAndCompanyIdAndIsDeletedFalse(@Param("userId") Long userId, @Param("companyId") Long companyId);
@Query("SELECT preferredCall FROM BeneficiaryPreferredCallEntity preferredCall WHERE preferredCall.userId = :userId AND (:userWithCompanyId IS NULL OR preferredCall.userWithCompany.id = :userWithCompanyId) AND isDeleted = false")
List<BeneficiaryPreferredCallEntity> findByUserIdAndUserWithCompanyIdAndIsDeletedFalse(@Param("userId") Long userId, @Param("userWithCompanyId") Long userWithCompanyId);
List<BeneficiaryPreferredCallEntity> findByBeneficiaryIdAndCompanyId(Long beneficiaryId,Long companyId);
List<BeneficiaryPreferredCallEntity> findByUserIdAndCallIdInAndIsDeletedFalse(Long userId, List<Long> callIds);
Optional<BeneficiaryPreferredCallEntity> findByIdAndIsDeletedFalse(Long id);
Optional<BeneficiaryPreferredCallEntity> findByUserIdAndCallIdAndCompanyIdAndIsDeletedFalse(Long userId, Long callId, Long companyId);
List<BeneficiaryPreferredCallEntity> findByUserIdAndCallIdInAndCompanyIdAndIsDeletedFalse(Long userId, List<Long> callIds,Long companyId);
Optional<BeneficiaryPreferredCallEntity> findByUserIdAndCallIdAndUserWithCompanyIdAndIsDeletedFalse(Long userId, Long callId, Long userWithCompanyId);
List<BeneficiaryPreferredCallEntity> findByUserIdAndCallIdInAndUserWithCompanyIdAndIsDeletedFalse(Long userId, List<Long> callIds, Long userWithCompanyId);
}

View File

@@ -1,11 +1,16 @@
package net.gepafin.tendermanagement.repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import net.gepafin.tendermanagement.entities.BeneficiaryEntity;
import java.util.List;
@Repository
public interface BeneficiaryRepository extends JpaRepository<BeneficiaryEntity, Long> {
@Query("SELECT u.id FROM UserEntity u JOIN u.beneficiary b WHERE b.id = u.beneficiary.id AND b.hubId = :hubId")
List<Long> findUserIdsByHubIdAndBeneficiaryId(Long hubId);
}

View File

@@ -28,6 +28,12 @@ public interface DocumentRepository extends JpaRepository<DocumentEntity, Long>
@Query("SELECT d FROM DocumentEntity d WHERE d.isDeleted = false")
List<DocumentEntity> findAllByIsDeleteFalse();
@Query("SELECT d FROM DocumentEntity d WHERE d.isDeleted = true")
List<DocumentEntity> findAllByIsDeleteTrue();
List<DocumentEntity> findAllByIdInAndIsDeletedFalse(Set<Long> documentIds);
List<DocumentEntity> findBySourceIdInAndSourceAndIsDeletedFalse(Set<Long> sourceId, String type);
}

View File

@@ -19,6 +19,8 @@ public interface FaqRepository extends JpaRepository<FaqEntity, Long> {
List<FaqEntity> findByCallIdAndIsDeletedFalse(Long callId);
Optional<FaqEntity> findByIdAndCallIdAndIsDeletedFalse(Long id, Long callId);
List<FaqEntity> findByCompanyIdAndUserIdAndIsDeletedFalse(Long companyId,Long userId);
List<FaqEntity> findByUserWithCompanyIdAndIsDeletedFalse(Long userWithCompanyId);
}

View File

@@ -1,15 +1,17 @@
package net.gepafin.tendermanagement.repositories;
import net.gepafin.tendermanagement.entities.HubEntity;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
@Repository
public interface HubRepository extends JpaRepository<HubEntity, Long> {
Optional<HubEntity> findByUniqueUuid(String hubUuid);
Optional<HubEntity> findByUniqueUuid(String hubUuid);
@Query("SELECT h FROM HubEntity h WHERE h.id = :hubId")
HubEntity findByHubId(@Param("hubId") Long hubId);
}

View File

@@ -0,0 +1,20 @@
package net.gepafin.tendermanagement.repositories;
import net.gepafin.tendermanagement.entities.NotificationEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface NotificationRepository extends JpaRepository<NotificationEntity, Long> {
NotificationEntity findByIdAndIsDeletedFalse(Long id);
List<NotificationEntity> findByUserIdAndIsDeletedFalse(Long userId);
List<NotificationEntity> findByUserIdAndUserWithCompanyIdAndIsDeletedFalseAndStatusIn(Long userId, Long userWithCompanyId, List<String> statuses);
List<NotificationEntity> findByUserIdAndIsDeletedFalseAndStatusIn(Long userId, List<String> statuses);
List<NotificationEntity> findByUserWithCompanyIdAndUserIdAndIsDeletedFalse(Long userWithCompanyId, Long userId);
}

View File

@@ -0,0 +1,8 @@
package net.gepafin.tendermanagement.repositories;
import net.gepafin.tendermanagement.entities.NotificationTypeEntity;
import org.springframework.data.jpa.repository.JpaRepository;
public interface NotificationTypeRepository extends JpaRepository<NotificationTypeEntity, Long> {
NotificationTypeEntity findByNotificationNameAndIsDeletedFalse(String value);
}

View File

@@ -9,7 +9,7 @@ import java.util.List;
public interface UserCompanyDelegationRepository extends JpaRepository<UserCompanyDelegationEntity, Long> {
UserCompanyDelegationEntity findByUserIdAndCompanyIdAndStatus(Long userId, Long companyId, String status);
UserCompanyDelegationEntity findByUserIdAndUserWithCompanyIdAndStatus(Long userId, Long userWithCompanyId, String status);
@Query("SELECT d FROM UserCompanyDelegationEntity d where d.status = :status")
List<UserCompanyDelegationEntity> findAllByStatus(@Param("status") String status);

View File

@@ -25,7 +25,7 @@ public interface UserRepository extends JpaRepository<UserEntity, Long> {
// boolean existsByEmailIgnoreCaseAndHubUniqueUuid(String email, String hubUuid);
List<UserEntity> findByRoleEntityIdAndHubId(Long roleId, Long hubId);
List<UserEntity> findByRoleEntityIdInAndHubId(List<Long> roleIds, Long hubId);
List<UserEntity> findByHubId(Long hubId);
@@ -50,5 +50,8 @@ public interface UserRepository extends JpaRepository<UserEntity, Long> {
"AND u.roleEntity.roleType = :beneficiaryRoleType")
Boolean existsByEmailIgnoreCaseForBeneficiaries(String email, String hubUuid, String beneficiaryRoleType);
// existsByBebooleanneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
List<UserEntity> findByRoleEntity_RoleTypeAndHubId(String roleType, Long hubId);
}

View File

@@ -1,22 +1,23 @@
package net.gepafin.tendermanagement.repositories;
import java.util.List;
import java.util.Optional;
import net.gepafin.tendermanagement.entities.UserWithCompanyEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import net.gepafin.tendermanagement.entities.UserWithCompanyEntity;
import java.util.List;
import java.util.Optional;
public interface UserWithCompanyRepository extends JpaRepository<UserWithCompanyEntity, Long> {
void deleteByCompanyIdAndIsDeletedFalse(Long companyId);
void deleteByCompanyIdAndIsDeletedFalse(Long companyId);
@Query("SELECT u.companyId FROM UserWithCompanyEntity u WHERE u.userId = :userId AND u.isDeleted = false")
List<Long> findActiveCompanyIdsByUserId(@Param("userId") Long userId);
@Query("SELECT u.companyId FROM UserWithCompanyEntity u WHERE u.userId = :userId AND u.isDeleted = false")
List<Long> findActiveCompanyIdsByUserId(@Param("userId") Long userId);
Optional<UserWithCompanyEntity> findByUserIdAndCompanyIdAndIsDeletedFalse(Long userId, Long companyId);
Optional<UserWithCompanyEntity> findByUserIdAndCompanyIdAndIsDeletedFalse(Long userId, Long companyId);
@Query("SELECT u FROM UserWithCompanyEntity u WHERE u.userId = :userId AND u.companyId = :companyId AND u.isDeleted = false")
UserWithCompanyEntity findByUserIdAndCompanyIdAndIsDeletedFalseForNotification(Long userId, Long companyId);
}