Subversion Repositories SmartDukaan

Rev

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