9.16/1
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user