Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
7283 kshitij.so 1
package in.shop2020.support.controllers;
2
 
8362 kshitij.so 3
import java.io.BufferedInputStream;
12449 kshitij.so 4
import java.io.BufferedReader;
7524 kshitij.so 5
import java.io.File;
7741 kshitij.so 6
import java.io.FileInputStream;
12449 kshitij.so 7
import java.io.FileNotFoundException;
8
import java.io.FileReader;
8362 kshitij.so 9
import java.io.FileWriter;
7524 kshitij.so 10
import java.io.IOException;
8362 kshitij.so 11
import java.io.InputStream;
12449 kshitij.so 12
import java.text.ParseException;
13
import java.util.ArrayList;
8620 kshitij.so 14
import java.util.Arrays;
12449 kshitij.so 15
import java.util.Calendar;
16
import java.util.Date;
17
import java.util.GregorianCalendar;
7365 kshitij.so 18
import java.util.HashMap;
7283 kshitij.so 19
import java.util.List;
20
import java.util.Map;
21
 
7591 kshitij.so 22
import javax.servlet.ServletContext;
8362 kshitij.so 23
import javax.servlet.ServletOutputStream;
7283 kshitij.so 24
import javax.servlet.ServletRequest;
25
import javax.servlet.http.HttpServletRequest;
8168 kshitij.so 26
import javax.servlet.http.HttpServletResponse;
7591 kshitij.so 27
import javax.servlet.http.HttpSession;
7283 kshitij.so 28
 
12449 kshitij.so 29
import in.shop2020.model.v1.catalog.AmazonPromotionType;
7283 kshitij.so 30
import in.shop2020.model.v1.catalog.Amazonlisted;
31
import in.shop2020.model.v1.catalog.CatalogServiceException;
32
import in.shop2020.model.v1.catalog.Item;
11197 kshitij.so 33
import in.shop2020.model.v1.inventory.AmazonFbaInventorySnapshot;
7283 kshitij.so 34
import in.shop2020.model.v1.inventory.AmazonInventorySnapshot;
12449 kshitij.so 35
import in.shop2020.model.v1.catalog.AmazonPromotion;
7283 kshitij.so 36
import in.shop2020.model.v1.catalog.CatalogService.Client;
37
import in.shop2020.model.v1.inventory.InventoryServiceException;
7741 kshitij.so 38
import in.shop2020.model.v1.order.AmazonOrder;
7591 kshitij.so 39
import in.shop2020.support.utils.ReportsUtils;
12449 kshitij.so 40
import in.shop2020.support.utils.PromotionFeed;
7283 kshitij.so 41
import in.shop2020.thrift.clients.CatalogClient;
42
import in.shop2020.thrift.clients.InventoryClient;
7365 kshitij.so 43
import in.shop2020.thrift.clients.LogisticsClient;
7741 kshitij.so 44
import in.shop2020.thrift.clients.TransactionClient;
7365 kshitij.so 45
import in.shop2020.logistics.DeliveryType;
46
import in.shop2020.logistics.LogisticsInfo;
47
import in.shop2020.logistics.LogisticsServiceException;
48
import in.shop2020.logistics.PickUpType;
7283 kshitij.so 49
 
7524 kshitij.so 50
import org.apache.commons.io.FileUtils;
7365 kshitij.so 51
import org.apache.commons.lang.xwork.StringUtils;
7741 kshitij.so 52
import org.apache.poi.hssf.usermodel.HSSFSheet;
53
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
8168 kshitij.so 54
import org.apache.poi.ss.usermodel.Cell;
7591 kshitij.so 55
import org.apache.struts2.convention.annotation.InterceptorRef;
56
import org.apache.struts2.convention.annotation.InterceptorRefs;
7283 kshitij.so 57
import org.apache.struts2.convention.annotation.Result;
58
import org.apache.struts2.convention.annotation.Results;
59
import org.apache.struts2.interceptor.ServletRequestAware;
8168 kshitij.so 60
import org.apache.struts2.interceptor.ServletResponseAware;
61
import org.apache.struts2.util.ServletContextAware;
7283 kshitij.so 62
import org.apache.thrift.TException;
7741 kshitij.so 63
import org.apache.thrift.transport.TTransportException;
7283 kshitij.so 64
import org.slf4j.Logger;
65
import org.slf4j.LoggerFactory;
66
 
12449 kshitij.so 67
import com.amazonaws.mws.MarketplaceWebServiceException;
68
import com.ibm.icu.text.SimpleDateFormat;
7283 kshitij.so 69
import com.opensymphony.xwork2.ValidationAwareSupport;
70
 
71
@SuppressWarnings("serial")
8620 kshitij.so 72
 
