Subversion Repositories SmartDukaan

Rev

Rev 11173 | Rev 11567 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11173 Rev 11531
Line 9... Line 9...
9
    to_t_banner, to_t_banner_map, to_t_product_notification_request_count, \
9
    to_t_banner, to_t_banner_map, to_t_product_notification_request_count, \
10
    to_t_voucher_item_mapping, to_t_insurer, to_t_Amazonlisted, to_t_ebay_item, \
10
    to_t_voucher_item_mapping, to_t_insurer, to_t_Amazonlisted, to_t_ebay_item, \
11
    to_t_uri_mapping, to_t_banner_list, to_t_campaign,to_t_snapdeal_item, \
11
    to_t_uri_mapping, to_t_banner_list, to_t_campaign,to_t_snapdeal_item, \
12
    to_t_snapdeal_item_details, to_t_product_feed_submit, to_t_marketplace_items, to_t_marketplace_itemprice,\
12
    to_t_snapdeal_item_details, to_t_product_feed_submit, to_t_marketplace_items, to_t_marketplace_itemprice,\
13
    to_t_marketplacepercentage, to_t_flipkart_item, to_t_flipkart_item_details, \
13
    to_t_marketplacepercentage, to_t_flipkart_item, to_t_flipkart_item_details, \
14
    to_t_market_place_history
14
    to_t_market_place_history,to_t_private_deal
15
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
15
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
16
    change_item_status, get_item, get_all_items, get_all_items_by_status, \
16
    change_item_status, get_item, get_all_items, get_all_items_by_status, \
17
    update_item, start_item_on, close_session, retire_item_on, \
17
    update_item, start_item_on, close_session, retire_item_on, \
18
    get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
18
    get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
19
    get_best_deals_count, get_best_sellers, get_latest_arrivals, \
19
    get_best_deals_count, get_best_sellers, get_latest_arrivals, \
Line 58... Line 58...
58
    delete_product_feed_submit, get_all_product_feed_submit, get_snapdeal_item_detail,\
58
    delete_product_feed_submit, get_all_product_feed_submit, get_snapdeal_item_detail,\
59
    get_marketplace_details_for_item, update_marketplace_attributes_for_item,\
59
    get_marketplace_details_for_item, update_marketplace_attributes_for_item,\
60
    get_costing_for_marketplace, get_all_marketplace_items_for_priceupdate, update_marketplace_priceupdate_status, \
60
    get_costing_for_marketplace, get_all_marketplace_items_for_priceupdate, update_marketplace_priceupdate_status, \
61
    update_item_hold_inventory, update_nlc_at_marketplaces, get_all_flipkart_items, get_flipkart_item, \
61
    update_item_hold_inventory, update_nlc_at_marketplaces, get_all_flipkart_items, get_flipkart_item, \
62
    add_or_update_flipkart_item, get_flipkart_item_detail, get_flipkart_items, search_flipkart_items, \
62
    add_or_update_flipkart_item, get_flipkart_item_detail, get_flipkart_items, search_flipkart_items, \
63
    get_count_for_flipkart_items, get_flipkart_search_result_count, get_all_fk_items, get_flipkart_item_by_sku_at_flipkart,\
63
    get_count_for_flipkart_items, get_flipkart_search_result_count, get_all_fk_items, get_flipkart_item_by_sku_at_flipkart, \
64
    get_marketplace_history, get_all_fbb_listed_items, get_count_for_marketplaceHistory, get_marketplace_history_by_date,\
64
    get_marketplace_history, get_all_fbb_listed_items, get_count_for_marketplaceHistory, get_marketplace_history_by_date,\
65
    get_all_fbb_pricing_items
65
    get_all_fbb_pricing_items,get_private_deal_details, get_private_deal_items, add_or_update_private_deal
66
    
-
 
67
from shop2020.thriftpy.model.v1.catalog.ttypes import status
66
from shop2020.thriftpy.model.v1.catalog.ttypes import status
68
from shop2020.utils.Utils import log_entry, to_py_date
67
from shop2020.utils.Utils import log_entry, to_py_date
69
import datetime
68
import datetime
70
 
69
 
