Subversion Repositories SmartDukaan

Rev

Show changed files | Directory listing | RSS feed

Filtering Options

Rev Age Author Path Log message Diff
37398 44 d 1 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Share one insurance invoice line builder across partner and standalone invoices

Extract InsuranceInvoiceLine next to the partner invoice builder so both callers
- OrderServiceImpl.getInvoicePdfModel(FofoOrder) and the standalone policy
invoice in InsuranceController - produce the SAC, tax split and description from
one place. Arithmetic is unchanged (verified bit-identical); policyPlan is null
for policies sold outside a device sale, so it falls back to a generic plan name
instead of printing null.

Add IciciLombardService.policyCertificatePath so the service that writes the
certificate owns the path; callers were rebuilding it and hardcoding the prod
directory, so lookups silently missed off prod.

Add selectByInvoiceNumbersAndProviderId so bulk invoice downloads fetch policies
in one query instead of one per invoice.
 
37302 56 d 8 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/ Split refurbished (margin scheme) items into their own order at placement

Refurbished lines are invoiced on the RF- series, but only the partner checkout path
split them out. Internal POs and bulk orders raised a single mixed transaction, which
billed as one invoice on whichever series its first line happened to resolve to
(NSPJB2757, NSPJB3212, NSUPDL3898/3899/4365/4366).

- PurchaseOrderServiceImpl: split a mixed internal PO into a regular PO and a margin
scheme PO, each with its own PO number, PDF and internal transaction. External vendor
POs raise no transaction, so they are left intact.
- BulkOrderService: raise one transaction per billing group, each with its own loan
sized to the wallet balance left to it. Pricing, combo, credit availability and the
first-PO gates still validate the order as a whole, so a split first PO cannot block
its own second half.
- TransactionServiceImpl: drop the float narrowing of walletUsed in
createTransactionForCartLines - the field is a double and the cart total is validated
within 0.001, so any total carrying paise was rejected.
 
37143 76 d 4 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Brand eligibility: unified blocked + LOI-ineligible enforcement — new BlockedBrandService; BrandsService restrictedBrands/applyRestrictedSolrExclusion/validateOrderableBrands; hard-validate at add-to-cart (fofoId-aware addItemsToCart) and bulk order; cart validation uses restricted union  
37119 83 d 5 h ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ old version app disabled for rbm  
37110 84 d 5 h aman /trunk/ Business-agreement e-sign gate between Full Stock Payment and PO creation

New AGREEMENT_ESIGN onboarding stage, verified by Legal (Gaurav Sharma):
- Hard-blocks first PO creation until the e-sign is verified (BulkOrderService),
mirroring the existing Full Stock Payment block.
- Agreement E-Sign panel (Partner Acquisition menu) listing FSP-done partners who
have not yet created their first PO: upload signed agreement + Gaurav-only verify.
- New agreement_esign table/entity + repository for the signed doc and audit trail.
- Timeline grid column + stepper stage for the new event.

Prod DB (separate, with sign-off): CREATE TABLE user.agreement_esign;
INSERT auth.menu + auth.menu_category rows for the panel.
 
37102 84 d 6 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Remove dead Counter/PrivateDealUser code: drop unused isFofo, bulkShipmentAmountLimit, verifiedOn, documentVerified fields and accessors; remove dead selectByIds repo methods; drop redundant Counter/PrivateDealUser repository injections in OrderServiceImpl and InvoiceService  
37091 86 d 2 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ Bulk orders: enforce combo requirements for RBM/SALES creators

Bulk PO path skipped combo validation, letting RBM/SALES-created bulk orders bill a
combo main without its required side(s). Now, when the creator holds an RBM(18) or
SALES(4) position, run the existing cart-path comboService.validateCombo on the
per-partner cart (already built via cartService.setCartItems) right before the
transaction is created. Restrict-only: throws 'Missing required Qty for Combo' if a
side is missing; never auto-injects. Gate fail-open; other creators (incl AUTO PO) unaffected.
 
37067 90 d 2 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ Fix null state code on FOFO partner-to-customer sale-return credit note: populate partner/customer address state codes via StateRepository lookup (were unset)  
36958 100 d 6 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).
 
36936 104 d 8 h vikas /trunk/ Update Email Ids  
36613 141 d 2 h aman /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ Fix:Update L3 to L4 for first po approval mail  
36578 144 d 6 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 145 d 8 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 145 d 9 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
 
36534 148 d 6 h aman /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/order/ Fix:First Po check (is it pending )  
36518 150 d 6 h aman /trunk/ Fix:Fix first po and edge case for bulk order  
36399 164 d 7 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Replace mailSender (SendGrid) with gmailRelaySender - SendGrid API key expired/revoked  
36362 169 d 2 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.
 
36309 171 d 21 h amit /trunk/profitmandi-dao/src/main/ Route phantom orders to per-region Dummy warehouse; complete applyColorChange rename

- Phantom allocations in getFulfillments route to the Dummy/GOOD/OURS warehouse under
vendor 40 for the partner's billing region. WarehouseServiceImpl.ensureDummyForBillingRegion
returns the existing Dummy or creates one on the fly. createVendorWarehouse hook auto-seeds
a Dummy when a new billing region's first warehouse is created.
- WarehouseRepository.selectByVendorBillingAndType supports the lookup.
- OrderService interface: rename notifyColorChange -> applyColorChange to match r36305's impl
rename (r36305 renamed only the impl, leaving trunk inconsistent).
- PurchaseOrderServiceImpl: remove auto-rebalance on PO receive. Real-wh rebalancing and
phantom-to-real binding are now ops-driven via the order billing UI
(changeFulfillmentWarehouse / applyColorChange / moveOrdersFulfilmentWarehouse).
- migration_dummy_warehouses.sql: idempotent seeding script for 14 Dummy/GOOD/OURS warehouses
under vendor 40, one per WAREHOUSE_MAP billing region that lacked one. Already applied to
hadb1 and local.
 
36305 172 d 14 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  

Show All