Subversion Repositories SmartDukaan

Rev

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

Rev 27950 Rev 28038
Line 47... Line 47...
47
import com.spice.profitmandi.common.util.FormattingUtils;
47
import com.spice.profitmandi.common.util.FormattingUtils;
48
import com.spice.profitmandi.common.util.Utils;
48
import com.spice.profitmandi.common.util.Utils;
49
import com.spice.profitmandi.dao.entity.catalog.Item;
49
import com.spice.profitmandi.dao.entity.catalog.Item;
50
import com.spice.profitmandi.dao.entity.catalog.Scheme;
50
import com.spice.profitmandi.dao.entity.catalog.Scheme;
51
import com.spice.profitmandi.dao.entity.catalog.TagListing;
51
import com.spice.profitmandi.dao.entity.catalog.TagListing;
52
import com.spice.profitmandi.dao.entity.catalog.TargetSlab;
-
 
53
import com.spice.profitmandi.dao.entity.dtr.PaymentOptionTransaction;
52
import com.spice.profitmandi.dao.entity.dtr.PaymentOptionTransaction;
54
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
53
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
55
import com.spice.profitmandi.dao.entity.fofo.DebitNote;
54
import com.spice.profitmandi.dao.entity.fofo.DebitNote;
56
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
55
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
57
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
56
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
Line 74... Line 73...
74
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
73
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
75
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
74
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
76
import com.spice.profitmandi.dao.entity.user.Address;
75
import com.spice.profitmandi.dao.entity.user.Address;
77
import com.spice.profitmandi.dao.entity.user.User;
76
import com.spice.profitmandi.dao.entity.user.User;
78
import com.spice.profitmandi.dao.entity.warehouse.WarehouseInventoryItem;
77
import com.spice.profitmandi.dao.entity.warehouse.WarehouseInventoryItem;
-
 
78
import com.spice.profitmandi.dao.entity.warehouse.WarehouseScan;
79
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
79
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
80
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
80
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
81
import com.spice.profitmandi.dao.enumuration.dtr.PaymentOptionReferenceType;
81
import com.spice.profitmandi.dao.enumuration.dtr.PaymentOptionReferenceType;
82
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
82
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
83
import com.spice.profitmandi.dao.model.ContentPojo;
83
import com.spice.profitmandi.dao.model.ContentPojo;
Line 117... Line 117...
117
import com.spice.profitmandi.dao.repository.transaction.UserWalletHistoryRepository;
117
import com.spice.profitmandi.dao.repository.transaction.UserWalletHistoryRepository;
118
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
118
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
119
import com.spice.profitmandi.dao.repository.user.AddressRepository;
119
import com.spice.profitmandi.dao.repository.user.AddressRepository;
120
import com.spice.profitmandi.dao.repository.user.UserRepository;
120
import com.spice.profitmandi.dao.repository.user.UserRepository;
121
import com.spice.profitmandi.dao.repository.warehouse.WarehouseInventoryItemRepository;
121
import com.spice.profitmandi.dao.repository.warehouse.WarehouseInventoryItemRepository;
-
 
122
import com.spice.profitmandi.dao.repository.warehouse.WarehouseScanRepository;
122
import com.spice.profitmandi.service.inventory.InventoryService;
123
import com.spice.profitmandi.service.inventory.InventoryService;
123
import com.spice.profitmandi.service.inventory.PurchaseService;
124
import com.spice.profitmandi.service.inventory.PurchaseService;
124
import com.spice.profitmandi.service.offers.OfferService;
125
import com.spice.profitmandi.service.offers.OfferService;
125
import com.spice.profitmandi.service.order.OrderService;
126
import com.spice.profitmandi.service.order.OrderService;
126
import com.spice.profitmandi.service.pricing.PriceDropService;
127
import com.spice.profitmandi.service.pricing.PriceDropService;
Line 137... Line 138...
137
 
138
 
