Resolved conflicts
This commit is contained in:
@@ -74,4 +74,10 @@ public interface ApplicationAmendmentRequestRepository extends JpaRepository<App
|
||||
" AND activeAmendment.isDeleted = false) ")
|
||||
Set<ApplicationEvaluationEntity> findEvaluationsWithoutActiveAmendmentsByIds(@Param("applicationEvaluationIds") Set<Long> applicationEvaluationIds);
|
||||
|
||||
@Query("SELECT a FROM ApplicationAmendmentRequestEntity a " +
|
||||
"WHERE a.isDeleted = false " +
|
||||
"AND a.status NOT IN ('CLOSE', 'EXPIRED') " +
|
||||
"AND a.endDate BETWEEN :startTime AND :endTime")
|
||||
List<ApplicationAmendmentRequestEntity> findExpiringBetween(LocalDateTime startTime, LocalDateTime endTime);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
||||
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.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -31,4 +34,33 @@ public interface ApplicationEvaluationRepository extends JpaRepository<Applicati
|
||||
|
||||
@Query("SELECT a FROM ApplicationEvaluationEntity a WHERE a.isDeleted = false AND a.endDate < :currentDate")
|
||||
List<ApplicationEvaluationEntity> findAllByIsDeletedFalseAndEndDateBefore(@Param("currentDate") LocalDateTime currentDate);
|
||||
|
||||
@Query("SELECT a FROM ApplicationEvaluationEntity a " +
|
||||
"WHERE a.isDeleted = false " +
|
||||
"AND a.status NOT IN ('CLOSE', 'EXPIRED') " +
|
||||
"AND a.endDate BETWEEN :startTime AND :endTime")
|
||||
List<ApplicationEvaluationEntity> findExpiringBetween(LocalDateTime startTime, LocalDateTime endTime);
|
||||
// @Query("SELECT AVG(DATEDIFF(DAY, e.startDate, e.endDate)) FROM ApplicationEvaluationEntity e WHERE e.applicationId IN :applicationIds AND e.startDate IS NOT NULL AND e.endDate IS NOT NULL AND e.isDeleted = false ")
|
||||
@Query("""
|
||||
SELECT AVG(e.activeDays)
|
||||
FROM ApplicationEvaluationEntity e
|
||||
WHERE e.applicationId IN :applicationIds
|
||||
AND e.activeDays IS NOT NULL
|
||||
AND e.isDeleted = false
|
||||
""")
|
||||
BigDecimal findAverageEvaluationTimeByApplicationIds(@Param("applicationIds") List<Long> applicationIds);
|
||||
@Query("""
|
||||
SELECT COUNT(e)
|
||||
FROM ApplicationEvaluationEntity e
|
||||
WHERE e.applicationId IN :applicationIds
|
||||
AND FUNCTION('DATE', e.endDate) BETWEEN :startDate AND :endDate
|
||||
AND e.isDeleted = false
|
||||
""")
|
||||
Long countDueApplicationsBetween(
|
||||
@Param("applicationIds") List<Long> applicationIds,
|
||||
@Param("startDate") LocalDate startDate,
|
||||
@Param("endDate") LocalDate endDate
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -24,7 +25,6 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
|
||||
|
||||
public Optional<ApplicationEntity> findByIdAndUserIdAndIsDeletedFalse(Long id,Long userId);
|
||||
|
||||
Optional<ApplicationEntity> findByUserIdAndUserWithCompanyIdAndCallIdAndIsDeletedFalse(Long userId, Long userWithCompanyId, Long callId);
|
||||
|
||||
public Optional<ApplicationEntity> findByIdAndUserIdAndCallIdAndIsDeletedFalse(Long applicationId, Long userId,
|
||||
Long callId);
|
||||
@@ -44,4 +44,37 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
|
||||
|
||||
@Query("SELECT a.call.id FROM ApplicationEntity a WHERE a.id = :id AND a.isDeleted = false")
|
||||
Long findCallIdById(@Param("id") Long id);
|
||||
|
||||
@Query("SELECT a.call.name, COUNT(a.id) FROM ApplicationEntity a WHERE a.isDeleted = false AND a.call.hub.id = :hubId GROUP BY a.call.name")
|
||||
List<Object[]> findApplicationsPerCallWithName(@Param("hubId") Long hubId);
|
||||
|
||||
// Count Applications by Status by Hub ID
|
||||
@Query("SELECT a.status, COUNT(a.id) FROM ApplicationEntity a WHERE a.isDeleted = false AND a.call.hub.id = :hubId GROUP BY a.status")
|
||||
List<Object[]> findApplicationsByStatus(@Param("hubId") Long hubId);
|
||||
|
||||
@Query("SELECT SUM(a.amountRequested) " +
|
||||
"FROM ApplicationEntity a " +
|
||||
"WHERE a.hubId = :hubId AND a.status IN ('SUBMIT', 'SOCCORSO', 'APPROVED', 'EVALUATION', 'APPOINTMENT', 'NDG', 'ADMISSIBLE','REJECTED')")
|
||||
BigDecimal findTotalAmountRequestedOfApplication(@Param("hubId") Long hubId);
|
||||
|
||||
@Query("SELECT SUM(a.amountAccepted) " +
|
||||
"FROM ApplicationEntity a " +
|
||||
"WHERE a.hubId = :hubId AND a.status = 'APPROVED'")
|
||||
BigDecimal findTotalAmountAcceptedOfApplication(@Param("hubId") Long hubId);
|
||||
|
||||
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.hubId = :hubId AND a.status = 'SUBMIT' AND a.isDeleted = false")
|
||||
public Long countApplicationsByHubId(@Param("hubId") Long hubId);
|
||||
|
||||
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.hubId = :hubId AND a.status = 'EVALUATION' AND a.isDeleted = false")
|
||||
Long countAssignedApplicationsByHubId(@Param("hubId") Long hubId);
|
||||
|
||||
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.hubId = :hubId AND a.status = 'APPROVED' AND a.isDeleted = false")
|
||||
Long countApprovedApplicationsByHubId(@Param("hubId") Long hubId);
|
||||
|
||||
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.hubId = :hubId AND a.status = 'SOCCORSO' AND a.isDeleted = false")
|
||||
Long countSoccorsoApplicationsByHubId(@Param("hubId") Long hubId);
|
||||
@Query("SELECT a.id FROM ApplicationEntity a WHERE a.hubId = :hubId AND a.isDeleted = false")
|
||||
List<Long> findApplicationIdsByHubId(@Param("hubId") Long hubId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -48,4 +48,10 @@ public interface CallRepository extends JpaRepository<CallEntity, Long>, JpaSpec
|
||||
BigDecimal findTotalAmountOfPublishedCallsAndHubId(@Param("hubId") Long hubId);
|
||||
@Query("SELECT c FROM CallEntity c WHERE c.id IN :ids AND c.status IN :status")
|
||||
List<CallEntity> findByIdInAndStatusIn(@Param("ids") List<Long> ids, @Param("status") List<String> status);
|
||||
|
||||
@Query("SELECT SUM(c.amount) FROM CallEntity c WHERE c.hub.id = :hubId AND c.status = 'PUBLISH'")
|
||||
BigDecimal findTotalAmountOfPublishedCalls(@Param("hubId") Long hubId);
|
||||
|
||||
List<CallEntity> findByIdIn(@Param("ids") List<Long> ids);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.ExpirationConfigEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface ExpirationConfigRepository extends JpaRepository<ExpirationConfigEntity, Long> {
|
||||
List<ExpirationConfigEntity> findByTypeAndIsDeletedFalse(String type);
|
||||
|
||||
}
|
||||
@@ -1,10 +1,18 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.UserActionEntity;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
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.util.List;
|
||||
|
||||
@Repository
|
||||
public interface UserActionsRepository extends JpaRepository<UserActionEntity, Long> {
|
||||
UserActionEntity findUserActionById(Long id);
|
||||
|
||||
UserActionEntity findUserActionByIdAndIsDeletedFalse(Long id);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
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.util.List;
|
||||
@@ -12,9 +14,16 @@ public interface UserRepository extends JpaRepository<UserEntity, Long> {
|
||||
|
||||
UserEntity findByBeneficiaryId(Long beneficiaryId);
|
||||
|
||||
Optional<UserEntity> findByEmailIgnoreCaseAndHubUniqueUuid(String email, String hubUuid);
|
||||
// Optional<UserEntity> findByEmailIgnoreCaseAndHubUniqueUuid(String email, String hubUuid);
|
||||
|
||||
boolean existsByEmailIgnoreCaseAndHubUniqueUuid(String email, String hubUuid);
|
||||
@Query("SELECT u FROM UserEntity u WHERE LOWER(u.email) = LOWER(:email) AND u.hub.uniqueUuid = :hubUuid AND u.roleEntity.roleType <> :roleType")
|
||||
Optional<UserEntity> findUserExcludingRoleType(
|
||||
@Param("email") String email,
|
||||
@Param("hubUuid") String hubUuid,
|
||||
@Param("roleType") String roleType
|
||||
);
|
||||
|
||||
// boolean existsByEmailIgnoreCaseAndHubUniqueUuid(String email, String hubUuid);
|
||||
|
||||
List<UserEntity> findByRoleEntityIdInAndHubId(List<Long> roleIds, Long hubId);
|
||||
|
||||
@@ -24,7 +33,28 @@ public interface UserRepository extends JpaRepository<UserEntity, Long> {
|
||||
|
||||
Optional<UserEntity> findByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
|
||||
|
||||
boolean existsByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
|
||||
// Boolean existsByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
|
||||
|
||||
@Query("SELECT COUNT(u) > 0 " +
|
||||
"FROM UserEntity u " +
|
||||
"WHERE LOWER(u.email) = LOWER(:email) " +
|
||||
"AND u.hub.uniqueUuid = :hubUuid " +
|
||||
"AND u.roleEntity.roleType <> :beneficiaryRoleType")
|
||||
Boolean existsByEmailIgnoreCaseForNonBeneficiaries(@Param("email") String email,
|
||||
@Param("hubUuid") String hubUuid,
|
||||
@Param("beneficiaryRoleType") String beneficiaryRoleType);
|
||||
|
||||
@Query("SELECT COUNT(u) > 0 " +
|
||||
"FROM UserEntity u " +
|
||||
"WHERE LOWER(u.email) = LOWER(:email) " +
|
||||
"AND u.hub.uniqueUuid = :hubUuid " +
|
||||
"AND u.roleEntity.roleType = :beneficiaryRoleType")
|
||||
Boolean existsByEmailIgnoreCaseForBeneficiaries(@Param("email") String email,
|
||||
@Param("hubUuid") String hubUuid,
|
||||
@Param("beneficiaryRoleType") String beneficiaryRoleType);
|
||||
|
||||
|
||||
boolean existsByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
|
||||
|
||||
List<UserEntity> findByRoleEntity_RoleTypeAndHubId(String roleType, Long hubId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user