7591 kshitij.so 73
@InterceptorRefs({
12449 kshitij.so 74
    @InterceptorRef("defaultStack"),
75
    @InterceptorRef("login")
7591 kshitij.so 76
})
7283 kshitij.so 77
@Results({
12449 kshitij.so 78
    @Result(name = "redirect", location = "${url}", type = "redirect"),
79
    @Result(name="authsuccess", type="redirectAction", params = {"actionName" , "reports"})
7524 kshitij.so 80
})
8168 kshitij.so 81
public class AmazonListController extends ValidationAwareSupport implements ServletRequestAware ,ServletResponseAware, ServletContextAware{
7283 kshitij.so 82
 
12449 kshitij.so 83
    private static Logger logger = LoggerFactory.getLogger(AmazonListController.class);
7283 kshitij.so 84
 
12449 kshitij.so 85
    private HttpServletRequest request;
86
    private HttpSession session;
87
    private ServletContext context;
88
    private HttpServletResponse response;
89
    private String url;
90
    private String id;
91
    private String itemId;
92
    private String isFba;
93
    private String isNonFba;
94
    private String isInventoryOverride;
95
    private String fbaPrice;
96
    private String sellingPrice;
97
    private String saholicPrice;
98
    private String isTime;
99
    private String handlingTime;
100
    private String customHandlingTime;
101
    private String holdInventory;
102
    private String defaultInventory;
103
    private String fileUploadFileName;
104
    private String fileUploadContentType;
105
    private String suppressMfnPriceUpdate;
106
    private String suppressFbaPriceUpdate;
107
    private File file;
108
    private String errMsg;
109
    private String next;
110
    private List<Amazonlisted> amazonItems;
111
    private String searchText;
112
    private long searchCount;
113
    private long totalCount;
114
    private String taxCode;
115
    private String fbbTaxCode;
116
    private String isFbb;
117
    private String fbbPrice;
118
    private String suppressFbbPriceUpdate;
119
    private String startDate;
120
    private String endDate;
121
    private List<AmazonPromotion> promotionResult;
122
    private String promotionType;
123
    private String overrrideWanlc;
124
    private String exceptionalWanlc;
125
    private String autoDecrement;
126
    private String autoIncrement;
127
    private String autoFavourite;
128
    private String manualFavourite;
129
    private String otherCost;
130
 
131
    public String getOtherCost() {
132
        return otherCost;
133
    }
7283 kshitij.so 134
 
12449 kshitij.so 135
    public void setOtherCost(String otherCost) {
136
        this.otherCost = otherCost;
137
    }
7283 kshitij.so 138
 
12449 kshitij.so 139
    public String getAutoDecrement() {
140
        return autoDecrement;
141
    }
7283 kshitij.so 142
 
12449 kshitij.so 143
    public void setAutoDecrement(String autoDecrement) {
144
        this.autoDecrement = autoDecrement;
145
    }
8620 kshitij.so 146
 
12449 kshitij.so 147
    public String getAutoIncrement() {
148
        return autoIncrement;
149
    }
7283 kshitij.so 150
 
12449 kshitij.so 151
    public void setAutoIncrement(String autoIncrement) {
152
        this.autoIncrement = autoIncrement;
153
    }
7365 kshitij.so 154
 
12449 kshitij.so 155
    public String getAutoFavourite() {
156
        return autoFavourite;
157
    }
7365 kshitij.so 158
 
12449 kshitij.so 159
    public void setAutoFavourite(String autoFavourite) {
160
        this.autoFavourite = autoFavourite;
161
    }
7365 kshitij.so 162
 
12449 kshitij.so 163
    public String getManualFavourite() {
164
        return manualFavourite;
165
    }
8620 kshitij.so 166
 
12449 kshitij.so 167
    public void setManualFavourite(String manualFavourite) {
168
        this.manualFavourite = manualFavourite;
169
    }
170
 
171
 
172
    public String index() {
173
        if (!ReportsUtils.canAccessReport((Long) session.getAttribute(ReportsUtils.ROLE),request.getServletPath())) {
174
            return "authfail";
175
        }
176
        return "index";
177
    }
178
 
179
    public String fetchItems() throws TException {
180
        Client CatalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
181
        if (searchText.length() == 0) {
182
            amazonItems = CatalogClient.getAmazonListedItems(Long.valueOf(next), 10);
183
            totalCount = CatalogClient.getCountForAmazonlistedItems();
184
            setSearchCount(totalCount);
185
        } else {
186
            List<String> subString = Arrays.asList(searchText.split(" "));
187
            amazonItems = CatalogClient.searchAmazonItems(subString,Long.valueOf(next), 10);
188
            totalCount = CatalogClient.getCountForAmazonlistedItems();
189
            searchCount = CatalogClient.getAmazonSearchResultCount(subString);
190
        }
191
        return "amazon-item-table";
192
    }
193
 
194
 
195
    public Amazonlisted fetchItemDetail() throws NumberFormatException, TException {
196
        Client CatalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
197
        return CatalogClient.getAmazonItemDetails(Long.valueOf(id));
198
    }
199
 
200
    public Item getSaholicItem(String id) throws NumberFormatException, CatalogServiceException, TException {
201
        Client CatalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
202
        return CatalogClient.getItem(Long.valueOf(id));
203
    }
204
 
205
 
206
 
207
    public String update() throws NumberFormatException, TException{
208
        Client CatalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
209
        boolean flag=false;
210
        boolean commit=false;
211
        long delay = Long.valueOf(customHandlingTime);
212
        if ( Boolean.valueOf(isTime)) {
213
            flag = true;
214
        }
215
        changeItemInventory();
216
        Amazonlisted amazonlisted = CatalogClient.getAmazonItemDetails(Long.valueOf(itemId));
217
        if (amazonlisted.getSellingPrice()!=Double.valueOf(sellingPrice)){
218
            amazonlisted.setSellingPrice(Double.valueOf(sellingPrice));
219
            commit=true;
220
        }
221
        if (amazonlisted.getFbaPrice()!=Double.valueOf(fbaPrice)){
222
            amazonlisted.setFbaPrice(Double.valueOf(fbaPrice));
223
            commit=true;
224
        }
225
        if (amazonlisted.isIsFba()!=Boolean.valueOf(isFba)){
226
            amazonlisted.setIsFba(Boolean.valueOf(isFba));
227
            commit=true;
228
        }
229
        if (amazonlisted.isIsNonFba()!=Boolean.valueOf(isNonFba)){
230
            amazonlisted.setIsNonFba(Boolean.valueOf(isNonFba));
231
            commit=true;
232
        }
233
        if (amazonlisted.isIsCustomTime()!=flag){
234
            amazonlisted.setIsCustomTime(flag);
235
            commit=true;
236
        }
237
        if (amazonlisted.getHandlingTime()!=delay){
238
            amazonlisted.setHandlingTime(delay);
239
            commit=true;
240
        }
241
        if(amazonlisted.isIsInventoryOverride()!=Boolean.valueOf(isInventoryOverride)){
242
            amazonlisted.setIsInventoryOverride(Boolean.valueOf(isInventoryOverride));
243
            commit=true;
244
        }
245
        if(amazonlisted.isSuppressMfnPriceUpdate()!=Boolean.valueOf(suppressMfnPriceUpdate)){
246
            amazonlisted.setSuppressMfnPriceUpdate(Boolean.valueOf(suppressMfnPriceUpdate));
247
            commit=true;
248
        }
249
        if(amazonlisted.isSuppressFbaPriceUpdate()!=Boolean.valueOf(suppressFbaPriceUpdate)){
250
            amazonlisted.setSuppressFbaPriceUpdate(Boolean.valueOf(suppressFbaPriceUpdate));
251
            commit=true;
252
        }
253
 
254
        if(!StringUtils.equals(amazonlisted.getTaxCode(), taxCode)){
255
            amazonlisted.setTaxCode(taxCode);
256
            commit=true;
257
        }
258
 
259
        if(!StringUtils.equals(amazonlisted.getFbbtaxCode(), fbbTaxCode)){
10922 kshitij.so 260
            amazonlisted.setFbbtaxCode(fbbTaxCode);
261
            commit=true;
262
        }
12449 kshitij.so 263
 
264
        if(amazonlisted.isSuppressFbbPriceUpdate()!=Boolean.valueOf(suppressFbbPriceUpdate)){
10922 kshitij.so 265
            amazonlisted.setSuppressFbbPriceUpdate(Boolean.valueOf(suppressFbbPriceUpdate));
266
            commit=true;
267
        }
12449 kshitij.so 268
 
269
        if (amazonlisted.getFbbPrice()!=Double.valueOf(fbbPrice)){
10922 kshitij.so 270
            amazonlisted.setFbbPrice(Double.valueOf(fbbPrice));
271
            commit=true;
272
        }
12449 kshitij.so 273
 
274
        if (amazonlisted.isIsFbb()!=Boolean.valueOf(isFbb)){
10922 kshitij.so 275
            amazonlisted.setIsFbb(Boolean.valueOf(isFbb));
276
            commit=true;
277
        }
8620 kshitij.so 278
 
12449 kshitij.so 279
        if (amazonlisted.isAutoDecrement()!=Boolean.valueOf(autoDecrement)){
280
            amazonlisted.setAutoDecrement(Boolean.valueOf(autoDecrement));
281
            commit=true;
282
        }
283
 
284
        if (amazonlisted.isAutoIncrement()!=Boolean.valueOf(autoIncrement)){
285
            amazonlisted.setAutoIncrement(Boolean.valueOf(autoIncrement));
286
            commit=true;
287
        }
288
 
289
        if (amazonlisted.isManualFavourite()!=Boolean.valueOf(manualFavourite)){
290
            amazonlisted.setManualFavourite(Boolean.valueOf(manualFavourite));
291
            commit=true;
292
        }
7283 kshitij.so 293
 
294
 
12449 kshitij.so 295
        if (amazonlisted.isOverrrideWanlc()!=Boolean.valueOf(overrrideWanlc)){
296
            amazonlisted.setOverrrideWanlc(Boolean.valueOf(overrrideWanlc));
297
            commit=true;
298
        }
7524 kshitij.so 299
 
12449 kshitij.so 300
        if (amazonlisted.getExceptionalWanlc()!=Double.valueOf(exceptionalWanlc)){
301
            amazonlisted.setExceptionalWanlc(Double.valueOf(exceptionalWanlc));
302
            commit=true;
303
        }
304
 
305
        if (amazonlisted.getOtherCost()!=Double.valueOf(otherCost)){
306
            amazonlisted.setOtherCost(Double.valueOf(otherCost));
307
            commit=true;
308
        }
8620 kshitij.so 309
 
12449 kshitij.so 310
        if(commit){
311
            CatalogClient.updateAmazonItemDetails(amazonlisted);
312
        }
313
        else{
314
            logger.info("Nothing new to commit");
315
        }
316
        return "index";
8620 kshitij.so 317
 
12449 kshitij.so 318
    }
7524 kshitij.so 319
 
12449 kshitij.so 320
    public void upload() throws IOException, TException {
321
        File fileToCreate = new File("/tmp/", "Amazon-shipping.xls");
322
        FileUtils.copyFile(this.file, fileToCreate);
323
        FileInputStream iFile = new FileInputStream(new File(file.getAbsolutePath()));
324
        HSSFWorkbook workbook = new HSSFWorkbook(iFile);
325
        HSSFSheet sheet = workbook.getSheetAt(0);
326
        Map<Long,Map<String,String>> amazonOrderMap = new HashMap<Long,Map<String,String>>();
327
        for (int iterator=sheet.getFirstRowNum();iterator<=sheet.getLastRowNum();iterator++){
328
            TransactionClient tcl = new TransactionClient();
329
            List<AmazonOrder> orders = tcl.getClient().getAmazonOrderByAmazonOrderId(sheet.getRow(iterator).getCell(0).getStringCellValue());
330
            for (AmazonOrder order : orders){
331
                if (StringUtils.equals(order.getStatus(), "Order-Payment-Success")){
332
                    Map<String,String> dateMap = new HashMap<String,String>();
333
                    dateMap.put(sheet.getRow(iterator).getCell(1).getStringCellValue(), sheet.getRow(iterator).getCell(2).getStringCellValue());
334
                    amazonOrderMap.put(order.getOrderId(), dateMap);
335
                }
336
            }
337
        }
338
        TransactionClient tcl = new TransactionClient();
339
        tcl.getClient().updateTimestampForAmazonOrder(amazonOrderMap);
340
    }
7461 kshitij.so 341
 
12449 kshitij.so 342
    public void uploadPromotionSheet() throws IOException, ParseException, TException, CatalogServiceException{
343
        Map<String,AmazonPromotion> amazonPromoMap = new HashMap<String,AmazonPromotion>();
344
        SimpleDateFormat dateFormatter;
345
        if (promotionType.equalsIgnoreCase("SHORTTERM")){
346
            dateFormatter = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
347
        }
348
        else{
349
            dateFormatter = new SimpleDateFormat("yyyy-MM-dd");
350
        }
351
        File fileToCreate = new File("/tmp/", "Amazon-Promotion-"+String.valueOf(getTimeInMilliseconds())+".xls");
352
        FileUtils.copyFile(this.file, fileToCreate);
353
        BufferedReader reader = null;
354
        try {
355
            reader = new BufferedReader(new FileReader(file.getAbsolutePath()));
356
        } catch (FileNotFoundException e1) {
357
            // TODO Auto-generated catch block
358
            e1.printStackTrace();
359
        }
360
        String str;
361
        int lineNumber = 0;
362
        while ((str = reader.readLine()) != null) {
363
            lineNumber++;
364
            if (str.trim().length() == 0 || lineNumber<4) {
365
                continue;
366
            }
7461 kshitij.so 367
 
12449 kshitij.so 368
            String[] values = str.split("\t");
369
            AmazonPromotion amazonPromotion = new AmazonPromotion();
370
            amazonPromotion.setSku(values[0]);
12460 kshitij.so 371
            amazonPromotion.setStandardPrice(Double.valueOf(values[1]));
372
            amazonPromotion.setSalePrice(Double.valueOf(values[2]));
373
            amazonPromotion.setSubsidyAmount(Double.valueOf(values[3]));
374
            Date startDate = dateFormatter.parse(values[4]);
375
            Date endDate = dateFormatter.parse(values[5]);
12449 kshitij.so 376
            amazonPromotion.setStartDate(startDate.getTime());
377
            amazonPromotion.setEndDate(endDate.getTime());
378
            amazonPromotion.setPromotionActive(true);
379
            amazonPromotion.setPromotionType(AmazonPromotionType.valueOf(promotionType));
380
            amazonPromoMap.put(amazonPromotion.getSku(), amazonPromotion);
381
        }
382
        Client cc = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
383
        if (!cc.addAmazonPromotion(amazonPromoMap)){
384
            throw new CatalogServiceException();
385
        }
386
//        if (promotionType.equalsIgnoreCase("LONGTERM")){
387
//            PromotionFeed pm = new PromotionFeed();
388
//            List<AmazonPromotion> list = new ArrayList<AmazonPromotion>(amazonPromoMap.values());
389
//            String fPath = pm.CreatePromotionFeed(list);
390
//            try {
391
//                logger.info(fPath);
392
//                pm.SubmitPromotionFeed(fPath);
393
//            } catch (InterruptedException e) {
394
//                // TODO Auto-generated catch block
395
//                e.printStackTrace();
396
//            } catch (MarketplaceWebServiceException e) {
397
//                // TODO Auto-generated catch block
398
//                e.printStackTrace();
399
//            }
400
//        }
401
    }
7283 kshitij.so 402
 
403
 
404
 
12449 kshitij.so 405
    private void changeItemInventory() throws NumberFormatException, TException {
406
        Client CatalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
7283 kshitij.so 407
 
12449 kshitij.so 408
        if (StringUtils.isEmpty(holdInventory)) {
409
            holdInventory = "0";
410
        }
411
        if (StringUtils.isEmpty(defaultInventory)) {
412
            defaultInventory = "0";
413
        }
414
        CatalogClient.updateItemInventory(Long.valueOf(itemId),Long.valueOf(holdInventory),Long.valueOf(defaultInventory));
415
    }
7283 kshitij.so 416
 
417
 
12449 kshitij.so 418
    public Map<Long, Long> getAvailableItemInventory(String itemId) throws NumberFormatException, InventoryServiceException, TException{
419
        InventoryClient inventoryServiceClient = new InventoryClient();
420
        in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
421
        in.shop2020.model.v1.inventory.ItemInventory thriftItemInventory = inventoryClient.getItemInventoryByItemId(Long.valueOf(itemId));
422
        return thriftItemInventory.getAvailability();
8620 kshitij.so 423
 
12449 kshitij.so 424
    }
7365 kshitij.so 425
 
12449 kshitij.so 426
    public Map<Long, Long> getReservedItemInventory(String itemId) throws NumberFormatException, InventoryServiceException, TException{
427
        InventoryClient inventoryServiceClient = new InventoryClient();
428
        in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
429
        in.shop2020.model.v1.inventory.ItemInventory thriftItemInventory = inventoryClient.getItemInventoryByItemId(Long.valueOf(itemId));
430
        return thriftItemInventory.getReserved();
7365 kshitij.so 431
 
12449 kshitij.so 432
    }
8070 kshitij.so 433
 
12449 kshitij.so 434
    public String getWarehouseName(String warehouseId) throws NumberFormatException, TException { 
435
        InventoryClient inventoryServiceClient = new InventoryClient();
436
        return inventoryServiceClient.getClient().getWarehouseName(Long.valueOf(warehouseId));
437
    }
438
 
439
    public AmazonInventorySnapshot getInventoryForAmazonItem(String itemId) throws NumberFormatException, TException {
440
        InventoryClient inventoryServiceClient = new InventoryClient();
441
        try { 
442
            return inventoryServiceClient.getClient().getAmazonInventoryForItem(Long.valueOf(itemId));
443
        }
444
        catch (Exception e){
445
            return null;
446
        }
447
    }
448
 
449
    public List<AmazonFbaInventorySnapshot> getFbaInventoryForAmazonItem(String itemId) throws NumberFormatException, TException {
450
        InventoryClient inventoryServiceClient = new InventoryClient();
451
        try { 
452
            return inventoryServiceClient.getClient().getAmazonFbaItemInventory(Long.valueOf(itemId));
453
        }
454
        catch (Exception e){
455
            return null;
456
        }
457
    }
458
 
12453 kshitij.so 459
    public Long getTimetoShip(String itemId) throws LogisticsServiceException, TException{
460
        LogisticsClient logisticsClient = new LogisticsClient();
461
        return logisticsClient.getClient().getLogisticsInfo("110001", Long.valueOf(itemId), DeliveryType.COD, PickUpType.COURIER).getShippingTime();
462
    }
463
 
464
//      public Long getTimetoShip(String itemId) throws LogisticsServiceException, TException{
465
//          return 0l;
12449 kshitij.so 466
//    }
467
 
468
 
469
    public double getWanlcForItem(String itemId){
470
        InventoryClient inventoryServiceClient;
471
        try {
472
            inventoryServiceClient = new InventoryClient();
473
        } catch (TTransportException e1) {
474
            // TODO Auto-generated catch block
475
            return 0.0;
476
        }
477
        try { 
478
            return inventoryServiceClient.getClient().getWanNlcForSource(Long.valueOf(itemId), 3);
479
        }
480
        catch (Exception e){
481
            return 0.0;
482
        }
483
    }
484
 
485
    public long getTimeInMilliseconds(){
486
        Calendar cal=GregorianCalendar.getInstance();
487
        return cal.getTimeInMillis();
488
    }
489
 
490
    public String runAsinJob() throws IOException, InterruptedException {
10925 kshitij.so 491
        if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0])) {
492
            logger.info(request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0]);
