| Line 10... |
Line 10... |
| 10 |
from shop2020.clients.InventoryClient import InventoryClient
|
10 |
from shop2020.clients.InventoryClient import InventoryClient
|
| 11 |
from shop2020.config.client.ConfigClient import ConfigClient
|
11 |
from shop2020.config.client.ConfigClient import ConfigClient
|
| 12 |
from shop2020.model.v1.catalog.impl import DataService
|
12 |
from shop2020.model.v1.catalog.impl import DataService
|
| 13 |
from shop2020.model.v1.catalog.impl.CategoryManager import CategoryManager
|
13 |
from shop2020.model.v1.catalog.impl.CategoryManager import CategoryManager
|
| 14 |
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, to_t_source, \
|
14 |
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, to_t_source, \
|
| 15 |
to_t_brand_info, to_t_private_deal
|
15 |
to_t_brand_info, to_t_private_deal, to_t_exclusive_affiliate_item_info
|
| 16 |
from shop2020.model.v1.catalog.impl.DataService import Item, ItemChangeLog, \
|
16 |
from shop2020.model.v1.catalog.impl.DataService import Item, ItemChangeLog, \
|
| 17 |
Category, EntityIDGenerator, SimilarItems, ProductNotification, Source, \
|
17 |
Category, EntityIDGenerator, SimilarItems, ProductNotification, Source, \
|
| 18 |
SourceItemPricing, AuthorizationLog, VoucherItemMapping, CategoryVatMaster, \
|
18 |
SourceItemPricing, AuthorizationLog, VoucherItemMapping, CategoryVatMaster, \
|
| 19 |
OOSTracker, EntityTag, ItemInsurerMapping, Insurer, Banner, BannerMap, \
|
19 |
OOSTracker, EntityTag, ItemInsurerMapping, Insurer, Banner, BannerMap, \
|
| 20 |
FreebieItem, BrandInfo, Amazonlisted, StorePricing, ItemVatMaster, \
|
20 |
FreebieItem, BrandInfo, Amazonlisted, StorePricing, ItemVatMaster, \
|
| 21 |
PageViewEvents, CartEvents, EbayItem, BannerUriMapping, Campaign, SnapdealItem, \
|
21 |
PageViewEvents, CartEvents, EbayItem, BannerUriMapping, Campaign, SnapdealItem, \
|
| 22 |
ProductFeedSubmit, MarketplaceItems, MarketPlaceItemPrice, \
|
22 |
ProductFeedSubmit, MarketplaceItems, MarketPlaceItemPrice, \
|
| 23 |
SourcePercentageMaster, SourceItemPercentage, FlipkartItem, MarketPlaceUpdateHistory, \
|
23 |
SourcePercentageMaster, SourceItemPercentage, FlipkartItem, \
|
| - |
|
24 |
MarketPlaceUpdateHistory, SourceCategoryPercentage, MarketPlaceHistory, \
|
| 24 |
SourceCategoryPercentage, MarketPlaceHistory, PrivateDeals, AmazonOutOfSync,PrivateDealsPriceComparison, SourceReturnPercentage, \
|
25 |
PrivateDeals, AmazonOutOfSync, PrivateDealsPriceComparison, \
|
| 25 |
CompetitorPricing, CompetitorPricingRequest, AmazonPromotion
|
26 |
SourceReturnPercentage, CompetitorPricing, CompetitorPricingRequest, \
|
| - |
|
27 |
AmazonPromotion, ExclusiveAffiliateItemInfo, OutboundAffiliateMaster
|
| 26 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
|
28 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
|
| 27 |
ItemType, PremiumType, FreebieItem as t_FreebieItem, \
|
29 |
ItemType, PremiumType, FreebieItem as t_FreebieItem, \
|
| 28 |
StorePricing as tStorePricing, CatalogServiceException, \
|
30 |
StorePricing as tStorePricing, CatalogServiceException, BannerType, InsurerType, \
|
| 29 |
BannerType, InsurerType, Banner as t_banner, CompetitorPricing as TCompetitorPricing
|
31 |
Banner as t_banner, CompetitorPricing as TCompetitorPricing
|
| 30 |
from shop2020.thriftpy.model.v1.inventory.ttypes import VatType, \
|
32 |
from shop2020.thriftpy.model.v1.inventory.ttypes import VatType, \
|
| 31 |
InventoryServiceException, IgnoredInventoryUpdateItems,SnapdealInventoryItem
|
33 |
InventoryServiceException, IgnoredInventoryUpdateItems, SnapdealInventoryItem
|
| 32 |
from shop2020.thriftpy.model.v1.order.ttypes import OrderSource
|
34 |
from shop2020.thriftpy.model.v1.order.ttypes import OrderSource
|
| 33 |
from shop2020.utils import EmailAttachmentSender
|
35 |
from shop2020.utils import EmailAttachmentSender
|
| 34 |
from shop2020.utils.EmailAttachmentSender import mail
|
36 |
from shop2020.utils.EmailAttachmentSender import mail
|
| 35 |
from shop2020.utils.Utils import to_py_date, log_risky_flag
|
37 |
from shop2020.utils.Utils import to_py_date, log_risky_flag
|
| 36 |
from sqlalchemy import desc, asc
|
38 |
from sqlalchemy import desc, asc
|
| 37 |
from sqlalchemy.sql.expression import or_, distinct, func, and_
|
39 |
from sqlalchemy.sql.expression import or_, distinct, func, and_
|
| 38 |
from sqlalchemy.sql.functions import now
|
40 |
from sqlalchemy.sql.functions import now
|
| 39 |
from string import Template
|
41 |
from string import Template
|
| 40 |
import datetime
|
42 |
import datetime
|
| 41 |
import math
|
43 |
import math
|
| 42 |
import sys
|
44 |
import sys
|
| Line 2886... |
Line 2888... |
| 2886 |
|
2888 |
|
| 2887 |
def __get_amazon_promotion_attributes_for_item(item_id):
|
2889 |
def __get_amazon_promotion_attributes_for_item(item_id):
|
| 2888 |
timestamp = datetime.datetime.now()
|
2890 |
timestamp = datetime.datetime.now()
|
| 2889 |
fbaPromo = AmazonPromotion.query.filter(AmazonPromotion.sku=='FBA'+str(item_id)).filter(AmazonPromotion.startDate<=timestamp).filter(AmazonPromotion.endDate>=timestamp).filter(AmazonPromotion.updatedOnMarketplace>to_py_date(0)).order_by(desc(AmazonPromotion.updatedOnMarketplace)).limit(1).all()
|
2891 |
fbaPromo = AmazonPromotion.query.filter(AmazonPromotion.sku=='FBA'+str(item_id)).filter(AmazonPromotion.startDate<=timestamp).filter(AmazonPromotion.endDate>=timestamp).filter(AmazonPromotion.updatedOnMarketplace>to_py_date(0)).order_by(desc(AmazonPromotion.updatedOnMarketplace)).limit(1).all()
|
| 2890 |
fbbPromo = AmazonPromotion.query.filter(AmazonPromotion.sku=='FBB'+str(item_id)).filter(AmazonPromotion.startDate<=timestamp).filter(AmazonPromotion.endDate>=timestamp).filter(AmazonPromotion.updatedOnMarketplace>to_py_date(0)).order_by(desc(AmazonPromotion.updatedOnMarketplace)).limit(1).all()
|
2892 |
fbbPromo = AmazonPromotion.query.filter(AmazonPromotion.sku=='FBB'+str(item_id)).filter(AmazonPromotion.startDate<=timestamp).filter(AmazonPromotion.endDate>=timestamp).filter(AmazonPromotion.updatedOnMarketplace>to_py_date(0)).order_by(desc(AmazonPromotion.updatedOnMarketplace)).limit(1).all()
|
| 2891 |
return fbaPromo, fbbPromo
|
- |
|
| 2892 |
|
2893 |
return fbaPromo, fbbPromo
|
| - |
|
2894 |
|
| - |
|
2895 |
def get_ex_affiliate_item_info():
|
| - |
|
2896 |
query = session.query(ExclusiveAffiliateItemInfo, OutboundAffiliateMaster.name).join((OutboundAffiliateMaster, ExclusiveAffiliateItemInfo.affiliateId==OutboundAffiliateMaster.id)).filter(ExclusiveAffiliateItemInfo.isActive == True).all()
|
| - |
|
2897 |
close_session()
|
| - |
|
2898 |
map = {}
|
| - |
|
2899 |
for q in query:
|
| - |
|
2900 |
map[q[0].itemId]=to_t_exclusive_affiliate_item_info(q)
|
| - |
|
2901 |
return map
|
| - |
|
2902 |
|
| 2893 |
|
2903 |
|