Subversion Repositories SmartDukaan

Rev

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

Rev 10287 Rev 10307
Line 293... Line 293...
293
	
293
	
294
	
294
	
295
	static{
295
	static{
296
		try {
296
		try {
297
			live = ConfigClient.getClient().get("sync_price_on_marketplace");
297
			live = ConfigClient.getClient().get("sync_price_on_marketplace");
298
			logger.info("Update_price_on_mp"+live);
-
 
299
		} catch (ConfigException e) {
298
		} catch (ConfigException e) {
300
		    logger.error("Unable to get parameter from the config service", e);
299
		    logger.error("Unable to get parameter from the config service", e);
301
		    live = "false";
300
		    live = "false";
302
		}
301
		}
303
	}
302
	}
Line 364... Line 363...
364
	public String update() throws NumberFormatException, TException, InventoryServiceException, CatalogServiceException, JSONException{
363
	public String update() throws NumberFormatException, TException, InventoryServiceException, CatalogServiceException, JSONException{
365
		Client catalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
364
		Client catalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
366
		//Client catalogClientProd = new CatalogClient().getClient();
365
		//Client catalogClientProd = new CatalogClient().getClient();
367
		Long timestamp = System.currentTimeMillis();
366
		Long timestamp = System.currentTimeMillis();
368
		SnapdealItem snapdealItem = catalogClient.getSnapdealItem(Long.valueOf(itemId));
367
		SnapdealItem snapdealItem = catalogClient.getSnapdealItem(Long.valueOf(itemId));
369
		Double oldPrice = snapdealItem.getSellingPrice(); 
368
		boolean toUpdate = false;
-
 
369
		if (snapdealItem.getSellingPrice()!=Double.valueOf(sellingPrice) || snapdealItem.isIsListedOnSnapdeal()!=Boolean.valueOf(isListedOnSnapdeal) || snapdealItem.isSuppressPriceFeed()!=Boolean.valueOf(isSuppressPriceFeed)){
-
 
370
			toUpdate=true;
-
 
371
		}
370
		Item item = catalogClient.getItem(Long.valueOf(itemId));
372
		Item item = catalogClient.getItem(Long.valueOf(itemId));
371
		MarketplacePercentage mpCosting = catalogClient.getCostingForMarketplace(7, Long.valueOf(itemId));
373
		MarketplacePercentage mpCosting = catalogClient.getCostingForMarketplace(7, Long.valueOf(itemId));
372
		if (mpCosting.getSource()==0){
374
		if (mpCosting.getSource()==0){
373
			throw new CatalogServiceException();
375
			throw new CatalogServiceException();
374
		}
376
		}
Line 418... Line 420...
418
 
420
 
419
		if (t_mpItem.getCurrentSp()< t_mpItem.getMinimumPossibleSp()){
421
		if (t_mpItem.getCurrentSp()< t_mpItem.getMinimumPossibleSp()){
420
			sendAlert(t_mpItem.getItemId(),t_mpItem.getCurrentSp(),t_mpItem.getMinimumPossibleSp());
422
			sendAlert(t_mpItem.getItemId(),t_mpItem.getCurrentSp(),t_mpItem.getMinimumPossibleSp());
421
		}
423
		}
422
		logger.info("\nUpdate Method Item Id "+itemId+"\nSelling Price "+sellingPrice+"\nWarehouse Id "+warehouseId+"\nMax Nlc "+maxNlc+"\nUpdated By: "+session.getAttribute(ReportsUtils.USER_NAME).toString());
424
		logger.info("\nUpdate Method Item Id "+itemId+"\nSelling Price "+sellingPrice+"\nWarehouse Id "+warehouseId+"\nMax Nlc "+maxNlc+"\nUpdated By: "+session.getAttribute(ReportsUtils.USER_NAME).toString());
423
		if(oldPrice!=Double.valueOf(sellingPrice) && Boolean.valueOf(live) && snapdealItem.isSuppressPriceFeed() && snapdealItem.isIsListedOnSnapdeal()){
425
		if(toUpdate && Boolean.valueOf(live) && (!snapdealItem.isSuppressPriceFeed()) && snapdealItem.isIsListedOnSnapdeal()){
424
			logger.info("Calling Method to update price at snapdeal");
426
			logger.info("Calling Method to update price at snapdeal");
425
			UpdateSDPricingUsingPanel updatePriceOnSnapdeal = new UpdateSDPricingUsingPanel(Float.valueOf(sellingPrice),supc,item,timestamp);
427
			UpdateSDPricingUsingPanel updatePriceOnSnapdeal = new UpdateSDPricingUsingPanel(Float.valueOf(sellingPrice),supc,item,timestamp);
426
			logger.info("Calling Thread to update price at snapdeal");
428
			logger.info("Calling Thread to update price at snapdeal");
427
			updatePriceOnSnapdeal.start();	
429
			updatePriceOnSnapdeal.start();	
428
		}
430
		}
Line 659... Line 661...
659
			throw new CatalogServiceException();
661
			throw new CatalogServiceException();
660
		}
662
		}
661
		if (t_mpItem.getCurrentSp()< t_mpItem.getMinimumPossibleSp()){
663
		if (t_mpItem.getCurrentSp()< t_mpItem.getMinimumPossibleSp()){
662
			sendAlert(t_mpItem.getItemId(),t_mpItem.getCurrentSp(),t_mpItem.getMinimumPossibleSp());
664
			sendAlert(t_mpItem.getItemId(),t_mpItem.getCurrentSp(),t_mpItem.getMinimumPossibleSp());
663
		}
665
		}
664
		if (Boolean.valueOf(live) && snapdealItem.isSuppressPriceFeed() && snapdealItem.isIsListedOnSnapdeal()){
666
		if (Boolean.valueOf(live) && (!snapdealItem.isSuppressPriceFeed()) && snapdealItem.isIsListedOnSnapdeal()){
665
			logger.info("Calling Method to update new item price at snapdeal");
667
			logger.info("Calling Method to update new item price at snapdeal");
666
			UpdateSDPricingUsingPanel updatePriceOnSnapdeal = new UpdateSDPricingUsingPanel(Float.valueOf(sellingPrice),supc,item,timestamp);
668
			UpdateSDPricingUsingPanel updatePriceOnSnapdeal = new UpdateSDPricingUsingPanel(Float.valueOf(sellingPrice),supc,item,timestamp);
667
			logger.info("Calling Thread to update new item price at snapdeal");
669
			logger.info("Calling Thread to update new item price at snapdeal");
668
			updatePriceOnSnapdeal.start();
670
			updatePriceOnSnapdeal.start();
669
		}
671
		}
Line 927... Line 929...
927
			sos.write(buffer);
929
			sos.write(buffer);
928
			sos.flush();
930
			sos.flush();
929
		} catch (IOException e) {
931
		} catch (IOException e) {
930
			System.out.println("Unable to stream the manifest file");
932
			System.out.println("Unable to stream the manifest file");
931
		}   
933
		}   
932
 
-
 
933
 
-
 
934
	}
934
	}
935
 
935
 
936
 
936
 
937
	public void uploadsnapdealBulkSheet() throws IOException, TException, NumberFormatException, InventoryServiceException, CatalogServiceException{
937
	public void uploadsnapdealBulkSheet() throws IOException, TException, NumberFormatException, InventoryServiceException, CatalogServiceException{
938
		File fileToCreate = new File("/tmp/", "Snapdeal-bulk-upload.xls");
938
		File fileToCreate = new File("/tmp/", "Snapdeal-bulk-upload.xls");