Subversion Repositories SmartDukaan

Rev

Rev 11219 | Rev 11639 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5711 mandeep.dh 1
/**
2
 * 
3
 */
4
package in.shop2020.inventory.controllers;
5
 
10689 manish.sha 6
import in.shop2020.model.v1.catalog.CatalogService;
7
import in.shop2020.model.v1.inventory.AmazonFbaInventorySnapshot;
8
import in.shop2020.model.v1.inventory.InventoryService;
9
import in.shop2020.thrift.clients.CatalogClient;
10
import in.shop2020.thrift.clients.InventoryClient;
5711 mandeep.dh 11
import in.shop2020.thrift.clients.WarehouseClient;
10689 manish.sha 12
import in.shop2020.warehouse.AmazonTransferredSkuDetail;
5711 mandeep.dh 13
import in.shop2020.warehouse.InventoryAge;
10689 manish.sha 14
import in.shop2020.warehouse.Scan;
15
import in.shop2020.warehouse.ScanType;
5711 mandeep.dh 16
import in.shop2020.warehouse.WarehouseService.Client;
17
 
18
import java.io.BufferedInputStream;
19
import java.io.BufferedWriter;
20
import java.io.File;
21
import java.io.FileInputStream;
10689 manish.sha 22
import java.io.FileNotFoundException;
23
import java.io.FileReader;
5711 mandeep.dh 24
import java.io.FileWriter;
25
import java.io.InputStream;
10689 manish.sha 26
import java.util.ArrayList;
27
import java.util.HashMap;
5711 mandeep.dh 28
import java.util.List;
10689 manish.sha 29
import java.util.Map;
5711 mandeep.dh 30
 
31
import javax.servlet.ServletOutputStream;
32
 
33
import org.apache.commons.lang.StringUtils;
34
import org.apache.commons.logging.Log;
35
import org.apache.commons.logging.LogFactory;
36
 
10689 manish.sha 37
 
38
 
5711 mandeep.dh 39
/**
40
 * @author mandeep
41
 *
42
 */
