Done ticket GEPAFINBE-153
This commit is contained in:
@@ -405,5 +405,18 @@ public class GepafinConstant {
|
||||
public static final String ASSIGNED_APPLICATION_STATUS_UPDATED_SUCCESSFULLY = "assigned.application.status.updated.successfully";
|
||||
|
||||
public static final String REQUIRED_REQUESTED_AMOUNT_MSG = "validation.required.requested.amount";
|
||||
|
||||
|
||||
public static final String REQUESTED_VS_APPROVED_AMOUNTS="requestedVsApprovedAmount";
|
||||
public static final String MONTH="month";
|
||||
public static final String TOTAL_REQUESTED="totalRequested";
|
||||
public static final String TOTAL_APPROVED="totalApproved";
|
||||
|
||||
public static final String NUMBER_OF_APPLICATION="numberOfApplication";
|
||||
|
||||
|
||||
public static final String COMPANY_ID_NOT_NULL_MSG = "company.id.not.null";
|
||||
public static final String USER_WITH_COMPANY="userWithCompany";
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1404,6 +1404,9 @@ public class ApplicationDao {
|
||||
public PageableResponseBean<List<ApplicationResponse>> getAllApplicationByPagination(UserEntity userEntity, Long callId, Long companyId, ApplicationPageableRequestBean applicationPageableRequestBean) {
|
||||
Integer pageNo = null;
|
||||
Integer pageLimit = null;
|
||||
|
||||
UserWithCompanyEntity userWithCompany= userWithCompanyRepository.findByUserIdAndCompanyIdAndIsDeletedFalse(userEntity.getId(), companyId).orElse(null);
|
||||
|
||||
if (applicationPageableRequestBean.getGlobalFilters() != null) {
|
||||
pageNo = applicationPageableRequestBean.getGlobalFilters().getPage();
|
||||
pageLimit = applicationPageableRequestBean.getGlobalFilters().getLimit();
|
||||
@@ -1414,7 +1417,7 @@ public class ApplicationDao {
|
||||
if (pageNo == null || pageNo <= 0) {
|
||||
pageNo = GepafinConstant.DEFAULT_PAGE;
|
||||
}
|
||||
Specification<ApplicationEntity> spec = search(callId, companyId, applicationPageableRequestBean, userEntity);
|
||||
Specification<ApplicationEntity> spec = search(callId,companyId, userWithCompany.getId(), applicationPageableRequestBean, userEntity);
|
||||
Page<ApplicationEntity> entityPage = applicationRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
|
||||
// Prepare the response
|
||||
|
||||
@@ -1437,10 +1440,10 @@ public class ApplicationDao {
|
||||
return pageableResponseBean;
|
||||
}
|
||||
|
||||
public Specification<ApplicationEntity> search(Long callId, Long companyId, ApplicationPageableRequestBean applicationPageableRequestBean, UserEntity userEntity) {
|
||||
public Specification<ApplicationEntity> search(Long callId, Long companyId, Long userWithCompanyId, ApplicationPageableRequestBean applicationPageableRequestBean, UserEntity userEntity) {
|
||||
return (root, query, criteriaBuilder) -> {
|
||||
|
||||
List<Predicate> predicates = getPredicates(applicationPageableRequestBean, criteriaBuilder, root, callId, companyId, userEntity);
|
||||
List<Predicate> predicates = getPredicates(applicationPageableRequestBean, criteriaBuilder, root, callId,companyId, userWithCompanyId, userEntity);
|
||||
SortBy sortBy = new SortBy(GepafinConstant.CREATED_DATE, true);
|
||||
|
||||
if (applicationPageableRequestBean.getGlobalFilters() != null
|
||||
@@ -1464,13 +1467,15 @@ public class ApplicationDao {
|
||||
|
||||
|
||||
private List<Predicate> getPredicates(ApplicationPageableRequestBean applicationPageableRequestBean,
|
||||
CriteriaBuilder criteriaBuilder, Root<ApplicationEntity> root, Long callId, Long companyId, UserEntity userEntity) {
|
||||
CriteriaBuilder criteriaBuilder, Root<ApplicationEntity> root, Long callId,Long companyId, Long userWithCompanyId, UserEntity userEntity) {
|
||||
|
||||
Integer year = null;
|
||||
String search = null;
|
||||
Integer daysRange = null;
|
||||
if (applicationPageableRequestBean.getGlobalFilters() != null) {
|
||||
year = applicationPageableRequestBean.getGlobalFilters().getYear();
|
||||
search = applicationPageableRequestBean.getGlobalFilters().getSearch();
|
||||
daysRange = applicationPageableRequestBean.getDaysRange();
|
||||
}
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
|
||||
@@ -1512,16 +1517,24 @@ public class ApplicationDao {
|
||||
}
|
||||
|
||||
// Optional companyId filter
|
||||
if (userWithCompanyId != null) {
|
||||
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.USER_WITH_COMPANY).get(GepafinConstant.ID), userWithCompanyId));
|
||||
}
|
||||
if (companyId != null) {
|
||||
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.COMPANY_ID), companyId));
|
||||
}
|
||||
|
||||
if (daysRange != null && daysRange >= 0) {
|
||||
LocalDateTime today = LocalDateTime.now();
|
||||
LocalDateTime pastDate = today.minusDays(daysRange);
|
||||
predicates.add(criteriaBuilder.between(root.get(GepafinConstant.CREATED_DATE), pastDate, today));
|
||||
}
|
||||
predicates.add(criteriaBuilder.isFalse(root.get(GepafinConstant.IS_DELETED)));
|
||||
|
||||
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.HUB_ID), userEntity.getHub().getId()));
|
||||
|
||||
|
||||
return predicates;
|
||||
|
||||
}
|
||||
public void checkCallEndDate(CallEntity call) {
|
||||
LocalDateTime now = DateTimeUtil.DateServerToUTC(LocalDateTime.now());
|
||||
|
||||
@@ -193,7 +193,7 @@ public class DashboardDao {
|
||||
|
||||
return stats;
|
||||
}
|
||||
// public Page<UserActionEntity> getUserAction(UserEntity requestedUserEntity){
|
||||
// public Page<UserActionEntity> getUserAction(UserEntity requestedUserEntity){
|
||||
// Pageable pageable = PageRequest.of(0, 20); // Get the first 20 records
|
||||
// List<String> roles=List.of(RoleStatusEnum.ROLE_PRE_INSTRUCTOR.getValue(),RoleStatusEnum.ROLE_GEPAFIN_OPERATOR.getValue(),RoleStatusEnum.ROLE_INSTRUCTOR_MANAGER.getValue());
|
||||
// Page<UserActionEntity> userActionEntities=userActionsRepository.findActionsByRoleNamesAndHubId(roles,requestedUserEntity.getHub().getId(),pageable);
|
||||
@@ -403,7 +403,107 @@ public class DashboardDao {
|
||||
return response;
|
||||
}
|
||||
|
||||
public static List<String> getStatusList() {
|
||||
return List.of(
|
||||
ApplicationStatusTypeEnum.SUBMIT.getValue(),
|
||||
ApplicationStatusTypeEnum.EVALUATION.getValue(),
|
||||
ApplicationStatusTypeEnum.APPROVED.getValue(),
|
||||
ApplicationStatusTypeEnum.REJECTED.getValue(),
|
||||
ApplicationStatusTypeEnum.SOCCORSO.getValue(),
|
||||
ApplicationStatusTypeEnum.APPOINTMENT.getValue(),
|
||||
ApplicationStatusTypeEnum.NDG.getValue(),
|
||||
ApplicationStatusTypeEnum.ADMISSIBLE.getValue()
|
||||
);
|
||||
}
|
||||
public BeneficiaryStatisticsResponseBean getStatisticsPageForBeneficiary(UserEntity userEntity, CompanyEntity company) {
|
||||
BeneficiaryStatisticsResponseBean widgetResponseBean = initializeBeneficiaryStatisticsBean();
|
||||
UserWithCompanyEntity userWithCompanyEntity = companyService.getUserWithCompany(userEntity.getId(), company.getId());
|
||||
Long hubId = userEntity.getHub().getId();
|
||||
List<String> statusList = getStatusList();
|
||||
Long submittedApplication = applicationRepository.countSubmittedApplicationsByHubIdAndUserId(hubId, userEntity.getId(), userWithCompanyEntity.getId(),statusList);
|
||||
Long approvedApplication = getApplicationCountByStatus(hubId, userEntity.getId(), userWithCompanyEntity.getId(), ApplicationStatusTypeEnum.APPROVED);
|
||||
BigDecimal successRate = getSuccessRate(hubId, userEntity.getId(), userWithCompanyEntity.getId());
|
||||
BigDecimal totalAmountRequested = applicationRepository.sumAmountRequestedByHubIdAndUserId(hubId, userEntity.getId(), userWithCompanyEntity.getId());
|
||||
|
||||
updateApplicationWidget(widgetResponseBean.getApplicationWidget(), submittedApplication, approvedApplication, successRate,totalAmountRequested);
|
||||
|
||||
Map<String, Object> widgetBars = getApplicationStatistics(userEntity,userWithCompanyEntity.getId());
|
||||
widgetResponseBean.setApplicationWidgetBars(widgetBars);
|
||||
return widgetResponseBean;
|
||||
}
|
||||
private BeneficiaryStatisticsResponseBean initializeBeneficiaryStatisticsBean() {
|
||||
return BeneficiaryStatisticsResponseBean.builder()
|
||||
.applicationWidget(ApplicationWidget.builder()
|
||||
.submittedApplication(0L)
|
||||
.approvedApplication(0L)
|
||||
.successRate(BigDecimal.ZERO)
|
||||
.totalAmountFinanced(BigDecimal.ZERO)
|
||||
.build())
|
||||
.build();
|
||||
}
|
||||
private Long getApplicationCountByStatus(Long hubId, Long userId, Long userWithCompanyId, ApplicationStatusTypeEnum status) {
|
||||
return applicationRepository.countSubmittedApplicationsByHubIdAndUserIdAndStatus(hubId, userId, userWithCompanyId, status.getValue());
|
||||
}
|
||||
private BigDecimal getSuccessRate(Long hubId, Long userId, Long userWithCompanyId) {
|
||||
return applicationRepository.findSuccessRateByHubIdAndUserIdAndUserWithCompanyId(hubId, userId, userWithCompanyId);
|
||||
}
|
||||
private void updateApplicationWidget(ApplicationWidget applicationWidget, Long submittedApplication, Long approvedApplication, BigDecimal successRate, BigDecimal totalAmountRequested) {
|
||||
applicationWidget.setSubmittedApplication(submittedApplication != null ? submittedApplication : 0L);
|
||||
applicationWidget.setApprovedApplication(approvedApplication != null ? approvedApplication : 0L);
|
||||
applicationWidget.setSuccessRate(successRate != null ? successRate : BigDecimal.ZERO);
|
||||
applicationWidget.setTotalAmountFinanced(totalAmountRequested != null ? totalAmountRequested : BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
public Map<String, Object> getApplicationStatistics(UserEntity requestedUser,Long userWithCompanyId) {
|
||||
Map<String, Object> stats = new HashMap<>();
|
||||
|
||||
Map<String, Long> statusData = new HashMap<>();
|
||||
for (ApplicationStatusTypeEnum status : ApplicationStatusTypeEnum.values()) {
|
||||
statusData.put(status.name(), 0L);
|
||||
}
|
||||
|
||||
// Get applications per status
|
||||
List<Object[]> applicationsByStatus = applicationRepository.findApplicationsByStatusAndUserIdAndUserWithCompanyId(
|
||||
requestedUser.getHub().getId(),
|
||||
requestedUser.getId(),
|
||||
userWithCompanyId
|
||||
);
|
||||
|
||||
applicationsByStatus.forEach(result -> {
|
||||
String status = (String) result[0];
|
||||
Long count = (Long) result[1];
|
||||
statusData.put(status, count);
|
||||
});
|
||||
|
||||
List<Map<String, Object>> statusList = statusData.entrySet().stream().map(entry -> {
|
||||
Map<String, Object> statusMap = new HashMap<>();
|
||||
statusMap.put(GepafinConstant.STATUS, entry.getKey());
|
||||
statusMap.put(GepafinConstant.NUMBER_OF_APPLICATION, entry.getValue());
|
||||
return statusMap;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
stats.put(GepafinConstant.APPLICATION_PER_STATUS, statusList);
|
||||
|
||||
|
||||
// Requested VS Approved Amounts
|
||||
List<Object[]> requestedVsApprovedAmounts = applicationRepository.findRequestedVsApprovedAmountsPerMonth(
|
||||
requestedUser.getHub().getId(),
|
||||
requestedUser.getId(),
|
||||
userWithCompanyId
|
||||
);
|
||||
|
||||
stats.put(GepafinConstant.REQUESTED_VS_APPROVED_AMOUNTS, requestedVsApprovedAmounts.stream().map(result -> {
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put(GepafinConstant.MONTH, result[0]);
|
||||
data.put(GepafinConstant.TOTAL_REQUESTED, result[1]);
|
||||
data.put(GepafinConstant.TOTAL_APPROVED, result[2]);
|
||||
return data;
|
||||
}).toList());
|
||||
|
||||
|
||||
|
||||
|
||||
return stats;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -145,6 +145,7 @@ public enum UserActionContextEnum {
|
||||
GET_APPLICATION_DETAILS("GET_APPLICATION_DETAILS"),
|
||||
GET_AMENDMENT_DETAILS("GET_AMENDMENT_DETAILS"),
|
||||
GET_APPLICATION_DETAILS_FOR_EVALUATION("GET_APPLICATION_DETAILS_FOR_EVALUATION"),
|
||||
GET_STATISTICS_PAGE_FOR_BENEFICIARY("GET_STATISTICS_PAGE_FOR_BENEFICIARY"),
|
||||
|
||||
/** Evaluation criteria action context **/
|
||||
GET_EVALUATION_CRITERIA("GET_EVALUATION_CRITERIA"),
|
||||
|
||||
@@ -10,5 +10,7 @@ public class ApplicationPageableRequestBean {
|
||||
|
||||
private GlobalFilters globalFilters;
|
||||
|
||||
private Integer daysRange;
|
||||
|
||||
private List<ApplicationStatusTypeEnum> status;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public class ApplicationWidget {
|
||||
|
||||
private Long submittedApplication;
|
||||
|
||||
private BigDecimal successRate;
|
||||
|
||||
private Long approvedApplication;
|
||||
|
||||
private BigDecimal totalAmountFinanced;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public class BeneficiaryStatisticsResponseBean {
|
||||
|
||||
|
||||
private ApplicationWidget applicationWidget;
|
||||
|
||||
private Map<String, Object> applicationWidgetBars;
|
||||
}
|
||||
@@ -92,5 +92,68 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
|
||||
@Query("SELECT a.id FROM ApplicationEntity a WHERE a.hubId = :hubId AND a.isDeleted = false")
|
||||
List<Long> findApplicationIdsByHubId(@Param("hubId") Long hubId);
|
||||
|
||||
@Query("SELECT CASE WHEN COUNT(CASE WHEN a.submissionDate IS NOT NULL THEN 1 ELSE NULL END) > 0 THEN " +
|
||||
"CAST((SUM(CASE WHEN a.status = 'APPROVED' THEN 1 ELSE 0 END) * 100.0) / " +
|
||||
"COUNT(CASE WHEN a.submissionDate IS NOT NULL THEN 1 ELSE NULL END) AS BigDecimal) " +
|
||||
"ELSE CAST(0 AS BigDecimal) END " +
|
||||
"FROM ApplicationEntity a " +
|
||||
"WHERE a.hubId = :hubId AND a.userId = :userId AND a.userWithCompany.id = :userWithCompanyId " +
|
||||
"AND a.isDeleted = false")
|
||||
BigDecimal findSuccessRateByHubIdAndUserIdAndUserWithCompanyId(
|
||||
@Param("hubId") Long hubId,
|
||||
@Param("userId") Long userId,
|
||||
@Param("userWithCompanyId") Long userWithCompanyId);
|
||||
|
||||
|
||||
@Query("SELECT a.status, COUNT(a.id) FROM ApplicationEntity a WHERE a.isDeleted = false AND a.userId = :userId AND a.userWithCompany.id = :userWithCompanyId AND a.call.hub.id = :hubId GROUP BY a.status")
|
||||
List<Object[]> findApplicationsByStatusAndUserIdAndUserWithCompanyId(@Param("hubId") Long hubId,
|
||||
@Param("userId") Long userId,
|
||||
@Param("userWithCompanyId") Long userWithCompanyId);
|
||||
|
||||
@Query("""
|
||||
SELECT TO_CHAR(a.submissionDate, 'Mon') AS month,
|
||||
SUM(a.amountRequested) AS totalRequested,
|
||||
SUM(a.amountAccepted) AS totalApproved
|
||||
FROM ApplicationEntity a
|
||||
WHERE a.isDeleted = false
|
||||
AND a.status = 'APPROVED'
|
||||
AND a.call.hub.id = :hubId
|
||||
AND a.userId = :userId
|
||||
AND a.userWithCompany.id = :userWithCompanyId
|
||||
GROUP BY TO_CHAR(a.submissionDate, 'Mon'), EXTRACT(YEAR FROM a.submissionDate), EXTRACT(MONTH FROM a.submissionDate)
|
||||
ORDER BY EXTRACT(YEAR FROM a.submissionDate), EXTRACT(MONTH FROM a.submissionDate)
|
||||
""")
|
||||
List<Object[]> findRequestedVsApprovedAmountsPerMonth(
|
||||
@Param("hubId") Long hubId,
|
||||
@Param("userId") Long userId,
|
||||
@Param("userWithCompanyId") Long userWithCompanyId
|
||||
);
|
||||
|
||||
@Query("SELECT COUNT(a) FROM ApplicationEntity a " +
|
||||
"WHERE a.hubId = :hubId " +
|
||||
"AND a.userId = :userId " +
|
||||
"AND a.userWithCompany.id = :userWithCompanyId " +
|
||||
"AND a.isDeleted = false " +
|
||||
"AND a.status IN :statusList " +
|
||||
"AND a.submissionDate IS NOT NULL")
|
||||
Long countSubmittedApplicationsByHubIdAndUserId(
|
||||
@Param("hubId") Long hubId,
|
||||
@Param("userId") Long userId,
|
||||
@Param("userWithCompanyId") Long userWithCompanyId,
|
||||
@Param("statusList") List<String> statusList
|
||||
);
|
||||
|
||||
@Query("SELECT COUNT(a) FROM ApplicationEntity a " +
|
||||
"WHERE a.hubId = :hubId " +
|
||||
"AND a.userId = :userId " +
|
||||
"AND a.userWithCompany.id = :userWithCompanyId " +
|
||||
"AND a.status = :status " +
|
||||
"AND a.isDeleted = false")
|
||||
Long countSubmittedApplicationsByHubIdAndUserIdAndStatus(
|
||||
@Param("hubId") Long hubId,
|
||||
@Param("userId") Long userId,
|
||||
@Param("userWithCompanyId") Long userWithCompanyId,
|
||||
@Param("status") String status);
|
||||
@Query("SELECT SUM(a.amountAccepted) FROM ApplicationEntity a WHERE a.hubId = :hubId AND a.userId = :userId AND a.status = 'APPROVED' AND a.userWithCompany.id = :userWithCompanyId AND a.isDeleted = false")
|
||||
BigDecimal sumAmountRequestedByHubIdAndUserId(@Param("hubId") Long hubId, @Param("userId") Long userId, @Param("userWithCompanyId") Long userWithCompanyId);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
package net.gepafin.tendermanagement.service;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.model.response.AmendmentWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.BeneficiaryWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.SuperAdminWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.*;
|
||||
|
||||
public interface DashboardService {
|
||||
|
||||
@@ -16,4 +12,6 @@ public interface DashboardService {
|
||||
public AmendmentWidgetResponseBean getAmendmentDetails(HttpServletRequest request);
|
||||
public AssignedApplicationWidgetResponseBean getApplicationDetailsForEvaluation(HttpServletRequest request);
|
||||
|
||||
public BeneficiaryStatisticsResponseBean getStatisticsPageForBeneficiary(HttpServletRequest request,Long companyId);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,11 +4,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.dao.DashboardDao;
|
||||
import net.gepafin.tendermanagement.entities.CompanyEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import net.gepafin.tendermanagement.model.response.AmendmentWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.BeneficiaryWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.SuperAdminWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.*;
|
||||
import net.gepafin.tendermanagement.service.DashboardService;
|
||||
import net.gepafin.tendermanagement.util.Validator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -52,4 +48,11 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
UserEntity userEntity = validator.validateUser(request);
|
||||
return dashboardDao.getApplicationDetailsForEvaluation(userEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeneficiaryStatisticsResponseBean getStatisticsPageForBeneficiary(HttpServletRequest request, Long companyId) {
|
||||
UserEntity userEntity = validator.validateUser(request);
|
||||
CompanyEntity company = validator.validateUserWithCompany(request, companyId);
|
||||
return dashboardDao.getStatisticsPageForBeneficiary(userEntity,company);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,7 @@ import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.model.response.AmendmentWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.BeneficiaryWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.SuperAdminWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.*;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -90,5 +86,17 @@ public interface DashboardApi {
|
||||
produces = { "application/json" })
|
||||
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')|| hasRole('ROLE_PRE_INSTRUCTOR')")
|
||||
ResponseEntity<Response<AssignedApplicationWidgetResponseBean>> getApplicationDetailsForEvaluation(HttpServletRequest request);
|
||||
|
||||
@Operation(summary = "Api to get Statistics page for beneficiary",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@GetMapping(value = "/beneficiary/statistic/company/{companyId}",
|
||||
produces = { "application/json" })
|
||||
ResponseEntity<Response<BeneficiaryStatisticsResponseBean>> getStatisticsPageForBeneficiary(HttpServletRequest request,
|
||||
@Parameter(description = "The company id", required = true) @PathVariable(value = "companyId", required = true) Long companyId);
|
||||
}
|
||||
|
||||
@@ -6,11 +6,7 @@ import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||
import net.gepafin.tendermanagement.model.response.AmendmentWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.BeneficiaryWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.SuperAdminWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.*;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.service.DashboardService;
|
||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||
@@ -83,6 +79,15 @@ public class DashboardApiController implements DashboardApi {
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(widgetResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.DASHBOARD_WIDGET_FETCHED_SUCCESSFULLY)));
|
||||
}
|
||||
@Override
|
||||
public ResponseEntity<Response<BeneficiaryStatisticsResponseBean>> getStatisticsPageForBeneficiary(HttpServletRequest request, Long companyId) {
|
||||
|
||||
/** This code is responsible for creating user action logs for the "Get statistics page for beneficiary" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_STATISTICS_PAGE_FOR_BENEFICIARY).build());
|
||||
|
||||
BeneficiaryStatisticsResponseBean widgetResponseBean= dashboardService.getStatisticsPageForBeneficiary(request, companyId);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(widgetResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.DASHBOARD_WIDGET_FETCHED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -365,5 +365,5 @@ evaluation.form.not.found=Evaluation form not found.
|
||||
assigned.application.status.updated.successfully=Assigned application status updated successfully.
|
||||
|
||||
validation.required.requested.amount=The Requested Amount configuration should be mandatory.
|
||||
|
||||
company.id.not.null=Company ID cannot be null.
|
||||
|
||||
|
||||
@@ -356,6 +356,6 @@ evaluation.form.not.found=Modulo di valutazione non trovato.
|
||||
assigned.application.status.updated.successfully=Stato dell'applicazione assegnata aggiornato con successo.
|
||||
|
||||
validation.required.requested.amount=La configurazione dell'importo richiesto è obbligatoria.
|
||||
|
||||
company.id.not.null=L'ID dell'azienda non pu? essere nullo.
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user