| Rev |
Age |
Author |
Path |
Log message |
Diff |
| 36451 |
3 d 20 h |
amit |
/trunk/profitmandi-dao/src/main/ |
Add reference field to catalog.offer and catalog.scheme for payout collation |
|
| 36446 |
4 d 14 h |
amit |
/trunk/profitmandi-dao/src/main/ |
DN lifecycle: decouple rejection from restore, add DebitNoteStatus, retailer acknowledgment flow
- Add DebitNoteStatus enum (CREATED/RECEIVED/APPROVED/REJECTED/CANCELLED) on debit_note table
- Add retailer_acknowledge_timestamp on purchase_return_order
- rejectReturn() no longer calls restoreReturnedItems() — inventory stays reduced until retailer confirms goods received back
- New acknowledgeRejectedReturn(): retailer confirms receipt, restores inventory+schemes+offers, DN→CANCELLED
- Set DN status in receiveDebitNoteItems (RECEIVED), refundOrder (APPROVED), rejectReturn (REJECTED)
- notifyReturnRejected: updated message, added Finance L1+L2 to CC
- notifyItemsReceived: added Finance L1
- New notifyRejectedGoodsAcknowledged notification
- SQL migration with backfill for existing data |
|
| 36443 |
4 d 22 h |
amit |
/trunk/profitmandi-dao/src/main/resources/sql/ |
Add ALTER TABLE migration to rename monitor_type normal to base |
|
| 36441 |
5 d 0 h |
amit |
/trunk/profitmandi-dao/src/main/ |
Rename monitor type 'normal' to 'base' in enum and SQL schema |
|
| 36439 |
5 d 1 h |
amit |
/trunk/profitmandi-dao/src/main/ |
Add outlet_name field to FofoStore entity, set from address.name on store creation
Adds outlet_name (VARCHAR 255) to FofoStore entity so the store's display
name is persisted directly on fofo_store instead of requiring a join through
retailer_registered_address -> address every time it is needed.
Sets fofoStore.setOutletName(retailerAddress.getName()) in both creation
paths: RetailerServiceImpl.createFofoStoreCodeByRetailerId (primary) and
RetailerController.createFofoStore (secondary).
Includes migration SQL script (migration_outlet_name_to_fofo_store.sql) to
ALTER TABLE and backfill existing rows from address.name. Must be run during
low-traffic window - fofo_store is heavily queried and ALTER takes a metadata
lock that blocks all concurrent SELECTs. |
|
| 36423 |
7 d 2 h |
amit |
/trunk/profitmandi-dao/src/main/resources/sql/ |
Fix catalog_monitor_type table charset to utf8 for consistency |
|
| 36407 |
8 d 18 h |
amit |
/trunk/profitmandi-dao/src/main/ |
Sale-return reversal: cancellability gate, CN on approve, INV reject, ROI semantics
GstProService.isIrnCancellable(invoiceNumber): predicate extracted from
the inline 24h check used in cancelInvoiceGst, so callers outside the
service can decide branching without duplicating the rule. DC and no-IRN
cases return false — those paths use EWB cancel / credit-note issuance.
PurchaseReturnServiceImpl: split single-phase return-receive into
submitReceiptForApproval + applyReceipt. Submit persists per-item return
type on PurchaseReturnItem so apply (called inline on auto-approve, or
later from refundOrder when finance clicks Process Refund) can replay
the scan loop without the original itemReturnTypes map.
processInvoiceReturn(autoApprove=true) no longer creates a PRO. Routes
through new cancelInvoiceFully which calls gstProService.cancelInvoiceGst
(the canonical IRN-cancel path setting Order.status=INVOICE_CANCELLED)
and adds wallet credit + warehouse-stock restoration. Cancellations now
live on Order/EInvoiceDetails screens, not in the returns ledger —
matches standard ERP practice and the existing cancelInvoiceGst flow.
processInvoiceReturn(autoApprove=false) creates an INV-prefix PRO in
pending state and calls notifyFinanceApprovalPending (Finance L1+L2
emails resolved dynamically from PositionRepository).
approveInvoiceReturn now runs applyInvoiceReturnViaCreditNote — raises
local CreditNote + CreditNoteLine rows (sequential CN# from
SellerWarehouse), issues CRN at GST via generateCreditNoteIrn, restores
warehouse stock, populates ReturnOrderInfo (this path IS a customer
return without DN — ROI is the right anchor), credits wallet. Drops the
old applyInvoiceReturnEffects helper which mishandled both cancel and
return-via-CN as the same path.
rejectInvoiceReturn: new method for finance to reject pending INV PROs.
Sale stands — only stamps reject_timestamp/reject_remark. No inventory,
no wallet, no GST action, no ROI. Closes the gap where finance had
Approve as the only option on a pending INV PRO.
refundOrder gains a refund guard (PRO must exist, not refunded, not
rejected) and applyReceipt-if-needed at the top — Finance's existing
Process Refund button now drives approve+refund atomically.
PurchaseReturnOrderRepository.selectByWarehouseIdsAndDateRange: Hibernate
query for a date-range listing on /return/invoice (default last 30
days, limit 200).
@Transactional(rollbackFor=Exception.class) at class level —
ProfitMandiBusinessException is checked, so Spring's default rollback
didn't fire on guard failures, allowing partial commits. Closing that
silently broken behaviour.
LineItemImei N+1 fix: receiveDebitNoteItems / refundOrder / rejectReturn
each iterated orders calling selectByLineItemId per row. Switched to the
existing batch selectByLineItemIds(List).
Email template finance-receipt-approval-pending.vm and SQL migration
migration_imei_net_margin_modal_api.sql added (registers the
/getImeiNetMarginModal endpoint in dtr.api and grants access to the
roles that currently access /order). |
|
| 36406 |
8 d 20 h |
amit |
/trunk/profitmandi-dao/src/main/resources/sql/ |
Add scheme_item windowing migration script.
Migrates fofo.scheme_item from composite (scheme_id, catalog_id) PK to
surrogate id BIGINT, adds audit columns, swaps the old uniqueness to
the 4-column window key, adds a date-driven lookup index, and installs
BEFORE INSERT/UPDATE triggers that enforce start<=end, containment in
parent scheme window, and non-overlap within (catalog_id, scheme_id).
Step 4b drops the legacy UNIQUE scheme_catalog (scheme_id, catalog_id);
without this the windowing feature is functionally blocked.
Applied on hadb1 in this revision. |
|
| 36403 |
8 d 23 h |
amit |
/trunk/profitmandi-dao/src/main/ |
Add catalog.catalog_monitor_type table, entity, and repository for per-catalog focused/normal monitor type tagging |
|
| 36362 |
13 d 18 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. |
|
| 36330 |
14 d 21 h |
amit |
/trunk/profitmandi-dao/src/main/ |
Fix getWarehousewiseCollection: add timestamp index, drop misleading FORCE INDEX
EXPLAIN on hadb1 showed the query was full-scanning transaction.userwallethistory
(1.9M rows) despite FORCE INDEX (idx_uwh_wallet_timestamp). The composite
(wallet_id, timestamp) needs an equality predicate on wallet_id to be usable,
but this query filters by uwh.timestamp at the scan level with no wallet_id —
driven from fofo_store via joins. Optimizer correctly rejected the hint and
picked ALL. Query averaged 773 ms across 4,095 calls (3,167 s cumulative).
- add_idx_uwh_timestamp_reftype.sql: new index on (timestamp, reference_type)
so the range scan narrows by time and reference_type filters inline.
- UserWalletRepositoryImpl:110: drop FORCE INDEX hint; let optimizer choose.
Updated comment to explain why.
Left PartnerCollectionPlanRepositoryImpl.getCommitmentCollectionSummary:117
untouched — that query drives from pcp → userwallet → userwallethistory and
the join has wallet_id = uw.id known at scan, so (wallet_id, timestamp) is
the right index there; FORCE INDEX remains appropriate. |
|
| 36323 |
15 d 1 h |
amit |
/trunk/profitmandi-dao/src/main/resources/ |
Fix app config |
|
| 36318 |
15 d 18 h |
aman |
/trunk/ |
Fix:Migrate legacy Purchase Return flow (Report + Bulk Create + Debit Notes) into FOFO |
|
| 36314 |
16 d 2 h |
amit |
/trunk/profitmandi-dao/src/main/ |
Fix Dummy warehouse creation defaults and backfill invoice receiveDate
- ensureDummyForBillingRegion: set isAvailabilityMonitored=0, transferDelayInHours=0,
source=0 explicitly; copy logisticsLocation and pincode from billing warehouse
(matches createVendorWarehouse pattern)
- Add SQL to backfill warehouse.invoice.receiveDate from warehouse.purchase.receivedOn
for received invoices where receiveDate is NULL |
|
| 36309 |
16 d 13 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 |
17 d 6 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 |
|
| 36105 |
36 d 18 h |
amit |
/trunk/profitmandi-dao/src/main/resources/ |
Remove SQL migration files from version control |
|
| 36103 |
36 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 |
|
| 36008 |
49 d 18 h |
aman |
/trunk/ |
Fix:Redesign the Po Approval page add total count, Add mail in bcc for testing , partnerpending task api response optimisation, |
|
| 35966 |
59 d 23 h |
amit |
/trunk/profitmandi-dao/src/main/resources/sql/ |
Add migration SQL for bulk order approval report menu and API access |
|