Subversion Repositories SmartDukaan

Rev

Rev 36633 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
27877 amit.gupta 1
package com.spice.profitmandi.service.offers;
2
 
30274 amit.gupta 3
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
4
import com.spice.profitmandi.dao.entity.catalog.Offer;
31205 amit.gupta 5
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
31903 amit.gupta 6
import com.spice.profitmandi.dao.model.AmountModel;
30274 amit.gupta 7
import com.spice.profitmandi.dao.model.CreateOfferRequest;
35394 amit 8
import com.spice.profitmandi.dao.model.QtyAmountModel;
33999 tejus.loha 9
import org.apache.commons.io.output.ByteArrayOutputStream;
30274 amit.gupta 10
import org.springframework.stereotype.Service;
11
 
29684 amit.gupta 12
import java.io.InputStream;
27877 amit.gupta 13
import java.time.LocalDate;
14
import java.time.YearMonth;
15
import java.util.List;
29785 amit.gupta 16
import java.util.Map;
36521 amit 17
import java.util.Set;
36305 amit 18
import java.util.LinkedHashMap;
27877 amit.gupta 19
 
20
@Service
21
public interface OfferService {
36049 amit 22
	void evictOfferCaches(int offerId);
23
 
36521 amit 24
	void evictOfferDefinitionCache(int offerId);
25
 
36702 amit 26
	/**
27
	 * Evicts month-level offer caches: monthOfferIds (admin listing) and
28
	 * catalog.published_yearmonth (partner-facing published offers).
29
	 * Use when offers are created/deleted and the month listing needs refresh.
30
	 */
31
	void evictMonthCaches(YearMonth yearMonth);
32
 
36521 amit 33
	Set<Integer> getMonthOfferIds(YearMonth yearMonth) throws ProfitMandiBusinessException;
34
 
27877 amit.gupta 35
	void addOfferService(CreateOfferRequest createOfferRequest) throws ProfitMandiBusinessException;
36
 
33247 ranu 37
    List<CreateOfferRequest> getPublishedOffers(int fofoId, YearMonth yearMonth) throws ProfitMandiBusinessException;
27877 amit.gupta 38
 
36049 amit 39
    List<CreateOfferRequest> getPublishedOffersCached(int fofoId, YearMonth yearMonth) throws ProfitMandiBusinessException;
40
 
33247 ranu 41
    Map<Integer, CreateOfferRequest> getAllOffers(YearMonth yearMonth) throws ProfitMandiBusinessException;
27877 amit.gupta 42
 
36049 amit 43
    CreateOfferRequest getOfferDefinition(int offerId) throws ProfitMandiBusinessException;
44
 
33247 ranu 45
    CreateOfferRequest getOffer(int fofoId, int offerId) throws ProfitMandiBusinessException;
27877 amit.gupta 46
 
33247 ranu 47
    List<CreateOfferRequest> getPublishedOffers(LocalDate date, int fofoId, int catalogId) throws ProfitMandiBusinessException;
29684 amit.gupta 48
 
31903 amit.gupta 49
    Map<Integer, CreateOfferRequest> getPublishedOffers(LocalDate date, int fofoId, String brand);
29785 amit.gupta 50
 
36374 ranu 51
    List<CreateOfferRequest> getActiveOffers(int fofoId) throws ProfitMandiBusinessException;
52
 
31903 amit.gupta 53
    void createOffers(InputStream inputStream) throws Exception;
29785 amit.gupta 54
 
33247 ranu 55
    Map<Integer, Map<Integer, Long>> getSlabPayoutMap(CreateOfferRequest createOfferRequest) throws ProfitMandiBusinessException;
29902 amit.gupta 56
 
31205 amit.gupta 57
 
31903 amit.gupta 58
    Map<Integer, Map<Integer, AmountModel>> getSlabPayoutMapNew(CreateOfferRequest createOfferRequest);
59
 
33247 ranu 60
    CreateOfferRequest getCreateOfferRequest(Offer fromOffer) throws ProfitMandiBusinessException;
31903 amit.gupta 61
 
33613 amit.gupta 62
    void reverseAdditionalSelloutSchemes(List<InventoryItem> inventoryItems, String reversalReason) throws ProfitMandiBusinessException;
31920 amit.gupta 63
 
36103 amit 64
    void restoreAdditionalSelloutSchemes(List<InventoryItem> inventoryItems, String restoreReason) throws ProfitMandiBusinessException;
65
 
31920 amit.gupta 66
    void processSellin(CreateOfferRequest createOfferRequest) throws Exception;
35394 amit 67
 
68
    Map<Integer, QtyAmountModel> getCriteriaQtyAmounModelMap(CreateOfferRequest createOfferRequest, int fofoId) throws ProfitMandiBusinessException;
69
 
31920 amit.gupta 70
    void processActivationtOffer(CreateOfferRequest createOfferRequest) throws ProfitMandiBusinessException;
33030 amit.gupta 71
 
36305 amit 72
    /**
73
     * Read-only calculation of offer payouts per partner. Returns a list of payout data
74
     * without persisting anything. Used by batch processing to separate read from write.
75
     */
76
    List<OfferPartnerPayoutData> calculateOfferPayouts(CreateOfferRequest createOfferRequest) throws ProfitMandiBusinessException;
77
 
78
    List<SellinPartnerPayoutData> calculateSellinPayouts(CreateOfferRequest createOfferRequest) throws Exception;
79
 
33247 ranu 80
    String getPartnerCriteriaString(PartnerCriteria partnerCriteria) throws ProfitMandiBusinessException;
33999 tejus.loha 81
 
82
    ByteArrayOutputStream createCSVOfferReport(CreateOfferRequest createOfferRequest) throws Exception;
35205 amit 83
 
84
    void sendWhatsapp(Offer offer, List<Integer> fofoIds, String imageUrl) throws Exception;
35856 amit 85
 
86
    void deleteOffer(int offerId) throws ProfitMandiBusinessException;
87
 
88
    List<Offer> publishAllUnpublished(YearMonth yearMonth) throws ProfitMandiBusinessException;
35885 amit 89
 
90
    void removePartnersFromOffer(int offerId, List<Integer> fofoIds) throws ProfitMandiBusinessException;
91
 
92
    void addPartnersToOffer(int offerId, List<Integer> fofoIds) throws ProfitMandiBusinessException;
93
 
94
    int cloneOfferForPartners(int sourceOfferId, List<Integer> fofoIds, List<Integer> targets) throws ProfitMandiBusinessException;
95
 
96
    void updateOfferTargets(int offerId, List<Integer> newTargets) throws ProfitMandiBusinessException;
35924 amit 97
 
98
    void updateOfferSlabs(com.spice.profitmandi.dao.model.UpdateOfferSlabsRequest request) throws ProfitMandiBusinessException;
36633 amit 99
 
100
    List<Offer> activateOffers(List<Integer> offerIds, boolean active) throws ProfitMandiBusinessException;
27877 amit.gupta 101
}