493
            return "authfail";
494
        }
495
        ProcessBuilder testProcess = new ProcessBuilder("/bin/bash");
12449 kshitij.so 496
        String[] command = {"/bin/bash", "-c", "sudo /root/code/trunk/AmazonFeeds/RunAsinJob.sh"};
497
        testProcess.command(command);
498
        logger.info(testProcess.command().toString());
499
        Process process = testProcess.start();
500
        process.waitFor();
501
        logger.info(String.valueOf(process.exitValue()));
502
        return "asinjob";
503
 
504
    }
505
 
506
    public String runFbbListingJob() throws IOException, InterruptedException {
507
        if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0])) {
508
            logger.info(request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0]);
509
            return "authfail";
510
        }
511
        ProcessBuilder testProcess = new ProcessBuilder("/bin/bash");
10925 kshitij.so 512
        String[] command = {"/bin/bash", "-c", "sudo /root/code/trunk/AmazonFeeds/RunFbbListingJob.sh"};
513
        testProcess.command(command);
514
        logger.info(testProcess.command().toString());
515
        Process process = testProcess.start();
516
        process.waitFor();
517
        logger.info(String.valueOf(process.exitValue()));
518
        return "asinjob";
519
    }
8620 kshitij.so 520
 
521
 
12449 kshitij.so 522
    public String runFbaListingJob() throws IOException, InterruptedException {
523
        if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0])) {
524
            logger.info(request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0]);
