Subversion Repositories SmartDukaan

Rev

Rev 37487 | Rev 37505 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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
 
33997 ranu 66
    List<RbmTargetAndAchievementsModel> getRbmTargetsAndAchievemnts(LocalDate startDate, LocalDate endDate);
67
 
33917 ranu 68
    List<RbmArrViewModel> getRbmTodayArr(LocalDate todayDate) throws Exception;
69
 
70
    List<RbmArrViewModel> getRbmTodayArr() throws Exception;
71
 
33926 ranu 72
    void setMovementWiseRbmTargets();
73
 
33985 ranu 74
    void setMovementWiseRbmAchievement();
75
 
34055 ranu 76
    List<Sold15daysOldAgingModel> getAgingSale(LocalDate startDate, LocalDate endDate);
77
 
78
    List<Our15DaysOldAgingStock> our15DaysAgingStock();
79
 
36334 ranu 80
    List<WarehouseAgingStockModel> getWarehouseWiseAgingStock();
81
 
34103 ranu 82
    List<RbmBilledFofoIdsModel> getDateWiseBilledFofoIdByRbm(LocalDate startDate, LocalDate endDate);
83
 
35453 amit 84
    List<RbmWeeklyBillingModel> getWeeklyBillingDataForMonth(LocalDate monthStart, LocalDate monthEnd);
85
 
34641 ranu 86
    double calculateFofoIdTodayTarget(int fofoId, double secondryMtd, LocalDate date);
34880 ranu 87
 
88
    long getRemainingDaysInMonth(LocalDate date);
35631 ranu 89
 
90
    List<RbmCallTargetModel> getRbmCallTargetModels() throws Exception;
91
 
36234 ranu 92
    List<RbmCallTargetModel> getRbmCallTargetModels(LocalDate queryDate) throws Exception;
93
 
35631 ranu 94
    List<OutOfSequenceDetailModel> getOutOfSequenceDetails(int authId);
35645 ranu 95
 
35672 ranu 96
    List<CalledPartnerDetailModel> getCalledPartnerDetails(int authId) throws ProfitMandiBusinessException;
35670 ranu 97
 
35730 ranu 98
    List<CalledPartnerDetailModel> getCalledPartnerDetails(int authId, LocalDate date) throws ProfitMandiBusinessException;
99
 
35645 ranu 100
    List<List<String>> getRbmCallTargetRawDataByAuthId(int authId) throws Exception;
35852 ranu 101
 
102
    List<List<String>> getAllCallDataByDate(LocalDate date) throws Exception;
36596 ranu 103
 
104
    List<List<String>> getAllRbmCallTargetRawData() throws Exception;
33917 ranu 105
}