43
public class InventoryAgeController extends BaseController {
10689 manish.sha 44
	private static Log logger = LogFactory.getLog(InventoryAgeController.class);
5711 mandeep.dh 45
 
10689 manish.sha 46
	public String index() {
47
		try {
48
			Client client = new WarehouseClient().getClient();
49
			List<InventoryAge> inventoryAge = client.getInventoryAge();
50
			List<InventoryAge> inventoryAgeAmazon = getAmazonInventoryAge();
51
			byte[] buffer = null;
52
			File file = createFile(inventoryAge, inventoryAgeAmazon);
53
			Thread.sleep(30000);
54
			buffer = new byte[(int) file.length()];
55
			InputStream input = null;
56
			try {
57
				int totalBytesRead = 0;
58
				input = new BufferedInputStream(new FileInputStream(file));
59
				while (totalBytesRead < buffer.length) {
60
					int bytesRemaining = buffer.length - totalBytesRead;
61
					// input.read() returns -1, 0, or more :
62
					int bytesRead = input.read(buffer, totalBytesRead,
63
							bytesRemaining);
64
					if (bytesRead > 0) {
65
						totalBytesRead = totalBytesRead + bytesRead;
66
					}
67
				}
68
				/*
69
				 * the above style is a bit tricky: it places bytes into the
70
				 * 'buffer' array; 'buffer' is an output parameter; the while
71
				 * loop usually has a single iteration only.
72
				 */
73
			} finally {
74
				input.close();
75
			}
5711 mandeep.dh 76
 
77
 
78
 
79
 
10689 manish.sha 80
			response.setContentType("application/vnd.ms-excel");
81
			response.setHeader("Content-disposition", "inline; filename="
82
					+ file.getName());
5711 mandeep.dh 83
 
10689 manish.sha 84
			ServletOutputStream sos = response.getOutputStream();
85
			sos.write(buffer);
86
			sos.flush();      
5711 mandeep.dh 87
 
10689 manish.sha 88
		}
89
		catch (Exception e) {
90
		}
91
 
92
		return null;
93
	}
94
 
95
	/**
96
	 * @param inventoryAge
97
	 * @return
98
	 */
99
	private File createFile(List<InventoryAge> inventoryAge, List<InventoryAge> inventoryAgeAmazon) {
100
		Map<Long,InventoryAge> inventoryAgeMap = new HashMap<Long,InventoryAge>();
101
 
102
		for(InventoryAge invAge : inventoryAge){
103
			inventoryAgeMap.put(invAge.getItemId(), invAge);
104
		}
105
 
106
		for(InventoryAge invAge : inventoryAgeAmazon){
107
			if(inventoryAgeMap.containsKey(invAge.getItemId())){
108
				InventoryAge invAgeObj = inventoryAgeMap.get(invAge.getItemId());
109
				invAgeObj.setFreshCount(invAgeObj.getFreshCount()+ invAge.getFreshCount());
110
				invAgeObj.setOneToTwoCount(invAgeObj.getOneToTwoCount() + invAge.getOneToTwoCount());
111
				invAgeObj.setTwoToThreeCount(invAgeObj.getTwoToThreeCount() + invAge.getTwoToThreeCount());
112
 
113
				invAgeObj.setThreeToFourCount(invAgeObj.getThreeToFourCount() + invAge.getThreeToFourCount());
114
				invAgeObj.setFourPlusCount(invAgeObj.getFourPlusCount() + invAge.getFourPlusCount());
115
				invAgeObj.setThreeMonthPlusCount(invAgeObj.getThreeMonthPlusCount() + invAge.getThreeMonthPlusCount());
116
				invAgeObj.setSixMonthPlusCount(invAgeObj.getSixMonthPlusCount() + invAge.getSixMonthPlusCount());
11219 manish.sha 117
				invAgeObj.setZeroToThreeMonthCount(invAgeObj.getZeroToThreeMonthCount() + invAge.getZeroToThreeMonthCount());
118
				invAgeObj.setThreeToSixMonthCount(invAgeObj.getThreeToSixMonthCount() + invAge.getThreeToSixMonthCount());
119
				invAgeObj.setSixToTwelveMonthCount(invAgeObj.getSixToTwelveMonthCount() + invAge.getSixToTwelveMonthCount());
120
				invAgeObj.setTwelveMonthsPlusCount(invAgeObj.getTwelveMonthsPlusCount() + invAge.getTwelveMonthsPlusCount());
10689 manish.sha 121
				invAgeObj.setZeroPlusCount(invAgeObj.getZeroPlusCount() + invAge.getZeroPlusCount());
122
				invAgeObj.setOnePlusCount(invAgeObj.getOnePlusCount() + invAge.getOnePlusCount());
123
				invAgeObj.setZeroPlusCost(invAgeObj.getZeroPlusCost() + invAge.getZeroPlusCost());
124
				invAgeObj.setOnePlusCost(invAgeObj.getOnePlusCost() + invAge.getOnePlusCost());
125
 
126
				inventoryAgeMap.put(invAge.getItemId(), invAgeObj);
127
 
128
			}
129
			else{
130
				inventoryAgeMap.put(invAge.getItemId(), invAge);
131
			}
132
		}
133
		List<InventoryAge> finalInventoryAge = new ArrayList<InventoryAge>();
134
		for(Long itemId : inventoryAgeMap.keySet()){
135
			finalInventoryAge.add(inventoryAgeMap.get(itemId));
136
		}
137
		try {
138
			File file = new File("/tmp/InventoryAge.xls");
139
			BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file));
140
			bufferedWriter.write(StringUtils.join(new String[] {
141
					"Item Id",
142
					"Category",
143
					"Brand",
144
					"Model Name",
145
					"Model Number",
146
					"Color",
147
					"Fresh",
148
					"1-2 week",
149
					"2-3 week",
150
					"3-4 week",
151
					"4+ week",
152
					"3+ month",
153
					"6+ month",
11219 manish.sha 154
					"0-3 month",
155
					"3-6 month",
156
					"6-12 month",
157
					"12+ month",
10689 manish.sha 158
					"1+ week",
159
					"1+ week cost",
160
					"All",
161
			"All cost" }, '\t'));
162
 
163
			for (InventoryAge item : finalInventoryAge) {
164
				bufferedWriter.newLine();
165
 
166
				bufferedWriter.write(StringUtils.join(
167
						new String[] {
168
								String.valueOf(item.getItemId()),
169
								item.getCategory(),
170
								item.getBrand(),
171
								item.getModelName(),
172
								item.getModelNumber(),
173
								item.getColor(),
174
								String.valueOf(item.getFreshCount()),
175
								String.valueOf(item.getOneToTwoCount()),
176
								String.valueOf(item.getTwoToThreeCount()),
177
								String.valueOf(item.getThreeToFourCount()),
178
								String.valueOf(item.getFourPlusCount()),
179
								String.valueOf(item.getThreeMonthPlusCount()),
180
								String.valueOf(item.getSixMonthPlusCount()),
11219 manish.sha 181
								String.valueOf(item.getZeroToThreeMonthCount()),
182
								String.valueOf(item.getThreeToSixMonthCount()),
183
								String.valueOf(item.getSixToTwelveMonthCount()),
184
								String.valueOf(item.getTwelveMonthsPlusCount()),
10689 manish.sha 185
								String.valueOf(item.getOnePlusCount()),
186
								String.valueOf(item.getOnePlusCost()),
187
								String.valueOf(item.getZeroPlusCount()),
188
								String.valueOf(item.getZeroPlusCost())}, '\t'));
189
			}
190
 
191
			bufferedWriter.close();
192
			return file;
193
		} catch (Exception e) {
194
			return null;
195
		}
