Conflict Resolved

This commit is contained in:
harish
2024-10-26 14:24:25 +05:30
131 changed files with 4492 additions and 1183 deletions

View File

@@ -32,13 +32,14 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.userId = :userId AND a.company.id = :companyId AND a.status = 'SUBMIT' ")
Long countSubmittedApplicationsByUserId(@Param("userId") Long userId, @Param("companyId") Long companyId);
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.status = 'SUBMIT'")
Long countSubmittedApplications();
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.status = 'DRAFT'")
Long countDraftApplications();
List<ApplicationEntity> findByCompanyIdAndUserIdAndIsDeletedFalse(Long companyId,Long userId);
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.status = 'SUBMIT' And a.hubId = :hubId")
public Long countSubmittedApplicationsByHubId(@Param("hubId") Long hubId);
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.status = 'DRAFT' And a.hubId = :hubId")
public Long countDraftApplicationsByHubId(@Param("hubId") Long hubId);
@Query("SELECT a.call.id FROM ApplicationEntity a WHERE a.id = :id")
Long findCallIdById(@Param("id") Long id);
}

View File

@@ -1,13 +1,24 @@
package net.gepafin.tendermanagement.repositories;
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 net.gepafin.tendermanagement.entities.ApplicationSignedDocumentEntity;
import java.util.List;
@Repository
public interface ApplicationSignedDocumentRepository extends JpaRepository<ApplicationSignedDocumentEntity, Long> {
ApplicationSignedDocumentEntity findByApplicationIdAndStatus(Long applicationId, String status);
Long findApplicationIdById(Long id);
@Query("SELECT a.id FROM ApplicationSignedDocumentEntity d JOIN d.application a WHERE d.id = :id")
List<Long> findApplicationIdIdsById(@Param("id") Long id);
@Query("SELECT d FROM ApplicationSignedDocumentEntity d WHERE d.status = :status")
List<ApplicationSignedDocumentEntity> findAllByIsStatus(@Param("status")String status);
}

View File

@@ -0,0 +1,13 @@
package net.gepafin.tendermanagement.repositories;
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
public interface AssignedApplicationsRepository extends JpaRepository<AssignedApplicationsEntity,Long>, JpaSpecificationExecutor<AssignedApplicationsEntity>{
Optional<AssignedApplicationsEntity> findByApplicationIdAndIsDeletedFalse(Long applicationId);
Optional<AssignedApplicationsEntity> findByIdAndIsDeletedFalse(Long id);
}

View File

