| Line 29... |
Line 29... |
| 29 |
|
29 |
|
| 30 |
|
30 |
|
| 31 |
|
31 |
|
| 32 |
public class CreateSubmitFlipkartPricingFeed {
|
32 |
public class CreateSubmitFlipkartPricingFeed {
|
| 33 |
private static long time = System.currentTimeMillis();
|
33 |
private static long time = System.currentTimeMillis();
|
| 34 |
private static List<MarketPlaceItemPrice> flipkartPricingItems;
|
34 |
private static List<MarketPlaceItemPrice> flipkartPricingItems = new ArrayList<MarketPlaceItemPrice>();
|
| 35 |
private static Map<Long,Item> aliveItemsMap = new HashMap<Long,Item>();
|
35 |
private static Map<Long,Item> aliveItemsMap = new HashMap<Long,Item>();
|
| 36 |
private static Map<Long,FlipkartItem> flipkartItemsMap = new HashMap<Long,FlipkartItem>();
|
36 |
private static Map<Long,FlipkartItem> flipkartItemsMap = new HashMap<Long,FlipkartItem>();
|
| 37 |
static List<Long> updatedItems = new ArrayList<Long>();
|
37 |
static List<Long> updatedItems = new ArrayList<Long>();
|
| 38 |
static java.text.SimpleDateFormat sdf;
|
38 |
static java.text.SimpleDateFormat sdf;
|
| 39 |
static String emailFromAddress;
|
39 |
static String emailFromAddress;
|
| 40 |
static String password;
|
40 |
static String password;
|
| 41 |
static GmailUtils mailer;
|
41 |
static GmailUtils mailer;
|
| 42 |
static String sendTo[];
|
42 |
static String sendTo[];
|
| - |
|
43 |
private static List<MarketPlaceItemPrice> flipkartPricingUpdateItems;
|
| 43 |
static
|
44 |
static
|
| 44 |
{
|
45 |
{
|
| 45 |
sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
|
46 |
sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
|
| 46 |
emailFromAddress = "build@shop2020.in";
|
47 |
emailFromAddress = "build@shop2020.in";
|
| 47 |
password = "cafe@nes";
|
48 |
password = "cafe@nes";
|
| Line 57... |
Line 58... |
| 57 |
} catch (TTransportException e) {
|
58 |
} catch (TTransportException e) {
|
| 58 |
e.printStackTrace();
|
59 |
e.printStackTrace();
|
| 59 |
}
|
60 |
}
|
| 60 |
try {
|
61 |
try {
|
| 61 |
time = System.currentTimeMillis();
|
62 |
time = System.currentTimeMillis();
|
| 62 |
flipkartPricingItems = catalogServiceClient.getMarketPlaceItemsForPriceUpdate(8);
|
63 |
flipkartPricingUpdateItems = catalogServiceClient.getMarketPlaceItemsForPriceUpdate(8);
|
| - |
|
64 |
for(MarketPlaceItemPrice flipkartPricingUpdateItem:flipkartPricingUpdateItems){
|
| - |
|
65 |
if(flipkartPricingUpdateItem.getLastUpdatedOn() > flipkartPricingUpdateItem.getLastUpdatedOnMarketplace() && !flipkartPricingUpdateItem.isIsPriceOverride() && flipkartPricingUpdateItem.isIsListedOnSource() && flipkartPricingUpdateItem.getSellingPrice()!=0){
|
| - |
|
66 |
flipkartPricingItems.add(flipkartPricingUpdateItem);
|
| - |
|
67 |
}
|
| - |
|
68 |
}
|
| 63 |
List<FlipkartItem> flipkartItems = null;
|
69 |
List<FlipkartItem> flipkartItems = null;
|
| 64 |
boolean retry = true;
|
70 |
boolean retry = true;
|
| 65 |
while(retry){
|
71 |
while(retry){
|
| 66 |
try{
|
72 |
try{
|
| 67 |
flipkartItems = catalogServiceClient.getAllFlipkartItems();
|
73 |
flipkartItems = catalogServiceClient.getAllFlipkartItems();
|
| Line 130... |
Line 136... |
| 130 |
+"</tr>";
|
136 |
+"</tr>";
|
| 131 |
String tableFooter = "</table></html>";
|
137 |
String tableFooter = "</table></html>";
|
| 132 |
Item item;
|
138 |
Item item;
|
| 133 |
StringBuffer feedResponse = null;
|
139 |
StringBuffer feedResponse = null;
|
| 134 |
for(MarketPlaceItemPrice entry:flipkartPricingItems){
|
140 |
for(MarketPlaceItemPrice entry:flipkartPricingItems){
|
| 135 |
if(!(entry.getLastUpdatedOn() > entry.getLastUpdatedOnMarketplace() && !entry.isIsPriceOverride() && entry.isIsListedOnSource() && entry.getSellingPrice()!=0)){
|
- |
|
| 136 |
continue;
|
- |
|
| 137 |
}
|
- |
|
| 138 |
updatedItems.add(entry.getItem_id());
|
141 |
updatedItems.add(entry.getItem_id());
|
| 139 |
feedResponse= new StringBuffer();
|
142 |
feedResponse= new StringBuffer();
|
| 140 |
item = aliveItemsMap.get(entry.getItem_id());
|
143 |
item = aliveItemsMap.get(entry.getItem_id());
|
| 141 |
System.out.println("Item ID " + entry.getItem_id());
|
144 |
System.out.println("Item ID " + entry.getItem_id());
|
| 142 |
System.out.println("Product Name " + getProductName(item));
|
145 |
System.out.println("Product Name " + getProductName(item));
|