525
            return "authfail";
526
        }
527
        ProcessBuilder testProcess = new ProcessBuilder("/bin/bash");
528
        String[] command = {"/bin/bash", "-c", "sudo /root/code/trunk/AmazonFeeds/RunFbaListingJob.sh"};
529
        testProcess.command(command);
530
        logger.info(testProcess.command().toString());
531
        Process process = testProcess.start();
532
        process.waitFor();
533
        logger.info(String.valueOf(process.exitValue()));
534
        return "asinjob";
535
    }
8073 kshitij.so 536
 
12449 kshitij.so 537
    public String runNonFbaListingJob() throws IOException, InterruptedException {
538
        if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0])) {
539
            logger.info(request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0]);
540
            return "authfail";
541
        }
542
        ProcessBuilder testProcess = new ProcessBuilder("/bin/bash");
543
        String[] command = {"/bin/bash", "-c", "sudo /root/code/trunk/AmazonFeeds/RunNonFbaListingJob.sh"};
544
        testProcess.command(command);
545
        logger.info(testProcess.command().toString());
546
        Process process = testProcess.start();
547
        process.waitFor();
548
        logger.info(String.valueOf(process.exitValue()));
549
        return "asinjob";
550
    }
8620 kshitij.so 551
 
12449 kshitij.so 552
    public void runFbaInventoryJob() throws IOException, InterruptedException {
553
        ProcessBuilder testProcess = new ProcessBuilder("/bin/bash");
554
        String[] command = {"/bin/bash", "-c", "sudo /root/code/trunk/AmazonFeeds/SubmitFBAInventoryFeed.sh"};
555
        testProcess.command(command);
556
        logger.info(testProcess.command().toString());
557
        Process process = testProcess.start();
558
        process.waitFor();
559
        logger.info(String.valueOf(process.exitValue()));
560
    }
