Subversion Repositories SmartDukaan

Rev

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

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