| 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.Item;
|
6 |
import in.shop2020.model.v1.catalog.Item;
|
| 6 |
import in.shop2020.model.v1.catalog.MarketplaceItems;
|
7 |
import in.shop2020.model.v1.catalog.MarketplaceItems;
|
| 7 |
import in.shop2020.model.v1.catalog.MarketplacePercentage;
|
8 |
import in.shop2020.model.v1.catalog.MarketplacePercentage;
|
| Line 17... |
Line 18... |
| 17 |
import in.shop2020.support.utils.ReportsUtils;
|
18 |
import in.shop2020.support.utils.ReportsUtils;
|
| 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 minPosTp;
|
127 |
private String minPosTp;
|
| 126 |
private String vat;
|
128 |
private String vat;
|
| 127 |
private String comparsionResult;
|
129 |
private String comparsionResult;
|
| 128 |
private String maxSp;
|
130 |
private String maxSp;
|
| 129 |
private String nDaySale;
|
131 |
private String nDaySale;
|
| - |
|
132 |
private static String live;
|
| 130 |
|
133 |
|
| 131 |
public String getnDaySale() {
|
134 |
public String getnDaySale() {
|
| 132 |
return nDaySale;
|
135 |
return nDaySale;
|
| 133 |
}
|
136 |
}
|
| 134 |
|
137 |
|
| Line 285... |
Line 288... |
| 285 |
}
|
288 |
}
|
| 286 |
|
289 |
|
| 287 |
public void setSdItemCode(String sdItemCode) {
|
290 |
public void setSdItemCode(String sdItemCode) {
|
| 288 |
this.sdItemCode = sdItemCode;
|
291 |
this.sdItemCode = sdItemCode;
|
| 289 |
}
|
292 |
}
|
| - |
|
293 |
|
| - |
|
294 |
|
| - |
|
295 |
static{
|
| - |
|
296 |
try {
|
| - |
|
297 |
live = ConfigClient.getClient().get("sync_price_on_marketplace");
|
| - |
|
298 |
logger.info("Update_price_on_mp"+live);
|
| - |
|
299 |
} catch (ConfigException e) {
|
| - |
|
300 |
logger.error("Unable to get parameter from the config service", e);
|
| - |
|
301 |
live = "false";
|
| - |
|
302 |
}
|
| - |
|
303 |
}
|
| 290 |
|
304 |
|
| 291 |
public String index() {
|
305 |
public String index() {
|
| 292 |
if (!ReportsUtils.canAccessReport((Long) session.getAttribute(ReportsUtils.ROLE),request.getServletPath())) {
|
306 |
if (!ReportsUtils.canAccessReport((Long) session.getAttribute(ReportsUtils.ROLE),request.getServletPath())) {
|
| 293 |
return "authfail";
|
307 |
return "authfail";
|
| 294 |
}
|
308 |
}
|
| Line 362... |
Line 376... |
| 362 |
mpItem.setEmiFee(mpCosting.getEmiFee());
|
376 |
mpItem.setEmiFee(mpCosting.getEmiFee());
|
| 363 |
mpItem.setReturnProvision(mpCosting.getReturnProvision());
|
377 |
mpItem.setReturnProvision(mpCosting.getReturnProvision());
|
| 364 |
mpItem.setClosingFee(mpCosting.getClosingFee());
|
378 |
mpItem.setClosingFee(mpCosting.getClosingFee());
|
| 365 |
mpItem.setServiceTax(mpCosting.getServiceTax());
|
379 |
mpItem.setServiceTax(mpCosting.getServiceTax());
|
| 366 |
mpItem.setCommission(mpCosting.getCommission());
|
380 |
mpItem.setCommission(mpCosting.getCommission());
|
| - |
|
381 |
mpItem.setPgFee(mpCosting.getPgFee());
|
| 367 |
InventoryClient inventoryServiceClient = new InventoryClient();
|
382 |
InventoryClient inventoryServiceClient = new InventoryClient();
|
| 368 |
in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
|
383 |
in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
|
| 369 |
Warehouse warehouse = inventoryClient.getWarehouse(Long.valueOf(warehouseId));
|
384 |
Warehouse warehouse = inventoryClient.getWarehouse(Long.valueOf(warehouseId));
|
| 370 |
/*if (!(warehouse.getWarehouseType()==WarehouseType.OURS && warehouse.getInventoryType() == InventoryType.GOOD)){
|
385 |
/*if (!(warehouse.getWarehouseType()==WarehouseType.OURS && warehouse.getInventoryType() == InventoryType.GOOD)){
|
| 371 |
throw new InventoryServiceException();
|
386 |
throw new InventoryServiceException();
|
| Line 403... |
Line 418... |
| 403 |
|
418 |
|
| 404 |
if (t_mpItem.getCurrentSp()< t_mpItem.getMinimumPossibleSp()){
|
419 |
if (t_mpItem.getCurrentSp()< t_mpItem.getMinimumPossibleSp()){
|
| 405 |
sendAlert(t_mpItem.getItemId(),t_mpItem.getCurrentSp(),t_mpItem.getMinimumPossibleSp());
|
420 |
sendAlert(t_mpItem.getItemId(),t_mpItem.getCurrentSp(),t_mpItem.getMinimumPossibleSp());
|
| 406 |
}
|
421 |
}
|
| 407 |
logger.info("\nUpdate Method Item Id "+itemId+"\nSelling Price "+sellingPrice+"\nWarehouse Id "+warehouseId+"\nMax Nlc "+maxNlc+"\nUpdated By: "+session.getAttribute(ReportsUtils.USER_NAME).toString());
|
422 |
logger.info("\nUpdate Method Item Id "+itemId+"\nSelling Price "+sellingPrice+"\nWarehouse Id "+warehouseId+"\nMax Nlc "+maxNlc+"\nUpdated By: "+session.getAttribute(ReportsUtils.USER_NAME).toString());
|
| 408 |
if(oldPrice!=Double.valueOf(sellingPrice)){
|
423 |
if(oldPrice!=Double.valueOf(sellingPrice) && Boolean.valueOf(live) && snapdealItem.isSuppressPriceFeed() && snapdealItem.isIsListedOnSnapdeal()){
|
| 409 |
logger.info("Calling Method to update price at snapdeal");
|
424 |
logger.info("Calling Method to update price at snapdeal");
|
| 410 |
UpdateSDPricingUsingPanel updatePriceOnSnapdeal = new UpdateSDPricingUsingPanel(Float.valueOf(sellingPrice),supc,item,timestamp);
|
425 |
UpdateSDPricingUsingPanel updatePriceOnSnapdeal = new UpdateSDPricingUsingPanel(Float.valueOf(sellingPrice),supc,item,timestamp);
|
| 411 |
logger.info("Calling Thread to update price at snapdeal");
|
426 |
logger.info("Calling Thread to update price at snapdeal");
|
| 412 |
updatePriceOnSnapdeal.start();
|
427 |
updatePriceOnSnapdeal.start();
|
| 413 |
}
|
428 |
}
|
| Line 422... |
Line 437... |
| 422 |
UpdateSDPricingUsingPanel updatePriceOnSnapdeal = new UpdateSDPricingUsingPanel(Float.valueOf(sellingPrice),supc,item,System.currentTimeMillis());
|
437 |
UpdateSDPricingUsingPanel updatePriceOnSnapdeal = new UpdateSDPricingUsingPanel(Float.valueOf(sellingPrice),supc,item,System.currentTimeMillis());
|
| 423 |
logger.info("Calling Thread to update price at snapdeal for auto pricing");
|
438 |
logger.info("Calling Thread to update price at snapdeal for auto pricing");
|
| 424 |
updatePriceOnSnapdeal.start();
|
439 |
updatePriceOnSnapdeal.start();
|
| 425 |
}
|
440 |
}
|
| 426 |
|
441 |
|
| - |
|
442 |
|
| 427 |
public boolean compareParameters(MarketplaceItems mpItem, SnapdealItem snapdealItem, Warehouse warehouse,double weight) throws TException, JSONException, CatalogServiceException{
|
443 |
public boolean compareParameters(MarketplaceItems mpItem, SnapdealItem snapdealItem, Warehouse warehouse,double weight) throws TException, JSONException, CatalogServiceException{
|
| 428 |
double nlc =getNlcForWarehouse(snapdealItem.getWarehouseId(),snapdealItem.getItem_id());
|
444 |
double nlc =getNlcForWarehouse(snapdealItem.getWarehouseId(),snapdealItem.getItem_id());
|
| 429 |
double vat = (snapdealItem.getSellingPrice()/(1+(mpItem.getVat()/100))-(nlc/(1+(mpItem.getVat()/100))))*(mpItem.getVat()/100);
|
445 |
double vat = (snapdealItem.getSellingPrice()/(1+(mpItem.getVat()/100))-(nlc/(1+(mpItem.getVat()/100))))*(mpItem.getVat()/100);
|
| 430 |
double inHouseCost = 15+vat+(mpItem.getReturnProvision()/100)*snapdealItem.getSellingPrice()+mpItem.getOtherCost();
|
446 |
double inHouseCost = 15+vat+(mpItem.getReturnProvision()/100)*snapdealItem.getSellingPrice()+mpItem.getOtherCost();
|
| 431 |
double lowest_possible_tp = nlc+inHouseCost;
|
447 |
double lowest_possible_tp = nlc+inHouseCost;
|
| 432 |
double our_tp = snapdealItem.getSellingPrice()- snapdealItem.getSellingPrice()*(mpItem.getCommission()/100+mpItem.getEmiFee()/100)*(1+(mpItem.getServiceTax()/100))-(snapdealItem.getCourierCost()+mpItem.getClosingFee())*(1+(mpItem.getServiceTax()/100));
|
448 |
double our_tp = snapdealItem.getSellingPrice()- snapdealItem.getSellingPrice()*((mpItem.getCommission()/100)+mpItem.getEmiFee()/100)*(1+(mpItem.getServiceTax()/100))-(snapdealItem.getCourierCost()+mpItem.getClosingFee())*(1+(mpItem.getServiceTax()/100))-(Math.max(20,(mpItem.getPgFee()/100)*snapdealItem.getSellingPrice())*(1+(mpItem.getServiceTax()/100)));
|
| - |
|
449 |
double commission=0.0;
|
| - |
|
450 |
if ((mpItem.getPgFee()/100)*snapdealItem.getSellingPrice()>=20){
|
| - |
|
451 |
commission = (((mpItem.getCommission()/100)+mpItem.getPgFee()/100)*snapdealItem.getSellingPrice());
|
| - |
|
452 |
}
|
| - |
|
453 |
else{
|
| 433 |
double commission = ((mpItem.getCommission()/100)*snapdealItem.getSellingPrice());
|
454 |
commission = ((mpItem.getCommission()/100)*snapdealItem.getSellingPrice()+20);
|
| - |
|
455 |
}
|
| 434 |
double service_tax = (mpItem.getServiceTax()/100)*(snapdealItem.getCommission()+snapdealItem.getCourierCost());
|
456 |
double service_tax = (mpItem.getServiceTax()/100)*(snapdealItem.getCommission()+snapdealItem.getCourierCost());
|
| 435 |
double lowest_possible_sp = (nlc+(snapdealItem.getCourierCost()+mpItem.getClosingFee())*(1+(mpItem.getServiceTax()/100))*(1+(mpItem.getVat()/100))+(15+mpItem.getOtherCost())*(1+(mpItem.getVat())/100))/(1-(mpItem.getCommission()/100+mpItem.getEmiFee()/100)*(1+(mpItem.getServiceTax()/100))*(1+(mpItem.getVat())/100)-(mpItem.getReturnProvision()/100)*(1+(mpItem.getVat())/100));
|
457 |
double lowest_possible_sp = 0.0;
|
| - |
|
458 |
if ((mpItem.getPgFee()/100)*snapdealItem.getSellingPrice()>=20){
|
| - |
|
459 |
lowest_possible_sp = (nlc+(snapdealItem.getCourierCost()+mpItem.getClosingFee())*(1+(mpItem.getServiceTax()/100))*(1+(mpItem.getVat()/100))+(15+mpItem.getOtherCost())*(1+(mpItem.getVat())/100))/(1-((mpItem.getCommission()/100)+mpItem.getEmiFee()/100+mpItem.getPgFee()/100)*(1+(mpItem.getServiceTax()/100))*(1+(mpItem.getVat())/100)-(mpItem.getReturnProvision()/100)*(1+(mpItem.getVat())/100));
|
| - |
|
460 |
}
|
| - |
|
461 |
else{
|
| - |
|
462 |
lowest_possible_sp = (nlc+(snapdealItem.getCourierCost()+mpItem.getClosingFee()+20)*(1+(mpItem.getServiceTax()/100))*(1+(mpItem.getVat()/100))+(15+mpItem.getOtherCost())*(1+(mpItem.getVat())/100))/(1-((mpItem.getCommission()/100)+mpItem.getEmiFee()/100)*(1+(mpItem.getServiceTax()/100))*(1+(mpItem.getVat())/100)-(mpItem.getReturnProvision()/100)*(1+(mpItem.getVat())/100));
|
| - |
|
463 |
}
|
| 436 |
double vat_rate_prod = getVatRateForItem(warehouse,snapdealItem.getSellingPrice(),snapdealItem.getItem_id());
|
464 |
double vat_rate_prod = getVatRateForItem(warehouse,snapdealItem.getSellingPrice(),snapdealItem.getItem_id());
|
| 437 |
JSONObject x = new JSONObject();
|
465 |
JSONObject x = new JSONObject();
|
| 438 |
x.put("NLC", nlc);
|
466 |
x.put("NLC", nlc);
|
| 439 |
x.put("VAT", vat);
|
467 |
x.put("VAT", vat);
|
| 440 |
x.put("COURIER COST",getCourierCost(weight));
|
468 |
x.put("COURIER COST",getCourierCost(weight));
|
| Line 614... |
Line 642... |
| 614 |
t_mpItem.setCommission(mpCosting.getCommission());
|
642 |
t_mpItem.setCommission(mpCosting.getCommission());
|
| 615 |
t_mpItem.setServiceTax(mpCosting.getServiceTax());
|
643 |
t_mpItem.setServiceTax(mpCosting.getServiceTax());
|
| 616 |
t_mpItem.setReturnProvision(mpCosting.getReturnProvision());
|
644 |
t_mpItem.setReturnProvision(mpCosting.getReturnProvision());
|
| 617 |
t_mpItem.setEmiFee(mpCosting.getEmiFee());
|
645 |
t_mpItem.setEmiFee(mpCosting.getEmiFee());
|
| 618 |
t_mpItem.setClosingFee(mpCosting.getClosingFee());
|
646 |
t_mpItem.setClosingFee(mpCosting.getClosingFee());
|
| - |
|
647 |
t_mpItem.setPgFee(mpCosting.getPgFee());
|
| 619 |
if(!compareParameters(t_mpItem,snapdealItem,warehouse,item.getWeight())){
|
648 |
if(!compareParameters(t_mpItem,snapdealItem,warehouse,item.getWeight())){
|
| 620 |
setComparsionResult("0");
|
649 |
setComparsionResult("0");
|
| 621 |
return "snapdeal-update-result";
|
650 |
return "snapdeal-update-result";
|
| 622 |
}
|
651 |
}
|
| 623 |
else{
|
652 |
else{
|
| Line 630... |
Line 659... |
| 630 |
throw new CatalogServiceException();
|
659 |
throw new CatalogServiceException();
|
| 631 |
}
|
660 |
}
|
| 632 |
if (t_mpItem.getCurrentSp()< t_mpItem.getMinimumPossibleSp()){
|
661 |
if (t_mpItem.getCurrentSp()< t_mpItem.getMinimumPossibleSp()){
|
| 633 |
sendAlert(t_mpItem.getItemId(),t_mpItem.getCurrentSp(),t_mpItem.getMinimumPossibleSp());
|
662 |
sendAlert(t_mpItem.getItemId(),t_mpItem.getCurrentSp(),t_mpItem.getMinimumPossibleSp());
|
| 634 |
}
|
663 |
}
|
| - |
|
664 |
if (Boolean.valueOf(live) && snapdealItem.isSuppressPriceFeed() && snapdealItem.isIsListedOnSnapdeal()){
|
| 635 |
logger.info("Calling Method to update new item price at snapdeal");
|
665 |
logger.info("Calling Method to update new item price at snapdeal");
|
| 636 |
UpdateSDPricingUsingPanel updatePriceOnSnapdeal = new UpdateSDPricingUsingPanel(Float.valueOf(sellingPrice),supc,item,timestamp);
|
666 |
UpdateSDPricingUsingPanel updatePriceOnSnapdeal = new UpdateSDPricingUsingPanel(Float.valueOf(sellingPrice),supc,item,timestamp);
|
| 637 |
logger.info("Calling Thread to update new item price at snapdeal");
|
667 |
logger.info("Calling Thread to update new item price at snapdeal");
|
| 638 |
updatePriceOnSnapdeal.start();
|
668 |
updatePriceOnSnapdeal.start();
|
| - |
|
669 |
}
|
| 639 |
return "snapdeal-update-result";
|
670 |
return "snapdeal-update-result";
|
| 640 |
}
|
671 |
}
|
| 641 |
|
672 |
|
| 642 |
|
673 |
|
| 643 |
public String getAddNewItemForm(){
|
674 |
public String getAddNewItemForm(){
|
| Line 683... |
Line 714... |
| 683 |
itemObj.put("CommissionRate", mpCosting.getCommission());
|
714 |
itemObj.put("CommissionRate", mpCosting.getCommission());
|
| 684 |
itemObj.put("ServiceTaxRate", mpCosting.getServiceTax());
|
715 |
itemObj.put("ServiceTaxRate", mpCosting.getServiceTax());
|
| 685 |
itemObj.put("ReturnProvision", mpCosting.getReturnProvision());
|
716 |
itemObj.put("ReturnProvision", mpCosting.getReturnProvision());
|
| 686 |
itemObj.put("EmiFee", mpCosting.getEmiFee());
|
717 |
itemObj.put("EmiFee", mpCosting.getEmiFee());
|
| 687 |
itemObj.put("ClosingFee", mpCosting.getClosingFee());
|
718 |
itemObj.put("ClosingFee", mpCosting.getClosingFee());
|
| - |
|
719 |
itemObj.put("PgFee", mpCosting.getPgFee());
|
| 688 |
return "item-details-json";
|
720 |
return "item-details-json";
|
| 689 |
}
|
721 |
}
|
| 690 |
|
722 |
|
| 691 |
public String ke$ha() throws NumberFormatException, TException, JSONException, InventoryServiceException, CatalogServiceException{
|
723 |
public String ke$ha() throws NumberFormatException, TException, JSONException, InventoryServiceException, CatalogServiceException{
|
| 692 |
Client catalogClientProd = new CatalogClient().getClient();
|
724 |
Client catalogClientProd = new CatalogClient().getClient();
|
| Line 946... |
Line 978... |
| 946 |
marketplaceItem.setCommission(mpCosting.getCommission());
|
978 |
marketplaceItem.setCommission(mpCosting.getCommission());
|
| 947 |
marketplaceItem.setServiceTax(mpCosting.getServiceTax());
|
979 |
marketplaceItem.setServiceTax(mpCosting.getServiceTax());
|
| 948 |
marketplaceItem.setReturnProvision(mpCosting.getReturnProvision());
|
980 |
marketplaceItem.setReturnProvision(mpCosting.getReturnProvision());
|
| 949 |
marketplaceItem.setEmiFee(mpCosting.getEmiFee());
|
981 |
marketplaceItem.setEmiFee(mpCosting.getEmiFee());
|
| 950 |
marketplaceItem.setClosingFee(mpCosting.getClosingFee());
|
982 |
marketplaceItem.setClosingFee(mpCosting.getClosingFee());
|
| - |
|
983 |
marketplaceItem.setPgFee(mpCosting.getPgFee());
|
| 951 |
|
984 |
|
| 952 |
try {
|
985 |
try {
|
| 953 |
item = catalogClient.getItem(sku);
|
986 |
item = catalogClient.getItem(sku);
|
| 954 |
if (item.getId()==0){
|
987 |
if (item.getId()==0){
|
| 955 |
sb.append(sku + " Item not valid"+"\n");
|
988 |
sb.append(sku + " Item not valid"+"\n");
|
| Line 1086... |
Line 1119... |
| 1086 |
}
|
1119 |
}
|
| 1087 |
|
1120 |
|
| 1088 |
warehouse = inventoryClient.getWarehouse(snapdealItem.getWarehouseId());
|
1121 |
warehouse = inventoryClient.getWarehouse(snapdealItem.getWarehouseId());
|
| 1089 |
snapdealItem.setCourierCost(courierCost);
|
1122 |
snapdealItem.setCourierCost(courierCost);
|
| 1090 |
marketplaceItem.setCourierCost(courierCost);
|
1123 |
marketplaceItem.setCourierCost(courierCost);
|
| 1091 |
transferPrice = roundTwoDecimals(snapdealItem.getSellingPrice()- snapdealItem.getSellingPrice()*(marketplaceItem.getCommission()/100+marketplaceItem.getEmiFee()/100)*(1+(marketplaceItem.getServiceTax()/100))-(snapdealItem.getCourierCost()+marketplaceItem.getClosingFee())*(1+(marketplaceItem.getServiceTax()/100)));
|
1124 |
transferPrice = roundTwoDecimals(snapdealItem.getSellingPrice()- snapdealItem.getSellingPrice()*((marketplaceItem.getCommission()/100)+marketplaceItem.getEmiFee()/100)*(1+(marketplaceItem.getServiceTax()/100))-(snapdealItem.getCourierCost()+marketplaceItem.getClosingFee())*(1+(marketplaceItem.getServiceTax()/100))-(Math.max(20,(marketplaceItem.getPgFee()/100)*snapdealItem.getSellingPrice())*(1+(marketplaceItem.getServiceTax()/100))));
|
| 1092 |
snapdealItem.setTransferPrice(transferPrice);
|
1125 |
snapdealItem.setTransferPrice(transferPrice);
|
| 1093 |
marketplaceItem.setCurrentTp(transferPrice);
|
1126 |
marketplaceItem.setCurrentTp(transferPrice);
|
| - |
|
1127 |
if ((marketplaceItem.getPgFee()/100)*snapdealItem.getSellingPrice()>=20){
|
| - |
|
1128 |
commission = (((marketplaceItem.getCommission()/100)+marketplaceItem.getPgFee()/100)*snapdealItem.getSellingPrice());
|
| - |
|
1129 |
}
|
| - |
|
1130 |
else{
|
| 1094 |
commission = roundTwoDecimals(((marketplaceItem.getCommission()/100)*snapdealItem.getSellingPrice()));
|
1131 |
commission = ((marketplaceItem.getCommission()/100)*snapdealItem.getSellingPrice()+20);
|
| - |
|
1132 |
}
|
| - |
|
1133 |
commission = roundTwoDecimals(commission);
|
| 1095 |
snapdealItem.setCommission(commission);
|
1134 |
snapdealItem.setCommission(commission);
|
| 1096 |
serviceTax = roundTwoDecimals((marketplaceItem.getServiceTax()/100)*(snapdealItem.getCommission()+snapdealItem.getCourierCost()));
|
1135 |
serviceTax = roundTwoDecimals((marketplaceItem.getServiceTax()/100)*(snapdealItem.getCommission()+snapdealItem.getCourierCost()));
|
| 1097 |
snapdealItem.setServiceTax(serviceTax);
|
1136 |
snapdealItem.setServiceTax(serviceTax);
|
| 1098 |
double vatRate = catalogClientProd.getVatPercentageForItem(snapdealItem.getItem_id(),warehouse.getStateId(),snapdealItem.getSellingPrice());
|
1137 |
double vatRate = catalogClientProd.getVatPercentageForItem(snapdealItem.getItem_id(),warehouse.getStateId(),snapdealItem.getSellingPrice());
|
| 1099 |
marketplaceItem.setVat(vatRate);
|
1138 |
marketplaceItem.setVat(vatRate);
|
| 1100 |
double vat = roundTwoDecimals((snapdealItem.getSellingPrice()/(1+(marketplaceItem.getVat()/100))-(snapdealItem.getMaxNlc()/(1+(marketplaceItem.getVat()/100))))*(marketplaceItem.getVat()/100));
|
1139 |
double vat = roundTwoDecimals((snapdealItem.getSellingPrice()/(1+(marketplaceItem.getVat()/100))-(snapdealItem.getMaxNlc()/(1+(marketplaceItem.getVat()/100))))*(marketplaceItem.getVat()/100));
|
| 1101 |
double inHouseCost = roundTwoDecimals(15+vat+(marketplaceItem.getReturnProvision()/100)*snapdealItem.getSellingPrice()+marketplaceItem.getOtherCost());
|
1140 |
double inHouseCost = roundTwoDecimals(15+vat+(marketplaceItem.getReturnProvision()/100)*snapdealItem.getSellingPrice()+marketplaceItem.getOtherCost());
|
| 1102 |
double lowest_possible_tp = roundTwoDecimals(snapdealItem.getMaxNlc()+inHouseCost);
|
1141 |
double lowest_possible_tp = roundTwoDecimals(snapdealItem.getMaxNlc()+inHouseCost);
|
| 1103 |
marketplaceItem.setMinimumPossibleTp(lowest_possible_tp);
|
1142 |
marketplaceItem.setMinimumPossibleTp(lowest_possible_tp);
|
| - |
|
1143 |
double lowest_possible_sp=0.0;
|
| - |
|
1144 |
if ((marketplaceItem.getPgFee()/100)*snapdealItem.getSellingPrice()>=20){
|
| 1104 |
double lowest_possible_sp = roundTwoDecimals((snapdealItem.getMaxNlc()+(snapdealItem.getCourierCost()+marketplaceItem.getClosingFee())*(1+marketplaceItem.getServiceTax()/100)*(1+(marketplaceItem.getVat()/100))+(15+marketplaceItem.getOtherCost())*(1+(marketplaceItem.getVat())/100))/(1-(marketplaceItem.getCommission()/100+marketplaceItem.getEmiFee()/100)*(1+(marketplaceItem.getServiceTax()/100))*(1+(marketplaceItem.getVat())/100)-(marketplaceItem.getReturnProvision()/100)*(1+(marketplaceItem.getVat())/100)));
|
1145 |
lowest_possible_sp = roundTwoDecimals((snapdealItem.getMaxNlc()+(snapdealItem.getCourierCost()+marketplaceItem.getClosingFee())*(1+marketplaceItem.getServiceTax()/100)*(1+(marketplaceItem.getVat()/100))+(15+marketplaceItem.getOtherCost())*(1+(marketplaceItem.getVat())/100))/(1-((marketplaceItem.getCommission()/100)+marketplaceItem.getEmiFee()/100+marketplaceItem.getPgFee()/100)*(1+(marketplaceItem.getServiceTax()/100))*(1+(marketplaceItem.getVat())/100)-(marketplaceItem.getReturnProvision()/100)*(1+(marketplaceItem.getVat())/100)));
|
| - |
|
1146 |
}
|
| - |
|
1147 |
else{
|
| - |
|
1148 |
lowest_possible_sp = roundTwoDecimals((snapdealItem.getMaxNlc()+(snapdealItem.getCourierCost()+marketplaceItem.getClosingFee()+20)*(1+marketplaceItem.getServiceTax()/100)*(1+(marketplaceItem.getVat()/100))+(15+marketplaceItem.getOtherCost())*(1+(marketplaceItem.getVat())/100))/(1-((marketplaceItem.getCommission()/100)+marketplaceItem.getEmiFee()/100)*(1+(marketplaceItem.getServiceTax()/100))*(1+(marketplaceItem.getVat())/100)-(marketplaceItem.getReturnProvision()/100)*(1+(marketplaceItem.getVat())/100)));
|
| - |
|
1149 |
}
|
| 1105 |
marketplaceItem.setMinimumPossibleSp(lowest_possible_sp);
|
1150 |
marketplaceItem.setMinimumPossibleSp(lowest_possible_sp);
|
| 1106 |
snapdealItem.setUpdatedBy(updatedBy);
|
1151 |
snapdealItem.setUpdatedBy(updatedBy);
|
| 1107 |
snapdealItem.setMarketplaceItems(marketplaceItem);
|
1152 |
snapdealItem.setMarketplaceItems(marketplaceItem);
|
| 1108 |
//logger.info(snapdealItem.toString());
|
1153 |
//logger.info(snapdealItem.toString());
|
| 1109 |
if(!catalogClient.addOrUpdateSnapdealItem(snapdealItem)){
|
1154 |
if(!catalogClient.addOrUpdateSnapdealItem(snapdealItem)){
|
| Line 1426... |
Line 1471... |
| 1426 |
return name!=null?name:"";
|
1471 |
return name!=null?name:"";
|
| 1427 |
}
|
1472 |
}
|
| 1428 |
|
1473 |
|
| 1429 |
|
1474 |
|
| 1430 |
|
1475 |
|
| 1431 |
}
|
- |
|
| 1432 |
|
1476 |
}
|
| - |
|
1477 |
|