Subversion Repositories SmartDukaan

Rev

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

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