Subversion Repositories SmartDukaan

Rev

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

Filtering Options

Rev Age Author Path Log message Diff
36578 39 d 11 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Flagship credit: fix sale conversion to use invoice reference, add IMEI activation trigger

- Sale flow: removed unnecessary model_flagship table lookup at sale time. The flagship loan's invoice number already links to the purchase orders, making the date-based check redundant and incorrect (would miss conversions if flagship entry removed after billing).
- IMEI activation: added flagship conversion in addActivatedImeis() for newly activated serials. Groups by partner, checks flagship limits, converts via invoice matching. Covers Samsung/Vivo/Oppo/Realme activation crons and manual UI uploads.
- Repository: added date-parameterized selectActiveFlagshipCatalogIds(catalogIds, asOfDate) overload for future use. Existing method delegates with LocalDate.now().
 
36562 40 d 13 h amit /trunk/profitmandi-dao/src/main/ Flagship credit: date-wise model_flagship table, sale-time conversion with pessimistic locking, batch queries, extracted doConvertFlagshipToLoan helper, removed Catalog.isFlagship  
36560 40 d 14 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Flagship credit: sale-time conversion with FOR UPDATE locking and performance optimizations

- convertFlagshipOnSale: partial conversion at billed price when retailer sells flagship stock
- hasActiveFlagshipLimits: cheap COUNT check to skip catalog lookup for non-flagship partners
- selectActiveFlagshipLimitBlocksForUpdate: pessimistic lock prevents double-conversion from concurrent sales/cron
- selectFlagshipLoansForConversion: added FOR UPDATE lock for cron expiry path
- Batch order fetch instead of per-limit queries
- Wired into OrderServiceImpl.createOrder after stock update
 
36362 64 d 7 h 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.
 
36305 67 d 18 h amit /trunk/profitmandi-dao/src/main/ Batch processing infrastructure + per-partner offer processing + partner limit optimization + investment cache eviction on billing/payment/cancellation with 3hr TTL  
36126 85 d 13 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ Change FOFO invoice PDF title from Retailer Invoice to Tax Invoice  
36093 90 d 6 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ Remove WOD brand eligibility check from tertiary billing flow  
35896 116 d 4 h amit /trunk/profitmandi-dao/src/main/ Simplify partner GST: read/write from fofo_store.gst_number instead of Counter chain

- Set fofo_store.gst_number when store code is created/updated in RetailerServiceImpl
- Replace PrivateDealUser->Counter->gstin reads with FofoStore.getGstNumber() in:
RetailerServiceImpl, OrderServiceImpl, InvoiceService
- Remove unnecessary PrivateDealUser/Counter batch fetches in getFofoRetailers/getFofoRetailerUserId
- Add migration script to backfill existing GST from counter to fofo_store
 
35800 126 d 7 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Optimize credit note generation (bulk query), fix brand code NPE, add dealer code order validation, add @Profile guard on SolrStartupSync  
35736 134 d 10 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ Fix remaining coding issues in FOFO order creation

- Remove unused changedTotalBillAmount dead code
- Fix NPE when serializedInventoryItemMap returns null for an item
- Replace break-in-loop with iterator().next() in createAndGetFofoOrderItem
- Replace e.printStackTrace() with proper LOGGER.error()
- Log actual exception in state rate lookup instead of swallowing it
- Skip processScratchOffer when no smartphone in order
 
35733 134 d 11 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ Fix noGST bug, remove dead price validation code, optimize live demo query in order creation

- noGST: compute once before loop with anyMatch instead of last-item-wins
- Remove pricingService.getPurchasePriceMopPriceNotFound call and empty validateDpPrice/validateMopPrice (disabled since 11 sep 2025)
- Replace selectAllSerialNumber full table load with targeted selectBySerialNumbers for order serials only
 
35695 136 d 14 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Perf: N+1 fix in FOFO OrderServiceImpl.createOrder - batch fetch live demo serials and collect FofoOrderItems during loop  
35493 183 d 3 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)
 
35236 241 d 8 h amit /trunk/ Fixed notification related issues with scheme also stopped using mongo for brands Schema  
35232 244 d 10 h ranu /trunk/ insurance can we add both same time  
35209 253 d 9 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ Samsung Upgrade Logic Added  
35156 259 d 13 h aman /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ Fix:Customer gender null check  
35097 268 d 14 h ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ get quote from backend  
35055 276 d 13 h ranu /trunk/ remove cash discount from billing page  
35034 281 d 9 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ Added new method  
35000 283 d 13 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ donotcommit  
34999 283 d 13 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ Update  
34994 287 d 5 h ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ mop and dp price validation hide  
34805 343 d 6 h ranu /trunk/ icici insurance policy phase one uploaded  
34798 345 d 9 h ranu /trunk/ icici insurance policy phase one uploaded  
34718 364 d 7 h aman.kumar /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ Invoice Update error fix  
34709 364 d 13 h amit.gupta /trunk/ Added Loan Related Changes  
34504 421 d 15 h amit.gupta /trunk/ Fixed rollback of excess schemes in Oppo  
34486 426 d 7 h amit.gupta /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Fixed scheme logic out reversal logic  
34474 427 d 7 h aman.kumar /trunk/ Scratch Offer  
34430 435 d 11 h tejus.lohani /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ Remove free insurance on ADLD  
34381 447 d 7 h vikas.jangra /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ Set Pending Order ID  
34367 450 d 10 h ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ gift series exteneded and investment cutt off change according to tarun sir  
34365 450 d 13 h ranu /trunk/ gift series exteneded and investment cutt off change according to tarun sir  
34361 451 d 7 h ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ gift series exteneded  
34354 451 d 15 h ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ scratch offer related code  
34353 451 d 15 h ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ scratch offer related code  
34351 452 d 1 h ranu /trunk/ eid scratch offer live  
34342 455 d 10 h ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ scratch offer related code  
34341 455 d 10 h ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ scratch offer related code