Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Show changed files | Directory listing | RSS feed

Filtering Options

Rev Age Author Path Log message Diff
35476 122 d 21 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/model/ Optimize Aging.15DaysOurStock query for better performance

- Restructured query to start from invoice table with sargable date filter
- Changed DATEDIFF(now(), inv.invoiceDate) > 15 to inv.invoiceDate < DATE_SUB(CURDATE(), INTERVAL 15 DAY)
- Reordered JOINs for better query execution plan
- Allows MySQL to use index on invoiceDate for initial filtering

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
 
35475 122 d 22 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 122 d 22 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 122 d 22 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  
35472 122 d 23 h vikas /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/dtr/ Leads Follow ups  
35471 123 d 1 h vikas /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/dtr/ Leads Follow ups  
35470 123 d 3 h vikas /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/dtr/ Leads Follow ups  
35469 123 d 3 h vikas /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/controller/ Leads Follow ups  
35468 123 d 3 h vikas /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/dtr/ Leads Follow ups  
35467 123 d 4 h amit /trunk/ Optimize /lead-description endpoint

- Add null check for authUser to prevent NPE
- Move visitRequests query inside followUp block
- Move Comparator outside loop
- Rewrite selectLeadsScheduledBetweenDate using Criteria API with Predicates
- Single query joins Lead + LeadActivity with filters in DB
- Remove in-memory filtering of assignTo
 
35466 123 d 10 h amit /trunk/ Optimize getActivatedImeiUpdationDate endpoint

- Add 30-day date filter to reduce table scan
- Replace LineItemImeiView with direct LineItemImei table
- Merge results with master brands/warehouses to show all combinations
- Display '-' for missing timestamps instead of hiding rows
 
35465 123 d 18 h amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/monitors/ Optimize today_po_rbm: single-pass iteration for warehouseWalletAmountModels

- Replace two separate stream operations with single loop
- Use EnumSet for efficient WalletReferenceType lookup
- Use Map.merge() for cleaner aggregation
 
35464 123 d 18 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/ Optimize /getActivatedModelByBrand and related activation queries

- Add date range filtering in WHERE clause to use activation_timestamp index
- Replace concat(year,month) with direct date comparisons for better performance
- Optimize getAuthFofoIds to avoid unnecessary DB call when user found in cache
- Use anyMatch() instead of filter().count() for short-circuit evaluation
 
35463 123 d 19 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/ Optimize /getMobileBrandWise and /getMobileLMSGraph queries

- Replace concat(year(), month()) pattern with date range comparisons
- Enables index usage on create_timestamp and activation_timestamp columns
- Update repository methods to pass date range parameters instead of string patterns
 
35462 123 d 20 h amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/ Fix LockAcquisitionException: Use bulk partner type fetch in controllers

Use getTypesForFofoIds() bulk method to avoid N+1 queries in:
- IndentController
- PlacementPlanController
- OrderManagementController
 
35461 123 d 20 h amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Fix LockAcquisitionException: Use bulk partner type fetch in ScheduledTasks

Use getTypesForFofoIds() bulk method in rollOutUpgardedMargins to avoid N+1 queries
 
35460 123 d 20 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Fix LockAcquisitionException: Add bulk partner type fetch with MAX(base, current_sales) logic

Problem:
- N+1 queries calling getTypeOnDate caused concurrent persist operations
- This led to LockAcquisitionException during high concurrency

Solution:
- Add getTypesForFofoIds() bulk read method for N+1 scenarios
- Add getBaseTypesForFofoIds() to fetch base types (first record of month)
- Implement MAX(base, current_sales) logic:
- Partner can upgrade mid-month based on current sales
- Partner can downgrade from upgrade but NOT below base
- Base type = previous month's sales tier
- Reduce cache from 1 day to 30 minutes for faster upgrade propagation
 
35459 124 d 2 h amit /trunk/ Revert non-Java file changes from r35458  
35458 124 d 2 h amit /trunk/ Revert @Transactional(readOnly=true) - keep @Transactional only at Controller level

Changes:
- profitmandi-web: Controllers use @Transactional(rollbackFor = Throwable.class) at class level, removed method-level @Transactional(readOnly = true)
- profitmandi-fofo: Controllers use @Transactional(rollbackFor = Throwable.class) at class level, removed method-level @Transactional
- profitmandi-dao: Removed @Transactional from services/repositories

Exceptions (called from interceptors, need own transaction):
- RoleManager: @Transactional(readOnly = true) - called from interceptor for auth
- PartnerTypeChangeServiceImpl.getBestPartner(): @Transactional - called from JWTUtil via interceptor

Fixed javax.transaction.Transactional to org.springframework.transaction.annotation.Transactional
Fixed rollbackOn to rollbackFor for Spring compatibility
 
35457 124 d 3 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/fofo/ Fixed method thats not readonly  

Show All