Subversion Repositories SmartDukaan

Rev

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

Filtering Options

Rev Age Author Path Log message Diff
37727 2 d 7 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/entity/transaction/ Fixed mail sender everywhere  
37600 11 d 22 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Replace entity loads with scalar aggregates in the investment sweep

Order.lineItem is a ManyToOne with FetchType.EAGER, so getInTransitOrders() and
selectPendingGrnOrders() pulled ~6,865 Order entities plus a LineItem for each
into the session every two minutes - all dirty-checked at flush - when the sweep
only reads getRetailerId() and getTotalAmount(). That, plus ~1,690 FofoStore and
~984 PartnerInvestment rows, put roughly 17,000 entities in one session per pass
and is most of the ~10s each sweep was taking.

Adds two scalar named queries returning (retailerId, sum(totalAmount)) grouped by
partner. A projection never hydrates the entity, so the eager association never
fires - about 13,700 entities become ~1,000 rows. The predicates copy
selectOrders(ids, pendingOrderStatus) and selectPendingGrnOrders(ids) exactly,
including the SD_START_DATE floor, and the comment on the named queries says to
change them together.

Deliberately NOT done by making lineItem lazy: that mapping is shared by every
Order consumer in the codebase and flipping it globally is a far wider change than
this needs.

Entity-returning variants are untouched for their existing callers. Drops the now
unused sumOrderAmounts helper and the TransactionService dependency.

Not a fix for a problem - the sweep was comfortably inside its 120s window at ~8%
duty. It removes waste that would matter if the cadence were ever shortened.
 
37588 12 d 1 h amit /trunk/profitmandi-dao/src/main/ Serve partner investment from a 2-minute snapshot instead of a 3-hour cache

getInvestment() was @Cacheable on a 3-hour Redis cache that addAmountToWallet
evicted but consumeAmountFromWallet did not. A partner whose advance payment was
swept straight to a loan had the money counted twice - once as a still-cached
wallet balance, once as the reduced utilisation - overstating their credit limit
by the payment x their tier until the cache expired.

Replaced with fofo.partner_investment, refreshed every 2 minutes by
PartnerInvestmentSweepService. Every coupled term is read in one pass, so wallet
and utilisation (and in-stock and aged-Apple) can never come from different
moments. A shorter TTL would only have made the error rarer - it scales with the
payment, not the delay.

- PartnerInvestment entity/repository + partner_investment_snapshot.sql
- PartnerInvestmentSweepService: 9 batched reads, stores base_value for change
detection, refreshes aged-Apple for partners whose stock moved intra-day
- getInvestment/getInvestmentsForFofoStores both read the snapshot, so the two
paths no longer disagree; live compute retained as fallback
- selectActivatedStockAmountByFofoIds: batches an N+1 that cost 233ms x 1690
partners (6.6 min -> 1.0 s)
- getFirstBillingDates: batches another N+1 (4.6 s -> 0.67 s)
- selectPendingGrnOrders(List) now applies the same SD_START_DATE floor as the
single-partner overload; the two were reporting different GRN-pending
- selectPartnerStockValueMap takes excludeActivated: an activated Apple handset
held past the aging window was added once to in-stock and subtracted twice
(activated stock, then the aged haircut). 90 units, 24 partners, Rs 65.19 lakh
double-deducted. Live-demo passes false - no overlap there.
- applyManualAdjustment: routes the two hand-rolled admin wallet adjustments
through WalletServiceImpl so they take the FOR UPDATE lock
- add_idx_order_grn_pending.sql: covering index, GRN query 1320ms -> 514ms
 
37089 71 d 4 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/ Optimize partnerPerformance data access: fofoId-scoped + month-bucketed query variants

- Order: fofoId-scoped billing-avg named queries (replace all-partner scan+filter)
- MonthlyTarget: selectByDatesAndFofoId batches 7 per-month lookups into one
- SchemeInOut/OfferPayout: month-bucketed ...ByMonth earnings queries collapsing the
per-month loop; new MonthlyBrandIncomeModel / MonthlyOfferPayoutModel
All additive; existing shared queries and their callers unchanged.
 
37077 71 d 7 h ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/entity/transaction/ old version app disabled for rbm  
36972 84 d 6 h ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/ changeList  
36713 119 d 0 h amit /trunk/profitmandi-dao/src/main/ PI idempotency fix: original_wallet_amount + order_wallet_adjustment tracking for price drops and splits. Modernize statement queries with INVOICE_CANCELLED and RETURNS_CN unions.  
36470 141 d 23 h ranu /trunk/ code commit for reports section v2  
36327 155 d 5 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Fix currentinventorysnapshot/currentreservationsnapshot deadlock and optimize getFirstBillingDate

- SaholicInventoryServiceImpl: enforce reservation-snapshot → inventory-snapshot
lock order in addReservationCount and reduceReservationCount via explicit
session.flush(); eliminates the hadb1 deadlock recorded 2026-04-20 19:43:24
between these two methods' opposite-order writes.
- SaholicInventorySnapshot: add @DynamicUpdate so UPDATEs only rewrite the
changed column instead of all three — cuts redo/binlog write amplification
and makes deadlock dumps pinpoint the actual business path.
- TransactionRepositoryImpl.getFirstBillingDate: replace filesort-over-all-billed-
orders with MIN(billingTimestamp) via new Order.selectFirstBillingByRetailer
named query (Select tables optimized away). Preserves 2017-01-01 cutoff and
null-for-unbilled-partner semantics.
- Add @Cacheable on redisOneDayCacheManager keyed by fofoId (unless null) so the
8 call sites stop piling up identical SELECTs on the order table — this was
the query pinning Hikari slots at 150-460s each in recent processlist dumps.
 
35631 235 d 6 h ranu /trunk/ code commit for calling target  
35490 273 d 23 h ranu /trunk/ given brandwise placement acesseries qty instead of value  
35475 275 d 18 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/entity/transaction/ Optimize selectTodayOrdersRBM: Replace derived table subquery with direct JOINs - 33x faster (78s -> 2.3s)  
35474 275 d 18 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/ Optimize selectTodayOrders query: Replace OR with UNION ALL to avoid sort_union operation for today_po endpoint  
35473 275 d 18 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/entity/transaction/ Optimize selectTodayOrdersRBM query: Replace OR with UNION ALL to avoid sort_union operation and improve query performance  
35172 347 d 1 h ranu /trunk/ billed po action download option done  
35155 349 d 19 h ranu /trunk/ get quote from backend  
35154 349 d 23 h ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/ get quote from backend  
35153 350 d 0 h ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/ bm wise filter in today po  
35147 351 d 0 h ranu /trunk/ bm wise filter in today po  
34849 417 d 23 h ranu /trunk/ logger added  
34813 429 d 1 h aman /trunk/ Partner Dashboard Analysis  
34754 443 d 6 h ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/entity/transaction/ method update  
34741 449 d 0 h ranu /trunk/ bi report correction  
34738 449 d 23 h ranu /trunk/ bi report correction  
34721 453 d 3 h ranu /trunk/ bi report correction  
34715 454 d 1 h ranu /trunk/ bi report some correction  
34641 477 d 4 h ranu /trunk/ bi report completed first commit  
34584 491 d 6 h amit.gupta /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/entity/transaction/ Removed delivery timestamp check  
33947 673 d 3 h ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/entity/transaction/ mtd and today target data query correction  
33944 673 d 7 h ranu /trunk/ mtd and today target data query correction  
33873 707 d 18 h ranu /trunk/ smart cart first phase updated  
33823 723 d 7 h amit.gupta /trunk/ Fixed changes related to sort issue  
33805 728 d 2 h amit.gupta /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/entity/transaction/ Addeed retailer count  
33801 728 d 3 h amit.gupta /trunk/ Addeed retailer count  
33791 729 d 21 h amit.gupta /trunk/ Added rbm wise Performance  
33464 824 d 6 h ranu /trunk/ poco billing mail shoot daily category team  
33443 832 d 3 h ranu /trunk/ print resource and order cancel by partner and cron dao mail shoot for Live Demo  
33430 842 d 0 h amit.gupta /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/entity/transaction/ Fixed Order quantity availability  
33429 842 d 1 h amit.gupta /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/entity/transaction/ Fixed Order quantity availability  
33396 854 d 1 h amit.gupta /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Fixed warehouse related bugs