Subversion Repositories SmartDukaan

Rev

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