25 lines
775 B
Java
25 lines
775 B
Java
package com.example.demo.dashboard;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
@Service
|
|
public class DashboardService {
|
|
private final DashboardRepository dashboardRepository;
|
|
|
|
public DashboardService(DashboardRepository dashboardRepository) {
|
|
this.dashboardRepository = dashboardRepository;
|
|
}
|
|
|
|
public DashboardOverviewResponse getOverview(long shopId) {
|
|
BigDecimal todaySales = dashboardRepository.sumTodaySalesOrders(shopId);
|
|
BigDecimal monthGrossProfit = dashboardRepository.sumMonthGrossProfitApprox(shopId);
|
|
BigDecimal stockTotalQty = dashboardRepository.sumTotalInventoryQty(shopId);
|
|
return new DashboardOverviewResponse(todaySales, monthGrossProfit, stockTotalQty);
|
|
}
|
|
}
|
|
|
|
|
|
|