| Line 1... |
Line 1... |
| 1 |
package com.smartdukaan.cron.scheduled;
|
1 |
package com.smartdukaan.cron.scheduled;
|
| 2 |
|
2 |
|
| 3 |
import com.spice.profitmandi.dao.entity.transaction.CronBatch;
|
3 |
import com.spice.profitmandi.dao.entity.transaction.CronBatch;
|
| 4 |
import com.spice.profitmandi.service.cron.CronBatchService;
|
4 |
import com.spice.profitmandi.service.cron.CronBatchService;
|
| 5 |
import com.spice.profitmandi.service.offers.OfferBatchService;
|
5 |
import com.spice.profitmandi.service.offers.OfferBatchService;
|
| - |
|
6 |
import com.spice.profitmandi.service.pricing.PriceDropBatchService;
|
| 6 |
import com.spice.profitmandi.service.transaction.PartnerLimitUpdateData;
|
7 |
import com.spice.profitmandi.service.transaction.PartnerLimitUpdateData;
|
| 7 |
import org.apache.logging.log4j.LogManager;
|
8 |
import org.apache.logging.log4j.LogManager;
|
| 8 |
import org.apache.logging.log4j.Logger;
|
9 |
import org.apache.logging.log4j.Logger;
|
| 9 |
import org.springframework.beans.factory.annotation.Autowired;
|
10 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 10 |
import org.springframework.stereotype.Component;
|
11 |
import org.springframework.stereotype.Component;
|
| Line 32... |
Line 33... |
| 32 |
private OfferBatchService offerBatchService;
|
33 |
private OfferBatchService offerBatchService;
|
| 33 |
|
34 |
|
| 34 |
@Autowired
|
35 |
@Autowired
|
| 35 |
private PartnerLimitHelper partnerLimitHelper;
|
36 |
private PartnerLimitHelper partnerLimitHelper;
|
| 36 |
|
37 |
|
| - |
|
38 |
@Autowired
|
| - |
|
39 |
private PriceDropBatchService priceDropBatchService;
|
| - |
|
40 |
|
| 37 |
/**
|
41 |
/**
|
| 38 |
* CLI entrypoint for cron: delegates to shared OfferBatchService (also used by web/fofo controllers).
|
42 |
* CLI entrypoint for cron: delegates to shared OfferBatchService (also used by web/fofo controllers).
|
| 39 |
*/
|
43 |
*/
|
| 40 |
public void processOfferWithBatch(int offerId) throws Exception {
|
44 |
public void processOfferWithBatch(int offerId) throws Exception {
|
| 41 |
offerBatchService.processOfferWithBatch(offerId);
|
45 |
offerBatchService.processOfferWithBatch(offerId);
|
| 42 |
}
|
46 |
}
|
| 43 |
|
47 |
|
| 44 |
/**
|
48 |
/**
|
| - |
|
49 |
* Scheduled entrypoint: delegates to shared PriceDropBatchService.
|
| - |
|
50 |
* Reprocesses (rejects) price drops for IMEIs activated before the drop date,
|
| - |
|
51 |
* each drop in its own REQUIRES_NEW transaction so user_wallet locks are held
|
| - |
|
52 |
* per-drop instead of for the whole run.
|
| - |
|
53 |
*/
|
| - |
|
54 |
public void reprocessPriceDropsWithBatch() {
|
| - |
|
55 |
priceDropBatchService.reprocessPriceDropsWithBatch();
|
| - |
|
56 |
}
|
| - |
|
57 |
|
| - |
|
58 |
/**
|
| 45 |
* Recalculates partner credit limits. Only writes to partners where values actually changed.
|
59 |
* Recalculates partner credit limits. Only writes to partners where values actually changed.
|
| 46 |
*
|
60 |
*
|
| 47 |
* Flow:
|
61 |
* Flow:
|
| 48 |
* 1. Read phase: calculate limits for all 1,500 partners, compare with current values
|
62 |
* 1. Read phase: calculate limits for all 1,500 partners, compare with current values
|
| 49 |
* 2. Create batch with only changed partners (~50-100 typically)
|
63 |
* 2. Create batch with only changed partners (~50-100 typically)
|