| Line 1... |
Line 1... |
| 1 |
package in.shop2020.catalog.dashboard.server;
|
1 |
package in.shop2020.catalog.dashboard.server;
|
| 2 |
|
2 |
|
| 3 |
import in.shop2020.catalog.dashboard.client.CatalogService;
|
3 |
import in.shop2020.catalog.dashboard.client.CatalogService;
|
| - |
|
4 |
import in.shop2020.catalog.dashboard.shared.BulkItemPricing;
|
| 4 |
import in.shop2020.catalog.dashboard.shared.Item;
|
5 |
import in.shop2020.catalog.dashboard.shared.Item;
|
| 5 |
import in.shop2020.catalog.dashboard.shared.ItemInventory;
|
6 |
import in.shop2020.catalog.dashboard.shared.ItemInventory;
|
| 6 |
import in.shop2020.catalog.dashboard.shared.ItemStatus;
|
7 |
import in.shop2020.catalog.dashboard.shared.ItemStatus;
|
| 7 |
import in.shop2020.catalog.dashboard.shared.ItemWarehouse;
|
8 |
import in.shop2020.catalog.dashboard.shared.ItemWarehouse;
|
| 8 |
import in.shop2020.catalog.dashboard.shared.ItemsComparator;
|
9 |
import in.shop2020.catalog.dashboard.shared.ItemsComparator;
|
| Line 834... |
Line 835... |
| 834 |
tItem.setRetireDate(item.getRetireDate());
|
835 |
tItem.setRetireDate(item.getRetireDate());
|
| 835 |
}
|
836 |
}
|
| 836 |
|
837 |
|
| 837 |
tItem.setUpdatedOn(Calendar.getInstance().getTimeInMillis());
|
838 |
tItem.setUpdatedOn(Calendar.getInstance().getTimeInMillis());
|
| 838 |
tItem.setPackQuantity(item.getPackQuantity());
|
839 |
tItem.setPackQuantity(item.getPackQuantity());
|
| - |
|
840 |
tItem.setQuantityStep(item.getQuantityStep());
|
| - |
|
841 |
tItem.setMinimumBuyQuantity(item.getMinimumBuyQuantity());
|
| 839 |
}
|
842 |
}
|
| 840 |
|
843 |
|
| 841 |
@Override
|
844 |
@Override
|
| 842 |
public void pauseItem(long itemId) {
|
845 |
public void pauseItem(long itemId) {
|
| 843 |
try {
|
846 |
try {
|
| Line 994... |
Line 997... |
| 994 |
}
|
997 |
}
|
| 995 |
|
998 |
|
| 996 |
if(it.getSellingPrice() != null) {
|
999 |
if(it.getSellingPrice() != null) {
|
| 997 |
tItem.setSellingPrice(it.getSellingPrice());
|
1000 |
tItem.setSellingPrice(it.getSellingPrice());
|
| 998 |
}
|
1001 |
}
|
| 999 |
|
1002 |
|
| 1000 |
tItem.setPackQuantity(it.getPackQuantity());
|
1003 |
tItem.setPackQuantity(it.getPackQuantity());
|
| 1001 |
|
1004 |
|
| 1002 |
tItem.setBestDealText(it.getBestDealsText());
|
1005 |
tItem.setBestDealText(it.getBestDealsText());
|
| 1003 |
|
1006 |
|
| 1004 |
if (it.getItemStatusValue() == ItemStatus.ACTIVE.getValue() || it.getItemStatusValue() == ItemStatus.PAUSED.getValue()) {
|
1007 |
if (it.getItemStatusValue() == ItemStatus.ACTIVE.getValue() || it.getItemStatusValue() == ItemStatus.PAUSED.getValue()) {
|
| Line 1091... |
Line 1094... |
| 1091 |
logger.info("Skipping Private deal: " + item.getId());
|
1094 |
logger.info("Skipping Private deal: " + item.getId());
|
| 1092 |
logger.info("Deal Price "+privateDeal.getDealPrice());
|
1095 |
logger.info("Deal Price "+privateDeal.getDealPrice());
|
| 1093 |
logger.info("Deal Start Date "+privateDeal.getStartDate());
|
1096 |
logger.info("Deal Start Date "+privateDeal.getStartDate());
|
| 1094 |
logger.info("Deal End Date "+privateDeal.getEndDate());
|
1097 |
logger.info("Deal End Date "+privateDeal.getEndDate());
|
| 1095 |
}
|
1098 |
}
|
| 1096 |
|
1099 |
|
| 1097 |
} catch (Exception e) {
|
1100 |
} catch (Exception e) {
|
| 1098 |
logger.error("Error while updating prices on production", e);
|
1101 |
logger.error("Error while updating prices on production", e);
|
| 1099 |
return "Error while updating all prices on production. Some of the prices may not have been updated";
|
1102 |
return "Error while updating all prices on production. Some of the prices may not have been updated";
|
| 1100 |
}
|
1103 |
}
|
| 1101 |
}
|
1104 |
}
|
| Line 1507... |
Line 1510... |
| 1507 |
} catch (Exception e) {
|
1510 |
} catch (Exception e) {
|
| 1508 |
logger.error("Error while getting all the categories: ", e);
|
1511 |
logger.error("Error while getting all the categories: ", e);
|
| 1509 |
}
|
1512 |
}
|
| 1510 |
return categoryList;
|
1513 |
return categoryList;
|
| 1511 |
}
|
1514 |
}
|
| 1512 |
|
1515 |
|
| 1513 |
@Override
|
1516 |
@Override
|
| 1514 |
public Map<Long, String> getAllCategoriesMap() {
|
1517 |
public Map<Long, String> getAllCategoriesMap() {
|
| 1515 |
Map<Long, String> categoryList = new TreeMap<Long, String>();
|
1518 |
Map<Long, String> categoryList = new TreeMap<Long, String>();
|
| 1516 |
try {
|
1519 |
try {
|
| 1517 |
CatalogClient catalogServiceClient = new CatalogClient();
|
1520 |
CatalogClient catalogServiceClient = new CatalogClient();
|
| Line 1891... |
Line 1894... |
| 1891 |
stockPurchaseParams.getMinStockLevel(),
|
1894 |
stockPurchaseParams.getMinStockLevel(),
|
| 1892 |
saleHistory,
|
1895 |
saleHistory,
|
| 1893 |
freebieItemId,
|
1896 |
freebieItemId,
|
| 1894 |
thriftItem.getAsin(),
|
1897 |
thriftItem.getAsin(),
|
| 1895 |
thriftItem.getHoldInventory(),
|
1898 |
thriftItem.getHoldInventory(),
|
| 1896 |
thriftItem.getDefaultInventory(),stateNameVatPercentageMap,privateDeal, thriftItem.getPackQuantity());
|
1899 |
thriftItem.getDefaultInventory(),stateNameVatPercentageMap,privateDeal, thriftItem.getPackQuantity(),
|
| - |
|
1900 |
thriftItem.getQuantityStep(),thriftItem.getMinimumBuyQuantity());
|
| 1897 |
return item;
|
1901 |
return item;
|
| 1898 |
}
|
1902 |
}
|
| 1899 |
|
1903 |
|
| 1900 |
@Override
|
1904 |
@Override
|
| 1901 |
public Map<Long, Double> getVatRates(long itemId, long categoryId) {
|
1905 |
public Map<Long, Double> getVatRates(long itemId, long categoryId) {
|
| Line 1958... |
Line 1962... |
| 1958 |
e.printStackTrace();
|
1962 |
e.printStackTrace();
|
| 1959 |
logger.info("Could not update");
|
1963 |
logger.info("Could not update");
|
| 1960 |
return false;
|
1964 |
return false;
|
| 1961 |
}
|
1965 |
}
|
| 1962 |
}
|
1966 |
}
|
| - |
|
1967 |
|
| - |
|
1968 |
public in.shop2020.catalog.dashboard.shared.BulkItemPricing addBulkPricingForItem(BulkItemPricing bulkItemPricing){
|
| - |
|
1969 |
try{
|
| - |
|
1970 |
in.shop2020.model.v1.catalog.BulkItemPricing t_bulkItemPricing = new in.shop2020.model.v1.catalog.BulkItemPricing();
|
| - |
|
1971 |
t_bulkItemPricing.setItem_id(bulkItemPricing.getItem_id());
|
| - |
|
1972 |
t_bulkItemPricing.setPrice(bulkItemPricing.getPrice());
|
| - |
|
1973 |
t_bulkItemPricing.setQuantity(bulkItemPricing.getQuantity());
|
| - |
|
1974 |
Client catalogClient = new CatalogClient().getClient();
|
| - |
|
1975 |
in.shop2020.model.v1.catalog.BulkItemPricing result = catalogClient.addBulkPricingForItem(t_bulkItemPricing);
|
| - |
|
1976 |
in.shop2020.catalog.dashboard.shared.BulkItemPricing bulkItemPricingObj = new in.shop2020.catalog.dashboard.shared.BulkItemPricing(result.getId(), result.getItem_id(), result.getQuantity(), result.getPrice());
|
| - |
|
1977 |
return bulkItemPricingObj;
|
| - |
|
1978 |
}
|
| - |
|
1979 |
catch (Exception e){
|
| - |
|
1980 |
e.printStackTrace();
|
| - |
|
1981 |
logger.info("Could not add bulk pricing");
|
| - |
|
1982 |
return null;
|
| - |
|
1983 |
}
|
| - |
|
1984 |
}
|
| - |
|
1985 |
|
| - |
|
1986 |
public List<in.shop2020.catalog.dashboard.shared.BulkItemPricing> getBulkPricingByItemId(long itemId){
|
| - |
|
1987 |
try{
|
| - |
|
1988 |
List<in.shop2020.catalog.dashboard.shared.BulkItemPricing> listBulkItemPricingObj = new ArrayList<in.shop2020.catalog.dashboard.shared.BulkItemPricing>();
|
| - |
|
1989 |
Client catalogClient = new CatalogClient().getClient();
|
| - |
|
1990 |
List<in.shop2020.model.v1.catalog.BulkItemPricing> t_bulkItemsPricing = catalogClient.getBulkPricingByItemId(itemId);
|
| - |
|
1991 |
for (in.shop2020.model.v1.catalog.BulkItemPricing result : t_bulkItemsPricing){
|
| - |
|
1992 |
in.shop2020.catalog.dashboard.shared.BulkItemPricing bulkItemPricingObj = new in.shop2020.catalog.dashboard.shared.BulkItemPricing(result.getId(), result.getItem_id(), result.getQuantity(), result.getPrice());
|
| - |
|
1993 |
listBulkItemPricingObj.add(bulkItemPricingObj);
|
| - |
|
1994 |
}
|
| - |
|
1995 |
return listBulkItemPricingObj;
|
| - |
|
1996 |
}
|
| - |
|
1997 |
catch (Exception e){
|
| - |
|
1998 |
e.printStackTrace();
|
| - |
|
1999 |
logger.info("Could not get bulk pricing");
|
| - |
|
2000 |
return null;
|
| - |
|
2001 |
}
|
| - |
|
2002 |
}
|
| - |
|
2003 |
|
| - |
|
2004 |
public boolean deleteBulkPricingForItemById(long id){
|
| - |
|
2005 |
try{
|
| - |
|
2006 |
Client catalogClient = new CatalogClient().getClient();
|
| - |
|
2007 |
boolean result = catalogClient.deleteBulkPricingForItemById(id);
|
| - |
|
2008 |
return result;
|
| - |
|
2009 |
}
|
| - |
|
2010 |
catch (Exception e){
|
| - |
|
2011 |
e.printStackTrace();
|
| - |
|
2012 |
logger.info("Could not delete bulk pricing");
|
| - |
|
2013 |
return false;
|
| - |
|
2014 |
}
|
| - |
|
2015 |
}
|
| - |
|
2016 |
|
| - |
|
2017 |
public boolean deleteBulkPricingForItem(long itemId){
|
| - |
|
2018 |
try{
|
| - |
|
2019 |
Client catalogClient = new CatalogClient().getClient();
|
| - |
|
2020 |
boolean result = catalogClient.deleteBulkPricingForItem(itemId);
|
| - |
|
2021 |
return result;
|
| - |
|
2022 |
}
|
| - |
|
2023 |
catch (Exception e){
|
| - |
|
2024 |
e.printStackTrace();
|
| - |
|
2025 |
logger.info("Could not delete all bulk pricing");
|
| - |
|
2026 |
return false;
|
| - |
|
2027 |
}
|
| - |
|
2028 |
}
|
| 1963 |
}
|
2029 |
}
|