Subversion Repositories SmartDukaan

Rev

Rev 28823 | Rev 28845 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 28823 Rev 28840
Line 42... Line 42...
42
import com.smartdukaan.cron.scheduled.SamsungIMEIActivationService;
42
import com.smartdukaan.cron.scheduled.SamsungIMEIActivationService;
43
import com.smartdukaan.cron.scheduled.ScheduledTasks;
43
import com.smartdukaan.cron.scheduled.ScheduledTasks;
44
import com.spice.profitmandi.common.enumuration.ItemType;
44
import com.spice.profitmandi.common.enumuration.ItemType;
45
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
45
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
46
import com.spice.profitmandi.common.model.CustomRetailer;
46
import com.spice.profitmandi.common.model.CustomRetailer;
-
 
47
import com.spice.profitmandi.common.model.ProfitMandiConstants;
47
import com.spice.profitmandi.common.util.FileUtil;
48
import com.spice.profitmandi.common.util.FileUtil;
48
import com.spice.profitmandi.common.util.FormattingUtils;
49
import com.spice.profitmandi.common.util.FormattingUtils;
49
import com.spice.profitmandi.common.util.Utils;
50
import com.spice.profitmandi.common.util.Utils;
50
import com.spice.profitmandi.dao.entity.catalog.Item;
51
import com.spice.profitmandi.dao.entity.catalog.Item;
51
import com.spice.profitmandi.dao.entity.catalog.Offer;
52
import com.spice.profitmandi.dao.entity.catalog.Offer;
Line 79... Line 80...
79
import com.spice.profitmandi.dao.entity.transaction.SellerWarehouse;
80
import com.spice.profitmandi.dao.entity.transaction.SellerWarehouse;
80
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
81
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
81
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
82
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
82
import com.spice.profitmandi.dao.entity.user.Address;
83
import com.spice.profitmandi.dao.entity.user.Address;
83
import com.spice.profitmandi.dao.entity.user.User;
84
import com.spice.profitmandi.dao.entity.user.User;
-
 
85
import com.spice.profitmandi.dao.entity.warehouse.BrandRegionMapping;
84
import com.spice.profitmandi.dao.entity.warehouse.WarehouseInventoryItem;
86
import com.spice.profitmandi.dao.entity.warehouse.WarehouseInventoryItem;
85
import com.spice.profitmandi.dao.entity.warehouse.WarehouseScan;
87
import com.spice.profitmandi.dao.entity.warehouse.WarehouseScan;
86
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
88
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
87
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
89
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
88
import com.spice.profitmandi.dao.enumuration.dtr.PaymentOptionReferenceType;
90
import com.spice.profitmandi.dao.enumuration.dtr.PaymentOptionReferenceType;
Line 128... Line 130...
128
import com.spice.profitmandi.dao.repository.transaction.SellerWarehouseRepository;
130
import com.spice.profitmandi.dao.repository.transaction.SellerWarehouseRepository;
129
import com.spice.profitmandi.dao.repository.transaction.UserWalletHistoryRepository;
131
import com.spice.profitmandi.dao.repository.transaction.UserWalletHistoryRepository;
130
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
132
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
131
import com.spice.profitmandi.dao.repository.user.AddressRepository;
133
import com.spice.profitmandi.dao.repository.user.AddressRepository;
132
import com.spice.profitmandi.dao.repository.user.UserRepository;
134
import com.spice.profitmandi.dao.repository.user.UserRepository;
-
 
135
import com.spice.profitmandi.dao.repository.warehouse.BrandRegionMappingRepository;
133
import com.spice.profitmandi.dao.repository.warehouse.WarehouseInventoryItemRepository;
136
import com.spice.profitmandi.dao.repository.warehouse.WarehouseInventoryItemRepository;
134
import com.spice.profitmandi.dao.repository.warehouse.WarehouseScanRepository;
137
import com.spice.profitmandi.dao.repository.warehouse.WarehouseScanRepository;
135
import com.spice.profitmandi.service.inventory.InventoryService;
138
import com.spice.profitmandi.service.inventory.InventoryService;
136
import com.spice.profitmandi.service.inventory.PurchaseService;
139
import com.spice.profitmandi.service.inventory.PurchaseService;
137
import com.spice.profitmandi.service.inventory.SaholicInventoryService;
140
import com.spice.profitmandi.service.inventory.SaholicInventoryService;
Line 1492... Line 1495...
1492
				partnerDailyInvestmentRepository.persist(partnerDailyInvestment);
1495
				partnerDailyInvestmentRepository.persist(partnerDailyInvestment);
1493
			}
1496
			}
1494
		}
1497
		}
1495
	}
1498
	}
1496
 
1499
 
-
 
1500
	@Autowired
-
 
1501
	BrandRegionMappingRepository brandRegionMappingRepository;
-
 
1502
	public void brandRegion() {
-
 
1503
		Set<Integer> warehouseIds = ProfitMandiConstants.WAREHOUSE_MAP.keySet();
-
 
1504
		Map<String, Map<Boolean, List<BrandRegionMapping>>> mapping = brandRegionMappingRepository.selectAll().stream().collect(
-
 
1505
				Collectors.groupingBy(BrandRegionMapping::getBrand, Collectors.collectingAndThen(Collectors.toList(), x->x.stream().collect(Collectors.groupingBy(BrandRegionMapping::isAccessory)))));
-
 
1506
		for(Map.Entry<String, Map<Boolean,List<BrandRegionMapping>>> entry : mapping.entrySet()) {
-
 
1507
			String brand = entry.getKey();
-
 
1508
			for(Map.Entry<Boolean, List<BrandRegionMapping>> isAccessoryEntry: entry.getValue().entrySet()) {
-
 
1509
				boolean isAccessory = isAccessoryEntry.getKey();
-
 
1510
				Map<Integer, List<Integer>> warehouseToIdsMap = isAccessoryEntry.getValue().stream().collect(Collectors.groupingBy(
-
 
1511
						BrandRegionMapping::getToWarehouseId, Collectors.mapping(BrandRegionMapping::getFromWarehouseId, Collectors.toList())));
-
 
1512
				for(int warehouseIdTo : warehouseIds) {
-
 
1513
					List<Integer> warehouseIdsFrom = warehouseToIdsMap.get(warehouseIdTo);
-
 
1514
						if(!warehouseIdsFrom.contains(warehouseIdTo)) {
-
 
1515
							LOGGER.info("Missing entries for brand region mapping = {}, {}, {}", brand, isAccessory, warehouseIdTo);
-
 
1516
							/*
-
 
1517
							 * BrandRegionMapping brandRegionMapping = new BrandRegionMapping();
-
 
1518
							 * brandRegionMapping.setAccessory(isAccessory);
-
 
1519
							 * brandRegionMapping.setBrand(brand);
-
 
1520
							 * brandRegionMapping.setFromWarehouseId(warehouseIdTo);
-
 
1521
							 * brandRegionMapping.setToWarehouseId(warehouseIdTo);
-
 
1522
							 * brandRegionMappingRepository.persist(brandRegionMapping);
-
 
1523
							 */
-
 
1524
					}
-
 
1525
				}
-
 
1526
			}
-
 
1527
		}
-
 
1528
	}
-
 
1529
 
1497
}
1530
}
1498
 
1531
 
1499
//7015845171
1532
//7015845171
1500
1533