8620 kshitij.so 561
 
12449 kshitij.so 562
    public void uploadAsinFile() throws IOException, TException{
563
        File fileToCreate = new File("/tmp/", "Amazon-asin-upload.xls");
564
        FileUtils.copyFile(this.file, fileToCreate);
565
        FileInputStream iFile = new FileInputStream(new File(file.getAbsolutePath()));
566
        HSSFWorkbook workbook = new HSSFWorkbook(iFile);
567
        HSSFSheet sheet = workbook.getSheetAt(0);
568
        Map<Long,Item> amazonAsin = new HashMap<Long,Item>();
569
        StringBuilder sb =new StringBuilder();
570
        Client CatalogClient=null;
571
        try {
572
            CatalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
573
        } catch (TTransportException e) {
574
            e.printStackTrace();
575
        }
576
        for (int iterator=(sheet.getFirstRowNum()+1);iterator<=sheet.getLastRowNum();iterator++){
577
            Item item=null;
578
            Long sku;
579
            String asin;
580
            if (checkEmptyString(sheet.getRow(iterator).getCell(0))){
581
                continue;
582
            }
583
            else {
584
                sku=(long) sheet.getRow(iterator).getCell(0).getNumericCellValue();
585
                try {
586
                    item = CatalogClient.getItem(sku);
587
                } catch (Exception e) {
588
                    logger.info("Unable to fetch item details ID= "+sku);
589
                    logger.info("Unable to fetch item. "+e);
590
                    sb.append("Service exception ItemId not updated Id= "+sku+"\n");
591
                    continue;
592
                } 
593
            }
8620 kshitij.so 594
 
12449 kshitij.so 595
            if(item.getId() == 0){
596
                logger.info("Item Id doesn't exist in catalog Id= "+sku);
597
                sb.append("Item Id doesn't exist in catalog Id= "+sku+"\n");
598
                continue;
599
            }
8620 kshitij.so 600
 
12449 kshitij.so 601
            if (!checkEmptyString(sheet.getRow(iterator).getCell(1))){
602
                asin = sheet.getRow(iterator).getCell(1).getStringCellValue();
603
                item.setAsin(asin);
604
            }
8620 kshitij.so 605
 
12449 kshitij.so 606
            if (!checkEmptyString(sheet.getRow(iterator).getCell(2))){
607
                long virtualInventory =(long) sheet.getRow(iterator).getCell(2).getNumericCellValue();
608
                item.setDefaultInventory(virtualInventory);
609
            }
8620 kshitij.so 610
 
12449 kshitij.so 611
            if (!checkEmptyString(sheet.getRow(iterator).getCell(3))){
612
                long riskyInventory =(long) sheet.getRow(iterator).getCell(3).getNumericCellValue();
613
                item.setHoldInventory(riskyInventory);
614
            }
8620 kshitij.so 615
 
12449 kshitij.so 616
            amazonAsin.put(sku, item);
617
        }
618
        CatalogClient.updateAsin(amazonAsin);
8620 kshitij.so 619
 
12449 kshitij.so 620
        logger.info("Amazon Asin Map "+amazonAsin.toString());
621
        CatalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
622
        CatalogClient.updateAsin(amazonAsin);
623
        File file = new File("/tmp/asinfile");
624
        FileWriter writer = new FileWriter(file);
625
        writer.append(sb.toString());
626
        writer.close();
627
        byte[] buffer = new byte[(int)file.length()];
628
        InputStream input = null;
629
        try {
630
            int totalBytesRead = 0;
631
            input = new BufferedInputStream(new FileInputStream(file));
632
            while(totalBytesRead < buffer.length){
633
                int bytesRemaining = buffer.length - totalBytesRead;
634
                int bytesRead = input.read(buffer, totalBytesRead, bytesRemaining); 
635
                if (bytesRead > 0){
636
                    totalBytesRead = totalBytesRead + bytesRead;
637
                }
638
            }
639
        }
640
        finally {
641
            input.close();
642
            file.delete();
643
        }
8620 kshitij.so 644
 
12449 kshitij.so 645
        response.setHeader("Content-Type", "text/javascript");
8168 kshitij.so 646
 
12449 kshitij.so 647
        ServletOutputStream sos;
648
        try {
649
            sos = response.getOutputStream();
650
            sos.write(buffer);
651
            sos.flush();
652
        } catch (IOException e) {
653
            System.out.println("Unable to stream the manifest file");
654
        }   
655
    }
8168 kshitij.so 656
 
