Subversion Repositories SmartDukaan

Rev

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

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