Subversion Repositories SmartDukaan

Rev

Show changed files | Details | Compare with Previous | Blame | RSS feed

Filtering Options

Rev Age Author Path Log message Diff
37941 7 d 3 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Partner GRN: lock purchase before quantity check; block re-billing of billed orders

- scanSerialized/scanNonSerialized lock the purchase row (refresh FOR UPDATE) and sum GRNed qty with
FOR UPDATE before checking against billed qty, so two concurrent GRNs of one invoice can't both pass
- Serialized GRN rejects a line carrying more IMEIs than its billed quantity (double-billed line)
- acceptOrders validates billing state; billing re-checks orders under FOR UPDATE so a second click
can't bill an already billed order
- Scheme IN skips inventory rows with initial quantity 0 (voided duplicate GRN rows)
- Includes an empty-list guard in selectWarehouseIdsByInvoiceNumbers from a parallel change
 
37939 7 d 19 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/ Scheme and offer payouts skip SUSPENDED and CLOSED stores

- Activation special support (processActivation): payouts of suspended or closed stores stay pending,
paid only if the store is revived
- Offer rollout and payout preview (activation/tertiary and sell-in): suspended and closed stores are
dropped by store status, whatever the partner criteria
 
37307 77 d 20 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/scheme/ Block activation of item-less schemes (SELLIN/SELLOUT/SPECIAL_SUPPORT): validateSchemeHasItems guards activeSchemeById and activeSchemeByIds, fixes /todayOfferList NPE caused by scheme 7877  
37160 92 d 18 h ranu /trunk/ super retailer club going live  
37136 98 d 20 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Release scheme payout and price-hike deduction on every GRN scan instead of purchase completion; serialize per-purchase processing with FOR UPDATE lock on fofo.purchase to prevent duplicate credits/debits under concurrent runs  
37068 108 d 22 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/scheme/ processSchemeOut: resolve OUT schemes on order create date, not GRN billing date

OUT schemes (sellout, special support, category, hygiene) are earned at the
sale event, so scheme eligibility must be pulled on fofoOrder.createTimestamp,
not each IMEI's GRN billing date. Reverts the r36397 date-basis change (which
pinned OUT to GRN date to 'align with IN behaviour' - but IN and OUT are
different events). The scheme_item date-windowing feature from r36397 is kept
intact; only the lookup date reverts to the order create timestamp.
 
36767 148 d 20 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/scheme/ Fixed Stock Purchase sAle ageing days, added fields to mail  
36491 175 d 1 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/scheme/ Fixed scheme item enddate to expire when scheme is expired  
36490 175 d 1 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/scheme/ Fixed scheme item enddate to expire when scheme is expired  
36451 180 d 20 h amit /trunk/profitmandi-dao/src/main/ Add reference field to catalog.offer and catalog.scheme for payout collation  
36405 185 d 20 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Fix duplicate SchemeInOut on concurrent GRN: SELECT FOR UPDATE on inventory_item before createSchemeInOut to serialise concurrent GRN calls per IMEI  
36397 185 d 23 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Scheme item windowing: add startDate/endDate per scheme_item.

Each fofo.scheme_item row now carries an optional [start_date, end_date]
window so the same (scheme_id, catalog_id) pair can be applicable for
different date ranges. Backward compatible: NULL window = always active.

- SchemeItem entity: composite (schemeId, catalogId) PK -> surrogate
long id (IDENTITY), unique (catalog_id, scheme_id, start_date, end_date),
audit cols (updatedBy, updatedOn).
- Scheme + TagListing named queries: gated by
'(si.start_date is null or :onDate between si.start_date and si.end_date)'.
- SchemeItemRepository: + selectById, selectBySchemeId,
existsOverlapping (half-open, with self-exclude), selectItemsOutsideWindow.
- SchemeService: + updateSchemeItemWindow / addSchemeItemWithDates /
clampSchemeItems with containment + overlap validation; drop dead
getTotalMargin.
- SchemeServiceImpl.processSchemeOut: pin scheme resolution to each
IMEI's GRN billing date (Purchase -> Order.billingTimestamp via
PurchaseService.getBillingDateOfPurchase) instead of fofoOrder
createTimestamp, aligning OUT with the existing IN behaviour.
 
36103 213 d 18 h amit /trunk/profitmandi-dao/src/main/ Add DN rejection with full reversal: restore inventory, schemes, price drops, offers; add deny reason to purchase return items; add purchase return notification service  
36070 218 d 0 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/ Premium CD days: add partner-type helpers, update credit terms, fix CD rejection for 20-day loans, update invoice PDF terms  
35895 242 d 16 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/ Simplify price handling code: remove dead code, replace System.out with LOGGER, deduplicate priceDiff calc, add comments  
35629 272 d 20 h amit /trunk/ Fixed SchemeService  
35559 287 d 21 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/scheme/ Fixed SchemeService  
35493 309 d 15 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ N+1 query optimization for B2B order creation flow

- OrderServiceImpl: Batch fetch PendingOrderItems before validation loop (line 402)
- OrderServiceImpl: Batch update opening stock using minusOpeningStockBatch
- OrderServiceImpl: Pre-fetch tagListings and GST rates before createAndGetFofoOrderItem loop
- OrderServiceImpl: Batch fetch PendingOrderItems for status update (line 719)
- CartServiceImpl: Pre-fetch items before getCartValidation loop
- SchemeServiceImpl: Batch fetch SchemeInOut records in processSchemeOut
- SmartCartService: Added minusOpeningStockBatch method for batch updates
- TagListingRepository: Added selectByItemIds batch method
- FofoOpeningStockRepository: Added findByFofoIdAndCatalogIds batch method
- PendingOrderItemRepository: Added selectByIds batch method

Performance improvement: ~70-100 DB queries reduced per order (10 items avg)
 
35394 317 d 12 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Improved performance  
35334 333 d 2 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/scheme/ Fixed hard limit  

Show All