12449 kshitij.so 657
    public void uploadBulkFile() throws IOException, TException{
658
        File fileToCreate = new File("/tmp/", "Amazon-bulk-upload.xls");
659
        FileUtils.copyFile(this.file, fileToCreate);
660
        FileInputStream iFile = new FileInputStream(new File(file.getAbsolutePath()));
661
        HSSFWorkbook workbook = new HSSFWorkbook(iFile);
662
 
663
        HSSFSheet sheet = workbook.getSheetAt(0);
664
        Map<Long,Amazonlisted> amazonBulkUpdate = new HashMap<Long,Amazonlisted>();
665
        Client CatalogClient=null;
666
        StringBuilder sb = new StringBuilder();
667
        try {
668
            CatalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
669
        } catch (TTransportException e) {
670
            // TODO Auto-generated catch block
671
            e.printStackTrace();
672
        }
673
        for (int iterator=(sheet.getFirstRowNum()+1);iterator<=sheet.getLastRowNum();iterator++){
674
            Amazonlisted amazonlisted =null;
675
            Long sku;
676
            if (checkEmptyString(sheet.getRow(iterator).getCell(0))){
677
                continue;
678
            }
679
            else {
680
                sku=(long) sheet.getRow(iterator).getCell(0).getNumericCellValue();
681
                try {
682
                    amazonlisted = CatalogClient.getAmazonItemDetails(sku);
683
                } catch (TException e) {
684
                    logger.info("Unable to fetch item details ID= "+sku);
685
                    sb.append("Service exception ItemId not updated Id= "+sku+"\n");
686
                    continue;
687
                }
688
            }
689
 
690
            if(amazonlisted.getItemid() == 0){
691
                logger.info("Item Id doesn't exist in amazonlisted Id= "+sku);
692
                sb.append("Item Id doesn't exist in amazonlisted Id= "+sku+"\n");
693
                continue;
694
            }
695
 
696
            if (!checkEmptyString(sheet.getRow(iterator).getCell(1))){
697
                double mfnPrice = sheet.getRow(iterator).getCell(1).getNumericCellValue();
698
                amazonlisted.setSellingPrice(mfnPrice);
699
            }
700
 
701
            if (!checkEmptyString(sheet.getRow(iterator).getCell(2))){
702
                double fbaSellingPrice = sheet.getRow(iterator).getCell(2).getNumericCellValue();
703
                amazonlisted.setFbaPrice(fbaSellingPrice);
704
            }
705
 
706
            if (!checkEmptyString(sheet.getRow(iterator).getCell(3))){
10922 kshitij.so 707
                double fbbSellingPrice = sheet.getRow(iterator).getCell(3).getNumericCellValue();
708
                amazonlisted.setFbbPrice(fbbSellingPrice);
709
            }
8168 kshitij.so 710
 
12449 kshitij.so 711
            if (!checkEmptyString(sheet.getRow(iterator).getCell(4))){
712
                if ((long)sheet.getRow(iterator).getCell(4).getNumericCellValue()==1){
713
                    amazonlisted.setIsNonFba(true);
714
                }
715
                if ((long)sheet.getRow(iterator).getCell(4).getNumericCellValue()==0){
716
                    amazonlisted.setIsNonFba(false);
717
                }
718
            }
8168 kshitij.so 719
 
12449 kshitij.so 720
            if (!checkEmptyString(sheet.getRow(iterator).getCell(5))){
721
                if ((long)sheet.getRow(iterator).getCell(5).getNumericCellValue()==1){
722
                    amazonlisted.setIsFba(true);
723
                }
724
                if ((long)sheet.getRow(iterator).getCell(5).getNumericCellValue()==0){
725
                    amazonlisted.setIsFba(false);
726
                }
727
            }
728
 
729
            if (!checkEmptyString(sheet.getRow(iterator).getCell(6))){
10922 kshitij.so 730
                if ((long)sheet.getRow(iterator).getCell(6).getNumericCellValue()==1){
731
                    amazonlisted.setIsFbb(true);
732
                }
733
                if ((long)sheet.getRow(iterator).getCell(6).getNumericCellValue()==0){
734
                    amazonlisted.setIsFbb(false);
735
                }
736
            }
8168 kshitij.so 737
 
12449 kshitij.so 738
            if (!checkEmptyString(sheet.getRow(iterator).getCell(7))){
739
                if ((long)sheet.getRow(iterator).getCell(7).getNumericCellValue()==1){
740
                    amazonlisted.setIsInventoryOverride(true);
741
                }
742
                if ((long)sheet.getRow(iterator).getCell(7).getNumericCellValue()==0){
743
                    amazonlisted.setIsInventoryOverride(false);
744
                }
745
            }
746
            if (!checkEmptyString(sheet.getRow(iterator).getCell(8))){
747
                if ((long)sheet.getRow(iterator).getCell(8).getNumericCellValue()==1){
748
                    amazonlisted.setSuppressMfnPriceUpdate(true);
749
                }
750
                if ((long)sheet.getRow(iterator).getCell(8).getNumericCellValue()==0){
751
                    amazonlisted.setSuppressMfnPriceUpdate(false);
752
                }
753
            }
754
 
755
            if (!checkEmptyString(sheet.getRow(iterator).getCell(9))){
756
                if ((long)sheet.getRow(iterator).getCell(9).getNumericCellValue()==1){
757
                    amazonlisted.setSuppressFbaPriceUpdate(true);
758
                }
759
                if ((long)sheet.getRow(iterator).getCell(9).getNumericCellValue()==0){
760
                    amazonlisted.setSuppressFbaPriceUpdate(false);
761
                }
762
            }
763
 
764
            if (!checkEmptyString(sheet.getRow(iterator).getCell(10))){
10922 kshitij.so 765
                if ((long)sheet.getRow(iterator).getCell(10).getNumericCellValue()==1){
766
                    amazonlisted.setSuppressFbbPriceUpdate(true);
767
                }
768
                if ((long)sheet.getRow(iterator).getCell(10).getNumericCellValue()==0){
769
                    amazonlisted.setSuppressFbbPriceUpdate(false);
770
                }
771
            }
8620 kshitij.so 772
 
12449 kshitij.so 773
            if (!checkEmptyString(sheet.getRow(iterator).getCell(11))){
774
                String taxCode = sheet.getRow(iterator).getCell(11).getStringCellValue();
775
                amazonlisted.setTaxCode(taxCode);
776
            }
777
 
778
            if (!checkEmptyString(sheet.getRow(iterator).getCell(12))){
10922 kshitij.so 779
                String fbbTaxCode = sheet.getRow(iterator).getCell(12).getStringCellValue();
780
                amazonlisted.setFbbtaxCode(fbbTaxCode);
781
            }
8362 kshitij.so 782
 
12449 kshitij.so 783
            amazonBulkUpdate.put(sku, amazonlisted);
784
        }
785
        logger.info("Amazon Bulk Map "+amazonBulkUpdate.toString());
786
        CatalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
787
        boolean result = CatalogClient.updateAmazonAttributesInBulk(amazonBulkUpdate);
788
        if (!result){
789
            sb = new StringBuilder();
790
            sb.append("Error : Unable to update");
791
        }
792
        File file = new File("/tmp/amazonbulk");
793
        FileWriter writer = new FileWriter(file);
794
        writer.append(sb.toString());
795
        writer.close();
796
        byte[] buffer = new byte[(int)file.length()];
797
        InputStream input = null;
798
        try {
799
            int totalBytesRead = 0;
800
            input = new BufferedInputStream(new FileInputStream(file));
801
            while(totalBytesRead < buffer.length){
802
                int bytesRemaining = buffer.length - totalBytesRead;
803
                int bytesRead = input.read(buffer, totalBytesRead, bytesRemaining); 
804
                if (bytesRead > 0){
805
                    totalBytesRead = totalBytesRead + bytesRead;
806
                }
807
            }
808
        }
809
        finally {
810
            input.close();
811
            file.delete();
812
        }
8362 kshitij.so 813
 
12449 kshitij.so 814
        response.setHeader("Content-Type", "text/javascript");
8168 kshitij.so 815
 
12449 kshitij.so 816
        ServletOutputStream sos;
817
        try {
818
            sos = response.getOutputStream();
819
            sos.write(buffer);
820
            sos.flush();
821
        } catch (IOException e) {
822
            System.out.println("Unable to stream the manifest file");
823
        }   
824
    }
8168 kshitij.so 825
 
8620 kshitij.so 826
 
827
 
8168 kshitij.so 828
 
12449 kshitij.so 829
    public boolean checkEmptyString(Cell cell){
830
        if (cell==null){
831
            return true;
832
        }
833
        return false;
834
    }
8168 kshitij.so 835
 
12449 kshitij.so 836
    public String uploadSheet(){
837
        if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0])) {
838
            logger.info(request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0]);
839
            return "authfail";
840
        }
841
        return "amazon-shipping-upload";
842
    }
8620 kshitij.so 843
 
12449 kshitij.so 844
    public String uploadPromotion(){
845
        if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0])) {
846
            logger.info(request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0]);
847
            return "authfail";
848
        }
849
        return "amazon-promotion-upload";
850
    }
8168 kshitij.so 851
 
12449 kshitij.so 852
    public String uploadAsin(){
853
        if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0])) {
854
            logger.info(request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0]);
855
            return "authfail";
856
        }
857
        return "amazon-asin-upload";
858
    }
8168 kshitij.so 859
 
12449 kshitij.so 860
    public String uploadBulkSheet(){
861
        if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0])) {
862
            logger.info(request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0]);
863
            return "authfail";
864
        }
865
        return "amazon-bulk-upload";
866
    }
7283 kshitij.so 867
 
8168 kshitij.so 868
 
12449 kshitij.so 869
    public String edit() {
870
        if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), request.getRequestURI().substring(request.getContextPath().length()).split("/")[1])) {
871
            return "authfail";
872
        }
873
        return "edit";
874
    }
8620 kshitij.so 875
 
12449 kshitij.so 876
    public String viewPromotionDetails() throws ParseException, TException{
877
        logger.info(startDate);
878
        logger.info(endDate);
879
        SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd");
880
        Date start = dateFormatter.parse(startDate);
881
        Date end = dateFormatter.parse(endDate);
882
        logger.info(start.getTime()+"");
883
        logger.info(end.getTime()+"");
884
        Client cc = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
885
        setPromotionResult(cc.getAmazonPromotion(start.getTime(),end.getTime()));
886
        return "amazon-promotion-result";
887
    }
8620 kshitij.so 888
 
12449 kshitij.so 889
    public String getDate(long timestamp){
890
        return new java.util.Date(timestamp).toLocaleString();
891
    }
7283 kshitij.so 892
 
12449 kshitij.so 893
    public String show() {
894
        if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), request.getRequestURI().substring(request.getContextPath().length()).split("/")[1])) {
895
            logger.info(request.getRequestURI().substring(request.getContextPath().length()).split("/")[1]);
896
            return "authfail";
897
        }
7283 kshitij.so 898
 
12449 kshitij.so 899
        if (StringUtils.equals(id, "options")){
900
            return "options";
901
        }
7283 kshitij.so 902
 
12449 kshitij.so 903
        if (StringUtils.equals(id, "item-table")){
904
            return "amazon-item-table";
905
        }
7283 kshitij.so 906
 
12449 kshitij.so 907
        if (StringUtils.equals(id, "promotion")){
908
            return "amazon-promotion";
909
        }
7283 kshitij.so 910
 
12449 kshitij.so 911
        return "id";
912
    }
7283 kshitij.so 913
 
12449 kshitij.so 914
    public String editNew() {
915
        return "editNew";
916
    }	
7283 kshitij.so 917
 
12449 kshitij.so 918
    public void setId(String id) {
919
        logger.info(id);
920
        this.id = id;
921
    }
7283 kshitij.so 922
 
12449 kshitij.so 923
    public void setUrl(String url) {
924
        this.url = url;
925
    }
7283 kshitij.so 926
 
12449 kshitij.so 927
    public String getUrl() {
928
        return url;
929
    }
7283 kshitij.so 930
 
12449 kshitij.so 931
    public String getId() {
932
        return id;
933
    }
7283 kshitij.so 934
 
12449 kshitij.so 935
    public void setItemId(String itemId) {
936
        this.itemId = itemId;
937
    }
7283 kshitij.so 938
 
12449 kshitij.so 939
    public String getItemId() {
940
        return itemId;
941
    }
7283 kshitij.so 942
 
12449 kshitij.so 943
    public void setIsFba(String isFba) {
944
        this.isFba = isFba;
945
    }
7283 kshitij.so 946
 
12449 kshitij.so 947
    public String getIsFba() {
948
        return isFba;
949
    }
7283 kshitij.so 950
 
12449 kshitij.so 951
    public void setIsNonFba(String isNonFba) {
952
        this.isNonFba = isNonFba;
953
    }
7283 kshitij.so 954
 
12449 kshitij.so 955
    public String getIsNonFba() {
956
        return isNonFba;
957
    }
7283 kshitij.so 958
 
12449 kshitij.so 959
    public void setIsInventoryOverride(String isInventoryOverride) {
960
        this.isInventoryOverride = isInventoryOverride;
961
    }
7365 kshitij.so 962
 
12449 kshitij.so 963
    public String getIsInventoryOverride() {
964
        return isInventoryOverride;
965
    }
7283 kshitij.so 966
 
12449 kshitij.so 967
    public void setSellingPrice(String sellingPrice) {
968
        this.sellingPrice = sellingPrice;
969
    }
7283 kshitij.so 970
 
12449 kshitij.so 971
    public String getSellingPrice() {
972
        return sellingPrice;
973
    }
7365 kshitij.so 974
 
12449 kshitij.so 975
    public void setFbaPrice(String fbaPrice) {
976
        this.fbaPrice = fbaPrice;
977
    }
7365 kshitij.so 978
 
12449 kshitij.so 979
    public String getFbaPrice() {
980
        return fbaPrice;
981
    }
7365 kshitij.so 982
 
12449 kshitij.so 983
    public void setSaholicPrice(String saholicPrice) {
984
        this.saholicPrice = saholicPrice;
985
    }
8168 kshitij.so 986
 
12449 kshitij.so 987
    public String getSaholicPrice() {
988
        return saholicPrice;
989
    }
7365 kshitij.so 990
 
12449 kshitij.so 991
    public void setIsTime(String isTime){
992
        logger.info("set istime"+isTime);
993
        this.isTime = isTime;
994
    }
7524 kshitij.so 995
 
12449 kshitij.so 996
    public String getIsTime(){
997
        return isTime;
998
    }
7365 kshitij.so 999
 
12449 kshitij.so 1000
    public void setHandlingTime(String handlingTime){
1001
        this.handlingTime = handlingTime;
1002
    }
7524 kshitij.so 1003
 
12449 kshitij.so 1004
    public String getHandlingTime(){
1005
        return handlingTime;
1006
    }
7461 kshitij.so 1007
 
12449 kshitij.so 1008
    public void setCustomHandlingTime(String customHandlingTime){
1009
        logger.info("set custom handling time"+customHandlingTime);
1010
        this.customHandlingTime = customHandlingTime;
1011
    }
7461 kshitij.so 1012
 
12449 kshitij.so 1013
    public String getCustomHandlingTime(){
1014
        return customHandlingTime;
1015
    }
7524 kshitij.so 1016
 
12449 kshitij.so 1017
    public void setHoldInventory(String holdInventory){
1018
        this.holdInventory = holdInventory;
1019
    }
7524 kshitij.so 1020
 
12449 kshitij.so 1021
    public String getHoldInventory(){
1022
        return holdInventory;
1023
    }
7524 kshitij.so 1024
 
12449 kshitij.so 1025
    public void setDefaultInventory(String defaultInventory){
1026
        this.defaultInventory = defaultInventory;
1027
    }
7524 kshitij.so 1028
 
12449 kshitij.so 1029
    public String getDefaultInventory(){
1030
        return defaultInventory;
1031
    }
7524 kshitij.so 1032
 