@@ -1,8 +1,8 @@
package net.gepafin.tendermanagement.repositories;
import net.gepafin.tendermanagement.entities.CallEntity;
import net.gepafin.tendermanagement.enums.CallStatusEnum;
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.math.BigDecimal;
@@ -11,15 +11,16 @@ import java.util.List;
@Repository
public interface CallRepository extends JpaRepository<CallEntity, Long> {
public CallEntity findByIdAndStatusNotIn(Long id, List<String> status);
List<CallEntity> findByStatusIn(List<String> callStatus);
// public CallEntity findByIdAndStatusNotIn(Long id, List<String> status);
// List<CallEntity> findByStatusIn(List<String> callStatus);
public CallEntity findByIdAndStatus(Long id,String status);
// public CallEntity findByIdAndStatus(Long id,String status);
public Long countByStatus(String status);
// public Long countByStatus(String status);
@Query("SELECT COALESCE(SUM(c.amount), 0) FROM CallEntity c WHERE c.status = 'PUBLISH'")
BigDecimal findTotalAmountOfPublishedCalls();
// @Query("SELECT COALESCE(SUM(c.amount), 0) FROM CallEntity c WHERE c.status = 'PUBLISH'")
// BigDecimal findTotalAmountOfPublishedCalls();
@Query("SELECT c.name, COUNT(a.id) " +
"FROM CallEntity c LEFT JOIN ApplicationEntity a ON c.id = a.call.id " +
@@ -29,4 +30,19 @@ public interface CallRepository extends JpaRepository<CallEntity, Long> {
@Query("SELECT c FROM CallEntity c JOIN ApplicationEntity a ON c.id = a.call.id WHERE a.id = :applicationId")
CallEntity findCallEntityByApplicationId(Long applicationId);
// @Query("SELECT c.name, COUNT(a.id) " +
// "FROM CallEntity c LEFT JOIN ApplicationEntity a ON c.id = a.call.id " +
// "GROUP BY c.name")
// List<Object[]> findApplicationsPerCall();
public List<CallEntity> findByStatusInAndHubId(List<String> callStatus, Long hubId);
public CallEntity findByIdAndStatusAndHubId(Long id, String status, Long hubId);
public Long countByStatusAndHubId(String status, Long hubId);
public CallEntity findByIdAndStatusNotInAndHubId(Long id, List<String> status, Long hubId);
@Query("SELECT COALESCE(SUM(c.amount), 0) FROM CallEntity c WHERE c.status = 'PUBLISH' And c.hub.id = :hubId")
BigDecimal findTotalAmountOfPublishedCallsAndHubId(@Param("hubId") Long hubId);
}

View File

@@ -4,6 +4,7 @@ import java.util.List;
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 net.gepafin.tendermanagement.entities.CompanyEntity;
@@ -11,13 +12,14 @@ import net.gepafin.tendermanagement.entities.CompanyEntity;
@Repository
public interface CompanyRepository extends JpaRepository<CompanyEntity, Long> {
List<CompanyEntity> findByIdIn(List<Long> companyIds);
List<CompanyEntity> findByIdInAndHubId(List<Long> companyIds, Long hubId);
Boolean existsByVatNumber(String vatNumber);
CompanyEntity findByVatNumber(String vatNumber);
Boolean existsByVatNumberAndHubId(String vatNumber, Long hubId);
@Query("SELECT COUNT(c) FROM CompanyEntity c")
long countTotalCompanies();
@Query("SELECT COUNT(c) FROM CompanyEntity c where c.hub.id = :hubId")
long countTotalCompaniesByHubId(@Param("hubId") Long hubId);
CompanyEntity findByVatNumberAndHubId(String vatNumber, Long hubId);
}

View File

@@ -0,0 +1,17 @@
package net.gepafin.tendermanagement.repositories;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import net.gepafin.tendermanagement.entities.CriteriaFormFieldEntity;
@Repository
public interface CriteriaFormFieldRepository extends JpaRepository<CriteriaFormFieldEntity, Long>{
List<CriteriaFormFieldEntity> findByCallIdAndFormIdAndFormFieldIdAndIsDeletedFalse(Long callId, Long formId, String formFieldId);
List<CriteriaFormFieldEntity> findByEvaluationCriteriaIdAndIsDeletedFalse(Long evaluationCriteriaId);
}

View File

@@ -15,12 +15,17 @@ public interface DocumentRepository extends JpaRepository<DocumentEntity, Long>
@Query("SELECT d FROM DocumentEntity d WHERE d.id = :id AND d.isDeleted = false")
Optional<DocumentEntity> findById(@Param("id") Long id);
List<DocumentEntity> findBySourceIdAndTypeAndIsDeletedFalse(Long sourceId, String type);
// List<DocumentEntity> findBySourceIdAndTypeAndIsDeletedFalse(Long sourceId, String type);
Optional<DocumentEntity> findByIdAndSourceIdAndIsDeletedFalse(Long id, Long sourceId);
// Optional<DocumentEntity> findByIdAndSourceIdAndIsDeletedFalse(Long id, Long sourceId);
List<DocumentEntity> findBySource(String source);
List<DocumentEntity> findBySourceIdAndSourceAndTypeAndIsDeletedFalse(Long sourceId, String source, String type);
Optional<DocumentEntity> findByIdAndSourceIdAndSourceAndIsDeletedFalse(Long id, Long sourceId, String source);
@Query("SELECT d FROM DocumentEntity d WHERE d.isDeleted = false")
List<DocumentEntity> findAllByIsDeleteFalse();
}

View File

@@ -0,0 +1,15 @@
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.stereotype.Repository;
@Repository
public interface HubRepository extends JpaRepository<HubEntity, Long> {
Optional<HubEntity> findByUniqueUuid(String hubUuid);
}

View File

@@ -1,9 +1,19 @@
package net.gepafin.tendermanagement.repositories;
import net.gepafin.tendermanagement.entities.LoginAttemptEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
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 LoginAttemptRepository extends JpaRepository<LoginAttemptEntity,Long> {
@Query("SELECT la FROM LoginAttemptEntity la LEFT JOIN UserEntity u ON u.email = la.username WHERE u.hub.id = :hubId")
Page<LoginAttemptEntity> findByHubId(@Param("hubId") Long hubId, PageRequest pageRequest);
}

View File

@@ -3,11 +3,12 @@ package net.gepafin.tendermanagement.repositories;
import net.gepafin.tendermanagement.entities.ProtocolEntity;
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 ProtocolRepository extends JpaRepository<ProtocolEntity,Long> {
@Query("SELECT MAX(p.protocolNumber) FROM ProtocolEntity p")
Integer findMaxProtocolNumber();
@Query("SELECT MAX(p.protocolNumber) FROM ProtocolEntity p where p.hubId = :hubId")
Long findMaxProtocolNumberAndHubId(@Param("hubId") Long hubId);
}

View File

@@ -0,0 +1,24 @@
package net.gepafin.tendermanagement.repositories;
import net.gepafin.tendermanagement.entities.S3ConfigEntity;
import net.gepafin.tendermanagement.enums.DocOtherSourceTypeEnum;
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
public interface S3ConfigRepository extends JpaRepository<S3ConfigEntity, Long> {
Optional<S3ConfigEntity> getPathByType(String type);
S3ConfigEntity findS3PathConfigurationById(Long id);
String getBucketNameByType(DocumentSourceTypeEnum type);
String getBucketNameByType(DocOtherSourceTypeEnum type);
@Query("Select s3.parentFolder From S3ConfigEntity s3 Where s3.type = :s")
String getPathByTypeOther(String s);
}

View File

@@ -1,5 +1,7 @@
package net.gepafin.tendermanagement.repositories;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@@ -10,4 +12,6 @@ public interface SamlResponseRepository extends JpaRepository<SamlResponseEntity
SamlResponseEntity findByToken(String token);
Optional<SamlResponseEntity> findByInResponseToAndStatus(String inResponseTo, String status);
}

