| Line 1... |
Line 1... |
| 1 |
package in.shop2020.support.controllers;
|
1 |
package in.shop2020.support.controllers;
|
| 2 |
|
2 |
|
| - |
|
3 |
import in.shop2020.config.ConfigException;
|
| 3 |
import in.shop2020.model.v1.catalog.CatalogService.Client;
|
4 |
import in.shop2020.model.v1.catalog.CatalogService.Client;
|
| 4 |
import in.shop2020.model.v1.catalog.CatalogServiceException;
|
5 |
import in.shop2020.model.v1.catalog.CatalogServiceException;
|
| 5 |
import in.shop2020.model.v1.catalog.FlipkartItem;
|
6 |
import in.shop2020.model.v1.catalog.FlipkartItem;
|
| 6 |
import in.shop2020.model.v1.catalog.FlipkartItemDetails;
|
7 |
import in.shop2020.model.v1.catalog.FlipkartItemDetails;
|
| 7 |
import in.shop2020.model.v1.catalog.Item;
|
8 |
import in.shop2020.model.v1.catalog.Item;
|
| Line 17... |
Line 18... |
| 17 |
import in.shop2020.support.utils.UpdateFlipkartPricing;
|
18 |
import in.shop2020.support.utils.UpdateFlipkartPricing;
|
| 18 |
import in.shop2020.support.utils.UpdateSDPricingUsingPanel;
|
19 |
import in.shop2020.support.utils.UpdateSDPricingUsingPanel;
|
| 19 |
import in.shop2020.thrift.clients.CatalogClient;
|
20 |
import in.shop2020.thrift.clients.CatalogClient;
|
| 20 |
import in.shop2020.thrift.clients.InventoryClient;
|
21 |
import in.shop2020.thrift.clients.InventoryClient;
|
| 21 |
import in.shop2020.thrift.clients.TransactionClient;
|
22 |
import in.shop2020.thrift.clients.TransactionClient;
|
| - |
|
23 |
import in.shop2020.thrift.clients.config.ConfigClient;
|
| 22 |
import in.shop2020.utils.GmailUtils;
|
24 |
import in.shop2020.utils.GmailUtils;
|
| 23 |
import javax.mail.MessagingException;
|
25 |
import javax.mail.MessagingException;
|
| 24 |
|
26 |
|
| 25 |
import java.io.BufferedInputStream;
|
27 |
import java.io.BufferedInputStream;
|
| 26 |
import java.io.File;
|
28 |
import java.io.File;
|
| Line 125... |
Line 127... |
| 125 |
private String vat;
|
127 |
private String vat;
|
| 126 |
private String comparsionResult;
|
128 |
private String comparsionResult;
|
| 127 |
private String maxSp;
|
129 |
private String maxSp;
|
| 128 |
private String nDaySale;
|
130 |
private String nDaySale;
|
| 129 |
private String fkSerialNumber;
|
131 |
private String fkSerialNumber;
|
| - |
|
132 |
private static String live;
|
| 130 |
|
133 |
|
| 131 |
public String getFkSerialNumber() {
|
134 |
public String getFkSerialNumber() {
|
| 132 |
return fkSerialNumber;
|
135 |
return fkSerialNumber;
|
| 133 |
}
|
136 |
}
|
| 134 |
|
137 |
|
| Line 293... |
Line 296... |
| 293 |
}
|
296 |
}
|
| 294 |
|
297 |
|
| 295 |
public void setFkItemCode(String fkItemCode) {
|
298 |
public void setFkItemCode(String fkItemCode) {
|
| 296 |
this.fkItemCode = fkItemCode;
|
299 |
this.fkItemCode = fkItemCode;
|
| 297 |
}
|
300 |
}
|
| - |
|
301 |
|
| - |
|
302 |
static{
|
| - |
|
303 |
try {
|
| - |
|
304 |
live = ConfigClient.getClient().get("sync_price_on_marketplace");
|
| - |
|
305 |
} catch (ConfigException e) {
|
| - |
|
306 |
logger.error("Unable to get parameter from the config service", e);
|
| - |
|
307 |
live = "false";
|
| - |
|
308 |
}
|
| - |
|
309 |
}
|
| 298 |
|
310 |
|
| 299 |
public String index() {
|
311 |
public String index() {
|
| 300 |
if (!ReportsUtils.canAccessReport((Long) session.getAttribute(ReportsUtils.ROLE),request.getServletPath())) {
|
312 |
if (!ReportsUtils.canAccessReport((Long) session.getAttribute(ReportsUtils.ROLE),request.getServletPath())) {
|
| 301 |
return "authfail";
|
313 |
return "authfail";
|
| 302 |
}
|
314 |
}
|
| Line 363... |
Line 375... |
| 363 |
MarketplacePercentage mpCosting = catalogClient.getCostingForMarketplace(8, Long.valueOf(itemId));
|
375 |
MarketplacePercentage mpCosting = catalogClient.getCostingForMarketplace(8, Long.valueOf(itemId));
|
| 364 |
if (mpCosting.getSource()==0){
|
376 |
if (mpCosting.getSource()==0){
|
| 365 |
throw new CatalogServiceException();
|
377 |
throw new CatalogServiceException();
|
| 366 |
}
|
378 |
}
|
| 367 |
MarketplaceItems mpItem = catalogClient.getMarketplacedetailsForItem(Long.valueOf(itemId),8);
|
379 |
MarketplaceItems mpItem = catalogClient.getMarketplacedetailsForItem(Long.valueOf(itemId),8);
|
| 368 |
double oldPrice = mpItem.getCurrentSp();
|
380 |
boolean toUpdate =false;
|
| - |
|
381 |
if (mpItem.getCurrentSp()!=Double.valueOf(sellingPrice) || flipkartItem.isIsListedOnFlipkart()!=Boolean.valueOf(isListedOnFlipkart) || flipkartItem.isSuppressPriceFeed()!=Boolean.valueOf(isSuppressPriceFeed)){
|
| - |
|
382 |
toUpdate=true;
|
| - |
|
383 |
}
|
| 369 |
mpItem.setEmiFee(mpCosting.getEmiFee());
|
384 |
mpItem.setEmiFee(mpCosting.getEmiFee());
|
| 370 |
mpItem.setReturnProvision(mpCosting.getReturnProvision());
|
385 |
mpItem.setReturnProvision(mpCosting.getReturnProvision());
|
| 371 |
mpItem.setClosingFee(mpCosting.getClosingFee());
|
386 |
mpItem.setClosingFee(mpCosting.getClosingFee());
|
| 372 |
mpItem.setServiceTax(mpCosting.getServiceTax());
|
387 |
mpItem.setServiceTax(mpCosting.getServiceTax());
|
| 373 |
mpItem.setCommission(mpCosting.getCommission());
|
388 |
mpItem.setCommission(mpCosting.getCommission());
|
| Line 407... |
Line 422... |
| 407 |
|
422 |
|
| 408 |
if (t_mpItem.getCurrentSp()< t_mpItem.getMinimumPossibleSp()){
|
423 |
if (t_mpItem.getCurrentSp()< t_mpItem.getMinimumPossibleSp()){
|
| 409 |
sendAlert(t_mpItem.getItemId(),t_mpItem.getCurrentSp(),t_mpItem.getMinimumPossibleSp());
|
424 |
sendAlert(t_mpItem.getItemId(),t_mpItem.getCurrentSp(),t_mpItem.getMinimumPossibleSp());
|
| 410 |
}
|
425 |
}
|
| 411 |
logger.info("\nUpdate Method Item Id "+itemId+"\nSelling Price "+sellingPrice+"\nWarehouse Id "+warehouseId+"\nMax Nlc "+maxNlc+"\nUpdated By: "+session.getAttribute(ReportsUtils.USER_NAME).toString());
|
426 |
logger.info("\nUpdate Method Item Id "+itemId+"\nSelling Price "+sellingPrice+"\nWarehouse Id "+warehouseId+"\nMax Nlc "+maxNlc+"\nUpdated By: "+session.getAttribute(ReportsUtils.USER_NAME).toString());
|
| 412 |
if(oldPrice != t_mpItem.getCurrentSp() && Boolean.valueOf(isListedOnFlipkart) && Boolean.valueOf(isSuppressInventoryFeed)){
|
427 |
if(toUpdate && Boolean.valueOf(live) && Boolean.valueOf(isListedOnFlipkart) && (!Boolean.valueOf(isSuppressPriceFeed))){
|
| 413 |
UpdateFlipkartPricing updateFlipkartPricing = new UpdateFlipkartPricing(Float.valueOf(sellingPrice),fkItemCode,item,timestamp);
|
428 |
UpdateFlipkartPricing updateFlipkartPricing = new UpdateFlipkartPricing(Float.valueOf(sellingPrice),fkItemCode,item,timestamp);
|
| 414 |
updateFlipkartPricing.start();
|
429 |
updateFlipkartPricing.start();
|
| 415 |
}
|
430 |
}
|
| 416 |
return "flipkart-update-result";
|
431 |
return "flipkart-update-result";
|
| 417 |
}
|
432 |
}
|
| Line 620... |
Line 635... |
| 620 |
throw new CatalogServiceException();
|
635 |
throw new CatalogServiceException();
|
| 621 |
}
|
636 |
}
|
| 622 |
if (t_mpItem.getCurrentSp()< t_mpItem.getMinimumPossibleSp()){
|
637 |
if (t_mpItem.getCurrentSp()< t_mpItem.getMinimumPossibleSp()){
|
| 623 |
sendAlert(t_mpItem.getItemId(),t_mpItem.getCurrentSp(),t_mpItem.getMinimumPossibleSp());
|
638 |
sendAlert(t_mpItem.getItemId(),t_mpItem.getCurrentSp(),t_mpItem.getMinimumPossibleSp());
|
| 624 |
}
|
639 |
}
|
| 625 |
if(Boolean.valueOf(isListedOnFlipkart) && Boolean.valueOf(isSuppressInventoryFeed)){
|
640 |
if(Boolean.valueOf(isListedOnFlipkart) && Boolean.valueOf(live) && (!Boolean.valueOf(isSuppressPriceFeed))){
|
| 626 |
UpdateFlipkartPricing updateFlipkartPricing = new UpdateFlipkartPricing(Float.valueOf(sellingPrice),fkItemCode,item,timestamp);
|
641 |
UpdateFlipkartPricing updateFlipkartPricing = new UpdateFlipkartPricing(Float.valueOf(sellingPrice),fkItemCode,item,timestamp);
|
| 627 |
updateFlipkartPricing.start();
|
642 |
updateFlipkartPricing.start();
|
| 628 |
}
|
643 |
}
|
| 629 |
return "flipkart-update-result";
|
644 |
return "flipkart-update-result";
|
| 630 |
}
|
645 |
}
|