| Line 1... |
Line 1... |
| 1 |
package in.shop2020.catalog.dashboard.server;
|
1 |
package in.shop2020.catalog.dashboard.server;
|
| 2 |
|
2 |
|
| - |
|
3 |
import java.io.BufferedReader;
|
| - |
|
4 |
import java.io.FileReader;
|
| - |
|
5 |
import java.io.IOException;
|
| - |
|
6 |
import java.text.DateFormat;
|
| - |
|
7 |
import java.text.SimpleDateFormat;
|
| - |
|
8 |
import java.util.ArrayList;
|
| - |
|
9 |
import java.util.Arrays;
|
| - |
|
10 |
import java.util.Calendar;
|
| - |
|
11 |
import java.util.Collections;
|
| - |
|
12 |
import java.util.Date;
|
| - |
|
13 |
import java.util.HashMap;
|
| - |
|
14 |
import java.util.HashSet;
|
| - |
|
15 |
import java.util.List;
|
| - |
|
16 |
import java.util.Map;
|
| - |
|
17 |
import java.util.Map.Entry;
|
| - |
|
18 |
import java.util.Set;
|
| - |
|
19 |
import java.util.TreeMap;
|
| - |
|
20 |
|
| - |
|
21 |
import org.apache.log4j.Logger;
|
| - |
|
22 |
import org.apache.thrift.TException;
|
| - |
|
23 |
import org.apache.thrift.transport.TTransportException;
|
| - |
|
24 |
|
| - |
|
25 |
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
| - |
|
26 |
|
| 3 |
import in.shop2020.catalog.dashboard.client.CatalogService;
|
27 |
import in.shop2020.catalog.dashboard.client.CatalogService;
|
| 4 |
import in.shop2020.catalog.dashboard.shared.BulkItemPricing;
|
28 |
import in.shop2020.catalog.dashboard.shared.BulkItemPricing;
|
| - |
|
29 |
import in.shop2020.catalog.dashboard.shared.CategoryHsnCode;
|
| 5 |
import in.shop2020.catalog.dashboard.shared.Item;
|
30 |
import in.shop2020.catalog.dashboard.shared.Item;
|
| 6 |
import in.shop2020.catalog.dashboard.shared.ItemInventory;
|
31 |
import in.shop2020.catalog.dashboard.shared.ItemInventory;
|
| 7 |
import in.shop2020.catalog.dashboard.shared.ItemStatus;
|
32 |
import in.shop2020.catalog.dashboard.shared.ItemStatus;
|
| 8 |
import in.shop2020.catalog.dashboard.shared.ItemWarehouse;
|
33 |
import in.shop2020.catalog.dashboard.shared.ItemWarehouse;
|
| 9 |
import in.shop2020.catalog.dashboard.shared.ItemsComparator;
|
34 |
import in.shop2020.catalog.dashboard.shared.ItemsComparator;
|
| Line 32... |
Line 57... |
| 32 |
import in.shop2020.thrift.clients.InventoryClient;
|
57 |
import in.shop2020.thrift.clients.InventoryClient;
|
| 33 |
import in.shop2020.thrift.clients.config.ConfigClient;
|
58 |
import in.shop2020.thrift.clients.config.ConfigClient;
|
| 34 |
import in.shop2020.utils.CategoryManager;
|
59 |
import in.shop2020.utils.CategoryManager;
|
| 35 |
import in.shop2020.utils.ConfigClientKeys;
|
60 |
import in.shop2020.utils.ConfigClientKeys;
|
| 36 |
|
61 |
|
| 37 |
import java.io.BufferedReader;
|
- |
|
| 38 |
import java.io.FileReader;
|
- |
|
| 39 |
import java.io.IOException;
|
- |
|
| 40 |
import java.text.DateFormat;
|
- |
|
| 41 |
import java.text.SimpleDateFormat;
|
- |
|
| 42 |
import java.util.ArrayList;
|
- |
|
| 43 |
import java.util.Arrays;
|
- |
|
| 44 |
import java.util.Calendar;
|
- |
|
| 45 |
import java.util.Collections;
|
- |
|
| 46 |
import java.util.Date;
|
- |
|
| 47 |
import java.util.HashMap;
|
- |
|
| 48 |
import java.util.HashSet;
|
- |
|
| 49 |
import java.util.List;
|
- |
|
| 50 |
import java.util.Map;
|
- |
|
| 51 |
import java.util.Map.Entry;
|
- |
|
| 52 |
import java.util.Set;
|
- |
|
| 53 |
import java.util.TreeMap;
|
- |
|
| 54 |
|
- |
|
| 55 |
import org.apache.log4j.Logger;
|
- |
|
| 56 |
import org.apache.thrift.TException;
|
- |
|
| 57 |
import org.apache.thrift.transport.TTransportException;
|
- |
|
| 58 |
|
- |
|
| 59 |
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
- |
|
| 60 |
|
- |
|
| 61 |
@SuppressWarnings("serial")
|
62 |
@SuppressWarnings("serial")
|
| 62 |
public class CatalogServiceImpl extends RemoteServiceServlet implements CatalogService {
|
63 |
public class CatalogServiceImpl extends RemoteServiceServlet implements CatalogService {
|
| 63 |
|
64 |
|
| 64 |
private static Logger logger = Logger.getLogger(CatalogServiceImpl.class);
|
65 |
private static Logger logger = Logger.getLogger(CatalogServiceImpl.class);
|
| 65 |
|
66 |
|
| Line 672... |
Line 673... |
| 672 |
CatalogClient catalogServiceClient = new CatalogClient();
|
673 |
CatalogClient catalogServiceClient = new CatalogClient();
|
| 673 |
Client catalogClient = catalogServiceClient.getClient();
|
674 |
Client catalogClient = catalogServiceClient.getClient();
|
| 674 |
InventoryClient inventoryServiceClient = new InventoryClient();
|
675 |
InventoryClient inventoryServiceClient = new InventoryClient();
|
| 675 |
in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
|
676 |
in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
|
| 676 |
in.shop2020.model.v1.catalog.Item tItem = new in.shop2020.model.v1.catalog.Item();
|
677 |
in.shop2020.model.v1.catalog.Item tItem = new in.shop2020.model.v1.catalog.Item();
|
| - |
|
678 |
tItem.setHsnCode(item.getHsnCode());
|
| 677 |
item.setQuantityStep(DEFAULTQUANTIYSTEP);
|
679 |
item.setQuantityStep(DEFAULTQUANTIYSTEP);
|
| 678 |
item.setMinimumBuyQuantity(DEFAULTMINBUYQTY);
|
680 |
item.setMinimumBuyQuantity(DEFAULTMINBUYQTY);
|
| 679 |
item.setMaximumBuyQuantity(DEFAULTMAXBUYQTY);
|
681 |
item.setMaximumBuyQuantity(DEFAULTMAXBUYQTY);
|
| 680 |
setThriftItemParams(tItem, item);
|
682 |
setThriftItemParams(tItem, item);
|
| 681 |
itemId = catalogClient.addItem(tItem);
|
683 |
itemId = catalogClient.addItem(tItem);
|
| Line 2048... |
Line 2050... |
| 2048 |
e.printStackTrace();
|
2050 |
e.printStackTrace();
|
| 2049 |
logger.info("Could not delete all bulk pricing");
|
2051 |
logger.info("Could not delete all bulk pricing");
|
| 2050 |
return false;
|
2052 |
return false;
|
| 2051 |
}
|
2053 |
}
|
| 2052 |
}
|
2054 |
}
|
| - |
|
2055 |
|
| - |
|
2056 |
public List<CategoryHsnCode> getHsnCodesByCategoryId(int categoryId) {
|
| - |
|
2057 |
List<CategoryHsnCode> categoryHsnCodes = new ArrayList<CategoryHsnCode>();
|
| - |
|
2058 |
try{
|
| - |
|
2059 |
Client client2 = new CatalogClient().getClient();
|
| - |
|
2060 |
for(in.shop2020.model.v1.catalog.CategoryHsnCode e : client2.getHsnCodesByCategory(categoryId)){
|
| - |
|
2061 |
CategoryHsnCode categoryHsnCode = new CategoryHsnCode();
|
| - |
|
2062 |
categoryHsnCode.setCategoryId(Long.valueOf(e.getCategoryId()).intValue());
|
| - |
|
2063 |
categoryHsnCode.setHsnCode(e.getHsnCode());
|
| - |
|
2064 |
categoryHsnCode.setDescription(e.getDescription());
|
| - |
|
2065 |
categoryHsnCodes.add(categoryHsnCode);
|
| - |
|
2066 |
}
|
| - |
|
2067 |
}catch(Exception e){
|
| - |
|
2068 |
e.printStackTrace();
|
| - |
|
2069 |
logger.info("Could not get Hsn Codes By Category Id");
|
| - |
|
2070 |
}
|
| - |
|
2071 |
return categoryHsnCodes;
|
| - |
|
2072 |
}
|
| - |
|
2073 |
|
| 2053 |
}
|
2074 |
}
|