71
class CatalogServiceHandler:
70
class CatalogServiceHandler:
Line 1484... Line 1483...
1484
            return [to_t_flipkart_item_details(item,None) for item in get_all_fk_items()]
1483
            return [to_t_flipkart_item_details(item,None) for item in get_all_fk_items()]
1485
        finally:
1484
        finally:
1486
            close_session()
1485
            close_session()
1487
    
1486
    
1488
    def getFlipkartItemBySkyAtFlipkart(self,sku):
1487
    def getFlipkartItemBySkyAtFlipkart(self,sku):
1489
        return to_t_flipkart_item(get_flipkart_item_by_sku_at_flipkart(sku))    
1488
        return to_t_flipkart_item(get_flipkart_item_by_sku_at_flipkart(sku))
1490
    
1489
    
1491
    def getMarketplaceHistory(self,source, offset, itemId):
1490
    def getMarketplaceHistory(self,source, offset, itemId):
1492
        try:
1491
        try:
1493
            return [to_t_market_place_history(item) for item in get_marketplace_history(source, offset, itemId)]
1492
            return [to_t_market_place_history(item) for item in get_marketplace_history(source, offset, itemId)]
1494
        finally:
1493
        finally:
1495
            close_session()    
1494
            close_session()    
1496
    
1495
    
-
 
1496
    
-
 
1497
    def getPrivateDealDetails(self,item_id):
-
 
1498
        try:
-
 
1499
            return to_t_private_deal(get_private_deal_details(item_id))
-
 
1500
        finally:
-
 
1501
            close_session()    
-
 
1502
    
1497
    def getAllFbbListedItems(self):
1503
    def getAllFbbListedItems(self):
1498
        try:
1504
        try:
1499
            items = get_all_fbb_listed_items()
1505
            items = get_all_fbb_listed_items()
1500
            ret_items = []
1506
            ret_items = []
1501
            for item in items:
1507
            for item in items:
Line 1513... Line 1519...
1513
                if item:
1519
                if item:
1514
                    ret_items.append(to_t_Amazonlisted(item))
1520
                    ret_items.append(to_t_Amazonlisted(item))
1515
            return ret_items
1521
            return ret_items
1516
        finally:
1522
        finally:
1517
            close_session()
1523
            close_session()
1518
                
1524
            
1519
    
-
 
1520
    def getMarketplaceHistoryByDate(self,source,startDate,endDate,offset,limit,itemId):
1525
    def getMarketplaceHistoryByDate(self,source,startDate,endDate,offset,limit,itemId):
1521
        try:
1526
        try:
1522
            return [to_t_market_place_history(item) for item in get_marketplace_history_by_date(source,startDate,endDate,offset,limit,itemId)]
1527
            return [to_t_market_place_history(item) for item in get_marketplace_history_by_date(source,startDate,endDate,offset,limit,itemId)]
1523
        finally:
1528
        finally:
1524
            close_session()
1529
            close_session()
Line 1527... Line 1532...
1527
        try:
1532
        try:
1528
            return get_count_for_marketplaceHistory(source,itemId)
1533
            return get_count_for_marketplaceHistory(source,itemId)
1529
        finally:
1534
        finally:
1530
            close_session()
1535
            close_session()
1531
        
1536
        
-
 
1537
           
-
 
1538
            
-
 
1539
    def getPrivateDealItems(self,offset,limit):
-
 
1540
        try:
-
 
1541
            items = []
-
 
1542
            for item in get_private_deal_items(offset,limit):
-
 
1543
                items.append(to_t_item(item))
-
 
1544
            return items 
-
 
1545
        finally:
-
 
1546
            close_session()
-
 
1547
            
-
 
1548
    def addOrUpdatePrivateDeal(self,privatedeal):                
-
 
1549
        try:
-
 
1550
            return add_or_update_private_deal(privatedeal)
-
 
1551
        finally:
-
 
1552
            close_session()    
1532
    
1553
    
1533
if __name__ == '__main__':
1554
if __name__ == '__main__':
1534
    items = get_all_alive_items()
1555
    items = get_all_alive_items()
1535
    ret_items = []
1556
    ret_items = []
1536
    for item in items:
1557
    for item in items: