Subversion Repositories SmartDukaan

Rev

Show changed files | Directory listing | RSS feed

Filtering Options

Rev Age Author Path Log message Diff
37089 6 d 18 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.
 
36999 18 d 16 h amit /trunk/profitmandi-dao/src/main/ Price-hike deduction (self-contained): revert hike logic from price-drop flow + remove deduct_on_hike flag; add GRN hook (PurchaseServiceImpl, before schemes) and on-demand executor endpoint that debit under-charged units billed in the hike's [affected_on, created_on] window. Idempotent per (hike, imei).  
36972 19 d 21 h ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/ changeList  
36958 20 d 18 h amit /trunk/profitmandi-dao/src/main/ Flagship credit: fire interest-free limits at billing + per-IMEI conversion

- createLoanForBilling now detects flagship lines inside the billing transaction (fixes the
REQUIRES_NEW visibility bug where flagship detection re-queried uncommitted invoice_number and
never fired). Creates one combined flagship limit (is_flagship=1, limit_block=1, 30-day deadline)
plus one transaction.loan_imei row per device.
- convertFlagshipOnSale / IMEI activation now convert only the sold device's slice (matched by IMEI),
so same-model siblings and other billing tranches keep their interest-free window; full convert at
30-day expiry. Lock order aligned (loan -> loan_imei) to avoid sale/expiry deadlock.
- New transaction.loan_imei table + LoanImei entity/repository (migration_loan_imei_table.sql).
- selectAllLoansByInvoice: PurchaseReturn now settles BOTH the real loan and the flagship limit on a
flagship-invoice return (prevents credit leak from a stranded limit).
- Cap guard (flagship credit never exceeds amount drawn) and robust limit settlement (paisa threshold
instead of exact float equality).
 
36898 28 d 15 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/ HID allocation: batch the requested-allocations screen (catalog-filtered HID query + batched billed/activated serial lookups) and add approved-list pagination (50/page) reusing GenericRepository paginated+count helpers  
36894 28 d 18 h amit /trunk/profitmandi-dao/src/main/ HID allocation: requested qty is now an additional one-time allowance (purchase-limit override, HID target unchanged); add approved_by column; add 5-day billed/activated serial lookups for the edit screen  
36850 34 d 21 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/transaction/ Account statement: anchor split-child pending indent to transaction root (any depth)

selectPendingIndentWalletAmount now dates any split order off the split-chain ROOT's
createTimestamp via MIN(createTimestamp) over transactionId, replacing the one-level
originalOrderId parent hop (r36830). All orders of a transaction share one wallet debit
posted at the root order's creation, so this resolves the root at any split depth and keeps
multi-level split children in pending indent from the debit date. Fixes account-statement
FLOAT DIFF for multi-level split chains (e.g. GERMAN UPBLY836 +27,998 -> 0). Correlated MIN
is backed by ix_order_transaction_id.
 
36830 39 d 18 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/transaction/ Account statement: anchor split-child pending indent to originalOrderId parent date

selectPendingIndentWalletAmount now dates a quantity-split child order (originalOrderId
set) off its parent's createTimestamp, so the owed split-out quantity stays in pending
indent from the parent's date and bridges the single wallet debit to the later billing
across a month boundary. Fixes account-statement FLOAT DIFF gaps for partners with
month-end order splits. One-level resolution (parents are chain roots).
 
36790 45 d 20 h amit /trunk/profitmandi-dao/src/main/ Add PO_REJECTED status and release rejected-PO orders from pending indent

Rejected bulk-PO approvals refunded the wallet but left order rows in
status=0 (PAYMENT_PENDING) with billing/refund NULL, so they were counted
by pending indent forever and inflated the account-statement closing
balance with no matching wallet liability.

- OrderStatus.PO_REJECTED(91) new terminal status for approval rejection
- OrderRepository.cancelRejectedTransactionOrders sets status + refund_timestamp
on a rejected transaction's still-pending orders (side-effect free: wallet
already refunded at txn level, these never-processed orders hold no reservation)
- backfill_po_rejected_orders.sql releases 485 historically-stranded orders
(Group A: wallet already refunded). Deploy code before running.
 
36779 46 d 20 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/transaction/ Fix NPE in selectPendingIndentWalletAmount for all-partners reco: exclude null-retailerId orphan orders (which formed a null GROUP BY key) and guard null group sums  
36778 46 d 20 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/transaction/ Fix account closing queries: cn.created_at -> cn.create_timestamp in selectOpeningAmount (r36719 missed it); remove dead single-partner selectOpeningAmount overload; correct pending-indent filter to exclude orders billed-before but refunded-after closingDate  
36774 46 d 21 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/ Add bulk getLoanOutstandingAtDate (principal+interest per partner at a date) for account reco closing  
36769 47 d 15 h amit /trunk/ Account statement: select the month-end scheme/margin credit notes by margin_month instead of cn_date.

Added CreditNoteRepository.selectByMarginMonth(fofoId, YearMonth) - fofo-scoped, keyed on margin_month passed as a YearMonth so the generic repo matches it as a whole-month range (robust to the stored day). populateData now uses it for the month-end CN block. margin_month is the explicit margin-period field (always populated for MARGINS and CN_CANCELLATION; RETURNS have none and are naturally excluded, consistent with returns being sourced from returnorderinfo).
 
36754 48 d 21 h amit /trunk/ Account statement (Excel): reconcile running balance to net standing (wallet + pending indent - loan).

- populateData: categorised lines, scheme/margin shown as month-end MARGINS credit note (CN_CANCELLATION and negative-net CNs rendered as debit notes), interest-accrued line as the standing-moving loan cost, and a net-pending-indent/diff line that lands the running balance on closing.
- Returns shown individually from returnorderinfo (one credit line per return, against its invoice on refundedAt); billing-query RETURNED/RETURNS_CN suppressed to avoid double count.
- Exclude PURCHASE and CREDIT_LIMIT/CREDIT_UTILIZED (loan cash legs) from the wallet body.
- LoanStatementRepository.getInterestAccruedBetween; ReturnOrderInfoRepository.selectReturnsBetween.
 
36719 54 d 13 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Add total_amount to credit_note: new column + backfill from lines, populate at all 5 CN/DN creation points, fix account statement query (cn.created_at -> cn.create_timestamp)  
36713 54 d 15 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.  
36704 54 d 18 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/transaction/ BI report: include INVOICE_CANCELLED (status 90) in refund deductions alongside RTO_REFUNDED. RTO_REFUNDED is deprecated; INVOICE_CANCELLED is the current cancellation path.  
36691 55 d 16 h amit /trunk/profitmandi-dao/src/main/ fix account statement balance gap: include pending orders with NULL billing/refund in getPendingIndentValueMap, fix double query execution in selectOpeningAmount, remove verbose logging in selectDetailsBetween, add indexes for returnorderinfo and returnorder  
36591 63 d 12 h vikas /trunk/ Store Image Capture & Pinelabs Affordability Enhancements  
36560 65 d 21 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
 

Show All