Commit 2ebcbca4 by 陈森彬

去掉某些没有采集的平台 powell统计过期率的时候去掉旧数据干扰

parent d8e6d9af
Showing with 13 additions and 7 deletions
...@@ -35,7 +35,6 @@ def get_mongo_conf(): ...@@ -35,7 +35,6 @@ def get_mongo_conf():
filter_pn = ("cdi", "richardsonrfpd", "company", "wpg",) filter_pn = ("cdi", "richardsonrfpd", "company", "wpg",)
class MongoOperator: class MongoOperator:
def __init__(self): def __init__(self):
...@@ -46,9 +45,9 @@ class MongoOperator: ...@@ -46,9 +45,9 @@ class MongoOperator:
self.db = self.conn[config['database']] self.db = self.conn[config['database']]
# element14 chip1stop ti # element14 chip1stop ti
self.colls = ('alliedelec', 'arrow', 'avnet', 'buerklin', 'digikey', 'master', 'rs', 'rochester', self.colls = ('alliedelec', 'arrow', 'avnet', 'buerklin', 'digikey', 'master', 'rs', 'rochester',
'verical', "powell", 'microchip', 'tme', 'heilind', 'maxim', 'aipco', 'company', 'rutronik', 'verical', "powell", 'tme', 'heilind', 'maxim', 'aipco',
'mouser', 'corestaff', 'wpg', 'szlc', 'element14', 'chip1stop', 'future', "nep", "cdi", 'mouser', 'corestaff', 'wpg', 'szlc', 'element14', 'future', "nep", "cdi",
"nac", "richardsonrfpd", "pui") "nac", "richardsonrfpd",)
@staticmethod @staticmethod
def get_unexpired_time(plat): def get_unexpired_time(plat):
...@@ -67,11 +66,18 @@ class MongoOperator: ...@@ -67,11 +66,18 @@ class MongoOperator:
@staticmethod @staticmethod
def get_query(ts, plat): def get_query(ts, plat):
expired_query, total_query = {'time': {"$lt": ts}}, {} expired_query, total_query = {'time': {"$lt": ts}}, {}
if plat not in ('element14', 'chip1stop', 'future'):
if plat in ('element14', 'chip1stop'):
expired_query = {'time': {"$gt": ts}}
elif plat in ("powell",): #powell 里面存在旧数据的需要过滤
expired_query["goods_id"] = {"$gte": 33000494159}
total_query["goods_id"] = {"$gte": 33000494159}
expired_query['is_error'] = 0 expired_query['is_error'] = 0
total_query['is_error'] = 0 total_query['is_error'] = 0
elif plat in ('element14', 'chip1stop'): elif plat not in ('element14', 'chip1stop', 'future'):
expired_query = {'time': {"$gt": ts}} expired_query['is_error'] = 0
total_query['is_error'] = 0
return expired_query, total_query return expired_query, total_query
@staticmethod @staticmethod
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment