Subversion Repositories SmartDukaan

Rev

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