Merge branch 'dashboard' of https://github.com/Kitzanos/GEPAFIN-BE into dashboard

This commit is contained in:
nisha
2024-10-14 17:16:57 +05:30
7 changed files with 37 additions and 25 deletions

View File

@@ -1,5 +1,6 @@
package net.gepafin.tendermanagement.dao;
import net.gepafin.tendermanagement.entities.CompanyEntity;
import net.gepafin.tendermanagement.entities.UserEntity;
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
import net.gepafin.tendermanagement.enums.CallStatusEnum;
@@ -75,16 +76,18 @@ public class DashboardDao {
return widget1;
}
public BeneficiaryWidgetResponseBean getDashboardWidgetForBeneficiary(UserEntity userEntity) {
BeneficiaryWidgetResponseBean beneficiaryWidgetResponseBean = new BeneficiaryWidgetResponseBean();
Long activeCalls = callRepository.countByStatus(CallStatusEnum.PUBLISH.getValue());
if (Boolean.FALSE.equals(FieldValidator.isNullOrZero(activeCalls))) {
beneficiaryWidgetResponseBean.setActiveCalls(activeCalls);
}
Long activeApplication = applicationRepository.countSubmittedApplicationsByUserId(userEntity.getId());
if (Boolean.FALSE.equals(FieldValidator.isNullOrZero(activeApplication))) {
beneficiaryWidgetResponseBean.setActiveAppication(activeApplication);
}
return beneficiaryWidgetResponseBean;
}
public BeneficiaryWidgetResponseBean getDashboardWidgetForBeneficiary(UserEntity userEntity,
CompanyEntity company) {
BeneficiaryWidgetResponseBean beneficiaryWidgetResponseBean = BeneficiaryWidgetResponseBean.builder()
.numberOfApplications(0L).numberOfCalls(0L).numberOfIntegratedDocuments(0L).build();
Long activeCalls = callRepository.countByStatus(CallStatusEnum.PUBLISH.getValue());
if (activeCalls != null) {
beneficiaryWidgetResponseBean.setNumberOfCalls(activeCalls);
}
Long activeApplication = applicationRepository.countSubmittedApplicationsByUserId(userEntity.getId(), company.getId());
if (activeApplication != null) {
beneficiaryWidgetResponseBean.setNumberOfApplications(activeApplication);
}
return beneficiaryWidgetResponseBean;
}
}