| Line 24... |
Line 24... |
| 24 |
import java.io.FileReader;
|
24 |
import java.io.FileReader;
|
| 25 |
import java.io.IOException;
|
25 |
import java.io.IOException;
|
| 26 |
import java.text.DateFormat;
|
26 |
import java.text.DateFormat;
|
| 27 |
import java.text.SimpleDateFormat;
|
27 |
import java.text.SimpleDateFormat;
|
| 28 |
import java.util.ArrayList;
|
28 |
import java.util.ArrayList;
|
| - |
|
29 |
import java.util.Arrays;
|
| 29 |
import java.util.Calendar;
|
30 |
import java.util.Calendar;
|
| 30 |
import java.util.Collections;
|
31 |
import java.util.Collections;
|
| 31 |
import java.util.Date;
|
32 |
import java.util.Date;
|
| 32 |
import java.util.HashMap;
|
33 |
import java.util.HashMap;
|
| 33 |
import java.util.List;
|
34 |
import java.util.List;
|
| Line 569... |
Line 570... |
| 569 |
|
570 |
|
| 570 |
/**
|
571 |
/**
|
| 571 |
* Retuns list of Items filtered by category (column is product_group in catalog.item table)
|
572 |
* Retuns list of Items filtered by category (column is product_group in catalog.item table)
|
| 572 |
* This list is used to generate master sheet (excel sheet)
|
573 |
* This list is used to generate master sheet (excel sheet)
|
| 573 |
* @param category
|
574 |
* @param category
|
| - |
|
575 |
* @param brand
|
| 574 |
* @return
|
576 |
* @return
|
| 575 |
*/
|
577 |
*/
|
| 576 |
public List<Item> getItemsByCategory(String category) {
|
578 |
public List<Item> getItemsForMasterSheet(String category, String brand) {
|
| 577 |
List<Item> itemList = new ArrayList<Item>();
|
579 |
List<Item> itemList = new ArrayList<Item>();
|
| 578 |
try {
|
580 |
try {
|
| 579 |
CatalogClient catalogServiceClient = new CatalogClient();
|
581 |
CatalogClient catalogServiceClient = new CatalogClient();
|
| 580 |
InventoryService.Client catalogClient = catalogServiceClient.getClient();
|
582 |
InventoryService.Client catalogClient = catalogServiceClient.getClient();
|
| 581 |
|
583 |
|
| 582 |
List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getItemsByCategory(category);
|
584 |
List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getItemsForMasterSheet(category, brand);
|
| 583 |
|
585 |
|
| 584 |
for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
|
586 |
for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
|
| 585 |
List<in.shop2020.model.v1.catalog.VendorItemPricing> vip = catalogClient.getAllItemPricing(thriftItem.getId());
|
587 |
List<in.shop2020.model.v1.catalog.VendorItemPricing> vip = catalogClient.getAllItemPricing(thriftItem.getId());
|
| 586 |
List<in.shop2020.model.v1.catalog.VendorItemMapping> vim = catalogClient.getVendorItemMappings(thriftItem.getId());
|
588 |
List<in.shop2020.model.v1.catalog.VendorItemMapping> vim = catalogClient.getVendorItemMappings(thriftItem.getId());
|
| 587 |
List<in.shop2020.model.v1.catalog.SourceItemPricing> sip = catalogClient.getAllSourcePricing(thriftItem.getId());
|
589 |
List<in.shop2020.model.v1.catalog.SourceItemPricing> sip = catalogClient.getAllSourcePricing(thriftItem.getId());
|
| Line 961... |
Line 963... |
| 961 |
ConfigMap.put("transfer_price_percentage", "2");
|
963 |
ConfigMap.put("transfer_price_percentage", "2");
|
| 962 |
ConfigMap.put("transfer_price_factor", "50");
|
964 |
ConfigMap.put("transfer_price_factor", "50");
|
| 963 |
}
|
965 |
}
|
| 964 |
return ConfigMap;
|
966 |
return ConfigMap;
|
| 965 |
}
|
967 |
}
|
| - |
|
968 |
|
| - |
|
969 |
@Override
|
| - |
|
970 |
public List<String> getAllCategories() {
|
| - |
|
971 |
List<String> categoryList = new ArrayList<String>();
|
| - |
|
972 |
List<Long> parentCategoryIDs = Arrays.asList(new Long[] {(long) 0,(long) 10001,(long) 10009,(long) 10049});
|
| - |
|
973 |
try {
|
| - |
|
974 |
CatalogClient catalogServiceClient = new CatalogClient();
|
| - |
|
975 |
InventoryService.Client catalogClient = catalogServiceClient.getClient();
|
| - |
|
976 |
|
| - |
|
977 |
List<in.shop2020.model.v1.catalog.Category> categories = catalogClient.getAllCategories();
|
| - |
|
978 |
|
| - |
|
979 |
for(in.shop2020.model.v1.catalog.Category category : categories) {
|
| - |
|
980 |
if(!parentCategoryIDs.contains(category.getParent_category_id())){
|
| - |
|
981 |
categoryList.add(category.getDisplay_name());
|
| - |
|
982 |
}
|
| - |
|
983 |
else{
|
| - |
|
984 |
continue;
|
| - |
|
985 |
}
|
| - |
|
986 |
}
|
| - |
|
987 |
} catch (Exception e) {
|
| - |
|
988 |
logger.error("Error while getting all the categories: ", e);
|
| - |
|
989 |
}
|
| - |
|
990 |
return categoryList;
|
| - |
|
991 |
}
|
| - |
|
992 |
|
| - |
|
993 |
@Override
|
| - |
|
994 |
public List<String> getAllBrands() {
|
| - |
|
995 |
List<String> brandsList = new ArrayList<String>();
|
| - |
|
996 |
try {
|
| - |
|
997 |
CatalogClient catalogServiceClient = new CatalogClient();
|
| - |
|
998 |
InventoryService.Client catalogClient = catalogServiceClient.getClient();
|
| - |
|
999 |
|
| - |
|
1000 |
brandsList = catalogClient.getAllBrands();
|
| - |
|
1001 |
} catch (Exception e) {
|
| - |
|
1002 |
logger.error("Error while getting all the categories: ", e);
|
| - |
|
1003 |
}
|
| - |
|
1004 |
return brandsList;
|
| - |
|
1005 |
}
|
| 966 |
}
|
1006 |
}
|
| 967 |
|
1007 |
|