196
	}
197
 
198
 
199
	public List<InventoryAge> getAmazonInventoryAge(){
200
		Long currentTimestamp = System.currentTimeMillis();
201
 
202
		List<InventoryAge> amazonInventoryAge = new ArrayList<InventoryAge>();
203
		try{
204
			InventoryService.Client inventoryClient = new InventoryClient().getClient();
205
			List<AmazonFbaInventorySnapshot> amazonFbaInventorySnapshot = inventoryClient.getAllAmazonFbaItemInventory();
206
 
207
			List<Long> itemIds = new ArrayList<Long>();
208
			for(AmazonFbaInventorySnapshot invSnapShot : amazonFbaInventorySnapshot)
209
				itemIds.add(invSnapShot.getItem_id());
210
			Client client = new WarehouseClient().getClient();
211
 
212
			List<AmazonTransferredSkuDetail> amazonTransferredSkuDetails = client.getAmazonTransferredSkuDetails(itemIds);
11582 manish.sha 213
			Map<Long, AmazonFbaInventorySnapshot> amazonFbaSnapshotMap = new HashMap<Long, AmazonFbaInventorySnapshot> ();
10689 manish.sha 214
 
215
			Map<Long, List<AmazonTransferredSkuDetail>> skuDetailsMap = new HashMap<Long, List<AmazonTransferredSkuDetail>>();
216
 
217
			for(AmazonFbaInventorySnapshot invSnapShot : amazonFbaInventorySnapshot){
218
				Long itemId= invSnapShot.getItem_id();
11582 manish.sha 219
				if(!amazonFbaSnapshotMap.containsKey(itemId)){
220
					amazonFbaSnapshotMap.put(itemId, invSnapShot);
221
				} else {
222
					AmazonFbaInventorySnapshot invSS = amazonFbaSnapshotMap.get(itemId);
223
					invSnapShot.setAvailability(invSnapShot.getAvailability() + invSS.getAvailability());
224
					amazonFbaSnapshotMap.put(itemId, invSnapShot);
225
				}
226
 
10689 manish.sha 227
				List<AmazonTransferredSkuDetail> mappedList = new ArrayList<AmazonTransferredSkuDetail>();
228
				for(AmazonTransferredSkuDetail detail: amazonTransferredSkuDetails){
229
					if(itemId == detail.getItemId()){
230
						mappedList.add(detail);
231
					}
232
				}
233
				skuDetailsMap.put(itemId, mappedList);
234
			}
235
 
236
			//CatalogService.Client catalogClient = new CatalogClient().getClient();
237
 
11582 manish.sha 238
			for(AmazonFbaInventorySnapshot invSnapShot : amazonFbaSnapshotMap.values()){
10689 manish.sha 239
				try{
240
 
241
					Long item_id = invSnapShot.getItem_id();
242
					List<AmazonTransferredSkuDetail> amazonTranSkuDetails = skuDetailsMap.get(item_id);
243
					long amazonFbaInvAvailability = invSnapShot.getAvailability();
244
					List<AmazonTransferredSkuDetail> toBeIncludeList = new ArrayList<AmazonTransferredSkuDetail>();
245
 
246
					long freshCount = 0;
247
					long oneToTwoCount = 0;
248
					long twoToThreeCount = 0;
249
					long threeToFourCount = 0;
250
					long fourPlusCount = 0;
251
					long onePlusCount = 0;
252
					long threeMonthPlusCount = 0;
253
					long sixMonthPlusCount = 0;
11219 manish.sha 254
					long zeroToThreeMonthCount = 0;
255
					long threeToSixMonthsCount = 0;
256
					long sixToTwelveMonthsCount = 0;
257
					long twelveMonthsPlusCount = 0;					
10689 manish.sha 258
					long onePlusCost = 0;
259
					long zeroPlusCount = 0;
260
					long zeroPlusCost = 0;
261
					String brand ="";
262
					String modelName ="";
263
					String modelNumber ="";
264
					String color ="";
265
					String category ="";
266
 
267
					if(amazonTranSkuDetails!=null && amazonTranSkuDetails.size()>0){
268
						brand = amazonTranSkuDetails.get(0).getBrand();
269
						modelName = amazonTranSkuDetails.get(0).getModelName();
270
						modelNumber = amazonTranSkuDetails.get(0).getModelNumber();
271
						color = amazonTranSkuDetails.get(0).getColor();
272
						category = amazonTranSkuDetails.get(0).getCategory();
273
					}else{
274
						continue;
275
					}
276
					double invAge = 0;
277
 
278
					for(AmazonTransferredSkuDetail amazonSkuDetail : amazonTranSkuDetails){
279
						if(amazonFbaInvAvailability == amazonSkuDetail.getQuantity()){
280
							toBeIncludeList.add(amazonSkuDetail);
281
							break;
282
						}
283
						if(amazonFbaInvAvailability > amazonSkuDetail.getQuantity()){
284
							toBeIncludeList.add(amazonSkuDetail);
285
							amazonFbaInvAvailability = amazonFbaInvAvailability- amazonSkuDetail.getQuantity();
286
							continue;
287
						}
288
						if(amazonFbaInvAvailability < amazonSkuDetail.getQuantity()){
289
							amazonSkuDetail.setQuantity(amazonFbaInvAvailability);
290
							toBeIncludeList.add(amazonSkuDetail);
291
							break;
292
						}
293
					}
294
 
295
					for(AmazonTransferredSkuDetail amazonSkuInfo : toBeIncludeList){
296
						if(!amazonSkuInfo.isSetPurchaseDate() || amazonSkuInfo.getPurchaseDate() == 0){
297
							if(!client.isAlive()){
298
								client = new WarehouseClient().getClient();
299
							}
300
							List<Scan> purchaseScans = client.getScansforPurchase(amazonSkuInfo.getPurchaseId(), ScanType.PURCHASE);
301
							amazonSkuInfo.setPurchaseDate(purchaseScans.get(0).getScannedAt());
302
						}
303
						invAge = (double)(currentTimestamp - amazonSkuInfo.getPurchaseDate())/ (24 * 60 * 60 * 1000 * 7);
304
						if(invAge < 1){
305
							freshCount = freshCount + amazonSkuInfo.getQuantity();
306
						}
307
						if(invAge >= 1 && invAge < 2){
308
							oneToTwoCount = oneToTwoCount + amazonSkuInfo.getQuantity();
309
						}
310
						if(invAge >= 2 && invAge < 3){
311
							twoToThreeCount = twoToThreeCount + amazonSkuInfo.getQuantity();
312
						}
313
						if(invAge >= 3 && invAge < 4){
314
							threeToFourCount = threeToFourCount + amazonSkuInfo.getQuantity();
315
						}
316
						if(invAge >= 4){
317
							fourPlusCount = fourPlusCount + amazonSkuInfo.getQuantity();
318
						}
319
						if(invAge >= 1){
320
							onePlusCount = onePlusCount + amazonSkuInfo.getQuantity();
321
							onePlusCost = (long)(onePlusCost + ( amazonSkuInfo.getQuantity() * amazonSkuInfo.getUnitPrice() ));
322
						}
323
						if(invAge >= 13){
324
							threeMonthPlusCount = threeMonthPlusCount + amazonSkuInfo.getQuantity();
325
						}
326
						if(invAge >= 26){
327
							sixMonthPlusCount = sixMonthPlusCount + amazonSkuInfo.getQuantity();
328
						}
11219 manish.sha 329
 
330
						if(invAge >0 && invAge <=13){
331
							zeroToThreeMonthCount = zeroToThreeMonthCount + amazonSkuInfo.getQuantity();
332
						}
333
 
334
						if(invAge >13 && invAge <=26){
335
							threeToSixMonthsCount = threeToSixMonthsCount + amazonSkuInfo.getQuantity();
336
						}
337
 
338
						if(invAge >26 && invAge <=52){
339
							sixToTwelveMonthsCount = sixToTwelveMonthsCount + amazonSkuInfo.getQuantity();
340
						}
341
 
342
						if(invAge > 52){
343
							twelveMonthsPlusCount = twelveMonthsPlusCount + amazonSkuInfo.getQuantity();
344
						}
10689 manish.sha 345
 
346
						zeroPlusCount = zeroPlusCount + amazonSkuInfo.getQuantity(); 
347
 
348
						zeroPlusCost = (long)(zeroPlusCost + ( amazonSkuInfo.getQuantity() * amazonSkuInfo.getUnitPrice() ));
349
					}
350
 
351
 
352
					InventoryAge inventAge = new InventoryAge();
353
					inventAge.setItemId(item_id);
354
					inventAge.setBrand(brand);
355
					inventAge.setModelName(modelName);
356
					inventAge.setModelNumber(modelNumber);
357
					inventAge.setColor(color);
358
					inventAge.setFreshCount(freshCount);
359
					inventAge.setOneToTwoCount(oneToTwoCount);
360
					inventAge.setTwoToThreeCount(twoToThreeCount);
361
					inventAge.setThreeToFourCount(threeToFourCount);
362
					inventAge.setFourPlusCount(fourPlusCount);
363
					inventAge.setThreeMonthPlusCount(threeMonthPlusCount);
364
					inventAge.setSixMonthPlusCount(sixMonthPlusCount);
11219 manish.sha 365
					inventAge.setZeroToThreeMonthCount(zeroToThreeMonthCount);
366
					inventAge.setThreeToSixMonthCount(threeToSixMonthsCount);
367
					inventAge.setSixToTwelveMonthCount(sixToTwelveMonthsCount);
368
					inventAge.setTwelveMonthsPlusCount(twelveMonthsPlusCount);
10689 manish.sha 369
					inventAge.setZeroPlusCount(zeroPlusCount);
370
					inventAge.setOnePlusCount(onePlusCount);
371
					inventAge.setZeroPlusCost(zeroPlusCost);
372
					inventAge.setOnePlusCost(onePlusCost);
373
					inventAge.setCategory(category);
374
 
375
					amazonInventoryAge.add(inventAge);
376
				}
377
				catch(Exception e){
378
					e.printStackTrace();				
379
				}
380
			}
381
 
382
		}
383
		catch(Exception e){
384
			e.printStackTrace();				
385
		}
386
		return amazonInventoryAge;
387
	}