138
@Component
139
@Component
139
@Transactional(rollbackFor = Throwable.class)
140
@Transactional(rollbackFor = Throwable.class)
140
public class RunOnceTasks {
141
public class RunOnceTasks {
141
 
142
 
142
	private static final Logger LOGGER = LogManager.getLogger(RunOnceTasks.class);
-
 
143
 
143
 
-
 
144
	private static final Logger LOGGER = LogManager.getLogger(RunOnceTasks.class);
144
	@Autowired
145
	@Autowired
145
	private LineItemRepository lineItemRepository;
146
	private LineItemRepository lineItemRepository;
146
 
147
 
147
	@Autowired
148
	@Autowired
148
	private LeadRepository leadRepository;
149
	private LeadRepository leadRepository;
Line 1300... Line 1301...
1300
			createOfferRequest.getTargetSlabs().stream();
1301
			createOfferRequest.getTargetSlabs().stream();
1301
			offerService.addOfferService(createOfferRequest);
1302
			offerService.addOfferService(createOfferRequest);
1302
		}
1303
		}
1303
	}
1304
	}
1304
 
1305
 
-
 
1306
	
-
 
1307
	@Autowired
-
 
1308
	private WarehouseScanRepository warehouseScanRepository;
-
 
1309
	public void fixScans() {
-
 
1310
		Map<Integer, Integer> inventoryOrderMap = new HashMap<>();
-
 
1311
		inventoryOrderMap.put(348795,1628598);
-
 
1312
		inventoryOrderMap.put(348796,1628599);
-
 
1313
		inventoryOrderMap.put(329854,1628600);
-
 
1314
		inventoryOrderMap.put(334197,1628602);
-
 
1315
		inventoryOrderMap.put(330110,1628603);
-
 
1316
		inventoryOrderMap.put(330111,1628604);
-
 
1317
		inventoryOrderMap.put(332843,1628605);
-
 
1318
		inventoryOrderMap.put(338067,1628606);
-
 
1319
		inventoryOrderMap.put(338974,1628609);
-
 
1320
		inventoryOrderMap.put(338975,1628610);
-
 
1321
		inventoryOrderMap.put(338971,1628612);
-
 
1322
		inventoryOrderMap.put(338588,1628615);
-
 
1323
		inventoryOrderMap.put(368205,1631619);
-
 
1324
		inventoryOrderMap.put(368206,1631620);
-
 
1325
		inventoryOrderMap.put(368207,1631621);
-
 
1326
		inventoryOrderMap.put(368208,1631622);
-
 
1327
		inventoryOrderMap.put(368209,1631623);
-
 
1328
		inventoryOrderMap.put(368211,1631625);
-
 
1329
		inventoryOrderMap.put(368213,1631627);
-
 
1330
		inventoryOrderMap.put(368214,1631628);
-
 
1331
		inventoryOrderMap.put(368203,1631629);
-
 
1332
		inventoryOrderMap.put(368216,1631630);
-
 
1333
		inventoryOrderMap.put(368217,1631631);
-
 
1334
		inventoryOrderMap.put(368218,1631632);
-
 
1335
		inventoryOrderMap.put(368219,1631633);
-
 
1336
		inventoryOrderMap.put(368222,1631635);
-
 
1337
		List<WarehouseScan> scans = warehouseScanRepository.selectAllByInventoryItemIds(new ArrayList<>(inventoryOrderMap.values()));
-
 
1338
		Map<Integer, List<WarehouseScan>> inventoryScansMap = scans.stream().collect(Collectors.groupingBy(WarehouseScan::getInventoryItemId, Collectors.toList()));
-
 
1339
		
-
 
1340
		for(Map.Entry<Integer, List<WarehouseScan>> mapEntry : inventoryScansMap.entrySet()) {
-
 
1341
			int inventoryItemId = mapEntry.getKey();
-
 
1342
			List<WarehouseScan> duplicateScans = mapEntry.getValue().stream().filter(x->x.getOrderId()==inventoryOrderMap.get(inventoryItemId)).collect(Collectors.toList());
-
 
1343
			WarehouseScan duplicateScan = duplicateScans.stream().findFirst().get();
-
 
1344
			LOGGER.info("Duplicate Scan {}", duplicateScan);
-
 
1345
		}
-
 
1346
		
-
 
1347
	}
-
 
1348
 
1305
}
1349
}
1306
 
1350
 
1307
//7015845171
1351
//7015845171
1308
1352