Subversion Repositories SmartDukaan

Rev

Show changed files | Directory listing | RSS feed

Filtering Options

Rev Age Author Path Log message Diff
36363 7 h 36 m amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/ Idempotent fofo_order creation in UpSaleController (mirrors r36362 in dao)

Same change as OrderServiceImpl.createAndGetFofoOrder: pre-select by
(fofo_id, invoice_number) and catch DataIntegrityViolationException as the
slow-race fallback. Paired with uk_fofo_order_fofo_invoice unique key.
 
36362 7 h 37 m amit /trunk/profitmandi-dao/src/main/ Make fofo_order creation idempotent on (fofo_id, invoice_number)

Fixes insert-intention gap-lock deadlocks on idx_invoice_number observed in
SHOW ENGINE INNODB STATUS at 2026-04-22 13:01:54 — two concurrent requests
inserting the same invoice_number for the same customer (client retry /
upstream webhook retry pattern).

- OrderServiceImpl.createAndGetFofoOrder: select-then-insert idempotency.
Fast path returns existing row if already created; slow-race path catches
DataIntegrityViolationException and re-selects the winner's row.
- add_uk_fofo_order_fofo_invoice.sql: adds UNIQUE KEY (fofo_id, invoice_number)
so the loser of a concurrent-insert race gets a clean DIVE instead of a
silent duplicate row (pre-check showed zero existing dup groups, safe).

findExistingFofoOrder wraps the repo call to swallow the repo's declared
ProfitMandiBusinessException — the impl actually returns null on not-found
(constructs an exception but never throws), so the swallow matches reality.
 
36361 7 h 47 m amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Switch @Scheduled updatePartnerLimit to batch-tracked version. Was calling legacy scheduledTasks.updatePartnerLimit (one synchronized tx, writes to all ~1500 partners each run, no audit). Now calls batchScheduledTasks.updatePartnerLimitWithBatch (writes only changed partners in per-partner REQUIRES_NEW, records each run in cron_batch / cron_batch_item, sends failure email on partial failures). Same cadence (every 20 min), same business logic. Runs are now visible in /admin/cron-batches UI.  
36360 8 h 44 m ranu /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/monitors/ login talktime hours cap on 100%  
36359 8 h 59 m ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/ rbm rating dashboard view commited  
36358 9 h 4 m amit /trunk/profitmandi-fofo/src/main/webapp/WEB-INF/views/ftl/ Replace non-ASCII separators in cron-batches modal with ASCII. Title middle-dot (U+00B7) and empty-timestamp em-dash (U+2014) were rendering as mojibake ('·' and 'â€') — response was being served without charset=UTF-8 in the Content-Type header despite Velocity being UTF-8 configured. Swapped to '|' and '-' to avoid the encoding issue without chasing it through Velocity/Tomcat config.  
36357 9 h 43 m amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/ Fix background-thread 'no session' error in DB guard. CronBatchRepository.selectRunningForOffer uses getCurrentSession() which needs an open tx; when OfferBatchService.processOfferWithBatch is called from the async worker thread (no outer tx), the guard query crashed with 'Could not obtain transaction-synchronized Session'. Offer 8819 submit succeeded but the background run died at the guard — before createBatch, so no cron_batch / cron_batch_item rows. Added CronBatchService.findRunningForOffer wrapping the repo call in @Transactional(readOnly=true); orchestrator calls the service method instead of repo directly. Matches the pattern used by loadOfferRequest / createBatch / calculate*Payouts — every caller opens its own tx.  
36356 10 h 9 m ranu /trunk/ rbm rating dashboard view commited  
36355 10 h 45 m amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/offers/ Skip already-paid partners before creating cron_batch_item rows. Adds hasRemainingSellinPayout / hasRemainingOfferPayout predicates on OfferProcessingHelper that mirror the amount calc in processPartner*Payout. Orchestrator filters partnerPayouts through these before createBatch — partners whose serials are fully paid (amount=0 after subtracting serialNumberPaid) are excluded entirely. Reruns of a completed offer now create no batch at all (log says 'all N eligible partners already fully paid, skipping batch'); partial reruns log filtered count. Avoids audit-trail noise of SUCCESS items that did zero work.  
36354 11 h 9 m amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ DB-backed concurrent-run guard for OfferBatchService.processOfferWithBatch. Adds CronBatchRepository.selectRunningForOffer(offerId) — single HQL query for RUNNING cron_batch rows named processSellinOffer-N or processActivationOffer-N. OfferBatchService early-returns (with a log) if any such row exists. Covers the three gaps the in-memory guard can't: JVM restart, multi-JVM, cron CLI + user click racing. Applies to both sync (cron --processOffersWithBatch) and async (/offer/process HTTP) paths.  
36353 12 h 24 m vikas /trunk/ Login issue  
36352 12 h 26 m amit /trunk/profitmandi-fofo/src/main/ Add admin cron batch review UI at /admin/cron-batches. Single page lists recent 200 batches grouped by date (most recent on top), clicking a row opens a modal with per-partner items (fofoId, partner, status, error, timestamps). Manual Refresh button re-fetches JSON. Admin-only via roleManager.isAdmin. Uses existing velocity layout (1-line passthrough). Three endpoints: GET /admin/cron-batches (HTML), /list (JSON), /{batchId}/items (JSON). Uses dao r36351 repo methods.  
36351 12 h 26 m amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/transaction/ Add CronBatchRepository.selectRecent(limit) and CronBatchItemRepository.selectByBatchId(batchId) for admin batch review UI. selectRecent returns most-recent-first via selectAllOrderByDescPaginated('id'); selectByBatchId uses selectAllByEqualOrderByDesc.  
36350 12 h 29 m aman /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/user/ Fix:Add brand commitment, ASM details, and finance option in WOD initiation email  
36349 12 h 42 m amit /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/v2/controller/fofo/ V2 /offer/process/{offerId} now fire-and-forget via submitBatchAsync (dao r36347). Response adds a 'message' field alongside success=true so the UI can surface 'Offer N submitted for processing' or 'already being processed'.  
36348 12 h 42 m amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/ /offer/process/{offerId} now fire-and-forget: calls offerBatchService.submitBatchAsync (dao r36347) and returns the status message immediately. User no longer waits on the 5+ min batch run; duplicate clicks for the same offer return 'already being processed' instead of spawning parallel deadlocking batches.  
36347 12 h 42 m amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/offers/ Add submitBatchAsync for fire-and-forget /offer/process — schedules processOfferWithBatch on a bounded background pool (3 daemon threads) and returns immediately with a human-readable message. In-memory ConcurrentHashMap.newKeySet() per-offerId guard prevents duplicate concurrent runs for the same offer (the scenario that caused offer 8802 deadlocks). Sync processOfferWithBatch kept unchanged for cron CLI (--processOffersWithBatch).  
36346 13 h 39 m ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/model/ rbm rating dashboard view commited  
36345 14 h 55 m amit /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/v2/controller/fofo/ Route V2 /offer/process/{offerId} through OfferBatchService (dao r36342). Same motivation as fofo r36344: per-partner REQUIRES_NEW eliminates lock contention seen on offer 8802 and isolates failures.  
36344 14 h 55 m amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/ Route /offer/process/{offerId} through OfferBatchService (dao r36342). Per-partner REQUIRES_NEW replaces the single outer transaction — fixes lock-acquisition failures (e.g. offer 8802) by releasing row locks between partners and isolating per-partner failures in cron_batch_item instead of aborting the whole run.  

Show All