| 33917 |
ranu |
1 |
package com.spice.profitmandi.service;
|
|
|
2 |
|
| 35672 |
ranu |
3 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 37497 |
ranu |
4 |
import com.spice.profitmandi.dao.entity.inventory.SalesTargets;
|
| 33917 |
ranu |
5 |
import com.spice.profitmandi.dao.model.*;
|
|
|
6 |
import org.springframework.stereotype.Service;
|
|
|
7 |
|
|
|
8 |
import java.time.LocalDate;
|
|
|
9 |
import java.util.List;
|
|
|
10 |
|
|
|
11 |
@Service
|
|
|
12 |
public interface RbmTargetService {
|
|
|
13 |
|
|
|
14 |
List<WarehouseRbmTargetModel> getWarehouseWiseRbmMonthlyTarget();
|
|
|
15 |
|
|
|
16 |
List<MTDAchievedTargetModel> getDateWiseAchievedTargetOfRbm(LocalDate startDate, LocalDate endDate);
|
|
|
17 |
|
|
|
18 |
List<WarehouseMobileStockByMovementModel> getWarehouseMobileStockByMovement();
|
|
|
19 |
|
| 33991 |
ranu |
20 |
List<SoldCatalogsReportModel> getCatalogSoldReport(LocalDate startDate, LocalDate endDate);
|
|
|
21 |
|
| 33917 |
ranu |
22 |
int getWorkingDaysCount(LocalDate startDate);
|
|
|
23 |
|
| 34055 |
ranu |
24 |
List<TodayAchievedMovementModel> getMovementWiseAchievementByDate(LocalDate startDate, LocalDate endDate);
|
| 33917 |
ranu |
25 |
|
| 37442 |
ranu |
26 |
List<RbmBrandSoldModel> getBrandsSoldByRbm(int authId, int warehouseId, LocalDate startDate, LocalDate endDate);
|
|
|
27 |
|
| 37460 |
ranu |
28 |
List<RbmBrandPartnerCountModel> getBrandPartnerCountByRbm(int authId, int warehouseId, LocalDate startDate, LocalDate endDate);
|
|
|
29 |
|
| 37487 |
ranu |
30 |
List<WarehouseBuyingByMovementModel> getWarehouseBuyingByMovement(int warehouseId, LocalDate startDate, LocalDate endDate);
|
|
|
31 |
|
| 37497 |
ranu |
32 |
/**
|
|
|
33 |
* Daily writer for Sales-hierarchy targets (mirrors {@link #setMovementWiseRbmTargets}).
|
|
|
34 |
* Reads today's persisted RBM snapshots from inventory.rbm_targets, rolls them up per
|
|
|
35 |
* (sales_auth_id × warehouse_id) for every active Sales person whose downline contains
|
|
|
36 |
* at least one RBM, and inserts one row per (sales, warehouse) into inventory.sales_targets.
|
|
|
37 |
* Intended to run once daily via the cron flag {@code pushSalesTargets},
|
|
|
38 |
* chained after {@code pushRbmTargets}.
|
|
|
39 |
*/
|
|
|
40 |
void setSalesTargets();
|
|
|
41 |
|
|
|
42 |
/**
|
|
|
43 |
* Same as {@link #setSalesTargets()} but for a specific date — reads that
|
|
|
44 |
* day's persisted RBM snapshots and writes Sales snapshots stamped to that
|
|
|
45 |
* day. Useful for backfilling missed cron runs or seeding local/staging
|
|
|
46 |
* data without needing today's RBM snapshot.
|
|
|
47 |
*/
|
|
|
48 |
void setSalesTargetsForDate(LocalDate date);
|
|
|
49 |
|
|
|
50 |
List<SalesTargets> getSalesTargetsByDates(LocalDate startDate, LocalDate endDate);
|
|
|
51 |
|
|
|
52 |
/**
|
|
|
53 |
* Historical snapshot writer for Sales-hierarchy achievement (mirrors
|
|
|
54 |
* {@link #setMovementWiseRbmAchievement}). Rolls up today's live order
|
|
|
55 |
* ACH into one row per (Sales person × warehouse) and persists to
|
|
|
56 |
* {@code inventory.sales_achievements} for later reconciliation.
|
|
|
57 |
* The DRR dashboard reads ACH LIVE from orders — this table is audit only.
|
|
|
58 |
*/
|
|
|
59 |
void setSalesAchievements();
|
|
|
60 |
|
|
|
61 |
/**
|
|
|
62 |
* Dated variant of {@link #setSalesAchievements()} for backfill.
|
|
|
63 |
*/
|
|
|
64 |
void setSalesAchievementsForDate(LocalDate date);
|
|
|
65 |
|
| 37505 |
ranu |
66 |
/**
|
|
|
67 |
* Per-(auth × warehouse) live achievement for a specific Sales-hierarchy role
|
|
|
68 |
* (category 4, escalation L1..L6) in a date range. Direct query — no RBM roll-up.
|
|
|
69 |
*/
|
|
|
70 |
List<SalesHierarchyAchievedByMovementModel> getSalesAchievementByRole(
|
|
|
71 |
int categoryId, String escalationType, LocalDate startDate, LocalDate endDate);
|
|
|
72 |
|
|
|
73 |
/**
|
|
|
74 |
* Monthly target per (auth × warehouse) for a specific Sales-hierarchy role,
|
|
|
75 |
* looked up for the month of {@code refDate}. Sum of
|
|
|
76 |
* {@code fofo.monthly_target.purchase} across each Sales person's assigned partners.
|
|
|
77 |
*/
|
|
|
78 |
List<SalesHierarchyMonthlyTargetModel> getSalesMonthlyTargetByRole(
|
|
|
79 |
int categoryId, String escalationType, LocalDate refDate);
|
|
|
80 |
|
| 33997 |
ranu |
81 |
List<RbmTargetAndAchievementsModel> getRbmTargetsAndAchievemnts(LocalDate startDate, LocalDate endDate);
|
|
|
82 |
|
| 33917 |
ranu |
83 |
List<RbmArrViewModel> getRbmTodayArr(LocalDate todayDate) throws Exception;
|
|
|
84 |
|
|
|
85 |
List<RbmArrViewModel> getRbmTodayArr() throws Exception;
|
|
|
86 |
|
| 33926 |
ranu |
87 |
void setMovementWiseRbmTargets();
|
|
|
88 |
|
| 33985 |
ranu |
89 |
void setMovementWiseRbmAchievement();
|
|
|
90 |
|
| 34055 |
ranu |
91 |
List<Sold15daysOldAgingModel> getAgingSale(LocalDate startDate, LocalDate endDate);
|
|
|
92 |
|
|
|
93 |
List<Our15DaysOldAgingStock> our15DaysAgingStock();
|
|
|
94 |
|
| 36334 |
ranu |
95 |
List<WarehouseAgingStockModel> getWarehouseWiseAgingStock();
|
|
|
96 |
|
| 34103 |
ranu |
97 |
List<RbmBilledFofoIdsModel> getDateWiseBilledFofoIdByRbm(LocalDate startDate, LocalDate endDate);
|
|
|
98 |
|
| 35453 |
amit |
99 |
List<RbmWeeklyBillingModel> getWeeklyBillingDataForMonth(LocalDate monthStart, LocalDate monthEnd);
|
|
|
100 |
|
| 34641 |
ranu |
101 |
double calculateFofoIdTodayTarget(int fofoId, double secondryMtd, LocalDate date);
|
| 34880 |
ranu |
102 |
|
|
|
103 |
long getRemainingDaysInMonth(LocalDate date);
|
| 35631 |
ranu |
104 |
|
|
|
105 |
List<RbmCallTargetModel> getRbmCallTargetModels() throws Exception;
|
|
|
106 |
|
| 36234 |
ranu |
107 |
List<RbmCallTargetModel> getRbmCallTargetModels(LocalDate queryDate) throws Exception;
|
|
|
108 |
|
| 35631 |
ranu |
109 |
List<OutOfSequenceDetailModel> getOutOfSequenceDetails(int authId);
|
| 35645 |
ranu |
110 |
|
| 35672 |
ranu |
111 |
List<CalledPartnerDetailModel> getCalledPartnerDetails(int authId) throws ProfitMandiBusinessException;
|
| 35670 |
ranu |
112 |
|
| 35730 |
ranu |
113 |
List<CalledPartnerDetailModel> getCalledPartnerDetails(int authId, LocalDate date) throws ProfitMandiBusinessException;
|
|
|
114 |
|
| 35645 |
ranu |
115 |
List<List<String>> getRbmCallTargetRawDataByAuthId(int authId) throws Exception;
|
| 35852 |
ranu |
116 |
|
|
|
117 |
List<List<String>> getAllCallDataByDate(LocalDate date) throws Exception;
|
| 36596 |
ranu |
118 |
|
|
|
119 |
List<List<String>> getAllRbmCallTargetRawData() throws Exception;
|
| 33917 |
ranu |
120 |
}
|