View File

@@ -2,9 +2,15 @@ package net.gepafin.tendermanagement.repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import net.gepafin.tendermanagement.entities.UserCompanyDelegationEntity;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
public interface UserCompanyDelegationRepository extends JpaRepository<UserCompanyDelegationEntity, Long> {
UserCompanyDelegationEntity findByUserIdAndCompanyIdAndStatus(Long userId, Long companyId, String status);
@Query("SELECT d FROM UserCompanyDelegationEntity d where d.status = :status")
List<UserCompanyDelegationEntity> findAllByStatus(@Param("status") String status);
}

View File

@@ -1,7 +1,6 @@
package net.gepafin.tendermanagement.repositories;
import net.gepafin.tendermanagement.entities.UserEntity;
import net.gepafin.tendermanagement.model.response.UserResponseBean;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@@ -11,17 +10,19 @@ import java.util.Optional;
@Repository
public interface UserRepository extends JpaRepository<UserEntity, Long> {
Optional<UserEntity> findByEmailIgnoreCase(String email);
boolean existsByEmailIgnoreCase(String email);
UserEntity findByEmail(String email);
Optional<UserEntity> findByBeneficiaryCodiceFiscale(String codiceFiscale);
boolean existsByBeneficiaryCodiceFiscale(String codiceFiscale);
UserEntity findByBeneficiaryId(Long beneficiaryId);
Long countByStatusAndRoleEntity_RoleType(String status, String roleName);
List<UserEntity> findByRoleEntityId(Long roleId);
Optional<UserEntity> findByEmailIgnoreCaseAndHubUniqueUuid(String email, String hubUuid);
boolean existsByEmailIgnoreCaseAndHubUniqueUuid(String email, String hubUuid);
List<UserEntity> findByRoleEntityIdAndHubId(Long roleId, Long hubId);
List<UserEntity> findByHubId(Long hubId);
Long countByStatusAndRoleEntityRoleTypeAndHubId(String status, String roleName, Long hubId);
Optional<UserEntity> findByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
boolean existsByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
}

View File

@@ -14,10 +14,8 @@ public interface UserWithCompanyRepository extends JpaRepository<UserWithCompany
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);