| Line 5... |
Line 5... |
| 5 |
import in.shop2020.logistics.LogisticsServiceException;
|
5 |
import in.shop2020.logistics.LogisticsServiceException;
|
| 6 |
import in.shop2020.model.v1.catalog.CatalogService.Client;
|
6 |
import in.shop2020.model.v1.catalog.CatalogService.Client;
|
| 7 |
import in.shop2020.model.v1.catalog.FlipkartItem;
|
7 |
import in.shop2020.model.v1.catalog.FlipkartItem;
|
| 8 |
import in.shop2020.model.v1.catalog.Item;
|
8 |
import in.shop2020.model.v1.catalog.Item;
|
| 9 |
import in.shop2020.model.v1.catalog.status;
|
9 |
import in.shop2020.model.v1.catalog.status;
|
| - |
|
10 |
import in.shop2020.model.v1.inventory.FlipkartInventorySnapshot;
|
| 10 |
import in.shop2020.model.v1.inventory.InventoryType;
|
11 |
import in.shop2020.model.v1.inventory.InventoryType;
|
| 11 |
import in.shop2020.model.v1.inventory.ItemInventory;
|
12 |
import in.shop2020.model.v1.inventory.ItemInventory;
|
| 12 |
import in.shop2020.model.v1.inventory.Warehouse;
|
13 |
import in.shop2020.model.v1.inventory.Warehouse;
|
| 13 |
import in.shop2020.model.v1.inventory.WarehouseLocation;
|
14 |
import in.shop2020.model.v1.inventory.WarehouseLocation;
|
| 14 |
import in.shop2020.model.v1.inventory.WarehouseType;
|
15 |
import in.shop2020.model.v1.inventory.WarehouseType;
|
| Line 58... |
Line 59... |
| 58 |
private static Map<Long, FlipkartInventoryItem> flipkartItemsInventoryMap = new HashMap<Long, FlipkartInventoryItem>();
|
59 |
private static Map<Long, FlipkartInventoryItem> flipkartItemsInventoryMap = new HashMap<Long, FlipkartInventoryItem>();
|
| 59 |
private static List<FlipkartItem> flipkartItems;
|
60 |
private static List<FlipkartItem> flipkartItems;
|
| 60 |
private static List<FlipkartItem> flipkartInventoryItems = new ArrayList<FlipkartItem>();
|
61 |
private static List<FlipkartItem> flipkartInventoryItems = new ArrayList<FlipkartItem>();
|
| 61 |
private static Map<Long,Long> itemIdOrdersMap = new HashMap<Long,Long>();
|
62 |
private static Map<Long,Long> itemIdOrdersMap = new HashMap<Long,Long>();
|
| 62 |
private static Map<Long,Item> aliveItemsMap = new HashMap<Long,Item>();
|
63 |
private static Map<Long,Item> aliveItemsMap = new HashMap<Long,Item>();
|
| - |
|
64 |
private static Map<Long,Long> heldOrdersMap = new HashMap<Long,Long>();
|
| 63 |
static java.text.SimpleDateFormat sdf;
|
65 |
static java.text.SimpleDateFormat sdf;
|
| 64 |
static String emailFromAddress;
|
66 |
static String emailFromAddress;
|
| 65 |
static String password;
|
67 |
static String password;
|
| 66 |
static GmailUtils mailer;
|
68 |
static GmailUtils mailer;
|
| 67 |
static String sendTo[];
|
69 |
static String sendTo[];
|
| Line 69... |
Line 71... |
| 69 |
{
|
71 |
{
|
| 70 |
sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
|
72 |
sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
|
| 71 |
emailFromAddress = "build@shop2020.in";
|
73 |
emailFromAddress = "build@shop2020.in";
|
| 72 |
password = "cafe@nes";
|
74 |
password = "cafe@nes";
|
| 73 |
mailer = new GmailUtils();
|
75 |
mailer = new GmailUtils();
|
| 74 |
//sendTo = new String[]{"vikram.raghav@shop2020.in"};
|
76 |
sendTo = new String[]{"vikram.raghav@shop2020.in"};
|
| 75 |
sendTo = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
|
77 |
/*sendTo = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
|
| 76 |
"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
|
78 |
"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
|
| 77 |
"yukti.jain@shop2020.in","manoj.pal@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
|
79 |
"yukti.jain@shop2020.in","manoj.pal@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
|
| 78 |
List<String> flipkartorderids = null;
|
80 |
*/List<String> flipkartorderids = null;
|
| 79 |
Client catalogServiceClient = null;
|
81 |
Client catalogServiceClient = null;
|
| 80 |
try {
|
82 |
try {
|
| 81 |
catalogServiceClient = new CatalogClient().getClient();
|
83 |
catalogServiceClient = new CatalogClient().getClient();
|
| 82 |
} catch (TTransportException e) {
|
84 |
} catch (TTransportException e) {
|
| 83 |
e.printStackTrace();
|
85 |
e.printStackTrace();
|
| 84 |
}
|
86 |
}
|
| 85 |
try {
|
87 |
try {
|
| 86 |
flipkartItems = catalogServiceClient.getAllFlipkartItems();
|
88 |
flipkartItems = catalogServiceClient.getAllFlipkartItems();
|
| 87 |
} catch (TException e) {
|
89 |
} catch (TException e) {
|
| 88 |
e.printStackTrace();
|
90 |
e.printStackTrace();
|
| 89 |
}
|
91 |
}
|
| 90 |
for(FlipkartItem flipkartItem:flipkartItems){
|
92 |
for(FlipkartItem flipkartItem:flipkartItems){
|
| 91 |
if(flipkartItem.isIsListedOnFlipkart() && !flipkartItem.isSuppressInventoryFeed())
|
93 |
if(flipkartItem.isIsListedOnFlipkart() && !flipkartItem.isSuppressInventoryFeed())
|
| 92 |
flipkartInventoryItems.add(flipkartItem);
|
94 |
flipkartInventoryItems.add(flipkartItem);
|
| 93 |
}
|
95 |
}
|
| 94 |
if(flipkartInventoryItems.size()==0){
|
96 |
if(flipkartInventoryItems.size()==0){
|
| 95 |
String text = "";
|
97 |
String text = "";
|
| 96 |
try {
|
98 |
try {
|
| 97 |
mailer.sendSSLMessage(sendTo,"No items to send inventory ", emailFromAddress, password, text);
|
99 |
mailer.sendSSLMessage(sendTo,"No items to send inventory ", emailFromAddress, password, text);
|
| 98 |
System.exit(0);
|
100 |
System.exit(0);
|
| 99 |
} catch (MessagingException e) {
|
101 |
} catch (MessagingException e) {
|
| 100 |
e.printStackTrace();
|
102 |
e.printStackTrace();
|
| 101 |
}
|
103 |
}
|
| 102 |
}
|
104 |
}
|
| 103 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = null;
|
105 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = null;
|
| 104 |
try {
|
106 |
try {
|
| 105 |
flipkartorderids = FetchOrders();
|
107 |
flipkartorderids = FetchOrders();
|
| 106 |
} catch (ClientProtocolException e1) {
|
108 |
} catch (ClientProtocolException e1) {
|
| 107 |
e1.printStackTrace();
|
109 |
e1.printStackTrace();
|
| 108 |
} catch (IOException e1) {
|
110 |
} catch (IOException e1) {
|
| 109 |
e1.printStackTrace();
|
111 |
e1.printStackTrace();
|
| 110 |
}
|
112 |
}
|
| 111 |
try {
|
113 |
try {
|
| 112 |
transactionClient = new TransactionClient("support_transaction_service_server_host","transaction_service_server_port").getClient();
|
114 |
transactionClient = new TransactionClient("support_transaction_service_server_host","transaction_service_server_port").getClient();
|
| 113 |
if(flipkartorderids!=null && flipkartorderids.size()>0){
|
115 |
if(flipkartorderids!=null && flipkartorderids.size()>0){
|
| 114 |
itemIdOrdersMap = transactionClient.getCreatedOrdersForFlipkart(flipkartorderids);
|
116 |
itemIdOrdersMap = transactionClient.getCreatedOrdersForFlipkart(flipkartorderids);
|
| 115 |
}
|
117 |
}
|
| 116 |
} catch (TTransportException e) {
|
118 |
} catch (TTransportException e) {
|
| 117 |
try {
|
119 |
try {
|
| 118 |
itemIdOrdersMap = transactionClient.getCreatedOrdersForFlipkart(flipkartorderids);
|
120 |
itemIdOrdersMap = transactionClient.getCreatedOrdersForFlipkart(flipkartorderids);
|
| 119 |
} catch (TException e1) {
|
121 |
} catch (TException e1) {
|
| 120 |
e1.printStackTrace();
|
122 |
e1.printStackTrace();
|
| 121 |
}
|
123 |
}
|
| 122 |
//e.printStackTrace();
|
124 |
//e.printStackTrace();
|
| 123 |
}catch (TException e) {
|
125 |
}catch (TException e) {
|
| 124 |
// TODO Auto-generated catch block
|
- |
|
| 125 |
e.printStackTrace();
|
126 |
e.printStackTrace();
|
| 126 |
}
|
127 |
}
|
| 127 |
|
128 |
|
| 128 |
}
|
129 |
}
|
| 129 |
|
130 |
|
| 130 |
public static void main(String[] args) throws ClientProtocolException, TException{
|
131 |
public static void main(String[] args) throws ClientProtocolException, TException{
|
| 131 |
calculateinventory();
|
132 |
calculateinventory();
|
| 132 |
DefaultHttpClient httpclient = new DefaultHttpClient();
|
133 |
DefaultHttpClient httpclient = new DefaultHttpClient();
|
| 133 |
httpclient = (DefaultHttpClient) WebClientWrapper.wrapClient(httpclient);
|
134 |
httpclient = (DefaultHttpClient) WebClientWrapper.wrapClient(httpclient);
|
| 134 |
/*httpclient.getCredentialsProvider().setCredentials(
|
135 |
httpclient.getCredentialsProvider().setCredentials(
|
| 135 |
new AuthScope("sandbox-api.flipkart.net", 443),
|
136 |
new AuthScope("sandbox-api.flipkart.net", 443),
|
| 136 |
new UsernamePasswordCredentials("og3yg5994bxbxxc1", "8a137068-417c-4e4f-ae95-9295ab938d88"));/// Test Server Access Keys
|
137 |
new UsernamePasswordCredentials("og3yg5994bxbxxc1", "8a137068-417c-4e4f-ae95-9295ab938d88"));/// Test Server Access Keys
|
| 137 |
*/
|
- |
|
| 138 |
httpclient.getCredentialsProvider().setCredentials(
|
138 |
/*httpclient.getCredentialsProvider().setCredentials(
|
| 139 |
new AuthScope("api.flipkart.net", 443),
|
139 |
new AuthScope("api.flipkart.net", 443),
|
| 140 |
new UsernamePasswordCredentials("m2z93iskuj81qiid","0c7ab6a5-98c0-4cdc-8be3-72c591e0add4")); //Prod Server Access Keys
|
140 |
new UsernamePasswordCredentials("m2z93iskuj81qiid","0c7ab6a5-98c0-4cdc-8be3-72c591e0add4")); //Prod Server Access Keys
|
| 141 |
HttpPost httppost = new HttpPost("https://api.flipkart.net/sellers/skus/listings/bulk"); // PROD
|
141 |
*///HttpPost httppost = new HttpPost("https://api.flipkart.net/sellers/skus/listings/bulk"); // PROD
|
| 142 |
//HttpPost httppost = new HttpPost("https://sandbox-api.flipkart.net/sellers/skus/listings/bulk"); // TEST
|
142 |
HttpPost httppost = new HttpPost("https://sandbox-api.flipkart.net/sellers/skus/listings/bulk"); // TEST
|
| 143 |
StringBuffer jsonRequest = new StringBuffer();
|
143 |
StringBuffer jsonRequest = new StringBuffer();
|
| 144 |
StringBuffer jsonStart = new StringBuffer();
|
144 |
StringBuffer jsonStart = new StringBuffer();
|
| 145 |
jsonStart = jsonStart.append("{\"listings\":[");
|
145 |
jsonStart = jsonStart.append("{\"listings\":[");
|
| 146 |
StringBuffer jsonEnd = new StringBuffer();
|
146 |
StringBuffer jsonEnd = new StringBuffer();
|
| 147 |
jsonEnd.append("]}");
|
147 |
jsonEnd.append("]}");
|
| Line 152... |
Line 152... |
| 152 |
try {
|
152 |
try {
|
| 153 |
logisticsServiceClient = new LogisticsClient("logistics_service_prod_server_host","logistics_service_prod_server_port");
|
153 |
logisticsServiceClient = new LogisticsClient("logistics_service_prod_server_host","logistics_service_prod_server_port");
|
| 154 |
logisticsClient = logisticsServiceClient.getClient();
|
154 |
logisticsClient = logisticsServiceClient.getClient();
|
| 155 |
|
155 |
|
| 156 |
} catch (TTransportException e) {
|
156 |
} catch (TTransportException e) {
|
| 157 |
// TODO Auto-generated catch block
|
- |
|
| 158 |
e.printStackTrace();
|
157 |
e.printStackTrace();
|
| 159 |
}
|
158 |
}
|
| 160 |
long stock=0;
|
159 |
long stock=0;
|
| 161 |
int i=0;
|
160 |
int i=0;
|
| 162 |
long available,reserve,heldforsource,totalheld,allocable,holdinventory,defaultinventory,actualstock,orders;
|
161 |
long available,reserve,heldforsource,totalheld,allocable,holdinventory,defaultinventory,actualstock,orders,heldorders;
|
| 163 |
StringBuffer inventoryItems =new StringBuffer();
|
162 |
StringBuffer inventoryItems =new StringBuffer();
|
| 164 |
String tableHeader = "<html><table border=\"1\" align=\"center\"><tr>"
|
163 |
String tableHeader = "<html><table border=\"1\" align=\"center\"><tr>"
|
| 165 |
+ "<td><b>" + "Product Name" +"</b></td>"
|
164 |
+ "<td><b>" + "Product Name" +"</b></td>"
|
| 166 |
+"<td><b>" + "Item ID" + "</b></td>"
|
165 |
+"<td><b>" + "Item ID" + "</b></td>"
|
| 167 |
+"<td><b>" + "Inventory" + "</b></td>"
|
166 |
+"<td><b>" + "Inventory" + "</b></td>"
|
| 168 |
+"<td><b>" + "Orders Added to Inventory" + "</b></td>"
|
167 |
+"<td><b>" + "Orders Added to Inventory" + "</b></td>"
|
| 169 |
+"<td><b>" + "Sent Inventory" + "</b></td>"
|
168 |
+"<td><b>" + "Sent Inventory" + "</b></td>"
|
| - |
|
169 |
+"<td><b>" + "Procurement SLA" + "</b></td>"
|
| - |
|
170 |
+"<td><b>" + "Orders on Hold" + "</b></td>"
|
| 170 |
+"</tr>";
|
171 |
+"</tr>";
|
| 171 |
String tableFooter = "</table></html>";
|
172 |
String tableFooter = "</table></html>";
|
| 172 |
Item item;
|
173 |
Item item;
|
| 173 |
StringBuffer feedResponse= new StringBuffer();
|
174 |
StringBuffer feedResponse= new StringBuffer();
|
| - |
|
175 |
List<FlipkartInventorySnapshot> inventorysnapshotlist = new ArrayList<FlipkartInventorySnapshot>();
|
| 174 |
for(Entry<Long, FlipkartInventoryItem> entry:flipkartItemsInventoryMap.entrySet()){
|
176 |
for(Entry<Long, FlipkartInventoryItem> entry:flipkartItemsInventoryMap.entrySet()){
|
| 175 |
actualstock=0;
|
177 |
actualstock=0;
|
| 176 |
orders=0;
|
178 |
orders=0;
|
| 177 |
stock=0;
|
179 |
stock=0;
|
| - |
|
180 |
heldorders=0;
|
| 178 |
available = entry.getValue().getAvailability();
|
181 |
available = entry.getValue().getAvailability();
|
| 179 |
reserve = entry.getValue().getReserve();
|
182 |
reserve = entry.getValue().getReserve();
|
| 180 |
heldforsource = entry.getValue().getHeldForSource();
|
183 |
heldforsource = entry.getValue().getHeldForSource();
|
| 181 |
totalheld = entry.getValue().getTotalHeldInventory();
|
184 |
totalheld = entry.getValue().getTotalHeldInventory();
|
| 182 |
holdinventory = entry.getValue().getHoldInventory();
|
185 |
holdinventory = entry.getValue().getHoldInventory();
|
| Line 244... |
Line 247... |
| 244 |
}
|
247 |
}
|
| 245 |
jsonRequest.append("{\"skuId\":"+"\""+entry.getValue().getSkuAtflipkart()+
|
248 |
jsonRequest.append("{\"skuId\":"+"\""+entry.getValue().getSkuAtflipkart()+
|
| 246 |
"\","+"\"attributeValues\""+":"+
|
249 |
"\","+"\"attributeValues\""+":"+
|
| 247 |
"{\"procurement_sla\""+":"+"\""+logisticinfo.getShippingTime()+
|
250 |
"{\"procurement_sla\""+":"+"\""+logisticinfo.getShippingTime()+
|
| 248 |
"\","+"\"stock_count\""+":"+"\""+stock+"\""+"}}");
|
251 |
"\","+"\"stock_count\""+":"+"\""+stock+"\""+"}}");
|
| - |
|
252 |
FlipkartInventorySnapshot inventorySnapshot = new FlipkartInventorySnapshot();
|
| - |
|
253 |
inventorySnapshot.setItem_id(entry.getKey());
|
| - |
|
254 |
inventorySnapshot.setAvailability(stock);
|
| - |
|
255 |
if(heldOrdersMap.containsKey(entry.getValue().getSkuAtflipkart())){
|
| - |
|
256 |
inventorySnapshot.setHeldOrders(heldOrdersMap.get(entry.getValue().getSkuAtflipkart()));
|
| - |
|
257 |
heldorders = heldOrdersMap.get(entry.getValue().getSkuAtflipkart());
|
| - |
|
258 |
}
|
| - |
|
259 |
else{
|
| - |
|
260 |
inventorySnapshot.setHeldOrders(0);
|
| - |
|
261 |
}
|
| - |
|
262 |
inventorySnapshot.setCreatedOrders(orders);
|
| - |
|
263 |
inventorysnapshotlist.add(inventorySnapshot);
|
| 249 |
item = aliveItemsMap.get(entry.getValue().getId());
|
264 |
item = aliveItemsMap.get(entry.getValue().getId());
|
| 250 |
inventoryItems.append("<tr>"
|
265 |
inventoryItems.append("<tr>"
|
| 251 |
+ "<td>" +getProductName(item)+"</td>"
|
266 |
+ "<td>" +getProductName(item)+"</td>"
|
| 252 |
+"<td>" + item.getId() + "</td>"
|
267 |
+"<td>" + item.getId() + "</td>"
|
| 253 |
+"<td>" + actualstock + "</td>"
|
268 |
+"<td>" + actualstock + "</td>"
|
| 254 |
+"<td>" + orders + "</td>"
|
269 |
+"<td>" + orders + "</td>"
|
| 255 |
+"<td>" + stock + "</td>"
|
270 |
+"<td>" + stock + "</td>"
|
| - |
|
271 |
+"<td>" + logisticinfo.getShippingTime() + "</td>"
|
| - |
|
272 |
+"<td>" + heldorders + "</td>"
|
| 256 |
+"</tr>");
|
273 |
+"</tr>");
|
| 257 |
i++;
|
274 |
i++;
|
| 258 |
if(flipkartItemsInventoryMap.entrySet().size()!=1 && (i!=flipkartItemsInventoryMap.entrySet().size()) ){
|
275 |
if(flipkartItemsInventoryMap.entrySet().size()!=1 && (i!=flipkartItemsInventoryMap.entrySet().size()) ){
|
| 259 |
if(i%10!=0){
|
276 |
if(i%10!=0){
|
| 260 |
jsonRequest.append(",");
|
277 |
jsonRequest.append(",");
|
| Line 265... |
Line 282... |
| 265 |
try {
|
282 |
try {
|
| 266 |
input = new StringEntity(jsonStart+jsonRequest.toString()+jsonEnd);
|
283 |
input = new StringEntity(jsonStart+jsonRequest.toString()+jsonEnd);
|
| 267 |
System.out.println("Json input " + jsonStart+jsonRequest.toString()+jsonEnd);
|
284 |
System.out.println("Json input " + jsonStart+jsonRequest.toString()+jsonEnd);
|
| 268 |
jsonRequest = new StringBuffer();
|
285 |
jsonRequest = new StringBuffer();
|
| 269 |
} catch (UnsupportedEncodingException e) {
|
286 |
} catch (UnsupportedEncodingException e) {
|
| 270 |
// TODO Auto-generated catch block
|
- |
|
| 271 |
e.printStackTrace();
|
287 |
e.printStackTrace();
|
| 272 |
}
|
288 |
}
|
| 273 |
input.setContentType("application/json");
|
289 |
input.setContentType("application/json");
|
| 274 |
|
290 |
|
| 275 |
httppost.setEntity(input);
|
291 |
httppost.setEntity(input);
|
| 276 |
HttpResponse response = null;
|
292 |
HttpResponse response = null;
|
| 277 |
try {
|
293 |
try {
|
| 278 |
System.out.println("Before send " );
|
294 |
System.out.println("Before send " );
|
| 279 |
response = httpclient.execute(httppost);
|
295 |
response = httpclient.execute(httppost);
|
| 280 |
System.out.println("After send " );
|
296 |
System.out.println("After send " );
|
| 281 |
} catch (IOException e) {
|
297 |
} catch (IOException e) {
|
| 282 |
// TODO Auto-generated catch block
|
- |
|
| 283 |
e.printStackTrace();
|
298 |
e.printStackTrace();
|
| 284 |
}
|
299 |
}
|
| 285 |
BufferedReader rd = null;
|
300 |
BufferedReader rd = null;
|
| 286 |
try {
|
301 |
try {
|
| 287 |
rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
|
302 |
rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
|
| 288 |
} catch (IllegalStateException e) {
|
303 |
} catch (IllegalStateException e) {
|
| 289 |
// TODO Auto-generated catch block
|
- |
|
| 290 |
e.printStackTrace();
|
304 |
e.printStackTrace();
|
| 291 |
} catch (IOException e) {
|
305 |
} catch (IOException e) {
|
| 292 |
// TODO Auto-generated catch block
|
- |
|
| 293 |
e.printStackTrace();
|
306 |
e.printStackTrace();
|
| 294 |
}
|
307 |
}
|
| 295 |
String line;
|
308 |
String line;
|
| - |
|
309 |
in.shop2020.model.v1.inventory.InventoryService.Client inventoryServiceClient;
|
| 296 |
try {
|
310 |
try {
|
| 297 |
while ((line = rd.readLine()) != null) {
|
311 |
while ((line = rd.readLine()) != null) {
|
| 298 |
System.out.println("Response " + line);
|
312 |
System.out.println("Response " + line);
|
| 299 |
if(line.equalsIgnoreCase("{\"status\":\"success\"}")){
|
313 |
if(line.equalsIgnoreCase("{\"status\":\"success\"}")){
|
| - |
|
314 |
inventoryServiceClient = new InventoryClient("inventory_service_server_host","inventory_service_server_port").getClient();
|
| - |
|
315 |
inventoryServiceClient.addOrUpdateFlipkartInventorySnapshot(inventorysnapshotlist);
|
| - |
|
316 |
inventorysnapshotlist = new ArrayList<FlipkartInventorySnapshot>();
|
| 300 |
}
|
317 |
}
|
| 301 |
else{
|
318 |
else{
|
| 302 |
feedResponse.append(line);
|
319 |
feedResponse.append(line);
|
| 303 |
}
|
320 |
}
|
| 304 |
|
321 |
|
| 305 |
}
|
322 |
}
|
| 306 |
} catch (IOException e) {
|
323 |
} catch (IOException e) {
|
| 307 |
// TODO Auto-generated catch block
|
- |
|
| 308 |
e.printStackTrace();
|
324 |
e.printStackTrace();
|
| 309 |
}
|
325 |
}
|
| 310 |
}
|
326 |
}
|
| 311 |
}
|
327 |
}
|
| 312 |
System.out.println("Before sending email");
|
328 |
System.out.println("Before sending email");
|
| Line 336... |
Line 352... |
| 336 |
CatalogClient catalogServiceClient = null;
|
352 |
CatalogClient catalogServiceClient = null;
|
| 337 |
Map<Long,ItemInventory> availability= new HashMap<Long,ItemInventory>();
|
353 |
Map<Long,ItemInventory> availability= new HashMap<Long,ItemInventory>();
|
| 338 |
try {
|
354 |
try {
|
| 339 |
catalogServiceClient = new CatalogClient();
|
355 |
catalogServiceClient = new CatalogClient();
|
| 340 |
} catch (TTransportException e) {
|
356 |
} catch (TTransportException e) {
|
| 341 |
// TODO Auto-generated catch block
|
- |
|
| 342 |
e.printStackTrace();
|
357 |
e.printStackTrace();
|
| 343 |
}
|
358 |
}
|
| 344 |
in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = catalogServiceClient.getClient();
|
359 |
in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = catalogServiceClient.getClient();
|
| 345 |
try {
|
360 |
try {
|
| 346 |
List<Item> aliveItems = catalogClient.getAllAliveItems();
|
361 |
List<Item> aliveItems = catalogClient.getAllAliveItems();
|
| Line 556... |
Line 571... |
| 556 |
flipkartItemsInventoryMap.put(thriftItem.getId(),item);
|
571 |
flipkartItemsInventoryMap.put(thriftItem.getId(),item);
|
| 557 |
|
572 |
|
| 558 |
}
|
573 |
}
|
| 559 |
|
574 |
|
| 560 |
} catch (TException e) {
|
575 |
} catch (TException e) {
|
| 561 |
// TODO Auto-generated catch block
|
- |
|
| 562 |
e.printStackTrace();
|
576 |
e.printStackTrace();
|
| 563 |
}
|
577 |
}
|
| 564 |
}
|
578 |
}
|
| 565 |
|
579 |
|
| 566 |
static List<String> FetchOrders() throws ClientProtocolException, IOException{
|
580 |
static List<String> FetchOrders() throws ClientProtocolException, IOException{
|
| Line 622... |
Line 636... |
| 622 |
}
|
636 |
}
|
| 623 |
i++;
|
637 |
i++;
|
| 624 |
}
|
638 |
}
|
| 625 |
List<String> orderIdList = new ArrayList<String>();
|
639 |
List<String> orderIdList = new ArrayList<String>();
|
| 626 |
for(Order order:orders){
|
640 |
for(Order order:orders){
|
| 627 |
System.out.println("Order " + order.getExternalId() +" "+order.getOrderItemId() + " : "+ order.getStatus() + " "+order.getStatusDateMessage() + " "
|
641 |
//System.out.println("Order " + order.getExternalId() +" "+order.getOrderItemId() + " : "+ order.getStatus() + " "+order.getStatusDateMessage() + " "
|
| 628 |
+ order.getStatusLabel() + " " + order.getPickup_by_date() + " "+ order.getTrackingId());
|
642 |
// + order.getStatusLabel() + " " + order.getPickup_by_date() + " "+ order.getTrackingId());
|
| 629 |
orderIdList.add(order.getExternalId());
|
643 |
orderIdList.add(order.getExternalId());
|
| - |
|
644 |
if(order.getStatus().equalsIgnoreCase("on_hold")){
|
| - |
|
645 |
if(heldOrdersMap.containsKey(order.getSku())){
|
| - |
|
646 |
heldOrdersMap.put(order.getSku(),heldOrdersMap.get(order.getSku())+order.getQuantity());
|
| - |
|
647 |
System.out.println("Item ID " + order.getSku() + " Held Orders " + heldOrdersMap.get(order.getSku()));
|
| - |
|
648 |
}
|
| - |
|
649 |
else{
|
| - |
|
650 |
heldOrdersMap.put(order.getSku(),(long) order.getQuantity());
|
| - |
|
651 |
System.out.println("Item ID " + order.getSku() + " Held Orders " + order.getQuantity());
|
| - |
|
652 |
}
|
| - |
|
653 |
}
|
| 630 |
}
|
654 |
}
|
| 631 |
return orderIdList;
|
655 |
return orderIdList;
|
| 632 |
}
|
656 |
}
|
| 633 |
static String getProductName(Item item){
|
657 |
static String getProductName(Item item){
|
| 634 |
return getName(item.getBrand())+" " + getName(item.getModelName())+" " + getName(item.getModelNumber())+" " + getName(item.getColor());
|
658 |
return getName(item.getBrand())+" " + getName(item.getModelName())+" " + getName(item.getModelNumber())+" " + getName(item.getColor());
|