Subversion Repositories SmartDukaan

Rev

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

Rev 12459 Rev 12661
Line 68... Line 68...
68
import in.shop2020.feeds.products.Listings;
68
import in.shop2020.feeds.products.Listings;
69
import in.shop2020.feeds.products.OverrideCurrencyAmount;
69
import in.shop2020.feeds.products.OverrideCurrencyAmount;
70
import in.shop2020.feeds.products.Price;
70
import in.shop2020.feeds.products.Price;
71
import in.shop2020.feeds.products.Product;
71
import in.shop2020.feeds.products.Product;
72
import in.shop2020.feeds.products.StandardProductID;
72
import in.shop2020.feeds.products.StandardProductID;
-
 
73
import in.shop2020.feeds.products.Price.Sale;
73
import in.shop2020.model.v1.catalog.CatalogService.Client;
74
import in.shop2020.model.v1.catalog.CatalogService.Client;
74
import in.shop2020.model.v1.catalog.CatalogServiceException;
75
import in.shop2020.model.v1.catalog.CatalogServiceException;
75
import in.shop2020.model.v1.catalog.Item;
76
import in.shop2020.model.v1.catalog.Item;
76
import in.shop2020.model.v1.inventory.InventoryServiceException;
77
import in.shop2020.model.v1.inventory.InventoryServiceException;
77
import in.shop2020.model.v1.inventory.ItemInventory;
78
import in.shop2020.model.v1.inventory.ItemInventory;
Line 455... Line 456...
455
				Thread.sleep(60000);
456
				Thread.sleep(60000);
456
			}
457
			}
457
		}
458
		}
458
	}
459
	}
459
 
460
 
-
 
461
	public static long getTimeInMilliseconds(){
-
 
462
        Calendar cal=GregorianCalendar.getInstance();
-
 
463
        return Long.valueOf(cal.getTimeInMillis());
460
 
464
    }
461
 
465
 
462
	public static void createFBAPricingFeed() throws CatalogServiceException, TException{
466
	public static void createFBAPricingFeed() throws CatalogServiceException, TException{
463
 
467
 
464
 
468
 
465
		File file = new File(AMAZON_FBA_PRICING_XML);
469
		File file = new File(AMAZON_FBA_PRICING_XML);
Line 511... Line 515...
511
				overridecurrencyamount.setCurrency(BaseCurrencyCodeWithDefault.DEFAULT);
515
				overridecurrencyamount.setCurrency(BaseCurrencyCodeWithDefault.DEFAULT);
512
				overridecurrencyamount.setValue(BigDecimal.valueOf(AItem.getFbaPrice()));
516
				overridecurrencyamount.setValue(BigDecimal.valueOf(AItem.getFbaPrice()));
513
				price.setStandardPrice(overridecurrencyamount);
517
				price.setStandardPrice(overridecurrencyamount);
514
				Random rand = new Random();
518
				Random rand = new Random();
515
				message.setMessageID(BigInteger.valueOf(Math.abs(rand.nextInt())));
519
				message.setMessageID(BigInteger.valueOf(Math.abs(rand.nextInt())));
-
 
520
				if (AItem.isIsFbaPromotionActive() && (AItem.getFbaPromoStartDate()<=getTimeInMilliseconds() && AItem.getFbaPromoEndDate()>=getTimeInMilliseconds())){
-
 
521
                    Sale sale = new Sale();
-
 
522
                    OverrideCurrencyAmount overridesaleamount = new OverrideCurrencyAmount();
-
 
523
                    overridesaleamount.setCurrency(BaseCurrencyCodeWithDefault.DEFAULT);
-
 
524
                    overridesaleamount.setValue(BigDecimal.valueOf(AItem.getFbaPromoPrice()));
-
 
525
                    sale.setSalePrice(overridesaleamount);
-
 
526
                    XMLGregorianCalendar startDate = null;
-
 
527
                    XMLGregorianCalendar endDate = null;
-
 
528
                    try {
-
 
529
                        GregorianCalendar calendar = new GregorianCalendar();
-
 
530
                        calendar.setTimeInMillis(AItem.getFbaPromoStartDate());
-
 
531
                        startDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(
-
 
532
                                calendar);
-
 
533
                        calendar.setTimeInMillis(AItem.getFbaPromoEndDate());
-
 
534
                        endDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(
-
 
535
                                calendar);
-
 
536
                    } catch (DatatypeConfigurationException e) {
-
 
537
                        e.printStackTrace();
-
 
538
                        continue;
-
 
539
                    }
-
 
540
                    sale.setStartDate(startDate);
-
 
541
                    sale.setEndDate(endDate);
-
 
542
                    price.setSale(sale);
-
 
543
                }
516
				message.setPrice(price);
544
				message.setPrice(price);
517
				message.setOperationType("Update");
545
				message.setOperationType("Update");
518
				messages.add(message);
546
				messages.add(message);
519
				itemIdsToUpdate.add(AItem.getItemid());
547
				itemIdsToUpdate.add(AItem.getItemid());
520
				count++;
548
				count++;