12449 kshitij.so 1033
    public File getFile() {
1034
        return file;
1035
    }
7524 kshitij.so 1036
 
12449 kshitij.so 1037
    public void setFile(File file) {
1038
        this.file = file;
1039
    }
7283 kshitij.so 1040
 
12449 kshitij.so 1041
    public String getFileUploadContentType() {
1042
        return fileUploadContentType;
1043
    }
8168 kshitij.so 1044
 
12449 kshitij.so 1045
    public void setFileUploadContentType(String fileUploadContentType) {
1046
        this.fileUploadContentType = fileUploadContentType;
1047
    }
8168 kshitij.so 1048
 
12449 kshitij.so 1049
    public String getFileUploadFileName() {
1050
        return fileUploadFileName;
1051
    }
8168 kshitij.so 1052
 
12449 kshitij.so 1053
    public void setFileUploadFileName(String fileUploadFileName) {
1054
        this.fileUploadFileName = fileUploadFileName;
1055
    }
8168 kshitij.so 1056
 
12449 kshitij.so 1057
    public void setServletRequest(HttpServletRequest req) {
1058
        this.request = req;
1059
        this.session = req.getSession();        
1060
    }
8168 kshitij.so 1061
 
12449 kshitij.so 1062
    @Override
1063
    public void setServletContext(ServletContext arg0) {
1064
        // TODO Auto-generated method stub
8168 kshitij.so 1065
 
12449 kshitij.so 1066
    }
8362 kshitij.so 1067
 
1068
 
12449 kshitij.so 1069
    public void setSuppressMfnPriceUpdate(String suppressMfnPriceUpdate) {
1070
        this.suppressMfnPriceUpdate = suppressMfnPriceUpdate;
1071
    }
8620 kshitij.so 1072
 
12449 kshitij.so 1073
    public String getSuppressMfnPriceUpdate() {
1074
        return suppressMfnPriceUpdate;
1075
    }
8362 kshitij.so 1076
 
12449 kshitij.so 1077
    public void setSuppressFbaPriceUpdate(String suppressFbaPriceUpdate) {
1078
        this.suppressFbaPriceUpdate = suppressFbaPriceUpdate;
1079
    }
8620 kshitij.so 1080
 
12449 kshitij.so 1081
    public String getSuppressFbaPriceUpdate() {
1082
        return suppressFbaPriceUpdate;
1083
    }
8620 kshitij.so 1084
 
12449 kshitij.so 1085
    public void setErrMsg(String errMsg) {
1086
        this.errMsg = errMsg;
1087
    }
8620 kshitij.so 1088
 
12449 kshitij.so 1089
    public String getErrMsg() {
1090
        return errMsg;
1091
    }
8620 kshitij.so 1092
 
12449 kshitij.so 1093
    public void setServletResponse(HttpServletResponse response) {
1094
        this.response = response;
1095
    }
8620 kshitij.so 1096
 
12449 kshitij.so 1097
    public void setNext(String next) {
1098
        logger.info("next is"+next);
1099
        this.next = next;
1100
    }
8620 kshitij.so 1101
 
12449 kshitij.so 1102
    public String getNext() {
1103
        return next;
1104
    }
8620 kshitij.so 1105
 
12449 kshitij.so 1106
    public void setAmazonItems(List<Amazonlisted> amazonItems) {
1107
        this.amazonItems = amazonItems;
1108
    }
8620 kshitij.so 1109
 
12449 kshitij.so 1110
    public List<Amazonlisted> getAmazonItems() {
1111
        return amazonItems;
1112
    }
8620 kshitij.so 1113
 
12449 kshitij.so 1114
    public void setSearchText(String searchText) {
1115
        this.searchText = searchText;
1116
    }
8620 kshitij.so 1117
 
12449 kshitij.so 1118
    public String getSearchText() {
1119
        return searchText;
1120
    }
8620 kshitij.so 1121
 
12449 kshitij.so 1122
    public long getSearchCount() {
1123
        return searchCount;
1124
    }
1125
 
1126
    public long getTotalCount() {
1127
        return totalCount;
1128
    }
1129
 
1130
    public void setSearchCount(long count) {
1131
        this.searchCount = count;
1132
    }
1133
 
1134
    public void setTaxCode(String taxCode) {
1135
        this.taxCode = taxCode;
1136
    }
1137
 
1138
    public String getTaxCode() {
1139
        return taxCode;
1140
    }
1141
 
10922 kshitij.so 1142
    public void setFbbTaxCode(String fbbTaxCode) {
1143
        this.fbbTaxCode = fbbTaxCode;
1144
    }
1145
 
1146
    public String get() {
1147
        return fbbTaxCode;
1148
    }
1149
 
1150
    public void setIsFbb(String isFbb) {
1151
        this.isFbb = isFbb;
1152
    }
1153
 
1154
    public String getIsFbb() {
1155
        return isFbb;
1156
    }
1157
 
1158
    public void setFbbPrice(String fbbPrice) {
1159
        this.fbbPrice = fbbPrice;
1160
    }
1161
 
1162
    public String getFbbPrice() {
1163
        return fbbPrice;
1164
    }
1165
 
1166
    public void setSuppressFbbPriceUpdate(String suppressFbbPriceUpdate) {
1167
        this.suppressFbbPriceUpdate = suppressFbbPriceUpdate;
1168
    }
1169
 
1170
    public String getSuppressFbbPriceUpdate() {
1171
        return suppressFbbPriceUpdate;
1172
    }
1173
 
12449 kshitij.so 1174
    public String getStartDate() {
1175
        return startDate;
1176
    }
1177
 
1178
    public void setStartDate(String startDate) {
1179
        this.startDate = startDate;
1180
    }
1181
 
1182
    public String getEndDate() {
1183
        return endDate;
1184
    }
1185
 
1186
    public void setEndDate(String endDate) {
1187
        this.endDate = endDate;
1188
    }
1189
 
1190
    public void setPromotionResult(List<AmazonPromotion> promotionResult) {
1191
        this.promotionResult = promotionResult;
1192
    }
1193
 
1194
    public List<AmazonPromotion> getPromotionResult() {
1195
        return promotionResult;
1196
    }
1197
 
1198
    public String getPromotionType() {
1199
        return promotionType;
1200
    }
1201
 
1202
    public void setPromotionType(String promotionType) {
1203
        this.promotionType = promotionType;
1204
    }
1205
 
1206
    public String getOverrrideWanlc() {
1207
        return overrrideWanlc;
1208
    }
1209
 
1210
    public void setOverrrideWanlc(String overrrideWanlc) {
1211
        this.overrrideWanlc = overrrideWanlc;
1212
    }
1213
 
1214
    public String getExceptionalWanlc() {
1215
        return exceptionalWanlc;
1216
    }
1217
 
1218
    public void setExceptionalWanlc(String exceptionalWanlc) {
1219
        this.exceptionalWanlc = exceptionalWanlc;
1220
    }
1221
 
7283 kshitij.so 1222
}