388
 
389
	public File createFile(List<InventoryAge> inventoryAge, String name){
390
		try {
391
			File file = new File(name);
392
			BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file));
393
			bufferedWriter.write(StringUtils.join(new String[] {
394
					"Item Id",
395
					"Category",
396
					"Brand",
397
					"Model Name",
398
					"Model Number",
399
					"Color",
400
					"Fresh",
401
					"1-2 week",
402
					"2-3 week",
403
					"3-4 week",
404
					"4+ week",
405
					"3+ month",
406
					"6+ month",
11219 manish.sha 407
					"0-3 month",
408
					"3-6 month",
409
					"6-12 month",
410
					"12+ month",
10689 manish.sha 411
					"1+ week",
412
					"1+ week cost",
413
					"All",
414
			"All cost" }, '\t'));
415
 
416
			for (InventoryAge item : inventoryAge) {
417
				bufferedWriter.newLine();
418
 
419
				bufferedWriter.write(StringUtils.join(
420
						new String[] {
421
								String.valueOf(item.getItemId()),
422
								item.getCategory(),
423
								item.getBrand(),
424
								item.getModelName(),
425
								item.getModelNumber(),
426
								item.getColor(),
427
								String.valueOf(item.getFreshCount()),
428
								String.valueOf(item.getOneToTwoCount()),
429
								String.valueOf(item.getTwoToThreeCount()),
430
								String.valueOf(item.getThreeToFourCount()),
431
								String.valueOf(item.getFourPlusCount()),
432
								String.valueOf(item.getThreeMonthPlusCount()),
433
								String.valueOf(item.getSixMonthPlusCount()),
11219 manish.sha 434
								String.valueOf(item.getZeroToThreeMonthCount()),
435
								String.valueOf(item.getThreeToSixMonthCount()),
436
								String.valueOf(item.getSixToTwelveMonthCount()),
437
								String.valueOf(item.getTwelveMonthsPlusCount()),
10689 manish.sha 438
								String.valueOf(item.getOnePlusCount()),
439
								String.valueOf(item.getOnePlusCost()),
440
								String.valueOf(item.getZeroPlusCount()),
441
								String.valueOf(item.getZeroPlusCost())}, '\t'));
442
			}
443
 
444
			bufferedWriter.close();
445
			return file;
446
		} catch (Exception e) {
447
			return null;
448
		}
449
 
450
	}
451
 
452
	public void downloadAmazonInventoryAge(){
453
		try {
454
			List<InventoryAge> inventoryAgeAmazon = getAmazonInventoryAge();
455
			byte[] buffer = null;
456
			File file = createFile(inventoryAgeAmazon,"/tmp/AmazonInventoryAge.xls");
457
			Thread.sleep(10000);
458
			buffer = new byte[(int) file.length()];
459
			InputStream input = null;
460
			try {
461
				int totalBytesRead = 0;
462
				input = new BufferedInputStream(new FileInputStream(file));
463
				while (totalBytesRead < buffer.length) {
464
					int bytesRemaining = buffer.length - totalBytesRead;
465
					// input.read() returns -1, 0, or more :
466
					int bytesRead = input.read(buffer, totalBytesRead,
467
							bytesRemaining);
468
					if (bytesRead > 0) {
469
						totalBytesRead = totalBytesRead + bytesRead;
470
					}
471
				}
472
				/*
473
				 * the above style is a bit tricky: it places bytes into the
474
				 * 'buffer' array; 'buffer' is an output parameter; the while
475
				 * loop usually has a single iteration only.
476
				 */
477
			} finally {
478
				input.close();
479
			}
480
 
481
 
482
 
483
 
484
			response.setContentType("application/vnd.ms-excel");
485
			response.setHeader("Content-disposition", "inline; filename="
486
					+ file.getName());
487
 
488
			ServletOutputStream sos = response.getOutputStream();
489
			sos.write(buffer);
490
			sos.flush();      
491
 
492
		}
493
		catch (Exception e) {
494
		}
495
 
496
	}
497
 
498
	public void downloadSaholicInventoryAge(){
499
		try {
500
			Client client = new WarehouseClient().getClient();
501
			List<InventoryAge> inventoryAge = client.getInventoryAge();
502
			byte[] buffer = null;
503
			File file = createFile(inventoryAge,"/tmp/SaholicInventoryAge.xls");
504
			Thread.sleep(10000);
505
			buffer = new byte[(int) file.length()];
506
			InputStream input = null;
507
			try {
508
				int totalBytesRead = 0;
509
				input = new BufferedInputStream(new FileInputStream(file));
510
				while (totalBytesRead < buffer.length) {
511
					int bytesRemaining = buffer.length - totalBytesRead;
512
					// input.read() returns -1, 0, or more :
513
					int bytesRead = input.read(buffer, totalBytesRead,
514
							bytesRemaining);
515
					if (bytesRead > 0) {
516
						totalBytesRead = totalBytesRead + bytesRead;
517
					}
518
				}
519
				/*
520
				 * the above style is a bit tricky: it places bytes into the
521
				 * 'buffer' array; 'buffer' is an output parameter; the while
522
				 * loop usually has a single iteration only.
523
				 */
524
			} finally {
525
				input.close();
526
			}
527
 
528
 
529
 
530
 
531
			response.setContentType("application/vnd.ms-excel");
532
			response.setHeader("Content-disposition", "inline; filename="
533
					+ file.getName());
534
 
535
			ServletOutputStream sos = response.getOutputStream();
536
			sos.write(buffer);
537
			sos.flush();      
538
 
539
		}
540
		catch (Exception e) {
541
		}
542
 
543
	}
544
 
545
	/*public static void main(String[] args) throws Exception{
546
 
547
	}*/
5711 mandeep.dh 548
}