Subversion Repositories SmartDukaan

Rev

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