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
35466 127 d 7 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 127 d 15 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 127 d 15 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 127 d 16 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 127 d 17 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 127 d 17 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 127 d 17 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 127 d 23 h amit /trunk/ Revert non-Java file changes from r35458  
35458 127 d 23 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 128 d 0 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/fofo/ Fixed method thats not readonly  
35456 128 d 0 h amit /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/controller/ Fixed method thats not readonly  
35455 128 d 3 h ranu /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/controller/checkout/ order controller @Transaction roll back for current  
35454 128 d 4 h amit /trunk/ perf: Optimize N+1 queries and reduce stream iterations in today_po and today_po_rbm endpoints

MonitorController.java:
- Consolidate 12 stream ops on rbmArrViewModels into single loop
- Consolidate 6 stream ops on sold15daysOldAgingModels into single loop
- Consolidate 6 stream ops on weeklyBillingData into single loop
- Merge double iteration loops into single pass operations
- Replace containsKey+get patterns with computeIfAbsent/getOrDefault
- Add extractRbmNames() helper to eliminate duplicated stream operations

CsServiceImpl.java:
- Fix N+1 in getAuthUserIdAndAuthUserMap using batch selectByIds
- Fix N+1 in getTicketIdAndAuthUserMapUsingTickets using batch selectByIds
- Fix N+1 in getAuthUserIdAndAuthUserMapUsingPositions using batch selectByIds
- Fix N+1 in getCategoryIdAndCategoryUsingPositions using batch selectAll
- Fix N+1 in getRegionIdAndRegionMap using batch selectAll
- Fix N+1 in getAuthUserByPartnerId using batch selectByIds
- Fix double N+1 in getAuthUserAndEsclationTypeByPartnerId
- Fix N+1 in authUserpartnerIdMap using selectByPositionIds
- Fix N+1 in getAuthUserIdPartnerIdMappingByCatIds
- Fix N+1 in getAuthUserIdPartnerIdMapping

RbmTargetServiceImpl.java:
- Fix O(n*m) stream filter in getRbmTodayArr using pre-built lookup maps
- Fix O(n*m) stream filter in setMovementWiseRbmTargets using pre-built maps

today_po.vm:
- Optimize template lookups with single get instead of containsKey+get
 
35453 128 d 5 h amit /trunk/ Optimize /indent/today_po_rbm endpoint - reduce DB queries by ~99%

- Consolidate 5 weekly billing queries into 1 using SQL CASE statements
- Add RbmWeeklyBillingModel for consolidated weekly billing data
- Batch fetch partner collection remarks to avoid N+1 queries
- Batch fetch collection map for all fofoIds to avoid N+1 queries in nested loop
- Reduces ~1160 queries to ~10 queries for 50 RBMs
 
35452 128 d 7 h amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/ Fixed npe issue and performance issue  
35451 128 d 8 h amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/ Fixed  
35450 128 d 21 h amit /trunk/profitmandi-fofo/src/main/resources/META-INF/ Fixed  
35449 128 d 21 h amit /trunk/profitmandi-dao/src/main/resources/ Add missing think.walnut.digital.recharge.balance.url property to shared properties  
35448 128 d 21 h amit /trunk/profitmandi-web/src/main/resources/META-INF/ Add missing think.walnut.digital.recharge.balance.url property to all environments  
35447 129 d 0 h amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Fix N+1 query in refundDnAmount() - batch fetch TagListings  

Show All