| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.service.catalog;
|
1 |
package com.spice.profitmandi.service.catalog;
|
| 2 |
|
2 |
|
| 3 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
3 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 4 |
import com.spice.profitmandi.dao.entity.catalog.ModelHotDeal;
|
4 |
import com.spice.profitmandi.dao.entity.catalog.ModelHotDeal;
|
| 5 |
|
5 |
|
| 6 |
import java.time.LocalDate;
|
- |
|
| 7 |
import java.util.List;
|
6 |
import java.util.List;
|
| 8 |
|
7 |
|
| - |
|
8 |
/**
|
| - |
|
9 |
* Hot deal ATTRIBUTES.
|
| - |
|
10 |
*
|
| - |
|
11 |
* <p>Membership is not managed here any more - a SKU is a hot deal because its brand is
|
| - |
|
12 |
* {@code ProfitMandiConstants.HOT_DEAL_BRAND}. There is consequently no date window, no
|
| - |
|
13 |
* "active" notion, and no per-brand cap: the old {@code MAX_ACTIVE_DEALS_PER_BRAND = 15}
|
| - |
|
14 |
* capped deals per OEM, which is meaningless once every hot deal shares one brand.
|
| - |
|
15 |
*
|
| - |
|
16 |
* <p>What remains is the five per-SKU pill attributes the partner app renders.
|
| - |
|
17 |
*/
|
| 9 |
public interface ModelHotDealService {
|
18 |
public interface ModelHotDealService {
|
| 10 |
|
19 |
|
| - |
|
20 |
/** Attributes for one Hot Deal SKU, or null when ops has not filled them in yet. */
|
| 11 |
int MAX_ACTIVE_DEALS_PER_BRAND = 15;
|
21 |
ModelHotDeal getAttributes(int catalogItemId);
|
| 12 |
|
22 |
|
| 13 |
List<ModelHotDeal> getDealsForBrand(int brandId);
|
- |
|
| 14 |
|
- |
|
| 15 |
/** All deals across brands, newest window first, server-side searched + paginated. */
|
23 |
/** All attribute rows, newest first, server-side searched and paginated. */
|
| 16 |
List<ModelHotDeal> searchDeals(String query, int page, int pageSize);
|
24 |
List<ModelHotDeal> listAll(String query, int page, int pageSize);
|
| 17 |
|
25 |
|
| 18 |
long countDeals(String query);
|
26 |
long countDeals(String query);
|
| 19 |
|
27 |
|
| 20 |
long countActive(int brandId);
|
- |
|
| 21 |
|
- |
|
| 22 |
void addDeal(int brandId, int catalogItemId, LocalDate startDate, LocalDate endDate,
|
- |
|
| 23 |
HotDealAttributes attributes, String user) throws ProfitMandiBusinessException;
|
- |
|
| 24 |
|
- |
|
| 25 |
void updateDeal(int id, LocalDate startDate, LocalDate endDate,
|
- |
|
| 26 |
HotDealAttributes attributes, String user) throws ProfitMandiBusinessException;
|
- |
|
| 27 |
|
- |
|
| 28 |
void removeDeal(int id) throws ProfitMandiBusinessException;
|
- |
|
| 29 |
|
- |
|
| 30 |
/**
|
28 |
/**
|
| 31 |
* Re-index the models whose deal window opens today or closed yesterday, so Solr's
|
29 |
* Create or update the five pill attributes for a Hot Deal-brand catalog.
|
| - |
|
30 |
* Rejects any catalog that does not carry the brand.
|
| - |
|
31 |
*
|
| 32 |
* derived hot_deal_b follows the window without anyone editing the deal. Run daily.
|
32 |
* @param oemCatalogId optional channel-side counterpart under the model's OEM brand;
|
| - |
|
33 |
* null clears any existing mapping. Validated to exist and to
|
| - |
|
34 |
* actually belong to that OEM brand.
|
| 33 |
*/
|
35 |
*/
|
| - |
|
36 |
void saveAttributes(int catalogItemId, HotDealAttributes attributes, Integer oemCatalogId, String user)
|
| 34 |
void syncHotDealFlags();
|
37 |
throws ProfitMandiBusinessException;
|
| - |
|
38 |
|
| - |
|
39 |
/** Drop the attributes row. The SKU stays a hot deal - only its pills disappear. */
|
| - |
|
40 |
void removeAttributes(int id) throws ProfitMandiBusinessException;
|
| 35 |
}
|
41 |
}
|